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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(okx): prove the listing's payment leg accepts a delegated OKX wallet, live in prod
nirholasfe67539227f6
diff --git a/prompts/finish/okx-ai-PROGRESS.md b/prompts/finish/okx-ai-PROGRESS.mdindex dfb61598d..92fbdb997 100644--- a/prompts/finish/okx-ai-PROGRESS.md+++ b/prompts/finish/okx-ai-PROGRESS.md@@ -6,6 +6,68 @@ Work Order 04 session, no earlier entries existed because no earlier work order---+## 2026-09-05, both fixes are LIVE in production and both were proven on the wire; only the resubmission is left++The deploy the previous session staged went out with the morning release (production reads+commit `0f75c2cf1`, revision `three-ws-api-00414-lr5`, built 03:44 UTC, and `a49056707` is an+ancestor of it). Everything that was "fixed in main and in no production" yesterday is now+serving. Both legs were then measured against the live site, not read in the diff.++### Leg 1: the quotation. PASS 20 probes++`node scripts/okx-compliance-probe.mjs` against `https://three.ws` is green on all four paid+rows and all five request shapes, where the same run before the deploy reported 36 failing+checks. Capture: `prompts/okx-ai/e2e-evidence/82-2026-09-05-post-deploy-compliance-probe.json`.+The guide's bodyless self-check now answers 402 with a `PAYMENT-REQUIRED` header instead of+415, and no rail is quoted twice.++### Leg 2: the payment. A real signed authorization is now accepted++The compliance probe stops at the quotation, so the EIP-7702 fix needed its own proof and now+has a rerunnable one: **`node scripts/okx-payment-leg-probe.mjs`** (new). It pulls the live+challenge, signs it through the `onchainos` TEE wallet, replays it with `PAYMENT-SIGNATURE`,+and requires the answer to be `insufficient_balance`, which the verifier throws only after+the signature, recipient, amount, validity window and unredeemed nonce have all passed.++`PASS 4 paid rows accepted a signed authorization against https://three.ws`, captured in+`prompts/okx-ai/e2e-evidence/83-2026-09-05-payment-leg-replay.json`. The same replay against+production yesterday would have answered `EIP-3009 signature does not verify for+authorization.from`, which is the exact refusal OKX's QA collected on 2026-08-27. The buyer+signing here is `0x75d0...cf69`, a delegated EOA carrying `0xef0100...` code, so the delegated+shape is genuinely exercised and not simulated. It holds 0 USD₮0, so nothing settled and no+nonce was redeemed; the script refuses to sign at all if the buyer is ever funded, unless+`--allow-spend` says the purchase is intended.++Both probes are now the mandatory pre-resubmission gate in the RUNBOOK (new section 5.5).++### The listing state, read live++`agent get-my-agents` still reads `approvalDisplayStatus: 5`, `status: 2`. The rejection text+has now landed in `approvalRemark` as well as the email, worded per row, and it repeats the+"free or small payment test" note about the audit address+`0xbc59eb75C55e3bF1E63aaeE653C2b8E02BFd2033`. Nothing here intercepts that address, and the+amount branch was never what refused it: an authorization under the list price dies at the+amount check with a different error and no RPC, while the 2026-08-27 wire capture shows 0.4 s+to 0.7 s of chain work before the refusal. Their test paid the full price and we rejected the+signature. That is fixed.++`agent service-list --agent-id 2632` confirms all seven rows survive unchanged: the four paid+rows still carry `A2MCP`, `chainIndex 196`, the USD₮0 contract, their registered fees+(0.01 / 0.05 / 0.25 / 0.25 USDT) and their live endpoints. So the resubmission is still the+bare activate, not a service delta.++### The only remaining step, owner-gated++```bash+onchainos agent activate --agent-id 2632 --preferred-language en-US+```++An on-chain write, so it waits for the owner's explicit yes. Nothing else is outstanding: the+code is live, both probes are green, the evidence is committed, and the wallet session is+authenticated (`onchainos wallet status` reads `loggedIn: true`, `[email protected]`).++---+## 2026-09-04, the chat host is deployable: the AI credential is no longer a missing secretThe chat bot (agent #2632) is back online from the codespace stopgap, its Cloud Run deploydiff --git a/prompts/finish/okx-ai-RUNBOOK.md b/prompts/finish/okx-ai-RUNBOOK.mdindex 33137d1fe..732fc62c3 100644--- a/prompts/finish/okx-ai-RUNBOOK.md+++ b/prompts/finish/okx-ai-RUNBOOK.md@@ -375,6 +375,45 @@ This is the holder-visible moment. Work the list top to bottom.---+## 5.5 The pre-resubmission gate: two probes, both must pass++Never resubmit on a code review alone. Both of these run against live production, take about+a minute together, and each one covers a leg the other cannot see. Every rejection since+2026-07-04 would have been caught by one of them.++```bash+node scripts/okx-compliance-probe.mjs # the 402 quotation, as the reviewer parses it+node scripts/okx-payment-leg-probe.mjs # the signed replay, as the reviewer pays it+```++- **`okx-compliance-probe.mjs`** walks all four paid rows through five request shapes,+ including the A2MCP guide's own bodyless `curl -i -X POST` self-check, and fails unless+ every one answers 402 with a `PAYMENT-REQUIRED` header that names each rail exactly once at+ the row's registered list price. It exists because a duplicated `eip155:196` accept at two+ prices reads to a validator as "quotation cannot be parsed", which is what rejection #3+ said in the reviewer's internal note.+- **`okx-payment-leg-probe.mjs`** fetches the challenge, signs it through the `onchainos` TEE+ wallet (so the buyer is a real EIP-7702 delegated OKX agentic wallet, the same shape as the+ audit address), replays it, and requires the answer to be `insufficient_balance` and+ nothing else. That error is thrown after the signature, recipient, amount, validity window+ and nonce have all been accepted, so it is the proof that a *funded* buyer settles. Our+ buyer holds no USD₮0, so the run spends nothing; if it is ever funded the script refuses to+ sign without `--allow-spend`, because then a pass would be a real purchase.++Both take `--base` (point them at a staged worktree's server before a deploy) and `--out`+(write the capture into `prompts/okx-ai/e2e-evidence/`). Commit the captures: they are the+evidence trail for the next review.++With both green and the seven rows still matching `api/_lib/okx-catalog.js` (§2), the+resubmission is one command, and it is an on-chain write, so the owner confirms it first:++```bash+onchainos agent activate --agent-id 2632 --preferred-language en-US+```++Do not run the WO-08 service delta when the rows already match: it deletes and recreates+correct rows and loses their service ids.+## 6. First-sale operations| What | How |diff --git a/prompts/okx-ai/e2e-evidence/82-2026-09-05-post-deploy-compliance-probe.json b/prompts/okx-ai/e2e-evidence/82-2026-09-05-post-deploy-compliance-probe.jsonnew file mode 100644index 000000000..fa457e280--- /dev/null+++ b/prompts/okx-ai/e2e-evidence/82-2026-09-05-post-deploy-compliance-probe.json@@ -0,0 +1,669 @@+{+ "captured_at": "2026-09-05T15:21:59.972Z",+ "base": "https://three.ws",+ "what": "Live A2MCP compliance capture of the four paid OKX.AI forge rows: the bodyless self-check answers the quotation, and every quotation names each rail once at the registered list price.",+ "pass": true,+ "failures": [],+ "probes": [+ {+ "service": "forge-draft",+ "probe": "GET, the SSE transport a streaming MCP client opens with",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "10000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-draft",+ "probe": "docs self-check: POST, no body, no content-type",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "10000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-draft",+ "probe": "POST {} with content-type application/json",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "10000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-draft",+ "probe": "POST a plain business payload, naming no tool",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "10000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-draft",+ "probe": "well-formed tools/call forge_3d (control)",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "10000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "10000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-standard",+ "probe": "GET, the SSE transport a streaming MCP client opens with",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "50000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-standard",+ "probe": "docs self-check: POST, no body, no content-type",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "50000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-standard",+ "probe": "POST {} with content-type application/json",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "50000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-standard",+ "probe": "POST a plain business payload, naming no tool",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "50000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-standard",+ "probe": "well-formed tools/call forge_3d (control)",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "50000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "50000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-hd",+ "probe": "GET, the SSE transport a streaming MCP client opens with",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-hd",+ "probe": "docs self-check: POST, no body, no content-type",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-hd",+ "probe": "POST {} with content-type application/json",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-hd",+ "probe": "POST a plain business payload, naming no tool",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-hd",+ "probe": "well-formed tools/call forge_3d (control)",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-image",+ "probe": "GET, the SSE transport a streaming MCP client opens with",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-image",+ "probe": "docs self-check: POST, no body, no content-type",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-image",+ "probe": "POST {} with content-type application/json",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-image",+ "probe": "POST a plain business payload, naming no tool",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ },+ {+ "service": "forge-image",+ "probe": "well-formed tools/call forge_3d (control)",+ "status": 402,+ "payment_required_header": true,+ "accepts": [+ {+ "scheme": "exact",+ "network": "eip155:196",+ "asset": "USD₮0 (X Layer settlement stablecoin)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "USDC (Solana)",+ "amount": "250000"+ },+ {+ "scheme": "exact",+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",+ "asset": "$THREE",+ "amount": "10000000"+ },+ {+ "scheme": "exact",+ "network": "eip155:8453",+ "asset": "USDC (Base)",+ "amount": "250000"+ }+ ],+ "duplicate_rails": false+ }+ ]+}diff --git a/prompts/okx-ai/e2e-evidence/83-2026-09-05-payment-leg-replay.json b/prompts/okx-ai/e2e-evidence/83-2026-09-05-payment-leg-replay.jsonnew file mode 100644index 000000000..06f97bbd0--- /dev/null+++ b/prompts/okx-ai/e2e-evidence/83-2026-09-05-payment-leg-replay.json@@ -0,0 +1,135 @@+{+ "captured_at": "2026-09-05T15:25:43.978Z",+ "base": "https://three.ws",+ "what": "Live replay of a TEE-signed EIP-3009 authorization against every paid OKX.AI forge row, proving the payment leg accepts an EIP-7702 delegated payer and refuses only for the empty test wallet.",+ "buyer": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "buyer_usdt0_atomics": "0",+ "pass": true,+ "failures": [],+ "rows": [+ {+ "service": "forge-draft",+ "endpoint": "https://three.ws/api/okx/3d/forge-draft",+ "list_price_atomics": "10000",+ "buyer": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "buyer_usdt0_atomics": "0",+ "challenge": {+ "status": 402,+ "has_header": true+ },+ "xlayer_accept": {+ "index": 0,+ "amount": "10000",+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736"+ },+ "authorization": {+ "from": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "nonce": "0xcea52a4367e1ff64552d8440ed64bf2e247a0c58c521f87d51cebec406a75749",+ "to": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "validAfter": "0",+ "validBefore": "1788708337",+ "value": "10000"+ },+ "replay": {+ "status": 402,+ "error": "insufficient_balance"+ },+ "verdict": "authorization accepted, stopped only at the empty payer",+ "nonce_redeemed_on_chain": false+ },+ {+ "service": "forge-standard",+ "endpoint": "https://three.ws/api/okx/3d/forge-standard",+ "list_price_atomics": "50000",+ "buyer": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "buyer_usdt0_atomics": "0",+ "challenge": {+ "status": 402,+ "has_header": true+ },+ "xlayer_accept": {+ "index": 0,+ "amount": "50000",+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736"+ },+ "authorization": {+ "from": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "nonce": "0x875d6a6989fd0865bee30f112c7685f19f74dc86a1e9d79ff2cf18cbbefd46e7",+ "to": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "validAfter": "0",+ "validBefore": "1788708339",+ "value": "50000"+ },+ "replay": {+ "status": 402,+ "error": "insufficient_balance"+ },+ "verdict": "authorization accepted, stopped only at the empty payer",+ "nonce_redeemed_on_chain": false+ },+ {+ "service": "forge-hd",+ "endpoint": "https://three.ws/api/okx/3d/forge-hd",+ "list_price_atomics": "250000",+ "buyer": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "buyer_usdt0_atomics": "0",+ "challenge": {+ "status": 402,+ "has_header": true+ },+ "xlayer_accept": {+ "index": 0,+ "amount": "250000",+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736"+ },+ "authorization": {+ "from": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "nonce": "0xee85e496cd2986988751787372d2d4e093008954e77b3f131bdb7d354952e757",+ "to": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "validAfter": "0",+ "validBefore": "1788708340",+ "value": "250000"+ },+ "replay": {+ "status": 402,+ "error": "insufficient_balance"+ },+ "verdict": "authorization accepted, stopped only at the empty payer",+ "nonce_redeemed_on_chain": false+ },+ {+ "service": "forge-image",+ "endpoint": "https://three.ws/api/okx/3d/forge-image",+ "list_price_atomics": "250000",+ "buyer": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "buyer_usdt0_atomics": "0",+ "challenge": {+ "status": 402,+ "has_header": true+ },+ "xlayer_accept": {+ "index": 0,+ "amount": "250000",+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736"+ },+ "authorization": {+ "from": "0x75d00a2713565171f33216e5aa2a375e076ecf69",+ "nonce": "0x61defa051fce8f016b0f07d733fb81f7a58c2e3fcf8a1b5ee1453fbd2f89d7b3",+ "to": "0x4022de2D36C334E73C7a108805Cea11C0564f402",+ "validAfter": "0",+ "validBefore": "1788708342",+ "value": "250000"+ },+ "replay": {+ "status": 402,+ "error": "insufficient_balance"+ },+ "verdict": "authorization accepted, stopped only at the empty payer",+ "nonce_redeemed_on_chain": false+ }+ ]+}diff --git a/scripts/okx-payment-leg-probe.mjs b/scripts/okx-payment-leg-probe.mjsnew file mode 100644index 000000000..496658f53--- /dev/null+++ b/scripts/okx-payment-leg-probe.mjs@@ -0,0 +1,239 @@+#!/usr/bin/env node+/**+ * Replay a real, TEE-signed x402 authorization against the four paid OKX.AI+ * forge rows and prove the payment leg accepts it.+ *+ * This is the half of the listing review that the compliance probe cannot see.+ * `okx-compliance-probe.mjs` proves the 402 quotation is well formed; this one+ * proves what happens after a buyer signs it. OKX's 2026-08-27 listing QA got+ * that far and was refused: every OKX agentic wallet is an EIP-7702 delegated+ * EOA, our verifier asked viem's `verifyTypedData`, viem took its ERC-1271+ * branch, and a perfectly good authorization was answered with a second 402.+ *+ * The buyer here is our own agentic wallet, which holds no USD₮0, so the run+ * settles nothing. That is the point: with an empty payer, the ONLY refusal a+ * correct rail may answer is `insufficient_balance`, which is thrown after the+ * signature, recipient, amount, validity window and nonce have all passed. Any+ * other refusal is the defect coming back. If the buyer is ever funded, a pass+ * becomes an actual settlement, so the run refuses to sign without+ * `--allow-spend`.+ *+ * Usage:+ * node scripts/okx-payment-leg-probe.mjs [--base https://three.ws] [--out <file>]+ * node scripts/okx-payment-leg-probe.mjs --rows forge-draft+ * node scripts/okx-payment-leg-probe.mjs --allow-spend # buyer is funded: this BUYS+ *+ * Requires a live `onchainos` wallet session (`onchainos wallet status`).+ */+import { execFileSync } from 'node:child_process';+import { writeFileSync, mkdirSync } from 'node:fs';+import { dirname } from 'node:path';+import { catalogEntry, FORGE_TOOL } from '../api/_lib/okx-catalog.js';++const args = process.argv.slice(2);+const flag = (name, fallback) => {+ const i = args.indexOf(name);+ return i === -1 ? fallback : args[i + 1];+};+const has = (name) => args.includes(name);++const BASE = (flag('--base', 'https://three.ws') || '').replace(/\/+$/, '');+const OUT = flag('--out', '');+const ALLOW_SPEND = has('--allow-spend');+const ROWS = (flag('--rows', 'forge-draft,forge-standard,forge-hd,forge-image') || '').split(',').map((s) => s.trim()).filter(Boolean);++const CLI = `${process.env.HOME}/.local/bin/onchainos`;+const XLAYER_RPCS = ['https://rpc.xlayer.tech', 'https://xlayerrpc.okx.com'];+const USDT0 = '0x779ded0c9e1022225f8e0630b35a9b54be713736';+const XLAYER = 'eip155:196';+const EIP3009_AUTH_STATE = '0xe94a0102';+const ERC20_BALANCE_OF = '0x70a08231';+const pad32 = (v) => String(v).toLowerCase().replace(/^0x/, '').padStart(64, '0');++/** The refusal a correct rail owes an empty payer, and nothing else. */+const EMPTY_PAYER_ERROR = 'insufficient_balance';++async function rpc(method, params) {+ let lastErr;+ for (const url of XLAYER_RPCS) {+ try {+ const res = await fetch(url, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),+ signal: AbortSignal.timeout(30_000),+ });+ const body = await res.json();+ if (body.error) throw new Error(body.error.message || 'rpc error');+ return body.result;+ } catch (err) {+ lastErr = err;+ }+ }+ throw lastErr;+}++const cli = (argv, timeout = 200_000) =>+ JSON.parse(execFileSync(CLI, argv, { encoding: 'utf8', maxBuffer: 1 << 24, timeout }));++const decodeB64Json = (v) => JSON.parse(Buffer.from(v, 'base64').toString('utf8'));++/** The buyer's own EVM address, read from the wallet rather than assumed. */+function buyerAddress() {+ const out = cli(['wallet', 'addresses'], 90_000);+ const evm = (out.data ?? out).evm;+ const entry = Array.isArray(evm) ? evm.find((e) => e.address) : null;+ if (!entry) throw new Error('wallet addresses returned no EVM address; is the session live?');+ return entry.address;+}++async function buyerFloat(address) {+ const out = await rpc('eth_call', [{ to: USDT0, data: ERC20_BALANCE_OF + pad32(address) }, 'latest']);+ return BigInt(out);+}++async function nonceRedeemed(from, nonce) {+ const out = await rpc('eth_call', [{ to: USDT0, data: EIP3009_AUTH_STATE + pad32(from) + pad32(nonce) }, 'latest']);+ return BigInt(out) !== 0n;+}++function pricedCall(prompt) {+ return {+ jsonrpc: '2.0',+ id: 1,+ method: 'tools/call',+ params: { name: FORGE_TOOL, arguments: { prompt } },+ };+}++const MCP_HEADERS = {+ 'content-type': 'application/json',+ accept: 'application/json, text/event-stream',+ 'mcp-protocol-version': '2025-06-18',+};++async function callRow(endpoint, body, paymentHeader) {+ const res = await fetch(endpoint, {+ method: 'POST',+ headers: { ...MCP_HEADERS, ...(paymentHeader ? { 'PAYMENT-SIGNATURE': paymentHeader } : {}) },+ body: JSON.stringify(body),+ signal: AbortSignal.timeout(180_000),+ });+ const text = await res.text();+ let parsed = null;+ try {+ parsed = JSON.parse(text);+ } catch {+ /* a non-JSON body is reported raw */+ }+ return {+ status: res.status,+ challengeHeader: res.headers.get('payment-required'),+ receiptHeader: res.headers.get('payment-response') || res.headers.get('x-payment-response'),+ body: parsed,+ text,+ };+}++const failures = [];+const results = [];++const buyer = buyerAddress();+const float = await buyerFloat(buyer);++for (const id of ROWS) {+ const entry = catalogEntry(id);+ if (!entry) {+ failures.push(`${id}: not in the catalog`);+ continue;+ }+ const endpoint = entry.endpoint.replace(/^https?:\/\/[^/]+/, BASE);+ const listPrice = BigInt(entry.amountAtomics);+ const row = { service: id, endpoint, list_price_atomics: entry.amountAtomics, buyer, buyer_usdt0_atomics: float.toString() };++ const unpaid = await callRow(endpoint, pricedCall(`a probe subject for ${id}`));+ row.challenge = { status: unpaid.status, has_header: Boolean(unpaid.challengeHeader) };+ if (unpaid.status !== 402 || !unpaid.challengeHeader) {+ failures.push(`${id}: priced call answered ${unpaid.status} with${unpaid.challengeHeader ? '' : 'out'} a PAYMENT-REQUIRED header, expected a 402 quotation`);+ results.push(row);+ continue;+ }++ const challenge = decodeB64Json(unpaid.challengeHeader);+ const index = (challenge.accepts || []).findIndex((a) => a.network === XLAYER);+ if (index === -1) {+ failures.push(`${id}: the quotation carries no ${XLAYER} rail, so an OKX buyer has nothing to sign`);+ results.push(row);+ continue;+ }+ const accept = challenge.accepts[index];+ row.xlayer_accept = { index, amount: accept.amount, payTo: accept.payTo, asset: accept.asset };+ if (BigInt(accept.amount) !== listPrice) {+ failures.push(`${id}: X Layer rail quotes ${accept.amount}, the listing registers ${entry.amountAtomics}`);+ }++ if (float >= BigInt(accept.amount) && !ALLOW_SPEND) {+ failures.push(`${id}: buyer ${buyer} holds ${float} USD₮0 atomics, at or above the ${accept.amount} quote, so replaying would really buy. Re-run with --allow-spend to authorize the purchase.`);+ results.push(row);+ continue;+ }++ const signed = cli(['payment', 'pay', '--payload', unpaid.challengeHeader, '--selected-index', String(index)]);+ const header = (signed.data ?? signed).authorization_header;+ if (!header) {+ failures.push(`${id}: the wallet returned no authorization_header to replay`);+ results.push(row);+ continue;+ }+ const authorization = decodeB64Json(header).payload?.authorization ?? null;+ row.authorization = authorization;++ const paid = await callRow(endpoint, pricedCall(`a probe subject for ${id}`), header);+ const error = paid.body?.error ?? (paid.challengeHeader ? decodeB64Json(paid.challengeHeader).error : null);+ row.replay = { status: paid.status, error: typeof error === 'string' ? error : JSON.stringify(error ?? null) };++ if (paid.status === 200) {+ row.verdict = 'settled';+ if (!ALLOW_SPEND) failures.push(`${id}: the replay settled from a wallet that read empty, which should be impossible`);+ } else if (paid.status === 402 && row.replay.error === EMPTY_PAYER_ERROR) {+ // Everything above the balance check passed: signature, recipient,+ // amount, validity window and an unredeemed nonce. A funded buyer, such+ // as the OKX audit wallet, settles from here.+ row.verdict = 'authorization accepted, stopped only at the empty payer';+ } else {+ row.verdict = 'refused';+ failures.push(`${id}: replay answered ${paid.status} "${row.replay.error}", expected ${EMPTY_PAYER_ERROR} from an empty payer`);+ }++ if (authorization?.from && authorization?.nonce) {+ const redeemed = await nonceRedeemed(authorization.from, authorization.nonce);+ row.nonce_redeemed_on_chain = redeemed;+ if (redeemed && !ALLOW_SPEND) failures.push(`${id}: the authorization nonce was redeemed on-chain, so money moved`);+ }++ results.push(row);+}++const report = {+ captured_at: new Date().toISOString(),+ base: BASE,+ what: 'Live replay of a TEE-signed EIP-3009 authorization against every paid OKX.AI forge row, proving the payment leg accepts an EIP-7702 delegated payer and refuses only for the empty test wallet.',+ buyer,+ buyer_usdt0_atomics: float.toString(),+ pass: failures.length === 0,+ failures,+ rows: results,+};++const serialized = `${JSON.stringify(report, null, 2)}\n`;+if (OUT) {+ mkdirSync(dirname(OUT), { recursive: true });+ writeFileSync(OUT, serialized);+ console.log(`wrote ${OUT}`);+} else {+ process.stdout.write(serialized);+}++for (const f of failures) console.error(`FAIL ${f}`);+console.log(failures.length === 0 ? `PASS ${results.length} paid rows accepted a signed authorization against ${BASE}` : `${failures.length} failing check(s)`);+process.exit(failures.length === 0 ? 0 : 1);