{"_id":"@agent-provider/ai-sdk","_rev":"6-7cfcd8aaa0755065c1dbc1d8eb48175e","name":"@agent-provider/ai-sdk","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@agent-provider/ai-sdk","version":"0.1.0","keywords":["browser","llm","ai-sdk","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/ai-sdk@0.1.0","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"dist":{"shasum":"d64135ed32ae766ef65665d4f0088941001c0509","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.0.tgz","fileCount":21,"integrity":"sha512-/gHzgo5ktAxhDNhmkKA0jUET3iNrED+XQ8V7E1WnbLXne1/DQOFuLs7nhgikfs7Wp/qngRIES35dDCTGQkyuog==","signatures":[{"sig":"MEUCIQDmdgkXBOvoejd+AmUiEf2MHG67/wIi/fWMyFImR/ga+AIgOdhdrqxdpXVEZzrdmq6aZ0BUxqR8aSImsvlWRAOhnNY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70843},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"13bee9a89750e14cf880d4c751c1bac52d900216","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"xertrov","email":"m@xk.io"},"_npmVersion":"12.0.1","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@ai-sdk/provider":"^4.0.3","@agent-provider/protocol":"0.1.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"peerDependencies":{"ai":">=7.0.34 <8"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.1.0_1784764798403_0.7456460721461065","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agent-provider/ai-sdk","version":"0.1.1","keywords":["browser","llm","ai-sdk","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/ai-sdk@0.1.1","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"6873a5db184cb7a03598cb8dae442986302186e3","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.1.tgz","fileCount":21,"integrity":"sha512-HmjDQrT5jPtA1j3CxotEPcykaXNBUwe7qkxv43jcFOO6omstWp15FemNxLErFSgKKam9HH0czqzTJYExGBOY3Q==","signatures":[{"sig":"MEUCIAQla+WF0vJhk3TbyTssZH0HSlZZGtsnm6P0j049Upm5AiEA0gPtB6dCreNdIq8XWkB2aCU+1O7DCPRAAPFIt/30RBU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fai-sdk@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":74611},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"2dd5039a143844c33be718ae76b6191608da76ef","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5f5ed025-4f70-456b-8969-20143b5d718e"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/ai-sdk"},"_npmVersion":"11.5.1","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@ai-sdk/provider":"^4.0.3","@agent-provider/protocol":"0.1.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"peerDependencies":{"ai":">=7.0.34 <8"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.1.1_1784766024448_0.7911703327437452","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agent-provider/ai-sdk","version":"0.1.2","keywords":["browser","llm","ai-sdk","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/ai-sdk@0.1.2","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"15dc795a3b31604ef55b352a501375e00712a6db","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.2.tgz","fileCount":21,"integrity":"sha512-N/5yDosvzU050sKrHcjn9eTTzwHH/94o6TFfQ4fLj7G9XY5i62/qSW8wD0ObwppRrd4R42NJTGSls1w0S09jfg==","signatures":[{"sig":"MEUCIA5qsQryWAS4x18YVj9i6DMg0oG628URXCeaPEadBjizAiEAl9FVFJnLQvf8JgfyKL1xqWvo9TBrd3ZXbpj+UAVS0lk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fai-sdk@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":74611},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"707770d8444dfababcdc11d677dbd93deff516ee","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5f5ed025-4f70-456b-8969-20143b5d718e"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/ai-sdk"},"_npmVersion":"11.5.1","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@ai-sdk/provider":"^4.0.3","@agent-provider/protocol":"0.1.2"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"peerDependencies":{"ai":">=7.0.34 <8"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.1.2_1784778830111_0.46773671266040884","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agent-provider/ai-sdk","version":"0.1.3","keywords":["browser","llm","ai-sdk","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/ai-sdk@0.1.3","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"a9af89d0e4afac2859551d1e36b9d9a369a939c7","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.3.tgz","fileCount":21,"integrity":"sha512-DcOoNB83NfZEQoKgaZd5lRIpIEvdfE+/q2/nyxGafsOmLPkIrqcSYsyYWAWXcQzfk/NhoTIMpqNxKbI0ihEgjw==","signatures":[{"sig":"MEUCIQDl5Sgu+BtYFdV4KFljl1+5xbE5y9oSjiH+QvsUoLgXwwIgfeO49F3td2lF9xXZWDNAYXeXw20ZrGQIeeV4lkgpfN0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fai-sdk@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":74611},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fb7c39c103b925ce01ef87cd7bf3c7bbb3c4a94f","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5f5ed025-4f70-456b-8969-20143b5d718e"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/ai-sdk"},"_npmVersion":"11.5.1","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@ai-sdk/provider":"^4.0.3","@agent-provider/protocol":"0.1.3"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"peerDependencies":{"ai":">=7.0.34 <8"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.1.3_1784893394388_0.5106300508940038","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agent-provider/ai-sdk","version":"0.1.4","keywords":["browser","llm","ai-sdk","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/ai-sdk@0.1.4","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"d4cd349ab104da418f8b8c3c8a75669fe8f5a7f4","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.4.tgz","fileCount":21,"integrity":"sha512-x+Y9bAwuJGCHJVqhEzT31z7qza6pPFu9ZreTauMJey0OmrdA9WxV4lptb8c61PorTwgm4uEYHgWc7PC6+mC+uw==","signatures":[{"sig":"MEYCIQC6ZrJD6l/4YikpbFaNdZVGgkp4Mb8xjPnR+femHW/yOwIhALm6fRsCcZCjOhzhHD46pQYjytbrLn3J+w4s8GD+n6P9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fai-sdk@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":75767},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f00aa305d5fe6486ad9ded8a89b6069c0c5249f0","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5f5ed025-4f70-456b-8969-20143b5d718e"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/ai-sdk"},"_npmVersion":"11.5.1","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@ai-sdk/provider":"^4.0.3","@agent-provider/protocol":"0.1.4"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"peerDependencies":{"ai":">=7.0.34 <8"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.1.4_1785432142262_0.17392044560395514","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agent-provider/ai-sdk","version":"0.1.5","description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","license":"CC0-1.0 OR Unlicense","repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/ai-sdk"},"keywords":["browser","llm","ai-sdk","agent-provider"],"engines":{"node":">=22"},"publishConfig":{"access":"public","provenance":true},"type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run","clean":"rm -rf dist"},"dependencies":{"@agent-provider/protocol":"0.1.5","@ai-sdk/provider":"^4.0.3"},"peerDependencies":{"ai":">=7.0.34 <8"},"devDependencies":{"ai":"^7.0.34","tsup":"^8.5.1","typescript":"^7.0.2","vitest":"^4.1.10"},"_id":"@agent-provider/ai-sdk@0.1.5","gitHead":"6e48a8d1a19595339cfc67606241ef9280edf3a4","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"homepage":"https://github.com/clankercode/agent-provider#readme","_nodeVersion":"22.23.1","_npmVersion":"11.5.1","dist":{"integrity":"sha512-qsEEaYTGUW15VsWbnw6Zym9qpLA+Ovfg3GMqcknOCQpFICUNx9mUeOLM1t0GKhFRKbBatEAoKQMuSNglJCNRng==","shasum":"90fcb9989c83cd9440f2e46a5c08ccc7aac697f5","tarball":"https://registry.npmjs.org/@agent-provider/ai-sdk/-/ai-sdk-0.1.5.tgz","fileCount":21,"unpackedSize":75767,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fai-sdk@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCIczlKVx26vrNnGJTa5oMxzqMPIrCzzPw0+P03JxGlrwIgIyp7a0RnPdq50sErIp4eqB+7cVjPzIemH5+7Aucmcpc="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5f5ed025-4f70-456b-8969-20143b5d718e"}},"directories":{},"maintainers":[{"name":"xertrov","email":"m@xk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-sdk_0.1.5_1785437740318_0.3333632722929074"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-22T23:59:58.262Z","modified":"2026-07-30T18:55:40.886Z","0.1.0":"2026-07-22T23:59:58.576Z","0.1.1":"2026-07-23T00:20:24.588Z","0.1.2":"2026-07-23T03:53:50.243Z","0.1.3":"2026-07-24T11:43:14.595Z","0.1.4":"2026-07-30T17:22:22.416Z","0.1.5":"2026-07-30T18:55:40.482Z"},"bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"license":"CC0-1.0 OR Unlicense","homepage":"https://github.com/clankercode/agent-provider#readme","keywords":["browser","llm","ai-sdk","agent-provider"],"repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/ai-sdk"},"description":"AI SDK LanguageModel fulfilled through the Agent Provider extension.","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"readme":"# @agent-provider/ai-sdk\n\nAn AI SDK `LanguageModel` provider backed by the user-controlled Agent Provider\nbrowser extension.\n\n```bash\nnpm install @agent-provider/ai-sdk ai\n```\n\nProvider credentials remain in the extension. The page selects a configured\nmodel alias and receives structured bridge failures when permission or policy\nrequirements are not met.\n\n## What it does\n\nThis package implements the AI SDK `LanguageModelV4` interface\n(`@ai-sdk/provider`) on top of the Agent Provider extension bridge. Instead of\ncalling a model API directly, the page sends sanitized requests to the\nextension over a scoped `postMessage` protocol; the extension applies the\nuser's origin grants, quotas, and policy, then brokers the call to a\nuser-configured provider using credentials the page never sees.\n\nPage code passes only allowlisted call options across the boundary: headers and\nprovider-controlled URLs are stripped, non-function tools are dropped, and raw\nchunk inclusion is disabled. The extension re-checks all of this. Failures\n(permission denied, quota exhausted, bridge unavailable, timeouts) surface as\ntyped `AgentProviderBridgeError` instances with `code`, `retryable`, and\n`details` fields, or as `AbortError` `DOMException`s on cancellation.\n\n## Requirements\n\n- A browser with the Agent Provider extension installed, and an exact-origin\n  grant for the calling page. Without the bridge, `connect()` fails with a\n  `BRIDGE_UNAVAILABLE` error.\n- A DOM environment: the default transport uses `window.postMessage`,\n  `ReadableStream`, `crypto.randomUUID`, and `DOMException`. For non-window\n  contexts, supply a custom `AgentProviderBridgeTransport`.\n- `ai` (AI SDK) version 7 or newer, `>=7.0.34 <8`.\n- ESM only; the package ships a single ESM entry point with TypeScript types.\n\n## Quick start\n\n```ts\nimport { generateText } from \"ai\";\nimport { createAgentProviderProvider } from \"@agent-provider/ai-sdk\";\n\nconst agentProvider = createAgentProviderProvider({ appName: \"My App\" });\n\nconst { text } = await generateText({\n  model: agentProvider(\"default\"),\n  prompt: \"Summarize the current page selection.\",\n});\n```\n\nThe argument to the provider is a model alias configured in the extension, not\na provider model ID; it defaults to `\"default\"`. Streaming works through the\nstandard AI SDK APIs (`streamText` and friends) with no extra configuration.\n\n## API\n\n- `createAgentProviderProvider(options?)` — returns a provider callable:\n  `provider(alias?)` or `provider.languageModel(alias?)` produces an AI SDK\n  `LanguageModelV4`; `provider.bridge` exposes the underlying\n  `AgentProviderBridge`. Options: `defaultAlias`, `appName`, `clientId`,\n  `connectTimeoutMs` (default 3000), `requestTimeoutMs` (default 90000), a\n  pre-built `bridge`, or a custom `transport`.\n- `createAgentProviderModel(options?)` — convenience escape hatch returning a\n  `LanguageModel` directly; accepts `alias` plus the bridge options above.\n- `AgentProviderBridge` — lower-level session object. `connect()` opens the\n  session and resolves the extension-reported `BridgeCapabilities`;\n  `requestPermission()` and `refreshPermission()` drive the consent flow;\n  `requestToolApproval()` and `reportToolExecution()` support the tool-use\n  contract; `snapshot` holds the latest capabilities; `dispose()` tears down\n  all pending work.\n- `AgentProviderBridgeError` — structured failure with `code`, `retryable`,\n  and `details`.\n- `AgentProviderBridgeTransport` / `WindowAgentProviderTransport` — transport\n  interface and the default window-based implementation.\n- Re-exported protocol types: `BridgeCapabilities`, `BridgeLimits`,\n  `PermissionState`.\n\n## Links\n\n- [Repository](https://github.com/clankercode/agent-provider) — extension,\n  threat model, and implementation status.\n- [`@agent-provider/protocol`](https://github.com/clankercode/agent-provider/tree/master/packages/protocol)\n  — the wire protocol and capability types this bridge speaks.\n\n## License\n\nCC0-1.0 OR Unlicense.\n","readmeFilename":"README.md"}