{"_id":"@agent-provider/runtime","_rev":"6-cfa8ca1ce5dd7f226252c156e8e804b6","name":"@agent-provider/runtime","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@agent-provider/runtime","version":"0.1.0","keywords":["browser","llm","agent","tools","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/runtime@0.1.0","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"dist":{"shasum":"79a65f3d6b0de6afbf6401cce55230f33d40f9e8","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.0.tgz","fileCount":19,"integrity":"sha512-FTRE2wfbHFURo03j7f1fX4X11U/4Ykzxy9V2s/v2ZLZRbCzNnjGnFQJNy+GNN20hEFZ3/0xwc0jkzVnMOJSByQ==","signatures":[{"sig":"MEQCIDwFC/vANNnTuAydj7xLxzq8iQd67uV3uKbZlp+7QS0NAiBlP81l6LeQTv3uR3wC+gF17NyxGVP8SC6uJtpSRwMp/g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90831},"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":"Headless page runtime, tool execution, approval, and context lifecycle.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/ai-sdk":"0.1.0","@agent-provider/context":"0.1.0","@agent-provider/protocol":"0.1.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/runtime_0.1.0_1784764811900_0.13817118235064152","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agent-provider/runtime","version":"0.1.1","keywords":["browser","llm","agent","tools","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/runtime@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":"ff2402915202089dc7437cd5069e0c3f6f22b99b","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.1.tgz","fileCount":19,"integrity":"sha512-mfTBNWcSrMFDalYzNUQL8+Uf3OVjYyTIAVwbdCtUbmr0W43bARR/4zd/QolhHWtCALAhkAKuShQNueuFlp1DIQ==","signatures":[{"sig":"MEUCIAedc434IeJCfx6JiEj0P/yf7zNwK4llxLepgke2FnABAiEA8yOJZvoR86qM7MB6/yoCOdCLggdMyhhpvSSzEE2lbeA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fruntime@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":94236},"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:026e03df-fc6f-40a7-969c-c4a2ab8b7bcd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/runtime"},"_npmVersion":"11.5.1","description":"Headless page runtime, tool execution, approval, and context lifecycle.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/ai-sdk":"0.1.1","@agent-provider/context":"0.1.1","@agent-provider/protocol":"0.1.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/runtime_0.1.1_1784766033735_0.628862937251133","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agent-provider/runtime","version":"0.1.2","keywords":["browser","llm","agent","tools","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/runtime@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":"6869c797f43b79a7104cf641b4e6ea4b13e92769","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.2.tgz","fileCount":19,"integrity":"sha512-lWJC67cT8g9056TpmHx68qOxq7e6dw2iOV+dRrkvJg6dc4I0FnoDqUo+0GwrL2Cii8DmfEoyaCb+Mw6Po2cW8g==","signatures":[{"sig":"MEUCICKIB5cfkfiyiAm12mZfOYSAcwEaZRNNc6blYo5isUEoAiEAz0lqQJx9ao/NLkzVLrm/slUVudWy7VbjY7gYTiCuaGg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fruntime@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":94236},"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:026e03df-fc6f-40a7-969c-c4a2ab8b7bcd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/runtime"},"_npmVersion":"11.5.1","description":"Headless page runtime, tool execution, approval, and context lifecycle.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/ai-sdk":"0.1.2","@agent-provider/context":"0.1.2","@agent-provider/protocol":"0.1.2"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/runtime_0.1.2_1784778834885_0.7370085541420275","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agent-provider/runtime","version":"0.1.3","keywords":["browser","llm","agent","tools","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/runtime@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":"4fa07f4cd90da5a5ce42a20990820ed98a81ca31","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.3.tgz","fileCount":19,"integrity":"sha512-gTx6rzO6mNkgp2SjAdkhkP8RigH5EdtLsDh59s4Jl+UN3K1abh4yuQR3t1NgoxyoUSWvfhj4Q5oImAKe1CMFQg==","signatures":[{"sig":"MEQCIGeAE15EV0loWB/ls41YlT7BJyNR2WFrcYUWmgKY+PX5AiAIYmawfoibx3bHUDMHjTxtozlNaFWlQQmFgqdqflwuiQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fruntime@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":94236},"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:026e03df-fc6f-40a7-969c-c4a2ab8b7bcd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/runtime"},"_npmVersion":"11.5.1","description":"Headless page runtime, tool execution, approval, and context lifecycle.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/ai-sdk":"0.1.3","@agent-provider/context":"0.1.3","@agent-provider/protocol":"0.1.3"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/runtime_0.1.3_1784893402702_0.10896054149631484","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agent-provider/runtime","version":"0.1.4","keywords":["browser","llm","agent","tools","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/runtime@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":"d587cbedc29632d676c51f0660513aff88d706b0","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.4.tgz","fileCount":21,"integrity":"sha512-MfihJ2qEfhksc/8bRGU/lNXo8Th8EFtEdQxsmet9q4mT29pg5FoTYJ+JHCND6PcGkb6kI1qATHq46RYZ8GHGng==","signatures":[{"sig":"MEUCIF69pvpQyhi2oGKFaLEKgO0OZqsir7ZoBYpGCEm8Y58jAiEA185/EAjK1hVo+1KrRIHRBW+wNnkfkwtCb8br+mBYpyg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fruntime@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1562571},"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:026e03df-fc6f-40a7-969c-c4a2ab8b7bcd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/runtime"},"_npmVersion":"11.5.1","description":"Headless page runtime, tool execution, approval, and context lifecycle.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/ai-sdk":"0.1.4","@agent-provider/context":"0.1.4","@agent-provider/protocol":"0.1.4"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/runtime_0.1.4_1785432146933_0.38050529211982287","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agent-provider/runtime","version":"0.1.5","description":"Headless page runtime, tool execution, approval, and context lifecycle.","license":"CC0-1.0 OR Unlicense","repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/runtime"},"keywords":["browser","llm","agent","tools","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/ai-sdk":"0.1.5","@agent-provider/context":"0.1.5","@agent-provider/protocol":"0.1.5","ai":">=7.0.34 <8"},"devDependencies":{"tsup":"^8.5.1","typescript":"^7.0.2","vitest":"^4.1.10","zod":"^4.4.3"},"_id":"@agent-provider/runtime@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-01WCu3YN/kUZsuTInp0hnJYOrDb20MCIx/m71juBp44k77bL2/MxXzpB+XznTvV8eTXHclBeUQqQcBVYb6VSJA==","shasum":"324a1164feb5181ff6341128b79881e32ca729bf","tarball":"https://registry.npmjs.org/@agent-provider/runtime/-/runtime-0.1.5.tgz","fileCount":21,"unpackedSize":1562571,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fruntime@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDAhMuo8K5pKtQik/c8qZY9akK4+vMsotPV9OS3qtBbrAiEAmakxvRGZE09PYIfA/wqIEZe/YMcx+8n54C18Nc2S0EE="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:026e03df-fc6f-40a7-969c-c4a2ab8b7bcd"}},"directories":{},"maintainers":[{"name":"xertrov","email":"m@xk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/runtime_0.1.5_1785437744838_0.378698700569575"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T00:00:11.764Z","modified":"2026-07-30T18:55:45.335Z","0.1.0":"2026-07-23T00:00:12.032Z","0.1.1":"2026-07-23T00:20:33.875Z","0.1.2":"2026-07-23T03:53:55.022Z","0.1.3":"2026-07-24T11:43:22.835Z","0.1.4":"2026-07-30T17:22:27.183Z","0.1.5":"2026-07-30T18:55:44.982Z"},"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","agent","tools","agent-provider"],"repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/runtime"},"description":"Headless page runtime, tool execution, approval, and context lifecycle.","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"readme":"# @agent-provider/runtime\n\nHeadless Agent Provider runtime with typed tools, observable run state,\ncontext lifecycle, and page-native mutation approval.\n\n```bash\nnpm install @agent-provider/runtime\n```\n\nThe runtime is UI-agnostic and ESM-only. Browser extension installation and an\nexplicit exact-origin grant are required for model execution.\n\n## What it does\n\n`@agent-provider/runtime` lets a trusted web application run a typed,\ntool-using agent without owning the user's model credentials. The application\ndeclares tools with schemas, risk levels, and confirmation rules; the Agent\nProvider browser extension brokers access to a user-configured model provider,\nmediates approvals, and keeps credentials out of page JavaScript.\n\nThe runtime exposes a single observable state object (connection, run state,\nmessages, tool activity, pending approvals) with a subscribe/getSnapshot\ninterface, so any UI layer can render it. Expected failures — permission\ndenied, policy denial, timeout, cancellation, bridge loss — resolve as\nstructured outcomes, not unhandled exceptions.\n\n## Quick start\n\n```ts\nimport { instantChatbot } from \"@agent-provider/runtime\";\nimport { z } from \"zod\";\n\nconst runtime = instantChatbot({\n  appName: \"Example App\",\n  instructions: \"Use tools instead of inventing page data.\",\n  tools: {\n    get_title: {\n      description: \"Return the current document title.\",\n      inputSchema: z.object({}),\n      risk: \"read\",\n      execute: () => document.title,\n    },\n  },\n});\n\nconst unsubscribe = runtime.subscribe(() => {\n  const state = runtime.getSnapshot();\n  // Render state.messages, state.approvals, state.toolActivity in your UI.\n});\n\nawait runtime.connect();\nawait runtime.requestPermission(\"Read page data to answer questions.\");\nconst outcome = await runtime.send(\"What is this page about?\");\n// outcome is { ok: true, code: \"completed\" } or { ok: false, code, message, retryable }.\n```\n\nAny schema library supported by the AI SDK works for `inputSchema` (Zod shown\nabove). `createAgentRuntime` is an alias of `instantChatbot`; use the\n`AgentProviderRuntime` class directly when you need to supply your own\n`LanguageModel` or bridge.\n\n## Approvals\n\nTools carry a `risk` of `\"read\"`, `\"write\"`, or `\"destructive\"`. Read tools run\nwithout in-page confirmation by default; write and destructive tools pause for\nexplicit user approval unless a `confirmation` rule says otherwise. When the\nextension bridge is connected, consequential calls are also subject to\nextension-side approval and are reported to the extension for audit.\n\nPending approvals appear in `state.approvals`; resolve them from your UI with\n`runtime.resolveApproval(id, approved)`. Unresolved approvals time out\n(`maxApprovalWaitMs`, default 120 seconds) and deny.\n\n## Notes\n\n- ESM-only, `sideEffects: false`, requires Node.js 22 or newer.\n- The bridge talks to the extension over `window.postMessage`; a page context\n  is required for extension-mediated execution.\n- Page context is opt-in and bounded: pass a `PageContext` from\n  `@agent-provider/context` — the runtime never reads the DOM directly.\n- Tool outputs are capped at 256 KiB per call.\n- Call `runtime.destroy()` on teardown; it cancels active runs and pending\n  approvals and disposes the bridge.\n\n### Dev-only debug tools\n\n**New in 0.1.4** — `createDebugTools()` returns a set of side-effect-free\ntools for testing the tool-call pipeline. Guard with `import.meta.env.DEV` —\nnever include in production builds.\n\n```ts\nimport { instantChatbot, createDebugTools } from \"@agent-provider/runtime\";\n\nconst debugTools = import.meta.env.DEV ? createDebugTools() : {};\nconst runtime = instantChatbot({\n  tools: {\n    ...debugTools,\n    // your real tools here\n  },\n});\n```\n\nAvailable debug tools: `debug_echo`, `debug_echo_delayed`, `debug_sleep`,\n`debug_ap_info` (returns run/tool IDs), `debug_models`.\n\n### Runtime getters\n\n**New in 0.1.4** — `AgentProviderRuntime` exposes two read-only\ngetters for UI display:\n\n- `runtime.toolCount` — number of page-declared tools.\n- `runtime.modelLabel` — resolved model + reasoning for the active alias\n  (e.g. `\"gpt-5-mini high\"`), read from bridge capabilities.\n\n## Links\n\n- Repository: https://github.com/clankercode/agent-provider\n- `@agent-provider/context` — bounded, revisioned page-context extraction.\n- `@agent-provider/react` — React bindings and reference chat UI for this\n  runtime.\n- `@agent-provider/ai-sdk` — the underlying AI SDK `LanguageModel` bridge.\n\n## License\n\nCC0-1.0 OR Unlicense.\n","readmeFilename":"README.md"}