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.

test(okx): answer the listing rejection's "cannot be parsed" note with OKX's own reader

nirholas6b757caeea0d
diff --git a/prompts/finish/_context/okx-ai-RUNBOOK.md b/prompts/finish/_context/okx-ai-RUNBOOK.md
index 62542e34a..a88e7f7dd 100644
--- a/prompts/finish/_context/okx-ai-RUNBOOK.md
+++ b/prompts/finish/_context/okx-ai-RUNBOOK.md
@@ -474,7 +474,14 @@ done # the quotation, as OKX's OWN validat
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.
+ said in the reviewer's internal note. Since 2026-09-09 it also reads every challenge back
+ with **OKX's own published reader**, `parsePaymentRequired()` from `@okxweb3/app-x402-core`
+ (already a dependency of this repo), on both the `PAYMENT-REQUIRED` header and the body, so
+ the note's verdict is answered by their parser rather than by our reading of the spec. All
+ 20 probes report `parsed` on both copies (capture:
+ `prompts/okx-ai/e2e-evidence/102-2026-09-09-okx-sdk-schema-read.json`). Note when extending
+ it: that function is a zod SAFE parse and never throws, so a `try`/`catch` around it passes
+ an empty object; the verdict has to read `result.success`.
- **`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
diff --git a/prompts/okx-ai/e2e-evidence/102-2026-09-09-okx-sdk-schema-read.json b/prompts/okx-ai/e2e-evidence/102-2026-09-09-okx-sdk-schema-read.json
new file mode 100644
index 000000000..59687d25e
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/102-2026-09-09-okx-sdk-schema-read.json
@@ -0,0 +1,710 @@
+{
+ "captured_at": "2026-09-09T19:50:52.561Z",
+ "base": "https://three.ws",
+ "what": "Live A2MCP compliance capture of the four paid OKX.AI forge rows: the bodyless self-check answers the quotation, every quotation names each rail once at the registered list price, and OKX's own SDK reader parses both the header and the body copy.",
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ },
+ {
+ "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,
+ "okx_sdk_reads_header": "parsed",
+ "okx_sdk_reads_body": "parsed"
+ }
+ ],
+ "note": "WO-07 closing audit: every 402 the four paid rows emit is read back with OKX's own published reader (@okxweb3/app-x402-core parsePaymentRequired), header copy and body copy, against the rejection remark's internal note that the quotation could not be parsed."
+}
diff --git a/scripts/okx-compliance-probe.mjs b/scripts/okx-compliance-probe.mjs
index d426d0463..53a904ac5 100644
--- a/scripts/okx-compliance-probe.mjs
+++ b/scripts/okx-compliance-probe.mjs
@@ -11,6 +11,13 @@
* scheme|network|asset), so the quotation is unambiguous.
* 3. Every stablecoin rail quotes the row's registered list price, whether or
* not the caller named a priced tool.
+ * 4. OKX's OWN published reader parses the quotation. The rejection's internal
+ * note said "x402 quotation cannot be parsed or is non-compliant", which is
+ * a verdict from their parser, not from ours, so the check that answers it
+ * is `parsePaymentRequired()` out of `@okxweb3/app-x402-core` (a declared
+ * dependency of this repo). Both copies are read: the PAYMENT-REQUIRED
+ * header, which is where the SDK's own resource server puts the challenge,
+ * and the response body.
*
* Usage:
* node scripts/okx-compliance-probe.mjs [--base https://three.ws] [--out <file>] [--note <text>]
@@ -20,6 +27,7 @@
*/
import { writeFileSync, mkdirSync } from 'node:fs';
import { dirname } from 'node:path';
+import { parsePaymentRequired } from '@okxweb3/app-x402-core/schemas';
const args = process.argv.slice(2);
const flag = (name, fallback) => {
@@ -68,12 +76,25 @@ async function probe(service, label, init) {
status: res.status,
payment_required_header: Boolean(res.headers.get('payment-required')),
};
+ // The header carries the authoritative copy on the OKX rail: their resource
+ // server answers with an empty body and the challenge in PAYMENT-REQUIRED,
+ // so a buyer's SDK reads the header. Decode it here and hand both copies to
+ // the schema check below.
+ const header = res.headers.get('payment-required');
+ let headerChallenge = null;
+ if (header) {
+ try {
+ headerChallenge = JSON.parse(Buffer.from(header, 'base64').toString('utf8'));
+ } catch (err) {
+ record.payment_required_header_decode_error = String(err?.message || err);
+ }
+ }
let parsed = null;
try {
parsed = JSON.parse(text);
} catch {
record.body = text.slice(0, 400);
- return { record, parsed };
+ return { record, parsed, headerChallenge };
}
if (Array.isArray(parsed?.accepts)) {
record.accepts = parsed.accepts.map((a) => ({
@@ -87,10 +108,28 @@ async function probe(service, label, init) {
} else {
record.body = text.slice(0, 400);
}
- return { record, parsed };
+ return { record, parsed, headerChallenge };
+}
+
+// Read a challenge with OKX's own SDK. A rejection here is the exact failure
+// their reviewer's internal note describes, so it is recorded per copy rather
+// than collapsed into one boolean.
+//
+// `parsePaymentRequired` is a zod SAFE parse: it returns `{ success, error }`
+// and never throws, so "it did not throw" is a false green that passes an empty
+// object. Read `success`, and report the failing field paths, which name the
+// part of the quotation their parser could not read.
+function sdkVerdict(challenge) {
+ if (!challenge) return 'absent';
+ const result = parsePaymentRequired(challenge);
+ if (result?.success === true) return 'parsed';
+ const issues = (result?.error?.issues || [])
+ .map((i) => `${(i.path || []).join('.') || '<root>'}: ${i.message}`)
+ .join('; ');
+ return `rejected: ${issues.slice(0, 300) || 'schema rejected the challenge'}`;
}
-function check(record, parsed, listPrice, failures) {
+function check(record, parsed, headerChallenge, listPrice, failures) {
const where = `${record.service} / ${record.probe}`;
if (record.status !== 402) {
failures.push(`${where}: expected HTTP 402, got ${record.status}`);
@@ -120,6 +159,14 @@ function check(record, parsed, listPrice, failures) {
failures.push(`${where}: ${assetLabel(a)} quoted ${amount}, expected the list price ${listPrice}`);
}
}
+ record.okx_sdk_reads_header = sdkVerdict(headerChallenge);
+ record.okx_sdk_reads_body = sdkVerdict(parsed);
+ if (record.okx_sdk_reads_header !== 'parsed') {
+ failures.push(`${where}: OKX's own SDK could not read the PAYMENT-REQUIRED header (${record.okx_sdk_reads_header})`);
+ }
+ if (record.okx_sdk_reads_body !== 'parsed') {
+ failures.push(`${where}: OKX's own SDK could not read the challenge body (${record.okx_sdk_reads_body})`);
+ }
}
const probes = [];
@@ -157,8 +204,8 @@ for (const [service, listPrice] of PAID_ROWS) {
],
];
for (const [label, init] of shapes) {
- const { record, parsed } = await probe(service, label, init);
- check(record, parsed, listPrice, failures);
+ const { record, parsed, headerChallenge } = await probe(service, label, init);
+ check(record, parsed, headerChallenge, listPrice, failures);
probes.push(record);
}
}
@@ -166,7 +213,7 @@ for (const [service, listPrice] of PAID_ROWS) {
const report = {
captured_at: new Date().toISOString(),
base: BASE,
- 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.',
+ what: "Live A2MCP compliance capture of the four paid OKX.AI forge rows: the bodyless self-check answers the quotation, every quotation names each rail once at the registered list price, and OKX's own SDK reader parses both the header and the body copy.",
pass: failures.length === 0,
failures,
probes,