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: coin detail page, economy heartbeat docs, changelog entry
nirholas2d5ce346a837
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2dc6706f7..ac63ac343 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Deploys restored — the platform ships again, and builds are 4× lighter** — three.ws was briefly unreachable while production moved to new infrastructure: every deploy was timing out at the build platform's 45-minute ceiling. The root cause is fixed — a monitoring SDK was being baked into every one of the platform's ~800 API functions, inflating the deploy payload to 2.3 GB; it now loads only where it is actually enabled, cutting that to 540 MB. Two smaller deploy blockers found along the way (a build-order race and two missing packages) are fixed too. The site is back, deploys complete with time to spare, and nothing about how you use the platform changes. `[infra, fix]`- **Four gestures return to the walk companion — nod, shrug, jog, celebrate** — The gesture wheel regained four expressive moves that had been silently dropped: nod (a quick upper-body affirm), shrug, jog (a full-body run loop), and celebrate (a whole-body cheer). Open the wheel with G (or long-press the action button on mobile) — the wheel now lays out all twelve gestures; keys 1–8 still trigger the first eight. Also part of this pass: the entire test suite now runs fully green, locking every one of these behaviors in. (`/walk`) `[fix]`- **The agent economy now runs from a single always-on heartbeat** — The live agent-to-agent economy - ring settlements, x402 micropayments, the Money Pulse feed, and the Labor Market - used to stall for hours at a time because it depended on schedulers that were silently not firing. It now runs from one consolidated heartbeat that any always-on trigger can drive every minute, so activity stays continuous instead of arriving in bursts. The Labor Market, which previously had no scheduler at all, is now driven too. We also lifted the ring's throughput ceiling so it can carry far higher daily on-chain volume once funded. `[improvement, infra]`+- **The whole agent economy now ticks every minute** — The minute heartbeat that drives the agent-to-agent economy was itself never being scheduled - it sat past the platform's scheduled-job limit, so the economy only moved when a deploy happened to nudge it. It's now pinned to run every minute, and it drives the full economy in one pass: agent tips and payouts, x402 payments, autonomous coin launches on pump.fun, copy/signal/strategy and DCA trading, subscriptions and royalties, $THREE buybacks, and treasury funding and reconciliation. Each engine self-paces to its own cadence, so nothing over-fires - but nothing sits idle waiting for a scheduler that never comes. The result: continuous activity instead of dead stretches. `[improvement, infra]`## 2026-07-03diff --git a/data/changelog.json b/data/changelog.jsonindex 60daa51d9..05f5c057f 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-04",+ "title": "The whole agent economy now ticks every minute",+ "summary": "The minute heartbeat that drives the agent-to-agent economy was itself never being scheduled - it sat past the platform's scheduled-job limit, so the economy only moved when a deploy happened to nudge it. It's now pinned to run every minute, and it drives the full economy in one pass: agent tips and payouts, x402 payments, autonomous coin launches on pump.fun, copy/signal/strategy and DCA trading, subscriptions and royalties, $THREE buybacks, and treasury funding and reconciliation. Each engine self-paces to its own cadence, so nothing over-fires - but nothing sits idle waiting for a scheduler that never comes. The result: continuous activity instead of dead stretches.",+ "tags": [+ "improvement",+ "infra"+ ]+ },{"date": "2026-07-04","title": "The agent economy now runs from a single always-on heartbeat",diff --git a/docs/economy-heartbeat.md b/docs/economy-heartbeat.mdindex 643fc9182..54ba6f57e 100644--- a/docs/economy-heartbeat.md+++ b/docs/economy-heartbeat.md@@ -26,13 +26,20 @@ is a single dispatcher that fans out — concurrently, with the same`Authorization: Bearer $CRON_SECRET` header Vercel would send — to every enginethat makes the economy move:-| Engine | Endpoint | Drives |+| Group | Endpoints | Drives || --- | --- | --- |-| Ring tick | `/api/cron/x402-ring-tick` | ring settlements / Agent Economy Volume |-| x402 seed | `/api/cron/x402-seed-cron` | x402 micropayment activity feed |-| Autonomous loop | `/api/cron/x402-autonomous-loop` | catalog spend (signals, audits) |-| Money Pulse | `/api/cron/pulse-tick` | the live wallet-activity feed |-| Labor Market | `/api/labor/tick` | bounty bids, awards, settlements |+| Payments & x402 | `x402-ring-tick`, `x402-seed-cron`, `x402-autonomous-loop`, `x402-ring-leak-scan`, `wallets-leak-scan`, `run-distribute-payments`, `payment-session-sweep` | ring settlements, micropayment feed, catalog spend, leak scans, payout distribution |+| Money Pulse, Labor & delegation | `pulse-tick`, `/api/labor/tick`, `index-delegations` | live wallet-activity feed, bounty bids/awards/settlements, agent hiring/delegation |+| Coin launches (pump.fun) | `launcher-tick`, `launcher-claimer`, `coin-intel-observe`, `pumpfun-monitor`, `pumpfun-graduations-sync`, `run-coin-cycle`, `run-coin-payouts` | autonomous minting, fee claims, launch intel, graduation sync, coin lifecycle + payouts |+| Autonomous / copy / strategy trading | `copy-fanout`, `mirror-fanout`, `signal-fanout`, `strategy-fanout`, `run-dca` | copy trading, signal/strategy execution, DCA |+| Tips, payouts, subscriptions, royalties | `club-payouts`, `run-subscriptions`, `process-subscriptions`, `settle-royalties`, `cosmetic-splits-sweep` | tipping payouts, subscription billing, royalty + cosmetic-split settlement |+| $THREE buyback | `run-buyback`, `run-three-buyback` | revenue → buy → treasury (internally gated hourly/daily) |+| Funding, treasury & reconcile | `treasury-topup`, `treasury-autopilot`, `treasury-sweepback`, `economy-reconcile`, `reflect-sweep` | master-wallet funding root, treasury autopilot, tamper reconciliation |+| $THREE market & holders | `three-market-refresh`, `three-holders-snapshot` | live coin market + holder snapshots |++The snipers / autonomous trading experiment run as a **standalone always-on worker**+([workers/agent-sniper/](../workers/agent-sniper)), not a Vercel cron, so they are+continuous and not part of this dispatch list.Every target engine is internally idempotent — per-tick spend caps, per-endpointcooldowns, and daily ceilings absorb over-calling — so it is safe to fire@@ -54,10 +61,14 @@ The whole economy now needs exactly one thing: something hitting2. **Upstash QStash (you already run Upstash Redis).** Register a schedule thatPOSTs the same URL every minute with the bearer header. Reliable, retried,dashboard-visible.-3. **Vercel Cron.** Already wired as one entry in `vercel.json`- (`* * * * *`). This only fires if the project's total cron count is within the- plan cap — trim `vercel.json` below 40 entries (or move to a plan that allows- more) for Vercel to schedule it.+3. **Vercel Cron (now the primary — no external infra needed).** `economy-tick`+ is pinned to **slot 0 of the `crons` array** in `vercel.json` (`* * * * *`), so+ it lands inside the plan's scheduled-cron cap and Vercel fires it every minute.+ Because it fans out to every engine above, the individual per-engine crons that+ still sit past slot 40 no longer need to be scheduled — the dispatcher covers+ them. Keep `economy-tick` first in the array; if it ever slips past the cap the+ whole economy goes dark again. The external triggers (1) and (2) remain valid as+ redundant belt-and-suspenders.4. **Always-on host.** `scripts/economy-heartbeat.mjs` still works as along-running pinger on any small VM (Fly.io / Railway / a box):`CRON_SECRET=… node scripts/economy-heartbeat.mjs` reads `vercel.json` anddiff --git a/public/changelog.json b/public/changelog.jsonindex fe30700ae..9eacb921e 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-04T04:50:54.607Z",+ "generated_at": "2026-07-04T04:57:04.706Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -59,6 +59,17 @@"infra"]},+ {+ "date": "2026-07-04",+ "type": "update",+ "title": "The whole agent economy now ticks every minute",+ "summary": "The minute heartbeat that drives the agent-to-agent economy was itself never being scheduled - it sat past the platform's scheduled-job limit, so the economy only moved when a deploy happened to nudge it. It's now pinned to run every minute, and it drives the full economy in one pass: agent tips and payouts, x402 payments, autonomous coin launches on pump.fun, copy/signal/strategy and DCA trading, subscriptions and royalties, $THREE buybacks, and treasury funding and reconciliation. Each engine self-paces to its own cadence, so nothing over-fires - but nothing sits idle waiting for a scheduler that never comes. The result: continuous activity instead of dead stretches.",+ "link": null,+ "tags": [+ "improvement",+ "infra"+ ]+ },{"date": "2026-07-03","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex 1b0ec7a9e..adf6aa7a7 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -46,6 +46,14 @@<category>improvement</category><description>The live agent-to-agent economy - ring settlements, x402 micropayments, the Money Pulse feed, and the Labor Market - used to stall for hours at a time because it depended on schedulers that were silently not firing. It now runs from one consolidated heartbeat that any always-on trigger can drive every minute, so activity stays continuous instead of arriving in bursts. The Labor Market, which previously had no scheduler at all, is now driven too. We also lifted the ring's throughput ceiling so it can carry far higher daily on-chain volume once funded.</description></item>+ <item>+ <title>The whole agent economy now ticks every minute</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-04:The whole agent economy now ticks every minute</guid>+ <pubDate>Sat, 04 Jul 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The minute heartbeat that drives the agent-to-agent economy was itself never being scheduled - it sat past the platform's scheduled-job limit, so the economy only moved when a deploy happened to nudge it. It's now pinned to run every minute, and it drives the full economy in one pass: agent tips and payouts, x402 payments, autonomous coin launches on pump.fun, copy/signal/strategy and DCA trading, subscriptions and royalties, $THREE buybacks, and treasury funding and reconciliation. Each engine self-paces to its own cadence, so nothing over-fires - but nothing sits idle waiting for a scheduler that never comes. The result: continuous activity instead of dead stretches.</description>+ </item><item><title>Docs · Claim Your Wallet & Trader Card</title><link>https://three.ws/docs/trader-card</link>diff --git a/public/features.json b/public/features.jsonindex a1d0befae..920e959db 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-04T04:50:54.591Z",+ "generated_at": "2026-07-04T04:57:04.683Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/coin-page.js b/src/coin-page.jsnew file mode 100644index 000000000..78d00f2b9--- /dev/null+++ b/src/coin-page.js@@ -0,0 +1,507 @@+// /coin/:id — rich coin detail page, adopted from the cryptocurrency.cv coin+// pages: header (icon / name / rank / price / 24h-7d-30d chips), interactive+// SVG price chart with time ranges and a crosshair tooltip, market-stats grid,+// related news, about text, and link pills. Data comes from the /api/coin/*+// proxies (CoinGecko + the cryptocurrency.cv news aggregator) — never mocked.++import {+ formatUsd,+ formatPrice,+ formatPercent,+ formatSupply,+ formatDateShort,+ formatChartTick,+ timeAgo,+ escapeHtml as esc,+} from './shared/coin-format.js';++const TIME_RANGES = [+ { label: '24H', days: 1 },+ { label: '7D', days: 7 },+ { label: '30D', days: 30 },+ { label: '90D', days: 90 },+ { label: '1Y', days: 365 },+];++const $ = (id) => document.getElementById(id);++function coinIdFromPath() {+ const m = location.pathname.match(/^\/coin\/([a-z0-9][a-z0-9_-]{0,99})\/?$/i);+ return m ? m[1].toLowerCase() : null;+}++const MINT_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;++// ── Fetch helpers ───────────────────────────────────────────────────────────++async function getJson(url) {+ const res = await fetch(url, { headers: { accept: 'application/json' } });+ if (!res.ok) {+ const err = new Error(`fetch ${url} → ${res.status}`);+ err.status = res.status;+ throw err;+ }+ return res.json();+}++// ── Skeletons ───────────────────────────────────────────────────────────────++function renderSkeletons() {+ $('cv-head').innerHTML = `+ <div class="cv-coin-head">+ <div class="cv-skel" style="width:64px;height:64px;border-radius:50%"></div>+ <div style="flex:1;min-width:0">+ <div class="cv-skel" style="width:14rem;height:2.25rem"></div>+ <div class="cv-skel" style="width:18rem;height:3rem;margin-top:0.75rem"></div>+ </div>+ </div>`;+ $('cv-chart').innerHTML =+ '<div class="cv-chart-panel"><div class="cv-skel" style="height:300px;border-radius:8px"></div></div>';+ $('cv-stats').innerHTML =+ '<div class="cv-stats-grid">' ++ Array.from({ length: 8 }, () => '<div class="cv-skel" style="height:5rem"></div>').join('') ++ '</div>';+}++// ── Header ──────────────────────────────────────────────────────────────────++function chip(label, value) {+ if (value == null || !Number.isFinite(value)) return '';+ const dir = value >= 0 ? 'up' : 'down';+ return `<span class="cv-chip ${dir}"><span class="win">${esc(label)}</span>${esc(formatPercent(value))}</span>`;+}++function renderHead(coin) {+ const m = coin.market || {};+ const todayAbs = m.change_24h_abs;+ $('cv-crumb-name').textContent = coin.name;+ $('cv-head').innerHTML = `+ <div class="cv-coin-head">+ ${coin.image ? `<img class="coin-icon" src="${esc(coin.image)}" alt="" width="64" height="64" data-no-dark-filter />` : ''}+ <div style="flex:1;min-width:0">+ <div class="title-row">+ <h1>${esc(coin.name)}</h1>+ <span class="ticker">${esc(coin.symbol || '')}</span>+ ${coin.rank != null ? `<span class="cv-rank-badge">#${coin.rank}</span>` : ''}+ </div>+ <div class="cv-price-row">+ <span class="cv-price cv-mono">${esc(formatPrice(m.price))}</span>+ <div style="display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap">+ ${chip('24h', m.change_pct?.h24)}${chip('7d', m.change_pct?.d7)}${chip('30d', m.change_pct?.d30)}+ </div>+ </div>+ ${+ todayAbs != null+ ? `<p class="cv-today">${todayAbs >= 0 ? '+' : '−'}$${Math.abs(todayAbs).toFixed(Math.abs(todayAbs) < 1 ? 4 : 2)} today</p>`+ : ''+ }+ ${+ coin.categories?.length+ ? `<div class="cv-cats">${coin.categories.map((c) => `<span class="cv-cat">${esc(c)}</span>`).join('')}</div>`+ : ''+ }+ </div>+ </div>`;+}++// ── Chart ───────────────────────────────────────────────────────────────────++const chartState = { days: 30, series: [], loading: true, error: null };++const CHART_W = 800;+const CHART_H = 300;+const PAD = { top: 20, right: 60, bottom: 30, left: 10 };++function chartGeometry(series) {+ const closes = series.map((p) => p[1]);+ const min = Math.min(...closes);+ const max = Math.max(...closes);+ const range = max - min || 1;+ const w = CHART_W - PAD.left - PAD.right;+ const h = CHART_H - PAD.top - PAD.bottom;+ const pts = closes.map((v, i) => ({+ x: PAD.left + (i / (closes.length - 1)) * w,+ y: PAD.top + h - ((v - min) / range) * h,+ }));+ const line = pts.map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x.toFixed(2)},${p.y.toFixed(2)}`).join(' ');+ const area = `${line} L${pts[pts.length - 1].x.toFixed(2)},${PAD.top + h} L${pts[0].x.toFixed(2)},${PAD.top + h} Z`;+ const first = closes[0];+ const last = closes[closes.length - 1];+ return {+ min,+ max,+ range,+ line,+ area,+ up: last >= first,+ changePct: first > 0 ? ((last - first) / first) * 100 : 0,+ };+}++function renderChart(coin) {+ const el = $('cv-chart');+ const { days, series, loading, error } = chartState;++ const rangeBtns = TIME_RANGES.map(+ (r) =>+ `<button type="button" class="cv-range-btn" data-days="${r.days}" aria-pressed="${r.days === days}">${r.label}</button>`,+ ).join('');++ let body;+ if (loading) {+ body = '<div class="cv-chart-state"><span class="cv-spinner" aria-hidden="true"></span>Loading chart…</div>';+ } else if (error || series.length < 2) {+ body = '<div class="cv-chart-state">Chart data unavailable</div>';+ } else {+ const g = chartGeometry(series);+ const color = g.up ? 'var(--cv-chart-green)' : 'var(--cv-chart-red)';+ const steps = 4;+ const h = CHART_H - PAD.top - PAD.bottom;+ const yLabels = Array.from({ length: steps + 1 }, (_, i) => {+ const price = g.min + (g.range * i) / steps;+ const y = PAD.top + h - (i / steps) * h;+ return `<g><line x1="${PAD.left}" y1="${y}" x2="${CHART_W - PAD.right}" y2="${y}" stroke="var(--cv-border)" stroke-width="0.5" stroke-dasharray="4 4" opacity="0.5"/><text x="${CHART_W - PAD.right + 8}" y="${y + 4}" font-size="10" fill="var(--cv-text-3)">${esc(formatPrice(price))}</text></g>`;+ }).join('');+ body = `+ <div class="cv-chart-area">+ <svg viewBox="0 0 ${CHART_W} ${CHART_H}" role="img"+ aria-label="Price chart for ${esc(coin.name)} over ${days} day${days > 1 ? 's' : ''}. Change: ${esc(formatPercent(g.changePct))}">+ <defs>+ <linearGradient id="cv-grad" x1="0" x2="0" y1="0" y2="1">+ <stop offset="0%" stop-color="${color}" stop-opacity="0.2"/>+ <stop offset="100%" stop-color="${color}" stop-opacity="0.02"/>+ </linearGradient>+ </defs>+ ${yLabels}+ <path d="${g.area}" fill="url(#cv-grad)"/>+ <path d="${g.line}" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>+ <g id="cv-crosshair" hidden>+ <line id="cv-cross-line" x1="0" y1="${PAD.top}" x2="0" y2="${CHART_H - PAD.bottom}" stroke="var(--cv-text-3)" stroke-width="0.5" stroke-dasharray="3 3"/>+ <circle id="cv-cross-dot" r="4" fill="${color}" stroke="var(--cv-surface)" stroke-width="2"/>+ </g>+ </svg>+ <div class="cv-chart-tip" id="cv-tip" hidden>+ <p class="p cv-mono" id="cv-tip-price"></p>+ <p class="d" id="cv-tip-date"></p>+ </div>+ </div>`;+ }++ const pct =+ !loading && !error && series.length >= 2+ ? (() => {+ const g = chartGeometry(series);+ return `<span class="pct ${g.up ? 'cv-up' : 'cv-down'} cv-mono">${esc(formatPercent(g.changePct))}</span>`;+ })()+ : '';++ el.innerHTML = `+ <div class="cv-chart-panel">+ <div class="cv-chart-bar">+ <div class="left"><span class="title">Price Chart</span>${pct}</div>+ <div class="cv-ranges" role="group" aria-label="Chart time range">${rangeBtns}</div>+ </div>+ ${body}+ </div>`;++ el.querySelectorAll('.cv-range-btn').forEach((btn) => {+ btn.addEventListener('click', () => {+ const d = Number(btn.dataset.days);+ if (d === chartState.days) return;+ chartState.days = d;+ loadChart(coin);+ });+ });++ wireChartPointer();+}++function wireChartPointer() {+ const svg = $('cv-chart').querySelector('svg');+ const tip = $('cv-tip');+ if (!svg || !tip || chartState.series.length < 2) return;+ const g = chartGeometry(chartState.series);+ const cross = svg.querySelector('#cv-crosshair');+ const crossLine = svg.querySelector('#cv-cross-line');+ const crossDot = svg.querySelector('#cv-cross-dot');+ const usableW = CHART_W - PAD.left - PAD.right;+ const usableH = CHART_H - PAD.top - PAD.bottom;++ function show(clientX) {+ const rect = svg.getBoundingClientRect();+ const mouseX = ((clientX - rect.left) / rect.width) * CHART_W;+ const n = chartState.series.length;+ const i = Math.max(0, Math.min(n - 1, Math.round(((mouseX - PAD.left) / usableW) * (n - 1))));+ const [ts, price] = chartState.series[i];+ const x = PAD.left + (i / (n - 1)) * usableW;+ const y = PAD.top + usableH - ((price - g.min) / g.range) * usableH;+ cross.removeAttribute('hidden');+ crossLine.setAttribute('x1', x);+ crossLine.setAttribute('x2', x);+ crossDot.setAttribute('cx', x);+ crossDot.setAttribute('cy', y);+ tip.hidden = false;+ tip.style.left = `${(x / CHART_W) * 100}%`;+ $('cv-tip-price').textContent = formatPrice(price);+ $('cv-tip-date').textContent = formatChartTick(ts, chartState.days);+ }+ function hide() {+ cross.setAttribute('hidden', '');+ tip.hidden = true;+ }+ svg.addEventListener('pointermove', (e) => show(e.clientX));+ svg.addEventListener('pointerleave', hide);+ svg.addEventListener('pointerdown', (e) => show(e.clientX));+}++async function loadChart(coin) {+ chartState.loading = true;+ chartState.error = null;+ renderChart(coin);+ try {+ const { data } = await getJson(`/api/coin/ohlc?id=${encodeURIComponent(coin.id)}&days=${chartState.days}`);+ chartState.series = data;+ chartState.loading = false;+ } catch (err) {+ chartState.loading = false;+ chartState.error = err;+ chartState.series = [];+ }+ renderChart(coin);+}++// ── Stats grid ──────────────────────────────────────────────────────────────++function miniStat(label, value, { sub, tone } = {}) {+ return `+ <div class="cv-mini-stat">+ <p class="label">${esc(label)}</p>+ <p class="value cv-mono${tone ? ` ${tone}` : ''}">${esc(value)}</p>+ ${sub ? `<p class="sub">${esc(sub)}</p>` : ''}+ </div>`;+}++function renderStats(coin) {+ const m = coin.market || {};+ $('cv-stats').innerHTML = `+ <h2 class="cv-h2">Market Stats</h2>+ <div class="cv-stats-grid">+ ${miniStat('Market Cap', formatUsd(m.market_cap))}+ ${miniStat('24h Volume', formatUsd(m.volume_24h))}+ ${miniStat('Circulating Supply', formatSupply(m.circulating))}+ ${miniStat('Total Supply', m.total != null ? formatSupply(m.total) : '—')}+ ${miniStat('All-Time High', formatPrice(m.ath), { sub: m.ath_date ? formatDateShort(m.ath_date) : undefined, tone: 'green' })}+ ${miniStat('All-Time Low', formatPrice(m.atl), { sub: m.atl_date ? formatDateShort(m.atl_date) : undefined, tone: 'red' })}+ ${miniStat('24h High', formatPrice(m.high_24h))}+ ${miniStat('24h Low', formatPrice(m.low_24h))}+ </div>`;+}++// ── News ────────────────────────────────────────────────────────────────────++async function loadNews(coin) {+ const el = $('cv-news');+ try {+ const { articles } = await getJson(+ `/api/coin/news?q=${encodeURIComponent(coin.name)}&limit=8`,+ );+ if (!articles?.length) {+ el.innerHTML = '';+ return;+ }+ el.innerHTML = `+ <h2 class="cv-h2">Latest ${esc(coin.name)} News</h2>+ <div class="cv-news-grid">+ ${articles+ .map(+ (a) => `+ <a class="cv-news-card" href="${esc(a.link)}" target="_blank" rel="noopener noreferrer">+ ${a.image ? `<img src="${esc(a.image)}" alt="" loading="lazy" />` : ''}+ <div style="min-width:0">+ <p class="t">${esc(a.title)}</p>+ <p class="m">${a.source ? `<span class="src">${esc(a.source)}</span> · ` : ''}${esc(timeAgo(a.published_at))}</p>+ </div>+ </a>`,+ )+ .join('')}+ </div>`;+ } catch {+ // News is an enhancement rail — a failed upstream hides the section+ // rather than blocking the coin profile.+ el.innerHTML = '';+ }+}++// ── About + links ───────────────────────────────────────────────────────────++function renderAbout(coin) {+ const el = $('cv-about');+ if (!coin.description) {+ el.innerHTML = '';+ return;+ }+ const paras = coin.description+ .split(/\n{2,}/)+ .filter((p) => p.trim())+ .slice(0, 6)+ .map((p) => `<p>${esc(p.trim())}</p>`)+ .join('');+ el.innerHTML = `<h2 class="cv-h2">About ${esc(coin.name)}</h2><div class="cv-prose">${paras}</div>`;+}++function pill(href, label) {+ return `<a class="cv-pill" href="${esc(href)}" target="_blank" rel="noopener noreferrer">${esc(label)} ↗</a>`;+}++function renderLinks(coin) {+ const l = coin.links || {};+ const pills = [];+ if (l.homepage) pills.push(pill(l.homepage, 'Website'));+ if (l.twitter) pills.push(pill(`https://twitter.com/${l.twitter}`, 'Twitter'));+ if (l.reddit) pills.push(pill(l.reddit, 'Reddit'));+ if (l.telegram) pills.push(pill(`https://t.me/${l.telegram}`, 'Telegram'));+ if (l.github) pills.push(pill(l.github, 'GitHub'));+ for (const url of (l.explorers || []).slice(0, 2)) pills.push(pill(url, 'Explorer'));++ // three.ws integration: a Solana contract gets first-party intel links.+ const solMint = coin.platforms?.solana;+ const contracts = Object.entries(coin.platforms || {}).slice(0, 3);++ let contractHtml = '';+ if (contracts.length) {+ contractHtml = `+ <div class="cv-pills" style="margin-top:0.75rem">+ ${contracts+ .map(+ ([chain, addr]) => `+ <span class="cv-contract" title="${esc(addr)}">+ <span>${esc(chain)}: ${esc(addr.length > 16 ? `${addr.slice(0, 8)}…${addr.slice(-6)}` : addr)}</span>+ <button type="button" data-copy="${esc(addr)}" aria-label="Copy ${esc(chain)} contract address">Copy</button>+ </span>`,+ )+ .join('')}+ </div>`;+ }++ let threewsHtml = '';+ if (solMint && MINT_RE.test(solMint)) {+ threewsHtml = `+ <div class="cv-pills" style="margin-top:0.75rem">+ <a class="cv-pill" href="/alpha-copilot?mint=${encodeURIComponent(solMint)}">Analyze with Alpha Copilot</a>+ <a class="cv-pill" href="/trades?mint=${encodeURIComponent(solMint)}">Live trades on three.ws</a>+ </div>`;+ }++ $('cv-links').innerHTML = pills.length || contractHtml || threewsHtml+ ? `<h2 class="cv-h2">Links</h2><div class="cv-pills">${pills.join('')}</div>${contractHtml}${threewsHtml}`+ : '';++ $('cv-links').querySelectorAll('button[data-copy]').forEach((btn) => {+ btn.addEventListener('click', async () => {+ try {+ await navigator.clipboard.writeText(btn.dataset.copy);+ btn.textContent = 'Copied';+ setTimeout(() => (btn.textContent = 'Copy'), 1500);+ } catch {+ btn.textContent = 'Copy failed';+ }+ });+ });+}++// ── Not found / error states ────────────────────────────────────────────────++function renderNotFound(id) {+ const mintish = MINT_RE.test(id);+ $('cv-head').innerHTML = `+ <h1 class="cv-h1">Coin not found</h1>+ <div class="cv-empty" style="text-align:left">+ <p style="margin:0 0 0.75rem">Could not find market data for “${esc(id)}”. The coin may not be+ listed on the market data source, or the id is misspelled.</p>+ <p style="margin:0">+ Try the <a href="/coins">markets index</a>${+ mintish+ ? ` — or, since this looks like a Solana mint address, check+ <a href="/launches/${esc(id)}">its launch profile</a> or+ <a href="/coin-intel">Coin Intelligence</a> on three.ws`+ : ''+ }.+ </p>+ </div>`;+ $('cv-chart').innerHTML = '';+ $('cv-stats').innerHTML = '';+ $('cv-crumb-name').textContent = 'Not found';+}++function renderError() {+ $('cv-head').innerHTML = `+ <h1 class="cv-h1">Market data unavailable</h1>+ <div class="cv-empty" style="text-align:left">+ <p style="margin:0">The market data source is temporarily unreachable. This usually clears in+ under a minute — <a href="javascript:location.reload()">reload the page</a> or head back to the+ <a href="/coins">markets index</a>.</p>+ </div>`;+ $('cv-chart').innerHTML = '';+ $('cv-stats').innerHTML = '';+}++// ── SEO / document metadata ─────────────────────────────────────────────────++function updateMeta(coin) {+ const m = coin.market || {};+ const title = `${coin.name} (${coin.symbol}) Price${m.price != null ? ` — ${formatPrice(m.price)}` : ''} · three.ws`;+ document.title = title;+ const set = (sel, attr, val) => document.querySelector(sel)?.setAttribute(attr, val);+ const desc = `Live ${coin.name} price, interactive chart, market stats, and news.${m.change_pct?.h24 != null ? ` 24h: ${formatPercent(m.change_pct.h24)}.` : ''}`;+ set('meta[name="description"]', 'content', desc);+ set('meta[property="og:title"]', 'content', title);+ set('meta[property="og:description"]', 'content', desc);+ set('meta[property="og:url"]', 'content', `https://three.ws/coin/${coin.id}`);+ let canon = document.querySelector('link[rel="canonical"]');+ if (!canon) {+ canon = document.createElement('link');+ canon.rel = 'canonical';+ document.head.appendChild(canon);+ }+ canon.href = `https://three.ws/coin/${coin.id}`;+ if (coin.image) set('meta[property="og:image"]', 'content', coin.image);+}++// ── Boot ────────────────────────────────────────────────────────────────────++async function main() {+ const id = coinIdFromPath();+ const main_ = $('cv-main');+ if (!id) {+ location.replace('/coins');+ return;+ }+ renderSkeletons();++ let coin;+ try {+ ({ coin } = await getJson(`/api/coin/detail?id=${encodeURIComponent(id)}`));+ } catch (err) {+ main_.removeAttribute('aria-busy');+ if (err.status === 404 || err.status === 400) renderNotFound(id);+ else renderError();+ return;+ }++ main_.removeAttribute('aria-busy');+ updateMeta(coin);+ renderHead(coin);+ renderStats(coin);+ renderAbout(coin);+ renderLinks(coin);+ if (coin.last_updated) {+ const upd = $('cv-updated');+ upd.hidden = false;+ upd.textContent = `Last updated: ${new Date(coin.last_updated).toLocaleString()}`;+ }+ // Chart + news stream in independently of the core profile.+ loadChart(coin);+ loadNews(coin);+}++main();diff --git a/vercel.json b/vercel.jsonindex d98bf198c..9acb73cc2 100644--- a/vercel.json+++ b/vercel.json@@ -4673,6 +4673,10 @@}],"crons": [+ {+ "path": "/api/cron/economy-tick",+ "schedule": "* * * * *"+ },{"path": "/api/cron/payment-session-sweep","schedule": "*/5 * * * *"