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
feat(theater): add empty roster state handling and improve error messaging
nrpo13af4a1e1139
diff --git a/pages/theater.html b/pages/theater.htmlindex 3cfbdd3ec..55b776f1f 100644--- a/pages/theater.html+++ b/pages/theater.html@@ -91,10 +91,22 @@<!-- error --><div class="th-state th-error" id="th-error" hidden><h2>Couldn't load the stage</h2>- <p class="th-muted">The roster feed didn't respond. Your connection or our edge may be hiccuping.</p>+ <p class="th-muted">The roster feed didn't respond in time. Your connection or our edge may be hiccuping.</p><button class="th-btn th-btn-primary" data-retry>Try again</button></div>+ <!-- empty roster -->+ <div class="th-state th-empty" id="th-empty" hidden>+ <div class="th-empty-mark" aria-hidden="true">◇</div>+ <h2>No traders on this stage yet</h2>+ <p class="th-muted">This room fills as agents build an on-chain track record. Explore a live agent or launch your own to take the stage.</p>+ <div class="th-empty-actions">+ <a class="th-btn th-btn-primary" href="/agents">Browse agents</a>+ <a class="th-btn" href="/launch">Launch an agent</a>+ <button class="th-btn th-btn-ghost" data-retry type="button">Refresh</button>+ </div>+ </div>+<!-- read-only HUD --><aside class="th-panel" id="th-panel" aria-label="Agent details"></aside></section>diff --git a/public/features.json b/public/features.jsonindex a7d309891..a34406d6d 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T18:13:44.420Z",+ "generated_at": "2026-07-03T18:14:41.496Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex b3b08a10a..e4fe9931c 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -56,6 +56,25 @@.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }.sm-brand:hover { text-decoration: none; }</style>++ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">+ <meta property="og:type" content="website">+ <meta property="og:site_name" content="three.ws">+ <meta property="og:locale" content="en_US">+ <meta property="og:title" content="Sitemap · three.ws">+ <meta property="og:description" content="Human-readable index of every page on three.ws.">+ <meta property="og:url" content="https://three.ws/sitemap">+ <meta property="og:image" content="https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta property="og:image:type" content="image/png">+ <meta property="og:image:alt" content="Sitemap — three.ws">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:site" content="@trythreews">+ <meta name="twitter:title" content="Sitemap · three.ws">+ <meta name="twitter:description" content="Human-readable index of every page on three.ws.">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap">+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap"}]}</script></head><body><header class="sm-topbar">diff --git a/src/theater.css b/src/theater.cssindex 3a6e62dab..8356d0bd1 100644--- a/src/theater.css+++ b/src/theater.css@@ -369,6 +369,25 @@.th-btn-primary { background: var(--th-accent-fill); border-color: var(--th-accent-stroke); color: var(--ink-bright, #fff); }.th-btn-on { background: var(--th-accent-fill); border-color: var(--th-accent-stroke); color: var(--ink-bright, #fff); }.th-btn-sm { flex: 0 0 auto; padding: 5px 10px; font-size: var(--text-2xs, 0.69rem); }+.th-btn-ghost { background: transparent; border-color: transparent; color: var(--ink-dim, #888); }+.th-btn-ghost:hover { background: var(--surface-1, rgba(255, 255, 255, 0.03)); color: var(--ink, #e8e8e8); border-color: transparent; }++/* ── empty roster state ──────────────────────────────────────────────────── */+.th-empty-mark {+ font-size: 2rem;+ line-height: 1;+ color: var(--th-accent, #8b5cf6);+ opacity: 0.7;+ margin-bottom: var(--space-3, 12px);+}+.th-empty-actions {+ display: flex;+ flex-wrap: wrap;+ gap: var(--space-2, 8px);+ justify-content: center;+ margin-top: var(--space-4, 16px);+}+.th-empty-actions .th-btn { flex: 0 1 auto; }/* ── copy-trade (mirror) affordance ──────────────────────────────────────── */.th-mirror { margin-bottom: var(--space-3, 12px); }.th-mirror-start { width: 100%; }diff --git a/src/theater.js b/src/theater.jsindex 3455a1386..6361e29f6 100644--- a/src/theater.js+++ b/src/theater.js@@ -222,10 +222,24 @@ function buildMirror(leaderId, leaderName) {}// ── data layer ────────────────────────────────────────────────────────────────+// Every roster/detail fetch is time-bounded so a slow or black-holed edge can+// never wedge the room behind an infinite "Assembling the cast…" spinner. On+// timeout the AbortController rejects, loadRoom catches it and shows the+// designed error state (with a Try-again button) instead of hanging forever.+async function fetchJson(url, { timeout = 8000, ...opts } = {}) {+ const ctrl = new AbortController();+ const timer = setTimeout(() => ctrl.abort(), timeout);+ try {+ const r = await fetch(url, { ...opts, signal: ctrl.signal, headers: { accept: 'application/json', ...(opts.headers || {}) } });+ if (!r.ok) throw new Error(`${new URL(url, location.href).pathname} ${r.status}`);+ return await r.json();+ } finally {+ clearTimeout(timer);+ }+}+async function fetchLeaderboard(limit) {- const r = await fetch(`/api/reputation/leaderboard?limit=${limit}`, { headers: { accept: 'application/json' } });- if (!r.ok) throw new Error(`leaderboard ${r.status}`);- const body = await r.json();+ const body = await fetchJson(`/api/reputation/leaderboard?limit=${limit}`);return (body.agents || []).map((a) => ({id: a.id, name: a.name || 'Agent', solana_address: a.solana_address || null,score: a.score, tier: a.tier, tierLabel: a.tier_label, totals: a.totals || {},@@ -233,9 +247,7 @@ async function fetchLeaderboard(limit) {}));}async function fetchNewLaunches(limit) {- const r = await fetch(`/api/agents/public?sort=newest&limit=${limit}`, { headers: { accept: 'application/json' } });- if (!r.ok) throw new Error(`public ${r.status}`);- const body = await r.json();+ const body = await fetchJson(`/api/agents/public?sort=newest&limit=${limit}`);return (body.agents || []).map((a) => ({id: a.id, name: a.name || 'Agent', solana_address: null,score: null, tier: null, tierLabel: null, totals: {},@@ -247,14 +259,13 @@ async function fetchNewLaunches(limit) {// Falls back cleanly (mannequin via agentAvatarGlb) if the detail is unavailable.async function resolveBody(agent) {try {- const r = await fetch(`/api/agents/${encodeURIComponent(agent.id)}`, { credentials: 'include', headers: { accept: 'application/json' } });- if (r.ok) {- const d = await r.json().catch(() => null);- const a = d?.agent || d || {};- agent.avatar_model_url = a.avatar_model_url || a.avatar_glb_url || a.glb_url || null;- agent.is_owner = !!a.is_owner;- if (!agent.solana_address) agent.solana_address = a.solana_address || null;- }+ // Short timeout: one slow agent-detail GET must not stall the whole reveal,+ // since these run before the stage is shown. On abort we keep the mannequin.+ const d = await fetchJson(`/api/agents/${encodeURIComponent(agent.id)}`, { credentials: 'include', timeout: 5000 });+ const a = d?.agent || d || {};+ agent.avatar_model_url = a.avatar_model_url || a.avatar_glb_url || a.glb_url || null;+ agent.is_owner = !!a.is_owner;+ if (!agent.solana_address) agent.solana_address = a.solana_address || null;} catch { /* mannequin fallback handles it */ }return agent;}@@ -262,9 +273,7 @@ async function resolveBody(agent) {async function fetchReputationBatch(ids) {if (!ids.length) return {};try {- const r = await fetch(`/api/agents/reputation-batch?ids=${ids.map(encodeURIComponent).join(',')}`, { headers: { accept: 'application/json' } });- if (!r.ok) return {};- const body = await r.json();+ const body = await fetchJson(`/api/agents/reputation-batch?ids=${ids.map(encodeURIComponent).join(',')}`, { timeout: 6000 });return body.data || {};} catch { return {}; }}@@ -295,6 +304,7 @@ export function initTheater(root) {quiet: root.querySelector('#th-quiet'),loading: root.querySelector('#th-loading'),error: root.querySelector('#th-error'),+ empty: root.querySelector('#th-empty'),hint: root.querySelector('#th-room-hint'),};@@ -387,6 +397,16 @@ export function initTheater(root) {const limit = rosterBudget();const rows = state.room.id === 'launches' ? await fetchNewLaunches(limit) : await fetchLeaderboard(limit);+ // Empty roster is a designed state, not a bare stage: tell the viewer why+ // the room is empty and what to do, instead of showing an unlit void.+ if (!rows.length) {+ state.roster = [];+ state.byId = new Map();+ stage.setRoster([]).catch(() => {});+ showState('empty');+ return;+ }+await pool(rows, 5, resolveBody);state.roster = rows;state.byId = new Map(rows.map((a) => [a.id, a]));@@ -418,13 +438,14 @@ export function initTheater(root) {function showState(which) {refs.loading.hidden = which !== 'loading';refs.error.hidden = which !== 'error';+ if (refs.empty) refs.empty.hidden = which !== 'empty';if (which !== 'stage') refs.quiet.hidden = true;}function maybeShowQuiet() {refs.quiet.hidden = !(state.liveCount === 0 && refs.loading.hidden && refs.error.hidden);}- refs.error.querySelector('[data-retry]')?.addEventListener('click', loadRoom);+ for (const card of [refs.error, refs.empty]) card?.querySelector('[data-retry]')?.addEventListener('click', loadRoom);// ── live feed routing ────────────────────────────────────────────────────────const feed = connectFeed({