agent-passport-system 1.38.0 → 1.40.0

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 (53) hide show
  1. package/README.md +81 -155
  2. package/dist/src/core/commerce.d.ts +9 -0
  3. package/dist/src/core/commerce.d.ts.map +1 -1
  4. package/dist/src/core/commerce.js +14 -1
  5. package/dist/src/core/commerce.js.map +1 -1
  6. package/dist/src/core/delegation.d.ts +6 -0
  7. package/dist/src/core/delegation.d.ts.map +1 -1
  8. package/dist/src/core/delegation.js +12 -3
  9. package/dist/src/core/delegation.js.map +1 -1
  10. package/dist/src/core/gateway.d.ts +3 -0
  11. package/dist/src/core/gateway.d.ts.map +1 -1
  12. package/dist/src/core/gateway.js +79 -7
  13. package/dist/src/core/gateway.js.map +1 -1
  14. package/dist/src/core-exports.d.ts +18 -0
  15. package/dist/src/core-exports.d.ts.map +1 -0
  16. package/dist/src/core-exports.js +26 -0
  17. package/dist/src/core-exports.js.map +1 -0
  18. package/dist/src/types/passport.d.ts +19 -0
  19. package/dist/src/types/passport.d.ts.map +1 -1
  20. package/dist/src/types/passport.js.map +1 -1
  21. package/dist/src/v2/credential-check-policy/check.d.ts +48 -0
  22. package/dist/src/v2/credential-check-policy/check.d.ts.map +1 -0
  23. package/dist/src/v2/credential-check-policy/check.js +139 -0
  24. package/dist/src/v2/credential-check-policy/check.js.map +1 -0
  25. package/dist/src/v2/credential-check-policy/index.d.ts +3 -0
  26. package/dist/src/v2/credential-check-policy/index.d.ts.map +1 -0
  27. package/dist/src/v2/credential-check-policy/index.js +4 -0
  28. package/dist/src/v2/credential-check-policy/index.js.map +1 -0
  29. package/dist/src/v2/credential-check-policy/types.d.ts +50 -0
  30. package/dist/src/v2/credential-check-policy/types.d.ts.map +1 -0
  31. package/dist/src/v2/credential-check-policy/types.js +23 -0
  32. package/dist/src/v2/credential-check-policy/types.js.map +1 -0
  33. package/dist/src/v2/index.d.ts +6 -0
  34. package/dist/src/v2/index.d.ts.map +1 -1
  35. package/dist/src/v2/index.js +7 -0
  36. package/dist/src/v2/index.js.map +1 -1
  37. package/dist/src/v2/sub-delegate-advisor.d.ts +77 -0
  38. package/dist/src/v2/sub-delegate-advisor.d.ts.map +1 -0
  39. package/dist/src/v2/sub-delegate-advisor.js +122 -0
  40. package/dist/src/v2/sub-delegate-advisor.js.map +1 -0
  41. package/dist/src/v2/wallet-binding/bind.d.ts +53 -0
  42. package/dist/src/v2/wallet-binding/bind.d.ts.map +1 -0
  43. package/dist/src/v2/wallet-binding/bind.js +188 -0
  44. package/dist/src/v2/wallet-binding/bind.js.map +1 -0
  45. package/dist/src/v2/wallet-binding/index.d.ts +3 -0
  46. package/dist/src/v2/wallet-binding/index.d.ts.map +1 -0
  47. package/dist/src/v2/wallet-binding/index.js +4 -0
  48. package/dist/src/v2/wallet-binding/index.js.map +1 -0
  49. package/dist/src/v2/wallet-binding/types.d.ts +53 -0
  50. package/dist/src/v2/wallet-binding/types.d.ts.map +1 -0
  51. package/dist/src/v2/wallet-binding/types.js +13 -0
  52. package/dist/src/v2/wallet-binding/types.js.map +1 -0
  53. package/package.json +6 -2
