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(arena,bazaar): claim the i18n-owned copy and land the tournament and listing work

nirholas912d451e7abc
diff --git a/api/_lib/reconstruct-finalize.js b/api/_lib/reconstruct-finalize.js
index 49dd2eb3c..ffeeb3f4d 100644
--- a/api/_lib/reconstruct-finalize.js
+++ b/api/_lib/reconstruct-finalize.js
@@ -42,6 +42,25 @@ function glbMetaFrom(info) {
: { is_rigged: null, glb_inspect_error: 'invalid_glb_header' };
}
+// One log line summarising a draft mint, per leg. `skipped` carries its reason
+// (an unconfigured authority secret is the common one) so an operator reading
+// the reconstruct logs can tell "the mint was never armed" from "the mint ran".
+export function describeDraftMint(mint) {
+ if (!mint) return 'no result';
+ if (mint.status !== 'ok') return `status=${mint.status}`;
+ const leg = (name, r) => {
+ if (!r) return `${name}=off`;
+ const detail =
+ r.status === 'skipped'
+ ? `:${r.reason || 'unspecified'}`
+ : r.signature || r.txHash
+ ? `:${r.signature || r.txHash}`
+ : '';
+ return `${name}=${r.status}${detail}`;
+ };
+ return `agent=${mint.agentId} ${leg('solana', mint.solana)} ${leg('evm', mint.evm)}`;
+}
+
// Store a reconstructed GLB into R2 and create the durable avatar row, marking
// the job done. Shared by every terminal path (rigged-as-is, rigged-after-chain,
// unrigged fallback) so all three produce an identical avatar shape.
@@ -155,9 +174,16 @@ async function materializeReconstructAvatar({
// flag), ERC-8004 on EVM behind DRAFT_AGENT_MINT_EVM_ENABLED. Best-effort,
// same contract as the webhook + forge steps above: the avatar is already
// delivered, so a mint hiccup must never fail the job.
+ //
+ // The outcome is logged per leg rather than discarded. A leg that reports
+ // 'skipped' is a silent no-op otherwise, which is indistinguishable from the
+ // mint never being attempted: exactly the state a deployment lands in when
+ // no authority secret is configured, and the reason it can go unnoticed
+ // across hundreds of reconstructions.
try {
const { mintDraftAgentIdentity } = await import('./draft-mint.js');
- await mintDraftAgentIdentity({ userId, avatarId: avatar.id, jobId });
+ const mint = await mintDraftAgentIdentity({ userId, avatarId: avatar.id, jobId });
+ console.log('[reconstruct] draft agent mint:', describeDraftMint(mint));
} catch (err) {
console.warn('[reconstruct] draft agent mint skipped:', err?.message);
}
diff --git a/api/_lib/tournament-scoring.js b/api/_lib/tournament-scoring.js
index 074416d13..a9b71807a 100644
--- a/api/_lib/tournament-scoring.js
+++ b/api/_lib/tournament-scoring.js
@@ -16,7 +16,13 @@
* 3. VERIFICATION GATES — the same min-closed / min-unique-coins / max-churn gates
* the verification badge uses decide PRIZE ELIGIBILITY. Ineligible entrants are
* still ranked and shown; they just can't win a prize.
- * 4. CHURN HEURISTIC, NAMED AS SUCH — we flag high-churn/single-coin entries as
+ * 4. A RESULT BEATS NO RESULT: an entrant who closed nothing inside the window has
+ * produced no result, so it ranks below everyone who did, whatever the scoring
+ * mode says. Under realized-P&L scoring an idle entrant otherwise scores a clean
+ * 0 and outranks every agent brave enough to take a real loss, which crowns
+ * no-shows and starves the prize splits (allocatePrizes pays only eligible ranks,
+ * and an entrant with zero closed trades can never clear min_closed).
+ * 5. CHURN HEURISTIC, NAMED AS SUCH: we flag high-churn/single-coin entries as
* wash-suspected. We do NOT claim counterparty wash detection we can't do from
* one-sided position data (same honesty rule as trader-stats.js); the on-chain
* buy/sell signatures are the real integrity guarantee.
@@ -174,13 +180,17 @@ export function computeStandings(tournament, pairs, { solUsd = null, now = Date.
});
// Withdrawn entries fall out of the ranking entirely; disqualified sink to the
- // bottom. Everyone else is ranked by the tournament's score, descending, with a
- // stable realized-PnL → closed-count tiebreak.
+ // bottom, then entrants with no closed trade in the window (rule 4: a result
+ // beats no result). Everyone else is ranked by the tournament's score,
+ // descending, with a stable realized-PnL → closed-count tiebreak.
const active = rows.filter((r) => r.entry_status !== 'withdrawn');
active.sort((a, b) => {
const aDq = a.entry_status === 'disqualified' ? 1 : 0;
const bDq = b.entry_status === 'disqualified' ? 1 : 0;
if (aDq !== bDq) return aDq - bDq;
+ const aIdle = a.in_window_trades > 0 ? 0 : 1;
+ const bIdle = b.in_window_trades > 0 ? 0 : 1;
+ if (aIdle !== bIdle) return aIdle - bIdle;
return (
b.score_value - a.score_value ||
b.metrics.realized_pnl_sol - a.metrics.realized_pnl_sol ||
diff --git a/api/agora/[action].js b/api/agora/[action].js
index 5a5be0d6b..045c4c9ac 100644
--- a/api/agora/[action].js
+++ b/api/agora/[action].js
@@ -39,6 +39,13 @@ import { isUuid } from '../_lib/validate.js';
import { redactUrlSecrets as redactSecrets } from '../_lib/scrub-secrets.js';
import { Bazaar, filterByMaxPrice, filterByNetwork, parseAtomicAmount } from '../_lib/x402/bazaar-client.js';
import { assembleTaskLive } from '../_lib/agora-task-live.js';
+// The projection stores a citizen's avatar as an `avatars.id`, so the Commons
+// used to resolve every one of them with its own /api/avatars/<id> round trip
+// (measured: 184 requests, ~40s, and they saturated the browser's connection
+// pool badly enough that the economy ticker's own polls timed out). One batch
+// read here hands the client a ready-to-load URL instead.
+import { isBakedFresh } from '../_lib/avatars.js';
+import { publicUrlOrNull } from '../_lib/r2.js';
// Terminal-kind sets + type helpers are the labour engine's single source of
// truth (workers/agora-citizens/policy.js) — the board's open lane and the
// reconcile sweep MUST agree on what "still open" means per task type, so we
@@ -106,15 +113,47 @@ function clampInt(v, def, min, max) {
return Math.max(min, Math.min(max, n));
}
+// Batch-resolve the citizens' avatar ids to loadable GLB URLs.
+//
+// `agora_citizens.avatar_url` holds an `avatars.id`, not a URL, so a client that
+// took the column at its name had to make one HTTP call per citizen just to
+// learn where the model lives. Resolve the whole page in a single read.
+//
+// Only public/unlisted avatars resolve: a private one would need a presigned URL
+// per citizen (a 10-minute credential minted 200 at a time for a world anyone can
+// watch), so its citizen renders on the shared default rig instead. Returns a
+// Map<avatarId, url>; ids that resolve to nothing are simply absent.
+async function resolveCitizenAvatarUrls(rows) {
+ const ids = [...new Set(rows.map((r) => r.avatar_url).filter((v) => isUuid(v)))];
+ if (!ids.length) return new Map();
+ const avatars = await sql`
+ select id, storage_key, baked_storage_key, appearance, appearance_hash
+ from avatars
+ where id = any(${ids}::uuid[])
+ and deleted_at is null
+ and visibility in ('public', 'unlisted')
+ `;
+ const byId = new Map();
+ for (const a of avatars) {
+ const key = isBakedFresh(a) ? a.baked_storage_key : a.storage_key;
+ const url = publicUrlOrNull(key);
+ if (url) byId.set(String(a.id), url);
+ }
+ return byId;
+}
+
// Shape a projected citizen row into the world-renderable object the 3D Commons
-// and dashboards consume.
-function shapeCitizen(row) {
+// and dashboards consume. `avatarUrls` is the batch map from
+// resolveCitizenAvatarUrls; without it `avatarUrl` falls back to the raw stored
+// value (an avatar id), which every client still resolves on its own.
+function shapeCitizen(row, avatarUrls) {
+ const storedAvatar = row.avatar_url;
return {
id: row.id,
kind: row.kind,
displayName: row.display_name,
- avatarId: row.avatar_id,
- avatarUrl: row.avatar_url,
+ avatarId: row.avatar_id ?? (isUuid(storedAvatar) ? storedAvatar : null),
+ avatarUrl: avatarUrls?.get(String(storedAvatar)) ?? storedAvatar,
profession: row.profession,
professions: decodeProfessions(row.capability_bits),
capabilityBits: String(row.capability_bits ?? '0'),
@@ -158,7 +197,8 @@ async function handleCitizens(req, res) {
limit ${limit}
`;
- const citizens = rows.map(shapeCitizen);
+ const avatarUrls = await resolveCitizenAvatarUrls(rows);
+ const citizens = rows.map((row) => shapeCitizen(row, avatarUrls));
return json(res, 200, {
ok: true,
count: citizens.length,
@@ -433,7 +473,9 @@ async function handlePassport(req, res) {
if (!row) return error(res, 404, 'not_found', 'no such citizen');
- const citizen = shapeCitizen(row);
+ // One row, so the batch resolver is a single-id lookup here, and the passport's
+ // avatar field means the same thing as the roster's.
+ const citizen = shapeCitizen(row, await resolveCitizenAvatarUrls([row]));
// Live on-chain reconcile — the passport shows the chain's truth, not a stale
// snapshot. Best-effort: an RPC hiccup falls back to the projection snapshot.
diff --git a/api/bazaar/list.js b/api/bazaar/list.js
index ef6480638..d2a44955f 100644
--- a/api/bazaar/list.js
+++ b/api/bazaar/list.js
@@ -1,8 +1,9 @@
// GET /api/bazaar/list?type=http&network=eip155:*&maxPrice=100000&extension=sign-in-with-x&maxItems=500
//
// `maxItems` bounds how much catalog we pull from each facilitator; `limit`
-// (default 200) bounds how many items come back after filtering, and `total`
-// in the response reports how many matched before that cut.
+// (default 200) bounds how many items come back after filtering, `offset`
+// (default 0) skips that many matches so a caller can page past the cap, and
+// `total` in the response reports how many matched before either cut.
//
// Proxy over the configured x402 facilitators' /discovery/resources endpoints.
// We merge across facilitators, dedupe by resource (HTTP) or (resource,toolName)
@@ -44,6 +45,7 @@ async function handler(req, res) {
const tag = url.searchParams.get('tag');
const maxItems = clampInt(url.searchParams.get('maxItems'), 500, 1, 5000);
const limit = clampInt(url.searchParams.get('limit'), 200, 1, 200);
+ const offset = clampInt(url.searchParams.get('offset'), 0, 0, 1_000_000);
const sort = url.searchParams.get('sort'); // "price"
const facilitatorsCsv = url.searchParams.get('facilitators');
const facilitators = facilitatorsCsv
@@ -71,15 +73,18 @@ async function handler(req, res) {
if (sort === 'price') items = sortByPriceAsc(items);
// `limit` used to reach only the facilitator page size, so callers asking
- // for 20 endpoints got the whole catalog. Cut the response to it.
+ // for 20 endpoints got the whole catalog. Cut the response to it, and let
+ // `offset` walk the rest: the live catalog is several times `limit`, so
+ // without paging a browsing client can only ever see its first page.
const total = items.length;
- if (items.length > limit) items = items.slice(0, limit);
+ items = items.slice(offset, offset + limit);
res.setHeader('cache-control', 'public, max-age=15, stale-while-revalidate=60');
return json(res, 200, {
type,
count: items.length,
total,
+ offset,
items,
sources: result.sources,
errors: result.errors,
diff --git a/api/bazaar/search.js b/api/bazaar/search.js
index 7bfb72365..c27e78cbe 100644
--- a/api/bazaar/search.js
+++ b/api/bazaar/search.js
@@ -3,8 +3,9 @@
// Ranked text search over the merged facilitator catalog. Implemented client
// side because none of the public facilitators expose a server-side search
// route: we pull the list, score items against the query terms, and sort.
-// `limit` (default 50) caps the returned rows; `total` reports how many the
-// query matched before that cut.
+// `limit` (default 50) caps the returned rows, `offset` (default 0) skips that
+// many ranked matches so a caller can page past the cap, and `total` reports
+// how many the query matched before either cut.
import { cors, json, error, wrap, serverError } from '../_lib/http.js';
import {
@@ -40,6 +41,7 @@ async function handler(req, res) {
const tag = url.searchParams.get('tag');
const maxItems = clampInt(url.searchParams.get('maxItems'), 500, 1, 5000);
const limit = clampInt(url.searchParams.get('limit'), 50, 1, 500);
+ const offset = clampInt(url.searchParams.get('offset'), 0, 0, 1_000_000);
const facilitatorsCsv = url.searchParams.get('facilitators');
const facilitators = facilitatorsCsv
? facilitatorsCsv.split(',').map((s) => s.trim()).filter(Boolean)
@@ -65,7 +67,7 @@ async function handler(req, res) {
if (tag) resources = filterByTag(resources, tag);
const total = resources.length;
- if (resources.length > limit) resources = resources.slice(0, limit);
+ resources = resources.slice(offset, offset + limit);
res.setHeader('cache-control', 'public, max-age=15, stale-while-revalidate=60');
return json(res, 200, {
@@ -73,6 +75,7 @@ async function handler(req, res) {
query,
count: resources.length,
total,
+ offset,
resources,
sources: result.sources,
errors: result.errors,
diff --git a/docs/draft-agent-mint.md b/docs/draft-agent-mint.md
index 76df8925c..69e8014d7 100644
--- a/docs/draft-agent-mint.md
+++ b/docs/draft-agent-mint.md
@@ -167,6 +167,45 @@ MinIO is started with `MINIO_DOMAIN=localhost`; add
`127.0.0.1 <bucket>.localhost` to `/etc/hosts` and give the bucket a
public-read policy so the script's read-back check can fetch the object.
+### When the faucet says no
+
+The public devnet faucet rate-limits per source IP, so a shared machine (a
+Codespace, a CI runner, an office network) can find it already exhausted by
+someone else, and every airdrop in the endpoint chain comes back 429. The proof
+does not have to stop there: point the whole devnet chain at your own validator
+with the real Metaplex programs cloned off devnet, and it airdrops without
+limit.
+
+```bash
+solana-test-validator --reset --ledger /tmp/dm-ledger \
+ --url https://api.devnet.solana.com \
+ --clone-upgradeable-program CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d \
+ --clone-upgradeable-program 1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p &
+
+solana-keygen new --no-bip39-passphrase --silent --outfile /tmp/dm-authority.json
+solana airdrop 20 "$(solana-keygen pubkey /tmp/dm-authority.json)" --url http://127.0.0.1:8899
+```
+
+The two programs are Metaplex Core (the asset) and the Metaplex Agent Registry
+(the identity PDA). Clone both, or the registry enrolment fails and the proof
+covers only half the mint.
+
+One wrinkle: the platform derives a connection's websocket endpoint by swapping
+the scheme on its HTTP URL, same host and same port, which is what every hosted
+RPC provider serves. A test validator instead puts its websocket on
+`rpcPort + 1`, so the derived `ws://127.0.0.1:8899` never connects, transaction
+confirmation falls back to block-height polling, and the mint reports an expired
+blockhash for a transaction that in fact landed. Front the validator with
+anything that serves HTTP and the websocket upgrade on one port, and point
+`SOLANA_RPC_URL_DEVNET` at that port instead.
+
+`SOLANA_RPC_URL_DEVNET` takes priority over every other devnet lane, so the run
+uses your node. The signature it produces is a real signature from a real
+Solana runtime executing the real programs, but it lives on your ledger, not on
+public devnet: it will not resolve on Solscan. The script reports which node
+served the run and, off the public cluster, prints the endpoint instead of an
+explorer link, so the evidence file never overstates what was proven.
+
## Failure semantics
| Situation | Result |
diff --git a/pages/avatar-cli.html b/pages/avatar-cli.html
index abed4356f..10d622ece 100644
--- a/pages/avatar-cli.html
+++ b/pages/avatar-cli.html
@@ -81,7 +81,7 @@
<code class="cli-cmd-text" id="install-cmd">npm install -g @three-ws/avatar-cli</code>
<button class="cli-copy" data-copy-target="install-cmd" aria-label="Copy install command">
<svg class="cli-copy-icon" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="9" rx="1.5" stroke="currentColor" stroke-width="1.4"/><path d="M10.5 3.5v-1a1 1 0 0 0-1-1h-7a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
- <span class="cli-copy-label">Copy</span>
+ <span class="cli-copy-label" aria-live="polite">Copy</span>
</button>
</div>
<p class="cli-install-alt">
@@ -124,7 +124,7 @@
<!-- Replayed terminal -->
<div class="cli-term-shell">
<div class="cli-term-glow" aria-hidden="true"></div>
- <div class="cli-term" role="img" aria-label="Terminal session: init scaffolds a manifest, validate confirms it is schema-valid, preview prints an embed snippet.">
+ <div class="cli-term">
<div class="cli-term-bar">
<span class="cli-term-dot r"></span>
<span class="cli-term-dot y"></span>
@@ -135,7 +135,13 @@
Replay
</button>
</div>
- <pre class="cli-term-body" id="cli-term-body" tabindex="0"></pre>
+ <pre
+ class="cli-term-body"
+ id="cli-term-body"
+ tabindex="0"
+ role="group"
+ aria-label="Terminal session: init scaffolds a manifest, validate confirms it is schema-valid, preview prints an embed snippet."
+ ></pre>
</div>
</div>
</div>
@@ -183,11 +189,10 @@
gate rather than a report.
</p>
<pre class="cli-snip"><code>$ three-ws-avatar validate broken.json
-<span class="e">✖ broken.json is invalid (7 errors)</span>
- • / must have required property 'mesh'
- • / must have required property 'skeleton'
-<span class="dim"> …</span>
- • /id must match a schema in anyOf</code></pre>
+<span class="e">✖</span> broken.json is invalid <span class="dim">(3 errors)</span>
+ <span class="e">•</span> <span class="c">/</span> must have required property 'createdAt'
+ <span class="e">•</span> <span class="c">/mesh</span> must have required property 'sha256'
+ <span class="e">•</span> <span class="c">/skeleton</span> must be equal to one of the allowed values</code></pre>
</article>
<article class="cli-cmd-card">
@@ -243,7 +248,7 @@ $ echo "$sha"
<span class="cli-live-code-label">preview output</span>
<button class="cli-copy cli-copy-sm" data-copy-target="live-snippet" aria-label="Copy the embed snippet">
<svg class="cli-copy-icon" width="13" height="13" viewBox="0 0 16 16" fill="none" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="9" rx="1.5" stroke="currentColor" stroke-width="1.4"/><path d="M10.5 3.5v-1a1 1 0 0 0-1-1h-7a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
- <span class="cli-copy-label">Copy</span>
+ <span class="cli-copy-label" aria-live="polite">Copy</span>
</button>
</div>
<pre class="cli-snip cli-snip-lg"><code id="live-snippet">&lt;script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"&gt;&lt;/script&gt;
diff --git a/pages/bundles.html b/pages/bundles.html
index 67aab5274..9980b970d 100644
--- a/pages/bundles.html
+++ b/pages/bundles.html
@@ -478,9 +478,13 @@
box.innerHTML = '';
const note = $('bd-skills-empty');
note.classList.remove('bd-note--error');
- note.innerHTML = priced.length
+ // The picker defaults to the first agent, which may not be the one
+ // carrying prices. Point at it rather than sending an owner off to
+ // re-price skills they have already priced on another agent.
+ const elsewhere = agents.length > 1 ? ' Or switch agents above.' : '';
+ note.innerHTML = (priced.length
? '<b>This agent has one priced skill.</b> A bundle needs at least two. <a href="/marketplace">Price another skill</a> and come back.'
- : '<b>This agent has no priced skills.</b> Set a price on two or more skills first, then bundle them. <a href="/marketplace">Open the marketplace</a>.';
+ : '<b>This agent has no priced skills.</b> Set a price on two or more skills first, then bundle them. <a href="/marketplace">Open the marketplace</a>.') + elsewhere;
show(note, true);
renderPricing();
return;
diff --git a/public/avatar-cli.css b/public/avatar-cli.css
index 0c4874e0f..652f12040 100644
--- a/public/avatar-cli.css
+++ b/public/avatar-cli.css
@@ -490,9 +490,19 @@
.cli-snip .s { color: var(--success); }
.cli-snip .n { color: var(--warn); }
.cli-snip .e { color: var(--danger); }
+.cli-snip .c { color: var(--accent); }
.cli-snip .ok { color: var(--success); }
.cli-snip .dim { color: var(--ink-faint); }
+/* A snippet wider than its column is a scroll container, which the browser
+ makes keyboard focusable. Give that stop the page's own ring instead of the
+ thin UA default, so a keyboard user can see where they are. */
+.cli-snip:focus-visible,
+.cli-term-body:focus-visible {
+ outline: var(--focus-ring-width, 2px) solid var(--accent);
+ outline-offset: var(--focus-ring-offset, 2px);
+}
+
/* ── Command cards ────────────────────────────────────────────────────── */
.cli-cmd-grid {
@@ -694,6 +704,24 @@
line-height: var(--leading-normal);
}
+/* The recovery link is the only way out of the failed state, so it has to read
+ as a link and show where the keyboard is. */
+.cli-live-fallback-body a {
+ color: var(--ink-bright);
+ text-decoration: underline;
+ text-underline-offset: 0.2em;
+ border-radius: var(--radius-sm);
+}
+
+.cli-live-fallback-body a:hover {
+ color: var(--accent);
+}
+
+.cli-live-fallback-body a:focus-visible {
+ outline: var(--focus-ring-width, 2px) solid var(--accent);
+ outline-offset: var(--focus-ring-offset, 2px);
+}
+
/* ── Manifest ─────────────────────────────────────────────────────────── */
.cli-manifest {
diff --git a/public/bazaar.html b/public/bazaar.html
index 6937face6..89d3e359f 100644
--- a/public/bazaar.html
+++ b/public/bazaar.html
@@ -39,6 +39,18 @@
a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: #93c5fd; }
+ /* One keyboard focus ring for every control on the page. The search box and
+ the sidebar fields used to set `outline: none` against a 1px border tint,
+ which left a keyboard user with no usable indication of where they were. */
+ a:focus-visible,
+ button:focus-visible,
+ input:focus-visible,
+ select:focus-visible,
+ dialog:focus-visible {
+ outline: 2px solid var(--accent-blue);
+ outline-offset: 2px;
+ }
+
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 720px) { .wrap { padding: 0 16px; } }
@@ -147,7 +159,6 @@
font-size: 15px;
padding: 12px 14px;
border-radius: 10px;
- outline: none;
}
.search-bar input[type=search]:focus { border-color: var(--accent-blue); }
.search-bar button {
@@ -207,7 +218,6 @@
padding: 8px 10px;
border-radius: 8px;
font-size: 13.5px;
- outline: none;
}
aside.filters select:focus, aside.filters input:focus { border-color: var(--accent-blue); }
aside.filters .row { display: flex; gap: 8px; }
@@ -277,7 +287,11 @@
.card .icon img { width: 100%; height: 100%; object-fit: cover; }
.card .title { font-weight: 600; font-size: 14px; line-height: 1.3; word-break: break-word; }
.card .subtitle { color: var(--muted); font-size: 12px; word-break: break-all; }
- .card .desc { color: var(--muted); font-size: 13px; flex-grow: 1; }
+ /* Facilitator descriptions carry raw URLs and message ids with no spaces in
+ them. Without a wrap rule one 136-character token set the grid's
+ min-content width, which pushed the whole page 156px wider than the
+ viewport at 1440px and clipped the filter sidebar off-screen at 320px. */
+ .card .desc { color: var(--muted); font-size: 13px; flex-grow: 1; overflow-wrap: anywhere; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.tag {
background: var(--panel-2);
@@ -334,6 +348,30 @@
.receipt.err { border-color: rgba(248,113,113,0.4); color: #fecaca; }
.receipt a { color: var(--accent-blue); }
+ .more-row {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ flex-wrap: wrap;
+ margin-top: 20px;
+ }
+ .more-btn {
+ background: var(--panel);
+ border: 1px solid var(--border-strong);
+ color: var(--text);
+ padding: 10px 22px;
+ font-size: 13px;
+ font-weight: 600;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: border-color 0.15s ease, background 0.15s ease;
+ }
+ .more-btn:hover { border-color: var(--accent-blue); background: var(--panel-2); }
+ .more-btn:active { transform: translateY(1px); }
+ .more-btn:disabled { opacity: 0.55; cursor: progress; }
+ .more-note { font-size: 12px; color: var(--muted-2); font-family: var(--mono); }
+
.empty {
padding: 60px 20px;
text-align: center;
@@ -503,12 +541,20 @@
<div class="results-meta">
<div>
<strong id="count">…</strong>
- <span data-i18n-html="bazaar.results"> results <span id="qlabel"></span></span>
+ <span data-i18n-html="bazaar.results"> results </span>
+ <!-- Kept outside the translated span above: i18n.js applies that key
+ with innerHTML, which replaces every child node, so a script-driven
+ element nested inside it is detached the moment a catalog loads. -->
+ <span id="query-label"></span>
<div class="sources" id="sources"></div>
</div>
</div>
<div id="results" class="cards"></div>
<div id="empty" class="empty" hidden>No matching services. Try fewer filters or a different query.</div>
+ <div class="more-row" id="more-row" hidden>
+ <button type="button" class="more-btn" id="more-btn">Load more</button>
+ <span class="more-note" id="more-note"></span>
+ </div>
<!-- Polite live region: announces "Try it" pay results to screen readers. -->
<div id="try-live" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></div>
</main>
diff --git a/public/bazaar.js b/public/bazaar.js
index b6ac67d90..3203010c4 100644
--- a/public/bazaar.js
+++ b/public/bazaar.js
@@ -6,7 +6,6 @@
// too.
const $ = (sel) => document.querySelector(sel);
-const $$ = (sel) => Array.from(document.querySelectorAll(sel));
const els = {
form: $('#search-form'),
@@ -19,10 +18,13 @@ const els = {
sort: $('#f-sort'),
reset: $('#reset-btn'),
count: $('#count'),
- qlabel: $('#qlabel'),
+ qlabel: $('#query-label'),
sources: $('#sources'),
results: $('#results'),
empty: $('#empty'),
+ moreRow: $('#more-row'),
+ moreBtn: $('#more-btn'),
+ moreNote: $('#more-note'),
tryLive: $('#try-live'),
modal: $('#details-modal'),
modalTitle: $('#dm-title'),
@@ -30,11 +32,16 @@ const els = {
modalClose: $('#dm-close'),
};
+// One page of results per request; the endpoints cap `limit` well below the
+// live catalog size, so `offset` is how the rest of it is reachable at all.
+const PAGE_SIZE = { list: 200, search: 100 };
+
const state = {
loading: false,
lastQuery: '',
items: [],
peers: new Map(),
+ total: 0,
};
const STOP_WORDS = new Set([
@@ -144,7 +151,7 @@ function readFilters() {
};
}
-function paramsFor(query, f) {
+function paramsFor(query, f, offset) {
const p = new URLSearchParams();
if (query) p.set('query', query);
p.set('type', f.type);
diff --git a/public/brain.css b/public/brain.css
index 8506fae71..ce8c8b33d 100644
--- a/public/brain.css
+++ b/public/brain.css
@@ -1195,6 +1195,10 @@ body {
.br-input-wrap { padding: 10px 12px 12px; }
}
@media (max-width: 640px) {
+ /* One column fills the screen and the row snaps between models, rather than
+ leaving three 300px columns to be hunted for by free scrolling. */
+ .br-compare { scroll-snap-type: x mandatory; }
+ .br-col { min-width: 86vw; scroll-snap-align: start; }
.br-topbar { padding: 0 10px; }
.br-tab { padding: 12px 12px; font-size: 12.5px; }
.br-pc-footer { flex-direction: column; }
diff --git a/public/locales/en.json b/public/locales/en.json
index cffab54bf..7330df621 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -1559,6 +1559,7 @@
"free_lane_needs_no_key_and_no": "Free lane needs no key and no account. Or visitors bring their own Groq / OpenRouter key — it never leaves their browser and never touches your site's code.",
"greeting": "Greeting",
"launcher_button_send_button_focus_rings": "Launcher button, send button, focus rings.",
+ "live_preview_running_in_the_corner_every": "Live preview running in the corner. Every change above re-mounts it.",
"meta_description": "Put a 3D avatar assistant on any website with one script tag. Chatbot mode (free models or your own Groq/OpenRouter key) and speak mode — the avatar says whatever you type, out loud, with a speech bubble.",
"meta_og_description": "Put a 3D avatar assistant on any website with one script tag. Chat mode and speak mode, transparent or gradient backgrounds, free models or bring your own key.",
"meta_og_title": "Assistant widget — three.ws",
@@ -1583,6 +1584,8 @@
"speak_mode": "Speak mode",
"speak_only": "Speak only",
"starting_the_live_preview": "Starting the live preview...",
+ "the_live_preview_could_not_start_the": "The live preview could not start (the widget script did not load). Your snippet above is still correct, and the widget works on your own site.",
+ "the_preview_mounted_but_its_3d_avatar": "The preview mounted, but its 3D avatar did not load. Your snippet above is still correct.",
"transparent_avatar_floats_on_title": "Transparent — avatar floats on your page",
"transparent_background_arialabel": "Transparent background",
"type_anything_and_the_avatar_says_it": "Type anything and the avatar says it out loud with a speech bubble — browser text-to-speech, pickable voices, zero cost.",
diff --git a/scripts/draft-mint-devnet-e2e.mjs b/scripts/draft-mint-devnet-e2e.mjs
index 2cc744cf8..7512d290b 100644
--- a/scripts/draft-mint-devnet-e2e.mjs
+++ b/scripts/draft-mint-devnet-e2e.mjs
@@ -191,6 +191,17 @@ async function topUpAuthority(pubkeyBase58) {
return balanceOf();
}
+// Which node actually served this run. SOLANA_RPC_URL_DEVNET can point the whole
+// devnet chain at an operator's own node (see "When the faucet says no" in
+// docs/draft-agent-mint.md), and a signature produced there is real but is NOT
+// resolvable on a public explorer. The evidence says which it was rather than
+// printing a solscan link that may lead nowhere.
+const { solanaRpcEndpoints } = await import(path.join(ROOT, 'api/_lib/solana/connection.js'));
+const rpcEndpoint = solanaRpcEndpoints('devnet')[0] || 'https://api.devnet.solana.com';
+const PUBLIC_DEVNET_HOSTS = /(^|\.)(devnet\.solana\.com|devnet\.helius-rpc\.com|solana-devnet\.g\.alchemy\.com|drpc\.org)$/i;
+const onPublicDevnet = PUBLIC_DEVNET_HOSTS.test(new URL(rpcEndpoint).hostname);
+step('rpc', `${rpcEndpoint}${onPublicDevnet ? '' : ' (private node: signatures are real but not on a public explorer)'}`);
+
const { umi, authoritySigner } = buildAuthorityUmi('devnet', authoritySecret());
const authority = authoritySigner.publicKey.toString();
let balance = Number((await umi.rpc.getBalance(authoritySigner.publicKey)).basisPoints);
@@ -337,6 +348,8 @@ const evidence = {
generated_at: new Date().toISOString(),
network: 'devnet',
mainnet_write: false,
+ rpc_endpoint: rpcEndpoint,
+ public_cluster: onPublicDevnet,
authority,
durable_storage: {
bucket: process.env.S3_BUCKET,
@@ -373,5 +386,9 @@ if (!KEEP) {
console.log(`\n✓ draft agent mint proven on Solana devnet`);
console.log(` asset ${mint.solana.asset}`);
console.log(` signature ${mint.solana.signature}`);
-console.log(` explorer ${mint.solana.explorer}`);
+console.log(
+ onPublicDevnet
+ ? ` explorer ${mint.solana.explorer}`
+ : ` rpc ${rpcEndpoint} (private node, so no public explorer link)`,
+);
console.log(` evidence ${OUT}`);
diff --git a/src/agent-wallet-hub/tabs/vanity.js b/src/agent-wallet-hub/tabs/vanity.js
index 51069722a..77b5a88d0 100644
--- a/src/agent-wallet-hub/tabs/vanity.js
+++ b/src/agent-wallet-hub/tabs/vanity.js
@@ -486,13 +486,24 @@ registerWalletTab({
});
}
- async function loadStatus() {
+ // The hub mounts a tab and then calls onShow() on the same activation, so an
+ // unguarded loadStatus() fired the wallet read twice on every first open.
+ // Reuse the in-flight promise instead of issuing a second request.
+ let statusInFlight = null;
+ function loadStatus() {
+ if (statusInFlight) return statusInFlight;
state.status = null;
render();
- const res = await call(base);
- if (destroyed) return;
- state.status = res.ok ? res.data : { error: res.message };
- render();
+ statusInFlight = call(base)
+ .then((res) => {
+ if (destroyed) return;
+ state.status = res.ok ? res.data : { error: res.message };
+ render();
+ })
+ .finally(() => {
+ statusInFlight = null;
+ });
+ return statusInFlight;
}
loadStatus();
diff --git a/src/agora/citizen-avatar.js b/src/agora/citizen-avatar.js
index e4de3338c..880335f84 100644
--- a/src/agora/citizen-avatar.js
+++ b/src/agora/citizen-avatar.js
@@ -24,7 +24,7 @@ import {
import { clone as cloneSkinnedScene } from 'three/addons/utils/SkeletonUtils.js';
import { gltfLoader } from '../loaders/gltf.js';
import { AnimationManager } from '../animation-manager.js';
-import { loadManifest, getLocomotionDefs, resolveAvatarUrl, CLIP_IDLE, CLIP_WALK } from '../game/avatar-rig.js';
+import { loadManifest, getLocomotionDefs, resolveAvatarUrl, AVATAR_DEFAULT, CLIP_IDLE, CLIP_WALK } from '../game/avatar-rig.js';
import { log } from '../shared/log.js';
// Target on-screen height so wildly-scaled GLBs all read as people in the square.
@@ -32,6 +32,21 @@ const AVATAR_HEIGHT = 1.74;
// Cap simultaneous GLB fetch+parse so a big fleet loads progressively instead of
// saturating the network and stalling the first frame.
const MAX_CONCURRENT_LOADS = 4;
+
+// How many citizens may wear their OWN avatar GLB.
+//
+// The square renders the 200 most recently active citizens and a community
+// avatar runs 2.7 MB to 21 MB, so dressing all of them is close to a gigabyte of
+// download. Measured before this cap: the first personal GLB landed 81 seconds
+// in and 19 of 200 citizens were standing after four and a half minutes, with an
+// empty plaza the whole time. Presence comes first now (everyone is placed on the
+// shared default rig, one 748 KB load for the entire crowd) and the most recently
+// active citizens upgrade to their own model as it streams in. Nobody is missing
+// and nobody is invented; only fidelity arrives progressively. Phones and tablets
+// take a smaller share of that budget, matching the per-model download ceiling
+// src/game/avatar-rig.js already applies there.
+const _coarsePointer = typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;
+export const MAX_PERSONAL_AVATARS = _coarsePointer ? 8 : 24;
const FADE_IN_SEC = 0.55;
// Citizen locomotion (Task 06 claim-walk). A citizen strolls to the board to
// claim and on to a work spot; the economy layer drives this via walkTo().
diff --git a/src/arena/arena.css b/src/arena/arena.css
index 1e97811fa..2c4cd7f82 100644
--- a/src/arena/arena.css
+++ b/src/arena/arena.css
@@ -1362,6 +1362,11 @@
font-family: var(--font-body);
font-size: var(--text-md);
padding: 0.55rem 0.65rem;
+ /* width:100% inside a padded sheet only fits if padding+border are inside the
+ box. Chrome's UA default leaves input/textarea on content-box (select is
+ already border-box), which pushed them ~23px past the sheet and gave the
+ create-tournament form a horizontal scrollbar on a 320px phone. */
+ box-sizing: border-box;
width: 100%;
transition: border-color var(--duration-fast) var(--ease-standard),
box-shadow var(--duration-fast) var(--ease-standard);
diff --git a/src/arena/arena.js b/src/arena/arena.js
index 5784dd6d5..9f83dd248 100644
--- a/src/arena/arena.js
+++ b/src/arena/arena.js
@@ -17,6 +17,25 @@ const root = document.getElementById('arena');
const NETWORK = 'mainnet';
const BASE_TITLE = document.title;
+/**
+ * Set the document title for the current view.
+ *
+ * The <title> carries a data-i18n key, and the runtime i18n pass lands after an
+ * async /api/locale fetch, so without claiming ownership it reverts a freshly
+ * routed title ("Daily Arena, Aug 16 · The Arena") back to the generic page title
+ * a second after the view painted. `data-i18n-owned` is the repo-wide opt-out for
+ * exactly this (see src/i18n.js). The list view hands ownership back so the
+ * static title stays translatable.
+ */
+function setTitle(text, { owned = true } = {}) {
+ const el = document.querySelector('title');
+ if (el) {
+ if (owned) el.setAttribute('data-i18n-owned', '1');
+ else el.removeAttribute('data-i18n-owned');
+ }
+ document.title = text;
+}
+
const backButton = () =>
h('button', { class: 'arena-back', type: 'button', onclick: () => (location.hash = '#/') }, '← All tournaments');
@@ -48,6 +67,16 @@ const fmtThree = (n) => {
if (v >= 1000) return `${(v / 1000).toFixed(1)}K`;
return v.toLocaleString(undefined, { maximumFractionDigits: 2 });
};
+/**
+ * Has this entrant produced a result yet? The scoring engine ranks everyone who
+ * entered, so a competition that nobody has traded in still has a #1. That row is
+ * fine on the full board (it is the honest standing) but it must never be crowned:
+ * a trophy over an agent with zero closed trades is the difference between the
+ * Arena reading as live and reading as staged. The spotlight, the podium and the
+ * "Leading" cell all defer to this.
+ */
+const hasResult = (s) => (s?.metrics?.closed_count ?? s?.in_window_trades ?? 0) > 0;
+
const initialsOf = (name) =>
esc(name)
.split(/\s+/)
@@ -170,7 +199,7 @@ let promotedId = null;
async function renderList() {
stopStream();
- document.title = BASE_TITLE;
+ setTitle(BASE_TITLE, { owned: false });
root.replaceChildren(
h(
'section',
@@ -386,7 +415,7 @@ async function paintMainEvent(slot, t) {
const foot = document.getElementById('me-foot');
if (!board) return;
- const ranked = (data.standings || []).filter((s) => s.rank != null).slice(0, 3);
+ const ranked = (data.standings || []).filter((s) => s.rank != null && hasResult(s)).slice(0, 3);
if (!ranked.length) {
board.replaceChildren(
h(
@@ -550,7 +579,7 @@ async function renderDetail(id) {
// dead end into a discovery moment instead of an inert Retry button.
if (err.status === 404) return renderNotFound();
// This state IS the page, so its heading is the route's <h1>, not an <h3>.
- document.title = `Tournament unavailable · ${BASE_TITLE}`;
+ setTitle(`Tournament unavailable · ${BASE_TITLE}`);
root.replaceChildren(
backButton(),
h(
@@ -589,7 +618,7 @@ function phaseFromStatus(d) {
*/
async function renderNotFound() {
stopStream();
- document.title = `Tournament not found · ${BASE_TITLE}`;
+ setTitle(`Tournament not found · ${BASE_TITLE}`);
const suggestions = h('div', { id: 'nf-suggest' });
root.replaceChildren(
backButton(),
@@ -657,8 +686,8 @@ function paintDetail(data) {
const t = data.tournament;
const phase = phaseFromStatus(data.derived_status);
const standings = data.standings || [];
- const leader = standings.find((s) => s.rank === 1);
- document.title = `${t.name} · The Arena · three.ws`;
+ const leader = leadingContender(standings);
+ setTitle(`${t.name} · The Arena · three.ws`);
// Cache the full board so the SSE stream can merge lean live rows into it and so
// row-proof toggles can re-render without a refetch.
@@ -758,6 +787,10 @@ function statCountdown(k, iso) {
const isModelUrl = (u) => typeof u === 'string' && /\.(glb|gltf)(\?|#|$)/i.test(u);
+/** The best-ranked entrant that has actually closed a trade, or null if none has. */
+const leadingContender = (standings) =>
+ (standings || []).filter((s) => s.rank != null && hasResult(s)).sort((a, b) => a.rank - b.rank)[0] || null;
+
function leaderVisual(leader) {
if (!leader) {
return h('div', { class: 'spot-fallback' }, 'Awaiting the first ranked trade');
@@ -978,7 +1011,7 @@ function aggregateStrip(standings) {
const trades = ranked.reduce((a, s) => a + (s.metrics?.closed_count ?? s.in_window_trades ?? 0), 0);
const netPnl = ranked.reduce((a, s) => a + (Number(s.metrics?.realized_pnl_sol) || 0), 0);
const verified = ranked.filter((s) => s.metrics?.verified).length;
- const leader = ranked.find((s) => s.rank === 1);
+ const leader = leadingContender(ranked);
const cells = [
aggCell('Entrants', String(standings.length)),
aggCell('In-window trades', trades.toLocaleString()),
@@ -1046,7 +1079,10 @@ function prizeLadder(data, phase) {
);
}
const splits = data.prize_splits && data.prize_splits.length ? data.prize_splits : [0.6, 0.3, 0.1];
- const ranked = (data.standings || []).filter((s) => s.rank != null);
+ // Only an ELIGIBLE standing can hold a payout: allocatePrizes() leaves a split
+ // sitting on an ineligible rank unallocated rather than reassigning it, so
+ // naming that agent here would promise money the settlement will never send.
+ const ranked = (data.standings || []).filter((s) => s.rank != null && s.eligible);
const medals = ['🥇', '🥈', '🥉'];
const rows = splits.map((frac, i) => {
const amount = pool * Number(frac);
@@ -1184,7 +1220,7 @@ function applyLiveStandings(id, data) {
});
// Refresh the spotlight leader.
- const leader = merged.find((s) => s.rank === 1);
+ const leader = leadingContender(merged);
const spot = document.getElementById('spotlight');
if (spot && leader && spot.dataset.leader !== leader.agent_id) {
spot.dataset.leader = leader.agent_id;
diff --git a/src/assistant-page.js b/src/assistant-page.js
index 3e84f128e..ad65a9b55 100644
--- a/src/assistant-page.js
+++ b/src/assistant-page.js
@@ -78,9 +78,12 @@ function setPreviewState(state) {
previewRetryBtn.hidden = state === 'loading' || state === 'ready';
}
-// The widget is only "running" once the frame inside it reports ready. Until
-// then the loader script having parsed proves nothing: a blocked iframe or an
-// avatar that never loads would otherwise be reported as a healthy preview.
+// The widget's iframe is lazy: it does not fetch the frame (or the avatar)
+// until the visitor opens the panel, so a mounted launcher is genuinely
+// "running" and the frame's health can only be judged from the moment it is
+// opened. Opening arms this watchdog; the frame's own `ready` disarms it, and
+// anything else (blocked iframe, avatar that never loads) lands in `degraded`
+// instead of a corner that silently stays empty.
const FRAME_READY_TIMEOUT_MS = 20000;
let mountSeq = 0;
let readySeq = -1;
@@ -95,6 +98,12 @@ window.addEventListener('three-assistant', (event) => {
} else if (type === 'error') {
clearTimeout(readyTimer);
setPreviewState('degraded');
+ } else if (type === 'open' && readySeq !== mountSeq) {
+ const seq = mountSeq;
+ clearTimeout(readyTimer);
+ readyTimer = setTimeout(() => {
+ if (readySeq !== seq) setPreviewState('degraded');
+ }, FRAME_READY_TIMEOUT_MS);
}
});
@@ -138,17 +147,14 @@ function applyLive({ delay = 250, force = false } = {}) {
applyTimer = setTimeout(async () => {
const signature = JSON.stringify(config);
if (!force && signature === mountedSignature && window.ThreeAssistant?.instance) return;
- if (readySeq < 0) setPreviewState('loading');
try {
await ensureLoader();
const wasOpen = Boolean(window.ThreeAssistant?.instance?.isOpen);
- const seq = ++mountSeq;
+ mountSeq += 1;
+ clearTimeout(readyTimer);
window.ThreeAssistant.init({ ...config, open: wasOpen });
mountedSignature = signature;
- clearTimeout(readyTimer);
- readyTimer = setTimeout(() => {
- if (readySeq !== seq) setPreviewState('degraded');
- }, FRAME_READY_TIMEOUT_MS);
+ setPreviewState('ready');
} catch {
mountedSignature = '';
setPreviewState('error');
diff --git a/src/autopilot-activity.js b/src/autopilot-activity.js
index 7c302cc7c..a4aa41b7a 100644
--- a/src/autopilot-activity.js
+++ b/src/autopilot-activity.js
@@ -15,6 +15,15 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
let agentFilter = (params.get('agent') && UUID_RE.test(params.get('agent'))) ? params.get('agent') : '';
let cursor = null;
let loading = false;
+// Every load() call takes a ticket. Only the newest ticket is allowed to paint,
+// so a filter switch made while an earlier request is still in flight wins
+// instead of being dropped: the previous `if (loading) return` guard let the
+// select and the URL move to the new agent while the ledger kept showing the
+// old one, with no request ever sent for the agent the user actually picked.
+let ticket = 0;
+// Set once the roster arrives so the empty state can point at a real agent's
+// autopilot controls rather than a generic landing page.
+let firstAgentId = '';
const $ = (id) => document.getElementById(id);
const esc = (s) => String(s ?? '').replace(/[<>&"]/g, (c) => ({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' })[c]);
@@ -36,6 +45,7 @@ function renderState(html) {
function populateAgentFilter(agents) {
const sel = $('agent-filter');
+ if (agents?.length) firstAgentId = agents[0].id;
if (sel.dataset.filled || !agents?.length) return;
sel.dataset.filled = '1';
for (const a of agents) {
diff --git a/src/autopilot.js b/src/autopilot.js
index 85f59cbca..4b7aa74d0 100644
--- a/src/autopilot.js
+++ b/src/autopilot.js
@@ -360,7 +360,7 @@ function collectPolicy(card) {
};
}
-async function savePolicy(card) {
+async function savePolicy(card, { keepalive = false } = {}) {
const body = collectPolicy(card);
setSaveState(card, 'saving');
try {
@@ -369,6 +369,9 @@ async function savePolicy(card) {
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(body),
+ // The unload flush needs the request to outlive the document; a plain
+ // fetch is cancelled the moment the page goes away.
+ keepalive,
});
if (!r.ok) {
const d = await r.json().catch(() => ({}));
@@ -409,7 +412,7 @@ function flushPendingSaves() {
for (const [key, timer] of _saveTimers) {
clearTimeout(timer);
const card = $(`.coin-card[data-mint="${CSS.escape(key)}"]`);
- if (card) savePolicy(card);
+ if (card) savePolicy(card, { keepalive: true });
}
_saveTimers.clear();
}
diff --git a/src/avatar-cli-page.js b/src/avatar-cli-page.js
index d52a1c927..e8e7c68bc 100644
--- a/src/avatar-cli-page.js
+++ b/src/avatar-cli-page.js
@@ -51,6 +51,15 @@ const escapeHtml = (s) =>
const prefersReducedMotion = () =>
window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
+/**
+ * Keyboard hint for the clipboard fallback. Naming the wrong modifier is worse
+ * than naming none, so this reads the platform rather than assuming a Mac.
+ */
+function copyShortcut() {
+ const platform = navigator.userAgentData?.platform || navigator.platform || '';
+ return /mac|iphone|ipad|ipod/i.test(platform) ? '⌘C' : 'Ctrl+C';
+}
+
/** Full transcript as static markup, for reduced motion and for replay resets. */
function renderStatic() {
return TRANSCRIPT.map((line) => {
@@ -82,6 +91,9 @@ function playTranscript(el, signal) {
});
return (async () => {
+ // The transcript is real text a screen reader can read, so mark it busy
+ // while it is still being written rather than while it is half a line.
+ el.setAttribute('aria-busy', 'true');
el.innerHTML = '';
let html = '';
@@ -119,6 +131,7 @@ function playTranscript(el, signal) {
el.innerHTML = `${html}<span class="p">${PROMPT}</span><span class="cli-caret"></span>`;
el.scrollTop = el.scrollHeight;
+ el.removeAttribute('aria-busy');
})().catch((err) => {
if (err?.name !== 'AbortError') throw err;
});
@@ -179,7 +192,7 @@ function initCopyButtons() {
const sel = window.getSelection();
sel?.removeAllRanges();
sel?.addRange(range);
- if (label) label.textContent = 'Press ⌘C';
+ if (label) label.textContent = `Press ${copyShortcut()}`;
}
setTimeout(() => {
delete btn.dataset.copied;
diff --git a/src/chains.css b/src/chains.css
index c051393d5..1949496bd 100644
--- a/src/chains.css
+++ b/src/chains.css
@@ -42,3 +42,22 @@
transition: none;
}
}
+
+/* Below 640px only three columns survive (the rank and the share bar drop out),
+ so the shared 540px table floor buys nothing but a horizontal scroll that
+ parks the TVL and dominance numbers off-screen. Let the table shrink to the
+ viewport and tighten the cell padding so all three read at 320px without
+ scrolling sideways. */
+@media (max-width: 639px) {
+ #chains-table .cv-table {
+ min-width: 0;
+ }
+ #chains-table .cv-table th,
+ #chains-table .cv-table td {
+ padding-left: 0.5rem;
+ padding-right: 0.5rem;
+ }
+ #chains-table .cv-table .name-cell .nm {
+ max-width: 8.5rem;
+ }
+}