{"_id":"@agenticprimitives/chain-state","_rev":"4-68c389f8f00d0a00ba1467e69d6db7e6","name":"@agenticprimitives/chain-state","dist-tags":{"latest":"0.0.0-alpha.4"},"versions":{"0.0.0-alpha.1":{"name":"@agenticprimitives/chain-state","version":"0.0.0-alpha.1","keywords":["agentic","primitives","chain","evidence","revocation"],"license":"MIT","_id":"@agenticprimitives/chain-state@0.0.0-alpha.1","maintainers":[{"name":"richcanvas","email":"richardpedersen3@gmail.com"}],"homepage":"https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/chain-state","bugs":{"url":"https://github.com/agentictrustlabs/agenticprimitives/issues"},"dist":{"shasum":"56522aca1ea1898d88d26003dfe727a81631d97f","tarball":"https://registry.npmjs.org/@agenticprimitives/chain-state/-/chain-state-0.0.0-alpha.1.tgz","fileCount":20,"integrity":"sha512-H1kG3YM4PEqgmmEElELbM50J71NqNKzpo8NI0ZYyVu7BtFY3p/i69k0hyfNYSRowryQoX2hU4KgqyvznUozfZA==","signatures":[{"sig":"MEUCIB9xyZwNaaUvqF2cIzD5+BtbhspfB/xZvmZ5nFasDiutAiEA9820DnlQQER0aV0RVcvs5otmiX00RhTq1IoGEnzvy18=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33167},"main":"./dist/index.js","type":"module","_from":"file:agenticprimitives-chain-state-0.0.0-alpha.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","test:unit":"vitest run test/unit --passWithNoTests","typecheck":"tsc -p tsconfig.json --noEmit","test:watch":"vitest"},"_npmUser":{"name":"richcanvas","email":"richardpedersen3@gmail.com"},"_resolved":"/tmp/d077d5dc43905135e23d14053f8b9a04/agenticprimitives-chain-state-0.0.0-alpha.1.tgz","_integrity":"sha512-H1kG3YM4PEqgmmEElELbM50J71NqNKzpo8NI0ZYyVu7BtFY3p/i69k0hyfNYSRowryQoX2hU4KgqyvznUozfZA==","repository":{"url":"git+https://github.com/agentictrustlabs/agenticprimitives.git","type":"git","directory":"packages/chain-state"},"_npmVersion":"11.16.0","description":"The chain-read authority port: resilient, evidence-bearing, fail-closed reads (isDelegationRevoked, verifySmartAgentSignature, isSessionDelegationAccepted) over multiple injected providers with circuit breakers, divergence detection, and bounded revocatio","directories":{},"_nodeVersion":"24.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.8"},"_npmOperationalInternal":{"tmp":"tmp/chain-state_0.0.0-alpha.1_1782902640488_0.08847997566145893","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.2":{"name":"@agenticprimitives/chain-state","version":"0.0.0-alpha.2","keywords":["agentic","primitives","chain","evidence","revocation"],"license":"MIT","_id":"@agenticprimitives/chain-state@0.0.0-alpha.2","maintainers":[{"name":"richcanvas","email":"richardpedersen3@gmail.com"}],"homepage":"https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/chain-state","bugs":{"url":"https://github.com/agentictrustlabs/agenticprimitives/issues"},"dist":{"shasum":"5b66ba2cc85958d64c6c3f359fea80429fd9fadc","tarball":"https://registry.npmjs.org/@agenticprimitives/chain-state/-/chain-state-0.0.0-alpha.2.tgz","fileCount":20,"integrity":"sha512-mxnELB81QQYhyNhEp/lR/9Rk+gxsXB9LHHU3PN2lfn+hMpOwa106yP+wrrDob06qsspgSyO3ap29fLhrHFZXgA==","signatures":[{"sig":"MEYCIQCWmHf1eYNtV3lrXUcRpivYAFA0sEmstjcYmwpRgiFwnwIhAMMTQVvVfqYmS0btqnTdh3vAyvPZDz8j2Oxh2Yqet9WV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33167},"main":"./dist/index.js","type":"module","_from":"file:agenticprimitives-chain-state-0.0.0-alpha.2.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","test:unit":"vitest run test/unit --passWithNoTests","typecheck":"tsc -p tsconfig.json --noEmit","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1ebdfd00-a761-46a0-8262-13abf7cdcb94"}},"_resolved":"/tmp/2a40dc7899a2257786d8fea2538a6dc4/agenticprimitives-chain-state-0.0.0-alpha.2.tgz","_integrity":"sha512-mxnELB81QQYhyNhEp/lR/9Rk+gxsXB9LHHU3PN2lfn+hMpOwa106yP+wrrDob06qsspgSyO3ap29fLhrHFZXgA==","repository":{"url":"git+https://github.com/agentictrustlabs/agenticprimitives.git","type":"git","directory":"packages/chain-state"},"_npmVersion":"11.19.0","description":"The chain-read authority port: resilient, evidence-bearing, fail-closed reads (isDelegationRevoked, verifySmartAgentSignature, isSessionDelegationAccepted) over multiple injected providers with circuit breakers, divergence detection, and bounded revocatio","directories":{},"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.8"},"_npmOperationalInternal":{"tmp":"tmp/chain-state_0.0.0-alpha.2_1789164087354_0.2679582478872524","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.3":{"name":"@agenticprimitives/chain-state","version":"0.0.0-alpha.3","keywords":["agentic","primitives","chain","evidence","revocation"],"license":"MIT","_id":"@agenticprimitives/chain-state@0.0.0-alpha.3","maintainers":[{"name":"richcanvas","email":"richardpedersen3@gmail.com"}],"homepage":"https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/chain-state","bugs":{"url":"https://github.com/agentictrustlabs/agenticprimitives/issues"},"dist":{"shasum":"71ec7233fbb42a80ae1721b547c5c6570b920338","tarball":"https://registry.npmjs.org/@agenticprimitives/chain-state/-/chain-state-0.0.0-alpha.3.tgz","fileCount":20,"integrity":"sha512-7XiY9HbQ4BKdxUQZtlXniw7G/3SelnKvsbUcTG0HGpvWBCScOXgCXitBCgzUZeosldOUZK+ij5PNFkfnKSUe3w==","signatures":[{"sig":"MEQCIHnOHMNmBcHRuUFO0h5mcZAFm3INs3Vf/KMNAzJdGX9uAiApQoD4vGq1DxiocpxUHqTl95dKratvdRnPa9g0rBJP7A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33167},"main":"./dist/index.js","type":"module","_from":"file:agenticprimitives-chain-state-0.0.0-alpha.3.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","test:unit":"vitest run test/unit --passWithNoTests","typecheck":"tsc -p tsconfig.json --noEmit","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1ebdfd00-a761-46a0-8262-13abf7cdcb94"}},"_resolved":"/tmp/920a26e91718425180328e14ab57e6a6/agenticprimitives-chain-state-0.0.0-alpha.3.tgz","_integrity":"sha512-7XiY9HbQ4BKdxUQZtlXniw7G/3SelnKvsbUcTG0HGpvWBCScOXgCXitBCgzUZeosldOUZK+ij5PNFkfnKSUe3w==","repository":{"url":"git+https://github.com/agentictrustlabs/agenticprimitives.git","type":"git","directory":"packages/chain-state"},"_npmVersion":"11.19.0","description":"The chain-read authority port: resilient, evidence-bearing, fail-closed reads (isDelegationRevoked, verifySmartAgentSignature, isSessionDelegationAccepted) over multiple injected providers with circuit breakers, divergence detection, and bounded revocatio","directories":{},"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.8"},"_npmOperationalInternal":{"tmp":"tmp/chain-state_0.0.0-alpha.3_1789230509564_0.8164625728187471","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.4":{"_id":"@agenticprimitives/chain-state@0.0.0-alpha.4","bugs":{"url":"https://github.com/agentictrustlabs/agenticprimitives/issues"},"dist":{"shasum":"f46858dbd2259f3fb4a351098f144b925f7c2a18","tarball":"https://registry.npmjs.org/@agenticprimitives/chain-state/-/chain-state-0.0.0-alpha.4.tgz","fileCount":20,"integrity":"sha512-deQGXpwqo6uRx/vJ2tTGECq5SEvXbGnYdl4IufYPDkZfFL4n+SluAabS4LooBoM+1rsy6Ct70g24OOTO98jSHA==","signatures":[{"sig":"MEYCIQCI6LB//LsqJvRdyFw59dk+7IVINiZimDRmxX3fQKoemQIhAI3CXnyfVIHFKmtnfPS6yuJIz81J5dqFzeCztLMUbzUM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCUPEcNBY//FIgG0fByKBt/M38QAkmRycUEmPXV2DU7yQIgQpA2kPGPBChjzJgo2iOnsk1+2i9npaSD4FjtKif9CfY="}],"unpackedSize":33662},"main":"./dist/index.js","name":"@agenticprimitives/chain-state","type":"module","_from":"file:agenticprimitives-chain-state-0.0.0-alpha.4.tgz","types":"./dist/index.d.ts","author":{"url":"https://agenticprimitives.dev","name":"Agentic Trust Labs"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"MIT","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","test:unit":"vitest run test/unit --passWithNoTests","typecheck":"tsc -p tsconfig.json --noEmit","test:watch":"vitest"},"version":"0.0.0-alpha.4","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1ebdfd00-a761-46a0-8262-13abf7cdcb94"}},"homepage":"https://agenticprimitives.dev","keywords":["agentic","primitives","chain","evidence","revocation","agentic-primitives","agenticprimitives","ai-agents","agent-authority","agentic-trust"],"_resolved":"/tmp/f7ab9e744ceed09839d714d4ecec3a5d/agenticprimitives-chain-state-0.0.0-alpha.4.tgz","_integrity":"sha512-deQGXpwqo6uRx/vJ2tTGECq5SEvXbGnYdl4IufYPDkZfFL4n+SluAabS4LooBoM+1rsy6Ct70g24OOTO98jSHA==","repository":{"url":"git+https://github.com/agentictrustlabs/agenticprimitives.git","type":"git","directory":"packages/chain-state"},"_npmVersion":"11.19.0","description":"The chain-read authority port: resilient, evidence-bearing, fail-closed reads (isDelegationRevoked, verifySmartAgentSignature, isSessionDelegationAccepted) over multiple injected providers with circuit breakers, divergence detection, and bounded revocatio","directories":{},"maintainers":[{"name":"richcanvas","email":"richardpedersen3@gmail.com"}],"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.8"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chain-state_0.0.0-alpha.4_1789814922509_0.5715914757097271"}}},"time":{"created":"2026-07-01T10:44:00.327Z","modified":"2026-09-19T10:48:42.872Z","0.0.0-alpha.1":"2026-07-01T10:44:00.621Z","0.0.0-alpha.2":"2026-09-11T22:01:27.509Z","0.0.0-alpha.3":"2026-09-12T16:28:29.715Z","0.0.0-alpha.4":"2026-09-19T10:48:42.618Z"},"bugs":{"url":"https://github.com/agentictrustlabs/agenticprimitives/issues"},"license":"MIT","homepage":"https://agenticprimitives.dev","keywords":["agentic","primitives","chain","evidence","revocation","agentic-primitives","agenticprimitives","ai-agents","agent-authority","agentic-trust"],"repository":{"url":"git+https://github.com/agentictrustlabs/agenticprimitives.git","type":"git","directory":"packages/chain-state"},"description":"The chain-read authority port: resilient, evidence-bearing, fail-closed reads (isDelegationRevoked, verifySmartAgentSignature, isSessionDelegationAccepted) over multiple injected providers with circuit breakers, divergence detection, and bounded revocatio","maintainers":[{"name":"richcanvas","email":"richardpedersen3@gmail.com"}],"readme":"# @agenticprimitives/chain-state\n\n> Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)\n\nThe chain-read **authority port** — resilient, evidence-bearing, fail-closed.\n\nAn authorization decision rests on a handful of chain reads (is this delegation revoked? does this Smart\nAgent's signature validate? is this session delegation accepted?). Those reads are part of the security\ndecision, so they cannot run on a single flaky RPC with no evidence and no freshness contract. This\npackage wraps multiple **injected** providers with per-provider circuit breakers, timeouts, divergence\ndetection, and a strict revocation-freshness rule — and every answer carries the block it was decided\nagainst.\n\nSee [spec 289](../../specs/289-chain-state-authority-port.md) +\n[ADR-0042](../../docs/architecture/decisions/0042-chain-state-is-the-chain-read-authority-port.md).\n\n## Usage\n\n```ts\nimport { createChainAuthorityReader, type ChainProvider } from '@agenticprimitives/chain-state';\n\n// Providers are injected — an app wires a viem-backed adapter (readContract only, ADR-0012).\nconst providers: ChainProvider[] = [makeViemProvider('alchemy', rpcA), makeViemProvider('infura', rpcB)];\n\nconst reader = createChainAuthorityReader({\n  chainId: 8453,\n  providers,\n  revocationFreshnessMs: 12_000,   // a cached \"not revoked\" is good for 12s, then re-read\n  onDivergence: (e) => metrics.increment('chain_state.divergence', { method: e.method }),\n});\n\nconst { revoked, evidence } = await reader.isDelegationRevoked(delegationHash);\n// evidence = { chainId, blockNumber, blockHash, observedAt, source } — log it with the allow/deny.\n\n// Critical-risk reads require all providers to agree, else fail closed:\nconst sig = await reader.verifySmartAgentSignature({ signer, digest, signature }, 'critical');\n```\n\n## The freshness invariant (ADR-0013 applied to time)\n\n- A **known-revoked** grant is cached forever (revocation is monotonic) — subsequent calls short-circuit.\n- A cached **not revoked** answer is authoritative only within `revocationFreshnessMs`; past the window\n  it is re-read. A failed re-read fails **closed** (treated as revoked) — a stale cache is never the final\n  revocation authority.\n\n## What it is not\n\n- Not a chain library — `ChainProvider` is injected; the viem adapter lives in the consumer.\n- Not the verify orchestration — `delegation`/`mcp-runtime` call this port; `chain-state` never imports\n  them (no back-edge).\n- Not an indexer — this is the per-decision read port, not a CQRS read model.\n\n## License\n\nMIT\n","readmeFilename":"README.md","author":{"url":"https://agenticprimitives.dev","name":"Agentic Trust Labs"}}