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
fix(chart-companion): open the feed on the swaps that already happened, newest on top
nirholas0c9c11b1d8f7
diff --git a/docs/dextools.md b/docs/dextools.mdindex a74c21c08..6b814e2d8 100644--- a/docs/dextools.md+++ b/docs/dextools.md@@ -55,7 +55,7 @@ A small framable card that sends a token's community to its DEXTools pair page.```html<iframe src="https://three.ws/embed/dextools-boost?mint=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump"- width="380" height="400" style="border:0" loading="lazy"+ width="380" height="460" style="border:0" loading="lazy"title="Boost on DEXTools"></iframe>```diff --git a/pages/dextools.html b/pages/dextools.htmlindex fe9f462a2..a03110b36 100644--- a/pages/dextools.html+++ b/pages/dextools.html@@ -113,9 +113,10 @@.dx-tabs { display: flex; gap: 6px; margin: 16px 0 10px; flex-wrap: wrap; }.dx-msg { margin: 10px 0 0; font-size: 0.88rem; color: var(--ink-dim); min-height: 1.3em; }.dx-msg.is-error { color: var(--danger, #ef4444); }- .dx-code { position: relative; margin-top: 10px; }- .dx-code pre { margin: 0; padding: 14px; padding-right: 86px; background: var(--bg-0); border: 1px solid var(--stroke); border-radius: 10px; overflow-x: auto; font-size: 0.8rem; line-height: 1.55; color: var(--ink); white-space: pre; }- .dx-code .dx-btn { position: absolute; top: 8px; right: 8px; padding: 6px 10px; font-size: 0.8rem; }+ .dx-code { margin-top: 10px; border: 1px solid var(--stroke); border-radius: 10px; overflow: hidden; background: var(--bg-0); }+ .dx-code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--stroke); font-size: 0.78rem; color: var(--ink-dim); }+ .dx-code pre { margin: 0; padding: 14px; background: var(--bg-0); overflow-x: auto; font-size: 0.8rem; line-height: 1.55; color: var(--ink); white-space: pre; }+ .dx-code .dx-btn { padding: 5px 10px; font-size: 0.8rem; }.dx-preview { border: 1px dashed var(--stroke-strong, var(--stroke)); border-radius: var(--radius-lg, 14px); min-height: 420px; display: grid; place-items: center; overflow: hidden; background: var(--surface-1); }.dx-preview iframe { border: 0; max-width: 100%; display: block; }.dx-preview-empty { text-align: center; padding: 24px; color: var(--ink-dim); max-width: 34ch; line-height: 1.55; font-size: 0.92rem; }@@ -228,7 +229,7 @@<button type="button" class="dx-btn" data-kind="boost" aria-pressed="false">Boost card</button><button type="button" class="dx-btn" id="dx-theme" aria-pressed="false" title="Toggle the embed theme">Light theme</button></div>- <div class="dx-code"><pre id="dx-snippet"></pre><button type="button" class="dx-btn" id="dx-copy">Copy</button></div>+ <div class="dx-code"><div class="dx-code-head"><span>HTML</span><button type="button" class="dx-btn" id="dx-copy">Copy</button></div><pre id="dx-snippet"></pre></div><p class="dx-msg" id="dx-resolved"></p></div></div>diff --git a/src/chart-companion/chart-companion.css b/src/chart-companion/chart-companion.cssindex 3eff4d68d..35ba1edc4 100644--- a/src/chart-companion/chart-companion.css+++ b/src/chart-companion/chart-companion.css@@ -148,7 +148,8 @@ body[data-mode='overlay'] {}.cc-input:hover { border-color: var(--cc-accent); }.cc-input[aria-invalid='true'] { border-color: var(--cc-down); }-.cc-form-msg { flex-basis: 100%; margin: 0; min-height: 1em; font-size: 13px; color: var(--cc-down); }+.cc-form-msg { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--cc-down); }+.cc-form-msg:empty { display: none; }/* ── layout ─────────────────────────────────────────────────────────────── */diff --git a/src/chart-companion/main.js b/src/chart-companion/main.jsindex e80eacc4e..36201d262 100644--- a/src/chart-companion/main.js+++ b/src/chart-companion/main.js@@ -470,16 +470,17 @@ async function run() {const seen = new Set();let primed = false;+ // Feed order is newest on top: callers hand reactions oldest first.+ const list = (reactions) => {+ if (!feed || !reactions.length) return;+ $('#cc-feed-empty')?.remove();+ for (const r of reactions) feed.prepend(feedItem(r));+ while (feed.children.length > FEED_MAX) feed.lastElementChild.remove();+ };+ // A frame's reactions arrive highest priority first; the top one is performed.const post = (reactions) => {- for (const r of reactions) {- if (feed) {- $('#cc-feed-empty')?.remove();- feed.prepend(feedItem(r));- while (feed.children.length > FEED_MAX) feed.lastElementChild.remove();- }- }- const top = reactions[0];- if (top) performer.perform(top);+ list([...reactions].reverse());+ if (reactions[0]) performer.perform(reactions[0]);};try {@@ -505,9 +506,9 @@ async function run() {keep.forEach((s) => seen.add(s));}if (!primed) {- // The backlog sizes the tape; it does not get cheered.- reactor.prime(trades);+ // The backlog fills the stats and the feed; only the greeting is performed.primed = true;+ list(reactor.prime(trades));post([reactor.greeting()]);} else if (trades.length) {post(reactor.ingestTrades(trades));diff --git a/src/chart-companion/reactor.js b/src/chart-companion/reactor.jsindex 9fb2bd4fe..5f5cf6707 100644--- a/src/chart-companion/reactor.js+++ b/src/chart-companion/reactor.js@@ -235,15 +235,19 @@ export function createReactor({ symbol = '', now = () => Date.now() } = {}) {return react('quiet');}- /** Prime the size window with history without reacting to it. */+ /**+ * Take in the backlog a page sees on load. It counts toward the stats and+ * the size window like any swap, and its notable trades come back as+ * reactions stamped with their own trade time, oldest first, so the feed+ * opens on what already happened. The caller lists them; it does not+ * perform them, because cheering a swap from ten minutes ago is noise.+ */function prime(trades) {- for (const t of (Array.isArray(trades) ? trades : []).sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0))) {- sizes.push(Number(t.sol_value_usd) || 0);- if (sizes.length > WINDOW) sizes.shift();- const p = tradePrice(t);- if (p != null) stats.lastPrice = p;- }+ const out = ingestTrades(trades)+ .map((r) => (r.trade?.timestamp ? { ...r, at: r.trade.timestamp * 1000 } : r))+ .sort((a, b) => a.at - b.at);lastTradeAt = now();+ return out;}return { ingestCandles, ingestTrades, tick, prime, greeting, stats, get symbol() { return sym; } };diff --git a/src/dextools-boost-embed.js b/src/dextools-boost-embed.jsindex c1018398c..6307b4909 100644--- a/src/dextools-boost-embed.js+++ b/src/dextools-boost-embed.js@@ -86,7 +86,8 @@ async function tokenMeta(mint) {const p = pairs[0];return {name: p.baseToken.name || null,- symbol: p.baseToken.symbol || null,+ // Tickers read in capitals everywhere else on three.ws ($THREE), whatever case the mint carries.+ symbol: p.baseToken.symbol ? p.baseToken.symbol.toUpperCase() : null,image: p.info?.imageUrl || null,priceUsd: Number(p.priceUsd),change24: Number(p.priceChange?.h24),diff --git a/src/dextools-hub.js b/src/dextools-hub.jsindex bea801c77..c7e7c15bd 100644--- a/src/dextools-hub.js+++ b/src/dextools-hub.js@@ -238,7 +238,7 @@ function renderBuilder() {frame.src = scene ? local.scene : local.boost;frame.title = scene ? 'Preview: token in 3D' : 'Preview: Boost on DEXTools card';frame.width = scene ? '420' : '380';- frame.height = scene ? '560' : '400';+ frame.height = scene ? '560' : '460';frame.loading = 'lazy';$('dx-preview').replaceChildren(frame);$('dx-out').hidden = false;diff --git a/src/dextools-input.js b/src/dextools-input.jsindex b6216094a..17b1f3afb 100644--- a/src/dextools-input.js+++ b/src/dextools-input.js@@ -98,6 +98,6 @@ export function embedSnippets({ mint, pair = null, theme = 'dark', origin = 'httscene,boost,sceneHtml: `<iframe src="${amp(scene)}"\n width="420" height="560" style="border:0" loading="lazy"\n title="Token in 3D by three.ws"></iframe>`,- boostHtml: `<iframe src="${amp(boost)}"\n width="380" height="400" style="border:0" loading="lazy"\n title="Boost on DEXTools"></iframe>`,+ boostHtml: `<iframe src="${amp(boost)}"\n width="380" height="460" style="border:0" loading="lazy"\n title="Boost on DEXTools"></iframe>`,};}diff --git a/tests/chart-companion-reactor.test.js b/tests/chart-companion-reactor.test.jsindex e92d2957e..75330d67a 100644--- a/tests/chart-companion-reactor.test.js+++ b/tests/chart-companion-reactor.test.js@@ -130,6 +130,17 @@ describe('streaks and highs', () => {});describe('stats, greeting and quiet', () => {+ it('counts the load backlog and returns its notable swaps oldest first, at their own trade time', () => {+ const r = createReactor();+ const old = { ...trade(5000), timestamp: 1_800_000_100 };+ const older = { ...trade(400, false), timestamp: 1_800_000_050 };+ const out = r.prime([old, older, trade(5)]);+ expect(out.map((x) => x.kind)).toEqual(['bigSell', 'whaleBuy']);+ expect(out[0].at).toBe(1_800_000_050_000);+ expect(r.stats.buys).toBe(2);+ expect(r.stats.sells).toBe(1);+ });+it('tallies the session', () => {const r = createReactor();r.ingestTrades([trade(100), trade(50, false), trade(900)]);