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.

feat(okx): compare the listing OKX actually stores, which no check was reading

nirholasfa466f2336fc
diff --git a/prompts/finish/_context/okx-ai-PROGRESS.md b/prompts/finish/_context/okx-ai-PROGRESS.md
index 9e8cdf0dd..9485d1f5d 100644
--- a/prompts/finish/_context/okx-ai-PROGRESS.md
+++ b/prompts/finish/_context/okx-ai-PROGRESS.md
@@ -6,6 +6,127 @@ Work Order 04 session, no earlier entries existed because no earlier work order
---
+## 2026-09-09, WO-07 final audit: the listing OKX stores fails OKX's own description rule, and nothing was comparing that copy
+
+Third OKX session on this date; two peers were running WO-04 and WO-05 in this worktree at the
+same time and their entries are directly above. Their probes and mine were independent and
+agree on everything they both cover, so this entry records only what is new: the audit findings
+and the fixes.
+
+### Re-verified today against production, nothing trusted from this file
+
+| Claim re-checked | Verdict |
+| --- | --- |
+| `okx-compliance-probe.mjs` | PASS 20 probes (`90-2026-09-09-compliance-probe.json`) |
+| `okx-payment-leg-probe.mjs` | PASS, 4 paid rows accepted a signed authorization, buyer still empty so nothing spent |
+| `onchainos agent x402-check`, all four paid rows | `valid: true`, `eip155:196` / `exact` / USD₮0 / `payTo 0x4022de2D...f402`, amounts 10000 / 50000 / 250000 / 250000 |
+| Module catalog vs `GET /api/okx/3d/catalog` | byte-identical (`JSON.stringify` equality), `validateCatalog()` clean |
+| Free lane | `catalog` 200, `health` 200 with all six subsystems ok, `forge-status` GET 405, four paid rows 402 |
+| Live 402 vs `specs/okx-agent-payments.md` §1.1 | every required field matches, `Access-Control-Expose-Headers` present, error string names the v2 header first |
+| Verify-before-dispatch | a forged EIP-3009 signature is refused identically on two identical attempts (`402`, quotation re-issued, no job started); a $0.01 authorization replayed at the $0.25 row dies at the amount check |
+| Wallets, X Layer block 70163162 | buyer 0 USD₮0 / 0 OKB, seller 2.427731 / 0.839596 OKB, relayer 0 / 0.02 OKB, `payTo` had not drifted |
+| `agent get-my-agents` | `approvalDisplayStatus: 5`, "Listing rejected", `status: 2`, `soldCount: 2`, `approvalRemark` 4109 chars, byte-identical to rejection #3 |
+| `agent feedback-list --agent-id 2632` | works, `total: 0` reviews |
+| `npm run build:pages` / `npm run audit:docs` | green / clean (1589 files) |
+
+### The finding: the seven rows OKX stores are missing three of the four required description parts
+
+`onchainos agent update --help` states the contract in OKX's own words: an A2MCP
+`serviceDescription` is four newline-separated parts (what it does / parameter spec / request
+method / a working curl) and *"an A2MCP listing missing any is rejected at listing QA"*.
+
+The rows OKX stores carry TWO parts, the prose form submitted on 2026-08-27. The module began
+generating all four on 2026-09-02 (`6435b9c07`) and no `agent update` has gone out since. So for
+a week the listing has been in exactly the state rejection #2 (2026-07-26, "service description /
+parameters / usage examples") described, while three sessions reported it as drift-free,
+including the entry directly above this one, which concluded "no service delta is needed" from a
+comparison of names, endpoints, fees and `serviceType` only.
+
+Nothing was comparing the copy that matters. `scripts/okx-three-copy-check.mjs` compared the
+module, the live endpoint and the submission payload: three copies that all derive from the same
+module and therefore cannot disagree in production. The 2026-09-02 session checked the on-chain
+rows by hand, found them identical, and that hand check was never mechanised.
+
+**Fixed:** the script now reads a FOURTH copy, the rows OKX actually stores
+(`onchainos agent service-list`), and fails on drift in description, fee or endpoint, plus rows
+present on one side only. It is on by default, takes the agent id from the catalog module
+(`AGENT_ID` overrides), accepts a saved capture with `--listing <file>`, narrows to the local
+copies with `--no-onchain`, and prints `on-chain NOT COMPARED (<why>)` rather than passing
+silently when there is no wallet session. `npm run okx:three-copy` today reads
+`COPY CHECK: FAIL (7 divergences across all four copies)`. It is check 5 of the RUNBOOK's
+pre-resubmission gate.
+
+### What that changes about the resubmission
+
+It is no longer a bare `activate`. The delta goes out first, and both are on-chain writes that
+wait for the owner:
+
+```bash
+onchainos agent service-list --agent-id 2632 \
+ | node scripts/okx-listing-payload.mjs --delta > /tmp/okx-2632-delta.json
+onchainos agent update --agent-id 2632 --service "$(cat /tmp/okx-2632-delta.json)"
+onchainos agent activate --agent-id 2632 --preferred-language en-US
+```
+
+The delta is seven `update` operations, each carrying its existing service id (39975 to 39981),
+so no row is deleted and no id is lost. That is the concern the entry above raises about running
+a delta, and it does not apply to this one: it is an update-in-place, not the retired WO-05
+create/delete churn.
+
+### Second finding: the chat bot cannot answer a reviewer, and its documented fallback is dead too
+
+`/api/healthz` reads `okx_chat_bot: degraded`. The host is deployed and healthy in every other
+respect (Cloud Run `okx-chat-bot`, up 4.2 days, daemon supervised, wallet session live as
+`[email protected]`, chat delivered, `lastOnlineTime` seconds old), but the AI provider refuses its
+credential: Vertex answers `403 Lightning dunning decision is deny for project:
+projects/93741856042`, which is a project-wide billing hold, not IAM. No reply can be authored,
+which is the failure mode that got the listing flagged offline on 2026-07-26.
+
+The host's own remedy lists three ways out. Option 3 (pin `OKX_BOT_AI_PROVIDER=codex` on the
+existing `openai-api-key` secret) was tested rather than assumed: the key authenticates
+(`/v1/models` 200) but a real completion answers `429 billing_not_active`. Both providers are
+billing-blocked, so no config change on this machine can restore the bot. Owner action.
+
+### Third finding, outside this stream, recorded because it costs a buyer their money
+
+`forge_generation` reads `down`: 44 of 91 outcomes in six hours failed, all of them
+`trellis_selfhost` on the image path, none marked `superseded_by`, so the poll-time failover did
+not re-dispatch them. Root cause from the worker's own logs, not a guess: `model-trellis` dies in
+TRELLIS `postprocessing_utils._fill_holes` with `RuntimeError: Cuda error: 2` from
+`nvdiffrast.rasterize`, i.e. `cudaErrorMemoryAllocation` on the L4. Container concurrency is 80
+but the worker holds `MAX_CONCURRENT=1` and frees GPU memory per job, so this is not parallel
+inference; it needs GPU-side debugging and a worker redeploy, and it is not a config lever.
+A draft-tier job submitted during this session landed on `hunyuan3d` and delivered a real
+3,058,208-byte GLB, so the lane that an OKX buyer hits is serving today.
+
+### Not fixed here, deliberately
+
+- `STRUCTURE.md` line 81 still reads `Built · deploy owner-gated` for the chat bot host, which
+ has been a live Cloud Run service since 2026-09-05. Another session is mid-rewrite on that file
+ (staged and unstaged home-lane edits), so correcting one status word would either mix their
+ work into this commit or lose it. Whoever edits `STRUCTURE.md` next: change that status to Live.
+- `tests/audit-guards.test.js` fails on `gate steps missing from data/guards.json:
+ check:windows-widget`, from commit `727869703` eleven minutes before this session's sweep. The
+ registry entry needs a proof fixture only that guard's author can write. Not this stream's, and
+ it blocks nothing here. `tests/version-endpoint.test.js` also failed once in shard 2 on the
+ build-info snapshot, which a concurrent build in this worktree explains.
+
+### State of the stream at close
+
+Code and production: verified. Docs: the RUNBOOK's §1 reading, §2 drift correction, §5.5 fifth
+gate and §6 first-sale table are corrected and every command in §1, §5, §5.5, §6 and §7 was
+executed this session. Three owner actions remain, all single steps:
+
+1. **Approve the resubmission** (the two on-chain writes above). Wallet session is live, no OTP
+ pending.
+2. **Fund the buyer** `0x75d00a2713565171f33216e5aa2a375e076ecf69` with >=$3 USD₮0
+ (`0x779ded0c9e1022225f8e0630b35a9b54be713736`) on X Layer / 196 for the first real settlement.
+ No OKB needed; the relayer pays gas.
+3. **Clear the GCP billing hold** on project `aerial-vehicle-466722-p5` so the marketplace chat
+ bot can author replies before OKX's review chat-tests it.
+
+---
+
## 2026-09-09, WO-05 refused and deleted; the three pre-resubmission gates are green on today's production
Asked to execute `912-okx-ai-05-relisting-resubmission.md`. **It was not executed, and the file
diff --git a/prompts/finish/_context/okx-ai-RUNBOOK.md b/prompts/finish/_context/okx-ai-RUNBOOK.md
index 5ec769790..b586a6703 100644
--- a/prompts/finish/_context/okx-ai-RUNBOOK.md
+++ b/prompts/finish/_context/okx-ai-RUNBOOK.md
@@ -161,13 +161,18 @@ onchainos agent get-my-agents
> moved field. `get-my-agents` (own agents only, no `--agent-ids`) carries all four. Use it for
> every status read; keep `get-agents` for the card copy, description and profile photo.
-Verified output (2026-09-02, the fields that matter):
+Verified output (2026-09-09, the fields that matter):
```json
-{ "agentId": "2632", "approvalDisplayStatus": 2, "approvalLabel": "Listing under review",
+{ "agentId": "2632", "approvalDisplayStatus": 5, "approvalLabel": "Listing rejected",
"status": 2, "statusLabel": "not listed", "soldCount": 2, "role": 2, "roleLabel": "ASP" }
```
+That is rejection #3's verdict, unchanged since 2026-09-05: the 4109-character `approvalRemark`
+is byte-for-byte the one the 2026-09-04 session root-caused, and nothing has been resubmitted
+since, so no new review has run. A rejection email arriving now is a re-send of that verdict,
+not a new one.
+
### Reading the fields
| Field | Meaning |
@@ -214,15 +219,22 @@ Re-verified 2026-09-02, live listing against
endpoint matching.**
> **Correction, 2026-09-09: "no drift" was only ever checked on names and endpoints, and the
-> descriptions ARE stale.** Run the check with the agent id and it fails:
-> `AGENT_ID=2632 node scripts/okx-three-copy-check.mjs` reports
-> `COPY CHECK: FAIL (7 divergences)`, one per row. The on-chain rows carry prose parameter
-> text; the module's `listingDescription()` now emits a parameter spec line, a method line and
-> a runnable `curl` example. Rejection #2 (2026-07-26) was about "service description /
-> parameters / usage examples", so this is that exact class of defect. Without `AGENT_ID` the
-> same script reads `PASS`, because it then compares only module, live endpoint and listing
-> submission, which do agree: **always pass `AGENT_ID=2632` when the question is what a
-> reviewer sees.** Closing this is an on-chain write, owned by
+> descriptions ARE stale.** `npm run okx:three-copy` (or `node scripts/okx-three-copy-check.mjs`)
+> now reads a FOURTH copy, the rows OKX actually stores, and reports
+> `COPY CHECK: FAIL (7 divergences across all four copies)`, one per row. The on-chain rows
+> carry prose parameter text; the module's `listingDescription()` now emits a parameter spec
+> line, a method line and a runnable `curl` example. Rejection #2 (2026-07-26) was about
+> "service description / parameters / usage examples", and `onchainos agent update --help`
+> states the rule in OKX's own words: all four parts are required and *"an A2MCP listing
+> missing any is rejected at listing QA"*. So this is that exact class of defect, live on the
+> listing right now.
+>
+> The on-chain copy is compared by DEFAULT and needs a live `onchainos` wallet session; the
+> agent id comes from the catalog module (`AGENT_ID=<id>` overrides it). Without a session the
+> run prints `on-chain NOT COMPARED (<why>)` and judges only the three local copies, which do
+> agree, so **read the `on-chain` line before trusting a PASS**; `--no-onchain` asks for that
+> narrower run deliberately, and `--listing <file>` compares against a saved `service-list`
+> capture instead of the CLI. Closing this is an on-chain write, owned by
> [`okx-ai-08-forge-relisting.md`](../911-okx-ai-08-forge-relisting.md). Capture:
> `prompts/okx-ai/e2e-evidence/95-2026-09-09-three-copy-onchain.txt`.
@@ -247,7 +259,7 @@ The catalog module stays the source of truth. Nine further rows (Identity Studio
single-capability REST services) are deployed and payable but carry `listed: false`; they
show up under `unlisted` in `GET /api/okx/3d/catalog` and are deliberately not submitted.
Re-run the comparison above after any change to the module, and after any listing update,
-with `AGENT_ID=2632` set so the on-chain copy is actually in the comparison.
+with a live wallet session so the on-chain copy is actually in the comparison.
---
@@ -390,7 +402,7 @@ This is the holder-visible moment. Work the list top to bottom.
---
-## 5.5 The pre-resubmission gate: four checks, all must pass
+## 5.5 The pre-resubmission gate: five checks, all must pass
Never resubmit on a code review alone. These run against live production and each one covers a
leg the others cannot see. Every rejection since 2026-07-04 would have been caught by one of
@@ -454,6 +466,21 @@ A window with no `done` row is a NO-GO on its own, whatever the payment gates sa
delivery bucket is unwritable, so a buyer is no longer charged for this, but a row that
refuses every call is still not a listing worth submitting.
+**5. What OKX stores matches what we serve.** The four checks above all read our own endpoints.
+None of them reads the listing, so none of them can see a row whose stored description, price
+or endpoint no longer matches the module. That is what was wrong on 2026-09-09 (§2), and it is
+rejection #2's exact class of defect sitting on a listing three sessions had called drift-free.
+
+```bash
+npm run okx:three-copy # needs a wallet session for the on-chain copy
+```
+
+`COPY CHECK: PASS (module == live == listing submission == on-chain listing)` is the only
+passing form. A run whose `on-chain` line reads `NOT COMPARED` has judged three local copies
+that cannot disagree with each other in production and proves nothing about the listing; log
+in and run it again. On a FAIL, the delta in §2 is the fix and it goes out BEFORE the
+activate.
+
The two scripts 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.
@@ -466,7 +493,10 @@ 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.
+correct rows and loses their service ids. **They do not match today** (§2), so the resubmission
+is currently `agent update --service <delta>` and then `activate`; the delta from
+`okx-listing-payload.mjs --delta` is seven `update` operations that each carry the existing
+service id, so nothing is deleted and no id is lost.
## 6. First-sale operations
@@ -476,7 +506,9 @@ correct rows and loses their service ids.
| What did buyers say? | `onchainos agent feedback-list --agent-id 2632` ("Query Agent reviews"). `--agent-id` is runtime-enforced: omit it and the CLI answers `missing required parameter: --agent-id`. Optional `--page` / `--page-size`. |
| Where does revenue land? | The seller/payTo wallet on X Layer (196), **verify live**, it has moved before (see §3); as of 2026-07-23 it is `0x4022de2D36C334E73C7a108805Cea11C0564f402`, the platform's standard EVM merchant wallet, not the buyer wallet. Confirm the first payout against the settlement tx hash from WO-04. |
| Where do errors surface? | The existing error-reporting path in [`api/_mcp/payments.js`](../../api/_mcp/payments.js); paid-endpoint failures answer **before** settlement, so a failed job never charges a buyer. |
-| Daily watch | `soldCount`, `approvalLabel`, and the paid-endpoint health/catalog free routes (§7). |
+| Can a buyer talk to us? | Chat is a buyer's first contact and OKX tests it during review. `curl -s -H "Authorization: Bearer $(gcloud auth print-identity-token)" https://okx-chat-bot-lp642k3kpa-uc.a.run.app/readyz` reads the host directly (it is not public, so an unauthenticated curl answers 403 from Google, not from us), and `/api/healthz`'s `okx_chat_bot` subsystem carries the same verdict. `ready:true` is the only healthy form: on 2026-09-09 the daemon was running, the wallet session live and every message delivered, while `verdict:"unauthorized"` meant no reply could be authored at all. `.remedy` names the three ways out. |
+| Two sales already, no settlement | `soldCount` reads 2 and has since before any funded call, while nothing has ever moved into the seller wallet on our rail (swept 2026-08-03 to 2026-09-09). Never cite it as revenue; the first real sale is the first settlement tx hash. |
+| Daily watch | `soldCount`, `approvalLabel`, the `okx_chat_bot` verdict, and the paid-endpoint health/catalog free routes (§7). |
---
diff --git a/scripts/okx-three-copy-check.mjs b/scripts/okx-three-copy-check.mjs
index 1f8e84e9b..a9ca12887 100644
--- a/scripts/okx-three-copy-check.mjs
+++ b/scripts/okx-three-copy-check.mjs
@@ -1,41 +1,61 @@
#!/usr/bin/env node
/**
- * The three-copy rule for the OKX.AI listing, enforced mechanically.
+ * The copy rule for the OKX.AI listing, enforced mechanically.
*
- * Agent #2632's catalog exists in three places, and OKX rejects the listing if
+ * Agent #2632's catalog exists in four places, and OKX rejects the listing if
* they disagree:
* 1. the module: api/_lib/okx-catalog.js, the source of truth
* 2. the live: GET https://three.ws/api/okx/3d/catalog, what a buyer reads
* 3. the listing: scripts/okx-listing-payload.mjs, what gets submitted to OKX
+ * 4. the on-chain listing: what OKX actually stores for #2632 today, read with
+ * `onchainos agent service-list --agent-id 2632`
*
* Copies 1 and 2 diverge on every deploy that ships a catalog edit but does not
* reach production; copies 1 and 3 diverge whenever the payload generator is
- * edited by hand. Both have happened. A reviewer who reads a price on the
- * listing and gets a different 402 amount from the endpoint fails the listing,
- * so this runs before any resubmission and after any catalog deploy.
+ * edited by hand. Both have happened. Copy 4 diverges whenever the module's
+ * listing text changes and no `agent update` is submitted afterwards, which is
+ * the failure this check missed for a week: the four-part description format
+ * landed on 2026-09-02 and the seven rows OKX stores kept the two-part text,
+ * while two sessions reported the listing as drift-free because nothing
+ * compared that copy. A reviewer who reads a price or a parameter spec on the
+ * listing and gets something else from the endpoint fails the listing, so this
+ * runs before any resubmission and after any catalog deploy.
+ *
+ * Copy 4 needs a live `onchainos` wallet session. Without one it is reported as
+ * NOT COMPARED rather than silently passing, so the output can never imply a
+ * check that did not run.
*
* Usage:
* node scripts/okx-three-copy-check.mjs
* node scripts/okx-three-copy-check.mjs --base http://localhost:3000
* node scripts/okx-three-copy-check.mjs --json report.json
+ * node scripts/okx-three-copy-check.mjs --listing capture.json # saved service-list
+ * node scripts/okx-three-copy-check.mjs --no-onchain # copies 1-3 only
+ * AGENT_ID=2632 node scripts/okx-three-copy-check.mjs # a different agent
*
- * Exit 0 = all three copies agree. Exit 1 = drift (each divergence printed).
+ * Exit 0 = every compared copy agrees. Exit 1 = drift (each divergence printed).
* Exit 2 = the live endpoint could not be read.
*/
import { execFileSync } from 'node:child_process';
-import { writeFileSync } from 'node:fs';
+import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import { OKX_CATALOG, catalogIndex, listedCatalog, listingDescription, validateCatalog } from '../api/_lib/okx-catalog.js';
const REPO = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+// The agent whose listing copy 4 reads, taken from the catalog module so the
+// id cannot drift from the one the catalog publishes to buyers. AGENT_ID
+// overrides it for a second agent or a staging listing.
+const AGENT_ID = process.env.AGENT_ID || catalogIndex().okxAgentId;
function parseArgs(argv) {
- const args = { base: 'https://three.ws', json: null };
+ const args = { base: 'https://three.ws', json: null, listing: null, onchain: true };
for (let i = 0; i < argv.length; i++) {
if (argv[i] === '--base') args.base = argv[++i].replace(/\/$/, '');
else if (argv[i] === '--json') args.json = argv[++i];
+ else if (argv[i] === '--listing') args.listing = argv[++i];
+ else if (argv[i] === '--no-onchain') args.onchain = false;
}
return args;
}
@@ -127,18 +147,111 @@ for (const row of LISTED) {
}
for (const extra of byName.keys()) fail('listing', `submission has "${extra}" which is not in the module`);
+// Copy 4: the rows OKX stores for #2632 right now. Read from a saved capture
+// when one is given, otherwise from the CLI, which needs a wallet session.
+// `service-list` shape: { ok, data: { "0": { total, list: [...] } } }.
+function readOnChainListing() {
+ if (args.listing) {
+ return { rows: JSON.parse(readFileSync(args.listing, 'utf8')), source: args.listing };
+ }
+ const cli = `${process.env.HOME}/.local/bin/onchainos`;
+ if (!existsSync(cli)) return { skipped: `${cli} is not installed` };
+ const raw = execFileSync(cli, ['agent', 'service-list', '--agent-id', String(AGENT_ID)], {
+ encoding: 'utf8',
+ maxBuffer: 1 << 24,
+ timeout: 120_000,
+ });
+ return { rows: JSON.parse(raw), source: `onchainos agent service-list --agent-id ${AGENT_ID}` };
+}
+
+// Both the CLI envelope and a bare array of rows are accepted, because the
+// capture people save by hand is usually one or the other.
+function listingRows(parsed) {
+ if (Array.isArray(parsed)) return parsed;
+ const container = parsed?.data?.['0'] ?? parsed?.data?.[0] ?? parsed?.data ?? parsed;
+ const rows = container?.list ?? container?.rows ?? container?.services;
+ if (!Array.isArray(rows)) throw new Error(`no service array found (top-level keys: ${Object.keys(parsed || {}).join(', ')})`);
+ return rows;
+}
+
+let onChainCompared = false;
+let onChainSkipped = args.onchain ? null : 'disabled with --no-onchain';
+if (args.onchain) {
+ try {
+ const read = readOnChainListing();
+ if (read.skipped) {
+ onChainSkipped = read.skipped;
+ } else {
+ if (read.rows?.ok === false) throw new Error(read.rows.error || 'the CLI refused the read');
+ const live = listingRows(read.rows);
+ console.log(`on-chain ${live.length} rows from ${read.source}`);
+ onChainCompared = true;
+ const onChainByName = new Map(live.map((r) => [r.serviceName ?? r.name, r]));
+ for (const row of LISTED) {
+ const stored = onChainByName.get(row.name);
+ if (!stored) {
+ fail('on-chain', `the listing has no row named "${row.name}" (submit it with an \`agent update\` create)`);
+ continue;
+ }
+ onChainByName.delete(row.name);
+ const want = listingDescription(row);
+ if ((stored.serviceDescription ?? '') !== want) {
+ fail(
+ 'on-chain',
+ `"${row.name}" description is stale on the listing\n module: ${JSON.stringify(want)}\n listing: ${JSON.stringify(stored.serviceDescription ?? '')}`,
+ );
+ }
+ if (String(stored.fee ?? '') !== String(row.priceUsd)) {
+ fail('on-chain', `"${row.name}" fee ${stored.fee} on the listing vs module ${row.priceUsd}`);
+ }
+ if ((stored.endpoint ?? '') !== row.endpoint) {
+ fail('on-chain', `"${row.name}" endpoint ${stored.endpoint} on the listing vs module ${row.endpoint}`);
+ }
+ }
+ for (const extra of onChainByName.keys()) {
+ fail('on-chain', `the listing still sells "${extra}", which the module does not list (delete it in the next \`agent update\`)`);
+ }
+ }
+ } catch (err) {
+ // A logged-out session is the ordinary case, not a failure of the
+ // listing: say so plainly and keep the other three copies' verdict.
+ const message = String(err?.message || err);
+ onChainSkipped = /session expired|please login/i.test(message)
+ ? 'no onchainos wallet session (run: onchainos wallet login --phase init)'
+ : message.split('\n')[0];
+ }
+}
+if (!onChainCompared) console.log(`on-chain NOT COMPARED (${onChainSkipped})`);
+
if (args.json) {
writeFileSync(
args.json,
- JSON.stringify({ base: args.base, rows: OKX_CATALOG.length, listed: LISTED.length, drift, ok: drift.length === 0 }, null, 2),
+ JSON.stringify(
+ {
+ base: args.base,
+ rows: OKX_CATALOG.length,
+ listed: LISTED.length,
+ onChainCompared,
+ ...(onChainCompared ? {} : { onChainSkipped }),
+ drift,
+ ok: drift.length === 0,
+ },
+ null,
+ 2,
+ ),
);
}
+const agreed = onChainCompared
+ ? 'module == live == listing submission == on-chain listing'
+ : 'module == live == listing submission; on-chain listing NOT COMPARED';
+const scope = onChainCompared ? 'all four copies' : 'copies 1-3 only, on-chain listing NOT COMPARED';
+
if (drift.length === 0) {
- console.log('\nTHREE-COPY: PASS (module == live == listing submission)');
+ console.log(`\nCOPY CHECK: PASS (${agreed})`);
process.exit(0);
}
console.log('');
for (const d of drift) console.log(`DRIFT [${d.where}] ${d.detail}`);
-console.log(`\nTHREE-COPY: FAIL (${drift.length} divergence${drift.length === 1 ? '' : 's'})`);
+console.log(`\nCOPY CHECK: FAIL (${drift.length} divergence${drift.length === 1 ? '' : 's'} across ${scope})`);
process.exit(1);