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.

fix(oracle): say what the market did after the call in the share preview and stat tiles

nirholas54fbf2f40b68
diff --git a/api/oracle-share.js b/api/oracle-share.js
index bce4533cf..1b8fe8baf 100644
--- a/api/oracle-share.js
+++ b/api/oracle-share.js
@@ -83,6 +83,7 @@ export default wrap(async (req, res) => {
swCount: Number(row.smart_wallet_count || 0),
pedigree: Number(row.pedigree || 0), structure: Number(row.structure || 0),
narrative: Number(row.narrative || 0), momentum: Number(row.momentum || 0),
+ outcome: row,
}),
ogAlt: `${sym} Oracle conviction score ${score}`,
};
@@ -155,15 +156,30 @@ function redirect(res, to) {
res.end();
}
-function buildDesc({ sym, name, score, tier, cat, swCount, pedigree, structure, narrative, momentum }) {
+function buildDesc({ sym, name, score, tier, cat, swCount, pedigree, structure, narrative, momentum, outcome }) {
const parts = [`Oracle scored ${sym} ${score}/100 (${tier} conviction)`];
if (cat) parts.push(`category: ${cat}`);
if (swCount > 0) parts.push(`${swCount} proven wallet${swCount === 1 ? '' : 's'} in`);
parts.push(`Who ${pedigree} · How ${structure} · What ${narrative} · Move ${momentum}`);
+ // A resolved coin says so in its own share preview. Boasting a 100/prime into
+ // a group chat for a launch that has since collapsed is the same stale verdict
+ // the hero used to show, just travelling further.
+ const since = descSince(outcome);
+ if (since) parts.push(since);
parts.push('proof.not.promises — three.ws Oracle');
return parts.join(' · ');
}
+/** One clause for what the market did after the call, or '' while it is open. */
+function descSince(row) {
+ if (!row) return '';
+ const ath = row.ath_multiple != null ? Number(row.ath_multiple) : null;
+ const peak = Number.isFinite(ath) && ath > 0 ? `${ath.toFixed(1)}x` : null;
+ if (row.graduated === true) return peak ? `since: graduated, peaked ${peak}` : 'since: graduated';
+ if (row.rugged === true) return peak ? `since: ran ${peak}, then rugged` : 'since: rugged';
+ return peak ? `since: peaked ${peak}` : '';
+}
+
function shortMint(m) { return `${m.slice(0, 6)}…${m.slice(-4)}`; }
function esc(s) {
@@ -367,7 +383,7 @@ export function outcomeStripHtml(row) {
function fmtUsdShort(n) {
const v = Number(n);
- if (!Number.isFinite(v)) return '—';
+ if (!Number.isFinite(v)) return 'n/a';
if (v >= 1e9) return `$${(v / 1e9).toFixed(1)}B`;
if (v >= 1e6) return `$${(v / 1e6).toFixed(1)}M`;
if (v >= 1e3) return `$${(v / 1e3).toFixed(1)}K`;
diff --git a/pages/activity.html b/pages/activity.html
index c15876d0a..8eec8c66d 100644
--- a/pages/activity.html
+++ b/pages/activity.html
@@ -778,15 +778,15 @@
? 'Share of resolved Oracle calls that won. No call has resolved yet.'
: `Share of resolved Oracle calls (lean, strong, prime) that won.${bar != null ? ` Baseline across every scored coin: ${bar}%.` : ''}`;
const cells = [
- ['Agents armed', d.agents_armed != null ? d.agents_armed : '—', 'accent', 'Distinct 3D agents currently armed with Oracle conviction'],
- ['Scored 24h', d.scored_24h != null ? d.scored_24h : '—', '', 'pump.fun coins the Oracle scored in the last 24 hours'],
- ['Open', d.open_actions != null ? d.open_actions : '—', '', 'Agent positions still open (entered, not yet settled)'],
- ['Win rate', d.win_rate != null ? d.win_rate + '%' : '—', wrClass, wrTitle],
- ['Best ATH', d.best_ath != null ? d.best_ath.toFixed(1) + '×' : '—', d.best_ath != null ? 'up' : '', 'Highest peak multiple reached by any coin the Oracle called'],
- ['PnL (7d)', pnlKnown ? (pnl >= 0 ? '+' : '') + sol(pnl) : '—', pnlKnown ? (pnl >= 0 ? 'up' : 'dn') : '', pnlKnown ? 'Realized SOL across agent positions settled in the last 7 days' : 'No agent position has settled with a realized figure in the last 7 days'],
- ['Prime coins', d.prime_count != null ? d.prime_count : '—', d.prime_count > 0 ? 'accent' : '', 'Coins currently sitting at prime conviction tier'],
- ['Strong coins', d.strong_count != null ? d.strong_count : '—', '', 'Coins currently sitting at strong conviction tier'],
- ['All-time scored',d.scored_total != null ? d.scored_total.toLocaleString() : '—', '', 'Every coin the Oracle has ever scored'],
+ ['Agents armed', d.agents_armed != null ? d.agents_armed : 'n/a', 'accent', 'Distinct 3D agents currently armed with Oracle conviction'],
+ ['Scored 24h', d.scored_24h != null ? d.scored_24h : 'n/a', '', 'pump.fun coins the Oracle scored in the last 24 hours'],
+ ['Open', d.open_actions != null ? d.open_actions : 'n/a', '', 'Agent positions still open (entered, not yet settled)'],
+ ['Win rate', d.win_rate != null ? d.win_rate + '%' : 'n/a', wrClass, wrTitle],
+ ['Best ATH', d.best_ath != null ? d.best_ath.toFixed(1) + '×' : 'n/a', d.best_ath != null ? 'up' : '', 'Highest peak multiple reached by any coin the Oracle called'],
+ ['PnL (7d)', pnlKnown ? (pnl >= 0 ? '+' : '') + sol(pnl) : 'n/a', pnlKnown ? (pnl >= 0 ? 'up' : 'dn') : '', pnlKnown ? 'Realized SOL across agent positions settled in the last 7 days' : 'No agent position has settled with a realized figure in the last 7 days'],
+ ['Prime coins', d.prime_count != null ? d.prime_count : 'n/a', d.prime_count > 0 ? 'accent' : '', 'Coins currently sitting at prime conviction tier'],
+ ['Strong coins', d.strong_count != null ? d.strong_count : 'n/a', '', 'Coins currently sitting at strong conviction tier'],
+ ['All-time scored',d.scored_total != null ? d.scored_total.toLocaleString() : 'n/a', '', 'Every coin the Oracle has ever scored'],
];
kpis.innerHTML = cells.map(([l, v, cls, tip]) =>
`<div class="ac-kpi" title="${esc(tip)}"><div class="v ${cls}">${v}</div><div class="l">${l}</div></div>`).join('');
@@ -869,9 +869,15 @@
async function loadStats() {
try {
const r = await fetch(`${STATS_API}?network=mainnet`, { headers: { accept: 'application/json' } });
- if (!r.ok) return;
+ if (!r.ok) throw new Error('HTTP ' + r.status);
applyStats(await r.json());
- } catch { /* KPIs fall back to activity summary */ }
+ } catch {
+ // Leave the skeleton up only while a request is genuinely in flight.
+ // Without this the tiles shimmered forever on a stats outage, which
+ // reads as "still loading" rather than "not available". renderKpis
+ // prints the placeholder glyph for every value it does not have.
+ renderKpis();
+ }
}
// ── SSE — real-time updates ──────────────────────────────────────────
@@ -1029,10 +1035,11 @@
const sym = (m.symbol || m.mint.slice(0, 6)).toUpperCase();
const av = imgSrc(m.image_uri, m.mint);
const up = (m.delta || 0) >= 0;
- return `<a class="ac-li" href="/oracle/coin/${encodeURIComponent(m.mint)}">
+ const moveTitle = `Conviction moved ${m.first_score} to ${m.score} in the last 24h${m.tier_changed ? ', crossing a tier' : ''}`;
+ return `<a class="ac-li" href="/oracle/coin/${encodeURIComponent(m.mint)}" title="${esc(moveTitle)}">
<img class="ac-li-av" src="${esc(av)}" alt="" ${imgFallbackAttr} loading="lazy" />
<span class="ac-li-main"><span class="ac-li-name">$${esc(sym)}${m.tier_changed ? ' <span style="color:var(--ac-up);font-size:9px">▲ tier</span>' : ''}</span><span class="ac-li-sub">${esc(m.tier || '')} · score ${m.score ?? '—'}</span></span>
- <span class="ac-li-r"><span class="ac-delta ${up ? 'up' : 'dn'}">${up ? '+' : ''}${m.delta}</span><span class="small">${m.first_score}→${m.score}</span></span>
+ <span class="ac-li-r"><span class="ac-delta ${up ? 'up' : 'dn'}">${up ? '+' : ''}${m.delta}</span><span class="small">${m.first_score} → ${m.score}</span></span>
</a>`;
}).join('');
return items[0];
diff --git a/src/oracle.js b/src/oracle.js
index 6664dcce8..d1a7db5f8 100644
--- a/src/oracle.js
+++ b/src/oracle.js
@@ -802,9 +802,13 @@ const TAKE_LABEL = { pedigree: 'Who', structure: 'How', narrative: 'What', momen
* than to nothing.
*/
function reasonClause(r) {
- const subject = String(r.subject || String(r.text || '').split(':')[0] || '').trim();
+ const text = String(r.text || '');
+ const subject = String(r.subject || text.split(':')[0] || '').trim();
if (!subject) return '';
- const lift = Number(r.lift);
+ // A row cached before the engine emitted structured reasons still has both
+ // halves inside its sentence, so recover them rather than dropping the lift
+ // for as long as the old rows live.
+ const lift = Number.isFinite(Number(r.lift)) ? Number(r.lift) : Number(text.match(/\(([\d.]+)x base rate\)/)?.[1]);
if (!Number.isFinite(lift) || (lift > 0.85 && lift < 1.15)) return esc(subject);
return `${esc(subject)} <i>${lift}x base</i>`;
}
@@ -832,7 +836,9 @@ function oracleTake(it) {
if (flags.includes('pedigree-flag')) body += '. Creator has a rug history';
else if (flags.includes('structure-flag')) body += '. Structure throws a flag';
- const cat = it.category && it.category !== 'unknown' ? ` Riding a ${esc(it.category)} narrative.` : '';
+ const cat = it.category && it.category !== 'unknown'
+ ? ` Riding ${/^[aeiou]/i.test(it.category) ? 'an' : 'a'} ${esc(it.category)} narrative.`
+ : '';
return `<div class="coin-take"><span class="ct-q">“</span><span><b>${lead}</b>: ${body}.${cat}</span></div>`;
}
@@ -1475,7 +1481,7 @@ function renderEdge() {
<div class="edge-hero${beats ? '' : ' thin'}">
<p class="edge-hero-claim">Prime calls win <b class="win">${edge.prime_win_rate}%</b> of the time${beats ? `, vs <b>${edge.baseline_win_rate}%</b> for a coin picked at random` : ''}.</p>
<p class="edge-hero-sub">${beats
- ? `That's a <b style="color:var(--ink)">+${lift} point</b> lift over blind buying${mult ? ` — <b style="color:var(--ink)">${mult}×</b> the base rate` : ''}. ${ladderLine(edge)}`
+ ? `That's a <b style="color:var(--ink)">+${lift} point</b> lift over blind buying${mult ? `, <b style="color:var(--ink)">${mult}×</b> the base rate` : ''}. ${ladderLine(edge)}`
: `Conviction isn't beating the market over this window yet. We show it anyway — no cherry-picking.`}</p>
${spikeLine(edge)}
<div class="edge-hero-metrics">
@@ -1506,10 +1512,10 @@ function renderEdge() {
<div class="dr-sec edge-sec">Calibration — realized win rate by score band</div>
<div class="cal">
${cal.slice().reverse().map(calRow).join('')}
- <div class="cal-legend">
+ <div class="cal-legend">
<span><i class="li-real"></i>Realized win rate (bar fill)</span>
- <span><i class="li-pred"></i>What the band predicts (midpoint)</span>
- <span style="color:var(--faint)">A calibrated engine keeps the bar near the marker, climbing band over band.</span>
+ <span><i class="li-pred"></i>What the band claims, converted from the score</span>
+ <span style="color:var(--faint)">A score is a rank, not a percentage: 86 claims 55%. The marker is that converted claim, on the event the model was fitted to predict (a 3× run or a graduation), so the bar and the marker measure different things on purpose. "ran 3×" is the trained event's own realized rate.</span>
</div>
</div>` : '';
@@ -1566,7 +1572,7 @@ function calRow(c) {
<div class="cal-real" style="width:${hasData ? real : 0}%"></div>
<div class="cal-pred" style="left:${c.predicted}%"></div>
</div>
- <div class="cal-val">${hasData ? `${real}%` : '<span style="color:var(--faint)">—</span>'}<small>pred ${c.predicted}%</small></div>
+ <div class="cal-val">${hasData ? `${real}%` : '<span style="color:var(--faint)">—</span>'}<small>claims ${c.predicted}%${c.realized_spike != null ? ` · ran 3× ${c.realized_spike}%` : ''}</small></div>
</div>`;
}