Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
0fe9013
test: capture 2.8.0 goldens for A2A answers and refusals
Revinand Nov 22, 2026
bf6bf27
feat(core): add task records to the store contract
Revinand Nov 22, 2026
97cd175
feat(storage): keep task records in schema v6
Revinand Nov 22, 2026
cbf86bf
feat(config): add A2A task retention
Revinand Nov 22, 2026
536c4c5
feat(a2a): validate every parameter and accept proto field names
Revinand Nov 22, 2026
cff5462
feat(a2a): serve GetTask, ListTasks and CancelTask from stored tasks
Revinand Nov 22, 2026
4e021e3
feat(a2a): return immediately and finish tasks in the background
Revinand Nov 23, 2026
851725b
feat(a2a): accept X-A2A-Extensions and warn on a public http base URL
Revinand Nov 23, 2026
11965c6
ci: run the A2A TCK at MUST level
Revinand Nov 23, 2026
9771092
feat(support): gate promotion on the criteria and promote core A2A
Revinand Nov 23, 2026
624a3f8
fix(a2a): name the x402 error code in a failed payment's status text
Revinand Nov 23, 2026
7e87a24
fix(support): list supported badges first
Revinand Nov 23, 2026
5aac86d
docs: note A2A task access and stored-task privacy
Revinand Nov 23, 2026
69ba343
fix(a2a): release the background slot when taking a pending payment f…
Revinand Nov 23, 2026
9d061a6
feat(storage): let a full task store evict records marked evictable
Revinand Nov 23, 2026
1195bb8
fix(a2a): mark task records nothing was charged for as evictable
Revinand Nov 23, 2026
9152240
fix(a2a): echo the x402 extension on every result to an activating re…
Revinand Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,68 @@ jobs:
# with deployed or preloaded tokens and no public RPC or facilitator.
- run: npm run test:e2e

tck:
name: A2A TCK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- run: npm ci
# Use the same record for the TCK revision and expected outcomes
- name: Read the TCK pin
id: pin
run: |
node -p "'repo=' + require('./src/support/a2a.json').conformance.upstream.repo" >> "$GITHUB_OUTPUT"
node -p "'commit=' + require('./src/support/a2a.json').conformance.upstream.commit" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
repository: ${{ steps.pin.outputs.repo }}
ref: ${{ steps.pin.outputs.commit }}
path: tck
persist-credentials: false
# Use the TCK lockfile to key the uv cache
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
version: '0.13.9'
python-version: '3.15.2'
enable-cache: true
cache-dependency-glob: tck/uv.lock
- run: uv sync --frozen
working-directory: tck
# The gateway's backend, RPC and facilitator URLs use loopback
# addresses in tests/tck/config.yaml
- name: Start the demo merchant and the gateway
run: |
npx tsx demo/merchant/src/main.ts > "$RUNNER_TEMP/merchant.log" 2>&1 &
AGENT_COMMERCE_CONFIG=tests/tck/config.yaml npx tsx src/gateway/main.ts > "$RUNNER_TEMP/gateway.log" 2>&1 &
for url in http://127.0.0.1:3000/api/report http://127.0.0.1:8099/health; do
for _ in $(seq 60); do
node -e "fetch('$url').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))" && break
sleep 1
done
node -e "fetch('$url').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"
done
# Run the comparison even if expected failures make the TCK exit
# non-zero. A missing report or one with no test cases fails the job.
- name: Run the TCK at MUST level
working-directory: tck
run: uv run --frozen ./run_tck.py --sut-host http://127.0.0.1:8099 --transport jsonrpc --level must || true
- name: Compare the run with the record
run: npx tsx scripts/tck-compare.ts tck/reports/junitreport.xml
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: tck-reports
path: |
tck/reports/
${{ runner.temp }}/gateway.log
retention-days: 7

package:
name: npm package
runs-on: ubuntu-latest
Expand Down
30 changes: 27 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ support, payment behavior and area boundaries consistent.

## Ground rules

1. **Scope discipline is a release requirement.** Supported: MCP, HTTP and
x402. Experimental and off by default: MPP, A2A, ACP and AP2; OpenAPI import
is an experimental CLI command. New protocols and rails land after the
1. **Scope discipline is a release requirement.** Supported: MCP, HTTP, x402
and A2A. A2A is off by default; its x402 extension is experimental.
MPP, ACP and AP2 are experimental and off by default. OpenAPI import is an
experimental CLI command. New protocols and rails land after the
adapter model survives real use. Classify every proposal as `BLOCKER` /
`QUALITY` / `NICE-TO-HAVE` / `POST-1.0` - the default answer to a new
capability is `POST-1.0`.
Expand Down Expand Up @@ -53,6 +54,29 @@ A change is not mergeable if the contract surface changed unannounced,
TypeScript fails, lint fails, required tests fail, or the deterministic E2E
fails.

### A2A TCK

