{"_id":"@amika/sdk","_rev":"6-271b5fc069a0169e44f641733eaebd33","name":"@amika/sdk","dist-tags":{"next":"0.9.2-rc.2","latest":"0.11.0"},"versions":{"0.9.2-rc.1":{"name":"@amika/sdk","version":"0.9.2-rc.1","license":"MIT","_id":"@amika/sdk@0.9.2-rc.1","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"homepage":"https://github.com/gofixpoint/amika#readme","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"dist":{"shasum":"57f6cd60beca63da8e5a3a5503acdb255040fcf6","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.9.2-rc.1.tgz","fileCount":8,"integrity":"sha512-GAvLTjVsaNId6CMUs5HANHsA4XspiN/2YLrxJZ2g72LHzyLxGD2WZ4KKYHrGrwG3IweCuWV0f+hWecUrPTtx8g==","signatures":[{"sig":"MEYCIQCOyYMujiLqfBmwUL7hU1a06yTy6PRalLE9P7SBksDWhgIhAOWpT5QpqCi5A4kfIT/vqqH5jdpBbPpIti+9lHP8mVzG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30561},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5673d995d779af9d3729d6e0d7b5ed02f457ae07","scripts":{"ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test","lint":"eslint","test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","format":"pnpm exec prettier --write .","typecheck":"tsc --noEmit","formatcheck":"pnpm exec prettier --check .","test:functional":"vitest run --config vitest.functional.config.ts"},"_npmUser":{"name":"jdcfixp1","email":"jakub@fixpoint.co"},"repository":{"url":"git+https://github.com/gofixpoint/amika.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"10.9.2","description":"TypeScript SDK for Amika, derived from the amika CLI","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.1.3","devDependencies":{"eslint":"^9.0.0","vitest":"^3.2.4","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","@eslint/js":"^9.0.0","typescript":"^5.5.0","@types/node":"^20.12.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.9.2-rc.1_1779847210564_0.7502603909238239","host":"s3://npm-registry-packages-npm-production"}},"0.9.2-rc.2":{"name":"@amika/sdk","version":"0.9.2-rc.2","license":"MIT","_id":"@amika/sdk@0.9.2-rc.2","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"homepage":"https://github.com/gofixpoint/amika#readme","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"dist":{"shasum":"24ff61dc4bc51e8b9d219619b2d94712cc2d099e","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.9.2-rc.2.tgz","fileCount":32,"integrity":"sha512-EyIOzblVXhl2hoE7YsSY42Yxywgl9PdcgQKor7dwhDp0jEn7rNfWzka3pXO+mREC5WQJTRCuU/GM4A7iKCgNtA==","signatures":[{"sig":"MEUCIQD8CYZjNJf3N5qyuiuULR9pIY4QOrkALAkB83owr8DV+AIgZ2mMLHWmDfng/FK0Vxr6j2m0StQtY83867/gTmpAAaA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78358},"main":"./dist/index.js","type":"module","_from":"file:amika-sdk-0.9.2-rc.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test","lint":"eslint","test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","format":"pnpm exec prettier --write .","typecheck":"tsc --noEmit","formatcheck":"pnpm exec prettier --check .","test:functional":"vitest run --config vitest.functional.config.ts"},"_npmUser":{"name":"jdcfixp1","email":"jakub@fixpoint.co"},"_resolved":"/private/var/folders/dk/8k6t2h195tv9001rrqgfvqhw0000gn/T/ee82df0256e1a1980dfc8267ee6fc26e/amika-sdk-0.9.2-rc.2.tgz","_integrity":"sha512-EyIOzblVXhl2hoE7YsSY42Yxywgl9PdcgQKor7dwhDp0jEn7rNfWzka3pXO+mREC5WQJTRCuU/GM4A7iKCgNtA==","repository":{"url":"git+https://github.com/gofixpoint/amika.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"10.9.2","description":"TypeScript SDK for Amika, derived from the amika CLI","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"eslint":"^9.0.0","vitest":"^3.2.4","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","@eslint/js":"^9.0.0","typescript":"^5.5.0","@types/node":"^20.12.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.9.2-rc.2_1779848320304_0.31244712824403154","host":"s3://npm-registry-packages-npm-production"}},"0.9.2":{"name":"@amika/sdk","version":"0.9.2","license":"MIT","_id":"@amika/sdk@0.9.2","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"homepage":"https://github.com/gofixpoint/amika#readme","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"dist":{"shasum":"86dd096c74c29a25058a09f1cdde2f81f3f2e0d9","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.9.2.tgz","fileCount":32,"integrity":"sha512-dckAynLhD2fEM2lrhfGXOdG1D4N0w12RsGyb1iUI2UOZ+GPrnZ97Uj7fZ+7z6mjQcaT8E+faN3zHkO9aB2FViQ==","signatures":[{"sig":"MEQCIBbjVvbv6uJnhAxUFG+ui1nbPFPl8y9G1K044GnBLeTlAiBdahqb2F2dOTPJ5coWPzLpqVKeMkcztGFUyizNb6ivPA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78353},"main":"./dist/index.js","type":"module","_from":"file:amika-sdk-0.9.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test","lint":"eslint","test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","format":"pnpm exec prettier --write .","typecheck":"tsc --noEmit","formatcheck":"pnpm exec prettier --check .","test:functional":"vitest run --config vitest.functional.config.ts"},"_npmUser":{"name":"jdcfixp1","email":"jakub@fixpoint.co"},"_resolved":"/private/var/folders/dk/8k6t2h195tv9001rrqgfvqhw0000gn/T/ff797c3715130e57c814abdd8a09b65f/amika-sdk-0.9.2.tgz","_integrity":"sha512-dckAynLhD2fEM2lrhfGXOdG1D4N0w12RsGyb1iUI2UOZ+GPrnZ97Uj7fZ+7z6mjQcaT8E+faN3zHkO9aB2FViQ==","repository":{"url":"git+https://github.com/gofixpoint/amika.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"10.9.2","description":"TypeScript SDK for Amika, derived from the amika CLI","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.0.0","vitest":"^3.2.4","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","@eslint/js":"^9.0.0","typescript":"^5.5.0","@types/node":"^20.12.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.9.2_1779851119370_0.16198357882473569","host":"s3://npm-registry-packages-npm-production"}},"0.9.3":{"name":"@amika/sdk","version":"0.9.3","license":"MIT","_id":"@amika/sdk@0.9.3","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"homepage":"https://github.com/gofixpoint/amika#readme","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"dist":{"shasum":"d6cbcd95d449dd88b177c6ebc4fe8a6c910e39ba","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.9.3.tgz","fileCount":32,"integrity":"sha512-bviAsy5kneLxvKQuQgsaGnz0qywHgsaNp14HTFjw5jLGtvY/+B5yP6tEB+5nxgBBcrb9Ho3Lb92TBfwDTKTceA==","signatures":[{"sig":"MEYCIQDU6Hw8twoV7KcaK6C3OWxhAnGcQ/jAadc0JvaDH6udqQIhAMGrC+x5XIwXMutyGwKHqsHTlxnAcQFSqYkfo6gro3+K","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78536},"main":"./dist/index.js","type":"module","_from":"file:amika-sdk-0.9.3.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test","lint":"eslint","test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","format":"pnpm exec prettier --write .","typecheck":"tsc --noEmit","formatcheck":"pnpm exec prettier --check .","test:functional":"vitest run --config vitest.functional.config.ts"},"_npmUser":{"name":"jdcfixp1","email":"jakub@fixpoint.co"},"_resolved":"/private/var/folders/dk/8k6t2h195tv9001rrqgfvqhw0000gn/T/fc5fdf12db7249687adc3838465afb48/amika-sdk-0.9.3.tgz","_integrity":"sha512-bviAsy5kneLxvKQuQgsaGnz0qywHgsaNp14HTFjw5jLGtvY/+B5yP6tEB+5nxgBBcrb9Ho3Lb92TBfwDTKTceA==","repository":{"url":"git+https://github.com/gofixpoint/amika.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"10.9.2","description":"TypeScript SDK for Amika, derived from the amika CLI","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.0.0","vitest":"^3.2.4","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","@eslint/js":"^9.0.0","typescript":"^5.5.0","@types/node":"^20.12.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.9.3_1779851865939_0.4229882507349918","host":"s3://npm-registry-packages-npm-production"}},"0.10.0":{"name":"@amika/sdk","version":"0.10.0","license":"MIT","_id":"@amika/sdk@0.10.0","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"homepage":"https://github.com/gofixpoint/amika#readme","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"dist":{"shasum":"5a11f5bcbbfdf1f850656e11b3cf96aeddbae6a9","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.10.0.tgz","fileCount":32,"integrity":"sha512-L1/mNun9Ofh0vcViCWfS8hEdUcJiq1rLJTgKbpLu2oFvxqhoEI/jNxfDG9j4cZQTnl+FY+2QFe+pcp6DLIeI8g==","signatures":[{"sig":"MEUCIEofbhspq7Z5ukrts/2OimSM1CzzTDxyZZxFAwteMjGFAiEAl8dPcZ2Cp/9EI3uBnBOsQouvT91ugDhTE88yRPsKRqI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":101501},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"a8bda713f603e58c5ce401ae894c5d044a4cf062","scripts":{"ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test","lint":"eslint","test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","format":"pnpm exec prettier --write .","typecheck":"tsc --noEmit","formatcheck":"pnpm exec prettier --check .","test:functional":"vitest run --config vitest.functional.config.ts"},"_npmUser":{"name":"dylanamika","email":"dylan@amika.dev"},"repository":{"url":"git+https://github.com/gofixpoint/amika.git","type":"git","directory":"sdk/typescript"},"_npmVersion":"11.6.0","description":"TypeScript SDK for Amika, derived from the amika CLI","directories":{},"_nodeVersion":"24.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.1.3","devDependencies":{"eslint":"^9.0.0","vitest":"^3.2.6","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","@eslint/js":"^9.0.0","typescript":"^5.5.0","@types/node":"^20.12.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.10.0_1784237578932_0.12520370270788495","host":"s3://npm-registry-packages-npm-production"}},"0.11.0":{"name":"@amika/sdk","version":"0.11.0","description":"TypeScript SDK for Amika, derived from the amika CLI","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"engines":{"node":">=18"},"packageManager":"pnpm@11.1.3","scripts":{"build":"pnpm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths","clean":"rm -rf dist","typecheck":"tsc --noEmit","lint":"eslint","format":"pnpm exec prettier --write .","formatcheck":"pnpm exec prettier --check .","test":"vitest run","test:functional":"vitest run --config vitest.functional.config.ts","ci":"pnpm run typecheck && pnpm run lint && pnpm run formatcheck && pnpm run build && pnpm test"},"devDependencies":{"@eslint/js":"^9.0.0","@types/node":"^20.12.0","eslint":"^9.0.0","globals":"^15.0.0","prettier":"^3.8.3","tsc-alias":"^1.8.10","typescript":"^5.5.0","typescript-eslint":"^8.0.0","vite-tsconfig-paths":"^5.1.0","vitest":"^3.2.6"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/gofixpoint/amika.git","directory":"sdk/typescript"},"gitHead":"ba938f6f45746ba57010f6701b68f52697f90588","_id":"@amika/sdk@0.11.0","bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"homepage":"https://github.com/gofixpoint/amika#readme","_nodeVersion":"22.14.0","_npmVersion":"11.19.1","dist":{"integrity":"sha512-MB6aSsrc4gihs2ksEC9+/dpc0XABLWThU1SCZPsohXc7aFDg0pea4ZeHz3uL8qa+64Y9L4xlsqRuf3aqzUGOOA==","shasum":"f6bc387dc7a39159d0fa9b6974927423dded5b91","tarball":"https://registry.npmjs.org/@amika/sdk/-/sdk-0.11.0.tgz","fileCount":42,"unpackedSize":211643,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amika%2fsdk@0.11.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDUsionuyho8LFMGNW+/QCG8/+WL6ZopsbDAJuyejCybwIgSNAlsEglpMNXMkmt+SlU4GT/KzGC2pIl5fGVTChhAug="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:02b73e8b-e0ef-461b-9991-7d06e40ad178"}},"directories":{},"maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.11.0_1788312951584_0.5738722814047859"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-27T02:00:10.317Z","modified":"2026-09-02T01:35:52.244Z","0.9.2-rc.1":"2026-05-27T02:00:10.731Z","0.9.2-rc.2":"2026-05-27T02:18:40.460Z","0.9.2":"2026-05-27T03:05:19.521Z","0.9.3":"2026-05-27T03:17:46.132Z","0.10.0":"2026-07-16T21:32:59.086Z","0.11.0":"2026-09-02T01:35:51.720Z"},"bugs":{"url":"https://github.com/gofixpoint/amika/issues"},"license":"MIT","homepage":"https://github.com/gofixpoint/amika#readme","repository":{"type":"git","url":"git+https://github.com/gofixpoint/amika.git","directory":"sdk/typescript"},"description":"TypeScript SDK for Amika, derived from the amika CLI","maintainers":[{"name":"dylanamika","email":"dylan@amika.dev"},{"name":"jdcfixp1","email":"jakub@fixpoint.co"}],"readme":"# @amika/sdk\n\nTypeScript SDK for [Amika](https://github.com/gofixpoint/amika). A 1:1 port of the Go API client at `go/internal/apiclient`. Same method names, same input/output shapes (camelCased), same HTTP behavior — talks to the cloud API at `https://app.amika.dev/api/v0beta1`.\n\n## Install\n\n```bash\nnpm install @amika/sdk\n```\n\n## Quick start\n\n```ts\nimport { AmikaClient } from \"@amika/sdk\";\n\nconst amika = new AmikaClient({\n  baseUrl: process.env.AMIKA_API_URL ?? \"https://app.amika.dev\",\n  accessToken: process.env.AMIKA_API_KEY!,\n});\n\n// Create a sandbox (returns immediately with state \"initializing\")\nconst sb = await amika.createSandbox({\n  name: \"hello-amika\",\n  provider: \"daytona\",\n  repoUrl: \"git@github.com:gofixpoint/example-repo.git\",\n  preset: \"coder\",\n  agentCredentials: [{ kind: \"claude\" }],\n});\nconsole.log(`Created sandbox \"${sb.name}\"`);\n\n// Wait until it's ready (polls every 3s, no timeout)\nawait amika.waitForSandbox(sb.name);\n\n// Send a prompt to an agent (HTTP timeout is 10 minutes for this endpoint)\nconst resp = await amika.agentSend(sb.name, {\n  message: \"Write a hello_world.md file with Hello World! in it\",\n  agent: \"claude\",\n});\nconsole.log(`Agent Response: ${resp.result}`);\n\n// Tear down\nconsole.log(`Deleting sandbox \"${sb.name}\"`);\nawait amika.deleteSandbox(sb.name);\n```\n\n## Configuration\n\n```ts\nnew AmikaClient({\n  baseUrl: \"https://app.amika.dev\",\n  accessToken: \"amk_…\", // OR\n  tokenSource: { token: () => \"…\" }, // implement your own (e.g., fetch from a secret manager)\n  fetch: customFetch, // optional: override globalThis.fetch (testing, polyfills)\n});\n```\n\n- `accessToken` and `tokenSource` are mutually exclusive; one is required.\n- The SDK does **not** read `AMIKA_API_KEY` or any on-disk credential file. Callers source the token themselves.\n\n## API surface\n\nMethods on `AmikaClient` mirror Go's `*apiclient.Client` 1:1:\n\n### Sandboxes\n\n| Method                      | Endpoint                                  |\n| --------------------------- | ----------------------------------------- |\n| `listSandboxes()`           | `GET /sandboxes`                          |\n| `createSandbox(req)`        | `POST /sandboxes`                         |\n| `getSandbox(name)`          | `GET /sandboxes/{name}`                   |\n| `waitForSandbox(name)`      | polls `GET /sandboxes/{name}` until ready |\n| `startSandbox(name)`        | `POST /sandboxes/{name}/start`            |\n| `waitForSandboxStart(name)` | polls until ready                         |\n| `stopSandbox(name)`         | `POST /sandboxes/{name}/stop`             |\n| `waitForSandboxStop(name)`  | polls until `stopped`                     |\n| `deleteSandbox(name)`       | `DELETE /sandboxes/{name}`                |\n| `listRepositories()`        | `GET /repositories`                       |\n\n### Services\n\n| Method                                           | Endpoint                                        |\n| ------------------------------------------------ | ----------------------------------------------- |\n| `listSandboxServices(sandboxRef?)`               | `GET /sandbox-services`                         |\n| `createSandboxService(sandboxRef, req)`          | `POST /sandboxes/{ref}/services`                |\n| `putSandboxService(sandboxRef, serviceRef, req)` | `PUT /sandboxes/{ref}/services/{serviceRef}`    |\n| `deleteSandboxService(sandboxRef, serviceRef)`   | `DELETE /sandboxes/{ref}/services/{serviceRef}` |\n\n### Secrets\n\n| Method                                | Endpoint                          |\n| ------------------------------------- | --------------------------------- |\n| `listSecrets()`                       | `GET /secrets`                    |\n| `createSecret(req)`                   | `POST /secrets`                   |\n| `updateSecret(id, req)`               | `PUT /secrets/{id}`               |\n| `createProviderSecret(provider, req)` | `POST /secrets/{provider}`        |\n| `listProviderSecrets(provider)`       | `GET /secrets/{provider}`         |\n| `deleteProviderSecret(provider, id)`  | `DELETE /secrets/{provider}/{id}` |\n\n### Agents and sessions\n\n| Method                                  | Endpoint                                              |\n| --------------------------------------- | ----------------------------------------------------- |\n| `agentSend(name, req)`                  | `POST /sandboxes/{name}/agent-send` (10-min timeout)  |\n| `sendAgentSession(req)`                 | `POST /agent-sessions` (10-min timeout)               |\n| `sendAgentSessionStream(req, handlers)` | `POST /agent-sessions/stream` (SSE)                   |\n| `listAgentSessions(limit?)`             | `GET /agent-sessions`                                 |\n| `getAgentSession(sessionId)`            | `GET /agent-sessions/{sessionId}`                     |\n| `createSession(name, req)`              | `POST /sandboxes/{name}/sessions`                     |\n| `listSessions(name)`                    | `GET /sandboxes/{name}/sessions`                      |\n| `getLatestSession(name)`                | `GET /sandboxes/{name}/sessions/latest` (null on 404) |\n| `getSession(name, sessionId)`           | `GET /sandboxes/{name}/sessions/{sessionId}`          |\n| `updateSession(name, sessionId, req)`   | `PATCH /sandboxes/{name}/sessions/{sessionId}`        |\n\n### Snapshots\n\n| Method                           | Endpoint                               |\n| -------------------------------- | -------------------------------------- |\n| `listSandboxSnapshots(filters?)` | `GET /sandbox-snapshots`               |\n| `createSandboxSnapshot(req)`     | `POST /sandbox-snapshots`              |\n| `getSandboxSnapshot(ref)`        | `GET /sandbox-snapshots/{ref}`         |\n| `waitForSandboxSnapshot(ref)`    | polls until `active` or `failed`       |\n| `getSandboxScrubPreview(ref)`    | `GET /sandbox-snapshots/scrub-preview` |\n| `deleteSandboxSnapshot(ref)`     | `DELETE /sandbox-snapshots/{ref}`      |\n\nFork a new sandbox from a captured snapshot by passing its slug as `snapshot` to `createSandbox({ snapshot })`.\n\nTypes are camelCased and translated to/from snake_case on the wire. See `src/types.ts` and `src/agent-sessions.ts` for the full set: `CreateSandboxRequest`, `RemoteSandbox`, `Secret`, `CreateProviderSecretRequest`, `AgentSendRequest`, `AgentSendResponse`, `Session`, `SandboxSnapshot`, `SandboxServiceResource`, `AgentSessionSendRequest`, `AgentSessionDetail`, etc.\n\n### Nullability\n\nField optionality mirrors the Go client's struct tags, which in turn follow the API schema. Whether a field can go missing in TypeScript tracks whether it is a pointer in Go:\n\n| Go field            | TypeScript          | Decoding                                                                |\n| ------------------- | ------------------- | ----------------------------------------------------------------------- |\n| `string`            | `x: string`         | required, always present                                                |\n| `string,omitempty`  | `x: string`         | may be omitted on the wire, and decodes to `\"\"` exactly as Go does      |\n| `*string`           | `x: string \\| null` | always present, and `null` is meaningful (a sandbox with no repository) |\n| `*string,omitempty` | `x?: string`        | `null` and absent both surface as `undefined`                           |\n\nA non-pointer Go field always lands as a value, so `state` and `status` stay plain strings even though the schema marks them optional. Go cannot tell an omitted `status` from an empty one, and neither should a 1:1 mirror. Slices go the other way, being nilable in Go themselves: `[]string,omitempty` is `x?: string[]`.\n\nTwo fields sit outside this rule because they sit outside the schema. `containerId` and `image` are CLI-only extensions that the API never returns, so they are typed optional to say exactly that.\n\n## Polling behavior\n\n`waitForSandbox`, `waitForSandboxStart`, and `waitForSandboxStop` poll `getSandbox` every **3 seconds** with **no client-side timeout**, matching Go's `WaitForSandbox`. They throw `AmikaError` if the sandbox enters `failed` state, including the server's `errorMessage` when present. `waitForSandboxSnapshot` polls `getSandboxSnapshot` the same way, returning once the snapshot is `active` and throwing if it ends up `failed`.\n\n## Streaming an agent turn\n\n`sendAgentSessionStream` reads the SSE endpoint and resolves with the same response `sendAgentSession` returns, after forwarding progress to your handlers:\n\n```ts\nconst result = await amika.sendAgentSessionStream(\n  { message: \"Add a CHANGELOG\", repoUrl: \"git@github.com:org/proj.git\" },\n  {\n    onStatus: (phase, sandboxId) => console.error(`[${phase}] ${sandboxId}`),\n    onDelta: (text) => process.stdout.write(text),\n  },\n);\nconsole.log(`\\nsession ${result.sessionId} on sandbox ${result.sandboxId}`);\n```\n\nThe server enforces a 300s ceiling on the request, below the client's 10-minute timeout. If it cuts the stream before a terminal frame, the call throws and the turn may still have completed — check `listAgentSessions()` for the session rather than assuming the work was lost.\n\n## Errors\n\n```ts\nimport { AmikaError, AmikaHTTPError, extractAgentAuthError } from \"@amika/sdk\";\n\ntry {\n  await amika.getSandbox(\"does-not-exist\");\n} catch (err) {\n  if (err instanceof AmikaHTTPError) {\n    console.error(err.statusCode, err.userMessage());\n    // userMessage() parses { code/error_code, message } if present, else returns the raw body\n  } else if (err instanceof AmikaError) {\n    console.error(err.message);\n  } else {\n    throw err;\n  }\n}\n```\n\n`agentSend` automatically detects agent-side auth failures (e.g., Anthropic 401) and rewrites them to a friendlier `AmikaError` explaining how to recover.\n\n## Development\n\n```bash\ncd sdk/typescript\npnpm install\npnpm typecheck\npnpm lint\npnpm formatcheck\npnpm test\npnpm build\n```\n\nTests use [Vitest](https://vitest.dev) with mocked `fetch` — no network or external binaries required.\n\n### Functional tests\n\nThe functional tests (named `*.functional.test.ts`, living under `test/functional/`) exercise the SDK against a real Amika server. They are excluded from `pnpm test`, which stays offline, and are skipped entirely when `AMIKA_API_URL` is unset. To run them:\n\n```bash\nAMIKA_API_URL=https://app.staging-amika.dev \\\nAMIKA_API_TOKEN=amk_… \\\npnpm test:functional\n```\n\n**Production is banned.** These tests provision and tear down real resources, so pointing `AMIKA_API_URL` at a production host (`app.amika.dev` or `amika.dev`) aborts the run before any test executes. This is a hard ban with no override; always target staging (e.g. `https://app.staging-amika.dev`).\n\nOptional env vars: `AMIKA_TEST_REPO_URL`, `AMIKA_TEST_PRESET`, `AMIKA_TEST_AGENT_NAME`, `AMIKA_TEST_AGENT_CREDENTIAL_NAME`, `AMIKA_TEST_AGENT_CREDENTIAL_TYPE`, `AMIKA_TEST_BRANCH`, `AMIKA_TEST_SANDBOX_NAME_PREFIX`, `AMIKA_TEST_PROVIDER`, `AMIKA_TEST_SANDBOX_PROVIDER`. See `test/functional/helpers.ts` for details.\n\nThe suite provisions a real sandbox and runs the full lifecycle (create → wait → list → get → sessions → agentSend → stop → start → delete), so a single run takes several minutes and creates billable resources. Sandboxes are cleaned up in `afterAll`, but the secrets API has no delete endpoint — test-created secrets accumulate.\n\n`org-resources.functional.test.ts` is the exception: it only reads org-scoped listings, so it provisions nothing and finishes in seconds. Run it alone with `pnpm test:functional org-resources`.\n","readmeFilename":"README.md"}