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.
x402 & Agent Commerce
UX Flow Atlas — cluster 09. Traced end-to-end from real source: page HTML, imported
JS modules, and backend API handlers. Routing is path-based via the vercel.json
route table (the live route/cron config the Cloud Run server reads); in dev the
route map in vite.config.js mirrors it. Clean URLs resolve to
files under pages/ or public/.
The cluster's spine is the x402 pay-per-call loop: hit a paid endpoint → get
402 Payment Required with paymentRequirements → pay (server-held agent wallet,
or the user's Phantom/MetaMask wallet, via the shared /x402.js modal, which also
offers a signed-in user's own agents as server-side payers) → re-send the
request with an X-PAYMENT header → facilitator verifies + settles on-chain →
endpoint runs and returns the result. The "agent economy" demos wrap this loop in a
choreographed two-agent narrative driven by Server-Sent Events.
Pay-per-call (x402) — /pay
- Source:
public/pay/index.html(route →public/pay/index.html; inline module scripts hold all app logic), backendapi/x402-pay.js,api/mcp,api/x402-checkout,api/_lib/x402-bsc-direct.js; agent wallet viaapi/agents/[id]/solana. - Entry point: Chat-style page. Left = conversation + quick-tool chips + prompt input ("Pay & Run"); right = "x402 settlement timeline"; footer = live "recent paid calls" ticker. First visit shows a 3-step walkthrough overlay (dismissed →
localStorage x402:seen-walk). - Prerequisites / gates: No signup to use the shared demo wallet (platform-funded). Three payer modes: (a) platform/agent server-payer (default): optional sign-in loads the user's own agents via
/api/x402-pay?agents=1(401 → "Sign in" CTA, falls back to demo wallet); selecting an agent with no wallet opens the generate-wallet overlay (POST /api/agents/{id}/solana, or grind a vanity address at/vanity-wallet). Paying from your own agent is a real-funds action: the account must first have signed the real-funds agreements (Terms of Service, Risk Disclosure, Agent Wallet Agreement) at/legal/agreements, else403 risk_ack_requiredwith the sign link and nothing sent, and an API-key or OAuth bearer caller additionally needs thewallet:writescope (403 insufficient_scopeotherwise;api/_lib/spend-scope.js, wherewallet:writeis the strictest of three grades and implies the narrowerwallet:tradeandwallet:launch). An agent payer is also held to its owner's spend policy and capped-burner limits (api/_lib/agent-trade-guards.js,reserveSpendUsd): a call above what the agent may sign alone is refused with a403spend-limit code (policy_step_upfor an owner-approval rule, see approvals) before the payment is built, so nothing moves, and an owner action is exempt from the burner cap. (b) Phantom (Solana USDC, user signs). (c) MetaMask/EVM on the "BNB Chain" tab (user signsapprove+pay(bytes32)). Wallet must hold ≥ $0.001 USDC for the chosen mode. - Steps (4 required + several optional):
- (optional) Read/dismiss the "How this works" walkthrough overlay.
- (optional) Pick a payer: sign in and select an agent, generate/import its wallet, or select Phantom / MetaMask card; otherwise the shared demo wallet is used.
- Choose a tool: click a quick chip (
/list_tools,/validate DamagedHelmet.glb,/inspect,/optimize,/search_avatars) or type a prompt (e.g.validate https://…/model.glb) and click Pay & Run / Enter. (Deep links/pay?validate=<glb>,?inspect=,?optimize=,?list=1auto-fire.) - System POSTs
/api/x402-pay(SSE) — timeline advanceschallenge → built → verified → dispatched → settled, each stage showing real ms timings and the settle tx prefix. - On
result: receipt rendered (amount, payment, durations), MCP output rendered in chat —tools/listlists tools,inspect/validate/optimizeshow JSON/cards, model-processing tools render an actual<model-viewer>GLB. Ticker bumps; balance + feed refresh.
- Decision points / branches: payer mode (server agent vs Phantom vs EVM —
run()dispatches torunPhantomPayment/runEvmPayment/ SSE path); agent has wallet vs not (gen overlay); prompt parse (parsePrompt) into a tool call; stream error vsresultvs "stream ended without result". - External calls / dependencies:
/api/x402-pay(SSE payer +?agents=1,?balance=1,?feed=1,/og),/api/mcp(402 probe + dispatch),/api/x402-checkout?action=prepare|encode,/api/agents/{id}/solana, Solana mainnet RPC (api.mainnet-beta.solana.com), x402 facilitator (verify/settle), Solscan for tx links; BSC path usesThreeWSPaymentscontract0x…1B72Cc. The Phantom path imports@solana/web3.jsthrough/load-module.js, which tries the pinned version on esm.sh, then jsdelivr, then unpkg, each under a deadline, so one blocked CDN no longer stalls the run at the signing step. - Success state: receipt card + rendered MCP result (incl. live 3D model), Solscan tx link, balance ticks down, feed prepends the call, page title shows elapsed ms.
- Empty / error states: not-signed-in → demo-wallet note; no agents → "Create your first agent"; agent has no wallet → gen overlay;
402/network failure → timeline stage flips to error +x402 call failed/Network errormessage; stream ends without result → explicit error; wallet underfunded surfaces from server error; unsigned real-funds agreements surface the server's "Sign the real-funds agreements … Nothing was sent" copy; Solana RPC unreadable while the server builds the transfer (every read on that path is guarded and cache-backed first) →503 rpc_unavailablewith aRetry-Afterheader and the copy "No funds were transferred; retry shortly" (the same guard answers/api/x402-checkout?action=prepare); a wallet component that fails to load on all three CDN mirrors → the failed step names the hosts it tried. - Step count: 4 required (+ ~4 optional).
Paid-call permalink — /pay/calls
- Source:
public/pay/calls/index.html(static share/OG view). - Entry point: Shareable permalink for a single completed paid call (linked from the
/payticker / OG image rendered by/api/x402-pay/og). - Prerequisites / gates: None — read-only.
- Steps (1):
- Open the link → page renders the recorded call (tool, MCP result card, Solscan tx) and sets the document title/OG metadata for social preview.
- Decision points / branches: result renderer branches by tool (
tools/list,validate_model,inspect_model,optimize_model, generic). - External calls / dependencies: record payload (embedded / fetched), Solscan,
/api/x402-pay/ogfor the share image. - Success state: rendered call summary with explorer link.
- Empty / error states: missing record → falls back to generic card / JSON dump.
- Step count: 1 required.
Hosted x402 checkout — /pay/c/<slug>
- Source:
public/pay/c/index.html+/x402.js; backendapi/x402-skus.js,api/x402-checkout-record.js. - Entry point: Hosted checkout for a merchant-defined SKU (
/pay/c/<slug>), branded with merchant + action name. - Prerequisites / gates: A valid
?slug/path slug resolving to a SKU; a wallet (Phantom/EVM) with USDC to pay. - Steps (3 required):
- Page loads SKU via
/api/x402-skus?slug=…and renders merchant/action; probes the target endpoint for its live402price + networks. - User clicks pay →
window.X402.pay({ endpoint: sku.target_endpoint, … })opens the shared modal (wallet connect + sign + settle). - On success the page re-calls the endpoint with the payment and records the call via
/api/x402-checkout-record; result shown.
- Page loads SKU via
- Decision points / branches: no slug → error; endpoint not returning 402 → "endpoint may have changed"; modal not loaded → error; Base vs Solana network.
- External calls / dependencies:
/api/x402-skus, target merchant endpoint,/x402.jsmodal,/api/x402-checkout-record, Solana/Base settlement. - Success state: payment settled + result rendered + call recorded.
- Empty / error states: missing slug, endpoint unreachable, non-402 response, modal load failure, payment cancel.
- Step count: 3 required.
x402 Bazaar — /bazaar
- Source:
public/bazaar.html+public/bazaar.js+/x402.js; backendapi/bazaar/list,api/bazaar/search,api/bazaar/context. - Entry point: Directory of live x402-paid endpoints (merged across facilitators) as a card grid with filters.
- Prerequisites / gates: None to browse; a wallet only when paying ("Try it").
- Steps (5 required + 2 optional):
- Page loads →
GET /api/bazaar/list→ renders endpoint cards. The handler merges every configured facilitator behind a 60s in-process catalog memo (BAZAAR_CATALOG_TTL_MS), returns at mostlimitrows (default 200) and reports the pre-cut match count astotal;offset(default 0) skips that many matches so a caller can page past the cap. The page asks for one page at a time (limit=200, or 100 for a search) and walks the rest withoffset: the count reads "200 of 1,234" and a Load more button appends the next page, disappearing once everything is shown or when a page comes back empty because the catalog moved. Every request carries a sequence number and aborts the one in flight, so the cards always match the controls the user last touched. - (optional) Filter by type (HTTP/MCP), network (EVM/Solana), max price, extension, sort.
- (optional) Search (
/api/bazaar/search?query=, sameoffsetpaging) or scroll, then Load more. - Click a card action: HTTP → Try it (pay flow); MCP tool → Inspect tool (details only — JSON-RPC, not auto-callable); Details → modal +
/api/bazaar/context?resource=. - On Try it:
window.X402.pay({ endpoint, method, merchant, action, … })opens the modal; pay → settle. - Inline
.receipton the card shows status + on-chain tx + explorer link.
- Page loads →
- Decision points / branches: HTTP vs MCP (MCP = inspect only); pay success/cancel/error → distinct receipt states; explorer chosen from endpoint network (Solscan/Basescan/Arbiscan/etc.).
- External calls / dependencies:
/api/bazaar/list|search|context,/x402.js, merchant endpoint, multi-chain explorers. - Success state: green receipt with tx hash + explorer link + result JSON; SR announcement "Payment succeeded for ".
- Empty / error states: no results → "No matching services…"; catalog unreachable → "Couldn't reach the catalog… Retry" (every
/api/bazaar/*handler answers502 facilitator_errorwhen all facilitators fail, so a total outage never renders as an empty catalog); modal load fail → "Payment module failed to load"; cancel → receipt hidden; error → red receipt; a Load more failure keeps the rows already on screen and puts the reason next to the button ("Couldn't reach the catalog. Try again." or "Could not load more: …"); a cross-origin endpoint whose response carries no CORS headers → the modal's discover step says " does not allow browser requests … Call it from a server, an agent, or the x402 CLI instead" and offers no Try-again button, since the same click can never succeed. - Step count: 5 required (+2 optional).
x402 Arbitrage — /arbitrage
- Source:
public/arbitrage.html+public/arbitrage.js+/x402.js(loaded on-demand); backendapi/bazaar/arbitrage. - Entry point: Cross-provider price-disparity board, one card per capability, ranked providers, spread %.
- Prerequisites / gates: None to browse; wallet only to pay.
- Deep links in:
/arbitrage?focus=<capability>(what/bazaarsends from a listing's priced-peers hint),?q=<text>,?type=http|mcp. The page writes its own filter state back withreplaceState, so any filtered view is shareable. - Steps (3 required + 3 optional):
- Page loads →
GET /api/bazaar/arbitrage?minSpreadPct=0&limit=200→ skeleton then arb cards (spread %, up to 5 providers cheapest-first, metrics). A source strip (#sources, polite live region) names every facilitator that answered with its listing count; one that dropped out reads " unreachable" (reason on hover) under an amber "Partial scan: N of M facilitators unreachable" pill, because the handler ships itserrorsnext tosourcesand a half-blind scan must not read as a quiet market. - (optional) Filter type All/HTTP/MCP; (optional) search by capability/host.
- Click Pay cheapest · $X → lazy-loads
/x402.js, thenwindow.X402.pay({ endpoint: cheapest.resource, method:'GET', merchant: host, action: capability }). - Result shows on the button: "✓ Paid" (auto-revert 4s) / "Failed: …" or "Error: …" (auto-revert 4s) / closing the modal hands the button straight back with no hold.
- (optional) Click Avoid · $Y → navigates to
/bazaar?q=<capability>(plus&type=mcpfor MCP capabilities, since the catalog defaults to the HTTP tab) to see the full spectrum.
- Page loads →
- Decision points / branches: MCP capability → "Pay" redirects to the catalog (can't call MCP directly); on-demand x402 load; button state management.
- What counts as an opportunity (backend): listings are grouped by capability key (MCP tool name, else service name, else the last literal URL segment; route placeholders like
/:solana_addressand/{mint}are skipped because they name the argument, not the capability). A group ships only if it spans two or more provider hosts, or if one host has a single resource quoted at two different prices by two different facilitators (a genuine cross-venue gap). A vendor charging different prices for its own distinct endpoints is not arbitrage and is dropped. - External calls / dependencies:
/api/bazaar/arbitrage,/x402.js, the cheapest live endpoint, Solscan/Basescan. - Success state: "✓ Paid" on the cheapest provider; payment settled on-chain.
- Empty / error states: filters exclude everything → "No opportunities match these filters" with a Clear-filters button and a catalog link; feed genuinely has no gap → "No cross-provider price gaps right now" with links to
/bazaarand/providers; timeout (20s) → "Request timed out… Retry"; feed error → "Couldn't reach the arbitrage feed…"; a partial scan renders normally with the degraded source strip rather than as an error; modal fail → "Payment modal failed to load". - Step count: 3 required (+3 optional).
x402 Providers — /providers
- Source:
public/providers.html+public/providers.js; backendapi/bazaar/providers. - Entry point: Two modes from one file — directory (
/providers) and profile (/providers?host=<host>). No payment surface; navigation hub into/bazaar. - Prerequisites / gates: None.
- Steps (2 required + 3 optional):
- Directory load → skeleton →
GET /api/bazaar/providers?limit=500→ provider cards (service count, median/min price, tags, networks). - (optional) Sort (most services / cheapest / most expensive / most networks); (optional) search by host/tag.
- Click a card →
/providers?host=…→ profile fetchGET /api/bazaar/providers?host=→ sidebar (metrics, "Visit site", "Open in catalog") + category/network charts + sorted services table. The listings array is capped atlimit(default 200, max 1000) whilelistingTotalcarries the provider's real count, so the heading reads "N listings (showing 200)" for the multi-thousand-listing hosts. - (optional) Click a listing row →
/bazaar?q=<service>.
- Directory load → skeleton →
- Decision points / branches: directory vs profile keyed on
?host; sort order; real-time search. - External calls / dependencies:
/api/bazaar/providers(list + single host), facilitator URLs, downstream explorers via/bazaar. - Success state: cards / profile render and are navigable.
- Empty / error states: timeout (20s) + retry; directory unreachable; profile 404 → "Failed to load provider" + back link; no search matches; no tags message.
- Step count: 2 required (+3 optional).
x402 Live Demo (IBM × three.ws) — /ibm/x402-demo
- Source:
pages/ibm/x402-demo.html(self-hosted IBM Plex fonts) +https://three.ws/x402.js+https://three.ws/agent-3d/latest/agent-3d.js; backendapi/x402/forge.js(forge-v2/models),api/x402/symbol-availability.js. - Entry point: Marketing/live-demo page with 5 stacked sections — two paid (Forge, Symbol Check) and three free/watch (Agent, Play, IRL); each lazy-boots via IntersectionObserver.
- Prerequisites / gates: Free demos: none. Paid demos: MetaMask (Base) or Phantom (Solana) with mainnet USDC — Forge $0.05–$0.50 by tier, Symbol Check $0.001.
- Steps (Forge: 5 required +1 optional; Symbol Check: 4 required):
- (Forge) Enter a prompt (default "a brass steampunk owl, full body").
- Page fetches the live
402challenge (GET /api/x402/forge-v2/models?tier=draft) and shows live price + networks + pay address. - (optional) Pick tier Draft/Standard/High → price updates.
- Click Pay $X & forge →
window.X402.pay({ endpoint:'/api/x402/forge-v2/models?tier=…&prompt=…', method:'GET', … })→ wallet signs gasless USDC auth → settle. - Endpoint returns a GLB →
<model-viewer>renders it (orbit/download); the autonomous<agent-3d>below celebrates (expressEmotion('celebration')+playEmote('cheer')).
- (Symbol Check) Enter ticker (default "GRANITE") → fetch
402from/api/x402/symbol-availability?ticker=→ Pay $0.001 & run → result panel shows availability pill + similar matches. - (Agent/Play/IRL) Scroll into view → 3D avatar auto-reacts /
/play+/irliframes lazy-load with "Full screen" / "Open on your phone".
- Decision points / branches: Forge vs Symbol Check (different endpoints/prices); paid vs free sections; agent reacts autonomously to settlement events; embeds load lazily.
- External calls / dependencies:
/api/x402/forge-v2/models,/api/x402/symbol-availability,/x402.js,/agent-3d/latest/agent-3d.js,/play,/irliframes, model-viewer bundle, Base/Solana settlement, explorers. - Success state: Forge → GLB rendered + agent celebrates; Symbol Check → availability result + agent reacts; receipt with tx + explorer link.
- Empty / error states: offline → "live price will load when you reconnect"; insufficient balance → "Top up USDC… then try again"; 402 preview fail → "Payment button still works"; modal fail → reload prompt; cancel → result clears; embed timeout (15s) → "Open it in a new tab".
- Step count: Forge 5 required (+1 optional tier); Symbol Check 4 required; free sections auto-play.
Endpoint Shopper — /shopper
- Source:
pages/shopper.html+src/shopper-app.js; backendapi/agents/endpoint-shopper-run.js(x402, $0.01 base + downstream budget) + the Bazaar registry. - Entry point: "Endpoint Shopper" — describe a task, set a budget, watch an agent discover + chain + call x402 endpoints to answer.
- Prerequisites / gates: No auth. Non-empty task and budget ≥ $0.01 to enable Run Task; a wallet only if the run hits a
402paywall. - Steps (5 required + 3 optional):
- Enter a task in
#task-input(or click an example chip). - (optional) Adjust budget slider ($0.10–$2.00, default $0.50).
- Click Run Task → button "Running…", skeleton cards shown.
POST /api/agents/endpoint-shopper-runwith{ task, maxCostUsd }→ agent emits a step trace: discover 🔍 → plan 🗺 → call ⚡ (per endpoint, with URL + USDC cost + snippet) → synthesize 🧠.- Timeline renders all steps; Total spent row ("$0.00…" or "Free"); Final Answer card with synthesized text. Button re-enabled.
- Enter a task in
- Decision points / branches: empty task / budget < $0.01 → button disabled + hint;
402→ paywall card "Pay with Wallet" →/paywall.html?req=…&return=/shopper;400/5xx/network → error card + retry. The error card never repeats the run route's machine output (a snake_case code such asno_payto_configured, or a diagnostic with a module prefix such aspaidEndpoint:): a5xxreads "The agent service is temporarily unavailable", a lost connection says the service could not be reached, and a4xxuses the server's text only when it reads as a sentence for a person (readableServerMessage), else designed copy. - External calls / dependencies:
/api/agents/endpoint-shopper-run, downstream x402 endpoints discovered via the Bazaar,/paywall.html. - Success state: full step timeline + final answer + total cost; ready for a new task.
- Empty / error states: initial skeleton/empty hint ("Enter a task…"); a run that returns no plan and no answer → "No endpoints matched" card quoting the task, with rewrite / raise budget / browse the Bazaar suggestions and a run-again button;
402warning card with CTA; red error card with retry; "Free (no paid calls executed)" if only free steps ran. - Step count: 5 required (+3 optional).
Fact Checker — /fact-checker
- Source:
pages/fact-checker.html+src/fact-checker-app.js; backendapi/x402/fact-check.js($0.10, 7-day Redis cache). - Entry point: Enter a claim, pick strictness, get a verdict + sources + cost breakdown + verifiable attestation.
- Prerequisites / gates: No auth. Non-empty claim ≤ 1000 chars; wallet only on
402. - Steps (4 required + 3 optional):
- Enter a claim in
#claim-input(or click an example chip); live char counter. - (optional) Pick strictness Low/Medium(default)/High.
- Click Check This Fact → validate → skeleton + "Searching sources…".
POST /api/x402/fact-checkwith{ claim, strictness }.- On
402→ payment panel (Base USDC $0.10 / Solana USDC $0.10) + "Connect wallet to pay →" (/marketplace). On200→ verdict banner (SUPPORTED/CONTRADICTED/MIXED/INSUFFICIENT + confidence), sources grid (stance/authority), cost breakdown, expandable SHA-256 attestation.
- Enter a claim in
- Decision points / branches: empty claim → no submit;
402→ payment panel;429→ "Too many checks…";5xx→ internal-error message; retry button re-runs same claim. Cached result returns200instantly. When the LLM stages cannot reach a provider, the check degrades instead of failing: real sources still return with neutral stances, the response carries adegradedmarker, and the result is never cached (so a provider outage is not pinned for 7 days). - External calls / dependencies:
/api/x402/fact-check(3 search queries → multi-source retrieval → LLM stance → weighted verdict → attestation; optional vision for image evidence, fail-open; the whole pipeline runs under a wall-clock budget,FACT_CHECK_BUDGET_MS, default 45s, so it never outlives the edge's 60s cutoff), Base/Solana USDC, Redis cache (7-day TTL, full-chain results only; every cache read and write is bounded at 2s, reads retry once, so a slow Upstash degrades to a cache miss instead of holding a paid request open). - Success state: verdict banner + sources + cost breakdown + attestation toggle.
- Empty / error states: initial example chips; skeleton loading; error card (title/msg/code + retry); payment panel with network badges.
- Step count: 4 required (+3 optional).
Unstoppable Agent — /unstoppable
- Source:
pages/unstoppable.html+src/unstoppable-dashboard.js+/x402.js; backendsapi/agents/unstoppable-public.js(free snapshot) andapi/agents/unstoppable-status.js($0.01 for the real-time reading). - Entry point: A live dashboard of an autonomous agent that must earn to survive: balance, runway, status (RUNNING/CONSERVING/HALTED), activity feed, latest reflection.
- Prerequisites / gates: None to view. The page polls the free snapshot, so it is populated with the agent's real numbers for every visitor. A wallet is needed only to pull the real-time reading.
- Steps (1 required + 1 recurring optional):
- Load page → paint the last reading from
localStorage unstoppable_last_readingif present → pollGET /api/agents/unstoppable-publicimmediately, then every 60s (exponential backoff to 5 min on faults, snapping back to 60s on the next good poll, plus an immediate re-poll when the tab regains focus). Renders hero balance + status + runway, 24h earnings/costs, lifetime net, the activity feed (THINK/EARN/REFLECT/IDLE/…), and the latest reflection, labelled "Free snapshot · · refreshed every 5 min". - (optional, repeatable) Click Unlock the live reading →
window.X402.pay({ endpoint: status, method:'GET', action:'Fund the … runway' })→ on success a toast plus the real-time reading, relabelled "Live reading". Each payment buys one live query and directly credits the agent's treasury.
- Load page → paint the last reading from
- Decision points / branches: snapshot
200→ populated;{ available: false }→ "datastore is not answering" banner; network fault or5xx→ "status feed is unreachable" banner, with the last known reading shown and labelled as such when cached, and per-panel failure copy plus a Retry button when not; payment low-balance → retry with link to/pay; payment cancel → no charge. A caller holding thex402:bypassinstall scope is served the live reading for free and is deliberately NOT recorded as revenue, so the runway the page reports stays honest. - External calls / dependencies:
/api/agents/unstoppable-public(free, cached one tick),/api/agents/unstoppable-status(paid, real-time, 20 rows),/x402.js, Base/Solana settlement. - Success state: populated hero + stats + non-empty activity feed + reflection + a data-source label saying whether the numbers are the free snapshot, a paid live reading, or the last known cached reading.
- Empty / error states: pre-fetch "Reading the agent's treasury…" with a shimmer on the reflection card; agent with no history → "No activity logged yet" and "No reflection written yet today", both explaining the 5-minute tick; fetch failure → hero alert banner + Retry now + a link to the snapshot endpoint, and every panel states what failed rather than shimmering forever.
- Step count: 1 required (+1 recurring optional payment).
Pay-As-You-Learn Tutor — /tutor
- Source:
public/tutor.html+public/tutor.js+/x402.js; backendapi/x402/tutor.js($0.01/question) +api/tutor/session.js(free resume). - Entry point: Chat tutor that charges per answer; session total accrues; "End & invoice" produces an itemized, attested invoice.
- Prerequisites / gates: No auth. Session id auto-minted to
localStorage three-tutor-session-id. Wallet connect happens lazily on the first paid question. Question 5–2000 chars. - Steps (4 required + 4 optional):
- (optional) Click a suggestion chip, or type a question in
#q(live char counter). - (optional) Pick expertise level Beginner/Intermediate(default)/Expert.
- Click send (or Cmd+Enter) → spinner; question added to thread.
window.X402.pay({ endpoint:'/api/x402/tutor', body:{ sessionId, question, level }, merchant:'three.ws Tutor', action:'Explain' }); first time → paywall modal connect + sign + settle.- On success → tutor bubble with answer + key points + example + follow-up; meta row (cost · level · model); session tab updates total + answer count.
- (optional) Click a follow-up suggestion to ask again (cost stacks). (optional) End & invoice → modal with per-question line items, running total, SHA-256 session attestation.
- (optional) Click a suggestion chip, or type a question in
- Decision points / branches: < 5 chars → ignored;
X402.paynot ready (6s) → error + retry; payment cancel → "no charge"; payment fail → retry; reload → session resumed vialocalStorage+ freeGET /api/tutor/session. - External calls / dependencies:
/api/x402/tutor(per-question charge, server-side session accrual + attestation),/api/tutor/session(resume),/x402.js, Base/Solana settlement. - Success state: stacked Q&A thread, session total + count, invoice with attestation.
- Empty / error states: initial title + 4 suggestion chips; spinner loading; error bubble in thread; invoice modal on demand.
- Step count: 4 required (+4 optional).
Forever (etch a message into Bitcoin) — /forever
- Source:
public/forever.html+public/forever.js; backendapi/forever/inscribe.js(creates a real OrdinalsBot Taproot text inscription on Bitcoin mainnet) +api/forever/status.js(polling). - Entry point: Compose a message → pay Bitcoin → it's inscribed onto a single satoshi, permanently. NOT an x402/USDC flow — payment is native BTC to a generated charge address (Lightning invoice offered too).
- Prerequisites / gates: Creating an order requires a signed-in session or a valid API bearer token (
POST /api/forever/inscribeanswers 401 otherwise), and both endpoints carry a per-IP rate ceiling (429). Message 1-1500 bytes UTF-8. Optional Taproot (bc1p...) receive address, verified with a full bech32m checksum so a mistyped address gets a precise 400 instead of an opaque upstream error (else platform vaultBTC_INSCRIPTION_RECEIVE_ADDRESS). Fee rate 3/8/20/50 sats/vB. User must hold BTC in their own wallet: a confirm dialog shows the estimated cost before the order is created. - Steps (6 required + 6 optional):
- Type the message (live char + byte counters; orange warning > 1500 bytes).
- (optional) Enter a Taproot receive address.
- (optional) Select fee rate → live fee estimate (
#feeEstimate) with sats / BTC / ≈USD (the first of four keyless price feeds to answer: CoinGecko, Coinbase, Kraken, DefiLlama, 4s each, best-effort). - Click Inscribe forever → native
confirm()showing estimated BTC cost + address ("payment is final once broadcast. Continue?"). POST /api/forever/inscribe{ message, receiveAddress, feeRate }→ creates OrdinalsBot order → returns charge address, amount (sats), Lightning invoice, mempool URL; order persisted tosessionStorage forever:order→ pay view.- Pay view: QR (BIP-21; api.qrserver.com, then quickchart.io, and if both fail the payment URI as selectable text so the payer is never left with a broken image), amount, pay-to/Lightning/receive/order-id rows, "Open in wallet" / "View on mempool" / "Cancel". User sends BTC from their own wallet.
- Auto-poll
GET /api/forever/status?id=<orderId>every 6s →waiting-payment → payment-received → inscribing → inscribed. Once a reveal txid exists the response also carriesinscription.onchain(confirmed, confirmations, block height and time) read keyless from Blockstream Esplora, so finality depth comes from the chain rather than from OrdinalsBot's order state; an Esplora outage degrades that field tonullinstead of failing the poll. - On
inscribed→ win view: large message, Inscription link (ordinals.com), reveal-tx link (mempool.space), receive address, "Bitcoin mainnet"; share to X / copy permalink / inscribe another.
- Decision points / branches: empty / > 1500 bytes / invalid Taproot / invalid fee rate → inline errors; signed-out → the server's 401 copy surfaces in the error banner; confirm-dialog cancel → stays in compose; order-create
502/503→ "Inscription failed. Try again." (the OrdinalsBot order call is bounded at 30s and never retried, since a retry after a request that actually landed would buy a second inscription); a non-OK, non-404 poll (including the502the API answers when OrdinalsBot misses its 15s deadline twice) is skipped and the next 6s tick retries; statusfailed→ OrdinalsBot contact note; status404(the order id no longer resolves upstream) → polling stops, the saved order is cleared, and the page returns to compose with a nothing-was-charged explanation; reload mid-payment →resumeIfAny()restores the pay view + resumes polling (unless the saved order 404s, which takes the same retire path). - External calls / dependencies:
/api/forever/inscribe+/api/forever/status→ OrdinalsBot (api.ordinalsbot.com, Bitcoin mainnet Taproot inscription), Blockstream Esplora (api/_lib/esplora.js, keyless reveal-tx confirmations, fail-soft), four BTC/USD feeds (CoinGecko, Coinbase, Kraken, DefiLlama; best-effort), two QR services (qrserver, then quickchart), mempool.space + ordinals.com for verification. - Success state: win view with permanent inscription + reveal-tx links + share buttons.
- Empty / error states: compose validation errors; inscribe failure banner; pay-view polling states; order
failedmessage with support info. - Step count: 6 required (+6 optional).
Agent Exchange — /agent-exchange
- Source:
pages/agent-exchange.html+src/agent-exchange.js; backendapi/x402-pay.js(SSE payer),api/x402/crypto-intel.js(the paid endpoint). - Entry point: Two 3D avatars (Intel Agent seller, Buyer Agent) face off; topic chips (SOL/BTC/ETH/DOGE/BNB) + Buy intel — $0.01 USDC + on-chain transaction feed. Real USDC settles per buy.
- Prerequisites / gates: No user auth/wallet. Server-side agent wallet (
X402_AGENT_SOLANA_SECRET_BASE58) must be funded ≥ $0.01; pre-flightcheckWallet()(/api/x402-pay?balance=1) disables the pay button if unconfigured/underfunded. - Steps (2 required; rest auto):
- [auto] Avatars load + greet (scripted speech via postMessage).
- [user] Select a topic chip (default SOL) → buyer agent reacts.
- [user] Click Buy intel — $0.01 USDC → button "Paying…".
- [auto SSE from
/api/x402-pay] six narrated stages:challenge → built → verified → dispatched → settled → done, each with stage chip + agent animation + narration. - [auto] Receipt card (Confirmed on-chain · amount, payer/payee, Solana mainnet, Solscan tx, headline + signal badge + 24h change); session total flashes. Bubbles auto-hide ~5.5s. Repeat with a new topic.
- Decision points / branches: topic selection feeds the intel request; wallet pre-flight gate; SSE
error/timeout (30s) → stage error + red receipt + reset + retry. - External calls / dependencies:
/api/x402-pay(POST SSE, toolcrypto_intel, endpoint/api/x402/crypto-intel),/api/x402-pay?balance=1,/api/x402/crypto-intel, Solana RPC settlement, Solscan. - Success state: all 6 stages + receipt with on-chain tx + agents celebrate + session total increments.
- Empty / error states: "Demo wallet not configured" (button disabled), "Agent wallet low on USDC" + fund address, timeout/SSE error with "No funds were moved", initial narration describing the flow.
- Step count: 2 required (auto SSE pipeline thereafter).
Agent Commerce — /agent-trade
- Source:
pages/agent-trade.html+src/agent-trade.js; backendapi/agent-trade/demo(SSE), guarded by a per-IP read limit and a global daily payout ceiling on the demo buyer wallet (limits.avatarPayoutDaily). It signs with the platform's demo keypairs, so the per-agent spend guards inapi/_lib/agent-trade-guards.jsdo not apply to it. - Entry point: Three.js scene with two geometric agents (Nexus buyer, Oracle seller) on platforms; topic dropdown + ▶ Run Trade Demo; central card + step log. Cinematic camera, particle beam, burst on confirm.
- Prerequisites / gates: No user auth. Server agent keypairs
AGENT_BUYER_SECRET+AGENT_SELLER_SECRET(+AGENT_TRADE_PRICE_SOL,AGENT_TRADE_NETWORK) must be configured + funded. Pre-flightcheckConfig()(/api/agent-trade/demo?check=1) runs with Run disabled and a skeleton card ("Checking the demo wallets") in the centre; configured → ready card + Run enabled; unconfigured → modal overlay walkthrough + env instructions, Run stays disabled; pre-flight unreachable → a "Status check failed" card with Retry the status check, and Run is left enabled so the run itself reports what failed. - Steps (2 required; rest auto):
- [user] Select a topic from the dropdown.
- [user] Click ▶ Run Trade Demo → "⏳ Running…".
- [auto SSE
/api/agent-trade/demo?topic=] ordered events with choreography:init(addresses/balances, camera fly) →request(buyer asks) →challenged(402 card, SOL price) →paying(particle beam buyer→seller; the buyer bubble "Sending X SOL on-chain…" carries an indeterminate progress bar, since a real transfer can take tens of seconds and static text is indistinguishable from a stalled page) →confirmed(burst, Solscan tx card, balance debited) →delivering("Analyzing with …", same pending bar) →delivered(final analysis card + model + tx link). - Button re-enabled ("Run again"); idle animation resumes.
- Decision points / branches: topic feeds the request payload; config gate (dismiss only hides overlay);
errorevent → the active chip flips red, a toast fires, and a centre failure card names the cause in its badge (insufficient_funds"Buyer wallet is short",daily_budget_exhausted"Daily spend limit reached",analysis_unavailable"No analysis model available",analysis_failed"Analysis failed after payment",send_failed"Payment failed", anything else "Trade stopped") with a Run it again button;not_configuredinstead re-opens the walkthrough overlay and disables Run; a stream that drops mid-run gets the same card badged "Stream dropped". Below 560px the labels and bubbles leave the 3D projection and stack into a flat strip (the layout the no-WebGL fallback also uses) so the card never paints over a speech bubble. - External calls / dependencies:
/api/agent-trade/demo(?check=1+?topic=SSE), real SOL settlement on Solana mainnet/devnet, AI model inference for the delivered analysis, Solscan. - Success state: all 7 SSE stages + final delivered-skill card with model-generated content + on-chain tx.
- Empty / error states: pre-flight skeleton card; not-configured modal overlay + unconfigured card; status-check-failed card with retry; failure card (badge + message + Run it again) on any
errorevent or dropped stream; idle ready card. - Step count: 2 required (auto SSE thereafter).
Agent Economy (Live) — /agent-economy
- Source:
pages/agent-economy.html+src/agent-economy.js; backendapi/agent-economy/status+api/agent-economy/transact. - Entry point: Three-column layout — buyer Nova (3D iframe) | service catalog + transaction feed | seller Oracle (3D iframe). Catalog: Market Analysis ($0.001), On-Chain Insight ($0.002), Risk Score ($0.003) + optional topic input.
- Prerequisites / gates: No user auth. Server wallet (
AVATAR_WALLET_SECRET) must be configured + funded;refreshWalletStatus()(/api/agent-economy/status) on init + after each trade shows fund alert / pause banner. - Steps (2 required + 1 optional; rest auto):
- [auto] Avatars load + greet.
- [user] Select a service button.
- [user, optional] Enter a topic (≤120 chars).
- [auto] Buyer Nova requests + pays (column flash, feed item 📡),
POST /api/agent-economy/transact { service, topic }. - [auto ~900ms] Oracle "receives" — payment particle buyer→seller, feed item 💸 with receipt + Solscan link; balances refresh.
- [auto ~400ms] Oracle delivers (speech via LLM, feed item ✅ with content). Status "Transaction complete". Repeat.
- Decision points / branches: service price tier; optional topic; wallet states —
wallet_unconfigured("Live transactions paused"),insufficient_balance("Not enough funds" + Add funds),no_recipient, generic error. - External calls / dependencies:
/api/agent-economy/status,/api/agent-economy/transact, Solana RPC settlement, LLM for buyer/seller speech,/a-embedavatar iframes (postMessage), Solscan. - Success state: 3 feed items (request / payment+receipt / delivery) + updated balances + ready for next service.
- Empty / error states: unconfigured pause; underfunded fund banner + "Add funds"; network error feed item; initial empty feed ("Pick a service above…").
- Step count: 2 required (+1 optional topic; auto orchestration thereafter).
Agent Economy — NOVA & ORACLE — /demo
- Source:
pages/demo-economy.html+src/demo-economy.js; backendapi/demo-economy(SSE). - Entry point: Single Three.js scene — NOVA (blue) + ORACLE (gold) on platforms with a TV screen between them; Run demo button; sidebar wallet chips + payment details + activity log.
- Prerequisites / gates: No user auth. Server agents configured + funded for live settlement; no pre-flight overlay — the stream emits error/demo_mode events if not configured. Unsigned-in/anonymous users get a simulated payment path.
- Steps (1 required; rest auto):
- [auto] Idle scene renders (TV idle, particles, auto-rotate, wallet chips).
- [user] Click Run demo → "Running…", log cleared, scene reset.
- [auto SSE
/api/demo-economy] typed events:step(e.g. agents_ready → camera fly) →bazaar(TV draws x402 service list) →wallet(chips updated) →payment(pay card; SOL amount; signature link or "SIMULATED" badge; mobile sheet slides up) →content(TV draws ORACLE market briefing with pools) →done. - Button re-enabled ("Run again").
- Decision points / branches: configured+funded vs underfunded (error w/ fund notice) vs not-configured (error, prompts anon to sign in);
simulated=true→ the pay card reads "Simulated payment" and asks the visitor to sign in to run a live on-chain transfer, plus a "Mode: Simulated" row. 35s hard timeout. - External calls / dependencies:
/api/demo-economy(SSE), Solana RPC settlement (if live), GeckoTerminal trending pools for the briefing (read through the shared upstream fetch: 8s deadline, one retry, breaker-guarded, and backed by a last-known-good copy up to 30 min old, so a throttled upstream leaves the demo with a briefing flaggedstale+as_ofrather than nothing to sell), Solscan. - Success state: TV shows final briefing with markets + prices + 24h changes; full activity log; "Run again".
- Empty / error states: not-configured error; underfunded fund notice; simulated mode; initial idle scene with "not configured" wallet chips.
- Step count: 1 required (auto SSE thereafter).
Agent Economy — Live — /live
- Source:
pages/live.html(inline module) +src/live-economy.js; backendapi/demo/economy(?status=1+?trade=1SSE) +api/chat(LLM dialogue). - Entry point: Full-screen Three.js scene — Oracle + Trader on pedestals + TV; CSS-overlaid name tags, balance chips, speech bubbles, HUD with ▶ Agent Trader pays Oracle for Solana market data + event log. Agents speak LLM-generated lines.
- Prerequisites / gates: Viewing is open; the live trade stream
/api/demo/economy?trade=1is auth-gated — anonymous users get a "Sign in to run a live on-chain trade" notice. Server agents must be configured + funded.refreshStatus()polls?status=1every 10s. - Steps (1 required; rest auto + LLM):
- [auto] Scene renders; Oracle greets (
3s, LLM via5.5s)./api/chat), Trader greets ( - [user] Click the trade button → "⏳ Trade in progress…", Trader waves + LLM intro line.
- [auto SSE
?trade=1] events:thinking→ (demo_modeif unsigned/unconfigured → "No real payment in demo mode") →paying(beam Trader→Oracle + LLM line) →paid(white flash, Oracle pedestal flash, balances refresh, Solscan log link, LLM lines) →fetching→delivering(TV draws market grid, reverse beam, LLM lines) →done. - Button re-enabled ("▶ Run Another Trade"). 45s hard timeout.
- [auto] Scene renders; Oracle greets (
- Decision points / branches: signed-in + funded (live SOL) vs not-configured/underfunded (
errorwith fund address + Copy/View/Retry) vs anonymous (error→ "Sign in" notice) vsdemo_mode(data only, no payment). - External calls / dependencies:
/api/chat(LLM),/api/demo/economy?status=1(poll) +?trade=1(auth-gated SSE), Solana RPC settlement, market-data source,/avatar-embed.htmliframes (postMessage), Solscan. - Success state: paid + delivered, TV market grid, log with Solscan link, balances updated, "Run Another Trade".
- Empty / error states: not-signed-in notice; underfunded fund notice; stream interrupted; demo-mode (no real SOL); initial idle TV + greetings.
- Step count: 1 required (auto SSE + LLM thereafter).
Sniper Arena — /play/arena
- Source:
pages/play/arena.html+src/play/arena.js+src/play/rivalries.js; backendapi/sniper/leaderboard,api/sniper/rivalries(seedocs/rivalries.md),api/sniper/stream(SSE),api/sniper/trader,api/oracle/agent-stats. - Entry point: A 3D world where autonomous AI agents trade real pump.fun tokens on Solana mainnet, live. Left = live leaderboard; right = live trade tape; bottom = movement hints. No x402 micropayments here — agents have pre-funded wallets and trade autonomously.
- Prerequisites / gates: None to watch. Picking an avatar is local (
localStorage arena:avatar:v1), no payment. Agents trade with their own funded Solana wallets. - Steps (4 required + 3 optional):
- [auto] Page boots
ArenaWorld(Three.js 60fps) and, without waiting on the 3D load, fetches/api/sniper/leaderboard?network=mainnetand mounts the grudge-match strip (GET /api/sniper/rivalries?window=7d&lookback=24h&limit=2, refreshed every 90s: each row pairs a trader with the one above them, labelled Passed / Debut / Chasing, with links to the leader's record and Ghost-copy). The board and tape paint while the animation manifest + avatar GLB download; the loading curtain sits below the side panels, so it only hides the empty canvas. Once the world is walkable, SSE/api/sniper/streamopens after the first board read. - [auto] Agents spawn once the world is ready (deterministic avatar by
agent_idhash, arc formation, floating DOM labels with rank/name/P&L). - [auto/live] SSE
buy/sell/updateevents → agent emotes + particle burst, trade tape prepends (BUY/SELL ▲▼, symbol, Solscan link), big-win banner, board refresh. - [user, optional] Choose your avatar → modal → select → spawn player (saved to localStorage).
- [user, optional] Move with WASD / drag look / scroll zoom / touch joystick.
- [user, optional] Click an agent label → camera focus + right drawer profile (equity sparkline, stats grid, recent closed trades with on-chain proof, Oracle conviction section) → Full proof & copy ↗ →
/trader/<agent_id>new tab.
- [auto] Page boots
- Decision points / branches: fully autonomous trading, so the user only watches/moves/inspects; header links out to
/duels(call which trader books more, free to play),/syndicates(copy the winners as a team), and/quests(today's trading quests); SSE vs periodic board refresh; avatar selection local; focus/unfocus; big-win banner threshold (≥0.4◎ or ≥100%). - External calls / dependencies:
/api/sniper/leaderboard,/api/sniper/rivalries,/api/sniper/stream(SSE),/api/sniper/trader,/api/oracle/agent-stats,/animations/manifest.json, avatar GLBs, Solscan,/trader/<id>. Solana mainnet (real pump.fun trades). - Success state: agents render + leaderboard + live tape; user can move + inspect; real trades animate in real time.
- Empty / error states: no live agents → "No agents are live yet… arm a trader and enter"; SSE drop → "Reconnecting…" (retry 2.5s); board never read → "Can't reach the leaderboard." + Retry now (KPI strip hidden); refresh fail after a good read → "Standings are stale." keeping the last good board and its KPI strip; rivalries → skeleton, an empty note when fewer than two traders have 3+ closed round-trips, or "Can't reach the rivalry feed." + Retry; drawer fail → "Couldn't load this trader"; avatar load fail → mono-initial tile.
- Step count: 4 required (auto boot) + 3 optional (avatar, move, inspect).
Agent Exchange (feature page) — /features/agent-exchange
- Source:
pages/features/agent-exchange.html(static marketing landing;/nav.js+/footer.js). - Entry point: Static feature page explaining the Agent Exchange concept. NOT a demo — it links to the live demo at
/agent-exchange. - Prerequisites / gates: None.
- Steps (1 required):
- Read the page (hero, "How it works" 3-step, highlights, FAQ).
- (optional) Click Watch live → (
/agent-exchange) to run the real demo, or All features (/features).
- Decision points / branches: none (static).
- External calls / dependencies: none beyond nav/footer includes.
- Success state: user navigates to the live
/agent-exchangedemo. - Empty / error states: none (static content).
- Step count: 1 required (+1 optional CTA).
Notes
- Routing: all clean URLs resolve through the
vercel.jsonroute table — read directly by the Cloud Run server (server/index.mjs) in production and mirrored by thevite.config.jshistoryApiFallbackmap in dev./pay,/bazaar,/arbitrage,/providers,/forever,/tutorlive underpublic/; the rest underpages/. - Shared payment modal:
/x402.js(public/x402.js, ~2.7k LOC) is the drop-inwindow.X402.pay()modal used by/pay/c,/bazaar,/arbitrage,/ibm/x402-demo,/shopper(paywall),/fact-checker,/unstoppable,/tutor. It handles wallet connect (Phantom/Solana, MetaMask/Base via EIP-3009), the 402→sign→retry loop, and SIWX re-entry. Before the first payment it collects the real-funds agreements (Terms of Service, Risk Disclosure, Agent Wallet Agreement) through the lazily loadedrisk-ack.js, degrading to a nativeconfirm()with the same wording if that module cannot load. A resource that prices itself in several Solana tokens (USDC and $THREE, a Token-2022 mint the Solana rail now settles) gets a token chooser. Solana transactions are signed through the wallet's Wallet Standardsolana:signTransactionfeature when it offers one, falling back to the injected provider; Phantom's Lighthouse guard instructions (up to 3) are accepted rather than vetoed, unless one names the sponsor's fee-payer account. Only a wallet's own refusal (EIP-1193 code 4001, ethers'ACTION_REJECTED) reads as a cancel; a server-side refusal keeps its real reason. Its Solana web3.js and SIWX hashing imports go through/load-module.js(the pinned version on esm.sh, then jsdelivr, then unpkg, each under a deadline); only when all three fail does the modal steer the buyer to MetaMask on Base, which needs no third-party code. A cross-origin endpoint whose response carries no CORS headers is reported as " does not allow browser requests" with a pointer to a server, an agent, or the x402 CLI, and no Try-again button. - Chain order in the 402: every
paidEndpointroute in this cluster (/api/x402/fact-check,/api/x402/tutor,/api/x402/symbol-availability, and the rest) inherits the platform default of Solana first, then Base, so the live challenge lists networks in the same order the discovery catalog advertises and a client that takes the first accept settles on Solana.tests/x402-solana-first-ordering.test.jsfails the suite if a route pins Base first again. - Server-payer vs user-payer: the "agent economy" narratives (
/agent-exchange,/agent-trade,/agent-economy,/demo,/live) pay from server-held agent wallets and stream the choreography over SSE — the user only triggers/selects, then watches. The "showcase" apps (/shopper,/fact-checker,/tutor,/bazaar,/arbitrage,/ibm) make the user pay via the/x402.jsmodal. - Auto-play demos:
/agent-exchange,/agent-trade,/agent-economy,/demoneed one user click to start, then auto-play./liveadds an auth gate for real settlement./play/arenais fully autonomous (agents trade themselves; user only watches/moves/inspects) and uses no x402 — real pre-funded Solana trades. - Forever is the only non-x402 payment in the cluster: native Bitcoin (or Lightning) to an OrdinalsBot charge address, inscribing a real Taproot text inscription on Bitcoin mainnet.
- Adjacent economy surfaces (2026-08-01, not yet traced as full sections):
/economy-lab(pages/economy-lab.html; Runway Lab, a live digital twin of the x402 payment rail; backendapi/x402/runway-lab.js),/pay/simulator(Spend Policy Simulator: dry-run an agent spending policy against real x402 prices),/flow(Money Flow Map, seedocs/money-flow-map.md),/play/solver(seedocs/economy-solver.md), and/conversions. - Inline handlers are gone: every HTML response in this cluster ships a CSP whose
script-srclists SHA-256 hashes of the inline scripts in the bytes actually sent, so no page here may carry anonclick=/onerror=attribute (not even inside a template literal). The card markup these flows render declares intent withdata-fallback,data-action="reload"ordata-stop-propagationandpublic/inline-behaviors.jsdelegates it;scripts/audit-inline-handlers.mjsfails the build if one comes back. - Source coverage: all 19 routes located and traced from real source.
/tutorresolves topublic/tutor.html+public/tutor.js(served statically; no explicit vite map entry needed). No source was missing.