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: Money Pulse — clickable counters, feed filter bar, and live updated indicator
nirholasa9a96c01a326
diff --git a/pages/pulse.html b/pages/pulse.htmlindex 6ad7ccd8a..46432b664 100644--- a/pages/pulse.html+++ b/pages/pulse.html@@ -56,39 +56,42 @@Every tip, launch, trade and payment moving through three.ws agent wallets —the moment it lands on-chain. Real events only. Click any beat to meet the agent behind it.</p>- <div class="px-net" role="tablist" aria-label="Network">- <button type="button" class="px-net-btn active" data-network="mainnet" role="tab" aria-selected="true">Mainnet</button>- <button type="button" class="px-net-btn" data-network="devnet" role="tab" aria-selected="false">Devnet</button>+ <div class="px-hero-row">+ <div class="px-net" role="tablist" aria-label="Network">+ <button type="button" class="px-net-btn active" data-network="mainnet" role="tab" aria-selected="true">Mainnet</button>+ <button type="button" class="px-net-btn" data-network="devnet" role="tab" aria-selected="false">Devnet</button>+ </div>+ <span class="px-updated" id="px-updated" aria-live="polite"></span></div></section><dl class="px-counters" id="px-counters">- <div class="px-counter px-counter--lead">+ <div class="px-counter px-counter--lead" data-filter="all" role="button" tabindex="0" aria-label="Show all events in feed"><dt>Volume · 24h</dt><dd id="px-c-vol">—</dd><span class="px-counter-sub" id="px-c-vol-sub">on-chain flow</span></div>- <div class="px-counter">+ <div class="px-counter" data-filter="tips" role="button" tabindex="0" aria-label="Filter feed to tips"><dt>Tips · 24h</dt><dd id="px-c-tips">—</dd><span class="px-counter-sub" id="px-c-tips-sub">—</span></div>- <div class="px-counter">+ <div class="px-counter" data-filter="launches" role="button" tabindex="0" aria-label="Filter feed to launches"><dt>Launches · 24h</dt><dd id="px-c-launches">—</dd><span class="px-counter-sub">coins minted</span></div>- <div class="px-counter">+ <div class="px-counter" data-filter="trades" role="button" tabindex="0" aria-label="Filter feed to trades"><dt>Trades · 24h</dt><dd id="px-c-trades">—</dd><span class="px-counter-sub" id="px-c-trades-sub">swaps</span></div>- <div class="px-counter">+ <div class="px-counter" data-filter="payments" role="button" tabindex="0" aria-label="Filter feed to payments"><dt>Payments · 24h</dt><dd id="px-c-pays">—</dd><span class="px-counter-sub">agent → agent x402</span></div>- <div class="px-counter">+ <div class="px-counter" data-filter="purchases" role="button" tabindex="0" aria-label="Filter feed to marketplace purchases"><dt>Marketplace · 24h</dt><dd id="px-c-market">—</dd><span class="px-counter-sub" id="px-c-market-sub">paid skill buys</span>@@ -144,7 +147,7 @@<div class="px-market-htxt"><span class="px-market-title">Trading viability</span><span class="px-market-tag" id="px-trade-pnl-tag">—</span>- <button type="button" class="px-market-action" id="px-trade-filter" hidden>Show trades in feed →</button>+ <button type="button" class="px-market-action" id="px-trade-filter" data-filter="trades" hidden>Show trades in feed →</button></div><span class="px-market-sub">Real, fully-guarded coin trades through agent wallets — what's flowing, what it costs, and the realized P&L on positions that have closed. The honest signal behind the Trades counter.</span></div>@@ -173,7 +176,13 @@<div class="px-grid"><div class="px-main">- <h2 class="px-section-h">Live feed</h2>+ <div class="px-feed-header">+ <h2 class="px-section-h">Live feed</h2>+ <div class="px-filter-bar" id="px-filter-bar" hidden>+ <span class="px-filter-label" id="px-filter-label"></span>+ <button type="button" class="px-filter-clear" id="px-filter-clear" aria-label="Clear feed filter">× clear</button>+ </div>+ </div><div id="px-feed"></div></div><aside class="px-rail" aria-label="Money intelligence">diff --git a/src/pulse.css b/src/pulse.cssindex 834cf0cb5..d8e59d782 100644--- a/src/pulse.css+++ b/src/pulse.css@@ -44,6 +44,11 @@.px-sub { max-width: 620px; margin: 0 auto; color: var(--ink-dim, #999); font-size: var(--text-lg, 1.02rem); line-height: 1.5; }.px-fineprint { font-size: var(--text-2xs, .68rem); text-align: left; margin: 0; color: var(--ink-faint, #666); }+/* Hero layout — network toggle + updated indicator in one row */+.px-hero-row { display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: var(--space-md, 16px); }+.px-hero-row .px-net { margin-top: 0; }+.px-updated { font-size: var(--text-2xs, .64rem); color: var(--ink-faint, #555); letter-spacing: .04em; transition: color .3s ease; }+/* Network toggle */.px-net { display: inline-flex; gap: 2px; margin-top: var(--space-md, 16px); padding: 3px;background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08));@@ -63,6 +68,12 @@border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px) var(--space-sm, 14px); text-align: center;transition: border-color .16s ease, background .16s ease; }.px-counter:hover { border-color: var(--stroke-strong, rgba(255,255,255,.14)); background: var(--surface-2, rgba(255,255,255,.05)); }+/* Clickable counters */+.px-counter[data-filter] { cursor: pointer; }+.px-counter[data-filter]:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }+.px-counter--active { border-color: var(--ink-bright, #fff) !important; background: var(--surface-3, rgba(255,255,255,.09)) !important; }+.px-counter--active dt { color: var(--ink, #e8e8e8); }+.px-counter--active dd { color: var(--ink-bright, #fff); }.px-counter--lead { background: var(--surface-2, rgba(255,255,255,.05)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }.px-counter dt { font-size: var(--text-2xs, .66rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #888); margin-bottom: 6px; }.px-counter dd { margin: 0; font-family: var(--font-mono, monospace); font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 700; color: var(--ink-bright, #fff); line-height: 1.05; }@@ -121,12 +132,35 @@A gain reads bright + tight; a loss reads dim. No green/red anywhere. */.px-pnl--up { color: var(--ink-bright, #fff); letter-spacing: -.01em; }.px-pnl--down { color: var(--ink-dim, #9a9a9a); }+/* P&L KPI gets a hairline-stronger frame so the bottom-line number reads as the+ panel's anchor without introducing any colour. */+.px-kpi--pnl { border-color: var(--stroke-strong, rgba(255,255,255,.14)); background: var(--surface-2, rgba(255,255,255,.05)); }+/* In-panel "show trades in feed" action — a quiet ghost button in the header row. */+.px-market-action { appearance: none; font: inherit; font-size: var(--text-2xs, .66rem); font-weight: 600; cursor: pointer;+ color: var(--ink-dim, #aaa); background: transparent; border: 1px solid var(--stroke, rgba(255,255,255,.10));+ border-radius: var(--radius-pill, 999px); padding: 4px 11px; white-space: nowrap; margin-left: auto;+ transition: color .14s ease, border-color .14s ease, background .14s ease; }+.px-market-action:hover { color: var(--ink-bright, #fff); border-color: var(--stroke-strong, rgba(255,255,255,.22)); background: var(--surface-2, rgba(255,255,255,.05)); }+.px-market-action:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }+/* One-line plain-language readout under the KPIs — the human summary of the week. */+.px-trade-insight { margin: 0 0 var(--space-md, 16px); font-size: var(--text-sm, .8rem); line-height: 1.45; color: var(--ink-dim, #aaa); }.px-skill-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: var(--radius-md, 9px); }.px-skill-row:hover { background: var(--surface-2, rgba(255,255,255,.05)); }.px-skill-name { font-size: var(--text-sm, .8rem); font-weight: 600; color: var(--ink, #e8e8e8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.px-skill-meta { flex: 0 0 auto; font-family: var(--font-mono, monospace); font-size: var(--text-sm, .78rem); font-weight: 700; color: var(--ink-bright, #fff); text-align: right; }.px-skill-meta small { display: block; font-weight: 400; color: var(--ink-faint, #666); font-size: var(--text-2xs, .6rem); }+/* Feed header — title + active filter bar on the same row */+.px-feed-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-md, 16px); }+.px-feed-header .px-section-h { margin-bottom: 0; }+.px-filter-bar { display: flex; align-items: center; gap: 8px; }+.px-filter-label { font-size: var(--text-2xs, .66rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #888); }+.px-filter-clear { appearance: none; background: none; border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-pill, 999px);+ padding: 3px 10px; font: inherit; font-size: var(--text-2xs, .66rem); font-weight: 500; color: var(--ink-dim, #888); cursor: pointer;+ transition: border-color .14s ease, color .14s ease; }+.px-filter-clear:hover { border-color: var(--stroke-strong, rgba(255,255,255,.18)); color: var(--ink-bright, #fff); }+.px-filter-clear:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }+/* Layout: feed + stats rail */.px-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-lg, 24px); align-items: start; }.px-main { min-width: 0; }diff --git a/src/pulse.js b/src/pulse.jsindex 0c2745bdc..1566e7e9e 100644--- a/src/pulse.js+++ b/src/pulse.js@@ -18,7 +18,7 @@ import { createLogger } from './shared/log.js';const log = createLogger('pulse');-const state = { network: 'mainnet', pulse: null };+const state = { network: 'mainnet', pulse: null, filter: 'all', lastUpdated: 0 };const $ = (id) => document.getElementById(id);@@ -50,6 +50,52 @@ function agentCardHTML(a, metricHTML) {);}+// Map of data-filter values → the feed type string the component understands.+const FILTER_TO_TYPE = { all: 'all', tips: 'tips', launches: 'launches', trades: 'trades', payments: 'payments', purchases: 'purchases' };+const FILTER_LABEL = { tips: 'Tips', launches: 'Launches', trades: 'Trades', payments: 'Payments', purchases: 'Marketplace' };++function setFeedFilter(filter) {+ const f = FILTER_TO_TYPE[filter] || 'all';+ state.filter = f;+ state.pulse?.setType(f);++ // Highlight the active counter; un-highlight all others.+ for (const el of document.querySelectorAll('[data-filter]')) {+ el.classList.toggle('px-counter--active', el.dataset.filter === f);+ }++ // Show / hide the filter bar.+ const bar = $('px-filter-bar');+ const label = $('px-filter-label');+ if (bar && label) {+ if (f === 'all') {+ bar.hidden = true;+ label.textContent = '';+ } else {+ label.textContent = `Showing: ${FILTER_LABEL[f] || f}`;+ bar.hidden = false;+ }+ }++ // Scroll the feed into view smoothly on filter change.+ if (f !== 'all') $('px-feed')?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });+}++// "Updated X ago" ticker — stamps time on each stats load, ticks every 15s.+function startUpdatedTick() {+ const el = $('px-updated');+ if (!el) return;+ function tick() {+ if (!state.lastUpdated) { el.textContent = ''; return; }+ const s = Math.round((Date.now() - state.lastUpdated) / 1000);+ if (s < 10) el.textContent = 'just now';+ else if (s < 60) el.textContent = `updated ${s}s ago`;+ else el.textContent = `updated ${Math.round(s / 60)}m ago`;+ }+ tick();+ setInterval(tick, 15_000);+}+async function loadStats() {const host = $('px-stats');try {@@ -57,6 +103,9 @@ async function loadStats() {if (!res.ok) throw new Error(`stats ${res.status}`);const { data } = await res.json();renderStats(data);+ state.lastUpdated = Date.now();+ const updEl = $('px-updated');+ if (updEl) updEl.textContent = 'just now';} catch (e) {log.warn('stats failed', e?.message);// The stats panel is supplementary — degrade quietly, never block the feed.@@ -365,6 +414,27 @@ function renderTrading(d) {pnlTag.classList.add('px-market-tag--off');}+ // One honest, plain-language readout of the week — what ran, what it cost, and+ // whether anything has closed yet. Sells carry no SOL out, so cost is over buys.+ const insight = $('px-trade-insight');+ if (insight) {+ if ((w7.trades || 0) > 0) {+ let line = `Agents ran ${fmtNum(w7.trades)} trade${w7.trades === 1 ? '' : 's'} this week, deploying ${fmtSol(w7.deployed_sol)} into buys (${fmtSol(w7.avg_trade_sol)} avg).`;+ line += pnl.closed_positions > 0+ ? ` ${pnl.closed_positions} position${pnl.closed_positions === 1 ? '' : 's'} closed for ${fmtSignedSol(pnl.net_sol)} realized — ${fmtPct(pnl.win_rate)} win rate.`+ : ` No positions have closed yet, so realized P&L is still pending.`;+ insight.textContent = line;+ insight.hidden = false;+ } else {+ insight.hidden = true;+ }+ }++ // Reveal the in-panel "show trades in feed" action only when there's something to+ // show. It carries data-filter="trades", so the shared counter wiring drives it.+ const filterBtn = $('px-trade-filter');+ if (filterBtn) filterBtn.hidden = !((w24.trades || 0) > 0 || (w7.trades || 0) > 0);+renderTradeSpark(d.series_7d);// Top traders — the wallets actually putting capital to work.@@ -436,12 +506,22 @@ function wireNetworkToggle() {}}+function wireCounterClicks() {+ for (const el of document.querySelectorAll('[data-filter]')) {+ el.addEventListener('click', () => setFeedFilter(el.dataset.filter));+ el.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setFeedFilter(el.dataset.filter); } });+ }+ $('px-filter-clear')?.addEventListener('click', () => setFeedFilter('all'));+}+function init() {wireNetworkToggle();+ wireCounterClicks();mountFeed();loadStats();loadTrading();loadMarketplace();+ startUpdatedTick();// Refresh stats on a slow cadence; the feed has its own live delta polling.setInterval(() => { if (!document.hidden) { loadStats(); loadTrading(); loadMarketplace(); } }, 60_000);}