{"_id":"@activade/droid-sdk","_rev":"3-b9d350ea62df02db7e1aeded54f6c86f","name":"@activade/droid-sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"@activade/droid-sdk","version":"0.0.1","keywords":["factory","droid","ai","cli","sdk","bun","typescript","codex","agent"],"author":"Activadee AI","license":"MIT","_id":"@activade/droid-sdk@0.0.1","maintainers":[{"name":"activadee14","email":"pkalwak05@gmail.com"}],"homepage":"https://github.com/activadee/droid-sdk#readme","bugs":{"url":"https://github.com/activadee/droid-sdk/issues"},"dist":{"shasum":"5059a8d504623baa12b8997568610722e78c04bb","tarball":"https://registry.npmjs.org/@activade/droid-sdk/-/droid-sdk-0.0.1.tgz","fileCount":41,"integrity":"sha512-KRapjuaSuV+J1LR3239a76mZ2xh3KAPudZmPFpm2osBuaiuIcbRXeAhQRIESYyKe/CuHHrrbYHs0q2bn/3OqHg==","signatures":[{"sig":"MEUCIGodk8r67Z3dEaUI5caW+FAOfhx/oIiCRACfLnxQdCxWAiEAzDs1b9eqkHlWd/LUllNQdinbvMkatZHpnKYx0o2cZGM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61820},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","shasum":"5059a8d504623baa12b8997568610722e78c04bb","engines":{"bun":">=1.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./cli":{"types":"./dist/cli/index.d.ts","import":"./dist/cli/index.js"}},"scripts":{"lint":"bunx biome check .","test":"bun test","build":"bun run build:types && bun run build:js","clean":"rm -rf dist","format":"bunx biome format --write .","build:js":"bun build ./src/index.ts ./src/cli/index.ts --outdir ./dist --target bun --splitting","lint:fix":"bunx biome check --write .","typecheck":"tsc --noEmit","test:watch":"bun test --watch","build:types":"tsc --emitDeclarationOnly","prepublishOnly":"bun run clean && bun run lint && bun run test && bun run build"},"_npmUser":{"name":"activadee14","email":"pkalwak05@gmail.com"},"_integrity":"sha512-KRapjuaSuV+J1LR3239a76mZ2xh3KAPudZmPFpm2osBuaiuIcbRXeAhQRIESYyKe/CuHHrrbYHs0q2bn/3OqHg==","repository":{"url":"https://github.com/activadee/droid-sdk","type":"git"},"_npmVersion":"10.8.3","description":"TypeScript SDK for Factory Droid CLI - Bun only","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.0","@types/bun":"latest","typescript":"^5.7.0","@biomejs/biome":"^1.9.0"},"peerDependencies":{"zod":"^3.0.0"},"peerDependenciesMeta":{"zod":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/droid-sdk_0.0.1_1767055570839_0.35006417424130976","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@activade/droid-sdk","version":"0.0.2","keywords":["factory","droid","ai","cli","sdk","node","bun","typescript","codex","agent"],"author":{"name":"Activadee AI"},"license":"MIT","_id":"@activade/droid-sdk@0.0.2","maintainers":[{"name":"activadee14","email":"pkalwak05@gmail.com"}],"homepage":"https://github.com/activadee/droid-sdk#readme","bugs":{"url":"https://github.com/activadee/droid-sdk/issues"},"dist":{"shasum":"33e59d9aba1d6c56e553b8eca5fb437b8909e7e6","tarball":"https://registry.npmjs.org/@activade/droid-sdk/-/droid-sdk-0.0.2.tgz","fileCount":43,"integrity":"sha512-1kLCr48IHbFAlkzd+tPQ5zr9lh5Ah90f1l45ySIXbwn4H+oGzdWUpoH14frg4czHwzr/fQH+LCV0QsQMnZk30g==","signatures":[{"sig":"MEUCIAg8qAIMiQKK2NN1Pxa8lPIv0FQ3FrN14PygvVwNNophAiEA7LVfdPmIoiDJ/ovwrPnFf3/7g2j9LO17Rep3hGkXDtU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64270},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./cli":{"types":"./dist/cli/index.d.ts","import":"./dist/cli/index.js"}},"gitHead":"5ead9af38799d838221df630cb09b3f86b6de521","scripts":{"lint":"bunx biome check .","test":"bun test","build":"bun run build:types && bun run build:js","clean":"rm -rf dist","format":"bunx biome format --write .","build:js":"bun build ./src/index.ts ./src/cli/index.ts --outdir ./dist --target node --splitting","lint:fix":"bunx biome check --write .","typecheck":"tsc --noEmit","test:watch":"bun test --watch","build:types":"tsc --emitDeclarationOnly","prepublishOnly":"bun run clean && bun run lint && bun run test && bun run build"},"_npmUser":{"name":"activadee14","email":"pkalwak05@gmail.com"},"repository":{"url":"git+https://github.com/activadee/droid-sdk.git","type":"git"},"_npmVersion":"10.9.4","description":"TypeScript SDK for Factory Droid CLI - Works with Node.js and Bun","directories":{},"_nodeVersion":"22.21.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^4.2.1","@types/bun":"latest","typescript":"^5.7.0","@biomejs/biome":"^1.9.0"},"peerDependencies":{"zod":"^3.0.0"},"peerDependenciesMeta":{"zod":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/droid-sdk_0.0.2_1767090062090_0.526313519915204","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@activade/droid-sdk","version":"0.1.0","description":"TypeScript SDK for Factory Droid CLI","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./cli":{"types":"./dist/cli/index.d.ts","import":"./dist/cli/index.js"}},"scripts":{"build":"bun run build:types && bun run build:js","build:js":"bun build ./src/index.ts ./src/cli/index.ts --outdir ./dist --target node --splitting","build:types":"tsc --emitDeclarationOnly","test":"bun test && bun run typecheck && bun run lint","typecheck":"tsc --noEmit","test:watch":"bun test --watch","lint":"bunx biome check .","lint:fix":"bunx biome check --write .","format":"bunx biome format --write .","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run lint && bun run test && bun run build"},"keywords":["factory","droid","ai","cli","sdk","node","bun","typescript","codex","agent"],"author":{"name":"Activade"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/activadee/droid-sdk.git"},"bugs":{"url":"https://github.com/activadee/droid-sdk/issues"},"homepage":"https://github.com/activadee/droid-sdk#readme","engines":{"node":">=18.0.0"},"peerDependencies":{"zod":"^3.0.0"},"peerDependenciesMeta":{"zod":{"optional":true}},"devDependencies":{"@biomejs/biome":"^2.3.10","@types/bun":"latest","typescript":"^5.7.0","zod":"^4.2.1"},"gitHead":"a1cacaeacf8cfcb0a529487583322dd38088d7e7","_id":"@activade/droid-sdk@0.1.0","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-I3Ovoorc0srYa4qdGnT/hebfKaqID2vH3qBYDZ6HPK1kXT2eZrfCp5AqAWz1qR9ve5os0MauRCwBRLDwO+nfuA==","shasum":"bb98d717fa6ccca0933d514a90f1d6b2ee2ddfb4","tarball":"https://registry.npmjs.org/@activade/droid-sdk/-/droid-sdk-0.1.0.tgz","fileCount":43,"unpackedSize":66966,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@activade%2fdroid-sdk@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCmVaUmR3naob28JSXd0YyINCkqYC6oVxzBclj8UQG7fQIhAN30JWvSxYO2Mcmu3JbkiAVzKh1xbumcrJbzzG14JzLb"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:307acb62-da88-404b-b44b-8d4e3b85b606"}},"directories":{},"maintainers":[{"name":"activadee14","email":"pkalwak05@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/droid-sdk_0.1.0_1767199062619_0.6326672810548624"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-30T00:46:10.723Z","modified":"2025-12-31T16:37:43.151Z","0.0.1":"2025-12-30T00:46:11.015Z","0.0.2":"2025-12-30T10:21:02.230Z","0.1.0":"2025-12-31T16:37:42.762Z"},"bugs":{"url":"https://github.com/activadee/droid-sdk/issues"},"author":{"name":"Activade"},"license":"MIT","homepage":"https://github.com/activadee/droid-sdk#readme","keywords":["factory","droid","ai","cli","sdk","node","bun","typescript","codex","agent"],"repository":{"type":"git","url":"git+https://github.com/activadee/droid-sdk.git"},"description":"TypeScript SDK for Factory Droid CLI","maintainers":[{"name":"activadee14","email":"pkalwak05@gmail.com"}],"readme":"# @activade/droid-sdk\n\nTypeScript SDK for [Factory Droid CLI](https://docs.factory.ai/cli) - Bun only.\n\nA programmatic wrapper around the `droid` CLI, enabling you to integrate Factory's AI development agent into your automation workflows, CI/CD pipelines, and developer tools.\n\n## Installation\n\n```bash\nbun add @activade/droid-sdk\n```\n\n### Prerequisites\n\n- [Bun](https://bun.sh) >= 1.0.0\n- [Factory Droid CLI](https://docs.factory.ai/cli/getting-started/quickstart) installed\n\n```bash\ncurl -fsSL https://app.factory.ai/cli | sh\n```\n\n## Quick Start\n\n```typescript\nimport { Droid } from '@activade/droid-sdk';\n\nconst droid = new Droid();\nconst thread = droid.startThread();\n\nconst result = await thread.run('Analyze this codebase');\nconsole.log(result.finalResponse);\n```\n\n## Features\n\n- **Thread-based conversations** - Maintain context across multiple turns\n- **Streaming events** - Real-time access to tool calls and results\n- **Session persistence** - Resume conversations across processes\n- **Structured output** - Parse responses with Zod schemas\n- **Auto-install CLI** - Optionally download the CLI on-demand\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { Droid } from '@activade/droid-sdk';\n\nconst droid = new Droid({\n  cwd: '/path/to/project',\n  model: 'claude-sonnet-4-5-20250929',\n});\n\nconst thread = droid.startThread();\nconst result = await thread.run('Fix all TypeScript errors');\n\nconsole.log(result.finalResponse);\nconsole.log(`Completed in ${result.durationMs}ms`);\n```\n\n### Streaming Events\n\n```typescript\nimport { Droid, isToolCallEvent, isToolResultEvent } from '@activade/droid-sdk';\n\nconst droid = new Droid();\nconst thread = droid.startThread();\n\nconst { events, result } = await thread.runStreamed('Refactor the auth module');\n\nfor await (const event of events) {\n  if (isToolCallEvent(event)) {\n    console.log(`Calling ${event.toolName}...`);\n  }\n  if (isToolResultEvent(event)) {\n    console.log(`Result: ${event.isError ? 'ERROR' : 'OK'}`);\n  }\n}\n\nconst turn = await result;\nconsole.log(turn.finalResponse);\n```\n\n### Multi-Turn Conversations\n\n```typescript\nconst thread = droid.startThread();\n\nawait thread.run('Read the README and understand the project');\nawait thread.run('Implement the feature described in the README');\nawait thread.run('Write tests for the implementation');\n\nconsole.log('Session ID:', thread.id);\n```\n\n### Resume Session\n\n```typescript\n// Save session ID\nconst thread = droid.startThread();\nawait thread.run('Start implementing feature X');\nconst sessionId = thread.id;\n\n// Later: resume the session\nconst resumedThread = droid.resumeThread(sessionId);\nawait resumedThread.run('Continue with the implementation');\n```\n\n### Structured Output with Zod\n\n```typescript\nimport { z } from 'zod';\nimport { Droid } from '@activade/droid-sdk';\n\nconst AnalysisSchema = z.object({\n  summary: z.string(),\n  issues: z.array(z.object({\n    file: z.string(),\n    severity: z.enum(['error', 'warning', 'info']),\n    message: z.string(),\n  })),\n  score: z.number().min(0).max(100),\n});\n\nconst droid = new Droid();\nconst thread = droid.startThread();\n\nconst result = await thread.run('Analyze codebase and return JSON with summary, issues, and score');\nconst analysis = result.parse(AnalysisSchema);\n\nconsole.log(`Quality score: ${analysis.score}/100`);\n```\n\n### One-Shot Execution\n\n```typescript\nconst droid = new Droid();\n\n// No session management, just execute and get result\nconst result = await droid.exec('Quick code review', {\n  autonomyLevel: 'default',\n});\n```\n\n### Auto-Install CLI\n\n```typescript\nimport { Droid } from '@activade/droid-sdk';\nimport { ensureDroidCli } from '@activade/droid-sdk/cli';\n\nconst droidPath = await ensureDroidCli({\n  onProgress: ({ phase, percent }) => {\n    console.log(`${phase}: ${percent ?? 0}%`);\n  },\n});\n\nconst droid = new Droid({ droidPath });\n```\n\n## Configuration\n\n### DroidConfig\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `cwd` | `string` | `process.cwd()` | Working directory |\n| `model` | `string` | (from Factory config) | AI model to use |\n| `autonomyLevel` | `'default' \\| 'low' \\| 'medium' \\| 'high'` | `'default'` | Autonomy level |\n| `reasoningEffort` | `'off' \\| 'low' \\| 'medium' \\| 'high'` | (model default) | Reasoning effort |\n| `droidPath` | `string` | `'droid'` | Path to CLI binary |\n| `timeout` | `number` | `600000` | Timeout in ms |\n\n### ThreadOptions\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `cwd` | `string` | Working directory for this thread |\n| `model` | `string` | Override model |\n| `autonomyLevel` | `string` | Override autonomy |\n| `reasoningEffort` | `string` | Override reasoning |\n| `useSpec` | `boolean` | Enable spec mode |\n| `specModel` | `string` | Model for spec phase |\n| `enabledTools` | `string[]` | Force-enable tools |\n| `disabledTools` | `string[]` | Disable tools |\n| `skipPermissionsUnsafe` | `boolean` | Skip permission checks (DANGEROUS) |\n\n## Available Models\n\n```typescript\nimport { MODELS } from '@activade/droid-sdk';\n\nMODELS.CLAUDE_OPUS      // 'claude-opus-4-5-20251101'\nMODELS.CLAUDE_SONNET    // 'claude-sonnet-4-5-20250929'\nMODELS.CLAUDE_HAIKU     // 'claude-haiku-4-5-20251001'\nMODELS.GPT_5_1_CODEX    // 'gpt-5.1-codex'\nMODELS.GPT_5_1_CODEX_MAX // 'gpt-5.1-codex-max'\nMODELS.GPT_5_2          // 'gpt-5.2'\nMODELS.GEMINI_3_PRO     // 'gemini-3-pro-preview'\nMODELS.DROID_CORE       // 'glm-4.6'\n```\n\n## Error Handling\n\n```typescript\nimport { Droid, CliNotFoundError, ExecutionError, ParseError } from '@activade/droid-sdk';\n\ntry {\n  const result = await thread.run('Do something');\n} catch (error) {\n  if (error instanceof CliNotFoundError) {\n    console.error('Droid CLI not installed');\n  } else if (error instanceof ExecutionError) {\n    console.error(`Execution failed: ${error.stderr}`);\n  } else if (error instanceof ParseError) {\n    console.error(`Failed to parse: ${error.raw}`);\n  }\n}\n```\n\n## CI/CD Example\n\n```yaml\n# .github/workflows/droid-review.yml\nname: Droid Code Review\non: [pull_request]\n\njobs:\n  review:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: oven-sh/setup-bun@v1\n      - run: curl -fsSL https://app.factory.ai/cli | sh\n      - run: |\n          bun run - <<'EOF'\n          import { Droid } from '@activade/droid-sdk';\n          const droid = new Droid();\n          const result = await droid.exec('Review this PR for issues');\n          console.log(result.finalResponse);\n          EOF\n        env:\n          FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }}\n```\n\n## API Reference\n\nSee [PLAN.md](./PLAN.md) for the complete API specification.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}