package/README.md CHANGED
@@ -5,211 +5,137 @@
5
5
  [![tests](https://img.shields.io/badge/tests-2552%20passing-brightgreen)](https://github.com/aeoess/agent-passport-system)
6
6
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18749779.svg)](https://doi.org/10.5281/zenodo.18749779)
7
7
 
8
- > **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete reference.
8
+ > **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs.
9
9
 
10
- **The enforcement and accountability layer for AI agents. Bring your own identity.**
10
+ **Governance infrastructure for AI agents. Gateway evaluation under 2ms.**
11
11
 
12
- APS is not an identity system. It's the governance layer that sits on top of whatever identity the agent already has. Accepts did:key, did:web, SPIFFE SVIDs, OAuth tokens, and native did:aps. Identity is the input. Enforcement is the product.
13
-
14
- The gateway is both judge and executor. Authority can only decrease at each transfer point. Cascade revocation propagates through delegation chains. Every action produces a signed receipt. Every constraint is checked in under 2ms.
15
-
16
- Seven independent projects have cross-tested against these primitives. AgentID: 7/7. MolTrust: 5/5. Kanoniv delegation chains: verified. Three languages, three codebases, identical results.
12
+ Authority can only decrease at each transfer point. The gateway is both judge and executor. Every action produces a signed receipt.
17
13
 
18
14
  ```bash
19
15
  npm install agent-passport-system
20
16
  ```
21
17
 
22
- ## Who's Building on APS
18
+ ## Quick Start
23
19
 
24
- | Project | What they do | What APS provides |
25
- |---------|-------------|-------------------|
26
- | [AgentID](https://github.com/haroldmalikfrimpong-ops/getagentid) | CA-issued identity, trust scoring | Self-sovereign identity, delegation chains |
27
- | [MolTrust](https://moltrust.ch) | On-chain constraint envelopes | Scope narrowing, spend limits, expiry |
28
- | [qntm](https://github.com/corpollc/qntm) | Encrypted relay transport | Identity keys, signed envelopes |
29
- | [Signet](https://github.com/Prismer-AI/signet) | MCP transport signing | Policy gate, execution attestation |
30
- | [ArkForge](https://arkforge.tech) | External proof anchoring | Receipts to anchor |
31
- | [Microsoft AGT](https://github.com/microsoft/agent-governance-toolkit) | Enterprise policy engine | Trust signals, scope verification |
32
-
33
- See [INTEGRATION.md](INTEGRATION.md) for how to compose your project with APS.
20
+ ```typescript
21
+ import {
22
+ createPassport, createDelegation, evaluateIntent, commercePreflight
23
+ } from 'agent-passport-system/core'
24
+ ```
34
25
 
35
- ## What It Does
26
+ ## Core Protocol
36
27
 
37
- **Enforce constraints on agent actions** — the ProxyGateway is an enforcement boundary that sits between the agent and any tool. Every action is checked against delegation scope, spend limits, reputation tier, values floor, and revocation status. The gateway executes the action, not the agent. The gateway generates the receipt, not the agent. Agents cannot bypass, forge, or skip enforcement.
28
+ What ships in every deployment.
38
29
 
39
- **Track trust with uncertainty** Bayesian reputation scoring where agents earn authority through verified task outcomes. Reputation decays over time. Authority tiers gate what actions an agent can take. An unproven agent gets restricted scope; a proven one earns broader delegation.
30
+ **Identity** -- Ed25519 passports, passport grades 0-3, key rotation, did:aps identifiers.
40
31
 
41
- **Produce cryptographic proof of everything** every action generates a signed receipt linking agent identity, delegation authority, constraint evaluation, and execution result. Receipts chain via hash pointers. Merkle trees commit receipt sets in 32 bytes. Disputes are resolved with math, not arguments.
32
+ **Delegation** -- Scoped authority with monotonic narrowing. Sub-delegation can only reduce scope. Cascade revocation propagates through the full chain. `subDelegateAdvisor` implements the bounded-escalation delegation pattern used in multi-model agent workflows where a lower-cost executor escalates to a higher-capability advisor at decision points -- the advisor delegation is count-bounded, cannot execute tools, and cascade-revokes with its parent.
42
33
 
43
- **Control spending** 4-gate commerce enforcement: passport verification, delegation scope check, spend limit enforcement, merchant allowlist. Human approval thresholds for high-value purchases. Cumulative budget tracking across sessions.
34
+ **Enforcement** -- 3-signature action chain: agent signs intent, policy engine signs evaluation, agent signs execution receipt. The agent cannot skip the check.
44
35
 
45
- **Revoke authority instantly** cascade revocation propagates through delegation chains. Revoke a parent, all children are automatically revoked. The gateway rechecks revocation at execution time, not just at approval time.
36
+ **Commerce** -- 5-gate preflight: valid passport, scope check, spend limit, merchant allowlist, idempotency. Human approval thresholds for high-value transactions.
46
37
 
47
- ## Quick Example: Enforce, Don't Just Identify
38
+ **Reputation** -- Bayesian trust scoring across 5 tiers. Authority is earned per-scope, not global. Passport grades compound with behavioral history.
48
39
 
49
- ```typescript
50
- import { createProxyGateway, generateKeyPair, joinSocialContract } from 'agent-passport-system'
51
-
52
- // 1. Create an enforcement gateway
53
- const gwKeys = generateKeyPair()
54
- const gateway = createProxyGateway({
55
- gatewayId: 'gateway-prod',
56
- ...gwKeys,
57
- floor: loadFloor('values/floor.yaml'),
58
- approvalTTLSeconds: 30,
59
- recheckRevocationOnExecute: true,
60
- enableReputationGating: true,
61
- }, toolExecutor)
62
-
63
- // 2. Agent joins with identity + values attestation
64
- const agent = joinSocialContract({ name: 'worker', owner: 'alice', floor: floorYaml })
65
-
66
- // 3. Register agent, add delegation
67
- gateway.registerAgent(agent.passport, agent.attestation)
68
- gateway.addDelegation(agent.agentId, delegation)
69
-
70
- // 4. Agent requests action → gateway enforces ALL constraints
71
- const result = await gateway.processToolCall({
72
- requestId: 'req-001',
73
- agentId: agent.agentId,
74
- agentPublicKey: agent.publicKey,
75
- tool: 'database_query',
76
- params: { query: 'SELECT * FROM users' },
77
- scopeRequired: 'data_read',
78
- spend: { amount: 5, currency: 'usd' },
79
- signature: sign(canonicalize({ requestId: 'req-001', tool: 'database_query', ... }), agent.privateKey)
80
- })
40
+ ## Wallet Binding
81
41
 
82
- // result.executed = true
83
- // result.proof = { requestSignature, decisionSignature, receiptSignature } ← 3-sig chain
84
- // result.receipt = signed, tamper-proof, links to delegation chain
85
- // result.tierCheck = reputation tier was sufficient
86
- ```
42
+ Two layers, designed to compose.
87
43
 
88
- **What just happened:** The gateway verified the agent's identity, checked delegation scope, enforced spend limits, evaluated values floor compliance, verified reputation tier, checked revocation status, executed the tool, generated a signed receipt, and updated reputation. All in one call. The agent never touched the tool directly.
44
+ **Structural (agent-attested).** The agent's own passport private key signs `{ passport_id, chain, address, bound_at }` and appends the result to the passport's `bound_wallets` field. Verifiable offline with just the passport public key. Chain-agnostic: Nano is the native APS wallet, but the primitive accepts any chain identifier with an address.
89
45
 
90
- ## Identity Is the Foundation, Not the Product
46
+ ```typescript
47
+ import { bindWallet, verifyBoundWallet } from 'agent-passport-system'
91
48
 
92
- Everything above is built on Ed25519 cryptographic identity. But identity is the plumbing, not the value proposition.
49
+ const bound = bindWallet({
50
+ passport: signedPassport,
51
+ privateKey: agentPrivateKey,
52
+ chain: 'nano',
53
+ address: 'nano_3jb1...',
54
+ })
93
55
 
94
- ```typescript
95
- // Identity creation is two lines
96
- const keys = generateKeyPair()
97
- const agent = joinSocialContract({ name: 'my-agent', owner: 'alice', floor: floorYaml })
98
-
99
- // The value is what you do WITH identity:
100
- // → Scoped delegation with spend limits and time bounds
101
- // → Cascade revocation that propagates through chains
102
- // → Reputation scoring that gates authority
103
- // → Values floor enforcement at execution time
104
- // → Beneficiary attribution via Merkle proofs
105
- // → Commerce gates that prevent unauthorized purchases
56
+ verifyBoundWallet(bound, 'nano', 'nano_3jb1...') // true
106
57
  ```
107
58
 
108
- ## The Stack
59
+ **Behavioral (issuer-attested).** Independent issuers (the [insumer-examples](https://github.com/insumerapi/insumer-examples) ecosystem and friends — skyemeta/skyeprofile and 8 others) sign attestations about wallet behavior, sybil signals, and on-chain history. Their signatures stand alone.
109
60
 
110
- 71 core modules + 32 v2 constitutional modules. 2,535 tests. Zero heavy dependencies.
61
+ The two layers compose: a verifier accepting both gets cryptographic proof that **this passport holder controls this address** (structural) **and** that **this address has these behavioral properties** (behavioral). Neither layer claims what the other proves. Multi-attestation envelopes carry both.
111
62
 
112
- | Layer | What it does | Key primitive |
113
- |-------|-------------|---------------|
114
- | **Enforcement Gateway** | Sits between agent and tools. Checks every constraint. Executes, generates receipts. | `ProxyGateway` — 6 enforcement properties, replay protection, revocation recheck |
115
- | **Reputation & Trust** | Bayesian scoring, authority tiers, evidence-weighted. Agents earn trust, don't claim it. | `ScopedReputation`, `AuthorityTier`, configurable decay |
116
- | **Agentic Commerce** | 4-gate checkout, spend tracking, human approval thresholds, beneficiary attribution. | `commercePreflight`, `CommerceActionReceipt` |
117
- | **Coordination** | Task briefs, evidence submission, review gates, handoffs, deliverables, metrics. | `TaskUnit` lifecycle with integrity validation |
118
- | **Intent & Policy** | Roles, tradeoff rules, deliberative consensus, 3-signature policy chain. | `ActionIntent` → `PolicyDecision` → `ActionReceipt` |
119
- | **Values Floor** | 8 principles (5 enforced, 3 attested). Graduated enforcement: inline/audit/warn. | `FloorAttestation`, compliance verification |
120
- | **Communication** | Ed25519-signed messages, registry, threading, topic filtering. | `SignedAgoraMessage`, tamper detection |
121
- | **Identity** | Bring your own: did:key, did:web, SPIFFE, OAuth, native did:aps. Ed25519 keypairs, scoped delegation, cascade revocation. | `toDIDKey`, `importSPIFFESVID`, `importOAuthToken`, `SignedPassport` |
63
+ `commercePreflight()` enforces the structural layer at gate 5: when the action references a `walletRef`, the gate denies with `WALLET_NOT_BOUND` unless the wallet is currently bound to the acting passport. The check is opt-in — actions without a `walletRef` skip it, so existing 5-gate flows are unaffected.
122
64
 
123
- **Extended modules (9-71):** W3C DID (`did:aps`), DID Interop (`did:key`, `did:web`), Identity Bridge (SPIFFE SVID, OAuth tokens), VC Wrapper (W3C Verifiable Credentials with did:key + SPIFFE evidence), Credential Request Protocol (selective disclosure), Verifiable Credentials, A2A Bridge, EU AI Act Compliance, Agent Context, Task Routing, Cross-Chain Data Flow (taint tracking, confused deputy prevention), E2E Encrypted Messaging (X25519 + XSalsa20), Obligations, Governance Provenance, Identity Continuity & Key Rotation, Receipt Ledger (Merkle-committed audit batches), Feasibility Linting, Precedent Control, Re-anchoring, Bounded Escalation, Oracle Witness Diversity, Messaging Audit Bridge, Policy Conflict Detection, Data Source Registration, Decision Semantics, Decision Equivalence, Execution Attestation, Bilateral Receipts, Governance Blocks, aps.txt, Governance 360, Data Lifecycle, Persistent Passports, ProxyGateway.
65
+ `unbindWallet()` produces a separately signed unbind event so the bind/unbind history can be reconstructed independent of the passport's current `bound_wallets` snapshot.
124
66
 
125
- **V2 Constitutional Framework (32 modules):** Designed through cross-model adversarial review. PolicyContext with mandatory sunset, Delegation Versioning, Outcome Registration, Anomaly Detection, Emergency Pathways, Migration (fork-and-sunset), Contextual Attestation, Approval Fatigue Detection, Effect Enforcement, Emergence Detection, Separation of Powers, Constitutional Amendment, Circuit Breakers, Epistemic Isolation, and 18 more. Source: [`src/v2/`](src/v2/).
67
+ ## Credential Check Policy
126
68
 
127
- ## MCP Server
128
-
129
- 132 tools across all modules. Any MCP client connects agents directly.
69
+ A credential needs to declare WHEN it should be re-verified. Different credential types have different trust decay profiles. APS lets the issuer set this on the delegation itself via `credentialCheckPolicy`.
130
70
 
131
- ```bash
132
- npm install -g agent-passport-system-mcp
133
- npx agent-passport-system-mcp setup
71
+ ```typescript
72
+ import { createDelegation } from 'agent-passport-system'
73
+
74
+ const delegation = createDelegation({
75
+ delegatedTo: agentPublicKey,
76
+ delegatedBy: principalPublicKey,
77
+ scope: ['payments:wire'],
78
+ spendLimit: 1_000_000,
79
+ expiresInHours: 24,
80
+ privateKey: principalPrivateKey,
81
+ credentialCheckPolicy: {
82
+ mode: 'both', // 'on-accept' | 'on-process' | 'both'
83
+ max_acceptance_age: 3600, // optional, seconds
84
+ },
85
+ })
134
86
  ```
135
87
 
136
- Every operation Ed25519 signed. Role-scoped access control. Auto-configures Claude Desktop and Cursor.
137
-
138
- npm: [agent-passport-system-mcp](https://www.npmjs.com/package/agent-passport-system-mcp) · GitHub: [aeoess/agent-passport-mcp](https://github.com/aeoess/agent-passport-mcp)
139
-
140
- ## Python SDK
88
+ Three modes:
141
89
 
142
- Full Python implementation. Signatures created in Python verify in TypeScript and vice versa.
143
-
144
- ```bash
145
- pip install agent-passport-system
146
- ```
90
+ **`on-accept`** -- verify once at credential acceptance time, trust the snapshot afterward. Cheap. Use for long-lived session credentials where the live revocation cost is prohibitive and brief staleness is acceptable. Live revocation between accept and process will not be caught.
147
91
 
148
- PyPI: [agent-passport-system](https://pypi.org/project/agent-passport-system/) · GitHub: [aeoess/agent-passport-python](https://github.com/aeoess/agent-passport-python)
92
+ **`on-process`** -- verify on every action evaluation. The default. Catches live revocation. This matches the existing APS recheck-on-execute behavior, so delegations without an explicit `credentialCheckPolicy` continue to work unchanged.
149
93
 
150
- ## CLI
94
+ **`both`** -- verify at acceptance AND at process time. Use for high-stakes actions (large spend, irreversible operations, cross-org transactions) where you want both the snapshot integrity check AND the live state check.
151
95
 
152
- 14 commands: `join`, `delegate`, `work`, `prove`, `audit`, `verify`, `inspect`, `status`, `agora post`, `agora read`, `agora list`, `agora verify`, `agora register`, `agora topics`.
96
+ Denial codes specific to this gate: `CREDENTIAL_NOT_ACCEPTED` (policy is `on-accept`/`both` but no acceptance stamp), `CREDENTIAL_ACCEPT_STALE` (stamp older than `max_acceptance_age`), `PROCESS_TIME_INVALID` (live state failed), `ACCEPT_TIME_INVALID` (acceptance check failed).
153
97
 
154
- ```bash
155
- npx agent-passport join --name my-agent --owner alice --floor values/floor.yaml
156
- npx agent-passport work --scope code_execution --result success --summary "Built the feature"
157
- npx agent-passport audit --floor values/floor.yaml
158
- ```
98
+ Proposed by [@piiiico](https://github.com/piiiico) on the a2aproject/A2A governance metadata thread.
159
99
 
160
- ## Tests
100
+ ## Extended Modules
161
101
 
162
- ```bash
163
- npm test
164
- # 2,535 tests, 0 failures
165
- ```
102
+ Pick what you need. `import from 'agent-passport-system'` for the full API.
166
103
 
167
- 50 adversarial tests: Merkle tampering, attribution gaming, compliance violations, floor negotiation attacks, cross-chain confused deputy, taint laundering, authority probing.
104
+ Coordination (task lifecycle with 9-state machine), EU AI Act compliance (signed evidence packets), framework adapters (CrewAI, LangChain, Google ADK, A2A, MCP), bilateral receipts, execution attestation, DID resolution, data lifecycle (access receipts, derivation tracking, consent revocation).
168
105
 
169
- ## How It Compares
106
+ ## Research Primitives
170
107
 
171
- | | APS | DeepMind | GaaS | OpenAI | LOKA |
172
- |---|---|---|---|---|---|
173
- | Status | Running code | Paper | Simulated | Advisory | Paper |
174
- | Enforcement gateway | 6 properties, replay protection | — | — | — | — |
175
- | Reputation/trust scoring | Bayesian + tiers | — | — | — | Consensus |
176
- | Identity | Ed25519 | Proposed | External | — | Proposed |
177
- | Delegation | Scoped + cascade revoke | Proposed | N/A | — | — |
178
- | Commerce | 4-gate + spend tracking | — | — | — | — |
179
- | Signed receipts | 3-sig chain | Proposed | Logs | General | — |
180
- | Values enforcement | 8 principles, graduated | — | Rules | — | — |
181
- | Coordination | Task lifecycle + MCP | — | — | — | — |
182
- | Tests | 2,230 (50 adversarial) | None | Limited | None | None |
108
+ Forward-looking governance. Published, tested, available.
183
109
 
184
- ## Recognition
110
+ 32 v2 constitutional modules: approval fatigue detection, epistemic isolation, blind evaluation, separation of powers, affected-party standing, circuit breakers, constitutional amendment, authority laundering audit, emergence detection.
185
111
 
186
- - **Working Group** with 4 founding members: APS, AgentID, qntm, OATR. Cross-protocol interop proven across three languages.
187
- - Integrated into [Microsoft agent-governance-toolkit](https://github.com/microsoft/agent-governance-toolkit) (PR #598)
188
- - Referenced in [MITRE ATLAS](https://github.com/mitre-atlas/atlas-data/issues/11) agent security techniques
189
- - Referenced in [MCP SEP-1763](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1763) interceptor framework
190
- - NIST NCCoE public comment on AI Agent Identity and Authorization
191
- - Collaboration with IETF DAAP draft author on delegation spec
192
- - Endorsed by Garry Tan (CEO, Y Combinator)
112
+ Institutional governance: charters, offices, federation, reserves, multi-party approvals.
193
113
 
194
- ## Paper
114
+ ## MCP Server
195
115
 
196
- **"Monotonic Narrowing for Agent Authority"** — Published on [Zenodo](https://doi.org/10.5281/zenodo.18749779). [Read →](papers/agent-social-contract.md)
116
+ ```bash
117
+ npx agent-passport-system-mcp
118
+ ```
197
119
 
198
- 📄 **"From Access to Derivation: Behavioral Derivation Rights"** Published on [Zenodo](https://doi.org/10.5281/zenodo.19476002). Governing what agents learn from authorized access.
120
+ 20 essential tools by default. Set `APS_PROFILE=full` for all 132 tools. Profiles: essential, identity, governance, coordination, commerce, data, gateway, comms, minimal, full.
199
121
 
200
- ## Authorship
122
+ ## Numbers
201
123
 
202
- Built by **Tymofii Pidlisnyi** ([@tima](https://github.com/aeoess)). Protocol designed with AI assistance from Claude (Anthropic), GPT (OpenAI), and Gemini (Google) through adversarial cross-model review.
124
+ 2,552 tests. 8 protocol layers. 11 framework adapters. Gateway evaluation under 2ms. Zero heavy dependencies. Apache-2.0.
203
125
 
204
- Website: [aeoess.com](https://aeoess.com) · npm: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) · MCP: [agent-passport-system-mcp](https://www.npmjs.com/package/agent-passport-system-mcp)
126
+ ## Papers
205
127
 
206
- ## LLM Documentation
128
+ - [The Agent Social Contract](https://doi.org/10.5281/zenodo.18749779)
129
+ - [Faceted Authority Attenuation](https://doi.org/10.5281/zenodo.19260073)
130
+ - [Behavioral Derivation Rights](https://doi.org/10.5281/zenodo.19365841)
131
+ - [Physics-Enforced Delegation](https://doi.org/10.5281/zenodo.19478584)
132
+ - IETF Internet-Draft: draft-pidlisnyi-aps-00
207
133
 
208
- - Index: [aeoess.com/llms.txt](https://aeoess.com/llms.txt)
209
- - Full docs: [aeoess.com/llms-full.txt](https://aeoess.com/llms-full.txt)
210
- - Quick start: [aeoess.com/llms/quickstart.txt](https://aeoess.com/llms/quickstart.txt)
211
- - API reference: [aeoess.com/llms/api.txt](https://aeoess.com/llms/api.txt)
134
+ ## Links
212
135
 
213
- ## License
136
+ - [aeoess.com](https://aeoess.com) -- Protocol home
137
+ - [llms-full.txt](https://aeoess.com/llms-full.txt) -- Complete reference for AI agents
138
+ - [Dev log](https://aeoess.com/blog.html) -- Day-by-day build record
139
+ - [npm](https://www.npmjs.com/package/agent-passport-system) · [PyPI](https://pypi.org/project/agent-passport-system/) · [MCP](https://www.npmjs.com/package/agent-passport-system-mcp)
214
140
 
215
- Apache-2.0 — see [LICENSE](LICENSE)
141
+ Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0.
@@ -1,3 +1,4 @@
1
+ import type { WalletChain } from '../v2/wallet-binding/types.js';
1
2
  import type { SignedPassport } from '../types/passport.js';
2
3
  import type { ACPCheckoutSession, ACPLineItem, ACPMoney, ACPAddress, CommerceConfig, CommerceDelegation, CommercePreflightResult, CommerceActionReceipt, HumanApprovalRequest, IdempotencyStore } from '../types/commerce.js';
3
4
  export declare function commercePreflight(opts: {
@@ -6,6 +7,10 @@ export declare function commercePreflight(opts: {
6
7
  merchantName: string;
7
8
  estimatedTotal: ACPMoney;
8
9
  config?: CommerceConfig;
10
+ walletRef?: {
11
+ chain: WalletChain;
12
+ address: string;
13
+ };
9
14
  idempotencyKey: string;
10
15
  idempotencyStore: IdempotencyStore;
11
16
  idempotencyWindowSeconds?: number;
@@ -16,6 +21,10 @@ export declare function commercePreflight(opts: {
16
21
  merchantName: string;
17
22
  estimatedTotal: ACPMoney;
18
23
  config?: CommerceConfig;
24
+ walletRef?: {
25
+ chain: WalletChain;
26
+ address: string;
27
+ };
19
28
  }): CommercePreflightResult;
20
29
  export declare function createCheckout(opts: {
21
30
  signedPassport: SignedPassport;
@@ -1 +1 @@
1
- {"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../../src/core/commerce.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EACrD,cAAc,EAAE,kBAAkB,EAClC,uBAAuB,EACvB,qBAAqB,EAAE,oBAAoB,EAC3C,gBAAgB,EACjB,MAAM,sBAAsB,CAAA;AAmB7B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,kBAAkB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,QAAQ,CAAA;IACxB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACpC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,kBAAkB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,QAAQ,CAAA;IACxB,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,GAAG,uBAAuB,CAAA;AA6G3B,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,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A;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5B,GAAG,kBAAkB,CAYrB;AAID,wBAAgB,eAAe,CAAC,UAAU,EAAE,kBAAkB,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,SAAS,EAAE,OAAO,CAAA;CACnB,CAcA;AAID,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,qBAAqB,EAC9B,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA0BtC"}
@@ -18,6 +18,7 @@ import { sign, verify as ed25519Verify } from '../crypto/keys.js';
18
18
  import { canonicalize } from './canonical.js';
19
19
  import { verifyPassport } from '../verification/verify.js';
20
20
  import { scopeAuthorizes } from './delegation.js';
21
+ import { verifyBoundWallet } from '../v2/wallet-binding/bind.js';
21
22
  // ── Commerce Scopes ──
22
23
  const COMMERCE_SCOPES = [
23
24
  'commerce:checkout',
@@ -77,7 +78,19 @@ export function commercePreflight(opts) {
77
78
  : `Merchant "${opts.merchantName}" is NOT on approved list: [${opts.delegation.approvedMerchants.join(', ')}]`,
78
79
  });
79
80
  }
80
- // Gate 5: Idempotency check (async, only if key + store provided)
81
+ // Gate 5: Wallet binding (only when the action references a specific wallet)
82
+ // Existing 5-gate flows that don't pass walletRef are unaffected.
83
+ if (opts.walletRef) {
84
+ const isBound = verifyBoundWallet(opts.signedPassport, opts.walletRef.chain, opts.walletRef.address);
85
+ checks.push({
86
+ check: 'wallet_bound',
87
+ passed: isBound,
88
+ detail: isBound
89
+ ? `Wallet ${opts.walletRef.chain}:${opts.walletRef.address} is bound to passport ${opts.signedPassport.passport.agentId}`
90
+ : `WALLET_NOT_BOUND: ${opts.walletRef.chain}:${opts.walletRef.address} is not bound to passport ${opts.signedPassport.passport.agentId}`,
91
+ });
92
+ }
93
+ // Gate 6: Idempotency check (async, only if key + store provided)
81
94
  if (opts.idempotencyKey && opts.idempotencyStore) {
82
95
  const windowSeconds = opts.idempotencyWindowSeconds ?? 300;
83
96
  return opts.idempotencyStore.check(opts.idempotencyKey, windowSeconds).then(result => {
@@ -1 +1 @@
1
- {"version":3,"file":"commerce.js","sourceRoot":"","sources":["../../../src/core/commerce.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,6CAA6C;AAC7C,qEAAqE;AACrE,2EAA2E;AAC3E,EAAE;AACF,yDAAyD;AACzD,kEAAkE;AAClE,wEAAwE;AACxE,+DAA+D;AAC/D,4EAA4E;AAC5E,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAClE,qEAAqE;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAUjD,wBAAwB;AAExB,MAAM,eAAe,GAAG;IACtB,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;CACT,CAAA;AAIV,SAAS,QAAQ,CAAC,UAA8B,EAAE,QAAuB;IACvE,OAAO,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACpD,CAAC;AAqBD,MAAM,UAAU,iBAAiB,CAAC,IASjC;IACC,MAAM,MAAM,GAA6B,EAAE,CAAA;IAC3C,MAAM,QAAQ,GAAa,EAAE,CAAA;IAE7B,gCAAgC;IAChC,MAAM,cAAc,GAAG,cAAc,CAA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,CAAC,4BAA4B,CAAC,CAAA;IAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;AAC/C,CAAC"}
@@ -8,6 +8,8 @@ export interface CreateDelegationOptions {
8
8
  scope: string[];
9
9
  scopeInterpretation?: 'exact' | 'glob' | 'hierarchical';
10
10
  spendLimit?: number;
11
+ /** Unit for spendLimit. Default 'currency'. 'invocations' for count-based bounds. */
12
+ spendLimitUnit?: 'currency' | 'invocations';
11
13
  maxDepth?: number;
12
14
  currentDepth?: number;
13
15
  expiresInHours?: number;
@@ -15,6 +17,8 @@ export interface CreateDelegationOptions {
15
17
  notBefore?: string;
16
18
  derivation_rights?: import('../types/passport.js').DerivationRights;
17
19
  observation_policy?: import('../types/passport.js').ObservationPolicy;
20
+ /** Verification timing policy (v2/credential-check-policy) */
21
+ credentialCheckPolicy?: import('../v2/credential-check-policy/types.js').CredentialCheckPolicy;
18
22
  privateKey: string;
19
23
  }
20
24
  export declare function createDelegation(opts: CreateDelegationOptions): Delegation;
@@ -23,6 +27,8 @@ export interface SubDelegateOptions {
23
27
  delegatedTo: string;
24
28
  scope: string[];
25
29
  spendLimit?: number;
30
+ /** Unit for spendLimit. Default inherits parent. 'invocations' enables count-based bounds. */
31
+ spendLimitUnit?: 'currency' | 'invocations';
26
32
  derivation_rights?: import('../types/passport.js').DerivationRights;
27
33
  privateKey: string;
28
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../../src/core/delegation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAC7D,uBAAuB,EAAE,yBAAyB,EAClD,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAqB7B,4CAA4C;AAC5C,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEvD;AAKD,wBAAgB,YAAY,CAAC,QAA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B;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,aAAa,CAmDvE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,aAAa,EACtB,cAAc,EAAE,MAAM,GACrB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAWtC;AAGD,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,EAAE,CAG7D;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEhF;AAeD;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAStE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED,wBAAgB,WAAW,IAAI,IAAI,CAKlC"}
@@ -69,12 +69,14 @@ export function createDelegation(opts) {
69
69
  expiresAt: expiry.toISOString(),
70
70
  spendLimit: opts.spendLimit,
71
71
  spentAmount: 0,
72
+ ...(opts.spendLimitUnit && { spendLimitUnit: opts.spendLimitUnit }),
72
73
  maxDepth: opts.maxDepth ?? 1,
73
74
  currentDepth: opts.currentDepth ?? 0,
74
75
  createdAt: now.toISOString(),
75
76
  notBefore: opts.notBefore ?? now.toISOString(),
76
77
  ...(opts.derivation_rights && { derivation_rights: opts.derivation_rights }),
77
78
  ...(opts.observation_policy && { observation_policy: opts.observation_policy }),
79
+ ...(opts.credentialCheckPolicy && { credentialCheckPolicy: opts.credentialCheckPolicy }),
78
80
  };
79
81
  const canonical = canonicalize(delegation);
80
82
  const signature = sign(canonical, opts.privateKey);
@@ -131,9 +133,15 @@ export function subDelegate(opts) {
131
133
  if (opts.derivation_rights && !parent.derivation_rights) {
132
134
  throw new Error('Derivation rights violation: parent delegation has no derivation_rights — child cannot introduce them');
133
135
  }
134
- // Enforce spend limit (use ?? not || so spendLimit: 0 is a valid no-spend limit)
136
+ // Enforce spend limit (use ?? not || so spendLimit: 0 is a valid no-spend limit).
137
+ // When child declares a unit that differs from parent (e.g. 'invocations' on a
138
+ // currency-based parent), parent-remaining comparison is skipped — the units
139
+ // are incommensurable and the child sets its own independent bound.
140
+ const parentUnit = parent.spendLimitUnit ?? 'currency';
141
+ const childUnit = opts.spendLimitUnit ?? parentUnit;
142
+ const unitsMatch = childUnit === parentUnit;
135
143
  const parentRemaining = (parent.spendLimit ?? Infinity) - (parent.spentAmount ?? 0);
136
- if (opts.spendLimit !== undefined && opts.spendLimit !== null && opts.spendLimit > parentRemaining) {
144
+ if (unitsMatch && opts.spendLimit !== undefined && opts.spendLimit !== null && opts.spendLimit > parentRemaining) {
137
145
  throw new Error(`Spend limit ${opts.spendLimit} exceeds parent remaining ${parentRemaining}`);
138
146
  }
139
147
  // Clamp child expiry to parent expiry (monotonic narrowing of time bounds)
@@ -147,7 +155,8 @@ export function subDelegate(opts) {
147
155
  delegatedBy: parent.delegatedTo, // the current delegate becomes delegator
148
156
  scope: opts.scope,
149
157
  scopeInterpretation: parent.scopeInterpretation, // Module 37: inherit from parent
150
- spendLimit: opts.spendLimit ?? parentRemaining,
158
+ spendLimit: opts.spendLimit ?? (unitsMatch ? parentRemaining : undefined),
159
+ spendLimitUnit: opts.spendLimitUnit,
151
160
  maxDepth: parent.maxDepth,
152
161
  currentDepth: parent.currentDepth + 1,
153
162
  expiresInHours: childExpiryHours,