Skip to content

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

fix(viewer): keep a shared model link's name and drop the download button that did nothing

nirholas4762e37e8b0e
diff --git a/data/changelog.json b/data/changelog.json
index 18c08afa9..127694f16 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,26 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-08-15",
+ "title": "Your master wallet: creating one no longer reports a failure, and your balances are real numbers again",
+ "summary": "Two faults on the master wallet page are fixed. First, every account that pressed Create my master wallet was told the creation had failed. The wallet was in fact created every time; the page then showed an error, and the same fault sat on the send and fund-an-agent paths, where a transfer that had already settled on Solana was reported as \"The transfer did not go through\", inviting people to send the same money twice. Nothing about the money was ever wrong, only what the page said about it. Second, the SOL and Solana USDC figures, and the total value, read \"unavailable\" for everyone regardless of what the wallet held, because the balance reader and the page were describing balances in two different shapes. They now show live amounts, priced against the SOL rate, and an empty wallet reads a plain 0 instead of \"unavailable\". A balance the network genuinely could not answer for still says \"unavailable\" and is left out of the total rather than counted as zero. Alongside that: failures now explain themselves in plain words with a support reference instead of printing raw operator text, the explainer bubbles fit inside a phone screen, and each one names what it explains for screen-reader users.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/wallet"
+ },
+ {
+ "date": "2026-08-15",
+ "title": "KOL Tracker: the whole board is readable on a phone, and dead columns are gone",
+ "summary": "On any screen narrower than the board, five of the tracker's seven columns were unreachable: the page could not shrink, and the overflow was clipped rather than scrollable, so P&L, win rate and trade count simply were not there on a phone. The board now fits any viewport and scrolls sideways on its own. Columns with nothing to show are dropped instead of rendering a full column of dashes, so followers and volume appear only once there is data behind them. Each wallet is printed once (it used to appear twice on every row) and links to its Solscan account, so any number on the board can be audited on-chain. Where the P&L for a window comes from is now stated once under the board instead of repeating on all fifty rows, the board refreshes every minute with the time of the last update on screen, and a refresh that fails keeps the rows you are reading rather than blanking them. A failed load now offers a Try again button, an empty window points at the trader leaderboard, and the whole board is navigable and announced properly with a keyboard and a screen reader.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/tracker"
+ },
{
"date": "2026-08-15",
"title": "Trade Terminal: an agent exit now opens the trade, not just the coin",
diff --git a/pages/tracker.html b/pages/tracker.html
index 0a29aa162..5c21f64ce 100644
--- a/pages/tracker.html
+++ b/pages/tracker.html
@@ -29,11 +29,12 @@
<meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=KOL+Tracker&amp;d=Solana+crypto+KOLs+ranked+by+realized+P%26L+computed+from+their+own+wallet%27s+on-chain+trade+history%2C+with+win+rate%2C+volume%2C+trade+count%2C+and+X+follower+counts&amp;p=%2Ftracker" />
<meta name="theme-color" content="#0a0a0a" />
<style>
- /* body is a flex column, so this flex item keeps min-width:auto and refuses
- to shrink below the board's min-width. html/body clip overflow-x, so
- without min-width:0 every column past the second is unreachable on any
- viewport narrower than the board. */
- .tk-shell { max-width: 1080px; min-width: 0; margin: 0 auto; padding: var(--space-lg) var(--space-md) var(--space-2xl); }
+ /* body is a flex column and `margin: 0 auto` is what centers this shell,
+ but auto cross-axis margins also cancel the flex stretch, leaving the
+ shell sized to its widest child (the board). html/body clip overflow-x,
+ so the excess is not even scrollable: without an explicit width every
+ column past the second is unreachable below the board's min-width. */
+ .tk-shell { width: 100%; max-width: 1080px; margin: 0 auto; padding: var(--space-lg) var(--space-md) var(--space-2xl); }
.tk-hero { padding: var(--space-xl) 0 var(--space-md); }
.tk-kicker { display: inline-flex; align-items: center; gap: var(--space-xs); font: var(--weight-semibold) var(--text-2xs)/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-dim); margin: 0 0 var(--space-sm); }
.tk-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-success) 60%, transparent); animation: tk-pulse 1.8s ease infinite; }
@@ -388,8 +389,12 @@
if (silent && rowsEl.querySelector('.tk-row')) setUpdated(state.updatedAt, true);
else showError(err.message || 'Something went wrong.');
} finally {
- if (inflight === ctrl) inflight = null;
- boardEl.setAttribute('aria-busy', 'false');
+ // A superseded request must not clear the busy flag out from under
+ // the newer request that replaced it.
+ if (inflight === ctrl) {
+ inflight = null;
+ boardEl.setAttribute('aria-busy', 'false');
+ }
}
}
diff --git a/pages/trending.html b/pages/trending.html
index 143cfc9cb..309c7543f 100644
--- a/pages/trending.html
+++ b/pages/trending.html
@@ -363,6 +363,20 @@
const WIN_LABEL = { '24h': '24h', '7d': '7d', 'all': 'all time' };
const WIN_PHRASE = { '24h': 'last 24 hours', '7d': 'last 7 days', 'all': 'window we retain' };
+ // The legends and the coin empty state name the selected window. They live
+ // inside translated markup, so re-stamp them after a locale swap and never
+ // assume a node survived it.
+ function setText(sel, value) {
+ const el = $(sel);
+ if (el) el.textContent = value;
+ }
+ function syncWindowLabels() {
+ setText('#legendWindow', WIN_LABEL[currentWin]);
+ setText('#coinLegendWindow', WIN_LABEL[currentWin]);
+ setText('#coinEmptyWindow', WIN_PHRASE[currentWin]);
+ }
+ window.addEventListener('i18n:change', syncWindowLabels);
+
// ── Tab switching ───────────────────────────────────────────────────
function syncTab(tab, { focus = false, push = false } = {}) {
currentTab = tab;
@@ -428,9 +442,7 @@
b.classList.toggle('active', on);
b.setAttribute('aria-pressed', String(on));
});
- $('#legendWindow').textContent = WIN_LABEL[win];
- $('#coinLegendWindow').textContent = WIN_LABEL[win];
- $('#coinEmptyWindow').textContent = WIN_PHRASE[win];
+ syncWindowLabels();
loadData();
});
});
@@ -667,8 +679,7 @@
const initialTab = new URL(location.href).searchParams.get('tab');
if (initialTab && initialTab !== 'agents') syncTab(TABS.includes(initialTab) ? initialTab : 'agents');
writeUrl(true);
- $('#coinLegendWindow').textContent = WIN_LABEL[currentWin];
- $('#coinEmptyWindow').textContent = WIN_PHRASE[currentWin];
+ syncWindowLabels();
loadData();
</script>
diff --git a/pages/voice.html b/pages/voice.html
index 698749752..66e0e3bac 100644
--- a/pages/voice.html
+++ b/pages/voice.html
@@ -222,24 +222,6 @@
.vl-btn:not(:disabled):hover { transform: translateY(-1px); }
.vl-btn:not(:disabled):active { transform: translateY(0); }
- /* Keyboard users get the same "you are here" signal a mouse user gets
- from :hover. The site reset clears the UA ring, so every control on
- this page states its own. */
- .vl-btn:focus-visible,
- .vl-pg-sample:focus-visible,
- .vl-script-next:focus-visible,
- .vl-voice-card [data-play]:focus-visible,
- .vl-review-field input:focus-visible,
- .vl-pg-field select:focus-visible,
- .vl-pg-field input:focus-visible,
- .vl-pg-textarea:focus-visible,
- .vl-byok-row input:focus-visible,
- .vb-filters input:focus-visible,
- .vb-filters select:focus-visible {
- outline: 2px solid #ffffff;
- outline-offset: 2px;
- }
-
.vl-btn-record {
background: #e8e8e8;
color: #0a0a0a;
@@ -900,6 +882,27 @@
margin-top: 10px;
}
+ /* ── Focus ──────────────────────────────────── */
+ /* Keyboard users get the same "you are here" signal a mouse user gets
+ from :hover. Several controls above clear the UA ring to style their
+ own border, so the ring is restored here, last, where it wins. */
+ .vl-btn:focus-visible,
+ .vl-pg-sample:focus-visible,
+ .vl-script-next:focus-visible,
+ .vl-empty-actions .vl-btn:focus-visible,
+ .vl-voice-card .vl-btn:focus-visible,
+ .vb-card .vl-btn:focus-visible,
+ .vl-review-field input:focus-visible,
+ .vl-pg-field select:focus-visible,
+ .vl-pg-field input:focus-visible,
+ .vl-pg-textarea:focus-visible,
+ .vl-byok-row input:focus-visible,
+ .vb-filters input[type="search"]:focus-visible,
+ .vb-filters select:focus-visible {
+ outline: 2px solid #ffffff;
+ outline-offset: 2px;
+ }
+
/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
.vb-grid { grid-template-columns: 1fr; }
diff --git a/prompts/swarm-100/route-tracker.md b/prompts/swarm-100/route-tracker.md
deleted file mode 100644
index 829f25534..000000000
--- a/prompts/swarm-100/route-tracker.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /tracker (KOL Tracker)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/tracker')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/tracker" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/tracker
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /tracker ("KOL Tracker", section "crypto").
-Declared purpose: Solana crypto KOLs ranked by realized P&L computed from their own wallet's on-chain trade history, with win rate, volume, trade count, and X follower counts for verified handles.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/tracker. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /tracker: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-tracker.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/prompts/swarm-100/route-trending.md b/prompts/swarm-100/route-trending.md
deleted file mode 100644
index 0a5fbf0ee..000000000
--- a/prompts/swarm-100/route-trending.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /trending (Trending: Top Agents & Coins on three.ws)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/trending')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/trending" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/trending
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /trending ("Trending: Top Agents & Coins on three.ws", section "crypto").
-Declared purpose: What's hot on three.ws right now. Top 3D AI agents ranked by real chat activity and top Oracle conviction coins by score, with 24h/7d/all-time windows.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/trending. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /trending: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-trending.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/src/voice-lab.js b/src/voice-lab.js
index 59934d2dd..e2738b812 100644
--- a/src/voice-lab.js
+++ b/src/voice-lab.js
@@ -1,5 +1,5 @@
import { getElevenKey, setElevenKey, clearElevenKey, withElevenKey, maskElevenKey } from './voice/eleven-key.js';
-import { mountVoiceBrowser, statusLine } from './voice/voice-browser.js';
+import { mountVoiceBrowser, statusLine, readLaneError } from './voice/voice-browser.js';
const $ = (id) => document.getElementById(id);
@@ -626,20 +626,13 @@ async function speakPlayground() {
});
if (!r.ok) {
- const errText = await r.text().catch(() => '');
- let msg = '';
- let topUp = '';
- try {
- const body = JSON.parse(errText);
- msg = body.message || body.error_description || body.error || '';
- if (body.top_up_url) topUp = ` Top up at ${body.top_up_url}.`;
- } catch {
- msg = errText;
- }
- // A lane that answers 503 is down, not busy: re-read the catalog so the
- // picker drops the voices it can no longer render.
- if (r.status === 503) voiceBrowser.reload({ silent: true });
- throw new Error(statusLine(msg || `HTTP ${r.status}`) + topUp);
+ const body = await r.clone().json().catch(() => ({}));
+ const { message, laneDown } = await readLaneError(r);
+ // The lane is gone, not busy: re-read the catalog so the picker drops
+ // the voices it can no longer render.
+ if (laneDown) voiceBrowser.reload({ silent: true });
+ const topUp = body.top_up_url ? ` Top up at ${body.top_up_url}.` : '';
+ throw new Error(message + topUp);
}
const cacheHit = r.headers.get('x-tts-cache') === 'hit';
diff --git a/src/voice/README.md b/src/voice/README.md
index 21b5103cd..0216315f3 100644
--- a/src/voice/README.md
+++ b/src/voice/README.md
@@ -49,7 +49,7 @@ No rig allowlist, same policy as the skeleton pipeline: `AvatarMouthTarget` and
| [avatar-snapshot.js](avatar-snapshot.js) | `captureSnapshotBlob(talkScene)`, `uploadAvatarSnapshot({ avatarId, scene })`, `SNAPSHOT_CONSTANTS` | Grabs a JPEG poster from the live WebGL canvas and pushes it through the existing presign-thumbnail plus auto-tag flow. |
| [wallet-intent.js](wallet-intent.js) | `WalletIntentController`, `isWalletCommand(text)` | Conversational wallet layer inside talk mode: a heuristic gate routes money-shaped utterances to `/api/agents/:id/solana/intent`, resolves amounts against real balances, previews the trade, and requires an explicit confirm (tap or "yes") before calling the same owner-only, spend-policy-gated trade/withdraw endpoints the wallet HUD uses. Nothing signs on its own path. |
| [eleven-key.js](eleven-key.js) | `getElevenKey()`, `setElevenKey(key)`, `clearElevenKey()`, `withElevenKey(headers)`, `maskElevenKey(key)` | Browser-only store for a user's own ElevenLabs API key (BYOK). The key lives in `localStorage` and rides voice requests as the `x-eleven-key` header; the server resolves it per request and never stores it, so BYOK calls run on the user's own ElevenLabs account. |
-| [voice-browser.js](voice-browser.js) | `mountVoiceBrowser({ root, onSelect, onCatalog })` | The multi-provider voice grid on [/voice](../../pages/voice.html). Reads `GET /api/tts/catalog` (Microsoft Edge, Gemini, NVIDIA, OpenAI, ElevenLabs in one shape) plus `GET /api/tts/eleven/library` for the public ElevenLabs Voice Library, and previews through `POST /api/tts/synthesize` so what you hear is what an agent will render. Search, language filter, provider pills with their billing rung, and a relevance order that puts the visitor's own language first and round-robins the providers. `onSelect` hands the pick to the playground; `onCatalog` hands the provider metadata over so the playground can show a model select and a style-direction field only where the lane supports them. |
+| [voice-browser.js](voice-browser.js) | `mountVoiceBrowser({ root, onSelect, onCatalog })`, `statusLine(message)`, `readLaneError(response)` | The multi-provider voice grid on [/voice](../../pages/voice.html). Reads `GET /api/tts/catalog` (Microsoft Edge, Gemini, NVIDIA, OpenAI, ElevenLabs in one shape) plus `GET /api/tts/eleven/library` for the public ElevenLabs Voice Library, and previews through `POST /api/tts/synthesize` so what you hear is what an agent will render. Search, language filter, provider pills with their billing rung, and a relevance order that puts the visitor's own language first and round-robins the providers. `onSelect` hands the pick to the playground; `onCatalog` hands the provider metadata over so the playground can show a model select and a style-direction field only where the lane supports them. Every nothing-to-show state carries its own way out: a failed catalog read offers Try again, a filter that matched nothing offers Clear filters, and a preview whose failure names the lane rather than the clip (`lane_unavailable`, `invalid_key`, `not_configured`, or any `503`) triggers a cache-skipping catalog re-read, so those voices leave the grid while the reason stays on screen. `statusLine` is the guard that keeps a vendor's multi-line error body out of a one-line status; `readLaneError` pulls out the written sentence plus whether the lane itself is down. |
## Install / use
diff --git a/src/voice/voice-browser.js b/src/voice/voice-browser.js
index 4d3085d65..4992aa7a0 100644
--- a/src/voice/voice-browser.js
+++ b/src/voice/voice-browser.js
@@ -49,10 +49,21 @@ export function statusLine(message, max = 180) {
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
}
-/** The message a TTS endpoint meant for a human, whatever shape it answered in. */
-export async function laneErrorMessage(response) {
+// Error codes that mean the LANE is down, not that this one clip failed. Any of
+// them makes the catalog stale the moment it arrives, because the server has
+// just taken that lane off the menu.
+const LANE_DOWN_CODES = new Set(['lane_unavailable', 'invalid_key', 'not_configured']);
+
+/**
+ * Read a TTS error response into the sentence meant for a human plus whether the
+ * lane itself is gone. Never throws: an unparseable body still yields a line.
+ */
+export async function readLaneError(response) {
const body = await response.json().catch(() => ({}));
- return statusLine(body.error_description || body.message || `HTTP ${response.status}`);
+ return {
+ message: statusLine(body.error_description || body.message || `HTTP ${response.status}`),
+ laneDown: LANE_DOWN_CODES.has(body.error) || response.status === 503,
+ };
}
function debounce(fn, ms) {
@@ -325,6 +336,10 @@ export function mountVoiceBrowser({ root, onSelect, onCatalog }) {
const r = await fetch('/api/tts/catalog?limit=2000', {
credentials: 'include',
headers: withElevenKey({}),
+ // The catalog is cacheable for a minute, which is right for a page
+ // load and wrong for a re-read triggered by a lane going down: the
+ // browser would answer that one from the copy still listing the lane.
+ cache: silent ? 'no-store' : 'default',
});
if (!r.ok) throw new Error(`HTTP ${r.status}`);
data = await r.json();
@@ -410,7 +425,7 @@ export function mountVoiceBrowser({ root, onSelect, onCatalog }) {
credentials: 'include',
headers: withElevenKey({}),
});
- if (!r.ok) throw new Error(await laneErrorMessage(r));
+ if (!r.ok) throw new Error((await readLaneError(r)).message);
data = await r.json();
} catch (err) {
if (token !== reqToken) return;
@@ -464,9 +479,9 @@ export function mountVoiceBrowser({ root, onSelect, onCatalog }) {
body: JSON.stringify({ provider: v.provider, voiceId: v.id, text: PREVIEW_LINE }),
});
if (!r.ok) {
- // 503 is the lane saying it cannot serve at all, not this clip failing.
- laneDown = r.status === 503;
- throw new Error(await laneErrorMessage(r));
+ const failure = await readLaneError(r);
+ laneDown = failure.laneDown;
+ throw new Error(failure.message);
}
if (token !== previewToken) return;
const blob = await r.blob();
@@ -480,10 +495,10 @@ export function mountVoiceBrowser({ root, onSelect, onCatalog }) {
} finally {
btn.disabled = false;
btn.textContent = original;
- // The lane just told us it cannot serve anything. Re-read the catalog so
- // the grid stops offering voices nobody can render, rather than leaving
- // the visitor to discover the outage one card at a time. Silent, so the
- // explanation they are reading survives the refresh.
+ // The failure was the lane, not the clip: the server has already taken
+ // it off the menu, so re-read the catalog and let its voices go with it
+ // rather than leaving the visitor to discover the outage one card at a
+ // time. Silent, so the explanation they are reading survives.
if (laneDown) loadCatalog({ silent: true });
}
}