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: enhance oracle handling and introduce 3D agent visualization
zprvd711ed9e49cd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 32f087a42..168f6cc7f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,12 +27,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Live Avatar Forge: build a 3D avatar on camera** — On an agent's live screen you can now type a prompt and watch a 3D avatar get generated, rigged, and animated in real time — free. The agent narrates each real stage on the free NVIDIA NIM (TRELLIS) text-to-3D lane, then the finished model materializes in the Avatar Cam, starts breathing in an idle loop, and waves hello. Open it in the 3D viewer or grab the model URL to set as your agent's look. Fresh forges also surface on the live agents wall. (`/agent-screen`) `[feature]`- **Live portfolio scoreboard: net worth, 24h P&L, and a sparkline on every agent screen** — Watching an agent is now watching the score. The live agent screen carries a new Portfolio HUD — net worth in SOL and USD, a 24h change that ticks green or red, and a sparkline drawn from real value history — with the ranked holdings below it and $THREE pinned and featured at the top. On the live wall, each card gains a compact 24h change badge in its corner, so you can see at a glance which agents are winning. Every number is real on-chain valuation: holdings are valued live, owners get pushed updates between polls, and a wallet with no history yet shows an honest empty state instead of a fake curve. (`/agent-screen`) `[feature]`- **Live Trading Desk: watch an agent trade with a real-time PnL ticker** — An agent's live screen now reads like a trading desk. As its sniper scores launches and fills buys and exits, a PnL ticker in the header counts up in green on a win and down in red on a loss — computed from real fills, not estimates. Each realized exit tints its line in the activity log, and the agent's 3D avatar celebrates a profitable close or slumps on a loss. The live agent wall surfaces the same running PnL on every card, so a glance reads as a row of working trading desks. Click the ticker for a win/loss and realized breakdown. (`/agents-live`) `[feature]`+- **Meet the agent behind each coin in interactive 3D** — Every coin page now shows the launching agent as a live, interactive 3D avatar right on the page — drag to orbit, scroll to zoom — instead of a flat thumbnail. Agents with their own model show it; the rest wear the shared base avatar so the stage is never empty. A "See in world" link drops that avatar straight into the walkable $THREE world. The 3D view only loads once it scrolls into view, so pages stay fast, and it falls back gracefully if a model can't load. (`/launches`) `[feature]`- **Multi-agent collaboration — watch a team take on one goal** — Give a lead agent a goal and watch a full team assemble to tackle it. The lead decomposes the goal, delegates sub-tasks to teammates, and hires paid agents over real x402 — every handoff stamped with an on-chain receipt and an explorer link. A live dependency graph on /agents-live and /agent-screen shows each node pulse from queued to running to done, with cost badges and real signatures as they settle. One goal, real payments, verifiable provenance. (`/agents-live`) `[feature]`- **New dashboard: total agent-to-agent economy volume** — There's now a live dashboard for the whole agent-to-agent economy: the total real USDC that agents have paid each other for hiring paid skills over x402. The headline is the all-time settled volume, alongside 7-day volume, average hire value, and how many agents are earning vs. paying. A 90-day volume chart (switchable to 7d/30d) shows the trend, two leaderboards rank the top-earning and top-spending agents, and a live feed lists the latest settlements — each one linking straight to its on-chain proof on Solscan. Every number is read from the real hire ledger; nothing is simulated. (`/agent-economy-volume`) `[feature]`- **Newsroom Anchor: agents read the market to you, live and on air** — Open an agent's screen and it becomes a live market-news anchor. Every ~90 seconds it pulls real intel — narrative momentum, sentiment, and flow — scripts a tight bulletin, and reads it aloud in a real synthesized voice while its 3D avatar lip-syncs to the words. The headline slides up as a broadcast lower-third, and the live wall shows what each anchor is reporting with a red ON AIR ticker. Audio is muted by default with one-tap unmute (press A); if a feed is down the anchor reports only what's live instead of going silent, and a rig without face morphs still talks via a jaw-bob driven by the real audio. (`/agent-screen`) `[feature]`+- **Oracle no longer mistakes stablecoins for coins** — The Oracle's feeds, movers, search, and wins gallery now ignore stablecoins and SOL-type tokens (USDC, USDT, wrapped/staked SOL, and similar). These show up as the other side of every trade but were never launched coins, so one was slipping into the rankings as a junk entry with an absurd multiple. They're now filtered out the moment data is ingested, hidden everywhere they're read, and any that were already cached are cleaned up automatically. (`/oracle`) `[fix]`- **Portfolio dashboard loads your agent balances again** — The portfolio page now shows your agents' live balances and value-over-time chart instead of failing to load. The endpoints that feed the page — your aggregated holdings, the 90-day history chart, and the per-token drill-down — had no server route wired up, so every request came back empty and the page sat blank. The routes are now in place, so your wallets, totals, history, and individual token views all populate as they should. (`/dashboard/portfolio`) `[fix]`- **Posting a labor-market bounty no longer hits a surprise rate limit** — Posting a bounty on the agent labor market used to share one rate-limit budget with the MCP agent tools, so heavy use of one could spuriously throttle the other and pop a confusing 'rate limit exceeded' with no guidance. Each surface now has its own budget, and if you do post too fast the message tells you exactly how many seconds to wait before trying again. (`/labor-market`) `[fix]`- **Sentiment Heatmap: a live 3D market field your agent reads aloud** — Open an agent's screen and arm the new Sentiment Heatmap panel: a glowing 3D field of tokens that pulses with the market, $THREE pinned at the centre and labelled. Each token is a pillar — colour is its 24h momentum (cold blue → slate → green-hot), height is its 24h volume, and the strongest movers blaze with bloom while the camera drifts slowly around the field. The data is live: trending market data from Dexscreener and pump.fun, with $THREE enriched by a real pump.fun-comment sentiment pulse. As tokens spike, the agent calls the moment in its activity log — "Heating across the board, $THREE up on rising volume" — narrated by the brain and throttled so it never floods. Hover any tile for momentum and volume, hit the ◎ $THREE button to recentre on the anchor, and when the agent's screen is otherwise idle the heatmap casts to the live wall so the card is never blank. Press H to toggle it. (`/agent-screen`) `[feature]`+- **Smart-Money wallet reputation stays fresh again** — The job that scores every wallet's realized track record and detects sybil/insider clusters was quietly timing out on large datasets, leaving the Smart-Money graph that powers the launch firewall, the sniper, and the public Smart-Money page increasingly stale. It now writes thousands of wallet scores in a handful of bulk operations instead of one row at a time, so it finishes in seconds and the reputation data behind every "who's in" breakdown stays current. Coin cards also stop re-requesting Oracle conviction for coins the data brain hasn't observed yet, so pages stay lighter. (`/smart-money`) `[fix, infra]`- **Solana Metaplex agents now appear in the on-chain deployments feed** — The on-chain Deployments feed is no longer EVM-only. Every Solana agent minted as a Metaplex Core asset — both the ones three.ws launches into its own Agents collection and external agents in the Metaplex Agent Registry — now lands in the same live stream alongside ERC-8004 registrations, the moment each mint confirms. Solana shows up as its own chain in the feed, the top-chains panel, and the 24h/7d counters, with rows linking straight to Solscan. The mainnet/testnet toggle maps to Solana mainnet-beta and devnet. (`/deployments`) `[feature]`- **Talk to any live agent — it answers out loud and remembers the conversation** — Type a question into the bar on any agent's screen and it answers you live — in its own persona and voice. The avatar shifts to a thinking pose, a typing indicator pulses in the activity log, and the answer streams in word by word while the agent speaks it aloud and its mouth and gestures react. Ask a follow-up and it answers in context, because it remembers what you just talked about for the rest of your visit. Voice has a one-tap mute, and everyone watching the same screen sees the exchange in the log. Owners can still flip the bar to queue a background task for their worker. (`/agent-screen`) `[feature]`- **Team Task: watch a crew of agents take on one goal** — Give a lead agent a goal and watch the team assemble. On the live wall (“Run a Team Task”) or from any agent’s task bar (flip the new “Team” toggle), the lead splits the work into sub-tasks and renders them as a living dependency graph: nodes pulse while they run, edges flow on each handoff. Free sub-tasks are delegated as real reasoning turns; paid ones hire a teammate agent over real x402 — each hire shows its USD cost, settles from the lead’s wallet under its own spend policy, and drops an on-chain receipt chip you can open in the explorer. Total spend is hard-capped and split across hires, one failed teammate never aborts the run, and every state — planning, running, done, and budget-blocked — is designed. (`/agents-live`) `[feature]`diff --git a/api/_lib/oracle/sources.js b/api/_lib/oracle/sources.jsindex ae348e315..1ef762a12 100644--- a/api/_lib/oracle/sources.js+++ b/api/_lib/oracle/sources.js@@ -226,7 +226,7 @@ export async function recentMints({ network = 'mainnet', limit = 100, sinceSeconselect mint from pump_coin_intelwhere network = ${network}and first_seen_at > now() - (${sinceSeconds} || ' seconds')::interval- and mint <> all(${QUOTE_MINT_LIST})+ and mint <> all(${QUOTE_MINT_LIST}::text[])order by first_seen_at desclimit ${Math.min(500, Math.max(1, limit))}`);diff --git a/api/_lib/oracle/store.js b/api/_lib/oracle/store.jsindex 26524b44b..3f47c8141 100644--- a/api/_lib/oracle/store.js+++ b/api/_lib/oracle/store.js@@ -122,16 +122,29 @@ export async function scoreCoin(mint, { network = 'mainnet', classify = true, peexport async function readFeed({ network = 'mainnet', limit = 50, minScore = 0, tier = null, category = null, sinceSeconds = 12 * 3600 } = {}) {const lim = Math.min(200, Math.max(1, Number(limit) || 50));const rows = await sql`- select mint, symbol, name, image_uri, score, tier, pedigree, structure, narrative, momentum,- badges, category, smart_wallet_count, scored_at, coin_first_seen_at- from oracle_conviction- where network = ${network}- and score >= ${Number(minScore) || 0}- and (${tier}::text is null or tier = ${tier})- and (${category}::text is null or category = ${category})- and mint <> all(${QUOTE_MINT_LIST})- and scored_at > now() - (${sinceSeconds} || ' seconds')::interval- order by score desc, scored_at desc+ select c.mint, c.symbol, c.name, c.image_uri, c.score, c.tier,+ c.pedigree, c.structure, c.narrative, c.momentum,+ c.badges, c.category, c.smart_wallet_count, c.scored_at, c.coin_first_seen_at,+ hist.spark+ from oracle_conviction c+ left join lateral (+ select array_agg(h.score order by h.scored_at)::int[] as spark+ from (+ select score, scored_at+ from oracle_conviction_history+ where mint = c.mint and network = c.network+ and scored_at > now() - interval '24 hours'+ order by scored_at desc+ limit 16+ ) h+ ) hist on true+ where c.network = ${network}+ and c.score >= ${Number(minScore) || 0}+ and (${tier}::text is null or c.tier = ${tier})+ and (${category}::text is null or c.category = ${category})+ and c.mint <> all(${QUOTE_MINT_LIST}::text[])+ and c.scored_at > now() - (${sinceSeconds} || ' seconds')::interval+ order by c.score desc, c.scored_at desclimit ${lim}`;return rows.map(rowToFeedItem);@@ -144,7 +157,7 @@ export async function feedSince({ network = 'mainnet', sinceIso, limit = 40 } =badges, category, smart_wallet_count, scored_at, coin_first_seen_atfrom oracle_convictionwhere network = ${network} and scored_at > ${sinceIso}::timestamptz- and mint <> all(${QUOTE_MINT_LIST})+ and mint <> all(${QUOTE_MINT_LIST}::text[])order by scored_at asclimit ${Math.min(100, Math.max(1, limit))}`;@@ -152,6 +165,10 @@ export async function feedSince({ network = 'mainnet', sinceIso, limit = 40 } =}function rowToFeedItem(r) {+ // Compact conviction trajectory for the inline card sparkline: the recorded+ // history points (24h, ≤16) with the live score guaranteed as the final point.+ let spark = Array.isArray(r.spark) ? r.spark.map(Number).filter(Number.isFinite) : [];+ if (r.score != null && (spark.length === 0 || spark[spark.length - 1] !== r.score)) spark.push(r.score);return {mint: r.mint, symbol: r.symbol, name: r.name, image_uri: r.image_uri,score: r.score, tier: r.tier,@@ -161,6 +178,7 @@ function rowToFeedItem(r) {smart_wallet_count: r.smart_wallet_count,scored_at: r.scored_at,coin_first_seen_at: r.coin_first_seen_at,+ spark: spark.length >= 2 ? spark : null,};}@@ -341,12 +359,12 @@ export async function purgeOldHistory(network = 'mainnet') {export async function purgeQuoteMints(network = 'mainnet') {const deleted = await sql`delete from oracle_conviction- where network = ${network} and mint = any(${QUOTE_MINT_LIST})+ where network = ${network} and mint = any(${QUOTE_MINT_LIST}::text[])returning mint`.then((r) => r.length).catch(() => 0);await Promise.all([- sql`delete from oracle_conviction_history where network = ${network} and mint = any(${QUOTE_MINT_LIST})`.catch(() => {}),- sql`delete from oracle_narrative where network = ${network} and mint = any(${QUOTE_MINT_LIST})`.catch(() => {}),+ sql`delete from oracle_conviction_history where network = ${network} and mint = any(${QUOTE_MINT_LIST}::text[])`.catch(() => {}),+ sql`delete from oracle_narrative where network = ${network} and mint = any(${QUOTE_MINT_LIST}::text[])`.catch(() => {}),]);return deleted;}diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex 75d6492e5..b43d243d7 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -2,7 +2,7 @@import { Ratelimit } from '@upstash/ratelimit';import { env } from './env.js';-import { getRedis } from './redis.js';+import { getRedis, isRedisAuthError } from './redis.js';const redis = getRedis();@@ -123,6 +123,13 @@ function warnDegradedOnce(name, err) {// rejections carry `circuitOpen`. Re-warning per limiter per cooldown on top of// that is pure noise — skip it and let the breaker own the signal.if (err?.circuitOpen) return;+ // @upstash/ratelimit catches the underlying Redis rejection and re-throws its+ // own UpstashError, dropping the `circuitOpen` tag — so an auth failure reaching+ // here on the breaker's once-per-cooldown trial command would still log, once per+ // limiter name. Across dozens of limiter names that recreates the WRONGPASS flood+ // the breaker exists to silence. The breaker already owns the single auth-failure+ // line and the rotate-the-token remediation, so suppress auth errors here too.+ if (isRedisAuthError(err)) return;const last = _degradeWarnedAt.get(name) || 0;const t = Date.now();if (t - last < DEGRADE_WARN_COOLDOWN_MS) return;diff --git a/api/_lib/redis.js b/api/_lib/redis.jsindex ab3992aa2..407d224b4 100644--- a/api/_lib/redis.js+++ b/api/_lib/redis.js@@ -54,10 +54,16 @@ let authTrialInFlight = false;// Auth/permission failures are permanent until the credential changes; only these// trip the breaker. Upstash surfaces them in the error message body it returns.+// Exported (as isRedisAuthError) so per-consumer fallbacks can recognize the same+// auth failure even when an intermediary library (e.g. @upstash/ratelimit) wraps+// the underlying rejection and strips our `circuitOpen` tag — those consumers+// defer the one auth log line to this module's breaker instead of re-logging it+// per limiter on every cooldown trial.function isAuthError(err) {const m = String(err?.message || err || '');return /WRONGPASS|NOAUTH|NOPERM|invalid or missing auth token|\b401\b|\b403\b/i.test(m);}+export { isAuthError as isRedisAuthError };// Thrown when the breaker is open. Tagged `circuitOpen` so consumers treat it as a// normal "Redis unavailable" fallback WITHOUT emitting a per-request warning (thediff --git a/api/oracle/backtest.js b/api/oracle/backtest.jsindex 2ebd3550d..a60eddc79 100644--- a/api/oracle/backtest.js+++ b/api/oracle/backtest.js@@ -32,6 +32,29 @@ const _cache = new Map(); // key → { data, at }function cacheKey(period, tier, network) { return `${period}:${tier}:${network}`; }+/**+ * Wilson score interval — the honest 95% confidence band for a win rate. Unlike+ * the naive ±√(p(1-p)/n), it stays inside [0,1] and is well-behaved at small n,+ * which is exactly the regime a young backtest lives in. Returned as integer+ * percentages so the UI can render "68% (54–80)" without further math.+ *+ * @param {number} wins+ * @param {number} n resolved sample (wins + losses)+ * @param {number} z z-score (1.96 ≈ 95%)+ * @returns {{lo:number, hi:number, width:number}|null}+ */+export function wilson(wins, n, z = 1.96) {+ if (!n || n <= 0) return null;+ const p = wins / n;+ const z2 = z * z;+ const denom = 1 + z2 / n;+ const centre = (p + z2 / (2 * n)) / denom;+ const margin = (z * Math.sqrt((p * (1 - p) + z2 / (4 * n)) / n)) / denom;+ const lo = Math.max(0, Math.round((centre - margin) * 100));+ const hi = Math.min(100, Math.round((centre + margin) * 100));+ return { lo, hi, width: hi - lo };+}+async function query(days, tier, network) {const key = cacheKey(days, tier, network);const hit = _cache.get(key);@@ -79,6 +102,83 @@ async function query(days, tier, network) {}const resolved = agg.wins + agg.losses;agg.win_rate = resolved ? Math.round((agg.wins / resolved) * 100) : null;+ agg.ci = wilson(agg.wins, resolved);++ // ── score-band calibration + Brier score ───────────────────────────────────+ // The conviction score claims to rank coins by win probability. Calibration is+ // the proof: bucket every resolved coin by its score band and measure the+ // REALIZED win rate per band. A trustworthy engine produces a monotonic ladder+ // (higher band → higher realized rate) that tracks the band's own prediction.+ // Brier = mean squared error of score/100 (treated as a probability) vs the+ // 0/1 outcome — one number for "how well-calibrated overall" (lower is better).+ // This pass is unconditional on tier so the baseline is the true market rate.+ const calRows = await sql`+ select+ width_bucket(c.score, 0, 100, 10) as bucket,+ count(*)::int as n,+ count(*) filter (where o.graduated or o.ath_multiple >= 2)::int as wins,+ round(avg(c.score)::numeric, 1) as avg_score+ from oracle_conviction c+ join pump_coin_outcomes o on o.mint = c.mint+ where c.network = ${network}+ and (o.graduated or o.rugged or o.ath_multiple is not null)+ ${periodFilter}+ group by 1+ order by 1+ `.catch(() => []);++ const calibration = calRows+ .filter((r) => r.bucket >= 1 && r.bucket <= 10)+ .map((r) => {+ const lo = (r.bucket - 1) * 10;+ const hi = r.bucket * 10;+ const realized = r.n ? Math.round((r.wins / r.n) * 100) : null;+ return {+ band: `${lo}–${hi}`,+ lo, hi,+ n: r.n,+ wins: r.wins,+ avg_score: r.avg_score != null ? Number(r.avg_score) : (lo + hi) / 2,+ predicted: Math.round((lo + hi) / 2), // band midpoint as a % prediction+ realized, // realized win rate in the band+ ci: wilson(r.wins, r.n),+ };+ });++ // Market baseline: a coin drawn at random from everything Oracle scored.+ const baseRow = await sql`+ select+ count(*)::int as n,+ count(*) filter (where o.graduated or o.ath_multiple >= 2)::int as wins,+ round(avg(power((c.score / 100.0) - (case when o.graduated or o.ath_multiple >= 2 then 1 else 0 end), 2))::numeric, 4) as brier+ from oracle_conviction c+ join pump_coin_outcomes o on o.mint = c.mint+ where c.network = ${network}+ and (o.graduated or o.rugged or o.ath_multiple is not null)+ ${periodFilter}+ `.then((r) => r[0] || {}).catch(() => ({}));++ const baselineN = Number(baseRow.n) || 0;+ const baselineWinRate = baselineN ? Math.round((Number(baseRow.wins) / baselineN) * 100) : null;+ const brier = baseRow.brier != null ? Number(baseRow.brier) : null;++ // Edge summary: does conviction actually beat blind buying, and does the ladder+ // climb in the right order?+ const primeRow = rows.find((r) => r.tier === 'prime');+ const primeResolved = primeRow ? primeRow.wins + primeRow.losses : 0;+ const primeWinRate = primeResolved ? Math.round((primeRow.wins / primeResolved) * 100) : null;+ const orderedRealized = calibration.map((c) => c.realized).filter((v) => v != null);+ const monotonic = orderedRealized.length >= 2+ && orderedRealized.every((v, i) => i === 0 || v >= orderedRealized[i - 1] - 5); // ≤5pt tolerance+ const edge = {+ baseline_win_rate: baselineWinRate,+ baseline_n: baselineN,+ prime_win_rate: primeWinRate,+ prime_lift: (primeWinRate != null && baselineWinRate != null) ? primeWinRate - baselineWinRate : null,+ edge_multiple: (primeWinRate != null && baselineWinRate) ? Number((primeWinRate / baselineWinRate).toFixed(2)) : null,+ monotonic,+ brier,+ };// ── top performers in the period ─────────────────────────────────────────const topFilter = days != null ? sql`and c.scored_at >= now() - (${days} || ' days')::interval` : sql``;@@ -105,6 +205,7 @@ async function query(days, tier, network) {wins: r.wins,losses: r.losses,win_rate: (r.wins + r.losses) > 0 ? Math.round((r.wins / (r.wins + r.losses)) * 100) : null,+ ci: wilson(r.wins, r.wins + r.losses),avg_ath: r.avg_ath ? Number(r.avg_ath) : null,median_ath: r.median_ath ? Number(r.median_ath) : null,three_x: r.three_x,@@ -114,6 +215,8 @@ async function query(days, tier, network) {rugged: r.rugged,})),aggregate: agg,+ calibration,+ edge,top_performers: top.map((r) => ({mint: r.mint,symbol: r.symbol,diff --git a/api/oracle/movers.js b/api/oracle/movers.jsindex 9a72108da..7f43d9a92 100644--- a/api/oracle/movers.js+++ b/api/oracle/movers.js@@ -84,7 +84,7 @@ export default wrap(async (req, res) => {from deduped djoin oracle_conviction c on c.mint = d.mint and c.network = d.networkwhere abs(c.score - d.first_score) >= ${minDelta}- and c.mint <> all(${QUOTE_MINT_LIST})+ and c.mint <> all(${QUOTE_MINT_LIST}::text[])and (${direction}::text = 'all'or (${direction}::text = 'rising' and c.score > d.first_score)diff --git a/api/oracle/search.js b/api/oracle/search.jsindex 8880e3fee..5b6be6841 100644--- a/api/oracle/search.js+++ b/api/oracle/search.js@@ -39,7 +39,7 @@ export default wrap(async (req, res) => {from oracle_convictionwhere network = ${network}and (symbol ilike ${pattern} or name ilike ${pattern})- and mint <> all(${QUOTE_MINT_LIST})+ and mint <> all(${QUOTE_MINT_LIST}::text[])order by score desc nulls lastlimit ${limit}`;diff --git a/api/oracle/wins.js b/api/oracle/wins.jsindex 72431e221..398286228 100644--- a/api/oracle/wins.js+++ b/api/oracle/wins.js@@ -86,7 +86,7 @@ export default wrap(async (req, res) => {where c.network = ${network}and o.ath_multiple >= ${minAth}and (o.graduated or o.ath_multiple >= 2)- and c.mint <> all(${QUOTE_MINT_LIST})+ and c.mint <> all(${QUOTE_MINT_LIST}::text[])${tierFilter}${periodFilter}${beforeFilter}@@ -109,7 +109,7 @@ export default wrap(async (req, res) => {where c.network = ${network}and o.ath_multiple >= ${minAth}and (o.graduated or o.ath_multiple >= 2)- and c.mint <> all(${QUOTE_MINT_LIST})+ and c.mint <> all(${QUOTE_MINT_LIST}::text[])${tierFilter}${periodFilter}`.catch(() => [{}]);diff --git a/data/changelog.json b/data/changelog.jsonindex bd9068632..bb969aa3c 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,34 @@{"$comment": "Curated changelog entries for three.ws \u2014 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-06-29",+ "title": "Smart-Money wallet reputation stays fresh again",+ "summary": "The job that scores every wallet's realized track record and detects sybil/insider clusters was quietly timing out on large datasets, leaving the Smart-Money graph that powers the launch firewall, the sniper, and the public Smart-Money page increasingly stale. It now writes thousands of wallet scores in a handful of bulk operations instead of one row at a time, so it finishes in seconds and the reputation data behind every \"who's in\" breakdown stays current. Coin cards also stop re-requesting Oracle conviction for coins the data brain hasn't observed yet, so pages stay lighter.",+ "tags": [+ "fix",+ "infra"+ ],+ "link": "/smart-money"+ },+ {+ "date": "2026-06-29",+ "title": "Meet the agent behind each coin in interactive 3D",+ "summary": "Every coin page now shows the launching agent as a live, interactive 3D avatar right on the page — drag to orbit, scroll to zoom — instead of a flat thumbnail. Agents with their own model show it; the rest wear the shared base avatar so the stage is never empty. A \"See in world\" link drops that avatar straight into the walkable $THREE world. The 3D view only loads once it scrolls into view, so pages stay fast, and it falls back gracefully if a model can't load.",+ "tags": [+ "feature"+ ],+ "link": "/launches"+ },+ {+ "date": "2026-06-29",+ "title": "Oracle no longer mistakes stablecoins for coins",+ "summary": "The Oracle's feeds, movers, search, and wins gallery now ignore stablecoins and SOL-type tokens (USDC, USDT, wrapped/staked SOL, and similar). These show up as the other side of every trade but were never launched coins, so one was slipping into the rankings as a junk entry with an absurd multiple. They're now filtered out the moment data is ingested, hidden everywhere they're read, and any that were already cached are cleaned up automatically.",+ "tags": [+ "fix"+ ],+ "link": "/oracle"+ },{"date": "2026-06-29","title": "Autonomous launcher is live, and each launch now opens with a dev buy",diff --git a/pages/oracle.html b/pages/oracle.htmlindex 6c20989b8..01a01eb89 100644--- a/pages/oracle.html+++ b/pages/oracle.html@@ -154,6 +154,12 @@.t-lean b { color: var(--gold); }.t-watch b { color: var(--muted); }.t-avoid b { color: var(--down); }+ .coin-spark { display: block; margin-top: 5px; line-height: 0; }+ .coin-spark svg { display: inline-block; overflow: visible; }+ /* Oracle's take — one-line synthesized verdict */+ .coin-take { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.4; color: var(--ink); margin: 2px 0 2px; padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,0.035); border: 1px solid var(--line); }+ .coin-take .ct-q { font: 800 13px/1 var(--mono); color: var(--faint); flex-shrink: 0; margin-top: 1px; }+ .coin-take b { color: var(--ink); font-weight: 700; }.tierpill { display: inline-block; font: 700 9.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 4px 7px; border-radius: 6px; margin-top: 4px; }.tp-prime, .tp-strong { background: color-mix(in srgb, var(--up) 18%, transparent); color: var(--up); }.tp-lean { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }@@ -248,6 +254,37 @@.edge-top-row { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); transition: border-color .14s; }.edge-top-row:hover { border-color: var(--stroke-strong, var(--cyan)); }.edge-ath { margin-left: auto; font: 700 13px/1 var(--mono); color: var(--up); }+ /* edge verdict hero — the headline proof */+ .edge-hero { background: linear-gradient(135deg, color-mix(in srgb, var(--up) 8%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--up) 22%, var(--line)); border-radius: var(--r); padding: 22px 22px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }+ .edge-hero.thin { background: var(--panel); border-color: var(--line); }+ .edge-hero-claim { font-size: clamp(18px, 3.2vw, 26px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.16; margin: 0; }+ .edge-hero-claim b.win { background: linear-gradient(100deg, var(--up), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }+ .edge-hero-sub { color: var(--muted); font-size: 13px; margin: 9px 0 0; max-width: 640px; }+ .edge-hero-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }+ .edge-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); font: 600 12px/1 var(--mono); }+ .edge-chip b { font-size: 14px; font-weight: 800; color: var(--ink); } .edge-chip b.up { color: var(--up); }+ .edge-chip span { color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }+ .edge-chip.ok { border-color: color-mix(in srgb, var(--up) 38%, var(--line)); }+ /* CI sublabel under a win-rate */+ .ci { display: block; font: 600 10px/1.2 var(--mono); color: var(--faint); margin-top: 3px; letter-spacing: .02em; }+ .erow.thin b, .erow.thin .ci { opacity: .5; }+ /* calibration ladder — realized win rate by score band */+ .cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }+ .cal-row { display: grid; grid-template-columns: 76px 1fr 116px; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }+ .cal-row:last-child { border-bottom: none; }+ .cal-row.empty { opacity: .4; }+ .cal-band { font: 700 12px/1 var(--mono); color: var(--ink); } .cal-band small { display: block; color: var(--faint); font-weight: 600; font-size: 9.5px; margin-top: 3px; }+ .cal-track { position: relative; height: 14px; border-radius: 7px; background: rgba(255,255,255,0.05); overflow: hidden; }+ .cal-real { position: absolute; inset: 0 auto 0 0; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--down), var(--up)); transition: width .5s cubic-bezier(.2,.7,.2,1); }+ .cal-pred { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .85; }+ .cal-pred::after { content: ''; position: absolute; top: -3px; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }+ .cal-val { text-align: right; font: 700 13px/1.25 var(--mono); }+ .cal-val small { display: block; font-weight: 600; font-size: 10px; color: var(--faint); }+ .cal-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); font: 600 11px/1 var(--mono); color: var(--muted); }+ .cal-legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }+ .cal-legend .li-real { width: 14px; height: 8px; border-radius: 3px; background: linear-gradient(90deg, var(--down), var(--up)); }+ .cal-legend .li-pred { width: 2px; height: 11px; background: var(--ink); }+ .dr-sec.edge-sec { font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 22px 0 10px; }/* agent panel */.apanel { display: grid; grid-template-columns: 1fr 1.8fr; gap: 16px; align-items: start; }@@ -677,8 +714,8 @@</section><section class="view" id="view-edge">- <p class="intro">Proof, not promises. Every conviction verdict is checked against ground truth — did the coin actually graduate to Raydium? This is the realized graduation rate by conviction tier across everything Oracle has scored. The edge only counts if the higher tiers win more often.</p>- <div class="edge" id="edgeWrap"></div>+ <p class="intro">Proof, not promises. Every conviction verdict is checked against ground truth — did the coin graduate, rug, or run? We measure the realized win rate by tier, show the 95% confidence band on every number, and plot calibration so you can see the score actually ranks coins by odds. The edge only counts if conviction beats blind buying — and we show it even when it doesn't.</p>+ <div id="edgeWrap"></div></section><!-- AGENTS LEADERBOARD -->diff --git a/pages/pump-visualizer.html b/pages/pump-visualizer.htmlindex 2cad35f4b..0cc08e7af 100644--- a/pages/pump-visualizer.html+++ b/pages/pump-visualizer.html@@ -1902,7 +1902,14 @@if (hit) _oracleCache.delete(mint);try {const r = await fetch(`/api/oracle/coin?mint=${encodeURIComponent(mint)}&network=mainnet`);- if (!r.ok) return null;+ if (!r.ok) {+ // 404 = mint not observed yet — a stable negative. Cache it under the+ // same TTL so a repaint-driven re-render doesn't re-fetch (and re-404)+ // every frame. A 503 is transient: return null without caching so the+ // next call retries.+ if (r.status === 404) _oracleCache.set(mint, { value: null, expires: now + ORACLE_TTL_MS });+ return null;+ }const d = await r.json();const cv = d?.conviction ? { score: d.conviction.score, tier: d.conviction.tier } : null;_oracleCache.set(mint, { value: cv, expires: now + ORACLE_TTL_MS });diff --git a/public/changelog.json b/public/changelog.jsonindex ed971bd37..19f64cae8 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-29T09:28:03.247Z",+ "generated_at": "2026-06-29T09:42:07.233Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -218,6 +218,16 @@"feature"]},+ {+ "date": "2026-06-29",+ "type": "update",+ "title": "Meet the agent behind each coin in interactive 3D",+ "summary": "Every coin page now shows the launching agent as a live, interactive 3D avatar right on the page — drag to orbit, scroll to zoom — instead of a flat thumbnail. Agents with their own model show it; the rest wear the shared base avatar so the stage is never empty. A \"See in world\" link drops that avatar straight into the walkable $THREE world. The 3D view only loads once it scrolls into view, so pages stay fast, and it falls back gracefully if a model can't load.",+ "link": "/launches",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-29","type": "update",@@ -248,6 +258,16 @@"feature"]},+ {+ "date": "2026-06-29",+ "type": "update",+ "title": "Oracle no longer mistakes stablecoins for coins",+ "summary": "The Oracle's feeds, movers, search, and wins gallery now ignore stablecoins and SOL-type tokens (USDC, USDT, wrapped/staked SOL, and similar). These show up as the other side of every trade but were never launched coins, so one was slipping into the rankings as a junk entry with an absurd multiple. They're now filtered out the moment data is ingested, hidden everywhere they're read, and any that were already cached are cleaned up automatically.",+ "link": "/oracle",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-29","type": "update",@@ -278,6 +298,17 @@"feature"]},+ {+ "date": "2026-06-29",+ "type": "update",+ "title": "Smart-Money wallet reputation stays fresh again",+ "summary": "The job that scores every wallet's realized track record and detects sybil/insider clusters was quietly timing out on large datasets, leaving the Smart-Money graph that powers the launch firewall, the sniper, and the public Smart-Money page increasingly stale. It now writes thousands of wallet scores in a handful of bulk operations instead of one row at a time, so it finishes in seconds and the reputation data behind every \"who's in\" breakdown stays current. Coin cards also stop re-requesting Oracle conviction for coins the data brain hasn't observed yet, so pages stay lighter.",+ "link": "/smart-money",+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-06-29","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 8fac37789..f8221ff5c 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -174,6 +174,14 @@<category>feature</category><description>An agent's live screen now reads like a trading desk. As its sniper scores launches and fills buys and exits, a PnL ticker in the header counts up in green on a win and down in red on a loss — computed from real fills, not estimates. Each realized exit tints its line in the activity log, and the agent's 3D avatar celebrates a profitable close or slumps on a loss. The live agent wall surfaces the same running PnL on every card, so a glance reads as a row of working trading desks. Click the ticker for a win/loss and realized breakdown.</description></item>+ <item>+ <title>Meet the agent behind each coin in interactive 3D</title>+ <link>https://three.ws/launches</link>+ <guid isPermaLink="false">2026-06-29:Meet the agent behind each coin in interactive 3D</guid>+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Every coin page now shows the launching agent as a live, interactive 3D avatar right on the page — drag to orbit, scroll to zoom — instead of a flat thumbnail. Agents with their own model show it; the rest wear the shared base avatar so the stage is never empty. A "See in world" link drops that avatar straight into the walkable $THREE world. The 3D view only loads once it scrolls into view, so pages stay fast, and it falls back gracefully if a model can't load.</description>+ </item><item><title>Multi-agent collaboration — watch a team take on one goal</title><link>https://three.ws/agents-live</link>@@ -198,6 +206,14 @@<category>feature</category><description>Open an agent's screen and it becomes a live market-news anchor. Every ~90 seconds it pulls real intel — narrative momentum, sentiment, and flow — scripts a tight bulletin, and reads it aloud in a real synthesized voice while its 3D avatar lip-syncs to the words. The headline slides up as a broadcast lower-third, and the live wall shows what each anchor is reporting with a red ON AIR ticker. Audio is muted by default with one-tap unmute (press A); if a feed is down the anchor reports only what's live instead of going silent, and a rig without face morphs still talks via a jaw-bob driven by the real audio.</description></item>+ <item>+ <title>Oracle no longer mistakes stablecoins for coins</title>+ <link>https://three.ws/oracle</link>+ <guid isPermaLink="false">2026-06-29:Oracle no longer mistakes stablecoins for coins</guid>+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The Oracle's feeds, movers, search, and wins gallery now ignore stablecoins and SOL-type tokens (USDC, USDT, wrapped/staked SOL, and similar). These show up as the other side of every trade but were never launched coins, so one was slipping into the rankings as a junk entry with an absurd multiple. They're now filtered out the moment data is ingested, hidden everywhere they're read, and any that were already cached are cleaned up automatically.</description>+ </item><item><title>Portfolio dashboard loads your agent balances again</title><link>https://three.ws/dashboard/portfolio</link>@@ -222,6 +238,14 @@<category>feature</category><description>Open an agent's screen and arm the new Sentiment Heatmap panel: a glowing 3D field of tokens that pulses with the market, $THREE pinned at the centre and labelled. Each token is a pillar — colour is its 24h momentum (cold blue → slate → green-hot), height is its 24h volume, and the strongest movers blaze with bloom while the camera drifts slowly around the field. The data is live: trending market data from Dexscreener and pump.fun, with $THREE enriched by a real pump.fun-comment sentiment pulse. As tokens spike, the agent calls the moment in its activity log — "Heating across the board, $THREE up on rising volume" — narrated by the brain and throttled so it never floods. Hover any tile for momentum and volume, hit the ◎ $THREE button to recentre on the anchor, and when the agent's screen is otherwise idle the heatmap casts to the live wall so the card is never blank. Press H to toggle it.</description></item>+ <item>+ <title>Smart-Money wallet reputation stays fresh again</title>+ <link>https://three.ws/smart-money</link>+ <guid isPermaLink="false">2026-06-29:Smart-Money wallet reputation stays fresh again</guid>+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The job that scores every wallet's realized track record and detects sybil/insider clusters was quietly timing out on large datasets, leaving the Smart-Money graph that powers the launch firewall, the sniper, and the public Smart-Money page increasingly stale. It now writes thousands of wallet scores in a handful of bulk operations instead of one row at a time, so it finishes in seconds and the reputation data behind every "who's in" breakdown stays current. Coin cards also stop re-requesting Oracle conviction for coins the data brain hasn't observed yet, so pages stay lighter.</description>+ </item><item><title>Solana Metaplex agents now appear in the on-chain deployments feed</title><link>https://three.ws/deployments</link>diff --git a/public/features.json b/public/features.jsonindex bf2bdc247..0902d97eb 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-29T09:28:03.223Z",+ "generated_at": "2026-06-29T09:42:07.218Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/launch-detail.css b/src/launch-detail.cssindex a80a72645..faeaf5840 100644--- a/src/launch-detail.css+++ b/src/launch-detail.css@@ -509,6 +509,54 @@ body {.ld-agent-desc { margin: 0; font-size: var(--text-sm); color: var(--ink-dim); line-height: 1.5; }.ld-agent-note { margin: 0; font-size: var(--text-xs); color: var(--ink-faint); }+/* The launching agent as a live, interactive 3D avatar. */+.ld-agent-stage {+ position: relative;+ width: 100%;+ aspect-ratio: 1 / 1;+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ overflow: hidden;+ background:+ radial-gradient(120% 90% at 50% 12%, color-mix(in srgb, var(--accent, #8b5cf6) 14%, transparent), transparent 60%),+ linear-gradient(180deg, var(--surface-2), var(--surface-3));+ isolation: isolate;+}+.ld-agent-3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity var(--duration-base) ease; }+.ld-agent-stage[data-state='ready'] .ld-agent-3d { opacity: 1; }+.ld-agent-stage-load {+ position: absolute; inset: 0; z-index: 2;+ display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-sm);+ font-size: var(--text-xs); color: var(--ink-dim);+ pointer-events: none;+}+.ld-agent-stage[data-state='error'] .ld-agent-stage-spin { display: none; }+.ld-agent-stage-spin {+ width: 22px; height: 22px; border-radius: 50%;+ border: 2px solid var(--stroke); border-top-color: var(--ink-bright);+ animation: ld-spin 0.8s linear infinite;+}+@keyframes ld-spin { to { transform: rotate(360deg); } }+@media (prefers-reduced-motion: reduce) { .ld-agent-stage-spin { animation: none; } }+.ld-agent-stage-bar {+ position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;+ display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);+ padding: var(--space-xs) var(--space-sm);+ background: linear-gradient(0deg, color-mix(in srgb, var(--surface-1) 86%, transparent), transparent);+ opacity: 0; transition: opacity var(--duration-fast) ease;+}+.ld-agent-stage[data-state='ready'] .ld-agent-stage-bar { opacity: 1; }+.ld-agent-stage:hover .ld-agent-stage-bar { opacity: 1; }+.ld-agent-stage-hint { font-size: var(--text-2xs); color: var(--ink-faint); letter-spacing: 0.02em; }+.ld-agent-stage-world {+ font-size: var(--text-2xs); font-weight: var(--weight-semibold);+ color: var(--ink-bright); text-decoration: none; white-space: nowrap;+ padding: 2px 6px; border-radius: var(--radius-sm);+ transition: background var(--duration-fast), color var(--duration-fast);+}+.ld-agent-stage-world:hover { background: var(--surface-3); }+.ld-agent-stage-world:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 2px; }+.ld-trader { display: flex; gap: var(--space-md); align-items: center; }.ld-trader-score { width: 76px; height: 76px; border-radius: var(--radius-md); display: grid; place-items: center; border: 1px solid currentColor; background: color-mix(in srgb, currentColor 8%, transparent); flex: 0 0 auto; }.ld-trader-num { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); line-height: 1; }diff --git a/src/launch-detail.js b/src/launch-detail.jsindex e589488b7..61f917b10 100644--- a/src/launch-detail.js+++ b/src/launch-detail.js@@ -1324,6 +1324,104 @@ function renderEconomics() {// AGENT BEHIND THE COIN// ════════════════════════════════════════════════════════════════════════════+// Lazy-load the first-party <agent-3d> web component. Tries the CDN, then the+// same-origin mirror, then the dev bundle — robust across prod and local dev.+// Resolved once and shared, so a second mount never re-imports.+let agent3DLibPromise = null;+function ensureAgent3DLib() {+ if (customElements.get('agent-3d')) return Promise.resolve(true);+ if (agent3DLibPromise) return agent3DLibPromise;+ const candidates = [+ 'https://three.ws/agent-3d/latest/agent-3d.js',+ '/agent-3d/latest/agent-3d.js',+ '/dist-lib/agent-3d.js',+ ];+ agent3DLibPromise = (async () => {+ for (const url of candidates) {+ try {+ await import(/* @vite-ignore */ url);+ if (customElements.get('agent-3d')) return true;+ } catch {+ /* try next candidate */+ }+ }+ return false;+ })();+ return agent3DLibPromise;+}++// The launching agent rendered as its real, interactive 3D avatar. Every agent+// resolves to a loadable model — its own GLB when public, else the shared+// mannequin (agentAvatarGlb) — so the stage is never an empty hole. The WebGL+// context is paid only once the card scrolls into view, and a failed/slow load+// degrades to the labelled fallback instead of a blank canvas.+function buildAgentStage(agent) {+ const glb = agentAvatarGlb(agent);+ const custom = hasCustomAvatar(agent);++ const stage = el('div', { class: 'ld-agent-stage', 'data-state': 'idle' });+ const loadEl = el('div', { class: 'ld-agent-stage-load' }, [+ el('span', { class: 'ld-agent-stage-spin', 'aria-hidden': 'true' }),+ el('span', { class: 'ld-agent-stage-msg', text: 'Loading 3D…' }),+ ]);+ stage.appendChild(loadEl);++ const setMsg = (text) => {+ const m = stage.querySelector('.ld-agent-stage-msg');+ if (m) m.textContent = text;+ };++ let mounted = false;+ const mount = async () => {+ if (mounted) return;+ mounted = true;+ const ok = await ensureAgent3DLib();+ if (!ok) {+ stage.dataset.state = 'error';+ setMsg("Couldn't load the 3D viewer.");+ return;+ }+ const a3d = el('agent-3d', {+ class: 'ld-agent-3d',+ alt: `${agent.name || 'Agent'} — 3D avatar`,+ });+ a3d.setAttribute('controls', 'orbit');+ a3d.setAttribute('src', glb);+ a3d.addEventListener('load', () => {+ stage.dataset.state = 'ready';+ loadEl.remove();+ }, { once: true });+ a3d.addEventListener('error', () => {+ stage.dataset.state = 'error';+ setMsg("Couldn't load the 3D model.");+ }, { once: true });+ stage.appendChild(a3d);+ stage.appendChild(+ el('div', { class: 'ld-agent-stage-bar' }, [+ el('span', { class: 'ld-agent-stage-hint', text: custom ? 'Drag to orbit · scroll to zoom' : 'Base avatar · drag to orbit' }),+ el('a', { class: 'ld-agent-stage-world', href: seeInWorldHref(agent), text: 'See in world →' }),+ ]),+ );+ };++ // Pay for the WebGL context only when the card is actually near the viewport.+ if ('IntersectionObserver' in window) {+ const io = new IntersectionObserver((entries) => {+ for (const e of entries) {+ if (e.isIntersecting) {+ io.disconnect();+ mount();+ }+ }+ }, { rootMargin: '240px' });+ io.observe(stage);+ } else {+ mount();+ }++ return stage;+}+function renderAgent() {const target = $('ld-agent');const agent = state.detail.agent;@@ -1334,12 +1432,7 @@ function renderAgent() {return;}- const avatar = agent.avatar_thumbnail_url- ? el('img', { class: 'ld-agent-avatar', src: agent.avatar_thumbnail_url, alt: '', loading: 'lazy' })- : el('span', { class: 'ld-agent-avatar ld-agent-avatar-fallback', text: (agent.name || '?')[0].toUpperCase() });-const head = el('a', { class: 'ld-agent-head', href: agent.url, 'aria-label': `View agent ${agent.name}` }, [- avatar,el('div', { class: 'ld-agent-id' }, [el('span', { class: 'ld-agent-name', text: agent.name || 'Agent' }),el('span', { class: 'ld-agent-role', text: 'Launching agent' }),@@ -1347,7 +1440,7 @@ function renderAgent() {el('span', { class: 'ld-agent-go', text: '→' }),]);- const body = el('div', { class: 'ld-agent-body' }, [head]);+ const body = el('div', { class: 'ld-agent-body' }, [buildAgentStage(agent), head]);// The launching agent's custodial Solana wallet — vanity-aware, copyable,// read-only for visitors. agent_authority (the on-chain signer) backstops thediff --git a/src/oracle.js b/src/oracle.jsindex 01fa9c93e..cfc1769c4 100644--- a/src/oracle.js+++ b/src/oracle.js@@ -662,6 +662,72 @@ function pillar(kind, label, val) {<div class="track"><div class="fill" style="width:${Math.max(0, Math.min(100, val || 0))}%"></div></div></div>`;}+// Inline conviction trajectory — a tiny SVG sparkline of the score over the last+// 24h. Trend-colored, with the live point dotted. Renders nothing for <2 points.+function miniSpark(points) {+ const pts = (points || []).map(Number).filter(Number.isFinite);+ if (pts.length < 2) return '';+ const W = 56, H = 18, pad = 2;+ const min = Math.min(...pts), max = Math.max(...pts);+ const span = max - min || 1;+ const n = pts.length;+ const xs = pts.map((_, i) => pad + (i / (n - 1)) * (W - pad * 2));+ const ys = pts.map((v) => pad + (1 - (v - min) / span) * (H - pad * 2));+ const delta = Math.round(pts[n - 1] - pts[0]);+ const col = delta > 2 ? 'var(--up)' : delta < -2 ? 'var(--down)' : 'var(--muted)';+ const poly = xs.map((x, i) => `${x.toFixed(1)},${ys[i].toFixed(1)}`).join(' ');+ const sign = delta > 0 ? '+' : '';+ return `<span class="coin-spark" title="Conviction ${sign}${delta} pts over the last 24h · ${n} readings">+ <svg width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" aria-label="Conviction trend ${sign}${delta} points over 24 hours">+ <polyline points="${poly}" fill="none" stroke="${col}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+ <circle cx="${xs[n - 1].toFixed(1)}" cy="${ys[n - 1].toFixed(1)}" r="1.9" fill="${col}"/>+ </svg></span>`;+}++const TAKE_TIER = {+ prime: 'A prime setup',+ strong: 'A strong setup',+ lean: 'A lean call',+ watch: 'One to watch',+ avoid: 'Steer clear',+};+const TAKE_PILLAR = {+ pedigree: { hi: 'sharp wallets are already in', lo: 'no real pedigree behind it' },+ structure:{ hi: 'a clean, distributed launch', lo: 'the launch structure is shaky' },+ narrative:{ hi: 'a narrative with legs', lo: 'a thin story' },+ momentum: { hi: 'real buy pressure building', lo: 'momentum hasn\'t shown up' },+};+const TAKE_LABEL = { pedigree: 'Who', structure: 'How', narrative: 'What', momentum: 'Move' };++// Oracle's take — a deterministic one-line synthesis grounded in the same pillars+// the card already shows. Leads with the tier, names the strongest pillar, and is+// honest about the weakest when conviction isn't high. No LLM, no latency, no spin.+function oracleTake(it) {+ const p = it.pillars || {};+ const entries = ['pedigree', 'structure', 'narrative', 'momentum']+ .map((k) => ({ k, v: Number(p[k]) }))+ .filter((e) => Number.isFinite(e.v));+ if (!entries.length) return '';+ const strong = entries.reduce((a, b) => (b.v > a.v ? b : a));+ const weak = entries.reduce((a, b) => (b.v < a.v ? b : a));+ const tier = it.tier || 'watch';+ const lead = TAKE_TIER[tier] || 'One to watch';++ let body;+ if (tier === 'prime' || tier === 'strong') {+ body = `${TAKE_PILLAR[strong.k].hi}`;+ if (it.smart_wallet_count >= 3 && strong.k !== 'pedigree') body += `, with ${it.smart_wallet_count} smart-money wallets in`;+ if ((it.badges || []).includes('structure-flag')) body += ` — but watch the structure flag`;+ } else if (tier === 'lean') {+ body = `${TAKE_PILLAR[strong.k].hi}, but ${TAKE_PILLAR[weak.k].lo}`;+ } else {+ body = weak.v < 40 ? `${TAKE_PILLAR[weak.k].lo}` : `nothing here stands out yet`;+ if ((it.badges || []).includes('structure-flag')) body = `the launch structure throws a flag`;+ }+ const cat = it.category && it.category !== 'unknown' ? ` Riding a ${esc(it.category)} narrative.` : '';+ return `<div class="coin-take"><span class="ct-q">“</span><span><b>${lead}</b> — ${body}.${cat}</span></div>`;+}+function coinCard(it, watched = new Set()) {const p = it.pillars || {};const badges = (it.badges || []).map((b) => {@@ -687,8 +753,10 @@ function coinCard(it, watched = new Set()) {<div class="dial"><b>${it.score}</b><span>conviction</span><div class="tierpill ${tierPill(it.tier)}">${esc(it.tier)}</div>+ ${miniSpark(it.spark)}</div></div>+ ${oracleTake(it)}<div class="pillars">${pillar('ped', 'Who', p.pedigree)}${pillar('str', 'How', p.structure)}@@ -1155,10 +1223,35 @@ function renderEdge() {}const agg = bt?.aggregate;+ const edge = bt?.edge;++ // ── verdict hero: does conviction beat blind buying? ──────────────────────+ let hero = '';+ if (edge && edge.prime_win_rate != null && edge.baseline_win_rate != null) {+ const lift = edge.prime_lift;+ const mult = edge.edge_multiple;+ const beats = lift != null && lift > 0;+ const mono = edge.monotonic;+ hero = `+ <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` : ''}. ${mono ? 'And the win rate climbs with the score at every band — the ranking is calibrated, not noise.' : 'The ladder isn\'t fully monotonic yet — treat lower bands with caution.'}`+ : `Conviction isn't beating the market over this window yet. We show it anyway — no cherry-picking.`}</p>+ <div class="edge-hero-metrics">+ <span class="edge-chip ${beats ? 'ok' : ''}"><b class="${beats ? 'up' : ''}">${lift != null ? (lift >= 0 ? '+' : '') + lift + 'pt' : '—'}</b><span>edge lift</span></span>+ ${mult ? `<span class="edge-chip"><b>${mult}×</b><span>vs base rate</span></span>` : ''}+ ${edge.brier != null ? `<span class="edge-chip" title="Mean squared error of the score (as a probability) vs the real outcome. Lower = better calibrated. 0.25 = a coin-flip."><b>${edge.brier.toFixed(3)}</b><span>brier</span></span>` : ''}+ <span class="edge-chip ${mono ? 'ok' : ''}"><b class="${mono ? 'up' : ''}">${mono ? 'monotonic' : 'mixed'}</b><span>ranking</span></span>+ ${edge.baseline_n ? `<span class="edge-chip"><b>${edge.baseline_n.toLocaleString()}</b><span>resolved</span></span>` : ''}+ </div>+ </div>`;+ }+const aggLine = agg && agg.total > 0 ? `<div class="edge-agg">- <div class="edge-kpi"><span>Total scored</span><b>${agg.total}</b></div>- <div class="edge-kpi"><span>Win rate</span><b class="${(agg.win_rate||0) >= 50 ? 'up' : 'dn'}">${agg.win_rate != null ? agg.win_rate + '%' : '—'}</b></div>+ <div class="edge-kpi"><span>Total scored</span><b>${agg.total.toLocaleString()}</b></div>+ <div class="edge-kpi"><span>Win rate</span><b class="${(agg.win_rate||0) >= 50 ? 'up' : 'dn'}">${agg.win_rate != null ? agg.win_rate + '%' : '—'}</b>${agg.ci ? `<span class="ci">95% CI ${agg.ci.lo}–${agg.ci.hi}</span>` : ''}</div><div class="edge-kpi"><span>Wins</span><b class="up">${agg.wins}</b></div><div class="edge-kpi"><span>Losses</span><b class="dn">${agg.losses}</b></div><div class="edge-kpi"><span>Graduated</span><b>${agg.graduated}</b></div>@@ -1167,9 +1260,22 @@ function renderEdge() {<div class="edge-kpi"><span>≥ 10×</span><b>${agg.ten_x}</b></div></div>` : '';+ // ── calibration ladder: realized win rate by score band ───────────────────+ const cal = (bt?.calibration || []).filter((c) => c.n != null);+ const calHtml = cal.length ? `+ <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">+ <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>+ </div>+ </div>` : '';+const top = bt?.top_performers?.slice(0, 5) || [];const topHtml = top.length ? `- <div class="dr-sec" style="margin-top:20px">Top performers (30d by ATH)</div>+ <div class="dr-sec edge-sec">Top performers (by ATH)</div><div class="edge-top">${top.map((t) => `<a class="edge-top-row" href="https://pump.fun/coin/${esc(t.mint)}" target="_blank" rel="noopener"><span class="tierpill ${tierPill(t.tier)}">${esc(t.tier)}</span>@@ -1179,30 +1285,51 @@ function renderEdge() {</div>` : '';wrap.innerHTML = `+ ${hero}${aggLine}- <div class="ehead" style="margin-top:${agg ? '20px' : '0'}"><span>Tier</span><span>Win rate</span><span class="colhide">Wins / Losses</span><span>Avg ATH×</span><span>≥ 5×</span></div>- ${rows.map(edgeRow).join('')}+ <div class="dr-sec edge-sec">Win rate by conviction tier</div>+ <div class="edge">+ <div class="ehead"><span>Tier</span><span>Win rate (95% CI)</span><span class="colhide">Wins / Losses</span><span>Avg ATH×</span><span>≥ 5×</span></div>+ ${rows.map(edgeRow).join('')}+ </div>+ ${calHtml}${topHtml}- <p style="font-size:11px;color:var(--faint);margin-top:18px">Win = graduated OR ATH ≥ 2×. Loss = rugged OR ATH < 1.2×. Open positions excluded. 30-day window.</p>`;+ <p style="font-size:11px;color:var(--faint);margin-top:18px">Win = graduated OR ATH ≥ 2×. Loss = rugged OR ATH < 1.2×. Open positions excluded. Confidence intervals are Wilson 95% — wide bands mean a thin sample, not a weak edge. 30-day window.</p>`;}function edgeRow(r) {- // Support both old format (grad_rate, scored) and new format (win_rate, total, wins, losses)+ // Support both old format (grad_rate, scored) and new format (win_rate, total, wins, losses, ci)const winRate = r.win_rate ?? r.grad_rate ?? null;- const total = r.total || r.scored || 0;const wins = r.wins ?? 0;const losses = r.losses ?? 0;+ const resolved = wins + losses;const ath = r.avg_ath ? Number(r.avg_ath).toFixed(1) : (r.avg_ath_multiple ? Number(r.avg_ath_multiple).toFixed(1) : null);const fiveX = r.five_x ?? 0;- return `<div class="erow">+ const thin = resolved > 0 && resolved < 8; // too few to trust — dim it, but show it+ const ci = r.ci && resolved ? `<span class="ci">${r.ci.lo}–${r.ci.hi}${thin ? ' · thin' : ''}</span>` : '';+ return `<div class="erow${thin ? ' thin' : ''}"${thin ? ' title="Small sample — wide confidence band"' : ''}><span><span class="tierpill ${tierPill(r.tier)}">${esc(r.tier)}</span></span>- <span><div class="gradbar"><i style="width:${winRate ?? 0}%"></i></div><span class="lstat" style="text-align:left"><b>${winRate != null ? winRate + '%' : '—'}</b></span></span>+ <span><div class="gradbar"><i style="width:${winRate ?? 0}%"></i></div><span class="lstat" style="text-align:left"><b>${winRate != null ? winRate + '%' : '—'}</b>${ci}</span></span><span class="lstat colhide">${wins} / ${losses}</span><span class="lstat"><b>${ath ? ath + '×' : '—'}</b></span><span class="lstat">${fiveX}</span></div>`;}+function calRow(c) {+ const real = c.realized;+ const hasData = real != null && c.n > 0;+ const thin = hasData && c.n < 5;+ return `<div class="cal-row${hasData ? '' : ' empty'}">+ <div class="cal-band">${esc(c.band)}<small>n=${c.n || 0}${thin ? ' · thin' : ''}</small></div>+ <div class="cal-track" role="img" aria-label="band ${esc(c.band)}: realized ${hasData ? real + '%' : 'no data'}, predicted ${c.predicted}%">+ <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>`;+}+// ── proof / wins gallery ──────────────────────────────────────────────────────const _proofState = { tier: '', period: '30d', cursor: null, loading: false };@@ -1468,6 +1595,17 @@ function structurePanel(st) {}+// Oracle's take for the drawer — leads with the tier+score, then weaves the two+// highest-contribution reasons the engine actually computed into one sentence.+function drawerTake(d) {+ const c = d.conviction || {};+ const lead = TAKE_TIER[c.tier] || 'One to watch';+ const rs = (d.reasons || []).map((r) => r.text).filter(Boolean);+ if (!rs.length) return '';+ const body = rs.slice(0, 2).map((t) => t.replace(/\.$/, '')).join('; ');+ return `<div class="coin-take" style="font-size:13.5px;margin:10px 0 4px"><span class="ct-q">“</span><span><b>${esc(lead)} at ${c.score}</b> — ${esc(body)}.</span></div>`;+}+function renderDrawer(d) {const c = d.conviction; const p = c.pillars || {};$('#drTitle').innerHTML = `${esc(c.symbol || '—')} <span style="color:var(--muted);font:600 13px var(--mono)">${esc(c.name || '')}</span>`;@@ -1488,6 +1626,7 @@ function renderDrawer(d) {${pillar('mom', 'Move', p.momentum)}</div></div>+ ${drawerTake(d)}<div class="dr-actions"><a class="dr-act" href="${pumpUrl(c.mint)}" target="_blank" rel="noopener">pump.fun ↗</a><a class="dr-act" href="${solscan(c.mint)}" target="_blank" rel="noopener">solscan ↗</a>diff --git a/src/pump/coin-status-card.js b/src/pump/coin-status-card.jsindex a2be110da..67d943d1c 100644--- a/src/pump/coin-status-card.js+++ b/src/pump/coin-status-card.js@@ -467,6 +467,12 @@ export function mountCoinStatus(container, mint, opts = {}) {let destroyed = false;let lastCoin = null;let lastConviction = null;+ // Once the Oracle reports this mint as not-yet-observed (404 not_found), stop+ // re-requesting conviction on every silent refresh: ingestion happens out of+ // band (the always-on observer), so the negative is stable for this session and+ // re-polling it every refreshMs just produces a steady stream of 404s. A 503+ // (transient scoring outage) is NOT terminal — we keep trying on those.+ let oracleUnavailable = false;const paint = (node) => {if (destroyed || !container) return;@@ -483,9 +489,16 @@ export function mountCoinStatus(container, mint, opts = {}) {try {// Fire coin + oracle fetches in parallel; oracle is best-effort (card only).- const oraclePromise = variant === 'card' && wantOracle+ // Skip it entirely once this mint is known-unobserved (see oracleUnavailable).+ const oraclePromise = variant === 'card' && wantOracle && !oracleUnavailable? fetch(`${ORACLE_ENDPOINT}?mint=${encodeURIComponent(mint)}`, { signal: sig })- .then((r) => (r.ok ? r.json() : null))+ .then((r) => {+ // 404 = the data brain hasn't observed this mint; a stable negative+ // for the session, so stop polling it. Other non-OK (e.g. 503) is+ // transient — return null and retry on the next refresh.+ if (r.status === 404) { oracleUnavailable = true; return null; }+ return r.ok ? r.json() : null;+ }).catch(() => null): null;diff --git a/tests/oracle/backtest-stats.test.js b/tests/oracle/backtest-stats.test.jsnew file mode 100644index 000000000..5c79fd204--- /dev/null+++ b/tests/oracle/backtest-stats.test.js@@ -0,0 +1,48 @@+// Unit tests for the Oracle backtest's statistical helpers. These numbers back+// the public "the edge is real" claim on /oracle, so the math has to be right.++import { describe, it, expect } from 'vitest';+import { wilson } from '../../api/oracle/backtest.js';++describe('wilson score interval', () => {+ it('returns null for an empty sample', () => {+ expect(wilson(0, 0)).toBeNull();+ expect(wilson(5, 0)).toBeNull();+ });++ it('brackets the point estimate', () => {+ const ci = wilson(7, 10); // 70%+ expect(ci.lo).toBeLessThanOrEqual(70);+ expect(ci.hi).toBeGreaterThanOrEqual(70);+ });++ it('stays inside [0,100] even at the extremes', () => {+ const all = wilson(10, 10); // 100%+ expect(all.lo).toBeGreaterThanOrEqual(0);+ expect(all.hi).toBeLessThanOrEqual(100);+ const none = wilson(0, 10); // 0%+ expect(none.lo).toBeGreaterThanOrEqual(0);+ expect(none.hi).toBeLessThanOrEqual(100);+ });++ it('produces a wider band for a smaller sample at the same rate', () => {+ const small = wilson(7, 10); // 70% of 10+ const large = wilson(700, 1000); // 70% of 1000+ expect(small.width).toBeGreaterThan(large.width);+ });++ it('narrows toward the point estimate as n grows', () => {+ const huge = wilson(7000, 10000); // 70% of 10k+ expect(huge.lo).toBeGreaterThan(68);+ expect(huge.hi).toBeLessThan(72);+ });++ it('matches the Wilson reference value (7/10 ≈ 40–89 at 95%)', () => {+ const ci = wilson(7, 10);+ // Wilson 95% score interval for 7/10 ≈ 0.397–0.892.+ expect(ci.lo).toBeGreaterThanOrEqual(38);+ expect(ci.lo).toBeLessThanOrEqual(42);+ expect(ci.hi).toBeGreaterThanOrEqual(87);+ expect(ci.hi).toBeLessThanOrEqual(91);+ });+});diff --git a/tests/oracle/sources-assemble.test.js b/tests/oracle/sources-assemble.test.jsindex 1c6f775d2..9eb10eeba 100644--- a/tests/oracle/sources-assemble.test.js+++ b/tests/oracle/sources-assemble.test.js@@ -35,4 +35,13 @@ describe('assembleIntel — outage vs unknown', () => {});await expect(assembleIntel('MintXYZ', 'mainnet')).rejects.toThrow(/deadline/);});++ it('refuses quote/stablecoin mints (USDC) without ever touching the DB', async () => {+ // USDC is the swap counter-side, never a launched coin. assembleIntel must+ // short-circuit to null before any query so it can never be scored/cached+ // (regression: USDC surfaced in the wins gallery as "$EPJFWD" at 32,905,333×).+ const USDC = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';+ await expect(assembleIntel(USDC, 'mainnet')).resolves.toBeNull();+ expect(sqlMock).not.toHaveBeenCalled();+ });});diff --git a/vercel.json b/vercel.jsonindex 8024f7b2c..19589c1b4 100644--- a/vercel.json+++ b/vercel.json@@ -93,7 +93,7 @@"includeFiles": "{examples/skills/**,data/pages.json,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 120},- "api/cron/recompute-reputation.js": {+ "api/cron/{recompute-reputation,smart-money-graph}.js": {"maxDuration": 300},"api/cron/[name].js": {diff --git a/workers/agent-sniper/recompute-wallet-graph.js b/workers/agent-sniper/recompute-wallet-graph.jsindex 766378624..cbc8159c3 100644--- a/workers/agent-sniper/recompute-wallet-graph.js+++ b/workers/agent-sniper/recompute-wallet-graph.js@@ -23,16 +23,16 @@import { scoreWallet, clusterByFunder } from './intel/wallet-graph.js';-let _sqlPromise = null;-async function getSql() {- if (_sqlPromise) return _sqlPromise;- _sqlPromise = import('../../api/_lib/db.js')- .then((m) => m.sql)+let _dbPromise = null;+async function getDb() {+ if (_dbPromise) return _dbPromise;+ _dbPromise = import('../../api/_lib/db.js')+ .then((m) => ({ sql: m.sql, sqlValues: m.sqlValues })).catch((err) => { console.warn('[wallet-graph] db import failed:', err?.message); return null; });- return _sqlPromise;+ return _dbPromise;}-const UPSERT_CHUNK = 200; // rows per multi-statement upsert batch+const UPSERT_CHUNK = 500; // rows per multi-row upsert statement (one round-trip each)const MIN_NET_BUY_LAMPORTS = 0; // a wallet must be a net buyer to be "in" a coinconst ms = (d) => (d ? new Date(d).getTime() : null);@@ -46,8 +46,9 @@ const ms = (d) => (d ? new Date(d).getTime() : null);*/export async function recomputeWalletGraph({ network = 'mainnet', maxCoins = 4000 } = {}) {const started = Date.now();- const sql = await getSql();- if (!sql) return { ok: false, wallets: 0, clusters: 0, coins: 0, ms: 0, reason: 'no_db' };+ const db = await getDb();+ if (!db) return { ok: false, wallets: 0, clusters: 0, coins: 0, ms: 0, reason: 'no_db' };+ const { sql, sqlValues } = db;const net = network === 'devnet' ? 'devnet' : 'mainnet';// 1) Pull every wallet that net-bought a coin with a FINAL outcome, joined to@@ -145,12 +146,12 @@ export async function recomputeWalletGraph({ network = 'mainnet', maxCoins = 400let wroteWallets = 0;let wroteClusters = 0;try {- wroteWallets = await upsertReputation(sql, repRows);+ wroteWallets = await upsertReputation(sql, sqlValues, repRows);// Replace this network's clusters wholesale: clustering is global over the// judged set, so a stale membership must be cleared, not left behind.await sql`delete from smart_wallet_clusters where network = ${net}`;- wroteClusters = await upsertClusters(sql, clusterRows);- await markFolded(sql, net, rows);+ wroteClusters = await upsertClusters(sql, sqlValues, clusterRows);+ await markFolded(sql, sqlValues, net, rows);} catch (err) {console.warn('[wallet-graph] persist failed:', err?.message);return { ok: false, wallets: wroteWallets, clusters: wroteClusters, coins: coins.size, ms: Date.now() - started, reason: 'persist_failed' };@@ -159,74 +160,74 @@ export async function recomputeWalletGraph({ network = 'mainnet', maxCoins = 400return { ok: true, wallets: wroteWallets, clusters: wroteClusters, coins: coins.size, ms: Date.now() - started };}-async function upsertReputation(sql, repRows) {+// One multi-row INSERT … VALUES per chunk (a single Neon round-trip) rather than+// one statement per row. `scored_at` is omitted from the tuple — the column+// defaults to now() on insert and is refreshed explicitly in the ON CONFLICT set.+// Keys are unique within repRows (built from a per-address Map), so a multi-row+// upsert never trips Postgres' "cannot affect row a second time" guard.+async function upsertReputation(sql, sqlValues, repRows) {let written = 0;for (let i = 0; i < repRows.length; i += UPSERT_CHUNK) {const chunk = repRows.slice(i, i + UPSERT_CHUNK);- for (const r of chunk) {- await sql`- insert into smart_wallet_reputation (- address, network, trades_seen, winners, losers, win_rate,- avg_ath_multiple, realized_score, labels, first_seen, last_seen, scored_at- ) values (- ${r.address}, ${r.network}, ${r.trades_seen}, ${r.winners}, ${r.losers},- ${r.win_rate}, ${r.avg_ath_multiple}, ${r.realized_score}, ${r.labels},- ${r.first_seen}, ${r.last_seen}, now()- )- on conflict (address, network) do update set- trades_seen = excluded.trades_seen, winners = excluded.winners,- losers = excluded.losers, win_rate = excluded.win_rate,- avg_ath_multiple = excluded.avg_ath_multiple,- realized_score = excluded.realized_score, labels = excluded.labels,- first_seen = least(smart_wallet_reputation.first_seen, excluded.first_seen),- last_seen = greatest(smart_wallet_reputation.last_seen, excluded.last_seen),- scored_at = now()- `;- written++;- }+ const values = chunk.map((r) => [+ r.address, r.network, r.trades_seen, r.winners, r.losers, r.win_rate,+ r.avg_ath_multiple, r.realized_score, r.labels, r.first_seen, r.last_seen,+ ]);+ await sql`+ insert into smart_wallet_reputation (+ address, network, trades_seen, winners, losers, win_rate,+ avg_ath_multiple, realized_score, labels, first_seen, last_seen+ ) values ${sqlValues(values)}+ on conflict (address, network) do update set+ trades_seen = excluded.trades_seen, winners = excluded.winners,+ losers = excluded.losers, win_rate = excluded.win_rate,+ avg_ath_multiple = excluded.avg_ath_multiple,+ realized_score = excluded.realized_score, labels = excluded.labels,+ first_seen = least(smart_wallet_reputation.first_seen, excluded.first_seen),+ last_seen = greatest(smart_wallet_reputation.last_seen, excluded.last_seen),+ scored_at = now()+ `;+ written += chunk.length;}return written;}-async function upsertClusters(sql, clusterRows) {+async function upsertClusters(sql, sqlValues, clusterRows) {let written = 0;for (let i = 0; i < clusterRows.length; i += UPSERT_CHUNK) {const chunk = clusterRows.slice(i, i + UPSERT_CHUNK);- for (const c of chunk) {- await sql`- insert into smart_wallet_clusters (- address, network, cluster_id, funder_root, size, confidence, scored_at- ) values (- ${c.address}, ${c.network}, ${c.cluster_id}, ${c.funder_root},- ${c.size}, ${c.confidence}, now()- )- on conflict (address, network) do update set- cluster_id = excluded.cluster_id, funder_root = excluded.funder_root,- size = excluded.size, confidence = excluded.confidence, scored_at = now()- `;- written++;- }+ const values = chunk.map((c) => [+ c.address, c.network, c.cluster_id, c.funder_root, c.size, c.confidence,+ ]);+ await sql`+ insert into smart_wallet_clusters (+ address, network, cluster_id, funder_root, size, confidence+ ) values ${sqlValues(values)}+ on conflict (address, network) do update set+ cluster_id = excluded.cluster_id, funder_root = excluded.funder_root,+ size = excluded.size, confidence = excluded.confidence, scored_at = now()+ `;+ written += chunk.length;}return written;}// Record the idempotency cursor: every coin folded this run, with the outcome it// was folded at. Lets an incremental variant skip already-folded coins; the full-// recompute above is itself idempotent regardless.-async function markFolded(sql, net, rows) {+// recompute above is itself idempotent regardless. One multi-row upsert per chunk.+async function markFolded(sql, sqlValues, net, rows) {const seen = new Map(); // mint → outcomefor (const r of rows) if (!seen.has(r.mint)) seen.set(r.mint, r.outcome);const entries = [...seen.entries()];for (let i = 0; i < entries.length; i += UPSERT_CHUNK) {const chunk = entries.slice(i, i + UPSERT_CHUNK);- for (const [mint, outcome] of chunk) {- await sql`- insert into smart_wallet_folded (mint, network, outcome, folded_at)- values (${mint}, ${net}, ${outcome}, now())- on conflict (mint, network) do update set- outcome = excluded.outcome, folded_at = now()- `;- }+ const values = chunk.map(([mint, outcome]) => [mint, net, outcome]);+ await sql`+ insert into smart_wallet_folded (mint, network, outcome)+ values ${sqlValues(values)}+ on conflict (mint, network) do update set+ outcome = excluded.outcome, folded_at = now()+ `;}}diff --git a/workers/oracle/score-loop.js b/workers/oracle/score-loop.jsindex 09e981653..de15e2398 100644--- a/workers/oracle/score-loop.js+++ b/workers/oracle/score-loop.js@@ -19,7 +19,7 @@ async function pendingMints(cfg) {left join oracle_conviction c on c.mint = i.mint and c.network = ${cfg.network}where i.network = ${cfg.network}and i.first_seen_at > now() - interval '12 hours'- and i.mint <> all(${QUOTE_MINT_LIST})+ and i.mint <> all(${QUOTE_MINT_LIST}::text[])and (c.mint is null or c.scored_at < now() - (${cfg.rescoreAfterSec} || ' seconds')::interval)order by i.first_seen_at desclimit ${cfg.scoreBatch}