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: sync working tree

nirholas96a06c6c9a29
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fe07a40e..9e814a563 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Docs · The solved economy** (`/docs/economy-solver`): The closed-form model behind /play/solver: expected cash, XP and yield per hour for every gatherable node at every level, the optimal fish-and-cook split, store payback, and the exact assumptions the arithmetic rests on.
- **Docs search now lands on the exact section you typed**: Typing a heading you saw in the docs did not always take you to it. A short section carries few words, so a long page that happened to reuse the same common words could outrank the section actually titled that. Search now recognises when what you typed IS a section's heading and sends you there first. Measured across the whole documentation corpus, a heading finding its own section went from 80 to 83 percent, and queries like "cost per asset" that previously returned three unrelated pages now open the right one. (`/docs`) `[improvement, docs]`
- **Pick animations by what they do: the motion of every clip is now measured and queryable**: Every animation clip in the library has been measured from its keyframes: how energetic it is, its tempo, which part of the body leads, whether it loops without a visible snap, and whether it survives as an upper-body overlay. The measurements power a new public API (GET /api/animations/signatures) with filters, slot-fit verdicts and a similar-clips ranking, plus two free MCP tools (animation_signature, find_similar_animations) so agents can pick clips the same way. The gestures page and the runtime defaults already run on the same numbers, so what you preview is what agents get. (`/gestures`) `[feature, sdk]`
+- **Your own avatar can sign now, not just the two that shipped with the page**: Sign language ran on two fixed rigs. You could watch the platform's avatars sign, but never your own, which is backwards for a feature whose whole point is that an avatar communicates. The Avatar setting on the sign language page and the ASL alphabet page now has a third option that opens the avatar gallery: pick any avatar you own, or any public one, and it takes over the signing on the spot, keeping the speed and signing hand you already chose. Your pick is remembered and carries between both pages. It works because a sign is described anatomically, an index fingertip on the chin rather than a fixed coordinate, so the same vocabulary is measured onto your avatar's own skeleton, whatever its proportions. An avatar that genuinely cannot sign, a model with no skeleton or no finger bones, is not left standing there mute: the page says which avatar it is and puts the working one back. (`/sign-language`) `[feature, improvement]`
## 2026-07-31
diff --git a/api/_lib/economy-ledger.js b/api/_lib/economy-ledger.js
index c0a4cce49..96db59b26 100644
--- a/api/_lib/economy-ledger.js
+++ b/api/_lib/economy-ledger.js
@@ -129,28 +129,17 @@ export async function getHead(masterPubkey) {
}
/**
- * Append one sweep's worth of events to the ledger as a single hash-chained
- * batch. Pure-ish orchestration around DB writes; returns what it wrote.
+ * Chain a batch of built rows onto the current head and insert them. One retry
+ * if a concurrent writer took our seq. Shared by every record* entry point so
+ * the chaining, the conflict retry, and the fail-soft contract are defined once.
*
- * @param {object} args
- * @param {string} args.runId
- * @param {string} args.masterPubkey
- * @param {'mainnet'|'devnet'} [args.network]
- * @param {object} args.result the object returned by sweepTopUps()
- * @param {{reserveSol?:number, runCapSol?:number, perTopupMaxSol?:number}} [args.caps]
- * @param {number} [args.now] epoch ms (injectable for tests)
+ * @param {{ masterPubkey: string, runId: string, rows: Array<object>, label: string }} args
* @returns {Promise<{written:number, seqFrom:number|null, seqTo:number|null, headHash:string|null, skippedWrite?:string}>}
*/
-export async function recordSweep({ runId, masterPubkey, network = 'mainnet', result, caps = {}, now = Date.now() }) {
- await ensureSchema();
- const solUsd = round6((await solPriceUsd(now)) || 0);
- const rows = buildSweepRows({ masterPubkey, network, result, caps, solUsd, now });
- if (!rows.length) return { written: 0, seqFrom: null, seqTo: null, headHash: null };
-
- // Chain onto the current head. One retry if a concurrent writer took our seq.
+async function appendChain({ masterPubkey, runId, rows, label }) {
for (let attempt = 0; attempt < 2; attempt++) {
const head = await getHead(masterPubkey);
- let seq = head ? head.seq : 0;
+ const seq = head ? head.seq : 0;
let prevHash = head ? head.entryHash : '';
const chained = rows.map((r, i) => {
const row = { ...r, seq: seq + i + 1, prev_hash: prevHash, run_id: runId };
@@ -169,13 +158,34 @@ export async function recordSweep({ runId, masterPubkey, network = 'mainnet', re
} catch (err) {
const conflict = /duplicate key|unique/i.test(err?.message || '');
if (conflict && attempt === 0) continue; // re-read head and rebuild the chain
- console.error('[economy-ledger] recordSweep write failed', { runId, error: err?.message });
+ console.error(`[economy-ledger] ${label} write failed`, { runId, error: err?.message });
return { written: 0, seqFrom: null, seqTo: null, headHash: null, skippedWrite: err?.message || 'write_failed' };
}
}
return { written: 0, seqFrom: null, seqTo: null, headHash: null, skippedWrite: 'seq_conflict' };
}
+/**
+ * Append one sweep's worth of events to the ledger as a single hash-chained
+ * batch. Pure-ish orchestration around DB writes; returns what it wrote.
+ *
+ * @param {object} args
+ * @param {string} args.runId
+ * @param {string} args.masterPubkey
+ * @param {'mainnet'|'devnet'} [args.network]
+ * @param {object} args.result the object returned by sweepTopUps()
+ * @param {{reserveSol?:number, runCapSol?:number, perTopupMaxSol?:number}} [args.caps]
+ * @param {number} [args.now] epoch ms (injectable for tests)
+ * @returns {Promise<{written:number, seqFrom:number|null, seqTo:number|null, headHash:string|null, skippedWrite?:string}>}
+ */
+export async function recordSweep({ runId, masterPubkey, network = 'mainnet', result, caps = {}, now = Date.now() }) {
+ await ensureSchema();
+ const solUsd = round6((await solPriceUsd(now)) || 0);
+ const rows = buildSweepRows({ masterPubkey, network, result, caps, solUsd, now });
+ if (!rows.length) return { written: 0, seqFrom: null, seqTo: null, headHash: null };
+ return appendChain({ masterPubkey, runId, rows, label: 'recordSweep' });
+}
+
/**
* Turn a sweepTopUps() result into ordered ledger rows with a running balance.
* Pure — no DB, no clock beyond the injected `now` — so it is unit-tested.
@@ -298,33 +308,7 @@ export async function recordSweepback({ runId, masterPubkey, network = 'mainnet'
const solUsd = round6((await solPriceUsd(now)) || 0);
const rows = buildSweepbackRows({ masterPubkey, network, result, solUsd, now });
if (!rows.length) return { written: 0, seqFrom: null, seqTo: null, headHash: null };
-
- for (let attempt = 0; attempt < 2; attempt++) {
- const head = await getHead(masterPubkey);
- let seq = head ? head.seq : 0;
- let prevHash = head ? head.entryHash : '';
- const chained = rows.map((r, i) => {
- const row = { ...r, seq: seq + i + 1, prev_hash: prevHash, run_id: runId };
- row.entry_hash = hashEntry(prevHash, row);
- prevHash = row.entry_hash;
- return row;
- });
- try {
- for (const row of chained) await insertRow(row);
- return {
- written: chained.length,
- seqFrom: chained[0].seq,
- seqTo: chained[chained.length - 1].seq,
- headHash: prevHash,
- };
- } catch (err) {
- const conflict = /duplicate key|unique/i.test(err?.message || '');
- if (conflict && attempt === 0) continue; // re-read head and rebuild the chain
- console.error('[economy-ledger] recordSweepback write failed', { runId, error: err?.message });
- return { written: 0, seqFrom: null, seqTo: null, headHash: null, skippedWrite: err?.message || 'write_failed' };
- }
- }
- return { written: 0, seqFrom: null, seqTo: null, headHash: null, skippedWrite: 'seq_conflict' };
+ return appendChain({ masterPubkey, runId, rows, label: 'recordSweepback' });
}
/**
@@ -432,6 +416,215 @@ export function buildSweepbackRows({ masterPubkey, network = 'mainnet', result,
return rows;
}
+// Read-error rows written per run before the summary takes over. A dead RPC tier
+// fails EVERY candidate at once, and 40 identical `rpc_error` rows would bloat
+// the chain without saying anything the summary's count does not. Twenty is
+// enough to see which wallets were affected.
+const MAX_READ_ERROR_ROWS = 20;
+
+/**
+ * Turn a `reclaimIdleAgentSol()` result into ordered ledger rows.
+ *
+ * The agent reclaim leg was the ONLY money path in the economy that wrote
+ * nothing to the book of record when it failed: the engine leg writes
+ * `inflow_failed`, the agent leg wrote nothing at all. That silence is not
+ * theoretical. On 2026-07-29 every Solana RPC lane was in quota cooldown, so
+ * every balance read failed, no candidate was ever planned, and 0.12 SOL sat
+ * reclaimable in agent wallets for ~11 hours while the sponsor stayed under its
+ * settle floor and every 402 challenge dropped its Solana accept. Nothing in the
+ * ledger recorded that the self-heal had even been attempted.
+ *
+ * Three row kinds, and the distinction between the last two is the whole point:
+ * `inflow` SOL that came back, with its signature.
+ * `inflow_failed` an attempt that did not land. `reason` names which
+ * stage failed (`rpc_error:` could not read the balance,
+ * `secret_undecryptable:` a KEY problem no funding fixes,
+ * anything else: the broadcast).
+ * `agent_reclaim` the summary, ALWAYS written, even on a no-op run, so
+ * "the loop ran and found nothing" and "the loop never
+ * ran" are different rows rather than the same absence.
+ *
+ * Pure: no DB, no clock beyond the injected `now`.
+ *
+ * @param {object} args
+ * @param {string} args.masterPubkey
+ * @param {'mainnet'|'devnet'} [args.network]
+ * @param {{master?:string, reclaimedSol?:number, moves?:Array<object>,
+ * skipped?:Array<object>, failed?:Array<object>,
+ * readErrors?:Array<object>, error?:string, dryRun?:boolean}} args.result
+ * @param {number} [args.masterSolBefore]
+ * @param {number} [args.deficitSol] the deficit the reclaim was trying to close
+ * @param {number} [args.solUsd]
+ * @param {number} [args.now] epoch ms
+ * @returns {Array<object>}
+ */
+export function buildAgentReclaimRows({
+ masterPubkey,
+ network = 'mainnet',
+ result,
+ masterSolBefore = null,
+ deficitSol = null,
+ solUsd = 0,
+ now = Date.now(),
+}) {
+ const rows = [];
+ const before = masterSolBefore == null ? null : round9(masterSolBefore);
+ let running = before ?? 0;
+ const baseTs = now;
+ let i = 0;
+ const ts = () => new Date(baseTs + i++).toISOString();
+
+ const common = {
+ master_pubkey: masterPubkey,
+ network,
+ reserve_sol: null,
+ run_cap_sol: null,
+ per_topup_max_sol: null,
+ master_sol_before: before,
+ };
+
+ const moves = result?.moves || [];
+ const failed = result?.failed || [];
+ const readErrors = result?.readErrors || [];
+ const skipped = result?.skipped || [];
+
+ for (const m of moves) {
+ const solAfter = round9(running + (Number(m.sol) || 0));
+ rows.push({
+ ...common,
+ ts: ts(),
+ event: 'inflow',
+ target_name: m.name || 'agent',
+ target_pubkey: m.address || null,
+ lamports: m.sol != null ? Math.round(m.sol * 1e9) : null,
+ sol: m.sol != null ? round9(m.sol) : null,
+ sol_usd: solUsd || null,
+ usd_value: solUsd && m.sol != null ? round6(m.sol * solUsd) : null,
+ tx_signature: m.signature || null,
+ reason: null,
+ master_sol_after: solAfter,
+ detail: { source: 'agent_reclaim', agent_id: m.agentId || null },
+ });
+ running = solAfter;
+ }
+
+ for (const f of failed) {
+ rows.push({
+ ...common,
+ ts: ts(),
+ event: 'inflow_failed',
+ target_name: f.name || 'agent',
+ target_pubkey: f.address || null,
+ lamports: f.sol != null ? Math.round(f.sol * 1e9) : null,
+ sol: f.sol != null ? round9(f.sol) : null,
+ sol_usd: solUsd || null,
+ usd_value: null,
+ tx_signature: null,
+ reason: f.reason || 'send_failed',
+ master_sol_after: running,
+ detail: { source: 'agent_reclaim', stage: f.stage || 'send' },
+ });
+ }
+
+ for (const e of readErrors.slice(0, MAX_READ_ERROR_ROWS)) {
+ rows.push({
+ ...common,
+ ts: ts(),
+ event: 'inflow_failed',
+ target_name: e.name || 'agent',
+ target_pubkey: e.address || null,
+ lamports: null,
+ sol: null,
+ sol_usd: solUsd || null,
+ usd_value: null,
+ tx_signature: null,
+ // A balance we could not READ is not a wallet that is empty. Keeping the
+ // stage on the row is what stops a future reader sizing a funding ask
+ // from a run where the fleet was simply unreadable.
+ reason: e.reason || 'rpc_error',
+ master_sol_after: running,
+ detail: { source: 'agent_reclaim', stage: 'read' },
+ });
+ }
+
+ const reclaimed = round9(result?.reclaimedSol ?? 0);
+ rows.push({
+ ...common,
+ ts: ts(),
+ event: 'agent_reclaim',
+ target_name: null,
+ target_pubkey: null,
+ lamports: null,
+ sol: reclaimed,
+ sol_usd: solUsd || null,
+ usd_value: solUsd ? round6(reclaimed * solUsd) : null,
+ tx_signature: null,
+ // The summary's own reason names the outcome class an operator acts on:
+ // `blocked` means we could not read or could not send (fix the RPC tier or
+ // the encryption key, no money required); `nothing_reclaimable` means every
+ // source is genuinely at its floor, which is the only case that needs funds.
+ reason: result?.error
+ ? `leg_error: ${String(result.error).slice(0, 180)}`
+ : reclaimed > 0
+ ? null
+ : failed.length + readErrors.length > 0
+ ? 'blocked'
+ : 'nothing_reclaimable',
+ master_sol_after: running,
+ detail: {
+ source: 'agent_reclaim',
+ dry_run: Boolean(result?.dryRun),
+ moves: moves.length,
+ failed: failed.length,
+ read_errors: readErrors.length,
+ read_errors_logged: Math.min(readErrors.length, MAX_READ_ERROR_ROWS),
+ skipped: skipped.length,
+ skipped_reasons: skipped.reduce((acc, s) => {
+ const key = s?.reason || 'unknown';
+ acc[key] = (acc[key] || 0) + 1;
+ return acc;
+ }, {}),
+ reclaimed_sol: reclaimed,
+ deficit_sol: deficitSol == null ? null : round9(deficitSol),
+ master_sol_before: before,
+ },
+ });
+ return rows;
+}
+
+/**
+ * Append one agent-reclaim run to the hash chain. Fail-soft in the same way every
+ * other recorder here is: a DB stall drops the batch and is reported, it never
+ * throws into the money path that already moved (or failed to move) SOL.
+ *
+ * @param {object} args
+ * @param {string} args.runId
+ * @param {string} args.masterPubkey
+ * @param {'mainnet'|'devnet'} [args.network]
+ * @param {object} args.result the object returned by reclaimIdleAgentSol()
+ * @param {number} [args.masterSolBefore]
+ * @param {number} [args.deficitSol]
+ * @param {number} [args.now]
+ * @returns {Promise<{written:number, seqFrom:number|null, seqTo:number|null, headHash:string|null, skippedWrite?:string}>}
+ */
+export async function recordAgentReclaim({
+ runId,
+ masterPubkey,
+ network = 'mainnet',
+ result,
+ masterSolBefore = null,
+ deficitSol = null,
+ now = Date.now(),
+}) {
+ await ensureSchema();
+ const solUsd = round6((await solPriceUsd(now)) || 0);
+ const rows = buildAgentReclaimRows({
+ masterPubkey, network, result, masterSolBefore, deficitSol, solUsd, now,
+ });
+ if (!rows.length) return { written: 0, seqFrom: null, seqTo: null, headHash: null };
+ return appendChain({ masterPubkey, runId, rows, label: 'recordAgentReclaim' });
+}
+
async function insertRow(r) {
await withDbRetry(() => sql`
INSERT INTO economy_master_ledger
diff --git a/api/_lib/llm-pricing.js b/api/_lib/llm-pricing.js
index bd2890e89..0f6e30c0b 100644
--- a/api/_lib/llm-pricing.js
+++ b/api/_lib/llm-pricing.js
@@ -4,10 +4,27 @@
// call cost us" — the admin spend dashboard reads the events this priced.
//
// Anthropic and OpenAI prices are list price per 1M tokens (input / output),
-// current as of each vendor's model catalog. Groq, OpenRouter, and NVIDIA NIM
-// are platform-funded free tiers (we hold the key, callers pay nothing), so
-// their marginal cost to us is $0 — they are intentionally priced at zero, not
+// current as of each vendor's model catalog. Groq and NVIDIA NIM are
+// platform-funded free tiers (we hold the key, callers pay nothing), so their
+// marginal cost to us is $0: they are intentionally priced at zero, not
// omitted, so the dashboard can show "calls served free" alongside paid spend.
+//
+// OpenRouter is NOT blanket-free, and treating it as such is what made a real
+// $30 credit burn invisible: the platform key routes `:free` models (genuinely
+// $0) AND vendor mirrors like `anthropic/claude-opus-5` (real spend at close to
+// list price), and both used to price to exactly 0, the mirror because its
+// namespaced id matched no table key and the provider was on the free list. A
+// lane reporting $0 while it drains a balance is worse than one reporting
+// nothing, so:
+//
+// • `:free` suffix → 0, and only that suffix earns a free price.
+// • vendor-namespaced id → priced by the underlying model (openRouterBaseId).
+// • a provider-reported cost (OpenRouter's `usage.cost`, requested with
+// `usage: { include: true }`) always wins over the table, it is the
+// authoritative number the account was actually charged.
+// • anything else on a spending lane → UNKNOWN (null), never 0. Callers
+// record null (usage_events.cost_micro_usd is nullable) and raise, so the
+// gap is visible instead of masquerading as free traffic.
import { isPaidModel } from './chat-models.js';
@@ -61,8 +78,49 @@ const PRICE_PER_MTOK = {
// Providers whose marginal cost to the platform is zero (platform-funded free
// tiers, or keyless anonymous tiers). vertex-gemini is deliberately NOT here —
-// it draws down GCP credits.
-const FREE_PROVIDERS = new Set(['groq', 'openrouter', 'nvidia', 'cerebras', 'gemini', 'ovh', 'pollinations']);
+// it draws down GCP credits. openrouter is deliberately NOT here either: the
+// platform key serves both `:free` models and paid vendor mirrors, so freeness
+// is a property of the MODEL on that lane, not of the lane (see isFreeLane).
+const FREE_PROVIDERS = new Set(['groq', 'nvidia', 'cerebras', 'gemini', 'ovh', 'pollinations']);
+
+// Strip a rung suffix from a provider name: '#n' for multi-key rungs
+// (openrouter#2), ':variant' for same-key model variants, '#instant' for the
+// Groq step-down. Every rung of a provider meters like its base.
+function baseProvider(provider) {
+ return String(provider || '').split(/[#:]/)[0];
+}
+
+/**
+ * The underlying model id behind an OpenRouter route.
+ *
+ * OpenRouter namespaces every id by vendor (`anthropic/claude-opus-5`,
+ * `openai/gpt-5.6-sol`, `x-ai/grok-4.5`), which matches nothing in the price
+ * table above, so a mirror of a $5/$25 model used to price to exactly $0.
+ * Strip the vendor segment so the mirror prices as the model it actually is.
+ * Ids already carrying a table-native prefix (`google/gemini-2.5-flash`,
+ * `ibm-granite/granite-4.1-8b`) are left alone by the caller because the table
+ * lookup tries the raw id first.
+ */
+export function openRouterBaseId(model) {
+ if (!model) return model;
+ const i = model.indexOf('/');
+ return i === -1 ? model : model.slice(i + 1);
+}
+
+/** Whether an OpenRouter route is the genuinely-free `:free` tier. */
+export function isOpenRouterFreeModel(model) {
+ return typeof model === 'string' && model.endsWith(':free');
+}
+
+/**
+ * Whether this provider/model pair costs the platform nothing. Used by the
+ * metering audit to tell "served free" apart from "we failed to price it".
+ */
+export function isFreeLane(provider, model) {
+ if (model && isPaidModel(model)) return false;
+ if (baseProvider(provider) === 'openrouter') return isOpenRouterFreeModel(model);
+ return FREE_PROVIDERS.has(baseProvider(provider));
+}
function priceForModel(model) {
if (!model) return null;
@@ -75,6 +133,12 @@ function priceForModel(model) {
return best ? PRICE_PER_MTOK[best] : null;
}
+// Resolve a price for a model, retrying once on the vendor-stripped id so an
+// OpenRouter mirror resolves to its underlying model's price.
+function priceForRoute(model) {
+ return priceForModel(model) || priceForModel(openRouterBaseId(model));
+}
+
// Anthropic prompt-cache multipliers against the model's base INPUT price.
// A cache write costs more than a plain input token; a cache read costs a
// tenth. These are ratios, not prices, so they stay correct as list prices
@@ -83,27 +147,39 @@ function priceForModel(model) {
const CACHE_WRITE_MULTIPLIER = 1.25;
const CACHE_READ_MULTIPLIER = 0.1;
-// Compute the cost of one completion in micro-USD. Returns an integer (rounded)
-// or 0 when the provider is free or the model is unpriced — never null, so the
-// caller can always record a numeric cost.
-//
-// `cacheWrite`/`cacheRead` are the Anthropic prompt-caching token counts
-// (`usage.cache_creation_input_tokens` / `usage.cache_read_input_tokens`).
-// They are DISJOINT from `input`: on a cached request the API reports
-// `input_tokens` as the uncached remainder only, so the three must be summed
-// (at their own rates) to price the full prompt. Omitting them would silently
-// under-report spend on every cached call.
-export function costMicroUsd({ provider, model, input = 0, output = 0, cacheWrite = 0, cacheRead = 0 } = {}) {
- // A paid/BYOK model draws real spend even when its transport provider is an
- // otherwise-free tier (e.g. OpenRouter Granite), so it is metered by its list
- // price below rather than zeroed. Genuinely-free models still short-circuit.
- // Provider names carry rung suffixes — '#n' for multi-key (openrouter#2),
- // ':variant' for same-key model variants (openrouter:free), '#instant' for
- // the Groq step-down. Strip them so every rung of a free provider prices
- // to zero.
- if (!(model && isPaidModel(model)) && provider && FREE_PROVIDERS.has(String(provider).split(/[#:]/)[0])) return 0;
- const price = priceForModel(model);
- if (!price) return 0;
+/**
+ * Cost of one completion in micro-USD.
+ *
+ * Returns an integer, or **null when the cost is UNKNOWN**, a spending lane
+ * whose model has no price and whose provider reported none. Null is not an
+ * error path to swallow: `usage_events.cost_micro_usd` is nullable precisely so
+ * unknown reads as unknown, and callers log it (see recordLlmSpend). Zero is
+ * reserved for lanes that genuinely cost nothing.
+ *
+ * `reportedCostUsd` is the provider's own charge for the call, in USD, when it
+ * tells us (OpenRouter returns `usage.cost` when the request carries
+ * `usage: { include: true }`). It is authoritative and overrides the table.
+ *
+ * `cacheWrite`/`cacheRead` are the Anthropic prompt-caching token counts
+ * (`usage.cache_creation_input_tokens` / `usage.cache_read_input_tokens`).
+ * They are DISJOINT from `input`: on a cached request the API reports
+ * `input_tokens` as the uncached remainder only, so the three must be summed
+ * (at their own rates) to price the full prompt. Omitting them would silently
+ * under-report spend on every cached call.
+ */
+export function costMicroUsd({ provider, model, input = 0, output = 0, cacheWrite = 0, cacheRead = 0, reportedCostUsd = null } = {}) {
+ // The provider told us what it charged, nothing beats that, including for a
+ // lane we have no table price for.
+ if (Number.isFinite(reportedCostUsd)) return Math.round(reportedCostUsd * 1_000_000);
+ // Genuinely-free lanes: platform-funded free tiers, keyless anonymous tiers,
+ // and OpenRouter's `:free` routes. A paid/BYOK model on an otherwise-free
+ // transport (OpenRouter Granite, the Claude mirrors) is NOT free and falls
+ // through to the table below.
+ if (isFreeLane(provider, model)) return 0;
+ const price = priceForRoute(model);
+ // Unknown on a spending lane. Never 0: a fabricated zero is how a $30
+ // OpenRouter burn stayed invisible until the balance was gone.
+ if (!price) return null;
const [inPerM, outPerM] = price;
// tokens / 1e6 * usdPerM * 1e6 micro-usd == tokens * usdPerM
const usdMicros =
@@ -114,8 +190,8 @@ export function costMicroUsd({ provider, model, input = 0, output = 0, cacheWrit
return Math.round(usdMicros);
}
-// Whether we have a real price for this model (vs. defaulting to 0). Lets the
+// Whether we have a real price for this model (vs. reporting unknown). Lets the
// dashboard distinguish "free provider" from "paid provider we can't price yet".
export function isPriced(model) {
- return priceForModel(model) != null;
+ return priceForRoute(model) != null;
}
diff --git a/api/_lib/ops/subsystem-health.js b/api/_lib/ops/subsystem-health.js
index f60933cf2..94741cd31 100644
--- a/api/_lib/ops/subsystem-health.js
+++ b/api/_lib/ops/subsystem-health.js
@@ -197,6 +197,37 @@ function checkHelius() {
// Falling through to free public nodes keeps the platform up but throttled, and
// that is precisely the state an operator must be told about, because clearing
// it costs money and only the owner can spend it.
+// Render a cooldown as a coarse "back in …". Whole hours past an hour, whole
+// minutes below it: an exhausted quota recovers on a 6h window, and reporting it
+// to the minute implies a precision the breaker does not have.
+function backIn(ms) {
+ if (ms >= 3_600_000) {
+ const h = Math.floor(ms / 3_600_000);
+ const m = Math.round((ms % 3_600_000) / 60_000);
+ return m ? `${h}h${m}m` : `${h}h`;
+ }
+ if (ms >= 60_000) return `${Math.round(ms / 60_000)}m`;
+ return `${Math.max(1, Math.round(ms / 1000))}s`;
+}
+
+// A one-line census of what is parked and when it comes back, appended to the
+// detail so it lands on /status and in healthz alike. Without it "1/3 paid lanes
+// serving" reads as an unexplained outage during what is in fact a normal quota
+// cooldown, and the next reader re-diagnoses "all lanes dead" from scratch. Cap
+// the list so a wide chain cannot turn one status line into a paragraph.
+const COOLING_LANES_SHOWN = 3;
+function coolingCensus(lanes) {
+ const cooling = lanes
+ .filter((l) => l.cooling)
+ .sort((a, b) => a.cooldownRemainingMs - b.cooldownRemainingMs);
+ if (cooling.length === 0) return '';
+ const shown = cooling
+ .slice(0, COOLING_LANES_SHOWN)
+ .map((l) => `${l.url.replace(/^https?:\/\//, '')} back in ${backIn(l.cooldownRemainingMs)}`);
+ const rest = cooling.length - shown.length;
+ return `; ${shown.join(', ')}${rest > 0 ? `, +${rest} more cooling` : ''}`;
+}
+
function checkRpcLanes() {
const base = { name: 'rpc_lanes', label: 'Solana RPC lanes' };
try {
@@ -207,23 +238,43 @@ function checkRpcLanes() {
total: h.total,
cooling: h.cooling,
};
+ // Per-lane state, so healthz answers "which lane, and when is it back?"
+ // without anyone having to re-probe the providers by hand. Masked to
+ // scheme+host by rpcLaneHealth, so no API key leaves the process.
+ const lanes = h.lanes.map((l) => ({
+ url: l.url,
+ paid: l.paid,
+ cooling: l.cooling,
+ recoversAt: l.recoversAt,
+ recoversIn: l.cooling ? backIn(l.cooldownRemainingMs) : null,
+ blockedMethods: l.blockedMethods.map((b) => b.method),
+ }));
+ const census = coolingCensus(h.lanes);
if (h.paidTotal === 0) {
- return { ...base, status: 'ok', detail: `${h.total} keyless lanes (no paid RPC configured)`, metrics };
+ return {
+ ...base,
+ status: 'ok',
+ detail: `${h.total} keyless lanes (no paid RPC configured)${census}`,
+ metrics,
+ lanes,
+ };
}
if (h.allPaidCooling) {
return {
...base,
status: 'degraded',
- detail: `all ${h.paidTotal} paid lanes exhausted; serving from ${h.total - h.cooling} free lanes`,
+ detail: `all ${h.paidTotal} paid lanes exhausted; serving from ${h.total - h.cooling} free lanes${census}`,
metrics,
- hint: 'Every paid Solana RPC plan is over quota at once. Calls still succeed on free public nodes but are throttled, which shows up as intermittent 5xx and slow settles. Owner action: top up or upgrade the RPC plans.',
+ lanes,
+ hint: 'Every paid Solana RPC plan is over quota at once. Calls still succeed on free public nodes but are throttled, which shows up as intermittent 5xx and slow settles. Each lane above carries its own recovery time, a quota cooldown clears itself, so check those before assuming an outage. Owner action if they are not clearing: top up or upgrade the RPC plans.',
};
}
return {
...base,
status: 'ok',
- detail: `${h.paidTotal - h.paidCooling}/${h.paidTotal} paid lanes serving`,
+ detail: `${h.paidTotal - h.paidCooling}/${h.paidTotal} paid lanes serving${census}`,
metrics,
+ lanes,
};
} catch (err) {
return { ...base, status: 'unknown', detail: err?.message || 'unreadable' };
diff --git a/api/_lib/solana/connection.js b/api/_lib/solana/connection.js
index b7dd783dd..bb34684ac 100644
--- a/api/_lib/solana/connection.js
+++ b/api/_lib/solana/connection.js
@@ -700,13 +700,27 @@ function paidMainnetEndpoints() {
*/
export function rpcLaneHealth(now = Date.now()) {
const paid = new Set(paidMainnetEndpoints());
+ // Group live method demotions by lane so each lane reports the call shapes it
+ // is currently skipped for. A lane can be fully healthy AND carry demotions,
+ // that is the normal state of a free lane, not a degradation.
+ const demotionsByUrl = new Map();
+ for (const d of rpcMethodDemotions(now)) {
+ if (!demotionsByUrl.has(d.url)) demotionsByUrl.set(d.url, []);
+ demotionsByUrl.get(d.url).push({ method: d.method, remainingMs: d.remainingMs });
+ }
const lanes = solanaRpcEndpoints('mainnet').map((url) => {
const until = _endpointCooldown.get(url) || 0;
+ const cooling = until > now;
return {
url: maskUrl(url),
paid: paid.has(url),
- cooling: until > now,
- cooldownRemainingMs: until > now ? until - now : 0,
+ cooling,
+ cooldownRemainingMs: cooling ? until - now : 0,
+ // Absolute wall-clock recovery, so an operator reading a parked snapshot
+ // (the /status page renders a cron-parked copy, minutes old) gets a time
+ // that stays true instead of a countdown that silently over-reports.
+ recoversAt: cooling ? until : null,
+ blockedMethods: demotionsByUrl.get(url) || [],
};
});
const paidLanes = lanes.filter((l) => l.paid);
@@ -857,11 +871,15 @@ export function classifyRpcBody(body) {
const msg = String(item.error?.message || '');
// status 429 → cooldownMsFor scans the message for a quota signal and parks
// a truly-exhausted plan for hours rather than re-hitting it every call.
+ // `methodBlock` splits that: the lane is not out of capacity, it is refusing
+ // this one call shape, so the rotating fetch demotes the method and leaves
+ // the lane in rotation. Both still fail the request over to the next lane.
return {
status: 429,
reason: `provider error ${code}`.trim(),
log: `200 + provider error ${code} ${msg.slice(0, 48)}`.trim(),
bodyText: msg,
+ methodBlock: isMethodRefusal(msg),
};
}
}
@@ -903,9 +921,42 @@ export function shouldRotate(status) {
// one request, so the caller gets nothing back — is the only WARN.
export function makeRotatingFetch(endpoints) {
return async function rotatingFetch(_info, init) {
+ // The call shapes in this request. Empty for an unreadable body, which makes
+ // every capability check a no-op rather than guessing.
+ const methods = rpcMethodsFromBody(typeof init?.body === 'string' ? init.body : '');
+
+ // Park the lane, or demote just this call shape on it, and log the choice
+ // once. A method refusal is NOT a lane fault: the lane keeps serving every
+ // other shape and never enters cooldown, so it can never be benched by its
+ // own routine traffic. Returns nothing; the caller always rotates.
+ const penalise = (url, status, bodyText, methodBlock, log) => {
+ if (methodBlock && methods.length) {
+ const fresh = methods.filter((m) => !isMethodDemoted(url, m));
+ const ms = markMethodDemotion(url, methods);
+ // Only the first caller to hit the refusal logs it; the rest see the
+ // demotion already in place and stay quiet.
+ if (fresh.length) {
+ console.log(
+ `[solana-rpc] ${maskUrl(url)} refused ${fresh.join(',')}, demoting that method for ${formatCooldown(ms)}, failing over`,
+ );
+ }
+ return;
+ }
+ // Check BEFORE marking: if parallel rotatingFetch calls race onto the same
+ // endpoint simultaneously, only the first to resolve logs, all subsequent
+ // callers see alreadyCooling=true and skip the line.
+ const alreadyCooling = isEndpointCooling(url);
+ const ms = markEndpointCooldown(url, status, bodyText);
+ if (!alreadyCooling) {
+ // INFO, not WARN: the request continues to the next provider and still
+ // succeeds. This is the redundancy working, not a fault.
+ console.log(`[solana-rpc] ${maskUrl(url)} ${log}, cooling ${formatCooldown(ms)}, failing over`);
+ }
+ };
+
// One fully-validated attempt against a single endpoint. Returns
- // `{ response }` with a usable JSON-RPC body, or `{ error }` after parking
- // the endpoint in cooldown so the caller rotates on. It NEVER returns an
+ // `{ response }` with a usable JSON-RPC body, or `{ error }` after penalising
+ // the endpoint so the caller rotates on. It NEVER returns an
// unvalidated body: a 200 carrying an empty/HTML/truncated payload, a
// `{jsonrpc,id}` envelope missing `result`, or a 200 + JSON-RPC capacity
// error is treated as a failure — web3.js would otherwise choke on it with a
@@ -924,38 +975,26 @@ export function makeRotatingFetch(endpoints) {
});
if (shouldRotate(resp.status)) {
// Read the body only on the failure path (we never return it) so a
- // quota signal can pick the long cooldown.
+ // quota signal can pick the long cooldown, and so a 401/403 can be told
+ // apart from a policy refusal. Reading it on 403 is load-bearing, not a
+ // nicety: PublicNode answers a programId-filtered getTokenAccountsByOwner
+ // with 403 + `blocked parameter`, and with the body unread that refusal
+ // classified as a bad key and benched a healthy free primary for 30
+ // minutes on its own routine traffic.
const bodyText =
- resp.status === 429
+ resp.status === 429 || resp.status === 403 || resp.status === 401
? await resp
.clone()
.text()
.catch(() => '')
: '';
- // Check BEFORE marking: if parallel rotatingFetch calls race onto
- // the same endpoint simultaneously, only the first to resolve logs —
- // all subsequent callers see alreadyCooling=true and skip the line.
- const alreadyCooling = isEndpointCooling(url);
- const ms = markEndpointCooldown(url, resp.status, bodyText);
- if (!alreadyCooling) {
- // INFO, not WARN: the request continues to the next provider and
- // still succeeds. This is the redundancy working, not a fault.
- console.log(
- `[solana-rpc] ${maskUrl(url)} ${resp.status}, cooling ${formatCooldown(ms)}, failing over`,
- );
- }
+ penalise(url, resp.status, bodyText, isMethodRefusal(bodyText), String(resp.status));
return { error: new Error(`solana rpc ${resp.status} @ ${maskUrl(url)}`) };
}
const okBody = await resp.text();
const bad = classifyRpcBody(okBody);
if (bad) {
- const alreadyCooling = isEndpointCooling(url);
- const ms = markEndpointCooldown(url, bad.status, bad.bodyText || '');
- if (!alreadyCooling) {
- console.log(
- `[solana-rpc] ${maskUrl(url)} ${bad.log}, cooling ${formatCooldown(ms)}, failing over`,
- );
- }
+ penalise(url, bad.status, bad.bodyText || '', bad.methodBlock === true, bad.log);
return { error: new Error(`solana rpc ${bad.reason} @ ${maskUrl(url)}`) };
}
// Body already consumed above; hand the caller a fresh Response carrying
@@ -987,25 +1026,35 @@ export function makeRotatingFetch(endpoints) {
else hydrateEndpointCooldowns();
let lastErr = null;
- // Pass 1 skips endpoints currently in cooldown. Pass 2 runs ONLY when pass 1
- // tried nothing (every endpoint was already cooling) — it ignores cooldowns so
- // a just-recovered node still gets exercised. Crucially both passes route
- // through tryEndpoint(), so the all-cooling case validates like any other and
- // can never fall back to a raw, unvalidated passthrough — the bug that leaked
- // an empty `[]` body straight to the browser and broke web3.js reads.
- for (const ignoreCooldown of [false, true]) {
+ // Passes widen the candidate set only when the narrower one had nothing to
+ // try. Pass 1 skips both lane cooldowns and lanes demoted for this call shape.
+ // Pass 2 forgives cooldowns so a just-recovered node still gets exercised but
+ // still respects capability, because a lane that refuses this shape will
+ // refuse it again. Pass 3 forgives everything, so a request whose method every
+ // lane has refused at some point still gets one honest attempt instead of
+ // failing on stale bookkeeping. Every pass routes through tryEndpoint(), so
+ // the widened cases validate like any other and can never fall back to a raw,
+ // unvalidated passthrough, the bug that leaked an empty `[]` body straight to
+ // the browser and broke web3.js reads.
+ const PASSES = [
+ { ignoreCooldown: false, ignoreCapability: false },
+ { ignoreCooldown: true, ignoreCapability: false },
+ { ignoreCooldown: true, ignoreCapability: true },
+ ];
+ for (const pass of PASSES) {
let attempted = false;
for (const url of endpoints) {
- if (!ignoreCooldown && isEndpointCooling(url)) continue;
+ if (!pass.ignoreCooldown && isEndpointCooling(url)) continue;
+ if (!pass.ignoreCapability && isAnyMethodDemoted(url, methods)) continue;
attempted = true;
const out = await tryEndpoint(url);
if (out.response) return out.response;
lastErr = out.error;
}
- // Pass 1 actually exercised at least one live endpoint and they all failed
- // this request — the chain is genuinely down right now, so don't force a
- // second cooldown-ignoring sweep that would just re-hammer dead lanes.
- if (!ignoreCooldown && attempted) break;
+ // This pass actually exercised at least one candidate and they all failed
+ // this request: the chain is genuinely down for it right now, so don't
+ // force a wider sweep that would just re-hammer known-bad lanes.
+ if (attempted) break;
}
// Reached the end with every provider failing in this one request — the caller
// gets a thrown error (→ a clean 502 from the proxy), never garbage. THIS is
diff --git a/api/_lib/trade-card-store.js b/api/_lib/trade-card-store.js
new file mode 100644
index 000000000..4f5b2a01c
--- /dev/null
+++ b/api/_lib/trade-card-store.js
@@ -0,0 +1,49 @@
+/**
+ * Loader for a single shareable trade.
+ *
+ * Split out from the pure model (api/_lib/trade-card.js) so the model stays
+ * database-free and unit-testable, while the OG image and the share page share
+ * one query and can never read the row two different ways.
+ *
+ * Only CLOSED positions are shareable: a card needs a result. An open position,
+ * an unknown id, or a deleted agent resolves to null and the caller renders its
+ * own fallback.
+ */
+
+import { sql } from './db.js';
+import { isUuid } from './validate.js';
+import { shapeTradeCard } from './trade-card.js';
+
+/**
+ * @param {string} id agent_sniper_positions.id
+ * @param {{ origin?: string }} [opts]
+ * @returns {Promise<object|null>} the card model, or null when not shareable
+ */
+export async function loadTradeCard(id, { origin = 'https://three.ws' } = {}) {
+ if (!isUuid(id)) return null;
+
+ let row;
+ try {
+ [row] = await sql`
+ select p.id, p.agent_id, p.network, p.mint, p.symbol, p.name,
+ p.status, p.exit_reason,
+ p.entry_quote_lamports, p.exit_quote_lamports,
+ p.realized_pnl_lamports, p.realized_pnl_pct,
+ p.buy_sig, p.sell_sig,
+ p.moonbag_base_amount, p.moonbag_last_value_lamports,
+ p.opened_at, p.closed_at,
+ a.name as agent_name,
+ a.profile_image_url as agent_image,
+ a.avatar_url as agent_avatar
+ from agent_sniper_positions p
+ join agent_identities a on a.id = p.agent_id and a.deleted_at is null
+ where p.id = ${id} and p.status = 'closed'
+ limit 1
+ `;
+ } catch {
+ return null;
+ }
+ if (!row) return null;
+
+ return shapeTradeCard(row, { origin });
+}
diff --git a/api/_lib/trade-card.js b/api/_lib/trade-card.js
new file mode 100644
index 000000000..c72322dc2
--- /dev/null
+++ b/api/_lib/trade-card.js
@@ -0,0 +1,244 @@
+/**
+ * Trade card model: the shared truth behind a single shareable pump.fun trade.
+ *
+ * One closed `agent_sniper_positions` row becomes one card. Both the OG image
+ * (api/trade-og.js) and the share page (api/trade-share.js) render from THIS
+ * model, so the picture that unfurls on X and the page a click lands on can
+ * never disagree about a number.
+ *
+ * Everything here is pure: row in, view model out. No database, no network, no
+ * clock. That is what makes the numbers testable (tests/trade-card.test.js).
+ *
+ * Honesty rules baked into the model, per the Arena trust standard:
+ * - A paper fill (simulate mode) is FLAGGED, never dressed up as a live trade.
+ * `paper: true` drives a visible marker on the card and in the share text.
+ * - A moon-bag exit is not a full exit. `moonbag: true` says the initials came
+ * out and the rest still rides, so a "+180%" headline is not read as "sold".
+ * - Losses render exactly like wins. There is no branch that hides a red card.
+ */
+
+import { holdTime, fmtSol, fmtPct, shortAddr } from '../../src/trader-format.js';
+
+export const LAMPORTS_PER_SOL = 1e9;
+
+/** The paper-fill sentinel the sniper writes into buy_sig/sell_sig in simulate mode. */
+export const SIMULATED_SIG = 'SIMULATED';
+
+/** Exit reasons the engine can write, mapped to language a spectator understands. */
+const EXIT_LABELS = {
+ take_profit: 'Take-profit',
+ stop_loss: 'Stop-loss',
+ trailing_stop: 'Trailing stop',
+ timeout: 'Max hold reached',
+ manual: 'Closed by owner',
+ kill_switch: 'Kill switch',
+ graduated: 'Graduated to AMM',
+ error: 'Closed on error',
+};
+
+/** Accent per outcome. Used by the SVG card and the share page alike. */
+export const TONE_ACCENT = { win: '#34d399', loss: '#f87171', flat: '#94a3b8' };
+
+export function exitReasonLabel(reason) {
+ if (!reason) return 'Closed';
+ return EXIT_LABELS[reason] || String(reason).replace(/_/g, ' ');
+}
+
+function num(v) {
+ if (v == null) return null;
+ const n = Number(v);
+ return Number.isFinite(n) ? n : null;
+}
+
+function lamportsToSol(v) {
+ if (v == null) return null;
+ try {
+ return Number(BigInt(v)) / LAMPORTS_PER_SOL;
+ } catch {
+ const n = Number(v);
+ return Number.isFinite(n) ? n / LAMPORTS_PER_SOL : null;
+ }
+}
+
+/** A real on-chain signature, or null for a paper fill / missing leg. */
+function realSig(sig) {
+ const s = typeof sig === 'string' ? sig.trim() : '';
+ return s && s !== SIMULATED_SIG ? s : null;
+}
+
+export function solscanTx(sig, network) {
+ const s = realSig(sig);
+ if (!s) return null;
+ return network === 'devnet' ? `https://solscan.io/tx/${s}?cluster=devnet` : `https://solscan.io/tx/${s}`;
+}
+
+export function solscanToken(mint, network) {
+ if (!mint) return null;
+ return network === 'devnet'
+ ? `https://solscan.io/token/${mint}?cluster=devnet`
+ : `https://solscan.io/token/${mint}`;
+}
+
+/**
+ * Seconds held, from the two timestamps the engine stamps. Returns null when
+ * either end is missing or the clock ran backwards, so the card shows a dash
+ * instead of inventing a duration.
+ */
+export function heldSeconds(openedAt, closedAt) {
+ if (!openedAt || !closedAt) return null;
+ const a = new Date(openedAt).getTime();
+ const b = new Date(closedAt).getTime();
+ if (!Number.isFinite(a) || !Number.isFinite(b) || b < a) return null;
+ return (b - a) / 1000;
+}
+
+/**
+ * Return multiple on the entry: 4.12 for a +312% trade. Null when the entry
+ * size is unknown or zero, which is the only case where a multiple is undefined.
+ */
+export function returnMultiple(pnlPct) {
+ const p = num(pnlPct);
+ if (p == null) return null;
+ const m = 1 + p / 100;
+ return m > 0 ? m : 0;
+}
+
+/**
+ * The single biggest number on the card. Percent is the memecoin lingua franca,
+ * so it leads; the multiple rides alongside once a trade more than doubled.
+ */
+export function headlineFor(pnlPct) {
+ const p = num(pnlPct);
+ if (p == null) return { primary: 'CLOSED', secondary: null };
+ const primary = fmtPct(p, { sign: true, dp: Math.abs(p) >= 100 ? 0 : 1 });
+ const mult = returnMultiple(p);
+ const secondary = mult != null && mult >= 2 ? `${mult.toFixed(mult >= 10 ? 0 : 1)}x` : null;
+ return { primary, secondary };
+}
+
+export function toneFor(pnlPct) {
+ const p = num(pnlPct);
+ if (p == null || Math.abs(p) < 0.05) return 'flat';
+ return p > 0 ? 'win' : 'loss';
+}
+
+/**
+ * Shape a joined position + agent row into the card model.
+ *
+ * @param {object} row agent_sniper_positions joined to agent_identities:
+ * id, agent_id, network, mint, symbol, name, status, exit_reason,
+ * entry_quote_lamports, exit_quote_lamports, realized_pnl_lamports,
+ * realized_pnl_pct, buy_sig, sell_sig, moonbag_base_amount,
+ * moonbag_last_value_lamports, opened_at, closed_at,
+ * agent_name, agent_image
+ * @param {{ origin?: string }} [opts]
+ * @returns {object} the view model both renderers read
+ */
+export function shapeTradeCard(row, { origin = 'https://three.ws' } = {}) {
+ const network = row.network === 'devnet' ? 'devnet' : 'mainnet';
+ const pnlPct = num(row.realized_pnl_pct);
+ const pnlSol = lamportsToSol(row.realized_pnl_lamports);
+ const entrySol = lamportsToSol(row.entry_quote_lamports);
+ const exitSol = lamportsToSol(row.exit_quote_lamports);
+
+ const buyUrl = solscanTx(row.buy_sig, network);
+ const sellUrl = solscanTx(row.sell_sig, network);
+ // A fill is paper when the engine wrote the sentinel (or no signature at all)
+ // on the entry leg. The entry is the honest test: every live position has one.
+ const paper = !realSig(row.buy_sig);
+
+ const secs = heldSeconds(row.opened_at, row.closed_at);
+ const moonbagTokens = num(row.moonbag_base_amount) || 0;
+ const moonbagSol = moonbagTokens > 0 ? lamportsToSol(row.moonbag_last_value_lamports) : null;
+
+ const tone = toneFor(pnlPct);
+ const headline = headlineFor(pnlPct);
+ const symbol = String(row.symbol || row.name || 'coin').replace(/^\$+/, '') || 'coin';
+ const agentName = String(row.agent_name || 'Agent').trim() || 'Agent';
+
+ const pnlSolStr = pnlSol != null ? fmtSol(pnlSol) : null;
+ const holdLabel = secs != null ? holdTime(secs) : null;
+
+ const model = {
+ id: row.id,
+ agentId: row.agent_id,
+ agentName,
+ agentImage: row.agent_image || row.agent_avatar || null,
+ network,
+ mint: row.mint,
+ mintShort: shortAddr(row.mint, 4, 4),
+ symbol,
+ coinName: row.name || null,
+
+ paper,
+ moonbag: moonbagTokens > 0,
+ moonbagSol,
+ tone,
+ accent: TONE_ACCENT[tone],
+ win: tone === 'win',
+
+ pnlPct,
+ pnlSol,
+ entrySol,
+ exitSol,
+ multiple: returnMultiple(pnlPct),
+ headline: headline.primary,
+ multipleLabel: headline.secondary,
+
+ heldSeconds: secs,
+ holdLabel,
+ exitReason: row.exit_reason || null,
+ exitLabel: exitReasonLabel(row.exit_reason),
+
+ buyUrl,
+ sellUrl,
+ mintUrl: solscanToken(row.mint, network),
+ agentUrl: `${origin}/trader/${encodeURIComponent(row.agent_id)}`,
+ shareUrl: `${origin}/trade/${encodeURIComponent(row.id)}`,
+ ogImageUrl: `${origin}/api/trade-og?id=${encodeURIComponent(row.id)}`,
+
+ pnlSolStr,
+ entrySolStr: entrySol != null ? fmtSol(entrySol, { sign: false }) : null,
+ exitSolStr: exitSol != null ? fmtSol(exitSol, { sign: false }) : null,
+ };
+
+ model.title = buildTitle(model);
+ model.description = buildDescription(model);
+ model.shareText = buildShareText(model);
+ return model;
+}
+
+/** Page + OG title. Leads with the outcome, names the agent, never hypes. */
+export function buildTitle(m) {
+ const result = m.pnlPct != null ? m.headline : 'Closed';
+ const paper = m.paper ? ' (paper)' : '';
+ return `${m.agentName} ${result} on $${m.symbol}${paper} · three.ws Arena`;
+}
+
+/** OG description. Every clause is a number that exists on the row. */
+export function buildDescription(m) {
+ const parts = [];
+ if (m.paper) parts.push('Paper trade (simulate mode), not a live fill');
+ if (m.entrySolStr && m.exitSolStr) parts.push(`${m.entrySolStr} in, ${m.exitSolStr} out`);
+ else if (m.entrySolStr) parts.push(`${m.entrySolStr} in`);
+ if (m.pnlSolStr) parts.push(`${m.pnlSolStr} realized`);
+ if (m.holdLabel) parts.push(`held ${m.holdLabel}`);
+ parts.push(m.exitLabel.toLowerCase());
+ if (m.moonbag) parts.push('initials out, moon-bag still riding');
+ parts.push(m.paper ? 'labeled paper, never counted as live' : 'every leg links to its on-chain transaction');
+ return parts.join(' · ');
+}
+
+/**
+ * The text pre-filled into an X post. Short, factual, no price call, no promise.
+ * The link carries the proof, so the copy does not have to oversell.
+ */
+export function buildShareText(m) {
+ const lead = m.paper
+ ? `${m.agentName} paper-traded $${m.symbol}`
+ : `${m.agentName} traded $${m.symbol} on pump.fun`;
+ const result = m.pnlPct != null ? `${m.headline}${m.multipleLabel ? ` (${m.multipleLabel})` : ''}` : 'closed';
+ const held = m.holdLabel ? ` in ${m.holdLabel}` : '';
+ const proof = m.paper ? 'Paper mode, labeled as such.' : 'On-chain, verifiable.';
+ return `${lead}: ${result}${held}. ${proof}`;
+}
diff --git a/api/_lib/x402/sponsor-runway.js b/api/_lib/x402/sponsor-runway.js
index f393cca7e..634d4606c 100644
--- a/api/_lib/x402/sponsor-runway.js
+++ b/api/_lib/x402/sponsor-runway.js
@@ -28,7 +28,7 @@
// consumer therefore carries the window alongside the number: a rate without
// its window is a rumour.
// 2. RUNWAY IS MEASURED TO THE FLOOR, NOT TO ZERO. Settling stops at the floor,
-// so the operationally meaningful figure is (balance − floor) / burn. The
+// so the operationally meaningful figure is (balance minus floor) / burn. The
// to-zero figure is still reported (`runway_days`) because it is what the
// board has always shown and what a funding ask is sized against, but the
// STATUS and the alert key off `runway_days_to_floor`.
diff --git a/docs/media-api.md b/docs/media-api.md
index 92eb67c76..471d91892 100644
--- a/docs/media-api.md
+++ b/docs/media-api.md
@@ -221,10 +221,32 @@ If `draco=1` comes back `500 transcode_failed` with `draco.createCompressedPrimi
## Same-origin GLB proxy
**`GET /api/glb?src=<url>`** streams any public GLB back with
-`access-control-allow-origin: *`. Generated models live on a CDN whose CORS
-policy is an origin allowlist, so a `<model-viewer>` embed on a partner site,
-a Jupyter/Colab notebook, or a localhost preview cannot fetch them directly.
-Routing the bytes through this proxy makes the read work from any origin.
+`access-control-allow-origin: *`.
+
+### When you need it, and when you do not
+
+It depends entirely on which host serves the `.glb`, not on which origin you
+are loading from. Measured 2026-08-01:
+
+| Source host | Cross-origin fetch | Use the proxy? |
+|---|---|---|
+| `https://three.ws/...` (built-in library avatars, `/avatars/*`, anything under the site) | `access-control-allow-origin: *` on every origin | No. Fetch it directly. |
+| `https://pub-*.r2.dev/...` (the media bucket: user-generated avatars, forge output, character-library GLBs, the target of `/api/avatar/render`'s `302`) | Header only for origins on the bucket allowlist (`three.ws`, `*.vercel.app`, `localhost:3000`). Every other origin gets no header and the fetch dies. | Yes. |
+
+So a `<model-viewer>` embed on a partner site, a Jupyter/Colab notebook, a
+Codespaces preview, or a Vite dev server on `localhost:5173` can read
+`three.ws` URLs directly but needs the proxy for bucket URLs. If you cannot
+tell which one an API handed you, the proxy is always safe: passing it a
+`three.ws` URL costs one extra hop on a cold CDN cache and nothing after.
+
+The bucket allowlist is the deliberate part for uploads (presigned `PUT`s stay
+origin-locked) and an accident for reads, which are meant to be world-open.
+`scripts/set-r2-cors.mjs` holds the corrected policy and
+`node scripts/set-r2-cors.mjs --probe` measures what is live; see
+[`scripts/README.md`](../scripts/README.md). Even once reads are world-open,
+this proxy stays the right answer for callers that want one URL shape and no
+dependency on a third-party host's headers.
+
Safe by construction: upstream objects are already public and keyless, and
the fetch runs through the SSRF-hardened fetcher (scheme allowlist, DNS
pinning, private-IP blocklist, redirect re-validation, byte cap, timeout).
diff --git a/docs/tutorials/render-avatar-images.md b/docs/tutorials/render-avatar-images.md
index 7a1ad4421..210998de7 100644
--- a/docs/tutorials/render-avatar-images.md
+++ b/docs/tutorials/render-avatar-images.md
@@ -442,9 +442,14 @@ Consequences, in order of how likely they are to matter to you:
## Step 9 - A real viewer on your own page
-Sometimes an image is not enough and you want the actual interactive model. Loading a GLB in the browser is a cross-origin `fetch`, which means CORS, and the CDN that hosts generated models answers cross-origin reads only for origins it recognizes (`three.ws` itself, and localhost dev servers). From `https://your-site.com`, a direct load fails with a CORS error and an empty canvas.
+Sometimes an image is not enough and you want the actual interactive model. Loading a GLB in the browser is a cross-origin `fetch`, which means CORS, and whether it works depends on which host serves the file.
-`GET /api/glb?src=<url>` exists exactly for this. It streams any public GLB back with `access-control-allow-origin: *`:
+Two hosts, two answers (measured 2026-08-01):
+
+- **`https://three.ws/...`**, which is where the built-in library avatars live (`/avatars/selfie-girl.glb` and friends), answers every origin with `access-control-allow-origin: *`. Load these directly. No proxy needed.
+- **`https://pub-*.r2.dev/...`**, the media CDN behind every avatar you or your users generated, answers only origins on its allowlist (`three.ws`, `*.vercel.app`, `localhost:3000`). From `https://your-site.com`, from Jupyter, or from a Vite server on `localhost:5173`, a direct load fails with a CORS error and an empty canvas. That is the URL `/api/avatar/render` redirects to and the URL the avatar APIs return for user avatars.
+
+`GET /api/glb?src=<url>` exists for the second case. It streams any public GLB back with `access-control-allow-origin: *`, and it is harmless on the first, so if you cannot tell which host a URL points at, use it. The example below proxies a `three.ws` URL that would also load directly, because it is the pattern that keeps working when you swap in a generated avatar:
```bash
curl -sD - -o /dev/null -H 'Origin: https://your-site.com' \
@@ -499,7 +504,7 @@ If you want a talking, animated agent rather than a viewer, that is the `<agent-
| `avatar-clip` request hangs, then dies with no body | `glbUrl` is over the 10 MB cap | Check with `curl -sI <url> \| grep -i content-length` first, then shrink it through `/api/avatar/optimize` and pass the optimizer URL as `glbUrl` (Step 7). |
| `502 render_failed` on `avatar-clip` | GLB unreachable or unparseable | Verify the URL returns a real GLB: `curl -sL -o m.glb <url> && head -c 4 m.glb` should print `glTF`. |
| `429` with `Retry-After` | 120 renders per 10 min per IP on `/api/avatar/render`, 60 on `avatar-clip` | Keep batches sequential and honour `Retry-After`. It is a rolling window, not a ban. |
-| Empty canvas in `<model-viewer>`, CORS error in console | Loading a CDN GLB directly from your own origin | Route it through `/api/glb?src=...` (Step 9). |
+| Empty canvas in `<model-viewer>`, CORS error in console | Loading a `pub-*.r2.dev` GLB directly from an origin the CDN does not echo | Route it through `/api/glb?src=...` (Step 9). A `three.ws/...` GLB needs no proxy, so check the host before you assume CORS. |
| Social card shows a blank or black box | Scraper hit a cold render, or choked on PNG alpha | Warm the URL once with `curl -sL`, and use `format=jpeg` with an opaque `bg`. |
---
@@ -514,7 +519,7 @@ If you want a talking, animated agent rather than a viewer, that is the `<agent-
- `POST /api/render/avatar-clip` for arbitrary GLBs, free camera orbits, and turntables
- The 10 MB cap and how `/api/avatar/optimize` gets you under it
- The `302`-to-CDN cache, its `updated_at`-keyed invalidation, and the five things that follow from it
-- Why the CDN blocks your origin's direct GLB reads and how `/api/glb` fixes it in one attribute
+- Which host needs `/api/glb` and which does not, and how the proxy fixes the CDN case in one attribute
## Next steps
diff --git a/pages/admin/ops.html b/pages/admin/ops.html
index 7193224bd..4eb5fba39 100644
--- a/pages/admin/ops.html
+++ b/pages/admin/ops.html
@@ -338,11 +338,21 @@ function renderPayments(d) {
const settleCls = w3.settle_success_rate == null ? '' : w3.settle_success_rate >= 0.9 ? 'ok' : w3.settle_success_rate >= 0.7 ? 'warn' : 'bad';
const verifyCls = w3.verify_reject_rate == null ? '' : w3.verify_reject_rate <= 0.05 ? 'ok' : w3.verify_reject_rate <= 0.2 ? 'warn' : 'bad';
- const sponsorCls = sp.error || sp.below_floor ? 'bad' : sp.runway_days != null && sp.runway_days < 3 ? 'warn' : 'ok';
+ // The card mirrors the verdict the scheduled monitor alerts on, so the board
+ // and this page can never disagree about whether the sponsor is in trouble.
+ const sponsorCls = sp.error || sp.runway_status === 'critical' || sp.below_floor ? 'bad'
+ : sp.runway_status === 'warn' ? 'warn' : 'ok';
const sponsorVal = sp.error ? '✕' : sp.sol != null ? sp.sol.toFixed(4) + ' SOL' : sp.configured === false ? 'not set' : 'n/a';
+ // A burn rate without the window it was measured over is a rumour: print both.
+ const burnTxt = sp.burn_sol_per_day != null
+ ? `burn ${sp.burn_sol_per_day}/day over ${sp.burn_window_days ?? '?'}d (${sp.settles_in_window ?? 0} settles)`
+ : `burn not measurable in ${sp.burn_window_days ?? '?'}d`;
+ const runwayTxt = sp.runway_days_to_floor != null
+ ? `runway ${sp.runway_days_to_floor}d to floor${sp.runway_alert_days != null ? ` (alerts under ${sp.runway_alert_days}d)` : ''}`
+ : `runway unknown${sp.runway_reason ? ` (${esc(sp.runway_reason)})` : ''}`;
const sponsorSub = sp.error ? esc(sp.error)
: sp.sol != null
- ? `floor ${sp.sol_floor != null ? sp.sol_floor.toFixed(2) : 'n/a'} · burn ${sp.burn_sol_per_day_7d ?? 'n/a'}/day · runway ${sp.runway_days != null ? sp.runway_days + 'd' : 'n/a'}`
+ ? `settle floor ${sp.settle_floor_sol != null ? sp.settle_floor_sol.toFixed(3) : 'n/a'} · ${burnTxt} · ${runwayTxt}`
: 'sponsor wallet unconfigured';
// Zero events across 24h is a state of its own: one clear line beats four
diff --git a/pages/docs-freshness.html b/pages/docs-freshness.html
index 27ca99eb2..02ed9dbc4 100644
--- a/pages/docs-freshness.html
+++ b/pages/docs-freshness.html
@@ -1,6 +1,7 @@
<!doctype html>
<html lang="en">
<head>
+ <style>/* three.ws hidden-guard: make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
<script>/* three.ws theme boot (no-flash); runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
diff --git a/pages/tour-atlas.html b/pages/tour-atlas.html
index f2c314fe9..b4f862ee7 100644
--- a/pages/tour-atlas.html
+++ b/pages/tour-atlas.html
@@ -198,8 +198,8 @@
.ta-idx {
position: absolute; top: 9px; left: 9px; z-index: 2;
padding: 3px 8px; border-radius: var(--radius-pill);
- background: rgba(8, 10, 16, 0.76); color: rgba(255, 255, 255, 0.82);
- border: 1px solid rgba(255, 255, 255, 0.14);
+ background: var(--scrim); color: var(--on-scrim);
+ border: 1px solid var(--on-scrim-stroke);
font: 600 10.5px/1 var(--font-mono);
font-variant-numeric: tabular-nums;
}
@@ -264,9 +264,8 @@
.ta-btn:active { transform: translateY(1px); }
.ta-btn:focus-visible { outline: 2px solid var(--ta-accent); outline-offset: 2px; }
.ta-btn[data-variant='primary'] {
- background: var(--ta-accent); border-color: var(--ta-accent); color: #07080c;
+ background: var(--ta-accent); border-color: var(--ta-accent); color: var(--btn-primary-fg);
}
- html[data-theme='light'] .ta-btn[data-variant='primary'] { color: #ffffff; }
.ta-btn[data-variant='primary']:hover { filter: brightness(1.08); }
/* ── Lightbox ─────────────────────────────────────────────────────── */
@@ -274,35 +273,35 @@
.ta-lb {
position: fixed; inset: 0; z-index: 2147483000;
display: grid; place-items: center; padding: 24px;
- background: rgba(5, 6, 10, 0.82); backdrop-filter: blur(6px);
+ background: var(--scrim-modal); backdrop-filter: blur(var(--blur-sm));
}
.ta-lb-panel {
width: min(1080px, 100%); max-height: calc(100vh - 48px);
display: flex; flex-direction: column; overflow: hidden;
background: var(--ta-panel); border: 1px solid var(--ta-border-2);
- border-radius: var(--radius-lg); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
+ border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
}
- .ta-lb-figure { position: relative; background: #05060a; flex-shrink: 0; }
+ .ta-lb-figure { position: relative; background: var(--scrim-strong); flex-shrink: 0; }
.ta-lb-figure img { display: block; width: 100%; height: auto; max-height: 58vh; object-fit: contain; }
.ta-lb-x {
position: absolute; top: 10px; right: 10px; z-index: 3;
width: 34px; height: 34px; border-radius: var(--radius-md); cursor: pointer;
display: grid; place-items: center; font: 600 15px/1 var(--font-body);
- background: rgba(8, 10, 16, 0.78); color: #fff; border: 1px solid rgba(255, 255, 255, 0.16);
+ background: var(--scrim); color: var(--on-scrim-bright); border: 1px solid var(--on-scrim-stroke);
}
- .ta-lb-x:hover { background: rgba(8, 10, 16, 0.95); }
+ .ta-lb-x:hover { background: var(--scrim-strong); }
.ta-lb-x:focus-visible { outline: 2px solid var(--ta-accent); outline-offset: 2px; }
.ta-lb-nav {
position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
width: 40px; height: 56px; border-radius: var(--radius-md); cursor: pointer;
display: grid; place-items: center; font: 600 18px/1 var(--font-body);
- background: rgba(8, 10, 16, 0.7); color: #fff; border: 1px solid rgba(255, 255, 255, 0.14);
+ background: var(--scrim); color: var(--on-scrim-bright); border: 1px solid var(--on-scrim-stroke);
}
- .ta-lb-nav:hover { background: rgba(8, 10, 16, 0.92); }
+ .ta-lb-nav:hover { background: var(--scrim-strong); }
.ta-lb-nav:focus-visible { outline: 2px solid var(--ta-accent); outline-offset: 2px; }
.ta-lb-nav[data-dir='prev'] { left: 10px; }
.ta-lb-nav[data-dir='next'] { right: 10px; }
- .ta-lb-nav[disabled] { opacity: 0.3; cursor: default; }
+ .ta-lb-nav[disabled] { opacity: var(--disabled-opacity); cursor: var(--disabled-cursor); }
.ta-lb-body { padding: 20px 24px 24px; overflow-y: auto; }
.ta-lb-kicker {
font: 600 11px/1 var(--font-mono);
diff --git a/prompts/fable-audit/00-INDEX.md b/prompts/fable-audit/00-INDEX.md
index aa8e88ecc..3cc8c335d 100644
--- a/prompts/fable-audit/00-INDEX.md
+++ b/prompts/fable-audit/00-INDEX.md
@@ -1,46 +1,38 @@
-# Fable Audit — Work-Order Pack (2026-07-11)
+# Fable Audit pack (2026-07-11)
-> Retirement note (2026-07-28): work orders verified fully shipped were deleted from this pack per owner directive; their files remain in git history. Links below to missing files refer to retired, completed work orders. Remaining files are open or partial.
+One work order per finding from the maximum-depth audit of 2026-07-11. Snapshot ref before the
+pack: `fable-audit-2026-07-11` (commit `267ee1418`).
-One `.md` per finding from the maximum-depth audit. Each file is a self-contained
-work order: context, the exact defect (file:line), the fix, verification, and a
-done checklist. Execute in the recommended order below.
+## State
-Snapshot ref before this pack: `fable-audit-2026-07-11` (at commit `267ee1418`).
-Work happens on `main`. Commit each item as its own small, revertible commit.
+**Every numbered finding shipped and its work order was retired** (C1, C2, H1 to H7, M1 to M7),
+along with the two batch records (`ENHANCEMENTS.md`, `LEAN-deletions.md`) once their items were
+closed. All of them, with their defect analysis, fixes and evidence, remain readable in git
+history:
+
+```bash
+git log --diff-filter=D --name-only -- prompts/fable-audit/ | head -40
+git show <sha>^:prompts/fable-audit/<file>.md
+```
+
+**What is left is one file:** [RESIDUALS.md](RESIDUALS.md), a runnable work order covering the
+three items that were deliberately left open, plus the one item (god-file splitting) that is
+explicitly not scheduled as its own session.
+
+| Item | Why it is still open |
+|---|---|
+| OIDC-authenticated invoker for `/api/cron/*` | Needs Cloud Scheduler and Cloud Run changes; `gcloud` auth on this machine dies to the Workspace reauth policy. The interim in-repo control ships regardless. |
+| Payment-outcome observability | The metrics already emit; nothing surfaces them. No UI surface was in scope for the audit batch. |
+| `data/skills/seed.json` regeneration | Generator and drift gate shipped; the regeneration diff touches other-project skill content, so committing it needs owner approval. |
## Commit gate reminder
-Some items touch skill files that reference other crypto projects (four.meme, BNB,
-OKX, etc.). Per `CLAUDE.md`, **any commit whose diff references a non-$THREE crypto
-project needs explicit owner approval first**. Items flagged `⚠ commit-gate` below
-must stop for owner sign-off before staging. Items without the flag are freely
-committable.
-
-## Recommended execution order
-| # | File | Severity | Area | Commit-gate |
-|---|---|---|---|---|
-| C1 | [C1-api-path-traversal.md](C1-api-path-traversal.md) | Critical | Server routing | no |
-| H1 | [H1-premium-status-ownership.md](H1-premium-status-ownership.md) | High | API authz | no |
-| H4 | [H4-dockerignore-ring-secrets.md](H4-dockerignore-ring-secrets.md) | High | Infra/secrets | no |
-| H6 | [H6-posthog-cookie-leak.md](H6-posthog-cookie-leak.md) | High | Server proxy | no |
-| H2 | [H2-self-facilitator-verify-simulation.md](H2-self-facilitator-verify-simulation.md) | High | Payments | no |
-| H3 | [H3-settlement-skip-on-flush.md](H3-settlement-skip-on-flush.md) | High | Payments | no |
-| M1 | [M1-facilitator-rate-limit.md](M1-facilitator-rate-limit.md) | Medium | Payments | no |
-| M2 | [M2-proxy-stream-crash.md](M2-proxy-stream-crash.md) | Medium | Server proxy | no |
-| H5 | [H5-worker-port-listener.md](H5-worker-port-listener.md) | High | Workers | no |
-| M3 | [M3-dockerfile-minimal.md](M3-dockerfile-minimal.md) | Medium | Infra | no |
-| M5 | [M5-ring-tx-bounds-guard.md](M5-ring-tx-bounds-guard.md) | Medium | Payments | no |
-| M6 | [M6-text-extract-allowhttp.md](M6-text-extract-allowhttp.md) | Medium | Security | no |
-| M7 | [M7-postversion-push-target.md](M7-postversion-push-target.md) | Medium | Repo/CI | no |
-| C2 | [C2-money-skill-confirmation-gates.md](C2-money-skill-confirmation-gates.md) | Critical | Skills | ⚠ partial |
-| H7 | [H7-wallet-skill-arbitration.md](H7-wallet-skill-arbitration.md) | High | Skills | ⚠ partial |
-| M4 | [M4-nft-model-id-placeholder.md](M4-nft-model-id-placeholder.md) | Medium | Skills | ⚠ commit-gate |
-| — | [LEAN-deletions.md](LEAN-deletions.md) | Lean | Deps/dedup | ⚠ partial |
-| — | [ENHANCEMENTS.md](ENHANCEMENTS.md) | Nice-to-have | Various | mixed |
+
+Any commit whose diff references a crypto project other than `$THREE` needs explicit owner
+approval first (`CLAUDE.md`). The seed-regeneration item ends at exactly that gate by design.
## Global done criteria for every item
-- Change is minimal and matches surrounding code style.
-- `npm test` still passes (or the relevant test is added).
-- A `data/changelog.json` entry is added **only** if the change is user-visible
- (security/reliability fixes usually are; internal refactors are not).
-- `git diff` self-reviewed before commit; commit message is specific and neutral.
+
+- The change is minimal and matches surrounding code style.
+- `npm test` still passes, or the relevant test is added.
+- A `data/changelog.json` entry only if the change is user-visible or operator-visible.
+- `git diff` self-reviewed before commit; the commit message is specific and neutral.
diff --git a/prompts/fable-audit/ENHANCEMENTS.md b/prompts/fable-audit/ENHANCEMENTS.md
deleted file mode 100644
index a0055325e..000000000
--- a/prompts/fable-audit/ENHANCEMENTS.md
+++ /dev/null
@@ -1,293 +0,0 @@
-# ENHANCEMENTS: 10x ideas, ranked by effort-to-impact
-
-**Severity:** Nice-to-have · Do these after the Critical/High items land.
-
-**Status legend:** DONE (landed, with evidence) · REMAINING (deliberately not done, with the reason).
-
-| # | Item | Status |
-|---|------|--------|
-| 1 | `.gcloudignore` upload smoke test | DONE |
-| 2 | Durable spent-nonce record for side-effecting paid routes | DONE |
-| 3 | Centralize the `[email protected]` version pin | DONE |
-| 4 | "Untrusted content" clause across ingest-then-decide skills | DONE |
-| 5 | OIDC-authenticated invoker for `/api/cron/*` | REMAINING |
-| 6 | Split god files | REMAINING |
-| 7 | Observability: payment-outcome dashboard | REMAINING |
-
-## 1. Deploy-time smoke test against the uploaded `.gcloudignore` file set (highest ROI)
-
-`.gcloudignore` uses a `/*` deny + allowlist. Its own comments record that a missing
-`!/agents/` 500'd `api/x402/fact-check.js` in every deployed revision, and a missing
-worker path broke the sniper build: prod-only `ERR_MODULE_NOT_FOUND`s. Add a build
-step that boots `server/index.mjs` (and touches a representative set of routes)
-against exactly the files that survive `.gcloudignore`, so a missing re-include
-**fails the build, not prod**. Low effort, kills a recurring outage class.
-
-**DONE. `scripts/check-gcloudignore.mjs`, `npm run check:gcloudignore`.**
-
-Rather than boot the server against a copied tree (minutes per run, and it only
-proves the routes it happens to touch), the script resolves the real
-`.gcloudignore` against the real tree with gcloud's own semantics: gitignore
-syntax, last match wins, and an excluded directory is pruned so a `!` rule
-underneath it cannot re-include anything. It then asserts BOTH directions of the
-allowlist, where the boot test would only have covered one:
-
-- **REQUIRED**: `server/`, `api/`, `package.json`, `vercel.json`, plus the paths
- whose omission caused the two recorded outages (`agents/`, `Dockerfile`,
- `agent-payments-sdk/`, `data/`, `public/`). A required path absent from the
- working tree is reported and skipped, never failed.
-- **FORBIDDEN**: `.env`, `.env.local`, `.env.*.local`, `.x402-ring-secrets.json`,
- `three.ws-log-export-*.json`, `*.pem`, `*.key`. The upload is a copy we do not
- control, so a secret swept in by a broad re-include is the failure mode that
- never announces itself.
-
-`.pem` and `.key` are confirmed against their bytes, not their names: vendored
-dependencies ship public CA bundles (pip's certifi does), and a check that cries
-wolf is a check people stop reading. A PEM private-key header fails; public
-certificate armour is cleared and counted; anything unreadable or unrecognised
-fails, so the sniff is only ever wrong in the safe direction.
-
-Verified both ways, not just on the green path:
-
-```
-$ node scripts/check-gcloudignore.mjs
- patterns: 36
- uploaded: 21999 file(s) across 2437 director(ies)
- secrets: none of the forbidden patterns would be uploaded
- cleared: 2 key-shaped file(s) verified public (--list to see them)
- required: every required build input survives the ignore rules
-OK: the build context is complete and carries no secrets.
-
-# a planted RSA key, a planted data/.env and a planted .key, all inside
-# re-included directories:
-FAIL: 3 secret-shaped file(s) would be uploaded:
- data/.env (.env: secret by name)
- data/__gcheck-tmp.pem (*.pem: contains a PEM private key)
- scripts/__gcheck-tmp.key (*.key: no public-certificate armour, treated as secret)
-
-# the historical outage, replayed via --ignore-file with `!/agents/` deleted:
-FAIL: 1 required input(s) would be EXCLUDED:
- agents: api/x402/fact-check.js + tutor.js import ../../agents/*
-```
-
-`--ignore-file <path>` resolves a PROPOSED ruleset against this tree, so a
-`.gcloudignore` edit can be proved safe before it is committed. `--list` prints
-the per-top-level-directory file counts. Dependency-free, so it runs in a clean
-deploy worktree with no `node_modules`. Wire it into `server/cloudbuild.yaml`
-ahead of the image build (owner approval gate 2 covers touching the deploy
-config), or run it from the deploy runbook next to `check:dist`.
-
-**Finding surfaced by the first run (not fixed here, out of scope):** the local
-tree uploads roughly 10.5k files from `workers/`, including
-`workers/avatar-reconstruction/.venv-eval` (a Python virtualenv). It is
-`.gitignore`d, so a deploy submitted from the runbook's clean
-`git worktree add --detach` context does not carry it, but a submit from this
-working directory would. A `**/.venv*/` re-exclude in `.gcloudignore` closes it.
-
-## 2. Durable spent-nonce record for side-effecting paid routes
-
-The always-on replay key (`proof:<paymentHash>`) is cached only for the idempotency
-TTL ([x402-paid-endpoint.js](../../api/_lib/x402-paid-endpoint.js)). After it
-expires, a captured `X-PAYMENT` header can re-enter the handler and re-run side
-effects (on-chain double-settle is already prevented). Persist a durable
-spent-payment-hash record for side-effecting routes, independent of cache TTL.
-Complements H2/H3.
-
-**DONE. Migration `20260729140000_x402_spent_payments.sql`, module
-`api/_lib/x402/spent-payments.js`, wired in `api/_lib/x402-paid-endpoint.js`.**
-
-- **Table**: `x402_spent_payments (payment_hash PK, endpoint, amount_atomics,
- created_at)` plus `x402_spent_payments_created_at_idx` for retention. No payer,
- header or payload is stored: the hash is one-way, so the table cannot be mined
- for payment material. `endpoint` and `amount_atomics` exist so an operator can
- read what was bought without joining the audit ledger.
-- **Lookup before the handler**: one indexed read, placed after the idempotency
- cache check and before `verifyPayment`, so a replay never reaches the side
- effects and never costs a facilitator round-trip. Rejects with `409
- payment_replayed` and `x-x402-idempotent: replayed`, distinct from the existing
- `conflict` and `in-flight` 409s so a client can tell the three apart.
-- **Atomic claim at the end of settlement**: `INSERT … ON CONFLICT (payment_hash)
- DO NOTHING RETURNING`, the same race-proof arbiter shape as
- `x402/settle-credit.js`. Zero rows back means another request already honoured
- this proof, and the response is refused rather than delivered twice. It runs
- LAST, after settle and the SIWX/receipt steps, so a payment that settled and
- then failed downstream leaves no spent row and the payer's retry with the same
- header still works.
-- **Failure policy: FAIL OPEN, deliberately**, and it is the inverse of
- `settle-credit.js` on purpose. Refusing there costs a retry; refusing here
- would break every paid route for the length of a DB outage, on payments whose
- funds already moved. A missing table (a deploy that ran ahead of its migration)
- takes the same open path. The cache guard, the payment-identifier reservation
- and the on-chain settle-credit gate all stay in force meanwhile.
-- **Retention**: `api/cron/db-retention.js` prunes the table at 90 days on a
- FIXED window (`X402_SPENT_RETENTION_DAYS`, floor 30). It is deliberately exempt
- from the storage-pressure valve that tightens the other windows, because
- shortening this one is exactly what re-opens the replay hole. The rows are a
- hash, a route and an amount, so the table cannot be why the branch is under
- pressure.
-
-Tests: `tests/api/x402-spent-payments.test.js` drives the real `paidEndpoint()`
-and the real guard against an in-memory stand-in for the Neon `sql` tag. Seven
-cases: the row is recorded with route and amount; a replay after cache expiry is
-refused and the handler does not re-run; a streaming route is refused before a
-byte of the good ships; distinct payments are unaffected; a settle failure leaves
-no row so the retry works; a lost insert race is refused rather than delivered;
-and a dead DB fails open with the route still serving.
-
-```
-$ npx vitest run tests/api/x402-spent-payments.test.js \
- tests/api/x402-paid-endpoint-streaming.test.js
- Test Files 2 passed (2)
- Tests 12 passed (12)
-```
-
-`tests/api/x402-paid-endpoint-streaming.test.js` gained one line
-(`delete process.env.DATABASE_URL` in `beforeAll`): every case there replays the
-same X-PAYMENT proof, so with a real `DATABASE_URL` exported in the shell the
-suite would have written junk rows and then 409'd on its own second case.
-
-**Deploy note:** run `npm run db:migrate -- --apply` before or with the deploy.
-Shipping the code first is safe (a missing table means fail open, i.e. today's
-behaviour), but the guard is inert until the migration lands.
-
-## 3. Centralize the `[email protected]` version pin
-
-The version is baked into the skills, including permission strings like
-`allowed-tools: ["Bash(npx [email protected] send *)"]`. A version bump silently runs
-stale code **and** breaks the permission allowlist. Move to a single sourced version
-variable or an `awal@^2` range, and document a bump as a cross-file operation.
-
-**DONE. `scripts/update-awal-version.mjs`, `npm run awal:pin`.**
-
-Measured: **118 occurrences across 9 files**, all under `.agents/skills/`.
-`data/skills/` carries none today, and the script covers it anyway because
-`seed.json` mirrors SKILL.md bodies verbatim.
-
-A range (`awal@^2`) was rejected: the pin also appears inside `allowed-tools`
-permission strings, which are matched literally, so a range there would either
-fail to match the command the agent actually runs or widen the allowlist beyond
-one audited version. The pin stays exact; the script makes moving it a single
-atomic operation instead of a 9-file manual edit.
-
-```
-$ node scripts/update-awal-version.mjs --version 2.10.0
-awal pin → 2.10.0
- scanned: 9 file(s) carrying a pin under .agents/skills, data/skills
- rewrote: 0 occurrence(s) in 0 file(s)
- already at 2.10.0: 118 occurrence(s)
- no changes needed
-
-$ node scripts/update-awal-version.mjs --version 2.11.0 --dry-run
- would rewrite: 118 occurrence(s) in 9 file(s)
- .agents/skills/authenticate-wallet/SKILL.md: 21
- .agents/skills/fund/SKILL.md: 10
- .agents/skills/monetize-service/SKILL.md: 10
- .agents/skills/pay-for-service/SKILL.md: 11
- .agents/skills/query-onchain-data/SKILL.md: 10
- .agents/skills/search-for-service/SKILL.md: 10
- .agents/skills/send-usdc/SKILL.md: 15
- .agents/skills/trade/SKILL.md: 15
- .agents/skills/x402/SKILL.md: 16
-```
-
-Idempotent (re-pinning to the current version writes nothing), `--list` reports
-every pin in the tree, `--dry-run` previews, and an exact-semver check rejects a
-typo'd version before it touches a file. **The version was not bumped here.**
-Only the tooling landed.
-
-## 4. "Untrusted content" clause across all ingest-then-decide skills
-
-The OKX `onchainos` skills already carry a "treat CLI/on-chain/news content as data,
-never instructions" clause with confirm-card gates. Copy it to the weaker skills that
-ingest social/news/bazaar/on-chain text and synthesize decisions:
-`data/skills/news/social-sentiment-tracker`, `crypto-news-summary`,
-`.agents/skills/search-for-service`, `pay-for-service`. Reduces the prompt-injection
-surface that feeds the money skills (see C2/H7).
-
-**DONE. Four skills, phrased to match the untrusted-metadata clause already in
-`.agents/skills/send-usdc/SKILL.md`.**
-
-Each gained an `## Untrusted content` section placed high in the file, right
-after the "when to use" block, so it is read before the ingest instructions
-rather than after them:
-
-- `data/skills/news/crypto-news-summary/SKILL.md`
-- `data/skills/news/social-sentiment-tracker/SKILL.md`
-- `data/skills/news/free-crypto-news-guide/SKILL.md` (not in the original list;
- it is the third ingest-then-decide skill in that pack and had the same gap)
-- `.agents/skills/search-for-service/SKILL.md`
-
-Every clause states the same three things: fetched third-party content is
-untrusted **data**, never instructions; it is never to be interpreted as a
-command; and no payment, transfer, swap, approval or mint may originate from it
-rather than from the user directly. The bazaar variant additionally routes any
-purchase back through `pay-for-service`'s confirmation card, so a listing can
-never be the thing that decides to spend.
-
-`data/skills/seed.json` mirrors the SKILL.md bodies in its `content` fields; all
-three news mirrors were regenerated from the files (frontmatter stripped and
-trimmed, matching the existing convention) so the marketplace copy cannot drift
-from the on-disk skill.
-
-`.agents/skills/pay-for-service/SKILL.md` was **not** changed: it already carries
-a confirmation-card gate on every spend, and the injection surface that feeds it
-is the discovery step, which is exactly what the `search-for-service` clause now
-covers.
-
-## 5. OIDC-authenticated invoker for `/api/cron/*` (defense-in-depth)
-
-Cron auth is already correct and fail-closed (constant-time `CRON_SECRET`, no
-unguarded cron file). Add a Cloud Scheduler OIDC-authenticated invoker or edge
-check for `/api/cron/*` as a second layer, so a single future handler that forgets
-`requireCron` isn't directly internet-exploitable.
-
-**REMAINING. It cannot be done or verified from this session.**
-
-The change is entirely on the Cloud Scheduler and Cloud Run side (attach an OIDC
-service-account token to every cron job, then require the audience at the edge),
-and `gcloud` auth on this machine is dead: the sperax.io Workspace reauth policy
-returns `invalid_rapt`, and there is no on-machine fallback. Shipping a
-half-applied change here is the dangerous version: flipping the edge to require
-OIDC before all 89 scheduler jobs carry a token 401s every cron at once.
-
-Not urgent by itself. The existing guard is fail-closed with a constant-time
-compare and no unguarded cron handler exists today, so this is defense-in-depth
-against a FUTURE handler that forgets `requireCron`. The cheap interim control is
-a test asserting every file under `api/cron/` calls the guard, and that belongs
-with the cron work rather than in this batch.
-
-Owner action to unblock: one `gcloud auth login`, after which the change is
-`gcloud scheduler jobs update http … --oidc-service-account-email …` across the
-job set plus the audience check at the edge.
-
-## 6. Split god files (maintainability, no runtime effect)
-
-`src/irl.js` (363KB), `src/marketplace.js` (332KB), `src/dashboard/dashboard.js`
-(238KB), `src/walk.js` (208KB) are hand-written single modules. Break each into
-feature-scoped modules behind the existing page-init entrypoint.
-
-**REMAINING, by design.** The original entry already says so: "Do this
-opportunistically when touching a file, not as a big-bang refactor."
-
-A batch refactor of four files totalling roughly 1.1 MB has no runtime effect,
-cannot be verified by anything narrower than a full browser sweep of four of the
-busiest pages, and would collide head-on with the other agents editing this
-worktree. The correct trigger is the next feature that opens one of these files:
-extract the region being touched, leave the entrypoint intact.
-
-## 7. Observability: payment-outcome dashboard
-
-The payment metrics already emit `recordPaymentMetric` (x402/failed/settled with
-reasons). Surface a small ops view of verify-reject rate, settle-fail rate, and
-sponsor-SOL balance vs floor, so the H2/M1 griefing classes become visible before
-they halt the economy.
-
-**REMAINING, out of scope for this batch** (no UI surface was in scope).
-
-Item 2 above added one new reason to the existing metric stream:
-`recordPaymentMetric({ kind: 'x402', status: 'failed', reason: 'payment_replayed' })`,
-emitted at both the pre-handler lookup and the post-settle claim, plus a
-`payment_replay_rejected` audit event carrying `metadata.stage`
-(`pre_handler` or `post_settle`). Replay rate is therefore already queryable and
-should be a panel on this dashboard when it is built, alongside verify-reject and
-settle-fail.
diff --git a/prompts/fable-audit/LEAN-deletions.md b/prompts/fable-audit/LEAN-deletions.md
deleted file mode 100644
index b4e978ef3..000000000
--- a/prompts/fable-audit/LEAN-deletions.md
+++ /dev/null
@@ -1,208 +0,0 @@
-# LEAN — Dependency removals & de-duplication
-
-**Severity:** Lean (no runtime bug) · **Area:** Deps / dedup · **Commit-gate:** ⚠ partial
-
-The repo is genuinely clean — no esbuild-trap files, no committed `dist/`, no
-fake-data arrays, no stub/TODO markers in first-party code. These are the real, small
-wins. Each is independent; do them as separate commits.
-
-> **Status (re-verified 2026-07-30):** only item 6 is still open. Items 1 and 2
-> have since landed: `grep -rn "node-fetch"` across `workers/`, `api/`, `src/`,
-> `packages/` and every `package.json` now returns nothing first-party (the sole
-> hit is a code sample inside a third-party skill doc in `data/skills/seed.json`),
-> and `query-string` is gone from the tree and from the root `package.json`.
-> Items 3, 4, 5 and 7 were closed on 2026-07-29, with 3 and 4 **withdrawn**:
-> every "unused" dependency there turned out to be load-bearing. See the
-> per-item notes and **Actual net** at the bottom.
-
-**Verify every removal with a peer-dependency check, a dynamic-import grep, and a
-build before deleting.** `npm ls <pkg>` is not sufficient: it does not distinguish a
-package required as a `peerDependency`, and a `from '<pkg>'` grep does not see
-`import('<pkg>')`. Both gaps produced false positives in this file (items 3 and 4).
-
-## 1. Remove `node-fetch` (highest-confidence)
-7 usage sites, **all** in `workers/` (agent-anchor, agent-screen-worker,
-agent-sniper). Node 24 has a global `fetch`. Migrate the 7 files (drop the
-`import fetch from 'node-fetch'` line), then remove the dep from the relevant
-`package.json`.
-- Verify: `grep -rn "node-fetch" workers/ api/ src/ packages/` → zero after; workers
- still run.
-
-## 2. Replace `query-string` with native `URLSearchParams`
-Exactly one call: [src/app.js:184](../../src/app.js) —
-`queryString.parse(location.hash)`. Replace with
-`Object.fromEntries(new URLSearchParams(location.hash.replace(/^#/, '')))` (adjust
-for the hash's actual format), remove the dep.
-- Verify: `grep -rn "query-string" src/ api/` → zero; the hash-parsing path works.
-
-## 3. ~~Remove zero-reference deps~~ (WITHDRAWN: all three are required peers)
-**Nothing removed. The "zero code references" reading was right and the conclusion
-was still wrong: every one of these is a non-optional `peerDependencies` entry of a
-package the root already depends on, so the root declaration is what satisfies it.
-They belong in `package.json` exactly as they are.** Same class as
-`@solana-program/stake` in the "Do NOT remove" list below.
-
-| Dep | Required by | Declared range |
-|---|---|---|
-| `@solana-program/compute-budget` | `helius-sdk` (peer, not optional) | `^0.15.0` (root pins `^0.15.0`) |
-| `@solana-program/system` | `helius-sdk` (peer, not optional) | `^0.12.0` |
-| `mppx` | `@bnb-chain/mpp` (peer, not optional; root dep at `^0.2.0`) | `^0.6.28` (root pins `^0.6.31`) |
-
-- Evidence: `node -e "console.log(require('./node_modules/helius-sdk/package.json').peerDependencies)"`
- → lists compute-budget, stake, system, token, `@solana/kit`; `peerDependenciesMeta`
- is `undefined`, so none are optional. Same check on `@bnb-chain/mpp` → `mppx`, `viem`.
-- Dropping them would leave the peer satisfied only by npm's auto-peer-install
- behaviour, which is not a contract worth depending on for a live payment/RPC path.
-- The lockfile-dependents sweep that found this: walk `package-lock.json`'s
- `packages` map and print every entry whose `dependencies`/`peerDependencies`
- mention the candidate. `npm ls <pkg>` alone does not distinguish a peer.
-
-## 4. ~~Relocate `axios` from root to `mcp-bridge/package.json`~~ (WITHDRAWN)
-**Nothing moved.** Root first-party code does use axios: `api/_lib/x402-user-payer.js:166`
-does `import('axios')` (a *dynamic* import, which is why a `from 'axios'` grep
-missed it) and hands the instance to `wrapAxiosWithPayment` from `@x402/axios`.
-`@x402/axios` also declares `axios` as a non-optional peer, and root code imports
-it. Native `fetch` cannot substitute: `wrapAxiosWithPayment` takes an axios
-instance by contract. `axios` stays a root dependency. (`mcp-bridge` and
-`character-studio` already declare their own copies, so the workspaces are fine
-either way.)
-
-## 5. De-duplicate SOL-price fetching: DONE (4 call sites migrated)
-Two canonical helpers, not one, because half these call sites price ETH/BNB/MATIC
-rather than SOL:
-- `api/_lib/sol-price.js` → `solPriceUsd()`: SOL spot, 60s cache, 7 sources.
-- `api/_lib/market-fallbacks.js` → `fetchCoinPriceUsd(id)` / `fetchCoinPriceUsdOrNull(id)`
- accepts any CoinGecko id; CoinGecko → DefiLlama → Kraken/Coinbase/Bitfinex.
-
-Migrated, each preserving its original failure contract:
-
-| File | Was | Now | Failure semantics kept |
-|---|---|---|---|
-| `api/_lib/agent-wallet.js` | bare CoinGecko ETH fetch + 5-min memo | `fetchCoinPriceUsd('ethereum')` + same 5-min memo | still **throws** when every source is down (callers divide by it to size a spend) |
-| `api/_lib/trust/subject-reputation.js` | bare CoinGecko fetch per chain native | `fetchCoinPriceUsdOrNull(cgId)` | still **null** on miss → holdings dimension unavailable, never an error |
-| `api/_lib/x402/pipelines/cross-chain-cost.js` | one CoinGecko call for `solana,ethereum` | `solPriceUsd()` ‖ `fetchCoinPriceUsdOrNull('ethereum')` | still **`{sol:null, eth:null}`** on failure → USD columns blank, gas units still recorded |
-| `api/pump/helius-stats.js` | bare CoinGecko fetch + private 60s cache + staleness flag | `solPriceUsd()` + new `solPriceInfo()` / `solChange24hPct()` | `sol_price_stale` and `sol_change_24h` unchanged on the wire |
-
-New in `api/_lib/sol-price.js` (needed to retire the last private cache):
-- `solPriceInfo()`: sync read of the shared cache, `{ price, at, stale, change24h }`.
- `stale` is true only when a good price is being served past its refresh window,
- so a page can still tell "couldn't refresh" from "no price yet".
-- `solChange24hPct()`: 24h delta, 5-min cache. Free when CoinGecko answered the
- price call; otherwise CoinGecko → DefiLlama `/percentage`. This is a net gain:
- the old single-source field went null whenever CoinGecko rate-limited.
-
-Verified live (not mocked): `/api/pump/helius-stats` over a real HTTP round trip →
-`200`, `sol_price: 73.45`, `sol_change_24h: 0.269` (served by the DefiLlama
-fallback while CoinGecko was cooling), `cache-control: public, max-age=3`.
-`fetchCoinPriceUsd('ethereum')` → `1903.72`; `fetchCoinPriceUsdOrNull('binancecoin')`
-→ `568.11`; a bogus id → `null`.
-
-**Still inline (not touched, out of this pass's scope):** `avatar-wallet.js` and
-`balances.js` already route through `solPriceUsd()` for SOL but keep a separate
-inline ETH read; `x402/pipelines/sniper-intel-enrich.js`, `api/coin/exchange.js`,
-`api/cron/news-archive-append.js` were not audited here. `src/shared/usd-price.js`
-stays as-is: different runtime (browser), deliberate copy.
-
-## 6. Generate `data/skills/seed.json` from source (bloat + drift)
-`seed.json` (2,701 lines, ~796KB) embeds verbatim copies of ~115 individual
-`SKILL.md` bodies — the largest file in the tree; every skill fix must be made twice
-(e.g. finding M4 lives in both). Add a build step that generates `seed.json` (and the
-`public/skills/`, `dist/`, `examples/skills/` copies) from the source `SKILL.md`
-files. **⚠ some skill bodies reference other coins → the regeneration diff may hit the
-commit gate; check before staging.** Larger effort — treat as its own task.
-
-**Tooling DONE (2026-07-31): `scripts/build-skills-seed.mjs`, `npm run
-build:skills-seed` / `check:skills-seed`.** Corrections to the entry above,
-verified against the tree: there are no `public/skills/`, `dist/`, or
-`examples/skills/` copies of seed.json (those dirs hold unrelated example
-packs), so the single `data/skills/seed.json` is the only generated artifact.
-Builtin entries regenerate wholly from `data/skills/<category>/<id>/SKILL.md`
-(content = body.trim(), manifest = frontmatter); the two vendored metamask
-entries regenerate their content from the vendor body + the marketplace
-trailer while carrying their hand-curated manifest/category over from the
-existing entry. `--check` is the drift gate; the first run caught 5 real
-drifts (a block-scalar description stored literally for one trading skill, a
-deleted sentence still present in another's seed copy, an edited erc8004
-description never mirrored) plus the stale `total: 113` (real count 115).
-**The regeneration itself is NOT committed:** its 14-line diff touches
-other-project skill content, so `node scripts/build-skills-seed.mjs` + commit
-awaits owner approval per the commit gate. Verified idempotent: regenerate,
-then `--check` passes and a second run writes nothing.
-
-## 7. De-duplicate draco vendor libs: DONE
-Correction to the original finding: the files were **never committed**. Both trees
-were gitignored and regenerated from `node_modules/three` by
-`scripts/copy-three-decoders.mjs` at postinstall, which wrote the same source to two
-destinations. So the waste was in the deployed image (~3.3 MB shipped twice), not in
-git. All 9 files verified byte-identical by md5 before deleting.
-
-Now one canonical copy at `/three/draco/`, shared by both apps:
-- `scripts/copy-three-decoders.mjs`: dropped the second destination; also removes a
- stale `public/scene-studio/draco/` from existing checkouts on the next install.
-- `src/scene-studio/loader.js:31`, `src/scene-studio/vendor/js/Loader.js:296,1115`,
- `pages/scene.html:70`: `setDecoderPath`/`<script src>` repointed to `/three/draco/`.
- Same-origin absolute paths, so the shared copy resolves from the subapp unchanged.
-- `.gitignore`: dropped the now-dead `public/scene-studio/draco/` rule.
-- `scripts/audit-deploy-artifacts.mjs`: the dist guard asserted
- `scene-studio/draco/draco_encoder.js`; now asserts `three/draco/draco_encoder.js`,
- and additionally `scene-studio/basis/basis_transcoder.wasm`, which Scene Studio's
- KTX2 loader needs and nothing was guarding.
-- `docs/ux-flows/03-3d-editing-viewer.md`: decoder path corrected.
-- `public/scene-studio/basis/` is a genuinely separate, committed tree and stays.
-
-Verified: `node scripts/copy-three-decoders.mjs` regenerates only `public/three/`;
-`findMissingDistAssets()` → `{missing: []}` against a `dist/` with the duplicate
-removed; `grep -rn "scene-studio/draco"` over code/pages/scripts → zero (only this
-doc and the removal note in the copy script).
-
-## Do NOT remove (verified false positives)
-- `@solana-program/stake` — `helius-sdk` dynamically imports it; guarded by
- `scripts/audit-deploy-artifacts.mjs`.
-- `@solana-program/compute-budget`, `@solana-program/system`: same story as
- `stake`: non-optional `helius-sdk` peers. See item 3.
-- `mppx`: non-optional peer of `@bnb-chain/mpp`. See item 3.
-- `axios`: `api/_lib/x402-user-payer.js` dynamically imports it for
- `@x402/axios`. See item 4.
-- `wawa-lipsync` — real ESM import in `public/demos/lipsync-tts.html:147`.
-- `undici` — the custom SSRF dispatcher in `api/_lib/ssrf.js`.
-- `@x402/axios`, `@x402/fetch` — legit x402 plumbing.
-- `nanoid` — 2 sites; swap to `crypto.randomUUID()` is optional/low value (tiny dep).
-- The 3 vite configs (`vite.config.js`, `vite.config.artifact.js`, `vitest.config.js`)
- and `vercel.json` — all live/distinct.
-
-## Estimated net
-~4-5 deps dropped/relocated, ~7 files simplified, ~30-50 LOC of SOL-price dup
-removed. No large dead-code bonfire available — the repo doesn't carry that debt.
-
----
-
-## Actual net (2026-07-29 pass: items 3, 4, 5, 7)
-**0 deps removed, 4 price call sites deduped, ~3.3 MB dropped from the deployed image.**
-
-The dependency half of this audit does not survive contact with the lockfile: all
-four candidates (`@solana-program/compute-budget`, `@solana-program/system`, `mppx`,
-`axios`) are load-bearing: three as non-optional peers, one via a dynamic import
-the grep missed. `package.json` is unchanged, so `npm install --package-lock-only`
-was not needed and was not run.
-
-The dedup half was real and is done. Item 7's "committed" premise was wrong (both
-draco trees were generated and gitignored) but the duplication it pointed at was
-real in the shipped image.
-
-Still open from this file: items 1 (`node-fetch`), 2 (`query-string`), 6
-(`seed.json` generation). Item 6 remains its own task.
-
-**Standing lesson for the next dep sweep:** "zero imports" is not evidence a
-dependency is unused. Before removing anything, check (a) `peerDependencies` of
-every package that could require it, and (b) *dynamic* `import('<pkg>')` /
-`require('<pkg>')` call sites, which a `from '<pkg>'` grep will not find. Both
-checks were missed here and both would have produced broken installs.
-
-### Verification run
-- `npx vitest run` over the 12 suites covering the touched libs (`subject-reputation`,
- `market-fallbacks`, the 7 `agent-wallet-*`, `economy-rebalance`, `premium-pass`,
- `pump-bonding`) → **12 files / 161 tests passed**.
-- `node --check` on all 7 edited JS/MJS files → clean.
-- `npx eslint` on the same set → **0 errors** (only pre-existing `no-console`
- warnings in `scripts/`).
-- Live price reads against the real upstreams (no mocks). See item 5.
diff --git a/prompts/fable-audit/RESIDUALS.md b/prompts/fable-audit/RESIDUALS.md
new file mode 100644
index 000000000..7eecb8984
--- /dev/null
+++ b/prompts/fable-audit/RESIDUALS.md
@@ -0,0 +1,110 @@
+# FA-RESIDUALS: the three open items from the 2026-07-11 deep audit
+
+**How to run this:** paste this whole file into a fresh Claude Code chat opened in
+`/workspaces/three.ws`, or say "execute `prompts/fable-audit/RESIDUALS.md`". Each task below is
+independently shippable; do them in order and commit each as its own small, revertible commit.
+Also read `CLAUDE.md`.
+
+Everything else from that audit shipped and its work orders were retired; the findings, fixes
+and evidence remain readable in git history.
+
+## Binding operating clause
+
+1. Finish 100% of what this machine can do. Never end with a question about scope or design.
+2. Task 3 ends at a commit gate that only the owner can clear (its diff touches other-project
+ skill content). Prepare it completely, verify it, leave it staged-but-uncommitted, and say
+ so in one line. That is a finished task, not a blocked one.
+3. CLAUDE.md hard rules: no mocks, no TODO comments, no commented-out code, no em-dash or
+ en-dash characters. Stage explicit paths only. Deploys and pushes are owner-gated.
+
+## Task 1: OIDC-authenticated invoker for `/api/cron/*` (defense in depth)
+
+Cron auth is already correct and fail-closed (constant-time `CRON_SECRET`, no unguarded cron
+handler). This adds a second layer so a future handler that forgets the guard is not directly
+internet-exploitable.
+
+**Order matters and getting it wrong 401s every cron at once:** attach an OIDC service-account
+token to every Cloud Scheduler job FIRST, verify each job still succeeds, and only then require
+the audience at the edge.
+
+1. Cheap interim control, ship this regardless of cloud access: a test that asserts every file
+ under `api/cron/` calls the cron guard. Put it next to `tests/cron-auth-fail-closed.test.js`
+ and make it fail on a deliberately unguarded fixture before you trust it.
+2. `gcloud scheduler jobs update http <job> --oidc-service-account-email <the three-ws runtime SA>`
+ across the whole job set (enumerate from Cloud Scheduler, not from memory).
+3. Add the audience check at the edge in `server/index.mjs` for `/api/cron/*`, accepting the
+ existing `CRON_SECRET` path as well until every job is confirmed migrated.
+4. Verify by triggering one real job and reading its execution result, then remove nothing:
+ both layers stay.
+
+If `gcloud` auth is dead (`invalid_rapt`, the recurring sperax.io Workspace reauth policy), ship
+step 1, write steps 2 to 4 as exact ready-to-run commands in the report, and note that one
+`gcloud auth login` clears them.
+
+## Task 2: payment-outcome observability
+
+`recordPaymentMetric` in `api/_lib/axiom.js` already emits x402 verify, failed and settled
+events with reasons, including `payment_replayed` from the spent-payment guard. Nothing surfaces
+them, so the griefing classes the audit found are invisible until the economy halts.
+
+Ship an ops view (follow the existing internal-page pattern, for example `/quality-bench`, which
+is deliberately not in `data/pages.json`) showing, over a selectable window:
+
+- verify-reject rate and the top reject reasons;
+- settle-fail rate and the top failure reasons;
+- replay-rejection rate split by stage (`pre_handler` vs `post_settle`);
+- sponsor and fee-wallet SOL balance against the configured floor, because settle-floor
+ starvation and dry wallets look identical from outside and have opposite fixes.
+
+Real data only, from the real metric stream and the real ledger. No sample arrays, no synthetic
+series. Designed empty, loading and error states. Document it in `docs/` and add a
+`STRUCTURE.md` row.
+
+## Task 3: regenerate `data/skills/seed.json` from source
+
+The generator and drift gate already exist: `scripts/build-skills-seed.mjs`,
+`npm run build:skills-seed`, `npm run check:skills-seed`. The regeneration itself was never
+committed because its diff touches skill bodies that reference other crypto projects.
+
+1. Run `npm run check:skills-seed` and record every drift it reports.
+2. Run `npm run build:skills-seed`, then `check:skills-seed` again (it must pass) and a second
+ build (it must write nothing: the generator is idempotent).
+3. Review the diff line by line. Anything referencing a crypto project other than $THREE means
+ the commit needs explicit owner approval.
+4. Leave it staged and uncommitted, and state in one line exactly what the owner is approving.
+
+## Deliberately not a task
+
+**Splitting the god files** (`src/irl.js` ~386 KB, `src/marketplace.js` ~342 KB,
+`src/dashboard/dashboard.js` ~238 KB, `src/walk.js` ~216 KB). A batch refactor of 1.1 MB has no
+runtime effect, cannot be verified by anything narrower than a full browser sweep of four of the
+busiest pages, and would collide head-on with the other agents editing this worktree. The
+correct trigger is the next feature that opens one of these files: extract the region being
+touched and leave the entrypoint intact. Do not schedule it as its own session.
+
+## Definition of done
+
+- [ ] Task 1: the guard test exists and fails on an unguarded fixture; the OIDC steps are either
+ executed and verified against a real job run, or written as exact commands with the reason.
+- [ ] Task 2: the ops view renders real metrics, with designed empty, loading and error states,
+ verified in a real browser; documented and rowed in `STRUCTURE.md`.
+- [ ] Task 3: `npm run check:skills-seed` passes after regeneration, the build is idempotent,
+ and the diff is staged with the one-line approval request.
+- [ ] `npm test` green; `npm run gate` no worse than when you started.
+- [ ] `npm run check:rules -- --paths <files you touched>` clean.
+- [ ] `data/changelog.json` entry only for what users or operators can see (task 2 qualifies;
+ tasks 1 and 3 do not).
+
+## Never blocked (pre-answered)
+
+| Blocker | Do this |
+|---|---|
+| `gcloud` auth dead | Expected and recurring. Ship the non-cloud half in full, write the cloud half as exact commands, and name the single `gcloud auth login`. |
+| The metric stream looks empty | Check whether the sink is configured on the running service before assuming there is no traffic; an unset sink and zero payments look the same. |
+| The seed regeneration hits the commit gate | That is the designed end state. Stage it, do not commit, and say what is being approved. |
+| A metric page needs a new dependency | Use the existing page and chart patterns in the repo. Do not add a charting library for one internal page. |
+
+## Report format
+
+Per task: what shipped, what is staged for approval, the exact owner commands if any, and the
+verification output. No recap of this file.
diff --git a/prompts/fix-queue/00-INDEX.md b/prompts/fix-queue/00-INDEX.md
new file mode 100644
index 000000000..dfb261a7a
--- /dev/null
+++ b/prompts/fix-queue/00-INDEX.md
@@ -0,0 +1,72 @@
+# fix-queue: open defects and errors, one work order per file
+
+Every file in this directory is a self-contained prompt. Paste one into a fresh
+Claude Code chat in this repo and run it to 100% without further input. Read
+this index first; every work order assumes it.
+
+Opened 2026-08-01 from a live sweep of this worktree and of production. Each
+symptom below was reproduced on that date, with the exact command and output
+recorded in the work order. Nothing here is speculative.
+
+## Shared facts (verified 2026-08-01)
+
+- **Production is current.** `GET https://three.ws/api/version` returns
+ `6cc0370dc`, which is `main` HEAD, on revision `three-ws-api-00353-tzp`. So
+ the usual first question ("is this just a deploy gap?") is already answered:
+ it is not. Re-check it anyway before you debug a production symptom, because
+ `main` moves.
+- **`gcloud` auth works from this workspace** (`gcloud scheduler jobs list`
+ succeeded). This has historically been flaky (Workspace reauth policy), so if
+ a gcloud call returns `invalid_rapt`, that is the known failure and needs one
+ `gcloud auth login` from the owner. Do not redesign around it.
+- **Project `aerial-vehicle-466722-p5`, region `us-central1`, service
+ `three-ws-api`.**
+- **The repo gate is currently RED.** `npm run gate` exits 1 on
+ `audit:hidden-guard`. Work order 04 fixes it. If you are running a different
+ work order, capture that known-red baseline first so you do not get blamed
+ for it, and do not let it stop you.
+- **Concurrent agents share this worktree.** Stage explicit paths, never
+ `git add -A`, and re-read a file before editing it if your task has been
+ running a while.
+
+## Rules that apply to every work order here
+
+1. CLAUDE.md wins over anything written here. No mocks, no fake data, no TODOs,
+ no stubs, no commented-out code.
+2. Do not stop to ask. The self-unblock playbook in CLAUDE.md covers every
+ blocker these work orders can hit. Finish, then report.
+3. Deploys and pushes stay owner-gated. Prepare everything so shipping is one
+ command, and say so in your report.
+4. Never top up per-agent x402 wallets. That strands SOL and kills the rail.
+5. A fix is not done until it is verified by the command named in the work
+ order, and the changelog entry (if user-visible) is written.
+
+## The queue
+
+| # | Work order | Severity | Blocked on |
+|---|---|---|---|
+| 01 | [x402 settle is DOWN at 26%](01-x402-settle-down.md) | P0 | nothing (diagnose first) |
+| 02 | [Two of three paid Solana RPC lanes are exhausted](02-solana-rpc-paid-lanes.md) | P0 | owner (money), work is routing |
+| 03 | [Every paid LLM backstop is dead](03-llm-paid-backstops.md) | P1 | owner (billing), work is failover proof |
+| 04 | [The gate is red: missing hidden guard](04-gate-red-hidden-guard.md) | P0 repo | nothing |
+| 05 | [Three eslint errors and 7804 warnings](05-lint-errors.md) | P1 | nothing |
+| 06 | [A declared cron never runs in production](06-cron-drift-garment-sweep.md) | P1 | nothing |
+| 07 | [17 broken stops in the guided tour](07-tour-atlas-broken-stops.md) | P1 | nothing |
+| 08 | [108 dead `#` links across the site](08-stub-hrefs-dead-paths.md) | P2 | nothing |
+| 09 | [A documented API call no longer answers as documented](09-runnable-docs-401.md) | P2 | nothing |
+| 10 | [`npm run test:core` never finishes](10-test-core-timeout.md) | P1 | nothing |
+| 11 | [`/api/avatar/optimize?draco=1` is 500 in production](11-avatar-optimize-draco.md) | P1 | owner (deploy) |
+| 12 | [Live R2 CORS does not match the script](12-r2-cors.md) | P2 | owner (one token) |
+| 13 | [The fact-check benchmark cannot be run](13-fact-check-benchmark.md) | P2 | owner (one credential) |
+| 14 | [Two external-venue blockers](14-external-venue-blockers.md) | P2 | owner. **Commit gate applies** |
+
+Work order 14 references crypto projects other than `$THREE`. Per CLAUDE.md,
+writing and working on it is fine, but **committing it needs explicit owner
+approval first.** The other thirteen carry no such constraint.
+
+## When you finish one
+
+Append a line to [PROGRESS.md](PROGRESS.md) with the date, the work order, what
+you changed, and the verification output. That file is the only memory between
+chats. Delete a work order file only when its fix is verified shipped, per the
+retirement policy in [../README.md](../README.md).
diff --git a/prompts/fix-queue/01-x402-settle-down.md b/prompts/fix-queue/01-x402-settle-down.md
new file mode 100644
index 000000000..69a764a4d
--- /dev/null
+++ b/prompts/fix-queue/01-x402-settle-down.md
@@ -0,0 +1,103 @@
+# 01. x402 settle is DOWN at 26%, and two different faults are stacked
+
+**Severity: P0.** Money path. Read [00-INDEX.md](00-INDEX.md) first.
+
+## Symptom (measured 2026-08-01 against production)
+
+`GET https://three.ws/api/healthz` reports the `x402_settle` subsystem as the
+only DOWN entry in an otherwise green fleet:
+
+```
+x402_settle down settle 26.1% (506/1938 paid attempts, 3 hours);
+ 1432 rail faults (http_502x1171, http_402x181, settle_failedx29)
+```
+
+The self-facilitator's own lifetime counters in the same response:
+
+```json
+"settle": { "ok": 4151, "failed": 85889,
+ "fail_reasons": { "fee_runway_exhausted": 85265, "broadcast_failed": 562,
+ "signature_already_settled": 56, "idempotent_replay": 4,
+ "not_confirmed": 2 } }
+"verify": { "ok": 90546, "rejected": 1531,
+ "reject_reasons": { "simulation_failed": 1531 } }
+```
+
+For contrast, `ISSUES.md` recorded 30.3% on 2026-07-31 with `http_502` dominant
+and near 78% on 2026-07-30. The rate has not recovered on its own.
+
+## What is actually being claimed here, and what is not
+
+Two distinct faults are stacked, and they have opposite fixes. Do not merge them.
+
+1. **`fee_runway_exhausted` (85,265 lifetime).** This is NOT an empty wallet. It
+ is the wallet-level fee governor refusing a settle because the wallet's daily
+ fee budget is spent, while the wallet is still above its hard SOL floor. The
+ decision and its exact reason string live in
+ [api/_lib/x402/wallet-fee-governor.js](../../api/_lib/x402/wallet-fee-governor.js)
+ (`fee_runway_exhausted:<spent>+<fee>><budget>`), applied at the one choke
+ point in
+ [api/_lib/x402/self-facilitator.js](../../api/_lib/x402/self-facilitator.js).
+ The distinct wallet-is-empty reason is `fee_wallet_below_floor`, and it does
+ not appear in the counters above. A config-shaped fault that looks exactly
+ like an empty wallet is the documented trap here.
+2. **`http_502` (1,171 in the 3h window).** Rail faults: broadcast failures with
+ empty simulation logs, `Blockhash not found`, malformed responses. These are
+ RPC-shaped and are downstream of work order
+ [02](02-solana-rpc-paid-lanes.md). They will not respond to any amount of
+ funding or governor tuning.
+
+## Run the triage agent first
+
+`.claude/agents/x402-economy-triage.md` exists precisely because
+"the wallets are dry" is the wrong answer most of the time. Invoke it, give it
+this file, and let it classify before you touch anything.
+
+## The job
+
+1. **Reproduce and split the failure set.** Query
+ `x402_self_facilitator_log` through the existing tooling, not hand SQL where
+ an endpoint already exists: `GET /api/x402/runway-lab` returns the live seed,
+ and `/economy-lab` runs the real admission logic client-side against it via
+ [api/_lib/x402/runway-sim.js](../../api/_lib/x402/runway-sim.js). Produce a
+ count per reason for the last 3h and the last 24h.
+2. **Confirm the amount-independence test.** Group failures by payment amount.
+ If the smallest bucket has the worst success ratio, insufficient funds cannot
+ be the cause, which is what `ISSUES.md` item 7 already found. Record the
+ table in your report. If the result has flipped since, say so loudly, because
+ it changes the fix.
+3. **Fix the governor half.** Decide, with the simulation rather than by feel,
+ whether the daily budget is genuinely too tight for current demand
+ (`X402_WALLET_FEE_RUNWAY_DAYS`, `X402_WALLET_FEE_MIN_BUDGET_LAMPORTS`) or
+ whether demand has grown past what the sponsor's balance can support. Then
+ either widen the governor on the Cloud Run service with
+ `gcloud run services update three-ws-api --region us-central1
+ --update-env-vars ...` (config-only updates are pre-approved; note that
+ `--set-env-vars` REPLACES the whole set and must never be used here), or cut
+ call volume with the ring cadence knobs. Show the projected runway from the
+ simulation before and after.
+4. **Do not lower `X402_SPONSOR_SOL_FLOOR_LAMPORTS`.** The hard floor is the
+ real protection and has already done its job once. The sponsor
+ (`WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW`) held 0.0318 SOL against a
+ measured 0.060 SOL/day burn on 2026-07-31, so also re-measure the balance and
+ the burn and put the current runway in your report. If it needs SOL, that is
+ an owner action of roughly 1 SOL (about 16 days); state it, do not wait on it.
+5. **Never top up per-agent wallets.** That strands SOL and kills the rail.
+6. **Leave the rail half to work order 02** and say so, rather than reporting
+ the settle rate as fixed when only one of the two faults moved.
+
+## Verification
+
+- `GET /api/healthz` `x402_settle` detail, re-read at least 30 minutes after the
+ change so the 3h window has moved.
+- `GET /api/ops/payment-outcomes` (the panel on `/admin/ops`, documented in
+ [docs/ops/payment-outcomes.md](../../docs/ops/payment-outcomes.md)) for
+ balance vs floor, measured burn, and runway.
+- The reason histogram from step 1, re-run, with `fee_runway_exhausted` down.
+
+## Done when
+
+`x402_settle` is no longer the dominant contributor to the DOWN verdict for the
+governor reason, the remaining failures are RPC-shaped only, the runway number
+on the payment-outcome board is truthful, and `ISSUES.md` items 6 and 7 are
+rewritten to match what you measured (or dropped if closed).
diff --git a/prompts/fix-queue/02-solana-rpc-paid-lanes.md b/prompts/fix-queue/02-solana-rpc-paid-lanes.md
new file mode 100644
index 000000000..a33a8d4bf
--- /dev/null
+++ b/prompts/fix-queue/02-solana-rpc-paid-lanes.md
@@ -0,0 +1,79 @@
+# 02. Two of three paid Solana RPC lanes are exhausted, and free lanes cap the settle rate
+
+**Severity: P0.** Solana is the home chain, so this is the highest-value
+infrastructure item in the queue. Read [00-INDEX.md](00-INDEX.md) first.
+
+## Symptom (measured 2026-08-01 against production)
+
+`GET https://three.ws/api/healthz`:
+
+```
+rpc_lanes ok 1/3 paid lanes serving
+helius ok premium RPC healthy
+```
+
+One paid lane is serving. The rail faults in work order
+[01](01-x402-settle-down.md) (`http_502` x1171 in 3h, `broadcast_failed`,
+`Blockhash not found`) are the downstream symptom: free lanes cap the achievable
+settle rate at roughly 82 to 95%, and the platform is currently well under that.
+
+`ISSUES.md` item 2 has the full history: Helius `-32429 max usage reached`,
+QuickNode `-32003 daily request limit reached`, and both Alchemy apps returning
+`429 Monthly capacity limit exceeded` (they share one account quota, so the
+second was never a spare). Note that `helius` currently reads healthy, so the
+lane set has partially recovered since that entry was written. Re-measure rather
+than trusting either document.
+
+## Two traps that have burned previous sessions
+
+1. **Probe with a metered call, never `getHealth`.** `getHealth` is unmetered
+ and returns `ok` on a fully exhausted endpoint. Use `getBalance`.
+2. **Pick the primary by call SHAPE, not by a probe that all lanes pass.** Every
+ free lane passes `getBalance`, `getLatestBlockhash` and
+ `getSignatureStatuses`, which makes them look interchangeable. On
+ `getTokenAccountsByOwner` filtered by `programId`, the call every token and
+ USDC balance reader makes constantly, PublicNode returns
+ `HTTP 403 blocked parameter: params.1.programId` and Leo RPC returns
+ `-32603`. Only MagicBlock and `mainnet-beta` serve it, which is why they hold
+ the top two slots. Promoting PublicNode is actively harmful.
+
+GCP credits cannot solve this: Blockchain Node Engine is Ethereum only, so there
+is no GCP-hosted Solana RPC to fail over to.
+
+## The job
+
+1. **Re-probe every lane** in `SOLANA_RPC_URL` and `SOLANA_RPC_FALLBACK_URLS`
+ (values on the Cloud Run service; read them with
+ `gcloud run services describe three-ws-api --region us-central1
+ --project aerial-vehicle-466722-p5 --format=yaml`) with a metered
+ `getBalance` AND a `getTokenAccountsByOwner` filtered by `programId`. Build a
+ capability matrix: lane, `getBalance` verdict, `getTokenAccountsByOwner`
+ verdict, error code.
+2. **Re-order the chain from that matrix**, primary first by capability then by
+ quota headroom. Apply with `--update-env-vars` only. Exhausted paid lanes
+ stay in the chain and re-enter rotation on their own when quota resets
+ (`QUOTA_COOLDOWN_MS` is 6h); do not delete them.
+3. **Check the 403-sizing fix shipped.** A `403` from PublicNode was once sized
+ as an auth failure and parked the whole node for 30 minutes on ordinary
+ traffic. Commit `61f3ae758` addresses it. Confirm it is in the running image
+ (`/api/version` vs `git log`), and if it is not, that is a reason to include
+ this in the next deploy, not a reason to promote PublicNode.
+4. **Quantify the ceiling.** Measure the settle success rate attributable to
+ lane faults specifically, so the owner sees what one restored paid plan buys.
+ That number is the entire business case for the spend.
+5. **Report the owner action in one line**: top up or upgrade one paid plan
+ (Helius, QuickNode, or Alchemy), or accept the free-lane ceiling. Do not
+ wait on it, and do not re-scope Solana work because of it.
+
+## Verification
+
+- Your capability matrix, re-run after the re-order, with the primary passing
+ both call shapes.
+- `GET /api/healthz` `rpc_lanes` detail.
+- The rail-fault count in `x402_settle` over a fresh 3h window.
+
+## Done when
+
+The primary lane serves both call shapes, the fallback order is justified by the
+matrix rather than by habit, `ISSUES.md` item 2 reflects the measured state, and
+the owner has a one-line spend decision with a number attached.
diff --git a/prompts/fix-queue/PROGRESS.md b/prompts/fix-queue/PROGRESS.md
new file mode 100644
index 000000000..3e02682fc
--- /dev/null
+++ b/prompts/fix-queue/PROGRESS.md
@@ -0,0 +1,12 @@
+# fix-queue progress log
+
+The only memory between chats. Append, never rewrite. Newest at the bottom.
+
+Format: `YYYY-MM-DD | work order | what changed | verification`.
+
+---
+
+2026-08-01 | pack opened | 14 work orders written from a live sweep of the
+worktree (`npm run gate`, `lint`, `audit:links`, `audit:tour-atlas`,
+`check:cron-drift`, `check:runnable-docs`) and of production
+(`/api/version`, `/api/healthz`) | baseline recorded in each work order
diff --git a/prompts/okx-ai/00-CONTEXT.md b/prompts/okx-ai/00-CONTEXT.md
index d536d5931..5ed5bed94 100644
--- a/prompts/okx-ai/00-CONTEXT.md
+++ b/prompts/okx-ai/00-CONTEXT.md
@@ -101,10 +101,10 @@ for the 6-digit OTP from that inbox and run `onchainos wallet verify <otp>`. Nev
| # | File | Depends on |
|---|---|---|
-| 01 | `01-protocol-research.md`, pin down the seller-side OKX payments spec |, |
-| 02 | `02-payments-integration.md`, implement OKX rail on our endpoint | 01 |
-| 03 | `03-service-decomposition.md`, split into micro-priced A2MCP services | 02 |
+| 01 | protocol research (retired, completed, in git history) | none |
+| 02 | payments integration (retired, completed, in git history) | 01 |
+| 03 | service decomposition (retired, completed, in git history) | 02 |
| 04 | `04-e2e-real-payment-test.md`, pay ourselves for real, verify settlement | 02, 03 |
-| 05 | `05-relisting-resubmission.md`, update #2632 + resubmit for review | 04 |
-| 06 | `06-agent-pfp-wedge.md`, the "avatars for OKX agents" flagship service | 02 (parallel ok) |
+| 05 | `05-relisting-resubmission.md`, update #2632 and resubmit for review | 04 |
+| 06 | Agent Identity Studio (retired 2026-08-01, verified shipped) | 02 |
| 07 | `07-final-audit-and-watch.md`, full audit, docs closure, approval watch | all |
diff --git a/prompts/okx-ai/README.md b/prompts/okx-ai/README.md
index ccf39eb59..6a098bbec 100644
--- a/prompts/okx-ai/README.md
+++ b/prompts/okx-ai/README.md
@@ -20,12 +20,15 @@ facts) and ends by appending to `PROGRESS.md` (the cross-chat handoff log).
| 1 | `01-protocol-research.md` (retired: completed, in git history) | Pin the seller-side payments spec from primary sources + live captures | done |
| 2 | `02-payments-integration.md` (retired: completed, in git history) | Implement the OKX rail on our endpoint, tested | done |
| 3 | `03-service-decomposition.md` (retired: completed, in git history) | Split into micro-priced services + free catalog | done |
-| 4 | `04-e2e-real-payment-test.md` | Pay ourselves for real; settlement + adversarial gauntlet | **wallet funding**, OTP |
-| 5 | `05-relisting-resubmission.md` | Update #2632 + resubmit for review | OTP; confirm on-chain writes |
-| 6 | `06-agent-pfp-wedge.md` | "Agent Identity Studio", avatars for OKX agents (parallel after 02) | funding for test buys |
-| 7 | `07-final-audit-and-watch.md` | Adversarial re-audit, docs closure, approval watch, launch runbook | OTP |
+| 4 | [04-e2e-real-payment-test.md](04-e2e-real-payment-test.md) | Pay ourselves for real; settlement + adversarial gauntlet | **wallet funding**, OTP |
+| 5 | [05-relisting-resubmission.md](05-relisting-resubmission.md) | Update #2632 + resubmit for review | OTP; confirm the on-chain write |
+| 6 | `06-agent-pfp-wedge.md` (retired 2026-08-01, verified shipped: `identity-studio` in `api/_lib/okx-catalog.js`, `api/_okx3d/identity.js`, the `/agent-identities` showcase in `data/pages.json`, `docs/agent-identities.md`) | "Agent Identity Studio", 3D avatars for OKX agents | done |
+| 7 | [07-final-audit-and-watch.md](07-final-audit-and-watch.md) | Adversarial re-audit, docs closure, approval watch, launch execution | OTP |
-Strict chain: 01 → 02 → 03 → 04 → 05 → 07. 06 can run any time after 02.
+Strict chain: 04, then 05, then 07. Each file is self-contained; paste it into a fresh chat.
+
+Both remaining human touchpoints are batched into one message per work order: the email OTP for
+`[email protected]`, and an explicit yes on any real payment. Everything else runs autonomously.
## Ground rules baked into every order
diff --git a/prompts/okx-ai/e2e-evidence/10-402-avatar.json b/prompts/okx-ai/e2e-evidence/10-402-avatar.json
new file mode 100644
index 000000000..f58173e39
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-avatar.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/avatar",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "500000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "500000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "500000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "500000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/avatar",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "500000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "500000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "500000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "500000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/avatar",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-fbx-export.json b/prompts/okx-ai/e2e-evidence/10-402-fbx-export.json
new file mode 100644
index 000000000..c716deb89
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-fbx-export.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/fbx-export",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "100000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "100000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/fbx-export",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "100000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "100000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/fbx-export",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-identity-studio.json b/prompts/okx-ai/e2e-evidence/10-402-identity-studio.json
new file mode 100644
index 000000000..479f24f0a
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-identity-studio.json
@@ -0,0 +1,795 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "error": "X-PAYMENT header is required",
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/identity-studio",
+ "description": "three.ws Agent Identity Studio, A2MCP (MCP Streamable HTTP) service that turns an AI agent's brand brief into a complete 3D identity: rigged GLB avatar + posed studio renders with an OKX-avatar-slot PFP crop. $1.50 per identity, USDC via x402; job status polling is free. Operated by three.ws.",
+ "mimeType": "application/json",
+ "serviceName": "three.ws Agent Identity Studio",
+ "tags": [
+ "x402",
+ "mcp",
+ "3d",
+ "avatar",
+ "identity"
+ ],
+ "iconUrl": "https://three.ws/favicon.ico"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "1500000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "10000000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump",
+ "extra": {
+ "name": "THREE",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "eip155:8453",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "eip155:8453",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "1000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ }
+ ],
+ "extensions": {
+ "bazaar": {
+ "discoverable": true,
+ "info": {
+ "input": {
+ "type": "http",
+ "method": "POST",
+ "body": {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "tools/call",
+ "params": {
+ "name": "validate_model",
+ "arguments": {
+ "url": "https://example.com/model.glb"
+ }
+ }
+ },
+ "bodyType": "json"
+ },
+ "output": {
+ "type": "json",
+ "example": {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "result": {
+ "content": [
+ {
+ "type": "text",
+ "text": "{\"ok\":true,\"warnings\":[],\"meta\":{\"vertices\":12345}}"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "http"
+ },
+ "method": {
+ "type": "string",
+ "enum": [
+ "POST",
+ "PUT",
+ "PATCH"
+ ]
+ },
+ "bodyType": {
+ "type": "string",
+ "enum": [
+ "json",
+ "form-data",
+ "text"
+ ]
+ },
+ "body": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "required": [
+ "jsonrpc",
+ "method"
+ ],
+ "properties": {
+ "jsonrpc": {
+ "type": "string",
+ "const": "2.0"
+ },
+ "id": {
+ "type": [
+ "string",
+ "number"
+ ]
+ },
+ "method": {
+ "type": "string",
+ "enum": [
+ "initialize",
+ "tools/list",
+ "tools/call",
+ "ping"
+ ],
+ "description": "MCP JSON-RPC method."
+ },
+ "params": {
+ "type": "object",
+ "description": "For tools/call: { name, arguments }. Tool names include validate_model, inspect_model, optimize_model, search_public_avatars, solana_register, solana_reputation, and others, see tools/list."
+ }
+ }
+ }
+ },
+ "required": [
+ "type",
+ "method",
+ "bodyType",
+ "body"
+ ],
+ "additionalProperties": false
+ },
+ "output": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string"
+ },
+ "example": {
+ "type": "object",
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "jsonrpc": {
+ "type": "string",
+ "const": "2.0"
+ },
+ "id": {
+ "type": [
+ "string",
+ "number"
+ ]
+ },
+ "result": {
+ "type": "object",
+ "properties": {
+ "content": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "type",
+ "text"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "text"
+ ]
+ },
+ "text": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "number"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "type"
+ ]
+ }
+ },
+ "required": [
+ "input"
+ ]
+ }
+ }
+ }
+ },
+ "body": {
+ "x402Version": 2,
+ "error": "X-PAYMENT header is required",
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/identity-studio",
+ "description": "three.ws Agent Identity Studio, A2MCP (MCP Streamable HTTP) service that turns an AI agent's brand brief into a complete 3D identity: rigged GLB avatar + posed studio renders with an OKX-avatar-slot PFP crop. $1.50 per identity, USDC via x402; job status polling is free. Operated by three.ws.",
+ "mimeType": "application/json",
+ "serviceName": "three.ws Agent Identity Studio",
+ "tags": [
+ "x402",
+ "mcp",
+ "3d",
+ "avatar",
+ "identity"
+ ],
+ "iconUrl": "https://three.ws/favicon.ico"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "1500000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "10000000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump",
+ "extra": {
+ "name": "THREE",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "eip155:8453",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "amount": "1000",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "network": "eip155:8453",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "1000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/identity-studio",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ }
+ ],
+ "extensions": {
+ "bazaar": {
+ "discoverable": true,
+ "info": {
+ "input": {
+ "type": "http",
+ "method": "POST",
+ "body": {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "tools/call",
+ "params": {
+ "name": "validate_model",
+ "arguments": {
+ "url": "https://example.com/model.glb"
+ }
+ }
+ },
+ "bodyType": "json"
+ },
+ "output": {
+ "type": "json",
+ "example": {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "result": {
+ "content": [
+ {
+ "type": "text",
+ "text": "{\"ok\":true,\"warnings\":[],\"meta\":{\"vertices\":12345}}"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "http"
+ },
+ "method": {
+ "type": "string",
+ "enum": [
+ "POST",
+ "PUT",
+ "PATCH"
+ ]
+ },
+ "bodyType": {
+ "type": "string",
+ "enum": [
+ "json",
+ "form-data",
+ "text"
+ ]
+ },
+ "body": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "required": [
+ "jsonrpc",
+ "method"
+ ],
+ "properties": {
+ "jsonrpc": {
+ "type": "string",
+ "const": "2.0"
+ },
+ "id": {
+ "type": [
+ "string",
+ "number"
+ ]
+ },
+ "method": {
+ "type": "string",
+ "enum": [
+ "initialize",
+ "tools/list",
+ "tools/call",
+ "ping"
+ ],
+ "description": "MCP JSON-RPC method."
+ },
+ "params": {
+ "type": "object",
+ "description": "For tools/call: { name, arguments }. Tool names include validate_model, inspect_model, optimize_model, search_public_avatars, solana_register, solana_reputation, and others, see tools/list."
+ }
+ }
+ }
+ },
+ "required": [
+ "type",
+ "method",
+ "bodyType",
+ "body"
+ ],
+ "additionalProperties": false
+ },
+ "output": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string"
+ },
+ "example": {
+ "type": "object",
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "jsonrpc": {
+ "type": "string",
+ "const": "2.0"
+ },
+ "id": {
+ "type": [
+ "string",
+ "number"
+ ]
+ },
+ "result": {
+ "type": "object",
+ "properties": {
+ "content": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "type",
+ "text"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "text"
+ ]
+ },
+ "text": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "number"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "type"
+ ]
+ }
+ },
+ "required": [
+ "input"
+ ]
+ }
+ },
+ "eip2612GasSponsoring": {
+ "info": {
+ "description": "The facilitator accepts EIP-2612 gasless Permit to `Permit2` canonical contract.",
+ "version": "1"
+ },
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "from": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the sender."
+ },
+ "asset": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the ERC-20 token contract."
+ },
+ "spender": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the spender (Canonical Permit2)."
+ },
+ "amount": {
+ "type": "string",
+ "pattern": "^[0-9]+$",
+ "description": "The amount to approve (uint256). Typically MaxUint."
+ },
+ "nonce": {
+ "type": "string",
+ "pattern": "^[0-9]+$",
+ "description": "The current nonce of the sender."
+ },
+ "deadline": {
+ "type": "string",
+ "pattern": "^[0-9]+$",
+ "description": "The timestamp at which the signature expires."
+ },
+ "signature": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "description": "The 65-byte concatenated signature (r, s, v) as a hex string."
+ },
+ "version": {
+ "type": "string",
+ "pattern": "^[0-9]+(\\.[0-9]+)*$",
+ "description": "Schema version identifier."
+ }
+ },
+ "required": [
+ "from",
+ "asset",
+ "spender",
+ "amount",
+ "nonce",
+ "deadline",
+ "signature",
+ "version"
+ ]
+ }
+ },
+ "erc20ApprovalGasSponsoring": {
+ "info": {
+ "description": "The facilitator broadcasts a pre-signed ERC-20 approve() transaction to grant Permit2 allowance.",
+ "version": "1"
+ },
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "from": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the sender (token owner)."
+ },
+ "asset": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the ERC-20 token contract."
+ },
+ "spender": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]{40}$",
+ "description": "The address of the spender (Canonical Permit2)."
+ },
+ "amount": {
+ "type": "string",
+ "pattern": "^[0-9]+$",
+ "description": "The amount approved (uint256). Always MaxUint256."
+ },
+ "signedTransaction": {
+ "type": "string",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "description": "The RLP-encoded signed EIP-1559 transaction as a hex string."
+ },
+ "version": {
+ "type": "string",
+ "pattern": "^[0-9]+(\\.[0-9]+)*$",
+ "description": "Schema version identifier."
+ }
+ },
+ "required": [
+ "from",
+ "asset",
+ "spender",
+ "amount",
+ "signedTransaction",
+ "version"
+ ]
+ }
+ },
+ "offer-receipt": {
+ "includeTxHash": false,
+ "offerValiditySeconds": 60,
+ "info": {
+ "offers": [
+ {
+ "format": "jws",
+ "acceptIndex": 0,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxNTAwMDAwIiwiYXNzZXQiOiIweDc3OWRlZDBjOWUxMDIyMjI1ZjhlMDYzMGIzNWE5YjU0YmU3MTM3MzYiLCJuZXR3b3JrIjoiZWlwMTU1OjE5NiIsInBheVRvIjoiMHg0MDIyZGUyRDM2QzMzNEU3M0M3YTEwODgwNUNlYTExQzA1NjRmNDAyIiwicmVzb3VyY2VVcmwiOiJodHRwczovL3RocmVlLndzL2FwaS9va3gvM2QvaWRlbnRpdHktc3R1ZGlvIiwic2NoZW1lIjoiZXhhY3QiLCJ2YWxpZFVudGlsIjoxNzg1NjIwMzE4LCJ2ZXJzaW9uIjoxfQ.uSjy8Xn73p2wNNtP_NiWZ1J_J5gG3MChJFuPOXQxfJ--rD4XUcJrCmUwGXDOL02YCziuX1l5CW9yhA-sSqQlCQ"
+ },
+ {
+ "format": "jws",
+ "acceptIndex": 1,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxMDAwIiwiYXNzZXQiOiJFUGpGV2RkNUF1ZnFTU3FlTTJxTjF4enliYXBDOEc0d0VHR2tad3lURHQxdiIsIm5ldHdvcmsiOiJzb2xhbmE6NWV5a3Q0VXNGdjhQOE5KZFRSRXBZMXZ6cUtxWkt2ZHAiLCJwYXlUbyI6Ind3d3d3RHhGV1JuN2dyZ3IzRXNyc2c1QzZOdkRvREhTQTRnYUNmZmNjclUiLCJyZXNvdXJjZVVybCI6Imh0dHBzOi8vdGhyZWUud3MvYXBpL29reC8zZC9pZGVudGl0eS1zdHVkaW8iLCJzY2hlbWUiOiJleGFjdCIsInZhbGlkVW50aWwiOjE3ODU2MjAzMTgsInZlcnNpb24iOjF9._hMPP_eB3sAQKH8zUQ4sF2B9Ey_ttl5l5jD44kRC-UiO2TVYKX27JN2TuiaNko9BCqf79euMVe-p_Kamf-pDAQ"
+ },
+ {
+ "format": "jws",
+ "acceptIndex": 2,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxMDAwMDAwMCIsImFzc2V0IjoiRmVNYkRvWDdSMVBzYzRHRWN2SmRzYk5iWkEzYmZ6dGN5RENhdEpWSnB1bXAiLCJuZXR3b3JrIjoic29sYW5hOjVleWt0NFVzRnY4UDhOSmRUUkVwWTF2enFLcVpLdmRwIiwicGF5VG8iOiJ3d3d3d0R4RldSbjdncmdyM0VzcnNnNUM2TnZEb0RIU0E0Z2FDZmZjY3JVIiwicmVzb3VyY2VVcmwiOiJodHRwczovL3RocmVlLndzL2FwaS9va3gvM2QvaWRlbnRpdHktc3R1ZGlvIiwic2NoZW1lIjoiZXhhY3QiLCJ2YWxpZFVudGlsIjoxNzg1NjIwMzE4LCJ2ZXJzaW9uIjoxfQ.uY29GW0cHq7z85VFWZJq7EYnqGO2i9v2aNNmEfCYi9kjeWyvzTqXI9NEvGYo8ZDmSZY9pmrPZWalDnLjkD6DBA"
+ },
+ {
+ "format": "jws",
+ "acceptIndex": 3,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxMDAwIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJwYXlUbyI6IjB4NDAyMmRlMmQzNmMzMzRlNzNjN2ExMDg4MDVjZWExMWMwNTY0ZjQwMiIsInJlc291cmNlVXJsIjoiaHR0cHM6Ly90aHJlZS53cy9hcGkvb2t4LzNkL2lkZW50aXR5LXN0dWRpbyIsInNjaGVtZSI6ImV4YWN0IiwidmFsaWRVbnRpbCI6MTc4NTYyMDMxOCwidmVyc2lvbiI6MX0.GY2k834ETC4j1rduzt79iuQ_GXEOkaRs58zVZYbUfMYJEZLDDfqT07KnEJ8rA2dkmSxwSE4Pfmia1mPxLiuuBQ"
+ },
+ {
+ "format": "jws",
+ "acceptIndex": 4,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxMDAwIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJwYXlUbyI6IjB4NDAyMmRlMmQzNmMzMzRlNzNjN2ExMDg4MDVjZWExMWMwNTY0ZjQwMiIsInJlc291cmNlVXJsIjoiaHR0cHM6Ly90aHJlZS53cy9hcGkvb2t4LzNkL2lkZW50aXR5LXN0dWRpbyIsInNjaGVtZSI6ImV4YWN0IiwidmFsaWRVbnRpbCI6MTc4NTYyMDMxOCwidmVyc2lvbiI6MX0.GY2k834ETC4j1rduzt79iuQ_GXEOkaRs58zVZYbUfMYJEZLDDfqT07KnEJ8rA2dkmSxwSE4Pfmia1mPxLiuuBQ"
+ },
+ {
+ "format": "jws",
+ "acceptIndex": 5,
+ "signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDp3ZWI6dGhyZWUud3Mja2V5LTEifQ.eyJhbW91bnQiOiIxMDAwIiwiYXNzZXQiOiIweDc3OWRlZDBjOWUxMDIyMjI1ZjhlMDYzMGIzNWE5YjU0YmU3MTM3MzYiLCJuZXR3b3JrIjoiZWlwMTU1OjE5NiIsInBheVRvIjoiMHg0MDIyZGUyRDM2QzMzNEU3M0M3YTEwODgwNUNlYTExQzA1NjRmNDAyIiwicmVzb3VyY2VVcmwiOiJodHRwczovL3RocmVlLndzL2FwaS9va3gvM2QvaWRlbnRpdHktc3R1ZGlvIiwic2NoZW1lIjoiZXhhY3QiLCJ2YWxpZFVudGlsIjoxNzg1NjIwMzE4LCJ2ZXJzaW9uIjoxfQ.t0PolLtd6R8-YnLpIMxtgq9L57w54FA_5kGYiJf24qmOTT3rri-FcEX4FOyaHBtdO0912jXzfRVRnJt0P6VFDw"
+ }
+ ]
+ },
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "offers": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "type": "string"
+ },
+ "acceptIndex": {
+ "type": "integer"
+ },
+ "payload": {
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer"
+ },
+ "resourceUrl": {
+ "type": "string"
+ },
+ "scheme": {
+ "type": "string"
+ },
+ "network": {
+ "type": "string"
+ },
+ "asset": {
+ "type": "string"
+ },
+ "payTo": {
+ "type": "string"
+ },
+ "amount": {
+ "type": "string"
+ },
+ "validUntil": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "version",
+ "resourceUrl",
+ "scheme",
+ "network",
+ "asset",
+ "payTo",
+ "amount"
+ ]
+ },
+ "signature": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "format",
+ "signature"
+ ]
+ }
+ }
+ },
+ "required": [
+ "offers"
+ ]
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-image-to-3d.json b/prompts/okx-ai/e2e-evidence/10-402-image-to-3d.json
new file mode 100644
index 000000000..a8d1ae13c
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-image-to-3d.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/image-to-3d",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "300000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "300000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/image-to-3d",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "300000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "300000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/image-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-pose-seed.json b/prompts/okx-ai/e2e-evidence/10-402-pose-seed.json
new file mode 100644
index 000000000..1959ea63d
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-pose-seed.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/pose-seed",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "20000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "20000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "20000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "20000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/pose-seed",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "20000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "20000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "20000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "20000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/pose-seed",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-retarget.json b/prompts/okx-ai/e2e-evidence/10-402-retarget.json
new file mode 100644
index 000000000..237e4aea5
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-retarget.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/retarget",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "100000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "100000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/retarget",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "100000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "100000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "100000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/retarget",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-rig.json b/prompts/okx-ai/e2e-evidence/10-402-rig.json
new file mode 100644
index 000000000..7f62e8f51
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-rig.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/rig",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "250000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "250000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "250000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "250000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/rig",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "250000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "250000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "250000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "250000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/rig",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-text-to-3d-pro.json b/prompts/okx-ai/e2e-evidence/10-402-text-to-3d-pro.json
new file mode 100644
index 000000000..f56971b26
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-text-to-3d-pro.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "300000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "300000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "300000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "300000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "300000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d-pro",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/10-402-text-to-3d.json b/prompts/okx-ai/e2e-evidence/10-402-text-to-3d.json
new file mode 100644
index 000000000..da30093ce
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/10-402-text-to-3d.json
@@ -0,0 +1,141 @@
+{
+ "status": 402,
+ "challenge": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/text-to-3d",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "10000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "10000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "10000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "10000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ },
+ "body": {
+ "x402Version": 2,
+ "resource": {
+ "url": "https://three.ws/api/okx/3d/text-to-3d",
+ "mimeType": "application/json"
+ },
+ "accepts": [
+ {
+ "scheme": "exact",
+ "network": "eip155:196",
+ "amount": "10000",
+ "payTo": "0x4022de2D36C334E73C7a108805Cea11C0564f402",
+ "maxTimeoutSeconds": 86400,
+ "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "symbol": "USDT",
+ "name": "USD₮0",
+ "version": "1",
+ "transferMethod": "eip3009",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
+ "amount": "10000",
+ "payTo": "wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU",
+ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USDC",
+ "decimals": 6,
+ "feePayer": "WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "10000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6
+ }
+ },
+ {
+ "scheme": "exact",
+ "network": "eip155:8453",
+ "amount": "10000",
+ "payTo": "0x4022de2d36c334e73c7a108805cea11c0564f402",
+ "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
+ "maxTimeoutSeconds": 60,
+ "resource": "https://three.ws/api/okx/3d/text-to-3d",
+ "extra": {
+ "name": "USD Coin",
+ "version": "2",
+ "decimals": 6,
+ "assetTransferMethod": "permit2",
+ "supportsEip2612": true
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/20-5d-garbage-header.txt b/prompts/okx-ai/e2e-evidence/20-5d-garbage-header.txt
new file mode 100644
index 000000000..d9f7f64a7
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/20-5d-garbage-header.txt
@@ -0,0 +1,28 @@
+=== 5d-i: garbage x-payment header ===
+HTTP/2 400
+content-type: application/json; charset=utf-8
+x-frame-options: DENY
+cache-control: no-store
+vary: Accept-Encoding
+x-cloud-trace-context: 12b0fc1f2740137896845866bb612a20
+date: Sat, 01 Aug 2026 21:34:21 GMT
+server: Google Frontend
+content-length: 159
+via: 1.1 google
+alt-svc: h3=":443"; ma=2592000
+
+{"error":"invalid_payment","error_description":"X-PAYMENT JSON parse failed: Unexpected token '�', \"��~k��j_�k)��ߡy�^\" is not valid JSON"}
+=== 5d-ii: base64 of valid JSON but wrong shape ===
+HTTP/2 402
+content-type: application/json; charset=utf-8
+cache-control: no-store
+payment-required: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJYIExheWVyIHBheW1lbnQgbXVzdCBjYXJyeSBwYXlsb2FkLmF1dGhvcml6YXRpb24gKyBwYXlsb2FkLnNpZ25hdHVyZSAoRUlQLTMwMDkpIiwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly90aHJlZS53cy9hcGkvb2t4LzNkL3RleHQtdG8tM2QiLCJtaW1lVHlwZSI6ImFwcGxpY2F0aW9uL2pzb24ifSwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1OjE5NiIsImFtb3VudCI6IjEwMDAwIiwicGF5VG8iOiIweDQwMjJkZTJEMzZDMzM0RTczQzdhMTA4ODA1Q2VhMTFDMDU2NGY0MDIiLCJtYXhUaW1lb3V0U2Vjb25kcyI6ODY0MDAsImFzc2V0IjoiMHg3NzlkZWQwYzllMTAyMjIyNWY4ZTA2MzBiMzVhOWI1NGJlNzEzNzM2IiwicmVzb3VyY2UiOiJodHRwczovL3RocmVlLndzL2FwaS9va3gvM2QvdGV4dC10by0zZCIsImV4dHJhIjp7InN5bWJvbCI6IlVTRFQiLCJuYW1lIjoiVVNE4oKuMCIsInZlcnNpb24iOiIxIiwidHJhbnNmZXJNZXRob2QiOiJlaXAzMDA5IiwiZGVjaW1hbHMiOjZ9fSx7InNjaGVtZSI6ImV4YWN0IiwibmV0d29yayI6InNvbGFuYTo1ZXlrdDRVc0Z2OFA4TkpkVFJFcFkxdnpxS3FaS3ZkcCIsImFtb3VudCI6IjEwMDAwIiwicGF5VG8iOiJ3d3d3d0R4RldSbjdncmdyM0VzcnNnNUM2TnZEb0RIU0E0Z2FDZmZjY3JVIiwiYXNzZXQiOiJFUGpGV2RkNUF1ZnFTU3FlTTJxTjF4enliYXBDOEc0d0VHR2tad3lURHQxdiIsIm1heFRpbWVvdXRTZWNvbmRzIjo2MCwicmVzb3VyY2UiOiJodHRwczovL3RocmVlLndzL2FwaS9va3gvM2QvdGV4dC10by0zZCIsImV4dHJhIjp7Im5hbWUiOiJVU0RDIiwiZGVjaW1hbHMiOjYsImZlZVBheWVyIjoiV3d3dUdicUhyd0Y1Ukc4OUtoVWJtUldFdmpuUkg5azVrVk01cDdUM1d3VyJ9fSx7InNjaGVtZSI6ImV4YWN0IiwibmV0d29yayI6ImVpcDE1NTo4NDUzIiwiYW1vdW50IjoiMTAwMDAiLCJwYXlUbyI6IjB4NDAyMmRlMmQzNmMzMzRlNzNjN2ExMDg4MDVjZWExMWMwNTY0ZjQwMiIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwibWF4VGltZW91dFNlY29uZHMiOjYwLCJyZXNvdXJjZSI6Imh0dHBzOi8vdGhyZWUud3MvYXBpL29reC8zZC90ZXh0LXRvLTNkIiwiZXh0cmEiOnsibmFtZSI6IlVTRCBDb2luIiwidmVyc2lvbiI6IjIiLCJkZWNpbWFscyI6Nn19LHsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsInBheVRvIjoiMHg0MDIyZGUyZDM2YzMzNGU3M2M3YTEwODgwNWNlYTExYzA1NjRmNDAyIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJtYXhUaW1lb3V0U2Vjb25kcyI6NjAsInJlc291cmNlIjoiaHR0cHM6Ly90aHJlZS53cy9hcGkvb2t4LzNkL3RleHQtdG8tM2QiLCJleHRyYSI6eyJuYW1lIjoiVVNEIENvaW4iLCJ2ZXJzaW9uIjoiMiIsImRlY2ltYWxzIjo2LCJhc3NldFRyYW5zZmVyTWV0aG9kIjoicGVybWl0MiIsInN1cHBvcnRzRWlwMjYxMiI6dHJ1ZX19XX0=
+vary: Accept-Encoding
+x-cloud-trace-context: ffba66eb0c7630cb54d32c796dc967c1
+date: Sat, 01 Aug 2026 21:34:29 GMT
+server: Google Frontend
+content-length: 1562
+via: 1.1 google
+alt-svc: h3=":443"; ma=2592000
+
+{"x402Version":2,"error":"X Layer payment must carry payload.authorization + payload.signature (EIP-3009)","resource":{"url":"https://three.ws/api/okx/3d/text-to-3d","mimeType":"application/json"},"accepts":[{"scheme":"exact","network":"eip155:196","amount":"10000","payTo":"0x4022de2D36C334E73C7a108805Cea11C0564f402","maxTimeoutSeconds":86400,"asset":"0x779ded0c9e1022225f8e0630b35a9b54be713736","resource":"https://three.ws/api/okx/3d/text-to-3d","extra":{"symbol":"USDT","name":"USD₮0","version":"1","transferMethod":"eip3009","decimals":6}},{"scheme":"exact","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","amount":"10000","payTo":"wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU","asset":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","maxTimeoutSeconds":60,"resource":"https://three.ws/api/okx/3d/text-to-3d","extra":{"name":"USDC","decimals":6,"feePayer":"WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW"}},{"scheme":"exact","network":"eip155:8453","amount":"10000","payTo":"0x4022de2d36c334e73c7a108805cea11c0564f402","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","maxTimeoutSeconds":60,"resource":"https://three.ws/api/okx/3d/text-to-3d","extra":{"name":"USD Coin","version":"2","decimals":6}},{"scheme":"exact","network":"eip155:8453","amount":"10000","payTo":"0x4022de2d36c334e73c7a108805cea11c0564f402","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","maxTimeoutSeconds":60,"resource":"https://three.ws/api/okx/3d/text-to-3d","extra":{"name":"USD Coin","version":"2","decimals":6,"assetTransferMethod":"permit2","supportsEip2612":true}}]}
diff --git a/prompts/quality-bar/README.md b/prompts/quality-bar/README.md
index bde9ee34a..927d1618b 100644
--- a/prompts/quality-bar/README.md
+++ b/prompts/quality-bar/README.md
@@ -1,42 +1,41 @@
-# quality-bar: the $100k GCP-credit quality campaign
-
-> Retirement note (2026-07-28): work orders verified fully shipped were deleted from this pack per owner directive; their files remain in git history. Links below to missing files refer to retired, completed work orders. Remaining files are open or partial.
+# quality-bar: the GCP-credit quality campaign
Owner directive 2026-07-16: spend the Google Cloud credits liberally to make the platform's
-UX/UI excellent and 3D generations as real-looking as IRL people and objects. No new non-GCP
-paid APIs. Agents complete their prompt 100% and never stop to ask questions;
-`_shared.md` carries everything needed to make that possible. Read it before any prompt.
+UX and UI excellent and 3D generations as real-looking as IRL people and objects. No new
+non-GCP paid APIs. Agents complete their work order 100% and never stop to ask questions.
+
+**Read `_shared.md` before any work order.** Each work order is also self-contained: paste the
+file into a fresh Claude Code chat and it runs.
## The thesis
-IRL-real 3D is a chain, and every prompt owns one link:
+IRL-real 3D is a chain and every work order owns one link: photoreal reference images, then the
+strongest mesh and texture model at fleet scale, then complete PBR materials, then cinematic
+viewers, wrapped in a flagship UX, measured so it cannot regress, with humans as the hardest
+special case.
-photoreal reference images (01) -> strongest mesh+texture model (02) at fleet scale (03)
--> complete PBR materials (04) -> cinematic viewers (05), wrapped in a flagship UX (06, 07, 08),
-measured so it cannot regress (09), with humans as the hardest special case (10).
+## Open work orders
-## Prompts
+| # | File | Owns | State |
+|---|------|------|-------|
+| 03 | [03-gpu-fleet-scaleout.md](03-gpu-fleet-scaleout.md) | Scale ceilings, cold-start honesty, keep-warm, load test | Partial. The TripoSG and text2motion deploys it opened with are shipped; scale, cold-start UX and the load test are open. |
+| 04 | [04-pbr-texture-material-realism.md](04-pbr-texture-material-realism.md) | Full PBR sets, measured presets, skin/eye/hair | Open |
+| 06 | [06-forge-ux-flow.md](06-forge-ux-flow.md) | The `/forge` flagship experience | Partial. History, compare mode and starters shipped; the result-moment click-through and the clean audit sweep are open. |
+| 07 | [07-design-system-sweep.md](07-design-system-sweep.md) | Tokens, states, microinteractions sitewide | Open |
+| 08 | [08-mobile-performance.md](08-mobile-performance.md) | Mobile excellence, GLB delivery | Partial. A measured baseline exists in `_generated/08/`; the fixes and the re-measure are open. |
+| 10 | [10-avatar-likeness-irl-people.md](10-avatar-likeness-irl-people.md) | IRL people: likeness, hands, rig, AR | Partial. Animation dignity is proven across ten rig conventions; one runtime-lane defect plus the likeness audit are open. |
-| # | File | Owns | Depends on |
-|---|------|------|------------|
-| 01 | 01-photoreal-reference-pipeline.md | Vertex reference images at every entry point | none |
-| 02 | 02-hunyuan3d-flagship-lane.md | Hunyuan3D live and quality-leading | quota grant (in flight) |
-| 03 | 03-gpu-fleet-scaleout.md | TripoSG fix, text2motion, scale ceilings, cold-start UX | quota grant helps |
-| 04 | 04-pbr-texture-material-realism.md | Full PBR sets, skin/eye/hair materials | none |
-| 05 | 05-cinematic-viewers-everywhere.md | One rendering bar in every viewer | none |
-| 06 | 06-forge-ux-flow.md | /forge flagship experience | best after 01, 05 |
-| 07 | 07-design-system-sweep.md | Tokens, states, microinteractions sitewide | none |
-| 08 | 08-mobile-performance.md | Mobile excellence, GLB compression | best after 05 |
-| 09 | 09-realism-eval-harness.md (retired 2026-07-30, verified shipped) | Benchmark + Gemini judge + regression gate | run EARLY for the baseline |
-| 10 | 10-avatar-likeness-irl-people.md | IRL people: likeness, hands, rig, AR | best after 02, 04 |
+Retired after verification (readable in git history): 01 photoreal reference pipeline, 02 the
+Hunyuan3D flagship lane, 05 cinematic viewers, 09 the realism eval harness (now
+`scripts/quality-bench.mjs` plus the weekly cron).
-Run 09 first (baseline), then 01/04/05/07 in parallel (no dependencies), 02/03 as quota lands,
-then 06/08/10.
+Suggested order: 04, 07 and 08 have no dependencies and can run in parallel. 03 unblocks
+throughput. 06 and 10 land best after 04.
-## Ground rules recap (full versions in _shared.md and CLAUDE.md)
+## Ground rules recap (full versions in `_shared.md` and `CLAUDE.md`)
- GCP spend approved; no new external paid APIs; never trade quality for cost.
-- Pathspec commits only; concurrent agents share the worktree; no push/post without owner say-so
- (GCP deploys of surfaces your prompt owns ARE in scope for this campaign).
-- Every user-visible change: changelog entry. Every claim: verified, with the receipts in the
- final report. Blockers get documented and routed around, never asked about.
+- Explicit-path commits only; concurrent agents share this worktree; no push or external post
+ without the owner saying so. GCP deploys of the surface a work order owns are in scope.
+- Every user-visible change gets a `data/changelog.json` entry. Every claim is verified with the
+ receipts in the final report. Blockers are routed around and documented, never asked about.
diff --git a/prompts/robinhood-chain/00-INDEX.md b/prompts/robinhood-chain/00-INDEX.md
index 52e0d1e67..84e7fdf17 100644
--- a/prompts/robinhood-chain/00-INDEX.md
+++ b/prompts/robinhood-chain/00-INDEX.md
@@ -1,53 +1,65 @@
-# Robinhood Chain prompt pack — execution index
+# Robinhood Chain pack: execution index
-> Retirement note (2026-07-28): work orders verified fully shipped were deleted from this pack per owner directive; their files remain in git history. Links below to missing files refer to retired, completed work orders. Remaining files are open or partial.
+Robinhood in this workspace always means **Robinhood Crypto**, never equities or options
+(`CLAUDE.md`). Chain facts live in [_shared.md](_shared.md); the research behind the campaign is
+in [PLAN.md](PLAN.md). Facts in those two files override training data.
-Run order matters: later waves consume earlier waves' output. Within a wave, prompts are
-independent and can run concurrently. Every agent reads `_shared.md` first, then its prompt.
+## State: every work order in this pack has shipped and been retired
-> DO NOT DELETE PROMPT FILES — even after their work ships. This pack was wiped once by an
-> overzealous cleanup and had to be restored. Only the owner removes prompts.
+All 19 numbered work orders were completed and their files removed from the working tree; each
+remains readable in git history (`git log --diff-filter=D --name-only -- prompts/robinhood-chain/`).
+What they produced is on disk:
-## Wave 1 — foundation (run first, alone)
-| Prompt | Product | Folder | Status |
-|---|---|---|---|
-| [01-sdk-core.md](01-sdk-core.md) | Core TypeScript SDK (`hoodchain`) | `robinhood/robinhood-chain-sdk/` | DONE 2026-07-13 — write-path E2E proven with REAL MONEY on mainnet 4663 (swap tx `0x20ab04a4…2085`, WETH→USDG via SwapRouter02, 1.606331 USDG received). Supersedes the faucet-blocked testnet swap. |
-
-## Wave 2 — SDK consumers (run after 01 completes; all concurrent)
-| Prompt | Product | Folder |
-|---|---|---|
-| [02-sdk-simple-wrapper.md](02-sdk-simple-wrapper.md) | Dead-simple wrapper (`hood-js`) | `robinhood/hood-js/` |
-| [03-sdk-advanced-wrapper.md](03-sdk-advanced-wrapper.md) | Advanced toolkit (`hoodkit`) | `robinhood/hoodkit/` |
-| [04-market-data-api.md](04-market-data-api.md) | Hosted market-data API + x402 | `robinhood/hood-api/` |
-| [05-x402-usdg-rail.md](05-x402-usdg-rail.md) | x402 USDG middleware + facilitator | `robinhood/hood402/` |
-| 06-mcp-servers.md (retired 2026-07-30, verified shipped: [email protected] on npm, 13/13 tests green; owner residuals: faucet-funded swap hash, GitHub Pages enable) | MCP servers (data + trading) | `robinhood/hood-mcp/` |
-| [11-toolkit-cli.md](11-toolkit-cli.md) | CLI toolkit (`hood-cli`) | `robinhood/hood-cli/` |
-| [14-wallet-connect-kit.md](14-wallet-connect-kit.md) | Wallet & onboarding kit (`hood-connect`) | `robinhood/hood-connect/` |
-| [15-tokenlist.md](15-tokenlist.md) | Canonical token list (`hood-tokenlist`) | `robinhood/hood-tokenlist/` |
-| [17-erc8056.md](17-erc8056.md) | ERC-8056 reference (`erc8056`) | `robinhood/erc8056/` |
-| [18-status-page.md](18-status-page.md) | Chain status page (`hood-status`) | `robinhood/hood-status/` |
-
-## Wave 3 — applications (after wave 2; all concurrent)
-| Prompt | Product | Folder |
-|---|---|---|
-| [07-agent-trading.md](07-agent-trading.md) | Autonomous trading agents | `robinhood/hood-traders/` |
-| [08-agent-launcher.md](08-agent-launcher.md) | Autonomous coin launcher | `robinhood/hood-launcher/` |
-| 09-examples.md (retired 2026-07-30, verified shipped: all 14 examples built and run, captured output in every README, gallery works as static files) | Examples gallery | `robinhood/robinhood-chain-examples/` |
-| [12-threews-markets.md](12-threews-markets.md) | three.ws /markets display + purchase | in-repo (`api/`, `public/`) |
-| [13-threews-play.md](13-threews-play.md) | three.ws /play coin worlds + firehose | in-repo |
-| [16-alerts-bots.md](16-alerts-bots.md) | Telegram + Discord alert bots (`hood-alerts`) | `robinhood/hood-alerts/` |
-| [19-usdg-checkout.md](19-usdg-checkout.md) | USDG checkout for humans (`hood-pay`) | `robinhood/hood-pay/` |
-
-## Wave 4 — synthesis (last)
-| Prompt | Product | Folder |
+| Product | Folder | Kind |
|---|---|---|
-| [10-tutorials.md](10-tutorials.md) | Tutorial site (`learn-robinhood-chain`) | `robinhood/learn-robinhood-chain/` |
+| Core TypeScript SDK | `robinhood/robinhood-chain-sdk/` | standalone repo |
+| Simple wrapper | `robinhood/hood-js/` | standalone repo |
+| Advanced toolkit | `robinhood/hoodkit/` | standalone repo |
+| Market-data API + x402 | `robinhood/hood-api/` | standalone repo |
+| x402 USDG rail | `robinhood/hood402/` | standalone repo |
+| MCP servers | `robinhood/hood-mcp/` | standalone repo, published to npm |
+| CLI toolkit | `robinhood/hood-cli/` | standalone repo |
+| Wallet and onboarding kit | `robinhood/hood-connect/` | standalone repo |
+| Canonical token list | `robinhood/hood-tokenlist/` | standalone repo |
+| ERC-8056 reference | `robinhood/erc8056/` | standalone repo |
+| Chain status page | `robinhood/hood-status/` | standalone repo |
+| Trading agents | `robinhood/hood-traders/` | standalone repo |
+| Coin launcher | `robinhood/hood-launcher/` | standalone repo |
+| Alert bots | `robinhood/hood-alerts/` | standalone repo |
+| USDG checkout | `robinhood/hood-pay/` | standalone repo |
+| Examples gallery | `robinhood/robinhood-chain-examples/` | standalone repo |
+| Tutorial site | `robinhood/learn-robinhood-chain/` | standalone repo |
+| In-repo markets board | `pages/markets.html`, `api/v1/robinhood/*`, route `/markets/robinhood` | three.ws surface |
+| In-repo coin worlds and firehose | `api/robinhood/play-worlds.js`, `api/robinhood/coin-trades.js`, `workers/robinhood-feed/` | three.ws surface |
+
+## What is left, and it is all owner-side
+
+None of these is agent-executable from this machine:
+
+1. **npm publish.** Every package is publish-ready (`npm pack` clean, `files`, `exports`,
+ `types` set). The owner holds the token: `npm publish --access public` per package.
+2. **GitHub Pages.** Each standalone repo ships a static `docs/` site. Enable Settings, Pages,
+ main branch, `/docs` after the repo is pushed. No GitHub Actions anywhere in this project.
+3. **Repo extraction and push.** The folders under `robinhood/` deliberately have no `.git`.
+ The owner extracts and pushes them.
+4. **Testnet faucet funding.** The official faucet requires Turnstile plus Google Sign-In in a
+ real browser, so a shared test wallet must be funded once by hand.
+
+## If you want an agent pass over this pack
+
+There is no open work order, so give a specific instruction instead. Useful ones:
+
+- "Re-verify every repo under `robinhood/`: install, build, test, `npm pack`, and report which
+ ones are still green." Real on-chain reads against mainnet 4663 are free and unblocked.
+- "Refresh `_shared.md` against the live chain and the current viem chain defs."
+- "Audit the in-repo `/markets/robinhood` surface against the live APIs and fix what drifted."
## Non-negotiables recap
-- Read `_shared.md` before starting. Facts there override training data.
-- Standalone repos live under `robinhood/<name>/`, MIT © 2026 nirholas, no `git init`, no commits.
-- Prompts 12–13 modify the three.ws app itself — same commit gate: leave uncommitted.
-- Docs sites are static `/docs` folders (Pages deploy-from-branch). No GitHub Actions anywhere.
-- Done = tested + real on-chain evidence + docs + report. See `_shared.md` report format.
-Research backing this pack: [PLAN.md](PLAN.md).
+- Standalone repos live under `robinhood/<name>/`, MIT, copyright 2026 nirholas, no `git init`
+ inside them and no commits from an agent.
+- **Commit gate:** everything in this campaign references a crypto project other than `$THREE`,
+ so no commit that touches it ships without explicit owner approval (`CLAUDE.md`).
+- Stock Token display is unrestricted; any buy or swap flow carries the eligibility disclosure
+ and a config-level geo gate. Memecoins carry no such restriction.
+- Done means tested, with real on-chain evidence, docs, and a report. Format in `_shared.md`.
diff --git a/public/changelog.json b/public/changelog.json
index 2bd0f3f78..d19c36d9b 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-01T21:10:27.953Z",
+ "generated_at": "2026-08-01T21:31:58.559Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -78,6 +78,17 @@
"sdk"
]
},
+ {
+ "date": "2026-08-01",
+ "type": "update",
+ "title": "Your own avatar can sign now, not just the two that shipped with the page",
+ "summary": "Sign language ran on two fixed rigs. You could watch the platform's avatars sign, but never your own, which is backwards for a feature whose whole point is that an avatar communicates. The Avatar setting on the sign language page and the ASL alphabet page now has a third option that opens the avatar gallery: pick any avatar you own, or any public one, and it takes over the signing on the spot, keeping the speed and signing hand you already chose. Your pick is remembered and carries between both pages. It works because a sign is described anatomically, an index fingertip on the chin rather than a fixed coordinate, so the same vocabulary is measured onto your avatar's own skeleton, whatever its proportions. An avatar that genuinely cannot sign, a model with no skeleton or no finger bones, is not left standing there mute: the page says which avatar it is and puts the working one back.",
+ "link": "/sign-language",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-31",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index 3ccced39d..3ff420e75 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -62,6 +62,14 @@
<category>feature</category>
<description>Every animation clip in the library has been measured from its keyframes: how energetic it is, its tempo, which part of the body leads, whether it loops without a visible snap, and whether it survives as an upper-body overlay. The measurements power a new public API (GET /api/animations/signatures) with filters, slot-fit verdicts and a similar-clips ranking, plus two free MCP tools (animation_signature, find_similar_animations) so agents can pick clips the same way. The gestures page and the runtime defaults already run on the same numbers, so what you preview is what agents get.</description>
</item>
+ <item>
+ <title>Your own avatar can sign now, not just the two that shipped with the page</title>
+ <link>https://three.ws/sign-language</link>
+ <guid isPermaLink="false">2026-08-01:Your own avatar can sign now, not just the two that shipped with the page</guid>
+ <pubDate>Sat, 01 Aug 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Sign language ran on two fixed rigs. You could watch the platform's avatars sign, but never your own, which is backwards for a feature whose whole point is that an avatar communicates. The Avatar setting on the sign language page and the ASL alphabet page now has a third option that opens the avatar gallery: pick any avatar you own, or any public one, and it takes over the signing on the spot, keeping the speed and signing hand you already chose. Your pick is remembered and carries between both pages. It works because a sign is described anatomically, an index fingertip on the chin rather than a fixed coordinate, so the same vocabulary is measured onto your avatar's own skeleton, whatever its proportions. An avatar that genuinely cannot sign, a model with no skeleton or no finger bones, is not left standing there mute: the page says which avatar it is and puts the working one back.</description>
+ </item>
<item>
<title>.well-known/mcp.json</title>
<link>https://three.ws/.well-known/mcp.json</link>
diff --git a/public/features.json b/public/features.json
index 77e38eb4c..088f6f3bb 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-01T21:10:27.933Z",
+ "generated_at": "2026-08-01T21:31:58.458Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/tokens.css b/public/tokens.css
index 25439e4f3..d833f3cc7 100644
--- a/public/tokens.css
+++ b/public/tokens.css
@@ -206,6 +206,26 @@
opacity at the component level.) */
--ink-faint: rgba(255, 255, 255, 0.55);
+ /* Scrim + on-scrim ink (B14): the one part of the palette that must NOT flip
+ with the theme. A scrim sits on top of MEDIA (a screenshot, a video frame, a
+ 3D canvas, a modal backdrop), not on a page surface, so its job is legibility
+ over unknown pixels: it stays dark and its ink stays light in both themes.
+ Before this existed the platform had 400+ hand-rolled rgba(0,0,0,…) overlays
+ clustered around four values; these four ARE that cluster, deduped.
+ soft gradient legibility wash under captions
+ scrim standard chip / label resting on media
+ strong hover or pressed state of the above, heavy caption bars
+ modal full-screen backdrop behind a dialog or lightbox
+ Pair with --on-scrim* for text and hairlines; never with --ink*, which flips. */
+ --scrim-soft: rgba(0, 0, 0, 0.35);
+ --scrim: rgba(0, 0, 0, 0.55);
+ --scrim-strong: rgba(0, 0, 0, 0.78);
+ --scrim-modal: rgba(0, 0, 0, 0.60);
+ --on-scrim-bright: #ffffff;
+ --on-scrim: rgba(255, 255, 255, 0.82);
+ --on-scrim-dim: rgba(255, 255, 255, 0.64);
+ --on-scrim-stroke: rgba(255, 255, 255, 0.16);
+
/* Elevation / shadow (B01) — three depth tiers. Mirrors the component layer
in style.css so any surface can express depth without hand-rolling shadows.
1 = resting panel · 2 = card · 3 = lifted / hover / modal */
diff --git a/scripts/README.md b/scripts/README.md
index ffc6f9a67..713574488 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -55,18 +55,39 @@ Runs the canonical CORS policy against the R2 bucket holding all media
`<img>`, `fetch`) and presigned uploads to work cross-origin.
```sh
-vercel env pull .env
-node scripts/set-r2-cors.mjs # apply
-node scripts/set-r2-cors.mjs --get # show what's currently live
+node scripts/set-r2-cors.mjs --probe # measure the live policy from outside
+node scripts/set-r2-cors.mjs --get # read the live policy (admin token only)
node scripts/set-r2-cors.mjs --dry-run # print the policy without pushing
+node scripts/set-r2-cors.mjs # apply (admin token only)
```
-Allowed origins are defined inline in the script — edit `ALLOWED_ORIGINS`
-when you add a new domain (preview branch, staging host, etc.) and re-run.
+Start with `--probe`. It measures what the bucket actually enforces using only
+the object-scoped keys every environment already has: one HEAD per origin
+against the public host for the read rule, one PUT preflight against the S3
+endpoint for the write rule. It prints a row per origin, marks any row where
+the measurement disagrees with the policy in the script, and exits `1` on
+drift. `--get` and the bare apply both call Get/PutBucketCors, which an
+"Object Read & Write" token cannot do; they print the exact token to mint
+instead of a stack trace.
+
+Credentials come from `.env` / `.env.local`, or from the Cloud Run service for
+production values (`gcloud run services describe three-ws-api --region
+us-central1 --project aerial-vehicle-466722-p5 --format=yaml`). Do not use
+`vercel env pull`: it returns empty for secret-type vars, and production has
+not run on Vercel since 2026-07-07. An admin token belongs in `.env.local` as
+`R2_ACCESS_KEY_ID` / `R2_SECRET_ACCESS_KEY`.
+
+Allowed origins are defined inline in the script: edit `ALLOWED_ORIGINS` when
+you add a new domain (preview branch, staging host, etc.) and re-run.
Idempotent: re-running with the same policy is a no-op.
Run this any time you see `No 'Access-Control-Allow-Origin' header` errors
-on assets served from `*.r2.dev` or your custom R2 domain.
+on assets served from `*.r2.dev` or your custom R2 domain. As of 2026-08-01
+the live policy is an origin allowlist that predates the current script, so
+`--probe` reports drift on `www.three.ws`, `*.app.github.dev`,
+`localhost:5173`, and every third-party origin. Until an admin token applies
+the fix, browser reads of bucket-hosted GLBs from an unlisted origin must go
+through [`/api/glb`](../docs/media-api.md#same-origin-glb-proxy).
### `mobile-perf.mjs`: mobile field metrics under CPU + network throttling
diff --git a/scripts/animation-dignity-sweep.mjs b/scripts/animation-dignity-sweep.mjs
index 17f11b64a..a7e1ac496 100644
--- a/scripts/animation-dignity-sweep.mjs
+++ b/scripts/animation-dignity-sweep.mjs
@@ -565,10 +565,9 @@ function effectorTravel(root, nodeMap, clip) {
* normalize onto the SAME canonical name, `LeftArm`, and no name-only table can
* separate them: the simple hobby rig in this sweep spells its upper arm
* `shoulderL` too, so re-pointing that spelling at `LeftShoulder` would freeze
- * that rig's arms instead. The ingest canonicalizer resolves it structurally
- * (canonicalizeJointNodes pass 1.5 demotes the clavicle-spelled contender when an
- * upper-arm-spelled one is present), which is why this only ever fires on the
- * runtime lane. See RUNTIME_PIVOT_REMEDY.
+ * that rig's arms instead. Both lanes resolve it by contention through the
+ * shared resolver (`resolveArmShoulderCollisions` in src/glb-canonicalize.js),
+ * so this is a hard failure on either lane.
*/
function armPivotCheck(nodeMap, present) {
const problems = [];
@@ -584,21 +583,18 @@ function armPivotCheck(nodeMap, present) {
return problems;
}
-const RUNTIME_PIVOT_REMEDY =
- 'remedy: port canonicalizeJointNodes pass 1.5/1.6 (the clavicle/upper-arm collision resolver in ' +
- 'src/glb-canonicalize.js) into canonicalNodeMapFromObject in src/animation-retarget.js. Every avatar ' +
- 'stored by three.ws is canonicalized at ingest (api/_lib/auto-rig.js, api/_lib/reconstruct-finalize.js, ' +
- 'api/avatars/_actions.js, src/account.js), so this affects only a third-party GLB loaded straight into ' +
- 'the viewer, and the arm still animates: it swings from the shoulder blade instead of the shoulder.';
+const ARM_PIVOT_REMEDY =
+ 'remedy: resolveArmShoulderCollisions in src/glb-canonicalize.js resolves this collision by ' +
+ 'contention for both lanes (ingest via canonicalizeJointNodes, runtime via canonicalBoneEntries in ' +
+ 'src/animation-retarget.js). A new rig that trips it needs the resolver widened there, never a ' +
+ 'per-rig name special-case.';
/**
- * Run one rig down one lane for one clip and return the measurements.
- *
- * @param {{ lane: string }} ctx the lane decides whether a mis-pivoted arm is a
- * failure (ingest, where the collision resolver runs and must have worked) or a
- * warning (runtime, where no structural resolver exists yet).
+ * Run one rig down one lane for one clip and return the measurements. Both lanes
+ * run the same checks: they share the collision resolver, so a mis-pivoted arm is
+ * a failure whichever path produced the node map.
*/
-function measure({ root, nodeMap, present, clip, lane }) {
+function measure({ root, nodeMap, present, clip }) {
const result = retargetClipToObject(clip, root, { minCoverage: 0 });
const out = {
clip: clip.name,
@@ -653,8 +649,7 @@ function measure({ root, nodeMap, present, clip, lane }) {
);
}
for (const p of armPivotCheck(nodeMap, present)) {
- if (lane === 'ingest') out.failures.push(p);
- else out.warnings.push(`${p}. ${RUNTIME_PIVOT_REMEDY}`);
+ out.failures.push(`${p}. ${ARM_PIVOT_REMEDY}`);
}
return out;
}
@@ -663,7 +658,7 @@ function measure({ root, nodeMap, present, clip, lane }) {
function runLane({ buffer, present, lane }) {
const { root } = graphFromGLB(buffer);
const nodeMap = canonicalNodeMapFromObject(root);
- const clips = CLIPS.map((name) => measure({ root, nodeMap, present, clip: loadClip(name), lane }));
+ const clips = CLIPS.map((name) => measure({ root, nodeMap, present, clip: loadClip(name) }));
return {
lane,
mappedBones: nodeMap.size,
diff --git a/scripts/audit-route-shadowing.mjs b/scripts/audit-route-shadowing.mjs
new file mode 100644
index 000000000..2c16feaa5
--- /dev/null
+++ b/scripts/audit-route-shadowing.mjs
@@ -0,0 +1,353 @@
+#!/usr/bin/env node
+// Audit: which api/** handlers are routed but can never execute?
+//
+// A handler is "shadowed" when the production router, walking vercel.json's
+// `routes` table in order, sends the handler's own canonical URL somewhere else:
+// to a different handler, to a static page, to an external proxy, or to a bare
+// status. The handler file exists, it looks routed, and it never runs.
+//
+// This script replicates server/index.mjs's matching algorithm exactly:
+// 1. Split `routes` at the {handle:"filesystem"} marker into phase 1 / post-fs.
+// 2. Phase 1, in order: `continue` rules only collect headers; the first
+// non-continue rule with a `dest` rewrites the path and ENDS phase 1; a
+// non-continue rule with `status` and no `dest` ends the request outright.
+// `has` conditions gate a rule to requests carrying the query/header/cookie
+// /host it names, so a plain request skips those rules entirely.
+// 3. If the rewritten path is still under /api/, it is dispatched with Vercel
+// filesystem semantics: exact file > exact dir > [param].js > [param]/ >
+// [...catchall].js, with `_`- and `.`-prefixed names never routable.
+//
+// Dynamic handlers are probed with several concrete segment values, because a
+// route-table regex may accept one shape of id and reject another. A handler is
+// only reported as fully shadowed when EVERY probe value is diverted; when some
+// values reach it and others do not, it is reported as partially shadowed.
+//
+// Usage:
+// node scripts/audit-route-shadowing.mjs # human-readable report
+// node scripts/audit-route-shadowing.mjs --json # machine-readable
+// node scripts/audit-route-shadowing.mjs --all # include partial hits
+//
+// Exit code 1 when at least one fully shadowed handler is found.
+
+import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const ROOT = path.resolve(__dirname, '..');
+const API_ROOT = path.join(ROOT, 'api');
+
+// ---------------------------------------------------------------------------
+// Route table (mirrors server/index.mjs lines 55-113)
+// ---------------------------------------------------------------------------
+
+const vercelConfig = JSON.parse(readFileSync(path.join(ROOT, 'vercel.json'), 'utf8'));
+const fsIndex = vercelConfig.routes.findIndex((r) => r.handle === 'filesystem');
+const compileRoute = (r, index) => ({ ...r, index, re: new RegExp(`^${r.src}$`) });
+const phase1Routes = vercelConfig.routes
+ .slice(0, fsIndex === -1 ? vercelConfig.routes.length : fsIndex)
+ .map((r, index) => ({ r, index }))
+ .filter(({ r }) => r.src)
+ .map(({ r, index }) => compileRoute(r, index));
+
+const substitute = (template, match) =>
+ template.replace(/\$(\d+)/g, (_, n) => match[Number(n)] ?? '');
+
+const isExternalDest = (dest) => /^https?:\/\//.test(dest || '');
+
+const hasValueCache = new Map();
+function compileHasValue(value) {
+ let re = hasValueCache.get(value);
+ if (!re) {
+ const caseInsensitive = value.startsWith('(?i)');
+ re = new RegExp(caseInsensitive ? value.slice(4) : value, caseInsensitive ? 'i' : undefined);
+ hasValueCache.set(value, re);
+ }
+ return re;
+}
+
+// A plain request carries no extra query, no auth header and no cookie, so any
+// `has`-gated rule is skipped, exactly as it is in production for that request.
+function hasMatches(route, req, url) {
+ if (!route.has) return true;
+ for (const cond of route.has) {
+ let val;
+ if (cond.type === 'query') val = url.searchParams.get(cond.key);
+ else if (cond.type === 'header') val = req.headers[cond.key.toLowerCase()];
+ else if (cond.type === 'cookie') {
+ const raw = req.headers.cookie || '';
+ const m = raw.match(new RegExp(`(?:^|;\\s*)${cond.key}=([^;]*)`));
+ val = m ? decodeURIComponent(m[1]) : undefined;
+ } else if (cond.type === 'host') val = req.headers.host;
+ else continue;
+ if (val == null) return false;
+ if (cond.value !== undefined && !compileHasValue(cond.value).test(val)) return false;
+ }
+ return true;
+}
+
+// ---------------------------------------------------------------------------
+// Filesystem resolution (mirrors server/index.mjs lines 197-261)
+// ---------------------------------------------------------------------------
+
+const dirCache = new Map();
+function listDir(dir) {
+ let entries = dirCache.get(dir);
+ if (!entries) {
+ entries = readdirSync(dir, { withFileTypes: true });
+ dirCache.set(dir, entries);
+ }
+ return entries;
+}
+
+const isRoutable = (name) => !name.startsWith('_') && !name.startsWith('.');
+
+function resolveApi(dir, segments, params) {
+ if (segments.length === 0) {
+ const index = path.join(dir, 'index.js');
+ return existsSync(index) ? { file: index, params } : null;
+ }
+ const [head, ...rest] = segments;
+
+ if (rest.length === 0) {
+ const exact = path.join(dir, `${head}.js`);
+ if (existsSync(exact)) return { file: exact, params };
+ }
+
+ const exactDir = path.join(dir, head);
+ if (existsSync(exactDir) && statSync(exactDir).isDirectory()) {
+ const hit = resolveApi(exactDir, rest, params);
+ if (hit) return hit;
+ }
+
+ const entries = listDir(dir);
+
+ if (rest.length === 0) {
+ for (const e of entries) {
+ if (!e.isFile() || !isRoutable(e.name)) continue;
+ if (e.name.startsWith('[') && e.name.endsWith('].js') && !e.name.startsWith('[...')) {
+ const name = e.name.slice(1, -4);
+ return { file: path.join(dir, e.name), params: { ...params, [name]: head } };
+ }
+ }
+ }
+
+ for (const e of entries) {
+ if (!e.isDirectory() || !isRoutable(e.name)) continue;
+ if (e.name.startsWith('[') && e.name.endsWith(']') && !e.name.startsWith('[...')) {
+ const name = e.name.slice(1, -1);
+ const hit = resolveApi(path.join(dir, e.name), rest, { ...params, [name]: head });
+ if (hit) return hit;
+ }
+ }
+
+ for (const e of entries) {
+ if (!e.isFile()) continue;
+ if (e.name.startsWith('[...') && e.name.endsWith('].js')) {
+ const name = e.name.slice(4, -4);
+ return {
+ file: path.join(dir, e.name),
+ params: { ...params, [name]: [head, ...rest].join('/') },
+ };
+ }
+ }
+
+ return null;
+}
+
+function dispatchTarget(pathname) {
+ const apiPath = pathname.endsWith('.js') ? pathname.slice(0, -3) : pathname;
+ let segments;
+ try {
+ segments = apiPath.slice(5).split('/').filter(Boolean).map(decodeURIComponent);
+ } catch {
+ return null;
+ }
+ if (
+ segments.length === 0 ||
+ segments.some((s) => !isRoutable(s) || s === '..' || s.includes('/') || s.includes('\\'))
+ )
+ return null;
+ const route = resolveApi(API_ROOT, segments, {});
+ if (route && !route.file.startsWith(API_ROOT + path.sep)) return null;
+ return route;
+}
+
+// ---------------------------------------------------------------------------
+// Full request resolution (mirrors the express handler, lines 429-501)
+// ---------------------------------------------------------------------------
+
+/**
+ * Resolve a request path the way production does.
+ * @returns {{outcome: string, file?: string, dest?: string, rule?: object}}
+ * outcome: 'handler' | 'no-handler' | 'static' | 'status' | 'external' | 'redirect'
+ */
+function resolveRequest(pathname, { method = 'GET', headers = { host: 'three.ws' } } = {}) {
+ const url = new URL(pathname, 'http://internal');
+ const req = { method, headers, url: pathname };
+ let currentPath = url.pathname;
+ let matchedRule = null;
+
+ // The external-dest proxy middleware walks phase 1 with the same first-match
+ // semantics and hijacks the request when the winning dest is absolute.
+ for (const route of phase1Routes) {
+ const m = route.re.exec(currentPath);
+ if (!m) continue;
+ if (!hasMatches(route, req, url)) continue;
+ if (route.continue) continue;
+ if (!route.dest || !isExternalDest(route.dest)) break;
+ return { outcome: 'external', dest: substitute(route.dest, m), rule: route };
+ }
+
+ // Trailing-slash collapse (non-/api only).
+ if (
+ (method === 'GET' || method === 'HEAD') &&
+ currentPath.length > 1 &&
+ currentPath.endsWith('/') &&
+ !currentPath.startsWith('/api/')
+ ) {
+ return { outcome: 'redirect', dest: currentPath.replace(/\/+$/, '') || '/' };
+ }
+
+ for (const route of phase1Routes) {
+ const m = route.re.exec(currentPath);
+ if (!m) continue;
+ if (!hasMatches(route, req, url)) continue;
+ if (route.continue) continue;
+ if (route.status && !route.dest) {
+ return { outcome: 'status', status: route.status, rule: route };
+ }
+ if (route.dest) {
+ const dest = substitute(route.dest, m);
+ const qIdx = dest.indexOf('?');
+ currentPath = qIdx === -1 ? dest : dest.slice(0, qIdx);
+ matchedRule = route;
+ break;
+ }
+ }
+
+ if (currentPath.startsWith('/api/')) {
+ const hit = dispatchTarget(currentPath);
+ if (hit) return { outcome: 'handler', file: hit.file, dest: currentPath, rule: matchedRule };
+ return { outcome: 'no-handler', dest: currentPath, rule: matchedRule };
+ }
+ return { outcome: 'static', dest: currentPath, rule: matchedRule };
+}
+
+// ---------------------------------------------------------------------------
+// Handler enumeration
+// ---------------------------------------------------------------------------
+
+// Probe values for a [param] segment. A route-table regex may accept one shape
+// and reject another (`([a-z0-9-]+)` vs `(\d+)` vs a base58 mint), so every
+// dynamic handler is tested against all of them.
+const PROBE_VALUES = ['probehandler1', '1234567890', 'Probe-Test_9', 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump'];
+
+function collectHandlers(dir, urlSegments, out) {
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ if (!isRoutable(entry.name)) continue;
+ const abs = path.join(dir, entry.name);
+ if (entry.isDirectory()) {
+ collectHandlers(abs, [...urlSegments, entry.name], out);
+ continue;
+ }
+ if (!entry.isFile() || !entry.name.endsWith('.js')) continue;
+ const base = entry.name.slice(0, -3);
+ if (base === 'index') out.push({ file: abs, segments: [...urlSegments] });
+ else out.push({ file: abs, segments: [...urlSegments, base] });
+ }
+ return out;
+}
+
+// Turn a handler's path segments into concrete request paths, one per probe
+// value (static handlers yield exactly one path).
+function candidatePaths(segments) {
+ const dynamic = segments.some((s) => s.startsWith('['));
+ const probes = dynamic ? PROBE_VALUES : [PROBE_VALUES[0]];
+ return probes.map((probe) => {
+ const parts = [];
+ for (const s of segments) {
+ if (s.startsWith('[...') && s.endsWith(']')) parts.push(probe, 'sub');
+ else if (s.startsWith('[') && s.endsWith(']')) parts.push(probe);
+ else parts.push(s);
+ }
+ return { probe, path: `/api/${parts.join('/')}` };
+ });
+}
+
+function describe(result) {
+ switch (result.outcome) {
+ case 'handler':
+ return `handler ${path.relative(ROOT, result.file)}`;
+ case 'no-handler':
+ return `404 (rewritten to ${result.dest}, no handler)`;
+ case 'static':
+ return `static/page ${result.dest}`;
+ case 'status':
+ return `status ${result.status}`;
+ case 'external':
+ return `external proxy ${result.dest}`;
+ case 'redirect':
+ return `redirect ${result.dest}`;
+ default:
+ return result.outcome;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Run
+// ---------------------------------------------------------------------------
+
+const handlers = collectHandlers(API_ROOT, [], []);
+const full = [];
+const partial = [];
+
+for (const h of handlers) {
+ const rel = path.relative(ROOT, h.file);
+ const probes = candidatePaths(h.segments).map((c) => {
+ const result = resolveRequest(c.path);
+ const reached = result.outcome === 'handler' && result.file === h.file;
+ return { ...c, result, reached };
+ });
+ const reachedCount = probes.filter((p) => p.reached).length;
+ if (reachedCount === probes.length) continue;
+ const rule = probes.find((p) => !p.reached)?.result.rule;
+ const record = {
+ handler: rel,
+ canonical: probes[0].path,
+ reachedWith: probes.filter((p) => p.reached).map((p) => p.path),
+ divertedTo: probes
+ .filter((p) => !p.reached)
+ .map((p) => ({ path: p.path, to: describe(p.result), outcome: p.result.outcome })),
+ rule: rule ? { index: rule.index, src: rule.src, dest: rule.dest ?? null } : null,
+ };
+ if (reachedCount === 0) full.push(record);
+ else partial.push(record);
+}
+
+const asJson = process.argv.includes('--json');
+const showAll = process.argv.includes('--all');
+
+if (asJson) {
+ console.log(JSON.stringify({ scanned: handlers.length, full, partial }, null, 2));
+} else {
+ console.log(`Scanned ${handlers.length} routable handlers under api/.\n`);
+ console.log(`Fully shadowed (no request shape reaches them): ${full.length}`);
+ for (const r of full) {
+ console.log(`\n ${r.handler}`);
+ for (const d of r.divertedTo) console.log(` ${d.path} -> ${d.to}`);
+ if (r.rule) console.log(` rule #${r.rule.index}: ${r.rule.src} -> ${r.rule.dest}`);
+ }
+ console.log(`\nPartially shadowed (some id shapes diverted): ${partial.length}`);
+ if (showAll) {
+ for (const r of partial) {
+ console.log(`\n ${r.handler}`);
+ for (const d of r.divertedTo) console.log(` ${d.path} -> ${d.to}`);
+ if (r.rule) console.log(` rule #${r.rule.index}: ${r.rule.src} -> ${r.rule.dest}`);
+ }
+ } else if (partial.length) {
+ console.log(' (re-run with --all to list them)');
+ }
+}
+
+process.exit(full.length > 0 ? 1 : 0);
diff --git a/scripts/export-examples.mjs b/scripts/export-satellites.mjs
similarity index 100%
rename from scripts/export-examples.mjs
rename to scripts/export-satellites.mjs
diff --git a/scripts/set-r2-cors.mjs b/scripts/set-r2-cors.mjs
index 3790178f4..2767ebb67 100644
--- a/scripts/set-r2-cors.mjs
+++ b/scripts/set-r2-cors.mjs
@@ -115,6 +115,19 @@ const POLICY = {
],
};
+// Origins --probe measures. Every literal from ALLOWED_ORIGINS, a concrete
+// sample per wildcard entry (a wildcard is only real if a host under it passes),
+// and two controls that must be read-allowed but write-denied.
+const PROBE_ORIGINS = [
+ ...ALLOWED_ORIGINS.map((o) => o.replace('*', 'probe-cors')),
+ 'https://example.org',
+ 'http://localhost:8080',
+];
+
+// The preflight target. OPTIONS is answered from the bucket policy alone, so
+// this key is never created or read.
+const PROBE_WRITE_KEY = 'cors-preflight-probe.bin';
+
const flag = (name) => process.argv.includes(name);
const s3 = new S3Client({
diff --git a/scripts/verify-sign-avatar.mjs b/scripts/verify-sign-avatar.mjs
index acdf02ffd..bf122cacb 100644
--- a/scripts/verify-sign-avatar.mjs
+++ b/scripts/verify-sign-avatar.mjs
@@ -55,8 +55,10 @@ for (const route of ['/sign-language', '/asl-alphabet']) {
// The gallery: open it, take the first public avatar, and require the stage
// to come back up on that GLB.
+ // The gallery module is imported on demand (it pulls in model-viewer), so
+ // the first open waits on a real network fetch, not just a render.
await page.click(`${rigSel} button:nth-child(3)`);
- await page.waitForSelector('.agp-overlay.agp-open', { timeout: 12000 });
+ await page.waitForSelector('.agp-overlay.agp-open', { timeout: 40000 });
check('the avatar gallery opened', true);
await page.waitForSelector('.agp-card', { timeout: 15000 });
const pickedName = await page.$eval('.agp-card', (el) => el.querySelector('.agp-card-name')?.textContent?.trim() || '');
diff --git a/src/animation-retarget.js b/src/animation-retarget.js
index 8ccbe9ec6..30d8c9b18 100644
--- a/src/animation-retarget.js
+++ b/src/animation-retarget.js
@@ -18,7 +18,7 @@
// browser (the /pose gallery) and in Node (the apply_animation MCP tool, vitest).
import { AnimationClip, Box3, Quaternion, Vector3 } from 'three';
-import { canonicalizeBoneName } from './glb-canonicalize.js';
+import { canonicalizeBoneName, resolveArmShoulderCollisions } from './glb-canonicalize.js';
import { CANONICAL_REST, CANONICAL_REST_WORLD } from './animation-canonical-rest.js';
// A clip retargets cleanly only when enough of its tracks find a home on the
@@ -79,20 +79,36 @@ const _q = new Quaternion();
* @property {number} face Blendshape lanes bound on the target (0 = no face).
*/
+// Whether Object3D `a` is an ancestor of `b`. Feeds the hierarchy tie-break in
+// resolveArmShoulderCollisions: the clavicle parents the upper arm.
+function isAncestorObject(a, b) {
+ for (let n = b?.parent; n; n = n.parent) if (n === a) return true;
+ return false;
+}
+
/**
- * Build a `canonical bone → target node name` map by walking an Object3D graph.
- * Used server-side (apply_animation) where there's no GltfRig wrapper. Prefers
- * SkinnedMesh skeleton bones, falls back to any named Bone nodes.
+ * Resolve every canonical bone the graph carries, in the order the maps below
+ * read it: node-graph bones first, then skeleton bones some exporters name only
+ * there. Each graph node is considered once, the clavicle/upper-arm collision is
+ * resolved against the live hierarchy (see resolveArmShoulderCollisions), and
+ * only then does first-wins pick one node per canonical name.
+ *
+ * Resolution has to happen BEFORE the first-wins claim: a Rigify rig lists
+ * `shoulder.L` (the clavicle) ahead of `upper_arm.L` and both normalize onto
+ * `LeftArm`, so claiming first would drop the upper arm before anything could
+ * notice the two bones were fighting over one name.
*
* @param {import('three').Object3D} root
- * @returns {Map<string,string>}
+ * @returns {Array<{node: import('three').Object3D, raw: string, canonical: string}>}
*/
-export function canonicalNodeMapFromObject(root) {
- const map = new Map();
+function canonicalBoneEntries(root) {
+ const entries = [];
+ const seen = new Set();
const consider = (node) => {
- if (!node?.name) return;
+ if (!node?.name || seen.has(node)) return;
+ seen.add(node);
const canonical = canonicalizeBoneName(node.name);
- if (canonical && !map.has(canonical)) map.set(canonical, node.name);
+ if (canonical) entries.push({ node, raw: node.name, canonical });
};
const skinned = [];
root.traverse((node) => {
@@ -102,6 +118,28 @@ export function canonicalNodeMapFromObject(root) {
for (const sm of skinned) {
for (const bone of sm.skeleton?.bones || []) consider(bone);
}
+ resolveArmShoulderCollisions(entries, {
+ isAncestor: (a, b) => isAncestorObject(a.node, b.node),
+ });
+ const claimed = new Set();
+ return entries.filter((e) => {
+ if (claimed.has(e.canonical)) return false;
+ claimed.add(e.canonical);
+ return true;
+ });
+}
+
+/**
+ * Build a `canonical bone → target node name` map by walking an Object3D graph.
+ * Used server-side (apply_animation) where there's no GltfRig wrapper. Prefers
+ * SkinnedMesh skeleton bones, falls back to any named Bone nodes.
+ *
+ * @param {import('three').Object3D} root
+ * @returns {Map<string,string>}
+ */
+export function canonicalNodeMapFromObject(root) {
+ const map = new Map();
+ for (const { canonical, node } of canonicalBoneEntries(root)) map.set(canonical, node.name);
return map;
}
@@ -133,18 +171,8 @@ export function canonicalNodeMapFromRig(rig) {
*/
export function canonicalRestMapFromObject(root) {
const map = new Map();
- const consider = (node) => {
- if (!node?.name) return;
- const canonical = canonicalizeBoneName(node.name);
- if (canonical && !map.has(canonical)) map.set(canonical, node.quaternion.clone());
- };
- const skinned = [];
- root.traverse((node) => {
- if (node.isSkinnedMesh) skinned.push(node);
- if (node.isBone) consider(node);
- });
- for (const sm of skinned) {
- for (const bone of sm.skeleton?.bones || []) consider(bone);
+ for (const { canonical, node } of canonicalBoneEntries(root)) {
+ map.set(canonical, node.quaternion.clone());
}
return map;
}
@@ -185,18 +213,8 @@ function worldRestQuat(node, stopAt) {
*/
export function canonicalWorldRestMapFromObject(root) {
const map = new Map();
- const consider = (node) => {
- if (!node?.name) return;
- const canonical = canonicalizeBoneName(node.name);
- if (canonical && !map.has(canonical)) map.set(canonical, worldRestQuat(node, root));
- };
- const skinned = [];
- root.traverse((node) => {
- if (node.isSkinnedMesh) skinned.push(node);
- if (node.isBone) consider(node);
- });
- for (const sm of skinned) {
- for (const bone of sm.skeleton?.bones || []) consider(bone);
+ for (const { canonical, node } of canonicalBoneEntries(root)) {
+ map.set(canonical, worldRestQuat(node, root));
}
return map;
}
diff --git a/src/sign-avatars.js b/src/sign-avatars.js
index d0c307f64..8c942f0d8 100644
--- a/src/sign-avatars.js
+++ b/src/sign-avatars.js
@@ -131,6 +131,12 @@ export function buildRigPicker({ host, optionClass, active, apply, onStatus }) {
// The custom pill carries the picked avatar's name once there is one, and
// keeps its own key in the map so pressed state tracks the avatar behind it.
let stored = customRig();
+ const describeCustom = () => {
+ customBtn.title = stored
+ ? `${stored.label} is your avatar. Click it again to choose a different one.`
+ : 'Sign with any avatar you own, or any public one.';
+ customBtn.setAttribute('aria-haspopup', 'dialog');
+ };
const customBtn = addPill(stored ? stored.label : 'Your avatar…', async () => {
if (busy) return;
if (stored && stored.id !== current.id) {
@@ -161,11 +167,13 @@ export function buildRigPicker({ host, optionClass, active, apply, onStatus }) {
stored = rig;
saveSignPrefs({ customRig: rig });
customBtn.textContent = rig.label;
+ describeCustom();
if (previousKey) buttons.delete(previousKey);
buttons.set(rig.id, customBtn);
await choose(rig);
});
if (stored) buttons.set(stored.id, customBtn);
+ describeCustom();
press(current);
}