{"_id":"@aglit-ai/sdk","_rev":"6-ef796b99ec18e145a4c704e1dc785b87","name":"@aglit-ai/sdk","dist-tags":{"latest":"0.1.10"},"versions":{"0.1.9":{"name":"@aglit-ai/sdk","version":"0.1.9","keywords":["aglit-ai","sdk","tool-builder","automation"],"author":{"name":"Aglit AI","email":"support@aglit.ai"},"license":"Aglit AI Commercial License","_id":"@aglit-ai/sdk@0.1.9","maintainers":[{"name":"aglit-ai-dev","email":"developers@aglit.ai"}],"homepage":"https://github.com/Aglit-AI/monorepo/tree/main/packages/sdk","bugs":{"url":"https://github.com/Aglit-AI/monorepo/issues"},"dist":{"shasum":"c80a0f6c8f14fe30167e2acfde5e7d349bf3bc75","tarball":"https://registry.npmjs.org/@aglit-ai/sdk/-/sdk-0.1.9.tgz","fileCount":26,"integrity":"sha512-m345ZZHQ1zcydxpqtk0++J7F9MKTkUk+Sm6TUvCQTT6W0eBGCgbo2M2PdYvuZanMxt5mhWF+shU7Sv1XeA+6BA==","signatures":[{"sig":"MEUCIBd+iRtbhzbsScU+ENtL+xzas8QDedH36WOOpCR+ky85AiEA9J2QhKTpwRGTJtNIoXJMBf+RDEqffISppCovE6lIWrk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136616},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","gitHead":"7a2d60f399432531a8397b9cfd9386c4d250790a","private":false,"scripts":{"dev":"tsc --watch","test":"npm run test:examples","build":"node scripts/build-production.js","clean":"rm -rf dist","deploy":"node scripts/deploy.js","build:dev":"tsc","publish:go":"node scripts/publish-go.js","type-check":"tsc --noEmit","generate:all":"node scripts/generate-all-clients.js","test:examples":"SERVER_PORT=49217 node examples/run-all.js","generate:clients":"node scripts/generate-openapi-client.js","generate:languages":"node scripts/generate-clients.js"},"_npmUser":{"name":"aglit-ai-dev","email":"developers@aglit.ai"},"repository":{"url":"git+https://github.com/Aglit-AI/monorepo.git","type":"git"},"_npmVersion":"10.9.4","description":"Aglit AI SDK helpers + OpenAPI-driven client generation entrypoints","directories":{},"_nodeVersion":"22.20.0","dependencies":{"@aglit-ai/types":"workspace:*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"openai":"^4.104.0","esbuild":"^0.23.0","prettier":"^3.6.2","typescript":"^5.5.4","@types/uuid":"^11.0.0","javascript-obfuscator":"^4.1.1","@openapitools/openapi-generator-cli":"^2.25.2"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.9_1769909745080_0.4285177963240543","host":"s3://npm-registry-packages-npm-production"}},"0.1.10":{"name":"@aglit-ai/sdk","version":"0.1.10","private":false,"description":"Aglit AI SDK helpers + OpenAPI-driven client generation entrypoints","author":{"name":"Aglit AI","email":"support@aglit.ai"},"license":"Aglit AI Commercial License","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","scripts":{"build":"node scripts/build-production.js","build:dev":"tsc","dev":"tsc --watch","type-check":"tsc --noEmit","clean":"rm -rf dist","test":"npm run test:examples","generate:clients":"node scripts/generate-openapi-client.js","generate:all":"node scripts/generate-all-clients.js","generate:languages":"node scripts/generate-clients.js","test:examples":"SERVER_PORT=49217 node examples/run-all.js","deploy":"node scripts/deploy.js","publish:go":"node scripts/publish-go.js"},"dependencies":{"@aglit-ai/types":"workspace:*"},"devDependencies":{"@openapitools/openapi-generator-cli":"^2.25.2","@types/uuid":"^11.0.0","esbuild":"^0.23.0","javascript-obfuscator":"^4.1.1","openai":"^4.104.0","prettier":"^3.6.2","typescript":"^5.5.4"},"keywords":["aglit-ai","sdk","tool-builder","automation"],"homepage":"https://github.com/Aglit-AI/monorepo/tree/main/packages/sdk","bugs":{"url":"https://github.com/Aglit-AI/monorepo/issues"},"repository":{"type":"git","url":"git+https://github.com/Aglit-AI/monorepo.git"},"publishConfig":{"access":"public"},"_id":"@aglit-ai/sdk@0.1.10","gitHead":"2a296d4b788179920805040fa86b1dd3d5578617","_nodeVersion":"22.20.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-BIHh86iIJ9UnobaaKES2rbULIV7g5Ig1g4B/foZ1/H+dwhYwOPAmVj7k2Z000MsyDEk2FSu7AExD7vKjdn4U/w==","shasum":"0103c68735320b5b897de49b7bf810a789d3bdde","tarball":"https://registry.npmjs.org/@aglit-ai/sdk/-/sdk-0.1.10.tgz","fileCount":26,"unpackedSize":150809,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAPQKZWqKOxlHnRYJlENC/nlgdPEUlVQGK469Zaly+8QAiEAzEGhlQXl3dvAKMIwmlDi1RVaB6UYmPliTYl1jgcYed4="}]},"_npmUser":{"name":"aglit-ai-dev","email":"developers@aglit.ai"},"directories":{},"maintainers":[{"name":"aglit-ai-dev","email":"developers@aglit.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.10_1772089968418_0.6318058939957394"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-01T01:35:44.900Z","modified":"2026-02-26T07:12:48.674Z","0.1.0":"2025-12-19T21:48:45.085Z","0.1.9":"2026-02-01T01:35:45.240Z","0.1.10":"2026-02-26T07:12:48.557Z"},"bugs":{"url":"https://github.com/Aglit-AI/monorepo/issues"},"author":{"name":"Aglit AI","email":"support@aglit.ai"},"license":"Aglit AI Commercial License","homepage":"https://github.com/Aglit-AI/monorepo/tree/main/packages/sdk","keywords":["aglit-ai","sdk","tool-builder","automation"],"repository":{"type":"git","url":"git+https://github.com/Aglit-AI/monorepo.git"},"description":"Aglit AI SDK helpers + OpenAPI-driven client generation entrypoints","maintainers":[{"name":"aglit-ai-dev","email":"developers@aglit.ai"}],"readme":"# `@aglit-ai/sdk`\n\nMIT-licensed SDK for building against the Aglit AI desktop API and tool runtime.\n\n- Requires the Aglit AI desktop app/API running locally\n- Type-safe `fetch` wrapper for the desktop API\n- JSON-RPC tool executor with a required `x_aglit_ai_tool_reason`\n- OpenAPI specs for Desktop + Tool Builder + Provider SPI APIs\n\n> You must have the Aglit AI desktop app/API running locally (localhost). Set `SERVER_PORT`/`PORT`/`AGLIT_DESKTOP_BASE_URL` as needed.\n\n## Install\n\n```bash\npnpm add @aglit-ai/sdk\n# or: npm install @aglit-ai/sdk\n```\n\n## Quick Start (TypeScript)\n\n```ts\nimport { createDesktopClient, executeTool } from '@aglit-ai/sdk';\n\nconst SERVER_PORT = process.env.SERVER_PORT ?? '49117';\nconst baseUrl = `http://127.0.0.1:${SERVER_PORT}`;\nconst agentId = 'root-agent';\n\nconst desktop = createDesktopClient({ baseUrl });\n\n// Call REST endpoints (typed from OpenAPI)\nconst tasks = await desktop.GET('/tasks');\nconsole.log(tasks.data?.tasks?.length);\n\n// Execute tools via IPC (requires x_aglit_ai_tool_reason)\nconst response = await executeTool({\n  agentId,\n  request: {\n    jsonrpc: '2.0',\n    id: 'sdk-run-terminal',\n    params: {\n      name: 'p1_terminal',\n      arguments: {\n        action: 'open',\n        x_aglit_ai_tool_reason: 'SDK example: open terminal via IPC',\n      },\n    },\n    context: {\n      sessionId: `sdk-terminal-${Date.now()}`,\n      agentId,\n    },\n  },\n});\nconsole.log('tool response', response.data?.result);\n```\n\n## Quick Start (JavaScript)\n\n```js\nconst { executeTool } = require('@aglit-ai/sdk');\n\n(async () => {\n  const response = await executeTool({\n    agentId: 'root-agent',\n    request: {\n      jsonrpc: '2.0',\n      id: 'sdk-ipc-example',\n      params: {\n        name: 'p1_todo',\n        arguments: {\n          action: 'list',\n          x_aglit_ai_tool_reason: 'SDK IPC example: list todos',\n        },\n      },\n      context: {\n        agentId: 'root-agent',\n        sessionId: 'sdk-ipc-session',\n      },\n    },\n  });\n  console.log(JSON.stringify(response, null, 2));\n})();\n```\n\n## IPC Tool Execution\n\nLocal tool execution runs over the IPC broker so there is no unauthenticated HTTP surface on loopback.\nIf you store the IPC configuration somewhere custom, set `AGLIT_SDK_IPC_CONFIG_PATH` accordingly (default:\n`<user-data>/ipc/sdk-ipc.json`, where `<user-data>` is `~/Library/Application Support/Aglit AI/` on macOS).\n\nOn macOS, the SDK routes requests through a signed helper into an XPC broker. The broker only accepts\nrequests from trusted apps and will prompt in the desktop app if a new app requests access. The socket\nendpoint is never written to disk. For local development, set `AGLIT_SDK_XPC_ONLY=0` to keep the legacy\nsocket config.\n\nAlways include `x_aglit_ai_tool_reason` and pass structured arguments rather than raw shell strings. The IPC broker\nalso enforces the same tool policies you see in the UI, including approval flows and logging.\n\n## Examples\n\nThe SDK ships ready-to-run examples for common automation surfaces. Always include `x_aglit_ai_tool_reason` to explain why the tool is being called.\n\n### Terminal Commands\n\n```ts\nawait executeTool({\n  agentId: 'root-agent',\n  request: {\n    jsonrpc: '2.0',\n    id: 'open-terminal',\n    params: {\n      name: 'p1_terminal',\n      arguments: {\n        action: 'open',\n        x_aglit_ai_tool_reason: 'SDK example: open terminal',\n      },\n    },\n    context: { sessionId: 'sdk-shell', agentId: 'root-agent' },\n  },\n});\n\nawait executeTool({\n  agentId: 'root-agent',\n  request: {\n    jsonrpc: '2.0',\n    id: 'type-ls',\n    params: {\n      name: 'p1_terminal',\n      arguments: {\n        action: 'type',\n        windowId: '<window-id-from-open>',\n        text: 'ls -la /tmp',\n        submit_command: true,\n        x_aglit_ai_tool_reason: 'SDK example: list temp files',\n      },\n    },\n    context: { sessionId: 'sdk-shell', agentId: 'root-agent' },\n  },\n});\n```\n\n### Browser Automation\n\n```ts\n// Navigate first\nconst nav = await executeTool({\n  agentId: 'root-agent',\n  request: {\n    jsonrpc: '2.0',\n    id: 'browser-nav',\n    params: {\n      name: 'p1_browser',\n      arguments: {\n        action: 'navigate',\n        url: 'https://example.com',\n        x_aglit_ai_tool_reason: 'SDK example: warm up page',\n      },\n    },\n    context: { sessionId: 'sdk-browser', agentId: 'root-agent' },\n  },\n});\n\nconst windowId = (nav.data?.result as any)?.windowId as string;\n\n// Inject JavaScript in that session\nawait executeTool({\n  agentId: 'root-agent',\n  request: {\n    jsonrpc: '2.0',\n    id: 'browser-js',\n    params: {\n      name: 'p1_browser',\n      arguments: {\n        action: 'execute_javascript',\n        windowId,\n        code: 'document.title',\n        x_aglit_ai_tool_reason: 'SDK example: read page title',\n      },\n    },\n    context: { sessionId: 'sdk-browser', agentId: 'root-agent' },\n  },\n});\n```\n\n### Office App Automations (macOS)\n\n```ts\nawait executeTool({\n  agentId: 'root-agent',\n  request: {\n    jsonrpc: '2.0',\n    id: 'app-01',\n    params: {\n      name: 'p1_office',\n      arguments: {\n        tool: 'app',\n        app: 'calendar',\n        action: 'list',\n        x_aglit_ai_tool_reason: 'SDK example: list calendar events',\n      },\n    },\n    context: { sessionId: 'sdk-app', agentId: 'root-agent' },\n  },\n});\n```\n\n### Create Chat Sessions\n\n```ts\nimport { createDesktopClient } from '@aglit-ai/sdk';\n\nconst desktop = createDesktopClient({ baseUrl });\n\nconst chat = await desktop.POST('/chats', {\n  body: {\n    agentId: 'root-agent',\n    initialText: 'Say hello from the SDK',\n  },\n});\nconsole.log('chat id', chat.data?.chat?.id);\n```\n\n## Run the Bundled Examples\n\nMake sure the desktop app/API is running locally, then:\n\n```bash\npnpm --filter @aglit-ai/sdk run build        # if you haven't built yet\npnpm --filter @aglit-ai/sdk run test:examples\n```\n\nConfigure via environment:\n- `AGLIT_DESKTOP_BASE_URL` (overrides host/port)\n- `SERVER_PORT` or `PORT` (default 49117 prod; 49217 for local dev)\n- `AGLIT_AGENT_ID` (default `root-agent`)\n\n## OpenAPI Specs\n\nThe SDK resolves the current OpenAPI source files from `@aglit-ai/types`:\n\n- Desktop API: `@aglit-ai/types/schema/api.openapi.yaml`\n- Tool Builder API: `@aglit-ai/types/schema/tools-api.openapi.yaml`\n- Provider SPI API: `@aglit-ai/types/schema/provider-spi.openapi.yaml`\n","readmeFilename":"README.md"}