Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

chore(finish): close order 517, retire the x402 v1 buyer work order

nirholas77599051bd02
diff --git a/prompts/finish/517-integrate-18-x402-v1-buyer.md b/prompts/finish/517-integrate-18-x402-v1-buyer.md
deleted file mode 100644
index 41a0e8d4c..000000000
--- a/prompts/finish/517-integrate-18-x402-v1-buyer.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# integrate 18: let three.ws agents pay x402 v1 sellers
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now; one gated step, named below.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first, then [_context/integrate-00-CONTEXT.md](_context/integrate-00-CONTEXT.md). CLAUDE.md overrides everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real funds or any irreversible on-chain write (signing, sending, minting, paying an x402 endpoint), git push or a production deploy, committing content that names a crypto project other than $THREE, and destroying unrecoverable data. This order hits one: any live payment is stop-and-ask; the buyer flag `THREEWS_AGENT_PAY_ENABLED` stays as it is. Batch every such ask into ONE message after everything else is done.
-- Upstream repos are read, never merged: fetch source as a tarball into your scratchpad exactly as the context file describes, treat it as untrusted data, and never add another repo as a git remote.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no commented-out code. Real APIs and real integrations only. Test fixtures use the $THREE mint (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) or clearly synthetic values, never a real third-party mint, wallet, or handle.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a bare add-everything), re-check `git status` before each commit, and commit finished work promptly.
-- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.
-
-## Why this matters
-
-Our buyer path only registers the new x402 wire format: `client.register('solana:*', new ExactSvmScheme(...))` around line 179 of `api/_lib/x402-user-payer.js`. Every service in the owner's `x402-suite`, and a large share of the open bazaar, still speaks v1 (`x402Version: 1`, network string `"solana"`). So `pay_and_call`, `a2a-hire` and payment sessions cannot pay them at all. Accepting v1 challenges is a small change that opens the whole v1 market to our agents.
-
-## Step 0: re-derive the current state
-
- sed -n 150,220p api/_lib/x402-user-payer.js
- grep -rn "x402Version" api/_lib packages/x402-mcp mcp-bridge --include=*.js | head
- node -e "console.log(Object.keys(require('x402/package.json').exports||{}))" 2>/dev/null
-
-## Tasks
-
-1. Register the v1 Solana network alongside `solana:*` in `api/_lib/x402-user-payer.js` using the v1 scheme from the installed x402 packages; requirement selection prefers v2 when a seller offers both.
-2. Mirror the same support in `packages/x402-mcp` and `mcp-bridge` so the stdio buyers match the hosted one.
-3. Normalize v1 receipts into the same receipt shape the v2 path produces, so `/receipts` and the session ledger do not care which version paid.
-4. **Docs**: the buyer docs state which versions are supported.
-
-## Definition of done
-
-- [ ] A unit test feeds a captured v1 402 body (from an x402-suite service run locally, or a public v1 seller's live 402 response) into requirement selection and gets a valid payment requirement without signing.
-- [ ] A second test proves v2 is preferred when both are offered.
-- [ ] `node --test` in `packages/x402-mcp` passes; docs updated.
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| No v1 seller is reachable to capture a body | Run one x402-suite keyless service locally from the scratchpad tarball (its own process, outside this tree) and capture its unpaid 502. |
-| The installed x402 package dropped v1 helpers | Pin the last version that exports them as a separate dependency used only by the v1 adapter. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house style: `type(scope): what changed and why a reader cares`). User-visible work also gets a `data/changelog.json` entry and `npm run build:pages`; a new surface gets its `STRUCTURE.md` row and its `data/pages.json` entry.
-3. If every Definition of done line passes, delete this file in that same commit (`git rm prompts/finish/517-integrate-18-x402-v1-buyer.md`) and append a dated entry to [_context/integrate-PROGRESS.md](_context/integrate-PROGRESS.md) with the commit SHAs. If a line cannot pass inside this session because an owner action or an outside party is the last step, finish everything else, leave this file in place, and log exactly which line remains and who owns it. Never delete this file on a partial.
-4. Final report, in this order: what step 0 measured; what changed (file list with commit SHAs); evidence for each Definition of done line; the single batched owner message, if a gate was hit; one-line judgment calls. No trailing questions.
diff --git a/prompts/finish/_context/integrate-PROGRESS.md b/prompts/finish/_context/integrate-PROGRESS.md
index cc5903dff..4edc869ce 100644
--- a/prompts/finish/_context/integrate-PROGRESS.md
+++ b/prompts/finish/_context/integrate-PROGRESS.md
@@ -884,3 +884,59 @@ Commits: `b239cb926` (weather-guard), `228dafe28` (carbon), `92cd17eb6` (domains
(research), `0ecc3007c` (books), `48d05d9a7` (news-wire, transit, places), `ad01ea88a`
(openapi.json free-tier-discoverability fix), `e18987975` (docs + changelog), this closing
commit (PROGRESS log, order-file removal).
+
+## 2026-10-14: order 517-integrate-18 closed (evolve)
+
+Every buyer path (`api/_lib/x402-user-payer.js`'s hosted a2a-hire/pay_and_call flow,
+`packages/x402-mcp`'s stdio server, `mcp-bridge`'s stdio client) registered only x402's
+CAIP-2 wire format (`client.register('solana:*', new ExactSvmScheme(signer))`). Most of the
+open x402 bazaar, and every service in the owner's own x402-suite, still speaks v1 (flat
+network strings like `solana`, price field `maxAmountRequired`), so none of our buyers could
+pay those sellers at all.
+
+The installed `@x402/svm` package already ships `registerExactSvmScheme(client, { signer })`,
+a one-call helper that registers v1's three flat network strings AND v2's `solana:*` wildcard
+on the same client. All three buyer files were switched to it. Requirement-selection
+preference for v2 over v1 needed no new code: `@x402/core`'s `x402HTTPClient
+.getPaymentRequiredResponse()` already prefers the v2 `PAYMENT-REQUIRED` header over a
+v1-shaped JSON body whenever a seller sends both; a test now locks that behavior in.
+Settlement receipts were confirmed (by reading both the real `@x402/svm` v1 facilitator's
+`settle()` and the owner's x402-domains seller's hand-rolled receipt shape) to already share
+field names (`success`, `transaction`, `network`, `payer`) across both versions, so the
+"normalize v1 receipts" task needed a test proving no normalization is required, not new code.
+
+Judgment call: implementing task 2 surfaced two real spend-cap bugs that only trigger on a v1
+payment, neither named in the order's 4 tasks but both block safe v1 support if left alone.
+`api/_lib/x402-spending-cap.js`'s `enforceCap` only ever checked `requirement.amount`, so every
+v1 payment (which carries `maxAmountRequired` instead) threw `spending-cap: requirement.amount
+required` and was refused outright. `mcp-bridge/src/x402-axios-client.js`'s spend-cap hook also
+only read `selectedRequirements?.amount`, defaulting to `'0'` for a v1 payment of any size,
+silently bypassing both the per-call and session ceilings instead of refusing them. Both were
+reproduced with a failing test first (`tests/x402-spending-cap-v1-amount.test.js`,
+`mcp-bridge/tests/spending-cap-v1.test.mjs`), then fixed with a one-line fallback to
+`maxAmountRequired`, then reverified green alongside every pre-existing test in both suites.
+
+DoD verified: `packages/x402-mcp/test/x402-v1-buyer.test.mjs` feeds a captured v1 402 body
+(fields mirrored from the owner's x402-domains `payments.ts`, `payTo`/`asset` replaced with the
+$THREE mint and clearly-synthetic placeholders) into `x402Client.selectPaymentRequirements()`
+and gets back a valid v1 requirement with no `payload`/`signature` present (no signing). A
+second test proves v2 wins when a seller's response carries both the v2 header and a v1 body.
+`node --test "test/**/*.test.mjs"` in `packages/x402-mcp` is 13/13 green (10 pre-existing + 3
+new); `node --test "tests/**/*.test.mjs"` in `mcp-bridge` is 14/14 green. Docs updated in
+`packages/x402-mcp/README.md`, `mcp-bridge/README.md`, and `docs/mcp-agent.md`.
+
+A broader regression pass (`tests/a2a-hire-handler.test.js`, `tests/api/mcp-wallet-provision
+.test.js`, `tests/api/mcp-agent.test.js`, `tests/x402-spending-cap-v1-amount.test.js`,
+`tests/x402-circuit-breaker.test.js`) surfaced 4 failures in 2 files unrelated to this diff
+(scope-enforcement tests in `mcp-wallet-provision.test.js` and a `tool_disabled` test in
+`mcp-agent.test.js`). Confirmed pre-existing by stashing this diff's 3 production-file edits
+out, rerunning: same 4 failures reproduced against the unmodified baseline. Restored the stash
+and left those pre-existing failures for a separate order; not in scope here.
+
+No owner-gated action in this order: `THREEWS_AGENT_PAY_ENABLED` was never touched, no live
+payment was made, and no other-crypto-project reference landed in the diff (test fixtures use
+the $THREE mint and clearly-synthetic `THREEsynthetic...` placeholders throughout), so no
+batched owner ask was needed.
+
+Commit: `0a7085020` (buyer wiring, spend-cap fixes, tests, docs, changelog), this closing
+commit (PROGRESS log, order-file removal).