{"_id":"@agfs/sdk","_rev":"2-8b15c2e7341454781696b49e66d2ed16","name":"@agfs/sdk","dist-tags":{"latest":"0.4.0"},"versions":{"0.3.0":{"name":"@agfs/sdk","version":"0.3.0","_id":"@agfs/sdk@0.3.0","maintainers":[{"name":"nearbycoder","email":"nearbycoder@gmail.com"}],"homepage":"https://github.com/nearbycoder/agfs#readme","bugs":{"url":"https://github.com/nearbycoder/agfs/issues"},"dist":{"shasum":"f01e89bd76f96472c6232a12b80c11a9526b5325","tarball":"https://registry.npmjs.org/@agfs/sdk/-/sdk-0.3.0.tgz","fileCount":4,"integrity":"sha512-xeRJLnyhL/rfbJQkL6jHj86Zi/ahOWA/1hjJAf/BlbUq8myHIZZAUbZtggfSRiO2/SkrK6YIkkFX8TMbF0Ls2w==","signatures":[{"sig":"MEUCIQC9K/JPBiJYI++ELKjz9NlKjD26MaKCWC1OG1fcC+D/aQIgc0zYvutTa+nSgEArfXIP4YZB+Bsq5+eAv/9+J1cDe8Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15673},"type":"module","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ae92ec86bbc6599b40463e50c39e3b26bb6cae17","scripts":{"test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"nearbycoder","email":"nearbycoder@gmail.com"},"repository":{"url":"git+https://github.com/nearbycoder/agfs.git","type":"git","directory":"packages/sdk"},"_npmVersion":"12.0.2","description":"Official TypeScript SDK for AGFS","directories":{},"_nodeVersion":"26.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^5.0.0","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.0_1788746808033_0.34291331100207656","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@agfs/sdk","version":"0.4.0","description":"Official TypeScript SDK for AGFS","type":"module","repository":{"type":"git","url":"git+https://github.com/nearbycoder/agfs.git","directory":"packages/sdk"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./oauth":{"types":"./dist/oauth.d.ts","import":"./dist/oauth.js"}},"engines":{"node":">=22"},"publishConfig":{"access":"public"},"devDependencies":{"typescript":"^7.0.2","vitest":"^5.0.0"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run --passWithNoTests"},"_id":"@agfs/sdk@0.4.0","bugs":{"url":"https://github.com/nearbycoder/agfs/issues"},"homepage":"https://github.com/nearbycoder/agfs#readme","_integrity":"sha512-vnGTMMq0f0XgHNnfZmLzGWE8TKDo/TeDpEMzvqbzEUND5QIJV6LHug8tCgmintSTN/w8tIsY0vTQIpsXNrGB8g==","_resolved":"/home/runner/work/agfs/agfs/release/agfs-sdk-0.4.0.tgz","_from":"file:release/agfs-sdk-0.4.0.tgz","_nodeVersion":"24.20.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-vnGTMMq0f0XgHNnfZmLzGWE8TKDo/TeDpEMzvqbzEUND5QIJV6LHug8tCgmintSTN/w8tIsY0vTQIpsXNrGB8g==","shasum":"611bfc1c60ab0df49d2ae2335868ac2b202c88cf","tarball":"https://registry.npmjs.org/@agfs/sdk/-/sdk-0.4.0.tgz","fileCount":8,"unpackedSize":32071,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agfs%2fsdk@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF4C0ngrYAY4BsZOL8LfXJDSAnGWAA04T7pnu07FNY8GAiBl3AKcmm41JEAfVN2XX24rhmFNBuaZA+VjgFKEnWHtoQ=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0085dbf2-5cab-4a69-ab87-0cf6f8932bd4"}},"directories":{},"maintainers":[{"name":"nearbycoder","email":"nearbycoder@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.4.0_1788812993172_0.4559186183846664"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-07T02:06:47.817Z","modified":"2026-09-07T20:29:53.630Z","0.3.0":"2026-09-07T02:06:48.192Z","0.4.0":"2026-09-07T20:29:53.311Z"},"bugs":{"url":"https://github.com/nearbycoder/agfs/issues"},"homepage":"https://github.com/nearbycoder/agfs#readme","repository":{"type":"git","url":"git+https://github.com/nearbycoder/agfs.git","directory":"packages/sdk"},"description":"Official TypeScript SDK for AGFS","maintainers":[{"name":"nearbycoder","email":"nearbycoder@gmail.com"}],"readme":"# @agfs/sdk\n\nOfficial TypeScript SDK for AGFS. Requires Node 22+ or a browser with Fetch and Web Crypto.\n\n```ts\nimport { AgfsClient } from \"@agfs/sdk\";\nconst agfs = new AgfsClient({ token: process.env.AGFS_TOKEN! });\nawait agfs.mkdir(\"/reports\");\nconst entry = await agfs.upload(\n  \"/reports/summary.txt\",\n  new Blob([\"First draft\"]),\n  {\n    contentType: \"text/plain\",\n    ifMatch: null, // create only\n  },\n);\nawait agfs.upload(entry.path, new Blob([\"Revised draft\"]), {\n  ifMatch: entry.etag!,\n});\nfor await (const file of agfs.searchAll({ q: \"revised\", path: \"/reports\" })) {\n  console.log(file.path);\n}\nconst run = await agfs.startRun(\"Daily report\", \"/reports\", {\n  inputs: [\"/inputs/brief.txt\"],\n  metadata: { revision: \"abc123\" },\n});\nconsole.log(await agfs.completeRun(run.id));\n```\n\nThe token determines the workspace. `workspace` is an optional assertion of that workspace's ID, not a way to switch a token into another workspace. Browser OAuth connections use the same API; supply their current bearer access token or an async token callback. For interactive browser login in Node, use the separate `@agfs/sdk/oauth` export. DPoP signing remains the calling application's responsibility.\n\n`upload` accepts a Blob or Uint8Array. `uploadSource` accepts `{size, read(start,end)}` for bounded-memory file uploads. Nonempty files use resumable 8 MiB parts, rehashing each resumed part. Retry an interrupted upload with the same source and options to continue. Empty files use the upload-intent API. The return value is the committed file entry.\n\nOmitting `ifMatch` preserves unconditional write behavior. `null` requires an absent destination; an ETag requires that exact version. A stale write throws `AgfsError` with status 409. `download(path, etag)` returns a streaming Response and rejects changed versions with 412. Callers must consume or cancel response bodies.\n\nThe client retries GET, HEAD, and PUT requests on transient network failures or HTTP 429/502/503/504, with bounded backoff. POST requests retry only when explicitly supplied an idempotency key. API redirects are rejected to protect credentials. `searchAll` and `activity` paginate automatically. `json('/platform/...', method, body, idempotencyKey)` provides access to the full API, including workspace, draft, webhook, and budget management.\n\nTokens must stay on the server or in a trusted application; never embed a privileged token in public frontend code.\n\nBrowser login uses PKCE, a loopback callback, and refresh-token rotation:\n\n```ts\nimport { OAuthSession, fileCredentialStore } from \"@agfs/sdk/oauth\";\nconst session = await OAuthSession.login({\n  onAuthorizationUrl: (url) => console.log(\"Open:\", url),\n  store: fileCredentialStore(\"/home/me/.config/agfs-sdk/credentials.json\"),\n});\nconst client = new AgfsClient({ token: session.token });\n```\n\nThe optional credential directory must be private (0700); files use 0600. Use one session per store/process. Pass `signal` in client options to cancel requests and retry delays. `mapConcurrent(items, concurrency, callback, signal)` bounds independent transfers to 1–8 workers. `changes(path, since, through)` supports incremental sync; an expired checkpoint returns 410.\n","readmeFilename":"README.md"}