{"_id":"@agent-provider/protocol","_rev":"6-42412a7f1778243015ac6296880822a1","name":"@agent-provider/protocol","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@agent-provider/protocol","version":"0.1.0","keywords":["browser","llm","protocol","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/protocol@0.1.0","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"dist":{"shasum":"e035b0ad3170fdf1da870af785f8574cb0fef14a","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.0.tgz","fileCount":17,"integrity":"sha512-X4uAMfj+XltMFem9rqXT3IoyRf2nKDAfx8YU7rDgSRRjLNM4GOTiQMXmqYcDhNOea3S0b/pOZpnwnkqVQFieBg==","signatures":[{"sig":"MEYCIQC6YgnsXF16F5znGYWi3rP6oiQljfCZzs8tef8JbFEOOAIhALRo88mt8UPYW6fgtmlKMVY2OSKszlRmxlrNEpXIsX+r","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67900},"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":"Versioned Agent Provider wire protocol and safe-value codec.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.0_1784764743051_0.46693238562373574","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agent-provider/protocol","version":"0.1.1","keywords":["browser","llm","protocol","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/protocol@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":"486ca57fc035d87b262c9c151ae411c63acfa76c","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.1.tgz","fileCount":17,"integrity":"sha512-qd2EaIS1QjOrGAhzlfFeOIxu8DNrTgNcxFdSiNTtAzRFeCzsEfnscRNyM905rrYNeCOVEleZVM2U13VpCHCwDQ==","signatures":[{"sig":"MEQCIBk/nbW8uJ6KtnAZxzYFMk/VO759LuHx1x7i3DPDb4evAiAqbRyqCdpIB/5TlxXxwBUFZ/QbaX/bnv7vZRHYoTpPrg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fprotocol@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":70927},"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:04064d7d-f11b-4421-8064-d5dfe660ada1"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/protocol"},"_npmVersion":"11.5.1","description":"Versioned Agent Provider wire protocol and safe-value codec.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.1_1784766004113_0.7297147323690565","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agent-provider/protocol","version":"0.1.2","keywords":["browser","llm","protocol","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/protocol@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":"fd2ebf2e88a6c395de15b2ea9886b12a011e880b","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.2.tgz","fileCount":17,"integrity":"sha512-51pE7QPrAlS4d/LeUIPoSf2CreACPkpud65EuPNxflsfdEhEvm90jS1o6VCJe9yiRui/jkz6VI82GG5XRcVq3g==","signatures":[{"sig":"MEYCIQDMzdio9X+Pxq85fDIG8G+9x0ZdHcCGEbH73XkKin3a9wIhAPhjcnE2SQQHts0wVEQSw2lu6XmHLI1lkyt7/g9i86KG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fprotocol@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":70927},"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:04064d7d-f11b-4421-8064-d5dfe660ada1"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/protocol"},"_npmVersion":"11.5.1","description":"Versioned Agent Provider wire protocol and safe-value codec.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.2_1784778819615_0.034747176066014296","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agent-provider/protocol","version":"0.1.3","keywords":["browser","llm","protocol","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/protocol@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":"2fa7ef920b39d119ca6397cb9f6f25224903a51c","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.3.tgz","fileCount":17,"integrity":"sha512-V6AsBFOGYJSkCEsEWsJtJI7sQzDCfSL1HMCjElcMf2YDX0TNT9v9eAf3c2JGk2HFZr1+fuqshWehVoJ3kgmJ7g==","signatures":[{"sig":"MEYCIQDB/b8wrCZIP370Sw1N0cmuV/YbEbZ0Tttg2DzWg3sxkQIhAOqoLqUaCFbNiq2fbgy9f2EbxJ2RDyJvZ6kniecK9byK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fprotocol@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":70927},"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:04064d7d-f11b-4421-8064-d5dfe660ada1"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/protocol"},"_npmVersion":"11.5.1","description":"Versioned Agent Provider wire protocol and safe-value codec.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.3_1784893377454_0.6659752423576975","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agent-provider/protocol","version":"0.1.4","keywords":["browser","llm","protocol","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/protocol@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":"711b2179c617dea419bd84044c1ad04041ae3d62","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.4.tgz","fileCount":19,"integrity":"sha512-VNWNrpKm+2GYiPIkBK2uKiBRqv3biZBUxmv9i31yym2QLnYHMtMHBQVhPtnD2zpbCKj2STe9vnwzzV8cxJl0yw==","signatures":[{"sig":"MEYCIQCH4tuhbV73seR4bkDf4DuK1F2aJtom/vpG3Kly2kW8+gIhAKSWyKwa6bSmf+cvpwWzuVCp/V74mo0MlN7qPxwYq6Jl","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fprotocol@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":85210},"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:04064d7d-f11b-4421-8064-d5dfe660ada1"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/protocol"},"_npmVersion":"11.5.1","description":"Versioned Agent Provider wire protocol and safe-value codec.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.4_1785432130693_0.9542129995467419","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agent-provider/protocol","version":"0.1.5","description":"Versioned Agent Provider wire protocol and safe-value codec.","license":"CC0-1.0 OR Unlicense","repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/protocol"},"keywords":["browser","llm","protocol","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"},"devDependencies":{"tsup":"^8.5.1","typescript":"^7.0.2","vitest":"^4.1.10"},"_id":"@agent-provider/protocol@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-PAU1dByPfspJdKTc2r1v4HWKQq2+qFYslTEhZ5eLahzRD7jlA8nJpQ5s0zEJbS4OotsY8+iBLvJz4AI8iCBqoQ==","shasum":"4551cd8af73b907fb64a8baa8a87bf1f8b947e0a","tarball":"https://registry.npmjs.org/@agent-provider/protocol/-/protocol-0.1.5.tgz","fileCount":19,"unpackedSize":85210,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fprotocol@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGXO8hl6P9Q5U4DEoEe8Cjhk8yz6fHWPn46HbygxFL5OAiEAwiHm10abqcB9KzajI4vNzYJ4dAd/Md9ge6qagB2evQ8="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:04064d7d-f11b-4421-8064-d5dfe660ada1"}},"directories":{},"maintainers":[{"name":"xertrov","email":"m@xk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/protocol_0.1.5_1785437731075_0.6571214409512744"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-22T23:59:02.939Z","modified":"2026-07-30T18:55:31.641Z","0.1.0":"2026-07-22T23:59:03.195Z","0.1.1":"2026-07-23T00:20:04.245Z","0.1.2":"2026-07-23T03:53:39.767Z","0.1.3":"2026-07-24T11:42:57.615Z","0.1.4":"2026-07-30T17:22:10.832Z","0.1.5":"2026-07-30T18:55:31.273Z"},"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","protocol","agent-provider"],"repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/protocol"},"description":"Versioned Agent Provider wire protocol and safe-value codec.","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"readme":"# @agent-provider/protocol\n\nVersioned wire messages, safe-value encoding, guards, and protocol negotiation\nfor Agent Provider browser bridges.\n\n```bash\nnpm install @agent-provider/protocol\n```\n\n## What it does\n\nAgent Provider is a browser extension that brokers user-controlled LLM access\nfor trusted web applications: credentials stay in the extension, and access is\ngranted per exact origin. This package defines the wire contract both sides of\nthat bridge share:\n\n- **Bootstrap messages** (`hello` / `ready` / `reject`) and version\n  negotiation between a page-side client and the extension.\n- **Bridge envelopes** — the typed message shapes for sessions, permission\n  requests and results, model generate/stream/cancel calls, tool approvals,\n  tool execution reports, and structured errors (`BridgeErrorCode`).\n- **Wire values** — a safe-value codec (`encodeWireValue` / `decodeWireValue`)\n  that carries plain JSON plus `undefined`, `bigint`, `Uint8Array`,\n  `ArrayBuffer`, `Date`, and `Error` as tagged values, and rejects functions,\n  symbols, class instances, cyclic objects, and non-finite numbers.\n- **Guards and constructors** — `isBootstrapMessage`, `isBridgeEnvelope`,\n  `isBridgeEnvelopeForDirection`, `isInternalPortMessage`,\n  `createBootstrapHello`, `createBootstrapReady`, `createBridgeEnvelope`, and\n  `negotiateProtocolVersion`, so every incoming message is validated before it\n  is trusted.\n- **Canonicalization** — `canonicalize` and `sha256Canonical`, used to\n  fingerprint approvals and model-alias authority so a granted operation\n  cannot be silently altered before dispatch.\n\n## Quick start\n\n```ts\nimport {\n  createBootstrapHello,\n  isBootstrapMessage,\n  negotiateProtocolVersion,\n  createBridgeEnvelope,\n  encodeWireValue,\n  decodeWireValue,\n} from \"@agent-provider/protocol\";\n\nconst hello = createBootstrapHello({ clientId: \"client-1\", min: 2, max: 2 });\nif (!isBootstrapMessage(hello)) throw new Error(\"invalid hello\");\n\nconst version = negotiateProtocolVersion(hello, { min: 1, max: 2 });\nif (version === undefined) throw new Error(\"no protocol overlap\");\n\nconst envelope = createBridgeEnvelope({\n  direction: \"page-to-extension\",\n  clientId: hello.clientId,\n  type: \"session.open\",\n  requestId: \"req-1\",\n  payload: { sdkVersion: \"0.1.0\" },\n});\n\nconst decoded = decodeWireValue(encodeWireValue({ when: new Date(0) }));\n```\n\nMost applications never touch this package directly — it is the shared\nfoundation under the runtime, React bindings, and the extension itself.\nIntegrate at that level unless you are building a new bridge implementation.\n\n## Notes\n\n- ESM-only; no CommonJS build is published.\n- Intended for browser-capable TypeScript or JavaScript environments: the\n  codec uses `btoa` / `atob`, and `sha256Canonical` uses\n  `globalThis.crypto.subtle` (available in browsers and Node.js 22+).\n- **New in 0.1.4** — `sha256Canonical` now has a pure-JS SHA-256\n  fallback (`sha256Hex`) that activates when `crypto.subtle` is unavailable\n  (non-secure HTTP origins, sandboxed iframes). Returns the same 64 lowercase\n  hex chars as Web Crypto. This fixes tool execution on LAN HTTP dogfood\n  origins where `isSecureContext === false`.\n- This package defines message shapes and validation only. It does not open\n  ports, grant permissions, or hold credentials — that is the extension's job.\n\n## Links\n\n- Repository: <https://github.com/clankercode/agent-provider>\n- Sibling packages: `@agent-provider/runtime`, `@agent-provider/context`,\n  `@agent-provider/ai-sdk`, `@agent-provider/react`, `@agent-provider/webmcp`\n\n## License\n\nCC0-1.0 OR Unlicense.\n","readmeFilename":"README.md"}