Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
x402 buys real work: paid forge output lands in the gallery with its receipt
nirholasee5098e27fce
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2e324ef7b..1390b8c3c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The Story So Far** (`/timeline`) — three.ws's history as an explorable 3D scene: every launch, partnership, listing, and milestone laid out along a path you can orbit in 360° or walk end to end, with a synced scrubber and source links.- **three.ws is an OpenAI Select Partner** (`/openai`) — three.ws is an OpenAI Select Partner in the OpenAI Partner Network. Connect the free three.ws 3D Studio MCP server to ChatGPT and turn a prompt into an interactive, riggable, AR-ready 3D model inline in the conversation.- **three.ws Named an OpenAI Select Partner** (`/blog/three-ws-openai-select-partner`) — three.ws has been named an OpenAI Select Partner within the OpenAI Partner Network. What we ship on OpenAI surfaces today: a free 3D Studio MCP connector for ChatGPT, custom GPT Actions, the open Spatial MCP response shape, and one-tap AR.+- **Agent-bought 3D models now appear in the gallery with their on-chain receipt** — When an AI agent pays for a 3D generation through the x402 forge endpoint, the finished model now lands in the public community gallery like any other creation, wearing a green x402 badge that links straight to the settle transaction on Solscan: who paid, what it cost, receipt one click away. Async generations finish server-side even if the buying agent never checks back. The trading sniper closes the same provenance loop from the other side: every market signal it buys now carries the payment signature of the call that bought it, so a trade decision can cite the exact on-chain payment that informed it. Also fixed: the autonomous economy loop now pauses cleanly with one loud alert when its fee wallet runs low instead of burning hundreds of doomed calls per hour, and three volume endpoints that were calling the dance-tip stage with the wrong HTTP method work again. (`/forge`) `[feature, improvement, fix]`- **Check any 3D tool result against the Spatial MCP standard, in the page, as you type** — Spatial MCP is our open standard for handing back a live 3D scene as an AI tool result instead of a link, and until now three.ws/spatial-mcp only claimed that the payloads it displayed were valid. Now it proves it. The conformance checker the standard ships runs in your browser, and every scene on the page carries its verdict underneath: conformant, zero errors, and which version of the shape it speaks. Below that is a box you can paste your own tool result into. It checks the payload as you type and, instead of answering yes or no, names the exact field that is wrong and what it should be, so anyone writing an adapter for their own 3D tool can debug it on the page without reading the specification or installing anything. Load the deliberately broken example to see the whole thing at once: six mistakes, each naming its own field, and the fallback a real host would show a user for a payload it cannot render. Anything that passes renders immediately in the same viewer. The checker is the same code our own servers validate with, now published at a fixed address so third parties can import it directly, which means what the page tells you about a payload is exactly what a build will tell you. Two safeguards landed alongside it, because this page had been quietly showing two empty frames: one refuses to ship a page that asks for a file by a path that will not resolve, and one loads the page for real in a browser and fails if a scene does not appear or an asset it depends on has gone missing. The first immediately found the same defect on three more live pages, all fixed in this release: the agent editor was loading none of its code, the Czech landing page none of its styling, and the first-meet page none of its script. (`/spatial-mcp`) `[feature, fix, infra]`- **Closed the tab while your avatar was building? It finishes anyway now** — Until today, a selfie avatar only completed while you kept the page open: your browser did the checking, and if you closed the tab after uploading, the engine finished your avatar but nobody ever came back to collect it. The job sat unfinished forever and your library never received the result. We found jobs stranded this way going back a month. The platform now checks in on every in-flight avatar itself, every few minutes, and files the finished result into your library exactly as if you had waited, so starting an avatar on your phone and pocketing it mid-build is now fine. The same pass also went back through every stranded job from the past month and delivered the ones whose results were still recoverable. Separately, the selfie page no longer shows a Masc and Femme body choice. Honest reason: the engine builds every avatar on one shared template body today, so that toggle changed nothing and never had, which is worse than not offering it. A real body choice, with sliders for build, height and more rather than two buttons, is planned on the parametric avatar base. (`/create/selfie`) `[fix, improvement]`- **Crypto API: automatic upstream failover ends most rate-limit errors** — The unified crypto API (/api/v1/x) no longer fails your call just because one upstream host had a bad moment. When a provider is backed by a pool of interchangeable hosts (the Solana read endpoints front the platform's full RPC pool), a rate-limited, unreachable, or erroring host now fails over to a healthy alternate within the same request. The API also remembers which host just failed for a short window, so during an outage only the first request pays the discovery cost and everything after routes straight to a working host. Rate-limit passthrough was the second-largest error class on the aggregator; this removes it for pooled providers. (`/crypto-api`) `[improvement, infra]`diff --git a/api/_lib/forge-store.js b/api/_lib/forge-store.jsindex 719ff5770..345937b69 100644--- a/api/_lib/forge-store.js+++ b/api/_lib/forge-store.js@@ -72,6 +72,44 @@ export function validModelCategory(v) {return typeof v === 'string' && MODEL_CATEGORIES.includes(v) ? v : null;}+// x402 payment provenance, shaped for read-path spreads. Only rows created by+// the paid /api/x402/forge lane carry these; every other lane spreads nothing,+// so existing consumers see no new keys on non-x402 items.+function x402Provenance(r) {+ if (!r?.x402_tx_sig && !r?.x402_payer) return {};+ return {+ x402: {+ payer: r.x402_payer ?? null,+ tx_sig: r.x402_tx_sig ?? null,+ price_usdc: r.x402_price_atomic != null ? Number(r.x402_price_atomic) / 1e6 : null,+ },+ };+}++// Stamp the on-chain receipt onto a creation the paid x402 lane just recorded:+// who paid, the settle signature, and the price. Keyed the same way as every+// other store writer (replicate_job_id + client_key) so it can only touch the+// row its caller created. Best-effort: a miss is logged, never thrown.+export async function attachX402Provenance({ replicateJobId, clientKey, payer, txSig, priceAtomic }) {+ if (!forgeStoreEnabled() || !replicateJobId || !clientKey) return false;+ try {+ const rows = await sql`+ update forge_creations+ set x402_payer = ${payer ?? null},+ x402_tx_sig = ${txSig ?? null},+ x402_price_atomic = ${Number.isFinite(Number(priceAtomic)) ? Number(priceAtomic) : null},+ updated_at = now()+ where replicate_job_id = ${replicateJobId} and client_key = ${clientKey}+ returning id+ `;+ return rows.length > 0;+ } catch (err) {+ if (isDbUnavailableError(err)) console.warn('[forge-store] attachX402Provenance skipped (db unavailable):', err?.message);+ else console.error('[forge-store] attachX402Provenance failed:', err?.message);+ return false;+ }+}+export async function createCreation({clientKey,ipHash,@@ -511,6 +549,7 @@ export async function getPublicCreation({ id }) {const rows = await sql`select fc.id, fc.prompt, fc.aspect, fc.glb_url, fc.preview_image_url, fc.outcome,fc.views_used, fc.multiview, fc.backend, fc.tier, fc.path, fc.model_category, fc.created_at,+ fc.x402_payer, fc.x402_tx_sig, fc.x402_price_atomic,u.username as creator_usernamefrom forge_creations fcleft join users u on u.id = fc.user_id and u.deleted_at is null@@ -536,6 +575,7 @@ export async function getPublicCreation({ id }) {// Real, opt-in attribution only — set when the model was forged while// signed in. Never invented for anonymous generations.creatorUsername: r.creator_username || null,+ ...x402Provenance(r),};} catch (err) {console.error('[forge-store] getPublicCreation failed:', err?.message);@@ -756,6 +796,7 @@ export async function listShowcase({ limit = 12, voterKey = null, sort = 'fresh'select fc.id, fc.prompt, fc.glb_url, fc.preview_image_url,fc.views_used, fc.multiview, fc.backend, fc.tier, fc.path,fc.model_category, fc.created_at, fc.vote_count,+ fc.x402_payer, fc.x402_tx_sig, fc.x402_price_atomic,(v.voter_key is not null) as votedfrom forge_creations fcleft join forge_votes v on v.creation_id = fc.id and v.voter_key = ${vk}@@ -769,6 +810,7 @@ export async function listShowcase({ limit = 12, voterKey = null, sort = 'fresh'select fc.id, fc.prompt, fc.glb_url, fc.preview_image_url,fc.views_used, fc.multiview, fc.backend, fc.tier, fc.path,fc.model_category, fc.created_at, fc.vote_count,+ fc.x402_payer, fc.x402_tx_sig, fc.x402_price_atomic,(v.voter_key is not null) as votedfrom forge_creations fcleft join forge_votes v on v.creation_id = fc.id and v.voter_key = ${vk}@@ -791,6 +833,7 @@ export async function listShowcase({ limit = 12, voterKey = null, sort = 'fresh'created_at: r.created_at,vote_count: Number(r.vote_count) || 0,voted: Boolean(r.voted),+ ...x402Provenance(r),}));} catch (err) {if (isDbUnavailableError(err)) console.warn('[forge-store] listShowcase skipped (db unavailable):', err?.message);@@ -911,6 +954,7 @@ export async function listRecentCreations({ limit = 24, before } = {}) {? await sql`select fc.id, fc.prompt, fc.glb_url, fc.preview_image_url, fc.model_category,fc.parent_creation_id, fc.created_at,+ fc.x402_payer, fc.x402_tx_sig, fc.x402_price_atomic,u.username, u.display_name, u.avatar_urlfrom forge_creations fcleft join users u on u.id = fc.user_id and u.deleted_at is null and u.username is not null@@ -922,6 +966,7 @@ export async function listRecentCreations({ limit = 24, before } = {}) {: await sql`select fc.id, fc.prompt, fc.glb_url, fc.preview_image_url, fc.model_category,fc.parent_creation_id, fc.created_at,+ fc.x402_payer, fc.x402_tx_sig, fc.x402_price_atomic,u.username, u.display_name, u.avatar_urlfrom forge_creations fcleft join users u on u.id = fc.user_id and u.deleted_at is null and u.username is not null@@ -941,6 +986,7 @@ export async function listRecentCreations({ limit = 24, before } = {}) {username: r.username || null,displayName: r.display_name || null,avatarUrl: r.avatar_url || null,+ ...x402Provenance(r),}));} catch (err) {if (isDbUnavailableError(err)) console.warn('[forge-store] listRecentCreations skipped (db unavailable):', err?.message);diff --git a/api/_lib/migrations/20260725150000_forge_x402_provenance.sql b/api/_lib/migrations/20260725150000_forge_x402_provenance.sqlnew file mode 100644index 000000000..db84679e4--- /dev/null+++ b/api/_lib/migrations/20260725150000_forge_x402_provenance.sql@@ -0,0 +1,21 @@+-- x402 payment provenance on forge creations.+--+-- Paid generations through POST /api/x402/forge historically produced a GLB for+-- the buyer but never landed in forge_creations, so the community gallery showed+-- none of the agent-economy output and a settled payment left no artifact trail.+-- The endpoint now records one creation row per settled generation; these three+-- columns carry the receipt: who paid, the on-chain settle signature, and the+-- price. A populated x402_tx_sig is what the gallery renders as the+-- "paid via x402" provenance badge (Solscan-linkable).+--+-- All three stay NULL for every non-x402 lane.++ALTER TABLE forge_creations ADD COLUMN IF NOT EXISTS x402_payer text;+ALTER TABLE forge_creations ADD COLUMN IF NOT EXISTS x402_tx_sig text;+ALTER TABLE forge_creations ADD COLUMN IF NOT EXISTS x402_price_atomic bigint;++-- The gallery filters/badges on "is an x402 creation"; a partial index keeps the+-- predicate cheap without taxing the (much larger) non-x402 corpus.+CREATE INDEX IF NOT EXISTS forge_creations_x402_idx+ ON forge_creations (created_at DESC)+ WHERE x402_tx_sig IS NOT NULL;diff --git a/api/_lib/migrations/20260725160000_oracle_signal_tx_receipt.sql b/api/_lib/migrations/20260725160000_oracle_signal_tx_receipt.sqlnew file mode 100644index 000000000..988ef9ff7--- /dev/null+++ b/api/_lib/migrations/20260725160000_oracle_signal_tx_receipt.sql@@ -0,0 +1,10 @@+-- Payment receipt on oracle intel signals.+--+-- Every row in oracle_intel_signals is bought: the x402 autonomous loop pays a+-- real USDC settle for the intel call that produced it. The settle signature+-- was recorded in x402_autonomous_log but never carried onto the signal row,+-- so the sniper's oracle gate could act on a paid signal without being able to+-- cite the payment. This column closes the provenance chain:+-- paid call (tx_signature) -> signal row -> gate adjustment -> trade decision.++ALTER TABLE oracle_intel_signals ADD COLUMN IF NOT EXISTS tx_signature text;diff --git a/api/cron/forge-finalize.js b/api/cron/forge-finalize.jsindex 8d56b7b83..1f1415362 100644--- a/api/cron/forge-finalize.js+++ b/api/cron/forge-finalize.js@@ -36,6 +36,8 @@ import { constantTimeEquals } from '../_lib/crypto.js';import { materializeCreation, markFailed, forgeStoreEnabled } from '../_lib/forge-store.js';import { notifyForgeComplete, notifyForgeFailed } from '../_lib/forge-notify.js';import { createRegenProvider as createGcpProvider } from '../_providers/gcp.js';+import { createNvidiaProvider } from '../_providers/nvidia.js';+import { decodeJobToken } from '../_lib/forge-job-token.js';export const maxDuration = 60;@@ -107,6 +109,12 @@ export default wrapCron(async (req, res) => {// No GCP_RECONSTRUCTION_KEY on this deployment: envelope rows can't be// polled here; the hard TTL below still reaps them.}+ let nvidia = null;+ try {+ nvidia = createNvidiaProvider();+ } catch {+ // NIM unconfigured: forge-token rows can't be polled here; hard TTL reaps.+ }const out = { done: 0, failed: 0, timed_out: 0, still_running: 0, unpollable: 0 };@@ -156,7 +164,41 @@ export default wrapCron(async (req, res) => {// queued / running / poll blip: fall through to the TTL check.} else if (!envelope) {- out.unpollable++;+ // The paid x402 lane stores the FULL signed forge token (provider ++ // upstream task id) so unattended agent purchases can be completed+ // server-side here, so an agent that got its poll_url answer and moved on+ // still ends with a finished gallery row, not a TTL orphan.+ const forgeToken = decodeJobToken(row.replicate_job_id);+ if (forgeToken?.provider === 'nvidia' && forgeToken.taskId && nvidia) {+ const status = await nvidia+ .status({ kind: forgeToken.kind, taskId: forgeToken.taskId })+ .catch(() => null);+ if (status?.status === 'done' && status.resultGlbUrl) {+ const durable = await materializeCreation({+ replicateJobId: row.replicate_job_id,+ clientKey: row.client_key,+ glbUrl: status.resultGlbUrl,+ });+ if (durable) {+ out.done++;+ continue;+ }+ out.still_running++;+ continue;+ }+ if (status?.status === 'failed') {+ await markFailed({+ replicateJobId: row.replicate_job_id,+ clientKey: row.client_key,+ error: status.error || 'generation failed',+ });+ out.failed++;+ continue;+ }+ // queued / running / poll blip: fall through to the TTL check.+ } else {+ out.unpollable++;+ }}if (ageMinutes > HARD_TTL_MINUTES) {diff --git a/api/cron/x402-autonomous-loop.js b/api/cron/x402-autonomous-loop.jsindex 22e3719f6..864a353a3 100644--- a/api/cron/x402-autonomous-loop.js+++ b/api/cron/x402-autonomous-loop.js@@ -133,25 +133,26 @@ async function recordLog(runId, entry, { amountAtomic, txSig, responseData, dura}}-async function upsertOracleSignal(entry, signalData) {+async function upsertOracleSignal(entry, signalData, txSig = null) {if (!signalData || entry.pipeline !== 'oracle') return;try {await sql`INSERT INTO oracle_intel_signals- (source_id, topic, signal, headline, confidence, price_usd, raw, ts)+ (source_id, topic, signal, headline, confidence, price_usd, raw, tx_signature, ts)VALUES(${entry.id}, ${signalData.topic || entry.id},${signalData.signal || null}, ${signalData.headline || null},${signalData.confidence || null}, ${signalData.price_usd || null},- ${JSON.stringify(signalData)}, now())+ ${JSON.stringify(signalData)}, ${txSig}, now())ON CONFLICT (source_id, topic)DO UPDATE SET- signal = EXCLUDED.signal,- headline = EXCLUDED.headline,- confidence = EXCLUDED.confidence,- price_usd = EXCLUDED.price_usd,- raw = EXCLUDED.raw,- ts = now()+ signal = EXCLUDED.signal,+ headline = EXCLUDED.headline,+ confidence = EXCLUDED.confidence,+ price_usd = EXCLUDED.price_usd,+ raw = EXCLUDED.raw,+ tx_signature = EXCLUDED.tx_signature,+ ts = now()`;} catch (err) {// Table may not exist yet — suppress, it will be created by the migration.@@ -198,18 +199,23 @@ async function ensureSchema() {try {await sql`CREATE TABLE IF NOT EXISTS oracle_intel_signals (- source_id text NOT NULL,- topic text NOT NULL,- signal text,- headline text,- confidence numeric(5,2),- price_usd numeric(20,8),- raw jsonb,- ts timestamptz DEFAULT now(),+ source_id text NOT NULL,+ topic text NOT NULL,+ signal text,+ headline text,+ confidence numeric(5,2),+ price_usd numeric(20,8),+ raw jsonb,+ tx_signature text,+ ts timestamptz DEFAULT now(),PRIMARY KEY (source_id, topic))`;} catch { /* already exists */ }+ try {+ // Pre-migration deployments created the table without the receipt column.+ await sql`ALTER TABLE oracle_intel_signals ADD COLUMN IF NOT EXISTS tx_signature text`;+ } catch { /* concurrent tick or insufficient privileges; migration covers it */ }}async function getDailySpend(redis) {@@ -367,6 +373,40 @@ export default wrapCron(async (req, res) => {);}+ // ── Sponsor SOL floor: the settle ceiling neither cap can see ────────────+ // This loop builds SPONSOR-mode payments (buildPaymentTx without selfPay), so+ // every settle is fee-paid by the sponsor wallet, and the self-facilitator+ // fail-closes the moment that wallet dips under SPONSOR_SOL_FLOOR_LAMPORTS.+ // Without this read, a below-floor sponsor still probes, signs, and POSTs a+ // payment for every ready entry, and every one dies at settle with a 502+ // (observed: ~420 fee_wallet_below_floor rejects/hour, for days). Read the+ // sponsor balance once per tick and treat below-floor as a hard pause on paid+ // calls: free endpoints and run()-style monitors keep running, and ONE deduped+ // CRITICAL alert names the wallet instead of a silent failure wave.+ // `null` = balance read failed; unknown must not read as "paused".+ const sponsorPubkey = env.X402_FEE_PAYER_SOLANA || null;+ let sponsorSolLamports = null;+ if (sponsorPubkey) {+ try {+ sponsorSolLamports = await conn.getBalance(new PublicKey(sponsorPubkey), 'confirmed');+ } catch (err) {+ log.warn('sponsor_sol_read_failed', { message: err?.message });+ }+ }+ const sponsorFloorPaused =+ sponsorSolLamports !== null && sponsorSolLamports < SPONSOR_SOL_FLOOR_LAMPORTS;+ if (sponsorFloorPaused) {+ log.warn('autonomous_sponsor_sol_floor', { sponsor: sponsorPubkey, lamports: sponsorSolLamports, floor: SPONSOR_SOL_FLOOR_LAMPORTS });+ await sendOpsAlert(+ '⛔ x402 autonomous loop paused: sponsor wallet below SOL settle floor',+ `Sponsor ${sponsorPubkey} holds ${(sponsorSolLamports / 1e9).toFixed(6)} SOL, below the ` ++ `${(SPONSOR_SOL_FLOOR_LAMPORTS / 1e9).toFixed(3)} SOL settle floor. The self-facilitator ` ++ 'fail-closes every settle at this level, so all paid calls are skipped this tick (free and ' ++ 'monitoring entries keep running). Fund the sponsor with SOL (or let treasury-topup refuel it) to resume.',+ { signature: `x402-autonomous-sponsor-sol-floor:${sponsorPubkey}` },+ );+ }+// ── Process each entry ────────────────────────────────────────────────────const results = [];let remainingCap = DAILY_CAP_ATOMIC - dailySpentSoFar;@@ -511,6 +551,14 @@ export default wrapCron(async (req, res) => {continue;}+ // Below the settle floor every sponsor-mode payment is rejected by the+ // facilitator before broadcast; skip BEFORE building/signing/POSTing.+ if (sponsorFloorPaused) {+ results.push({ id: entry.id, status: 'skip', reason: 'sponsor_sol_floor_paused' });+ await setCooldown(redis, entry); // SOL won't appear mid-cooldown; stop re-probing+ continue;+ }+amountAtomic = Number(accept.amount || 0);if (amountAtomic > remainingCap) {log.info('autonomous_cap_would_exceed', { id: entry.id, amount: amountAtomic, remaining: remainingCap });@@ -578,7 +626,9 @@ export default wrapCron(async (req, res) => {await incrementDailySpend(redis, amountAtomic);if (entry.extractSignal) signalData = entry.extractSignal(responseBody);await setCooldown(redis, entry);- if (signalData) await upsertOracleSignal(entry, signalData);+ // The settle signature rides along so the sniper's oracle gate can cite+ // the exact on-chain payment behind each signal it acts on.+ if (signalData) await upsertOracleSignal(entry, signalData, txSig);await runStoreValue(entry, { sql, redis, responseBody, signalData, runId, targetUrl, targetContext, endpointUrl, origin, durationMs: Date.now() - t0, success, amountAtomic, txSig });} else {errorMsg = `http_${paidRes.status}`;diff --git a/api/x402/forge.js b/api/x402/forge.jsindex d794f16e8..e834ed109 100644--- a/api/x402/forge.js+++ b/api/x402/forge.js@@ -83,6 +83,14 @@ import {FORGE_BAZAAR,} from '../_lib/forge-listing.js';import { llmComplete } from '../_lib/llm.js';+import { randomUUID } from 'node:crypto';+import {+ attachX402Provenance,+ createCreation,+ forgeStoreEnabled,+ hashClient,+ materializeCreation,+} from '../_lib/forge-store.js';const ROUTE = '/api/x402/forge';const REQUIRED_SCOPE = 'x402:bypass';@@ -719,8 +727,62 @@ export default wrap(async (req, res) => {paymentResponseHeader,});}++ // Gallery + provenance: every settled generation becomes a real forge_creations+ // row, so agent-economy output lands in the same community gallery as every+ // other lane, stamped with who paid, the settle signature, and the price.+ if (!parsed.isHealthCheck) {+ await recordPaidCreation({ parsed, result, settled, priceAtomics });+ }});+// Record a settled paid generation into forge_creations with x402 provenance.+// Inline-done lanes (HF reconstruct, synchronous NIM) materialize immediately:+// the GLB is copied durable and the row goes straight to 'done', visible in the+// gallery within one feed refresh. Async lanes store the FULL job token as the+// job key; api/cron/forge-finalize decodes it and completes the row+// server-side, so the artifact lands even if the buyer never polls. Runs after+// the response is sent; every step is best-effort, and a store hiccup must never+// affect the buyer, who already has their result.+async function recordPaidCreation({ parsed, result, settled, priceAtomics }) {+ if (!forgeStoreEnabled() || !result || result.status === 'failed') return;+ try {+ const payer = settled?.payer || null;+ // One stable pseudo-identity per paying wallet: their creations group in+ // "recent" feeds the same way a browser's do, without inventing a user.+ const clientKey = hashClient(`x402:${payer || 'anon'}`);+ const jobKey = result.job_id || `x402-${randomUUID().replace(/-/g, '')}`;+ const created = await createCreation({+ clientKey,+ ipHash: null,+ prompt: parsed.prompt || (parsed.isImageMode ? 'image reconstruction (x402)' : ''),+ aspect: parsed.aspect,+ previewImageUrl: null,+ replicateJobId: jobKey,+ textToImageModel: null,+ viewsRequested: parsed.imageUrls?.length ?? 0,+ viewsUsed: null,+ multiview: (parsed.imageUrls?.length ?? 0) > 1,+ backend: result.backend ?? null,+ tier: result.tier ?? null,+ path: 'x402',+ });+ if (!created) return;+ await attachX402Provenance({+ replicateJobId: jobKey,+ clientKey,+ payer,+ txSig: settled?.transaction || null,+ priceAtomic: priceAtomics,+ });+ if (result.status === 'done' && result.glb_url) {+ await materializeCreation({ replicateJobId: jobKey, clientKey, glbUrl: result.glb_url });+ }+ } catch (err) {+ console.warn(`[x402/forge] gallery record failed (buyer unaffected): ${err?.message || err}`);+ }+}+// Validate a parsed body object (the stream is already consumed by the handler).// Mirrors parseRequest but takes an object instead of the request stream.async function parseRequestFromObject(body) {diff --git a/data/changelog.json b/data/changelog.jsonindex 1562e23de..46dfc387e 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,17 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-07-25",+ "title": "Agent-bought 3D models now appear in the gallery with their on-chain receipt",+ "summary": "When an AI agent pays for a 3D generation through the x402 forge endpoint, the finished model now lands in the public community gallery like any other creation, wearing a green x402 badge that links straight to the settle transaction on Solscan: who paid, what it cost, receipt one click away. Async generations finish server-side even if the buying agent never checks back. The trading sniper closes the same provenance loop from the other side: every market signal it buys now carries the payment signature of the call that bought it, so a trade decision can cite the exact on-chain payment that informed it. Also fixed: the autonomous economy loop now pauses cleanly with one loud alert when its fee wallet runs low instead of burning hundreds of doomed calls per hour, and three volume endpoints that were calling the dance-tip stage with the wrong HTTP method work again.",+ "tags": [+ "feature",+ "improvement",+ "fix"+ ],+ "link": "/forge"+ },{"date": "2026-07-25","title": "Closed the tab while your avatar was building? It finishes anyway now",diff --git a/docs/autonomous-x402.md b/docs/autonomous-x402.mdindex 19cc0265f..2a67e6cf2 100644--- a/docs/autonomous-x402.md+++ b/docs/autonomous-x402.md@@ -36,6 +36,17 @@ Each tick:Payments are real on chain — no mocks, no simulations.+Two per-tick balance reads act as hard pause switches in front of every paid+call, because neither cap above can see them: the payer's **USDC float** (an+empty float skips paid entries instead of signing payments that die at settle+with "Simulation failed") and the sponsor fee wallet's **SOL settle floor**+(below `X402_SPONSOR_SOL_FLOOR_LAMPORTS` the self-facilitator fail-closes every+sponsor-mode settle, so the loop skips paid entries rather than hammering+hundreds of doomed 502s per hour). Both fire one deduped CRITICAL ops alert+naming the wallet; free endpoints and `run()`-style monitors keep running while+paused, and `api/cron/treasury-topup` refuels the wallets when the economy+master holds funds.+## Configuration| Env var | Default | Purpose |@@ -187,7 +198,8 @@ corroborate — the ops financial-integrity surface alerts on those. Detail:| Sink | Written by ||---|---|| `x402_autonomous_log` | Every call (success or failure), with `signal_data` / `value_extracted`. |-| `oracle_intel_signals` | `oracle` / `sniper` entries, keyed by source + topic; consumed by the sniper oracle gate. |+| `oracle_intel_signals` | `oracle` / `sniper` entries, keyed by source + topic; consumed by the sniper oracle gate. Each row carries `tx_signature`, the settle signature of the paid call that bought it, so a gate decision can cite its receipt (surfaced as `signal_receipts` on gate results). |+| `forge_creations` | Every settled `POST /api/x402/forge` generation (any buyer, not just this loop). The row lands in the public community gallery with `x402_payer` / `x402_tx_sig` / `x402_price_atomic` provenance; the gallery renders a Solscan-linked "x402 · $price" badge. Inline-done lanes materialize immediately; async lanes store the full job token and `api/cron/forge-finalize` completes them server-side. || `agent_custody_events` | The USDC spend, with `category: 'x402'` (see [Money feed](money-feed.md)). || `x402_volume_metrics` | Per-endpoint proof-of-volume + liveness ledger from the Volume Bootstrap Loop (see [x402 revenue](x402-revenue.md#proof-of-volume--x402_volume_metrics)). || `payment_reconciliation` | One verdict per settlement claim from the daily reconciliation job (see [x402 revenue](x402-revenue.md#reconciliation--payment_reconciliation)). |diff --git a/docs/x402-endpoints.md b/docs/x402-endpoints.mdindex b73d3415e..527a9740f 100644--- a/docs/x402-endpoints.md+++ b/docs/x402-endpoints.md@@ -174,7 +174,7 @@ datapoints at **$0.0005** USDC each by default, overridable per family with| Endpoint | Default | Returns || ----------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------- |-| `/api/x402/forge` | tiered | Text/image → 3D model (price by tier; GPU-bound). See [Avatar pipeline](avatar-pipeline.md). |+| `/api/x402/forge` | tiered | Text/image → 3D model (price by tier; GPU-bound). Every settled generation also lands in the public community gallery (`forge_creations`) stamped with the payer, settle signature, and price; the gallery shows a Solscan-linked "x402" provenance badge. See [Avatar pipeline](avatar-pipeline.md). || `/api/x402/embody` | $1.00 | **Embodiment.** One call, an agent buys itself a body: prompt or image in → rigged, voiced 3D avatar out, plus a durable persona id and a one-tag `<iframe>` embed for any website. Settles on delivery — a failed generation never charges. See [Embodiment](embody.md). || `/api/x402/pipeline` | per stage | **One call, full 3D asset pipeline** — text or GLB in, rigged/optimized game-ready GLB out. Ordered chain of `generate → rig → remesh → gameready → stylize`; the 402 quote is the exact sum of the requested stages. Poll free at `/api/forge?job=<id>` for per-stage progress. See [3D pipeline](3d-pipeline.md). || `/api/x402/pipeline-rig` | $0.05 | **Pipeline — Rig.** Static GLB in → animation-ready rigged GLB out (skeleton + skin weights). One paid call, durable URL. See [3D pipeline](3d-pipeline.md). |diff --git a/public/changelog.json b/public/changelog.jsonindex 5d0e36ced..925f29d4b 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-25T11:13:11.300Z",+ "generated_at": "2026-07-25T11:31:37.124Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -46,6 +46,18 @@"launch"]},+ {+ "date": "2026-07-25",+ "type": "update",+ "title": "Agent-bought 3D models now appear in the gallery with their on-chain receipt",+ "summary": "When an AI agent pays for a 3D generation through the x402 forge endpoint, the finished model now lands in the public community gallery like any other creation, wearing a green x402 badge that links straight to the settle transaction on Solscan: who paid, what it cost, receipt one click away. Async generations finish server-side even if the buying agent never checks back. The trading sniper closes the same provenance loop from the other side: every market signal it buys now carries the payment signature of the call that bought it, so a trade decision can cite the exact on-chain payment that informed it. Also fixed: the autonomous economy loop now pauses cleanly with one loud alert when its fee wallet runs low instead of burning hundreds of doomed calls per hour, and three volume endpoints that were calling the dance-tip stage with the wrong HTTP method work again.",+ "link": "/forge",+ "tags": [+ "feature",+ "improvement",+ "fix"+ ]+ },{"date": "2026-07-25","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 771bb427b..1906cee0a 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -38,6 +38,14 @@<category>launch</category><description>three.ws has been named an OpenAI Select Partner within the OpenAI Partner Network. What we ship on OpenAI surfaces today: a free 3D Studio MCP connector for ChatGPT, custom GPT Actions, the open Spatial MCP response shape, and one-tap AR.</description></item>+ <item>+ <title>Agent-bought 3D models now appear in the gallery with their on-chain receipt</title>+ <link>https://three.ws/forge</link>+ <guid isPermaLink="false">2026-07-25:Agent-bought 3D models now appear in the gallery with their on-chain receipt</guid>+ <pubDate>Sat, 25 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>When an AI agent pays for a 3D generation through the x402 forge endpoint, the finished model now lands in the public community gallery like any other creation, wearing a green x402 badge that links straight to the settle transaction on Solscan: who paid, what it cost, receipt one click away. Async generations finish server-side even if the buying agent never checks back. The trading sniper closes the same provenance loop from the other side: every market signal it buys now carries the payment signature of the call that bought it, so a trade decision can cite the exact on-chain payment that informed it. Also fixed: the autonomous economy loop now pauses cleanly with one loud alert when its fee wallet runs low instead of burning hundreds of doomed calls per hour, and three volume endpoints that were calling the dance-tip stage with the wrong HTTP method work again.</description>+ </item><item><title>Check any 3D tool result against the Spatial MCP standard, in the page, as you type</title><link>https://three.ws/spatial-mcp</link>diff --git a/src/forge-showcase.js b/src/forge-showcase.jsindex 390ccb41e..d2d009c53 100644--- a/src/forge-showcase.js+++ b/src/forge-showcase.js@@ -81,6 +81,8 @@ function ensureShowcaseVoteStyles() {.showcase-cat-badge.model-cat-creature { background: rgba(251,146,60,.18); color: #fdba74; }.showcase-cat-badge.model-cat-vehicle { background: rgba(56,189,248,.18); color: #7dd3fc; }.showcase-cat-badge.model-cat-other { background: rgba(255,255,255,.08); color: #a1a1aa; }+ .showcase-x402-badge { background: rgba(20,241,149,.14); color: #5eead4; text-decoration: none; transition: background .15s ease; z-index: 2; position: relative; }+ .showcase-x402-badge:hover, .showcase-x402-badge:focus-visible { background: rgba(20,241,149,.28); outline: none; }`;document.head.appendChild(style);}@@ -440,6 +442,22 @@ function buildCard(c) {foot.appendChild(catBadge);}+ // x402 provenance: this model was bought by an agent with real on-chain+ // USDC. The badge links to the settle transaction so the receipt is one+ // click away; stopPropagation keeps it from opening the viewer.+ if (c.x402?.tx_sig) {+ const pay = document.createElement('a');+ pay.className = 'showcase-cat-badge showcase-x402-badge';+ pay.href = `https://solscan.io/tx/${encodeURIComponent(c.x402.tx_sig)}`;+ pay.target = '_blank';+ pay.rel = 'noopener noreferrer';+ pay.textContent = c.x402.price_usdc != null ? `x402 · $${c.x402.price_usdc}` : 'x402';+ pay.title = `Paid via x402 by ${c.x402.payer ? `${c.x402.payer.slice(0, 4)}…${c.x402.payer.slice(-4)}` : 'an agent'}. View settle transaction`;+ pay.setAttribute('aria-label', 'Paid via x402. View settle transaction on Solscan');+ pay.addEventListener('click', (e) => e.stopPropagation());+ foot.appendChild(pay);+ }+// Right-aligned actions: upvote + Remix, kept together so the footer reads// as [when · category] ……… [▲ votes] [Remix].const actions = document.createElement('div');diff --git a/src/forge-studio/forge-showcase.js b/src/forge-studio/forge-showcase.jsindex a9158dac3..b3d7e9993 100644--- a/src/forge-studio/forge-showcase.js+++ b/src/forge-studio/forge-showcase.js@@ -81,6 +81,8 @@ function ensureShowcaseVoteStyles() {.showcase-cat-badge.model-cat-creature { background: rgba(251,146,60,.18); color: #fdba74; }.showcase-cat-badge.model-cat-vehicle { background: rgba(56,189,248,.18); color: #7dd3fc; }.showcase-cat-badge.model-cat-other { background: rgba(255,255,255,.08); color: #a1a1aa; }+ .showcase-x402-badge { background: rgba(20,241,149,.14); color: #5eead4; text-decoration: none; transition: background .15s ease; z-index: 2; position: relative; }+ .showcase-x402-badge:hover, .showcase-x402-badge:focus-visible { background: rgba(20,241,149,.28); outline: none; }`;document.head.appendChild(style);}@@ -440,6 +442,22 @@ function buildCard(c) {foot.appendChild(catBadge);}+ // x402 provenance: this model was bought by an agent with real on-chain+ // USDC. The badge links to the settle transaction so the receipt is one+ // click away; stopPropagation keeps it from opening the viewer.+ if (c.x402?.tx_sig) {+ const pay = document.createElement('a');+ pay.className = 'showcase-cat-badge showcase-x402-badge';+ pay.href = `https://solscan.io/tx/${encodeURIComponent(c.x402.tx_sig)}`;+ pay.target = '_blank';+ pay.rel = 'noopener noreferrer';+ pay.textContent = c.x402.price_usdc != null ? `x402 · $${c.x402.price_usdc}` : 'x402';+ pay.title = `Paid via x402 by ${c.x402.payer ? `${c.x402.payer.slice(0, 4)}…${c.x402.payer.slice(-4)}` : 'an agent'}. View settle transaction`;+ pay.setAttribute('aria-label', 'Paid via x402. View settle transaction on Solscan');+ pay.addEventListener('click', (e) => e.stopPropagation());+ foot.appendChild(pay);+ }+// Right-aligned actions: upvote + Remix, kept together so the footer reads// as [when · category] ……… [▲ votes] [Remix].const actions = document.createElement('div');diff --git a/tests/x402-registry-http-shape.test.js b/tests/x402-registry-http-shape.test.jsnew file mode 100644index 000000000..fdcddea71--- /dev/null+++ b/tests/x402-registry-http-shape.test.js@@ -0,0 +1,34 @@+import { describe, it, expect } from 'vitest';++import { getSelfRegistry } from '../api/_lib/x402/autonomous-registry.js';++// Regression guard for the July 2026 405 wave: the three "Dance Tip Volume"+// entries POSTed a JSON body at /api/x402/dance-tip, a GET-only endpoint that+// reads query params, so every call bounced with http_405 (2,700+ failures in+// 48h) while looking like real volume attempts. Registry entries must match the+// HTTP shape of the endpoint they buy from.++describe('autonomous registry HTTP shape', () => {+ const registry = getSelfRegistry();++ it('dance-tip volume entries are GET with query params in the path', () => {+ const tips = registry.filter((e) => e.id?.startsWith('dance-tip-vol'));+ expect(tips.length).toBeGreaterThanOrEqual(3);+ for (const e of tips) {+ expect(e.method).toBe('GET');+ expect(e.body ?? null).toBeNull();+ expect(e.path).toMatch(/^\/api\/x402\/dance-tip\?dancer=\d&dance=\w+$/);+ }+ });++ it('no fetch-style entry sends a body on a GET', () => {+ // run()-style entries own their whole call and are exempt; plain entries+ // are fetched by the loop with { method, body } verbatim, where a GET with+ // a body is always a shape bug (undefined behavior per fetch spec).+ const offenders = registry+ .filter((e) => typeof e.run !== 'function')+ .filter((e) => (e.method || 'POST') === 'GET' && e.body != null)+ .map((e) => e.id);+ expect(offenders).toEqual([]);+ });+});diff --git a/workers/agent-sniper/oracle-gate.js b/workers/agent-sniper/oracle-gate.jsindex cc2d5cdb1..bae5ec76a 100644--- a/workers/agent-sniper/oracle-gate.js+++ b/workers/agent-sniper/oracle-gate.js@@ -40,6 +40,10 @@ const RUG_FRESH_MINUTES = Number(process.env.SNIPER_RUGPULL_FRESH_MIN || 60);let _macroCache = null;let _macroCacheTs = 0;const MACRO_TTL_MS = 120_000;+// Settle signatures of the paid x402 calls behind the current macro adjustment,+// refreshed together with _macroCache. Surfaced on gate results so every trade+// decision carries the on-chain receipts of the signals that shaped it.+let _macroReceipts = [];// Per-coin sentiment cache (separate from the conviction cache).const _sentCache = new Map(); // key → { adj, ts }@@ -66,7 +70,7 @@ async function getMacroAdjustment() {}try {const rows = await sql`- select source_id, topic, signal, confidence, ts+ select source_id, topic, signal, confidence, tx_signature, tsfrom oracle_intel_signalswhere topic in ('solana', 'bitcoin', 'pump')and ts > now() - interval '1 hour'@@ -87,6 +91,7 @@ async function getMacroAdjustment() {let adjustment = 0;const WEIGHTS = { solana: 1.2, bitcoin: 0.8, pump: 1.5 };+ const receipts = [];for (const [topic, row] of Object.entries(latest)) {const w = WEIGHTS[topic] ?? 1.0;@@ -102,10 +107,18 @@ async function getMacroAdjustment() {adjustment -= Math.round(5 * w * confFactor);}// 'neutral' → no adjustment.++ // Payment provenance: the settle signature of the x402 call that bought+ // this signal, so a trade decision can point at the exact on-chain+ // payment that informed it (journal + /sniper surfaces).+ if (sig === 'bearish' || sig === 'bullish') {+ receipts.push({ topic, signal: sig, tx_signature: row.tx_signature || null });+ }}// Clamp: never move the bar more than ±15 points.adjustment = Math.max(-15, Math.min(15, adjustment));+ _macroReceipts = receipts;_macroCache = adjustment;_macroCacheTs = Date.now();return adjustment;@@ -289,8 +302,14 @@ export async function oracleGate(mint, network, strat) {reason: `oracle_below_min:${score}<${effectiveMin}${breakdown}`,macro_adjustment: macroAdj,coin_adjustment: coinAdj,+ ...(macroAdj !== 0 && _macroReceipts.length ? { signal_receipts: _macroReceipts } : {}),};}- return { pass: true, macro_adjustment: macroAdj, coin_adjustment: coinAdj };+ return {+ pass: true,+ macro_adjustment: macroAdj,+ coin_adjustment: coinAdj,+ ...(macroAdj !== 0 && _macroReceipts.length ? { signal_receipts: _macroReceipts } : {}),+ };}