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
feat: real-time 3D protocol visualization page + build/skill pipeline updates
nirholas450beb7fa524
diff --git a/api/_lib/sas.js b/api/_lib/sas.jsindex 658e3da53..7db2dd863 100644--- a/api/_lib/sas.js+++ b/api/_lib/sas.js@@ -25,9 +25,28 @@ import {} from 'sas-lib';import { BorshSchema } from 'borsher';+// Resolve sas-config.json in a bundle-safe way. scripts/bundle-api.mjs inlines+// this module into each API entry with esbuild, which rewrites import.meta.url+// to the OUTPUT file's location — so an import.meta-relative `../../sdk/src/...`+// resolves to a bogus api/sdk/src/... path and ENOENTs at load. process.cwd() is+// /var/task on Vercel (the file ships via vercel.json includeFiles) and the repo+// root in dev; the import.meta path stays as a fallback for unbundled callers.const __dirname = path.dirname(fileURLToPath(import.meta.url));-const CONFIG_PATH = path.join(__dirname, '..', '..', 'sdk', 'src', 'sas-config.json');-const CONFIG = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));+const CONFIG_CANDIDATES = [+ path.join(process.cwd(), 'sdk', 'src', 'sas-config.json'),+ path.join(__dirname, '..', '..', 'sdk', 'src', 'sas-config.json'),+];+const CONFIG = (() => {+ let lastErr;+ for (const candidate of CONFIG_CANDIDATES) {+ try {+ return JSON.parse(fs.readFileSync(candidate, 'utf8'));+ } catch (err) {+ lastErr = err;+ }+ }+ throw lastErr;+})();const RPC = {mainnet: process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com',diff --git a/data/pages.json b/data/pages.jsonindex 5bdd77d09..46b1cce03 100644--- a/data/pages.json+++ b/data/pages.json@@ -341,6 +341,14 @@"changefreq": "hourly","added": "2026-05-25"},+ {+ "path": "/three-live",+ "title": "$THREE Live · Protocol Pulse",+ "description": "The $THREE protocol as a living 3D organism. Real on-chain trades pulse through it in real time — each transaction emits a particle burst, whales send shockwaves, with a live trade feed and a HUD of price, market cap, holders, and volume.",+ "priority": 0.8,+ "changefreq": "always",+ "added": "2026-05-29"+ },{"path": "/fact-checker","title": "Fact Checker",diff --git a/package-lock.json b/package-lock.jsonindex c76e35c59..5471dd56a 100644--- a/package-lock.json+++ b/package-lock.json@@ -63,7 +63,7 @@"@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^2.2.8","@solana/actions": "^0.0.2","@solana/kit": "^6.9.0",- "@solana/pay": "^1.0.16",+ "@solana/pay": "^0.2.6","@solana/spl-token": "^0.4.14","@solana/wallet-adapter-base": "^0.9.23","@solana/wallet-adapter-phantom": "^0.9.24",@@ -388,6 +388,35 @@"undici-types": "^6.20.0"}},+ "character-studio/node_modules/@solana/pay": {+ "version": "1.0.16",+ "resolved": "https://registry.npmjs.org/@solana/pay/-/pay-1.0.16.tgz",+ "integrity": "sha512-+d4BolMzbfachWuQcmKzKR0IDQLcSh/QFwEH3bhf/myyjDeDqjURgpfs3F0oG5t7Ea0xmfS2+FAg01rxDhFu0w==",+ "license": "MIT",+ "dependencies": {+ "@solana/plugin-interfaces": "^6.5.0",+ "@solana/qr-code-styling": "^1.6.0"+ },+ "bin": {+ "pay": "run.cjs"+ },+ "engines": {+ "node": ">=20"+ },+ "peerDependencies": {+ "@solana-program/memo": "^0.11.0",+ "@solana-program/system": "^0.12.0",+ "@solana-program/token": "^0.12.0",+ "@solana-program/token-2022": "^0.9.0",+ "@solana/keys": "^6.5.0",+ "@solana/kit": "^6.5.0",+ "@solana/kit-plugin-instruction-plan": "^0.8.0",+ "@solana/kit-plugin-payer": "^0.8.0",+ "@solana/kit-plugin-rpc": "^0.8.0",+ "@solana/rpc-subscriptions-api": "^6.5.0",+ "@solana/rpc-subscriptions-spec": "^6.5.0"+ }+ },"character-studio/node_modules/@vitest/expect": {"version": "3.2.4","resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz",@@ -1237,6 +1266,35 @@"undici-types": "^6.20.0"}},+ "multiplayer/node_modules/@solana/pay": {+ "version": "1.0.16",+ "resolved": "https://registry.npmjs.org/@solana/pay/-/pay-1.0.16.tgz",+ "integrity": "sha512-+d4BolMzbfachWuQcmKzKR0IDQLcSh/QFwEH3bhf/myyjDeDqjURgpfs3F0oG5t7Ea0xmfS2+FAg01rxDhFu0w==",+ "license": "MIT",+ "dependencies": {+ "@solana/plugin-interfaces": "^6.5.0",+ "@solana/qr-code-styling": "^1.6.0"+ },+ "bin": {+ "pay": "run.cjs"+ },+ "engines": {+ "node": ">=20"+ },+ "peerDependencies": {+ "@solana-program/memo": "^0.11.0",+ "@solana-program/system": "^0.12.0",+ "@solana-program/token": "^0.12.0",+ "@solana-program/token-2022": "^0.9.0",+ "@solana/keys": "^6.5.0",+ "@solana/kit": "^6.5.0",+ "@solana/kit-plugin-instruction-plan": "^0.8.0",+ "@solana/kit-plugin-payer": "^0.8.0",+ "@solana/kit-plugin-rpc": "^0.8.0",+ "@solana/rpc-subscriptions-api": "^6.5.0",+ "@solana/rpc-subscriptions-spec": "^6.5.0"+ }+ },"multiplayer/node_modules/undici-types": {"version": "6.26.0","resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.26.0.tgz",@@ -18702,32 +18760,21 @@}},"node_modules/@solana/pay": {- "version": "1.0.16",- "resolved": "https://registry.npmjs.org/@solana/pay/-/pay-1.0.16.tgz",- "integrity": "sha512-+d4BolMzbfachWuQcmKzKR0IDQLcSh/QFwEH3bhf/myyjDeDqjURgpfs3F0oG5t7Ea0xmfS2+FAg01rxDhFu0w==",- "license": "MIT",+ "version": "0.2.6",+ "resolved": "https://registry.npmjs.org/@solana/pay/-/pay-0.2.6.tgz",+ "integrity": "sha512-6vZxVKvMvE5E3yyw0+WD3zIH47Gz3kuvqU2KqHxKUgmPRMH32gW26Dq77XmGdY3FOuWW8ZGvb9j8YiO86MC2eA==",+ "license": "Apache-2.0","dependencies": {- "@solana/plugin-interfaces": "^6.5.0",- "@solana/qr-code-styling": "^1.6.0"- },- "bin": {- "pay": "run.cjs"+ "@solana/qr-code-styling": "^1.6.0",+ "@solana/spl-token": "^0.4.13",+ "@solana/web3.js": "^1.98.2",+ "bignumber.js": "^9.1.0",+ "cross-fetch": "^3.1.5",+ "js-base64": "^3.7.2",+ "tweetnacl": "^1.0.3"},"engines": {- "node": ">=20"- },- "peerDependencies": {- "@solana-program/memo": "^0.11.0",- "@solana-program/system": "^0.12.0",- "@solana-program/token": "^0.12.0",- "@solana-program/token-2022": "^0.9.0",- "@solana/keys": "^6.5.0",- "@solana/kit": "^6.5.0",- "@solana/kit-plugin-instruction-plan": "^0.8.0",- "@solana/kit-plugin-payer": "^0.8.0",- "@solana/kit-plugin-rpc": "^0.8.0",- "@solana/rpc-subscriptions-api": "^6.5.0",- "@solana/rpc-subscriptions-spec": "^6.5.0"+ "node": ">=16"}},"node_modules/@solana/plugin-core": {diff --git a/package.json b/package.jsonindex 57b703e13..aed03746b 100644--- a/package.json+++ b/package.json@@ -146,7 +146,7 @@"@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^2.2.8","@solana/actions": "^0.0.2","@solana/kit": "^6.9.0",- "@solana/pay": "^1.0.16",+ "@solana/pay": "^0.2.6","@solana/spl-token": "^0.4.14","@solana/wallet-adapter-base": "^0.9.23","@solana/wallet-adapter-phantom": "^0.9.24",diff --git a/pages/agent-next.html b/pages/agent-next.htmlindex a130e7dcb..70c7d5c98 100644--- a/pages/agent-next.html+++ b/pages/agent-next.html@@ -163,8 +163,15 @@.act-btn.primary { color: var(--text); }.act-btn.primary .act-icon { background: var(--panel-soft); }@media (max-width: 720px) {- .action-rail { left: 12px; right: 12px; top: auto; bottom: 80px; transform: none; flex-direction: row; overflow-x: auto; border-radius: 10px; }- .act-btn { min-width: auto; padding: 8px 10px; }+ /* Emote rail → thin horizontal strip pinned to the bottom of the canvas,+ above the owner bar. Keeps the avatar's face/upper body unobstructed. */+ .action-rail {+ left: 10px; right: 10px; top: auto; bottom: 10px; transform: none;+ flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch;+ border-radius: 10px; scrollbar-width: none;+ }+ .action-rail::-webkit-scrollbar { display: none; }+ .act-btn { min-width: auto; padding: 8px 10px; white-space: nowrap; }.act-btn .act-icon { display: none; }}@@ -434,7 +441,16 @@.owner-btn.accent { color: var(--ok); }.owner-btn.accent:hover { background: rgba(34,197,94,0.1); }@media (max-width: 720px) {- .owner-bar { top: auto; bottom: 140px; left: 12px; right: 12px; justify-content: center; flex-wrap: wrap; }+ /* Owner tabs → single-row scrollable strip just above the emote rail,+ instead of a wrapping block that covered the avatar's torso. */+ .owner-bar {+ top: auto; bottom: 58px; left: 10px; right: 10px;+ justify-content: flex-start; flex-wrap: nowrap;+ overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;+ }+ .owner-bar::-webkit-scrollbar { display: none; }+ /* Float the in-canvas message log above both bottom strips. */+ .chat-messages { bottom: 100px; max-height: 160px; }}/* ── OWNER SIDE PANELS ───────────────────────────────── */diff --git a/pages/three-live.html b/pages/three-live.htmlnew file mode 100644index 000000000..83dec1f20--- /dev/null+++ b/pages/three-live.html@@ -0,0 +1,661 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>$THREE Live · Protocol Pulse — three.ws</title>+ <meta name="description" content="The $THREE protocol as a living 3D organism. Watch real on-chain trades pulse through it in real time — every transaction emits a burst, whales send shockwaves, with a live trade feed and protocol stats." />+ <link rel="canonical" href="/three-live" />+ <link rel="stylesheet" href="/style.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/mobile.css" />+ <style>+ :root {+ --pl-bg: #04050a;+ --pl-panel: rgba(9, 11, 18, 0.82);+ --pl-border: rgba(255, 255, 255, 0.10);+ --pl-text: #eaecf5;+ --pl-muted: #8b92ad;+ --pl-faint: #5a6178;+ --pl-green: #34e0a8;+ --pl-red: #ff5d73;+ --pl-accent: #8b7bff;+ --pl-mono: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);+ --pl-disp: var(--font-display, 'Space Grotesk', system-ui, sans-serif);+ }+ html, body { background: var(--pl-bg); color: var(--pl-text); overflow: hidden; height: 100%; }+ body { margin: 0; }+ .site-header { position: relative; z-index: 20; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }++ #pl-stage { position: fixed; inset: 0; z-index: 0; }+ #pl-canvas-host { position: absolute; inset: 0; }+ #pl-canvas-host canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }+ #pl-canvas-host canvas:active { cursor: grabbing; }++ .pl-overlay { position: absolute; pointer-events: none; z-index: 10; }+ .pl-overlay > * { pointer-events: auto; }++ /* ── Hero readout (top-left): price + sentiment ── */+ .pl-hero {+ top: calc(var(--header-h, 3.5rem) + 16px);+ left: 18px;+ background: var(--pl-panel);+ border: 1px solid var(--pl-border);+ border-radius: 14px;+ padding: 16px 18px;+ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);+ min-width: 232px;+ }+ .pl-hero .sym { font-family: var(--pl-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--pl-muted); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }+ .pl-hero .sym .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }+ .pl-hero[data-state="connecting"] .dot { background: #f5a623; animation: plPulse 1.2s ease-in-out infinite; }+ .pl-hero[data-state="live"] .dot { background: var(--pl-green); box-shadow: 0 0 10px rgba(52,224,168,0.8); animation: plPulse 1.6s ease-in-out infinite; }+ .pl-hero[data-state="quiet"] .dot { background: var(--pl-accent); box-shadow: 0 0 8px rgba(139,123,255,0.6); }+ .pl-hero[data-state="error"] .dot { background: var(--pl-red); }+ .pl-hero .price { font-family: var(--pl-disp); font-size: 34px; font-weight: 600; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }+ .pl-hero .chg { font-family: var(--pl-mono); font-size: 14px; font-weight: 600; }+ .pl-hero .chg.up { color: var(--pl-green); }+ .pl-hero .chg.down { color: var(--pl-red); }+ .pl-hero .chg.flat { color: var(--pl-muted); }+ .pl-activity {+ margin-top: 12px; display: flex; align-items: center; gap: 10px;+ font-family: var(--pl-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--pl-muted);+ }+ .pl-activity .bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; position: relative; }+ .pl-activity .bar .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(90deg, var(--pl-accent), var(--pl-green)); transition: width 0.5s ease; border-radius: 3px; }+ .pl-activity .reading { font-weight: 600; color: var(--pl-text); min-width: 64px; text-align: right; }++ /* ── Stat grid (bottom-left) ── */+ .pl-stats {+ bottom: 18px; left: 18px;+ display: grid; grid-template-columns: repeat(2, minmax(108px, 1fr)); gap: 1px;+ background: var(--pl-border);+ border: 1px solid var(--pl-border); border-radius: 12px; overflow: hidden;+ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);+ max-width: 340px;+ }+ .pl-stats .cell { background: var(--pl-panel); padding: 11px 14px; }+ .pl-stats .label { font-family: var(--pl-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pl-faint); }+ .pl-stats .value { font-family: var(--pl-mono); font-size: 15px; color: var(--pl-text); margin-top: 3px; font-variant-numeric: tabular-nums; }+ .pl-stats .value.g { color: var(--pl-green); }+ .pl-stats .value.r { color: var(--pl-red); }++ /* ── Live trade ticker (right) ── */+ .pl-ticker {+ top: calc(var(--header-h, 3.5rem) + 16px);+ right: 18px;+ width: 264px;+ background: var(--pl-panel);+ border: 1px solid var(--pl-border);+ border-radius: 14px;+ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);+ overflow: hidden;+ }+ .pl-ticker .head {+ display: flex; align-items: center; gap: 8px;+ padding: 11px 14px; border-bottom: 1px solid var(--pl-border);+ font-family: var(--pl-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pl-muted);+ }+ .pl-ticker .head .live { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--pl-green); }+ .pl-ticker .head .live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pl-green); animation: plPulse 1.4s ease-in-out infinite; }+ .pl-ticker ol { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow: hidden; }+ .pl-ticker li {+ display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;+ font-family: var(--pl-mono); font-size: 12px; animation: plRise 0.35s ease both;+ }+ .pl-ticker li .side { font-weight: 700; width: 34px; font-size: 10px; letter-spacing: 0.05em; }+ .pl-ticker li.buy .side { color: var(--pl-green); }+ .pl-ticker li.sell .side { color: var(--pl-red); }+ .pl-ticker li .amt { color: var(--pl-text); font-variant-numeric: tabular-nums; }+ .pl-ticker li.buy { background: linear-gradient(90deg, rgba(52,224,168,0.10), transparent); }+ .pl-ticker li.sell { background: linear-gradient(90deg, rgba(255,93,115,0.10), transparent); }+ .pl-ticker li .who { color: var(--pl-faint); margin-left: auto; }+ .pl-ticker .empty { padding: 22px 14px; text-align: center; color: var(--pl-faint); font-family: var(--pl-mono); font-size: 11.5px; line-height: 1.6; }+ @keyframes plRise { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }+ @keyframes plPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }++ /* ── Flow counters (bottom-center) ── */+ .pl-flow {+ bottom: 18px; left: 50%; transform: translateX(-50%);+ display: flex; gap: 1px; background: var(--pl-border);+ border: 1px solid var(--pl-border); border-radius: 12px; overflow: hidden;+ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);+ font-family: var(--pl-mono);+ }+ .pl-flow .seg { background: var(--pl-panel); padding: 9px 18px; text-align: center; }+ .pl-flow .label { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pl-faint); }+ .pl-flow .num { font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }+ .pl-flow .seg.buys .num { color: var(--pl-green); }+ .pl-flow .seg.sells .num { color: var(--pl-red); }+ .pl-flow .seg.win .label { font-size: 9px; }++ /* ── Hint + intro + error ── */+ .pl-hint {+ bottom: 18px; right: 18px;+ font-family: var(--pl-mono); font-size: 10.5px; color: var(--pl-faint);+ background: var(--pl-panel); border: 1px solid var(--pl-border); border-radius: 10px;+ padding: 7px 11px; line-height: 1.6;+ }+ .pl-hint b { color: var(--pl-muted); }++ .pl-intro {+ position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column;+ align-items: center; justify-content: center; pointer-events: none;+ background: radial-gradient(ellipse at center, rgba(139,123,255,0.10) 0%, var(--pl-bg) 72%);+ opacity: 1; transition: opacity 0.7s ease 0.15s;+ }+ .pl-intro.is-hidden { opacity: 0; }+ .pl-intro .ring { width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); border-top-color: var(--pl-accent); animation: plSpin 1s linear infinite; }+ .pl-intro .label { margin-top: 18px; font-family: var(--pl-mono); font-size: 12px; letter-spacing: 0.2em; color: var(--pl-muted); text-transform: uppercase; }+ @keyframes plSpin { to { transform: rotate(360deg); } }++ .pl-toast {+ position: absolute; top: calc(var(--header-h, 3.5rem) + 16px); left: 50%; transform: translateX(-50%) translateY(-8px);+ background: rgba(40, 12, 18, 0.92); border: 1px solid rgba(255,93,115,0.4); color: #ffb8c2;+ border-radius: 10px; padding: 8px 14px; font-family: var(--pl-mono); font-size: 12px;+ opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;+ }+ .pl-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }++ @media (max-width: 820px) {+ .pl-ticker { display: none; }+ .pl-hint { display: none; }+ .pl-hero { min-width: 0; left: 12px; right: 12px; padding: 12px 14px; }+ .pl-hero .price { font-size: 28px; }+ .pl-stats { left: 12px; bottom: 84px; grid-template-columns: repeat(2, 1fr); max-width: calc(100% - 24px); }+ .pl-flow { bottom: 12px; }+ }+ </style>+</head>+<body>+ <header class="site-header">+ <h1 class="site-header-brand">+ <a href="/" aria-label="three.ws home"><img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a>+ </h1>+ <div id="nav-container"></div>+ </header>+ <script src="/nav.js"></script>++ <div id="pl-stage">+ <div id="pl-canvas-host"></div>++ <!-- Hero: price + sentiment gauge -->+ <section class="pl-overlay pl-hero" id="pl-hero" data-state="connecting" aria-live="polite">+ <div class="sym"><span class="dot"></span> <span id="pl-status-text">$THREE · connecting…</span></div>+ <div class="price" id="pl-price">$—</div>+ <div class="chg flat" id="pl-change">—</div>+ <div class="pl-activity" title="On-chain trade throughput in the last 60s — activity, not a buy/sell signal">+ <span>QUIET</span>+ <span class="bar"><span class="fill" id="pl-activity-fill"></span></span>+ <span>BUSY</span>+ <span class="reading" id="pl-activity-reading">—</span>+ </div>+ </section>++ <!-- Live trade ticker -->+ <aside class="pl-overlay pl-ticker" id="pl-ticker">+ <div class="head">Live trades <span class="live">live</span></div>+ <ol id="pl-ticker-list">+ <li class="empty" id="pl-ticker-empty">Listening to the $THREE bonding curve…<br />trades will stream in here.</li>+ </ol>+ </aside>++ <!-- Stat grid -->+ <section class="pl-overlay pl-stats" id="pl-stats">+ <div class="cell"><div class="label">Market cap</div><div class="value g" id="pl-mcap">—</div></div>+ <div class="cell"><div class="label">24h volume</div><div class="value" id="pl-vol">—</div></div>+ <div class="cell"><div class="label">Holders</div><div class="value" id="pl-holders">—</div></div>+ <div class="cell"><div class="label">Liquidity</div><div class="value" id="pl-liq">—</div></div>+ <div class="cell"><div class="label">Agents deployed</div><div class="value" id="pl-agents">—</div></div>+ <div class="cell"><div class="label">$THREE burned</div><div class="value r" id="pl-burned">—</div></div>+ </section>++ <!-- Flow counters -->+ <section class="pl-overlay pl-flow" id="pl-flow">+ <div class="seg buys"><div class="label">Buys / 60s</div><div class="num" id="pl-buys">0</div></div>+ <div class="seg win"><div class="label">Vol / 60s</div><div class="num" id="pl-vol60">$0</div></div>+ <div class="seg sells"><div class="label">Sells / 60s</div><div class="num" id="pl-sells">0</div></div>+ </section>++ <div class="pl-overlay pl-hint"><b>Drag</b> to orbit · <b>Scroll</b> to zoom · each particle is a real trade</div>++ <div class="pl-intro" id="pl-intro"><div class="ring"></div><div class="label">Reading the chain</div></div>+ <div class="pl-toast" id="pl-toast"></div>+ </div>++ <script type="module">+ import * as THREE from 'three';+ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';+ import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';+ import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';+ import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';+ import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';++ // ── Config / live data sources ───────────────────────────────────────+ const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+ const STATS_API = '/api/three-token/stats';+ const TRADES_SSE = `/api/agents/pumpfun-feed?kind=trades&mint=${THREE_MINT}`;+ const STATS_INTERVAL_MS = 8_000;+ const FLOW_WINDOW_MS = 60_000;+ const WHALE_USD = 2_000; // a trade this big sends a shockwave+ const PARTICLE_POOL = 1400; // hard cap on live particles+ const TICKER_MAX = 14;+ const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;++ // ── DOM ──────────────────────────────────────────────────────────────+ const host = document.getElementById('pl-canvas-host');+ const heroEl = document.getElementById('pl-hero');+ const statusText = document.getElementById('pl-status-text');+ const priceEl = document.getElementById('pl-price');+ const changeEl = document.getElementById('pl-change');+ const activityFill = document.getElementById('pl-activity-fill');+ const activityReading = document.getElementById('pl-activity-reading');+ const tickerList = document.getElementById('pl-ticker-list');+ const tickerEmpty = document.getElementById('pl-ticker-empty');+ const introEl = document.getElementById('pl-intro');+ const toastEl = document.getElementById('pl-toast');+ const el = (id) => document.getElementById(id);++ // ── Scene ──────────────────────────────────────────────────────────────+ const scene = new THREE.Scene();+ scene.background = new THREE.Color(0x04050a);+ scene.fog = new THREE.FogExp2(0x04050a, 0.0125);++ const camera = new THREE.PerspectiveCamera(52, 1, 0.1, 600);+ camera.position.set(0, 6, 64);++ const renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: 'high-performance' });+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));+ renderer.outputColorSpace = THREE.SRGBColorSpace;+ renderer.toneMapping = THREE.ACESFilmicToneMapping;+ renderer.toneMappingExposure = 1.1;+ host.appendChild(renderer.domElement);++ const composer = new EffectComposer(renderer);+ composer.addPass(new RenderPass(scene, camera));+ const bloom = new UnrealBloomPass(new THREE.Vector2(1, 1), 1.05, 0.6, 0.12);+ composer.addPass(bloom);+ composer.addPass(new OutputPass());++ const controls = new OrbitControls(camera, renderer.domElement);+ controls.enableDamping = true;+ controls.dampingFactor = 0.06;+ controls.rotateSpeed = 0.55;+ controls.zoomSpeed = 0.7;+ controls.minDistance = 26;+ controls.maxDistance = 140;+ controls.enablePan = false;+ controls.autoRotate = !reduceMotion;+ controls.autoRotateSpeed = 0.5;++ scene.add(new THREE.AmbientLight(0xffffff, 0.5));+ const keyLight = new THREE.DirectionalLight(0xc9b8ff, 1.0); keyLight.position.set(30, 40, 40); scene.add(keyLight);+ const rimLight = new THREE.DirectionalLight(0x5b8cff, 0.5); rimLight.position.set(-40, -10, -30); scene.add(rimLight);++ // ── Starfield ──────────────────────────────────────────────────────────+ (function stars() {+ const n = 2200;+ const pos = new Float32Array(n * 3);+ for (let i = 0; i < n; i++) {+ const r = 140 + Math.random() * 220;+ const t = Math.random() * Math.PI * 2;+ const p = Math.acos(2 * Math.random() - 1);+ pos[i*3] = r * Math.sin(p) * Math.cos(t);+ pos[i*3+1] = r * Math.sin(p) * Math.sin(t);+ pos[i*3+2] = r * Math.cos(p);+ }+ const g = new THREE.BufferGeometry();+ g.setAttribute('position', new THREE.BufferAttribute(pos, 3));+ scene.add(new THREE.Points(g, new THREE.PointsMaterial({ size: 0.5, color: 0x9fb0ff, transparent: true, opacity: 0.55, sizeAttenuation: true })));+ })();++ // ── The Core — a living organism whose surface displaces with a heartbeat+ // and whose colour reflects live buy/sell sentiment. ───────────────────+ const coreUniforms = {+ uTime: { value: 0 },+ uPulse: { value: 0 }, // momentary kick on each trade (decays)+ uHeart: { value: 0 }, // activity level (trade frequency) — NOT directional+ uColorCalm: { value: new THREE.Color(0x6d5cff) }, // brand violet at rest+ uColorHot: { value: new THREE.Color(0x46e0d0) }, // teal when busy+ };+ const coreMat = new THREE.ShaderMaterial({+ uniforms: coreUniforms,+ vertexShader: `+ uniform float uTime; uniform float uPulse; uniform float uHeart;+ varying vec3 vNormal; varying float vDisp;+ // layered trig displacement — organic, dependency-free, always compiles+ float wob(vec3 p, float t) {+ return sin(p.x * 2.1 + t) * sin(p.y * 2.4 + t * 1.3) * sin(p.z * 2.0 + t * 0.7)+ + 0.5 * sin(p.x * 4.3 - t * 1.7) * sin(p.z * 3.7 + t);+ }+ void main() {+ vNormal = normalize(normalMatrix * normal);+ float heartbeat = (0.06 + uHeart * 0.10) * sin(uTime * 2.4);+ float d = wob(position, uTime * 0.6) * (0.16 + uHeart * 0.08) + heartbeat + uPulse * 0.42;+ vDisp = d;+ vec3 displaced = position + normal * d;+ gl_Position = projectionMatrix * modelViewMatrix * vec4(displaced, 1.0);+ }+ `,+ fragmentShader: `+ uniform float uHeart; uniform float uPulse;+ uniform vec3 uColorCalm; uniform vec3 uColorHot;+ varying vec3 vNormal; varying float vDisp;+ void main() {+ vec3 viewDir = vec3(0.0, 0.0, 1.0);+ float fres = pow(1.0 - max(dot(normalize(vNormal), viewDir), 0.0), 2.2);+ // Colour reflects ACTIVITY (how busy the curve is), never buy/sell direction.+ float activity = clamp(uHeart + uPulse * 0.5, 0.0, 1.0);+ vec3 tone = mix(uColorCalm, uColorHot, activity);+ vec3 base = tone * (0.35 + vDisp * 1.6 + uPulse * 0.8);+ vec3 col = base + fres * tone * 1.4;+ gl_FragColor = vec4(col, 1.0);+ }+ `,+ });+ const core = new THREE.Mesh(new THREE.IcosahedronGeometry(9, 24), coreMat);+ scene.add(core);++ // Wireframe shell + soft glow halo around the core+ const shell = new THREE.Mesh(+ new THREE.IcosahedronGeometry(10.4, 3),+ new THREE.MeshBasicMaterial({ color: 0x8b7bff, wireframe: true, transparent: true, opacity: 0.10 })+ );+ scene.add(shell);+ const halo = new THREE.Mesh(+ new THREE.SphereGeometry(13.5, 32, 32),+ new THREE.MeshBasicMaterial({ color: 0x8b7bff, transparent: true, opacity: 0.05, side: THREE.BackSide })+ );+ scene.add(halo);++ // ── Trade particles — pooled. Each live trade emits a burst that flies+ // outward (buys up/green, sells down/red), then fades and recycles. ────+ const pPos = new Float32Array(PARTICLE_POOL * 3);+ const pCol = new Float32Array(PARTICLE_POOL * 3);+ const pVel = new Float32Array(PARTICLE_POOL * 3);+ const pLife = new Float32Array(PARTICLE_POOL); // remaining life (s); 0 = free+ const pMaxLife = new Float32Array(PARTICLE_POOL);+ const pSize = new Float32Array(PARTICLE_POOL);+ let pCursor = 0;+ for (let i = 0; i < PARTICLE_POOL; i++) { pPos[i*3+1] = 9999; }++ const pGeo = new THREE.BufferGeometry();+ pGeo.setAttribute('position', new THREE.BufferAttribute(pPos, 3));+ pGeo.setAttribute('color', new THREE.BufferAttribute(pCol, 3));+ pGeo.setAttribute('psize', new THREE.BufferAttribute(pSize, 1));+ const pMat = new THREE.ShaderMaterial({+ uniforms: { uScale: { value: renderer.getPixelRatio() * 220 } },+ transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,+ vertexShader: `+ attribute float psize; attribute vec3 color; uniform float uScale;+ varying vec3 vColor;+ void main() {+ vColor = color;+ vec4 mv = modelViewMatrix * vec4(position, 1.0);+ gl_PointSize = psize * uScale / max(-mv.z, 1.0);+ gl_Position = projectionMatrix * mv;+ }+ `,+ fragmentShader: `+ varying vec3 vColor;+ void main() {+ float d = length(gl_PointCoord - vec2(0.5));+ if (d > 0.5) discard;+ float a = smoothstep(0.5, 0.0, d);+ gl_FragColor = vec4(vColor, a);+ }+ `,+ });+ const particles = new THREE.Points(pGeo, pMat);+ particles.frustumCulled = false;+ scene.add(particles);++ // Shockwave rings (whales). Small pool of expanding rings.+ const shockwaves = [];+ function spawnShockwave(color) {+ const geo = new THREE.RingGeometry(9.2, 9.8, 64);+ const mat = new THREE.MeshBasicMaterial({ color, transparent: true, opacity: 0.8, side: THREE.DoubleSide, depthWrite: false, blending: THREE.AdditiveBlending });+ const ring = new THREE.Mesh(geo, mat);+ ring.lookAt(camera.position);+ ring.userData = { life: 1.2, max: 1.2 };+ scene.add(ring);+ shockwaves.push(ring);+ if (shockwaves.length > 12) { const old = shockwaves.shift(); scene.remove(old); old.geometry.dispose(); old.material.dispose(); }+ }++ const BULL = new THREE.Color(0x34e0a8);+ const BEAR = new THREE.Color(0xff5d73);++ function emitTrade(isBuy, usd) {+ const value = Math.max(1, usd || 1);+ const mag = Math.min(1, Math.log10(value + 1) / Math.log10(50_000)); // 0..1+ const count = Math.round(4 + mag * 36);+ const baseColor = isBuy ? BULL : BEAR;+ const dirY = isBuy ? 1 : -1;+ const speed = 8 + mag * 26;+ const size = 1.4 + mag * 5.5;+ const life = 1.4 + mag * 1.6;+ for (let k = 0; k < count; k++) {+ const i = pCursor; pCursor = (pCursor + 1) % PARTICLE_POOL;+ // emit from a point on the core surface+ const theta = Math.random() * Math.PI * 2;+ const phi = Math.acos(2 * Math.random() - 1);+ const nx = Math.sin(phi) * Math.cos(theta);+ const ny = Math.sin(phi) * Math.sin(theta);+ const nz = Math.cos(phi);+ pPos[i*3] = nx * 9.5; pPos[i*3+1] = ny * 9.5; pPos[i*3+2] = nz * 9.5;+ // velocity: radial out + biased vertically by side+ const sp = speed * (0.6 + Math.random() * 0.7);+ pVel[i*3] = nx * sp * 0.7;+ pVel[i*3+1] = ny * sp * 0.5 + dirY * (sp * 0.6);+ pVel[i*3+2] = nz * sp * 0.7;+ const tint = 0.75 + Math.random() * 0.25;+ pCol[i*3] = baseColor.r * tint; pCol[i*3+1] = baseColor.g * tint; pCol[i*3+2] = baseColor.b * tint;+ pSize[i] = size * (0.7 + Math.random() * 0.6);+ pMaxLife[i] = life; pLife[i] = life;+ }+ // momentary core kick + heartbeat feed+ coreUniforms.uPulse.value = Math.min(1.2, coreUniforms.uPulse.value + 0.25 + mag * 0.6);+ if (value >= WHALE_USD) spawnShockwave(baseColor);+ }++ // ── Live sentiment / flow bookkeeping ───────────────────────────────────+ const recentTrades = []; // { t, isBuy, usd } — for activity level + factual counts+ let lastTradeAt = 0;+ // Roll up the last 60s of activity: factual buy/sell counts + total volume, plus+ // a non-directional "busyness" reading. We deliberately do NOT synthesize a+ // buy/sell verdict or net-flow signal — the scene shows what happened on-chain,+ // it does not make a call. Each transaction is still labelled buy/sell (factual).+ function updateFlowCounters(now) {+ while (recentTrades.length && now - recentTrades[0].t > FLOW_WINDOW_MS) recentTrades.shift();+ let buys = 0, sells = 0, vol = 0;+ for (const r of recentTrades) { if (r.isBuy) buys++; else sells++; vol += r.usd; }+ el('pl-buys').textContent = String(buys);+ el('pl-sells').textContent = String(sells);+ el('pl-vol60').textContent = vol > 0 ? fmtUsd(vol) : '$0';+ const trades = buys + sells;+ const busy = Math.min(1, trades / 30); // 30 trades/min ≈ "busy"+ activityFill.style.width = Math.round(busy * 100) + '%';+ activityReading.textContent = trades === 0 ? 'Quiet' : trades >= 24 ? 'Very busy' : trades >= 8 ? 'Active' : 'Steady';+ }++ // ── HUD updates ─────────────────────────────────────────────────────────+ function fmtUsd(n) {+ n = Number(n);+ if (!Number.isFinite(n) || n === 0) return '—';+ const a = Math.abs(n);+ if (a >= 1e9) return '$' + (n/1e9).toFixed(2) + 'B';+ if (a >= 1e6) return '$' + (n/1e6).toFixed(2) + 'M';+ if (a >= 1e3) return '$' + (n/1e3).toFixed(1) + 'K';+ if (a >= 1) return '$' + n.toFixed(2);+ return '$' + n.toPrecision(3);+ }+ function fmtNum(n) {+ n = Number(n);+ if (!Number.isFinite(n)) return '—';+ if (n >= 1e6) return (n/1e6).toFixed(1) + 'M';+ if (n >= 1e3) return (n/1e3).toFixed(1) + 'K';+ return String(Math.round(n));+ }+ function setHero(state, text) { heroEl.dataset.state = state; if (text) statusText.textContent = text; }++ function pushTicker(isBuy, usd, who) {+ if (tickerEmpty) tickerEmpty.remove();+ const li = document.createElement('li');+ li.className = isBuy ? 'buy' : 'sell';+ const side = document.createElement('span'); side.className = 'side'; side.textContent = isBuy ? 'BUY' : 'SELL';+ const amt = document.createElement('span'); amt.className = 'amt'; amt.textContent = fmtUsd(usd);+ const w = document.createElement('span'); w.className = 'who'; w.textContent = who ? who.slice(0, 4) + '…' + who.slice(-4) : '';+ li.append(side, amt, w);+ tickerList.prepend(li);+ while (tickerList.children.length > TICKER_MAX) tickerList.lastChild.remove();+ }++ // ── Stats polling ───────────────────────────────────────────────────────+ let statsTimer = null, statsFailures = 0;+ async function pollStats() {+ try {+ const r = await fetch(STATS_API, { cache: 'no-store' });+ if (!r.ok) throw new Error('stats ' + r.status);+ const d = await r.json();+ const tk = d.token || {}; const pr = d.protocol || {};+ statsFailures = 0;+ if (tk.price_usd != null) priceEl.textContent = fmtUsd(tk.price_usd);+ const chg = Number(tk.price_change_24h);+ if (Number.isFinite(chg)) {+ changeEl.textContent = (chg >= 0 ? '+' : '') + chg.toFixed(2) + '% · 24h';+ changeEl.className = 'chg ' + (chg > 0.01 ? 'up' : chg < -0.01 ? 'down' : 'flat');+ }+ el('pl-mcap').textContent = fmtUsd(tk.market_cap);+ el('pl-vol').textContent = fmtUsd(tk.volume_24h);+ el('pl-holders').textContent = tk.holders != null ? fmtNum(tk.holders) : '—';+ el('pl-liq').textContent = fmtUsd(tk.liquidity);+ el('pl-agents').textContent = pr.total_agents != null ? fmtNum(pr.total_agents) : '—';+ const burned = (pr.total_agents || 0) * (pr.agent_deploy_burn || 0);+ el('pl-burned').textContent = burned ? fmtNum(burned) : '—';+ // market cap gently scales the core+ if (tk.market_cap) {+ const mc = Math.min(1, Math.log10(Number(tk.market_cap) + 1) / Math.log10(50_000_000));+ targetCoreScale = 0.85 + mc * 0.4;+ }+ } catch (err) {+ statsFailures++;+ if (statsFailures >= 2) showToast('Live stats unavailable — retrying…');+ }+ }++ // ── Trades SSE ──────────────────────────────────────────────────────────+ let es = null, sseRetry = 0, sseRetryTimer = null;+ function connectTrades() {+ try { es = new EventSource(TRADES_SSE); } catch { scheduleReconnect(); return; }+ es.addEventListener('open', () => { /* server "open" event */ });+ es.onopen = () => { sseRetry = 0; setHero('live', '$THREE · live'); };+ es.addEventListener('trade', (ev) => {+ let d; try { d = JSON.parse(ev.data); } catch { return; }+ const isBuy = d.is_buy === true || d.txType === 'buy' || d.tx_type === 'buy';+ const usd = Number(d.sol_value_usd) || (Number(d.sol_amount ?? d.solAmount) || 0) * 150; // sol fallback+ const now = performance.now();+ lastTradeAt = now;+ recentTrades.push({ t: now, isBuy, usd });+ emitTrade(isBuy, usd);+ pushTicker(isBuy, usd, d.trader || d.traderPublicKey);+ setHero('live', '$THREE · live');+ });+ es.onerror = () => { setHero(recentTrades.length ? 'live' : 'connecting', '$THREE · reconnecting…'); scheduleReconnect(); };+ }+ function scheduleReconnect() {+ if (sseRetryTimer) return;+ if (es) { try { es.close(); } catch {} es = null; }+ const delay = Math.min(15_000, 1_000 * 2 ** sseRetry++);+ sseRetryTimer = setTimeout(() => { sseRetryTimer = null; connectTrades(); }, delay);+ }++ let toastTimer = null;+ function showToast(msg) {+ toastEl.textContent = msg; toastEl.classList.add('is-visible');+ clearTimeout(toastTimer); toastTimer = setTimeout(() => toastEl.classList.remove('is-visible'), 3200);+ }++ // ── Animation loop ───────────────────────────────────────────────────────+ let targetCoreScale = 1, coreScale = 1;+ let raf = null, prev = performance.now(), running = true;+ const heartEMA = { v: 0 };++ function tick(now) {+ raf = requestAnimationFrame(tick);+ const dt = Math.min(0.05, (now - prev) / 1000); prev = now;+ const t = now / 1000;++ // core shader+ coreUniforms.uTime.value = t;+ coreUniforms.uPulse.value *= Math.pow(0.02, dt); // fast decay+ // heartbeat amplitude tracks trade frequency (trades in last 8s)+ const recent8 = recentTrades.filter((r) => now - r.t < 8_000).length;+ heartEMA.v += (Math.min(1, recent8 / 12) - heartEMA.v) * 0.05;+ coreUniforms.uHeart.value = heartEMA.v;+ coreScale += (targetCoreScale - coreScale) * 0.04;+ core.scale.setScalar(coreScale);+ shell.scale.setScalar(coreScale);+ shell.rotation.y += dt * 0.06; shell.rotation.x += dt * 0.02;+ halo.scale.setScalar(coreScale * (1 + coreUniforms.uPulse.value * 0.04));++ // particles integrate+ let anyAlive = false;+ for (let i = 0; i < PARTICLE_POOL; i++) {+ if (pLife[i] <= 0) continue;+ anyAlive = true;+ pLife[i] -= dt;+ const f = Math.max(0, pLife[i] / pMaxLife[i]);+ pVel[i*3] *= 0.96; pVel[i*3+1] *= 0.96; pVel[i*3+2] *= 0.96;+ pPos[i*3] += pVel[i*3] * dt; pPos[i*3+1] += pVel[i*3+1] * dt; pPos[i*3+2] += pVel[i*3+2] * dt;+ if (pLife[i] <= 0) { pPos[i*3+1] = 9999; pSize[i] = 0; continue; }+ // fade by shrinking size (additive material has no per-vertex alpha)+ const baseSz = pSize[i];+ pGeo.attributes.psize.array[i] = baseSz * (0.3 + f * 0.7);+ }+ pGeo.attributes.position.needsUpdate = true;+ pGeo.attributes.color.needsUpdate = true;+ pGeo.attributes.psize.needsUpdate = true;++ // shockwaves+ for (let i = shockwaves.length - 1; i >= 0; i--) {+ const r = shockwaves[i]; r.userData.life -= dt;+ if (r.userData.life <= 0) { scene.remove(r); r.geometry.dispose(); r.material.dispose(); shockwaves.splice(i, 1); continue; }+ const k = 1 - r.userData.life / r.userData.max;+ r.scale.setScalar(1 + k * 3.2); r.material.opacity = 0.8 * (1 - k); r.lookAt(camera.position);+ }++ // idle/quiet state+ if (lastTradeAt && now - lastTradeAt > 25_000 && heroEl.dataset.state === 'live') setHero('quiet', '$THREE · market quiet');++ updateFlowCounters(now);+ controls.update();+ composer.render();+ }++ // ── Resize / lifecycle ───────────────────────────────────────────────────+ function resize() {+ const w = host.clientWidth, h = host.clientHeight;+ renderer.setSize(w, h); composer.setSize(w, h);+ bloom.setSize(w, h);+ camera.aspect = w / h; camera.updateProjectionMatrix();+ pMat.uniforms.uScale.value = renderer.getPixelRatio() * 220;+ }+ new ResizeObserver(resize).observe(host);+ resize();++ document.addEventListener('visibilitychange', () => {+ if (document.hidden) { if (raf) cancelAnimationFrame(raf); raf = null; }+ else if (!raf) { prev = performance.now(); raf = requestAnimationFrame(tick); }+ });+ window.addEventListener('beforeunload', () => { if (es) es.close(); if (statsTimer) clearInterval(statsTimer); });++ // ── Boot ──────────────────────────────────────────────────────────────────+ setHero('connecting', '$THREE · connecting…');+ pollStats().finally(() => { setTimeout(() => introEl.classList.add('is-hidden'), 350); });+ statsTimer = setInterval(pollStats, STATS_INTERVAL_MS);+ connectTrades();+ raf = requestAnimationFrame(tick);+ </script>+</body>+</html>diff --git a/public/app-next.css b/public/app-next.cssindex a15e7df0a..3ec453d3d 100644--- a/public/app-next.css+++ b/public/app-next.css@@ -1431,6 +1431,15 @@ body.app-next-body .nich-panel {z-index: 24;}+/* The chat dock is the single composer on /app-next — it writes through to the+ panel's hidden .nich-input and clicks .nich-mic programmatically. Hide the+ panel's own input + mic row so we don't render two stacked composers; the+ panel stays a pure conversation thread (header + messages). */+body.app-next-body .nich-panel .nich-controls,+body.app-next-body .nich-panel .nich-mic-row {+ display: none !important;+}+/* When chat is active, slide the input dock to the right to align with theconversation panel — keeps input + thread as one unified column.Uses translate instead of left/right so the transition animates cleanly. */diff --git a/public/nav.html b/public/nav.htmlindex be5d479f6..83aef0e84 100644--- a/public/nav.html+++ b/public/nav.html@@ -326,6 +326,12 @@><span class="nav-mi-sub">3D view of trending tokens</span></a></li>+ <li role="none">+ <a href="/three-live" role="menuitem"+ ><span class="nav-mi-title">$THREE Live<span class="nav-pill" aria-hidden="true">NEW</span></span+ ><span class="nav-mi-sub">Protocol pulse — live trades in 3D</span></a+ >+ </li><li role="none"><a href="/strategy-lab" role="menuitem"><span class="nav-mi-title">Strategy Lab</spandiff --git a/scripts/build-vercel.mjs b/scripts/build-vercel.mjsindex 972115a75..7c5031bbc 100644--- a/scripts/build-vercel.mjs+++ b/scripts/build-vercel.mjs@@ -73,25 +73,47 @@ async function buildChat() {writeStamp('chat', inputs);}-// Guard: agent-payments-sdk/dist/ is gitignored. Vercel caches node_modules/+// Guard: these SDKs' dist/ dirs are gitignored. Vercel caches node_modules/// across deploys and skips npm install (and therefore postinstall) when// package-lock.json is unchanged. Two failure modes follow:// 1. The dist is missing entirely → the Vite app build can't resolve the-// package entry and fails.+// package entry and fails, or — for SDKs marked external in bundle-api —+// the deployed function FUNCTION_INVOCATION_FAILEDs at load (the bundle+// leaves the import to be resolved against node_modules at runtime, and+// `@three-ws/solana-agent/dist/index.js` simply isn't there).// 2. A stale or corrupt dist survives in the cache → e.g. a malformed ESM// entry crashed every cron that imports the SDK at runtime with a// SyntaxError ("export{…} = pkg" failing ModuleJob._instantiate).// `existsSync` alone misses case 2. Validate that every published entry parses// as a real module; rebuild from source if any is missing or syntactically bad.-const SDK_ENTRIES = [- 'agent-payments-sdk/dist/index.js',- 'agent-payments-sdk/dist/solana/index.js',- 'agent-payments-sdk/dist/x402/index.js',- 'agent-payments-sdk/dist/evm/index.js',+const SDKS = [+ {+ name: 'agent-payments-sdk',+ dir: 'agent-payments-sdk',+ entries: [+ 'agent-payments-sdk/dist/index.js',+ 'agent-payments-sdk/dist/solana/index.js',+ 'agent-payments-sdk/dist/x402/index.js',+ 'agent-payments-sdk/dist/evm/index.js',+ ],+ },+ {+ // @three-ws/solana-agent — imported by api/agenc/[action].js and marked+ // external in scripts/bundle-api.mjs, so its dist must exist in the+ // deployed node_modules at runtime.+ name: '@three-ws/solana-agent',+ dir: 'solana-agent-sdk',+ entries: [+ 'solana-agent-sdk/dist/index.js',+ 'solana-agent-sdk/dist/wallet/index.js',+ 'solana-agent-sdk/dist/x402-exact/index.js',+ 'solana-agent-sdk/dist/solana-agent-kit/index.js',+ ],+ },];-function sdkDistIsValid() {- for (const rel of SDK_ENTRIES) {+function sdkDistIsValid(entries) {+ for (const rel of entries) {const abs = resolve(ROOT, rel);if (!existsSync(abs)) {console.log(`[sdk-dist] ${rel} missing`);@@ -112,14 +134,16 @@ function sdkDistIsValid() {}async function ensureSDKDist() {- if (sdkDistIsValid()) return;- console.log('[sdk-dist] agent-payments-sdk dist missing or invalid — rebuilding from source');- execSync('rm -rf dist', { cwd: resolve(ROOT, 'agent-payments-sdk'), stdio: 'inherit' });- await run('sdk-dist', 'npm run build --prefix agent-payments-sdk', {- env: { NODE_OPTIONS: '--no-deprecation' },- });- if (!sdkDistIsValid()) {- throw new Error('[sdk-dist] rebuild produced an invalid dist — aborting');+ for (const sdk of SDKS) {+ if (sdkDistIsValid(sdk.entries)) continue;+ console.log(`[sdk-dist] ${sdk.name} dist missing or invalid — rebuilding from source`);+ execSync('rm -rf dist', { cwd: resolve(ROOT, sdk.dir), stdio: 'inherit' });+ await run(`sdk-dist:${sdk.dir}`, `npm run build --prefix ${sdk.dir}`, {+ env: { NODE_OPTIONS: '--no-deprecation' },+ });+ if (!sdkDistIsValid(sdk.entries)) {+ throw new Error(`[sdk-dist] ${sdk.name} rebuild produced an invalid dist — aborting`);+ }}}diff --git a/scripts/bundle-api.mjs b/scripts/bundle-api.mjsindex b88489bca..a8b46a4c3 100644--- a/scripts/bundle-api.mjs+++ b/scripts/bundle-api.mjs@@ -95,6 +95,11 @@ const EXTERNALS = [// require('url') — same ESM-bundling incompatibility as @x402/extensions.// Marking it external lets Node.js load it natively as CJS.'gltf-validator',+ // @vercel/og reads its bundled fonts from a path relative to its own package+ // dir. Inlining it rewrites that path to the route's output location, so the+ // font read ENOENTs at load. External keeps the package (and its font assets)+ // resolvable from node_modules at runtime.+ '@vercel/og','jsdom','ethers','@elevenlabs/elevenlabs-js',@@ -134,7 +139,16 @@ function esbuildArgs(files) {// offending packages external is whack-a-mole (the call sites live deep// in transitive CJS deps, not just @x402). Inject a real CommonJS// `require` via createRequire so the shim resolves built-ins natively.- `--banner:js=import { createRequire as __createRequireForBundle } from 'node:module'; const require = __createRequireForBundle(import.meta.url);`,+ //+ // The banner must survive being inlined TWICE into one output: a route file+ // that imports a sibling route file (e.g. pump-fun-mcp.js → ./pump/[action].js)+ // pulls in the sibling's already-bundled copy, which carries this same banner.+ // A top-level `import { … as X }` binding can't be redeclared, so two copies+ // were a SyntaxError ("Identifier '__createRequireForBundle' has already been+ // declared") that crashed the function at load (FUNCTION_INVOCATION_FAILED).+ // `var require` redeclares legally and a dynamic `await import()` has no import+ // binding to collide, so duplication is harmless.+ `--banner:js=var require = (await import('node:module')).createRequire(import.meta.url);`,`--outdir=${API_DIR}`,`--outbase=${API_DIR}`,'--allow-overwrite',diff --git a/src/skills/local-packs.js b/src/skills/local-packs.jsindex fd0c707bb..9a905dfac 100644--- a/src/skills/local-packs.js+++ b/src/skills/local-packs.js@@ -13,15 +13,34 @@// the agent reads it and follows the embedded instructions.import { readFileSync } from 'fs';+import { join } from 'path';++// Resolve in a bundle-safe way. scripts/bundle-api.mjs inlines this module into+// each API entry with esbuild, which rewrites `import.meta.url` to the OUTPUT+// file's location (e.g. /var/task/api/chat-skills.js). A `../../`-relative URL+// is correct from this source path (src/skills/) but resolves two levels too+// high from the bundled entry (→ /var/data/...), so the read used to ENOENT in+// production. process.cwd() is /var/task on Vercel and the repo root in dev, and+// the JSON is force-shipped via vercel.json includeFiles (data/_generated/**),+// so the cwd path is correct in both. The original URL path stays as a fallback+// for any caller that runs unbundled from an unexpected cwd.+const REL = 'data/_generated/local-skill-packs.json';+const CANDIDATES = [+ join(process.cwd(), REL),+ new URL('../../' + REL, import.meta.url),+];let _cached = null;export function loadLocalSkillPacks() {if (_cached) return _cached;- _cached = JSON.parse(- readFileSync(- new URL('../../data/_generated/local-skill-packs.json', import.meta.url),- 'utf8',- ),- );- return _cached;+ let lastErr;+ for (const candidate of CANDIDATES) {+ try {+ _cached = JSON.parse(readFileSync(candidate, 'utf8'));+ return _cached;+ } catch (err) {+ lastErr = err;+ }+ }+ throw lastErr;}diff --git a/src/walk.js b/src/walk.jsindex 5db61f23d..c9e8c074d 100644--- a/src/walk.js+++ b/src/walk.js@@ -428,6 +428,26 @@ function applyCameraImmediate() {camLookCurrent.copy(camLookTarget);camera.lookAt(camLookCurrent);}++// Recompute the follow offset so the full avatar plus headroom fits the+// current viewport. Distance is derived from the camera's vertical FOV, and+// portrait/narrow viewports (phones) get pulled back further so the head+// isn't cropped. Safe to call before an avatar loads — uses the cached height.+// On a resize we update the offset only and let the follow loop lerp to it;+// on first load we snap so frame 0 is already framed.+function frameAvatarCamera({ snap = true } = {}) {+ const height = avatarHeight || 1.8;+ const aspect = camera.aspect || window.innerWidth / window.innerHeight;+ // 1.5× the avatar height as the vertical span gives ~25% headroom top and+ // bottom; narrower-than-square viewports get up to ~1.6× for clear headroom.+ const portraitBoost = aspect < 1 ? 1 + (1 - aspect) * 0.6 : 1;+ const coverage = height * 1.5 * portraitBoost;+ const vFovRad = (camera.fov * Math.PI) / 180;+ const fitDist = coverage / (2 * Math.tan(vFovRad / 2));+ CAM_OFFSET.set(0, height * 0.62, fitDist);+ CAM_LOOK_OFFSET.set(0, height * 0.5, 0);+ if (snap) applyCameraImmediate();+}applyCameraImmediate();// ── Drag-to-orbit on the canvas (one-finger drag rotates the camera yaw) ──@@ -689,9 +709,7 @@ async function loadAvatar() {// Frame the camera relative to the avatar's height.const height = Math.max(0.5, box.max.y - box.min.y);avatarHeight = height;- CAM_OFFSET.set(0, height * 1.05, height * 1.95);- CAM_LOOK_OFFSET.set(0, height * 0.6, 0);- applyCameraImmediate();+ frameAvatarCamera();animationManager.attach(avatar);@@ -717,6 +735,9 @@ async function loadAvatar() {currentMotion = 'idle';dismissLoading();+ // Clear the sticky "loading avatar…" pill that #walk-status ships with —+ // setStatus auto-hides this confirmation after a couple of seconds.+ setStatus('Ready — drag to look around');buildEmoteTray();// Auto-hide help hints after 5 seconds.@@ -1148,6 +1169,9 @@ function resize() {renderer.setSize(w, h, false);camera.aspect = w / h;camera.updateProjectionMatrix();+ // Re-fit the follow framing for the new aspect (e.g. phone rotation) so the+ // avatar's head stays in frame. Update the offset only; the loop lerps to it.+ frameAvatarCamera({ snap: false });}window.addEventListener('resize', resize);window.addEventListener('orientationchange', resize);@@ -2423,10 +2447,13 @@ loadAvatar()}).catch((err) => {console.error('[walk] failed to load avatar:', err);+ // Tear down the full-screen loading overlay so the error is readable and+ // the scene (default ground/lighting) is visible behind the message.+ dismissLoading();const hasParam = new URLSearchParams(location.search).has('avatar');const suffix = hasParam ? ' — <a href="/walk">try the default avatar</a>' : '';- if (statusEl) statusEl.innerHTML = `failed to load avatar: ${err?.message ?? err}${suffix}`;if (statusEl) {+ statusEl.innerHTML = `failed to load avatar: ${err?.message ?? err}${suffix}`;statusEl.classList.add('is-error');statusEl.classList.remove('is-hidden');}diff --git a/vercel.json b/vercel.jsonindex b1c322cc5..34d8336a6 100644--- a/vercel.json+++ b/vercel.json@@ -8,35 +8,35 @@},"functions": {"api/club/tips-stream.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 300},"api/avatars/[id].js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 300},"api/tts/speak.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 60},"api/widgets/[id]/knowledge-process.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 300},"api/agents/pumpfun.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 120},"api/cron/[name].js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 300},"api/agents/gmgn.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 120},"api/**/*.js": {- "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**",+ "includeFiles": "examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json","maxDuration": 30}},@@ -277,6 +277,10 @@"src": "/pump-visualizer/?","dest": "/pump-visualizer.html"},+ {+ "src": "/three-live/?",+ "dest": "/three-live.html"+ },{"src": "/pump-live/?","dest": "/pump-live.html"diff --git a/vite.config.js b/vite.config.jsindex c1e0918e4..e9f6f7f17 100644--- a/vite.config.js+++ b/vite.config.js@@ -213,6 +213,7 @@ const appConfig = {'pump-live': resolve(__dirname, 'pages/pump-live.html'),'pump-dashboard': resolve(__dirname, 'pages/pump-dashboard.html'),'pump-visualizer': resolve(__dirname, 'pages/pump-visualizer.html'),+ 'three-live': resolve(__dirname, 'pages/three-live.html'),'avatar-artifact': resolve(__dirname, 'pages/avatar-artifact.html'),'launch-week': resolve(__dirname, 'pages/three-ws-launch-week.html'),community: resolve(__dirname, 'pages/community.html'),@@ -468,6 +469,8 @@ const appConfig = {'/pump-dashboard/': resolve(root, 'pages/pump-dashboard.html'),'/pump-visualizer': resolve(root, 'pages/pump-visualizer.html'),'/pump-visualizer/': resolve(root, 'pages/pump-visualizer.html'),+ '/three-live': resolve(root, 'pages/three-live.html'),+ '/three-live/': resolve(root, 'pages/three-live.html'),'/avatar-artifact': resolve(root, 'pages/avatar-artifact.html'),'/avatar-artifact/': resolve(root, 'pages/avatar-artifact.html'),'/walk': resolve(root, 'pages/walk.html'),