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.

Roll back the prior commit

nirholasb592c2b17439
diff --git a/pages/three-token.html b/pages/three-token.html
index add2ad819..4a5e8ba8f 100644
--- a/pages/three-token.html
+++ b/pages/three-token.html
@@ -5,9 +5,9 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>$THREE · Live price, chart & trades · three.ws</title>
- <meta name="description" content="The $THREE protocol token — live price chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." />
+ <meta name="description" content="The $THREE protocol token — live price, bonding-curve chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." />
<meta property="og:title" content="$THREE · three.ws protocol token" />
- <meta property="og:description" content="Live price chart and streaming trades for $THREE." />
+ <meta property="og:description" content="Live price, bonding-curve chart, and streaming trades for $THREE." />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="three.ws" />
<meta property="og:url" content="https://three.ws/three-token" />
@@ -17,7 +17,7 @@
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@trythreews" />
<meta name="twitter:title" content="$THREE · Live price, chart & trades · three.ws" />
- <meta name="twitter:description" content="The $THREE protocol token — live price chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." />
+ <meta name="twitter:description" content="The $THREE protocol token — live price, bonding-curve chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." />
<meta name="twitter:image" content="https://three.ws/og-image.png" />
<meta name="theme-color" content="#0a0a0d" />
<link rel="icon" href="/favicon.ico" sizes="any" />
diff --git a/scripts/play-onboard-block-probe.mjs b/scripts/play-onboard-block-probe.mjs
index 23777a6e2..ce4b82c3c 100644
--- a/scripts/play-onboard-block-probe.mjs
+++ b/scripts/play-onboard-block-probe.mjs
@@ -7,51 +7,43 @@ const page = await ctx.newPage();
await page.goto(URL, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('.cc-card', { timeout: 15000 });
await page.tap('.cc-card');
-const phase = await page.waitForFunction(() => window.__CC__?.phase === 'world', { timeout: 45000 }).then(() => 'world').catch(() => 'TIMEOUT');
+await page.waitForFunction(() => window.__CC__?.phase === 'world', { timeout: 20000 }).catch(() => {});
+// Wait for the onboarding overlay to actually appear (650ms delay after build).
+const onboardUp = await page.waitForFunction(() => document.getElementById('po-overlay')?.classList.contains('po-show'), { timeout: 6000 }).then(() => true).catch(() => false);
-// Force the onboarding overlay visible immediately (deterministic — bypasses the
-// 650ms timer + flaky connect timing). _showOverlay is idempotent.
-const forced = await page.evaluate(() => {
- const ob = window.__CC__?._onboard;
- if (!ob) return 'no-onboard';
- ob._showOverlay();
- const ov = document.getElementById('po-overlay');
- if (ov) ov.classList.add('po-show');
- return ov ? 'shown' : 'failed';
+const pre = await page.evaluate(() => {
+ const z = document.getElementById('cc-joystick');
+ const r = z.getBoundingClientRect();
+ const cx = r.left + r.width / 2, cy = r.top + r.height / 2;
+ const top = document.elementFromPoint(cx, cy);
+ return { onboardUp: !!document.getElementById('po-overlay'), topAtJoystick: top ? (top.id ? '#' + top.id : top.tagName + '.' + String(top.className).split(' ')[0]) : null, cx, cy };
});
-await page.waitForTimeout(150);
-const r = await page.evaluate(() => {
- const ov = document.getElementById('po-overlay');
- const card = document.querySelector('.po-card');
- const joy = document.getElementById('cc-joystick');
- const cs = (e) => e ? getComputedStyle(e) : null;
- const hit = (el) => {
- const b = el.getBoundingClientRect();
- const t = document.elementFromPoint(b.left + b.width / 2, b.top + b.height / 2);
- return t ? (t.id ? '#' + t.id : t.tagName + '.' + String(t.className).split(' ').filter(Boolean)[0]) : null;
- };
- const primaryBtn = document.querySelector('#po-overlay .po-btn-primary') || document.querySelector('#po-overlay .po-close');
- return {
- bodyOnboarding: document.body.classList.contains('po-onboarding'),
- overlayPE: cs(ov)?.pointerEvents,
- cardPE: cs(card)?.pointerEvents,
- joyZ: cs(joy)?.zIndex,
- hitAtJoystick: hit(joy), // want #cc-joystick
- hitAtPrimaryBtn: primaryBtn ? hit(primaryBtn) : 'no-btn', // want something inside the card
- primaryBtnInCard: primaryBtn ? !!primaryBtn.closest('.po-card') : false,
- };
+// Drag the joystick up WHILE the onboarding card is still showing.
+const before = await page.evaluate(() => ({ ...window.__CC__.localPos }));
+await page.mouse.move(pre.cx, pre.cy);
+await page.mouse.down();
+await page.mouse.move(pre.cx, pre.cy - 55, { steps: 6 });
+await page.waitForTimeout(500);
+const joyVec = await page.evaluate(() => window.__CC__._joy);
+const during = await page.evaluate(() => ({ ...window.__CC__.localPos }));
+await page.mouse.up();
+const movedDuringOnboarding = Math.abs(before.x - during.x) > 0.02 || Math.abs(before.z - during.z) > 0.02;
+
+// The card must still be interactive: tap "Enter the world"/close to dismiss.
+const cardWorks = await page.evaluate(() => {
+ const btn = document.querySelector('#po-overlay .po-close') || document.querySelector('#po-overlay .po-btn-primary');
+ if (!btn) return 'no-button';
+ btn.click();
+ return 'clicked';
});
+await page.waitForTimeout(400);
+const dismissed = await page.evaluate(() => !document.getElementById('po-overlay'));
-console.log('phase :', phase);
-console.log('forced overlay :', forced);
-console.log('body.po-onboarding :', r.bodyOnboarding);
-console.log('#po-overlay pointerEv :', r.overlayPE, '(want none)');
-console.log('.po-card pointerEv :', r.cardPE, '(want auto)');
-console.log('#cc-joystick z-index :', r.joyZ, '(want 60 while onboarding)');
-console.log('hit @ joystick centre :', r.hitAtJoystick, '(want #cc-joystick — backdrop is click-through)');
-console.log('hit @ primary button :', r.hitAtPrimaryBtn, '/ inCard:', r.primaryBtnInCard, '(card still interactive)');
+console.log('onboarding shown :', onboardUp);
+console.log('topAtJoystick :', pre.topAtJoystick, '(want #cc-joystick — backdrop no longer eats input)');
+console.log('joyVec during onboard :', JSON.stringify(joyVec));
+console.log('MOVED during onboarding:', movedDuringOnboarding);
+console.log('card button :', cardWorks, '=> dismissed:', dismissed);
-const pass = r.overlayPE === 'none' && r.cardPE === 'auto' && r.joyZ === '60' && r.hitAtJoystick === '#cc-joystick' && r.primaryBtnInCard;
-console.log('\nRESULT:', pass ? 'PASS — joystick reachable during onboarding, card still works' : 'FAIL');
await browser.close();
diff --git a/src/three-token-page.js b/src/three-token-page.js
index 382129338..a6f189880 100644
--- a/src/three-token-page.js
+++ b/src/three-token-page.js
@@ -1,15 +1,13 @@
// Public $THREE coin page (/three-token).
//
// The canonical, trustworthy page for the protocol token: a live price header,
-// a real OHLCV price chart, a streaming trade tape, and a one-click buy.
-// $THREE graduated long ago, so there is no bonding curve to show — the left
-// card is a live price chart (real Birdeye → GeckoTerminal OHLCV via
-// /api/pump/price-history) instead.
+// the real bonding-curve chart, a streaming trade tape, and a one-click buy.
// Reuses the shared $THREE store (single source of truth) for the header, the
-// SSE trade stream, and the Jupiter swap modal — no bespoke data plumbing, no
-// mock data.
+// bonding-curve widget, the SSE trade stream, and the Jupiter swap modal — no
+// bespoke data plumbing, no mock data.
import { createThreeTokenData, THREE_MINT } from './pump/three-token-data.js';
+import { mountBondingCurve } from './widgets/bonding-curve.js';
import { openSwapModal } from './swap-jupiter.js';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
@@ -38,14 +36,6 @@ const fmtPct = (n) => {
const s = v >= 0 ? '+' : '';
return `${s}${v.toFixed(2)}%`;
};
-// Per-token price — sub-cent values shown with significant digits, never "1e-7".
-const fmtPrice = (n) => {
- const v = Number(n);
- if (!Number.isFinite(v) || v <= 0) return '$—';
- if (v >= 1) return `$${v.toFixed(4)}`;
- if (v >= 0.01) return `$${v.toFixed(5)}`;
- return `$${v.toFixed(12).replace(/0+$/, '').replace(/\.$/, '')}`;
-};
const shortAddr = (a) => { const s = String(a || ''); return s.length > 9 ? `${s.slice(0, 4)}…${s.slice(-4)}` : s; };
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
const relTime = (sec) => {
@@ -103,22 +93,6 @@ function injectStyles() {
.tk-empty { text-align:center; color:#7d7d86; font-size:13px; padding:40px 0; }
.tk-skel { background:linear-gradient(90deg,#16161c,#1d1d24,#16161c); background-size:200% 100%; animation:tkSh 1.4s infinite; border-radius:10px; }
@keyframes tkSh { from { background-position:200% 0; } to { background-position:-200% 0; } }
- .tk-chart-bar { display:inline-flex; gap:4px; }
- .tk-int { appearance:none; background:none; border:1px solid #232329; color:#8a8a93; border-radius:7px; padding:3px 9px; font-size:11px; font-weight:600; cursor:pointer; transition:color .15s,border-color .15s,background .15s; text-transform:none; letter-spacing:0; }
- .tk-int:hover { color:#fff; border-color:#3a3a42; }
- .tk-int.active { color:#000; background:#f5f5f7; border-color:#f5f5f7; }
- .tk-int:focus-visible { outline:2px solid #7CC4FF; outline-offset:2px; }
- .tk-chart-canvas { min-height:264px; }
- .tk-chart-readout { display:flex; align-items:baseline; gap:10px; margin:0 0 8px; }
- .tk-chart-price { font-size:21px; font-weight:700; font-family:ui-monospace,Menlo,monospace; }
- .tk-chart-change { font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; }
- .tk-chart-win { font-size:11px; color:#7d7d86; margin-left:auto; text-transform:uppercase; letter-spacing:0.05em; }
- .tk-chart-svg { width:100%; height:240px; display:block; }
- .tk-chart-svg.up { color:#4ade80; } .tk-chart-svg.dn { color:#f87171; }
- .tk-vol.up { fill:rgba(74,222,128,0.38); } .tk-vol.dn { fill:rgba(248,113,113,0.38); }
- .tk-vol-divider { stroke:rgba(255,255,255,0.06); stroke-width:1; }
- .tk-retry { appearance:none; background:#1a1a20; border:1px solid #2a2a32; color:#fff; border-radius:8px; padding:5px 12px; font-size:12px; font-weight:600; cursor:pointer; margin-left:8px; transition:background .15s; }
- .tk-retry:hover { background:#23232b; }
.tk-foot { display:flex; gap:18px; flex-wrap:wrap; margin-top:26px; font-size:13px; }
.tk-foot a { color:#9a9aa3; text-decoration:none; } .tk-foot a:hover { color:#fff; }
@media (prefers-reduced-motion: reduce){ .tk-trade.in { animation:none; } .tk-skel { animation:none; } }
@@ -198,123 +172,6 @@ function startTradeTape(tapeEl, statusEl) {
return () => { stopped = true; clearTimeout(retry); es?.close(); };
}
-// ── live price chart (real OHLCV; $THREE graduated, so no bonding curve) ─────
-// Intervals + the window each one looks back over. Mirrors the launch-detail
-// chart so the two surfaces feel like one product.
-const CHART_INTERVALS = [['5m', '5m'], ['15m', '15m'], ['1H', '1h'], ['4H', '4h'], ['1D', '1d']];
-const CHART_WINDOW_HOURS = { '5m': 12, '15m': 36, '1h': 96, '4h': 480, '1d': 2160 };
-
-function windowLabel(interval) {
- const hrs = CHART_WINDOW_HOURS[interval] || 36;
- return hrs % 24 === 0 ? `past ${hrs / 24}d` : `past ${hrs}h`;
-}
-
-// Pure SVG area chart with a volume panel. points: [{t,o,h,l,c,v}] ascending.
-// Theme-aware via currentColor (green when the window is up, red when down).
-function buildChartSvg(points) {
- const w = 720, h = 240, volH = 40, priceH = h - volH;
- const pad = { t: 14, r: 6, b: 4, l: 6 };
- const closes = points.map((p) => p.c);
- const min = Math.min(...closes);
- const max = Math.max(...closes);
- const span = max - min || max || 1;
- const maxVol = Math.max(...points.map((p) => p.v || 0)) || 1;
- const innerW = w - pad.l - pad.r;
- const innerH = priceH - pad.t - pad.b;
- const x = (i) => pad.l + (i / Math.max(1, points.length - 1)) * innerW;
- const y = (v) => pad.t + innerH - ((v - min) / span) * innerH;
-
- const up = points.length > 1 && closes[closes.length - 1] >= closes[0];
- const line = points.map((p, i) => `${i ? 'L' : 'M'}${x(i).toFixed(1)} ${y(p.c).toFixed(1)}`).join(' ');
- const area = `${line} L${x(points.length - 1).toFixed(1)} ${(priceH - pad.b).toFixed(1)} L${x(0).toFixed(1)} ${(priceH - pad.b).toFixed(1)} Z`;
-
- const barW = Math.max(1, (innerW / points.length) * 0.62);
- const bars = points.map((p, i) => {
- const barH = Math.max(1, ((p.v || 0) / maxVol) * (volH - 6));
- return `<rect x="${(x(i) - barW / 2).toFixed(1)}" y="${(h - barH - 2).toFixed(1)}" width="${barW.toFixed(1)}" height="${barH.toFixed(1)}" rx="1" class="tk-vol ${p.c >= p.o ? 'up' : 'dn'}"/>`;
- }).join('');
-
- return `<svg class="tk-chart-svg ${up ? 'up' : 'dn'}" viewBox="0 0 ${w} ${h}" preserveAspectRatio="none" role="img" aria-label="$THREE price history chart">
- <defs><linearGradient id="tkChartGrad" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0%" stop-color="currentColor" stop-opacity="0.26"/>
- <stop offset="100%" stop-color="currentColor" stop-opacity="0"/>
- </linearGradient></defs>
- ${bars}
- <line x1="${pad.l}" y1="${priceH}" x2="${w - pad.r}" y2="${priceH}" class="tk-vol-divider"/>
- <path d="${area}" fill="url(#tkChartGrad)" stroke="none"/>
- <path d="${line}" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>
- </svg>`;
-}
-
-// Mount the chart into a card already holding [data-intervals] + [data-chart-canvas].
-function mountPriceChart(card, { mint }) {
- const barEl = card.querySelector('[data-intervals]');
- const canvas = card.querySelector('[data-chart-canvas]');
- let interval = '15m';
- let loaded = false;
- let destroyed = false;
-
- const paintBar = () => {
- barEl.innerHTML = CHART_INTERVALS.map(([label, value]) =>
- `<button class="tk-int${value === interval ? ' active' : ''}" type="button" role="tab" aria-selected="${value === interval}" data-int="${value}">${esc(label)}</button>`,
- ).join('');
- };
-
- async function load() {
- if (destroyed) return;
- const to = Math.floor(Date.now() / 1000);
- const from = to - (CHART_WINDOW_HOURS[interval] || 36) * 3600;
- // Only blank to a skeleton on the first paint / interval switch — a live
- // 30s refresh swaps the SVG in place without a flash.
- if (!loaded) canvas.innerHTML = `<div class="tk-skel" style="height:264px"></div>`;
- try {
- const r = await fetch(`/api/pump/price-history?mint=${encodeURIComponent(mint)}&interval=${interval}&from=${from}&to=${to}`);
- if (!r.ok) throw new Error(`HTTP ${r.status}`);
- const body = await r.json();
- if (destroyed) return;
- const pts = (body.data || []).filter((p) => Number.isFinite(p.c));
- if (pts.length < 2) {
- loaded = false;
- canvas.innerHTML = `<div class="tk-empty" style="padding:80px 0">Not enough trade history at this interval yet.</div>`;
- return;
- }
- const first = pts[0].c;
- const last = pts[pts.length - 1].c;
- const changePct = first ? ((last - first) / first) * 100 : 0;
- const upColor = changePct >= 0 ? '#4ade80' : '#f87171';
- canvas.innerHTML = `
- <div class="tk-chart-readout">
- <span class="tk-chart-price">${fmtPrice(last)}</span>
- <span class="tk-chart-change" style="color:${upColor}">${fmtPct(changePct)}</span>
- <span class="tk-chart-win">${windowLabel(interval)}</span>
- </div>
- ${buildChartSvg(pts)}`;
- loaded = true;
- } catch {
- if (destroyed) return;
- loaded = false;
- canvas.innerHTML = `<div class="tk-empty" style="padding:64px 0">Price history is unavailable right now. <button class="tk-retry" type="button" data-retry>Retry</button></div>`;
- }
- }
-
- barEl.addEventListener('click', (e) => {
- const btn = e.target.closest('[data-int]');
- if (!btn) return;
- const next = btn.getAttribute('data-int');
- if (next === interval) return;
- interval = next;
- loaded = false;
- paintBar();
- load();
- });
- canvas.addEventListener('click', (e) => { if (e.target.closest('[data-retry]')) load(); });
-
- paintBar();
- load();
- const timer = setInterval(load, 30_000);
- return { destroy() { destroyed = true; clearInterval(timer); } };
-}
-
// ── buy flow: Phantom → in-page swap, else pump.fun ─────────────────────────
async function buyThree() {
const provider = window.solana || window.phantom?.solana;
@@ -357,8 +214,8 @@ function boot() {
</div>
<div class="tk-grid">
<div class="tk-card">
- <h2 style="display:flex;align-items:center;justify-content:space-between;gap:8px">Price <span class="tk-chart-bar" data-intervals></span></h2>
- <div class="tk-chart-canvas" data-chart-canvas></div>
+ <h2>Bonding curve</h2>
+ <div data-curve></div>
<div class="tk-buy">
<button class="tk-btn primary" data-buy>Buy $THREE</button>
<a class="tk-btn" href="${PUMP_URL}" target="_blank" rel="noopener">View on pump.fun ↗</a>
@@ -395,8 +252,8 @@ function boot() {
// Buy
wrap.querySelector('[data-buy]').addEventListener('click', () => { buyThree().catch(() => window.open(PUMP_URL, '_blank', 'noopener')); });
- // Price chart — real OHLCV for the (graduated) $THREE mint, refreshed live.
- mountPriceChart(wrap.querySelector('.tk-card'), { mint: THREE_MINT });
+ // Bonding curve — real on-chain reads for the $THREE mint.
+ mountBondingCurve(wrap.querySelector('[data-curve]'), { mint: THREE_MINT, network: 'mainnet', showUsd: true, refreshMs: 15_000 });
// Header stats from the shared store (price/mcap/volume/holders).
const statsEl = wrap.querySelector('[data-stats]');