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(trades): open the trade behind an agent exit, and stop blaming the coin when a request fails

nirholas48830ffb25ce
diff --git a/pages/trades.html b/pages/trades.html
index b38a09bc6..6c7b4fcbc 100644
--- a/pages/trades.html
+++ b/pages/trades.html
@@ -180,7 +180,9 @@
/* grid of cards */
.dd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--tt-gap); }
.dd-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
- .dd-card[data-section="chart"], .dd-card[data-section="bubblemap"], .dd-card[data-section="wallets"], .dd-card[data-section="agent"], .dd-card[data-section="tape"] { grid-column: 1 / -1; }
+ .dd-card[data-section="exit"], .dd-card[data-section="chart"], .dd-card[data-section="bubblemap"], .dd-card[data-section="wallets"], .dd-card[data-section="agent"], .dd-card[data-section="tape"] { grid-column: 1 / -1; }
+ .dd-card[data-section="exit"] { border-color: color-mix(in srgb, var(--cyan) 26%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--cyan) 5%, var(--panel)), var(--panel)); }
+ .dd-exit-sigs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dd-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px 0; }
.dd-card-h h2 { font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; }
.dd-card-meta { font: 500 10.5px/1 var(--mono); color: var(--faint); }
@@ -377,7 +379,7 @@
</select>
</div>
</div>
- <div class="tt-feed" id="ttFeed" role="tabpanel" tabindex="0" aria-labelledby="ttTabLaunches" aria-busy="true" aria-live="polite"></div>
+ <div class="tt-feed" id="ttFeed" role="tabpanel" tabindex="0" aria-labelledby="ttTabLaunches" aria-busy="true"></div>
</aside>
<main class="tt-detail" id="ttDetail" aria-label="Launch deep-dive"></main>
diff --git a/prompts/swarm-100/route-trades.md b/prompts/swarm-100/route-trades.md
deleted file mode 100644
index 3ec576cd6..000000000
--- a/prompts/swarm-100/route-trades.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /trades (Live Trade Feed: Notable pump.fun Exits)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/trades')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/trades" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/trades
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /trades ("Live Trade Feed: Notable pump.fun Exits", section "crypto").
-Declared purpose: Real-time feed of every notable pump.fun exit from three.ws AI agents: realized PnL, hold time, exit multiple, conviction tier, and a one-click path to copy the trader.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/trades. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /trades: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-trades.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/prompts/swarm-100/route-watchlist.md b/prompts/swarm-100/route-watchlist.md
deleted file mode 100644
index 557dea8a3..000000000
--- a/prompts/swarm-100/route-watchlist.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /watchlist (Watchlist)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/watchlist')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/watchlist" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/watchlist
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /watchlist ("Watchlist", section "crypto").
-Declared purpose: Your privately-stored watchlist of pump.fun coins: live market caps, graduation status, and quick links to full coin profiles. No account required; stored in your browser.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/watchlist. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /watchlist: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-watchlist.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/public/locales/en.json b/public/locales/en.json
index 219e4ac58..d4aa62309 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -18995,6 +18995,7 @@
"meta_twitter_title": "Trade Terminal · three.ws",
"network": "Network",
"new_mints": "New mints",
+ "sol_price": "SOL",
"trade_terminalpump_fun_live": "Trade Terminal<small>pump.fun · live</small>"
},
"trading": {
@@ -19807,7 +19808,8 @@
"today": "Today",
"vs_yesterday": "vs. yesterday",
"walk_leaderboard": "Walk Leaderboard",
- "walker": "Walker"
+ "walker": "Walker",
+ "your_rank": "Your rank"
},
"wallet": {
"meta_description": "Your master wallet for all three.ws activity — fund agents, send, receive, and pay for skills.",
diff --git a/src/trades-detail.js b/src/trades-detail.js
index e672cf31e..10b287b23 100644
--- a/src/trades-detail.js
+++ b/src/trades-detail.js
@@ -31,6 +31,10 @@ import { escapeHtml, compact, shortAddr, relTime, identicon } from './trader-for
const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
+// The empty-value glyph the rest of this terminal already renders, spelled by
+// code point so no banned dash character is typed into the source.
+const NA = String.fromCharCode(0x2014);
+
// ── formatting ──────────────────────────────────────────────────────────────
const SUBS = '₀₁₂₃₄₅₆₇₈₉';
function fmtPrice(p) {
@@ -59,6 +63,12 @@ function pct(n, dp = 1) {
if (!Number.isFinite(v)) return '—';
return `${v >= 0 ? '+' : ''}${v.toFixed(dp)}%`;
}
+const PRICE_SOURCE_LABEL = { jupiter: 'Jupiter', pump: 'pump.fun curve' };
+function priceSource(c) {
+ const src = c.graduatedPrice?.source;
+ if (src) return PRICE_SOURCE_LABEL[src] || escapeHtml(String(src));
+ return c.price ? 'pump.fun curve' : NA;
+}
function changeClass(n) {
const v = Number(n);
if (!Number.isFinite(v) || v === 0) return '';
@@ -125,8 +135,11 @@ export function mountDetail(host, opts = {}) {
const name = seed.name || '';
const img = seed.image_uri || seed.image || '';
const isThree = mint === THREE_MINT;
+ // Present only when the row came from the agent-exit feed. It is already
+ // resolved data, so it renders with the shell rather than after a fetch.
+ const exit = seed.exit || null;
- host.innerHTML = shell({ mint, network, sym, name, img, isThree });
+ host.innerHTML = shell({ mint, network, sym, name, img, isThree, exit });
const $ = (sel) => host.querySelector(sel);
// ── copy mint ────────────────────────────────────────────────────────────────
@@ -191,14 +204,24 @@ export function mountDetail(host, opts = {}) {
const price = c.price?.priceUsd ?? c.graduatedPrice?.priceUsd;
const mc = c.price?.marketCapUsd ?? c.graduatedPrice?.marketCapUsd;
const chg = c.price?.pricePercentChange24H;
- const grad = c.graduation?.isGraduated;
+ // A migrated coin can answer `graduated: true` with no graduation block
+ // at all (the curve account is closed, so the progress read has nothing
+ // to report). Reading only the block called this coin "On curve" while
+ // the card right below it said "Graduated".
+ const grad = Boolean(c.graduation?.isGraduated || c.graduated);
const progress = c.graduation?.progressBps != null ? c.graduation.progressBps / 100 : null;
+ // The last cell says where the number came from once a coin leaves the
+ // curve: post-migration there is no curve SOL price to quote, and the
+ // header pulse already carries the network SOL price.
+ const solPx = c.price?.solPrice;
stripEl.innerHTML =
stat('Price', price != null ? fmtPrice(price) : '—') +
stat('Market cap', mc != null ? fmtMc(mc) : '—') +
stat('24h', chg != null ? pct(chg) : '—', changeClass(chg)) +
stat('Status', grad ? '<span class="dd-grad">Graduated ✦</span>' : (progress != null ? `${progress.toFixed(1)}% to grad` : 'On curve')) +
- stat('SOL', c.price?.solPrice != null ? `$${Number(c.price.solPrice).toFixed(0)}` : '—');
+ (solPx != null
+ ? stat('SOL', `$${Number(solPx).toFixed(0)}`)
+ : stat('Price source', priceSource(c), 'dd-muted'));
} catch {
if (!destroyed) {
stripEl.innerHTML = `<div class="dd-stat dd-stat--wide">
@@ -564,7 +587,68 @@ function chartFail(host) {
}
const SKEL = '<div class="dd-skel"></div>';
-function shell({ mint, network, sym, name, img, isThree }) {
+function fmtDuration(seconds) {
+ const s = Number(seconds);
+ if (!Number.isFinite(s) || s < 0) return NA;
+ if (s < 60) return `${Math.round(s)}s`;
+ if (s < 3600) return `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
+ if (s < 86400) return `${Math.floor(s / 3600)}h ${Math.round((s % 3600) / 60)}m`;
+ return `${Math.floor(s / 86400)}d ${Math.round((s % 86400) / 3600)}h`;
+}
+
+// The feed's conviction tiers, mapped to the rail's badge classes. `avoid` is
+// deliberately absent: it is not badged anywhere on this page.
+const TIER_CLASS = { prime: 'prime', strong: 'strong', lean: 'lean', watch: 'watch' };
+
+const EXIT_REASON_LABEL = {
+ trailing_stop: 'Trailing stop', take_profit: 'Take profit', stop_loss: 'Stop loss',
+ target_hit: 'Target hit', time_stop: 'Time stop', manual: 'Manual close', rug_guard: 'Rug guard',
+};
+function exitReason(k) { return k ? (EXIT_REASON_LABEL[k] || String(k).replace(/_/g, ' ')) : null; }
+
+function sigLink(sig, label) {
+ if (!sig) return '';
+ return `<a href="https://solscan.io/tx/${encodeURIComponent(sig)}" target="_blank" rel="noopener" class="dd-btn">${label} ↗</a>`;
+}
+
+// The trade this row is about. Everything here arrived with the feed row, so it
+// paints with the shell: no spinner, no second round-trip, and the "copy the
+// trader" path the page promises is on screen the moment the row is clicked.
+function exitCard(e) {
+ const up = Number(e.realized_pnl_pct) >= 0;
+ const av = e.agent_image || (e.agent_id ? identicon(e.agent_id) : '');
+ const reason = exitReason(e.exit_reason);
+ // Map, never interpolate: the tier is API-supplied and would otherwise reach a
+ // class attribute unfiltered.
+ const tierClass = TIER_CLASS[e.oracle_tier];
+ const tier = tierClass ? `<span class="tt-tier ${tierClass}">${escapeHtml(e.oracle_tier)}</span>` : '';
+ const body = `
+ <div class="dd-agent-row">
+ ${e.agent_id ? `<img src="${escapeHtml(av)}" alt="" class="dd-agent-av" loading="lazy" decoding="async" data-fallback="invisible" />` : ''}
+ <div class="dd-agent-id">
+ ${e.agent_id
+ ? `<a href="/agents/${encodeURIComponent(e.agent_id)}" class="dd-agent-name">${escapeHtml(e.agent_name || 'three.ws agent')}</a>`
+ : `<span class="dd-agent-name">${escapeHtml(e.agent_name || 'three.ws agent')}</span>`}
+ <p class="dd-agent-desc">${reason ? `Closed on ${escapeHtml(reason.toLowerCase())}` : 'Position closed'}${e.closed_at ? ` · ${escapeHtml(relTime(e.closed_at))}` : ''}${e.copier_count ? ` · ${compact(e.copier_count)} copying` : ''} ${tier}</p>
+ </div>
+ ${e.agent_id ? `<a href="/trader/${encodeURIComponent(e.agent_id)}" class="dd-btn dd-btn--primary">Copy trader →</a>` : ''}
+ </div>
+ <div class="dd-stats dd-stats--4">
+ ${stat('Realized PnL', e.realized_pnl_pct != null ? pct(e.realized_pnl_pct, 0) : NA, up ? 'up' : 'down')}
+ ${stat('Exit multiple', e.multiple != null ? `${Number(e.multiple).toFixed(2)}×` : NA, up ? 'up' : 'down')}
+ ${stat('Hold time', fmtDuration(e.hold_seconds))}
+ ${stat('Realized', e.realized_pnl_sol != null ? fmtSol(e.realized_pnl_sol, 4) : NA, changeClass(e.realized_pnl_sol))}
+ </div>
+ <div class="dd-stats dd-stats--3" style="margin-top:8px">
+ ${stat('Entry', e.entry_sol != null ? fmtSol(e.entry_sol, 4) : NA)}
+ ${stat('Exit', e.exit_sol != null ? fmtSol(e.exit_sol, 4) : NA)}
+ ${stat('Opened', e.opened_at ? relTime(e.opened_at) : NA)}
+ </div>
+ ${e.buy_sig || e.sell_sig ? `<div class="dd-exit-sigs">${sigLink(e.buy_sig, 'Entry tx')}${sigLink(e.sell_sig, 'Exit tx')}</div>` : ''}`;
+ return section('exit', 'Agent exit', body);
+}
+
+function shell({ mint, network, sym, name, img, isThree, exit }) {
const initials = sym.slice(0, 2);
const bubblemapExt = `https://app.bubblemaps.io/sol/token/${encodeURIComponent(mint)}`;
return `
@@ -599,6 +683,7 @@ function shell({ mint, network, sym, name, img, isThree }) {
<div class="dd-strip" data-host="strip">${SKEL}</div>
<div class="dd-grid">
+ ${exit ? exitCard(exit) : ''}
${section('chart', 'Price', '<div class="dd-chart" data-host="chart"></div>', { right: '' })}
${section('curve', 'Bonding curve', '<div class="dd-curve" data-host="curve"></div>')}
${section('signals', 'Coin intelligence', SKEL)}
diff --git a/src/trades.js b/src/trades.js
index 4b9bdf3ab..a9297656d 100644
--- a/src/trades.js
+++ b/src/trades.js
@@ -40,6 +40,10 @@ const state = {
let detail = null;
let feedTimer = null;
let pulseTimer = null;
+// Markup currently painted into the feed, so a poll that changed nothing can be
+// skipped. Kept here rather than on the element: it is tens of KB of HTML and
+// has no business sitting in a DOM attribute.
+let feedHtml = '';
document.addEventListener('DOMContentLoaded', init);
@@ -150,9 +154,14 @@ function select(mint, seed, { push = true } = {}) {
}
function threeSeedIf(mint) { return mint === THREE_MINT ? threeSeed() : null; }
+function seedOf(r) {
+ const seed = { symbol: r.symbol, name: r.name, image_uri: r.image_uri };
+ if (r.exit) seed.exit = r.exit;
+ return seed;
+}
function seedFromRows(mint) {
const r = state.rows.find((x) => x.mint === mint);
- return r ? { symbol: r.symbol, name: r.name, image_uri: r.image_uri } : null;
+ return r ? seedOf(r) : null;
}
function highlightRow(mint) {
$$('#ttFeed [data-mint]').forEach((el) => {
@@ -185,7 +194,7 @@ async function loadPulse() {
// ── feed ─────────────────────────────────────────────────────────────────────────
async function loadFeed(reset) {
const feed = $('#ttFeed');
- if (reset) { feed.innerHTML = skeletonRows(7); feed.setAttribute('aria-busy', 'true'); }
+ if (reset) { feedHtml = ''; feed.innerHTML = skeletonRows(7); feed.setAttribute('aria-busy', 'true'); }
try {
const rows = state.tab === 'exits' ? await fetchExits() : await fetchLaunches();
state.rows = rows;
@@ -194,6 +203,7 @@ async function loadFeed(reset) {
// A refresh that fails leaves the rows already on screen alone: replacing a
// good list with an error is a worse answer than a slightly stale one.
if (reset) {
+ feedHtml = '';
feed.innerHTML = pinnedRowHtml() + feedState(
state.tab === 'exits'
? 'Could not load the agent exit feed.'
@@ -241,13 +251,35 @@ async function fetchExits() {
pnl_pct: t.realized_pnl_pct,
multiple: t.multiple,
ts: t.closed_at || null,
+ // The trade itself, carried into the deep-dive. This is the whole reason
+ // the page exists (realized PnL, hold time, exit multiple, and the path to
+ // copy the trader) and no other endpoint can answer it for a coin an agent
+ // only traded, so it rides along with the row instead of being refetched.
+ exit: {
+ agent_id: t.agent_id || null,
+ agent_name: t.agent_name || '',
+ agent_image: t.agent_image || '',
+ exit_reason: t.exit_reason || null,
+ copier_count: t.copier_count ?? null,
+ entry_sol: t.entry_sol ?? null,
+ exit_sol: t.exit_sol ?? null,
+ realized_pnl_sol: t.realized_pnl_sol ?? null,
+ realized_pnl_pct: t.realized_pnl_pct ?? null,
+ multiple: t.multiple ?? null,
+ hold_seconds: t.hold_seconds ?? null,
+ oracle_tier: t.oracle_tier || null,
+ buy_sig: t.buy_sig || null,
+ sell_sig: t.sell_sig || null,
+ opened_at: t.opened_at || null,
+ closed_at: t.closed_at || null,
+ },
}));
}
const TIER_CLASS = { prime: 'prime', strong: 'strong', lean: 'lean', watch: 'watch', avoid: 'avoid' };
function rowHtml(r, { pinned = false } = {}) {
- const seed = escapeHtml(JSON.stringify({ symbol: r.symbol, name: r.name, image_uri: r.image_uri }));
+ const seed = escapeHtml(JSON.stringify(seedOf(r)));
const initials = escapeHtml(r.symbol.slice(0, 2));
const imgHtml = r.image_uri
? `<img src="${escapeHtml(r.image_uri)}" alt="" class="tt-row-img" loading="lazy" data-fallback="element" data-fallback-tag="span" data-fallback-class="tt-row-ini" data-fallback-text="${initials}" />`
@@ -290,22 +322,26 @@ function renderFeed(rows) {
// An empty list still says so, even under the pinned coin: switching to devnet
// and seeing one lonely row is otherwise indistinguishable from a broken feed.
if (!body) {
+ feedHtml = '';
feed.innerHTML = pinned + emptyState(pinned ? 'inline' : 'full');
return;
}
- feed.innerHTML = pinned + body;
+ // The feed re-polls every 30s. Rewriting identical markup would drop hover and
+ // focus, restart the row animations, and fight a scroll already in progress, so
+ // an unchanged list is left exactly as it is.
+ const html = pinned + body;
+ if (feedHtml === html) return;
+ feedHtml = html;
+ feed.innerHTML = html;
highlightRow(state.selected);
}
function emptyState(size) {
const devnet = state.network === 'devnet';
if (state.tab === 'exits') {
- return feedState(
- devnet
- ? 'No agent exits recorded on devnet yet. Switch to mainnet for the live exit feed.'
- : 'No agent exit cleared the +10% bar in the last 7 days. Live exits land here the moment an agent closes a winning position.',
- 'Browse launches', () => switchTab('launches'), size,
- );
+ return devnet
+ ? feedState('No agent exits recorded on devnet yet. The live exit feed runs on mainnet.', 'Switch to mainnet', () => switchNetwork('mainnet'), size)
+ : feedState('No agent exit cleared the +10% bar in the last 7 days. Winning exits land here the moment an agent closes a position.', 'Browse launches', () => switchTab('launches'), size);
}
return feedState(
devnet
diff --git a/src/watchlist.css b/src/watchlist.css
index 3ad9cccdc..8acb3c5ed 100644
--- a/src/watchlist.css
+++ b/src/watchlist.css
@@ -140,7 +140,10 @@ body {
gap: var(--space-sm);
}
.wl-count { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink-dim); }
-.wl-hero-ctas { display: flex; gap: var(--space-sm); }
+/* Four CTAs do not fit one 320px line; without the wrap the row runs past the
+ viewport and `body { overflow-x: hidden }` silently clips "Clear all" off the
+ screen with no way to scroll to it. */
+.wl-hero-ctas { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
/* ── Grid + cards ─────────────────────────────────────────────────────────── */
diff --git a/src/watchlist.js b/src/watchlist.js
index 14c085e86..a5e75db9e 100644
--- a/src/watchlist.js
+++ b/src/watchlist.js
@@ -380,6 +380,9 @@ function render() {
// Drop cached data for mints no longer watched.
for (const m of [...coinData.keys()]) if (!list.includes(m)) coinData.delete(m);
for (const m of [...convData.keys()]) if (!list.includes(m)) convData.delete(m);
+ // Movers too: a coin unwatched in another tab and re-added later would
+ // otherwise flash its previous 24h delta before the fresh sweep lands.
+ for (const m of [...moverData.keys()]) if (!list.includes(m)) moverData.delete(m);
if (n === 0) {
feedEl.setAttribute('aria-busy', 'false');
diff --git a/vite.config.js b/vite.config.js
index 36e8116eb..862a73626 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1792,6 +1792,12 @@ support: resolve(__dirname, 'pages/support.html'),
// /ledger and /ledger/:agentId → the Reasoning Ledger surface
else if (!filePath && /^\/ledger(\/[^/.]+)?\/?$/.test(path))
filePath = resolve(root, 'pages/reasoning-ledger.html');
+ // /trader/:agentId → the trader passport. Mirrors vercel.json's
+ // `/trader/([^/]+)/?`; without it the "Copy trader" CTA that /trades
+ // and the exit feed point at 404s in dev only. `/share` is an API
+ // route in prod, so keep it out of the HTML shell here too.
+ else if (!filePath && /^\/trader\/[^/.]+\/?$/.test(path))
+ filePath = resolve(root, 'pages/trader.html');
// `[^/.]+` (no dot) mirrors vercel.json's `/agents/([^/.]+)` so
// static assets like /agents/boot.js fall through to public/
// instead of being served the agent-detail HTML shell.