The `tck` CI job runs the [A2A TCK](https://github.com/a2aproject/a2a-tck) at
MUST level against the gateway configured by `tests/tck/config.yaml`. It
compares failures and skips with `conformance.upstream` in
`src/support/a2a.json` and fails on a mismatch. The record lists individual
outcomes and shared skip messages, with a reason for each. Update it in the
same commit when these outcomes change.

To run locally, check out the TCK at the recorded commit and install Python
3.15 and [uv](https://docs.astral.sh/uv/). Run the comparison even if the TCK
command exits non-zero:

```bash
npm run demo:merchant &
AGENT_COMMERCE_CONFIG=tests/tck/config.yaml npx tsx src/gateway/main.ts &
# in the TCK checkout
uv sync --frozen
uv run --frozen ./run_tck.py --sut-host http://127.0.0.1:8099 --transport jsonrpc --level must
# back in this repository
npx tsx scripts/tck-compare.ts <tck checkout>/reports/junitreport.xml
```

## Architecture you need to know before writing code

Read, in order:
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!-- support-record:begin badges -->
<img alt="MCP" src="https://img.shields.io/badge/MCP-supported-6b4fbb">
<img alt="x402" src="https://img.shields.io/badge/x402-supported-0052ff">
<img alt="A2A" src="https://img.shields.io/badge/A2A-supported-2ea44f">
<img alt="MPP" src="https://img.shields.io/badge/MPP-experimental-f0a30a">
<img alt="A2A" src="https://img.shields.io/badge/A2A-experimental-f0a30a">
<img alt="ACP" src="https://img.shields.io/badge/ACP-experimental-f0a30a">
<img alt="AP2" src="https://img.shields.io/badge/AP2-experimental-f0a30a">
<!-- support-record:end -->
Expand All @@ -25,7 +25,7 @@ call and pay for it without adding those protocols to your backend.

Run the gateway in your infrastructure and describe each endpoint in YAML, or
generate draft resource definitions from OpenAPI. Resources can be exposed over
HTTP, MCP or experimental A2A; dedicated resources can implement experimental
HTTP, MCP or A2A; dedicated resources can implement experimental
ACP checkout operations. Paid resources use x402 or experimental MPP and can
also require an AP2 mandate proving that the buyer approved the purchase. Funds
go directly to the merchant wallet, and the gateway needs neither the buyer's
Expand Down Expand Up @@ -308,16 +308,16 @@ See [docs/configuration.md](docs/configuration.md).

<!-- support-record:begin matrix -->

| Protocol | Status | Pinned revision | Implemented subset |
| ------------ | ------------ | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **HTTP** | Supported | native | resource routes and rail-specific payment headers |
| **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping |
| **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 |
| **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 |
| **A2A** | Experimental | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage`, paid flow and the x402 extension |
| **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations |
| **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 |
| **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` |
| Protocol | Status | Pinned revision | Implemented subset |
| ------------ | ------------ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **HTTP** | Supported | native | resource routes and rail-specific payment headers |
| **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping |
| **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 |
| **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 |
| **A2A** | Supported | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental |
| **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations |
| **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 |
| **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` |

<!-- support-record:end -->

Expand All @@ -342,7 +342,8 @@ prints the `unsupported` lists for A2A, ACP and AP2 when they are enabled.
### Versioning

Minor releases may break experimental configurations, integrations or types.
This includes MPP, A2A, ACP, AP2, ERC-8409 quotes, the
This includes MPP, ACP, AP2, the
[a2a-x402 extension](docs/protocols/a2a.md#x402-extension), ERC-8409 quotes, the
[public resource URL](docs/configuration.md#public-resource-url) and
[Bazaar metadata](docs/configuration.md#bazaar-metadata) in payment
challenges, and these interfaces:
Expand All @@ -356,6 +357,7 @@ challenges, and these interfaces:
in 2.7.0.
- `PaymentContext.protocol` and `AdapterHealthComponent.undetermined` (added
in 2.8.0), and the `./testing` entry.
- `TaskRecord` and the task storage methods on `ReceiptStore`, added in 2.9.0.

A profile moves from experimental to supported only when it meets the
[promotion criteria](docs/protocols.md#promotion-criteria).
Expand Down Expand Up @@ -525,7 +527,7 @@ INFO AP2 disabled
PASS Payments x402 v2 (scheme=exact) enabled - LOCAL dev chain (eip155:31337), destination=0x7099…79C8, facilitator=local (in-process), paymentFlow=authorization
PASS Payments (offers) 1 offer(s) pass their health checks
INFO Payments (MPP) MPP not configured
PASS Storage sqlite schema v5 writable; receipts=2
PASS Storage sqlite schema v6 writable; receipts=2
PASS Transactions none unresolved
PASS Protocol versions reported by gateway /.well-known/agent-commerce

Expand Down Expand Up @@ -595,8 +597,8 @@ follows.
It exits 0 after a completed run, even if attempts remain unresolved, and 1 if
the run fails to complete. If a store error stops a hold scan, the command
prints the report, preserving any saved resolutions, and exits 1.
`reconcile` and `resolve` refuse receipt databases below schema v5 without
migrating them. Back up the database, then start the gateway once before
`reconcile` and `resolve` reject receipt databases with an older schema
without migrating them. Back up the database, then start the gateway once before
retrying either command.

Each family needs its own evidence:
Expand Down Expand Up @@ -719,7 +721,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).

**Now** - MCP, x402 v2, settlement on the local chain, Base Sepolia, Base
mainnet, Solana devnet and Solana mainnet, receipts, doctor, deterministic
demo, experimental A2A v1.0.1 and ACP `2026-04-17` checkout adapters,
demo, the A2A v1.0.1 adapter, the experimental ACP `2026-04-17` checkout adapter,
experimental AP2 v0.2.0 mandate verification, experimental MPP `charge`
payments, experimental OpenAPI import, experimental retries after a lost
response, and experimental discovery metadata for x402 Bazaar and MCP Registry
Expand Down
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"!package-lock.json",
"!src/protocols/acp/spec",
"!tests/fixtures/acp",
"!tests/fixtures/a2a",
"!tests/fixtures/mcp-registry",
"!tests/integration/goldens"
]
Expand Down
13 changes: 9 additions & 4 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ protocols:
# name: io.github.acme/weather
# version: 1.0.0
# description: Weather forecasts, paid per call
# A2A (Agent2Agent) v1.0.1 - experimental, off by default.
# Serves JSON-RPC `SendMessage` at mountPath and the Agent Card at
# /.well-known/agent-card.json. Enable at least one resource with
# `expose: [a2a]`. Clients send `A2A-Version: 1.0`.
# A2A (Agent2Agent) v1.0.1 is off by default; its x402 extension is experimental
# Serves JSON-RPC `SendMessage`, `GetTask`, `ListTasks` and `CancelTask` at
# mountPath and the Agent Card at /.well-known/agent-card.json. Enable at
# least one resource with `expose: [a2a]`. Clients send `A2A-Version: 1.0`.
# See docs/protocols/a2a.md for supported features.
a2a:
enabled: false
mountPath: /a2a
# Retain task responses in the receipt database for later reads.
# At capacity, refuse new records and keep existing ones.
# tasks:
# retentionHours: 24 # 1 to 8760
# maxRetained: 1000 # 1 to 1,000,000
# ACP (Agentic Commerce Protocol), stable snapshot 2026-04-17 - experimental,
# off by default. Enabling it serves the five checkout routes under mountPath
# and the specification-fixed discovery document at /.well-known/acp.json.
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public RPC or real funds.
| config schema, loader, env substitution | `src/config` |
| Fastify server, routes, adapter mounting | `src/gateway` |
| MCP adapter | `src/protocols/mcp` |
| A2A adapter (experimental) | `src/protocols/a2a` |
| A2A adapter | `src/protocols/a2a` |
| ACP checkout adapter (experimental) | `src/protocols/acp` |
| shared bearer check, body reader, URL join | `src/protocols/http.ts` |
| x402 provider + local/remote facilitator | `src/payments/x402` |
Expand Down
26 changes: 25 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,28 @@ keys:

Lengths count Unicode code points.

## `protocols.a2a`

Off by default. The optional `tasks` block limits retention for `GetTask`,
`ListTasks` and `CancelTask`; see [Tasks](protocols/a2a.md#tasks).

```yaml
protocols:
a2a:
enabled: true
mountPath: /a2a # default
tasks: # optional
retentionHours: 24 # default; 1 to 8760
maxRetained: 1000 # default; 1 to 1,000,000
```

- `retentionHours`: how long a task stays readable after it is stored or updated.
- `maxRetained`: the limit on unexpired task records when admitting a new
record. At capacity, the store evicts eligible uncharged responses to make
room, or refuses the new record if too few can be evicted. Existing IDs can
still be replaced. [A2A tasks](protocols/a2a.md#tasks) describes eligibility
and eviction order.

## `protocols.acp`

Experimental, off by default, and absent from a config that predates it. The
Expand Down Expand Up @@ -932,7 +954,9 @@ serves, including the A2A Agent Card and ACP discovery paths · a
`protocols.mcp.registry` value that breaks the field rules above · an ACP checkout
mapping that is incomplete, names a missing or non-`acp` resource, reuses one
resource for two operations, or maps a paid one · an ACP idempotency retention
below 24 hours · an invalid or zero `payTo`/`asset`/`recipient` · an
below 24 hours · a `protocols.a2a.tasks.retentionHours` that is not an integer
from 1 to 8760, or a `protocols.a2a.tasks.maxRetained` that is not an integer
from 1 to 1,000,000 · an invalid or zero `payTo`/`asset`/`recipient` · an
`x402.accepts` list that is empty or on a resource that cannot use it · a
`mimeType` that is not a media type, or on a resource that is not fixed-price
with `x402` in `payments` · an `idempotency` block on a resource that is not
Expand Down
Loading
Loading