@agent-custody/receipts 0.16.4 → 0.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +7 -4
  2. package/dist/a2a.js +1 -1
  3. package/dist/cli.js +50 -7
  4. package/dist/console-page.js +144 -50
  5. package/dist/deny-report.d.ts +7 -0
  6. package/dist/deny-report.js +14 -5
  7. package/dist/design.d.ts +11 -0
  8. package/dist/design.js +91 -0
  9. package/dist/index.d.ts +4 -0
  10. package/dist/index.js +3 -0
  11. package/dist/log-admin.d.ts +2 -0
  12. package/dist/log-admin.js +113 -62
  13. package/dist/log-store.d.ts +8 -2
  14. package/dist/log-store.js +24 -12
  15. package/dist/perathos.d.ts +50 -0
  16. package/dist/perathos.js +187 -0
  17. package/dist/portal.d.ts +66 -5
  18. package/dist/portal.js +923 -246
  19. package/dist/session-audit.d.ts +46 -0
  20. package/dist/session-audit.js +150 -0
  21. package/dist/site-links.d.ts +23 -0
  22. package/dist/site-links.js +29 -0
  23. package/docs/acs.md +2 -0
  24. package/docs/approvals.md +1 -1
  25. package/docs/completeness.md +1 -1
  26. package/docs/configuration.md +2 -0
  27. package/docs/console.md +11 -2
  28. package/docs/door-signals.md +1 -1
  29. package/docs/door.md +4 -16
  30. package/docs/egress.md +3 -1
  31. package/docs/github-action.md +2 -2
  32. package/docs/mandates.md +1 -1
  33. package/docs/perathos.md +97 -0
  34. package/docs/sdk.md +32 -1
  35. package/docs/threat-model.md +2 -1
  36. package/docs/tutorials.md +2 -0
  37. package/docs/usage.md +4 -2
  38. package/docs/verification.md +1 -1
  39. package/package.json +1 -1
  40. package/vectors/interop/perathos/LICENSE +21 -0
  41. package/vectors/interop/perathos/README.md +17 -0
  42. package/vectors/interop/perathos/pocketos-replay/session.head.json +11 -0
  43. package/vectors/interop/perathos/pocketos-replay/session.jsonl +8 -0
  44. package/vectors/interop/perathos/pocketos-replay/verification.json +65 -0
package/docs/usage.md CHANGED
@@ -1,4 +1,6 @@
1
- # Usage guide: the gateway
1
+ # Running the gateway
2
+
3
+ > How it works and when to use it. Every field, route, and flag is in [the reference](../../../site/reference/gateway.md).
2
4
 
3
5
  This page covers the gateway, the out-of-process producer. For the in-process interceptor that hooks Claude Code, the Claude Agent SDK, or any framework's tool functions, see [sdk.md](sdk.md).
4
6
 
@@ -123,7 +125,7 @@ At startup the gateway fetches the agent's card from `<url>/.well-known/agent-ca
123
125
  "log": { "url": "https://log.example.com/", "tokenEnv": "AGENT_CUSTODY_LOG_TOKEN" }
