Skip to content

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

feat: enhance tournament detail view with improved error handling and not-found recovery

udvk9fbb30f29e96
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a73eae12e..62b8b2369 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-26
+- **A stale Arena link no longer dead-ends on a 'not found' screen** — Opening a shared tournament link after the competition has ended or rolled off used to leave you stranded on a bare 'Tournament not found' page whose only button was a Retry that could never work. Now that case turns into a way forward: a clear explanation plus a live grid of the tournaments running and starting right now, so there's always something to jump into. Genuine connection hiccups (as opposed to a missing tournament) keep a Retry alongside a 'Back to all tournaments' escape hatch. Every tournament page also gets a Share button that copies its link, sets a proper browser-tab title, and scrolls cleanly to the top as you move between views. (`/arena`) `[fix, improvement]`
- **Animation Studio gains undo, mirror, and copy/paste posing** — Posing an avatar in the Animation Studio is now far quicker. Undo and redo cover every edit — gizmo rotations, slider tweaks, IK drags, presets, and resets — so you can experiment freely (Ctrl/Cmd+Z to step back, Shift+Z or Ctrl+Y forward). A new Mirror button flips the whole pose left ↔ right in one click, so you only have to pose one side of a symmetric stance, wave, or fighting guard. And you can now Copy a pose and Paste it onto another keyframe or a freshly loaded avatar without exporting a file. Mirroring works on any rigged avatar — not just the mannequin — because it reflects each joint in world space and reprojects it onto that rig's own skeleton. Keyboard shortcuts: M to mirror, C to copy, V to paste. (`/pose`) `[feature, improvement]`
- **API endpoints answer HEAD checks instantly and shrug off cache hiccups** — Two reliability fixes for anything that talks to the three.ws API. Lightweight HEAD requests — the kind uptime monitors, link previews, and agent crawlers send to check an endpoint — used to hang on agent routes until the request timed out; they now return immediately, the same as a GET but without the body. And when our cache store has a rough moment, the platform now trips a fast circuit-breaker and serves from local memory instantly instead of making every request wait on a slow cache write. Live feeds and agent pages stay snappy through a cache blip. `[fix, infra]`
- **Avatar Studio avatars come alive — pick from 16 motions** — Your avatar no longer stands frozen in a stiff T-pose while you dress it. Avatar Studio now plays a natural looping idle the moment it loads — proof the avatar is fully rigged — and a new Animate tab lets you drive the rig live: 16 curated motions including Idle, Wave, Cheer, Celebrate, Flex, Dance, Shuffle, Rumba, Thriller, Capoeira and more. Looping motions become your avatar's resting idle, so when you Save, your avatar is captured in the relaxed stance you chose rather than a rigid pose. One-shot moves like Wave and Celebrate play once and settle back to idle automatically. (`/avatar-studio`) `[feature, improvement]`
diff --git a/agents/index.html b/agents/index.html
index 0a3f76d02..774a51d8c 100644
--- a/agents/index.html
+++ b/agents/index.html
@@ -14,7 +14,7 @@
<meta property="og:image" content="https://three.ws/og-image.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@trythreews" />
- <meta name="theme-color" content="#0a0a0c" />
+ <meta name="theme-color" content="#050505" />
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
@@ -26,18 +26,17 @@
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agents Index","description":"Browse every public 3D AI agent on three.ws.","url":"https://three.ws/agents","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
<style>
:root {
- --bg: #05060c; --panel: rgba(13,15,23,0.72); --panel-solid: #0c0e16; --line: rgba(255,255,255,0.09);
- --ink: #eaeefa; --muted: #8a92a8; --faint: rgba(255,255,255,0.45);
- --cyan: #5fe3ff; --violet: #a07bff; --gold: #fbbf24; --up: #34d399; --down: #f87171;
+ --bg: #050505; --panel: rgba(255,255,255,0.03); --panel-solid: #111111; --line: rgba(255,255,255,0.09);
+ --ink: #f6f6f6; --muted: #a8a8a8; --faint: rgba(255,255,255,0.45);
+ --accent: #ffffff;
--r: 14px; --r-sm: 9px;
- --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
+ --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
-webkit-font-smoothing: antialiased; }
- body { background: radial-gradient(52% 44% at 88% -4%, color-mix(in srgb, var(--violet) 14%, transparent), transparent 68%),
- radial-gradient(44% 38% at 2% -2%, color-mix(in srgb, var(--cyan) 11%, transparent), transparent 62%), var(--bg); }
+ body { background: radial-gradient(60% 48% at 50% -6%, rgba(255,255,255,0.05), transparent 70%), var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 18px 90px; }
@@ -45,19 +44,18 @@
/* hero */
.hero { padding: 40px 0 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12px/1 var(--mono);
- letter-spacing: .04em; text-transform: uppercase; color: var(--cyan); padding: 6px 12px;
- border: 1px solid color-mix(in srgb, var(--cyan) 28%, var(--line)); border-radius: 999px;
- background: color-mix(in srgb, var(--cyan) 8%, transparent); margin-bottom: 18px; }
+ letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 12px;
+ border: 1px solid var(--line); border-radius: 999px;
+ background: rgba(255,255,255,0.04); margin-bottom: 18px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.05; letter-spacing: -0.025em;
margin: 0 0 10px; font-weight: 800; }
- .hero h1 span { background: linear-gradient(100deg, var(--cyan), var(--violet));
- -webkit-background-clip: text; background-clip: text; color: transparent; }
+ .hero h1 span { color: var(--ink); }
.hero p { max-width: 580px; font-size: 15.5px; color: var(--muted); margin: 0 0 22px; }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px;
font-weight: 600; font-size: 14px; border: 1px solid rgba(255,255,255,0.14); transition: all .16s; cursor: pointer; }
- .btn-primary { background: linear-gradient(135deg, var(--cyan), var(--violet)); border-color: transparent; color: #050610; }
- .btn-primary:hover { opacity: .88; }
+ .btn-primary { background: var(--accent); border-color: transparent; color: #050505; }
+ .btn-primary:hover { background: rgba(255,255,255,0.88); }
.btn-ghost { background: rgba(255,255,255,0.05); color: var(--ink); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
@@ -67,11 +65,11 @@
.search-wrap input { width: 100%; background: var(--panel); border: 1px solid var(--line);
border-radius: 8px; padding: 9px 14px 9px 36px; font: 14px/1 inherit; color: var(--ink); outline: none;
transition: border-color .16s; }
- .search-wrap input:focus { border-color: color-mix(in srgb, var(--cyan) 50%, var(--line)); }
+ .search-wrap input:focus { border-color: rgba(255,255,255,0.28); }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--muted); }
select.ctrl { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
padding: 9px 12px; font: 14px/1 inherit; color: var(--ink); outline: none; cursor: pointer; }
- select.ctrl:focus { border-color: color-mix(in srgb, var(--cyan) 50%, var(--line)); }
+ select.ctrl:focus { border-color: rgba(255,255,255,0.28); }
.count-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
/* grid */
@@ -81,19 +79,20 @@
/* agent card */
.ag-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: border-color .18s, transform .18s; position: relative; overflow: hidden; }
- .ag-card:hover { border-color: color-mix(in srgb, var(--cyan) 35%, var(--line)); transform: translateY(-2px); }
+ .ag-card:hover { border-color: rgba(255,255,255,0.22); transform: translateY(-2px); }
.ag-card-link { position: absolute; inset: 0; z-index: 1; }
.ag-top { display: flex; gap: 12px; align-items: flex-start; }
.ag-avatar { width: 52px; height: 52px; border-radius: 11px; object-fit: cover;
background: rgba(255,255,255,0.07); border: 1px solid var(--line); flex-shrink: 0; }
- .ag-avatar-fallback { width: 52px; height: 52px; border-radius: 11px; background: linear-gradient(135deg, var(--violet), var(--cyan));
- display: flex; align-items: center; justify-content: center; font: 800 22px/1 var(--mono); color: #050610; flex-shrink: 0; }
+ .ag-avatar-fallback { width: 52px; height: 52px; border-radius: 11px; background: rgba(255,255,255,0.08);
+ border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
+ font: 800 22px/1 var(--mono); color: var(--ink); flex-shrink: 0; }
.ag-meta { min-width: 0; flex: 1; }
.ag-name { font-weight: 700; font-size: 15.5px; line-height: 1.2; margin-bottom: 3px;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-badge-onchain { display: inline-flex; align-items: center; gap: 4px; font: 600 10.5px/1 var(--mono);
- color: var(--up); padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--up) 12%, transparent);
- border: 1px solid color-mix(in srgb, var(--up) 30%, transparent); }
+ color: var(--ink); padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,0.07);
+ border: 1px solid rgba(255,255,255,0.16); }
.ag-desc { font-size: 13px; color: var(--muted); line-height: 1.45;
overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ag-footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
@@ -110,7 +109,7 @@
/* state */
.state { text-align: center; padding: 60px 20px; color: var(--muted); }
.state b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 8px; }
- .state a { color: var(--cyan); }
+ .state a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
/* load more */
.load-more-wrap { text-align: center; margin-top: 28px; }
diff --git a/api/_lib/oracle/sources.js b/api/_lib/oracle/sources.js
index 9f96e61d4..7b37e9e26 100644
--- a/api/_lib/oracle/sources.js
+++ b/api/_lib/oracle/sources.js
@@ -232,13 +232,16 @@ export async function walletProfile(wallet, network = 'mainnet') {
from wallet_reputation where wallet = ${wallet} and network = ${network} limit 1
`);
const recent = await tryRows(() => sql`
- select w.mint, w.buy_lamports, w.sell_lamports, w.is_creator, w.last_seen_at,
- i.symbol, i.name, i.image_uri, i.category
+ select w.mint, w.buy_count, w.sell_count, w.buy_lamports, w.sell_lamports,
+ w.base_bought, w.base_sold, w.is_creator, w.first_seen_at, w.last_seen_at,
+ i.symbol, i.name, i.image_uri, i.category, i.quality_score, i.narrative,
+ o.graduated, o.rugged, o.ath_multiple, o.last_market_cap_usd
from pump_coin_wallets w
left join pump_coin_intel i on i.mint = w.mint
+ left join pump_coin_outcomes o on o.mint = w.mint
where w.wallet = ${wallet}
order by w.last_seen_at desc
- limit 25
+ limit 60
`);
return { rep, recent };
}
diff --git a/api/traders/preview.js b/api/traders/preview.js
index adfe7b04f..ad61ef28c 100644
--- a/api/traders/preview.js
+++ b/api/traders/preview.js
@@ -36,20 +36,53 @@ export default wrap(async (req, res) => {
// Build a useful summary even if wallet_reputation doesn't have this wallet
// yet (it's scored by the smart-money rollup worker, so new wallets lag).
+ // Every per-coin number traces to a real on-chain trade aggregate in
+ // pump_coin_wallets — buy/sell lamports + base amounts + tx counts + the
+ // observed first/last-seen window — so the wallet dashboard renders deep,
+ // honest analytics with no synthesized values.
const coins = (recent || []).map((r) => {
const buySol = r.buy_lamports != null ? Number(r.buy_lamports) / LAMPORTS : null;
const sellSol = r.sell_lamports != null ? Number(r.sell_lamports) / LAMPORTS : null;
const pnlSol = buySol != null && sellSol != null ? sellSol - buySol : null;
+ // ROI on deployed capital — the canonical "Xx" a trader reads off GMGN.
+ const roi = buySol != null && sellSol != null && buySol > 0 ? (sellSol - buySol) / buySol : null;
+ const buyCount = r.buy_count != null ? Number(r.buy_count) : 0;
+ const sellCount = r.sell_count != null ? Number(r.sell_count) : 0;
+ // Tokens still held = bought − sold (base units). >0 means an open bag,
+ // so realized PnL alone understates an unclosed winner.
+ const baseBought = r.base_bought != null ? Number(r.base_bought) : null;
+ const baseSold = r.base_sold != null ? Number(r.base_sold) : null;
+ const baseHeld = baseBought != null && baseSold != null ? Math.max(0, baseBought - baseSold) : null;
+ const holdMs = r.first_seen_at && r.last_seen_at
+ ? new Date(r.last_seen_at).getTime() - new Date(r.first_seen_at).getTime()
+ : null;
+ const open = baseHeld != null ? baseHeld > 0 && (baseBought ? baseHeld / baseBought > 0.01 : false) : false;
return {
mint: r.mint,
symbol: r.symbol || null,
name: r.name || null,
image_uri: r.image_uri || null,
category: r.category || null,
+ narrative: r.narrative || null,
+ quality_score: r.quality_score != null ? Number(r.quality_score) : null,
is_creator: r.is_creator || false,
+ graduated: r.graduated ?? null,
+ rugged: r.rugged ?? null,
+ ath_multiple: r.ath_multiple != null ? Number(r.ath_multiple) : null,
+ last_market_cap_usd: r.last_market_cap_usd != null ? Number(r.last_market_cap_usd) : null,
+ buy_count: buyCount,
+ sell_count: sellCount,
+ tx_count: buyCount + sellCount,
buy_sol: buySol,
sell_sol: sellSol,
pnl_sol: pnlSol,
+ roi: roi,
+ base_bought: baseBought,
+ base_sold: baseSold,
+ base_held: baseHeld,
+ open: open,
+ hold_ms: holdMs != null && holdMs >= 0 ? holdMs : null,
+ first_seen_at: r.first_seen_at ? new Date(r.first_seen_at).toISOString() : null,
last_seen_at: r.last_seen_at ? new Date(r.last_seen_at).toISOString() : null,
};
});
@@ -59,6 +92,33 @@ export default wrap(async (req, res) => {
const wins = coins.filter((c) => c.pnl_sol != null && c.pnl_sol > 0).length;
const losses = coins.filter((c) => c.pnl_sol != null && c.pnl_sol <= 0).length;
+ // ROI distribution buckets — the GMGN "Distribution (Token N)" panel. Each
+ // closed position lands in exactly one bucket by realized return.
+ const closed = coins.filter((c) => c.roi != null && !c.open);
+ const dist = { x5: 0, x2: 0, up: 0, down: 0, rug: 0 };
+ for (const c of closed) {
+ if (c.roi >= 5) dist.x5++;
+ else if (c.roi >= 2) dist.x2++;
+ else if (c.roi >= 0) dist.up++;
+ else if (c.roi >= -0.5) dist.down++;
+ else dist.rug++;
+ }
+
+ // Holding-duration + tx aggregates across the observed window.
+ const holdMsList = coins.map((c) => c.hold_ms).filter((m) => m != null && m > 0);
+ const avgHoldMs = holdMsList.length ? Math.round(holdMsList.reduce((a, b) => a + b, 0) / holdMsList.length) : null;
+ const totalTx = coins.reduce((a, c) => a + (c.tx_count || 0), 0);
+ const openCount = coins.filter((c) => c.open).length;
+ const creatorCoins = coins.filter((c) => c.is_creator).length;
+
+ // Category mix — what this wallet actually trades.
+ const catMap = new Map();
+ for (const c of coins) {
+ const k = c.category || 'unknown';
+ catMap.set(k, (catMap.get(k) || 0) + 1);
+ }
+ const categories = [...catMap.entries()].map(([category, count]) => ({ category, count })).sort((a, b) => b.count - a.count);
+
const profile = rep ? {
coins_traded: Number(rep.coins_traded) || 0,
early_entries: Number(rep.early_entries) || 0,
@@ -88,11 +148,22 @@ export default wrap(async (req, res) => {
coins,
summary: {
total_coins: coins.length,
+ closed_coins: closed.length,
+ open_positions: openCount,
+ creator_coins: creatorCoins,
wins_in_window: wins,
losses_in_window: losses,
+ win_rate_window: closed.length ? Math.round((closed.filter((c) => c.pnl_sol > 0).length / closed.length) * 1000) / 1000 : null,
total_buy_sol: Math.round(totalBuy * 1000) / 1000,
total_sell_sol: Math.round(totalSell * 1000) / 1000,
+ total_volume_sol: Math.round((totalBuy + totalSell) * 1000) / 1000,
net_pnl_sol: Math.round((totalSell - totalBuy) * 1000) / 1000,
+ avg_buy_sol: coins.length ? Math.round((totalBuy / coins.length) * 1000) / 1000 : 0,
+ avg_sell_sol: coins.length ? Math.round((totalSell / coins.length) * 1000) / 1000 : 0,
+ total_tx: totalTx,
+ avg_hold_ms: avgHoldMs,
+ distribution: dist,
+ categories,
},
generated_at: new Date().toISOString(),
}, { 'Cache-Control': 'public, max-age=120, stale-while-revalidate=300' });
diff --git a/data/changelog.json b/data/changelog.json
index 7d456928e..d1d195610 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,13 @@
{
"$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-06-26",
+ "title": "A stale Arena link no longer dead-ends on a 'not found' screen",
+ "summary": "Opening a shared tournament link after the competition has ended or rolled off used to leave you stranded on a bare 'Tournament not found' page whose only button was a Retry that could never work. Now that case turns into a way forward: a clear explanation plus a live grid of the tournaments running and starting right now, so there's always something to jump into. Genuine connection hiccups (as opposed to a missing tournament) keep a Retry alongside a 'Back to all tournaments' escape hatch. Every tournament page also gets a Share button that copies its link, sets a proper browser-tab title, and scrolls cleanly to the top as you move between views.",
+ "tags": ["fix", "improvement"],
+ "link": "/arena"
+ },
{
"date": "2026-06-26",
"title": "Mission Control now has a real candlestick chart with live price updates",
diff --git a/public/changelog.json b/public/changelog.json
index d37807141..0b21d86ee 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,11 +1,22 @@
{
- "generated_at": "2026-06-26T06:43:53.261Z",
+ "generated_at": "2026-06-26T07:12:03.426Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
"url": "https://three.ws"
},
"entries": [
+ {
+ "date": "2026-06-26",
+ "type": "update",
+ "title": "A stale Arena link no longer dead-ends on a 'not found' screen",
+ "summary": "Opening a shared tournament link after the competition has ended or rolled off used to leave you stranded on a bare 'Tournament not found' page whose only button was a Retry that could never work. Now that case turns into a way forward: a clear explanation plus a live grid of the tournaments running and starting right now, so there's always something to jump into. Genuine connection hiccups (as opposed to a missing tournament) keep a Retry alongside a 'Back to all tournaments' escape hatch. Every tournament page also gets a Share button that copies its link, sets a proper browser-tab title, and scrolls cleanly to the top as you move between views.",
+ "link": "/arena",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-26",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index c8a7e5dd4..5b970ad75 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -6,6 +6,14 @@
<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/>
<description>What's new on three.ws — features, improvements, and releases, newest first.</description>
<language>en</language>
+ <item>
+ <title>A stale Arena link no longer dead-ends on a 'not found' screen</title>
+ <link>https://three.ws/arena</link>
+ <guid isPermaLink="false">2026-06-26:A stale Arena link no longer dead-ends on a 'not found' screen</guid>
+ <pubDate>Fri, 26 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Opening a shared tournament link after the competition has ended or rolled off used to leave you stranded on a bare 'Tournament not found' page whose only button was a Retry that could never work. Now that case turns into a way forward: a clear explanation plus a live grid of the tournaments running and starting right now, so there's always something to jump into. Genuine connection hiccups (as opposed to a missing tournament) keep a Retry alongside a 'Back to all tournaments' escape hatch. Every tournament page also gets a Share button that copies its link, sets a proper browser-tab title, and scrolls cleanly to the top as you move between views.</description>
+ </item>
<item>
<title>Animation Studio gains undo, mirror, and copy/paste posing</title>
<link>https://three.ws/pose</link>
diff --git a/public/features.json b/public/features.json
index cb5700cf2..bde7cfb96 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-26T06:43:53.249Z",
+ "generated_at": "2026-06-26T07:12:03.378Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/alpha-copilot.css b/src/alpha-copilot.css
index 274daba4c..98c8c0d80 100644
--- a/src/alpha-copilot.css
+++ b/src/alpha-copilot.css
@@ -13,7 +13,12 @@
}
/* ── hero ─────────────────────────────────────────────────────────────────── */
-.ac-hero { text-align: center; max-width: 760px; margin: 0 auto var(--space-xl); }
+.ac-hero { text-align: center; max-width: 760px; margin: 0 auto var(--space-lg); position: relative; }
+.ac-hero::before {
+ content: ''; position: absolute; left: 50%; top: -40px; transform: translateX(-50%);
+ width: 520px; max-width: 90vw; height: 320px; pointer-events: none; z-index: -1;
+ background: radial-gradient(closest-side, var(--wallet-glow), transparent 70%); opacity: 0.6;
+}
.ac-kicker {
display: inline-flex; align-items: center; gap: var(--space-xs);
font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.04em;
@@ -33,20 +38,64 @@
100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.ac-title { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1.05; margin: 0 0 var(--space-sm); color: var(--ink-bright); }
-.ac-sub { font-size: var(--text-base); color: var(--ink-dim); line-height: 1.55; margin: 0 auto var(--space-lg); max-width: 640px; }
+.ac-sub { font-size: var(--text-base); color: var(--ink-dim); line-height: 1.55; margin: 0 auto var(--space-md); max-width: 640px; }
.ac-sub strong { color: var(--ink); }
+.ac-hero-rail {
+ list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-md);
+ justify-content: center; flex-wrap: wrap;
+}
+.ac-hero-rail li { display: inline-flex; align-items: center; gap: var(--space-2xs); font-size: var(--text-2xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; font-family: var(--font-mono); }
+.ac-hero-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--wallet-accent); }
+
+/* ── agent picker (the gallery) ───────────────────────────────────────────── */
+.ac-pick { max-width: 1180px; margin: 0 auto var(--space-lg); }
+.ac-pick-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); }
+.ac-pick-title { font-family: var(--font-display); font-size: var(--text-md); color: var(--ink-bright); margin: 0; }
+.ac-pick-idtoggle {
+ background: none; border: none; cursor: pointer; padding: 0;
+ font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.03em;
+ color: var(--ink-faint); text-decoration: underline; text-underline-offset: 3px;
+ transition: color var(--duration-fast);
+}
+.ac-pick-idtoggle:hover { color: var(--wallet-accent); }
+
+.ac-pick-rail {
+ display: flex; gap: var(--space-sm); overflow-x: auto; padding: var(--space-2xs) 2px var(--space-sm);
+ scroll-snap-type: x proximity; scrollbar-width: thin;
+}
+.ac-pick-rail::-webkit-scrollbar { height: 6px; }
+.ac-pick-rail::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: var(--radius-pill); }
+
+.ac-agent-card {
+ flex: 0 0 auto; scroll-snap-align: start; width: 188px; text-align: left;
+ display: flex; align-items: center; gap: var(--space-sm);
+ background: var(--surface-glass); border: 1px solid var(--stroke); border-radius: var(--radius-md);
+ padding: var(--space-sm); cursor: pointer; color: var(--ink);
+ transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-instant);
+}
+.ac-agent-card:hover { border-color: var(--wallet-stroke); background: var(--surface-1); transform: translateY(-1px); }
+.ac-agent-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--wallet-accent-soft); }
+.ac-agent-card.is-active { border-color: var(--wallet-stroke-strong); background: var(--wallet-accent-soft); box-shadow: 0 0 0 1px var(--wallet-stroke-strong) inset; }
+.ac-agent-av { flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
+.ac-agent-av img { width: 100%; height: 100%; object-fit: cover; }
+.ac-agent-initials { font-family: var(--font-display); font-size: var(--text-sm); color: var(--wallet-accent); font-weight: 700; }
+.ac-agent-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
+.ac-agent-card .ac-agent-name { font-size: var(--text-sm); font-weight: 600; color: var(--ink-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.ac-agent-meta { font-size: var(--text-2xs); color: var(--ink-faint); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.ac-gallery-empty { padding: var(--space-md); color: var(--ink-faint); font-size: var(--text-sm); }
+.ac-skel-orb { width: 40px; height: 40px; border-radius: var(--radius-sm); flex: 0 0 auto; background: linear-gradient(90deg, var(--surface-1), var(--surface-3), var(--surface-1)); background-size: 200% 100%; animation: ac-shimmer 1.4s infinite; }
+.ac-agent-card.ac-skel { cursor: default; pointer-events: none; flex-direction: row; }
+.ac-agent-card.ac-skel .ac-skel-line { flex: 1; }
-.ac-agentpick { display: flex; gap: var(--space-sm); justify-content: center; flex-wrap: wrap; align-items: flex-end; }
-.ac-field { display: flex; flex-direction: column; gap: var(--space-2xs); text-align: left; }
-.ac-field > span { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }
-.ac-field input {
- width: min(420px, 76vw); font-family: var(--font-mono); font-size: var(--text-md);
+.ac-pick-id { display: flex; gap: var(--space-sm); margin-top: var(--space-xs); }
+.ac-id-input {
+ flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--text-sm);
padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md);
background: var(--bg-1); border: 1px solid var(--stroke); color: var(--ink);
transition: border-color var(--duration-fast) var(--ease-standard);
}
-.ac-field input:focus { outline: none; border-color: var(--wallet-focus); box-shadow: 0 0 0 3px var(--wallet-accent-soft); }
-.ac-field input.is-invalid { border-color: var(--danger); animation: ac-shake 0.3s; }
+.ac-id-input:focus { outline: none; border-color: var(--wallet-focus); box-shadow: 0 0 0 3px var(--wallet-accent-soft); }
+.ac-id-input.is-invalid { border-color: var(--danger); animation: ac-shake 0.3s; }
@keyframes ac-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* ── buttons ──────────────────────────────────────────────────────────────── */
@@ -61,6 +110,9 @@
.ac-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--wallet-accent-soft); }
.ac-btn-ghost { background: transparent; border-color: var(--stroke); color: var(--ink-dim); font-weight: 500; }
.ac-btn-ghost:hover { color: var(--ink); }
+.ac-refresh { display: inline-flex; align-items: center; gap: var(--space-2xs); font-size: var(--text-sm); padding: var(--space-2xs) var(--space-sm); }
+.ac-refresh svg { transition: transform var(--duration-base) var(--ease-emphasized); }
+.ac-refresh:hover svg { transform: rotate(-90deg); }
.ac-btn-read {
width: 100%; margin-top: var(--space-sm);
background: var(--wallet-accent-fill); border-color: var(--wallet-stroke); color: var(--wallet-accent);
@@ -93,35 +145,57 @@
/* ── stage (avatar narrator) ──────────────────────────────────────────────── */
.ac-stage { display: flex; flex-direction: column; }
.ac-stage.is-speaking { border-color: var(--wallet-stroke-strong); box-shadow: var(--shadow-2), 0 0 28px var(--wallet-glow); }
-.ac-stage-avatar { position: relative; aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 38%, rgba(139, 92, 246, 0.12), transparent 62%), var(--bg-0); }
+.ac-stage-avatar { position: relative; aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 38%, rgba(139, 92, 246, 0.14), transparent 62%), var(--bg-0); }
.ac-avatar { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity var(--duration-slow) var(--ease-out); }
.ac-avatar.ready, agent-3d.ready { opacity: 1; }
-.ac-stage-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-lg); text-align: center; color: var(--ink-faint); font-size: var(--text-sm); }
-.ac-stage-meta { padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--stroke); }
-.ac-stage-name { font-family: var(--font-display); font-size: var(--text-lg); color: var(--ink-bright); }
+.ac-stage-placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: var(--space-sm); padding: var(--space-lg); text-align: center; color: var(--ink-faint); font-size: var(--text-sm); }
+.ac-stage-orb { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, var(--wallet-accent), transparent 70%); opacity: 0.5; animation: ac-breathe 3.2s ease-in-out infinite; }
+@keyframes ac-breathe { 50% { transform: scale(1.12); opacity: 0.8; } }
+
+/* speaking equalizer overlaid on the avatar's lower edge */
+.ac-eq { position: absolute; left: 0; right: 0; bottom: var(--space-sm); display: flex; gap: 4px; justify-content: center; align-items: flex-end; height: 22px; opacity: 0; transition: opacity var(--duration-base); pointer-events: none; }
+.ac-eq.is-on { opacity: 1; }
+.ac-eq span { width: 4px; height: 6px; border-radius: var(--radius-pill); background: var(--wallet-accent); box-shadow: 0 0 8px var(--wallet-glow); }
+.ac-eq.is-on span { animation: ac-eq 0.9s ease-in-out infinite; }
+.ac-eq span:nth-child(2) { animation-delay: 0.12s; }
+.ac-eq span:nth-child(3) { animation-delay: 0.24s; }
+.ac-eq span:nth-child(4) { animation-delay: 0.36s; }
+.ac-eq span:nth-child(5) { animation-delay: 0.48s; }
+@keyframes ac-eq { 0%, 100% { height: 6px; } 50% { height: 20px; } }
+
+.ac-stage-meta { padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--stroke); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
+.ac-stage-id { min-width: 0; }
+.ac-stage-name { font-family: var(--font-display); font-size: var(--text-lg); color: var(--ink-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-stage-role { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--wallet-accent); }
+.ac-stage-link { flex: 0 0 auto; font-size: var(--text-2xs); font-family: var(--font-mono); color: var(--ink-faint); text-decoration: none; padding: var(--space-2xs) var(--space-xs); border: 1px solid var(--stroke); border-radius: var(--radius-sm); transition: color var(--duration-fast), border-color var(--duration-fast); }
+.ac-stage-link:hover { color: var(--ink); border-color: var(--wallet-stroke); }
.ac-speak { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-md); border-top: 1px solid var(--stroke); background: var(--wallet-accent-soft); }
.ac-speak.is-speaking { animation: ac-glow 1.4s ease-in-out infinite; }
@keyframes ac-glow { 50% { background: var(--wallet-accent-fill); } }
.ac-speak-btn {
flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
background: var(--wallet-accent-fill); border: 1px solid var(--wallet-stroke); color: var(--wallet-accent);
- cursor: pointer; font-size: 11px; display: grid; place-items: center;
+ cursor: pointer; display: grid; place-items: center; transition: background var(--duration-fast), color var(--duration-fast);
}
.ac-speak-btn:hover { background: var(--wallet-accent-soft); color: var(--ink-bright); }
+.ac-speak-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--wallet-accent-soft); }
.ac-speak-line { margin: 0; font-size: var(--text-md); line-height: 1.5; color: var(--ink); font-style: italic; }
/* ── the read ─────────────────────────────────────────────────────────────── */
-.ac-read { padding: var(--space-md); min-height: 220px; }
-.ac-read-empty { color: var(--ink-faint); font-size: var(--text-sm); line-height: 1.5; display: grid; place-items: center; min-height: 200px; text-align: center; }
-.ac-read-loading { display: grid; place-items: center; gap: var(--space-sm); min-height: 200px; color: var(--ink-dim); font-size: var(--text-sm); }
+.ac-read { padding: var(--space-md); min-height: 280px; }
+.ac-read-empty { color: var(--ink-faint); font-size: var(--text-sm); line-height: 1.5; display: grid; place-items: center; align-content: center; gap: var(--space-xs); min-height: 240px; text-align: center; padding: var(--space-md); }
+.ac-read-empty-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: var(--wallet-accent); background: var(--wallet-accent-soft); border: 1px solid var(--wallet-stroke); margin-bottom: var(--space-2xs); }
+.ac-read-empty-title { font-family: var(--font-display); font-size: var(--text-md); color: var(--ink-bright); margin: 0; }
+.ac-read-empty p:last-child { max-width: 320px; margin: 0; }
+.ac-read-loading { display: grid; place-items: center; gap: var(--space-sm); min-height: 240px; color: var(--ink-dim); font-size: var(--text-sm); text-align: center; }
+.ac-read-loading-fine { font-size: var(--text-2xs); color: var(--ink-faint); margin: 0; }
.ac-thinking { display: flex; gap: 5px; }
.ac-thinking span { width: 8px; height: 8px; border-radius: 50%; background: var(--wallet-accent); animation: ac-bounce 1.2s infinite; }
.ac-thinking span:nth-child(2) { animation-delay: 0.15s; }
.ac-thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ac-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }
-.ac-read-top { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-sm); }
+.ac-read-top { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); flex-wrap: wrap; }
.ac-verdict {
font-family: var(--font-display); font-size: var(--text-md); font-weight: 700;
padding: var(--space-2xs) var(--space-md); border-radius: var(--radius-pill);
@@ -130,28 +204,41 @@
.ac-verdict.is-snipe { background: rgba(74, 222, 128, 0.14); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.4); }
.ac-verdict.is-watch { background: rgba(251, 191, 36, 0.14); color: var(--warn); border: 1px solid rgba(251, 191, 36, 0.4); }
.ac-verdict.is-pass { background: rgba(248, 113, 113, 0.12); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.35); }
-.ac-conviction { display: flex; align-items: center; gap: var(--space-sm); flex: 1; }
-.ac-conviction-bar { flex: 1; height: 7px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
-.ac-conviction-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--wallet-accent), var(--wallet-accent-strong)); border-radius: var(--radius-pill); transition: width var(--duration-slow) var(--ease-emphasized); }
-.ac-conviction-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); }
-.ac-conviction-val small { color: var(--ink-faint); }
-.ac-read-target { font-family: var(--font-mono); font-size: var(--text-base); color: var(--ink-bright); margin-bottom: var(--space-sm); }
+.ac-read-target { font-family: var(--font-mono); font-size: var(--text-base); color: var(--ink-bright); }
.ac-read-coinname { color: var(--ink-dim); font-family: var(--font-body); font-size: var(--text-sm); }
-.ac-guard { display: flex; gap: var(--space-xs); align-items: flex-start; font-size: var(--text-2xs); color: var(--warn); background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25); border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-sm); margin: 0 0 var(--space-sm); line-height: 1.4; }
+.ac-conviction { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); }
+.ac-conviction-bar { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
+.ac-conviction-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--wallet-accent), var(--wallet-accent-strong)); border-radius: var(--radius-pill); transition: width var(--duration-slow) var(--ease-emphasized); }
+.ac-conviction.is-snipe .ac-conviction-bar span { background: linear-gradient(90deg, var(--success), #34d399); }
+.ac-conviction.is-pass .ac-conviction-bar span { background: linear-gradient(90deg, var(--danger), #f87171); }
+.ac-conviction.is-watch .ac-conviction-bar span { background: linear-gradient(90deg, var(--warn), #fbbf24); }
+.ac-conviction-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); white-space: nowrap; }
+.ac-conviction-val small { color: var(--ink-faint); font-size: var(--text-2xs); margin-left: 4px; }
+
+.ac-read-quote { margin: 0 0 var(--space-md); padding: var(--space-sm) var(--space-md); border-left: 2px solid var(--wallet-stroke-strong); background: var(--surface-1); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: var(--text-sm); line-height: 1.5; color: var(--ink); font-style: italic; }
+
+.ac-guard { display: flex; gap: var(--space-xs); align-items: flex-start; font-size: var(--text-2xs); color: var(--warn); background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25); border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-sm); margin: 0 0 var(--space-md); line-height: 1.4; }
.ac-guard-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-top: 5px; }
-.ac-risks { margin: 0 0 var(--space-md); padding-left: var(--space-md); display: flex; flex-direction: column; gap: var(--space-2xs); }
+.ac-risks-wrap { margin: 0 0 var(--space-md); }
+.ac-risks-head { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); margin-bottom: var(--space-xs); }
+.ac-risks { margin: 0; padding-left: var(--space-md); display: flex; flex-direction: column; gap: var(--space-2xs); }
.ac-risks li { font-size: var(--text-sm); color: var(--ink-dim); line-height: 1.45; }
+.ac-risks li::marker { color: var(--danger); }
.ac-read-signals { border: 1px solid var(--stroke); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); background: var(--surface-1); margin-bottom: var(--space-sm); }
.ac-read-signals-head { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); margin-bottom: var(--space-xs); }
.ac-read-signals-head span { color: var(--success); text-transform: none; letter-spacing: 0; }
.ac-read-signals dl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2xs) var(--space-md); margin: 0; }
-.ac-read-signals dl > div { display: flex; justify-content: space-between; gap: var(--space-sm); border-bottom: 1px dashed var(--stroke); padding: 3px 0; }
+.ac-read-signals dl > div { display: flex; justify-content: space-between; gap: var(--space-sm); border-bottom: 1px dashed var(--stroke); padding: 3px var(--space-2xs); border-radius: var(--radius-sm); }
+.ac-read-signals dl > div.is-cited { background: var(--wallet-accent-soft); border-bottom-color: transparent; position: relative; }
+.ac-read-signals dl > div.is-cited dt { color: var(--wallet-accent); }
+.ac-read-signals dl > div.is-cited dd { color: var(--ink-bright); }
.ac-read-signals dt { font-size: var(--text-sm); color: var(--ink-dim); }
.ac-read-signals dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); }
.ac-read-wallet { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-faint); margin-bottom: var(--space-sm); }
+.ac-read-wallet-k { color: var(--ink-dim); }
.ac-action { margin-top: var(--space-sm); }
.ac-action .ac-btn-act { width: 100%; }
@@ -163,21 +250,38 @@
.ac-launches { padding: var(--space-sm); display: flex; flex-direction: column; }
.ac-launches-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-xs) var(--space-sm) var(--space-sm); }
.ac-launches-head h2 { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-md); font-family: var(--font-display); margin: 0; color: var(--ink-bright); }
-.ac-launches-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 620px; overflow-y: auto; padding: 0 var(--space-2xs); }
-.ac-launch { background: var(--surface-1); border: 1px solid var(--stroke); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); transition: border-color var(--duration-fast); }
+.ac-launches-count { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-faint); background: var(--surface-2); border-radius: var(--radius-pill); padding: 1px var(--space-xs); }
+.ac-launches-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 660px; overflow-y: auto; padding: 0 var(--space-2xs) var(--space-2xs); }
+.ac-launch { position: relative; background: var(--surface-1); border: 1px solid var(--stroke); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); transition: border-color var(--duration-fast), background var(--duration-fast); }
.ac-launch:hover { border-color: var(--wallet-stroke); }
-.ac-launch-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
+.ac-launch.is-top { border-color: var(--wallet-stroke-strong); background: linear-gradient(180deg, var(--wallet-accent-soft), var(--surface-1)); }
+.ac-launch.is-reading { border-color: var(--wallet-stroke-strong); box-shadow: 0 0 0 1px var(--wallet-stroke-strong) inset; }
+.ac-launch-top { position: absolute; top: -8px; right: var(--space-md); font-family: var(--font-mono); font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--wallet-accent); background: var(--bg-1); border: 1px solid var(--wallet-stroke-strong); border-radius: var(--radius-pill); padding: 1px var(--space-xs); }
+.ac-launch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.ac-launch-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ac-launch-sym { font-family: var(--font-mono); font-weight: 700; color: var(--ink-bright); font-size: var(--text-md); }
-.ac-launch-name { font-size: var(--text-2xs); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
+.ac-launch-name { font-size: var(--text-2xs); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
+.ac-launch-num { text-align: right; display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
+.ac-launch-mc { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); }
.ac-launch-age { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-faint); }
-.ac-launch-stats { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-xs); }
-.ac-launch-stats span { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-dim); background: var(--surface-2); padding: 2px var(--space-xs); border-radius: var(--radius-sm); }
-.ac-launch-stats .is-good { color: var(--success); }
-.ac-flag { color: var(--danger) !important; background: rgba(248, 113, 113, 0.1) !important; }
+
+.ac-launch-bars { display: flex; flex-direction: column; gap: 4px; margin-top: var(--space-sm); }
+.ac-bar { display: grid; grid-template-columns: 22px 1fr 24px; align-items: center; gap: var(--space-xs); }
+.ac-bar-k { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-faint); }
+.ac-bar-track { height: 5px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
+.ac-bar-fill { display: block; height: 100%; border-radius: var(--radius-pill); transition: width var(--duration-base) var(--ease-emphasized); }
+.ac-bar.is-good .ac-bar-fill { background: var(--success); }
+.ac-bar.is-mid .ac-bar-fill { background: var(--warn); }
+.ac-bar.is-low .ac-bar-fill { background: var(--danger); }
+.ac-bar.is-empty .ac-bar-fill { background: var(--stroke-strong); }
+.ac-bar-v { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-dim); text-align: right; }
+.ac-bar.is-good .ac-bar-v { color: var(--success); }
+
+.ac-flag { display: inline-block; margin-top: var(--space-sm); font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--danger); background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3); border-radius: var(--radius-sm); padding: 1px var(--space-xs); }
/* ── shared states ────────────────────────────────────────────────────────── */
.ac-state { padding: var(--space-lg) var(--space-md); text-align: center; color: var(--ink-faint); font-size: var(--text-sm); display: flex; flex-direction: column; gap: var(--space-sm); align-items: center; }
+.ac-state-orb { width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--wallet-accent), transparent 70%); opacity: 0.45; animation: ac-breathe 3.2s ease-in-out infinite; }
.ac-state-error { color: var(--danger); }
.ac-skel { pointer-events: none; }
.ac-skel-line { height: 9px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-1), var(--surface-3), var(--surface-1)); background-size: 200% 100%; animation: ac-shimmer 1.4s infinite; margin: var(--space-2xs) 0; }
@@ -209,5 +313,6 @@
.ac-act-audit:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
- .ac-live-dot, .ac-thinking span, .ac-skel-line, .ac-speak.is-speaking, .ac-drawer-card { animation: none; }
+ .ac-live-dot, .ac-thinking span, .ac-skel-line, .ac-skel-orb, .ac-speak.is-speaking, .ac-drawer-card,
+ .ac-stage-orb, .ac-state-orb, .ac-eq span { animation: none; }
}
diff --git a/src/arena/arena.css b/src/arena/arena.css
index 12c76dda0..5f286136a 100644
--- a/src/arena/arena.css
+++ b/src/arena/arena.css
@@ -670,6 +670,28 @@
line-height: 1.5;
font-size: var(--text-md, 0.82rem);
}
+.state-icon {
+ font-size: 2.4rem;
+ line-height: 1;
+ margin-bottom: 0.7rem;
+}
+.state-actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5rem;
+ justify-content: center;
+}
+
+/* Not-found recovery: surfaced live/upcoming tournaments */
+#nf-suggest {
+ margin-top: var(--space-lg, 1.6rem);
+}
+.nf-h {
+ font-size: var(--text-base, 1rem);
+ letter-spacing: -0.01em;
+ margin: 0 0 var(--space-md, 1rem);
+ color: var(--text-2, #a8a8a8);
+}
/* ── Modal ────────────────────────────────────────────────────────────── */
.arena-modal {
diff --git a/src/arena/arena.js b/src/arena/arena.js
index b23ec3d7c..5622cdda5 100644
--- a/src/arena/arena.js
+++ b/src/arena/arena.js
@@ -311,7 +311,7 @@ async function renderDetail(id) {
detailId = id;
lastRanks = new Map();
root.replaceChildren(
- h('button', { class: 'arena-back', type: 'button', onclick: () => (location.hash = '#/') }, '← All tournaments'),
+ backButton(),
h('div', { class: 'skeleton', style: 'height:120px;margin-bottom:1.2rem' }),
h('div', { class: 'skeleton', style: 'height:340px' }),
);
@@ -320,14 +320,23 @@ async function renderDetail(id) {
try {
data = await fetchJSON(`/api/tournaments/${id}`);
} catch (err) {
+ // A 404 means the link is stale — retrying it will never succeed. Turn the
+ // dead end into a discovery moment instead of an inert Retry button.
+ if (err.status === 404) return renderNotFound();
root.replaceChildren(
- h('button', { class: 'arena-back', type: 'button', onclick: () => (location.hash = '#/') }, '← All tournaments'),
+ backButton(),
h(
'div',
{ class: 'state' },
- h('h3', {}, err.status === 404 ? 'Tournament not found' : 'Could not load this tournament'),
- h('p', {}, err.message || ''),
- h('button', { class: 'btn', type: 'button', onclick: () => renderDetail(id) }, 'Retry'),
+ h('div', { class: 'state-icon', 'aria-hidden': 'true' }, '⚠️'),
+ h('h3', {}, 'Could not load this tournament'),
+ h('p', {}, err.message || 'Something went wrong reaching the Arena. Check your connection and try again.'),
+ h(
+ 'div',
+ { class: 'state-actions' },
+ h('button', { class: 'btn btn-primary', type: 'button', onclick: () => renderDetail(id) }, 'Retry'),
+ h('button', { class: 'btn btn-ghost', type: 'button', onclick: () => (location.hash = '#/') }, 'Back to all tournaments'),
+ ),
),
);
return;
@@ -345,11 +354,75 @@ function phaseFromStatus(d) {
return 'finished';
}
+/**
+ * Not-found recovery. A shared link can outlive its tournament (ended, removed, or
+ * created on a different network). Rather than stranding the visitor on a 404, show
+ * what's live or upcoming right now so there's always a way forward.
+ */
+async function renderNotFound() {
+ stopStream();
+ document.title = `Tournament not found · ${BASE_TITLE}`;
+ const suggestions = h('div', { id: 'nf-suggest' });
+ root.replaceChildren(
+ backButton(),
+ h(
+ 'div',
+ { class: 'state' },
+ h('div', { class: 'state-icon', 'aria-hidden': 'true' }, '🏁'),
+ h('h3', {}, 'This tournament isn’t here'),
+ h(
+ 'p',
+ {},
+ 'The link may be stale, or the competition has wrapped up and rolled off. Here’s what’s happening in the Arena right now.',
+ ),
+ h('button', { class: 'btn btn-primary', type: 'button', onclick: () => (location.hash = '#/') }, 'Browse all tournaments'),
+ ),
+ suggestions,
+ );
+
+ try {
+ const data = listCache ? { tournaments: listCache } : await fetchJSON(`/api/tournaments?network=${NETWORK}`);
+ const all = data.tournaments || [];
+ listCache = all;
+ const picks = [
+ ...all.filter((t) => t.phase === 'live'),
+ ...all.filter((t) => t.phase === 'upcoming'),
+ ].slice(0, 6);
+ if (picks.length) {
+ suggestions.replaceChildren(
+ h('h2', { class: 'nf-h' }, 'Live & upcoming'),
+ h('div', { class: 'tourn-grid' }, ...picks.map(tournamentCard)),
+ );
+ startCountdowns();
+ }
+ } catch {
+ /* Suggestions are a bonus — the recovery state stands on its own without them. */
+ }
+}
+
+/** Share the deep link to a tournament (native share sheet, with clipboard fallback). */
+function shareTournament(t) {
+ const url = `${location.origin}/arena#/t/${t.id}`;
+ if (navigator.share) {
+ navigator.share({ title: `${t.name} · The Arena`, url }).catch(() => {});
+ return;
+ }
+ if (navigator.clipboard?.writeText) {
+ navigator.clipboard.writeText(url).then(
+ () => toast('Link copied to clipboard'),
+ () => toast('Could not copy the link', true),
+ );
+ return;
+ }
+ toast('Copy this link from your address bar to share', true);
+}
+
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`;
// 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.
@@ -379,6 +452,7 @@ function paintDetail(data) {
t.attestation_url
? h('a', { class: 'btn btn-ghost', href: t.attestation_url, target: '_blank', rel: 'noopener' }, '⛓ On-chain result')
: null,
+ h('button', { class: 'btn btn-ghost', type: 'button', onclick: () => shareTournament(t) }, '↗ Share'),
),
);
@@ -414,11 +488,7 @@ function paintDetail(data) {
),
);
- root.replaceChildren(
- h('button', { class: 'arena-back', type: 'button', onclick: () => (location.hash = '#/') }, '← All tournaments'),
- head,
- body,
- );
+ root.replaceChildren(backButton(), head, body);
}
function detailStats(data, phase) {
@@ -947,6 +1017,7 @@ function toLocalInput(d) {
// ───────────────────────────────────────────────────────────────────────────
function route() {
const hash = location.hash || '#/';
+ window.scrollTo({ top: 0, behavior: 'auto' });
const m = hash.match(/^#\/t\/([0-9a-f-]{36})/i);
if (m) renderDetail(m[1]);
else renderList();
diff --git a/src/trades-bubblemap.js b/src/trades-bubblemap.js
new file mode 100644
index 000000000..95ab28199
--- /dev/null
+++ b/src/trades-bubblemap.js
@@ -0,0 +1,308 @@
+/**
+ * Holder bubblemap — a dependency-free canvas force simulation of a coin's
+ * wallet footprint. Every node is a real trading wallet from
+ * /api/pump/intel (the `wallets` array); radius is proportional to the wallet's
+ * share of buy volume, colour encodes its behavioural label, and wallets that
+ * share an on-chain funder (the `cluster`/`funder` fields) are pulled together
+ * and wired with faint links — the same coordination signal that drives the
+ * conviction score, made visible.
+ *
+ * No fabricated nodes: if a coin has no enriched wallet set, the caller renders
+ * the empty state instead of mounting this. The sim is a light Verlet-ish
+ * spring/repulsion loop that settles in ~2s and then idles cheaply.
+ */
+
+import { shortAddr } from './trader-format.js';
+
+// Behavioural label → colour. Mirrors the palette the rest of the terminal uses
+// so a "whale" reads the same amber everywhere. Order matters: the first label a
+// wallet carries from this list wins as its primary colour.
+const LABEL_STYLE = [
+ ['creator', { color: '#c084fc', ring: 'rgba(192,132,252,.5)', name: 'Creator' }],
+ ['rugger', { color: '#f43f5e', ring: 'rgba(244,63,94,.5)', name: 'Rugger' }],
+ ['dumped', { color: '#f87171', ring: 'rgba(248,113,113,.5)', name: 'Dumped' }],
+ ['sniper', { color: '#fb923c', ring: 'rgba(251,146,60,.5)', name: 'Sniper' }],
+ ['bundled', { color: '#fbbf24', ring: 'rgba(251,191,36,.5)', name: 'Bundled' }],
+ ['smart_money', { color: '#34d399', ring: 'rgba(52,211,153,.5)', name: 'Smart money' }],
+ ['whale', { color: '#22d3ee', ring: 'rgba(34,211,238,.5)', name: 'Whale' }],
+ ['holding', { color: '#60a5fa', ring: 'rgba(96,165,250,.5)', name: 'Holding' }],
+ ['flipped', { color: '#94a3b8', ring: 'rgba(148,163,184,.5)', name: 'Flipped' }],
+];
+const DEFAULT_STYLE = { color: '#64748b', ring: 'rgba(100,116,139,.4)', name: 'Trader' };
+
+function styleFor(labels) {
+ const set = new Set(Array.isArray(labels) ? labels : []);
+ for (const [key, style] of LABEL_STYLE) if (set.has(key)) return { key, ...style };
+ return { key: 'trader', ...DEFAULT_STYLE };
+}
+
+// Distinct legend entries actually present in this wallet set, in palette order.
+function legendFor(nodes) {
+ const seen = new Map();
+ for (const n of nodes) if (!seen.has(n.style.key)) seen.set(n.style.key, n.style);
+ return [...seen.values()];
+}
+
+/**
+ * @param {HTMLElement} host — container; sized via CSS, the canvas fills it.
+ * @param {object} opts
+ * @param {Array} opts.wallets — /api/pump/intel `wallets[]`
+ * @param {Array} [opts.clusters] — /api/pump/intel `clusters[]` (for link weight)
+ * @param {(wallet:object)=>void} [opts.onSelect] — click a bubble
+ * @returns {{ destroy(): void }}
+ */
+export function mountBubblemap(host, opts = {}) {
+ const wallets = (Array.isArray(opts.wallets) ? opts.wallets : [])
+ .filter((w) => w && w.wallet && Number(w.buy_sol) > 0)
+ .sort((a, b) => Number(b.buy_sol) - Number(a.buy_sol))
+ .slice(0, 80); // cap for legibility + perf; these are the wallets that matter
+
+ if (!wallets.length) {
+ host.innerHTML = `<div class="bm-empty">No enriched wallet graph for this coin yet.<br>The funder map appears once first-buyer wallets are traced on-chain.</div>`;
+ return { destroy() { host.innerHTML = ''; } };
+ }
+
+ const maxBuy = Math.max(...wallets.map((w) => Number(w.buy_sol) || 0)) || 1;
+ const totalBuy = wallets.reduce((s, w) => s + (Number(w.buy_sol) || 0), 0) || 1;
+
+ host.innerHTML = `
+ <canvas class="bm-canvas" aria-label="Holder funder bubblemap"></canvas>
+ <div class="bm-tip" hidden></div>
+ <div class="bm-legend"></div>`;
+ const canvas = host.querySelector('.bm-canvas');
+ const tip = host.querySelector('.bm-tip');
+ const legendEl = host.querySelector('.bm-legend');
+ const ctx = canvas.getContext('2d');
+
+ let W = 0, H = 0, dpr = Math.min(window.devicePixelRatio || 1, 2);
+
+ // Build nodes. Radius ∝ sqrt(share) so area tracks volume share, not linear.
+ const nodes = wallets.map((w) => {
+ const buy = Number(w.buy_sol) || 0;
+ const share = buy / totalBuy;
+ const r = 7 + Math.sqrt(buy / maxBuy) * 30;
+ return {
+ w,
+ label: shortAddr(w.wallet, 4, 4),
+ style: styleFor(w.labels),
+ cluster: w.cluster ?? w.funder ?? null,
+ share,
+ r,
+ x: 0, y: 0, vx: 0, vy: 0,
+ };
+ });
+
+ // Group node indices by cluster so members spring toward a shared centroid.
+ const clusterMembers = new Map();
+ for (let i = 0; i < nodes.length; i++) {
+ const c = nodes[i].cluster;
+ if (c == null) continue;
+ if (!clusterMembers.has(c)) clusterMembers.set(c, []);
+ clusterMembers.get(c).push(i);
+ }
+ // Links only within clusters of 2+ wallets — that's the coordination story.
+ const links = [];
+ for (const idxs of clusterMembers.values()) {
+ if (idxs.length < 2) continue;
+ for (let a = 0; a < idxs.length; a++)
+ for (let b = a + 1; b < Math.min(idxs.length, a + 4); b++)
+ links.push([idxs[a], idxs[b]]);
+ }
+
+ legendEl.innerHTML = legendFor(nodes)
+ .map((s) => `<span class="bm-leg"><i style="background:${s.color}"></i>${s.name}</span>`)
+ .join('');
+
+ function resize() {
+ const rect = host.getBoundingClientRect();
+ W = Math.max(240, rect.width);
+ H = Math.max(220, rect.height);
+ dpr = Math.min(window.devicePixelRatio || 1, 2);
+ canvas.width = Math.round(W * dpr);
+ canvas.height = Math.round(H * dpr);
+ canvas.style.width = `${W}px`;
+ canvas.style.height = `${H}px`;
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
+ }
+
+ // Seed positions: scatter on a ring, biggest wallets toward the centre.
+ function seed() {
+ const cx = W / 2, cy = H / 2;
+ nodes.forEach((n, i) => {
+ const ang = (i / nodes.length) * Math.PI * 2 + (i % 3);
+ const rad = (0.2 + (1 - n.r / 40) * 0.5) * Math.min(W, H) * 0.4;
+ n.x = cx + Math.cos(ang) * rad + (i % 7 - 3);
+ n.y = cy + Math.sin(ang) * rad + (i % 5 - 2);
+ n.vx = n.vy = 0;
+ });
+ }
+
+ // One physics step: centre gravity, pairwise repulsion, cluster cohesion,
+ // link springs, wall bounce. Cheap O(n²) — n ≤ 80.
+ function step(alpha) {
+ const cx = W / 2, cy = H / 2;
+ // cluster centroids
+ const centroids = new Map();
+ for (const [c, idxs] of clusterMembers) {
+ let sx = 0, sy = 0;
+ for (const i of idxs) { sx += nodes[i].x; sy += nodes[i].y; }
+ centroids.set(c, { x: sx / idxs.length, y: sy / idxs.length });
+ }
+ for (let i = 0; i < nodes.length; i++) {
+ const n = nodes[i];
+ // gentle pull to centre
+ n.vx += (cx - n.x) * 0.0009 * alpha;
+ n.vy += (cy - n.y) * 0.0009 * alpha;
+ // cluster cohesion
+ if (n.cluster != null && centroids.has(n.cluster)) {
+ const c = centroids.get(n.cluster);
+ n.vx += (c.x - n.x) * 0.01 * alpha;
+ n.vy += (c.y - n.y) * 0.01 * alpha;
+ }
+ // repulsion
+ for (let j = i + 1; j < nodes.length; j++) {
+ const m = nodes[j];
+ let dx = n.x - m.x, dy = n.y - m.y;
+ let d2 = dx * dx + dy * dy;
+ if (d2 < 0.01) { dx = (i - j) * 0.5 + 0.1; dy = 0.1; d2 = dx * dx + dy * dy; }
+ const minD = n.r + m.r + 6;
+ const d = Math.sqrt(d2);
+ const force = (minD * minD) / d2;
+ const push = Math.min(force, 14) * alpha * 0.5;
+ const ux = dx / d, uy = dy / d;
+ n.vx += ux * push; n.vy += uy * push;
+ m.vx -= ux * push; m.vy -= uy * push;
+ }
+ }
+ // link springs hold same-funder wallets near each other
+ for (const [a, b] of links) {
+ const n = nodes[a], m = nodes[b];
+ const dx = m.x - n.x, dy = m.y - n.y;
+ const d = Math.hypot(dx, dy) || 1;
+ const rest = n.r + m.r + 18;
+ const f = (d - rest) * 0.012 * alpha;
+ const ux = dx / d, uy = dy / d;
+ n.vx += ux * f; n.vy += uy * f;
+ m.vx -= ux * f; m.vy -= uy * f;
+ }
+ // integrate + damping + walls
+ for (const n of nodes) {
+ n.vx *= 0.86; n.vy *= 0.86;
+ n.x += n.vx; n.y += n.vy;
+ if (n.x < n.r) { n.x = n.r; n.vx *= -0.4; }
+ if (n.x > W - n.r) { n.x = W - n.r; n.vx *= -0.4; }
+ if (n.y < n.r) { n.y = n.r; n.vy *= -0.4; }
+ if (n.y > H - n.r) { n.y = H - n.r; n.vy *= -0.4; }
+ }
+ }
+
+ let hovered = null;
+
+ function draw() {
+ ctx.clearRect(0, 0, W, H);
+ // links
+ ctx.lineWidth = 1;
+ for (const [a, b] of links) {
+ const n = nodes[a], m = nodes[b];
+ ctx.strokeStyle = 'rgba(251,191,36,.10)';
+ ctx.beginPath();
+ ctx.moveTo(n.x, n.y);
+ ctx.lineTo(m.x, m.y);
+ ctx.stroke();
+ }
+ // bubbles
+ for (const n of nodes) {
+ const isHover = n === hovered;
+ ctx.beginPath();
+ ctx.arc(n.x, n.y, n.r, 0, Math.PI * 2);
+ ctx.fillStyle = n.style.color + (isHover ? '40' : '26');
+ ctx.fill();
+ ctx.lineWidth = isHover ? 2 : 1.25;
+ ctx.strokeStyle = isHover ? n.style.color : n.style.ring;
+ ctx.stroke();
+ // label only on bubbles large enough to hold it
+ if (n.r >= 16) {
+ ctx.fillStyle = 'rgba(255,255,255,.82)';
+ ctx.font = '600 9px ui-monospace, monospace';
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'middle';
+ ctx.fillText(n.label, n.x, n.y);
+ }
+ }
+ }
+
+ // ── animation loop ───────────────────────────────────────────────────────────
+ let raf = 0, frame = 0, running = true;
+ function loop() {
+ if (!running) return;
+ // high alpha early for fast settle, then a low idle alpha to stay lively
+ const alpha = frame < 120 ? 1 : 0.18;
+ step(alpha);
+ draw();
+ frame++;
+ raf = requestAnimationFrame(loop);
+ }
+
+ // ── pointer: hover tooltip + click select ────────────────────────────────────
+ function nodeAt(px, py) {
+ for (let i = nodes.length - 1; i >= 0; i--) {
+ const n = nodes[i];
+ if ((px - n.x) ** 2 + (py - n.y) ** 2 <= n.r * n.r) return n;
+ }
+ return null;
+ }
+ function onMove(e) {
+ const rect = canvas.getBoundingClientRect();
+ const px = e.clientX - rect.left, py = e.clientY - rect.top;
+ const n = nodeAt(px, py);
+ hovered = n;
+ canvas.style.cursor = n ? 'pointer' : 'default';
+ if (!n) { tip.hidden = true; return; }
+ const w = n.w;
+ const pct = (n.share * 100).toFixed(n.share >= 0.1 ? 0 : 1);
+ tip.innerHTML = `
+ <div class="bm-tip-addr">${shortAddr(w.wallet, 6, 6)} <b>${n.style.name}</b></div>
+ <div class="bm-tip-row"><span>Buy</span><b>${(Number(w.buy_sol) || 0).toFixed(2)} ◎</b></div>
+ <div class="bm-tip-row"><span>Sell</span><b>${(Number(w.sell_sol) || 0).toFixed(2)} ◎</b></div>
+ <div class="bm-tip-row"><span>Share of buys</span><b>${pct}%</b></div>
+ ${w.funder ? `<div class="bm-tip-row"><span>Funder</span><b>${shortAddr(w.funder, 4, 4)}</b></div>` : ''}`;
+ tip.hidden = false;
+ const tx = Math.min(px + 14, W - 170);
+ const ty = Math.min(py + 14, H - 90);
+ tip.style.left = `${Math.max(6, tx)}px`;
+ tip.style.top = `${Math.max(6, ty)}px`;
+ }
+ function onLeave() { hovered = null; tip.hidden = true; }
+ function onClick(e) {
+ const rect = canvas.getBoundingClientRect();
+ const n = nodeAt(e.clientX - rect.left, e.clientY - rect.top);
+ if (n && typeof opts.onSelect === 'function') opts.onSelect(n.w);
+ }
+
+ canvas.addEventListener('mousemove', onMove);
+ canvas.addEventListener('mouseleave', onLeave);
+ canvas.addEventListener('click', onClick);
+
+ const ro = new ResizeObserver(() => {
+ const prevW = W;
+ resize();
+ if (!prevW) { seed(); frame = 0; }
+ });
+ ro.observe(host);
+
+ resize();
+ seed();
+ loop();
+
+ return {
+ destroy() {
+ running = false;
+ cancelAnimationFrame(raf);
+ try { ro.disconnect(); } catch { /* gone */ }
+ canvas.removeEventListener('mousemove', onMove);
+ canvas.removeEventListener('mouseleave', onLeave);
+ canvas.removeEventListener('click', onClick);
+ host.innerHTML = '';
+ },
+ };
+}
diff --git a/src/trades-tape.js b/src/trades-tape.js
new file mode 100644
index 000000000..39acd751a
--- /dev/null
+++ b/src/trades-tape.js
@@ -0,0 +1,156 @@
+/**
+ * Live trade tape for a single coin.
+ *
+ * Two real sources, no fabrication:
+ * • Seed/fallback — GET /api/pump/dex-trades (GeckoTerminal, covers graduated
+ * coins like $THREE that the bonding-curve WS never sees).
+ * • Realtime — SSE /api/pump/trades-stream?mint (PumpPortal, covers coins
+ * still on the curve). Each event prepends a row.
+ *
+ * Whichever source has data wins; both can run at once and the tape de-dupes by
+ * signature. A coin that is fully graduated simply shows the dex seed and the
+ * stream stays quiet — that is honest, not broken.
+ */
+
+import { createSseClient } from './mission-control/realtime.js';
+import { shortAddr } from './trader-format.js';
+
+const MAX_ROWS = 60;
+
+function fmtAmt(sol) {
+ const n = Number(sol);
+ if (!Number.isFinite(n)) return '—';
+ if (n >= 1000) return `${(n / 1000).toFixed(1)}k`;
+ if (n >= 1) return n.toFixed(2);
+ return n.toFixed(3);
+}
+function fmtUsd(n) {
+ const v = Number(n);
+ if (!Number.isFinite(v) || v <= 0) return '';
+ if (v >= 1000) return `$${(v / 1000).toFixed(1)}k`;
+ return `$${v.toFixed(0)}`;
+}
+function ago(tsSec) {
+ const s = Math.max(0, Math.floor(Date.now() / 1000) - Number(tsSec || 0));
+ if (s < 60) return `${s}s`;
+ if (s < 3600) return `${Math.floor(s / 60)}m`;
+ return `${Math.floor(s / 3600)}h`;
+}
+
+function normalize(t) {
+ const sig = t.signature || t.tx_signature || t.txHash || null;
+ const isBuy = t.is_buy ?? (t.txType === 'buy' || t.tx_type === 'buy');
+ return {
+ sig,
+ isBuy: Boolean(isBuy),
+ sol: Number(t.sol_amount ?? t.solAmount),
+ usd: Number(t.sol_value_usd),
+ trader: t.trader || t.owner || t.user || null,
+ ts: Number(t.timestamp) || Math.floor(Date.now() / 1000),
+ };
+}
+
+function rowHtml(t) {
+ const side = t.isBuy ? 'buy' : 'sell';
+ const usd = fmtUsd(t.usd);
+ const traderCell = t.trader
+ ? `<a href="https://solscan.io/account/${t.trader}" target="_blank" rel="noopener" class="tp-trader">${shortAddr(t.trader, 4, 4)}</a>`
+ : '<span class="tp-trader tp-trader--anon">—</span>';
+ return `<div class="tp-row tp-${side}" data-sig="${t.sig || ''}">
+ <span class="tp-side">${t.isBuy ? 'BUY' : 'SELL'}</span>
+ <span class="tp-amt">${fmtAmt(t.sol)} ◎</span>
+ <span class="tp-usd">${usd}</span>
+ ${traderCell}
+ <span class="tp-time">${ago(t.ts)}</span>
+ </div>`;
+}
+
+/**
+ * @param {HTMLElement} host
+ * @param {object} opts
+ * @param {string} opts.mint
+ * @returns {{ destroy(): void }}
+ */
+export function mountTradeTape(host, opts = {}) {
+ const mint = String(opts.mint || '').trim();
+ host.innerHTML = `
+ <div class="tp-head">
+ <span class="tp-live" data-state="off"><span class="tp-live-dot"></span>live tape</span>
+ <span class="tp-cols"><span>SIDE</span><span>SOL</span><span>USD</span><span>TRADER</span><span>AGE</span></span>
+ </div>
+ <div class="tp-body" data-host="rows"><div class="tp-msg">Loading recent trades…</div></div>`;
+
+ const rowsEl = host.querySelector('[data-host="rows"]');
+ const liveEl = host.querySelector('.tp-live');
+
+ const seen = new Set();
+ const rows = [];
+ let destroyed = false;
+ let sse = null;
+ let ageTimer = null;
+
+ function render() {
+ if (!rows.length) {
+ rowsEl.innerHTML = '<div class="tp-msg">No recent trades on this venue.</div>';
+ return;
+ }
+ rowsEl.innerHTML = rows.map(rowHtml).join('');
+ }
+
+ function add(raw, { prepend = true } = {}) {
+ const t = normalize(raw);
+ if (t.sig && seen.has(t.sig)) return false;
+ if (t.sig) seen.add(t.sig);
+ if (!Number.isFinite(t.sol)) return false;
+ if (prepend) rows.unshift(t); else rows.push(t);
+ if (rows.length > MAX_ROWS) rows.length = MAX_ROWS;
+ return true;
+ }
+
+ async function seed() {
+ try {
+ const r = await fetch(`/api/pump/dex-trades?mint=${encodeURIComponent(mint)}&limit=40`, {
+ headers: { accept: 'application/json' },
+ });
+ if (!r.ok) throw new Error(String(r.status));
+ const data = await r.json();
+ const list = Array.isArray(data?.trades) ? data.trades : [];
+ // newest first
+ list.sort((a, b) => Number(b.timestamp) - Number(a.timestamp));
+ for (const t of list) add(t, { prepend: false });
+ } catch {
+ /* dex venue may not exist (pre-graduation) — the stream covers it */
+ }
+ if (!destroyed) render();
+ }
+
+ function startStream() {
+ sse = createSseClient({
+ url: `/api/pump/trades-stream?mint=${encodeURIComponent(mint)}`,
+ events: {
+ trade: (d) => {
+ if (destroyed || !d || d.mint !== mint) return;
+ if (add(d, { prepend: true })) render();
+ },
+ close: () => {},
+ },
+ onState: (state) => { liveEl.dataset.state = state === 'live' ? 'on' : 'off'; },
+ });
+ sse.start();
+ }
+
+ // Re-render the relative ages every 5s so the tape feels alive even when quiet.
+ ageTimer = setInterval(() => { if (!destroyed && rows.length) render(); }, 5_000);
+
+ seed();
+ startStream();
+
+ return {
+ destroy() {
+ destroyed = true;
+ clearInterval(ageTimer);
+ try { sse?.stop(); } catch { /* already stopped */ }
+ host.innerHTML = '';
+ },
+ };
+}