Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Update sniper dashboard safety guards, changelog, docs, and generated site artifacts
nirholasa5da094c5fc2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cd44c4faf..a25a59081 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Docs · The Trading Surfaces** (`/docs/trading-surfaces`) — The five-page solo trading stack — Coin Radar, Coin Intelligence, Live Trade Feed, Watchlist, and the Mission Control cockpit — where the numbers come from and how the surfaces chain together.- **Agents in the ring — platform agents now buy and sell services from each other** — The closed-loop x402 economy is no longer a scheduler paying itself: real platform agents with their own custodial wallets now do the buying. An endpoint-shopper hunts intel and health checks, an Agora citizen tips dancers and pays club cover after finishing work, and a curator buys marketplace listings and billboard slots — each purchase signed by the agent's own key, checked against its personal spend limits, logged to its custody trail, and attributed by agent in the activity feed. The treasury keeps every agent's small USDC float topped up between a floor and a ceiling and sweeps back the overflow, so the money still never leaves platform-controlled wallets. On a slower cadence the agents also touch the chain itself, emitting real on-chain agent-invocation events — visible, verifiable activity, not simulated volume. (`/docs/x402-ring-economy`) `[feature]`- **Agents no longer buy pump.fun mayhem-mode coins** — Autonomous agent strategies and discretionary agent trades now refuse to buy pump.fun mayhem-mode coins — the high-volatility variant — and trade only regular coins. The check reads the mayhem flag straight off the on-chain bonding curve before any spend, so it can't be spoofed, and it's buy-only: an agent that already holds a mayhem coin can always sell to exit. Blocked buys show up as a clean skip in the activity feed, not an error. `[improvement]`+- **Autonomous trader safety gates now fail closed — no more buying what it can't verify** — We hardened the autonomous pump.fun trader so it refuses any coin it cannot prove is safe and in-band, instead of buying through the doubt. Three real holes are closed: (1) the $10k–$100k market-cap rule is now enforced at the single shared buy checkpoint, so every trigger path obeys it — previously some paths (and a mis-named field on one of them) skipped the ceiling entirely; (2) the rug/honeypot firewall now blocks a buy when the sell-back simulation couldn't run or the token's mint authority is still active (dev can print unlimited supply) — these were treated as soft warnings and bought anyway; (3) the Mayhem-token exclusion and the serial-launcher check now skip when the data can't be read, rather than assuming safe. Net effect: the bot buys fewer coins, but only ones it can actually verify are in the band and sellable. Every change is covered by tests. `[fix, security]`- **Autonomous trading experiment — take initials, hold a moon bag, never dump the whole bag** — You can now give one agent a real budget and let it trade newer pump.fun launches under a disciplined, documented risk policy. It only buys projects between $10k and $100k market cap, never buys pump.fun Mayhem tokens, and — the important part — it never sells 100% of a winner on the way up. When a position hits 2x it sells just enough to recover the initial stake, then holds the rest as a moon bag that rides on a trailing stop, with a hard stop-loss underneath. Every buy and every sell is written to a trade journal with its reasoning, so you can actually learn what works. Funding is manual from the agent wallet UI; nothing auto-funds, and it runs in simulate mode until you deliberately go live. (`/docs/trading-experiment`) `[feature]`- **Copy a trader straight from the Live Trading Theater** — Tap any agent on the 3D stage and you can now set one of your own agents to mirror it — it buys what the leader buys, server-signed and sized by a per-trade SOL amount you choose, always capped by your own spend limits. Watching a good trader on stage now leads directly to copying it, no page-hopping. Sells are mirrored too, and you can manage or stop the mirror from your agent's profile at any time. (`/theater`) `[feature]`- **Custody and the Trader Card, explained end to end** — Two more guides for the trust layer. Custody You Can Verify walks through the four guarantees on every agent wallet — spend caps enforced before signing, a freeze switch that never blocks your own withdrawal, the six-hourly Merkle proof-of-custody you can re-verify in your own browser, and social recovery with a dead-man’s-switch inheritance flow. Claim Your Wallet explains how any Solana wallet’s pump.fun track record is computed from on-chain aggregates and how one gasless signature publishes it as your shareable Trader Card. (`/docs/custody`) `[docs]`diff --git a/STRUCTURE.md b/STRUCTURE.mdindex c6e5ca656..62312da2c 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -37,7 +37,7 @@ bottom.| Avatar Seeder control room | [pages/admin/seeder.html](pages/admin/seeder.html) + [src/admin-seeder.js](src/admin-seeder.js) `→ /admin/seeder`, backend [api/admin/seeder.js](api/admin/seeder.js) | In-repo (admin, noindex) | Arm/disarm the headless [Avaturn seed cron](api/cron/avaturn-seed-cron.js), watch live throughput + rig rate, and preview freshly-forged rigged avatars in 3D. Toggles the `avaturn_seed` runtime flag. Flags: [api/_lib/flags.js](api/_lib/flags.js) + [api/admin/flags.js](api/admin/flags.js). Docs: [docs/ops/runtime-flags.md](docs/ops/runtime-flags.md) || On-chain agent invocation | [contracts/agent-invocation/](contracts/agent-invocation) | In-repo | Anchor program: verifiable agent-to-agent skill invocation events. SDK: [agent-protocol-sdk/](agent-protocol-sdk) || Cross-chain SDKs | [sdk/](sdk), [solana-agent-sdk/](solana-agent-sdk), [agent-payments-sdk/](agent-payments-sdk), [agent-protocol-sdk/](agent-protocol-sdk) | Published | Cross-chain agent SDKs |-| MCP integration | [mcp-server/](mcp-server), [mcp-bridge/](mcp-bridge), [packages/*-mcp/](packages) | 31 npm servers + 6 hosted remote, all in the [MCP registry](https://registry.modelcontextprotocol.io/?q=io.github.nirholas) | Model Context Protocol surface — full server list in [docs/mcp.md](docs/mcp.md) |+| MCP integration | [mcp-server/](mcp-server), [mcp-bridge/](mcp-bridge), [packages/*-mcp/](packages) | 32 npm servers + 6 hosted remote (38 total), all in the [MCP registry](https://registry.modelcontextprotocol.io/?q=io.github.nirholas) | Model Context Protocol surface — full server list in [docs/mcp.md](docs/mcp.md) || SNS naming + pay-by-name | [api/sns.js](api/sns.js), [api/sns-subdomain.js](api/sns-subdomain.js), [api/threews/subdomain.js](api/threews/subdomain.js), [api/x402/pay-by-name.js](api/x402/pay-by-name.js), [src/solana/sns-subdomain.js](src/solana/sns-subdomain.js), [pages/threews-claim.html](pages/threews-claim.html) | In-repo | `*.threews.sol` subdomain mint, x402 payments addressed by name. Env: `THREEWS_SOL_PARENT_SECRET_BASE58`. See [SNS_PARTNERSHIP_PROPOSAL.md](docs/internal/SNS_PARTNERSHIP_PROPOSAL.md) || Self-hosted x402 facilitator + ring economy | [api/x402-facilitator/[action].js](api/x402-facilitator/[action].js), [api/_lib/x402/self-facilitator.js](api/_lib/x402/self-facilitator.js), [api/x402/ring-settle.js](api/x402/ring-settle.js), [api/_lib/x402/pipelines/ring-rebalance.js](api/_lib/x402/pipelines/ring-rebalance.js), [api/x402-ring.js](api/x402-ring.js), [scripts/x402-ring-setup.mjs](scripts/x402-ring-setup.mjs) | In-repo (off by default) | Closed-loop agent-to-agent x402: platform wallets pay platform endpoints, settled in-house (no external facilitator). Fee-minimized, SOL-floor guarded, internal-labeled. Env: `X402_SELF_FACILITATOR_ENABLED`, `X402_FEE_PAYER_SECRET_BASE58`, `X402_TREASURY_SECRET_BASE58`. See [docs/x402-ring-economy.md](docs/x402-ring-economy.md) || Ring economy operator dashboard | [pages/admin/ring.html](pages/admin/ring.html) + [src/admin-ring.js](src/admin-ring.js) `→ /admin/ring`, backend [api/admin/ring-dashboard.js](api/admin/ring-dashboard.js) | In-repo (admin, noindex) | Live eyes on the closed-loop x402 ring: per-minute settlement pulse (green/amber/red heartbeat), loop diagram with live wallet balances + floors, streaming activity feed (agent attribution, Solscan links, skip/fail reasons), fee-burn vs daily budget, integrity (leak scan + reconciliation), per-endpoint coverage. One aggregate read model composes [/api/x402-ring](api/x402-ring.js); admin/Bearer-secret authed. Labels volume as internal dogfooding. See [docs/x402-ring-economy.md](docs/x402-ring-economy.md#watching-it--the-operator-dashboard) |diff --git a/data/changelog.json b/data/changelog.jsonindex 04ada761d..88409ef3f 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$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-07-03",+ "title": "Autonomous trader safety gates now fail closed — no more buying what it can't verify",+ "summary": "We hardened the autonomous pump.fun trader so it refuses any coin it cannot prove is safe and in-band, instead of buying through the doubt. Three real holes are closed: (1) the $10k–$100k market-cap rule is now enforced at the single shared buy checkpoint, so every trigger path obeys it — previously some paths (and a mis-named field on one of them) skipped the ceiling entirely; (2) the rug/honeypot firewall now blocks a buy when the sell-back simulation couldn't run or the token's mint authority is still active (dev can print unlimited supply) — these were treated as soft warnings and bought anyway; (3) the Mayhem-token exclusion and the serial-launcher check now skip when the data can't be read, rather than assuming safe. Net effect: the bot buys fewer coins, but only ones it can actually verify are in the band and sellable. Every change is covered by tests.",+ "tags": [+ "fix",+ "security"+ ]+ },{"date": "2026-07-03","title": "The trading stack is now fully documented",diff --git a/docs/content/social/unannounced-backlog.md b/docs/content/social/unannounced-backlog.mdindex 4a07e48bc..76689bd7b 100644--- a/docs/content/social/unannounced-backlog.md+++ b/docs/content/social/unannounced-backlog.md@@ -5,7 +5,7 @@ The gap list: features that are **shipped** but have **never had an X post** on**Method.** Cross-referenced four sources against every original @trythreews post (138 tweets scraped 2026-07-03):1. `data/changelog.json` — 635 `feature`-tagged entries, 2026-04-15 → 2026-07-032. `data/pages.json` — 374 public pages (per `npm run build:pages`)-3. `STRUCTURE.md` — the full surface map (31 MCP servers, 19 published `@three-ws/*` SDKs)+3. `STRUCTURE.md` — the full surface map (38 MCP servers (32 npm + 6 hosted), 19 published `@three-ws/*` SDKs)4. `docs/` + package READMEs — the documentation each post must link as proofA feature counts as "announced" only if a tweet actually shows or names it — a passing mention doesn't count. Same honesty rules as the rest of this engine ([README.md](README.md)): every claim needs a proof link, and affiliation-sensitive items (IBM/AWS/NVIDIA/Alibaba) get a language gate.@@ -221,7 +221,7 @@ Every format show has its own spec in [docs/live-agent-tasks/](../../live-agent-| Feature | Hook | Live | Docs || --- | --- | --- | --- |-| **31 MCP servers** (+6 hosted) | Tweets said "two MCP servers." It's 31 on npm + the registry. | registry | [docs/mcp.md](../../mcp.md), [docs/mcp-tools.md](../../mcp-tools.md), per-server READMEs in `packages/*-mcp/` |+| **38 MCP servers** (32 npm + 6 hosted) | Tweets said "two MCP servers." It's 38 in the official registry. | registry | [docs/mcp.md](../../mcp.md), [docs/mcp-tools.md](../../mcp-tools.md), per-server READMEs in `packages/*-mcp/` || **19 published SDKs** | Zero-dep, pure ESM, 216 green tests | npm | [docs/sdk.md](../../sdk.md), [docs/sdk-launch.md](../../sdk-launch.md), `STRUCTURE.md` SDK table || React component library | 3D AI agents in React | npm | [packages/react/README.md](../../../packages/react/README.md) || Free ChatGPT 3D Studio | No-login 3D Studio for ChatGPT | changelog 2026-06-28 | [docs/mcp-3d-studio.md](../../mcp-3d-studio.md), [docs/store-submissions/04-openai-free-3d-endpoint.md](../../store-submissions/04-openai-free-3d-endpoint.md) |@@ -279,7 +279,7 @@ Every format show has its own spec in [docs/live-agent-tasks/](../../live-agent-## Receipts-and-stats posts (numbers we can prove today)-- **31 MCP servers** in the official registry (tweets have only ever claimed 1–2) — `STRUCTURE.md`+- **38 MCP servers** in the official registry (tweets have only ever claimed 1–2) — `docs/mcp.md`, `STRUCTURE.md`- **19 published zero-dependency SDKs**, 216 green tests — `STRUCTURE.md` SDK table- **374 public pages** — `npm run build:pages` output over `data/pages.json`- **635 feature entries** shipped since April 15 — `data/changelog.json`diff --git a/public/changelog.json b/public/changelog.jsonindex 500d0e5fe..82b1619d1 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T17:24:58.906Z",+ "generated_at": "2026-07-03T17:44:05.099Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -66,6 +66,17 @@"improvement"]},+ {+ "date": "2026-07-03",+ "type": "update",+ "title": "Autonomous trader safety gates now fail closed — no more buying what it can't verify",+ "summary": "We hardened the autonomous pump.fun trader so it refuses any coin it cannot prove is safe and in-band, instead of buying through the doubt. Three real holes are closed: (1) the $10k–$100k market-cap rule is now enforced at the single shared buy checkpoint, so every trigger path obeys it — previously some paths (and a mis-named field on one of them) skipped the ceiling entirely; (2) the rug/honeypot firewall now blocks a buy when the sell-back simulation couldn't run or the token's mint authority is still active (dev can print unlimited supply) — these were treated as soft warnings and bought anyway; (3) the Mayhem-token exclusion and the serial-launcher check now skip when the data can't be read, rather than assuming safe. Net effect: the bot buys fewer coins, but only ones it can actually verify are in the band and sellable. Every change is covered by tests.",+ "link": null,+ "tags": [+ "fix",+ "security"+ ]+ },{"date": "2026-07-03","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 1be18798d..25f380cd5 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -54,6 +54,14 @@<category>improvement</category><description>Autonomous agent strategies and discretionary agent trades now refuse to buy pump.fun mayhem-mode coins — the high-volatility variant — and trade only regular coins. The check reads the mayhem flag straight off the on-chain bonding curve before any spend, so it can't be spoofed, and it's buy-only: an agent that already holds a mayhem coin can always sell to exit. Blocked buys show up as a clean skip in the activity feed, not an error.</description></item>+ <item>+ <title>Autonomous trader safety gates now fail closed — no more buying what it can't verify</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-03:Autonomous trader safety gates now fail closed — no more buying what it can't verify</guid>+ <pubDate>Fri, 03 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>We hardened the autonomous pump.fun trader so it refuses any coin it cannot prove is safe and in-band, instead of buying through the doubt. Three real holes are closed: (1) the $10k–$100k market-cap rule is now enforced at the single shared buy checkpoint, so every trigger path obeys it — previously some paths (and a mis-named field on one of them) skipped the ceiling entirely; (2) the rug/honeypot firewall now blocks a buy when the sell-back simulation couldn't run or the token's mint authority is still active (dev can print unlimited supply) — these were treated as soft warnings and bought anyway; (3) the Mayhem-token exclusion and the serial-launcher check now skip when the data can't be read, rather than assuming safe. Net effect: the bot buys fewer coins, but only ones it can actually verify are in the band and sellable. Every change is covered by tests.</description>+ </item><item><title>Autonomous trading experiment — take initials, hold a moon bag, never dump the whole bag</title><link>https://three.ws/docs/trading-experiment</link>diff --git a/public/docs/index.html b/public/docs/index.htmlindex ce28aa785..7d9a1fec4 100644--- a/public/docs/index.html+++ b/public/docs/index.html@@ -49,7 +49,7 @@.content pre { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow-x: auto; }.content pre code { background: none; border: none; padding: 0; color: #cdd6e4; }.content blockquote { border-left: 3px solid #2a2a30; margin: 16px 0; padding: 2px 16px; color: var(--mut); }- .content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }+ .content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }.content th, .content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }.content th { background: #111114; }.content img { max-width: 100%; border-radius: 8px; }@@ -150,7 +150,7 @@['deployment', 'Deployment', 'Shipping agents to production.'],]],['MCP servers', [- ['mcp', 'Overview', 'All 20 three.ws MCP servers — hosted + npm.'],+ ['mcp', 'Overview', 'All 38 three.ws MCP servers — hosted + npm.'],['mcp-scenes', 'Scenes', 'Speak a placed 3D diorama into being.'],['mcp-x402', 'x402 Wallet', 'A self-custodial wallet that pays any x402 service.'],['mcp-intel', 'Intel', 'Smart-money scores, wallet reputation, KOL data.'],diff --git a/public/features.json b/public/features.jsonindex 5aaaee832..879d480cf 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T17:24:58.873Z",+ "generated_at": "2026-07-03T17:44:05.037Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex e8f4e53df..197477ee3 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -56,6 +56,25 @@.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }.sm-brand:hover { text-decoration: none; }</style>++ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">+ <meta property="og:type" content="website">+ <meta property="og:site_name" content="three.ws">+ <meta property="og:locale" content="en_US">+ <meta property="og:title" content="Sitemap · three.ws">+ <meta property="og:description" content="Human-readable index of every page on three.ws.">+ <meta property="og:url" content="https://three.ws/sitemap">+ <meta property="og:image" content="https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta property="og:image:type" content="image/png">+ <meta property="og:image:alt" content="Sitemap — three.ws">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:site" content="@trythreews">+ <meta name="twitter:title" content="Sitemap · three.ws">+ <meta name="twitter:description" content="Human-readable index of every page on three.ws.">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap">+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap"}]}</script></head><body><header class="sm-topbar">diff --git a/src/dashboard-next/pages/sniper.js b/src/dashboard-next/pages/sniper.jsindex 66a4ab360..8ed799761 100644--- a/src/dashboard-next/pages/sniper.js+++ b/src/dashboard-next/pages/sniper.js@@ -52,7 +52,9 @@ const STYLE = `<style>/* overview strip */.sn-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }-.sn-kpi { background: var(--nxt-panel); border: 1px solid var(--nxt-stroke); border-radius: var(--nxt-radius); padding: 14px 16px; }+.sn-kpi { background: var(--nxt-panel); border: 1px solid var(--nxt-stroke); border-radius: var(--nxt-radius); padding: 14px 16px; font-family: inherit; color: inherit; text-align: left; display: block; width: 100%; cursor: pointer; transition: border-color .14s, background .14s, transform .14s; }+.sn-kpi:hover { border-color: var(--nxt-stroke-strong); background: var(--nxt-bg-2); transform: translateY(-1px); }+.sn-kpi:focus-visible { outline: 2px solid var(--nxt-accent); outline-offset: 2px; }.sn-kpi-label { font-size: 11px; color: var(--nxt-ink-faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }.sn-kpi-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }@@ -152,6 +154,16 @@ const STYLE = `<style>.sn-ob-score { font: 700 11px/1 var(--nxt-mono, monospace); font-variant-numeric: tabular-nums; }.sn-ob-tier { font: 600 8px/1 var(--nxt-mono, monospace); text-transform: uppercase; letter-spacing: .06em; opacity: .8; }.sn-empty { color: var(--nxt-ink-faint); font-size: 13px; padding: 24px 16px; text-align: center; }+/* coin-detail deep link on position/trade symbols */+.sn-coin-link { color: inherit; text-decoration: none; border-bottom: 1px dotted color-mix(in srgb, var(--nxt-ink-faint) 60%, transparent); transition: color .12s, border-color .12s; }+.sn-coin-link:hover { color: var(--nxt-accent); border-bottom-color: var(--nxt-accent); }+.sn-coin-link:focus-visible { outline: 2px solid var(--nxt-accent); outline-offset: 2px; border-radius: 3px; }+/* per-card live positions block */+.sn-agent-pos { border: 1px solid var(--nxt-line); border-radius: var(--nxt-radius-sm); margin-bottom: 16px; overflow: hidden; }+.sn-agent-pos .sn-pos-row { padding: 10px 12px; }+.sn-agent-pos-empty { color: var(--nxt-ink-faint); font-size: 12.5px; padding: 12px; text-align: center; }+/* live open-positions chip in the collapsed card head */+.sn-open-chip { font-variant-numeric: tabular-nums; }/* execution readout — MEV route, tip, time-to-land */.sn-exec { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 5px; }.sn-exec-badge { font: 600 9.5px/1 var(--nxt-mono, monospace); text-transform: uppercase; letter-spacing: .05em; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--nxt-stroke); color: var(--nxt-ink-faint); }@@ -286,27 +298,20 @@ function overviewStrip() {const winRate = totalClosed > 0 ? Math.round((totalWins / totalClosed) * 100) : null;const armed = _strategies.filter((s) => s.enabled && !s.kill_switch).length;+ // Each KPI is a real button that jumps to the section backing the number —+ // the strip is navigation, not decoration.+ const kpi = (jump, label, valHtml, title) => `+ <button type="button" class="sn-kpi" data-jump="${jump}" title="${esc(title)}" aria-label="${esc(`${label} — ${title}`)}">+ <div class="sn-kpi-label">${label}</div>+ <div class="sn-kpi-val">${valHtml}</div>+ </button>`;+return `<div class="sn-strip">- <div class="sn-kpi">- <div class="sn-kpi-label">Armed agents</div>- <div class="sn-kpi-val">${armed}</div>- </div>- <div class="sn-kpi">- <div class="sn-kpi-label">Open positions</div>- <div class="sn-kpi-val">${totalOpen}</div>- </div>- <div class="sn-kpi">- <div class="sn-kpi-label">Realized PnL</div>- <div class="sn-kpi-val ${clr(lamportsToSol(String(totalPnlLam)))}">${fmtLamports(String(totalPnlLam))}</div>- </div>- <div class="sn-kpi">- <div class="sn-kpi-label">Win rate</div>- <div class="sn-kpi-val">${winRate != null ? `${winRate}%` : '—'}</div>- </div>- <div class="sn-kpi">- <div class="sn-kpi-label">Closed trades</div>- <div class="sn-kpi-val">${totalClosed}</div>- </div>+ ${kpi('#sn-cards', 'Armed agents', String(armed), 'Jump to your strategies')}+ ${kpi('#sn-positions', 'Open positions', `<span data-kpi-open>${totalOpen}</span>`, 'Jump to live positions')}+ ${kpi('#sn-hist-mount', 'Realized PnL', `<span class="${clr(lamportsToSol(String(totalPnlLam)))}">${fmtLamports(String(totalPnlLam))}</span>`, 'Jump to trade history')}+ ${kpi('#sn-hist-mount', 'Win rate', winRate != null ? `${winRate}%` : '—', 'Jump to trade history')}+ ${kpi('#sn-hist-mount', 'Closed trades', String(totalClosed), 'Jump to trade history')}</div>`;}@@ -334,6 +339,7 @@ function stratCard(s) {<span>${fmtSol(lamportsToSol(s.per_trade_lamports))} / trade</span><span>Daily budget: ${fmtSol(lamportsToSol(s.daily_budget_lamports))}</span>${walletBal != null ? `<span class="${walletWarn ? 'sn-neg' : ''}">Wallet: ${fmtSol(walletBal)}${walletWarn ? ' ⚠ low' : ''}</span>` : ''}+ <span class="sn-open-chip" data-open-chip="${esc(s.agent_id)}" hidden></span></div></div><div class="sn-badges">@@ -380,6 +386,10 @@ function stratCard(s) {<span class="sn-sum-val ${clr(pnlSol)}">${fmtSol(pnlSol)}</span></div></div>+ <div class="sn-section-head" style="margin-top:0">Open positions</div>+ <div class="sn-agent-pos" data-agent-positions="${esc(s.agent_id)}">+ <div class="sn-agent-pos-empty">Loading positions…</div>+ </div>${stratForm(s)}</div><div class="sn-pane" data-pane="money" data-agent="${esc(s.agent_id)}" hidden>@@ -652,6 +662,8 @@ function livePositionsSection() {<span class="sn-conn-status" id="sn-conn-status" role="status" aria-live="polite">Connecting…</span></div><div class="sn-live-links">+ <a class="sn-btn ghost" style="${ghostBtn}" href="/dashboard/portfolio" title="Full wallet holdings across chains">Portfolio</a>+ <a class="sn-btn ghost" style="${ghostBtn}" href="/dashboard/tokens" title="Pump.fun trading desk — watchlists, scanner, charts">Trading desk</a><a class="sn-btn ghost" style="${ghostBtn}" href="/leaderboard" target="_blank" rel="noopener">Leaderboard ↗</a><a class="sn-btn ghost" style="${ghostBtn}" href="/play/arena" target="_blank" rel="noopener">Sniper Arena ↗</a></div>@@ -670,7 +682,6 @@ function renderPositions(positions) {return;}el.innerHTML = positions.map(posRow).join('');- enrichPositionOracle();}function posRow(p) {@@ -679,9 +690,10 @@ function posRow(p) {const pnlStr = pnlSol != null? `<span class="${clr(pnlSol)}">${pnlSol >= 0 ? '+' : ''}${fmtSol(pnlSol)}${pnlPct != null ? ` · ${pnlPct >= 0 ? '+' : ''}${pnlPct.toFixed(1)}%` : ''}</span>`: '—';- const link = p.buy_url- ? `<a class="sn-pos-link" href="${esc(p.buy_url)}" target="_blank" rel="noopener">Solscan ↗</a>`- : p.mint ? `<a class="sn-pos-link" href="${pumpUrl(p.mint)}" target="_blank" rel="noopener">pump.fun ↗</a>` : '';+ const links = [+ p.buy_url ? `<a class="sn-pos-link" href="${esc(p.buy_url)}" target="_blank" rel="noopener">Solscan ↗</a>` : '',+ p.mint ? `<a class="sn-pos-link" href="${pumpUrl(p.mint)}" target="_blank" rel="noopener">pump.fun ↗</a>` : '',+ ].filter(Boolean).join('');const sym = p.symbol || p.mint?.slice(0, 8) || 'this position';// One-tap manual exit: sell the agent's full holding of this mint now, at a// real price, via /api/sniper/close (the same executeSell the worker uses).@@ -690,22 +702,30 @@ function posRow(p) {? `<button class="sn-pos-sell" data-action="sell-now" data-pos="${esc(p.id)}" data-agent="${esc(p.agent_id || '')}" data-mint="${esc(p.mint || '')}" data-net="${esc(p.network || 'mainnet')}" data-sym="${esc(sym)}" title="Sell this position now from the agent wallet">Sell now</button>`: '';const mintAttr = p.mint ? ` data-oracle-mint="${esc(p.mint)}"` : '';+ // The symbol itself deep-links to the coin detail page (score, holders, trade+ // tape) — the Oracle badge only renders for scored coins, so it can't be the+ // only way in.+ const symHtml = p.mint+ ? `<a class="sn-coin-link" href="/oracle/coin/${encodeURIComponent(p.mint)}" title="Open coin detail — conviction, holders, live trades">${esc(p.symbol || p.mint.slice(0, 8))}</a>`+ : esc(p.symbol || '—');return `<div class="sn-pos-row"${mintAttr}><div class="sn-pos-info">- <div class="sn-pos-sym">${esc(p.symbol || p.mint?.slice(0, 8) || '—')}</div>+ <div class="sn-pos-sym">${symHtml}</div><div class="sn-pos-sub">${esc(p.agent_name || '')}${p.opened_at ? ` · opened ${relTime(p.opened_at)}` : ''}</div>${execReadout(p)}</div><div class="sn-pos-pnl">${pnlStr}</div><span class="sn-pos-oracle"></span>- <div class="sn-pos-actions">${sellBtn}${link}</div>+ <div class="sn-pos-actions">${sellBtn}${links}</div></div>`;}const SN_TIER_COLOR = { prime: '#c084fc', strong: '#34d399', lean: '#fbbf24', watch: '#94a3b8', avoid: '#f87171' };async function enrichPositionOracle() {- const el = document.getElementById('sn-positions');+ // Scan the whole page, not just the global list — per-card position blocks+ // carry data-oracle-mint too. The hasChildNodes guard keeps repeats cheap.+ const el = document.getElementById('sn-root');if (!el) return;const rows = el.querySelectorAll('[data-oracle-mint]');if (!rows.length) return;@@ -755,9 +775,12 @@ function histRow(t) {? new Date(t.closed_at).getTime() - new Date(t.opened_at).getTime(): null;const holdStr = holdMs != null ? holdDuration(holdMs) : '—';+ const symHtml = t.mint+ ? `<a class="sn-coin-link" href="/oracle/coin/${encodeURIComponent(t.mint)}" title="Open coin detail — conviction, holders, live trades">${esc(t.symbol || t.mint.slice(0, 8))}</a>`+ : esc(t.symbol || '—');return `<tr class="sn-hist-row"><td>- <div class="sn-hist-sym">${esc(t.symbol)}</div>+ <div class="sn-hist-sym">${symHtml}</div><div class="sn-hist-agent">${esc(t.agent_name || '')}</div></td><td class="r">${entrySol}</td>@@ -956,6 +979,13 @@ function wireEvents(root) {const subtab = e.target.closest('[data-subtab]');if (subtab) { switchSubtab(subtab); return; }+ // KPI strip → jump to the section backing the number+ const jump = e.target.closest('[data-jump]');+ if (jump) {+ document.querySelector(jump.dataset.jump)?.scrollIntoView({ behavior: 'smooth', block: 'start' });+ return;+ }+const retryMoney = e.target.closest('[data-action="retry-money"]');if (retryMoney) {const host = retryMoney.closest('.sn-pane')?.querySelector('[data-money-host]');@@ -1358,6 +1388,38 @@ function renderOwnedPositions() {.filter((p) => owned.has(p.agent_id) && ['opening', 'open'].includes(p.status)).sort((a, b) => new Date(b.opened_at || 0) - new Date(a.opened_at || 0));renderPositions(list);+ renderAgentCardPositions(list);+ const kpiOpen = document.querySelector('[data-kpi-open]');+ if (kpiOpen) kpiOpen.textContent = String(list.length);+}++// Mirror each agent's slice of the live stream into its strategy card: the+// "Open positions" block in the expanded pane and the "n open · ±PnL" chip in+// the collapsed head, so a bot's holdings are visible without leaving the card.+function renderAgentCardPositions(list) {+ for (const host of document.querySelectorAll('[data-agent-positions]')) {+ const agentId = host.dataset.agentPositions;+ const mine = list.filter((p) => p.agent_id === agentId);+ const strat = _strategies.find((s) => s.agent_id === agentId);+ const armed = strat && strat.enabled && !strat.kill_switch;+ host.innerHTML = mine.length+ ? mine.map(posRow).join('')+ : `<div class="sn-agent-pos-empty">${armed+ ? 'No open positions — armed and watching for the next trigger.'+ : 'No open positions. Arm the strategy to start sniping.'}</div>`;++ const chip = document.querySelector(`[data-open-chip="${CSS.escape(agentId)}"]`);+ if (chip) {+ if (!mine.length) { chip.hidden = true; chip.textContent = ''; }+ else {+ const pnl = mine.reduce((s, p) => s + (p.unrealized_pnl_sol || 0), 0);+ chip.hidden = false;+ chip.className = `sn-open-chip ${clr(pnl)}`;+ chip.textContent = `${mine.length} open · ${pnl >= 0 ? '+' : ''}${fmtSol(pnl)}`;+ }+ }+ }+ if (list.length) enrichPositionOracle();}async function seedPositions() {diff --git a/tests/sniper-safety-guards.test.js b/tests/sniper-safety-guards.test.jsindex b80914dfa..bad044234 100644--- a/tests/sniper-safety-guards.test.js+++ b/tests/sniper-safety-guards.test.js@@ -21,6 +21,8 @@ vi.mock('../api/_lib/db.js', () => {import { parseAgentIds } from '../workers/agent-sniper/config.js';import { mayhemVerdict, mayhemGate } from '../workers/agent-sniper/mayhem-gate.js';+import { marketCapBandReason, scoreMint } from '../workers/agent-sniper/scorer.js';+import { criticalFirewallReason } from '../api/_lib/trade-firewall.js';import { withinMasterDailyCap, masterDailyOutflowSol } from '../api/_lib/launcher-funding.js';describe('parseAgentIds (worker agent scoping)', () => {@@ -60,6 +62,61 @@ describe('mayhemGate', () => {});});+describe('marketCapBandReason (owner rule: buy only $10k–$100k, fail closed)', () => {+ const band = { min_market_cap_usd: 10_000, max_market_cap_usd: 100_000 };+ it('passes a coin inside the band', () => {+ expect(marketCapBandReason(50_000, band)).toBeNull();+ });+ it('blocks below the floor (a sub-$10k rug)', () => {+ expect(marketCapBandReason(4_500, band)).toMatch(/^mc_below_min:/);+ });+ it('blocks above the ceiling', () => {+ expect(marketCapBandReason(250_000, band)).toMatch(/^mc_above_max:/);+ });+ it('FAILS CLOSED on unknown market cap when a floor exists — never buys blind', () => {+ expect(marketCapBandReason(null, band)).toMatch(/^mc_below_min:n\/a</);+ expect(marketCapBandReason(undefined, band)).toMatch(/^mc_below_min:n\/a</);+ });+ it('is a no-op when the strategy configures no band', () => {+ expect(marketCapBandReason(null, {})).toBeNull();+ expect(marketCapBandReason(3, {})).toBeNull();+ });+});++describe('criticalFirewallReason (fail-closed: warnings that mean "unproven", not "safe")', () => {+ it('returns null for no assessment / clean checks', () => {+ expect(criticalFirewallReason(null)).toBeNull();+ expect(criticalFirewallReason({ checks: [{ status: 'pass', reason: 'authorities_renounced' }] })).toBeNull();+ });+ it('flags an unproven round-trip (honeypot sim unavailable)', () => {+ expect(criticalFirewallReason({ checks: [{ status: 'warn', reason: 'simulation_unavailable' }] }))+ .toBe('simulation_unavailable');+ });+ it('flags active mint authority (infinite-supply rug)', () => {+ expect(criticalFirewallReason({ checks: [{ status: 'warn', reason: 'mint_authority_active' }] }))+ .toBe('mint_authority_active');+ });+ it('does NOT flag a non-critical warning (e.g. price impact)', () => {+ expect(criticalFirewallReason({ checks: [{ status: 'warn', reason: 'price_impact' }] })).toBeNull();+ });+ it('ignores a critical code that actually passed', () => {+ expect(criticalFirewallReason({ checks: [{ status: 'pass', reason: 'mint_authority_active' }] })).toBeNull();+ });+});++describe('scoreMint creator-launch gate (fail closed)', () => {+ it('skips a serial rugger over the launch cap', () => {+ const r = scoreMint({ market_cap_usd: 50_000, creator_launches: 25 }, { max_creator_launches: 10 });+ expect(r.pass).toBe(false);+ expect(r.reasons).toContain('creator_too_many_launches');+ });+ it('FAILS CLOSED when creator history is unknown but a cap is set', () => {+ const r = scoreMint({ market_cap_usd: 50_000, creator_launches: null }, { max_creator_launches: 10 });+ expect(r.pass).toBe(false);+ expect(r.reasons).toContain('creator_launches_unknown');+ });+});+describe('withinMasterDailyCap (hard master outflow ceiling)', () => {it('no cap when capSol is 0 / negative / non-finite', () => {expect(withinMasterDailyCap(5, 5, 0).ok).toBe(true);