124
126
  ```
125
127
 
126
- Exactly one of the two. The bearer token comes from the named environment variable, never from the file, and a missing variable fails at startup. Add `"hashOnly": true` for any log run by someone else: the gateway then sends only the leaf hash, sha256 of the receipt envelope with the RFC 6962 prefix, so the log commits to the receipt without ever holding it, and the receipts with their arguments and results stay in `receiptsDir`. The verifier does not change; it hashes the envelope itself. A log that serves several tenants is reached at `<url>/t/<tenant>/`, and each of its tree heads names its log, which a verifier checks with `--log-id`. With a remote log the tree head in each receipt is signed by the log's key, and a verifier must be given that key with `--log-key`. The gateway does not take the log's answer on trust either: the tree head in every append's answer must verify against the log's keys, name the expected log, match the proof's size, and the inclusion proof must place that very leaf under the signed root, all before a pre-committed call is forwarded and before any receipt is handed out; an answer that fails any of it is a refusal. `"keys": ["keys/log.pub"]` pins the log's public keys, `"logId"` the id its heads must carry; without `keys` the log's key document at `/.well-known/agent-custody-log.json` is fetched from the log itself once, on the first append, and pinned. That catches a log that turns dishonest later, not one that is dishonest from the start, so a gateway config with `precommit` and a remote log must list `keys`. When the log rotates its key, add the new public key to `keys`; a gateway that fetched the keys needs a restart. An append that gets no answer within `timeoutMs` (default 10000) counts as unreachable and is retried like a server error, so a log that accepts connections and never answers cannot hold a call forever. If the log does not take a receipt, the gateway keeps the signed receipt in `receipts/outbox/<receiptId>.json` and returns the real outcome of the call to the agent, with the receipt id and `_meta["agent-custody/log-pending"]: true`. The gateway appends the outbox at startup and every 30 seconds, and writes `receipts/<receiptId>.json` when the log takes the receipt. Until then no bundle exists, so no receipt that was never logged is handed out. The table [below](#when-the-log-fails) gives each case. For a tool named in `precommit` the order is reversed, below, and the action never happens. A fact lookup is different: it runs before the policy decides, because the policy decides on it, and only once the intercepted tool is in the grant's scope, so a fact tool must be a read. Naming a fact tool in `precommit` is refused at startup; `"*"` covers the tools the agent calls, not the gateway's own lookups. Every lookup is on the receipt with its arguments. The reference log server is `node src/cli.ts log --file log.jsonl --key keys/log.key --port 8787 --token-env AGENT_CUSTODY_LOG_TOKEN [--log-id <id>] [--tenants tenants.json]`. It serves `POST /append` with `{leaf}` or `{leafHash}` (token required when one is configured), `GET /root?size=N`, `GET /consistency?old=M&new=N`, and `GET /head`; [verification.md](verification.md) says what each proves. `--log-id` writes that id into every tree head. `--tenants` names a JSON file, `{ "acme": { "file": "acme.jsonl", "tokenEnv": "ACME_TOKEN", "logId": "acme-eu" } }`, and each tenant is its own log at `/t/acme/…` with its own token and id; the default log stays at the root paths. With `--hash-only` the server refuses `{leaf}` at append and accepts only `{leafHash}`, so a log run for other people never receives a receipt regardless of the client's configuration; the hosted deployment sets it. With `--db-env DATABASE_URL` the server keeps its logs in Postgres instead of files, and needs the `pg` package beside it: leaves as hashes in one table keyed by tenant, one writer per tenant enforced with an advisory lock so a second instance is safe, tenants and their tokens in tables of their own with tokens stored only as hashes, and rate limits per token (50 appends a second, burst 100, a 64 KB body cap; a refused append answers 429 with `retry-after`, and the gateway's sink retries a few times). Tenants are managed with `log-admin --db-env DATABASE_URL`: `tenant add <id> [--log-id <id>]`, `token add <tenant> --label <text>` (the token is printed once), `token revoke <tenant> <hash-prefix>`, `tenant disable <id>`, `tenant plan <id> <free|team|enterprise>`, and `import --file log.jsonl [--tenant default]` to bring an existing file log in as hashes. Every tenant is on a plan, `free` unless moved: free allows ten thousand appends a calendar month, team a million, enterprise has no allowance. An append past the allowance is refused with 429, the numbers, and a `retry-after` that reaches the start of next month; the gateway behind it then withholds pre-committed calls and financial operations, so a tenant out of quota never acts on those without evidence. Any other call is forwarded, and its receipt waits in the outbox ([below](#when-the-log-fails)). The tenant's own `GET /t/<name>/usage` reports the plan and quota beside the month's appends. The tenant portal, `agent-custody portal --db-env DATABASE_URL --secret-env PORTAL_SECRET --public-url <log url> [--checkpoints-url <url>] [--portal-url <url>] [--stripe-key-env NAME --stripe-webhook-env NAME --stripe-price-team <price id>] [--trust-proxy]`, is the self-serve front of the same tables: a team registers with an email, a password (scrypt), and a tenant id and gets the tenant and its first key shown once with the welcome sheet; the dashboard shows appends against the plan, the tree size and root, the latest checkpoint, the log's URLs, keys, and the audit rows; keys are minted and revoked there, recorded as `portal:<email>`; the export command is on the page; and with the three Stripe variables the team plan is bought through Stripe Checkout, the signed webhook moving the plan (`stripe:<event>` in the audit trail) and the customer portal handling cancellation. Sessions are a signed cookie, `SameSite=Strict`, and every write needs a JSON body. Each member has a role (`owner`, `admin`, `reviewer`, `readonly`), an account can turn on TOTP MFA, and the operator can set up single sign-on through the tenant's own OIDC or SAML identity provider with `log-admin sso set`; the [hosted log reference](https://docs.agent-custody.dev/reference/hosted) lists the routes. SAML needs `@node-saml/node-saml` beside the CLI. The compose file runs it as the `portal` service at `PORTAL_HOST`. The root paths serve the tenant `default`, created on first start with `--log-id`, and `--token-env` still works for it. The key that signs tree heads can live in its own process: `agent-custody signer --key keys/log.key --port 8790 --token-env SIGNER_TOKEN` holds it and answers `POST /sign` with the shared secret and `GET /keys` to anyone; the log server then runs with `--signer-url http://signer:8790/ --signer-token-env SIGNER_TOKEN` instead of `--key`, and the process that faces the internet never holds the key. Either way the log serves its keys at `/.well-known/agent-custody-log.json`, current key first and retired keys (`--retired-key old.pub`) after it, so verifiers fetch and pin them with `verify --log-url` and `audit --log-url` rather than receiving a key file from the operator. With `--checkpoint-dir <dir>` the server publishes a signed checkpoint, every `--checkpoint-every` seconds (default 300), for each log whose tree has grown, and every `--checkpoint-heartbeat` seconds (default 21600, six hours) for a log that has not, so a quiet log's latest checkpoint is never more than six hours old and the monitor can tell quiet from stalled, as `<dir>/<tenant>/<treeSize>.json` and `latest.json`, and with a database also as rows; `GET /checkpoints?since=<size>` and `GET /t/<tenant>/checkpoints` list them. Serve the directory read-only from a second host, so the record of what the log signed does not depend on the log's API being up; a verifier who kept an earlier head audits against a later checkpoint with `audit --older <bundle> --newer <checkpoint> --log-url <url>`. With `--admin-token-env ADMIN_TOKEN` (Postgres only) the server also serves the operator's page at `/admin` and its API under `/admin/`: list and create tenants, mint a token that is shown once beside the tenant's welcome sheet, revoke tokens, disable tenants. Everything under `/admin`, the page included, needs the admin token: the browser asks for it (any user name, the token as the password) and an API client sends it as a bearer; a handful of wrong attempts from one address are throttled for a minute. Every change made there or with `log-admin` is recorded: who (the name entered at the browser prompt and the address, `bearer` for an API client, or the user and host for the command line), what (`tenant.add`, `tenant.disable`, `token.add`, `token.revoke`), which tenant, and the detail, never the token itself; the page shows it under Activity, `GET /admin/audit?tenant=&limit=` and `log-admin audit` list it, and a tenant reads their own rows at `GET /t/<name>/audit` with their token. Nothing else is stored by the page. Behind a reverse proxy, start the server with `--trust-proxy` so those per-address limits key on `X-Forwarded-For` instead of on the proxy's own address, and only there, since the header is otherwise the client's to forge. `--public-url` and `--checkpoints-url` fill the sheet in. The witness closes the last gap: `agent-custody witness --key witness.key --log-url <url> --checkpoints-url <url> --out <dir> [--tenant <name>]...` runs on a machine the log's operator does not control, fetches each watched log's latest checkpoint, verifies it against the log's published keys, proves with the log's consistency proof that it extends the last head the witness signed, and countersigns it into `<dir>/<tenant>/<size>.json` and `latest.json`; a checkpoint that does not extend, or a second history at the same size, gets `ALARM.json` instead. Its key document is `<dir>/.well-known/agent-custody-witness.json`. Serve `<dir>` from the witness's own host; verifiers add `--witness-url` (or `--witness-key`) to `audit`, and the newer head must then carry the witness's signature. Two more things an operator needs. `agent-custody log-check --log-url <url> --checkpoints-url <url> [--witness-url <url>] [--tenant <name>]... [--max-lag <seconds>]` is the outside monitor: it verifies the head against the published keys, that the latest checkpoint verifies and keeps up with the head, that the head extends the checkpoint, and, with a witness, that the witness has countersigned, keeps up, and has raised no alarm; it exits 1 on any failure, so cron or a scheduled workflow on a machine that is not the log's turns it into an alert. `GET /health` on the server is the liveness check for a load balancer. And `GET /admin/usage?month=YYYY-MM`, on the admin page and as `/admin/usage.csv`, is the metering: appends per tenant for the month, leaves in total, live tokens, the numbers any invoice rests on. A tenant needs none of that to leave with their evidence: `agent-custody log-export --log-url <url> --tenant <name> --token-env AGENT_CUSTODY_LOG_TOKEN --out <dir>` fetches, with their own token, every leaf hash (`GET /t/<name>/leaves?since=&limit=`, pages of up to ten thousand), the signed head, the published keys, the signed checkpoints, their own usage (`GET /t/<name>/usage?month=`), and the administrative actions on their tenant (`GET /t/<name>/audit`, into `audit.json`), checks that the head and every checkpoint verify against the keys and that the leaves fetched hash to their roots, and writes `log.jsonl` in the format `verify --log` and `audit --log` read, so the export verifies receipts with no server at all. It exits 1 and says what did not add up if anything does not. Both routes answer only to that tenant's token. [deploy/](../../deploy/README.md) runs the server, the signer, Postgres, and the checkpoints host as containers, and [deploy/witness/](../../deploy/witness/) the witness.
128
+ Exactly one of the two. The bearer token comes from the named environment variable, never from the file, and a missing variable fails at startup. Add `"hashOnly": true` for any log run by someone else: the gateway then sends only the leaf hash, sha256 of the receipt envelope with the RFC 6962 prefix, so the log commits to the receipt without ever holding it, and the receipts with their arguments and results stay in `receiptsDir`. The verifier does not change; it hashes the envelope itself. A log that serves several tenants is reached at `<url>/t/<tenant>/`, and each of its tree heads names its log, which a verifier checks with `--log-id`. With a remote log the tree head in each receipt is signed by the log's key, and a verifier must be given that key with `--log-key`. The gateway does not take the log's answer on trust either: the tree head in every append's answer must verify against the log's keys, name the expected log, match the proof's size, and the inclusion proof must place that very leaf under the signed root, all before a pre-committed call is forwarded and before any receipt is handed out; an answer that fails any of it is a refusal. `"keys": ["keys/log.pub"]` pins the log's public keys, `"logId"` the id its heads must carry; without `keys` the log's key document at `/.well-known/agent-custody-log.json` is fetched from the log itself once, on the first append, and pinned. That catches a log that turns dishonest later, not one that is dishonest from the start, so a gateway config with `precommit` and a remote log must list `keys`. When the log rotates its key, add the new public key to `keys`; a gateway that fetched the keys needs a restart. An append that gets no answer within `timeoutMs` (default 10000) counts as unreachable and is retried like a server error, so a log that accepts connections and never answers cannot hold a call forever. If the log does not take a receipt, the gateway keeps the signed receipt in `receipts/outbox/<receiptId>.json` and returns the real outcome of the call to the agent, with the receipt id and `_meta["agent-custody/log-pending"]: true`. The gateway appends the outbox at startup and every 30 seconds, and writes `receipts/<receiptId>.json` when the log takes the receipt. Until then no bundle exists, so no receipt that was never logged is handed out. The table [below](#when-the-log-fails) gives each case. For a tool named in `precommit` the order is reversed, below, and the action never happens. A fact lookup is different: it runs before the policy decides, because the policy decides on it, and only once the intercepted tool is in the grant's scope, so a fact tool must be a read. Naming a fact tool in `precommit` is refused at startup; `"*"` covers the tools the agent calls, not the gateway's own lookups. Every lookup is on the receipt with its arguments. The reference log server is `node src/cli.ts log --file log.jsonl --key keys/log.key --port 8787 --token-env AGENT_CUSTODY_LOG_TOKEN [--log-id <id>] [--tenants tenants.json]`. It serves `POST /append` with `{leaf}` or `{leafHash}` (token required when one is configured), `GET /root?size=N`, `GET /consistency?old=M&new=N`, and `GET /head`; [verification.md](verification.md) says what each proves. `--log-id` writes that id into every tree head. `--tenants` names a JSON file, `{ "acme": { "file": "acme.jsonl", "tokenEnv": "ACME_TOKEN", "logId": "acme-eu" } }`, and each tenant is its own log at `/t/acme/…` with its own token and id; the default log stays at the root paths. With `--hash-only` the server refuses `{leaf}` at append and accepts only `{leafHash}`, so a log run for other people never receives a receipt regardless of the client's configuration; the hosted deployment sets it. With `--db-env DATABASE_URL` the server keeps its logs in Postgres instead of files, and needs the `pg` package beside it: leaves as hashes in one table keyed by tenant, one writer per tenant enforced with an advisory lock so a second instance is safe, tenants and their tokens in tables of their own with tokens stored only as hashes, and rate limits per token (50 appends a second, burst 100, a 64 KB body cap; a refused append answers 429 with `retry-after`, and the gateway's sink retries a few times). Tenants are managed with `log-admin --db-env DATABASE_URL`: `tenant add <id> [--log-id <id>]` (both plain identifiers: letters, digits, `.`, `_`, `-`), `token add <tenant> --label <text>` (the token is printed once), `token revoke <tenant> <hash-prefix>`, `tenant disable <id>`, `tenant plan <id> <free|team|enterprise>`, and `import --file log.jsonl [--tenant default]` to bring an existing file log in as hashes. Every tenant is on a plan, `free` unless moved: free allows ten thousand appends a calendar month, team a million, enterprise has no allowance. An append past the allowance is refused with 429, the numbers, and a `retry-after` that reaches the start of next month; the gateway behind it then withholds pre-committed calls and financial operations, so a tenant out of quota never acts on those without evidence. Any other call is forwarded, and its receipt waits in the outbox ([below](#when-the-log-fails)). The tenant's own `GET /t/<name>/usage` reports the plan and quota beside the month's appends. The tenant portal, `agent-custody portal --db-env DATABASE_URL --secret-env PORTAL_SECRET --public-url <log url> [--checkpoints-url <url>] [--portal-url <url>] [--stripe-key-env NAME --stripe-webhook-env NAME --stripe-price-team <price id>] [--trust-proxy]`, is the self-serve front of the same tables: a team registers with an email, a password (scrypt), and a tenant id and gets the tenant and its first key shown once with the welcome sheet; the dashboard shows appends against the plan, the tree size and root, the latest checkpoint, the log's URLs, keys, and the audit rows; keys are minted and revoked there, recorded as `portal:<email>`; the export command is on the page; and with the three Stripe variables the team plan is bought through Stripe Checkout, the signed webhook moving the plan (`stripe:<event>` in the audit trail) and the customer portal handling cancellation. Sessions are a signed cookie, `SameSite=Strict`, and every write needs a JSON body: one over 64 KB is answered 413, one that is not JSON 400, and any other failure a plain 500 with the detail in the portal's log, never in the answer. Each member has a role (`owner`, `admin`, `reviewer`, `readonly`), an account can turn on TOTP MFA, and the operator can set up single sign-on through the tenant's own OIDC or SAML identity provider with `log-admin sso set`; the [hosted log reference](https://docs.agent-custody.dev/reference/hosted) lists the routes. SAML needs `@node-saml/node-saml` beside the CLI. The compose file runs it as the `portal` service at `PORTAL_HOST`. The root paths serve the tenant `default`, created on first start with `--log-id`, and `--token-env` still works for it. The key that signs tree heads can live in its own process: `agent-custody signer --key keys/log.key --port 8790 --token-env SIGNER_TOKEN` holds it and answers `POST /sign` with the shared secret and `GET /keys` to anyone; the log server then runs with `--signer-url http://signer:8790/ --signer-token-env SIGNER_TOKEN` instead of `--key`, and the process that faces the internet never holds the key. Either way the log serves its keys at `/.well-known/agent-custody-log.json`, current key first and retired keys (`--retired-key old.pub`) after it, so verifiers fetch and pin them with `verify --log-url` and `audit --log-url` rather than receiving a key file from the operator. With `--checkpoint-dir <dir>` the server publishes a signed checkpoint, every `--checkpoint-every` seconds (default 300), for each log whose tree has grown, and every `--checkpoint-heartbeat` seconds (default 21600, six hours) for a log that has not, so a quiet log's latest checkpoint is never more than six hours old and the monitor can tell quiet from stalled, as `<dir>/<tenant>/<treeSize>.json` and `latest.json`, and with a database also as rows; `GET /checkpoints?since=<size>` and `GET /t/<tenant>/checkpoints` list them. Serve the directory read-only from a second host, so the record of what the log signed does not depend on the log's API being up; a verifier who kept an earlier head audits against a later checkpoint with `audit --older <bundle> --newer <checkpoint> --log-url <url>`. With `--admin-token-env ADMIN_TOKEN` (Postgres only) the server also serves the operator's page at `/admin` and its API under `/admin/`: list and create tenants, mint a token that is shown once beside the tenant's welcome sheet, revoke tokens, disable tenants. Everything under `/admin`, the page included, needs the admin token: the browser asks for it (any user name, the token as the password) and an API client sends it as a bearer; a handful of wrong attempts from one address are throttled for a minute. Every change made there or with `log-admin` is recorded: who (the name entered at the browser prompt and the address, `bearer` for an API client, or the user and host for the command line), what (`tenant.add`, `tenant.disable`, `token.add`, `token.revoke`), which tenant, and the detail, never the token itself; the page shows it under Activity, `GET /admin/audit?tenant=&limit=` and `log-admin audit` list it, and a tenant reads their own rows at `GET /t/<name>/audit` with their token. Nothing else is stored by the page. Behind a reverse proxy, start the server with `--trust-proxy` so those per-address limits key on `X-Forwarded-For` instead of on the proxy's own address, and only there, since the header is otherwise the client's to forge. `--public-url` and `--checkpoints-url` fill the sheet in. The witness closes the last gap: `agent-custody witness --key witness.key --log-url <url> --checkpoints-url <url> --out <dir> [--tenant <name>]...` runs on a machine the log's operator does not control, fetches each watched log's latest checkpoint, verifies it against the log's published keys, proves with the log's consistency proof that it extends the last head the witness signed, and countersigns it into `<dir>/<tenant>/<size>.json` and `latest.json`; a checkpoint that does not extend, or a second history at the same size, gets `ALARM.json` instead. Its key document is `<dir>/.well-known/agent-custody-witness.json`. Serve `<dir>` from the witness's own host; verifiers add `--witness-url` (or `--witness-key`) to `audit`, and the newer head must then carry the witness's signature. Two more things an operator needs. `agent-custody log-check --log-url <url> --checkpoints-url <url> [--witness-url <url>] [--tenant <name>]... [--max-lag <seconds>]` is the outside monitor: it verifies the head against the published keys, that the latest checkpoint verifies and keeps up with the head, that the head extends the checkpoint, and, with a witness, that the witness has countersigned, keeps up, and has raised no alarm; it exits 1 on any failure, so cron or a scheduled workflow on a machine that is not the log's turns it into an alert. `GET /health` on the server is the liveness check for a load balancer. And `GET /admin/usage?month=YYYY-MM`, on the admin page and as `/admin/usage.csv`, is the metering: appends per tenant for the month, leaves in total, live tokens, the numbers any invoice rests on. A tenant needs none of that to leave with their evidence: `agent-custody log-export --log-url <url> --tenant <name> --token-env AGENT_CUSTODY_LOG_TOKEN --out <dir>` fetches, with their own token, every leaf hash (`GET /t/<name>/leaves?since=&limit=`, pages of up to ten thousand), the signed head, the published keys, the signed checkpoints, their own usage (`GET /t/<name>/usage?month=`), and the administrative actions on their tenant (`GET /t/<name>/audit`, into `audit.json`), checks that the head and every checkpoint verify against the keys and that the leaves fetched hash to their roots, and writes `log.jsonl` in the format `verify --log` and `audit --log` read, so the export verifies receipts with no server at all. It exits 1 and says what did not add up if anything does not. Both routes answer only to that tenant's token. [deploy/](../../deploy/README.md) runs the server, the signer, Postgres, and the checkpoints host as containers, and [deploy/witness/](../../deploy/witness/) the witness.
127
129
 
128
130
  `otel`, optional in both the gateway and SDK configs, sends every receipt to the collector you already run as one span over OTLP/HTTP, after the receipt is issued: `"otel": { "url": "http://localhost:4318", "headersEnv": { "x-api-key": "OTEL_KEY" }, "serviceName": "support-agents" }`. The span's trace id is the receipt id, its attributes carry the tool, agent, principal, execution status, policy decision, and log position, and its status is an error only when the upstream failed or errored, since a denial is the policy working. A door receipt records an inbound request, so its span kind is `SERVER`; every other issuer's span is `CLIENT`. Export is best effort: a collector that is down or refuses costs a line on stderr, never a receipt. Tutorial 18 shows it against a stand-in collector.
129
131
 
@@ -1,4 +1,4 @@
1
- # Verifying a receipt
1
+ # How verification works
2
2
 
3
3
  A verifier needs three things and no network access:
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-custody/receipts",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "mcpName": "io.github.svayatta/agent-custody",
5
5
  "description": "Proof of what your AI agents did. Give your agents real power, without losing control of them: signed, verifiable receipts for tool calls, an MCP gateway with Cedar or Rego policy, and a Merkle transparency log.",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tamuka Chagonda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ # Perathos interop vector
2
+
3
+ Records written by another project's own writer, so that `verify-perathos` is tested against them and not only against our reading of the spec.
4
+
5
+ `pocketos-replay/` holds three files from the sample evidence pack in [perathos-protocol/perathos](https://github.com/perathos-protocol/perathos), `examples/pocketos_replay/sample-evidence-pack.zip`, at commit `9ec0c3b36d39558fff7aae8652f6c44e7d5396d9` (the zip's SHA-256 is `1815c2f2d4302c44a6e5a1eefd7621579277725f2a1f42ade60e8433c8cd5d56`):
6
+
7
+ | file | what it is |
8
+ | --- | --- |
9
+ | `session.jsonl` | the session log, `perathos.receipt/v1`: 8 receipts, 2 signed checkpoints |
10
+ | `session.head.json` | the head witness: the last checkpoint's `seq` and `receipt_hash` (it also carries a signature, which the spec does not define and the reader does not check) |
11
+ | `verification.json` | the report of Perathos's own verifier on the same log, which `test/perathos.test.ts` compares with ours |
12
+
13
+ The recorder's key is `d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707`, as `verification.json` names it. The pack's anchors, precondition, manifest, and reports are not copied, because the reader does not read them yet.
14
+
15
+ Do not edit or regenerate these files. They are copied byte for byte.
16
+
17
+ The files are Copyright (c) 2026 Tamuka Chagonda and used under the MIT License, whose text is in `LICENSE` beside this file, copied from the same repository.
@@ -0,0 +1,11 @@
1
+ {
2
+ "receipt_hash": "f53bd64de64d8b29fc025c7d07f3570d6a1a41c1fe036fb4727cb30c4c1b19b1",
3
+ "seq": 8,
4
+ "session_id": "pocketos-replay",
5
+ "signature": {
6
+ "algorithm": "ed25519",
7
+ "signature": "c739672a1fec289190524fe8aff579f53428f96922b701d4db20afb7dcec6d390583fba7544ceb20b60cb9e61bf5315f2684194df499c7aeece4373d15ebd103",
8
+ "verify_key": "d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707"
9
+ },
10
+ "ts": "2026-11-04T08:19:08.217162Z"
11
+ }
@@ -0,0 +1,8 @@
1
+ {"agent":"claude-code","args_hash":"b68b4f27ab26c316258def49fe5de03704efcc558cf144538508f61b29b1138e","kind":"pre","prev_hash":"0000000000000000000000000000000000000000000000000000000000000000","receipt_hash":"4efbb8754f2c9a9bc145491947b9d082c3215c0df788b6b0578e3dd0a3ce37ce","seq":1,"session_id":"pocketos-replay","tool":"Bash","tool_use_id":"toolu_01","ts":"2026-11-04T08:19:04.700884Z","v":"perathos.receipt/v1"}
2
+ {"agent":"claude-code","args_hash":"b68b4f27ab26c316258def49fe5de03704efcc558cf144538508f61b29b1138e","kind":"post","prev_hash":"4efbb8754f2c9a9bc145491947b9d082c3215c0df788b6b0578e3dd0a3ce37ce","receipt_hash":"db16746b00e348af3450f7e37ba0dfb3c3ab8a32de00bc91a8bf932cd5fe3618","result_hash":"af5b7295ff3b7c583fbdf477253ff8105d68f5ed1e03118396c4b2fcd9869488","seq":2,"session_id":"pocketos-replay","status":"ok","tool":"Bash","tool_use_id":"toolu_01","ts":"2026-11-04T08:19:04.945954Z","v":"perathos.receipt/v1"}
3
+ {"agent":"claude-code","args_hash":"20bf9eb9a74aa6a900c628109717b888b13bcff270e7d3174ac9e7b824a38e2e","guard":{"decision":"deny","precondition":null,"rule":"paas.railway"},"kind":"pre","prev_hash":"db16746b00e348af3450f7e37ba0dfb3c3ab8a32de00bc91a8bf932cd5fe3618","receipt_hash":"a9dd6da880670e197843a3dbb5ae015500c629edd32ba71d1713c108f37b5973","seq":3,"session_id":"pocketos-replay","tool":"Bash","tool_use_id":"toolu_02","ts":"2026-11-04T08:19:05.192047Z","v":"perathos.receipt/v1"}
4
+ {"agent":"claude-code","args_hash":"f1fde088301840df5209c7c8a20368910d22f1c22faf82355b4f6b4b0b5fe0d4","guard":{"decision":"deny","precondition":null,"rule":"guard.self-authorize"},"kind":"pre","prev_hash":"a9dd6da880670e197843a3dbb5ae015500c629edd32ba71d1713c108f37b5973","receipt_hash":"13cf1dd83e754db45b0287a9342a41880bc03e5c997ae0c5f63132bc51a94cf2","seq":4,"session_id":"pocketos-replay","tool":"Bash","tool_use_id":"toolu_03","ts":"2026-11-04T08:19:05.431384Z","v":"perathos.receipt/v1"}
5
+ {"agent":"claude-code","event":"Stop","kind":"checkpoint","model":null,"prev_hash":"13cf1dd83e754db45b0287a9342a41880bc03e5c997ae0c5f63132bc51a94cf2","receipt_hash":"da5428a50b4c919b362208d8b0af5d6176faea8586b2481358cd1690fceeec36","seq":5,"session_id":"pocketos-replay","signature":{"algorithm":"ed25519","signature":"e8a97ad2bd619d469d580d73ca2bf20512cbea1fd622b470012b49343e29093f216c330844fc89f0d2dbd06a2e50e02a3db438d08cc0c0f52fb9ae11ec8f5504","verify_key":"d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707"},"signer":"d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707","ts":"2026-11-04T08:19:05.695124Z","v":"perathos.receipt/v1"}
6
+ {"agent":"claude-code","args_hash":"20bf9eb9a74aa6a900c628109717b888b13bcff270e7d3174ac9e7b824a38e2e","guard":{"decision":"allow","precondition":"2f33e233db8e7a1468e2f0885c51eeabb03960c8b4978c013dc1c6528ac8ebb9","rule":"paas.railway"},"kind":"pre","prev_hash":"da5428a50b4c919b362208d8b0af5d6176faea8586b2481358cd1690fceeec36","receipt_hash":"728b7471075e5ab1626511838d8befd27fa6e2803f82200c81f6ac805300cc84","seq":6,"session_id":"pocketos-replay","tool":"Bash","tool_use_id":"toolu_04","ts":"2026-11-04T08:19:07.697718Z","v":"perathos.receipt/v1"}
7
+ {"agent":"claude-code","args_hash":"20bf9eb9a74aa6a900c628109717b888b13bcff270e7d3174ac9e7b824a38e2e","kind":"post","prev_hash":"728b7471075e5ab1626511838d8befd27fa6e2803f82200c81f6ac805300cc84","receipt_hash":"eac94c1e2a98757c7834fe3a51d6a8f48e225c8d324a1c9cd4c314683dd3049e","result_hash":"d94dd1a471d6ca93e2ca75f12b7d0d53b895c8b4e38403a61b6de4c8e1a45a1b","seq":7,"session_id":"pocketos-replay","status":"ok","tool":"Bash","tool_use_id":"toolu_04","ts":"2026-11-04T08:19:07.931239Z","v":"perathos.receipt/v1"}
8
+ {"agent":"claude-code","event":"Stop","kind":"checkpoint","model":null,"prev_hash":"eac94c1e2a98757c7834fe3a51d6a8f48e225c8d324a1c9cd4c314683dd3049e","receipt_hash":"f53bd64de64d8b29fc025c7d07f3570d6a1a41c1fe036fb4727cb30c4c1b19b1","seq":8,"session_id":"pocketos-replay","signature":{"algorithm":"ed25519","signature":"c739672a1fec289190524fe8aff579f53428f96922b701d4db20afb7dcec6d390583fba7544ceb20b60cb9e61bf5315f2684194df499c7aeece4373d15ebd103","verify_key":"d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707"},"signer":"d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707","ts":"2026-11-04T08:19:08.217162Z","v":"perathos.receipt/v1"}
@@ -0,0 +1,65 @@
1
+ {
2
+ "path": "session.jsonl",
3
+ "valid": true,
4
+ "errors": [],
5
+ "warnings": [],
6
+ "session_id": "pocketos-replay",
7
+ "receipts": 8,
8
+ "tool_calls": 4,
9
+ "checkpoints": 2,
10
+ "signed_checkpoints": 2,
11
+ "sealed_through": 8,
12
+ "unsealed_tail": 0,
13
+ "signers": [
14
+ "d53f11ff38959d472a2e619b346340b44a79866fb8650d96f22ada467f524707"
15
+ ],
16
+ "models": [],
17
+ "tools": {
18
+ "Bash": 4
19
+ },
20
+ "first_ts": "2026-11-04T08:19:04.700884Z",
21
+ "last_ts": "2026-11-04T08:19:08.217162Z",
22
+ "blocked": 2,
23
+ "anchors": 2,
24
+ "anchored_through": 8,
25
+ "anchored_time": "2026-11-04T08:19:09Z",
26
+ "blocked_calls": [
27
+ {
28
+ "seq": 3,
29
+ "ts": "2026-11-04T08:19:05.192047Z",
30
+ "tool": "Bash",
31
+ "rule": "paas.railway"
32
+ },
33
+ {
34
+ "seq": 4,
35
+ "ts": "2026-11-04T08:19:05.431384Z",
36
+ "tool": "Bash",
37
+ "rule": "guard.self-authorize"
38
+ }
39
+ ],
40
+ "allowed_under_precondition": [
41
+ {
42
+ "seq": 6,
43
+ "ts": "2026-11-04T08:19:07.697718Z",
44
+ "tool": "Bash",
45
+ "rule": "paas.railway",
46
+ "precondition": {
47
+ "id": "d5852e52-6d9f-4642-954f-876039684c10",
48
+ "scope": "pg-data",
49
+ "check": "python check_backup.py offsite/prod-backup.db",
50
+ "manual_reason": null,
51
+ "created": "2026-11-04T08:19:07Z",
52
+ "expires": "2026-11-04T08:49:07Z"
53
+ }
54
+ }
55
+ ],
56
+ "preconditions_missing_from_pack": [],
57
+ "limits": [
58
+ "Shows which key sealed the record, not which model ran (the model name is self-reported).",
59
+ "Event times come from the local clock; only anchored checkpoints have an independent time.",
60
+ "Tool arguments and outputs are not included, only their SHA-256 hashes.",
61
+ "A gap in recording (hooks switched off) is not visible in the log.",
62
+ "The guard matches command patterns; it is a safeguard against accidents, not a sandbox."
63
+ ],
64
+ "exported_at": "2026-11-04T08:19:10Z"
65
+ }