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
fix(pages): design the empty, loading and error states across the crypto and studio pages
nirholas687cb509b76a
diff --git a/pages/marketplace-walk.html b/pages/marketplace-walk.htmlindex ffe4ce4a3..de33d7d58 100644--- a/pages/marketplace-walk.html+++ b/pages/marketplace-walk.html@@ -45,7 +45,6 @@<link rel="manifest" href="/manifest.webmanifest" /><link rel="stylesheet" href="/style.css" /><link rel="stylesheet" href="/footer.css" />- <link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/fonts/fonts.css" /><link rel="stylesheet" href="/mobile.css" />diff --git a/pages/marketplace.html b/pages/marketplace.htmlindex f61c0c05e..c8d681474 100644--- a/pages/marketplace.html+++ b/pages/marketplace.html@@ -27,7 +27,6 @@<link rel="preload" href="/fonts/inter-latin.woff2" as="font" type="font/woff2" crossorigin /><link rel="preload" href="/fonts/space-grotesk-latin.woff2" as="font" type="font/woff2" crossorigin /><link rel="stylesheet" href="/style.css" />- <link rel="stylesheet" href="/footer.css" /><link rel="stylesheet" href="/marketplace.css" /><link rel="stylesheet" href="/marketplace-v2.css" /><link rel="stylesheet" href="/fonts/fonts.css" />diff --git a/pages/rankings.html b/pages/rankings.htmlindex bc4d50acd..4896c0066 100644--- a/pages/rankings.html+++ b/pages/rankings.html@@ -77,8 +77,10 @@white-space: nowrap;}.rk-seg-btn:hover { color: var(--color-text); }+ .rk-seg-btn:active { transform: scale(0.97); }.rk-seg-btn.is-active { background: var(--surface-3); color: var(--color-text-bright); }.rk-seg-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }+ @media (prefers-reduced-motion: reduce) { .rk-seg-btn:active { transform: none; } }.rk-board { border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--surface-1); overflow: hidden; }.rk-head, .rk-row {@@ -100,7 +102,11 @@.rk-avatar-fallback { display: flex; align-items: center; justify-content: center; font: var(--weight-semibold) var(--text-sm)/1 var(--font-body); color: var(--color-text-dim); }.rk-handle { font: var(--weight-medium) var(--text-md)/1.2 var(--font-body); color: var(--color-text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }a.rk-handle:hover { color: var(--color-text-bright); text-decoration: underline; }+ a.rk-handle:active { color: var(--accent); }+ a.rk-handle:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); border-radius: var(--radius-sm); }+ .rk-you { flex: none; padding: 2px 7px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--accent) 18%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--color-text-bright); font: var(--weight-semibold) var(--text-2xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }.rk-value { font: var(--weight-semibold) var(--text-md)/1 var(--font-mono); color: var(--color-text-bright); text-align: right; }+ .rk-rank.is-unranked { font-size: var(--text-2xs); letter-spacing: 0.04em; color: var(--color-text-faint); }.rk-me { position: sticky; bottom: 0; z-index: 5; margin-top: var(--space-md); border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--color-border)); border-radius: var(--radius-lg); background: var(--surface-3); backdrop-filter: blur(var(--blur-md)); -webkit-backdrop-filter: blur(var(--blur-md)); box-shadow: var(--shadow-2); }.rk-me .rk-row { border-bottom: 0; }@@ -108,14 +114,19 @@.rk-loadmore { display: block; margin: var(--space-md) auto 0; appearance: none; cursor: pointer; padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--surface-1); color: var(--color-text); font: var(--weight-medium) var(--text-md)/1 var(--font-body); transition: background var(--duration-fast) var(--ease-standard); }.rk-loadmore:hover { background: var(--surface-2); }+ .rk-loadmore:active { background: var(--surface-3); }.rk-loadmore:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }.rk-loadmore[disabled] { opacity: var(--disabled-opacity); cursor: var(--disabled-cursor); }+ .rk-more-error { margin: var(--space-sm) auto 0; max-width: 46ch; text-align: center; font: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-body); color: var(--color-danger, var(--color-text-dim)); }.rk-state { padding: var(--space-2xl) var(--space-md); text-align: center; }.rk-state-title { font: var(--weight-semibold) var(--text-lg)/1.2 var(--font-display); color: var(--color-text-bright); margin: 0 0 var(--space-xs); }.rk-state-msg { font: var(--weight-regular) var(--text-md)/var(--leading-normal) var(--font-body); color: var(--color-text-dim); margin: 0 auto var(--space-md); max-width: 46ch; }.rk-state .rk-cta { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-md); background: var(--accent); color: #0a0a0a; font: var(--weight-semibold) var(--text-md)/1 var(--font-body); text-decoration: none; transition: opacity var(--duration-fast) var(--ease-standard); }.rk-state .rk-cta:hover { opacity: 0.85; }+ .rk-state .rk-cta:active { opacity: 0.7; }+ .rk-state .rk-cta:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }+ .rk-state-detail { font: var(--weight-regular) var(--text-2xs)/1.4 var(--font-mono); color: var(--color-text-faint); margin: var(--space-sm) 0 0; }.rk-skel-row { display: grid; grid-template-columns: 56px 1fr 140px; gap: var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-border); }.rk-skel { height: 14px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: rk-shimmer 1.4s ease infinite; }@@ -126,6 +137,8 @@.rk-footer-links { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }.rk-footer-links a { font: var(--weight-medium) var(--text-sm)/1 var(--font-body); color: var(--color-text-dim); text-decoration: none; padding: var(--space-xs) var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-pill); transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); }.rk-footer-links a:hover { color: var(--color-text-bright); border-color: var(--color-text-dim); }+ .rk-footer-links a:active { background: var(--surface-2); }+ .rk-footer-links a:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }@media (max-width: 640px) {.rk-head, .rk-row, .rk-skel-row { grid-template-columns: 40px 1fr 96px; }@@ -160,16 +173,16 @@<section class="rk-controls" aria-label="Leaderboard metric"><div class="rk-seg" role="tablist" aria-label="Rank by" id="rk-metric">- <button class="rk-seg-btn is-active" data-metric="creations" role="tab" aria-selected="true" data-i18n="rankings.creations">Creations</button>- <button class="rk-seg-btn" data-metric="remixes_received" role="tab" aria-selected="false" data-i18n="rankings.remixes">Remixes</button>- <button class="rk-seg-btn" data-metric="launches" role="tab" aria-selected="false" data-i18n="rankings.launches">Launches</button>- <button class="rk-seg-btn" data-metric="followers" role="tab" aria-selected="false" data-i18n="rankings.followers">Followers</button>- <button class="rk-seg-btn" data-metric="walk_distance" role="tab" aria-selected="false" data-i18n="rankings.walk_distance">Walk Distance</button>+ <button class="rk-seg-btn is-active" data-metric="creations" role="tab" aria-selected="true" aria-controls="rk-board" data-i18n="rankings.creations">Creations</button>+ <button class="rk-seg-btn" data-metric="remixes_received" role="tab" aria-selected="false" aria-controls="rk-board" tabindex="-1" data-i18n="rankings.remixes">Remixes</button>+ <button class="rk-seg-btn" data-metric="launches" role="tab" aria-selected="false" aria-controls="rk-board" tabindex="-1" data-i18n="rankings.launches">Launches</button>+ <button class="rk-seg-btn" data-metric="followers" role="tab" aria-selected="false" aria-controls="rk-board" tabindex="-1" data-i18n="rankings.followers">Followers</button>+ <button class="rk-seg-btn" data-metric="walk_distance" role="tab" aria-selected="false" aria-controls="rk-board" tabindex="-1" data-i18n="rankings.walk_distance">Walk Distance</button></div></section>- <section class="rk-board" aria-label="Ranked creators" aria-busy="true">- <div class="rk-head" role="row" aria-hidden="true">+ <section class="rk-board" id="rk-board" role="tabpanel" tabindex="0" aria-label="Ranked creators" aria-busy="true">+ <div class="rk-head" aria-hidden="true"><span>#</span><span data-i18n="rankings.creator">Creator</span><span class="rk-col-num" id="rk-metric-label" data-i18n="rankings.creations_2">Creations</span>@@ -178,9 +191,10 @@</section><button type="button" id="rk-loadmore" class="rk-loadmore" hidden data-i18n="rankings.show_more">Show more</button>+ <p id="rk-more-error" class="rk-more-error" role="status" hidden></p><div id="rk-me-wrap" class="rk-me" hidden>- <div class="rk-me-tag">Your rank</div>+ <div class="rk-me-tag" data-i18n="rankings.your_rank" data-i18n-owned="1">Your rank</div><div id="rk-me-row"></div></div>@@ -202,7 +216,9 @@const loadMoreEl = document.getElementById('rk-loadmore');const meWrap = document.getElementById('rk-me-wrap');const meRow = document.getElementById('rk-me-row');+ const meTag = meWrap.querySelector('.rk-me-tag');const metricSeg = document.getElementById('rk-metric');+ const moreErrorEl = document.getElementById('rk-more-error');const streakCard = document.getElementById('rk-streak-card');const streakNum = document.getElementById('rk-streak-num');const streakLabel = document.getElementById('rk-streak-label');@@ -224,6 +240,13 @@};const PAGE = 50;let state = { metric: 'creations', offset: 0, total: 0, loading: false };+ // Every fetch carries a sequence number and its own AbortController. A+ // metric switch mid-flight aborts the old request and bumps the sequence,+ // so a late response can never paint the wrong metric over the new one.+ // The previous guard dropped the click outright, which left the selected+ // tab and the rendered board permanently disagreeing.+ let requestSeq = 0;+ let inflight = null;const esc = (s) => String(s).replace(/[<>&"']/g, (c) => ({ '<': '<', '>': '>', '&': '&', '"': '"', "'": ''' }[c]));@@ -245,16 +268,25 @@return `<span class="rk-avatar rk-avatar-fallback" aria-hidden="true">${ch}</span>`;}- function rowHtml(r, metric, isMe) {+ function rowHtml(r, metric, isMe, { pinned = false } = {}) {+ // The you-marker rides beside the handle rather than inside its text so+ // it survives the linked case: a signed-in creator with a public profile+ // gets an <a>, and inlining "(you)" there dropped it for exactly the+ // users most likely to be looking for themselves.const handle = r.profileUrl? `<a class="rk-handle" href="${esc(r.profileUrl)}">${esc(r.handle)}</a>`- : `<span class="rk-handle">${esc(r.handle)}${isMe ? ' (you)' : ''}</span>`;- const rankCls = r.rank && r.rank <= 3 ? 'rk-rank is-top' : 'rk-rank';- const rankText = r.rank == null ? '—' : (medal(r.rank) || '#' + r.rank);+ : `<span class="rk-handle">${esc(r.handle)}</span>`;+ // Inside the pinned "Your rank" card the chip and a spelled-out rank are+ // both redundant with the card's own label, and at 320px they crowded the+ // handle down to a single character. The card carries that copy instead.+ const you = isMe && !pinned ? '<span class="rk-you">You</span>' : '';+ const unranked = r.rank == null;+ const rankCls = unranked ? 'rk-rank is-unranked' : r.rank <= 3 ? 'rk-rank is-top' : 'rk-rank';+ const rankText = unranked ? (pinned ? '' : 'Unranked') : (medal(r.rank) || '#' + r.rank);return `- <div class="rk-row" role="row">+ <div class="rk-row"><span class="${rankCls}">${rankText}</span>- <span class="rk-creator">${avatarCell(r)} ${handle}</span>+ <span class="rk-creator">${avatarCell(r)} ${handle}${you}</span><span class="rk-value">${fmtValue(metric, r.value)}</span></div>`;}@@ -271,30 +303,83 @@rowsEl.innerHTML = `<div class="rk-state"><p class="rk-state-title">${esc(copy.title)}</p><p class="rk-state-msg">${esc(copy.msg)}</p>${copy.cta ? `<a class="rk-cta" href="${esc(copy.cta.href)}">${esc(copy.cta.label)}</a>` : ''}</div>`;}+ function showError(detail) {+ const wrap = document.createElement('div');+ wrap.className = 'rk-state';+ wrap.innerHTML =+ `<p class="rk-state-title">Couldn't load the leaderboard</p>` ++ `<p class="rk-state-msg">The rankings service didn't answer. Check your connection and try again; every board is rebuilt from live data, so nothing is lost.</p>`;+ const btn = document.createElement('button');+ btn.className = 'rk-cta';+ btn.type = 'button';+ btn.textContent = 'Retry';+ btn.addEventListener('click', () => load({ reset: true }));+ wrap.appendChild(btn);+ if (detail) {+ const p = document.createElement('p');+ p.className = 'rk-state-detail';+ p.textContent = detail;+ wrap.appendChild(p);+ }+ rowsEl.replaceChildren(wrap);+ }+function renderMe(me, metric) {if (!me) { meWrap.hidden = true; return; }meWrap.hidden = false;- meRow.innerHTML = rowHtml(me, metric, true);+ meTag.textContent = me.rank == null ? 'Your rank · not ranked yet' : 'Your rank';+ meRow.innerHTML = rowHtml(me, metric, true, { pinned: true });+ }++ // The streak card needs no username and no second endpoint: /api/leaderboard/unified+ // returns the viewer's streak and badges alongside the board.+ function renderStreak(streak, badges) {+ if (!streak) { streakCard.classList.remove('is-visible'); return; }+ streakCard.classList.add('is-visible');+ const days = streak.currentStreak || 0;+ streakNum.textContent = days === 1 ? '1-day streak' : `${days}-day streak`;+ streakLabel.textContent = days > 0+ ? `Come back tomorrow to keep it alive. Longest so far: ${streak.longestStreak || days} days.`+ : 'Create, launch, or walk today to start one.';+ const list = (badges || []).slice(0, 4);+ streakBadges.innerHTML = list.length+ ? list.map((b) => `<span class="rk-badge-chip" title="${esc(b.description || '')}">${esc(b.icon || '\u2605')} ${esc(b.label || b.code)}</span>`).join('')+ : '<span class="rk-badge-chip">\u2605 No badges yet</span>';}async function load({ reset = true } = {}) {- if (state.loading) return;+ if (!reset && state.loading) return;+ if (inflight) inflight.abort();+ const ctrl = new AbortController();+ inflight = ctrl;+ const seq = ++requestSeq;+ const isCurrent = () => seq === requestSeq;+state.loading = true;- if (reset) { state.offset = 0; skeleton(); meWrap.hidden = true; }+ if (reset) {+ state.offset = 0;+ skeleton();+ meWrap.hidden = true;+ loadMoreEl.hidden = true;+ }+ moreErrorEl.hidden = true;boardEl.setAttribute('aria-busy', 'true');loadMoreEl.disabled = true;const params = new URLSearchParams({ metric: state.metric, limit: String(PAGE), offset: String(state.offset) });try {- const res = await fetch('/api/leaderboard/unified?' + params.toString(), { credentials: 'include' });+ const res = await fetch('/api/leaderboard/unified?' + params.toString(), { credentials: 'include', signal: ctrl.signal });if (!res.ok) throw new Error('HTTP ' + res.status);const data = await res.json();+ if (!isCurrent()) return;state.total = data.total || 0;const metric = data.metric || state.metric;metricLabelEl.textContent = METRIC_HEAD[metric] || 'Value';+ renderStreak(data.streak, data.badges);if (reset && (!data.rows || !data.rows.length)) {showState(EMPTY_COPY[metric] || { title: 'No one ranked yet', msg: 'Be the first.' });- renderMe(data.me && data.me.value > 0 ? data.me : null, metric);+ loadMoreEl.hidden = true;+ renderMe(data.me, metric);return;}@@ -305,42 +390,58 @@loadMoreEl.hidden = !data.hasMore;renderMe(data.me, metric);} catch (err) {+ if (err?.name === 'AbortError' || !isCurrent()) return;+ const detail = err?.message || 'Unknown error';if (reset) {- const wrap = document.createElement('div');- wrap.className = 'rk-state';- wrap.innerHTML = `<p class="rk-state-title">Couldn't load the leaderboard</p><p class="rk-state-msg">${esc(err.message || 'Something went wrong.')}</p>`;- const btn = document.createElement('button');- btn.className = 'rk-cta';- btn.type = 'button';- btn.textContent = 'Retry';- btn.addEventListener('click', () => load({ reset: true }));- wrap.appendChild(btn);- rowsEl.replaceChildren(wrap);+ loadMoreEl.hidden = true;+ showError(detail);+ } else {+ // A silent no-op on "Show more" reads as a dead button. Say what+ // happened and leave the already-loaded rows in place.+ moreErrorEl.textContent = `Couldn't load more (${detail}). Tap Show more to try again.`;+ moreErrorEl.hidden = false;}} finally {- state.loading = false;- boardEl.setAttribute('aria-busy', 'false');- loadMoreEl.disabled = false;+ if (isCurrent()) {+ state.loading = false;+ inflight = null;+ boardEl.setAttribute('aria-busy', 'false');+ loadMoreEl.disabled = false;+ }}}function bindSeg(seg, key, onChange) {- seg.addEventListener('click', (e) => {- const btn = e.target.closest('.rk-seg-btn');+ const buttons = () => [...seg.querySelectorAll('.rk-seg-btn')];+ function select(btn) {if (!btn || btn.classList.contains('is-active')) return;- seg.querySelectorAll('.rk-seg-btn').forEach((b) => { b.classList.remove('is-active'); b.setAttribute('aria-selected', 'false'); });+ // Roving tabindex: exactly one tab is in the tab order, arrow keys+ // move between them. Without it a keyboard user tabs through all+ // five before reaching the board.+ buttons().forEach((b) => {+ b.classList.remove('is-active');+ b.setAttribute('aria-selected', 'false');+ b.tabIndex = -1;+ });btn.classList.add('is-active');btn.setAttribute('aria-selected', 'true');+ btn.tabIndex = 0;state[key] = btn.dataset[key];onChange();- });+ }+ seg.addEventListener('click', (e) => select(e.target.closest('.rk-seg-btn')));seg.addEventListener('keydown', (e) => {- if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;- const btns = [...seg.querySelectorAll('.rk-seg-btn')];- const i = btns.findIndex((b) => b.classList.contains('is-active'));- const next = btns[(i + (e.key === 'ArrowRight' ? 1 : btns.length - 1)) % btns.length];- next.focus(); next.click();+ const btns = buttons();+ let next = null;+ if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {+ const i = btns.findIndex((b) => b.classList.contains('is-active'));+ next = btns[(i + (e.key === 'ArrowRight' ? 1 : btns.length - 1)) % btns.length];+ } else if (e.key === 'Home') next = btns[0];+ else if (e.key === 'End') next = btns[btns.length - 1];+ if (!next) return;e.preventDefault();+ next.focus();+ select(next);});}@@ -349,36 +450,6 @@load({ reset: true });- // Streak card — only for a signed-in viewer with a resolvable username.- // Reuses GET /api/users/:username (already returns streak + badges) so- // this page adds zero new auth surface: it just needs to know who's- // signed in, which /api/auth/me already answers (same call profile.html- // uses to resolve the viewer).- (async () => {- try {- const meRes = await fetch('/api/auth/me', { credentials: 'include' });- if (!meRes.ok) return;- const me = await meRes.json();- const username = me?.user?.username;- if (!username) return;- const profRes = await fetch(`/api/users/${encodeURIComponent(username)}`);- if (!profRes.ok) return;- const prof = await profRes.json();- const streak = prof?.streak;- if (!streak) return;- streakCard.classList.add('is-visible');- streakNum.textContent = `${streak.currentStreak || 0}-day streak`;- streakLabel.textContent = streak.currentStreak > 0- ? 'Come back tomorrow to keep it alive'- : 'Create, launch, or walk today to start one';- const badges = (prof.badges || []).slice(0, 4);- streakBadges.innerHTML = badges- .map((b) => `<span class="rk-badge-chip" title="${esc(b.description || '')}">${esc(b.icon || '★')} ${esc(b.label || b.code)}</span>`)- .join('');- } catch {- /* streak card is a bonus — never block the board */- }- })();</script><!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. --><script type="module" src="/i18n.js"></script>diff --git a/pages/restyle.html b/pages/restyle.htmlindex b3c37c13a..4fd77727d 100644--- a/pages/restyle.html+++ b/pages/restyle.html@@ -87,10 +87,13 @@.rs-note { font-size: 12px; color: var(--text-3); margin-top: 8px; min-height: 16px; }.rs-note.is-error { color: var(--danger, #e0645a); }.rs-note.is-busy { color: var(--accent, #7aa2ff); }+ .rs-note.is-done { color: var(--success, #4ade80); }.rs-sources { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }.rs-file { font-size: 12px; color: var(--text-2); }.rs-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }.rs-hint a { color: var(--accent, #7aa2ff); }+ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }+ .rs-stage.is-dropping { border-color: var(--accent, #7aa2ff); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent, #7aa2ff) 45%, transparent); }</style><meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">@@ -121,11 +124,11 @@<!-- Stage --><div class="rs-stage" id="stage"><div class="rs-canvas" id="canvas-wrap"></div>- <div class="rs-overlay" id="status" hidden>+ <div class="rs-overlay" id="status" role="status" aria-live="polite" hidden><div class="rs-spinner" aria-hidden="true"></div><div>Loading model…</div></div>- <div class="rs-overlay" id="error" hidden>+ <div class="rs-overlay" id="error" role="alert" hidden><div id="error-msg">That model could not be loaded.</div><button class="rs-btn" id="retry" data-i18n="restyle.load_the_sample_model">Load the sample model</button></div>@@ -137,10 +140,13 @@<div class="rs-card"><h2 data-i18n="restyle.load_a_model">Load a model</h2><div class="rs-sources">- <label class="rs-btn" for="file">Upload GLB<input id="file" type="file" accept=".glb,.gltf,model/gltf-binary" hidden /></label>+ <button class="rs-btn" id="upload" data-i18n="restyle.upload_glb">Upload GLB</button>+ <input id="file" type="file" accept=".glb,.gltf,model/gltf-binary" class="sr-only" tabindex="-1" aria-hidden="true" />+ <label class="sr-only" for="url-input" data-i18n="restyle.model_url">Model URL</label><input class="rs-input" id="url-input" style="width: 150px" type="url" placeholder="https://…/model.glb" /><button class="rs-btn" id="load-url" data-i18n="restyle.load_url">Load URL</button></div>+ <div class="rs-note" id="load-note" aria-live="polite"></div><div class="rs-hint">No model? The platform's sample avatar loads by default. Make one in <a href="/forge" data-i18n="restyle.forge">Forge</a>.</div></div>@@ -152,6 +158,7 @@<div class="rs-card"><h2 data-i18n="restyle.ai_restyle">AI restyle</h2><div class="rs-row">+ <label class="sr-only" for="ai-instruction" data-i18n="restyle.describe_the_look">Describe the look</label><input class="rs-input" id="ai-instruction" style="width: 100%; flex: 1 1 auto" type="text"placeholder="e.g. cyberpunk neon, worn copper, glossy ceramic" maxlength="300" /></div>@@ -159,7 +166,7 @@<button class="rs-btn rs-btn--primary" id="ai-restyle" data-i18n="restyle.restyle">Restyle</button><label class="rs-color" style="font-size: 12px"><input id="ai-texture" type="checkbox" checked /> Generate texture too</label></div>- <div class="rs-note" id="ai-note"></div>+ <div class="rs-note" id="ai-note" aria-live="polite"></div><div class="rs-hint">Describe a look in plain language — IBM Granite proposes real PBR values (basecolor, metalness, roughness, emissive), applied live and checkpointed as a new version below.For a full pixel-level UV repaint (not just flat PBR), use the@@ -168,9 +175,9 @@<div class="rs-card"><h2 data-i18n="restyle.fine_tune">Fine-tune</h2>- <div class="rs-slider"><span data-i18n="restyle.metalness">Metalness</span><input id="metalness" type="range" min="0" max="1" step="0.01" /></div>- <div class="rs-slider"><span data-i18n="restyle.roughness">Roughness</span><input id="roughness" type="range" min="0" max="1" step="0.01" /></div>- <div class="rs-slider"><span data-i18n="restyle.emissive">Emissive</span><input id="emissive" type="range" min="0" max="4" step="0.05" /></div>+ <div class="rs-slider"><label for="metalness" data-i18n="restyle.metalness">Metalness</label><input id="metalness" type="range" min="0" max="1" step="0.01" /></div>+ <div class="rs-slider"><label for="roughness" data-i18n="restyle.roughness">Roughness</label><input id="roughness" type="range" min="0" max="1" step="0.01" /></div>+ <div class="rs-slider"><label for="emissive" data-i18n="restyle.emissive">Emissive</label><input id="emissive" type="range" min="0" max="4" step="0.05" /></div><div class="rs-colors"><label class="rs-color">Base <input id="basecolor" type="color" value="#888888" /></label><label class="rs-color">Glow <input id="emissivecolor" type="color" value="#000000" /></label>@@ -189,7 +196,7 @@<div class="rs-row" style="margin-top: 10px"><button class="rs-btn" id="save-variants" data-i18n="restyle.save_all_as_versions">Save all as versions</button></div>- <div class="rs-note" id="variants-note"></div>+ <div class="rs-note" id="variants-note" aria-live="polite"></div></div><div class="rs-hint">Same seed → same set, every time. Variants fan out from the last preset you applied.Swatches preview instantly in-browser; "Save all as versions" mints each one as its own real,@@ -203,7 +210,7 @@<button class="rs-btn" id="reset" data-i18n="restyle.reset_to_original">Reset to original</button><button class="rs-btn rs-btn--primary" id="export" data-i18n="restyle.export_glb">Export GLB</button></div>- <div class="rs-note" id="export-note"></div>+ <div class="rs-note" id="export-note" aria-live="polite"></div></div><div class="rs-card">@@ -215,7 +222,7 @@<div class="rs-row" style="margin-top: 12px"><button class="rs-btn" id="save-version" data-i18n="restyle.save_version">Save version</button></div>- <div class="rs-note" id="lineage-note"></div>+ <div class="rs-note" id="lineage-note" aria-live="polite"></div></div></div></div>diff --git a/pages/rig-doctor.html b/pages/rig-doctor.htmlindex d70203769..7e77b41ec 100644--- a/pages/rig-doctor.html+++ b/pages/rig-doctor.html@@ -129,11 +129,11 @@</section><!-- Everything below is written by src/rig-doctor-page.js once a file is read. -->- <section class="rd-results" id="rd-results" hidden aria-live="polite" aria-labelledby="rd-results-title">+ <section class="rd-results" id="rd-results" hidden aria-labelledby="rd-results-title"><h2 class="rd-sr-only" id="rd-results-title">Diagnosis</h2><!-- Verdict banner -->- <div class="rd-verdict" id="rd-verdict" data-level="pass">+ <div class="rd-verdict" id="rd-verdict" data-level="pass" role="status" aria-live="polite"><div class="rd-verdict-mark" id="rd-verdict-mark" aria-hidden="true"></div><div class="rd-verdict-body"><p class="rd-verdict-file" id="rd-verdict-file"></p>@@ -198,8 +198,9 @@</div><div class="rd-chips" id="rd-unmapped"></div><p class="rd-panel-foot">- If these are a standard rig, they belong in the canonicalizer.- <a href="https://github.com/nirholas/three.ws/blob/main/src/glb-canonicalize.js" rel="noopener">Open an issue with this list</a>+ If these are a standard rig, they belong in+ <a href="https://github.com/nirholas/three.ws/blob/main/src/glb-canonicalize.js" target="_blank" rel="noopener noreferrer">the canonicalizer</a>.+ <a href="https://github.com/nirholas/three.ws/issues/new?title=Rig%20convention%20not%20recognised%20by%20Rig%20Doctor&body=These%20joint%20names%20were%20not%20recognised%3A%0A%0A" target="_blank" rel="noopener noreferrer">Open an issue with this list</a>and every future upload of that rig animates.</p></div>diff --git a/pages/search.html b/pages/search.htmlindex bda2974ce..8cb86bc3e 100644--- a/pages/search.html+++ b/pages/search.html@@ -60,7 +60,7 @@<div class="sr-controls"><label class="sr-search" for="sr-q"><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.6" d="M13.6 13.6 18 18M9 15.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Z"/></svg>- <input type="search" id="sr-q" placeholder="Search avatars, agents, models, worlds, coins…" autocomplete="off" maxlength="80" />+ <input type="search" id="sr-q" aria-label="Search avatars, agents, models, worlds and coins" placeholder="Search avatars, agents, models, worlds, coins…" autocomplete="off" maxlength="80" /></label><!-- role="group", not "tablist": the children are aria-pressed toggle buttons,not tabs, and tablist requires role="tab" children (axe aria-required-children). -->@@ -75,7 +75,7 @@<section id="sr-grid" class="sr-grid" aria-label="Search results"></section>- <div class="sr-quicklinks" id="sr-quicklinks">+ <nav class="sr-quicklinks" id="sr-quicklinks" aria-label="Browse three.ws by type"><a class="sr-quicklink" href="/creations" data-i18n-html="search.creator_gallery_browse_and_remix_the_live"><span class="sr-quicklink-title">Creator Gallery →</span><span class="sr-quicklink-desc">Browse and remix the live 3D creation bazaar</span>@@ -100,7 +100,7 @@<span class="sr-quicklink-title">Trending →</span><span class="sr-quicklink-desc">Top agents and top conviction coins right now</span></a>- </div>+ </nav></main><script type="module" src="/src/search-page.js"></script>diff --git a/pages/sign-language.html b/pages/sign-language.htmlindex 33f9080ae..5d605a12f 100644--- a/pages/sign-language.html+++ b/pages/sign-language.html@@ -35,7 +35,12 @@<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Sign Language Avatars","description":"three.ws avatars sign in American Sign Language: fingerspelling for any word or number, signed chat replies, and webcam sign-to-text recognition: the full loop, live in 3D.","url":"https://three.ws/sign-language","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script><style>- .sl-main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 96px; }+ /* `margin: 0 auto` is an auto cross-axis margin on a flex item of the+ column-flex body, which cancels the stretch: without a definite width the+ main box shrink-to-fits to its own min-content (456px with the API+ console populated) and mobile.css's overflow-x: clip then amputates the+ right side of every section on a 320px screen instead of scrolling. */+ .sl-main { width: 100%; max-width: 1240px; min-width: 0; box-sizing: border-box; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 96px; }/* Hero: live avatar left, pitch + input right */.sl-hero {@@ -60,9 +65,9 @@/* Spell input */.sl-try { margin-top: 26px; }.sl-try-label { font-size: 13px; color: var(--ink-dim); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }- .sl-input-row { display: flex; gap: 8px; }+ .sl-input-row { display: flex; flex-wrap: wrap; gap: 8px; }.sl-input {- flex: 1 1 auto; min-width: 0; box-sizing: border-box;+ flex: 1 1 0; min-width: 0; box-sizing: border-box;background: rgba(167,139,250,.06); border: 1px solid rgba(167,139,250,.4);color: var(--ink); font: inherit; font-size: 15px; padding: 12px 14px; border-radius: 12px;}@@ -115,7 +120,7 @@/* Speed + dominant hand */.sl-settings { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }- .sl-setting { display: flex; align-items: center; gap: 9px; }+ .sl-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }.sl-setting-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }.sl-opts { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--stroke); border-radius: 999px; background: var(--surface-2); }.sl-opt {@@ -219,7 +224,7 @@.sl-api-code-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-dim); margin: 16px 0 6px; }.sl-api-pre { margin: 0; padding: 14px; border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface-2); overflow-x: auto; max-height: 340px; }.sl-api-pre code { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; color: var(--ink); white-space: pre; }- .sl-api-foot { margin: 22px 0 0; color: var(--ink-dim); font-size: 13px; line-height: 1.7; }+ .sl-api-foot { margin: 22px 0 0; color: var(--ink-dim); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }.sl-api-foot a { color: var(--ink); }.sl-api-foot code { font-family: var(--font-mono); font-size: 12px; }@@ -243,6 +248,11 @@.sl-webcam-grid { grid-template-columns: 1fr; }#sl-cam-preview { max-width: 360px; }}+ @media (max-width: 420px) {+ /* A 380px floor on a 4:5 stage is wider than the screen: below this+ the aspect ratio alone frames the avatar. */+ .sl-stage-wrap { min-height: 0; }+ }</style><meta property="og:image:alt" content="Sign Language Avatars · three.ws">diff --git a/pages/sign-mirror.html b/pages/sign-mirror.htmlindex 31877e06e..9426c7cde 100644--- a/pages/sign-mirror.html+++ b/pages/sign-mirror.html@@ -134,7 +134,8 @@.sm-btn:hover:not(:disabled) { background: rgba(56,189,248,.3); border-color: rgba(56,189,248,.8); }.sm-btn:active:not(:disabled) { transform: scale(.98); }.sm-btn:focus-visible { outline: 2px solid rgba(56,189,248,.9); outline-offset: 1px; }- .sm-btn:disabled { opacity: .6; cursor: wait; }+ .sm-btn:disabled { opacity: .55; cursor: not-allowed; }+ .sm-btn[aria-busy='true']:disabled { cursor: wait; }.sm-btn-quiet { background: transparent; border-color: var(--stroke); color: var(--ink-dim); font-weight: 500; }.sm-btn-quiet:hover:not(:disabled) { color: var(--ink); border-color: rgba(56,189,248,.6); background: transparent; }.sm-opts { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--stroke); border-radius: 999px; background: var(--surface-2); }@@ -158,7 +159,22 @@}.sm-video-empty .sm-video-empty-inner { max-width: 40ch; }.sm-video-empty strong { color: var(--ink); display: block; margin-bottom: 6px; font-size: 15px; }+ .sm-video-empty .sm-video-inner { max-width: 40ch; display: none; }+ .sm-video-empty .sm-video-inner strong { color: var(--ink); display: block; margin: 8px 0 6px; font-size: 15px; }body[data-sm-camera='on'] .sm-video-empty { display: none; }+ body[data-sm-camera='loading'] .sm-video-idle,+ body[data-sm-camera='starting'] .sm-video-idle { display: none; }+ body[data-sm-camera='loading'] .sm-video-loading,+ body[data-sm-camera='starting'] .sm-video-starting { display: block; }+ .sm-spinner {+ display: inline-block; width: 22px; height: 22px; border-radius: 50%;+ border: 2px solid var(--stroke); border-top-color: #38bdf8;+ animation: sm-spin .8s linear infinite;+ }+ @keyframes sm-spin { to { transform: rotate(360deg); } }+ @media (prefers-reduced-motion: reduce) {+ .sm-spinner { animation-duration: 2.4s; }+ }.sm-grade { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }.sm-score-row { display: flex; align-items: center; gap: 14px; }@@ -203,11 +219,21 @@.sm-group p { margin: 0 0 12px; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }.sm-letters { display: flex; flex-wrap: wrap; gap: 8px; }.sm-letter {+ position: relative; overflow: hidden;appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 16px;width: 44px; height: 44px; border-radius: 12px; color: var(--ink-dim);border: 1px solid var(--stroke); background: var(--surface-2);transition: color .14s ease, border-color .14s ease, background .14s ease, transform .14s ease;}+ /* The best score this letter has reached, so 26 identical squares read+ as a map of where the practice actually is. */+ .sm-letter::after {+ content: ''; position: absolute; left: 0; bottom: 0; height: 3px;+ width: var(--sm-best, 0%); background: rgba(56,189,248,.85);+ transition: width .3s ease;+ }+ .sm-letter[data-tried='false']::after { display: none; }+ .sm-letter[data-passed='true']::after { background: rgba(4,18,28,.45); }.sm-letter:hover { color: var(--ink); border-color: rgba(56,189,248,.6); transform: translateY(-2px); }.sm-letter:active { transform: translateY(0) scale(.96); }.sm-letter:focus-visible { outline: 2px solid rgba(56,189,248,.9); outline-offset: 2px; }@@ -300,21 +326,32 @@<video id="sm-video" playsinline muted aria-label="Your camera, mirrored"></video><svg id="sm-overlay" viewBox="0 0 640 480" preserveAspectRatio="xMidYMid slice" aria-hidden="true"></svg><div class="sm-video-empty">- <div class="sm-video-empty-inner">+ <div class="sm-video-empty-inner sm-video-idle"><strong>The camera is off.</strong>Turn it on to be graded live. The video, the hand landmarks, and every scorestay in this tab: there is no network call in the practice loop. Or skip thecamera and copy the target diagram by eye.</div>+ <div class="sm-video-inner sm-video-loading" role="status">+ <span class="sm-spinner" aria-hidden="true"></span>+ <strong>Downloading the hand tracker.</strong>+ About 8 MB, once per browser. It is cached after this, and it runs in this+ tab from then on.+ </div>+ <div class="sm-video-inner sm-video-starting" role="status">+ <span class="sm-spinner" aria-hidden="true"></span>+ <strong>Waiting for the camera.</strong>+ Allow the camera in your browser prompt and the grading starts.+ </div></div></div><div class="sm-grade"><div class="sm-score-row"><span id="sm-score" aria-hidden="true">0</span>- <span class="sm-score-unit">/100</span>+ <span class="sm-score-unit" aria-hidden="true">/100</span><div id="sm-score-bar" role="progressbar" aria-label="Handshape score" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div></div>- <div id="sm-hint">Turn the camera on to be graded, or just copy the diagram.</div>+ <div id="sm-hint" role="status" aria-live="polite">Turn the camera on to be graded, or just copy the diagram.</div><div id="sm-fingers" role="group" aria-label="Per-finger score"></div><div class="sm-camera-row"><button class="sm-btn" id="sm-camera" type="button" aria-pressed="false">Turn the camera on</button>diff --git a/pages/signals.html b/pages/signals.htmlindex 9d924bec6..c083a547f 100644--- a/pages/signals.html+++ b/pages/signals.html@@ -66,16 +66,16 @@</section><section class="sm-controls" aria-label="Filters">- <div class="sm-seg" role="tablist" aria-label="Rank by" id="sm-sort">- <button class="sm-seg-btn is-active" data-sort="edge" role="tab" aria-selected="true" data-i18n="signals.proven_edge">Proven edge</button>- <button class="sm-seg-btn" data-sort="roi" role="tab" data-i18n="signals.avg_roi">Avg ROI</button>- <button class="sm-seg-btn" data-sort="hitrate" role="tab" data-i18n="signals.hit_rate">Hit rate</button>- <button class="sm-seg-btn" data-sort="subscribers" role="tab" data-i18n="signals.subscribers">Subscribers</button>- <button class="sm-seg-btn" data-sort="newest" role="tab" data-i18n="signals.newest">Newest</button>+ <div class="sm-seg" role="group" aria-label="Rank by" id="sm-sort">+ <button class="sm-seg-btn is-active" type="button" data-sort="edge" aria-pressed="true" aria-controls="sm-grid" data-i18n="signals.proven_edge">Proven edge</button>+ <button class="sm-seg-btn" type="button" data-sort="roi" aria-pressed="false" aria-controls="sm-grid" data-i18n="signals.avg_roi">Avg ROI</button>+ <button class="sm-seg-btn" type="button" data-sort="hitrate" aria-pressed="false" aria-controls="sm-grid" data-i18n="signals.hit_rate">Hit rate</button>+ <button class="sm-seg-btn" type="button" data-sort="subscribers" aria-pressed="false" aria-controls="sm-grid" data-i18n="signals.subscribers">Subscribers</button>+ <button class="sm-seg-btn" type="button" data-sort="newest" aria-pressed="false" aria-controls="sm-grid" data-i18n="signals.newest">Newest</button></div>- <div class="sm-seg sm-net" role="tablist" aria-label="Network" id="sm-net">- <button class="sm-seg-btn is-active" data-net="mainnet" role="tab" aria-selected="true" data-i18n="signals.mainnet">Mainnet</button>- <button class="sm-seg-btn" data-net="devnet" role="tab" data-i18n="signals.devnet">Devnet</button>+ <div class="sm-seg sm-net" role="group" aria-label="Network" id="sm-net">+ <button class="sm-seg-btn is-active" type="button" data-net="mainnet" aria-pressed="true" aria-controls="sm-grid" data-i18n="signals.mainnet">Mainnet</button>+ <button class="sm-seg-btn" type="button" data-net="devnet" aria-pressed="false" aria-controls="sm-grid" data-i18n="signals.devnet">Devnet</button></div></section>diff --git a/pages/sniper-experiments.html b/pages/sniper-experiments.htmlindex a515c76af..cb0439379 100644--- a/pages/sniper-experiments.html+++ b/pages/sniper-experiments.html@@ -81,15 +81,20 @@<!-- Window switch + summary tiles. Hydrated by src/sniper-experiments.js. --><section id="xp-controls" class="cv-section" aria-label="Window"></section>++ <!-- A refresh that failed on top of a good board says so here rather than+ letting stale numbers keep claiming to be live. -->+ <div id="xp-alert" class="xp-alert cv-inline-note" role="status" hidden></div>+<section id="xp-summary" class="cv-section" aria-label="Summary"></section><!-- The comparison board. Hydrated by src/sniper-experiments.js. -->- <section id="xp-board" class="cv-section" aria-label="Strategy comparison"></section>+ <section id="xp-board" class="cv-section" aria-label="Strategy comparison" aria-busy="true"></section><!-- LLM judgment ledger: verdicts scored against real coin outcomes. --><section id="xp-judgment" class="cv-section" aria-label="LLM judgment ledger"></section>- <p class="cv-updated" id="xp-updated"></p>+ <p class="cv-updated" id="xp-updated" role="status" aria-live="polite"></p></main><script type="module" src="/src/sniper-experiments.js"></script>diff --git a/pages/splat.html b/pages/splat.htmlindex d1222a692..156ba6b1b 100644--- a/pages/splat.html+++ b/pages/splat.html@@ -156,6 +156,14 @@color: var(--text-2, #a8a8a8); font-size: 12.5px; transition: border-color 0.15s, color 0.15s;}.sp-sample:hover { border-color: var(--hairline-strong, #2a2a2a); color: var(--text, #f6f6f6); }+ .sp-sample:active { border-color: var(--accent, #fff); }+ .sp-sample:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }+ .sp-btn:active { border-color: var(--accent, #fff); }+ .sp-icon-btn:active { color: var(--accent, #fff); }+ .sp-sr-only {+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;+ overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;+ }.sp-sample-dot { width: 8px; height: 8px; border-radius: 50%; background: #c4b5fd; flex: 0 0 auto; }.sp-note { font-size: 11.5px; color: var(--text-3, #8a8a8a); line-height: 1.55; }@@ -196,6 +204,7 @@</div><h3 data-i18n="splat.load_a_splat_to_begin">Load a splat to begin</h3><p data-i18n-html="splat.drop_a_here_paste_a_url_or">Drop a <code>.ply</code> / <code>.splat</code> / <code>.ksplat</code> here, paste a URL, or try a sample on the right.</p>+ <button class="sp-btn" id="sp-idle-pick" type="button" style="width:auto">Choose a file</button></div><!-- Loading -->@@ -235,6 +244,7 @@<div class="sp-card"><h2 data-i18n="splat.load_by_url">Load by URL</h2><div class="sp-field">+ <label class="sp-sr-only" for="sp-url" data-i18n="splat.splat_scene_url">Splat scene URL</label><input class="sp-input" id="sp-url" type="url" placeholder="https://…/avatar.ply" autocomplete="off" /><button class="sp-btn sp-btn--primary" id="sp-load-url" type="button"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14 M13 5l7 7-7 7"/></svg>diff --git a/pages/temporary.html b/pages/temporary.htmlindex d9816b367..8ab30996a 100644--- a/pages/temporary.html+++ b/pages/temporary.html@@ -32,7 +32,6 @@<link rel="manifest" href="/manifest.webmanifest" /><link rel="stylesheet" href="/style.css" /><link rel="stylesheet" href="/footer.css" />- <link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/fonts/fonts.css" /><link rel="stylesheet" href="/mobile.css" />@@ -72,7 +71,6 @@--text: #fafafa;--text-2: #a1a1aa;--accent: #ffffff;- --danger: var(--danger);}html, body {@@ -307,6 +305,24 @@}#walk-status.is-error { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); }#walk-status.is-hidden { opacity: 0; }+ /* The pill is pointer-transparent so it never eats an orbit drag, but+ the avatar-load failure writes a recovery link into it. A descendant+ can opt back in, so the link stays clickable without the pill+ blocking the canvas underneath it. */+ #walk-status a {+ pointer-events: auto;+ color: var(--text);+ text-decoration: underline;+ text-underline-offset: 2px;+ border-radius: 4px;+ }+ #walk-status a:hover { color: var(--accent); }+ #walk-status a:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ /* A faded-out pill is still hit-testable, so drop the link with it. */+ #walk-status.is-hidden a { pointer-events: none; }#walk-help {position: fixed;@@ -686,6 +702,14 @@transform: translateX(-50%);bottom: calc(180px + env(safe-area-inset-bottom, 0));flex-direction: row;+ /* Every gesture is a tap target, so the row must never run past+ the screen edge. Capped to the viewport it wraps upward+ instead of stranding the first and last emotes off-screen.+ Plain wrap keeps the visual order equal to the DOM order. */+ flex-wrap: wrap;+ justify-content: center;+ align-items: center;+ max-width: calc(100vw - 24px);gap: 8px;}.walk-emote-btn { width: 40px; height: 40px; font-size: 18px; }@@ -1274,7 +1298,7 @@<link rel="stylesheet" href="/nav.css" /><link rel="canonical" href="https://three.ws/temporary">- <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Walk","description":"Drive a 3D avatar around with a joystick or WASD — toggle the back camera for AR-style passthrough.","url":"https://three.ws/temporary","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Drive Your Avatar","description":"Drive a 3D avatar around with a joystick or WASD, then toggle the back camera for AR-style passthrough on your phone.","url":"https://three.ws/temporary","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script><meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1"><meta property="og:locale" content="en_US">@@ -1285,6 +1309,15 @@<header class="walk-site-header" id="walk-header"><div id="nav-container"></div></header><script src="/nav.js"></script>+ <!--+ The document heading. The whole page is a full-bleed 3D stage whose HUD+ is deliberately chrome-free, so the heading is exposed to assistive tech+ with the canonical .sr-only clip (tokens.css) rather than drawn over the+ scene. Without it this route had no h1 at all once the coin lobby was+ dismissed, and screen-reader users landed on an unnamed page.+ -->+ <h1 class="sr-only" data-i18n="temporary.page_heading">Drive your avatar</h1>+<!-- Loading overlay --><div id="walk-loading" class="walk-loading"><div class="walk-loading-inner">diff --git a/pages/theater.html b/pages/theater.htmlindex d99990458..698ba9109 100644--- a/pages/theater.html+++ b/pages/theater.html@@ -70,7 +70,10 @@<div class="th-layout"><section class="th-stage" id="th-stage" aria-label="3D trading stage"><canvas id="th-canvas" class="th-canvas"></canvas>- <div id="th-overlay" class="th-overlay" aria-hidden="true"></div>+ <!-- Projection layer for the nameplates and receipts. NOT aria-hidden: the+ nameplates are real focusable buttons and the only keyboard route into an+ agent's panel, so hiding this subtree strands them outside the a11y tree. -->+ <div id="th-overlay" class="th-overlay"></div><!-- loading --><div class="th-state th-loading" id="th-loading">diff --git a/pages/three-live.html b/pages/three-live.htmlindex c00fe19c9..eff2602d6 100644--- a/pages/three-live.html+++ b/pages/three-live.html@@ -42,6 +42,18 @@.pl-overlay { position: absolute; pointer-events: none; z-index: 10; }.pl-overlay > * { pointer-events: auto; }+ /* Wide layout keeps the hero and the trade feed in opposite corners, so the+ wrapper contributes no box at all and each child anchors to #pl-stage+ exactly as it did before. The narrow rules below turn it into the single+ stacked column that lets the feed survive on a phone. */+ #pl-hud-top { display: contents; }++ .pl-sr {+ position: absolute; width: 1px; height: 1px; margin: -1px;+ padding: 0; border: 0; overflow: hidden; white-space: nowrap;+ clip: rect(0 0 0 0); clip-path: inset(50%);+ }+/* ── Hero readout (top-left): price + sentiment ── */.pl-hero {top: calc(var(--header-h, 3.5rem) + 16px);@@ -53,7 +65,7 @@backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);min-width: 232px;}- .pl-hero .sym { font-family: var(--pl-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--pl-muted); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }+ .pl-hero .sym { font-family: var(--pl-mono); font-size: 11px; font-weight: 400; line-height: 1.4; margin: 0; letter-spacing: 0.16em; color: var(--pl-muted); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }.pl-hero .sym .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }.pl-hero[data-state="connecting"] .dot { background: #f5a623; animation: plPulse 1.2s ease-in-out infinite; }.pl-hero[data-state="live"] .dot { background: var(--pl-green); box-shadow: 0 0 10px rgba(52,224,168,0.8); animation: plPulse 1.6s ease-in-out infinite; }@@ -72,6 +84,27 @@.pl-activity .bar .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(90deg, var(--pl-accent), var(--pl-green)); transition: width 0.5s ease; border-radius: 3px; }.pl-activity .reading { font-weight: 600; color: var(--pl-text); min-width: 64px; text-align: right; }+ /* Failure notice: stays up for as long as the feed is actually down. */+ .pl-fault {+ display: flex; align-items: center; gap: 10px; flex-wrap: wrap;+ margin: 12px 0 0; padding: 9px 11px;+ background: rgba(255, 93, 115, 0.09);+ border: 1px solid rgba(255, 93, 115, 0.32); border-radius: 10px;+ font-family: var(--pl-mono); font-size: 11.5px; line-height: 1.5; color: #ffb8c2;+ }+ .pl-fault[hidden] { display: none; }+ .pl-retry {+ flex: none; margin-left: auto; cursor: pointer;+ font-family: var(--pl-mono); font-size: 11px; letter-spacing: 0.05em;+ color: var(--pl-text); background: rgba(255, 255, 255, 0.07);+ border: 1px solid var(--pl-border); border-radius: 7px; padding: 5px 10px;+ transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;+ }+ .pl-retry:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }+ .pl-retry:active { transform: translateY(1px); }+ .pl-retry:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 2px; }+ .pl-retry[disabled] { opacity: 0.55; cursor: progress; }+/* ── Stat grid (bottom-left) ── */.pl-stats {bottom: 18px; left: 18px;@@ -165,12 +198,36 @@.pl-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }@media (max-width: 820px) {- .pl-ticker { display: none; }.pl-hint { display: none; }- .pl-hero { min-width: 0; left: 12px; right: 12px; padding: 12px 14px; }+ /* One column from the header down to the bottom HUD band. --pl-dock-h is+ measured from the live band height, so the feed grows into whatever+ room is left instead of being deleted from the small screen. */+ #pl-hud-top {+ display: flex; flex-direction: column; gap: 10px;+ position: absolute; z-index: 10; pointer-events: none;+ top: calc(var(--header-h, 3.5rem) + 16px);+ left: 12px; right: 12px;+ bottom: calc(var(--pl-dock-h, 210px) + 10px);+ }+ #pl-hud-top > * { position: static; pointer-events: none; }+ .pl-hero { min-width: 0; padding: 12px 14px; flex: 0 0 auto; }.pl-hero .price { font-size: 28px; }- .pl-stats { left: 12px; bottom: 84px; grid-template-columns: repeat(2, 1fr); max-width: calc(100% - 24px); }- .pl-flow { bottom: 12px; }+ .pl-ticker { display: flex; flex-direction: column; width: auto; flex: 1 1 auto; min-height: 0; }+ .pl-ticker ol { max-height: none; flex: 1 1 auto; overflow-y: auto; }+ /* Under roughly two rows of trades the feed reads as a scrap of a panel+ rather than a feed, so the short-viewport case drops it and leaves the+ hero and the bottom band whole. */+ #pl-hud-top.is-cramped .pl-ticker { display: none; }+ /* --pl-band-base clears the flow row AND the shared corner stack, which+ spans the full width down here and would otherwise sit on the grid. */+ .pl-stats {+ left: 12px; right: 12px; bottom: calc(var(--pl-band-base, 80px) + 10px);+ grid-template-columns: repeat(2, 1fr); max-width: none;+ }+ .pl-flow { bottom: 12px; left: 12px; right: 12px; transform: none; }+ .pl-flow .seg { flex: 1; padding: 8px 10px; }+ .pl-flow .label { font-size: 8.5px; white-space: nowrap; }+ .pl-flow .num { font-size: 16px; }}</style>@@ -197,15 +254,19 @@<header><div id="nav-container"></div></header><script src="/nav.js"></script>- <div id="pl-stage">+ <!-- data-corner-ignore: this page declares its own corner-stack clearance from+ measured HUD geometry (syncDock below). Without it the stack's automatic+ probe adds a second, overlapping lift on top of that reservation. -->+ <div id="pl-stage" data-corner-ignore><div id="pl-canvas-host"></div><!-- Hero: price + sentiment gauge -->+ <div id="pl-hud-top"><section class="pl-overlay pl-hero" id="pl-hero" data-state="connecting" aria-live="polite">- <div class="sym"><span class="dot"></span> <span id="pl-status-text" data-i18n="three_live.three_connecting">$THREE · connecting…</span></div>+ <h1 class="sym"><span class="dot" aria-hidden="true"></span> <span id="pl-status-text" data-i18n="three_live.three_connecting">$THREE · connecting…</span><span class="pl-sr">: Protocol Pulse, live on-chain $THREE activity rendered in 3D</span></h1><div class="price" id="pl-price">$—</div><div class="chg flat" id="pl-change">—</div>- <div class="pl-activity" title="On-chain trade throughput in the last 60s — activity, not a buy/sell signal">+ <div class="pl-activity" title="On-chain trade throughput in the last 60s. Activity, not a buy/sell signal."><span data-i18n="three_live.quiet">QUIET</span><span class="bar"><span class="fill" id="pl-activity-fill"></span></span><span data-i18n="three_live.busy">BUSY</span>@@ -216,15 +277,25 @@<a href="/dashboard/holders" style="color:var(--pl-faint);text-decoration:none" data-i18n="three_live.holder_leaderboard">▸ Holder leaderboard</a><a href="https://pump.fun/coin/FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump" target="_blank" rel="noopener" style="color:var(--pl-faint);text-decoration:none" data-i18n="three_live.buy_three">▸ Buy $THREE ↗</a></div>+ <!-- Persistent, actionable failure notice. A toast alone disappears after a+ few seconds and leaves a HUD full of dashes with no explanation. -->+ <p class="pl-fault" id="pl-fault" role="alert" hidden>+ <span id="pl-fault-text"></span>+ <button type="button" id="pl-fault-retry" class="pl-retry">Retry now</button>+ </p></section><!-- Live trade ticker --><aside class="pl-overlay pl-ticker" id="pl-ticker"><div class="head">Live trades <span class="live" data-i18n="three_live.live">live</span></div><ol id="pl-ticker-list" role="list">- <li class="empty" id="pl-ticker-empty" data-i18n="three_live.live_trades_will_appear_here">Live trades will appear here.</li>+ <!-- The script swaps this for the shared state-kit empty state, so it is+ marked script-owned: the i18n catalog pass would otherwise reset it+ to a bare text node and wipe that markup. -->+ <li class="empty" id="pl-ticker-empty" data-i18n-owned="1">Live trades will appear here.</li></ol></aside>+ </div><!-- Stat grid --><section class="pl-overlay pl-stats" id="pl-stats">@@ -290,11 +361,18 @@live: true,title: 'No trades yet',body: 'Live trades will appear here.',- tip: 'Streaming live from the $THREE bonding curve on-chain — each trade shows up the moment it settles.',+ tip: 'Streaming live from the $THREE bonding curve on-chain. Each trade shows up the moment it settles.',});}const introEl = document.getElementById('pl-intro');const toastEl = document.getElementById('pl-toast');+ const hudTop = document.getElementById('pl-hud-top');+ const statsPanel = document.getElementById('pl-stats');+ const flowPanel = document.getElementById('pl-flow');+ const hintPanel = document.querySelector('.pl-hint');+ const faultEl = document.getElementById('pl-fault');+ const faultText = document.getElementById('pl-fault-text');+ const faultRetry = document.getElementById('pl-fault-retry');const el = (id) => document.getElementById(id);// Null-tolerant writers. Privacy/anti-popup browser extensions strip// fixed-position overlays (our HUD is a set of `.pl-overlay` nodes), which@@ -547,8 +625,56 @@if (n >= 1e3) return (n/1e3).toFixed(1) + 'K';return String(Math.round(n));}- function setHero(state, text) { if (heroEl) heroEl.dataset.state = state; if (text) setText(statusText, text); }- const heroState = () => (heroEl ? heroEl.dataset.state : '');+ // ── Status resolution ───────────────────────────────────────────────────+ // The stream and the stats poll fail independently, so they each keep their+ // own health flag and one resolver decides what the badge says. The old code+ // let whichever handler fired last win, which is how a stats outage could be+ // erased by the next SSE retry and leave a HUD of dashes with no explanation.+ let streamState = 'connecting'; // connecting | live | quiet | reconnecting+ let statsOk = null; // null = not answered yet, true/false = last poll+ const STREAM_LABEL = {+ connecting: '$THREE · connecting…',+ live: '$THREE · live',+ quiet: '$THREE · market quiet',+ reconnecting: '$THREE · reconnecting…',+ };+ function setHero(state, text) {+ if (heroEl) heroEl.dataset.state = state;+ if (text != null && statusText) {+ // Claim the node from the i18n catalog pass. It lands after an async+ // locale fetch and would otherwise revert a live badge to "connecting…"+ // for the rest of the session.+ statusText.setAttribute('data-i18n-owned', '1');+ statusText.textContent = text;+ }+ }+ function setStream(state) { streamState = state; renderStatus(); }+ function renderStatus() {+ const streamDown = streamState === 'connecting' || streamState === 'reconnecting';+ // Until something has actually happened the markup already says+ // "connecting…", and it says it in the visitor's language. Leave that+ // first paint to the i18n catalog and only claim the node once the+ // script has a status of its own to report.+ const untouched = streamState === 'connecting' && statsOk !== false;+ if (statsOk === false && streamDown) {+ setHero('error', '$THREE · live data unavailable');+ } else {+ setHero(streamState === 'reconnecting' ? 'connecting' : streamState, untouched ? null : STREAM_LABEL[streamState]);+ }+ renderFault();+ }+ // One persistent line naming exactly what is down and offering the recovery.+ function renderFault() {+ if (!faultEl) return;+ const streamDown = streamState === 'reconnecting';+ let msg = '';+ if (statsOk === false && streamDown) msg = 'Price, stats and the trade stream are all unreachable. Retrying automatically.';+ else if (statsOk === false) msg = 'Price and protocol stats are unreachable. The trade stream is still running.';+ else if (streamDown) msg = 'The live trade stream dropped. Reconnecting automatically.';+ if (!msg) { faultEl.hidden = true; return; }+ setText(faultText, msg);+ faultEl.hidden = false;+ }function pushTicker(isBuy, usd, who) {if (!tickerList) return;@@ -572,11 +698,8 @@const d = await r.json();const tk = d.token || {}; const pr = d.protocol || {};statsFailures = 0;- // Recover from a prior stats-error badge once figures load again. Don't stomp- // the live/quiet badge the trade stream owns — only clear the error state.- if (heroState() === 'error') {- setHero(recentTrades.length ? 'live' : 'connecting', recentTrades.length ? '$THREE · live' : '$THREE · connecting…');- }+ statsOk = true;+ renderStatus();if (tk.price_usd != null) setText(priceEl, fmtUsd(tk.price_usd));const chg = Number(tk.price_change_24h);if (Number.isFinite(chg) && changeEl) {@@ -597,12 +720,12 @@}} catch (err) {statsFailures++;- // Badge the error on the FIRST failure for fast feedback: the hero dot turns- // red and the status line says so, then keep retrying on the poll interval.- // Only flip the badge if a live trade stream isn't already proving the chain- // is reachable; in that case the stats endpoint alone hiccupped.- if (heroState() !== 'live') setHero('error', '$THREE · stats unavailable');- showToast(statsFailures >= 2 ? 'Live stats still unavailable — retrying…' : 'Live stats unavailable — retrying…');+ // Badge the error on the FIRST failure for fast feedback, then keep+ // retrying on the poll interval. The persistent notice in the hero is+ // what the visitor reads; the toast is only the arrival cue.+ statsOk = false;+ renderStatus();+ if (statsFailures === 1) showToast('Live stats unavailable. Retrying.');}}@@ -611,7 +734,7 @@function connectTrades() {try { es = new EventSource(TRADES_SSE); } catch { scheduleReconnect(); return; }es.addEventListener('open', () => { /* server "open" event */ });- es.onopen = () => { sseRetry = 0; setHero('live', '$THREE · live'); };+ es.onopen = () => { sseRetry = 0; setStream('live'); };es.addEventListener('trade', (ev) => {let d; try { d = JSON.parse(ev.data); } catch { return; }const isBuy = d.is_buy === true || d.txType === 'buy' || d.tx_type === 'buy';@@ -621,9 +744,9 @@recentTrades.push({ t: now, isBuy, usd });emitTrade(isBuy, usd);pushTicker(isBuy, usd, d.trader || d.traderPublicKey);- setHero('live', '$THREE · live');+ setStream('live');});- es.onerror = () => { setHero(recentTrades.length ? 'live' : 'connecting', '$THREE · reconnecting…'); scheduleReconnect(); };+ es.onerror = () => { setStream('reconnecting'); scheduleReconnect(); };}function scheduleReconnect() {if (sseRetryTimer) return;@@ -690,13 +813,104 @@}// idle/quiet state- if (lastTradeAt && now - lastTradeAt > 25_000 && heroState() === 'live') setHero('quiet', '$THREE · market quiet');+ if (lastTradeAt && now - lastTradeAt > 25_000 && streamState === 'live') setStream('quiet');updateFlowCounters(now);controls.update();composer.render();}+ // ── Recovery control ────────────────────────────────────────────────────+ // The poll already retries on its own interval; this is the visitor's way to+ // stop waiting for it. Both feeds are re-armed, because the notice can name+ // either one.+ if (faultRetry) {+ faultRetry.addEventListener('click', async () => {+ faultRetry.disabled = true;+ faultRetry.textContent = 'Retrying…';+ if (streamState === 'reconnecting') {+ if (sseRetryTimer) { clearTimeout(sseRetryTimer); sseRetryTimer = null; }+ sseRetry = 0;+ if (es) { try { es.close(); } catch { /* already closed */ } es = null; }+ connectTrades();+ }+ await pollStats();+ faultRetry.disabled = false;+ faultRetry.textContent = 'Retry now';+ });+ }++ // ── Bottom-band measurement ─────────────────────────────────────────────+ // Two consumers, one measure pass. The narrow layout needs to know how tall+ // the bottom HUD band is so the trade feed can fill exactly the gap above it,+ // and the shared corner stack (language control, Getting started) needs the+ // same clearance so it stops landing on top of the page's own controls. The+ // stack's own probe cannot see these: it walks up to the nearest fixed+ // ancestor, which here is the full-viewport #pl-stage, and gives up.+ const CORNER_KEY = 'three-live-hud';+ const narrowLayout = window.matchMedia('(max-width: 820px)');+ function clearanceOf(node) {+ if (!node || getComputedStyle(node).display === 'none') return 0;+ const r = node.getBoundingClientRect();+ return r.height > 0 ? Math.max(0, window.innerHeight - r.top) : 0;+ }+ let stackRo = null, stackWatched = false;+ function syncDock() {+ const root = document.documentElement;+ const stackEl = document.getElementById('tws-corner-stack');+ // Wide layout parks the stack in the corner it shares with the orbit hint+ // and nothing else. Narrow layout turns it into a full-width bar, where the+ // bottom-most thing the page owns is the flow row. Reserving only that keeps+ // the lift small; the stat grid then steps over the stack itself, so the+ // whole bottom band stacks flow, stack, stats without ever double-counting.+ const need = narrowLayout.matches ? clearanceOf(flowPanel) : clearanceOf(hintPanel);+ const stack = window.twsCornerStack;+ if (stack) {+ if (need > 0) stack.reserve(CORNER_KEY, { height: Math.round(need) });+ else stack.release(CORNER_KEY);+ }+ // observe() fires the callback immediately, so this attaches exactly once:+ // re-observing on every pass would spin the observer against itself.+ if (stackEl && stackRo && !stackWatched) { stackWatched = true; stackRo.observe(stackEl); }+ // Narrow layout turns the stack into a full-width bar sitting right where+ // the stat grid does, so the grid steps over whatever is actually parked+ // there (the stack alone, or the stack lifted by the walk companion).+ // Clamped at 40% of the viewport for two reasons: the stack's position is+ // partly a function of the reservation written just above, so an unbounded+ // read could walk the band a little further up on every pass, and a HUD+ // that climbs off the top is worse than one a helper pill overlaps.+ let base = clearanceOf(flowPanel);+ if (narrowLayout.matches && stackEl) {+ const r = stackEl.getBoundingClientRect();+ if (r.height > 0) {+ base = Math.max(base, Math.round(window.innerHeight - r.top) + 10);+ base = Math.min(base, Math.round(window.innerHeight * 0.4));+ }+ }+ root.style.setProperty('--pl-band-base', Math.round(base) + 'px');+ const band = Math.max(clearanceOf(statsPanel), clearanceOf(flowPanel));+ if (band > 0) root.style.setProperty('--pl-dock-h', Math.round(band) + 'px');+ // Measured from the column and the hero, never from the feed itself: the+ // feed's own height goes to zero the moment this class hides it, which+ // would latch the page into the cramped layout for good.+ if (hudTop && heroEl) {+ const room = hudTop.getBoundingClientRect().height - heroEl.getBoundingClientRect().height - 10;+ hudTop.classList.toggle('is-cramped', narrowLayout.matches && room < 112);+ }+ }+ // The stack grows when its Getting started checklist opens, which moves the+ // floor the stat grid sits on. Watched separately because the element is+ // mounted by another module and may not exist on the first pass.+ stackRo = new ResizeObserver(syncDock);+ const dockRo = new ResizeObserver(syncDock);+ if (statsPanel) dockRo.observe(statsPanel);+ if (flowPanel) dockRo.observe(flowPanel);+ if (heroEl) dockRo.observe(heroEl);+ window.addEventListener('resize', syncDock);+ window.addEventListener('tws-corner-stack:ready', syncDock);+ narrowLayout.addEventListener('change', syncDock);+ syncDock();+// ── Resize / lifecycle ───────────────────────────────────────────────────function resize() {const w = host.clientWidth, h = host.clientHeight;@@ -715,12 +929,12 @@window.addEventListener('beforeunload', () => { if (es) es.close(); if (statsTimer) clearInterval(statsTimer); });// ── Boot ──────────────────────────────────────────────────────────────────- setHero('connecting', '$THREE · connecting…');+ renderStatus();// Seed the SOL price used for trades that only supply sol_amount.// Same-origin call to the free /api/crypto/token snapshot (wrapped-SOL mint)// — Jupiter's browser fetch is CORS-blocked, this reuses the platform's// cached multi-provider SOL/USD read instead.- fetch('/api/crypto/token?address=So11111111111111111111111111111111111111112', { signal: AbortSignal.timeout(5000) })+ fetch('/api/crypto/token?address=So11111111111111111111111111111111111111112', { signal: AbortSignal.timeout(9000) }).then((r) => r.ok ? r.json() : null).then((d) => { const p = Number(d?.priceUsd); if (p > 0) _solUsd = p; }).catch(() => {});diff --git a/pages/tour-atlas.html b/pages/tour-atlas.htmlindex 6e980e30f..1c75cd3d2 100644--- a/pages/tour-atlas.html+++ b/pages/tour-atlas.html@@ -5,7 +5,7 @@<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /><title>Tour Atlas · three.ws</title>- <meta name="description" content="Every stop on the three.ws guided tour, as a real screenshot of the live site with the feature circled. Search 185 stops, filter by chapter, read what the guide says, and drop the tour onto any feature in one click." />+ <meta name="description" content="Every stop on the three.ws guided tour, as a real screenshot of the live site with the feature circled. Search 263 stops, filter by chapter, read what the guide says, and drop the tour onto any feature in one click." /><link rel="canonical" href="https://three.ws/tour/atlas" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />@@ -16,13 +16,13 @@<link rel="stylesheet" href="/mobile.css" /><meta property="og:type" content="website" /><meta property="og:title" content="Tour Atlas · three.ws" />- <meta property="og:description" content="Every feature on three.ws, photographed on the live site with the feature circled. 185 stops, searchable, one click from the guided tour." />+ <meta property="og:description" content="Every feature on three.ws, photographed on the live site with the feature circled. 263 stops, searchable, one click from the guided tour." /><meta property="og:url" content="https://three.ws/tour/atlas" />- <meta property="og:image" content="https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+185+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+263+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="Tour Atlas · three.ws" />- <meta name="twitter:description" content="185 stops of the three.ws guided tour, each one a real screenshot with the feature circled." />- <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+185+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas" />+ <meta name="twitter:description" content="263 stops of the three.ws guided tour, each one a real screenshot with the feature circled." />+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+263+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas" /><style>/* Thin alias layer over the canonical vocabulary in public/tokens.css —the sanctioned pattern (same as --nxt-* / --nv-*): every value resolves@@ -252,6 +252,7 @@}.ta-empty h2 { font: 650 18px/1.3 var(--font-body); margin: 0 0 8px; }.ta-empty p { font: 400 14px/1.6 var(--font-body); color: var(--ta-muted); margin: 0 auto 18px; max-width: 44ch; }+ .ta-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }.ta-btn {display: inline-flex; align-items: center; gap: 8px; cursor: pointer;@@ -283,6 +284,15 @@}.ta-lb-figure { position: relative; background: var(--scrim-strong); flex-shrink: 0; }.ta-lb-figure img { display: block; width: 100%; height: auto; max-height: 58vh; object-fit: contain; }+ .ta-lb-figure img[hidden] { display: none; }+ /* A stop with no capture still opens, so the figure says why instead of+ leaving an empty black band above the narration. */+ .ta-lb-none[hidden] { display: none; }+ .ta-lb-none {+ margin: 0; min-height: 148px; display: grid; place-items: center;+ padding: 28px 56px; text-align: center;+ font: 500 13.5px/1.6 var(--font-body); color: var(--on-scrim-bright);+ }.ta-lb-x {position: absolute; top: 10px; right: 10px; z-index: 3;width: 34px; height: 34px; border-radius: var(--radius-md); cursor: pointer;@@ -339,7 +349,7 @@<meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Tour Atlas — three.ws"><meta name="twitter:site" content="@trythreews">- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Tour Atlas","description":"Every stop on the guided tour as a real screenshot of the live site, with the feature circled by the tour's own spotlight. Search 185 stops, filter by chapter, read what the guide says about each one, and drop the tour onto any feature in a single click.","url":"https://three.ws/tour/atlas","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+185+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Tour","item":"https://three.ws/tour"},{"@type":"ListItem","position":3,"name":"Atlas","item":"https://three.ws/tour/atlas"}]}]}</script>+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Tour Atlas","description":"Every stop on the guided tour as a real screenshot of the live site, with the feature circled by the tour's own spotlight. Search 263 stops, filter by chapter, read what the guide says about each one, and drop the tour onto any feature in a single click.","url":"https://three.ws/tour/atlas","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Tour+Atlas&d=Every+stop+on+the+guided+tour+as+a+real+screenshot+of+the+live+site%2C+with+the+feature+circled+by+the+tour%27s+own+spotlight.+Search+263+stops%2C+filter+by+chapter&p=%2Ftour%2Fatlas"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Tour","item":"https://three.ws/tour"},{"@type":"ListItem","position":3,"name":"Atlas","item":"https://three.ws/tour/atlas"}]}]}</script></head><body><script src="/nav.js"></script>@@ -386,6 +396,7 @@<button class="ta-lb-nav" type="button" data-dir="prev" data-act="prev" aria-label="Previous stop">‹</button><button class="ta-lb-nav" type="button" data-dir="next" data-act="next" aria-label="Next stop">›</button><img id="ta-lb-img" alt="" />+ <p class="ta-lb-none" id="ta-lb-none" hidden></p></div><div class="ta-lb-body"><p class="ta-lb-kicker" id="ta-lb-kicker"></p>diff --git a/public/reputation/index.html b/public/reputation/index.htmlindex 0e26fbf6a..eadd97416 100644--- a/public/reputation/index.html+++ b/public/reputation/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" />- <title data-i18n="reputation_index.meta_title">Agent Reputation — three.ws</title>+ <title data-i18n="reputation_index.meta_title">Reputation Explorer · three.ws</title><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /><meta name="description" content="View and submit on-chain reviews for any AI agent or Ethereum address." data-i18n-attr="content:reputation_index.meta_description"/><meta name="theme-color" content="#090909" />@@ -354,6 +354,36 @@.rep-error-card p { color: rgba(252,165,165,0.7); margin: 0 0 1rem; }.rep-back-link { font-size: 0.875rem; color: rgba(255,255,255,0.50); }+ /* ── Section heading above the review tabs ── */+ .rep-section-title {+ font-size: 0.6875rem;+ text-transform: uppercase;+ letter-spacing: 1.1px;+ color: rgba(232, 233, 240, 0.4);+ font-weight: 700;+ font-family: inherit;+ }++ /* ── Recovery actions on a failed attestation read ── */+ .rep-error-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }+ .rep-error-card .rep-action-btn { font-size: 0.8125rem; }+ .rep-error-card p:last-child { margin-bottom: 0; }++ /* ── Keyboard focus: every control on this page shows where it is ── */+ .rep-page-wrap a:focus-visible,+ .rep-page-wrap button:focus-visible,+ .rep-page-wrap input:focus-visible,+ .rep-page-wrap select:focus-visible,+ .rep-page-wrap textarea:focus-visible {+ outline: 2px solid #ffffff;+ outline-offset: 2px;+ }+ .rep-search-btn:active,+ .rep-submit-btn-primary:active:not(:disabled) { background: #cfcfcf; }+ .rep-action-btn:active,+ .rep-example-chip:active,+ .rep-connect-btn:active { background: rgba(255, 255, 255, 0.16); }+/* ── Responsive ── */@media (max-width: 680px) {.rep-search-title { font-size: 1.875rem; }@@ -385,7 +415,7 @@<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1"><meta property="og:locale" content="en_US">- <meta property="og:image:alt" content="Reputation Explorer — three.ws">+ <meta property="og:image:alt" content="Reputation Explorer · three.ws"><meta name="twitter:site" content="@trythreews"><script src="/model-viewer-meshopt.js"></script></head>@@ -393,7 +423,7 @@<a href="#rep-content" class="h-skip-link" data-i18n="reputation_index.skip_to_content">Skip to content</a><header>- <h1 data-i18n-html="reputation_index.three_ws">+ <div class="site-wordmark" data-i18n-html="reputation_index.three_ws"><a href="/" aria-label="three.ws home"><img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><spanclass="wordmark-dot"@@ -401,7 +431,7 @@></span>three.ws</a>- </h1>+ </div><div id="nav-container"></div></header><script src="/nav.js"></script>diff --git a/public/reputation/reputation.js b/public/reputation/reputation.jsindex 28997456c..86d80488a 100644--- a/public/reputation/reputation.js+++ b/public/reputation/reputation.js@@ -1,8 +1,8 @@/**- * Reputation page — view and submit on-chain attestations for any agent address.+ * Reputation page: view and submit on-chain attestations for any agent address.*- * Reading: EAS (Ethereum Attestation Service) via EASScan GraphQL — no wallet required.- * Writing: EAS SDK — requires MetaMask/wallet + a small amount of gas.+ * Reading: EAS (Ethereum Attestation Service) via EASScan GraphQL, no wallet required.+ * Writing: EAS SDK, requires MetaMask/wallet plus a small amount of gas.** URL params:* ?address=0x... attestations for an Ethereum address@@ -339,6 +339,21 @@ function renderReviewCard(a, chainId) {</div>`;}+function renderLoadFailure(chain, address, err) {+ const reason = err?.message ? String(err.message) : 'the request did not complete';+ return `<div class="rep-error-card" role="alert">+ <strong>Reviews could not be loaded</strong>+ <p>+ The EAS attestation index for ${esc(chain.name)} did not answer (${esc(reason)}), so this+ address's review history is unknown. This says nothing about the address itself.+ </p>+ <div class="rep-error-actions">+ <button class="rep-action-btn" id="rep-retry-load" type="button">Try again</button>+ <a class="rep-action-btn" href="${esc(chain.easscan)}/address/${esc(address)}" target="_blank" rel="noopener">Open on EASScan ↗</a>+ </div>+ </div>`;+}+function renderEmpty(msg) {return `<div class="rep-empty-state"><svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.15)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>@@ -355,11 +370,11 @@ function mountSubmitForm(container, { recipientAddress, chainId }) {<div class="rep-submit-card"><div class="rep-submit-header"><div>- <h3 class="rep-submit-title">Write a review</h3>+ <h2 class="rep-submit-title">Write a review</h2><p class="rep-submit-sub">Signed on-chain · permanently public · ${esc(writeChain.name)}${writeChain.testnet ? ' <span class="rep-testnet-tag">testnet</span>' : ''}</p></div></div>- ${writeChain.testnet ? `<div class="rep-testnet-notice" role="note">Reviews are written to <strong>${esc(writeChain.name)}</strong> — a free test network. They're real, signed attestations for trying the flow, not mainnet reputation.</div>` : ''}+ ${writeChain.testnet ? `<div class="rep-testnet-notice" role="note">Reviews are written to <strong>${esc(writeChain.name)}</strong>, a free test network. They're real, signed attestations for trying the flow, not mainnet reputation.</div>` : ''}<div id="rep-wallet-area"><button class="rep-connect-btn" id="rep-connect-btn">@@ -560,7 +575,7 @@ function showSearchForm(appEl) {<div class="rep-search-wrap"><div class="rep-search-hero"><div class="rep-search-glow" aria-hidden="true"></div>- <h1 class="rep-search-title">Agent Reputation</h1>+ <h1 class="rep-search-title">Reputation Explorer</h1><p class="rep-search-sub">Search on-chain reviews for any AI agent or Ethereum address.</p><form class="rep-search-form" id="rep-search-form" autocomplete="off" novalidate>@@ -570,6 +585,7 @@ function showSearchForm(appEl) {class="rep-search-input"id="rep-search-input"type="text"+ aria-label="Ethereum address or ENS name"placeholder="0x address or ENS name (vitalik.eth)…"spellcheck="false"autocorrect="off"@@ -602,21 +618,21 @@ function showSearchForm(appEl) {<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg><div><strong>On-chain reviews</strong>- <p>Attestations are signed transactions — permanent, public, and tamper-proof.</p>+ <p>Attestations are signed transactions: permanent, public, and tamper-proof.</p></div></div><div class="rep-info-card"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#3dc1ff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg><div><strong>Any address</strong>- <p>Search any Ethereum address or ENS name — no registration required.</p>+ <p>Search any Ethereum address or ENS name. No registration required.</p></div></div><div class="rep-info-card"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#22d17a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg><div><strong>EAS-powered</strong>- <p>Built on Ethereum Attestation Service — the open standard for on-chain trust.</p>+ <p>Built on Ethereum Attestation Service, the open standard for on-chain trust.</p></div></div></div>@@ -645,7 +661,7 @@ function showSearchForm(appEl) {// ── Skeleton ──────────────────────────────────────────────────────────────────-function showSkeleton(appEl, address) {+function showSkeleton(appEl) {appEl.innerHTML = `<div class="rep-loading-header"><div class="rep-skel rep-skel-lg"></div>@@ -665,7 +681,7 @@ function showSkeleton(appEl, address) {async function renderProfile(appEl, { address, chainId }) {const chain = EAS_CHAINS[chainId];if (!chain) {- appEl.innerHTML = `<div class="rep-error-card"><strong>Unsupported network</strong><p>EAS is not available on chain ${chainId}. Try Base (8453), Ethereum (1), or Optimism (10).</p></div>`;+ appEl.innerHTML = `<div class="rep-error-card" role="alert"><strong>Unsupported network</strong><p>EAS is not available on chain ${chainId}. Try Base (8453), Ethereum (1), or Optimism (10).</p><a href="/reputation" class="rep-back-link">← Search again</a></div>`;return;}@@ -698,11 +714,18 @@ async function renderProfile(appEl, { address, chainId }) {resolvedAddress = getAddress(resolvedAddress);- // Parallel fetch: EAS attestations + ERC-8004 agent lookup- const [attestations, agentId] = await Promise.all([- fetchAttestations(resolvedAddress, chainId).catch(() => []),+ // Parallel fetch: EAS attestations + ERC-8004 agent lookup. A failed+ // attestation read is kept distinct from an empty one: reporting an+ // unreachable index as "0 reviews" is a false statement about the address.+ const [attestationResult, agentId] = await Promise.all([+ fetchAttestations(resolvedAddress, chainId).then(+ (rows) => ({ rows }),+ (err) => ({ error: err })+ ),findAgentIdForAddress(resolvedAddress, chainId).catch(() => null),]);+ const loadError = attestationResult.error || null;+ const attestations = attestationResult.rows || [];// ERC-8004 reputation (if agent is registered)let erc8004Rep = null;@@ -716,7 +739,7 @@ async function renderProfile(appEl, { address, chainId }) {// Share URLconst shareUrl = `${window.location.origin}/reputation?address=${encodeURIComponent(resolvedAddress)}&chain=${chainId}`;const tweetText = encodeURIComponent(- `On-chain reputation for ${displayName} on @trythreews — ${stats.count} review${stats.count !== 1 ? 's' : ''}${hasScores ? `, avg ${stats.avgStars}/5 stars` : ''}\n${shareUrl}`+ `On-chain reputation for ${displayName} on @trythreews: ${stats.count} review${stats.count !== 1 ? 's' : ''}${hasScores ? `, avg ${stats.avgStars}/5 stars` : ''}\n${shareUrl}`);const tweetUrl = `https://x.com/intent/tweet?text=${tweetText}`;@@ -734,10 +757,10 @@ async function renderProfile(appEl, { address, chainId }) {<div class="rep-profile-identity">${identiconHtml(resolvedAddress, 48)}<div>- ${isEns ? `<div class="rep-ens-name">${esc(displayName)}</div>` : ''}+ <h1 class="rep-ens-name">${esc(isEns ? displayName : shortAddr(resolvedAddress))}</h1><div class="rep-address-display"><code class="rep-address-code">${esc(resolvedAddress)}</code>- <button class="rep-copy-addr" data-copy="${esc(resolvedAddress)}" title="Copy address" type="button">+ <button class="rep-copy-addr" data-copy="${esc(resolvedAddress)}" title="Copy address" aria-label="Copy address" type="button"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button></div>@@ -748,10 +771,10 @@ async function renderProfile(appEl, { address, chainId }) {</div></div><div class="rep-profile-actions">- <a href="${esc(tweetUrl)}" class="rep-action-btn" target="_blank" rel="noopener">+ ${loadError ? '' : `<a href="${esc(tweetUrl)}" class="rep-action-btn" target="_blank" rel="noopener"><svg width="12" height="12" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>Share- </a>+ </a>`}<button class="rep-action-btn" id="rep-copy-link" type="button"><svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="3" r="1.5"/><circle cx="12" cy="13" r="1.5"/><circle cx="3" cy="8" r="1.5"/><line x1="10.6" y1="3.9" x2="4.4" y2="7.1"/><line x1="10.6" y1="12.1" x2="4.4" y2="8.9"/></svg>Copy link@@ -760,10 +783,11 @@ async function renderProfile(appEl, { address, chainId }) {</div></div>+ ${loadError ? renderLoadFailure(chain, resolvedAddress, loadError) : `<div class="rep-stats-grid"><div class="rep-stat-card"><div class="rep-stat-label">Avg Rating</div>- <div class="rep-stat-value">${hasScores ? stats.avgStars : '—'}<span class="rep-stat-denom">${hasScores ? ' / 5' : ''}</span></div>+ <div class="rep-stat-value">${hasScores ? stats.avgStars : 'n/a'}<span class="rep-stat-denom">${hasScores ? ' / 5' : ''}</span></div><div class="rep-stars-display">${hasScores ? starsHtml(stats.avgStars, 16) : '<span class="rep-no-data">No reviews yet</span>'}</div></div><div class="rep-stat-card">@@ -774,7 +798,7 @@ async function renderProfile(appEl, { address, chainId }) {<div class="rep-stat-card"><div class="rep-stat-label">Score Distribution</div><div class="rep-dist-mini">- ${hasScores ? renderStatBar(stats.scoreMap, stats.count) : '<span class="rep-no-data">—</span>'}+ ${hasScores ? renderStatBar(stats.scoreMap, stats.count) : '<span class="rep-no-data">No scores yet</span>'}</div></div></div>@@ -788,6 +812,7 @@ async function renderProfile(appEl, { address, chainId }) {` : ''}<div class="rep-reviews-section">+ <h2 class="rep-section-title">Reviews</h2><div class="rep-tabs" role="tablist"><button class="rep-tab active" data-filter="all" role="tab" aria-selected="true">All <span class="rep-tab-badge">${all.length}</span>@@ -805,11 +830,17 @@ async function renderProfile(appEl, { address, chainId }) {: all.slice(0, 30).map((a) => renderReviewCard(a, chainId)).join('')}</div></div>+ `}<div id="rep-submit-section"></div></div>`;+ // Retry the attestation read in place when the index was unreachable.+ appEl.querySelector('#rep-retry-load')?.addEventListener('click', () => {+ renderProfile(appEl, { address, chainId });+ });+// Wire filter tabsconst filterData = { all, scored: attestations.filter((a) => a.decoded?.score !== undefined), commented: withComment };appEl.querySelectorAll('.rep-tab').forEach((tab) => {@@ -837,7 +868,11 @@ async function renderProfile(appEl, { address, chainId }) {const btn = e.currentTarget;try { await navigator.clipboard.writeText(resolvedAddress); } catch { /* */ }btn.title = 'Copied!';- setTimeout(() => { btn.title = 'Copy address'; }, 2000);+ btn.setAttribute('aria-label', 'Address copied');+ setTimeout(() => {+ btn.title = 'Copy address';+ btn.setAttribute('aria-label', 'Copy address');+ }, 2000);});// Mount submit formdiff --git a/public/rig-doctor.css b/public/rig-doctor.cssindex 5400cfb6d..5d3032c08 100644--- a/public/rig-doctor.css+++ b/public/rig-doctor.css@@ -592,9 +592,15 @@transition: opacity 0.3s ease;}+/* Fading the status to zero opacity leaves "Building the scene" in the+ accessibility tree forever, so a screen reader keeps reporting a load that+ finished. `visibility` removes it for real, delayed by the fade so the+ transition still plays. */.rd-stage[data-state='ready'] .rd-stage-status {opacity: 0;+ visibility: hidden;pointer-events: none;+ transition: opacity 0.3s ease, visibility 0s linear 0.3s;}.rd-spinner {diff --git a/public/style.css b/public/style.cssindex 349ed5acf..5e13d589c 100644--- a/public/style.css+++ b/public/style.css@@ -589,7 +589,8 @@ header:not([class]):not(:has(#nav-container)) {-webkit-app-region: drag;}-header h1 {+header h1,+header .site-wordmark {color: #fff;font-family: var(--font-display);font-size: var(--text-lg);@@ -602,7 +603,8 @@ header h1 {gap: var(--space-xs);}-header h1 > a {+header h1 > a,+header .site-wordmark > a {color: inherit;font-size: inherit;text-decoration: inherit;@@ -611,7 +613,8 @@ header h1 > a {gap: 0.5rem;}-header h1 .wordmark-dot {+header h1 .wordmark-dot,+header .site-wordmark .wordmark-dot {width: 8px;height: 8px;border-radius: 50%;@@ -620,7 +623,8 @@ header h1 .wordmark-dot {display: inline-block;}-header h1 .wordmark-logo {+header h1 .wordmark-logo,+header .site-wordmark .wordmark-logo {width: 28px;height: 28px;display: inline-block;@@ -1025,7 +1029,8 @@ header h1 .wordmark-logo {line-height: 3rem;}- header h1 {+ header h1,+ header .site-wordmark {font-size: 1em;line-height: 3rem;}diff --git a/public/tokens.css b/public/tokens.cssindex 89a6e0a01..560f0d441 100644--- a/public/tokens.css+++ b/public/tokens.css@@ -279,10 +279,18 @@style.css and nav.css, so putting the reservation here reaches everysurface, render-blocking, before the first paint. `:empty` stops matching assoon as the header is in, so the real header owns its height from then on.- Keep these two heights equal to the rendered `.nav` height in nav.css. */-#nav-container:empty { min-height: 69px; }+ Keep --nav-h equal to the rendered `.nav` height in nav.css.++ --nav-h is the rendered height of that injected header, and it is NOT the+ same number as --header-h (3.5rem / 56px), which sizes the older in-page+ `<header>` element. A full-screen surface that pins itself under the shared+ nav must offset by --nav-h: offsetting by --header-h leaves the top 13px of+ the surface painted behind the nav, which is how Scene Studio's File/Edit/+ Add menubar row shipped with its glyph tops sliced off. */+:root { --nav-h: 69px; }+#nav-container:empty { min-height: var(--nav-h); }@media (max-width: 880px) {- #nav-container:empty { min-height: 65px; }+ :root { --nav-h: 65px; }}diff --git a/scripts/audit-console.mjs b/scripts/audit-console.mjsindex 536a230c7..0d10d6bed 100644--- a/scripts/audit-console.mjs+++ b/scripts/audit-console.mjs@@ -20,8 +20,12 @@* LOG_ALL=1 node scripts/audit-console.mjs # stream every console line* HEADFUL=1 node scripts/audit-console.mjs # watch it run* CONCURRENCY=6 node scripts/audit-console.mjs # parallel tabs (default 5)+ * AUDIT_BASE=http://localhost:3211 node scripts/audit-console.mjs # drive a server you own*- * Reuses a dev server already on :3000, otherwise spawns an ephemeral Vite. The+ * Reuses a dev server already on :3000, otherwise spawns an ephemeral Vite. Set+ * AUDIT_BASE to drive a server you started yourself, which is what you want when+ * other agents share the box: a :3000 owned by someone else can disappear+ * mid-sweep and every remaining route then reads as a navigation failure. The* dev server proxies /api/* to https://three.ws, so API calls hit real* endpoints — auth/payment-gated 4xx are classified "expected", never failures.*/@@ -127,6 +131,25 @@ async function warmupDeps(base) {}async function startServer() {+ // An explicit target wins over discovery: on a shared box the server on :3000+ // may belong to another agent and vanish mid-sweep, which turns every+ // remaining route into a bogus navigation failure.+ if (process.env.AUDIT_BASE) {+ const base = process.env.AUDIT_BASE.replace(/\/$/, '');+ // Poll rather than probe once: a live Vite on a saturated box can take tens+ // of seconds to answer, and a single miss would abort a sweep of a server+ // that is in fact up.+ const deadline = Date.now() + SERVER_BOOT_MS;+ let up = 0;+ while (!up && Date.now() < deadline) {+ up = await probe(`${base}/`, REUSE_PROBE_MS);+ if (!up) await new Promise((r) => setTimeout(r, 2000));+ }+ if (!up) throw new Error(`AUDIT_BASE ${base} is not answering`);+ console.log(C.d(` using AUDIT_BASE ${base}`));+ await warmupDeps(base);+ return { base, stop: async () => {} };+ }if (await probe(`${PROBE_BASE}/`, REUSE_PROBE_MS)) {console.log(C.d(' reusing dev server on :3000'));// localhost (not 127.0.0.1) — some CDN CORS configs allow it, fewer spurious errors.@@ -365,27 +388,24 @@ console.log(C.b('╚════════════════════const { base, stop } = await startServer();-const browser = await chromium.launch({- headless: !process.env.HEADFUL,- args: [- '--no-sandbox',- '--disable-dev-shm-usage',- '--disable-setuid-sandbox',- '--use-gl=angle',- '--use-angle=swiftshader',- '--enable-unsafe-swiftshader',- '--ignore-gpu-blocklist',- '--mute-audio',- ],-});--// results[viewportKey] = array of per-route result objects-const results = {};+function launchBrowser() {+ return chromium.launch({+ headless: !process.env.HEADFUL,+ args: [+ '--no-sandbox',+ '--disable-dev-shm-usage',+ '--disable-setuid-sandbox',+ '--use-gl=angle',+ '--use-angle=swiftshader',+ '--enable-unsafe-swiftshader',+ '--ignore-gpu-blocklist',+ '--mute-audio',+ ],+ });+}-for (const vpKey of viewportKeys) {- const vp = VIEWPORTS[vpKey];- console.log(C.b(`\n▶ ${vp.label}\n`));- const context = await browser.newContext({+function newContext(browser, vp) {+ return browser.newContext({viewport: { width: vp.width, height: vp.height },isMobile: vp.isMobile,hasTouch: vp.isMobile,@@ -394,10 +414,52 @@ for (const vpKey of viewportKeys) {? 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1': undefined,});+}++// A headless Chromium driving dozens of WebGL routes can be killed outright on a+// loaded or memory-tight box. That is the machine dying, not a page defect, and+// it used to abort the whole sweep on whichever route happened to be next. Bring+// a fresh browser up instead and re-run that route: a real defect still fails on+// the retry, so nothing is excused, only re-measured.+const BROWSER_GONE = /has been closed|Target closed|browser has (been )?disconnected|Browser closed/i;++let browser = await launchBrowser();++// results[viewportKey] = array of per-route result objects+const results = {};++for (const vpKey of viewportKeys) {+ const vp = VIEWPORTS[vpKey];+ console.log(C.b(`\n▶ ${vp.label}\n`));+ let context = await newContext(browser, vp);+ let recycling = null;+ const recycle = () => {+ // One relaunch shared by every in-flight worker, never one browser each.+ recycling ||= (async () => {+ console.log(C.y('\n headless browser died (machine, not page) — relaunching\n'));+ try {+ await browser.close();+ } catch {+ /* already gone */+ }+ browser = await launchBrowser();+ context = await newContext(browser, vp);+ })().finally(() => {+ recycling = null;+ });+ return recycling;+ };let done = 0;const res = await runPool(routes, CONCURRENCY, async (route) => {- const r = await checkRoute(context, base, route);+ let r;+ try {+ r = await checkRoute(context, base, route);+ } catch (e) {+ if (!BROWSER_GONE.test(e?.message || '')) throw e;+ await recycle();+ r = await checkRoute(context, base, route);+ }done++;const errs = totalErrors(r);const status = errs === 0 ? C.g('✓') : C.r(`✗ ${errs}`);diff --git a/scripts/page-audit.mjs b/scripts/page-audit.mjsindex b48eed1b2..87be5714d 100644--- a/scripts/page-audit.mjs+++ b/scripts/page-audit.mjs@@ -526,7 +526,13 @@ function pickDiscovered(links, known) {// on, so every error-severity finding is re-checked SOLO before it is reported:// findings that reproduce stay errors, findings that do not are demoted to info// and labelled, never silently dropped.-const REVERIFY_CAP = Number(opt('reverify-cap', 60)) || 60;+// `|| 60` here silently rewrote an explicit `--reverify-cap 0` back to 60, so+// the documented way to skip the solo re-check never skipped anything. Fall+// back only when the value is absent or not a number.+const REVERIFY_CAP = (() => {+ const raw = Number(opt('reverify-cap', 60));+ return Number.isFinite(raw) && raw >= 0 ? raw : 60;+})();// Collapse the volatile parts of a finding so the same defect matches across// runs: blob/object URLs, uuids, base58 mints, query strings and bare numbers@@ -579,22 +585,36 @@ async function reverify(browser, results, viewports, authed) {}let demoted = 0;+ let checked = 0;for (const suspect of budget) {const viewport = suspect.viewport;if (!viewports.includes(viewport)) continue;- const ctx = await browser.newContext({- ...(viewport === 'mobile' ? devices['iPhone 13'] : { viewport: { width: 1440, height: 900 } }),- ...(authed ? { storageState: AUTH_STATE } : {}),- ignoreHTTPSErrors: true,- });+ let ctx;+ try {+ ctx = await browser.newContext({+ ...(viewport === 'mobile' ? devices['iPhone 13'] : { viewport: { width: 1440, height: 900 } }),+ ...(authed ? { storageState: AUTH_STATE } : {}),+ ignoreHTTPSErrors: true,+ });+ } catch (err) {+ // No browser to re-check with. Every remaining suspect keeps the+ // severity the sweep gave it, and the report still gets written.+ console.log(` ⚠ re-verify stopped: ${err.message.split('\n')[0]}`);+ return { checked, demoted, skipped: skipped + (budget.length - checked), aborted: true };+ }let solo;try {solo = await auditRoute(ctx, suspect.route, viewport);} catch {solo = null; // a crashed re-check proves nothing; leave the finding as-is}- await ctx.close();+ try {+ await ctx.close();+ } catch {+ // The context went down with its browser; the session relaunches it.+ }if (!solo) continue;+ checked++;const reproduced = new Set(solo.findings.map(fingerprint));let localDemotions = 0;@@ -615,23 +635,44 @@ async function reverify(browser, results, viewports, authed) {` ${left ? '🔴' : '✓ '} ${suspect.route} [${viewport}] ${left} confirmed, ${localDemotions} demoted\n`,);}- return { checked: budget.length, demoted, skipped };+ return { checked, demoted, skipped };}// ── Worker pool ───────────────────────────────────────────────────────────────-async function runPool(ctx, routes, viewport, onResult) {+// A dead browser or a context torn down with it is not a defect in the page+// being audited: every route after it would otherwise be reported as an+// `audit-crash` error against a page nobody ever loaded.+const DEAD_SESSION = /Target (page, context or browser|closed)|browser has been closed|Browser closed|has been closed/i;++async function runPool(pool, routes, viewport, onResult) {const queue = [...routes];const results = [];const worker = async () => {while (queue.length) {const route = queue.shift();- const r = await auditRoute(ctx, route, viewport).catch((e) => ({- route,- viewport,- title: '',- navStatus: null,- findings: [{ type: 'audit-crash', severity: 'error', detail: e.message }],- }));+ let r = null;+ // One retry on a torn-down session, against a rebuilt context. A second+ // failure is reported, so a route that genuinely crashes the renderer+ // still surfaces instead of looping.+ for (let attempt = 0; attempt < 2; attempt++) {+ try {+ r = await auditRoute(await pool.context(), route, viewport);+ break;+ } catch (e) {+ if (attempt === 0 && DEAD_SESSION.test(e.message || '')) {+ await pool.recycle();+ continue;+ }+ r = {+ route,+ viewport,+ title: '',+ navStatus: null,+ findings: [{ type: 'audit-crash', severity: 'error', detail: e.message }],+ };+ break;+ }+ }results.push(r);onResult(r);}@@ -710,6 +751,13 @@ function writeReport(allResults, meta) {'. Errors below reproduced on a page loaded by itself, so they are real.',);}+ if (meta.verification?.aborted) {+ lines.push(+ '- ⚠ The solo re-check did not finish (the browser session ended). Errors that were not' ++ ' re-checked are reported exactly as the parallel sweep saw them, so some may be' ++ ' contention artifacts. Re-run those routes with `--concurrency 1` before acting.',+ );+ }lines.push('');if (meta.discovered?.length) {lines.push('## Crawl-discovered routes (linked on the site, missing from data/pages.json)');@@ -763,6 +811,134 @@ function writeReport(allResults, meta) {return { jsonPath, mdPath, totals, pages };}+// ── Browser session ───────────────────────────────────────────────────────────+// A full sweep drives hundreds of WebGL pages through one browser process for+// well over an hour, on a box that is often running other agents' builds beside+// it. When that process dies (the kernel reaps it, or a renderer takes the+// browser down with it), every later `newContext` throws+// "Target page, context or browser has been closed" and the run aborts with+// hundreds of already-collected results still in memory and no report on disk.+// The findings were never the problem, so a dead browser is replaced rather+// than allowed to end the sweep.+class BrowserSession {+ constructor() {+ this.browser = null;+ this.relaunches = 0;+ }++ // The sandbox flags are chromium-only; webkit and firefox reject unknown args.+ async #launch() {+ this.browser = await ENGINE.launch(+ ENGINE_NAME === 'chromium' ? { args: ['--no-sandbox', '--disable-dev-shm-usage'] } : {},+ );+ return this.browser;+ }++ async start() {+ return this.#launch();+ }++ // Playwright reports a dead process through isConnected(), but a browser can+ // also die between that check and the call, so the retry covers both.+ async newContext(opts) {+ for (let attempt = 0; ; attempt++) {+ if (!this.browser || !this.browser.isConnected()) {+ this.relaunches++;+ console.log(` ⚠ browser process gone; relaunching (#${this.relaunches})`);+ await this.#launch();+ }+ try {+ return await this.browser.newContext(opts);+ } catch (err) {+ if (attempt >= 2) throw err;+ try {+ await this.browser.close();+ } catch {+ // Already gone. Nothing to close, and nothing that changes the retry.+ }+ this.browser = null;+ }+ }+ }++ async close() {+ if (!this.browser) return;+ try {+ await this.browser.close();+ } catch {+ // Closing a browser that already died is not a sweep failure.+ }+ this.browser = null;+ }+}++// One shared context per viewport pass, rebuilt on demand. The pool exists so+// the concurrent workers in runPool can agree on a single replacement instead+// of each opening its own after the same crash.+class ContextPool {+ constructor(session, opts, init) {+ this.session = session;+ this.opts = opts;+ this.init = init;+ this.ctx = null;+ this.pending = null;+ this.recycling = null;+ }++ async context() {+ if (this.ctx) return this.ctx;+ if (!this.pending) {+ this.pending = (async () => {+ try {+ const ctx = await this.session.newContext(this.opts);+ if (this.init) await ctx.addInitScript(this.init);+ this.ctx = ctx;+ return ctx;+ } finally {+ // Cleared on failure too: a rejected promise left in `pending`+ // would be handed to every remaining route, turning one bad+ // launch into a sweep of identical phantom crashes.+ this.pending = null;+ }+ })();+ }+ return this.pending;+ }++ // Drop the current context so the next `context()` builds a fresh one. Every+ // worker that hit the same dead session calls this at once, so a recycle+ // already in flight is awaited rather than started again: otherwise the+ // second caller would throw away the replacement the first just built.+ async recycle() {+ if (this.recycling) return this.recycling;+ this.recycling = (async () => {+ const dead = this.ctx;+ this.ctx = null;+ this.pending = null;+ if (dead) {+ try {+ await dead.close();+ } catch {+ // The context died with its browser; there is nothing left to close.+ }+ }+ this.recycling = null;+ })();+ return this.recycling;+ }++ async close() {+ const ctx = this.ctx;+ this.ctx = null;+ if (!ctx) return;+ try {+ await ctx.close();+ } catch {+ // Same as above: a context whose browser is gone needs no teardown.+ }+ }+}+// ── Main ──────────────────────────────────────────────────────────────────────async function main() {if (DO_LOGIN) {@@ -782,10 +958,8 @@ async function main() {console.log(` viewports: ${viewports.join(', ')} · concurrency: ${CONCURRENCY}`);console.log(` engine: ${ENGINE_NAME}`);- // The sandbox flags are chromium-only; webkit and firefox reject unknown args.- const browser = await ENGINE.launch(- ENGINE_NAME === 'chromium' ? { args: ['--no-sandbox', '--disable-dev-shm-usage'] } : {},- );+ const browser = new BrowserSession();+ await browser.start();const seedCtx = await browser.newContext(authed ? { storageState: AUTH_STATE } : {},);@@ -806,8 +980,7 @@ async function main() {// Codespaces hostnames aren't in the R2 CORS allowlist; ignore HTTPS errors.ignoreHTTPSErrors: true,};- const ctx = await browser.newContext(ctxOpts);- await ctx.addInitScript(trackClickListeners);+ const pool = new ContextPool(browser, ctxOpts, trackClickListeners);console.log(`── ${viewport} ──`);const onResult = (r) => {const e = r.findings.filter((f) => f.severity === 'error').length;@@ -816,7 +989,7 @@ async function main() {process.stdout.write(` ${tag} ${r.route} (${e}e/${w}w)\n`);allResults.push(r);};- await runPool(ctx, routes, viewport, onResult);+ await runPool(pool, routes, viewport, onResult);// After the first pass, audit every crawl-discovered route the manifest// missed. They join `routes` so later viewports cover them too.if (firstViewport && !explicitRoutes.length) {@@ -832,7 +1005,7 @@ async function main() {knownRoutes.add(d);discovered.push(d);}- await runPool(ctx, picked.audit, viewport, onResult);+ await runPool(pool, picked.audit, viewport, onResult);}if (picked.dropped.length) {console.log(@@ -841,11 +1014,19 @@ async function main() {}firstViewport = false;}- await ctx.close();+ await pool.close();}// Confirm every error against a solo re-check before reporting it.- const verification = await reverify(browser, allResults, viewports, authed);+ let verification = { checked: 0, demoted: 0, skipped: 0 };+ try {+ verification = await reverify(browser, allResults, viewports, authed);+ } catch (err) {+ // Hundreds of collected results are worth more than a perfect re-check.+ // Report what the sweep saw and say the pass did not finish.+ console.log(` ⚠ re-verify failed: ${err.message.split('\n')[0]}`);+ verification.aborted = true;+ }await browser.close();const { jsonPath, mdPath, totals, pages } = writeReport(allResults, {diff --git a/scripts/verify-sign-mirror.mjs b/scripts/verify-sign-mirror.mjsindex 37c753a44..ecd5e56ad 100644--- a/scripts/verify-sign-mirror.mjs+++ b/scripts/verify-sign-mirror.mjs@@ -50,7 +50,11 @@ page.on('pageerror', (e) => {console.log(`\nSign Mirror, ${BASE}/sign-mirror`);phase = 'first load';+// The shared nav fetches its own markup on boot. Reloading on top of that+// in-flight request aborts it, which surfaced as a console error that had+// nothing to do with this page, so let the first load settle before reloading.await page.goto(`${BASE}/sign-mirror`, { waitUntil: 'domcontentloaded' });+await page.waitForSelector('#nav-container nav, #nav-container a', { timeout: 30000 }).catch(() => {});await page.evaluate(() => localStorage.clear());await page.reload({ waitUntil: 'domcontentloaded' });@@ -124,13 +128,48 @@ if (cameraRan) {check('camera starts and reports no hand in frame', true);await page.locator('#sm-camera').click();check('camera stops cleanly', await page.evaluate(() => document.body.dataset.smCamera === 'off'));+ const idleHint = await page.locator('#sm-hint').textContent();+ check('stopping the camera restores an actionable hint', /camera on|copy the diagram/i.test(idleHint || ''), idleHint || 'empty');+ check('stopping the camera hides the tracking note', await page.locator('#sm-camera-note').isHidden());} else {// No network to the model CDN (or no fake device): the page must have said// so in the status line rather than dying silently.const st = await page.locator('#sm-status').textContent();check('camera failure is explained to the user', /camera|tracker|diagram/i.test(st || ''), st || 'no status');+ check('the camera panel is not left mid-flight', await page.evaluate(() => document.body.dataset.smCamera !== 'loading' && document.body.dataset.smCamera !== 'starting'), await page.evaluate(() => document.body.dataset.smCamera || 'unset'));}+// Every letter square carries its best score: the state the grader keeps has to+// be readable, and it has to survive a reload.+phase = 'best score surfacing';+await page.evaluate(() => {+ localStorage.setItem('threews:sign-mirror-progress', JSON.stringify({ passed: { A: true }, best: { A: 91, B: 44 } }));+});+await page.waitForSelector('#nav-container nav, #nav-container a', { timeout: 30000 }).catch(() => {});+await page.reload({ waitUntil: 'domcontentloaded' });+await page.waitForSelector('.sm-letter[data-char="B"]');+await page.waitForFunction(() => /best score 44/i.test(document.querySelector('.sm-letter[data-char="B"]')?.getAttribute('aria-label') || ''), { timeout: 30000 });+check('a practised letter names its best score', true);+check(+ 'an unpractised letter says so',+ /not attempted/i.test((await page.locator('.sm-letter[data-char="X"]').getAttribute('aria-label')) || ''),+ (await page.locator('.sm-letter[data-char="X"]').getAttribute('aria-label')) || '',+);+check('the best-score sliver is drawn', (await page.locator('.sm-letter[data-char="B"]').getAttribute('data-tried')) === 'true');+await page.locator('#sm-reset').click();+check('reset clears the sliver', (await page.locator('.sm-letter[data-char="B"]').getAttribute('data-tried')) === 'false');+check('reset clears the passed marks', (await page.locator('.sm-letter[data-passed="true"]').count()) === 0);++// Nothing may push the page sideways at a phone width.+phase = 'responsive';+for (const width of [320, 768, 1440]) {+ await page.setViewportSize({ width, height: 900 });+ await page.waitForTimeout(400);+ const m = await page.evaluate(() => ({ scrollW: document.documentElement.scrollWidth, clientW: document.documentElement.clientWidth }));+ check(`no horizontal scroll at ${width}px`, m.scrollW <= m.clientW + 1, `scrollWidth=${m.scrollW} clientWidth=${m.clientW}`);+}+await page.setViewportSize({ width: 1280, height: 900 });+phase = 'teardown';check('no console errors', consoleErrors.length === 0, consoleErrors.slice(0, 5).join(' | '));diff --git a/src/erc8004/showcase.js b/src/erc8004/showcase.jsindex 1a1f2e063..e69de29bb 100644--- a/src/erc8004/showcase.js+++ b/src/erc8004/showcase.js@@ -1,546 +0,0 @@-/**- * /showcase — browsable directory of every ERC-8004 agent with a 3D avatar.- *- * Reads from GET /api/showcase (backed by erc8004_agents_index, populated by- * api/cron/erc8004-crawl.js). Unlike /discover (search-by-input via /api/explore),- * this page is pure browse: pick a net + chains, scroll a grid of newest-minted- * agents, click a card to open its 3D viewer at /a/<chainId>/<agentId>.- *- * Lazy-loaded by src/app.js `_showShowcasePage`.- */--import { CHAIN_META, supportedChainIds } from './chain-meta.js';-import { resolveURI } from '../ipfs.js';-import { skeletonHTML, emptyStateHTML, errorStateHTML, ensureStateKitStyles } from '../shared/state-kit.js';-import { onchainBadgeHTML, ensureOnchainBadgeStyles } from '../shared/onchain-badge.js';-ensureStateKitStyles();-ensureOnchainBadgeStyles();--const PAGE_SIZE = 24;-const NET_KEY = '3dagent.showcase.net';-const CHAINS_KEY = '3dagent.showcase.chains';-const SORT_KEY = '3dagent.showcase.sort';--// Returns true if a URL contains signed/expiring query params (GitHub JWT,-// S3/R2 presigned) — these reliably 404 after the token expires, so we-// skip rendering the image rather than logging a spurious network error.-function hasExpiringSignature(url) {- if (!url) return false;- try {- const p = new URL(url).searchParams;- return p.has('jwt') || p.has('X-Amz-Signature') || p.has('X-Goog-Signature');- } catch { return false; }-}--const esc = (s) =>- String(s ?? '').replace(- /[&<>"']/g,- (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c],- );--const shortAddr = (a) => (a ? `${a.slice(0, 6)}…${a.slice(-4)}` : '');--function loadNet() {- try {- const v = localStorage.getItem(NET_KEY);- if (v === 'mainnet' || v === 'testnet' || v === 'all') return v;- } catch {}- return 'mainnet';-}-function saveNet(v) {- try {- localStorage.setItem(NET_KEY, v);- } catch {}-}--function loadSort() {- try {- const v = localStorage.getItem(SORT_KEY);- if (v === 'newest' || v === 'oldest') return v;- } catch {}- return 'newest';-}-function saveSort(v) {- try {- localStorage.setItem(SORT_KEY, v);- } catch {}-}--function loadChains() {- try {- const raw = localStorage.getItem(CHAINS_KEY);- if (!raw) return [];- const parsed = JSON.parse(raw);- if (!Array.isArray(parsed)) return [];- return parsed.filter((n) => Number.isInteger(n));- } catch {- return [];- }-}-function saveChains(ids) {- try {- localStorage.setItem(CHAINS_KEY, JSON.stringify(ids));- } catch {}-}--function splitChains() {- const ids = supportedChainIds();- const mainnet = [];- const testnet = [];- for (const id of ids) {- const m = CHAIN_META[id];- if (!m) continue;- (m.testnet ? testnet : mainnet).push(id);- }- return { mainnet, testnet };-}--/**- * Entry point called by app.js `_showShowcasePage`.- * @param {HTMLElement} container- */-export function renderShowcasePage(container) {- const page = new ShowcasePage(container);- page.mount();- return page;-}--class ShowcasePage {- /** @param {HTMLElement} container */- constructor(container) {- this.container = container;- this._net = loadNet();- this._sort = loadSort();- this._chains = loadChains(); // empty = all of `_net`- this._items = [];- this._nextCursor = null;- this._total = 0;- this._loading = false;- this._reqSeq = 0;- this._onHashChange = () => this._readURL({ replace: true });- this._onScroll = () => this._maybeAutoLoad();- }-- mount() {- this.container.innerHTML = `- <div class="showcase-shell">- <header class="showcase-hero">- <div class="showcase-hero-inner">- <div class="showcase-eyebrow">ERC-8004 · Directory</div>- <h1 class="showcase-title">Every three.ws on-chain.</h1>- <p class="showcase-subtitle">- Browse every ERC-8004 agent with a <code>gltf</code> body — discovered across- ${supportedChainIds().length} chains and indexed from canonical registries. Click any- card to open it in the 3D viewer.- </p>- <div class="showcase-stats" data-role="stats">- <div class="showcase-stat">- <span class="showcase-stat-value" data-role="statTotal">—</span>- <span class="showcase-stat-label">three.wss</span>- </div>- <div class="showcase-stat">- <span class="showcase-stat-value">${splitChains().mainnet.length}+${splitChains().testnet.length}</span>- <span class="showcase-stat-label">chains</span>- </div>- <div class="showcase-stat">- <span class="showcase-stat-value">v2.0</span>- <span class="showcase-stat-label">registry</span>- </div>- </div>- </div>- </header>-- <section class="showcase-controls">- <div class="showcase-controls-row">- <div class="showcase-segmented" role="tablist" data-role="netGroup">- <button type="button" role="tab" class="showcase-seg" data-net="mainnet">Mainnet</button>- <button type="button" role="tab" class="showcase-seg" data-net="testnet">Testnet</button>- <button type="button" role="tab" class="showcase-seg" data-net="all">All</button>- </div>- <div class="showcase-controls-spacer"></div>- <div class="showcase-sort">- <label class="showcase-sort-lbl" for="showcase-sort-sel">Sort</label>- <select id="showcase-sort-sel" class="showcase-sort-sel" data-role="sortSel">- <option value="newest">Newest</option>- <option value="oldest">Oldest</option>- </select>- </div>- </div>- <div class="showcase-controls-row showcase-controls-row--chains">- <strong class="showcase-controls-lbl">Chains</strong>- <div class="showcase-chain-chips" data-role="chainChips"></div>- <button type="button" class="showcase-chip-reset" data-role="chainReset" hidden>Clear</button>- </div>- </section>-- <section class="showcase-results" data-role="results" aria-live="polite"></section>-- <div class="showcase-loadmore" data-role="loadMore" hidden>- <button type="button" class="showcase-btn" data-role="loadMoreBtn">Load more</button>- </div>- </div>- `;-- this._bindControls();- this._renderNetSegmented();- this._renderSortSelect();- this._renderChainChips();-- window.addEventListener('hashchange', this._onHashChange);- window.addEventListener('popstate', this._onHashChange);- window.addEventListener('scroll', this._onScroll, { passive: true });-- this._readURL({ replace: true });- }-- destroy() {- window.removeEventListener('hashchange', this._onHashChange);- window.removeEventListener('popstate', this._onHashChange);- window.removeEventListener('scroll', this._onScroll);- }-- // ── URL ↔ state ───────────────────────────────────────────────────────-- _readURL({ replace }) {- const url = new URL(location.href);- const net = url.searchParams.get('net');- const sort = url.searchParams.get('sort');- const chains = url.searchParams.get('chain');- if (net && ['mainnet', 'testnet', 'all'].includes(net)) {- this._net = net;- saveNet(net);- }- if (sort && ['newest', 'oldest'].includes(sort)) {- this._sort = sort;- saveSort(sort);- }- if (chains !== null) {- const parsed = chains- .split(',')- .map((s) => Number(s.trim()))- .filter((n) => Number.isInteger(n) && CHAIN_META[n]);- this._chains = parsed;- saveChains(parsed);- }-- this._renderNetSegmented();- this._renderSortSelect();- this._renderChainChips();- this._resetAndLoad();- }-- _pushURL() {- const url = new URL(location.href);- if (this._net !== 'mainnet') url.searchParams.set('net', this._net);- else url.searchParams.delete('net');- if (this._sort !== 'newest') url.searchParams.set('sort', this._sort);- else url.searchParams.delete('sort');- if (this._chains.length) url.searchParams.set('chain', this._chains.join(','));- else url.searchParams.delete('chain');- history.replaceState({}, '', url.toString());- }-- // ── Controls ──────────────────────────────────────────────────────────-- _bindControls() {- this.container.querySelector('[data-role="netGroup"]').addEventListener('click', (e) => {- const btn = e.target.closest('button[data-net]');- if (!btn) return;- const next = btn.dataset.net;- if (next === this._net) return;- this._net = next;- saveNet(next);- // Clearing chain filter makes sense when flipping net (chips re-render anyway).- this._chains = [];- saveChains([]);- this._renderNetSegmented();- this._renderChainChips();- this._pushURL();- this._resetAndLoad();- });-- this.container.querySelector('[data-role="sortSel"]').addEventListener('change', (e) => {- const v = e.target.value;- if (v !== 'newest' && v !== 'oldest') return;- this._sort = v;- saveSort(v);- this._pushURL();- this._resetAndLoad();- });-- this.container.querySelector('[data-role="chainReset"]').addEventListener('click', () => {- this._chains = [];- saveChains([]);- this._renderChainChips();- this._pushURL();- this._resetAndLoad();- });-- this.container.querySelector('[data-role="loadMoreBtn"]').addEventListener('click', () => {- this._loadMore();- });- }-- _renderNetSegmented() {- const group = this.container.querySelector('[data-role="netGroup"]');- group.querySelectorAll('button[data-net]').forEach((btn) => {- const active = btn.dataset.net === this._net;- btn.classList.toggle('showcase-seg--active', active);- btn.setAttribute('aria-selected', active ? 'true' : 'false');- });- }-- _renderSortSelect() {- const sel = this.container.querySelector('[data-role="sortSel"]');- sel.value = this._sort;- }-- _renderChainChips() {- const root = this.container.querySelector('[data-role="chainChips"]');- const { mainnet, testnet } = splitChains();- const pool =- this._net === 'mainnet'- ? mainnet- : this._net === 'testnet'- ? testnet- : [...mainnet, ...testnet];-- const chip = (id) => {- const m = CHAIN_META[id];- if (!m) return '';- const active = this._chains.includes(id);- return `- <button type="button"- class="showcase-chip ${active ? 'showcase-chip--active' : ''} ${m.testnet ? 'showcase-chip--testnet' : ''}"- data-chain="${id}"- title="${esc(m.name)}"- aria-pressed="${active ? 'true' : 'false'}"- >- <span class="showcase-chip-dot"></span>- ${esc(m.shortName || m.name)}- </button>- `;- };-- root.innerHTML = pool.map(chip).join('');- root.querySelectorAll('.showcase-chip').forEach((btn) => {- btn.addEventListener('click', () => {- const id = Number(btn.dataset.chain);- const idx = this._chains.indexOf(id);- if (idx >= 0) this._chains.splice(idx, 1);- else this._chains.push(id);- saveChains(this._chains);- this._renderChainChips();- this._pushURL();- this._resetAndLoad();- });- });-- const reset = this.container.querySelector('[data-role="chainReset"]');- reset.hidden = this._chains.length === 0;- }-- // ── Data ──────────────────────────────────────────────────────────────-- _resetAndLoad() {- this._items = [];- this._nextCursor = null;- this._reqSeq++;- this._renderResults({ skeleton: true });- this._loadMore({ first: true });- }-- async _loadMore({ first = false } = {}) {- if (this._loading) return;- if (!first && !this._nextCursor) return;- this._loading = true;- const seq = this._reqSeq;- this._setLoadMoreState();-- const params = new URLSearchParams();- params.set('net', this._net);- params.set('sort', this._sort);- params.set('limit', String(PAGE_SIZE));- if (this._chains.length) params.set('chain', this._chains.join(','));- if (this._nextCursor) params.set('cursor', this._nextCursor);-- try {- const res = await fetch('/api/showcase?' + params.toString(), {- headers: { accept: 'application/json' },- });- if (!res.ok) {- const text = await res.text().catch(() => '');- throw new Error(`HTTP ${res.status}${text ? ': ' + text.slice(0, 200) : ''}`);- }- const data = await res.json();- if (seq !== this._reqSeq) return; // superseded- const agents = Array.isArray(data.agents) ? data.agents : [];- this._items = this._items.concat(agents);- this._nextCursor = data.next_cursor || null;- this._total = Number(data.total) || this._total;- this._renderStats();- this._renderResults();- } catch (err) {- if (seq !== this._reqSeq) return;- this._renderError(err.message || String(err));- } finally {- if (seq === this._reqSeq) this._loading = false;- this._setLoadMoreState();- }- }-- _maybeAutoLoad() {- if (this._loading || !this._nextCursor) return;- const more = this.container.querySelector('[data-role="loadMore"]');- if (!more || more.hidden) return;- const rect = more.getBoundingClientRect();- if (rect.top < window.innerHeight + 400) this._loadMore();- }-- // ── Render ────────────────────────────────────────────────────────────-- _renderStats() {- const el = this.container.querySelector('[data-role="statTotal"]');- if (el) el.textContent = formatCount(this._total);- }-- _setLoadMoreState() {- const wrap = this.container.querySelector('[data-role="loadMore"]');- const btn = this.container.querySelector('[data-role="loadMoreBtn"]');- if (!wrap || !btn) return;- wrap.hidden = !this._nextCursor;- btn.disabled = !!this._loading;- btn.textContent = this._loading ? 'Loading…' : 'Load more';- }-- _renderResults({ skeleton = false } = {}) {- const out = this.container.querySelector('[data-role="results"]');- if (skeleton) {- out.setAttribute('aria-busy', 'true');- out.innerHTML = `<div class="showcase-grid">${skeletonHTML(8, 'card')}</div>`;- return;- }-- out.removeAttribute('aria-busy');-- if (!this._items.length) {- const altNet = this._net === 'mainnet' ? 'Testnet' : 'Mainnet';- out.innerHTML = emptyStateHTML({- title: 'No agents found',- body: `Try a different chain filter, flip to ${altNet}, or <a href="/deploy">deploy your own</a>.`,- actions: [{ label: 'Deploy an agent', href: '/deploy', primary: true }],- live: true,- });- return;- }-- out.innerHTML = `- <div class="showcase-grid">- ${this._items.map((a) => renderCard(a)).join('')}- </div>- `;- this._wireCardShare(out);- }-- _renderError(message) {- const out = this.container.querySelector('[data-role="results"]');- out.removeAttribute('aria-busy');- out.innerHTML = errorStateHTML({- title: "Couldn't load the directory",- body: esc(message),- });- out.querySelector('[data-sk-retry]').addEventListener('click', () =>- this._resetAndLoad(),- );- }-- _wireCardShare(root) {- root.querySelectorAll('[data-role="card-share"]').forEach((btn) => {- btn.addEventListener('click', async (e) => {- e.preventDefault();- const href = btn.dataset.share;- if (!href) return;- const url = new URL(href, location.origin).toString();- try {- await navigator.clipboard.writeText(url);- btn.textContent = 'Copied ✓';- setTimeout(() => (btn.textContent = 'Share'), 1400);- } catch {- window.prompt('Copy link:', url);- }- });- });- }-}--// ─── Card ──────────────────────────────────────────────────────────────────--/**- * @param {object} a Shaped agent from /api/showcase- */-function renderCard(a) {- const chainMeta = CHAIN_META[a.chainId];- const chainShort = chainMeta?.shortName || a.chainName || `#${a.chainId}`;- const img = (a.image && !hasExpiringSignature(a.image)) ? resolveURI(a.image) : '';- const title = esc(a.name || `Agent #${a.agentId}`);- const descLine = a.description- ? `<p class="showcase-card-desc">${esc(truncate(a.description, 140))}</p>`- : '';- const ownerLine = a.owner- ? `<a class="showcase-card-owner" href="${esc(a.ownerExplorerUrl || '#')}" target="_blank" rel="noopener" title="${esc(a.owner)}">Owner ${esc(shortAddr(a.owner))} ↗</a>`- : '';-- const badgeHtml = onchainBadgeHTML(a, { size: 'sm', showChain: true });-- const tags = [];- tags.push(`<span class="showcase-tag showcase-tag--3d">3D</span>`);- if (a.x402Support) tags.push(`<span class="showcase-tag showcase-tag--x402">x402 💳</span>`);- const serviceTypes = new Set();- for (const s of a.services || []) {- const name = String(s?.name || '').toLowerCase();- if (name === 'a2a' || name.startsWith('a2a')) serviceTypes.add('A2A');- else if (name === 'mcp' || name.startsWith('mcp')) serviceTypes.add('MCP');- else if (name === 'oasf') serviceTypes.add('OASF');- }- for (const t of serviceTypes) tags.push(`<span class="showcase-tag">${t}</span>`);-- return `- <article class="showcase-card">- <a class="showcase-card-thumb" href="${esc(a.viewerUrl)}" aria-label="Open Agent #${esc(a.agentId)} in 3D viewer">- ${img ? `<img src="${esc(img)}" alt="" loading="lazy" />` : `<div class="showcase-card-ph">🤖</div>`}- <span class="showcase-chain-badge ${chainMeta?.testnet ? 'showcase-chain-badge--testnet' : ''}" title="${esc(chainMeta?.name || '')}">- ${esc(chainShort)}- </span>- <span class="showcase-card-3dpill">▶ 3D</span>- </a>- <div class="showcase-card-body">- <div class="showcase-card-head">- <a class="showcase-card-title" href="${esc(a.viewerUrl)}">${title}</a>- <span class="showcase-card-id">#${esc(a.agentId)}</span>- ${badgeHtml}- </div>- ${descLine}- <div class="showcase-card-tags">${tags.join('')}</div>- ${ownerLine}- <div class="showcase-card-actions">- <a class="showcase-btn showcase-btn--sm showcase-btn--primary" href="${esc(a.viewerUrl)}">Open 3D ↗</a>- ${a.tokenExplorerUrl ? `<a class="showcase-btn showcase-btn--sm" href="${esc(a.tokenExplorerUrl)}" target="_blank" rel="noopener">Explorer ↗</a>` : ''}- <button type="button" class="showcase-btn showcase-btn--sm showcase-btn--ghost"- data-role="card-share" data-share="${esc(a.viewerUrl)}" title="Copy shareable link">Share</button>- </div>- </div>- </article>- `;-}--function truncate(s, n) {- s = String(s || '');- return s.length > n ? s.slice(0, n - 1) + '…' : s;-}--function formatCount(n) {- if (!Number.isFinite(n)) return '—';- if (n >= 1_000_000) return (n / 1_000_000).toFixed(1).replace(/\.0$/, '') + 'M';- if (n >= 1_000) return (n / 1_000).toFixed(1).replace(/\.0$/, '') + 'K';- return String(n);-}diff --git a/src/filter-controls.css b/src/filter-controls.cssindex e80320714..c454dd37b 100644--- a/src/filter-controls.css+++ b/src/filter-controls.css@@ -1,8 +1,9 @@/** Shared filter-control row: the labelled selects, reset button and result* count that sit above a data table. Used by /screener and /yields, both of- * which also load coin-pages.css for cv-table, cv-search, cv-pill and the- * hm-seg segmented control. Any page adding a scr-controls row must link this+ * which also load coin-pages.css for cv-table, cv-search, cv-pill, the hm-seg+ * segmented control and cv-linkbtn (the in-prose reset/retry control inside an+ * empty or failed state). Any page adding a scr-controls row must link this* file, or the row falls back to unstyled inline markup.*/@@ -95,25 +96,6 @@font-variant-numeric: tabular-nums;}-.scr-empty-reset {- appearance: none;- border: 0;- background: transparent;- padding: 0;- font: inherit;- color: var(--cv-accent);- cursor: pointer;- text-decoration: underline;-}-.scr-empty-reset:hover {- color: var(--cv-accent-hover);-}-.scr-empty-reset:focus-visible {- outline: 2px solid var(--cv-accent);- outline-offset: 2px;- border-radius: var(--cv-radius-sm);-}-@media (max-width: 639px) {.scr-field {flex: 1 1 45%;diff --git a/src/radar.css b/src/radar.cssindex 3fe82782f..470a86ebf 100644--- a/src/radar.css+++ b/src/radar.css@@ -99,7 +99,11 @@display: flex; flex-direction: column; gap: var(--space-sm);padding: var(--space-sm) 0 var(--space-md);margin-bottom: var(--space-md);- background: linear-gradient(180deg, var(--bg-0) 70%, transparent);+ /* The fade is a fixed band at the bottom edge, not a percentage: the+ toolbar wraps to ~8 rows on a 320px phone, where a 30% transparent tail+ is tall enough that the first card scrolls through it and both become+ unreadable. A pixel band stays a hairline fade at every width. */+ background: linear-gradient(180deg, var(--bg-0) calc(100% - 14px), transparent);border-bottom: 1px solid var(--stroke);}.radar-chips { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }@@ -249,7 +253,7 @@/* ── card ─────────────────────────────────────────────────────────────────── */.radar-card {- display: flex; flex-direction: column; gap: var(--space-sm);+ display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0;background: var(--card-bg, var(--surface-glass));border: 1px solid var(--card-border, var(--stroke));border-radius: var(--radius-lg); padding: var(--space-md);@@ -333,7 +337,7 @@.rc-flag--clean { color: var(--success); background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.24); }.rc-stats {- display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-xs) var(--space-sm);+ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs) var(--space-sm);padding-top: var(--space-xs); border-top: 1px solid var(--stroke);}.rc-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }@@ -410,6 +414,38 @@.radar-state-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; justify-content: center; margin-top: var(--space-xs); }.radar-error .radar-state-title { color: var(--danger); }+/* removable filter chips (no-match state) */+.radar-active-filters { display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: center; margin-top: var(--space-2xs); }+.radar-active-filter {+ display: inline-flex; align-items: center; gap: var(--space-2xs); max-width: 100%;+ font-family: var(--font-body); font-size: var(--text-sm); color: var(--ink);+ background: var(--surface-2); border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-pill); padding: var(--space-2xs) var(--space-sm);+ cursor: pointer;+ transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);+}+.radar-active-filter:hover { background: var(--surface-3); border-color: var(--danger); }+.radar-active-filter:active { transform: translateY(1px); }+.radar-active-filter:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }+.radar-active-filter-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.radar-active-filter-x { color: var(--ink-faint); font-size: var(--text-md); line-height: 1; }+.radar-active-filter:hover .radar-active-filter-x { color: var(--danger); }++/* market pulse: designed unavailable state (the aggregate failed and there is+ no earlier value to keep showing) */+.radar-pulse--unavailable { grid-template-columns: 1fr; }+.rp-cell--unavailable { gap: var(--space-2xs); align-items: flex-start; }+.rp-cell--unavailable .rp-sub { white-space: normal; }+.rp-retry {+ font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold);+ color: var(--ink); background: var(--surface-2); border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-md); padding: var(--space-2xs) var(--space-sm);+ cursor: pointer; margin-top: var(--space-2xs);+ transition: background var(--duration-fast) var(--ease-standard);+}+.rp-retry:hover { background: var(--surface-3); }+.rp-retry:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }+.radar-btn {font-family: var(--font-body); font-size: var(--text-ui); font-weight: var(--weight-semibold);color: var(--btn-primary-fg); background: var(--accent);@@ -616,7 +652,11 @@.radar-controls { gap: var(--space-sm); }.radar-search { max-width: none; flex-basis: 100%; }.radar-updated { margin-left: 0; width: 100%; }- .radar-grid { grid-template-columns: 1fr; }+ /* minmax(0, 1fr), not 1fr: a bare 1fr floors the track at the card's+ min-content width, which on a 320px phone resolved to 329px and pushed+ ~19px of every card under the mobile overflow-x: clip guard. */+ .radar-grid { grid-template-columns: minmax(0, 1fr); }+ .rc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }.rd-signals { grid-template-columns: 1fr; }.radar-drawer-panel { width: 100%; border-left: none; }.radar-pulse { grid-template-columns: repeat(2, 1fr); }diff --git a/src/radar.js b/src/radar.jsindex 3c962169d..3759c20c2 100644--- a/src/radar.js+++ b/src/radar.js@@ -152,6 +152,7 @@ const state = {pollTimer: null,inFlight: null,pulse: null, // market-pulse aggregate (or null until first load)+ pulseStatus: 'loading', // loading | ready | error (drives the strip's own state)pulseInFlight: null,};@@ -252,10 +253,15 @@ async function fetchPulse() {});if (!r.ok) throw new Error(`pulse HTTP ${r.status}`);state.pulse = await r.json();+ state.pulseStatus = 'ready';updatePulseStrip();} catch (err) {if (err.name === 'AbortError') return;log.error('pulse fetch failed:', err.message || err);+ // A later poll can still succeed, so keep the last good aggregate on+ // screen. With nothing to keep, swap the skeleton for a designed+ // "unavailable" cell instead of leaving a shimmer up forever.+ if (!state.pulse) { state.pulseStatus = 'error'; updatePulseStrip(); }} finally {state.pulseInFlight = null;}@@ -291,7 +297,12 @@ function render() {} else {const visible = applyClientFilters(state.coins);if (!visible.length) {- body.append(state.status === 'empty' ? renderEmptyState() : renderNoMatchState());+ // Most of the filters (search, category, min quality, smart money,+ // news) are applied server-side, so an over-tight filter comes back+ // as an empty feed and used to render "radar is clear", blaming the+ // market for the user's own filter and offering no way out. The+ // filter state, not the response shape, decides which state is true.+ body.append(activeFilters().length ? renderNoMatchState() : renderEmptyState());} else {body.append(state.view === 'list' ? renderList(visible) : renderGrid(visible));}@@ -300,6 +311,20 @@ function render() {updateUpdatedLabel();}+// Every filter currently narrowing the feed, each with the label the user sees+// and the reset that drops just that one. Drives the no-match state's removable+// chips, and (by being non-empty) the choice between "no match" and "no coins".+function activeFilters() {+ const out = [];+ if (state.query) out.push({ label: `Search: ${state.query}`, clear: () => { state.query = ''; } });+ if (state.category) out.push({ label: `Category: ${CATEGORY_LABEL[state.category] || state.category}`, clear: () => { state.category = null; } });+ if (state.minQuality > 0) out.push({ label: `Min quality: ${state.minQuality}`, clear: () => { state.minQuality = 0; } });+ if (state.smartOnly) out.push({ label: 'Smart money only', clear: () => { state.smartOnly = false; } });+ if (state.newsOnly) out.push({ label: 'News-driven only', clear: () => { state.newsOnly = false; } });+ if (state.hideRisky) out.push({ label: 'Flagged coins hidden', clear: () => { state.hideRisky = false; } });+ return out;+}+function applyClientFilters(coins) {if (!state.hideRisky) return coins;return coins.filter((c) => {@@ -326,7 +351,27 @@ function updatePulseStrip() {function fillPulseStrip(strip, p) {strip.innerHTML = '';+ strip.classList.remove('radar-pulse--unavailable');if (!p) {+ if (state.pulseStatus === 'error') {+ // The aggregate is a summary of the same window the feed below+ // already shows, so its failure is a note, not a page error. Say so+ // and offer the retry rather than shimmering forever.+ const cell = el('div', 'rp-cell rp-cell--unavailable');+ cell.append(el('span', 'rp-label', 'Market pulse'));+ cell.append(el('span', 'rp-sub', 'The 24h aggregate did not load. The live feed below is unaffected.'));+ const retry = el('button', 'rp-retry', 'Retry');+ retry.type = 'button';+ retry.addEventListener('click', () => {+ state.pulseStatus = 'loading';+ updatePulseStrip();+ fetchPulse();+ });+ cell.append(retry);+ strip.classList.add('radar-pulse--unavailable');+ strip.append(cell);+ return;+ }// first paint, before the aggregate lands — quiet skeleton, no layout jumpfor (let i = 0; i < 5; i++) {const cell = el('div', 'rp-cell rp-cell--sk');@@ -1055,12 +1100,35 @@ function renderEmptyState() {}function renderNoMatchState() {+ const filters = activeFilters();const box = el('div', 'radar-state radar-empty');box.append(radarGlyph());box.append(el('h2', 'radar-state-title', 'No coins match these filters'));- box.append(el('p', 'radar-state-text', 'The radar has live coins, but none pass your current category, quality, or risk filters. Loosen them to see more.'));+ box.append(el('p', 'radar-state-text', 'The radar is live and scoring launches, but nothing in the current window passes every filter you have set. Drop one to widen the search.'));++ // Removable chips: dropping the one filter that is too tight beats resetting+ // everything and rebuilding the view from scratch.+ if (filters.length) {+ const chips = el('div', 'radar-active-filters');+ chips.setAttribute('role', 'group');+ chips.setAttribute('aria-label', 'Active filters');+ for (const f of filters) {+ const b = el('button', 'radar-active-filter');+ b.type = 'button';+ b.append(el('span', 'radar-active-filter-text', f.label));+ const x = el('span', 'radar-active-filter-x', '\u00d7');+ x.setAttribute('aria-hidden', 'true');+ b.append(x);+ b.title = `Remove filter: ${f.label}`;+ b.setAttribute('aria-label', `Remove filter: ${f.label}`);+ b.addEventListener('click', () => { f.clear(); onFilterChange(); });+ chips.append(b);+ }+ box.append(chips);+ }+const actions = el('div', 'radar-state-actions');- const reset = el('button', 'radar-btn', 'Reset filters');+ const reset = el('button', 'radar-btn', 'Reset all filters');reset.type = 'button';reset.addEventListener('click', () => {state.category = null; state.minQuality = 0; state.hideRisky = false;@@ -1068,6 +1136,9 @@ function renderNoMatchState() {onFilterChange();});actions.append(reset);+ const live = el('a', 'radar-btn radar-btn--ghost', 'See raw launches \u2192');+ live.href = '/pump-live';+ actions.append(live);box.append(actions);return box;}@@ -1490,8 +1561,9 @@ function renderDrawerContent(panel, coin) {const copy = el('button', 'rd-copy', 'Copy');copy.type = 'button';copy.addEventListener('click', async () => {- try { await navigator.clipboard.writeText(coin.mint); copy.textContent = 'Copied'; setTimeout(() => copy.textContent = 'Copy', 1400); }- catch { copy.textContent = 'Copy failed'; setTimeout(() => copy.textContent = 'Copy', 1400); }+ const ok = await writeClipboard(coin.mint);+ copy.textContent = ok ? 'Copied' : 'Copy failed';+ setTimeout(() => { copy.textContent = 'Copy'; }, 1400);});id.append(code, copy);panel.append(id);@@ -1501,6 +1573,35 @@ function renderDrawerContent(panel, coin) {if (close) close.focus();}+// Clipboard API first; on a browser or context that refuses it (an insecure+// origin, a denied permission) fall back to a scratch textarea so the mint+// button still copies instead of only reporting failure. Mirrors the same+// helper in src/converter.js.+async function writeClipboard(text) {+ if (navigator.clipboard?.writeText) {+ try {+ await navigator.clipboard.writeText(text);+ return true;+ } catch {+ // Permission denied or an insecure context: try the fallback below.+ }+ }+ const ta = document.createElement('textarea');+ ta.value = text;+ ta.setAttribute('readonly', '');+ ta.style.cssText = 'position:fixed;top:0;left:-9999px;opacity:0';+ document.body.appendChild(ta);+ ta.select();+ let ok = false;+ try {+ ok = document.execCommand('copy');+ } catch {+ ok = false;+ }+ ta.remove();+ return ok;+}+function smChip(text) {return el('span', 'rd-sm-chip', text);}diff --git a/src/restyle.js b/src/restyle.jsindex d33177eba..84fbc2495 100644--- a/src/restyle.js+++ b/src/restyle.js@@ -76,7 +76,7 @@ function cache() {'stage', 'canvas-wrap', 'presets', 'variants', 'variant-strip', 'history','metalness', 'roughness', 'emissive', 'basecolor', 'emissivecolor','seed', 'variant-count', 'gen-variants', 'reset', 'export', 'export-note',- 'file', 'url-input', 'load-url', 'status', 'error', 'error-msg', 'retry',+ 'file', 'upload', 'url-input', 'load-url', 'load-note', 'status', 'error', 'error-msg', 'retry','ai-instruction', 'ai-restyle', 'ai-texture', 'ai-note','lineage-strip', 'save-version', 'lineage-note','save-variants', 'variants-note',@@ -191,7 +191,12 @@ function mountModel(newRoot, label, opts = {}) {syncSlidersFromModel();markPresetActive(null);- if (!opts.preserveLineage) {+ if (opts.preserveLineage) {+ // Reverting to an existing version: the lineage thread stays, but every+ // downstream operation (AI restyle, Save version, Save all as versions)+ // must now read THIS version's bytes, not the newest checkpoint's.+ if (opts.originUrl) state.sourceGlbUrl = opts.originUrl;+ } else {state.sourceUrlPending = null;if (opts.originUrl) {state.sourceGlbUrl = opts.originUrl;@@ -414,6 +419,7 @@ function generateVariants() {el['variant-strip'].innerHTML = '';for (const v of variants) {const b = document.createElement('button');+ b.type = 'button';b.className = 'rs-swatch';b.style.background = v.config.color;b.title = `${v.label} · seed ${v.seed}`;@@ -593,7 +599,10 @@ function renderLineageStrip() {const entry = state.realLineage.find((v) => v.index === idx);if (!entry) return;state.activeIndex = idx;- loadModel(entry.glbUrl, entry.label || `Version ${idx}`, { preserveLineage: true });+ loadModel(entry.glbUrl, entry.label || `Version ${idx}`, {+ preserveLineage: true,+ originUrl: entry.glbUrl,+ });});});}@@ -631,8 +640,10 @@ function buildPresetButtons() {for (const name of MATERIAL_PRESET_NAMES) {const preset = MATERIAL_PRESETS[name];const b = document.createElement('button');+ b.type = 'button';b.className = 'rs-preset';b.dataset.preset = name;+ b.setAttribute('aria-pressed', 'false');b.innerHTML = `<span class="rs-preset__swatch" style="background:${swatchCss(preset)}"></span><span>${preset.label || name}</span>`;b.addEventListener('click', () => applyPreset(name));el.presets.appendChild(b);@@ -649,35 +660,72 @@ function wireControls() {el['save-variants'].addEventListener('click', persistVariants);el.reset.addEventListener('click', resetModel);el.export.addEventListener('click', exportModel);- el.retry.addEventListener('click', () => loadModel(DEFAULT_MODEL, 'sample', { originUrl: absoluteUrl(DEFAULT_MODEL) }));+ el.retry.addEventListener('click', () => {+ const next = new URL(location.href);+ if (next.searchParams.has('url')) {+ next.searchParams.delete('url');+ history.replaceState(null, '', next.toString());+ }+ setNote(el['load-note'], '');+ loadModel(DEFAULT_MODEL, 'sample', { originUrl: absoluteUrl(DEFAULT_MODEL) });+ });el['ai-restyle'].addEventListener('click', aiRestyle);el['ai-instruction'].addEventListener('keydown', (e) => {if (e.key === 'Enter') aiRestyle();});el['save-version'].addEventListener('click', saveVersion);+ // The file input itself is off-screen (a bare styled <label> is not+ // keyboard-focusable, so it left upload unreachable without a mouse).+ el.upload.addEventListener('click', () => el.file.click());el.file.addEventListener('change', (e) => {const f = e.target.files?.[0];- if (f) loadModel(f, f.name);+ if (f) acceptLocalFile(f);+ // Clearing the value lets the same file be picked twice in a row; the+ // browser fires no change event for an unchanged selection otherwise.+ e.target.value = '';});el['load-url'].addEventListener('click', () => {const u = (el['url-input'].value || '').trim();- if (!u) return;+ if (!u) {+ setNote(el['load-note'], 'Paste a public .glb or .gltf URL first.', 'error');+ el['url-input'].focus();+ return;+ }const next = new URL(location.href);next.searchParams.set('url', u);location.href = next.toString();});- // Drag & drop onto the stage.+ el['url-input'].addEventListener('keydown', (e) => {+ if (e.key === 'Enter') el['load-url'].click();+ });+ // Drag & drop onto the stage, with a visible drop target and an honest+ // rejection for anything that is not a glTF binary.const stage = el.stage;- ['dragover', 'drop'].forEach((ev) =>- stage.addEventListener(ev, (e) => {- e.preventDefault();- if (ev === 'drop') {- const f = e.dataTransfer?.files?.[0];- if (f && /\.(glb|gltf)$/i.test(f.name)) loadModel(f, f.name);- }- }),- );+ stage.addEventListener('dragover', (e) => {+ e.preventDefault();+ stage.classList.add('is-dropping');+ });+ stage.addEventListener('dragleave', () => stage.classList.remove('is-dropping'));+ stage.addEventListener('drop', (e) => {+ e.preventDefault();+ stage.classList.remove('is-dropping');+ const f = e.dataTransfer?.files?.[0];+ if (!f) return;+ acceptLocalFile(f);+ });+}++// A local file has no public URL yet, so mountModel checkpoints its bytes in+// the background. Report both the accept and the reject honestly rather than+// letting a wrong-format drop vanish silently.+function acceptLocalFile(file) {+ if (!/\.(glb|gltf)$/i.test(file.name)) {+ setNote(el['load-note'], `"${file.name}" is not a .glb or .gltf model.`, 'error');+ return;+ }+ setNote(el['load-note'], `Loaded ${file.name}.`, 'done');+ loadModel(file, file.name);}function syncSlidersFromModel() {@@ -697,7 +745,9 @@ function syncSlidersFromModel() {function markPresetActive(name) {el.presets.querySelectorAll('.rs-preset').forEach((b) => {- b.classList.toggle('is-active', b.dataset.preset === name);+ const on = b.dataset.preset === name;+ b.classList.toggle('is-active', on);+ b.setAttribute('aria-pressed', on ? 'true' : 'false');});}@@ -755,6 +805,7 @@ function setNote(node, text, kind) {node.textContent = text;node.classList.toggle('is-error', kind === 'error');node.classList.toggle('is-busy', kind === 'busy');+ node.classList.toggle('is-done', kind === 'done');}function fmtBytes(n) {return n > 1e6 ? (n / 1e6).toFixed(1) + ' MB' : Math.round(n / 1024) + ' KB';diff --git a/src/rig-doctor-page.js b/src/rig-doctor-page.jsindex caa5c6c7c..0a5e928b4 100644--- a/src/rig-doctor-page.js+++ b/src/rig-doctor-page.js@@ -47,7 +47,11 @@ const state = {repaired: null,blobUrl: null,stage: null,- busy: false,+ // Monotonic token for the newest requested file. FileReader and fetch both+ // resolve asynchronously, so a second drop landing mid-read must win rather+ // than be dropped on the floor: every completion checks that it is still the+ // newest before it touches the DOM.+ seq: 0,};// ── Entry ────────────────────────────────────────────────────────────────────@@ -136,27 +140,47 @@ function wireShortcut() {}function readFile(file) {- if (state.busy) return;if (!/\.glb$/i.test(file.name)) {showError(file.name, 'Only .glb files can be read here. Export as binary glTF, not .gltf, .fbx, or .vrm.');return;}+ const seq = ++state.seq;setDropState('reading', file.name);const reader = new FileReader();- reader.onerror = () => showError(file.name, 'The browser could not read that file.');- reader.onload = () => diagnose(reader.result, file.name);+ reader.onerror = () => {+ if (seq !== state.seq) return;+ showError(file.name, 'The browser could not read that file. It may have been moved or renamed since you picked it.');+ };+ reader.onload = () => {+ if (seq !== state.seq) return;+ diagnose(reader.result, file.name);+ };reader.readAsArrayBuffer(file);}+// The samples are the only bytes this page fetches, so a failure here is a+// network or hosting problem, not a malformed rig. Saying "could not be read as+// a GLB" over a bare "Failed to fetch" would send the user to re-export a file+// that is perfectly fine, so this path gets its own headline and its own way out.async function loadSample(url, name) {- if (state.busy) return;+ const seq = ++state.seq;setDropState('reading', name);try {const res = await fetch(url);- if (!res.ok) throw new Error(`sample unavailable (${res.status})`);- diagnose(await res.arrayBuffer(), name);+ if (!res.ok) throw new Error(`the server answered ${res.status}`);+ const buffer = await res.arrayBuffer();+ if (seq !== state.seq) return;+ diagnose(buffer, name);} catch (err) {- showError(name, `Could not load the sample: ${err.message}`);+ if (seq !== state.seq) return;+ const reason = /failed to fetch|networkerror|load failed/i.test(err.message)+ ? 'the request never reached three.ws'+ : err.message;+ showError(+ name,+ `This sample rig could not be downloaded: ${reason}. Check your connection and try again, or drop one of your own .glb files instead: that path needs no network at all.`,+ 'That sample could not be downloaded.',+ );}}@@ -173,12 +197,10 @@ function setDropState(name, label) {// ── Diagnosis ────────────────────────────────────────────────────────────────function diagnose(buffer, fileName) {- state.busy = true;let report;try {report = analyzeGlb(buffer, { fileName });} catch (err) {- state.busy = false;showError(fileName, err.message);return;}@@ -200,11 +222,10 @@ function diagnose(buffer, fileName) {results.hidden = false;results.scrollIntoView({ behavior: prefersReducedMotion() ? 'auto' : 'smooth', block: 'start' });- state.busy = false;mountStage(report);}-function showError(fileName, message) {+function showError(fileName, message, headline = 'That file could not be read as a GLB.') {const results = $('rd-results');teardownStage();state.report = null;@@ -212,7 +233,7 @@ function showError(fileName, message) {$('rd-verdict').setAttribute('data-level', 'fail');$('rd-verdict-mark').innerHTML = VERDICT_MARK.fail;$('rd-verdict-file').textContent = fileName;- $('rd-verdict-headline').textContent = 'That file could not be read as a GLB.';+ $('rd-verdict-headline').textContent = headline;$('rd-verdict-detail').textContent = message;$('rd-verdict-notes').innerHTML = '';$('rd-verdict-actions').innerHTML = '';@@ -227,6 +248,11 @@ function showError(fileName, message) {for (const panel of document.querySelectorAll('.rd-col-report .rd-panel')) panel.hidden = true;$('rd-stage').setAttribute('data-state', 'failed');setStageStatus('Nothing to preview');+ // The stage panel's own labels are set by mountStage, which never ran here.+ // Left alone they read "Loading the scene" above a stage that has already+ // given up, and promise a retargeting run on a file that was never parsed.+ $('rd-stage-note').textContent = 'Preview unavailable';+ $('rd-stage-foot').textContent = 'Once a file parses, its rig previews here with the real clip library.';results.hidden = false;results.scrollIntoView({ behavior: prefersReducedMotion() ? 'auto' : 'smooth', block: 'start' });}diff --git a/src/search-page.css b/src/search-page.cssindex 93e7288f4..c82fd9d3d 100644--- a/src/search-page.css+++ b/src/search-page.css@@ -23,7 +23,7 @@ body {/* Search bar + type filters */.sr-controls { margin: var(--space-lg, 24px) auto 0; max-width: 760px; display: flex; flex-direction: column; gap: 12px; }.sr-search { display: flex; align-items: center; gap: 10px; background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.1)); border-radius: var(--radius-pill, 999px); padding: 12px 20px; transition: border-color .14s ease; }-.sr-search:focus-within { border-color: var(--stroke-strong, rgba(255,255,255,.24)); }+.sr-search:focus-within { border-color: var(--ink-bright, #fff); box-shadow: 0 0 0 2px var(--bg-0, #0a0a0a), 0 0 0 4px var(--ink-bright, #fff); }.sr-search svg { flex: 0 0 auto; color: var(--ink-faint, #666); }.sr-search input { flex: 1; border: none; background: transparent; outline: none; font: inherit; font-size: var(--text-lg, 1rem); color: var(--ink-bright, #fff); min-width: 0; }.sr-search input::placeholder { color: var(--ink-faint, #666); }@@ -33,7 +33,10 @@ body {.sr-type-btn:hover { color: var(--ink, #e8e8e8); }.sr-type-btn.active { color: var(--bg-0, #0a0a0a); background: var(--ink-bright, #fff); border-color: var(--ink-bright, #fff); }.sr-type-btn:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }-.sr-type-count { opacity: .65; font-weight: 500; margin-left: 4px; }+/* A type whose source returned nothing for the current query: still clickable+ (its empty state offers a create CTA), just visibly de-emphasised. */+.sr-type-btn.is-empty { opacity: .42; }+.sr-type-btn.is-empty:hover { opacity: 1; }/* Feed head */.sr-feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: var(--space-xl, 40px) 0 var(--space-md, 16px); flex-wrap: wrap; }@@ -45,6 +48,7 @@ body {@keyframes sr-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }.sr-card:hover { border-color: var(--stroke-strong, rgba(255,255,255,.18)); background: var(--surface-2, rgba(255,255,255,.05)); transform: translateY(-2px); }+.sr-card-thumb-link { display: block; text-decoration: none; }.sr-card-thumb { display: block; aspect-ratio: 1 / 1; background: var(--bg-0, #0a0a0a); position: relative; }.sr-card-mv { width: 100%; height: 100%; display: block; --poster-color: transparent; background: radial-gradient(circle at 50% 40%, var(--surface-2, rgba(255,255,255,.05)), var(--bg-0, #0a0a0a)); }.sr-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }@@ -55,10 +59,12 @@ body {.sr-card-title { margin: 0; font-size: var(--text-sm, .88rem); font-weight: 600; color: var(--ink-bright, #fff); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }.sr-card-title a { color: inherit; text-decoration: none; }.sr-card-title a:hover { text-decoration: underline; }+.sr-card-title a:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; border-radius: 3px; }.sr-card-desc { margin: 0; font-size: var(--text-2xs, .74rem); color: var(--ink-dim, #999); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2em; }.sr-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }.sr-card-creator { font-size: var(--text-2xs, .68rem); color: var(--ink-faint, #777); text-decoration: none; }-.sr-card-creator:hover { color: var(--ink-bright, #fff); text-decoration: underline; }+a.sr-card-creator:hover { color: var(--ink-bright, #fff); text-decoration: underline; }+a.sr-card-creator:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; border-radius: 3px; }.sr-card-followers { font-size: var(--text-2xs, .64rem); color: var(--ink-faint, #666); }.sr-card-actions { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }@@ -71,7 +77,9 @@ body {.sr-remix-inline { display: none; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--stroke, rgba(255,255,255,.1)); margin-top: 8px; width: 100%; }.sr-remix-inline.is-open { display: flex; }-.sr-remix-inline input { font: inherit; font-size: var(--text-sm, .8rem); color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.1)); border-radius: var(--radius-sm, 8px); padding: 7px 10px; }+.sr-remix-label { font-size: var(--text-2xs, .68rem); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint, #777); }+.sr-remix-inline input { font: inherit; font-size: var(--text-sm, .8rem); color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.1)); border-radius: var(--radius-sm, 8px); padding: 7px 10px; min-width: 0; }+.sr-remix-inline input:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 1px; }.sr-remix-status { font-size: var(--text-2xs, .7rem); color: var(--ink-faint, #666); min-height: 1.3em; }.sr-remix-status[data-kind="error"] { color: var(--danger, #f87171); }.sr-remix-status[data-kind="done"] { color: var(--success, #4ade80); }@@ -85,14 +93,14 @@ body {.sr-empty-sub { max-width: 460px; margin: 0 auto 16px; font-size: var(--text-sm, .85rem); line-height: 1.5; }.sr-empty-ctas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }.sr-error a { color: var(--ink-bright, #fff); }-/* Retry re-runs the search in place; it navigates nowhere, so it is a button- that reads as a link and keeps native keyboard and focus behaviour. */-.sr-error button { appearance: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--ink-bright, #fff); text-decoration: underline; text-underline-offset: 2px; }-.sr-error button:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; border-radius: 2px; }+/* Retry re-runs the search in place, so it is a real button sitting in the+ same CTA row as the browse links rather than a look-alike anchor. */+.sr-empty-ctas button { cursor: pointer; }/* Suggested-when-idle quick links (no query yet) */.sr-quicklinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-sm, 12px); margin-top: var(--space-lg, 24px); }.sr-quicklink { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07)); border-radius: var(--radius-lg, 14px); text-decoration: none; transition: border-color .14s ease, background .14s ease, transform .14s ease; }+.sr-quicklink:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }.sr-quicklink:hover { border-color: var(--stroke-strong, rgba(255,255,255,.18)); background: var(--surface-2, rgba(255,255,255,.05)); transform: translateY(-2px); }.sr-quicklink-title { font-size: var(--text-sm, .85rem); font-weight: 600; color: var(--ink-bright, #fff); }.sr-quicklink-desc { font-size: var(--text-2xs, .7rem); color: var(--ink-faint, #777); line-height: 1.4; }diff --git a/src/search-page.js b/src/search-page.jsindex 70a2bab15..b890b9ff5 100644--- a/src/search-page.js+++ b/src/search-page.js@@ -1,9 +1,9 @@-// /search — cross-entity discovery over GET /api/search. Debounced text query+// /search: cross-entity discovery over GET /api/search. Debounced text query// + type filter chips, fanning out to the federated backend (api/search.js /// api/_lib/cross-search.js) and rendering one ranked grid of avatar/agent/-// model/world/coin cards. Model results carry a real, wired "Remix — $0.25"-// action against the same paid rail /creations uses (POST /api/x402/remix-asset)-// — reusing that flow rather than re-deriving it.+// model/world/coin cards. Model results carry a real, wired "Remix, $0.25"+// action against the same paid rail /creations uses (POST /api/x402/remix-asset),+// reusing that flow rather than re-deriving it.import { ensureX402 } from './shared/x402-loader.js';@@ -26,7 +26,14 @@ const TYPE_CREATE_CTA = {coin: { label: 'Launch a coin', href: '/launch' },};-const state = { q: '', type: 'all', loading: false, controller: null };+// Browse surfaces that stay useful when the search index itself is unreachable.+const FALLBACK_BROWSE = [+ { label: 'Creator Gallery', href: '/creations' },+ { label: 'Avatar Gallery', href: '/gallery' },+ { label: 'Agents Index', href: '/agents' },+];++const state = { q: '', type: 'all', loading: false, controller: null, counts: null };function esc(s) {return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));@@ -36,6 +43,16 @@ function cssEscape(s) {return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(s) : String(s).replace(/["\\]/g, '\\$&');}+function isExternal(href) {+ return /^https?:/i.test(href || '');+}++// Off-site destinations open in a new tab and need rel hardening; in-site ones+// are plain same-tab links, so they get neither attribute.+function linkAttrs(href) {+ return isExternal(href) ? ' target="_blank" rel="noopener noreferrer"' : '';+}+function debounce(fn, ms) {let t;return (...args) => {@@ -48,10 +65,16 @@ function renderTypeChips() {const wrap = $('sr-types');if (!wrap) return;wrap.innerHTML = Object.entries(TYPE_LABELS)- .map(- ([key, label]) =>- `<button type="button" class="sr-type-btn${key === state.type ? ' active' : ''}" data-type="${key}" aria-pressed="${key === state.type}">${label}</button>`,- )+ .map(([key, label]) => {+ const active = key === state.type;+ // counts come from the last "all" response, where every source really+ // was queried. A scoped response only counts its own type, so its+ // zeroes say nothing about the others and are ignored.+ const noMatches = !active && state.counts && key !== 'all' && state.counts[key] === 0;+ const cls = `sr-type-btn${active ? ' active' : ''}${noMatches ? ' is-empty' : ''}`;+ const title = noMatches ? ` title="No ${label.toLowerCase()} matched this query"` : '';+ return `<button type="button" class="${cls}" data-type="${key}" aria-pressed="${active}"${title}>${label}</button>`;+ }).join('');}@@ -65,33 +88,52 @@ function cardThumb(item) {return `<div class="sr-card-thumb"><div class="sr-card-noimg">${esc((item.title || '?')[0]?.toUpperCase() || '?')}</div></div>`;}-function cardHtml(item) {+function creatorHtml(item) {+ if (!item.creator) return '';const followers = item.signals?.followerCount;- const creator = item.creator- ? `<a class="sr-card-creator" href="${esc(item.creator.url || '#')}"${item.creator.url ? '' : ' aria-disabled="true" tabindex="-1"'}>${esc(item.creator.label)}</a>${- typeof followers === 'number' ? `<span class="sr-card-followers">· ${followers} follower${followers === 1 ? '' : 's'}</span>` : ''- }`- : '';+ // A creator with no resolvable profile (a pure on-chain owner address, an+ // anonymous forge creation) is rendered as text, never as a dead "#" link.+ const name = item.creator.url+ ? `<a class="sr-card-creator" href="${esc(item.creator.url)}"${linkAttrs(item.creator.url)}>${esc(item.creator.label)}</a>`+ : `<span class="sr-card-creator">${esc(item.creator.label)}</span>`;+ const count =+ typeof followers === 'number' && followers > 0+ ? `<span class="sr-card-followers">· ${followers} follower${followers === 1 ? '' : 's'}</span>`+ : '';+ return name + count;+}++function cardHtml(item) {+ const href = item.assetUrl ? esc(item.assetUrl) : '';+ const attrs = linkAttrs(item.assetUrl);+ const title = esc(item.title);+ // The thumbnail repeats the title link's destination, so it stays out of the+ // tab order and the accessibility tree rather than shipping as a link with+ // no accessible name.+ const thumb = href+ ? `<a class="sr-card-thumb-link" href="${href}"${attrs} tabindex="-1" aria-hidden="true">${cardThumb(item)}</a>`+ : cardThumb(item);const remixBtn = item.remix- ? `<button class="sr-card-btn sr-card-btn--remix" type="button" data-remix-open="${esc(item.id)}">Remix — $${item.remix.priceUsd.toFixed(2)}</button>`+ ? `<button class="sr-card-btn sr-card-btn--remix" type="button" data-remix-open="${esc(item.id)}" aria-expanded="false" aria-label="Remix ${title} for $${item.remix.priceUsd.toFixed(2)}">Remix, $${item.remix.priceUsd.toFixed(2)}</button>`: '';const remixInline = item.remix? `<div class="sr-remix-inline" data-remix-inline="${esc(item.id)}">- <input type="text" class="sr-remix-input" placeholder='Describe the change, e.g. "make it metallic"' maxlength="500" />- <button class="sr-card-btn sr-card-btn--remix" type="button" data-remix-pay="${esc(item.id)}" data-remix-glb="${esc(item.glbUrl || '')}">Pay & remix</button>+ <label class="sr-remix-label" for="sr-remix-${esc(item.id)}">Describe the change</label>+ <input type="text" class="sr-remix-input" id="sr-remix-${esc(item.id)}" placeholder='e.g. "make it metallic"' maxlength="500" />+ <button class="sr-card-btn sr-card-btn--remix" type="button" data-remix-pay="${esc(item.id)}">Pay and remix</button><div class="sr-remix-status" role="status" aria-live="polite"></div></div>`: '';return `<article class="sr-card" data-item-id="${esc(item.id)}">- <a href="${esc(item.assetUrl || '#')}" target="${item.assetUrl?.startsWith('http') ? '_blank' : '_self'}" rel="noopener noreferrer">${cardThumb(item)}</a>+ ${thumb}<span class="sr-card-type">${esc(item.type)}</span><div class="sr-card-body">- <h3 class="sr-card-title"><a href="${esc(item.assetUrl || '#')}" target="${item.assetUrl?.startsWith('http') ? '_blank' : '_self'}" rel="noopener noreferrer">${esc(item.title)}</a></h3>+ <h3 class="sr-card-title">${href ? `<a href="${href}"${attrs}>${title}</a>` : title}</h3>${item.description ? `<p class="sr-card-desc">${esc(item.description)}</p>` : ''}- <div class="sr-card-meta">${creator}</div>+ <div class="sr-card-meta">${creatorHtml(item)}</div><div class="sr-card-actions">- <a class="sr-card-btn" href="${esc(item.assetUrl || '#')}" target="${item.assetUrl?.startsWith('http') ? '_blank' : '_self'}" rel="noopener noreferrer">View</a>+ ${href ? `<a class="sr-card-btn" href="${href}"${attrs} aria-label="View ${title}">View</a>` : ''}${remixBtn}</div>${remixInline}@@ -100,9 +142,6 @@ function cardHtml(item) {}function emptyStateHtml() {- if (!state.q) {- return '';- }const cta = state.type !== 'all' && TYPE_CREATE_CTA[state.type] ? TYPE_CREATE_CTA[state.type] : null;const ctas = Object.values(TYPE_CREATE_CTA);return `@@ -115,10 +154,45 @@ function emptyStateHtml() {</div>`;}+// The backend answers 200 with { enabled: false } when its creation stores are+// not reachable. That is not "nothing matched", so it gets its own honest state+// pointing at the browse surfaces that are still live.+function warmingStateHtml() {+ return `+ <div class="sr-empty">+ <div class="sr-empty-title">Search is warming up</div>+ <p class="sr-empty-sub">The creation index is not reachable right now, so this query could not run. Browse by type in the meantime, or retry in a moment.</p>+ <div class="sr-empty-ctas">+ ${FALLBACK_BROWSE.map((b) => `<a class="sr-card-btn" href="${b.href}">${b.label}</a>`).join('')}+ <button class="sr-card-btn sr-card-btn--remix" type="button" data-retry>Retry</button>+ </div>+ </div>`;+}++function errorStateHtml(message) {+ return `+ <div class="sr-error">+ <div class="sr-empty-title">Search is temporarily unavailable</div>+ <p class="sr-empty-sub">${esc(message)}</p>+ <div class="sr-empty-ctas">+ <button class="sr-card-btn sr-card-btn--remix" type="button" data-retry>Retry</button>+ ${FALLBACK_BROWSE.map((b) => `<a class="sr-card-btn" href="${b.href}">${b.label}</a>`).join('')}+ </div>+ </div>`;+}+function skeletonHtml(n = 8) {return Array.from({ length: n }, () => '<div class="sr-skeleton"></div>').join('');}+function syncUrl() {+ const params = new URLSearchParams();+ if (state.q) params.set('q', state.q);+ if (state.type !== 'all') params.set('type', state.type);+ const qs = params.toString();+ history.replaceState(null, '', qs ? `?${qs}` : location.pathname);+}+async function runSearch() {const grid = $('sr-grid');const countEl = $('sr-count');@@ -131,12 +205,15 @@ async function runSearch() {if (!state.q) {grid.innerHTML = '';if (countEl) countEl.textContent = '';+ state.counts = null;+ renderTypeChips();$('sr-quicklinks')?.removeAttribute('hidden');state.loading = false;return;}$('sr-quicklinks')?.setAttribute('hidden', '');grid.setAttribute('aria-busy', 'true');+ if (countEl) countEl.textContent = 'Searching…';grid.innerHTML = skeletonHtml();try {@@ -146,16 +223,27 @@ async function runSearch() {if (!res.ok) throw new Error(data?.message || `search returned ${res.status}`);if (controller.signal.aborted) return;+ if (data.enabled === false) {+ state.counts = null;+ renderTypeChips();+ if (countEl) countEl.textContent = 'Search index unavailable';+ grid.innerHTML = warmingStateHtml();+ return;+ }+const items = Array.isArray(data.items) ? data.items : [];+ state.counts = state.type === 'all' && data.counts ? data.counts : null;+ renderTypeChips();if (countEl) {countEl.textContent = items.length? `${items.length} result${items.length === 1 ? '' : 's'} for "${state.q}"`- : '';+ : `No results for "${state.q}"`;}grid.innerHTML = items.length ? items.map(cardHtml).join('') : emptyStateHtml();} catch (err) {if (controller.signal.aborted) return;- grid.innerHTML = `<div class="sr-error"><div class="sr-empty-title">Search is temporarily unavailable</div><p>${esc(err?.message || 'Please try again.')} <button type="button" data-retry>Retry</button></p></div>`;+ if (countEl) countEl.textContent = 'Search failed';+ grid.innerHTML = errorStateHtml(err?.message || 'The search service did not respond. Please try again.');} finally {grid.removeAttribute('aria-busy');state.loading = false;@@ -169,14 +257,32 @@ function wireControls() {const input = $('sr-q');input?.addEventListener('input', (e) => {state.q = e.target.value.trim();- history.replaceState(null, '', state.q ? `?q=${encodeURIComponent(state.q)}${state.type !== 'all' ? `&type=${state.type}` : ''}` : location.pathname);+ syncUrl();debouncedSearch();});+ // Enter runs the query immediately instead of waiting out the debounce;+ // Escape clears it and returns the page to its idle browse state.+ input?.addEventListener('keydown', (e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ state.q = input.value.trim();+ syncUrl();+ runSearch();+ } else if (e.key === 'Escape' && input.value) {+ e.preventDefault();+ input.value = '';+ state.q = '';+ syncUrl();+ runSearch();+ }+ });$('sr-types')?.addEventListener('click', (e) => {const btn = e.target.closest('[data-type]');- if (!btn) return;+ if (!btn || btn.dataset.type === state.type) return;state.type = btn.dataset.type;+ state.counts = null;renderTypeChips();+ syncUrl();if (state.q) runSearch();});$('sr-grid')?.addEventListener('click', (e) => {@@ -184,15 +290,16 @@ function wireControls() {runSearch();return;}- const openId = e.target.closest('[data-remix-open]')?.dataset.remixOpen;- if (openId) {- const inline = document.querySelector(`[data-remix-inline="${cssEscape(openId)}"]`);- inline?.classList.toggle('is-open');- if (inline?.classList.contains('is-open')) inline.querySelector('input')?.focus();+ const openBtn = e.target.closest('[data-remix-open]');+ if (openBtn) {+ const inline = document.querySelector(`[data-remix-inline="${cssEscape(openBtn.dataset.remixOpen)}"]`);+ const open = inline?.classList.toggle('is-open');+ openBtn.setAttribute('aria-expanded', String(Boolean(open)));+ if (open) inline.querySelector('input')?.focus();return;}const payId = e.target.closest('[data-remix-pay]')?.dataset.remixPay;- if (payId) return remixOne(payId, e.target.closest('.sr-card'));+ if (payId) remixOne(payId, e.target.closest('.sr-card'));});}@@ -203,7 +310,11 @@ async function remixOne(sourceId, cardEl) {const payBtn = cardEl?.querySelector(`[data-remix-pay="${cssEscape(sourceId)}"]`);const instruction = input?.value.trim();if (!instruction) {- if (statusEl) statusEl.textContent = 'Describe the change first.';+ if (statusEl) {+ statusEl.dataset.kind = 'error';+ statusEl.textContent = 'Describe the change first.';+ }+ input?.focus();return;}if (payBtn) payBtn.disabled = true;@@ -218,15 +329,15 @@ async function remixOne(sourceId, cardEl) {method: 'POST',body: { source_creation_id: sourceId, instruction },merchant: 'three.ws Remix Bazaar',- action: 'Remix this model — $0.25 USDC (a royalty routes to its creator)',+ action: 'Remix this model for $0.25 USDC (a royalty routes to its creator)',});const remix = out?.result?.remix;const royalty = out?.result?.royalty;if (statusEl) {statusEl.dataset.kind = 'done';statusEl.innerHTML = remix?.viewerUrl- ? `Remixed! <a href="${esc(remix.viewerUrl)}" target="_blank" rel="noopener noreferrer">View your new model →</a>` +- (royalty?.paid ? ` · $${royalty.creatorUsd} routed to the original creator.` : '')+ ? `Remixed! <a href="${esc(remix.viewerUrl)}" target="_blank" rel="noopener noreferrer">View your new model</a>` ++ (royalty?.paid ? ` · $${esc(royalty.creatorUsd)} routed to the original creator.` : ''): 'Remix submitted.';}if (input) input.value = '';@@ -240,9 +351,11 @@ async function remixOne(sourceId, cardEl) {}}+// Runs BEFORE wireControls() paints the chips: reading ?type= afterwards left+// the chip row claiming "All" while the results were already scoped.function initFromUrl() {const params = new URLSearchParams(location.search);- const q = (params.get('q') || '').trim();+ const q = (params.get('q') || '').trim().slice(0, 80);const type = params.get('type');if (q) {state.q = q;@@ -252,9 +365,12 @@ function initFromUrl() {if (type && TYPE_LABELS[type]) state.type = type;}-document.addEventListener('DOMContentLoaded', () => {- wireControls();+function boot() {initFromUrl();+ wireControls();if (state.q) runSearch();else $('sr-quicklinks')?.removeAttribute('hidden');-});+}++if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);+else boot();diff --git a/src/sign-mirror-page.js b/src/sign-mirror-page.jsindex 14fb4c11a..7ecf4a7b9 100644--- a/src/sign-mirror-page.js+++ b/src/sign-mirror-page.js@@ -11,7 +11,7 @@// in the practice loop at all.import { PoseStage } from './avatar-pose.js';-import { buildFingerspellingClip, normalizeWord } from './fingerspelling.js';+import { buildFingerspellingClip } from './fingerspelling.js';import { LETTERS, LETTER_NOTES } from './asl-alphabet-data.js';import { GradeSmoother, gradeHandshape, rankHandshapes } from './sign-grader.js';import { HAND_CONNECTIONS, handshapeLandmarks, projectHand } from './sign-hand-model.js';@@ -54,28 +54,42 @@ function writeJSON(key, value) {}}-/** Draw a hand skeleton into an SVG element from 21 projected points. */+const SVG_NS = 'http://www.w3.org/2000/svg';++/**+ * Draw a hand skeleton into an SVG element from 21 projected points.+ *+ * The overlay redraws on every camera frame, so the nodes are built once and+ * then only their coordinates change: rebuilding 21 circles and 21 lines sixty+ * times a second is enough layout churn to be felt on a laptop.+ */function drawSkeleton(svg, points, { className = '' } = {}) {- const ns = 'http://www.w3.org/2000/svg';- svg.textContent = '';- const g = document.createElementNS(ns, 'g');- if (className) g.setAttribute('class', className);- for (const [a, b] of HAND_CONNECTIONS) {- const line = document.createElementNS(ns, 'line');+ let g = svg.firstElementChild;+ if (!g || g.childElementCount !== HAND_CONNECTIONS.length + points.length) {+ svg.textContent = '';+ g = document.createElementNS(SVG_NS, 'g');+ for (let i = 0; i < HAND_CONNECTIONS.length; i++) g.append(document.createElementNS(SVG_NS, 'line'));+ points.forEach((_, i) => {+ const dot = document.createElementNS(SVG_NS, 'circle');+ dot.setAttribute('r', i === 0 || i % 4 === 0 ? '3.6' : '2.4');+ g.append(dot);+ });+ svg.append(g);+ }+ if (g.getAttribute('class') !== className) g.setAttribute('class', className);+ const nodes = g.children;+ HAND_CONNECTIONS.forEach(([a, b], i) => {+ const line = nodes[i];line.setAttribute('x1', points[a].x.toFixed(1));line.setAttribute('y1', points[a].y.toFixed(1));line.setAttribute('x2', points[b].x.toFixed(1));line.setAttribute('y2', points[b].y.toFixed(1));- g.append(line);- }+ });points.forEach((p, i) => {- const dot = document.createElementNS(ns, 'circle');+ const dot = nodes[HAND_CONNECTIONS.length + i];dot.setAttribute('cx', p.x.toFixed(1));dot.setAttribute('cy', p.y.toFixed(1));- dot.setAttribute('r', i === 0 || i % 4 === 0 ? '3.6' : '2.4');- g.append(dot);});- svg.append(g);}async function boot() {@@ -102,6 +116,13 @@ async function boot() {};// ── The avatar half ──────────────────────────────────────────────────────+ const replayBtn = $('#sm-replay');+ const setReplayable = (on) => {+ if (!replayBtn) return;+ replayBtn.disabled = !on;+ replayBtn.title = on ? '' : 'This avatar cannot fingerspell, so there is nothing to replay. The target diagram still shows the shape.';+ };+const mountStage = async () => {stage?.dispose();stage = new PoseStage(stageHost, { glbUrl: avatar.url, framing: 'portrait' });@@ -110,10 +131,12 @@ async function boot() {stage.start();canSign = !!supported;if (!supported) setStatus('This avatar has no finger bones. Practice still works: the target diagram and the scoring do not need it.', 'warn');+ setReplayable(canSign);return canSign;} catch (err) {log.warn('[sign-mirror] stage mount failed', err?.message);canSign = false;+ setReplayable(false);setStatus('The 3D preview could not start. The target diagram and scoring still work.', 'warn');return false;}@@ -165,6 +188,22 @@ async function boot() {let lastVideoTime = -1;const smoother = new GradeSmoother({ passScore: 78, holdMs: 800 });+ const IDLE_HINT = 'Turn the camera on to be graded, or just copy the diagram.';++ // The still letters: J and Z are excluded because they are defined by a path+ // the hand traces, which a single-frame ranking cannot recognise.+ const RANKABLE = LETTERS.filter((l) => !MOVING.has(l));+ const RANK_INTERVAL_MS = 350;+ let lastRankAt = 0;+ let lookedLike = '';++ // The hint is a live region, and it is written on every graded frame. Writing+ // the same sentence again would make a screen reader read it again, so only a+ // genuine change reaches the DOM.+ const setHint = (text) => {+ if (hintEl && hintEl.textContent !== text) hintEl.textContent = text;+ };+const setScore = (value, holding, heldMs) => {const pct = Math.max(0, Math.min(100, value));if (scoreEl) scoreEl.textContent = `${Math.round(pct)}`;@@ -181,24 +220,67 @@ async function boot() {}};+ // One row per finger, built on the first graded frame and then updated in+ // place. Same reason as the skeleton: this runs at camera frame rate.+ const fingerRows = new Map();const renderFingers = (grade) => {if (!fingersEl) return;- fingersEl.textContent = '';for (const f of grade.fingers) {- const row = document.createElement('div');- row.className = 'sm-finger';- row.dataset.state = f.score >= 0.8 ? 'good' : f.score >= 0.5 ? 'close' : 'far';- const name = document.createElement('span');- name.className = 'sm-finger-name';- name.textContent = f.finger;- const bar = document.createElement('span');- bar.className = 'sm-finger-bar';- bar.style.setProperty('--sm-fill', `${Math.round(f.score * 100)}%`);- row.append(name, bar);- fingersEl.append(row);+ let row = fingerRows.get(f.finger);+ if (!row) {+ const el = document.createElement('div');+ el.className = 'sm-finger';+ const name = document.createElement('span');+ name.className = 'sm-finger-name';+ name.textContent = f.finger;+ const bar = document.createElement('span');+ bar.className = 'sm-finger-bar';+ // A real progressbar rather than a bare div: a screen reader can+ // read the number on demand, without every frame announcing itself.+ bar.setAttribute('role', 'progressbar');+ bar.setAttribute('aria-label', `${f.finger} finger`);+ bar.setAttribute('aria-valuemin', '0');+ bar.setAttribute('aria-valuemax', '100');+ el.append(name, bar);+ fingersEl.append(el);+ row = { el, bar, pct: -1 };+ fingerRows.set(f.finger, row);+ }+ const state = f.score >= 0.8 ? 'good' : f.score >= 0.5 ? 'close' : 'far';+ if (row.el.dataset.state !== state) row.el.dataset.state = state;+ const pct = Math.round(f.score * 100);+ if (pct !== row.pct) {+ row.pct = pct;+ row.bar.style.setProperty('--sm-fill', `${pct}%`);+ row.bar.setAttribute('aria-valuenow', String(pct));+ }}};+ const clearFingers = () => {+ fingerRows.clear();+ if (fingersEl) fingersEl.textContent = '';+ };++ // The best score per letter survives the session, but the grader beats it+ // many times a second: batch the write instead of touching storage per frame.+ let bestTimer = 0;+ const flushProgress = () => {+ if (!bestTimer) return;+ window.clearTimeout(bestTimer);+ bestTimer = 0;+ writeJSON(PROGRESS_KEY, progress);+ renderLetterBest();+ };+ const saveBestSoon = () => {+ if (bestTimer) return;+ bestTimer = window.setTimeout(() => {+ bestTimer = 0;+ writeJSON(PROGRESS_KEY, progress);+ renderLetterBest();+ }, 2000);+ };+const markPassed = (letter) => {progress.passed[letter] = true;writeJSON(PROGRESS_KEY, progress);@@ -209,18 +291,19 @@ async function boot() {const onPassed = (letter) => {markPassed(letter);setStatus(`${letter} is right. Well held.`, 'good');- if (hintEl) hintEl.textContent = `${letter} passed. Next letter loaded.`;const idx = ALL_COURSE_LETTERS.indexOf(letter);const next = ALL_COURSE_LETTERS.slice(idx + 1).find((l) => !progress.passed[l]) || ALL_COURSE_LETTERS.find((l) => !progress.passed[l]);+ setHint(next ? `${letter} passed. ${next} is next.` : `${letter} passed. That is every letter in the alphabet.`);if (next) window.setTimeout(() => selectLetter(next), 900);else setStatus('Every letter passed. You can read and make the whole manual alphabet.', 'good');};const gradeFrame = (landmarks, now) => {- const target = MOVING.has(current) ? current : current;let grade;try {- grade = gradeHandshape(landmarks, target);+ // J and Z move, and only their handshape can be scored; the letter card+ // says so outright, so every letter grades against its own shape.+ grade = gradeHandshape(landmarks, current);} catch (err) {log.warn('[sign-mirror] grade failed', err?.message);return;@@ -228,25 +311,28 @@ async function boot() {const state = smoother.push(grade, now);setScore(state.score, state.holding, state.heldMs);renderFingers(grade);- if (progress.best[current] == null || state.score > progress.best[current]) {+ if (progress.best[current] == null || Math.round(state.score) > progress.best[current]) {progress.best[current] = Math.round(state.score);+ saveBestSoon();}if (state.passed) {smoother.reset();+ flushProgress();onPassed(current);return;}- if (hintEl) {- // When the hand is a long way off, say what it DOES look like: a- // learner making a clean B while aiming for D is helped far more by- // "that is a B" than by "straighten your ring finger".- if (state.score < 45) {- const [best] = rankHandshapes(landmarks, LETTERS.filter((l) => !MOVING.has(l)));- hintEl.textContent = best && best.name !== current && best.score > 70 ? `That is a clean ${best.name}. For ${current}: ${grade.hint}` : grade.hint;- } else {- hintEl.textContent = grade.hint;- }+ // When the hand is a long way off, say what it DOES look like: a learner+ // making a clean B while aiming for D is helped far more by "that is a B"+ // than by "straighten your ring finger". Ranking every letter costs a full+ // grade per candidate, so it runs a few times a second, not per frame.+ if (state.score < 45 && now - lastRankAt > RANK_INTERVAL_MS) {+ lastRankAt = now;+ const [best] = rankHandshapes(landmarks, RANKABLE);+ lookedLike = best && best.name !== current && best.score > 70 ? best.name : '';+ } else if (state.score >= 45) {+ lookedLike = '';}+ setHint(lookedLike ? `That is a clean ${lookedLike}. For ${current}: ${grade.hint}` : grade.hint);};const stopCamera = () => {@@ -264,20 +350,68 @@ async function boot() {}overlay?.replaceChildren();setScore(0, false, 0);- if (fingersEl) fingersEl.textContent = '';- if (hintEl) hintEl.textContent = '';+ clearFingers();+ lookedLike = '';+ lastRankAt = 0;+ if (cameraNote) cameraNote.hidden = true;+ // Back to the state the page opened in: the box says what to do next+ // rather than sitting there empty.+ setHint(IDLE_HINT);+ flushProgress();+ };++ /**+ * What to tell the learner when the camera does not come up. The raw error is+ * a bundler URL or a DOM exception name, neither of which anyone can act on,+ * so each cause gets the sentence that says what to actually do next.+ *+ * @param {unknown} err whatever was thrown+ * @param {'tracker'|'camera'} where which half of the start failed+ * @returns {string}+ */+ const cameraFailureMessage = (err, where) => {+ const name = err?.name || '';+ const text = err?.message || '';+ if (where === 'tracker') {+ return 'The hand tracker could not be downloaded. Check the connection and try again; the target diagram and the letter notes work without it.';+ }+ if (name === 'NotAllowedError' || /denied|not allowed|permission/i.test(text)) {+ return 'Camera permission was refused. Allow it in your browser address bar, then try again.';+ }+ if (name === 'NotFoundError' || name === 'DevicesNotFoundError' || /not found|no device/i.test(text)) {+ return 'No camera was found on this device. Copy the target diagram by eye instead: the letter notes still teach the shape.';+ }+ if (name === 'NotReadableError' || name === 'TrackStartError' || /in use|could not start video/i.test(text)) {+ return 'The camera is busy in another app or tab. Close the other one and try again.';+ }+ if (name === 'SecurityError' || !window.isSecureContext) {+ return 'Browsers only hand out the camera over HTTPS. Open this page on https://three.ws and try again.';+ }+ if (name === 'OverconstrainedError') {+ return 'This camera cannot deliver the format the tracker needs. Try another camera, or copy the target diagram by eye.';+ }+ return 'The camera could not start. Try again, or copy the target diagram by eye: the letter notes still teach the shape.';};const startCamera = async () => {if (running) return;if (!navigator.mediaDevices?.getUserMedia) {- setStatus('This browser has no camera API. Practice with the target diagram instead.', 'warn');+ setStatus(+ window.isSecureContext+ ? 'This browser has no camera API. Practice with the target diagram instead.'+ : 'Browsers only hand out the camera over HTTPS. Open this page on https://three.ws to be graded live.',+ 'warn',+ );return;}+ let failedAt = 'camera';cameraBtn.disabled = true;+ cameraBtn.setAttribute('aria-busy', 'true');cameraBtn.textContent = 'Starting the camera...';+ document.body.dataset.smCamera = landmarker ? 'starting' : 'loading';try {if (!landmarker) {+ failedAt = 'tracker';setStatus('Loading the hand tracker (about 8 MB, once per browser).');const { FilesetResolver, HandLandmarker } = await import('@mediapipe/tasks-vision');const { modelUrl, visionWasmBase } = await import('./shared/mediapipe-assets.js');@@ -291,6 +425,8 @@ async function boot() {numHands: 1,});}+ failedAt = 'camera';+ document.body.dataset.smCamera = 'starting';stream = await navigator.mediaDevices.getUserMedia({ video: { width: 640, height: 480, facingMode: 'user' }, audio: false });video.srcObject = stream;await video.play();@@ -302,17 +438,15 @@ async function boot() {if (cameraNote) cameraNote.hidden = false;loop();} catch (err) {- log.warn('[sign-mirror] camera failed', err?.message);- const denied = /denied|not allowed/i.test(err?.message || '');- setStatus(- denied- ? 'Camera permission was refused. Allow it in your browser address bar, then try again.'- : `The camera could not start: ${err?.message || 'unknown error'}. The target diagram still works.`,- 'warn',- );+ log.warn(`[sign-mirror] ${failedAt} failed`, err?.message);+ // A tracker that half-loaded is not reusable: drop it so the next+ // attempt downloads it again rather than throwing on a dead handle.+ if (failedAt === 'tracker') landmarker = null;stopCamera();+ setStatus(cameraFailureMessage(err, failedAt), 'warn');} finally {cameraBtn.disabled = false;+ cameraBtn.removeAttribute('aria-busy');}};@@ -321,11 +455,23 @@ async function boot() {raf = requestAnimationFrame(loop);if (!video.videoWidth || video.currentTime === lastVideoTime) return;lastVideoTime = video.currentTime;- const result = landmarker.detectForVideo(video, performance.now());+ let result;+ try {+ result = landmarker.detectForVideo(video, performance.now());+ } catch (err) {+ // A tracker that throws mid-stream (a lost GPU context, a released+ // WASM heap) would otherwise kill the frame loop silently and leave+ // the page claiming the camera is on. Stop, and say why.+ log.warn('[sign-mirror] tracker failed', err?.message);+ landmarker = null;+ stopCamera();+ setStatus('The hand tracker stopped. Turn the camera on again to restart it.', 'warn');+ return;+ }const hand = result?.landmarks?.[0];if (!hand?.length) {- if (hintEl) hintEl.textContent = 'No hand in frame. Hold one hand up, palm toward the camera.';- overlay?.replaceChildren();+ setHint('No hand in frame. Hold one hand up, palm toward the camera.');+ if (overlay?.firstElementChild) overlay.replaceChildren();setScore(0, false, 0);return;}@@ -372,7 +518,12 @@ async function boot() {});drawTarget(letter);showOnAvatar(letter);- if (hintEl && !running) hintEl.textContent = 'Turn the camera on to be graded, or just copy the diagram.';+ lookedLike = '';+ lastRankAt = 0;+ if (!running) {+ setHint(IDLE_HINT);+ clearFingers();+ }const url = new URL(location.href);url.searchParams.set('letter', letter);history.replaceState(null, '', url);@@ -399,7 +550,6 @@ async function boot() {btn.dataset.char = letter;btn.textContent = letter;btn.setAttribute('aria-pressed', String(letter === current));- btn.setAttribute('aria-label', `Practise the letter ${letter}`);if (progress.passed[letter]) btn.dataset.passed = 'true';btn.addEventListener('click', () => selectLetter(letter));row.append(btn);@@ -407,8 +557,29 @@ async function boot() {wrap.append(h, p, row);railEl.append(wrap);}+ renderLetterBest();};+ // The best score a letter has reached is worth seeing: it turns 26 identical+ // squares into a map of where the practice actually is. The sliver under the+ // letter is the score, and the label says it out loud for a screen reader.+ function renderLetterBest() {+ for (const btn of document.querySelectorAll('.sm-letter')) {+ const letter = btn.dataset.char;+ const best = progress.best[letter];+ const held = progress.passed[letter];+ btn.style.setProperty('--sm-best', `${Math.max(0, Math.min(100, best ?? 0))}%`);+ btn.dataset.tried = best == null ? 'false' : 'true';+ const label = held+ ? `Practise the letter ${letter}, already held correctly`+ : best == null+ ? `Practise the letter ${letter}, not attempted yet`+ : `Practise the letter ${letter}, best score ${best} of 100`;+ btn.setAttribute('aria-label', label);+ btn.title = label;+ }+ }+const progressEl = $('#sm-progress');const progressBar = $('#sm-progress-bar');function renderProgress() {@@ -424,15 +595,16 @@ async function boot() {// ── Controls ─────────────────────────────────────────────────────────────cameraBtn?.addEventListener('click', () => (running ? stopCamera() : startCamera()));- $('#sm-replay')?.addEventListener('click', () => showOnAvatar(current));+ replayBtn?.addEventListener('click', () => showOnAvatar(current));$('#sm-reset')?.addEventListener('click', () => {progress.passed = {};progress.best = {};writeJSON(PROGRESS_KEY, progress);document.querySelectorAll('.sm-letter[data-passed]').forEach((el) => el.removeAttribute('data-passed'));+ renderLetterBest();renderProgress();- setStatus('Progress cleared.');+ setStatus('Progress cleared. Every letter is back to unpractised.');});const handBtns = document.querySelectorAll('[data-hand]');@@ -450,7 +622,7 @@ async function boot() {document.addEventListener('keydown', (e) => {if (e.metaKey || e.ctrlKey || e.altKey) return;const tag = e.target?.tagName;- if (tag === 'INPUT' || tag === 'TEXTAREA') return;+ if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || e.target?.isContentEditable) return;const key = e.key.toUpperCase();if (LETTER_NOTES[key]) {selectLetter(key);@@ -459,6 +631,7 @@ async function boot() {});// ── Boot ─────────────────────────────────────────────────────────────────+ setReplayable(false);buildRail();renderProgress();await mountStage();diff --git a/src/signal-detail.js b/src/signal-detail.jsindex 4f263b525..266dd01d1 100644--- a/src/signal-detail.js+++ b/src/signal-detail.js@@ -259,7 +259,7 @@ function wireSubscribe() {function errorState(msg) {const root = $('#sd-root');root.setAttribute('aria-busy', 'false');- root.innerHTML = `<div class="sm-empty"><h2>${escapeHtml(msg)}</h2><p>This feed may have been paused or never existed.</p><a class="sm-cta" href="/signals">Browse all feeds →</a></div>`;+ root.innerHTML = `<div class="sm-empty"><h1 id="sd-title" class="sd-error-title">${escapeHtml(msg)}</h1><p>This feed may have been paused, made unlisted, or never existed.</p><div class="sm-empty-actions"><a class="sm-cta" href="/signals">Browse all feeds →</a></div></div>`;}async function loadAgents() {diff --git a/src/signals.css b/src/signals.cssindex d441105ae..41e6ac129 100644--- a/src/signals.css+++ b/src/signals.css@@ -68,19 +68,34 @@/* ── Status (loading / empty / error) ─────────────────────────────────────── */.sm-status { margin: 0 0 16px; padding: 14px 16px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; border: 1px solid var(--line, rgba(255,255,255,0.1)); background: var(--surface-1, rgba(255,255,255,0.03)); color: var(--ink-dim, #aab); }.sm-status.is-error { border-color: color-mix(in srgb, var(--sm-loss) 40%, transparent); background: color-mix(in srgb, var(--sm-loss) 8%, transparent); color: var(--sm-loss); }-.sm-status .sm-retry { margin-left: 10px; appearance: none; cursor: pointer; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 8px; padding: 5px 11px; font: 600 12px/1 var(--body, sans-serif); }+.sm-status .sm-retry { margin-left: 10px; appearance: none; cursor: pointer; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 8px; padding: 5px 11px; font: 600 12px/1 var(--body, sans-serif); transition: background 0.14s, transform 0.1s; }+.sm-status .sm-retry:hover { background: color-mix(in srgb, currentColor 14%, transparent); }+.sm-status .sm-retry:active { transform: translateY(1px); }+.sm-status .sm-retry:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }.sm-empty { text-align: center; padding: 60px 20px; }-.sm-empty h2 { margin: 0 0 8px; font: 600 20px/1.2 var(--display, sans-serif); color: var(--ink-bright, #fff); }+/* .sd-error-title is the detail page's not-found heading: an h1, because the+ shell's aria-labelledby points at it, sized like the empty-state h2 it sits+ in rather than like a hero title. */+.sm-empty h2, .sm-empty .sd-error-title { margin: 0 0 8px; font: 600 20px/1.2 var(--display, sans-serif); color: var(--ink-bright, #fff); letter-spacing: normal; }.sm-empty p { margin: 0 auto 18px; max-width: 460px; color: var(--ink-dim, #9aa); line-height: 1.6; font-size: 14px; }-.sm-empty .sm-cta { display: inline-block; text-decoration: none; font: 600 13px/1 var(--body, sans-serif); color: #160d28; background: var(--sm-accent); padding: 11px 18px; border-radius: 10px; }+.sm-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }+.sm-empty .sm-cta { display: inline-block; text-decoration: none; font: 600 13px/1 var(--body, sans-serif); color: #160d28; background: var(--sm-accent); padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; transition: background 0.14s, transform 0.1s, border-color 0.14s; }[data-theme='dark'] .sm-empty .sm-cta { color: #fff; background: color-mix(in srgb, var(--sm-accent) 72%, #000); }+.sm-empty .sm-cta:hover { background: color-mix(in srgb, var(--sm-accent) 86%, #fff); }+.sm-empty .sm-cta:active { transform: translateY(1px); }+.sm-empty .sm-cta:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: 3px; }+/* Secondary action: the publisher's own path in, styled as an outline so the+ reader's first move stays the leaderboard. */+.sm-empty .sm-cta.is-ghost { color: var(--ink, #e8e8ee); background: transparent; border-color: var(--line, rgba(255, 255, 255, 0.16)); }+[data-theme='dark'] .sm-empty .sm-cta.is-ghost { color: var(--ink, #e8e8ee); background: transparent; }+.sm-empty .sm-cta.is-ghost:hover { background: var(--sm-accent-soft); border-color: var(--sm-stroke); color: var(--ink-bright, #fff); }/* ── Grid + cards ─────────────────────────────────────────────────────────── */-.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }+.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 16px; }@media (max-width: 480px) { .sm-grid { grid-template-columns: 1fr; } }.sm-card {- position: relative; display: flex; flex-direction: column; gap: 14px;+ position: relative; min-width: 0; display: flex; flex-direction: column; gap: 14px;background: var(--surface-1, rgba(255,255,255,0.03)); border: 1px solid var(--line, rgba(255,255,255,0.08));border-radius: 16px; padding: 18px; text-decoration: none; color: inherit;transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;@@ -99,8 +114,9 @@.sm-avatar { width: 44px; height: 44px; border-radius: 11px; flex: none; object-fit: cover; background: var(--surface-2, rgba(255,255,255,0.06)); border: 1px solid var(--line, rgba(255,255,255,0.1)); }.sm-card-head .sm-id { min-width: 0; }.sm-feed-title { margin: 0; font: 600 15px/1.25 var(--display, sans-serif); color: var(--ink-bright, #fff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.sm-pub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--ink-dim, #9aa); }-.sm-verified { display: inline-flex; align-items: center; gap: 3px; font: 600 10.5px/1 var(--mono, monospace); color: var(--sm-win); background: color-mix(in srgb, var(--sm-win) 12%, transparent); border: 1px solid color-mix(in srgb, var(--sm-win) 30%, transparent); border-radius: 6px; padding: 3px 6px; }+.sm-pub { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 3px; font-size: 12px; color: var(--ink-dim, #9aa); }+.sm-pub-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.sm-verified { flex: none; display: inline-flex; align-items: center; gap: 3px; font: 600 10.5px/1 var(--mono, monospace); color: var(--sm-win); background: color-mix(in srgb, var(--sm-win) 12%, transparent); border: 1px solid color-mix(in srgb, var(--sm-win) 30%, transparent); border-radius: 6px; padding: 3px 6px; }.sm-edge { display: flex; align-items: baseline; gap: 8px; }.sm-edge-score { font: 700 30px/1 var(--display, sans-serif); color: var(--ink-bright, #fff); }@@ -116,10 +132,11 @@.sm-metric .v.loss { color: var(--sm-loss); }.sm-metric .v.muted { color: var(--ink-dim, #9aa); }-.sm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line, rgba(255,255,255,0.06)); }-.sm-price { display: flex; flex-direction: column; gap: 2px; }+.sm-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line, rgba(255,255,255,0.06)); }+.sm-card-foot > * { min-width: 0; }+.sm-price { display: flex; flex-direction: column; gap: 2px; min-width: 0; }.sm-price .amt { font: 600 15px/1 var(--display, sans-serif); color: var(--ink-bright, #fff); }-.sm-price .per { font: 500 11px/1 var(--mono, monospace); color: var(--ink-dim, #889); }+.sm-price .per { font: 500 11px/1 var(--mono, monospace); color: var(--ink-dim, #889); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sm-thin { font: 600 10.5px/1 var(--mono, monospace); color: var(--sm-flat); background: var(--surface-2, rgba(255,255,255,0.05)); border-radius: 6px; padding: 4px 7px; }.sm-view { font: 600 12.5px/1 var(--body, sans-serif); color: var(--sm-accent); white-space: nowrap; }.sm-card:hover .sm-view { text-decoration: underline; }diff --git a/src/signals.js b/src/signals.jsindex c943ead96..47883effa 100644--- a/src/signals.js+++ b/src/signals.js@@ -37,12 +37,12 @@ function syncControls() {for (const btn of document.querySelectorAll('#sm-sort .sm-seg-btn')) {const on = btn.dataset.sort === state.sort;btn.classList.toggle('is-active', on);- btn.setAttribute('aria-selected', on ? 'true' : 'false');+ btn.setAttribute('aria-pressed', on ? 'true' : 'false');}for (const btn of document.querySelectorAll('#sm-net .sm-seg-btn')) {const on = btn.dataset.net === state.network;btn.classList.toggle('is-active', on);- btn.setAttribute('aria-selected', on ? 'true' : 'false');+ btn.setAttribute('aria-pressed', on ? 'true' : 'false');}}@@ -108,7 +108,7 @@ function card(f) {${avatar}<div class="sm-id"><h3 class="sm-feed-title">${escapeHtml(f.title)}</h3>- <div class="sm-pub">${escapeHtml(f.publisher.name)} ${verified}</div>+ <div class="sm-pub"><span class="sm-pub-name">${escapeHtml(f.publisher.name)}</span>${verified}</div></div></div><div>@@ -131,9 +131,13 @@ function emptyState() {$('#sm-grid').innerHTML = `<div class="sm-empty" style="grid-column:1/-1"><h2>No live feeds yet</h2>- <p>Verified traders haven't published a feed on ${state.network} yet. Build a verified track record on the- leaderboard, then publish your signals from your agent's wallet — your followers' agents pay per signal and auto-mirror.</p>- <a class="sm-cta" href="/leaderboard">See the trader leaderboard →</a>+ <p>No verified trader has published a feed on ${state.network} yet. Build a verified track record on the+ leaderboard, then publish your signals from your agent's wallet: your followers' agents pay per signal and+ auto-mirror the fill.</p>+ <div class="sm-empty-actions">+ <a class="sm-cta" href="/leaderboard">See the trader leaderboard →</a>+ <a class="sm-cta is-ghost" href="/agent-wallet#signals">Publish your feed</a>+ </div></div>`;}@@ -209,6 +213,10 @@ function bindControls() {function init() {readUrl();+ // An unrecognised ?sort= / ?network= falls back to the defaults above, so+ // rewrite the address bar to the view actually rendered: a shared link is+ // only shareable if it names the board the next reader will see.+ writeUrl();syncControls();bindControls();load();diff --git a/src/sniper-experiments.css b/src/sniper-experiments.cssindex 72de2413e..bb53fbee1 100644--- a/src/sniper-experiments.css+++ b/src/sniper-experiments.css@@ -184,16 +184,22 @@.xp-stall-blocking b { color: var(--cv-red); }-/* The record cell stacks up to four lines (W/L, open, moon bags, paper). Give it- * a floor so none of them overflow into the conditions column beside it. */-.xp-table td:nth-child(3) { min-width: 130px; }-/* ── P&L ─────────────────────────────────────────────────────────────────── */.xp-pos { color: var(--cv-green); font-weight: 600; }.xp-neg { color: var(--cv-red); font-weight: 600; }/* ── table + rows ────────────────────────────────────────────────────────── */-.xp-table { width: 100%; font-size: 0.875rem; }+/* Nine columns, three of them prose. The shared .cv-table floor of 540px packs+ * them tight enough that every entry-condition line wraps mid-phrase; this is+ * the width the board actually needs before its own overflow-x container takes+ * over on a narrow screen. */+.xp-table { width: 100%; min-width: 860px; font-size: 0.875rem; }++/* .cv-table is built for the sortable, row-clickable market tables and hands+ * every header and row a pointer cursor. Nothing on this board sorts and no row+ * navigates, so that cursor promises an interaction that does not exist. */+.xp-table th,+.xp-table tbody tr { cursor: default; }/* The shared .cv-table sets `white-space: nowrap` and right-aligns every cell,* which suits a grid of figures but not this board: the first three columns hold@@ -279,7 +285,34 @@.xp-tile i { font-size: 0.75rem; font-style: normal; color: var(--cv-text-3); }@media (max-width: 640px) {- .xp-cond { max-width: none; }+ .xp-cond { width: auto; }.xp-table { font-size: 0.8125rem; }.xp-table td { padding: 8px; }}++/* ── first paint ─────────────────────────────────────────────────────────── */+/* Skeleton lines share the shared .cv-skel shimmer (and its reduced-motion+ * opt-out) and only add the geometry, so loading reads as the same system as+ * every other crypto page. */+.xp-skel-line {+ display: block;+ height: 0.75rem;+ border-radius: var(--cv-radius-sm);+}++.xp-skel-lg { height: 1.25rem; }+.xp-skel-tile { gap: 8px; }++/* ── degraded refresh ────────────────────────────────────────────────────── */+/* Shown only when a poll fails over a board that already has numbers on it. */+.xp-alert {+ margin: 0 0 12px;+ padding: 8px 12px;+ border: 1px solid color-mix(in srgb, var(--cv-red) 35%, var(--cv-border));+ border-radius: var(--cv-radius-md);+ background: var(--cv-red-soft);+ color: var(--cv-text-2);+ flex-wrap: wrap;+}++.xp-alert .dot { background: var(--cv-red); }diff --git a/src/sniper-experiments.js b/src/sniper-experiments.jsindex b463cd814..7b8dd17c3 100644--- a/src/sniper-experiments.js+++ b/src/sniper-experiments.js@@ -18,6 +18,16 @@ const WINDOWS = [let windowKey = '7d';let timer = null;+// Monotonic request id. Switching windows fires a new fetch while the previous+// one is still in flight, and the two can land out of order: without this the+// slower 7d response overwrites the 24h board the user just asked for.+let reqSeq = 0;+// Whether a real board has ever rendered. A first-load failure gets the full+// error card (there is nothing to keep); a failed refresh on top of good data+// keeps the board and says the numbers are stale, because blanking a working+// dashboard over one dropped poll is worse than showing it a minute old.+let hasData = false;+let lastGoodAt = null;async function getJson(url) {const res = await fetch(url, { headers: { accept: 'application/json' } });@@ -29,6 +39,41 @@ async function getJson(url) {return res.json();}+// What actually went wrong, in a sentence the reader can act on. `fetch` throws a+// bare "Failed to fetch" for every transport failure, which tells nobody+// anything; an HTTP status tells us whether waiting will help.+function describeFailure(err) {+ const status = err && err.status;+ if (status === 429) {+ return {+ headline: 'Rate limited',+ detail: 'This scoreboard is public and rate limited per IP. It refreshes itself in a few seconds.',+ };+ }+ if (status === 404) {+ return {+ headline: 'Scoreboard endpoint not found',+ detail: 'The strategy feed moved or is not deployed on this host.',+ };+ }+ if (typeof status === 'number' && status >= 500) {+ return {+ headline: 'The scoreboard service is down',+ detail: `The fleet feed answered ${status}. The trading agents keep running; only this view is affected.`,+ };+ }+ if (typeof status === 'number') {+ return {+ headline: "Couldn't load the scoreboard",+ detail: `The fleet feed answered ${status}.`,+ };+ }+ return {+ headline: "Couldn't reach the fleet feed",+ detail: 'Nothing answered at /api/sniper/experiments. Check your connection.',+ };+}+function sol(n) {if (n == null || !Number.isFinite(Number(n))) return '·';const v = Number(n);@@ -128,6 +173,59 @@ function exitLine(x) {return bits.join(' · ');}+// First paint. The board's own fetch reads live SOL balances off an RPC, so the+// gap between DOMContentLoaded and data is seconds, not milliseconds: without+// this the page sits as a headline over a blank void long enough to read as+// broken. Shape-matched to the real layout so nothing jumps when data lands.+function renderSkeleton() {+ const tile = `+ <div class="cv-card xp-tile xp-skel-tile">+ <span class="cv-skel xp-skel-line" style="width:64%"></span>+ <b class="cv-skel xp-skel-line xp-skel-lg" style="width:46%"></b>+ <i class="cv-skel xp-skel-line" style="width:78%"></i>+ </div>`;+ $('xp-summary').innerHTML = `<div class="xp-tiles">${tile.repeat(6)}</div>`;+ const cell = (w) => `<td><span class="cv-skel xp-skel-line" style="width:${w}"></span></td>`;+ const row = `<tr>${cell('82%')}${cell('90%')}${cell('60%')}${cell('50%')}${cell('62%')}${cell('50%')}${cell('55%')}${cell('45%')}${cell('58%')}</tr>`;+ $('xp-board').innerHTML = `+ <div class="cv-card" style="overflow-x:auto">+ <table class="cv-table xp-table">+ <thead>+ <tr>+ <th>Strategy</th><th>Entry conditions</th><th>Record</th><th>Win rate</th>+ <th>Realized</th><th>ROI</th><th>Avg trade</th><th>Avg hold</th><th>Last trade</th>+ </tr>+ </thead>+ <tbody>${row.repeat(5)}</tbody>+ </table>+ </div>`;+ $('xp-board').setAttribute('aria-busy', 'true');+ $('xp-updated').textContent = 'Loading the fleet record\u2026';+}++// A refresh that fails on top of a good board. The numbers stay (a minute-old+// scoreboard beats a blank one) but they stop claiming to be current, and the+// reader gets the same manual retry the error card offers.+function renderStaleNotice(err) {+ const el = $('xp-alert');+ if (!el) return;+ const { headline } = describeFailure(err);+ const since = lastGoodAt ? ago(new Date(lastGoodAt).toISOString()) : 'a moment ago';+ el.innerHTML = `+ <span class="dot" aria-hidden="true"></span>+ <span>${esc(headline)}. Showing the last good read from ${esc(since)}.</span>+ <button type="button" class="cv-linkbtn" data-retry>Retry now</button>`;+ el.hidden = false;+ el.querySelector('[data-retry]').addEventListener('click', refresh);+}++function clearStaleNotice() {+ const el = $('xp-alert');+ if (!el) return;+ el.hidden = true;+ el.innerHTML = '';+}+function renderControls() {$('xp-controls').innerHTML = `<div class="xp-seg" role="group" aria-label="Time window">@@ -207,9 +305,13 @@ function renderSummary(experiments, masterWallet) {function renderBoard(experiments) {if (!experiments.length) {$('xp-board').innerHTML = `- <div class="cv-card" style="text-align:center;padding:32px">+ <div class="cv-empty"><p style="margin:0 0 6px;font-weight:600">No strategies armed on this network yet</p>- <p style="margin:0;color:var(--cv-text-3)">Arm an agent on <a href="/arm">/arm</a> and its record shows up here automatically.</p>+ <p style="margin:0">+ Every arm on this board is a real agent trading its own wallet.+ <a href="/arm">Arm an agent</a> and its record appears here on its first fill,+ or read how the fleet is scored in the <a href="/trading">trading hub</a>.+ </p></div>`;return;}@@ -258,7 +360,18 @@ function renderJudgment(judgment) {const el = $('xp-judgment');if (!el) return;if (!judgment || !judgment.length) {- el.innerHTML = '';+ // The LLM arms are half of what this page is about, so "no verdicts in this+ // window" is a fact worth stating rather than a section that quietly vanishes.+ el.innerHTML = `+ <h2 class="cv-h2">Judgment ledger</h2>+ <div class="cv-empty">+ <p style="margin:0 0 6px;font-weight:600">No LLM verdicts in this window</p>+ <p style="margin:0">+ The judge-driven arms record a verdict per launch they evaluate, buys and+ skips alike. Widen the window above, or read how the arms are scored in the+ <a href="/trading">trading hub</a>.+ </p>+ </div>`;return;}const rows = judgment@@ -293,66 +406,46 @@ function renderJudgment(judgment) {</div>`;}+function renderError(err) {+ const { headline, detail } = describeFailure(err);+ $('xp-summary').innerHTML = '';+ $('xp-judgment').innerHTML = '';+ $('xp-board').innerHTML = `+ <div class="cv-empty">+ <p style="margin:0 0 6px;font-weight:600">${esc(headline)}</p>+ <p style="margin:0 0 14px">${esc(detail)} It retries on its own every ${REFRESH_MS / 1000}s.</p>+ <button type="button" class="cv-linkbtn" data-retry>Try again now</button>+ </div>`;+ $('xp-board').querySelector('[data-retry]').addEventListener('click', refresh);+ $('xp-updated').textContent = 'Not updated: the fleet feed is unreachable.';+}+async function refresh() {+ const seq = ++reqSeq;+ if (!hasData) $('xp-board').setAttribute('aria-busy', 'true');try {const data = await getJson(`/api/sniper/experiments?network=mainnet&window=${encodeURIComponent(windowKey)}`);+ // A window switch fired while this was in flight: that newer answer owns the+ // board now, and painting this one would silently show the wrong window.+ if (seq !== reqSeq) return;+ clearStaleNotice();renderSummary(data.experiments, data.master_wallet);renderBoard(data.experiments);renderJudgment(data.judgment);+ hasData = true;+ lastGoodAt = Date.now();$('xp-updated').textContent = `Updated ${new Date(data.t).toLocaleTimeString()} · real on-chain fills only`;} catch (err) {- $('xp-board').innerHTML = `- <div class="cv-card" style="text-align:center;padding:32px">- <p style="margin:0 0 6px;font-weight:600">Couldn't load the scoreboard</p>- <p style="margin:0;color:var(--cv-text-3)">${esc(err.message)}. Retrying automatically.</p>- </div>`;+ if (seq !== reqSeq) return;+ if (hasData) renderStaleNotice(err);+ else renderError(err);+ } finally {+ if (seq === reqSeq) $('xp-board').setAttribute('aria-busy', 'false');}}-function injectStyles() {- const css = `- .xp-seg{display:inline-flex;gap:4px;background:var(--cv-bg-2,rgba(255,255,255,.04));border:1px solid var(--cv-border,rgba(255,255,255,.08));border-radius:10px;padding:3px}- .xp-seg-btn{appearance:none;border:0;background:transparent;color:var(--cv-text-2,#aaa);font:inherit;font-size:12.5px;padding:5px 12px;border-radius:8px;cursor:pointer;transition:background .15s,color .15s}- .xp-seg-btn:hover{color:var(--cv-text,#eee)}- .xp-seg-btn:focus-visible{outline:2px solid var(--cv-accent,#7c6cff);outline-offset:1px}- .xp-seg-btn.on{background:var(--cv-bg-3,rgba(255,255,255,.09));color:var(--cv-text,#fff)}- .xp-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}- .xp-tile{display:flex;flex-direction:column;gap:2px;padding:14px 16px}- .xp-tile span{font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--cv-text-3,#888)}- .xp-tile b{font-size:19px;font-weight:650}- .xp-tile i{font-style:normal;font-size:12px;color:var(--cv-text-3,#888)}- .xp-table{width:100%;border-collapse:collapse;font-size:13px;min-width:860px}- .xp-table th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--cv-text-3,#888);padding:8px 10px;border-bottom:1px solid var(--cv-border,rgba(255,255,255,.08))}- .xp-table td{padding:10px;border-bottom:1px solid var(--cv-border,rgba(255,255,255,.05));vertical-align:top}- .xp-table tr:last-child td{border-bottom:0}- .xp-table tr:hover td{background:var(--cv-bg-2,rgba(255,255,255,.03))}- .xp-label{font-weight:600}- .xp-agent{font-size:12px;color:var(--cv-text-3,#888);margin-top:2px}- .xp-agent a{color:inherit}- .xp-agent a:hover{color:var(--cv-text,#eee)}- .xp-wallet{font-size:11px;color:var(--cv-text-3,#888);margin-top:3px;display:flex;gap:6px;align-items:baseline;font-variant-numeric:tabular-nums}- .xp-wallet a{color:inherit;text-decoration:none;border-bottom:1px dotted var(--cv-border,rgba(255,255,255,.25))}- .xp-wallet a:hover{color:var(--cv-text,#eee)}- .xp-wallet-none{opacity:.6}- .xp-cond{max-width:300px;color:var(--cv-text-2,#bbb)}- .xp-cond-sub{font-size:11.5px;color:var(--cv-text-3,#888);margin-top:3px}- .xp-badge{display:inline-block;font-size:10.5px;padding:1px 7px;border-radius:99px;border:1px solid var(--cv-border,rgba(255,255,255,.12));vertical-align:1px}- .xp-badge-llm{color:#c9b8ff;border-color:rgba(150,120,255,.4)}- .xp-badge-rules{color:var(--cv-text-3,#999)}- .xp-pos{color:#4ade80}- .xp-neg{color:#f87171}- .xp-open{font-size:11px;color:#93c5fd}- .xp-paper{font-size:11px;color:var(--cv-text-3,#888);margin-top:3px}- .xp-paused{font-size:10.5px;color:var(--cv-text-3,#888);font-weight:400}- .xp-off td{opacity:.55}- `;- const el = document.createElement('style');- el.textContent = css;- document.head.appendChild(el);-}--injectStyles();renderControls();+renderSkeleton();refresh();timer = setInterval(refresh, REFRESH_MS);document.addEventListener('visibilitychange', () => {diff --git a/src/splat-viewer.js b/src/splat-viewer.jsindex 2e066a94f..1d610f1d0 100644--- a/src/splat-viewer.js+++ b/src/splat-viewer.js@@ -29,12 +29,23 @@ async function teardown() {if (!_viewer) return;const v = _viewer;_viewer = null;+ // dispose() nulls viewer.renderer partway through, so grab it first.+ const renderer = v.renderer;try {v.stop?.();// dispose() tears down the renderer then tries body.removeChild(rootElement),- // which throws for our nested host — everything we care about is gone by then.+ // which throws for our nested host. Everything we care about is gone by then.await v.dispose?.();} catch { /* harmless nested-root removeChild from the splat lib */ }+ // renderer.dispose() frees the three.js caches but leaves the WebGL context+ // alive, and the removeChild throw above aborts the lib's own final cleanup+ // before it can finish. Without an explicit release, every scene swap leaks a+ // live GL context, and a browser only grants a page a handful of those before+ // it starts reclaiming the oldest ones out from under a running scene.+ try {+ renderer?.forceContextLoss?.();+ renderer?.dispose?.();+ } catch { /* context already lost */ }if (_objectUrl) { URL.revokeObjectURL(_objectUrl); _objectUrl = null; }const host = HOST();if (host) host.innerHTML = '';@@ -68,7 +79,7 @@ function setLive(label) {function setDownload(url, filename) {const btn = $('#sp-download');if (_downloadUrl && _downloadUrl !== url) URL.revokeObjectURL(_downloadUrl);- if (!url) { btn.hidden = true; _downloadUrl = null; return; }+ if (!url) { btn.hidden = true; btn.removeAttribute('href'); _downloadUrl = null; return; }_downloadUrl = url;btn.href = url;btn.download = filename || 'avatar.splat';@@ -84,6 +95,9 @@ function formatFor(name, GS) {}// ── Core render ──────────────────────────────────────────────────────────────+const CAMERA_START = [0, 0, 3.2];+const CAMERA_TARGET = [0, 0, 0];+async function renderBuffer(buffer, { label, format }) {_lastRender = { buffer, format, label };setLoading('Decoding radiance field…', `${(buffer.byteLength / 1024 / 1024).toFixed(1)} MB`);@@ -100,8 +114,8 @@ async function renderBuffer(buffer, { label, format }) {useBuiltInControls: true,gpuAcceleratedSort: false,cameraUp: [0, 1, 0],- initialCameraPosition: [0, 0, 3.2],- initialCameraLookAt: [0, 0, 0],+ initialCameraPosition: CAMERA_START,+ initialCameraLookAt: CAMERA_TARGET,});_viewer = viewer;try {@@ -111,17 +125,43 @@ async function renderBuffer(buffer, { label, format }) {progressiveLoad: false,});viewer.start();+ watchContextLoss(viewer);setLive(label);+ return true;} catch (err) {await teardown();setError('That file isn’t a valid splat', 'Expected a .ply, .splat, or .ksplat Gaussian-splat scene. Check the file and try again.');console.error('[splat] decode failed', err);+ return false;}}-// Rebuilding the viewer from the cached buffer is the most reliable way to reset-// the camera across splat-lib versions.+// A GPU driver reset or a browser-reclaimed context leaves a live canvas painting+// nothing. Say so instead of showing a frozen frame, and offer the way back.+function watchContextLoss(viewer) {+ const canvas = viewer.renderer?.domElement;+ if (!canvas) return;+ canvas.addEventListener('webglcontextlost', (e) => {+ e.preventDefault();+ if (_viewer !== viewer) return;+ teardown();+ setError('The 3D context was lost', 'Your browser released the WebGL context, usually after a GPU reset or heavy memory pressure. Load the scene again to restore it.');+ }, { once: true });+}++// Reset the camera on the live viewer. Rebuilding from the cached buffer also+// works, but it drops and recreates a WebGL context for what is a two-line+// transform change, and the stage flashes through the loading overlay.function recenter() {+ const v = _viewer;+ if (v?.camera && v.controls) {+ v.camera.position.set(...CAMERA_START);+ v.controls.target.set(...CAMERA_TARGET);+ v.camera.lookAt(v.controls.target);+ v.controls.update();+ v.forceRenderNextFrame?.();+ return;+ }if (_lastRender) renderBuffer(_lastRender.buffer, _lastRender);}@@ -170,9 +210,12 @@ async function loadFromUrl(url, label) {console.error('[splat] fetch failed', err);return;}- const name = parsed.pathname.split('/').pop() || 'remote';- await renderBuffer(buffer, { label: label || name, format: formatFor(name, GS) });- setDownload(null);+ const name = parsed.pathname.split('/').pop() || 'remote.splat';+ const ok = await renderBuffer(buffer, { label: label || name, format: formatFor(name, GS) });+ // The bytes are already in memory, so a remote scene is as saveable as an+ // uploaded one. Handing back the fetched buffer also spares the user a second+ // round trip to a host that may not allow one.+ setDownload(ok ? URL.createObjectURL(new Blob([buffer], { type: 'application/octet-stream' })) : null, name);}async function loadFromFile(file) {@@ -181,8 +224,8 @@ async function loadFromFile(file) {let buffer;try { buffer = await file.arrayBuffer(); }catch (err) { setError('Couldn’t read that file', err.message); return; }- await renderBuffer(buffer, { label: file.name, format: formatFor(file.name, GS) });- setDownload(URL.createObjectURL(new Blob([buffer])), file.name);+ const ok = await renderBuffer(buffer, { label: file.name, format: formatFor(file.name, GS) });+ setDownload(ok ? URL.createObjectURL(new Blob([buffer], { type: 'application/octet-stream' })) : null, file.name);}// ── Procedural samples (antimatter15 .splat layout, 32 bytes/splat) ──────────@@ -261,8 +304,8 @@ async function loadSample(kind) {const isBust = kind === 'bust';const buffer = isBust ? sampleBust() : sampleShell();const label = isBust ? 'Synthetic head bust · 14,000 splats' : 'Radiance shell · 6,000 splats';- await renderBuffer(buffer, { label, format: GS.SceneFormat.Splat });- setDownload(URL.createObjectURL(new Blob([buffer], { type: 'application/octet-stream' })), isBust ? 'sample-bust.splat' : 'sample-shell.splat');+ const ok = await renderBuffer(buffer, { label, format: GS.SceneFormat.Splat });+ setDownload(ok ? URL.createObjectURL(new Blob([buffer], { type: 'application/octet-stream' })) : null, isBust ? 'sample-bust.splat' : 'sample-shell.splat');}// ── Wiring ───────────────────────────────────────────────────────────────────@@ -278,6 +321,9 @@ function init() {});$('#sp-pick').addEventListener('click', () => $('#sp-file').click());+ // The whole idle panel is a mouse target, and the button inside it is the+ // keyboard one. Stop the button's click bubbling or the picker opens twice.+ $('#sp-idle-pick').addEventListener('click', (e) => { e.stopPropagation(); $('#sp-file').click(); });$('#sp-idle').addEventListener('click', () => $('#sp-file').click());$('#sp-file').addEventListener('change', (e) => {const file = e.target.files?.[0];@@ -312,7 +358,10 @@ function init() {loadFromUrl(src, p.get('name') || undefined);}- window.addEventListener('beforeunload', () => { teardown(); setDownload(null); });+ // pagehide, not beforeunload: an unconditional beforeunload listener opts the+ // page out of the back/forward cache, so returning to it would cost a full+ // reload of the splat engine.+ window.addEventListener('pagehide', () => { teardown(); setDownload(null); });}if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);diff --git a/src/symphony.css b/src/symphony.cssindex fb8345945..ed5d01507 100644--- a/src/symphony.css+++ b/src/symphony.css@@ -232,6 +232,42 @@ a.sy-row-link:focus-visible { outline: 2px solid var(--sym-money); outline-offse}.sy-empty strong { color: var(--ink); }.sy-empty a { color: var(--sym-money); }+.sy-empty p { margin: 0 0 8px; }+.sy-empty p:last-child { margin-bottom: 0; }++/* The feed is down: a red-edged block, not the same quiet-economy card, so the+ two states are never mistaken for each other at a glance. */+.sy-empty-error { border-color: var(--sym-alarm); border-style: solid; }+.sy-empty-error strong { color: var(--sym-alarm); }+.sy-retry {+ padding: 8px 18px; border-radius: 999px;+ background: transparent; color: var(--ink-bright);+ border: 1px solid var(--stroke-strong); font: inherit; font-size: 13px; cursor: pointer;+ transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;+}+.sy-retry:hover { color: var(--sym-money); border-color: var(--sym-money); background: rgba(67, 217, 163, 0.08); }+.sy-retry:active { transform: translateY(1px); }+.sy-retry:focus-visible { outline: 2px solid var(--sym-money); outline-offset: 2px; }+.sy-retry[aria-busy="true"] { color: var(--ink-dim); cursor: progress; }++/* Loading: the score's own shape, greyed out, rather than an empty strip that+ reads as "nothing ever happens here". */+.sy-skeleton { display: flex; flex-direction: column; }+.sy-skel-row {+ height: 47px; border-bottom: 1px solid var(--stroke);+ background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);+ background-size: 400% 100%;+ animation: sy-shimmer 1.4s ease-in-out infinite;+}+.sy-skel-row:nth-child(2) { animation-delay: 0.08s; }+.sy-skel-row:nth-child(3) { animation-delay: 0.16s; }+.sy-skel-row:nth-child(4) { animation-delay: 0.24s; }+.sy-skel-row:nth-child(5) { animation-delay: 0.32s; }+.sy-skel-row:nth-child(6) { animation-delay: 0.4s; }+@keyframes sy-shimmer {+ from { background-position: 100% 0; }+ to { background-position: 0 0; }+}/* Visually hidden, still announced: the throttled live region that narratesone arrival at a time for screen readers. */@@ -255,4 +291,6 @@ a.sy-row-link:focus-visible { outline: 2px solid var(--sym-money); outline-offse@media (prefers-reduced-motion: reduce) {.sy-live-dot { animation: none; }.sy-row { animation: none; }+ .sy-solo-dot { animation: none; }+ .sy-skel-row { animation: none; background: var(--surface-1); }}diff --git a/src/symphony.js b/src/symphony.jsindex b0a3ee41d..c4e56fb35 100644--- a/src/symphony.js+++ b/src/symphony.js@@ -52,6 +52,8 @@ const state = {source: null, // EventSourcepollTimer: null,status: 'connecting',+ loading: true, // a read is in flight and there is nothing on screen yet+ feedOk: false, // the LAST feed read succeeded; gates "live" from ever being a liefilter: {}, // solo mode: {} = the whole platform, else { agentId } | { actor }};@@ -63,6 +65,36 @@ function loadJson(key, fallback) {try { return JSON.parse(localStorage.getItem(key)) ?? fallback; } catch { return fallback; }}+/* ── i18n ownership ────────────────────────────────────────────────────── */++/*+ * The page ships its copy as static HTML annotated with data-i18n, and the+ * catalog pass lands AFTER an async /api/locale fetch. Anything this script+ * writes into an annotated node before then is silently reverted: the status+ * pill snaps back to "connecting" while the stream is live, and a pressed play+ * button snaps back to "Play the economy" while audio is running.+ * `data-i18n-owned="1"` is this codebase's documented opt-out (src/i18n.js):+ * claim a node while the script owns its text, hand it back when it returns to+ * its declared copy so a later locale switch still translates it.+ */+function i18nText(key, fallback) {+ const v = window.threewsI18n?.t?.(key);+ return typeof v === 'string' && v && v !== key ? v : fallback;+}++function claimI18n(el, text) {+ if (!el) return;+ el.setAttribute('data-i18n-owned', '1');+ el.textContent = text;+}++function releaseI18n(el, text) {+ if (!el) return;+ el.textContent = text;+ el.removeAttribute('data-i18n-owned');+ window.threewsI18n?.apply?.(el); // the catalog may have landed while owned+}+/* ── Audio engine ──────────────────────────────────────────────────────── */const audio = {@@ -424,6 +456,26 @@ function ledgerRowHTML(evt) {</div>`;}+// First paint is in flight. A blank strip where the score belongs reads as+// "nothing ever happens here"; six inert bars read as "the score is loading".+function loadingLedgerHTML() {+ return `<div class="sy-skeleton" aria-hidden="true">${'<div class="sy-skel-row"></div>'.repeat(6)}</div>`;+}++// The feed is unreachable. This must never borrow the quiet-economy copy+// below: "the economy is quiet" is a claim about the platform, and claiming it+// while we cannot see the platform at all is simply false.+function offlineLedgerHTML() {+ return `+ <div class="sy-empty sy-empty-error" role="alert">+ <p><strong>The live event feed is unreachable.</strong></p>+ <p>Nothing can be scored without it, so the stage is silent. The page+ keeps retrying by itself every ${Math.round(POLL_MS / 1000)} seconds.</p>+ <p><button type="button" class="sy-retry" id="sy-retry">Try again now</button></p>+ <p><a href="/pulse">Watch the Money Pulse</a> or <a href="/economy">see the economy dashboard</a>.</p>+ </div>`;+}+function emptyLedgerHTML() {const label = filterLabel(state.filter, state.events);if (label) {@@ -453,7 +505,18 @@ function emptyLedgerHTML() {function renderLedger() {const el = $('sy-ledger');if (!el) return;- el.innerHTML = state.events.length ? state.events.map(ledgerRowHTML).join('') : emptyLedgerHTML();+ if (state.events.length) {+ el.removeAttribute('aria-busy');+ el.innerHTML = state.events.map(ledgerRowHTML).join('');+ return;+ }+ if (state.loading) {+ el.setAttribute('aria-busy', 'true');+ el.innerHTML = loadingLedgerHTML();+ return;+ }+ el.removeAttribute('aria-busy');+ el.innerHTML = state.status === 'offline' ? offlineLedgerHTML() : emptyLedgerHTML();}// One newly-arrived event: insert a single node at the head and evict the tail.@@ -483,6 +546,28 @@ function announceEvent(evt) {el.textContent = d.detail ? `${d.title}, ${d.detail}` : d.title;}+/*+ * The status pill is derived, never assigned ad hoc. It used to be written from+ * four call sites and they disagreed: a page that had never once reached the+ * API showed "live (polling)", because the EventSource error handler set+ * "polling" before the offline guard downstream could read it. Two facts decide+ * it: whether the last feed read worked, and whether the SSE tail is open.+ */+function syncStatus() {+ if (!state.feedOk) {+ state.status = state.loading ? 'connecting' : 'offline';+ return;+ }+ if (state.source && state.source.readyState === 1) {+ state.status = 'live';+ return;+ }+ // The data on screen is real, but the tail is not open. Only claim the+ // polling fallback once it is genuinely running; otherwise we are still+ // connecting it.+ state.status = state.pollTimer ? 'polling' : 'connecting';+}+function renderStats() {const set = (id, v) => { const el = $(id); if (el) el.textContent = v; };set('sy-notes', String(state.notesPlayed));@@ -491,9 +576,13 @@ function renderStats() {const pill = $('sy-status');if (pill) {pill.dataset.status = state.status;- pill.textContent = state.status === 'live' ? 'live'+ // "connecting" is the only one of the four that ships as declared copy,+ // so it is the only one the catalog can translate; the pill is claimed+ // either way so the catalog pass cannot revert a live status to it.+ claimI18n(pill, state.status === 'live' ? 'live': state.status === 'polling' ? 'live (polling)'- : state.status === 'offline' ? 'offline' : 'connecting';+ : state.status === 'offline' ? 'offline'+ : i18nText('symphony.connecting', 'connecting'));}}@@ -509,6 +598,35 @@ function renderSoloChip() {document.body.classList.toggle('sy-soloing', Boolean(name));}+/*+ * The soloing sentence is translated as MARKUP, and every locale's value+ * carries its own EMPTY <strong id="sy-solo-label">. So the catalog pass does+ * not merely overwrite the participant's name, it replaces the element holding+ * it, and a deep link like /symphony?actor=Luna rendered "Soloing . Everything+ * else is muted."+ *+ * The i18n:change event alone cannot fix it: the catalog lands on its own+ * schedule and in testing it beat this module's own boot (event at 999ms,+ * listener registered at 1089ms), so half the time there is nothing listening+ * yet. Watching the bar covers both orders, and marking the sentence+ * script-owned is not an option because that would freeze it in English.+ */+function wireI18nRepaint() {+ window.addEventListener('i18n:change', () => {+ renderSoloChip();+ renderStats();+ });+ const bar = $('sy-solo-bar');+ if (!bar || typeof MutationObserver === 'undefined') return;+ // Writing the name back mutates the bar again; the equality guard makes that+ // second pass a no-op, so the observer settles instead of looping.+ new MutationObserver(() => {+ const name = filterLabel(state.filter, state.events);+ const label = $('sy-solo-label');+ if (name && label && label.textContent !== name) label.textContent = name;+ }).observe(bar, { childList: true, subtree: true });+}+/*** Switch the whole page to one participant (or back to everything) without a* reload: reset the accumulated stream, re-fetch under the new filter, and@@ -519,6 +637,7 @@ async function setFilter(filter, { push = true } = {}) {state.seen = new Set();state.events = [];state.lastEventTs = 0;+ state.loading = true; // re-reading under the new filter, not an empty resultif (push && typeof history !== 'undefined' && history.replaceState) {const qs = state.filter.agentId ? `?agent=${encodeURIComponent(state.filter.agentId)}`: state.filter.actor ? `?actor=${encodeURIComponent(state.filter.actor)}`@@ -534,6 +653,12 @@ async function setFilter(filter, { push = true } = {}) {function wireSolo() {$('sy-ledger')?.addEventListener('click', (e) => {+ const retry = e.target.closest('.sy-retry');+ if (retry) {+ e.preventDefault();+ retryFeed(retry);+ return;+ }const btn = e.target.closest('.sy-solo');if (!btn) return;e.preventDefault();@@ -543,6 +668,33 @@ function wireSolo() {$('sy-solo-clear')?.addEventListener('click', () => setFilter({}));}+/** Retry the feed by hand from the offline state, and re-open the SSE tail. */+async function retryFeed(btn) {+ btn.disabled = true;+ btn.setAttribute('aria-busy', 'true');+ btn.textContent = 'Reconnecting…';+ state.loading = true;+ syncStatus();+ renderStats();+ // A CLOSED EventSource never reconnects on its own; drop it so the reopen+ // below is a real reconnection rather than a no-op.+ if (state.source && state.source.readyState === 2) {+ state.source.close();+ state.source = null;+ }+ const ok = await fetchFirstPaint();+ if (ok && !state.source) connectStream();+ syncStatus();+ renderStats();+ // A failed retry repaints the offline block, which replaces this button+ // outright; only a surviving node still needs its idle label back.+ if (btn.isConnected) {+ btn.disabled = false;+ btn.removeAttribute('aria-busy');+ btn.textContent = 'Try again now';+ }+}+/* ── Event plumbing ────────────────────────────────────────────────────── */function acceptEvent(evt, { silent = false } = {}) {@@ -584,12 +736,17 @@ async function fetchFirstPaint() {const data = await res.json();const events = Array.isArray(data.events) ? data.events : [];for (const evt of events.slice().reverse()) acceptEvent(evt, { silent: true });+ state.feedOk = true;+ state.loading = false;+ syncStatus();renderLedger();renderStats();return true;} catch (err) {log.warn('first paint failed', err);- state.status = 'offline';+ state.loading = false;+ state.feedOk = false;+ syncStatus();renderStats();renderLedger();return false;@@ -601,14 +758,14 @@ function connectStream() {try {const source = new EventSource(STREAM_URL);state.source = source;- source.addEventListener('hello', () => { state.status = 'live'; stopPolling(); renderStats(); });+ source.addEventListener('hello', () => { state.feedOk = true; syncStatus(); stopPolling(); renderStats(); });source.addEventListener('event', (msg) => {try { acceptEvent(JSON.parse(msg.data)); } catch { /* malformed frame */ }});source.onerror = () => {// EventSource auto-reconnects; run the poll fallback while it is down.- state.status = 'polling';startPolling();+ syncStatus();renderStats();};} catch (err) {@@ -619,12 +776,15 @@ function connectStream() {function startPolling() {if (state.pollTimer) return;- state.status = state.status === 'offline' ? 'offline' : 'polling';state.pollTimer = setInterval(async () => {- const ok = await fetchFirstPaintDiff();- state.status = ok ? (state.source && state.source.readyState === 1 ? 'live' : 'polling') : 'offline';+ state.feedOk = await fetchFirstPaintDiff();+ syncStatus();renderStats();+ // The offline and quiet-economy blocks are different sentences; a poll+ // that flips the verdict has to repaint the one on screen.+ if (!state.events.length) renderLedger();}, POLL_MS);+ syncStatus(); // the timer exists now, so "polling" is finally true}function stopPolling() {@@ -694,7 +854,7 @@ function toggleRecord() {rec.start();audio.recorder = rec;btn.setAttribute('aria-pressed', 'true');- btn.textContent = 'Stop + save clip';+ claimI18n(btn, 'Stop + save clip');audio.recordTimer = setTimeout(stopRecord, RECORD_MAX_MS);} catch (err) {log.warn('recorder failed', err);@@ -709,11 +869,34 @@ function stopRecord() {try { audio.recorder.stop(); } catch { /* already stopped */ }audio.recorder = null;}- if (btn) { btn.setAttribute('aria-pressed', 'false'); btn.textContent = 'Record a video clip'; }+ if (btn) {+ btn.setAttribute('aria-pressed', 'false');+ releaseI18n(btn, 'Record a video clip');+ }}/* ── Controls ──────────────────────────────────────────────────────────── */+/*+ * The play button's declared copy is translated MARKUP (`<span>Play the+ * economy</span>`), so its two states are handled as a claim/release pair: the+ * script owns the node while it reads "Pause", and hands it back on stop so the+ * catalog restores the visitor's own language rather than English.+ */+function setPlayLabel(btn, playing) {+ if (!btn) return;+ btn.setAttribute('aria-pressed', String(playing));+ const span = btn.querySelector('span') || btn.appendChild(document.createElement('span'));+ if (playing) {+ btn.setAttribute('data-i18n-owned', '1');+ span.textContent = 'Pause';+ return;+ }+ span.textContent = 'Play the economy';+ btn.removeAttribute('data-i18n-owned');+ window.threewsI18n?.apply?.(btn);+}+let recapDone = false;async function togglePlay() {@@ -723,7 +906,11 @@ async function togglePlay() {stopDrone();stopRecord();if (audio.ctx) await audio.ctx.suspend().catch(() => {});- if (btn) { btn.setAttribute('aria-pressed', 'false'); btn.querySelector('span').textContent = 'Play the economy'; }+ setPlayLabel(btn, false);+ // A clip cut while the context is suspended is a file full of silence.+ // Take the affordance away with the sound rather than ship that.+ const stoppedRec = $('sy-record');+ if (stoppedRec) stoppedRec.hidden = true;return;}const ctx = ensureAudio();@@ -736,7 +923,7 @@ async function togglePlay() {await ctx.resume().catch(() => {});state.playing = true;startDrone();- if (btn) { btn.setAttribute('aria-pressed', 'true'); btn.querySelector('span').textContent = 'Pause'; }+ setPlayLabel(btn, true);const recBtn = $('sy-record');if (recBtn && audio.recordDest) recBtn.hidden = false;@@ -807,8 +994,10 @@ async function main() {wireControls();wireLegend();wireSolo();+ wireI18nRepaint();renderSoloChip();renderStats();+ renderLedger(); // skeleton while the first read is in flightawait fetchFirstPaint();renderSoloChip(); // resolve an ?agent=<id> deep link to its display nameconnectStream();diff --git a/src/theater-feed.js b/src/theater-feed.jsindex d4cd48956..d28fc1643 100644--- a/src/theater-feed.js+++ b/src/theater-feed.js@@ -95,15 +95,22 @@ export function normalizeEvent(e) {* Fetch the recent feed snapshot for first paint (quiet-market highlights and* the replay seed). Returns normalised events newest-first.*/-export async function loadSnapshot(limit = 40) {+export async function loadSnapshot(limit = 40, { timeout = 8000 } = {}) {+ // Time-bounded like every other fetch on this page: a black-holed edge must+ // resolve to the designed "no recent activity" copy, never leave the tape and+ // the quiet card blank behind a promise that never settles.+ const ctrl = new AbortController();+ const timer = setTimeout(() => ctrl.abort(), timeout);try {- const r = await fetch(`/api/feed?limit=${limit}`, { headers: { accept: 'application/json' } });+ const r = await fetch(`/api/feed?limit=${limit}`, { headers: { accept: 'application/json' }, signal: ctrl.signal });if (!r.ok) return [];const body = await r.json();const events = Array.isArray(body.events) ? body.events : [];return events.map(normalizeEvent).filter(Boolean);} catch {return [];+ } finally {+ clearTimeout(timer);}}@@ -113,7 +120,7 @@ export async function loadSnapshot(limit = 40) {* EventSource reconnects automatically; we surface that as 'reconnecting' so the* UI never shows stale data as live. Returns { close }.*/-export function connectFeed({ onEvent, onStatus }) {+export function connectFeed({ onEvent, onStatus, connectDeadline = 15000 }) {if (typeof EventSource === 'undefined') {onStatus?.('offline');return { close() {} };@@ -121,13 +128,21 @@ export function connectFeed({ onEvent, onStatus }) {let es = null;let closed = false;let firstOpen = true;+ // A stream that never opens (a buffering proxy, a middlebox that eats+ // text/event-stream) fires no error and no open, so the pill would claim+ // "Connecting" for the rest of the session. Bound the wait and tell the truth.+ let deadline = null;+ const clearDeadline = () => { if (deadline) { clearTimeout(deadline); deadline = null; } };+ const goLive = () => { clearDeadline(); firstOpen = false; onStatus?.('live'); };const open = () => {if (closed) return;onStatus?.(firstOpen ? 'connecting' : 'reconnecting');+ clearDeadline();+ deadline = setTimeout(() => { if (!closed) onStatus?.('reconnecting'); }, connectDeadline);es = new EventSource('/api/feed-stream');- es.addEventListener('hello', () => { firstOpen = false; onStatus?.('live'); });- es.addEventListener('open', () => { onStatus?.('live'); });+ es.addEventListener('hello', goLive);+ es.addEventListener('open', goLive);es.addEventListener('event', (ev) => {let raw;try { raw = JSON.parse(ev.data); } catch { return; }@@ -137,6 +152,7 @@ export function connectFeed({ onEvent, onStatus }) {es.onerror = () => {// EventSource transitions to CLOSED only on fatal errors; for transient// drops it retries on its own. Surface 'reconnecting' either way.+ clearDeadline();onStatus?.('reconnecting');if (es && es.readyState === EventSource.CLOSED && !closed) {try { es.close(); } catch {}@@ -149,6 +165,7 @@ export function connectFeed({ onEvent, onStatus }) {return {close() {closed = true;+ clearDeadline();try { es?.close(); } catch {}},};diff --git a/src/theater.css b/src/theater.cssindex 8356d0bd1..959805f84 100644--- a/src/theater.css+++ b/src/theater.css@@ -36,6 +36,7 @@transition: color var(--duration-fast, 140ms) var(--ease-standard, ease);}.th-back:hover { color: var(--ink-bright, #fff); }+.th-back:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 3px; border-radius: 6px; }.th-title-wrap { flex: 1; min-width: 0; }.th-title {margin: 0;@@ -227,6 +228,7 @@.th-rec-sub { font-family: var(--font-mono, monospace); font-size: var(--text-2xs, 0.69rem); color: var(--th-accent); }.th-rec-link { font-size: var(--text-2xs, 0.69rem); color: var(--ink-dim, #888); text-decoration: none; }.th-rec-link:hover { color: var(--ink-bright, #fff); }+.th-rec-link:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; border-radius: 3px; }.th-rec-win { border-color: rgba(74, 222, 128, 0.45); }.th-rec-win .th-rec-sub { color: var(--success, #4ade80); }.th-rec-loss { border-color: rgba(248, 113, 113, 0.45); }@@ -291,6 +293,10 @@transition: background var(--duration-fast, 140ms) var(--ease-standard, ease);}.th-hl:hover { background: var(--surface-2, rgba(255, 255, 255, 0.05)); }+.th-hl:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }+/* A highlight with no destination is not a link: no pointer, no hover lift. */+.th-hl-static { cursor: default; }+.th-hl-static:hover { background: var(--surface-1, rgba(255, 255, 255, 0.03)); }.th-hl-title { font-size: var(--text-sm, 0.78rem); font-weight: var(--weight-semibold, 600); }.th-hl-sub { font-family: var(--font-mono, monospace); font-size: var(--text-2xs, 0.69rem); color: var(--th-accent); }.th-hl .th-tick-time { margin-left: auto; }@@ -326,6 +332,7 @@cursor: pointer; font-size: 13px; line-height: 1;}.th-panel-close:hover { color: var(--ink-bright, #fff); }+.th-panel-close:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }.th-panel-head { display: flex; gap: var(--space-3, 12px); align-items: center; margin-bottom: var(--space-4, 16px); padding-right: 28px; }.th-panel-av { width: 52px; height: 52px; border-radius: var(--radius-md, 10px); object-fit: cover; background: var(--surface-2, rgba(255, 255, 255, 0.05)); flex: 0 0 auto; }.th-panel-av-fallback { display: flex; align-items: center; justify-content: center; font-family: var(--font-display, system-ui); font-weight: var(--weight-bold, 700); font-size: 22px; color: var(--th-accent); border: 1px solid var(--th-accent-stroke); }@@ -349,6 +356,7 @@color: var(--ink, #e8e8e8); text-decoration: none;}.th-addr:hover { border-color: var(--th-accent-stroke); }+.th-addr:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; }.th-addr-ext { color: var(--ink-dim, #888); }.th-panel-actions { display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); margin-bottom: var(--space-3, 12px); }@@ -440,6 +448,14 @@animation: th-slidein var(--duration-base, 220ms) var(--ease-emphasized, ease);}@keyframes th-slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }+/* Tape states: skeleton rows while the snapshot is in flight, designed copy when+ the feed genuinely has nothing recent to show. */+.th-tick-skel { animation: none; }+.th-tick-skel .th-tick-dot { background: var(--surface-3, rgba(255, 255, 255, 0.09)); }+.th-tick-skel .th-tick-body { gap: 5px; }+.th-skel-title { width: 62%; height: 10px; }+.th-skel-sub { width: 38%; height: 8px; }+.th-tick-empty { padding: 10px 2px; font-size: var(--text-xs, 0.72rem); line-height: 1.5; }.th-tick-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-dim, #888); flex: 0 0 auto; }.th-tick-buy .th-tick-dot, .th-tick-win .th-tick-dot { background: var(--success, #4ade80); }.th-tick-loss .th-tick-dot { background: var(--danger, #f87171); }@@ -451,6 +467,7 @@.th-tick-sub { font-family: var(--font-mono, monospace); font-size: var(--text-2xs, 0.69rem); color: var(--ink-dim, #888); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.th-tick-link { color: var(--ink-dim, #888); text-decoration: none; font-size: 13px; flex: 0 0 auto; }.th-tick-link:hover { color: var(--th-accent); }+.th-tick-link:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; border-radius: 3px; }.th-tick-time { font-size: 0.6rem; color: var(--ink-faint, rgba(255, 255, 255, 0.45)); font-variant-numeric: tabular-nums; flex: 0 0 auto; }.th-replay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }@@ -464,6 +481,7 @@transition: transform var(--duration-fast, 140ms) var(--ease-standard, ease);}.th-replay-mark:hover { transform: scale(1.2); }+.th-replay-mark:focus-visible { outline: 2px solid var(--th-accent); outline-offset: 2px; transform: scale(1.2); }.th-replay-mark.th-tick-buy, .th-replay-mark.th-tick-win { border-color: var(--success, #4ade80); background: rgba(74, 222, 128, 0.2); }.th-replay-mark.th-tick-loss { border-color: var(--danger, #f87171); background: rgba(248, 113, 113, 0.2); }.th-replay-mark.th-tick-launch, .th-replay-mark.th-tick-verify, .th-replay-mark.th-tick-pay { border-color: var(--th-accent-stroke); background: var(--th-accent-fill); }diff --git a/src/theater.js b/src/theater.jsindex 8cbbf0c86..eb984170e 100644--- a/src/theater.js+++ b/src/theater.js@@ -21,9 +21,45 @@ import './ui-juice.css';import { enterRow } from './ui-juice.js';const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+const ROSTER_TIMEOUT_MS = 8000;+// A slow-but-alive edge must still produce the stage. The first attempt fails+// fast so a genuinely dead endpoint reaches the error card quickly; the retry+// gives a congested one the room it needs before we call the stage broken.+const ROSTER_RETRY_TIMEOUT_MS = 20000;const WATCH_KEY = 'theater:watch:v1';const SOUND_KEY = 'theater:sound:v1';+// -- i18n ownership -----------------------------------------------------------+// The status pill, the quiet-market heartbeat and the sound button's aria-label+// all ship with a data-i18n key (so the pre-render copy is translated) but hold+// live state the moment this script runs. The catalog pass lands after the async+// /api/locale fetch, which is routinely AFTER the feed has already connected, so+// without an opt-out it reverted the pill to "Connecting" for the rest of the+// session and told a screen reader the sound was off while it was on.+// `data-i18n-owned="1"` is this codebase's documented opt-out; releasing an+// element hands it back so a locale switch still localizes the declared copy.+const i18nDefaults = new WeakMap();+function claimI18nText(el, text) {+ if (!el) return;+ if (!i18nDefaults.has(el)) i18nDefaults.set(el, el.textContent);+ el.setAttribute('data-i18n-owned', '1');+ el.textContent = text;+}+function releaseI18nText(el) {+ if (!el) return;+ el.removeAttribute('data-i18n-owned');+ const key = el.getAttribute('data-i18n');+ const translated = key ? window.threewsI18n?.t?.(key) : '';+ const restored = translated && translated !== key ? translated : i18nDefaults.get(el);+ if (restored != null) el.textContent = restored;+}+// Translated copy for a key that exists in the catalog, falling back to the+// English source when the catalog has not landed (or has no such key).+const tr = (key, fallback) => {+ const v = window.threewsI18n?.t?.(key);+ return v && v !== key ? v : fallback;+};+// Fill magnitude (0..1) from a real event's numeric size — drives centerpiece// scale and stinger loudness so a whale buy lands harder than a dust trade.function fillMagnitude(n) {@@ -238,16 +274,16 @@ async function fetchJson(url, { timeout = 8000, ...opts } = {}) {}}-async function fetchLeaderboard(limit) {- const body = await fetchJson(`/api/reputation/leaderboard?limit=${limit}`);+async function fetchLeaderboard(limit, timeout = ROSTER_TIMEOUT_MS) {+ const body = await fetchJson(`/api/reputation/leaderboard?limit=${limit}`, { timeout });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 || {},avatar_thumbnail: a.avatar_thumbnail_url || null,}));}-async function fetchNewLaunches(limit) {- const body = await fetchJson(`/api/agents/public?sort=newest&limit=${limit}`);+async function fetchNewLaunches(limit, timeout = ROSTER_TIMEOUT_MS) {+ const body = await fetchJson(`/api/agents/public?sort=newest&limit=${limit}`, { timeout });return (body.agents || []).map((a) => ({id: a.id, name: a.name || 'Agent', solana_address: null,score: null, tier: null, tierLabel: null, totals: {},@@ -329,7 +365,16 @@ export function initTheater(root) {const paintSound = () => {const on = stinger.enabled;refs.sound.setAttribute('aria-pressed', on ? 'true' : 'false');- refs.sound.setAttribute('aria-label', on ? 'Sound on' : 'Sound off');+ // "Sound off" is the button's declared copy; while sound is ON the label is+ // live state and the catalog pass must not revert it to the wrong one.+ if (on) {+ refs.sound.setAttribute('data-i18n-owned', '1');+ refs.sound.setAttribute('aria-label', 'Sound on');+ refs.sound.setAttribute('title', tr('theater.toggle_fill_sounds_title', 'Toggle fill sounds'));+ } else {+ refs.sound.removeAttribute('data-i18n-owned');+ refs.sound.setAttribute('aria-label', tr('theater.sound_off_arialabel', 'Sound off'));+ }refs.sound.classList.toggle('is-on', on);refs.sound.querySelector('.th-sound-icon').textContent = on ? '🔊' : '🔇';};@@ -352,6 +397,8 @@ export function initTheater(root) {liveCount: 0,lastMoveTs: null, // ts of the newest real event seen (drives the quiet heartbeat)selected: null,+ loadSeq: 0, // guards against a superseded roster load painting the wrong room+ seenIds: new Set(), // the tape is seeded from the snapshot, so dedupe by event id};// ── rooms ──────────────────────────────────────────────────────────────────@@ -378,24 +425,51 @@ export function initTheater(root) {}// ── status pill ─────────────────────────────────────────────────────────────+ // "Connecting" is the element's own declared copy, so the catalog owns it and a+ // non-English visitor gets it translated. Every other state is live data this+ // script owns, or the catalog pass would revert the pill to "Connecting" and+ // leave it claiming a connection that opened long ago.function setStatus(s) {const map = {- connecting: ['Connecting', 'th-dot-amber'],+ connecting: [null, 'th-dot-amber'],live: ['Live', 'th-dot-green'],reconnecting: ['Reconnecting…', 'th-dot-amber'],offline: ['Offline', 'th-dot-red'],};const [label, dot] = map[s] || map.offline;refs.status.className = `th-status ${dot}`;- refs.status.querySelector('.th-status-label').textContent = label;+ const node = refs.status.querySelector('.th-status-label');+ if (label === null) releaseI18nText(node);+ else claimI18nText(node, label);}// ── roster load ──────────────────────────────────────────────────────────────+ const fetchRoster = (limit, timeout) =>+ (state.room.id === 'launches' ? fetchNewLaunches(limit, timeout) : fetchLeaderboard(limit, timeout));++ // A congested edge answering just past the first budget used to land the whole+ // room on the error card even though the endpoint was healthy. Try once more+ // with a longer budget, and say so, before declaring the stage broken.+ async function loadRosterRows(limit) {+ try {+ return await fetchRoster(limit, ROSTER_TIMEOUT_MS);+ } catch (e) {+ if (e?.name !== 'AbortError') throw e;+ claimI18nText(refs.loading.querySelector('p'), 'Still assembling the cast…');+ return await fetchRoster(limit, ROSTER_RETRY_TIMEOUT_MS);+ }+ }+async function loadRoom() {+ // A room switch (or a Try-again) while a slow load is in flight must not let+ // the superseded response paint over the room the viewer actually chose.+ const seq = ++state.loadSeq;+ const stale = () => seq !== state.loadSeq;showState('loading');try {const limit = rosterBudget();- const rows = state.room.id === 'launches' ? await fetchNewLaunches(limit) : await fetchLeaderboard(limit);+ const rows = await loadRosterRows(limit);+ if (stale()) return;// 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.@@ -408,6 +482,7 @@ export function initTheater(root) {}await pool(rows, 5, resolveBody);+ if (stale()) return;state.roster = rows;state.byId = new Map(rows.map((a) => [a.id, a]));@@ -427,6 +502,7 @@ export function initTheater(root) {// Re-apply any watched highlight that belongs to this room.for (const id of state.watch) if (state.byId.has(id)) stage.highlight(id);} catch (err) {+ if (stale()) return;log.warn('[theater] room load failed', err?.message);showState('error');}@@ -436,6 +512,9 @@ export function initTheater(root) {// The quiet-market card is independent: it rides at the foot of the stage and// only shows while no live event has arrived (the cast still stands on stage).function showState(which) {+ // The retry re-labels the loading card; hand it back to the catalog whenever+ // a fresh load starts so a second attempt does not inherit the first's copy.+ if (which === 'loading') releaseI18nText(refs.loading.querySelector('p'));refs.loading.hidden = which !== 'loading';refs.error.hidden = which !== 'error';if (refs.empty) refs.empty.hidden = which !== 'empty';@@ -454,7 +533,9 @@ export function initTheater(root) {});function routeEvent(n) {- pushTicker(n);+ // A stream reconnect can replay events the tape already carries. Those are+ // history, not a fresh fill, so they must not perform on stage again.+ if (!pushTicker(n)) return;// Safety refusals play as an at-desk "wave it off" on the actor's monitor// (amber flash) — the guardrail made visible — but never a celebration.@@ -510,23 +591,81 @@ export function initTheater(root) {}// ── ticker ───────────────────────────────────────────────────────────────────- function pushTicker(n) {- state.liveCount++;- state.lastMoveTs = n.ts;+ // The rail is seeded with the real recent snapshot so the Live tape is never a+ // blank column on a quiet market, then live events land on top. Seeded rows are+ // history: they neither animate in, dismiss the quiet card, nor count as the+ // stage lighting up. Dedupe by feed id so a snapshot event that also arrives on+ // the stream is not listed twice.+ // Returns false when the event was already on the tape, so a duplicate never+ // re-triggers the on-stage spectacle for a fill the viewer already watched.+ function pushTicker(n, { live = true } = {}) {+ if (n.id) {+ if (state.seenIds.has(n.id)) return false;+ state.seenIds.add(n.id);+ // bounded: the tape keeps 40 rows, the id set only has to outlive them+ if (state.seenIds.size > 500) state.seenIds.delete(state.seenIds.values().next().value);+ }+ if (live) {+ state.liveCount++;+ state.lastMoveTs = n.ts;+ }+ refs.ticker.querySelectorAll('.th-tick-empty, .th-tick-skel').forEach((r) => r.remove());+ const external = n.href ? /^https?:/i.test(n.href) : false;const row = el('li', { class: `th-tick th-tick-${n.kind}` }, [el('span', { class: 'th-tick-dot' }),el('div', { class: 'th-tick-body' }, [el('span', { class: 'th-tick-title', text: n.title }),n.sub ? el('span', { class: 'th-tick-sub', text: n.sub }) : null,]),- n.href ? el('a', { class: 'th-tick-link', href: n.href, target: '_blank', rel: 'noopener', 'aria-label': 'Open in explorer', text: '↗' }) : null,+ n.href+ ? el('a', {+ class: 'th-tick-link',+ href: n.href,+ target: external ? '_blank' : null,+ rel: external ? 'noopener' : null,+ 'aria-label': external ? `Open ${n.title} in the explorer` : `Open ${n.title}`,+ text: '↗',+ })+ : null,el('time', { class: 'th-tick-time', text: timeAgo(n.ts), datetime: new Date(n.ts).toISOString() }),]);- refs.ticker.prepend(row);- enterRow(row); // slide the freshly-landed live event in (reduced-motion safe)+ if (live) {+ refs.ticker.prepend(row);+ enterRow(row); // slide the freshly-landed live event in (reduced-motion safe)+ } else {+ refs.ticker.append(row); // snapshot arrives newest-first, so append keeps that order+ }while (refs.ticker.children.length > 40) refs.ticker.lastElementChild.remove();// a real event arrived → dismiss the quiet state- if (!refs.quiet.hidden) refs.quiet.hidden = true;+ if (live && !refs.quiet.hidden) refs.quiet.hidden = true;+ return true;+ }++ // The tape's loading state: three skeleton rows so the rail reads as "filling"+ // rather than "empty" while the snapshot is in flight. aria-hidden because the+ // rail is a live region and a skeleton has nothing to announce.+ function renderTickerLoading() {+ refs.ticker.replaceChildren(+ ...Array.from({ length: 3 }, () =>+ el('li', { class: 'th-tick th-tick-skel', 'aria-hidden': 'true' }, [+ el('span', { class: 'th-tick-dot' }),+ el('div', { class: 'th-tick-body' }, [+ el('span', { class: 'th-skel-inline th-skel-title' }),+ el('span', { class: 'th-skel-inline th-skel-sub' }),+ ]),+ ]),+ ),+ );+ }++ // The tape's designed empty state: a feed with nothing recent still has to say+ // what the viewer is waiting for, not render an empty column.+ function renderTickerEmpty() {+ refs.ticker.querySelectorAll('.th-tick-skel').forEach((r) => r.remove());+ if (refs.ticker.children.length) return;+ refs.ticker.replaceChildren(el('li', { class: 'th-tick-empty th-muted' }, [+ 'Nothing on the tape yet. Every confirmed buy, launch and payment lands here the moment it clears.',+ ]));}// ── replay ────────────────────────────────────────────────────────────────────@@ -672,33 +811,51 @@ export function initTheater(root) {function updateBeat() {const beat = refs.quiet.querySelector('[data-beat]');if (!beat) return;+ // The live variant is this script's data, so claim it against the catalog+ // pass; the fallback IS the element's declared copy, so hand it back.if (Number.isFinite(state.lastMoveTs)) {- beat.textContent = `Last on-chain move ${timeAgo(state.lastMoveTs)} ago — the stage lights up the instant the next buy fills.`;+ claimI18nText(beat, `Last on-chain move ${timeAgo(state.lastMoveTs)} ago. The stage lights up the instant the next buy fills.`);} else {- beat.textContent = 'The stage lights up the instant the next on-chain buy fills.';+ releaseI18nText(beat);}}+ // A highlight with a real destination (an explorer receipt or an agent profile)+ // is a link; one without is plain text. A stub href="#" looks clickable and+ // goes nowhere, which is worse than not offering the affordance at all.+ function renderHighlight(e) {+ const kids = [+ el('span', { class: 'th-tick-dot' }),+ el('span', { class: 'th-hl-title', text: e.title }),+ e.sub ? el('span', { class: 'th-hl-sub', text: e.sub }) : null,+ el('time', { class: 'th-tick-time', text: timeAgo(e.ts), datetime: new Date(e.ts).toISOString() }),+ ];+ const cls = `th-hl th-tick-${e.kind}`;+ if (!e.href) return el('div', { class: `${cls} th-hl-static` }, kids);+ const external = /^https?:/i.test(e.href);+ // Internal routes stay in this tab; only an explorer receipt leaves the page.+ return el('a', { class: cls, href: e.href, target: external ? '_blank' : null, rel: external ? 'noopener' : null }, kids);+ }+loadSnapshot(40).then((events) => {if (events.length) state.lastMoveTs = Math.max(...events.map((e) => e.ts));updateBeat();- const featured = events.filter((e) => ROOMS.some((r) => r.featured.has(e.kind)) && (e.href || e.sub));+ // Seed the tape with real recent history before the first live event lands.+ // The rail is an aria-live region, so drop the live semantics for the seed:+ // this is existing history, not twenty events announcing themselves at once.+ refs.ticker.removeAttribute('aria-live');+ for (const e of events.slice(0, 20)) pushTicker(e, { live: false });+ renderTickerEmpty();+ requestAnimationFrame(() => refs.ticker.setAttribute('aria-live', 'polite'));const host = refs.quiet.querySelector('[data-highlights]');- if (!host) return;- if (!featured.length) {- host.append(el('p', { class: 'th-muted', text: 'No recent activity to replay. The stage goes live the moment an agent moves.' }));- return;+ if (host) {+ const featured = events.filter((e) => ROOMS.some((r) => r.featured.has(e.kind)) && (e.href || e.sub));+ host.replaceChildren(+ ...(featured.length+ ? featured.slice(0, 8).map(renderHighlight)+ : [el('p', { class: 'th-muted', text: 'No recent activity to replay. The stage goes live the moment an agent moves.' })]),+ );}- host.replaceChildren(- ...featured.slice(0, 8).map((e) =>- el('a', { class: `th-hl th-tick-${e.kind}`, href: e.href || '#', target: e.href ? '_blank' : null, rel: 'noopener' }, [- el('span', { class: 'th-tick-dot' }),- el('span', { class: 'th-hl-title', text: e.title }),- e.sub ? el('span', { class: 'th-hl-sub', text: e.sub }) : null,- el('time', { class: 'th-tick-time', text: timeAgo(e.ts) }),- ]),- ),- );maybeShowQuiet();});@@ -717,6 +874,7 @@ export function initTheater(root) {// keyboard: Esc closes panelwindow.addEventListener('keydown', (e) => { if (e.key === 'Escape') closePanel(); });+ renderTickerLoading();renderReplay();loadRoom();diff --git a/src/tour-atlas.js b/src/tour-atlas.jsindex 384649dc7..e60f8f8d1 100644--- a/src/tour-atlas.js+++ b/src/tour-atlas.js@@ -29,6 +29,8 @@ const els = {lbSay: document.getElementById('ta-lb-say'),lbMeta: document.getElementById('ta-lb-meta'),lbActions: document.getElementById('ta-lb-actions'),+ lbNone: document.getElementById('ta-lb-none'),+ main: document.querySelector('main'),};const state = {@@ -40,6 +42,7 @@ const state = {visible: [],openIndex: -1,lastFocus: null,+ wired: false,};const esc = (s) =>@@ -174,12 +177,24 @@ function altFor(stop) {return `Screenshot of ${stop.path} on three.ws${where}`;}+// Why a stop has no picture. There are two very different reasons and the page+// used to print only the first one, which was a false statement about all 18 of+// the stops that actually have it: every uncaptured stop in the committed atlas+// answered HTTP 200 and then ran past the screenshot timeout, because it is a+// live 3D or live-data page that never stops painting. Saying "did not respond"+// about a page that answered fine sends the reader to debug the wrong thing.+function noShotReason(stop) {+ if (stop.status === 0) return 'No screenshot: this page did not answer when the atlas last ran.';+ if (stop.status >= 400) return `No screenshot: this page answered HTTP ${stop.status} when the atlas last ran.`;+ return 'No screenshot: this page was still painting when the atlas last ran. Open it to see it live.';+}+function cardHtml(stop, i) {const shot = stop.media?.thumb;const figure = shot? `<img src="${esc(shot.url)}" alt="${esc(altFor(stop))}" loading="lazy" decoding="async"width="${shot.width}" height="${shot.height}" />`- : `<div class="ta-shot-none">No screenshot: this page did not respond when the atlas last ran.</div>`;+ : `<div class="ta-shot-none">${esc(noShotReason(stop))}</div>`;const badges = badgesFor(stop).map((b) => `<span class="ta-badge" data-tone="${b.tone}">${esc(b.t)}</span>`).join('');@@ -225,14 +240,38 @@ function renderSkeleton() {els.count.textContent = 'Loading the atlas…';}+// A visitor cannot act on "Failed to fetch" or on an instruction to run an npm+// script, so every failure is translated into a sentence that says what happened+// and what to do about it, next to a button that runs the same load again.function renderError(message) {els.grid.innerHTML =`<div class="ta-empty"><h2>The atlas could not load</h2>` +`<p>${esc(message)}</p>` +- `<a class="ta-btn" data-variant="primary" href="/tour">Take the guided tour instead</a></div>`;+ `<div class="ta-empty-actions">` ++ `<button type="button" class="ta-btn" data-variant="primary" data-act="retry">Try again</button>` ++ `<a class="ta-btn" href="/tour">Take the guided tour instead</a></div></div>`;els.count.textContent = '';}+class AtlasLoadError extends Error {+ constructor(message, cause) {+ super(message);+ this.name = 'AtlasLoadError';+ this.cause = cause;+ }+}++// fetch() rejects with a TypeError for every transport-level failure (offline,+// DNS, CORS, an aborted request), which is the only class we can name honestly+// without guessing.+function visitorMessage(err) {+ if (err instanceof AtlasLoadError) return err.message;+ if (err instanceof TypeError) {+ return 'Your connection dropped before the atlas finished loading. Check it and try again.';+ }+ return 'Something went wrong while opening the atlas. Try again in a moment.';+}+// ── Lightbox ─────────────────────────────────────────────────────────────────function metaRow(term, value) {return `<div><dt>${esc(term)}</dt><dd>${esc(value)}</dd></div>`;@@ -251,10 +290,17 @@ function openStop(i, { pushHash = true } = {}) {els.lbImg.src = hero.url;els.lbImg.alt = altFor(stop);els.lbImg.hidden = false;+ els.lbNone.hidden = true;+ els.lbNone.textContent = '';} else {+ // Hiding the image on its own left a bare black band above the copy. The+ // stop still has a page and a narration worth reading, so the figure says+ // why there is no picture instead of showing an empty frame.els.lbImg.removeAttribute('src');els.lbImg.alt = '';els.lbImg.hidden = true;+ els.lbNone.textContent = noShotReason(stop);+ els.lbNone.hidden = false;}const sectionTitle =@@ -292,6 +338,9 @@ function openStop(i, { pushHash = true } = {}) {const wasHidden = els.lb.hidden;els.lb.hidden = false;document.body.style.overflow = 'hidden';+ // aria-modal alone leaves every card behind the dialog reachable to a screen+ // reader's virtual cursor; inert takes them out of the tree too.+ if (els.main) els.main.inert = true;// Move focus into the dialog on open. While stepping through stops the// visitor's focus is already on prev/next, so leave it there.if (wasHidden) els.lb.querySelector('[data-act="close"]').focus();@@ -302,11 +351,38 @@ function closeLightbox() {if (els.lb.hidden) return;els.lb.hidden = true;document.body.style.overflow = '';+ if (els.main) els.main.inert = false;state.openIndex = -1;history.replaceState(null, '', location.pathname + location.search);state.lastFocus?.focus?.();}+function resetFilters() {+ state.query = '';+ state.track = 'all';+ state.health = 'all';+ state.section = 'all';+ els.search.value = '';+ renderSegments();+ renderSections();+ renderGrid();+}++// A shared /tour/atlas#<id> link has to land on that stop even when it sits+// outside the filters the visitor last had. Returns false for an id no stop+// carries, which leaves the grid alone rather than blanking it.+function openFromHash(id) {+ let i = state.visible.findIndex((s) => s.id === id);+ if (i < 0) {+ if (!state.manifest.stops.some((s) => s.id === id)) return false;+ resetFilters();+ i = state.visible.findIndex((s) => s.id === id);+ if (i < 0) return false;+ }+ openStop(i, { pushHash: false });+ return true;+}+function step(delta) {const next = state.openIndex + delta;if (next < 0 || next >= state.visible.length) return;@@ -315,8 +391,11 @@ function step(delta) {// ── Events ───────────────────────────────────────────────────────────────────function wire() {+ if (state.wired) return;+ state.wired = true;let timer;els.search.addEventListener('input', (e) => {+ if (!state.manifest) return;const value = e.target.value.trim().toLowerCase();clearTimeout(timer);timer = setTimeout(() => {@@ -327,7 +406,7 @@ function wire() {const onSeg = (e) => {const btn = e.target.closest('button[data-val]');- if (!btn) return;+ if (!btn || !state.manifest) return;state[btn.dataset.group] = btn.dataset.val;renderSegments();renderGrid();@@ -337,32 +416,26 @@ function wire() {els.sections.addEventListener('click', (e) => {const btn = e.target.closest('button[data-section]');- if (!btn) return;+ if (!btn || !state.manifest) return;state.section = btn.dataset.section;renderSections();renderGrid();});- const reset = () => {- state.query = '';- state.track = 'all';- state.health = 'all';- state.section = 'all';- els.search.value = '';- renderSegments();- renderSections();- renderGrid();- };els.count.addEventListener('click', (e) => {- if (e.target.closest('.ta-reset')) reset();+ if (e.target.closest('.ta-reset')) resetFilters();});els.grid.addEventListener('click', (e) => {if (e.target.closest('[data-act="reset"]')) {- reset();+ resetFilters();+ return;+ }+ if (e.target.closest('[data-act="retry"]')) {+ load();return;}const card = e.target.closest('.ta-card');- if (card) openStop(Number(card.dataset.i));+ if (card && state.manifest) openStop(Number(card.dataset.i));});els.lb.addEventListener('click', (e) => {@@ -375,6 +448,17 @@ function wire() {else if (e.target === els.lb) closeLightbox();});+ window.addEventListener('hashchange', () => {+ if (!state.manifest) return;+ const id = decodeURIComponent(location.hash.slice(1));+ if (!id) {+ closeLightbox();+ return;+ }+ if (state.visible[state.openIndex]?.id === id) return;+ openFromHash(id);+ });+document.addEventListener('keydown', (e) => {if (els.lb.hidden) {// "/" focuses search from anywhere on the page, unless the visitor is@@ -407,13 +491,20 @@ function wire() {// ── Boot ─────────────────────────────────────────────────────────────────────async function load() {+ state.manifest = null;renderSkeleton();try {const res = await fetch(MANIFEST_URL, { cache: 'no-cache' });- if (!res.ok) throw new Error(`The atlas manifest returned HTTP ${res.status}.`);- const data = await res.json();+ if (!res.ok) {+ throw new AtlasLoadError(+ `The atlas could not be reached (HTTP ${res.status}). It is usually back within a minute.`,+ );+ }+ const data = await res.json().catch((cause) => {+ throw new AtlasLoadError('The atlas came back in a form this page could not read.', cause);+ });if (!data || !Array.isArray(data.stops) || !data.stops.length) {- throw new Error('The atlas manifest is empty. Run `npm run tour:atlas` to rebuild it.');+ throw new AtlasLoadError('The atlas has no stops recorded yet, so there is nothing to show.');}state.manifest = data;renderStats();@@ -421,17 +512,17 @@ async function load() {renderSegments();renderSections();renderGrid();- wire();// A shared /tour/atlas#<stop-id> link opens straight onto that card.const wanted = decodeURIComponent(location.hash.slice(1));- if (wanted) {- const i = state.visible.findIndex((s) => s.id === wanted);- if (i >= 0) openStop(i, { pushHash: false });- }+ if (wanted) openFromHash(wanted);} catch (err) {- renderError(err instanceof Error ? err.message : 'Something went wrong.');+ renderError(visitorMessage(err));}}+// Wired before the first fetch so the toolbar and the retry button are live even+// on a load that never got a manifest; every handler returns early until one+// arrives.+wire();load();diff --git a/tests/no-duplicate-stylesheet-links.test.js b/tests/no-duplicate-stylesheet-links.test.jsnew file mode 100644index 000000000..eed903684Binary files /dev/null and b/tests/no-duplicate-stylesheet-links.test.js differdiff --git a/tests/sniper-experiments-page.test.js b/tests/sniper-experiments-page.test.jsnew file mode 100644index 000000000..d7ad2052c--- /dev/null+++ b/tests/sniper-experiments-page.test.js@@ -0,0 +1,172 @@+// /sniper/experiments page wiring.+//+// A scoreboard can be correct and still be unusable. These pin the failures this+// page actually shipped with: a second, stale copy of its own stylesheet injected+// at runtime that overrode the token-based one (hardcoded #4ade80 on a white+// light-theme background, ~1.7:1), a blank void instead of a loading state while+// the RPC balance reads land, an error card with nothing to click, and a window+// switch that could paint an out-of-order response.++import { describe, it, expect } from 'vitest';+import { readFileSync } from 'node:fs';+import { resolve, dirname } from 'node:path';+import { fileURLToPath } from 'node:url';++const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');+const read = (p) => readFileSync(resolve(ROOT, p), 'utf8');++const html = read('pages/sniper-experiments.html');+const js = read('src/sniper-experiments.js');+const css = read('src/sniper-experiments.css');+const vercel = JSON.parse(read('vercel.json'));+const viteConfig = read('vite.config.js');+const pages = JSON.parse(read('data/pages.json'));++function pagePaths() {+ const out = new Set();+ const walk = (node) => {+ if (Array.isArray(node)) return node.forEach(walk);+ if (!node || typeof node !== 'object') return;+ if (typeof node.path === 'string') out.add(node.path);+ Object.values(node).forEach(walk);+ };+ walk(pages);+ return out;+}++describe('routing', () => {+ it('serves /sniper/experiments from the route table', () => {+ const route = vercel.routes.find((r) => r.src === '/sniper/experiments/?');+ expect(route).toBeDefined();+ expect(route.dest).toBe('/sniper-experiments.html');+ });++ it('routes the scoreboard endpoint to its handler', () => {+ const route = vercel.routes.find((r) => r.src === '/api/sniper/experiments');+ expect(route).toBeDefined();+ expect(route.dest).toBe('/api/sniper/experiments.js');+ });++ it('is a build entry and resolves in the dev server route map', () => {+ expect(viteConfig).toContain("'sniper-experiments': resolve(__dirname, 'pages/sniper-experiments.html')");+ expect(viteConfig).toContain("'/sniper/experiments': resolve(root, 'pages/sniper-experiments.html')");+ });++ it('is declared in data/pages.json, which feeds the sitemap and llms.txt', () => {+ expect(pagePaths().has('/sniper/experiments')).toBe(true);+ });+});++describe('head', () => {+ it('carries a specific title, description and canonical URL', () => {+ expect(html).toMatch(/<title[^>]*>Sniper Experiments · three\.ws<\/title>/);+ const desc = html.match(/name="description"\s+content="([^"]+)"/s)?.[1] || '';+ expect(desc.length).toBeGreaterThan(80);+ expect(desc).toMatch(/LLM/);+ expect(html).toContain('<link rel="canonical" href="https://three.ws/sniper/experiments" />');+ });+});++describe('page structure', () => {+ it('mounts every element the hydration script writes into', () => {+ const ids = [...js.matchAll(/\$\('([a-z0-9-]+)'\)/g)].map((m) => m[1]);+ expect(ids.length).toBeGreaterThan(4);+ for (const id of new Set(ids)) {+ expect(html, `#${id} is written to but not present in the page`).toContain(`id="${id}"`);+ }+ });++ it('loads its own stylesheet and module', () => {+ expect(html).toContain('/src/sniper-experiments.css');+ expect(html).toContain('/src/sniper-experiments.js');+ });++ it('has exactly one h1', () => {+ expect(html.match(/<h1[\s>]/g)).toHaveLength(1);+ });++ it('every internal href resolves to a declared page or a served route', () => {+ // `src` entries are regexes, and several real routes are alternations+ // (`/(oracle/arm|arm)/?`), so a string compare misses them. Match the way+ // server/index.mjs does: anchor the pattern and test the path against it.+ const patterns = vercel.routes+ .filter((r) => typeof r.src === 'string' && typeof r.dest === 'string')+ .map((r) => new RegExp(`^${r.src}$`));+ const served = (href) => patterns.some((re) => re.test(href));+ const hrefs = [...html.matchAll(/href="(\/[^"#]*)"/g), ...js.matchAll(/href="(\/[^"#$`]*)"/g)]+ .map((m) => m[1])+ .filter((h) => !h.startsWith('/src/') && !h.startsWith('/api/'));+ const known = pagePaths();+ for (const href of new Set(hrefs)) {+ if (href === '/') continue;+ if (/\.(css|js|ico|svg|png|webmanifest)$/.test(href)) continue;+ const ok = known.has(href) || served(href) || href.startsWith('/docs/');+ expect(ok, `${href} is linked from /sniper/experiments but matches no route`).toBe(true);+ }+ });+});++describe('styling has one source of truth', () => {+ // The page shipped with a second copy of its own rules built as a template+ // literal and appended to <head> at runtime. Being last, it won every tie and+ // silently reverted the stylesheet: profit figures rendered #4ade80 on the+ // light theme's white background at roughly 1.7:1.+ it('never injects a stylesheet at runtime', () => {+ expect(js).not.toContain('createElement(\'style\')');+ expect(js).not.toMatch(/\.xp-[a-z-]+\s*\{[^}]*:/);+ });++ it('takes every colour from the theme tokens, not a hardcoded hex', () => {+ expect(css).not.toMatch(/color:\s*#[0-9a-f]{3,8}\b/i);+ expect(css).toContain('color: var(--cv-green)');+ expect(css).toContain('color: var(--cv-red)');+ });++ it('does not promise interactions the board does not have', () => {+ // .cv-table is built for sortable, row-clickable market tables. Nothing on+ // this board sorts and no row navigates.+ expect(css).toMatch(/\.xp-table th,\s*\n?\.xp-table tbody tr \{ cursor: default; \}/);+ });+});++describe('every state is designed', () => {+ it('paints a shape-matched skeleton before the first response', () => {+ expect(js).toContain('function renderSkeleton()');+ expect(js).toContain('cv-skel');+ // Runs at bootstrap, not only on a later refresh.+ expect(js).toMatch(/renderControls\(\);\s*\nrenderSkeleton\(\);\s*\nrefresh\(\);/);+ expect(css).toContain('.xp-skel-line');+ });++ it('gives the error state a real retry control and a human cause', () => {+ expect(js).toContain('function renderError(');+ expect(js).toContain('data-retry');+ expect(js).toContain("querySelector('[data-retry]').addEventListener('click', refresh)");+ expect(js).toContain('function describeFailure(');+ });++ it('keeps a working board on a failed refresh instead of blanking it', () => {+ expect(js).toContain('function renderStaleNotice(');+ expect(js).toMatch(/if \(hasData\) renderStaleNotice\(err\);\s*\n\s*else renderError\(err\);/);+ expect(html).toContain('id="xp-alert"');+ });++ it('states the empty case for both the board and the judgment ledger', () => {+ expect(js).toContain('No strategies armed on this network yet');+ expect(js).toContain('No LLM verdicts in this window');+ });++ it('announces refreshes and load state to assistive tech', () => {+ expect(html).toContain('aria-busy="true"');+ expect(html).toMatch(/id="xp-updated"[^>]*aria-live="polite"/);+ expect(js).toContain("setAttribute('aria-busy'");+ });+});++describe('polling correctness', () => {+ it('discards an out-of-order response so a window switch cannot be overwritten', () => {+ expect(js).toContain('let reqSeq = 0');+ expect(js).toContain('const seq = ++reqSeq');+ expect(js.match(/if \(seq !== reqSeq\) return;/g)?.length).toBeGreaterThanOrEqual(2);+ });+});diff --git a/tests/symphony-cross-links.test.js b/tests/symphony-cross-links.test.jsindex 335caf338..6f44841b7 100644--- a/tests/symphony-cross-links.test.js+++ b/tests/symphony-cross-links.test.js@@ -45,6 +45,51 @@ describe('symphony cross-links', () => {expect(nav).toMatch(/Agent Symphony/);});+ it('a dead feed reads as a dead feed, never as a quiet economy', () => {+ const js = read('src/symphony.js');+ // Two different verdicts about the platform, so two different blocks: for+ // a while an unreachable feed rendered "The economy is quiet right now",+ // which is a claim about the platform made while we cannot see it.+ expect(js).toMatch(/function offlineLedgerHTML/);+ expect(js).toMatch(/function emptyLedgerHTML/);+ expect(js).toMatch(/The live event feed is unreachable/);+ // ...and it is actionable, not a dead end.+ expect(js).toMatch(/class="sy-retry"/);+ expect(js).toMatch(/async function retryFeed/);+ // The status pill is derived from facts rather than assigned ad hoc,+ // which is what let a page that had never reached the API say "live".+ expect(js).toMatch(/function syncStatus/);+ expect(js).toMatch(/if \(!state\.feedOk\)/);+ });++ it('the styles back every ledger state the script can render', () => {+ const css = read('src/symphony.css');+ for (const cls of ['.sy-empty-error', '.sy-retry', '.sy-skeleton', '.sy-skel-row']) {+ expect(css).toContain(cls);+ }+ });++ it('live nodes are held against the async i18n catalog pass', () => {+ const js = read('src/symphony.js');+ // src/i18n.js applies its catalog after an async /api/locale fetch and+ // reverts every annotated node. data-i18n-owned is the documented opt-out.+ expect(js).toMatch(/data-i18n-owned/);+ // The soloing sentence is translated markup carrying its own EMPTY+ // <strong id="sy-solo-label">, so the catalog replaces the element the+ // participant's name lives in. The event alone is a race, so the bar is+ // observed too.+ expect(js).toMatch(/i18n:change/);+ expect(js).toMatch(/new MutationObserver\([\s\S]{0,400}sy-solo-label/);+ });++ it('the solo sentence really does ship an empty label element per locale', () => {+ // The bug above is only reachable because the catalog value contains the+ // element. If a future extraction stops shipping the <strong>, the+ // observer is dead weight and this test says so.+ const en = JSON.parse(read('public/locales/en.json'));+ expect(en.symphony.soloing_everything_else_is_muted).toMatch(/<strong id="sy-solo-label"><\/strong>/);+ });+it('/symphony declares the solo affordance its own copy promises', () => {const html = read('pages/symphony.html');expect(html).toMatch(/id="sy-solo-bar"/);diff --git a/tests/tour-atlas.test.js b/tests/tour-atlas.test.jsindex 1e4922f7e..1f4dea4d3 100644--- a/tests/tour-atlas.test.js+++ b/tests/tour-atlas.test.js@@ -22,7 +22,13 @@ import { readFileSync } from 'node:fs';import { resolve, dirname } from 'node:path';import { fileURLToPath } from 'node:url';-import { atlasProblems, renderPublicAtlas, summarizeStops } from '../scripts/build-tour-atlas.mjs';+import {+ atlasProblems,+ renderPublicAtlas,+ stopCountClaims,+ stopCountProblems,+ summarizeStops,+} from '../scripts/build-tour-atlas.mjs';import { navigate, NAV_ATTEMPTS } from '../scripts/capture-tour-atlas.mjs';import {TOUR_FALLBACK_SELECTORS,@@ -350,3 +356,56 @@ describe('the committed atlas', () => {expect(atlas.stops.map((s) => s.id).sort()).toEqual(curriculum.stops.map((s) => s.id).sort());});});++describe('stopCountProblems()', () => {+ it('reads a stop count out of prose and out of an encoded OG image URL', () => {+ expect(stopCountClaims('Search 263 stops, filter by chapter.')).toEqual([263]);+ expect(stopCountClaims('d=Search+263+stops%2C+filter')).toEqual([263]);+ expect(stopCountClaims('263 stops of the guided tour, each a screenshot')).toEqual([263]);+ });++ it('ignores copy that never claims a count', () => {+ expect(stopCountClaims('Every stop on the guided tour, photographed.')).toEqual([]);+ expect(stopCountProblems(263, [{ label: 'x', text: 'no numbers here' }])).toEqual([]);+ });++ it('passes copy that agrees with the atlas', () => {+ expect(+ stopCountProblems(263, [+ { label: 'page', text: 'Search 263 stops. 263 stops of the tour.' },+ ]),+ ).toEqual([]);+ });++ it('names the file and both numbers when the copy drifts', () => {+ const problems = stopCountProblems(263, [+ { label: 'pages/tour-atlas.html', text: 'Search 185 stops, filter by chapter.' },+ ]);+ expect(problems).toHaveLength(1);+ expect(problems[0]).toContain('pages/tour-atlas.html');+ expect(problems[0]).toContain('185 stops');+ expect(problems[0]).toContain('263');+ });++ it('reports one problem per wrong number, not one per occurrence', () => {+ const problems = stopCountProblems(263, [+ { label: 'page', text: '185 stops. Search+185+stops. 185 stops again. 200 stops.' },+ ]);+ expect(problems).toHaveLength(2);+ });+});++describe('the committed copy that advertises the atlas', () => {+ it('claims the number of stops the atlas actually has', () => {+ const atlas = JSON.parse(readFileSync(resolve(ROOT, 'data/tour-atlas.json'), 'utf8'));+ const entry = JSON.parse(readFileSync(resolve(ROOT, 'data/pages.json'), 'utf8'))+ .sections.flatMap((section) => section.pages)+ .find((page) => page.path === '/tour/atlas');+ expect(+ stopCountProblems(atlas.stops.length, [+ { label: 'data/pages.json', text: entry.description },+ { label: 'pages/tour-atlas.html', text: readFileSync(resolve(ROOT, 'pages/tour-atlas.html'), 'utf8') },+ ]),+ ).toEqual([]);+ });+});diff --git a/vite.config.js b/vite.config.jsindex 15b17e429..b1d2e7a8b 100644--- a/vite.config.js+++ b/vite.config.js@@ -343,6 +343,24 @@ const appConfig = {rewrite: (path) =>`/api/oracle-share?mint=${path.replace(/^\/oracle\/coin\//, '').replace(/\/$/, '')}`,},+ // /discover/a/<chain>/<id> and /discover/a/sol/<asset> are server-rendered+ // detail pages too: vercel.json rewrites them to the api/discover-detail+ // function, so no HTML file exists for the dev route map and the path 404s+ // in dev while working in prod. Every on-chain agent card on /search and+ // /discover links there, so without this rule a local audit reports those+ // results dead. Mirror the production rewrite against the upstream.+ '^/discover/a/(?:\\d+/\\d+|sol/[A-Za-z0-9]+)/?$': {+ target: DEV_API_PROXY,+ changeOrigin: true,+ secure: true,+ rewrite: (path) => {+ const clean = path.replace(/\/$/, '');+ const onchain = clean.match(/^\/discover\/a\/(\d+)\/(\d+)$/);+ if (onchain) return `/api/discover-detail?kind=onchain&chain=${onchain[1]}&id=${onchain[2]}`;+ const solana = clean.match(/^\/discover\/a\/sol\/([A-Za-z0-9]+)$/);+ return `/api/discover-detail?kind=solana&asset=${solana[1]}`;+ },+ },'/api': {target: DEV_API_PROXY,changeOrigin: true,@@ -545,6 +563,7 @@ const appConfig = {'smart-home': resolve(__dirname, 'pages/smart-home.html'),'smart-home-join': resolve(__dirname, 'pages/smart-home-join.html'),'smart-home-plan': resolve(__dirname, 'pages/smart-home-plan.html'),+ 'smart-home-privacy': resolve(__dirname, 'pages/smart-home-privacy.html'),'smart-home-satellite': resolve(__dirname, 'pages/smart-home-satellite.html'),'materialize-order': resolve(__dirname, 'pages/materialize-order.html'),'materialize-ops': resolve(__dirname, 'pages/materialize-ops.html'),@@ -1402,6 +1421,10 @@ const appConfig = {'/smart-home/satellite/': resolve(root, 'pages/smart-home-satellite.html'),'/smart-home/plan': resolve(root, 'pages/smart-home-plan.html'),'/smart-home/plan/': resolve(root, 'pages/smart-home-plan.html'),+ '/smart-home/privacy': resolve(root, 'pages/smart-home-privacy.html'),+ '/smart-home/privacy/': resolve(root, 'pages/smart-home-privacy.html'),+ '/smart-home/join': resolve(root, 'pages/smart-home-join.html'),+ '/smart-home/join/': resolve(root, 'pages/smart-home-join.html'),'/marketplace': resolve(root, 'pages/marketplace.html'),'/marketplace/': resolve(root, 'pages/marketplace.html'),'/marketplace-walk': resolve(root, 'pages/marketplace-walk.html'),@@ -2187,9 +2210,13 @@ const appConfig = {// /materialize/orders/:id → one print order's timeline (uuid).else if (!filePath && /^\/materialize\/orders\/[0-9a-fA-F-]{36}\/?$/.test(path))filePath = resolve(root, 'pages/materialize-order.html');- // /home/:id → the live 3D home (uuid). Mirrors vercel.json, which- // routes this ahead of the bare /home redirect.- else if (!filePath && /^\/home\/[0-9a-fA-F-]{36}\/?$/.test(path))+ // The live 3D home (uuid), at both of its addresses. Mirrors+ // vercel.json: /smart-home/:id is where the connect flow's "Open"+ // lands, /smart-home/:id/settings is that home's settings card, and+ // /home/:id is the campaign's own address for the scene.+ else if (!filePath && /^\/smart-home\/[0-9a-fA-F-]{36}\/settings\/?$/.test(path))+ filePath = resolve(root, 'pages/smart-home.html');+ else if (!filePath && /^\/(?:smart-)?home\/[0-9a-fA-F-]{36}\/?$/.test(path))filePath = resolve(root, 'pages/home-scene.html');// /drops/:slug → one generative 3D collection. Declared ahead of the// /drop/:id rule below so the singular sealed-gift route and this@@ -3334,6 +3361,15 @@ const appConfig = {},VitePWA({registerType: 'autoUpdate',+ // The default ('auto') injects a plain classic <script src="/registerSW.js">+ // into <head>, which the parser must fetch and run before it paints:+ // one render-blocking round trip on EVERY built page, measured on+ // /, /create, /forge, /marketplace and /play. registerSW.js does its+ // work inside a window 'load' listener, so deferring it changes nothing+ // about when the service worker registers and removes the block.+ // The strip-sw plugin above matches on the tag's id, which both modes+ // emit, so embed entries still get the script removed.+ injectRegister: 'script-defer',includeAssets: ['favicon.ico', 'pwa-192x192.png', 'pwa-512x512.png', 'pwa-maskable-192x192.png', 'pwa-maskable-512x512.png', 'pwa-icon.svg'],manifest: {name: 'three.ws — Give Your AI a Body',