@atrib/agent 0.2.5 → 0.2.7

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.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # `@atrib/agent`
2
2
 
3
- **Verifiable agent actions, client side. Every outbound MCP tool call gets signed at the moment of dispatch, carries provable context to the receiver, and chains into the next action. Works with every major MCP framework. Sits above every major agent payment protocol so commerce-closing settlement is bundled in.**
3
+ **Verifiable agent actions, client side. Outbound MCP tool calls carry atrib/W3C context, consume upstream signed records, record local gap nodes, and emit signed fallback transaction records when commerce closes. Works with every major MCP framework. Sits above every major agent payment protocol so commerce-closing evidence can join the same trace.**
4
4
 
5
- `@atrib/agent` is the client-side half of the [atrib protocol](https://github.com/creatornader/atrib/blob/main/atrib-spec.md). Each outbound MCP tool call becomes a signed, chainable record so anyone (the agent itself, downstream auditors, merchants closing a transaction, future agents picking up the work) can verify what happened without trusting any intermediary.
5
+ `@atrib/agent` is the client-side half of the [atrib protocol](https://github.com/creatornader/atrib/blob/main/atrib-spec.md). It keeps outbound MCP calls in the atrib session lifecycle: context goes out, upstream atrib tokens come back in, unsigned hops become local gap nodes, and transaction-shaped responses can produce signed agent-side fallback records. Ordinary `tool_call` records are signed at the tool boundary by `@atrib/mcp`, `@atrib/mcp-wrap`, or an instrumented upstream server.
6
6
 
7
- You set up one `atrib()` interceptor, plug it into your framework's adapter, and every outbound `tools/call` from that point on carries W3C trace context, an atrib chain token, and the full atrib session lifecycle. When a payment completes (through any of the supported commerce protocols), a transaction record closes the chain and the substrate produces a signed settlement document anyone can recompute. When commerce never closes the chain, the substrate still serves recall, audit, and cross-agent provenance.
7
+ You set up one `atrib()` interceptor, plug it into your framework's adapter, and every outbound `tools/call` from that point on carries W3C trace context, an atrib chain token, and the full atrib session lifecycle. When a payment completes through a supported commerce protocol, the interceptor can consume an upstream atrib record or emit an agent-side fallback `transaction` record. When commerce never closes the chain, the substrate still serves recall, audit, and cross-agent provenance.
8
8
 
9
9
  Two coverage surfaces define what you get:
10
10
 
@@ -26,7 +26,7 @@ Two coverage surfaces define what you get:
26
26
 
27
27
  ## Coverage Matrix 2: Agent Payment Protocols
28
28
 
29
- `@atrib/agent` sits **above** every major agent payment protocol. It does not implement payments, move money, or enforce transactions; it detects transaction events in the response flow of whichever payment protocol your agent is using, and writes a signed transaction record that closes the attribution chain. **You do not choose a payment protocol at install time**; the detection logic for all six (ACP, UCP, x402, MPP, AP2, a2a-x402) runs simultaneously and fires on whichever one your tool responses happen to carry. Transaction records emitted by `@atrib/agent` carry the `signers` array per spec [§1.7.6](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#176-cross-attestation-requirement-for-transaction-records); the counterparty signature is collected via the payment protocol's settlement response.
29
+ `@atrib/agent` sits **above** every major agent payment protocol. It does not implement payments, move money, or enforce transactions; it detects transaction events in the response flow of whichever payment protocol your agent is using, and writes a signed fallback transaction record when no upstream atrib token already closed the chain. **You do not choose a payment protocol at install time**; the detection logic for all six (ACP, UCP, x402, MPP, AP2, a2a-x402) runs simultaneously and fires on whichever one your tool responses happen to carry. The fallback record is signed by the agent. Counterparty signatures and payment-receipt evidence are verifier inputs when the protocol supplies them; [D052](https://github.com/creatornader/atrib/blob/main/DECISIONS.md#d052-cross-attestation-requirement-for-transaction-records)-aware verifiers still flag records that do not meet the required cross-attestation bar.
30
30
 
31
31
  All detection logic lives in `packages/agent/src/transaction.ts` and runs against unit tests for each protocol's published spec.
32
32
 
@@ -36,7 +36,7 @@ All detection logic lives in `packages/agent/src/transaction.ts` and runs agains
36
36
  | **UCP**. Universal Commerce Protocol | `github.com/universal-commerce-protocol/ucp` | Same shape as ACP + top-level `ucp.version` envelope | [§1.7.2](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#172-ucp-universal-commerce-protocol) |
37
37
  | **x402** | Coinbase. `github.com/coinbase/x402` | HTTP `PAYMENT-RESPONSE` header (v2) or legacy `X-PAYMENT-RESPONSE` (v1) on the 200 response | [§1.7.3](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#173-x402) |
38
38
  | **MPP**. Machine Payments Protocol | Tempo Labs / Stripe; IETF `draft-ryan-httpauth-payment-01` | HTTP `Payment-Receipt` header on 200 success response | [§1.7.4](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#174-mpp-machine-payments-protocol) |
39
- | **AP2**. Agent Payments Protocol | Google; `github.com/google-agentic-commerce/ap2` | A2A Message with DataPart containing `ap2.mandates.PaymentMandate` | [§1.7.5](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#175-ap2-and-a2a-x402) |
39
+ | **AP2**. Agentic Payment Protocol | Google; `github.com/google-agentic-commerce/AP2` | Successful AP2 `PaymentReceipt` or `CheckoutReceipt`; v0.1 `ap2.mandates.PaymentMandate` remains a fallback | [§1.7.5](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#175-ap2-and-a2a-x402) |
40
40
  | **a2a-x402** | Google. `github.com/google-agentic-commerce/a2a-x402` | A2A task `status.message.metadata["x402.payment.status"] === "payment-completed"` + `receipts[].success === true` | [§1.7.5](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#175-ap2-and-a2a-x402) (reported as AP2 crypto path) |
41
41
 
42
42
  **The linking mechanism is the same across all six:** the session `context_id` (16-byte anchor, equal to the W3C OTel trace-id by default) travels with the outbound payment request; via `X-atrib-Context` HTTP header for protocols that don't expose a free-form metadata field, or via `params._meta.atrib` for any payment protocol running over MCP transport. When the merchant's side sees the payment-completed signal, atrib writes a transaction record with that `context_id`, and the attribution graph can reconstruct the full chain from contributing tool calls → transaction → settlement.
@@ -97,9 +97,25 @@ HTTP/1.1 200 OK
97
97
  Payment-Receipt: eyJzdGF0dXMiOiJzdWNjZXNzIn0
98
98
  ```
99
99
 
100
- #### AP2: Google Agent Payments Protocol (v0.1)
100
+ #### AP2: Google Agentic Payment Protocol (v0.2)
101
101
 
102
- Detected from an A2A `Message` containing a `DataPart` whose `data` object has the literal key `"ap2.mandates.PaymentMandate"`. AP2 v0.1 does **not** use W3C Verifiable Credentials despite earlier drafts assuming it would (a legacy VC fallback is kept for research forks).
102
+ Detected from successful AP2 receipts. Current AP2 uses Checkout and Payment Mandates for authorization, then returns signed Checkout Receipts and Payment Receipts when a verifier accepts or rejects the mandate. atrib treats the successful receipt as the transaction close signal.
103
+
104
+ Decoded receipt objects are detected when they carry `status: "Success"` and the required AP2 fields. Signed receipt JWTs are detected in AP2 sample result envelopes when the envelope has `status: "success"` plus `payment_receipt` or `checkout_receipt`.
105
+
106
+ ```json
107
+ {
108
+ "status": "success",
109
+ "order_id": "order_123",
110
+ "checkout_receipt": "eyJhbGciOiJFUzI1NiJ9.eyJzdGF0dXMiOiJTdWNjZXNzIn0.signature"
111
+ }
112
+ ```
113
+
114
+ Mandate-only payloads are not detected, including `vct: "mandate.payment.1"` and `vct: "mandate.checkout.1"`. Mandates authorize a future action; they do not prove the verifier accepted it.
115
+
116
+ Verifier-side AP2 / Verifiable Intent checks live in `@atrib/verify`, not this detector. Use `verifyAp2ViEvidence()` for decoded receipts or `verifyAp2ViEvidenceAsync()` for compact signed receipt JWTs when a merchant or auditor needs to validate AP2 receipt references, VI SD-JWT signatures, `sd_hash` links, disclosure digests, delegated agent keys, and checkout/payment binding after detection.
117
+
118
+ The older AP2 v0.1 DataPart shape remains supported as a compatibility fallback:
103
119
 
104
120
  ```json
105
121
  {
@@ -119,7 +135,7 @@ Detected from an A2A `Message` containing a `DataPart` whose `data` object has t
119
135
  }
120
136
  ```
121
137
 
122
- `IntentMandate` and `CartMandate` are **not** detected; they are upstream funnel events, not transaction events. Only `PaymentMandate` closes the chain.
138
+ `IntentMandate` and `CartMandate` are still not detected; they are upstream funnel events, not transaction events.
123
139
 
124
140
  #### a2a-x402: Google AP2 crypto path
125
141
 
@@ -16,17 +16,23 @@ export interface CloudflareAgentLike {
16
16
  client: unknown;
17
17
  url?: URL | string;
18
18
  }>;
19
+ listServers?: () => Array<{
20
+ id: string;
21
+ name: string;
22
+ server_url?: string | null;
23
+ }>;
19
24
  };
20
25
  }
21
26
  /** Options for `attributeCloudflareAgentMcp`. */
22
27
  export interface AttributeCloudflareAgentMcpOptions {
23
- /** The atrib interceptor that should observe tool calls on this agent. */
28
+ /** The atrib interceptor that should observe MCP client calls on this agent. */
24
29
  interceptor: ToolCallInterceptor;
25
30
  /**
26
- * Optional override map of server name → canonical serverUrl. If a server
27
- * name appears here, the helper passes that URL as the `serverUrl` option
28
- * to `wrapMcpClient`. If a server name is missing from this map, the helper
29
- * derives serverUrl from the connection's own `url.origin`.
31
+ * Optional override map of server id or server name → canonical serverUrl.
32
+ * If a key appears here, the helper passes that URL as the `serverUrl`
33
+ * option to `wrapMcpClient`. If a key is missing from this map, the helper
34
+ * derives serverUrl from Cloudflare's stored server row, then from the
35
+ * connection's own `url`.
30
36
  *
31
37
  * Override when the upstream URL the agent connects to is not the canonical
32
38
  * URL you want to record in attribution records (e.g. you're hitting a
@@ -35,9 +41,9 @@ export interface AttributeCloudflareAgentMcpOptions {
35
41
  serverUrls?: Record<string, string>;
36
42
  }
37
43
  /**
38
- * Wrap every currently-connected MCP client on a Cloudflare Agent with atrib
39
- * attribution. Returns the number of connections wrapped (excluding ones that
40
- * were already wrapped). Idempotent. safe to call multiple times.
44
+ * Wrap every currently-connected MCP client on a Cloudflare Agent with atrib's
45
+ * agent interceptor. Returns the number of connections wrapped (excluding ones
46
+ * that were already wrapped). Idempotent. safe to call multiple times.
41
47
  *
42
48
  * Call this in `onStart()` after your `addMcpServer()` calls. If you add more
43
49
  * MCP servers later (in a message handler, after OAuth, etc.), call again.
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare-agent.d.ts","sourceRoot":"","sources":["../../src/adapters/cloudflare-agent.ts"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAkB3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE;QACH,cAAc,EAAE,MAAM,CACpB,MAAM,EACN;YACE,MAAM,EAAE,OAAO,CAAA;YACf,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAA;SACnB,CACF,CAAA;KACF,CAAA;CACF;AAED,iDAAiD;AACjD,MAAM,WAAW,kCAAkC;IACjD,0EAA0E;IAC1E,WAAW,EAAE,mBAAmB,CAAA;IAEhC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,kCAAkC,GAC1C,MAAM,CA4DR"}
1
+ {"version":3,"file":"cloudflare-agent.d.ts","sourceRoot":"","sources":["../../src/adapters/cloudflare-agent.ts"],"names":[],"mappings":"AAkEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAkB3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE;QACH,cAAc,EAAE,MAAM,CACpB,MAAM,EACN;YACE,MAAM,EAAE,OAAO,CAAA;YACf,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAA;SACnB,CACF,CAAA;QACD,WAAW,CAAC,EAAE,MAAM,KAAK,CAAC;YACxB,EAAE,EAAE,MAAM,CAAA;YACV,IAAI,EAAE,MAAM,CAAA;YACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAC3B,CAAC,CAAA;KACH,CAAA;CACF;AAED,iDAAiD;AACjD,MAAM,WAAW,kCAAkC;IACjD,gFAAgF;IAChF,WAAW,EAAE,mBAAmB,CAAA;IAEhC;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,kCAAkC,GAC1C,MAAM,CAsFR"}
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  /**
3
- * Adapter: attribute MCP tool calls flowing through a Cloudflare Agent.
3
+ * Adapter: route Cloudflare Agent MCP client calls through atrib's agent
4
+ * interceptor.
4
5
  *
5
6
  * Cloudflare's `agents` package exposes two MCP integration surfaces:
6
7
  *
@@ -14,15 +15,19 @@
14
15
  * 2. **Client-side `Agent.addMcpServer`**. your `Agent` (or `AIChatAgent`)
15
16
  * connects to one or more upstream MCP servers via `this.addMcpServer(name, url)`.
16
17
  * Cloudflare's `MCPClientManager` constructs an `@modelcontextprotocol/sdk`
17
- * Client per upstream and stores it on `agent.mcp.mcpConnections[name].client`.
18
+ * Client per upstream and stores it on `agent.mcp.mcpConnections[id].client`.
18
19
  * Tool invocations flow through `MCPClientManager.callTool()` which
19
- * delegates straight to `mcpConnections[serverId].client.callTool(...)`
20
- * (verified against `agents@0.9.0` `dist/client-BwgM3cRz.js` line 1444).
20
+ * delegates straight to `mcpConnections[serverId].client.callTool(...)`.
21
+ * Verified against `agents@0.13.3`.
21
22
  *
22
23
  * This file is the helper for surface (2). It walks `agent.mcp.mcpConnections`
23
24
  * after the agent has finished registering its upstream MCP servers and
24
25
  * replaces each connection's `client` field with one wrapped by `wrapMcpClient`.
25
- * Subsequent tool calls go through atrib's interceptor lifecycle.
26
+ * Subsequent tool calls carry atrib/W3C context, consume upstream attribution
27
+ * tokens, record unsigned gap nodes, and emit agent-side fallback transaction
28
+ * records when a response matches a known commerce close signal. Ordinary
29
+ * tool_call records still come from the upstream MCP server when it is wrapped
30
+ * with `@atrib/mcp`.
26
31
  *
27
32
  * Usage:
28
33
  *
@@ -53,7 +58,8 @@
53
58
  * Per spec §5.8 (degradation contract), if any single connection fails to wrap
54
59
  * (missing `client` field, unexpected shape), the helper logs a warning with
55
60
  * the `atrib:` prefix and skips it without throwing. The agent's tool calls
56
- * continue to work. they just won't be attributed for that connection.
61
+ * continue to work. they just won't carry agent-side atrib context or fallback
62
+ * transaction detection for that connection.
57
63
  */
58
64
  import { wrapMcpClient } from './mcp-client.js';
59
65
  /** Runtime check that an unknown value structurally matches MinimalMcpClient. */
@@ -69,9 +75,9 @@ function isMinimalMcpClient(v) {
69
75
  */
70
76
  const ATRIB_WRAPPED = Symbol.for('atrib.cloudflare.wrapped');
71
77
  /**
72
- * Wrap every currently-connected MCP client on a Cloudflare Agent with atrib
73
- * attribution. Returns the number of connections wrapped (excluding ones that
74
- * were already wrapped). Idempotent. safe to call multiple times.
78
+ * Wrap every currently-connected MCP client on a Cloudflare Agent with atrib's
79
+ * agent interceptor. Returns the number of connections wrapped (excluding ones
80
+ * that were already wrapped). Idempotent. safe to call multiple times.
75
81
  *
76
82
  * Call this in `onStart()` after your `addMcpServer()` calls. If you add more
77
83
  * MCP servers later (in a message handler, after OAuth, etc.), call again.
@@ -84,22 +90,44 @@ export function attributeCloudflareAgentMcp(agent, options) {
84
90
  return 0;
85
91
  }
86
92
  let wrapped = 0;
87
- for (const [name, conn] of Object.entries(connections)) {
93
+ const serversById = new Map();
94
+ try {
95
+ const servers = agent.mcp.listServers?.();
96
+ if (Array.isArray(servers)) {
97
+ for (const server of servers) {
98
+ if (typeof server.id === 'string') {
99
+ serversById.set(server.id, {
100
+ name: server.name,
101
+ server_url: server.server_url,
102
+ });
103
+ }
104
+ }
105
+ }
106
+ }
107
+ catch (err) {
108
+ console.warn('atrib: failed to read Cloudflare MCP server list, falling back to connection URLs', err);
109
+ }
110
+ for (const [connectionId, conn] of Object.entries(connections)) {
88
111
  try {
89
112
  if (!conn || !isMinimalMcpClient(conn.client)) {
90
- console.warn(`atrib: connection '${name}' has no client field, skipping`);
113
+ console.warn(`atrib: connection '${connectionId}' has no client field, skipping`);
91
114
  continue;
92
115
  }
93
116
  // Skip already-wrapped clients (idempotency)
94
117
  if (conn.client[ATRIB_WRAPPED] === true) {
95
118
  continue;
96
119
  }
97
- // Derive serverUrl: explicit override > connection.url.origin > undefined
98
- let serverUrl = options.serverUrls?.[name];
120
+ // Derive serverUrl:
121
+ // explicit override by id > explicit override by server name >
122
+ // Cloudflare stored server row > connection URL > undefined.
123
+ const server = serversById.get(connectionId);
124
+ let serverUrl = options.serverUrls?.[connectionId] ??
125
+ (server?.name ? options.serverUrls?.[server.name] : undefined) ??
126
+ (typeof server?.server_url === 'string' ? server.server_url : undefined);
99
127
  if (!serverUrl && conn.url) {
100
128
  try {
101
129
  const u = conn.url instanceof URL ? conn.url : new URL(conn.url);
102
- serverUrl = u.origin;
130
+ serverUrl = u.href;
103
131
  }
104
132
  catch {
105
133
  // URL parse failed; let wrapMcpClient fall back to no serverUrl
@@ -116,7 +144,7 @@ export function attributeCloudflareAgentMcp(agent, options) {
116
144
  catch (err) {
117
145
  // §5.8 degradation contract: never let a single bad connection break
118
146
  // the whole agent. Log and continue.
119
- console.warn(`atrib: failed to wrap MCP connection '${name}', skipping:`, err);
147
+ console.warn(`atrib: failed to wrap MCP connection '${connectionId}', skipping:`, err);
120
148
  }
121
149
  }
122
150
  return wrapped;
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare-agent.js","sourceRoot":"","sources":["../../src/adapters/cloudflare-agent.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAA;AAGtE,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,CAAU;IACpC,OAAO,CACL,CAAC,IAAI,IAAI;QACT,OAAO,CAAC,KAAK,QAAQ;QACrB,OAAQ,CAA4B,CAAC,QAAQ,KAAK,UAAU,CAC7D,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;AA2C5D;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAA0B,EAC1B,OAA2C;IA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AE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC9D,CAAC,OAAO,MAAM,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;YAC1E,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC3B,IAAI,CAAC;oBACH,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;oBAChE,SAAS,GAAG,CAAC,CAAC,IAAI,CAAA;gBACpB,CAAC;gBAAC,MAAM,CAAC;oBACP,gEAAgE;gBAClE,CAAC;YACH,CAAC;YAED,MAAM,aAAa,GAAG,aAAa,CACjC,IAAI,CAAC,MAAM,EACX,OAAO,CAAC,WAAW,EACnB,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAC/B,CAMA;YAAC,aAAoD,CAAC,aAAa,CAAC,GAAG,IAAI,CAAA;YAE5E,qEAAqE;YACrE,oEAAoE;YACpE,iDAAiD;YACjD,IAAI,CAAC,MAAM,GAAG,aAAa,CAAA;YAC3B,OAAO,EAAE,CAAA;QACX,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,qEAAqE;YACrE,qCAAqC;YACrC,OAAO,CAAC,IAAI,CAAC,yCAAyC,YAAY,cAAc,EAAE,GAAG,CAAC,CAAA;QACxF,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -4,21 +4,23 @@
4
4
  * Detects transaction events from response shapes for ACP, UCP, x402, MPP,
5
5
  * AP2, and heuristic tool name matching.
6
6
  *
7
- * Protocol shape sources (verified 2026-04-06):
7
+ * Protocol shape sources (verified 2026-05-27):
8
8
  * - ACP: github.com/agentic-commerce-protocol/agentic-commerce-protocol
9
9
  * rfcs/rfc.agentic_checkout.md
10
10
  * - UCP: github.com/universal-commerce-protocol/ucp
11
11
  * docs/specification/checkout-rest.md (version 2026-01-11)
12
- * - AP2: github.com/google-agentic-commerce/ap2 (v0.1). A2A Message with a
13
- * DataPart containing the key `ap2.mandates.PaymentMandate`. AP2 does
14
- * NOT currently use W3C Verifiable Credentials despite earlier drafts
15
- * of this code and the atrib spec assuming it would.
12
+ * - AP2: github.com/google-agentic-commerce/AP2 (v0.2). Current AP2 uses
13
+ * SD-JWT Mandates for authorization and signed CheckoutReceipt /
14
+ * PaymentReceipt JWTs for acceptance. Detection fires on successful
15
+ * receipt shapes, not mandate-only payloads. The legacy v0.1 A2A
16
+ * DataPart key `ap2.mandates.PaymentMandate` remains supported as a
17
+ * compatibility fallback.
16
18
  * - a2a-x402: github.com/google-agentic-commerce/a2a-x402. extension that
17
19
  * layers x402 crypto payments over A2A. Detection signal is
18
20
  * `status.message.metadata["x402.payment.status"] === "payment-completed"`
19
21
  * with at least one `success: true` entry in
20
22
  * `status.message.metadata["x402.payment.receipts"]`. Both shapes are
21
- * reported as `protocol: 'AP2'` since a2a-x402 IS the AP2 crypto path.
23
+ * reported as `protocol: 'AP2'` since a2a-x402 is the AP2 crypto path.
22
24
  * - x402: github.com/coinbase/x402. response header `PAYMENT-RESPONSE` (v2)
23
25
  * or `X-PAYMENT-RESPONSE` (v1 legacy). Value is base64-encoded JSON
24
26
  * with shape { success: bool, transaction, network, payer, requirements }.
@@ -28,7 +30,7 @@
28
30
  * Value is base64url-nopad JSON with required field { status: "success",
29
31
  * method, timestamp, reference }.
30
32
  *
31
- * x402 and MPP are DIFFERENT protocols that use DIFFERENT headers. Earlier
33
+ * x402 and MPP are different protocols that use different headers. Earlier
32
34
  * versions of this code conflated them on a fictitious shared `Payment-Receipt`
33
35
  * header. see DECISIONS.md D016 for the verification trail.
34
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,CAAA;AAEtF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC3C,oBAAoB,CAkItB"}
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,CAAA;AAEtF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AA2GD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC3C,oBAAoB,CAgJtB"}
@@ -7,6 +7,85 @@ const HEURISTIC_KEYWORDS = [
7
7
  'purchase',
8
8
  'checkout',
9
9
  ];
10
+ const AP2_PAYMENT_RECEIPT_KEYS = ['ap2.PaymentReceipt', 'payment_receipt'];
11
+ const AP2_CHECKOUT_RECEIPT_KEYS = ['ap2.CheckoutReceipt', 'checkout_receipt'];
12
+ const AP2_RECEIPT_SCAN_LIMIT = 80;
13
+ function isRecord(value) {
14
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
15
+ }
16
+ function isString(value) {
17
+ return typeof value === 'string';
18
+ }
19
+ function isNonEmptyString(value) {
20
+ return typeof value === 'string' && value.length > 0;
21
+ }
22
+ function hasAp2SuccessStatus(record) {
23
+ return record['status'] === 'Success' || record['status'] === 'success';
24
+ }
25
+ function looksLikeCompactJwt(value) {
26
+ return isNonEmptyString(value) && value.split('.').length === 3;
27
+ }
28
+ function isAp2PaymentReceiptObject(value) {
29
+ if (!isRecord(value))
30
+ return false;
31
+ return (value['status'] === 'Success' &&
32
+ isString(value['iss']) &&
33
+ typeof value['iat'] === 'number' &&
34
+ isNonEmptyString(value['reference']) &&
35
+ isNonEmptyString(value['payment_id']) &&
36
+ isNonEmptyString(value['psp_confirmation_id']) &&
37
+ isNonEmptyString(value['network_confirmation_id']));
38
+ }
39
+ function isAp2CheckoutReceiptObject(value) {
40
+ if (!isRecord(value))
41
+ return false;
42
+ return (value['status'] === 'Success' &&
43
+ isString(value['iss']) &&
44
+ typeof value['iat'] === 'number' &&
45
+ isNonEmptyString(value['reference']) &&
46
+ isNonEmptyString(value['order_id']));
47
+ }
48
+ function hasAp2ReceiptField(record, keys, isReceiptObject) {
49
+ for (const key of keys) {
50
+ const value = record[key];
51
+ if (isReceiptObject(value))
52
+ return true;
53
+ if (hasAp2SuccessStatus(record) && looksLikeCompactJwt(value))
54
+ return true;
55
+ }
56
+ return false;
57
+ }
58
+ function containsAp2V02Receipt(value) {
59
+ const queue = [value];
60
+ const seen = new Set();
61
+ let scanned = 0;
62
+ while (queue.length > 0 && scanned < AP2_RECEIPT_SCAN_LIMIT) {
63
+ const current = queue.shift();
64
+ scanned += 1;
65
+ if (Array.isArray(current)) {
66
+ for (const item of current)
67
+ queue.push(item);
68
+ continue;
69
+ }
70
+ if (!isRecord(current))
71
+ continue;
72
+ if (seen.has(current))
73
+ continue;
74
+ seen.add(current);
75
+ if (isAp2PaymentReceiptObject(current) || isAp2CheckoutReceiptObject(current)) {
76
+ return true;
77
+ }
78
+ if (hasAp2ReceiptField(current, AP2_PAYMENT_RECEIPT_KEYS, isAp2PaymentReceiptObject) ||
79
+ hasAp2ReceiptField(current, AP2_CHECKOUT_RECEIPT_KEYS, isAp2CheckoutReceiptObject)) {
80
+ return true;
81
+ }
82
+ for (const nested of Object.values(current)) {
83
+ if (isRecord(nested) || Array.isArray(nested))
84
+ queue.push(nested);
85
+ }
86
+ }
87
+ return false;
88
+ }
10
89
  /**
11
90
  * Detect whether a tool call response contains a transaction signal (§5.4.5).
12
91
  */
@@ -57,7 +136,20 @@ export function detectTransaction(toolName, response, headers) {
57
136
  return { detected: true, protocol: 'MPP', checkoutUrl: null };
58
137
  }
59
138
  }
60
- // AP2 v0.1. PaymentMandate Message inside an A2A DataPart.
139
+ // AP2 v0.2. Successful CheckoutReceipt / PaymentReceipt is the close signal.
140
+ // Mandates authorize the action and are kept out of transaction detection.
141
+ // Sources:
142
+ // - docs/ap2/specification.md: Checkout/Payment Receipt returned on completion
143
+ // - code/sdk/schemas/ap2/payment_receipt.json
144
+ // - code/sdk/schemas/ap2/checkout_receipt.json
145
+ // Shapes:
146
+ // - { status: "success", payment_receipt: "<signed JWT>" }
147
+ // - { status: "success", checkout_receipt: "<signed JWT>" }
148
+ // - { parts: [{ kind: "data", data: { "ap2.PaymentReceipt": { status: "Success", ... } } }] }
149
+ if (resp && containsAp2V02Receipt(resp)) {
150
+ return { detected: true, protocol: 'AP2', checkoutUrl: null };
151
+ }
152
+ // AP2 v0.1 compatibility. PaymentMandate Message inside an A2A DataPart.
61
153
  // Source: github.com/google-agentic-commerce/ap2 docs/specification.md
62
154
  // Shape: { ..., parts: [{ kind: "data", data: { "ap2.mandates.PaymentMandate": {...} } }, ...] }
63
155
  if (resp) {
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAoDtC,MAAM,kBAAkB,GAAG;IACzB,cAAc;IACd,mBAAmB;IACnB,iBAAiB;IACjB,aAAa;IACb,UAAU;IACV,UAAU;CACX,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,QAAiB,EACjB,OAA4C;IAE5C,MAAM,IAAI,GAAG,QAAsD,CAAA;IAEnE,uCAAuC;IACvC,2EAA2E;IAC3E,8EAA8E;IAC9E,0EAA0E;IAC1E,kDAAkD;IAClD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAuB,CAAA;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAwC,CAAA;QAClE,IAAI,MAAM,KAAK,WAAW,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YACvE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAwC,CAAA;YACtE,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,IAAI,OAAO,WAAW,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAA;YACzE,MAAM,WAAW,GACf,OAAO,KAAK,CAAC,eAAe,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAK,CAAC,eAAe,CAAY,CAAC,CAAC,CAAC,IAAI,CAAA;YACxF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,CAAA;QACzE,CAAC;QAED,6EAA6E;QAC7E,2GAA2G;QAC3G,IAAI,IAAI,CAAC,MAA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AAgB,IAAI,uBAAuB,CAAC,EAAE,CAAC;YAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;QAC/D,CAAC;IACH,CAAC;IAED,8CAA8C;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAA;IACxC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;IACrE,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AAC/D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atrib/agent",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,13 +33,13 @@
33
33
  "@noble/ed25519": "^3.1.0",
34
34
  "@noble/hashes": "^2.2.0",
35
35
  "canonicalize": "^3.0.0",
36
- "@atrib/mcp": "0.11.0",
37
- "@atrib/verify": "0.3.5"
36
+ "@atrib/mcp": "0.12.0",
37
+ "@atrib/verify": "0.3.7"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^25.8.0",
40
+ "@types/node": "^25.9.1",
41
41
  "typescript": "^6.0.3",
42
- "vitest": "^4.1.6"
42
+ "vitest": "^4.1.7"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",