Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(zauth): 402/401 client-aware MCP auth challenge, pay-by-name telemetry, replay tooling

nirholascbae7a04cdbd
diff --git a/api/_lib/zauth.js b/api/_lib/zauth.js
index 5520a1cd0..b05371d5d 100644
--- a/api/_lib/zauth.js
+++ b/api/_lib/zauth.js
@@ -163,7 +163,7 @@ function buildMiddleware() {
// 3. Agent payment routes (delegated x402 calls + invoice payments).
const MONITORED_SERVERS =
/\/api\/(wk-x402|mcp|mcp-3d|mcp-agent|mcp-bazaar|pump-fun-mcp|ibm-mcp|x402-pay)(\/|$)/;
-const MONITORED_X402_FREE = /\/api\/x402\/(admin(\/|$)|did$|my-receipts$)/;
+const MONITORED_X402_FREE = /\/api\/x402\/(admin(\/|$)|did$|my-receipts$|pay-by-name$)/;
const MONITORED_X402 = /\/api\/x402\/[^/]/;
const MONITORED_AGENTS =
/\/api\/agents\/x402\/|\/api\/agents\/[^/]+\/x402\/|\/api\/agents\/payments\//;
diff --git a/api/_mcp/auth.js b/api/_mcp/auth.js
index 0c76c93e6..2cbb9227e 100644
--- a/api/_mcp/auth.js
+++ b/api/_mcp/auth.js
@@ -24,18 +24,33 @@ export function send401(res, msg) {
res.end(JSON.stringify({ error: 'unauthorized', error_description: msg }));
}
-// Challenge for an unauthenticated request with no payment. Returns 401 with a
-// WWW-Authenticate header so MCP/OAuth clients (claude.ai connectors, the MCP
-// TS SDK) can discover the protected-resource metadata and start the OAuth
-// flow — they require status 401 per the MCP authorization spec (RFC 9728).
+// MCP clients speaking Streamable HTTP MUST advertise SSE support in Accept
+// (spec 2025-06-18 §Transports), and post-initialize requests carry the
+// MCP-Protocol-Version / Mcp-Session-Id headers. x402 agents, Bazaar
+// validators, and registry crawlers (zauth) send none of these — they expect
+// a plain 402 Payment Required.
+function isMcpProtocolClient(req) {
+ const h = req?.headers || {};
+ if (h['mcp-protocol-version'] || h['mcp-session-id']) return true;
+ const accept = String(h.accept || '');
+ return accept.includes('text/event-stream');
+}
+
+// Challenge for an unauthenticated request with no payment. MCP/OAuth clients
+// (claude.ai connectors, the MCP TS SDK) get 401 with a WWW-Authenticate
+// header so they can discover the protected-resource metadata and start the
+// OAuth flow — they require status 401 per the MCP authorization spec
+// (RFC 9728). Everything else (x402 agents, Bazaar validators, the zauth
+// registry) gets the same envelope as a proper 402 Payment Required, which is
+// what x402 tooling keys on. (A bare 402 for everyone made the connector
+// probe spin; a blanket 401 made x402 crawlers misclassify the endpoints.)
//
-// We ALSO ship the x402 payment envelope in the body + PAYMENT-REQUIRED header,
-// so x402-aware clients and Bazaar validators can still read the price/accepts
-// from this same response. (Previously this path returned a bare 402, which
-// OAuth clients couldn't interpret — the connector probe just spun.)
-export function sendAuthChallenge(res, { resourceUrl, requirements, challenge }) {
+// Both shapes ship the x402 payment envelope in the body + PAYMENT-REQUIRED
+// header, and both carry WWW-Authenticate, so either kind of client can
+// recover from a mismatched guess.
+export function sendAuthChallenge(res, { req, resourceUrl, requirements, challenge }) {
const resource = env.MCP_RESOURCE;
- res.statusCode = 401;
+ res.statusCode = isMcpProtocolClient(req) ? 401 : 402;
res.setHeader(
'www-authenticate',
`Bearer resource_metadata=${quoteString(`${env.APP_ORIGIN}/.well-known/oauth-protected-resource`)}, resource=${quoteString(resource)}`,
@@ -141,7 +156,7 @@ export async function authenticateRequest(
}
}
- sendAuthChallenge(res, { resourceUrl, requirements, challenge });
+ sendAuthChallenge(res, { req, resourceUrl, requirements, challenge });
return null;
}
@@ -155,6 +170,7 @@ export async function handleSse(req, res, { resourcePath = '/api/mcp', challenge
if (!bearer && !req.headers['x-payment']) {
const sseResourceUrl = resolveResourceUrl(req, resourcePath);
return sendAuthChallenge(res, {
+ req,
resourceUrl: sseResourceUrl,
requirements: paymentRequirements(sseResourceUrl),
challenge,
diff --git a/api/_mcp3d/text-to-image.js b/api/_mcp3d/text-to-image.js
index 7f863f237..e9520378a 100644
--- a/api/_mcp3d/text-to-image.js
+++ b/api/_mcp3d/text-to-image.js
@@ -51,21 +51,44 @@ function parseRetryAfter(headers, message) {
return 10;
}
+// Vertex Imagen returns the PNG inline as a data: URI. Downstream image-to-3D
+// providers take URLs (Replicate caps inline data URIs at ~256 KB — a 1024px
+// Imagen PNG blows straight past that), so persist the bytes to object storage
+// and hand back a durable https URL instead.
+async function persistDataUriImage(result) {
+ if (!result?.imageUrl?.startsWith('data:')) return result;
+ const { putObject, publicUrl } = await import('../_lib/r2.js');
+ const b64 = result.imageUrl.split(',')[1] || '';
+ const key = `forge/refs/${globalThis.crypto.randomUUID()}.png`;
+ await putObject({ key, body: Buffer.from(b64, 'base64'), contentType: 'image/png' });
+ return { ...result, imageUrl: publicUrl(key) };
+}
+
// Generate a single image from a text prompt.
//
// Prefers Vertex AI Imagen when GOOGLE_CLOUD_PROJECT is configured (free with
-// GCP credits, higher quality). Falls back to Replicate flux-schnell otherwise.
+// GCP credits, higher quality). Falls back to Replicate flux-schnell otherwise —
+// including when the Vertex path is configured but fails (bad service-account
+// JSON, expired model, missing object storage for the inline PNG): a broken
+// preferred provider must degrade to the working one, never take down the
+// whole text→3D pipeline.
export async function textToImage(prompt, { aspectRatio = '1:1' } = {}) {
+ const token = readEnv('REPLICATE_API_TOKEN');
+
// ── Vertex AI Imagen path ────────────────────────────────────────────────
if (readEnv('GOOGLE_CLOUD_PROJECT')) {
- const { generateImage, isConfigured } = await import('./vertex-imagen.js');
- if (isConfigured()) {
- return generateImage(prompt, { aspectRatio });
+ try {
+ const { generateImage, isConfigured } = await import('./vertex-imagen.js');
+ if (isConfigured()) {
+ return await persistDataUriImage(await generateImage(prompt, { aspectRatio }));
+ }
+ } catch (err) {
+ if (!token) throw err;
+ console.error(`vertex imagen failed, falling back to replicate: ${err?.message}`);
}
}
// ── Replicate fallback ───────────────────────────────────────────────────
- const token = readEnv('REPLICATE_API_TOKEN');
if (!token) {
throw Object.assign(
new Error(
diff --git a/api/_mcp3d/vertex-imagen.js b/api/_mcp3d/vertex-imagen.js
index 6dbe4b13c..7bec96c7d 100644
--- a/api/_mcp3d/vertex-imagen.js
+++ b/api/_mcp3d/vertex-imagen.js
@@ -59,8 +59,8 @@ async function getAccessToken() {
}
const saJson = readEnv('GCP_SERVICE_ACCOUNT_JSON');
- if (saJson) {
- return _tokenFromServiceAccount(JSON.parse(saJson));
+ if (saJson && saJson.trim() && saJson.trim() !== '""') {
+ return _tokenFromServiceAccount(parseServiceAccount(saJson));
}
// Fall back to the metadata server (Cloud Run / GCE)
@@ -84,6 +84,40 @@ async function getAccessToken() {
);
}
+// Service-account JSON pasted into a secrets UI routinely arrives mangled:
+// wrapped in an extra layer of quotes, with escaped inner quotes (`{\"type\"…}`),
+// or base64-encoded. Accept every common mangling; reject with a designed
+// `unconfigured` error (instead of a raw JSON.parse crash) so callers can
+// branch to a fallback provider.
+function parseServiceAccount(raw) {
+ let v = raw.trim();
+ if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) {
+ v = v.slice(1, -1).trim();
+ }
+ const candidates = [v, v.replace(/\\"/g, '"')];
+ if (/^[A-Za-z0-9+/=\s]+$/.test(v)) {
+ try {
+ candidates.push(Buffer.from(v, 'base64').toString('utf8'));
+ } catch {
+ // not base64 — fall through to the error below
+ }
+ }
+ for (const candidate of candidates) {
+ try {
+ const sa = JSON.parse(candidate);
+ if (sa && typeof sa === 'object' && sa.client_email && sa.private_key) return sa;
+ } catch {
+ // try the next decoding
+ }
+ }
+ throw Object.assign(
+ new Error(
+ 'GCP_SERVICE_ACCOUNT_JSON is set but is not a valid service-account JSON object (expected client_email + private_key). Re-paste the raw key file contents.',
+ ),
+ { code: 'unconfigured' },
+ );
+}
+
async function _tokenFromServiceAccount(sa) {
// Build a JWT for the service account and exchange it for an access token.
// Uses the Web Crypto API (available in Node 18+ and Vercel edge runtime).
diff --git a/api/_providers/replicate.js b/api/_providers/replicate.js
index 1832b767d..8f7dc0820 100644
--- a/api/_providers/replicate.js
+++ b/api/_providers/replicate.js
@@ -84,6 +84,29 @@ function multiviewModel() {
return readEnv('REPLICATE_MULTIVIEW_MODEL') || null;
}
+// Replicate serves the unversioned /models/{owner}/{name}/predictions endpoint
+// for official models, but community models (firtoz/trellis included) 404 there
+// unless a version is pinned. Resolve the model's latest published version once
+// per process and retry through the version-pinned /predictions endpoint.
+const _latestVersionCache = new Map();
+
+async function resolveLatestVersion(owner, name, authHeaders) {
+ const slug = `${owner}/${name}`;
+ if (_latestVersionCache.has(slug)) return _latestVersionCache.get(slug);
+ const res = await fetch(`${REPLICATE_BASE}/models/${owner}/${name}`, { headers: authHeaders });
+ const data = await res.json().catch(() => ({}));
+ if (!res.ok || !data?.latest_version?.id) {
+ throw Object.assign(
+ new Error(
+ data?.detail || `replicate model ${slug} not found or has no published version`,
+ ),
+ { code: 'mode_unconfigured', status: 502, providerStatus: res.status },
+ );
+ }
+ _latestVersionCache.set(slug, data.latest_version.id);
+ return data.latest_version.id;
+}
+
function isMultiviewCapable(modelRef) {
if (!modelRef) return false;
const slug = String(modelRef).split(':')[0].toLowerCase();
@@ -359,7 +382,29 @@ export function createRegenProvider() {
});
}
- const data = await response.json().catch(() => ({}));
+ let data = await response.json().catch(() => ({}));
+
+ // Community models 404 on the unversioned model-level endpoint even
+ // though the model exists — resolve the latest published version and
+ // retry through the version-pinned predictions endpoint.
+ if (response.status === 404 && slugMatch && !isVersionHash) {
+ const [, owner, name, pinnedVersion] = slugMatch;
+ const version = pinnedVersion || (await resolveLatestVersion(owner, name, authHeaders));
+ try {
+ response = await fetch(`${REPLICATE_BASE}/predictions`, {
+ method: 'POST',
+ headers: authHeaders,
+ body: JSON.stringify({ ...requestBody, version }),
+ });
+ } catch (err) {
+ throw Object.assign(new Error(`replicate submit failed: ${err?.message}`), {
+ code: 'provider_unreachable',
+ status: 502,
+ });
+ }
+ data = await response.json().catch(() => ({}));
+ }
+
if (!response.ok) {
throw Object.assign(
new Error(data?.detail || data?.title || `replicate returned ${response.status}`),
diff --git a/api/pump-fun-mcp.js b/api/pump-fun-mcp.js
index 733415dee..1e6626224 100644
--- a/api/pump-fun-mcp.js
+++ b/api/pump-fun-mcp.js
@@ -19,7 +19,12 @@
import { cors, json, method, wrap, readJson, rateLimited } from './_lib/http.js';
import { limits, clientIp } from './_lib/rate-limit.js';
import { extractBearer, authenticateBearer } from './_lib/auth.js';
-import { verifyPayment, resolveResourceUrl, paymentRequirements } from './_lib/x402-spec.js';
+import {
+ verifyPayment,
+ resolveResourceUrl,
+ paymentRequirements,
+ build402Body,
+} from './_lib/x402-spec.js';
import { getPumpSdk, getConnection, solanaPubkey, getAmmPoolState } from './_lib/pump.js';
import { pumpfunMcp, pumpfunBotEnabled } from './_lib/pumpfun-mcp.js';
import { getRadarSignals } from '../src/kol/radar.js';
@@ -752,9 +757,25 @@ async function authorizeGatedTool(req, res, id) {
return false;
}
}
- json(res, 401, rpcEnvelope(id, null, {
- code: -32001,
- message: 'authentication required for this tool (provide a Bearer token or X-PAYMENT)',
+ // No bearer, no payment: answer 402 Payment Required with the full x402
+ // envelope so paying agents (and registry crawlers like zauth) can discover
+ // price/accepts. The body keeps the JSON-RPC error shape MCP clients
+ // expect, with the envelope mirrored in error.data and the
+ // PAYMENT-REQUIRED header (same dual-protocol pattern as _mcp/auth.js).
+ const resourceUrl = resolveResourceUrl(req, '/api/pump-fun-mcp');
+ const envelope = build402Body({
+ resourceUrl,
+ accepts: paymentRequirements(resourceUrl),
+ error: 'X-PAYMENT header is required',
+ });
+ res.setHeader(
+ 'PAYMENT-REQUIRED',
+ Buffer.from(JSON.stringify(envelope), 'utf8').toString('base64'),
+ );
+ json(res, 402, rpcEnvelope(id, null, {
+ code: -32402,
+ message: 'payment or authentication required for this tool (provide a Bearer token or X-PAYMENT)',
+ data: envelope,
}));
return false;
}
diff --git a/api/x402-pay.js b/api/x402-pay.js
index 21cf21591..d59a83321 100644
--- a/api/x402-pay.js
+++ b/api/x402-pay.js
@@ -542,7 +542,7 @@ export default wrap(async (req, res) => {
// the demo UI can render "wallet not configured" instead of a
// red console error. Other failures still bubble as 500.
if (err.code === 'wallet_misconfigured' || err.code === 'wallet_unconfigured') {
- return json(res, 200, { configured: false, error: err.message, address: null, sol: 0, usdc: 0 });
+ return json(res, 200, { configured: false, code: err.code, error: err.message, address: null, sol: 0, usdc: 0 });
}
return json(res, err.status || 500, { error: err.message });
}
diff --git a/chat/src/PayWalletPicker.svelte b/chat/src/PayWalletPicker.svelte
index 5896e19c2..b33219487 100644
--- a/chat/src/PayWalletPicker.svelte
+++ b/chat/src/PayWalletPicker.svelte
@@ -9,6 +9,7 @@
let demoWallet = { address: null, usdc: null, sol: null, configured: null };
let demoLoading = false;
let demoError = '';
+ let demoUnconfigured = false;
let popoverEl;
let buttonEl;
@@ -28,12 +29,19 @@
async function loadDemoWallet() {
demoLoading = true;
demoError = '';
+ demoUnconfigured = false;
try {
const r = await fetch('/api/x402-pay?balance=1');
if (!r.ok) throw new Error('HTTP ' + r.status);
demoWallet = await r.json();
- if (demoWallet?.configured === false && demoWallet.error) {
- demoError = demoWallet.error;
+ if (demoWallet?.configured === false) {
+ // A wallet that simply isn't set up is a neutral state, not an
+ // error — only misconfiguration and fetch failures go red.
+ if (demoWallet.code === 'wallet_unconfigured') {
+ demoUnconfigured = true;
+ } else {
+ demoError = demoWallet.error || 'wallet misconfigured';
+ }
}
} catch (err) {
demoError = err.message || 'failed to load demo wallet';
@@ -200,6 +208,8 @@
{shortAddr(demoWallet.address)} · {fmtUsdc(demoWallet.usdc)}
{:else if demoError}
<span class="text-red-600">{demoError}</span>
+ {:else if demoUnconfigured && signedIn && agentsWithWallet.length > 0}
+ not configured — pick one of your agent wallets below
{:else}
not configured
{/if}
diff --git a/pages/avatar-artifact.html b/pages/avatar-artifact.html
index f67edc420..8a4eaaa5c 100644
--- a/pages/avatar-artifact.html
+++ b/pages/avatar-artifact.html
@@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
+ <title>Avatar Viewer — three.ws</title>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
diff --git a/pages/home.html b/pages/home.html
index e717b818a..19780f05f 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -2551,7 +2551,6 @@
<a class="nav-mi" href="/arbitrage" role="menuitem"><span class="nav-mi-t">API Arbitrage <span class="nav-pill-sm">New</span></span><span class="nav-mi-d">Cheapest endpoint per capability, live</span></a>
<a class="nav-mi" href="/providers" role="menuitem"><span class="nav-mi-t">API Providers <span class="nav-pill-sm">New</span></span><span class="nav-mi-d">Operator profiles for the paid API catalog</span></a>
<a class="nav-mi" href="/unstoppable" role="menuitem"><span class="nav-mi-t">Unstoppable Agent <span class="nav-pill-sm">New</span></span><span class="nav-mi-d">Self-funding agent dashboard, live</span></a>
- <a class="nav-mi" href="/rider" role="menuitem"><span class="nav-mi-t">Rider (VR)</span><span class="nav-mi-d">Open-source VR music visualization</span></a>
<a class="nav-mi" href="/forever" role="menuitem"><span class="nav-mi-t">Forever</span><span class="nav-mi-d">Etch a message into Bitcoin — forever</span></a>
<a class="nav-mi" href="/eth-vanity" role="menuitem"><span class="nav-mi-t">ETH vanity (CREATE2)</span><span class="nav-mi-d">Grind a smart-contract address</span></a>
<a class="nav-mi" href="/vanity-wallet" role="menuitem"><span class="nav-mi-t">Vanity wallet</span><span class="nav-mi-d">Grind a Solana address</span></a>
@@ -2624,7 +2623,6 @@
<a href="/arbitrage">API Arbitrage</a>
<a href="/providers">API Providers</a>
<a href="/unstoppable">Unstoppable Agent</a>
- <a href="/rider">Rider (VR)</a>
<a href="/forever">Forever</a>
<div class="dr-h">More</div>
<a href="/pricing">Pricing</a>
diff --git a/pages/pump-dashboard.html b/pages/pump-dashboard.html
index c18084c18..dc0adef11 100644
--- a/pages/pump-dashboard.html
+++ b/pages/pump-dashboard.html
@@ -67,59 +67,59 @@
</div>
<nav>
<div class="pd-nav-section">Overview</div>
- <a href="#" data-page="dashboard" class="is-active">
+ <a href="#dashboard" data-page="dashboard" class="is-active">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><rect x="2" y="2" width="5" height="5" rx="1"/><rect x="9" y="2" width="5" height="5" rx="1"/><rect x="2" y="9" width="5" height="5" rx="1"/><rect x="9" y="9" width="5" height="5" rx="1"/></svg>
Dashboard
</a>
- <a href="#" data-page="feed">
+ <a href="#feed" data-page="feed">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M2 10c0-3.3 2.7-6 6-6"/><path d="M2 6c0-2.2 1.8-4 4-4"/><circle cx="3" cy="13" r="1.2" fill="currentColor" stroke="none"/></svg>
Live Feed
</a>
<div class="pd-nav-section">Tracking</div>
- <a href="#" data-page="watches">
+ <a href="#watches" data-page="watches">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M1.5 8s2.5-5 6.5-5 6.5 5 6.5 5-2.5 5-6.5 5S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="2.2"/></svg>
Watch List
</a>
- <a href="#" data-page="claims">
+ <a href="#claims" data-page="claims">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M5.5 8.5l1.8 1.8L10.8 6.5"/></svg>
Fee Claims
</a>
- <a href="#" data-page="alerts">
+ <a href="#alerts" data-page="alerts">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M3 11c0-3 1-7 5-7s5 4 5 7M2 11h12M7 13h2"/></svg>
Alerts
</a>
<div class="pd-nav-section">Tools</div>
- <a href="#" data-page="scanner">
+ <a href="#scanner" data-page="scanner">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5l3 3"/></svg>
Token Scanner
</a>
- <a href="#" data-page="quoting">
+ <a href="#quoting" data-page="quoting">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M2 12l3-4 3 2 4-6 2 3"/></svg>
Quote Engine
</a>
- <a href="#" data-page="vanity">
+ <a href="#vanity" data-page="vanity">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="5" cy="11" r="2.5"/><path d="M7 9l6-6M11 4l2 2"/></svg>
Vanity Generator
</a>
<div class="pd-nav-section">Agent</div>
- <a href="#" data-page="animations">
+ <a href="#animations" data-page="animations">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="8" cy="5" r="2.5"/><path d="M3 14c0-3 2.2-5 5-5s5 2 5 5"/></svg>
Default Agent
</a>
- <a href="#" data-page="revenue">
+ <a href="#revenue" data-page="revenue">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M2 13l3.5-4 3 2.5L13 5"/><path d="M10 5h3v3"/></svg>
Revenue
</a>
<div class="pd-nav-section">System</div>
- <a href="#" data-page="config">
+ <a href="#config" data-page="config">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="8" cy="8" r="2"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"/></svg>
Configuration
</a>
- <a href="#" data-page="api">
+ <a href="#api" data-page="api">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><rect x="2" y="6" width="5" height="4" rx="1"/><path d="M7 8h4M11 6v4M14 6v4M11 6h3M11 10h3"/></svg>
API Reference
</a>
@@ -946,6 +946,8 @@
function navigateTo(page) {
state.currentPage = page;
+ // Keep the URL shareable: every cockpit page is deep-linkable via its #hash.
+ if (location.hash.slice(1) !== page) history.replaceState(null, '', '#' + page);
document.querySelectorAll('.pd-page').forEach((p) => p.classList.remove('is-active'));
const target = $('page-' + page);
if (target) target.classList.add('is-active');
@@ -1681,7 +1683,7 @@
try {
const resp = await apiFetch('/api/v1/watches?limit=100');
if (resp.status === 404) {
- tbody.innerHTML = `<tr><td colspan="6" class="pd-empty">Watches require a PumpKit-style API. Point the API URL in <a href="#" data-page-link="config" class="pd-mono" style="color:var(--accent)">Configuration</a> at your PumpKit deployment.</td></tr>`;
+ tbody.innerHTML = `<tr><td colspan="6" class="pd-empty">Watches require a PumpKit-style API. Point the API URL in <a href="#config" data-page-link="config" class="pd-mono" style="color:var(--accent)">Configuration</a> at your PumpKit deployment.</td></tr>`;
$('pd-watches-count').textContent = '0';
bindPageLinks();
return;
@@ -2719,6 +2721,14 @@
a.addEventListener('click', (e) => { e.preventDefault(); navigateTo(a.dataset.page); });
});
+ // Deep links: honor #hash on load and when the URL is edited by hand.
+ const hashPage = location.hash.slice(1);
+ if (hashPage && hashPage !== state.currentPage && $('page-' + hashPage)) navigateTo(hashPage);
+ window.addEventListener('hashchange', () => {
+ const page = location.hash.slice(1);
+ if (page && page !== state.currentPage && $('page-' + page)) navigateTo(page);
+ });
+
// Filter buttons
document.querySelectorAll('.pd-filter-btn').forEach((b) => {
b.addEventListener('click', () => {
diff --git a/public/footer.css b/public/footer.css
index 3c1a0e356..1f1094978 100644
--- a/public/footer.css
+++ b/public/footer.css
@@ -526,6 +526,15 @@
grid-template-columns: repeat(2, 1fr);
gap: 1.25rem 1rem;
}
+ /* 44px minimum touch targets (WCAG 2.5.8) without changing desktop rhythm */
+ .h-footer-link-col {
+ gap: 0.25rem;
+ }
+ .h-footer-links a {
+ display: inline-flex;
+ align-items: center;
+ min-height: 44px;
+ }
.h-footer-bottom {
flex-direction: column;
align-items: flex-start;
diff --git a/public/nav-data.js b/public/nav-data.js
new file mode 100644
index 000000000..c6329a6e5
--- /dev/null
+++ b/public/nav-data.js
@@ -0,0 +1,285 @@
+// three.ws site navigation — the single source of truth for every menu.
+//
+// Consumed by:
+// - public/nav.js renders the desktop dropdowns and the
+// mobile drawer from this data at runtime
+// - chat/src/three-ui/TopNav.svelte chat header's main-site links
+//
+// Edit menus HERE and only here. Never hand-write menu markup in nav.html or
+// a page header — that is exactly the drift this module exists to kill.
+//
+// Shapes:
+// group: { label, badge?, note?, layout?: 'wide' | 'mega',
+// items?: item[], columns?: { label, items: item[] }[] }
+// - default layout: single-column dropdown of `items`
+// - 'wide': two-column dropdown of `items`
+// - 'mega': right-anchored three-column dropdown of named `columns`
+// item: { title, href, desc, badge?, attrs? }
+// - attrs: extra HTML attributes, e.g. { 'data-glossary-open': '' }
+
+export const NAV_GROUPS = [
+ {
+ label: 'Build',
+ items: [
+ {
+ title: 'Create an agent',
+ href: '/create-agent',
+ badge: 'New',
+ desc: 'Guided wizard: name, 3D body, skills, personality → ship it',
+ },
+ {
+ title: 'Vanity wallet',
+ href: '/vanity-wallet',
+ badge: 'New',
+ desc: 'Grind a custom Solana address — prefix, suffix, or both',
+ },
+ {
+ title: 'Worlds',
+ href: '/play',
+ badge: 'New',
+ desc: 'Every coin is a 3D world — drop in & hang out',
+ },
+ { title: 'Create avatar', href: '/create', desc: 'Pick or upload a 3D body' },
+ {
+ title: 'Selfie to avatar',
+ href: '/create/selfie',
+ desc: 'One photo → rigged 3D avatar',
+ },
+ {
+ title: 'Avatar Studio',
+ href: '/avatar-studio',
+ desc: 'Sculpt face + body from scratch → export GLB',
+ },
+ {
+ title: 'Text to 3D',
+ href: '/forge',
+ badge: 'New',
+ desc: 'Describe an object → textured GLB',
+ },
+ {
+ title: 'Voice Lab',
+ href: '/voice',
+ badge: 'New',
+ desc: 'Clone your voice · TTS playground',
+ },
+ { title: 'Pose Studio', href: '/pose', desc: 'Click-to-pose mannequin + export PNG' },
+ { title: 'Viewer', href: '/app', desc: 'Drag-and-drop GLB' },
+ {
+ title: 'Playground',
+ href: '/playground',
+ desc: 'Viewer + environment + embed code',
+ },
+ { title: 'glTF Validator', href: '/validation', desc: 'Khronos spec check' },
+ ],
+ },
+ {
+ label: 'Discover',
+ items: [
+ {
+ title: 'What is three.ws?',
+ href: '/what-is',
+ desc: 'Plain-English intro + real use-cases — start here',
+ },
+ {
+ title: 'Features',
+ href: '/features',
+ desc: 'Everything an agent gets — interactive tour',
+ },
+ { title: 'ERC-8004 Agents', href: '/discover', desc: 'On-chain agent directory' },
+ { title: 'Agents Index', href: '/agents', desc: 'Browse every registered agent' },
+ {
+ title: 'Reputation Explorer',
+ href: '/reputation',
+ desc: 'On-chain scores & attestations',
+ },
+ { title: 'Marketplace', href: '/marketplace', desc: 'Buy, sell & remix agents' },
+ { title: 'Avatar Gallery', href: '/gallery', desc: 'Every public 3D avatar' },
+ {
+ title: 'Skills',
+ href: '/skills',
+ badge: 'New',
+ desc: 'Browse agent tool packs & capabilities',
+ },
+ { title: 'x402 Bazaar', href: '/bazaar', desc: 'Browse paid APIs and MCP tools' },
+ {
+ title: 'Community',
+ href: '/community',
+ desc: 'X, GitHub, and ways to get involved',
+ },
+ {
+ title: 'Labs',
+ href: '/labs',
+ badge: 'New',
+ desc: 'Hidden gems — fact-checker, tutor, lipsync & more',
+ },
+ ],
+ },
+ {
+ label: 'Embed',
+ items: [
+ { title: 'Widgets', href: '/widgets', desc: 'Browse + customize embeddable widgets' },
+ { title: 'Widget Studio', href: '/studio', desc: 'Pick avatar → copy snippet' },
+ { title: 'Embed editor', href: '/embed.html', desc: 'Tune mode, size, position' },
+ {
+ title: 'Avatar SDK',
+ href: '/avatar-sdk',
+ badge: 'New',
+ desc: 'npm · web component · React · GLB upload',
+ },
+ { title: 'Embed docs', href: '/docs#embedding', desc: 'iframe + oEmbed' },
+ { title: '<agent-3d>', href: '/docs#web-component', desc: 'Web component reference' },
+ ],
+ },
+ {
+ label: 'Learn',
+ items: [
+ { title: 'Docs', href: '/docs', desc: 'SDKs + API reference' },
+ { title: 'Tutorials', href: '/tutorials', desc: 'Step-by-step guides' },
+ {
+ title: 'Brain',
+ href: '/brain',
+ badge: 'New',
+ desc: 'Claude · GPT · DeepSeek · Qwen · Llama',
+ },
+ { title: 'Chat', href: '/chat', desc: 'Talk to your agent' },
+ { title: 'Pay', href: '/pay', desc: 'Agent payments — x402 + USDC' },
+ { title: 'Solana SDK', href: '/docs#solana', desc: 'Attestations + agent-kit' },
+ {
+ title: 'Glossary',
+ href: '#',
+ desc: 'Plain-English definitions for crypto terms',
+ attrs: { 'data-glossary-open': '' },
+ },
+ ],
+ },
+ {
+ label: 'Integrations',
+ layout: 'wide',
+ note: 'Live partner showcases — built on real platforms, running end-to-end.',
+ items: [
+ {
+ title: 'Agent Galaxy',
+ href: '/ibm/galaxy',
+ desc: 'Granite embeddings → 3D semantic agent map',
+ },
+ { title: 'Oracle', href: '/ibm/oracle', desc: 'Granite TimeSeries forecasting in 3D' },
+ { title: 'Digital Twin', href: '/ibm/twin', desc: 'Living market replica + projection' },
+ {
+ title: 'Trust Layer',
+ href: '/ibm/trust-layer',
+ desc: 'Granite Guardian governs wallet agents',
+ },
+ {
+ title: 'Identity Firewall',
+ href: '/ibm/identity',
+ desc: 'Granite gate against agent impersonation',
+ },
+ {
+ title: 'Proof',
+ href: '/ibm/proof',
+ desc: 'On-chain AI notary — forecast → govern → Solana',
+ },
+ { title: 'Vision', href: '/ibm/vision', desc: 'Granite Vision — image → understanding' },
+ {
+ title: 'AWS Marketplace',
+ href: '/aws',
+ desc: 'three.ws as an AWS Partner listing',
+ },
+ ],
+ },
+ {
+ label: 'Labs',
+ badge: 'Beta',
+ layout: 'mega',
+ note: 'Experimental features — actively iterating. Expect rough edges.',
+ columns: [
+ {
+ label: 'Avatar & Motion',
+ items: [
+ { title: 'Lipsync', href: '/lipsync', desc: 'TTS or mic → in-browser viseme → mouth' },
+ { title: 'Mocap Studio', href: '/mocap-studio', desc: 'Record face → save clip → replay' },
+ { title: 'Pose Studio', href: '/pose', desc: 'Click-to-pose mannequin + export PNG' },
+ { title: 'OBS Overlay', href: '/overlay-control', desc: 'Stream deck — emote hotkeys, mic' },
+ { title: 'Walk', href: '/walk', desc: 'Walk your avatar — multiplayer + AR' },
+ { title: 'XR', href: '/xr', desc: 'Place your avatar in the real world' },
+ { title: 'Rider (VR)', href: '/rider', desc: 'Open-source VR music visualization' },
+ ],
+ },
+ {
+ label: 'Markets & Pump',
+ items: [
+ {
+ title: 'Launchpad Studio',
+ href: '/launchpad',
+ desc: 'Build a 3D launchpad · token · concierge',
+ },
+ { title: 'GMGN Smart Money', href: '/gmgn', desc: 'Agent narrates smart wallet signals' },
+ { title: 'Pump.fun stream', href: '/pumpfun', desc: 'Mint agent tokens' },
+ { title: 'Live launches', href: '/pump-live', desc: 'Real-time launch feed' },
+ { title: 'Pump Dashboard', href: '/pump-dashboard', desc: 'Watches · scanner · quotes' },
+ { title: 'Pump Visualizer', href: '/pump-visualizer', desc: '3D view of trending tokens' },
+ {
+ title: '$THREE Live',
+ href: '/three-live',
+ badge: 'New',
+ desc: 'Protocol pulse — live trades in 3D',
+ },
+ { title: 'Strategy Lab', href: '/strategy-lab', desc: 'DCA + subscriptions' },
+ ],
+ },
+ {
+ label: 'x402 & Onchain',
+ items: [
+ { title: 'Pole Club', href: '/club', desc: 'x402 micro-tip demo — $0.001 / dance' },
+ {
+ title: 'Endpoint Shopper',
+ href: '/shopper',
+ desc: 'AI chains x402 endpoints to answer a task',
+ },
+ {
+ title: 'Pay-As-You-Learn Tutor',
+ href: '/tutor',
+ desc: '$0.01 per answer in USDC over x402',
+ },
+ {
+ title: 'Fact Checker',
+ href: '/fact-checker',
+ desc: '$0.10 per claim — cited verdict + attestation',
+ },
+ { title: 'API Arbitrage', href: '/arbitrage', desc: 'Cheapest endpoint per capability, live' },
+ {
+ title: 'API Providers',
+ href: '/providers',
+ desc: 'Operator profiles for the paid API catalog',
+ },
+ {
+ title: 'Unstoppable Agent',
+ href: '/unstoppable',
+ desc: 'Self-funding agent dashboard, live',
+ },
+ { title: 'Forever', href: '/forever', desc: 'Etch a message into Bitcoin — forever' },
+ { title: 'EVM vanity wallet', href: '/evm-wallet', desc: 'Grind an Ethereum / EVM address' },
+ { title: 'ETH vanity (CREATE2)', href: '/eth-vanity', desc: 'Grind a smart-contract address' },
+ ],
+ },
+ ],
+ },
+];
+
+// Top-level links rendered after the dropdown groups (no submenu).
+export const NAV_LINKS = [{ label: 'Pricing', href: '/pricing' }];
+
+// Footer-of-drawer links that have no desktop dropdown home.
+export const DRAWER_LEGAL = [
+ { title: 'Privacy Policy', href: '/legal/privacy' },
+ { title: 'Terms of Use', href: '/legal/tos' },
+];
+
+// The chat SPA header shows a compact subset of main-site destinations.
+// Kept here so chat and the main nav can never disagree on labels or hrefs.
+export const CHAT_SITE_LINKS = [
+ { label: 'Marketplace', href: '/marketplace' },
+ { label: 'Pay', href: '/pay' },
+ { label: 'Features', href: '/features' },
+ { label: 'Docs', href: '/docs' },
+];
diff --git a/public/nav.css b/public/nav.css
index e6f67a660..98e731529 100644
--- a/public/nav.css
+++ b/public/nav.css
@@ -245,6 +245,8 @@
@media (max-width: 880px) {
.nav-main { display: none; }
.nav-inner { padding: 14px 20px; gap: 16px; }
+ /* 44px minimum touch targets: expand the brand's hit area without moving it */
+ .nav .brand { padding: 10px 8px; margin: -10px -8px; }
}
/* ── NAV DROPDOWNS ───────────────────────────────────────────── */
@@ -357,6 +359,7 @@
}
.nav-drawer .dr-h:first-child { padding-top: 4px; }
.nav-drawer a {
+ display: flex; align-items: center; min-height: 44px;
padding: 11px 16px; font-size: var(--text-base); font-weight: 450;
border-radius: 8px;
transition: background 0.12s, color 0.12s;
diff --git a/public/nav.html b/public/nav.html
index 7d8602d2b..4a922f256 100644
--- a/public/nav.html
+++ b/public/nav.html
@@ -4,348 +4,10 @@
<img class="brand-mark" src="/three.svg" alt="three.ws" width="24" height="24" />
<span>three.ws</span>
</a>
- <nav class="nav-main" aria-label="Primary">
- <div class="nav-grp">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <div class="nav-pop" role="menu" aria-label="Build">
- <a class="nav-mi" href="/create-agent" role="menuitem"
- ><span class="nav-mi-t"
- >Create an agent <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d"
- >Guided wizard: name, 3D body, skills, personality → ship it</span
- ></a
- >
- <a class="nav-mi" href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-t"
- >Vanity wallet <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d"
- >Grind a custom Solana address — prefix, suffix, or both</span
- ></a
- >
- <a class="nav-mi" href="/play" role="menuitem"
- ><span class="nav-mi-t">Worlds <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d"
- >Every coin is a 3D world — drop in &amp; hang out</span
- ></a
- >
- <a class="nav-mi" href="/create" role="menuitem"
- ><span class="nav-mi-t">Create avatar</span
- ><span class="nav-mi-d">Pick or upload a 3D body</span></a
- >
- <a class="nav-mi" href="/create/selfie" role="menuitem"
- ><span class="nav-mi-t">Selfie to avatar</span
- ><span class="nav-mi-d">One photo → rigged 3D avatar</span></a
- >
- <a class="nav-mi" href="/avatar-studio" role="menuitem"
- ><span class="nav-mi-t">Avatar Studio</span
- ><span class="nav-mi-d"
- >Sculpt face + body from scratch → export GLB</span
- ></a
- >
- <a class="nav-mi" href="/forge" role="menuitem"
- ><span class="nav-mi-t"
- >Text to 3D <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">Describe an object → textured GLB</span></a
- >
- <a class="nav-mi" href="/voice" role="menuitem"
- ><span class="nav-mi-t">Voice Lab <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">Clone your voice · TTS playground</span></a
- >
- <a class="nav-mi" href="/pose" role="menuitem"
- ><span class="nav-mi-t">Pose Studio</span
- ><span class="nav-mi-d">Click-to-pose mannequin + export PNG</span></a
- >
- <a class="nav-mi" href="/app" role="menuitem"
- ><span class="nav-mi-t">Viewer</span
- ><span class="nav-mi-d">Drag-and-drop GLB</span></a
- >
- <a class="nav-mi" href="/playground" role="menuitem"
- ><span class="nav-mi-t">Playground</span
- ><span class="nav-mi-d">Viewer + environment + embed code</span></a
- >
- <a class="nav-mi" href="/validation" role="menuitem"
- ><span class="nav-mi-t">glTF Validator</span
- ><span class="nav-mi-d">Khronos spec check</span></a
- >
- </div>
- </div>
- <div class="nav-grp">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- >
- Discover<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <div class="nav-pop" role="menu" aria-label="Discover">
- <a class="nav-mi" href="/what-is" role="menuitem"
- ><span class="nav-mi-t">What is three.ws?</span
- ><span class="nav-mi-d"
- >Plain-English intro + real use-cases — start here</span
- ></a
- >
- <a class="nav-mi" href="/features" role="menuitem"
- ><span class="nav-mi-t">Features</span
- ><span class="nav-mi-d"
- >Everything an agent gets — interactive tour</span
- ></a
- >
- <a class="nav-mi" href="/discover" role="menuitem"
- ><span class="nav-mi-t">ERC-8004 Agents</span
- ><span class="nav-mi-d">On-chain agent directory</span></a
- >
- <a class="nav-mi" href="/agents" role="menuitem"
- ><span class="nav-mi-t">Agents Index</span
- ><span class="nav-mi-d">Browse every registered agent</span></a
- >
- <a class="nav-mi" href="/reputation" role="menuitem"
- ><span class="nav-mi-t">Reputation Explorer</span
- ><span class="nav-mi-d">On-chain scores &amp; attestations</span></a
- >
- <a class="nav-mi" href="/marketplace" role="menuitem"
- ><span class="nav-mi-t">Marketplace</span
- ><span class="nav-mi-d">Buy, sell &amp; remix agents</span></a
- >
- <a class="nav-mi" href="/gallery" role="menuitem"
- ><span class="nav-mi-t">Avatar Gallery</span
- ><span class="nav-mi-d">Every public 3D avatar</span></a
- >
- <a class="nav-mi" href="/skills" role="menuitem"
- ><span class="nav-mi-t">Skills <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">Browse agent tool packs &amp; capabilities</span></a
- >
- <a class="nav-mi" href="/bazaar" role="menuitem"
- ><span class="nav-mi-t">x402 Bazaar</span
- ><span class="nav-mi-d">Browse paid APIs and MCP tools</span></a
- >
- <a class="nav-mi" href="/community" role="menuitem"
- ><span class="nav-mi-t">Community</span
- ><span class="nav-mi-d">X, GitHub, and ways to get involved</span></a
- >
- <a class="nav-mi" href="/labs" role="menuitem"
- ><span class="nav-mi-t">Labs <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d"
- >Hidden gems — fact-checker, tutor, lipsync &amp; more</span
- ></a
- >
- </div>
- </div>
- <div class="nav-grp">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- >
- Embed<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <div class="nav-pop" role="menu" aria-label="Embed">
- <a class="nav-mi" href="/widgets" role="menuitem"
- ><span class="nav-mi-t">Widgets</span
- ><span class="nav-mi-d">Browse + customize embeddable widgets</span></a
- >
- <a class="nav-mi" href="/studio" role="menuitem"
- ><span class="nav-mi-t">Widget Studio</span
- ><span class="nav-mi-d">Pick avatar → copy snippet</span></a
- >
- <a class="nav-mi" href="/embed.html" role="menuitem"
- ><span class="nav-mi-t">Embed editor</span
- ><span class="nav-mi-d">Tune mode, size, position</span></a
- >
- <a class="nav-mi" href="/avatar-sdk" role="menuitem"
- ><span class="nav-mi-t"
- >Avatar SDK <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">npm · web component · React · GLB upload</span></a
- >
- <a class="nav-mi" href="/docs#embedding" role="menuitem"
- ><span class="nav-mi-t">Embed docs</span
- ><span class="nav-mi-d">iframe + oEmbed</span></a
- >
- <a class="nav-mi" href="/docs#web-component" role="menuitem"
- ><span class="nav-mi-t">&lt;agent-3d&gt;</span
- ><span class="nav-mi-d">Web component reference</span></a
- >
- </div>
- </div>
- <div class="nav-grp">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- >
- Learn<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <div class="nav-pop" role="menu" aria-label="Learn">
- <a class="nav-mi" href="/docs" role="menuitem"
- ><span class="nav-mi-t">Docs</span
- ><span class="nav-mi-d">SDKs + API reference</span></a
- >
- <a class="nav-mi" href="/tutorials" role="menuitem"
- ><span class="nav-mi-t">Tutorials</span
- ><span class="nav-mi-d">Step-by-step guides</span></a
- >
- <a class="nav-mi" href="/brain" role="menuitem"
- ><span class="nav-mi-t">Brain <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">Claude · GPT · DeepSeek · Qwen · Llama</span></a
- >
- <a class="nav-mi" href="/chat" role="menuitem"
- ><span class="nav-mi-t">Chat</span
- ><span class="nav-mi-d">Talk to your agent</span></a
- >
- <a class="nav-mi" href="/pay" role="menuitem"
- ><span class="nav-mi-t">Pay</span
- ><span class="nav-mi-d">Agent payments — x402 + USDC</span></a
- >
- <a class="nav-mi" href="/docs#solana" role="menuitem"
- ><span class="nav-mi-t">Solana SDK</span
- ><span class="nav-mi-d">Attestations + agent-kit</span></a
- >
- <a class="nav-mi" href="#" role="menuitem" data-glossary-open
- ><span class="nav-mi-t">Glossary</span
- ><span class="nav-mi-d">Plain-English definitions for crypto terms</span></a
- >
- </div>
- </div>
- <div class="nav-grp">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- >
- Labs<span class="nav-pill-sm" aria-hidden="true">Beta</span
- ><span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <div class="nav-pop mega" role="menu" aria-label="Labs">
- <div class="nav-pop-note">
- Experimental features — actively iterating. Expect rough edges.
- </div>
- <div class="nav-col" role="group" aria-label="Avatar &amp; Motion">
- <div class="nav-col-h">Avatar &amp; Motion</div>
- <a class="nav-mi" href="/lipsync" role="menuitem"
- ><span class="nav-mi-t">Lipsync</span
- ><span class="nav-mi-d">TTS or mic → in-browser viseme → mouth</span></a
- >
- <a class="nav-mi" href="/mocap-studio" role="menuitem"
- ><span class="nav-mi-t">Mocap Studio</span
- ><span class="nav-mi-d">Record face → save clip → replay</span></a
- >
- <a class="nav-mi" href="/pose" role="menuitem"
- ><span class="nav-mi-t">Pose Studio</span
- ><span class="nav-mi-d">Click-to-pose mannequin + export PNG</span></a
- >
- <a class="nav-mi" href="/overlay-control" role="menuitem"
- ><span class="nav-mi-t">OBS Overlay</span
- ><span class="nav-mi-d">Stream deck — emote hotkeys, mic</span></a
- >
- <a class="nav-mi" href="/walk" role="menuitem"
- ><span class="nav-mi-t">Walk</span
- ><span class="nav-mi-d">Walk your avatar — multiplayer + AR</span></a
- >
- <a class="nav-mi" href="/xr" role="menuitem"
- ><span class="nav-mi-t">XR</span
- ><span class="nav-mi-d">Place your avatar in the real world</span></a
- >
- </div>
- <div class="nav-col" role="group" aria-label="Markets &amp; Pump">
- <div class="nav-col-h">Markets &amp; Pump</div>
- <a class="nav-mi" href="/launchpad" role="menuitem"
- ><span class="nav-mi-t">Launchpad Studio</span
- ><span class="nav-mi-d"
- >Build a 3D launchpad · token · concierge</span
- ></a
- >
- <a class="nav-mi" href="/gmgn" role="menuitem"
- ><span class="nav-mi-t">GMGN Smart Money</span
- ><span class="nav-mi-d">Agent narrates smart wallet signals</span></a
- >
- <a class="nav-mi" href="/pumpfun" role="menuitem"
- ><span class="nav-mi-t">Pump.fun stream</span
- ><span class="nav-mi-d">Mint agent tokens</span></a
- >
- <a class="nav-mi" href="/pump-live" role="menuitem"
- ><span class="nav-mi-t">Live launches</span
- ><span class="nav-mi-d">Real-time mint feed</span></a
- >
- <a class="nav-mi" href="/pump-dashboard" role="menuitem"
- ><span class="nav-mi-t">Pump Dashboard</span
- ><span class="nav-mi-d">Watches · scanner · quotes</span></a
- >
- <a class="nav-mi" href="/pump-visualizer" role="menuitem"
- ><span class="nav-mi-t">Pump Visualizer</span
- ><span class="nav-mi-d">3D view of trending tokens</span></a
- >
- <a class="nav-mi" href="/three-live" role="menuitem"
- ><span class="nav-mi-t"
- >$THREE Live <span class="nav-pill-sm">New</span></span
- ><span class="nav-mi-d">Protocol pulse — live trades in 3D</span></a
- >
- <a class="nav-mi" href="/strategy-lab" role="menuitem"
- ><span class="nav-mi-t">Strategy Lab</span
- ><span class="nav-mi-d">DCA + subscriptions</span></a
- >
- </div>
- <div class="nav-col" role="group" aria-label="x402 &amp; Onchain">
- <div class="nav-col-h">x402 &amp; Onchain</div>
- <a class="nav-mi" href="/club" role="menuitem"
- ><span class="nav-mi-t">Pole Club</span
- ><span class="nav-mi-d">x402 micro-tip demo — $0.001 / dance</span></a
- >
- <a class="nav-mi" href="/shopper" role="menuitem"
- ><span class="nav-mi-t">Endpoint Shopper</span
- ><span class="nav-mi-d"
- >AI chains x402 endpoints to answer a task</span
- ></a
- >
- <a class="nav-mi" href="/tutor" role="menuitem"
- ><span class="nav-mi-t">Pay-As-You-Learn Tutor</span
- ><span class="nav-mi-d">$0.01 per answer in USDC over x402</span></a
- >
- <a class="nav-mi" href="/fact-checker" role="menuitem"
- ><span class="nav-mi-t">Fact Checker</span
- ><span class="nav-mi-d"
- >$0.10 per claim — cited verdict + attestation</span
- ></a
- >
- <a class="nav-mi" href="/arbitrage" role="menuitem"
- ><span class="nav-mi-t">x402 Arbitrage</span
- ><span class="nav-mi-d">Cheapest endpoint per capability, live</span></a
- >
- <a class="nav-mi" href="/providers" role="menuitem"
- ><span class="nav-mi-t">x402 Providers</span
- ><span class="nav-mi-d"
- >Operator profiles for the paid API catalog</span
- ></a
- >
- <a class="nav-mi" href="/unstoppable" role="menuitem"
- ><span class="nav-mi-t">Unstoppable Agent</span
- ><span class="nav-mi-d">Self-funding agent dashboard, live</span></a
- >
- <a class="nav-mi" href="/forever" role="menuitem"
- ><span class="nav-mi-t">Forever</span
- ><span class="nav-mi-d">Etch a message into Bitcoin — forever</span></a
- >
- <a class="nav-mi" href="/evm-wallet" role="menuitem"
- ><span class="nav-mi-t">EVM vanity wallet</span
- ><span class="nav-mi-d">Grind an Ethereum / EVM address</span></a
- >
- <a class="nav-mi" href="/eth-vanity" role="menuitem"
- ><span class="nav-mi-t">ETH vanity (CREATE2)</span
- ><span class="nav-mi-d">Grind a smart-contract address</span></a
- >
- </div>
- </div>
- </div>
- </nav>
+ <!-- Menu groups + top-level links are rendered here by nav.js from
+ nav-data.js — the single source of truth for every menu item.
+ Do not hand-write menu markup in this file. -->
+ <nav class="nav-main" aria-label="Primary"></nav>
<div class="nav-end">
<button
type="button"
@@ -439,80 +101,5 @@
</button>
</div>
</header>
-<nav class="nav-drawer" id="nav-drawer" aria-label="Mobile" aria-hidden="true">
- <div class="dr-h">Build</div>
- <a href="/create-agent">Create an agent</a>
- <a href="/vanity-wallet">Vanity wallet</a>
- <a href="/play">Worlds</a>
- <a href="/create">Create avatar</a>
- <a href="/create/selfie">Selfie to avatar</a>
- <a href="/avatar-studio">Avatar Studio</a>
- <a href="/forge">Text to 3D</a>
- <a href="/voice">Voice Lab</a>
- <a href="/pose">Pose Studio</a>
- <a href="/app">Viewer</a>
- <a href="/playground">Playground</a>
- <a href="/validation">glTF Validator</a>
- <div class="dr-h">Discover</div>
- <a href="/what-is">What is three.ws?</a>
- <a href="/features">Features</a>
- <a href="/discover">ERC-8004 Agents</a>
- <a href="/agents">Agents Index</a>
- <a href="/reputation">Reputation Explorer</a>
- <a href="/marketplace">Marketplace</a>
- <a href="/gallery">Avatar Gallery</a>
- <a href="/skills">Skills</a>
- <a href="/bazaar">x402 Bazaar</a>
- <a href="/community">Community</a>
- <a href="/labs">Labs</a>
- <div class="dr-h">Embed</div>
- <a href="/widgets">Widgets</a>
- <a href="/studio">Widget Studio</a>
- <a href="/embed.html">Embed editor</a>
- <a href="/avatar-sdk">Avatar SDK</a>
- <a href="/docs#embedding">Embed docs</a>
- <a href="/docs#web-component">&lt;agent-3d&gt;</a>
- <div class="dr-h">Learn</div>
- <a href="/docs">Docs</a>
- <a href="/tutorials">Tutorials</a>
- <a href="/brain">Brain</a>
- <a href="/chat">Chat</a>
- <a href="/pay">Pay</a>
- <a href="/docs#solana">Solana SDK</a>
- <a href="#" data-glossary-open>Glossary</a>
- <div class="dr-h">Labs · Avatar &amp; Motion</div>
- <a href="/lipsync">Lipsync</a>
- <a href="/mocap-studio">Mocap Studio</a>
- <a href="/pose">Pose Studio</a>
- <a href="/overlay-control">OBS Overlay</a>
- <a href="/walk">Walk</a>
- <a href="/xr">XR</a>
- <div class="dr-h">Labs · Markets &amp; Pump</div>
- <a href="/launchpad">Launchpad Studio</a>
- <a href="/gmgn">GMGN Smart Money</a>
- <a href="/pumpfun">Pump.fun stream</a>
- <a href="/pump-live">Live launches</a>
- <a href="/pump-dashboard">Pump Dashboard</a>
- <a href="/pump-visualizer">Pump Visualizer</a>
- <a href="/three-live">$THREE Live</a>
- <a href="/strategy-lab">Strategy Lab</a>
- <div class="dr-h">Labs · x402 &amp; Onchain</div>
- <a href="/club">Pole Club</a>
- <a href="/shopper">Endpoint Shopper</a>
- <a href="/tutor">Pay-As-You-Learn Tutor</a>
- <a href="/fact-checker">Fact Checker</a>
- <a href="/arbitrage">x402 Arbitrage</a>
- <a href="/providers">x402 Providers</a>
- <a href="/unstoppable">Unstoppable Agent</a>
- <a href="/forever">Forever</a>
- <a href="/evm-wallet">EVM vanity wallet</a>
- <a href="/eth-vanity">ETH vanity (CREATE2)</a>
- <div class="dr-h">Legal</div>
- <a href="/legal/privacy">Privacy Policy</a>
- <a href="/legal/tos">Terms of Use</a>
- <div class="dr-h">More</div>
- <a href="/my-agents" id="home-nav-drawer-my-agents" data-auth="in" hidden>My Agents</a>
- <div class="sep"></div>
- <a href="/login" id="home-nav-drawer-cta" data-auth="out">Sign in</a>
- <a class="btn primary btn--primary" href="/dashboard" style="margin-top: 4px">Console →</a>
-</nav>
+<!-- Drawer sections are rendered by nav.js from nav-data.js. -->
+<nav class="nav-drawer" id="nav-drawer" aria-label="Mobile" aria-hidden="true"></nav>
diff --git a/public/nav.js b/public/nav.js
index 6233953b9..cf225af48 100644
--- a/public/nav.js
+++ b/public/nav.js
@@ -1,11 +1,13 @@
// three.ws shared site navigation loader.
//
// Injects the global header (public/nav.html) into any page that includes a
-// `<div id="nav-container"></div>` and `<script src="/nav.js">`, then wires the
-// homepage nav behavior: hover/click dropdowns, the mobile drawer, the Walk
-// Companion toggle, auth-aware CTAs, and active-page highlighting. The markup,
-// styles (public/nav.css) and behavior here mirror pages/home.html so every
-// page reads as the same site.
+// `<div id="nav-container"></div>` and `<script src="/nav.js">`, renders every
+// menu (desktop dropdowns + mobile drawer) from public/nav-data.js — the
+// single source of truth for menu items — then wires the behavior:
+// hover/click dropdowns, the mobile drawer, the Walk Companion toggle,
+// auth-aware CTAs, and active-page highlighting. The homepage
+// (pages/home.html) consumes this same loader, so every page reads as the
+// same site by construction.
// Load the site-wide glossary tooltip system (public/glossary.js) on every
// page. Self-mounting + idempotent; honours <html data-glossary="off">.
@@ -77,14 +79,14 @@ function boot() {
link.href = '/nav.css';
document.head.appendChild(link);
}
- fetch('/nav.html')
- .then((response) => response.text())
- .then((data) => {
- navContainer.innerHTML = data;
+ Promise.all([fetch('/nav.html').then((response) => response.text()), import('/nav-data.js')])
+ .then(([html, navData]) => {
+ navContainer.innerHTML = html;
+ renderMenus(navContainer, navData);
initNav(navContainer);
loadNotificationsInbox();
})
- .catch(() => {});
+ .catch((err) => console.error('nav: failed to load shared navigation', err));
}
if (document.readyState === 'loading') {
@@ -101,6 +103,102 @@ function initNav(root) {
initActivePage(root);
}
+// ── Menu rendering ──────────────────────────────────────────────────────────
+// The desktop dropdowns and the mobile drawer are both rendered from
+// nav-data.js so a menu item can only ever exist in one place.
+function escHtml(s) {
+ return String(s == null ? '' : s)
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+}
+
+function attrString(attrs) {
+ if (!attrs) return '';
+ return Object.keys(attrs)
+ .map((key) => ` ${key}="${escHtml(attrs[key])}"`)
+ .join('');
+}
+
+function renderMenuItem(item) {
+ const badge = item.badge ? ` <span class="nav-pill-sm">${escHtml(item.badge)}</span>` : '';
+ return (
+ `<a class="nav-mi" href="${escHtml(item.href)}" role="menuitem"${attrString(item.attrs)}>` +
+ `<span class="nav-mi-t">${escHtml(item.title)}${badge}</span>` +
+ `<span class="nav-mi-d">${escHtml(item.desc)}</span></a>`
+ );
+}
+
+function renderGroup(group) {
+ const badge = group.badge
+ ? `<span class="nav-pill-sm" aria-hidden="true">${escHtml(group.badge)}</span>`
+ : '';
+ const popClass =
+ group.layout === 'mega' ? 'nav-pop mega' : group.layout === 'wide' ? 'nav-pop wide' : 'nav-pop';
+ const note = group.note ? `<div class="nav-pop-note">${escHtml(group.note)}</div>` : '';
+ const body = group.columns
+ ? group.columns
+ .map(
+ (col) =>
+ `<div class="nav-col" role="group" aria-label="${escHtml(col.label)}">` +
+ `<div class="nav-col-h">${escHtml(col.label)}</div>` +
+ col.items.map(renderMenuItem).join('') +
+ `</div>`,
+ )
+ .join('')
+ : (group.items || []).map(renderMenuItem).join('');
+ return (
+ `<div class="nav-grp">` +
+ `<button type="button" class="nav-trigger" aria-haspopup="true" aria-expanded="false">` +
+ `${escHtml(group.label)}${badge}<span class="nav-caret" aria-hidden="true">▾</span></button>` +
+ `<div class="${popClass}" role="menu" aria-label="${escHtml(group.label)}">${note}${body}</div>` +
+ `</div>`
+ );
+}
+
+function renderTopLink(link) {
+ return `<a href="${escHtml(link.href)}">${escHtml(link.label)}</a>`;
+}
+
+function renderDrawerLink(item) {
+ return `<a href="${escHtml(item.href)}"${attrString(item.attrs)}>${escHtml(item.title)}</a>`;
+}
+
+function renderDrawer(navData) {
+ let html = '';
+ navData.NAV_GROUPS.forEach((group) => {
+ if (group.columns) {
+ group.columns.forEach((col) => {
+ html += `<div class="dr-h">${escHtml(group.label)} · ${escHtml(col.label)}</div>`;
+ html += col.items.map(renderDrawerLink).join('');
+ });
+ } else {
+ html += `<div class="dr-h">${escHtml(group.label)}</div>`;
+ html += (group.items || []).map(renderDrawerLink).join('');
+ }
+ });
+ html += `<div class="dr-h">Legal</div>`;
+ html += navData.DRAWER_LEGAL.map(renderDrawerLink).join('');
+ html += `<div class="dr-h">More</div>`;
+ html += navData.NAV_LINKS.map(renderTopLink).join('');
+ html += `<a href="/my-agents" id="home-nav-drawer-my-agents" data-auth="in" hidden>My Agents</a>`;
+ html += `<div class="sep"></div>`;
+ html += `<a href="/login" id="home-nav-drawer-cta" data-auth="out">Sign in</a>`;
+ html += `<a class="btn primary btn--primary" href="/dashboard" style="margin-top: 4px">Console →</a>`;
+ return html;
+}
+
+function renderMenus(root, navData) {
+ const main = root.querySelector('.nav-main');
+ if (main) {
+ main.innerHTML =
+ navData.NAV_GROUPS.map(renderGroup).join('') + navData.NAV_LINKS.map(renderTopLink).join('');
+ }
+ const drawer = root.querySelector('#nav-drawer');
+ if (drawer) drawer.innerHTML = renderDrawer(navData);
+}
+
// ── Desktop dropdowns ──────────────────────────────────────────────────────
// Hover to open on pointer devices; click/keyboard for touch + accessibility.
function initDropdowns(root) {
diff --git a/scripts/agent-x402-demo/pay.mjs b/scripts/agent-x402-demo/pay.mjs
index 9fa5a89c2..66480f9e8 100644
--- a/scripts/agent-x402-demo/pay.mjs
+++ b/scripts/agent-x402-demo/pay.mjs
@@ -42,7 +42,7 @@ const bs58encode = bs58.default ? bs58.default.encode : bs58.encode;
// A curated menu of live, GET-able paid services with a tangible result.
const SERVICES = {
'agent-reputation': { url: '/api/x402/agent-reputation?agent_id=76bca598-103f-4e3a-8c95-b0d64993258a', blurb: 'an on-chain reputation score for another agent' },
- 'pump-agent-audit': { url: '/api/x402/pump-agent-audit?mint=Aodd9LBDCue4HN6KyhpSai7yudFCoEWJ3FLHdgYajQzb', blurb: "an audit of a live pump.fun agent's token" },
+ 'pump-agent-audit': { url: '/api/x402/pump-agent-audit?mint=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump', blurb: "an audit of a live pump.fun agent's token" },
'symbol-availability': { url: '/api/x402/symbol-availability?ticker=WWWTEST', blurb: 'whether a token ticker is still available' },
};
diff --git a/scripts/audit-home-probe.mjs b/scripts/audit-home-probe.mjs
new file mode 100644
index 000000000..61058c1e8
--- /dev/null
+++ b/scripts/audit-home-probe.mjs
@@ -0,0 +1,77 @@
+// One-off homepage audit probe — run with: node scripts/audit-home-probe.mjs
+import { chromium } from 'playwright';
+
+const URL = 'http://localhost:3000/';
+
+async function probe(viewport, label) {
+ const browser = await chromium.launch();
+ const page = await browser.newPage({ viewport });
+ const consoleMsgs = [];
+ page.on('console', (m) => {
+ if (m.type() === 'error' || m.type() === 'warning') {
+ consoleMsgs.push(`[${m.type()}] ${m.text().slice(0, 200)}`);
+ }
+ });
+ page.on('pageerror', (e) => consoleMsgs.push(`[pageerror] ${String(e).slice(0, 200)}`));
+
+ // Count WebGL context creations
+ await page.addInitScript(() => {
+ window.__glContexts = 0;
+ const orig = HTMLCanvasElement.prototype.getContext;
+ HTMLCanvasElement.prototype.getContext = function (type, ...args) {
+ const ctx = orig.call(this, type, ...args);
+ if (ctx && /webgl/.test(type)) window.__glContexts++;
+ return ctx;
+ };
+ });
+
+ await page.goto(URL, { waitUntil: 'domcontentloaded', timeout: 60000 });
+ await page.waitForTimeout(4000);
+
+ const aboveFold = await page.evaluate(() => {
+ const stage = document.querySelector('.hero-stage');
+ return {
+ heroStageH: stage ? stage.offsetHeight : null,
+ heroStageW: stage ? stage.offsetWidth : null,
+ agentEls: document.querySelectorAll('agent-3d').length,
+ glContexts: window.__glContexts,
+ pageH: document.documentElement.scrollHeight,
+ };
+ });
+
+ // Scroll through the whole page to trigger reveals + lazy boots
+ await page.evaluate(async () => {
+ const step = window.innerHeight * 0.8;
+ for (let y = 0; y < document.documentElement.scrollHeight; y += step) {
+ window.scrollTo(0, y);
+ await new Promise((r) => setTimeout(r, 350));
+ }
+ });
+ await page.waitForTimeout(5000);
+
+ const afterScroll = await page.evaluate(() => {
+ const reveals = [...document.querySelectorAll('.reveal')];
+ return {
+ reveals: reveals.length,
+ revealed: reveals.filter((el) => el.classList.contains('vis')).length,
+ agentEls: document.querySelectorAll('agent-3d').length,
+ glContexts: window.__glContexts,
+ pageH: document.documentElement.scrollHeight,
+ heroAgentAlive: (() => {
+ const a = document.querySelector('#hero-stage-inner agent-3d');
+ return a ? a.classList.contains('loaded') : null;
+ })(),
+ };
+ });
+
+ console.log(`\n===== ${label} (${viewport.width}x${viewport.height}) =====`);
+ console.log('above fold:', JSON.stringify(aboveFold));
+ console.log('after full scroll:', JSON.stringify(afterScroll));
+ console.log(`console errors/warnings (${consoleMsgs.length}):`);
+ [...new Set(consoleMsgs)].slice(0, 25).forEach((m) => console.log(' ' + m));
+
+ await browser.close();
+}
+
+await probe({ width: 1440, height: 900 }, 'desktop');
+await probe({ width: 375, height: 812 }, 'mobile');
diff --git a/scripts/verify-zauth-runtime.mjs b/scripts/verify-zauth-runtime.mjs
index df7ae9c42..e05860743 100644
--- a/scripts/verify-zauth-runtime.mjs
+++ b/scripts/verify-zauth-runtime.mjs
@@ -162,6 +162,14 @@ results.push(
expectMonitored: false,
}),
);
+results.push(
+ await runCase({
+ name: 'free GET /api/x402/pay-by-name (must be ignored)',
+ req: { url: '/api/x402/pay-by-name?name=%40nich', method: 'GET' },
+ statusCode: 200,
+ expectMonitored: false,
+ }),
+);
results.push(
await runCase({
name: 'admin GET /api/x402/admin/skus (must be ignored)',
diff --git a/scripts/x402-all.mjs b/scripts/x402-all.mjs
index cb64758b9..64642ccd6 100644
--- a/scripts/x402-all.mjs
+++ b/scripts/x402-all.mjs
@@ -28,8 +28,8 @@ const ENDPOINTS = [
{ name: 'onchain-identity-verify',path: '/api/x402/onchain-identity-verify?address=0x33369135724F53521dF38e69262792a1EC068cd7', method: 'GET' },
{ name: 'agent-reputation', path: '/api/x402/agent-reputation?agent_id=7b9a4f30-2d11-4e2d-9d12-1cdb1f6a3a55', method: 'GET' },
{ name: 'pump-agent-audit', path: '/api/x402/pump-agent-audit?mint=C3vQABCDEFGHJKLMNopqrstuvwxyZ12345abcdefghi', method: 'GET' },
- { name: 'mint-to-mesh', path: '/api/x402/mint-to-mesh?mint=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263', method: 'GET' },
- { name: 'mint-to-mesh-batch', path: '/api/x402/mint-to-mesh-batch', method: 'POST', body: { mints: ['DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'] } },
+ { name: 'mint-to-mesh', path: '/api/x402/mint-to-mesh?mint=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump', method: 'GET' },
+ { name: 'mint-to-mesh-batch', path: '/api/x402/mint-to-mesh-batch', method: 'POST', body: { mints: ['FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump'] } },
];
const results = [];
diff --git a/scripts/x402-test-solana.mjs b/scripts/x402-test-solana.mjs
index b61d132f6..7f9167a78 100644
--- a/scripts/x402-test-solana.mjs
+++ b/scripts/x402-test-solana.mjs
@@ -54,8 +54,7 @@ const ENDPOINTS = [
{ name: 'symbol-availability', method: 'GET', url: '/api/x402/symbol-availability?ticker=WWWTEST' },
{ name: 'skill-marketplace', method: 'GET', url: `/api/x402/skill-marketplace?agent_id=${REAL_AGENT_ID}` },
{ name: 'agent-reputation', method: 'GET', url: `/api/x402/agent-reputation?agent_id=${REAL_AGENT_ID}` },
- // Aodd9L... is a real pump-agent mint (from skill-marketplace listing).
- { name: 'pump-agent-audit', method: 'GET', url: `/api/x402/pump-agent-audit?mint=Aodd9LBDCue4HN6KyhpSai7yudFCoEWJ3FLHdgYajQzb` },
+ { name: 'pump-agent-audit', method: 'GET', url: `/api/x402/pump-agent-audit?mint=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump` },
{
name: 'mint-to-mesh-batch',
method: 'POST',
@@ -65,7 +64,7 @@ const ENDPOINTS = [
{
name: 'onchain-identity-verify',
method: 'GET',
- url: `/api/x402/onchain-identity-verify?agent_id=${REAL_AGENT_ID}&chain=solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp&contract_or_mint=Aodd9LBDCue4HN6KyhpSai7yudFCoEWJ3FLHdgYajQzb`,
+ url: `/api/x402/onchain-identity-verify?agent_id=${REAL_AGENT_ID}&chain=solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp&contract_or_mint=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`,
},
];
diff --git a/scripts/zauth-register-endpoints.mjs b/scripts/zauth-register-endpoints.mjs
index dd5f2544f..223389017 100644
--- a/scripts/zauth-register-endpoints.mjs
+++ b/scripts/zauth-register-endpoints.mjs
@@ -49,7 +49,6 @@ const ENDPOINTS = [
{ path: '/api/x402/mint-to-mesh-batch', method: 'POST', json: true, body: '{}' },
{ path: '/api/x402/model-check', method: 'GET' },
{ path: '/api/x402/onchain-identity-verify', method: 'GET' },
- { path: '/api/x402/pay-by-name?name=three.ws', method: 'GET' },
{ path: '/api/x402/permit2-paid-demo', method: 'GET' },
{ path: '/api/x402/pump-agent-audit', method: 'GET' },
{ path: '/api/x402/pump-launch', method: 'POST', json: true, body: '{}' },
diff --git a/scripts/zauth-replay-telemetry.mjs b/scripts/zauth-replay-telemetry.mjs
new file mode 100644
index 000000000..9f8bb8ccf
--- /dev/null
+++ b/scripts/zauth-replay-telemetry.mjs
@@ -0,0 +1,144 @@
+// Replay production 402 challenges through the REAL zauth SDK from a
+// long-lived process, with the real ZAUTH_API_KEY from .env.local.
+//
+// node scripts/zauth-replay-telemetry.mjs
+//
+// Purpose: distinguish "Vercel drops telemetry before flush" from "zauth's
+// backend doesn't register endpoints off bare 402 challenges". Each paid
+// surface is fetched from production (no X-PAYMENT → zero cost), and the
+// genuine response (status, PAYMENT-REQUIRED header, body) is replayed
+// through api/_lib/zauth.js instrument()/drain() so the SDK observes it
+// exactly as the deployed middleware would — but from a process that
+// cannot be frozen mid-flush. Debug output prints the backend's
+// accepted-event counts, which is ground truth on delivery.
+import { EventEmitter } from 'node:events';
+import { readFileSync } from 'node:fs';
+
+// Load ZAUTH_* from .env.local before importing the adapter (env.js reads
+// process.env live; the middleware builds lazily on first instrument()).
+for (const line of readFileSync(new URL('../.env.local', import.meta.url), 'utf8').split('\n')) {
+ const m = line.match(/^\s*(ZAUTH_[A-Z_]+)\s*=\s*(.*)\s*$/);
+ if (m && !process.env[m[1]]) process.env[m[1]] = m[2].replace(/^["']|["']$/g, '');
+}
+if (!process.env.ZAUTH_API_KEY) {
+ console.error('ZAUTH_API_KEY not found in environment or .env.local');
+ process.exit(1);
+}
+process.env.ZAUTH_DEBUG = '1';
+// Label events as production — they describe the deployed endpoints.
+process.env.VERCEL_ENV = process.env.VERCEL_ENV || 'production';
+
+const { instrument, drain, status } = await import('../api/_lib/zauth.js');
+
+const BASE = process.env.THREE_WS_BASE || 'https://three.ws';
+const MCP_BODY = JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' });
+
+// Same catalog as zauth-register-endpoints.mjs.
+const ENDPOINTS = [
+ { path: '/api/mcp', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/mcp-3d', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/mcp-agent', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/mcp-bazaar', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/pump-fun-mcp', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/ibm-mcp', method: 'POST', body: MCP_BODY, json: true },
+ { path: '/api/wk-x402', method: 'GET' },
+ { path: '/api/x402/agent-reputation', method: 'GET' },
+ { path: '/api/x402/asset-download?slug=pole-dancer-rumba', method: 'GET' },
+ { path: '/api/x402/cosmetic-purchase?id=skin-midnight&account=g_5f3c9a21b8', method: 'GET' },
+ { path: '/api/x402/crypto-intel', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/dance-tip', method: 'GET' },
+ { path: '/api/x402/fact-check', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/forge', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/mint-to-mesh', method: 'GET' },
+ { path: '/api/x402/mint-to-mesh-batch', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/model-check', method: 'GET' },
+ { path: '/api/x402/onchain-identity-verify', method: 'GET' },
+ { path: '/api/x402/permit2-paid-demo', method: 'GET' },
+ { path: '/api/x402/pump-agent-audit', method: 'GET' },
+ { path: '/api/x402/pump-launch', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/skill-call?skill=wallet-balance', method: 'GET' },
+ { path: '/api/x402/skill-marketplace', method: 'GET' },
+ { path: '/api/x402/symbol-availability', method: 'GET' },
+ { path: '/api/x402/tutor', method: 'POST', json: true, body: '{}' },
+ { path: '/api/x402/vanity', method: 'GET' },
+];
+
+function makeReq({ path, method }) {
+ return {
+ url: path,
+ method,
+ headers: {
+ host: 'three.ws',
+ 'x-forwarded-proto': 'https',
+ 'user-agent': 'three.ws-zauth-replay',
+ },
+ socket: { remoteAddress: '203.0.113.7' },
+ };
+}
+
+function makeRes() {
+ const res = new EventEmitter();
+ const headersStore = {};
+ res.statusCode = 200;
+ res.headersSent = false;
+ res.writableEnded = false;
+ res.setHeader = (k, v) => {
+ headersStore[String(k).toLowerCase()] = v;
+ };
+ res.getHeader = (k) => headersStore[String(k).toLowerCase()];
+ res.getHeaders = () => ({ ...headersStore });
+ res.removeHeader = (k) => delete headersStore[String(k).toLowerCase()];
+ res.write = () => true;
+ res.end = function end() {
+ res.writableEnded = true;
+ res.headersSent = true;
+ res.emit('finish');
+ res.emit('close');
+ return res;
+ };
+ return res;
+}
+
+console.log('— zauth telemetry replay —');
+console.log('status():', JSON.stringify(status()));
+
+let replayed = 0;
+for (const ep of ENDPOINTS) {
+ const headers = { 'user-agent': 'three.ws-zauth-replay' };
+ if (ep.json) headers['content-type'] = 'application/json';
+ let upstream;
+ try {
+ upstream = await fetch(BASE + ep.path, {
+ method: ep.method,
+ headers,
+ body: ep.body,
+ signal: AbortSignal.timeout(20_000),
+ });
+ } catch (err) {
+ console.log(` SKIP ${ep.path} — upstream fetch failed: ${err.message}`);
+ continue;
+ }
+ const bodyText = await upstream.text().catch(() => '');
+
+ const req = makeReq(ep);
+ const res = makeRes();
+ const monitored = instrument(req, res);
+ if (!monitored) {
+ console.log(` SKIP ${ep.path} — not monitored?!`);
+ continue;
+ }
+ res.statusCode = upstream.status;
+ for (const name of ['content-type', 'payment-required', 'www-authenticate']) {
+ const v = upstream.headers.get(name);
+ if (v) res.setHeader(name, v);
+ }
+ res.end(bodyText);
+ await drain();
+ replayed++;
+ console.log(` replayed ${upstream.status} ${ep.method.padEnd(4)} ${ep.path}`);
+}
+
+// Let the SDK finish any trailing batch work, then shut down cleanly.
+await new Promise((r) => setTimeout(r, 2000));
+await drain();
+console.log(`\nreplayed ${replayed}/${ENDPOINTS.length} endpoints through the live SDK`);
diff --git a/src/constellation/main.js b/src/constellation/main.js
index 79dc9e543..f73f83bf5 100644
--- a/src/constellation/main.js
+++ b/src/constellation/main.js
@@ -488,7 +488,7 @@ async function init() {
applySemanticLayout(filled);
setStatus('live', `Embedded by IBM&nbsp;Granite · <code>${escapeHtml(model || EMBED_MODEL_HINT)}</code> · ${dimensions || dim}d`);
} catch (e) {
- if (e.code === 'watsonx_unconfigured') {
+ if (e.code === 'embed_unconfigured') {
setStatus('off', 'IBM watsonx not configured — showing tokens by trending rank. <a href="/ibm/galaxy" style="color:var(--brand-blue-light)">Enable →</a>');
} else if (e.status === 404) {
setStatus('off', 'Granite embeddings endpoint not deployed yet — showing tokens by trending rank.');
diff --git a/tasks/agent-creation/11-feature-agent-creation-wizard.md b/tasks/agent-creation/11-feature-agent-creation-wizard.md
deleted file mode 100644
index 5d27d6b36..000000000
--- a/tasks/agent-creation/11-feature-agent-creation-wizard.md
+++ /dev/null
@@ -1,52 +0,0 @@
----
-status: not-started
----
-# Prompt 11: Agent Creation Wizard
-
-**Status:** Not Started
-
-## Objective
-Create a user-friendly, step-by-step wizard for creating a new agent. This will improve the user experience compared to a single, long form.
-
-## Explanation
-Creating a new agent involves multiple pieces of information: name, description, 3D model, skills, etc. A multi-step wizard breaks this down into manageable chunks, guiding the user through the process and improving completion rates.
-
-## Instructions
-1. **Create a new page:** `create-agent.html`.
-2. **Design a multi-step UI:**
- * Use JavaScript to create a tab-like interface or a component that shows one step at a time.
- * Steps could be:
- 1. **Basic Info:** Name, Description, Tags.
- 2. **3D Model:** Upload a GLB/glTF file or choose from a default library.
- 3. **Skills:** Add/remove skills for the agent.
- 4. **Voice & Personality:** (Future feature, but plan for it) Set TTS voice and base prompt.
- 5. **Review & Create:** Show a summary and a final "Create Agent" button.
-3. **State Management:**
- * Store the agent data in a JavaScript object as the user moves through the steps.
- * Implement "Next" and "Back" buttons.
-4. **API Integration:**
- * On the final step, the "Create Agent" button should POST the complete agent object to a new API endpoint: `/api/agents/create`.
- * The backend will handle creating the new agent in the database.
-
-## UI Sketch
-```
-+-------------------------------------------------------------+
-| Create Your Agent |
-+-------------------------------------------------------------+
-| [Step 1: Info] -> [Step 2: Model] -> [Step 3: Skills] ... |
-+-------------------------------------------------------------+
-| |
-| +--------------------------+ |
-| | Agent Name | |
-| | [______________________] | |
-| | | |
-| | Agent Description | |
-| | [______________________] | |
-| | [______________________] | |
-| +--------------------------+ |
-| |
-| +--------------+ |
-| | Next > | |
-| +--------------+ |
-+-------------------------------------------------------------+
-```
diff --git a/tests/mcp-auth-challenge.test.js b/tests/mcp-auth-challenge.test.js
new file mode 100644
index 000000000..ef2f7c67b
--- /dev/null
+++ b/tests/mcp-auth-challenge.test.js
@@ -0,0 +1,92 @@
+import { describe, it, expect, vi } from 'vitest';
+
+// env throws if required vars are missing — stub before the module imports it.
+vi.mock('../api/_lib/env.js', () => ({
+ env: {
+ APP_ORIGIN: 'https://three.ws',
+ MCP_RESOURCE: 'https://three.ws/api/mcp',
+ X402_PAY_TO_BASE: '0x4022de2d36c334e73c7a108805cea11c0564f402',
+ },
+}));
+
+const { sendAuthChallenge } = await import('../api/_mcp/auth.js');
+
+function mkRes() {
+ const headers = {};
+ return {
+ statusCode: 200,
+ body: null,
+ setHeader(k, v) {
+ headers[k.toLowerCase()] = v;
+ },
+ getHeader(k) {
+ return headers[k.toLowerCase()];
+ },
+ end(body) {
+ this.body = body;
+ },
+ headers,
+ };
+}
+
+const REQUIREMENTS = [
+ {
+ scheme: 'exact',
+ amount: '1000',
+ network: 'eip155:8453',
+ payTo: '0x4022de2d36c334e73c7a108805cea11c0564f402',
+ asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
+ resource: 'https://three.ws/api/mcp',
+ },
+];
+
+function challengeFor(headers) {
+ const res = mkRes();
+ sendAuthChallenge(res, {
+ req: { headers },
+ resourceUrl: 'https://three.ws/api/mcp',
+ requirements: REQUIREMENTS,
+ });
+ return res;
+}
+
+describe('sendAuthChallenge status negotiation', () => {
+ it('returns 402 Payment Required to plain x402 clients (no MCP signals)', () => {
+ const res = challengeFor({ accept: 'application/json' });
+ expect(res.statusCode).toBe(402);
+ });
+
+ it('returns 402 when there is no accept header at all (crawlers)', () => {
+ const res = challengeFor({});
+ expect(res.statusCode).toBe(402);
+ });
+
+ it('returns 401 to MCP Streamable HTTP clients (Accept includes SSE)', () => {
+ const res = challengeFor({ accept: 'application/json, text/event-stream' });
+ expect(res.statusCode).toBe(401);
+ });
+
+ it('returns 401 when MCP-Protocol-Version header is present', () => {
+ const res = challengeFor({ accept: 'application/json', 'mcp-protocol-version': '2025-06-18' });
+ expect(res.statusCode).toBe(401);
+ });
+
+ it('returns 401 when Mcp-Session-Id header is present', () => {
+ const res = challengeFor({ 'mcp-session-id': 'abc123' });
+ expect(res.statusCode).toBe(401);
+ });
+
+ it('always ships the x402 envelope and discovery headers, on both statuses', () => {
+ for (const headers of [{}, { accept: 'text/event-stream' }]) {
+ const res = challengeFor(headers);
+ expect(res.getHeader('www-authenticate')).toContain('resource_metadata=');
+ const envelope = JSON.parse(
+ Buffer.from(res.getHeader('payment-required'), 'base64').toString('utf8'),
+ );
+ expect(envelope.x402Version).toBeDefined();
+ expect(envelope.accepts).toHaveLength(REQUIREMENTS.length);
+ const body = JSON.parse(res.body);
+ expect(body.accepts).toHaveLength(REQUIREMENTS.length);
+ }
+ });
+});