{"_id":"@agentactioncapsule/emit","name":"@agentactioncapsule/emit","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@agentactioncapsule/emit","version":"0.1.0","description":"Agent Action Capsule — spec-pure JS/TS: jcs-n canonicalization, CPB derive_id, emit, verify (draft-mih-scitt-agent-action-capsule-02)","type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"repository":{"type":"git","url":"git+https://github.com/action-state-group/capsule-emit-js.git"},"devDependencies":{"@types/node":"^22.0.0","tsup":"^8.0.0","typescript":"^5.5.0","vitest":"^2.0.0"},"engines":{"node":">=18.0.0"},"license":"Apache-2.0","_id":"@agentactioncapsule/emit@0.1.0","bugs":{"url":"https://github.com/action-state-group/capsule-emit-js/issues"},"homepage":"https://github.com/action-state-group/capsule-emit-js#readme","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-759mTKKTOV+PuS4FRKhfffqswxZUMLsP/5+fRQpajZV8l0fzKNZVDVDvkkMtyr21jofLUXO1i2WVoy7/VsFcAg==","shasum":"4290b95679c857bdb51e6c95e86df6bc3182a719","tarball":"https://registry.npmjs.org/@agentactioncapsule/emit/-/emit-0.1.0.tgz","fileCount":8,"unpackedSize":92629,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD9fb+ctsv4L320/9KCTvSw3+E4SjCB8B2ws7fA8n5jrgIhAIQyl85cu43L6dqmJn0/QMYSoCfTF8UCmMVnU0Soq2c0"}]},"_npmUser":{"name":"stevenmih","email":"steven@actionstate.ai"},"directories":{},"maintainers":[{"name":"stevenmih","email":"steven@actionstate.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emit_0.1.0_1785540882082_0.40299384053546405"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T23:34:41.868Z","0.1.0":"2026-07-31T23:34:42.241Z","modified":"2026-07-31T23:34:42.487Z"},"maintainers":[{"name":"stevenmih","email":"steven@actionstate.ai"}],"description":"Agent Action Capsule — spec-pure JS/TS: jcs-n canonicalization, CPB derive_id, emit, verify (draft-mih-scitt-agent-action-capsule-02)","homepage":"https://github.com/action-state-group/capsule-emit-js#readme","repository":{"type":"git","url":"git+https://github.com/action-state-group/capsule-emit-js.git"},"bugs":{"url":"https://github.com/action-state-group/capsule-emit-js/issues"},"license":"Apache-2.0","readme":"# capsule-emit-js\n\nSpec-pure JavaScript/TypeScript port of the\n[Agent Action Capsule](https://github.com/action-state-group/agent-action-capsule)\ncanonicalization, emission, and verification core.\n\nImplements:\n\n- **Algorithm jcs-n** — absent-field normalization + RFC 8785 JCS + SHA-256\n  (draft-mih-sokolov-scitt-payload-binding-00 §3.1)\n- **Derived identifier** — `derive_id`, `verify_carried_id`\n  (draft-mih-sokolov-scitt-payload-binding-00 §4)\n- **Typed digest references** — `make_typed_ref`, `verify_typed_ref`\n  (draft-mih-sokolov-scitt-payload-binding-00 §6)\n- **emit()** — sealed Agent Action Capsule builder with self-attestation\n  (draft-mih-scitt-agent-action-capsule-02 §5)\n- **verify() + verify_store()** — Class 1 payload verifier, all §6 checks\n  (draft-mih-scitt-agent-action-capsule-02 §6)\n\n**The vector suite is the acceptance gate.** The 60-vector suite (27 CPB\nconformance vectors + 33 AAC assertions against 32 frozen capsule cases)\nruns on every push and pull request. Passing the same vectors as the Python\nand Go reference implementations establishes byte-level compatibility.\n\n---\n\n## Requirements\n\nNode.js ≥ 18. No production dependencies — uses only `node:crypto`.\n\n## Install\n\n```sh\nnpm install agent-action-capsule   # name TBD — see below\n```\n\n> **Note:** The npm package name has not been finalized. The library is\n> published at the operator's discretion. Do not rely on the current\n> `package.json` name field until a stable release is tagged.\n\n## Usage\n\n### Emit a capsule\n\n```typescript\nimport { emit } from 'agent-action-capsule';\n\nconst capsule = emit({\n  action_type: 'decide',\n  operator: 'acme-corp',\n  developer: 'purchase-agent@v1',\n  tool_name: 'submit_purchase_order',\n  disposition: {\n    decision: 'accept',\n    approver: 'policy',\n    verdict_class: 'executed',\n  },\n  effect: { status: 'confirmed', type: 'write_order', response_digest: '<64-hex>' },\n});\nconsole.log(capsule.capsule_id); // 64-char lowercase hex\n```\n\n### Verify a capsule\n\n```typescript\nimport { verify } from 'agent-action-capsule';\n\nconst result = verify(capsuleDictFromStorage);\nconsole.log(result.ok);        // boolean\nconsole.log(result.findings);  // [{code, detail, severity, check}]\nconsole.log(result.capsule_id); // recomputed capsule_id (null if uncomputable)\n```\n\n### JCS-N canonicalization (CPB)\n\n```typescript\nimport { canonicalDigest, deriveId, normalize, jcs } from 'agent-action-capsule';\n\n// Canonical digest with exclusion set\nconst digest = canonicalDigest(payload, ['record_id']);\n\n// Derive and verify a carried identifier\nimport { deriveId, verifyCarriedId } from 'agent-action-capsule';\nconst id = deriveId(payload, ['record_id']);\nverifyCarriedId(payloadWithCarriedId, 'record_id', ['record_id']); // throws on mismatch\n```\n\n### Typed digest references\n\n```typescript\nimport { makeTypedRef, verifyTypedRef } from 'agent-action-capsule';\n\nconst ref = makeTypedRef(artifactPayload, {\n  name: 'authorization-doc',\n  exclusion_set: ['doc_id'],\n});\n// ref = { type: 'authorization-doc', digest_alg: 'SHA-256', digest: '...' }\n\nverifyTypedRef(ref, artifactPayload, { name: 'authorization-doc', exclusion_set: ['doc_id'] });\n```\n\n## Run the vector suite\n\n```sh\nnpm install\nnpm test\n```\n\nExpected output: **60 passed** (vitest).\n\nThe vectors are vendored in `test-vectors/`:\n- `test-vectors/cpb/` — CPB conformance vectors from\n  `scitt-payload-binding@cpb-vectors-and-ref-impl`\n- `test-vectors/aac/` — AAC conformance vectors from\n  `agent-action-capsule/test-vectors/`\n\n## Phase 1 scope and honest limitations\n\n**In scope (phase 1):**\n\n- Algorithm jcs-n: normalize, jcs, json_digest, canonical_digest,\n  compute_capsule_id\n- CPB: derive_id, verify_carried_id, make_typed_ref, verify_typed_ref\n- AAC emit(): capsule builder, seal, field assembly, effect-mode derivation\n- AAC Class 1 verify() + verify_store(): all eight structural/semantic checks\n  in §6, plus domain/provenance registry checks\n\n**Not in scope (phase 1):**\n\n- **Anchor client** — no HTTP submission to a SCITT Transparency Service;\n  the `anchored` assurance mode is not claimed\n- **Framework adapters** — no MCP, LangChain.js, or Vercel AI SDK wrappers\n  (planned phase 2)\n- **Substrate verification** — COSE_Sign1 signature and Receipt verification\n  are out of scope for the Class 1 payload verifier (same scope as the\n  Python/Go reference implementations)\n- **Class 2 (manifest-aware) verification** — out of scope per spec\n- **Selective disclosure mechanics** — the SD-encoded-form hook in\n  `derive_id` is included; the full SD presentation layer is not\n- **npm publication** — not published; no release yet\n\n## Specs\n\n- **CPB:** [draft-mih-sokolov-scitt-payload-binding-00](https://github.com/action-state-group/scitt-payload-binding)\n- **AAC:** [draft-mih-scitt-agent-action-capsule-02](https://github.com/action-state-group/agent-action-capsule)\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n\nAll contributions require a DCO `Signed-off-by` line (`git commit -s`).\n","readmeFilename":"README.md","_rev":"1-a9a59cf63fbf3bce492be8ee91283a56"}