@devlab.group/agent-commerce 2.7.2 → 2.8.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.
- package/README.md +71 -24
- package/dist/ap2.d.ts +3 -11
- package/dist/ap2.js +96 -27
- package/dist/ap2.js.map +1 -1
- package/dist/{chunk-77HLISG4.js → chunk-2PVRHMVT.js} +14 -10
- package/dist/chunk-2PVRHMVT.js.map +1 -0
- package/dist/chunk-ENK63GKR.js +22 -0
- package/dist/chunk-ENK63GKR.js.map +1 -0
- package/dist/{chunk-YHNTTMED.js → chunk-MDOGXTZD.js} +2 -2
- package/dist/chunk-MDOGXTZD.js.map +1 -0
- package/dist/chunk-MNI6APE6.js +64 -0
- package/dist/chunk-MNI6APE6.js.map +1 -0
- package/dist/{chunk-XXHC6AA3.js → chunk-QZW5YL3G.js} +160 -41
- package/dist/chunk-QZW5YL3G.js.map +1 -0
- package/dist/{chunk-DJRWYDKJ.js → chunk-RXYGC7A3.js} +3 -3
- package/dist/{chunk-DJRWYDKJ.js.map → chunk-RXYGC7A3.js.map} +1 -1
- package/dist/{chunk-5AO5N2XY.js → chunk-VHS6MGXJ.js} +621 -4
- package/dist/chunk-VHS6MGXJ.js.map +1 -0
- package/dist/cli/{ap2-O3HJSS2E.js → ap2-GYKFGE66.js} +35 -8
- package/dist/cli/ap2-GYKFGE66.js.map +1 -0
- package/dist/cli/chunk-2PO65227.js +619 -0
- package/dist/cli/chunk-2PO65227.js.map +1 -0
- package/dist/cli/{chunk-GBBG66O6.js → chunk-3PGFOEVJ.js} +132 -103
- package/dist/cli/chunk-3PGFOEVJ.js.map +1 -0
- package/dist/cli/chunk-4YZULHX2.js +64 -0
- package/dist/cli/chunk-4YZULHX2.js.map +1 -0
- package/dist/cli/chunk-526C4KZA.js +93 -0
- package/dist/cli/chunk-526C4KZA.js.map +1 -0
- package/dist/cli/{chunk-FETTSOMT.js → chunk-5CH5VFC6.js} +139 -4
- package/dist/cli/chunk-5CH5VFC6.js.map +1 -0
- package/dist/cli/chunk-6BWEHQPJ.js +215 -0
- package/dist/cli/chunk-6BWEHQPJ.js.map +1 -0
- package/dist/cli/chunk-GISJ73ML.js +20 -0
- package/dist/cli/chunk-GISJ73ML.js.map +1 -0
- package/dist/cli/chunk-MASLG557.js +26 -0
- package/dist/cli/chunk-MASLG557.js.map +1 -0
- package/dist/cli/chunk-RQ7W3NA5.js +143 -0
- package/dist/cli/chunk-RQ7W3NA5.js.map +1 -0
- package/dist/cli/chunk-RWBUHDU7.js +48 -0
- package/dist/cli/chunk-RWBUHDU7.js.map +1 -0
- package/dist/cli/chunk-SAAT2XFX.js +8 -0
- package/dist/cli/{chunk-B4QJV7OC.js.map → chunk-SAAT2XFX.js.map} +1 -1
- package/dist/cli/{chunk-S5TQXKQ7.js → chunk-SYXLQ5BS.js} +7 -5
- package/dist/cli/chunk-SYXLQ5BS.js.map +1 -0
- package/dist/cli/{chunk-FL4HPCD4.js → chunk-THH7Y3OO.js} +3 -35
- package/dist/cli/chunk-THH7Y3OO.js.map +1 -0
- package/dist/cli/{chunk-55AI6CLW.js → chunk-USIXWAXZ.js} +2 -2
- package/dist/cli/chunk-USIXWAXZ.js.map +1 -0
- package/dist/cli/{chunk-QUFFT5K3.js → chunk-VWQMSWDF.js} +141 -42
- package/dist/cli/chunk-VWQMSWDF.js.map +1 -0
- package/dist/cli/{chunk-OETKXDGA.js → chunk-WFIR374D.js} +89 -272
- package/dist/cli/chunk-WFIR374D.js.map +1 -0
- package/dist/cli/{chunk-XRG5UTIC.js → chunk-YXXPZFWC.js} +4 -4
- package/dist/cli/{chunk-XRG5UTIC.js.map → chunk-YXXPZFWC.js.map} +1 -1
- package/dist/cli/config-JWMHWVRT.js +14 -0
- package/dist/cli/{config-ODN4IEMZ.js.map → config-JWMHWVRT.js.map} +1 -1
- package/dist/cli/index.js +349 -78
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{mcp-G2D2Z77G.js → mcp-OW5GY7TT.js} +84 -45
- package/dist/cli/mcp-OW5GY7TT.js.map +1 -0
- package/dist/cli/payment-providers-QL2BJYMD.js +6 -0
- package/dist/cli/{payment-providers-7RIIZ5OF.js.map → payment-providers-QL2BJYMD.js.map} +1 -1
- package/dist/cli/{provider-ARV3VAQ7.js → provider-3A2LVEQS.js} +145 -23
- package/dist/cli/provider-3A2LVEQS.js.map +1 -0
- package/dist/cli/receipts-FQUFGEQD.js +9 -0
- package/dist/cli/{receipts-HLQ7D722.js.map → receipts-FQUFGEQD.js.map} +1 -1
- package/dist/cli/{run-BHODKC6H.js → run-KF5OQYPL.js} +92 -63
- package/dist/cli/run-KF5OQYPL.js.map +1 -0
- package/dist/cli/{x402-LHW2YQ6W.js → x402-5A7CVCIJ.js} +12 -8
- package/dist/cli/x402-5A7CVCIJ.js.map +1 -0
- package/dist/index.d.ts +36 -12
- package/dist/index.js +340 -394
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +80 -42
- package/dist/mcp.js.map +1 -1
- package/dist/mpp.d.ts +3 -2
- package/dist/mpp.js +139 -20
- package/dist/mpp.js.map +1 -1
- package/dist/{protocol-adapter-DdFL5LBU.d.ts → protocol-adapter-D6JH_kk-.d.ts} +2 -2
- package/dist/{runtime-BmaSp2Ce.d.ts → runtime-D8u6lYfx.d.ts} +10 -0
- package/dist/{store-DQwbKhnc.d.ts → store-BzgwHOPu.d.ts} +2 -2
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{transaction-BXXJltZ-.d.ts → transaction-F9ZvhokH.d.ts} +1 -1
- package/dist/types-Dl27vhEc.d.ts +167 -0
- package/dist/x402.d.ts +7 -110
- package/dist/x402.js +6 -5
- package/dist/x402.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-2573DASO.js +0 -8
- package/dist/chunk-2573DASO.js.map +0 -1
- package/dist/chunk-5AO5N2XY.js.map +0 -1
- package/dist/chunk-77HLISG4.js.map +0 -1
- package/dist/chunk-XXHC6AA3.js.map +0 -1
- package/dist/chunk-YHNTTMED.js.map +0 -1
- package/dist/cli/ap2-O3HJSS2E.js.map +0 -1
- package/dist/cli/chunk-3NVJAQRO.js +0 -119
- package/dist/cli/chunk-3NVJAQRO.js.map +0 -1
- package/dist/cli/chunk-55AI6CLW.js.map +0 -1
- package/dist/cli/chunk-66NTYSXI.js +0 -277
- package/dist/cli/chunk-66NTYSXI.js.map +0 -1
- package/dist/cli/chunk-B4QJV7OC.js +0 -8
- package/dist/cli/chunk-FETTSOMT.js.map +0 -1
- package/dist/cli/chunk-FL4HPCD4.js.map +0 -1
- package/dist/cli/chunk-GBBG66O6.js.map +0 -1
- package/dist/cli/chunk-H7EBJ4I3.js +0 -53
- package/dist/cli/chunk-H7EBJ4I3.js.map +0 -1
- package/dist/cli/chunk-OETKXDGA.js.map +0 -1
- package/dist/cli/chunk-QUFFT5K3.js.map +0 -1
- package/dist/cli/chunk-S5TQXKQ7.js.map +0 -1
- package/dist/cli/chunk-TPC4EJLT.js +0 -11
- package/dist/cli/chunk-TPC4EJLT.js.map +0 -1
- package/dist/cli/config-ODN4IEMZ.js +0 -13
- package/dist/cli/mcp-G2D2Z77G.js.map +0 -1
- package/dist/cli/payment-providers-7RIIZ5OF.js +0 -6
- package/dist/cli/provider-ARV3VAQ7.js.map +0 -1
- package/dist/cli/receipts-HLQ7D722.js +0 -9
- package/dist/cli/run-BHODKC6H.js.map +0 -1
- package/dist/cli/x402-LHW2YQ6W.js.map +0 -1
- package/dist/networks-DDHYJLcg.d.ts +0 -39
package/README.md
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
<a href="#quickstart"><img alt="Quickstart" src="https://img.shields.io/badge/quickstart-5%20minutes-2ea44f"></a>
|
|
9
9
|
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
10
10
|
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-strict-3178c6">
|
|
11
|
+
<!-- support-record:begin badges -->
|
|
11
12
|
<img alt="MCP" src="https://img.shields.io/badge/MCP-supported-6b4fbb">
|
|
12
13
|
<img alt="x402" src="https://img.shields.io/badge/x402-supported-0052ff">
|
|
13
14
|
<img alt="MPP" src="https://img.shields.io/badge/MPP-experimental-f0a30a">
|
|
14
15
|
<img alt="A2A" src="https://img.shields.io/badge/A2A-experimental-f0a30a">
|
|
15
16
|
<img alt="ACP" src="https://img.shields.io/badge/ACP-experimental-f0a30a">
|
|
16
17
|
<img alt="AP2" src="https://img.shields.io/badge/AP2-experimental-f0a30a">
|
|
18
|
+
<!-- support-record:end -->
|
|
17
19
|
</p>
|
|
18
20
|
|
|
19
21
|
## What it is, in ten seconds
|
|
@@ -71,7 +73,8 @@ agent-commerce doctor
|
|
|
71
73
|
|
|
72
74
|
Requires **Node >= 22**. The package includes the `agent-commerce` CLI
|
|
73
75
|
(`init`, `validate`, `start`, `doctor`, `reconcile`, `resolve`, `demo`,
|
|
74
|
-
`import openapi`, `version`) and a library for embedding
|
|
76
|
+
`import openapi`, `export mcp-registry`, `version`) and a library for embedding
|
|
77
|
+
the gateway.
|
|
75
78
|
The default install excludes optional protocol, payment and authorization
|
|
76
79
|
peers. The OpenAPI parser is a regular dependency because import is part of the
|
|
77
80
|
CLI.
|
|
@@ -84,10 +87,10 @@ agent-commerce start --config config.yaml --env-file .env
|
|
|
84
87
|
Install the optional peers for the features you enable, listed below. Missing
|
|
85
88
|
startup imports stop the gateway with an error naming the package; missing
|
|
86
89
|
Solana, NEAR or CDP peers fail provider health checks or payment requests.
|
|
87
|
-
`start`, `validate`, `doctor`, `reconcile` and `
|
|
88
|
-
load environment variables before reading the
|
|
89
|
-
the environment take precedence. To embed the
|
|
90
|
-
the library:
|
|
90
|
+
`start`, `validate`, `doctor`, `reconcile`, `resolve` and `export mcp-registry`
|
|
91
|
+
accept `--env-file <path>` to load environment variables before reading the
|
|
92
|
+
config. Variables already set in the environment take precedence. To embed the
|
|
93
|
+
gateway in your own process, use the library:
|
|
91
94
|
|
|
92
95
|
```ts
|
|
93
96
|
import { createGateway, loadConfig, receipts } from '@devlab.group/agent-commerce';
|
|
@@ -303,17 +306,22 @@ See [docs/configuration.md](docs/configuration.md).
|
|
|
303
306
|
|
|
304
307
|
## Protocol support
|
|
305
308
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
| **
|
|
311
|
-
| **
|
|
312
|
-
| **
|
|
313
|
-
| **
|
|
314
|
-
| **
|
|
315
|
-
| **
|
|
316
|
-
|
|
|
309
|
+
<!-- support-record:begin matrix -->
|
|
310
|
+
|
|
311
|
+
| Protocol | Status | Pinned revision | Implemented subset |
|
|
312
|
+
| ------------ | ------------ | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
313
|
+
| **HTTP** | Supported | native | resource routes and rail-specific payment headers |
|
|
314
|
+
| **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping |
|
|
315
|
+
| **x402** | Supported | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding |
|
|
316
|
+
| **MPP** | Experimental | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A |
|
|
317
|
+
| **A2A** | Experimental | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage`, paid flow and the x402 extension |
|
|
318
|
+
| **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations |
|
|
319
|
+
| **AP2** | Experimental | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement |
|
|
320
|
+
| **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` |
|
|
321
|
+
|
|
322
|
+
<!-- support-record:end -->
|
|
323
|
+
|
|
324
|
+
UCP is planned and has no implementation.
|
|
317
325
|
|
|
318
326
|
[AP2](docs/protocols/ap2.md) is an authorization method, not a transport. It verifies a
|
|
319
327
|
mandate before a paid resource settles; the gateway does not issue the mandate
|
|
@@ -333,11 +341,24 @@ prints the `unsupported` lists for A2A, ACP and AP2 when they are enabled.
|
|
|
333
341
|
|
|
334
342
|
### Versioning
|
|
335
343
|
|
|
336
|
-
Minor releases may break experimental configurations, integrations or types
|
|
337
|
-
MPP, A2A, ACP, AP2, ERC-8409 quotes,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
344
|
+
Minor releases may break experimental configurations, integrations or types.
|
|
345
|
+
This includes MPP, A2A, ACP, AP2, ERC-8409 quotes, the
|
|
346
|
+
[public resource URL](docs/configuration.md#public-resource-url) and
|
|
347
|
+
[Bazaar metadata](docs/configuration.md#bazaar-metadata) in payment
|
|
348
|
+
challenges, and these interfaces:
|
|
349
|
+
|
|
350
|
+
- `agent-commerce import openapi`.
|
|
351
|
+
- `agent-commerce export mcp-registry`, `doctor --registry` and the
|
|
352
|
+
`protocols.mcp.registry` keys.
|
|
353
|
+
- `PaymentProvider.reconcile` and the `ReceiptStore` methods and types added
|
|
354
|
+
in 2.6.0.
|
|
355
|
+
- The `idempotency` resource settings and the store and provider methods added
|
|
356
|
+
in 2.7.0.
|
|
357
|
+
- `PaymentContext.protocol` and `AdapterHealthComponent.undetermined` (added
|
|
358
|
+
in 2.8.0), and the `./testing` entry.
|
|
359
|
+
|
|
360
|
+
A profile moves from experimental to supported only when it meets the
|
|
361
|
+
[promotion criteria](docs/protocols.md#promotion-criteria).
|
|
341
362
|
|
|
342
363
|
The journal's `Transaction` type, `ReceiptStore` journal methods and
|
|
343
364
|
`/api/transactions` response shape are supported. The `transactionId` fields,
|
|
@@ -494,6 +515,7 @@ spend real USDC when their opt-ins and credentials are present.
|
|
|
494
515
|
$ npm run agent-commerce -- doctor --config config-demo.yaml
|
|
495
516
|
|
|
496
517
|
PASS Config valid: 2 resource(s), merchant "Demo Data Store" (using local chain manifest .deploy/local.json for X402_ASSET, X402_ASSET_NAME, X402_ASSET_VERSION, X402_ASSET_DECIMALS, MERCHANT_WALLET, X402_FACILITATOR_PRIVATE_KEY)
|
|
518
|
+
PASS Secrets 6 set (MERCHANT_WALLET, X402_ASSET, X402_ASSET_DECIMALS, X402_ASSET_NAME, X402_ASSET_VERSION, X402_FACILITATOR_PRIVATE_KEY); 8 defaulted (ADMIN_TOKEN, DASHBOARD_ORIGIN, GATEWAY_PORT, GATEWAY_PUBLIC_BASE_URL, MERCHANT_API_BASE_URL, RECEIPT_STORE_PATH, X402_NETWORK, X402_RPC_URL)
|
|
497
519
|
PASS Gateway healthy and ready at http://127.0.0.1:8080
|
|
498
520
|
PASS Backend 2/2 backend host(s) reachable
|
|
499
521
|
PASS Protocols http=on mcp=on (/mcp) a2a=off acp=off
|
|
@@ -501,12 +523,13 @@ INFO A2A disabled
|
|
|
501
523
|
INFO ACP disabled
|
|
502
524
|
INFO AP2 disabled
|
|
503
525
|
PASS Payments x402 v2 (scheme=exact) enabled - LOCAL dev chain (eip155:31337), destination=0x7099…79C8, facilitator=local (in-process), paymentFlow=authorization
|
|
526
|
+
PASS Payments (offers) 1 offer(s) pass their health checks
|
|
504
527
|
INFO Payments (MPP) MPP not configured
|
|
505
528
|
PASS Storage sqlite schema v5 writable; receipts=2
|
|
506
529
|
PASS Transactions none unresolved
|
|
507
530
|
PASS Protocol versions reported by gateway /.well-known/agent-commerce
|
|
508
531
|
|
|
509
|
-
Score:
|
|
532
|
+
Score: 10/10 checks passed
|
|
510
533
|
```
|
|
511
534
|
|
|
512
535
|
`doctor` compares live settlement terms with local config for each rail and
|
|
@@ -514,6 +537,29 @@ resource: offer order, network, token, payee and transfer method, plus decimals
|
|
|
514
537
|
and payment flows when published. Mismatches fail the check. It also names
|
|
515
538
|
failing offers when health is published; reasons appear in gateway debug logs.
|
|
516
539
|
|
|
540
|
+
`Secrets` lists each config placeholder (`${VAR}`) as missing, set or
|
|
541
|
+
defaulted. Config loading stops at the first missing variable; this check
|
|
542
|
+
reports them all. It fails if any are missing and prints names only, never
|
|
543
|
+
values or defaults.
|
|
544
|
+
|
|
545
|
+
A check that cannot reach a verdict carries `undetermined`: `unreachable`
|
|
546
|
+
for known transport failures, such as refused or reset connections, timeouts
|
|
547
|
+
or temporary DNS failures; `skipped` when a prerequisite fails. Unresolvable
|
|
548
|
+
hostnames and TLS errors leave the check unmarked.
|
|
549
|
+
Text output appends `[not determined: <reason>]`. The marker does not affect
|
|
550
|
+
status, score or exit code; an unreachable gateway still fails its check.
|
|
551
|
+
|
|
552
|
+
`--registry` (experimental) adds an `MCP Registry` check. It fetches the
|
|
553
|
+
latest listing for `protocols.mcp.registry.name` from
|
|
554
|
+
`registry.modelcontextprotocol.io`, sending only that name and a fixed
|
|
555
|
+
`include_deleted=true` flag, and compares it with what `export mcp-registry`
|
|
556
|
+
would write. Differences, deprecated or deleted listings, missing listings and
|
|
557
|
+
request failures produce WARN rather than FAIL.
|
|
558
|
+
Recognized transport failures also get the `unreachable` marker. The check
|
|
559
|
+
names differing fields and uses fixed messages for known lifecycle statuses,
|
|
560
|
+
without echoing arbitrary registry values or request error messages. See
|
|
561
|
+
[MCP Registry listing](docs/protocols/mcp.md#mcp-registry-listing).
|
|
562
|
+
|
|
517
563
|
Exits non-zero if anything fails. `--json` for machines.
|
|
518
564
|
|
|
519
565
|
### `agent-commerce reconcile`
|
|
@@ -675,8 +721,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
675
721
|
mainnet, Solana devnet and Solana mainnet, receipts, doctor, deterministic
|
|
676
722
|
demo, experimental A2A v1.0.1 and ACP `2026-04-17` checkout adapters,
|
|
677
723
|
experimental AP2 v0.2.0 mandate verification, experimental MPP `charge`
|
|
678
|
-
payments, experimental OpenAPI import,
|
|
679
|
-
response
|
|
724
|
+
payments, experimental OpenAPI import, experimental retries after a lost
|
|
725
|
+
response, and experimental discovery metadata for x402 Bazaar and MCP Registry
|
|
726
|
+
listings.
|
|
680
727
|
|
|
681
728
|
**Next** - a `doctor` GitHub Action · UCP ·
|
|
682
729
|
autonomous-mode AP2 (open mandates, agent key binding, constraint evaluation) ·
|
package/dist/ap2.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { A as AP2_CHECKOUT_MANDATE_VCT, a as AP2_CHECKOUT_PROFILE, b as AP2_DEFA
|
|
|
3
3
|
import { AuthorizationProvider, Clock } from './index.js';
|
|
4
4
|
import { Logger } from './index.js';
|
|
5
5
|
import { ReceiptStore } from './index.js';
|
|
6
|
-
import './transaction-
|
|
6
|
+
import './transaction-F9ZvhokH.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A private ES256 key: either a private JWK (the pair of the public one in the
|
|
@@ -54,19 +54,11 @@ interface CreateCheckoutJwtOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
declare function createCheckoutJwt(options: CreateCheckoutJwtOptions): Promise<string>;
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Adapter self-description.
|
|
59
|
-
*
|
|
60
|
-
* Imports nothing but core types and the pins, so `doctor` can report AP2
|
|
61
|
-
* without pulling `jose` or `@sd-jwt/core` into the CLI bundle.
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
57
|
/** What this provider actually verifies */
|
|
65
58
|
declare const AP2_CAPABILITIES: readonly string[];
|
|
66
59
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* support
|
|
60
|
+
* Unsupported AP2 features from the support record, published in the descriptor
|
|
61
|
+
* and printed by `doctor` to show the limits of protocol support
|
|
70
62
|
*/
|
|
71
63
|
declare const AP2_UNSUPPORTED: readonly string[];
|
|
72
64
|
|
package/dist/ap2.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AP2_CHECKOUT_MANDATE_VCT, AP2_SIGNING_ALGORITHM, AP2_DIGEST_ALGORITHM, AP2_CHECKOUT_PROFILE, AP2_SPEC_VERSION, AP2_KEY_TYPE, AP2_JWK_CURVE, openSqliteDatabase } from './chunk-
|
|
2
|
-
export { AP2_CHECKOUT_MANDATE_VCT, AP2_CHECKOUT_PROFILE, AP2_DEFAULT_CLOCK_SKEW_SECONDS, AP2_MAX_CLOCK_SKEW_SECONDS, AP2_SIGNING_ALGORITHM, AP2_SPEC_VERSION } from './chunk-
|
|
3
|
-
import { PACKAGE_VERSION } from './chunk-
|
|
1
|
+
import { AP2_CHECKOUT_MANDATE_VCT, AP2_SIGNING_ALGORITHM, AP2_DIGEST_ALGORITHM, AP2_CHECKOUT_PROFILE, AP2_SPEC_VERSION, AP2_KEY_TYPE, AP2_JWK_CURVE, openSqliteDatabase } from './chunk-RXYGC7A3.js';
|
|
2
|
+
export { AP2_CHECKOUT_MANDATE_VCT, AP2_CHECKOUT_PROFILE, AP2_DEFAULT_CLOCK_SKEW_SECONDS, AP2_MAX_CLOCK_SKEW_SECONDS, AP2_SIGNING_ALGORITHM, AP2_SPEC_VERSION } from './chunk-RXYGC7A3.js';
|
|
3
|
+
import { exclusionNames, descriptorStatus, PACKAGE_VERSION } from './chunk-ENK63GKR.js';
|
|
4
4
|
import { hasMethodGroup } from './chunk-WDD2ZUR3.js';
|
|
5
|
-
import { systemClock, NOOP_LOGGER, CommerceError } from './chunk-
|
|
5
|
+
import { systemClock, NOOP_LOGGER, CommerceError } from './chunk-MDOGXTZD.js';
|
|
6
6
|
import { isRecord } from './chunk-2CJNA7MS.js';
|
|
7
7
|
import { SignJWT, importPKCS8, importJWK, jwtVerify, decodeProtectedHeader, decodeJwt } from 'jose';
|
|
8
8
|
import canonicalize from 'canonicalize';
|
|
@@ -199,6 +199,96 @@ async function createCheckoutJwt(options) {
|
|
|
199
199
|
return new SignJWT({ agent_commerce: agentCommerce }).setProtectedHeader({ alg: AP2_SIGNING_ALGORITHM, kid, typ: "JWT" }).setIssuer(issuer).setAudience(audience).setIssuedAt(issuedAt).setExpirationTime(issuedAt + expiresIn).setJti(options.jwtId ?? crypto.randomUUID()).sign(key);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
// src/support/ap2.json
|
|
203
|
+
var ap2_default = {
|
|
204
|
+
name: "ap2",
|
|
205
|
+
kind: "authorization",
|
|
206
|
+
title: "AP2",
|
|
207
|
+
status: "experimental",
|
|
208
|
+
role: "Authorization method, not a payment rail: a paid resource can require a verified mandate in addition to its x402 or MPP payment, never instead of it.",
|
|
209
|
+
subset: "closed Checkout Mandate verification before settlement",
|
|
210
|
+
spec: {
|
|
211
|
+
revisions: ["v0.2.0"],
|
|
212
|
+
display: "v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode",
|
|
213
|
+
source: {
|
|
214
|
+
repo: "google-agentic-commerce/AP2",
|
|
215
|
+
commit: "b4587ac1d055888a73b4b21750973cffba961793"
|
|
216
|
+
},
|
|
217
|
+
stable: false,
|
|
218
|
+
statement: "Standardization of the specification will continue within the Agentic Authentication Technical and Payments Technical Working Groups in FIDO",
|
|
219
|
+
checked: "2026-11-17"
|
|
220
|
+
},
|
|
221
|
+
packages: [
|
|
222
|
+
{ name: "jose", use: "runtime" },
|
|
223
|
+
{ name: "@sd-jwt/core", use: "runtime" },
|
|
224
|
+
{ name: "canonicalize", use: "runtime" }
|
|
225
|
+
],
|
|
226
|
+
artifacts: [
|
|
227
|
+
{
|
|
228
|
+
path: "tests/fixtures/ap2/v0.2.0",
|
|
229
|
+
revision: "b4587ac1d055888a73b4b21750973cffba961793"
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
features: [
|
|
233
|
+
{ name: "direct-mode", status: "experimental" },
|
|
234
|
+
{ name: "trusted-agent-provider", status: "experimental" },
|
|
235
|
+
{ name: "mandate.checkout.1", status: "experimental" },
|
|
236
|
+
{ name: "sd-jwt-presentation", status: "experimental" },
|
|
237
|
+
{ name: "ES256", status: "experimental" },
|
|
238
|
+
{ name: "sha-256", status: "experimental" },
|
|
239
|
+
{ name: "static-inline-trust", status: "experimental" },
|
|
240
|
+
{ name: "merchant-checkout-jwt-binding", status: "experimental" },
|
|
241
|
+
{ name: "agent-commerce/ap2/checkout/v1", status: "experimental" },
|
|
242
|
+
{ name: "purchase-binding", status: "experimental" },
|
|
243
|
+
{ name: "replay-defence", status: "experimental" }
|
|
244
|
+
],
|
|
245
|
+
exclusions: [
|
|
246
|
+
{ name: "autonomous mode" },
|
|
247
|
+
{
|
|
248
|
+
name: "open checkout mandates (mandate.checkout.open.1)",
|
|
249
|
+
note: "Rejected because the provider does not evaluate spending constraints."
|
|
250
|
+
},
|
|
251
|
+
{ name: "payment mandates (mandate.payment.1)" },
|
|
252
|
+
{ name: "spending constraint evaluation" },
|
|
253
|
+
{ name: "cnf-bound agent keys" },
|
|
254
|
+
{ name: "user credential delegation (OpenID4VP)" },
|
|
255
|
+
{ name: "delegation chains and key-binding JWTs" },
|
|
256
|
+
{
|
|
257
|
+
name: "JWKS and any key discovery by URL (jku, x5u)",
|
|
258
|
+
note: "Operators supply all keys in config."
|
|
259
|
+
},
|
|
260
|
+
{ name: "issuer metadata fetching" },
|
|
261
|
+
{ name: "remote revocation" },
|
|
262
|
+
{ name: "key rotation without a config change" },
|
|
263
|
+
{ name: "signature algorithms other than ES256" },
|
|
264
|
+
{ name: "digest algorithms other than sha-256" },
|
|
265
|
+
{ name: "mandate issuance" },
|
|
266
|
+
{ name: "checkout receipts" },
|
|
267
|
+
{
|
|
268
|
+
name: "AP2 transport adapter or /.well-known/ap2",
|
|
269
|
+
note: "HTTP, MCP and A2A carry the mandate in the gateway's own carriers; AP2 v0.2.0 defines none."
|
|
270
|
+
},
|
|
271
|
+
{ name: "AP2 as a payment rail" },
|
|
272
|
+
{ name: "AP2 over the ACP checkout adapter" }
|
|
273
|
+
],
|
|
274
|
+
deviations: [],
|
|
275
|
+
conformance: {
|
|
276
|
+
suite: "Tests using mandates minted by the AP2 v0.2.0 reference SDK, plus end-to-end refusal cases.",
|
|
277
|
+
tests: [
|
|
278
|
+
"tests/unit/authorization-ap2/sdk-vectors.test.ts",
|
|
279
|
+
"tests/integration/ap2-x402-conformance.test.ts"
|
|
280
|
+
],
|
|
281
|
+
skipped: []
|
|
282
|
+
},
|
|
283
|
+
gaps: [
|
|
284
|
+
{
|
|
285
|
+
requirement: "Return a Checkout Receipt once the merchant has accepted or rejected a Checkout Mandate",
|
|
286
|
+
state: "open"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
docs: ["docs/protocols/ap2.md"]
|
|
290
|
+
};
|
|
291
|
+
|
|
202
292
|
// src/authorization/ap2/descriptor.ts
|
|
203
293
|
var AP2_CAPABILITIES = [
|
|
204
294
|
"direct-mode",
|
|
@@ -213,28 +303,7 @@ var AP2_CAPABILITIES = [
|
|
|
213
303
|
"purchase-binding",
|
|
214
304
|
"replay-defence"
|
|
215
305
|
];
|
|
216
|
-
var AP2_UNSUPPORTED =
|
|
217
|
-
// Mandate kinds. Open mandates are refused: see AP2_CHECKOUT_MANDATE_VCT
|
|
218
|
-
"autonomous mode",
|
|
219
|
-
"open checkout mandates (mandate.checkout.open.1)",
|
|
220
|
-
"payment mandates (mandate.payment.1)",
|
|
221
|
-
"spending constraint evaluation",
|
|
222
|
-
"cnf-bound agent keys",
|
|
223
|
-
// Delegation models other than a trusted agent provider
|
|
224
|
-
"user credential delegation (OpenID4VP)",
|
|
225
|
-
"delegation chains and key-binding JWTs",
|
|
226
|
-
// Key handling. Every key is written into config by an operator
|
|
227
|
-
"JWKS and any key discovery by URL (jku, x5u)",
|
|
228
|
-
"issuer metadata fetching",
|
|
229
|
-
"key rotation without a config change",
|
|
230
|
-
// Algorithms
|
|
231
|
-
"signature algorithms other than ES256",
|
|
232
|
-
"digest algorithms other than sha-256",
|
|
233
|
-
// Roles this gateway does not play
|
|
234
|
-
"mandate issuance",
|
|
235
|
-
"checkout receipts",
|
|
236
|
-
"AP2 over the ACP checkout adapter"
|
|
237
|
-
];
|
|
306
|
+
var AP2_UNSUPPORTED = exclusionNames(ap2_default);
|
|
238
307
|
function buildAp2Descriptor(implementationVersion) {
|
|
239
308
|
return {
|
|
240
309
|
name: "ap2",
|
|
@@ -242,7 +311,7 @@ function buildAp2Descriptor(implementationVersion) {
|
|
|
242
311
|
implementationVersion,
|
|
243
312
|
supportedSpec: `ap2/v${AP2_SPEC_VERSION} mode=direct`,
|
|
244
313
|
capabilities: AP2_CAPABILITIES,
|
|
245
|
-
status:
|
|
314
|
+
status: descriptorStatus(ap2_default),
|
|
246
315
|
unsupported: AP2_UNSUPPORTED
|
|
247
316
|
};
|
|
248
317
|
}
|