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: deployments feed, money pulse, and memetic launcher engine
nirholas2e4a2b9322d4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8182fb74f..0504a3ea5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Capabilities — Alpha Hunt, Launcher, Auto-Claim & Market Maker** (`/dashboard/capabilities`) — Live command center for all 4 autonomous agent capabilities: Alpha Hunt smart-money scoring, autonomous Coin Launcher on schedule, Creator Auto-Claim for fee harvesting, and Market Maker with Jito execution.- **Live Agents** (`/agents-live`) — Mission control — real-time grid of all AI agents with active screen streams. Watch their screens and avatar feeds live.+- **On-chain Deployments** (`/deployments`) — A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.- **Partner Ecosystem** (`/partners`) — three.ws partner ecosystem — AWS, IBM, Google Cloud, Alibaba Cloud, Intel, NVIDIA, Microsoft, Oracle. The cloud and AI platforms powering 3D AI agents at enterprise scale.- **three.ws Joins the Alibaba Cloud Partner Network** (`/blog/three-ws-alibaba-cloud-partnership`) — three.ws is now an Alibaba Cloud Partner, bringing Qwen foundation models and Asia-Pacific cloud infrastructure to the three.ws 3D AI agent platform.- **60 live x402 payments per minute** — A new per-minute cron fires 60 parallel real Solana USDC micropayments each tick via the x402 protocol, seeding the platform's payment activity feed and club stage with continuous on-chain traffic. Each payment is a signed SPL TransferChecked transaction broadcast via the Solana facilitator — not simulated. Configure the batch size or pause it with X402_SEED_BATCH_SIZE / X402_SEED_ENABLED. (`/pay`) `[infra, feature]`@@ -17,6 +18,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Improved resilience during database outages** — API endpoints now return HTTP 503 (Service Unavailable) with a Retry-After header instead of 500 when the database is temporarily unreachable, so clients and caches know to back off and retry rather than treating it as a permanent error. Background crons skip their tick gracefully and log a warning instead of firing repeated alert storms. A single deduped ops alert now covers the whole outage. `[fix, infra]`- **Live Agents mission control + one-click session launcher** — New /agents-live page shows a real-time grid of every AI agent with an active screen stream — watch their screens and avatar feeds live, all in one view. Agent owners now get a "Start Live Session" panel on any watch view: click Generate credentials, copy the Docker or Node launch command, run it anywhere, and the agent browser session starts streaming to the screen canvas instantly. Sessions are signed 7-day bearer tokens, no extra setup required. (`/agents-live`) `[feature]`- **Manage your AWS Marketplace API key — new keys & usage page** — AWS Marketplace subscribers (and anyone with an x402 subscription key) now have a home for it at /billing/keys. See every key with its billing source — AWS Marketplace or on-chain — live status, rate limit, total calls, and when it was last used. Rotate a key to get a fresh secret in one click (AWS-billed keys stay linked to your AWS account and keep metering correctly), or revoke a native key outright. The post-subscribe welcome flow now points here, so a lost key is always recoverable by rotating instead of being stuck. (`/billing/keys`) `[feature]`+- **Money Pulse redesign — monochrome, with far more live data** — The live activity page at /pulse got a full pass. It's now proper monochrome to match the rest of the site — the violet accent and green/amber feed colors give way to a single clean ink ramp. And it carries a lot more real signal: 24h on-chain volume (SOL + USD), distinct active wallets, and split counters for trades, snipes, and agent-to-agent payments, plus a 7-day activity sparkline, the day's single biggest tip, and a fresh-launches feed alongside the existing top-earners and busiest-wallets boards. Every number is a real on-chain or launch record — never synthetic. (`/pulse`) `[improvement, feature]`- **Partner ecosystem page** — New /partners page showing all active technology partnerships — AWS, IBM, Google Cloud, Alibaba Cloud, Intel, NVIDIA, Microsoft, and Oracle — with what each powers on the platform, tier badges, and links to partner-specific pages and MCP servers. (`/partners`) `[feature]`- **Production stability fixes — payment sessions, Redis error handling, infra resilience** — Fixed a SQL syntax error that blocked payment session expiry and refunds (PostgreSQL does not allow LIMIT directly in UPDATE — now uses a CTE with FOR UPDATE SKIP LOCKED). Fixed esbuild class-name minification breaking NeonDB error detection in production — infrastructure errors (wrong DB credentials, Redis auth) now correctly return 503 and suppress alert storms instead of crashing every endpoint with 500. Added graceful Redis-unavailable handling to the usage flush buffer and the bounty board API. Fixed Express-style response methods in pulse-tick cron. `[fix, infra]`- **Sign-in restored during rate-limiter outages** — Fixed an issue where a temporary outage of the distributed rate limiter could block every sign-in attempt platform-wide. The login and registration limiters now degrade gracefully to a local per-instance cap during such an outage — keeping sign-in available while still throttling brute-force attempts — instead of denying everyone. Money-moving limits are unchanged and still fail safe. `[fix, security]`diff --git a/api/_lib/launcher-engine.js b/api/_lib/launcher-engine.jsnew file mode 100644index 000000000..d85855515--- /dev/null+++ b/api/_lib/launcher-engine.js@@ -0,0 +1,457 @@+// @ts-check+// Autonomous coin launcher engine — the Memetic Launcher.+//+// The platform-side sibling of the circulation engine (circulation.js). Where+// circulation makes a pool of real agents tip/pay/trade one another every tick,+// THIS engine makes them mint coins on pump.fun on a cadence, each one riding a+// live cultural narrative (launcher-trends.js). Every launch flows through the+// SAME real code path a human owner uses — build metadata, then the agent signs+// its OWN pump.fun create — so each coin carries a real avatar identity and lands+// in /launches and the money feed as a genuine on-chain launch. No synthetic rows.+//+// The handshake (per launch):+// 1. pick a narrative-driven coin (launcher-sources.pickSource)+// 2. pick the next agent in rotation (launcher_queue, oldest-first, weighted)+// 3. master tops the agent up with the per-launch SOL (launcher-funding)+// 4. the agent builds metadata + signs its own create (postAs → /api/pump)+// 5. record the run + advance the rotation (launcher_runs / _queue)+//+// SAFE BY CONSTRUCTION. The engine is fully inert unless a launcher_config row is+// enabled (the seeded global row ships disabled + dry_run). dry_run selects a coin+// + agent and records the run but never moves SOL or submits a create. Hard caps+// (per-launch SOL, daily SOL, hourly count, target cadence) and an auto-tripping+// circuit breaker bound the blast radius. Never throws — every failure is contained+// and recorded.++import { sql } from './db.js';+import { env } from './env.js';+import { solanaConnection } from './agent-pumpfun.js';+import { createSession } from './auth.js';+import { pickSource } from './launcher-sources.js';+import {+ masterBalanceSol,+ dailySpentSol,+ fundAgentForLaunch,+} from './launcher-funding.js';++const ORIGIN = env.APP_ORIGIN || 'https://three.ws';++// How few enabled agents in the rotation before we auto-enroll more, and how many+// to enroll per top-up. The global rotation draws from the circulation pool (which+// grows itself), so the launcher is autonomous end-to-end with zero curation.+const MIN_QUEUE = 3;+const ENROLL_BATCH = 12;++// Circuit breaker: this many consecutive launch FAILURES (real submit/RPC errors,+// not business-rule skips) since the last success trips the config's paused flag.+const FAIL_BREAK = 5;++// Master must hold at least (per_launch_sol + this) or we wait — a recoverable+// skip (operator tops up the master), never a breaker trip.+const MASTER_FEE_BUFFER_SOL = 0.01;++// ── schema guard ────────────────────────────────────────────────────────────────+// Self-contained so the engine runs whether or not 20260629060000_coin_launcher.sql+// has been applied. Mirrors that migration; CREATE … IF NOT EXISTS is idempotent.+let _ensured = false;+async function ensureSchema() {+ if (_ensured) return;+ await sql`+ create table if not exists launcher_config (+ id uuid primary key default gen_random_uuid(),+ scope text not null check (scope in ('global','user')),+ user_id uuid,+ enabled boolean not null default false,+ dry_run boolean not null default true,+ mode text not null default 'hybrid' check (mode in ('off','trend','meme','random','hybrid')),+ sources jsonb not null default '["coin_intel","trending","x"]'::jsonb,+ categories jsonb not null default '[]'::jsonb,+ target_cadence_seconds integer not null default 60,+ max_per_hour integer not null default 30,+ per_launch_sol numeric(20,9) not null default 0.03,+ dev_buy_sol numeric(20,9) not null default 0,+ daily_sol_cap numeric(20,9) not null default 1,+ buyback_bps integer not null default 5000,+ network text not null default 'mainnet',+ paused boolean not null default false,+ pause_reason text,+ updated_by uuid,+ created_at timestamptz not null default now(),+ updated_at timestamptz not null default now()+ )+ `;+ await sql`create unique index if not exists launcher_config_global_uniq on launcher_config (scope) where scope = 'global'`;+ await sql`create unique index if not exists launcher_config_user_uniq on launcher_config (user_id) where scope = 'user'`;+ await sql`+ create table if not exists launcher_queue (+ agent_id uuid primary key references agent_identities(id) on delete cascade,+ scope text not null default 'user' check (scope in ('global','user')),+ user_id uuid,+ enabled boolean not null default true,+ weight integer not null default 1,+ last_launched_at timestamptz,+ launch_count integer not null default 0,+ created_at timestamptz not null default now()+ )+ `;+ await sql`create index if not exists launcher_queue_pick_idx on launcher_queue (scope, enabled, last_launched_at nulls first)`;+ await sql`+ create table if not exists launcher_runs (+ id uuid primary key default gen_random_uuid(),+ scope text not null default 'global' check (scope in ('global','user')),+ user_id uuid,+ agent_id uuid,+ kind text not null check (kind in ('trend','meme','random')),+ trigger_source text,+ trigger_detail jsonb not null default '{}'::jsonb,+ name text, symbol text, mint text,+ network text not null default 'mainnet',+ sol_spent numeric(20,9) not null default 0,+ buyback_bps integer,+ status text not null default 'pending'+ check (status in ('pending','dry_run','funded','launched','confirmed','skipped','failed')),+ dry_run boolean not null default false,+ tx_signature text, fund_signature text, error text,+ created_at timestamptz not null default now(),+ updated_at timestamptz not null default now()+ )+ `;+ await sql`create index if not exists launcher_runs_recent_idx on launcher_runs (created_at desc)`;+ await sql`create index if not exists launcher_runs_scope_idx on launcher_runs (scope, created_at desc)`;+ await sql`create index if not exists launcher_runs_spend_idx on launcher_runs (created_at) where status in ('funded','launched','confirmed')`;+ await sql`create unique index if not exists launcher_runs_mint_uniq on launcher_runs (mint) where mint is not null`;+ await sql`+ insert into launcher_config (scope, enabled, dry_run, mode)+ values ('global', false, true, 'hybrid')+ on conflict do nothing+ `;+ _ensured = true;+}++// A skip is an expected, recoverable non-event (cadence not due, cap reached, no+// agent ready) — logged as a 'skipped' run, never an error.+class Skip extends Error {}++// ── run-row helpers ─────────────────────────────────────────────────────────────+async function insertRun(cfg, coin, agent) {+ const [row] = await sql`+ insert into launcher_runs+ (scope, user_id, agent_id, kind, trigger_source, trigger_detail,+ name, symbol, network, buyback_bps, status, dry_run)+ values (+ ${cfg.scope}, ${cfg.user_id ?? null}, ${agent?.id ?? null},+ ${coin.kind}, ${coin.trigger_source ?? null}, ${JSON.stringify(coin.trigger_detail ?? {})}::jsonb,+ ${coin.name}, ${coin.symbol}, ${cfg.network}, ${cfg.buyback_bps},+ 'pending', ${cfg.dry_run}+ )+ returning id+ `;+ return row.id;+}++async function setRun(id, fields) {+ await sql`+ update launcher_runs set+ status = coalesce(${fields.status ?? null}, status),+ mint = coalesce(${fields.mint ?? null}, mint),+ sol_spent = coalesce(${fields.sol_spent ?? null}, sol_spent),+ tx_signature = coalesce(${fields.tx_signature ?? null}, tx_signature),+ fund_signature = coalesce(${fields.fund_signature ?? null}, fund_signature),+ error = coalesce(${fields.error ?? null}, error),+ updated_at = now()+ where id = ${id}+ `;+}++// ── rotation ────────────────────────────────────────────────────────────────────++// Keep the rotation stocked. Global draws from the self-growing circulation pool;+// a user scope draws from that user's own avatar-bearing agents. Either way the+// engine never needs a human to curate who can launch.+async function ensureQueue(cfg) {+ const [{ c }] = await sql`+ select count(*)::int as c from launcher_queue+ where scope = ${cfg.scope} and enabled = true+ `;+ if (c >= MIN_QUEUE) return c;++ const candidates = cfg.scope === 'global'+ ? await sql`+ select ai.id from agent_identities ai+ where ai.deleted_at is null and ai.is_public = true+ and ai.avatar_id is not null+ and (ai.meta->>'circulation') = 'true'+ and ai.meta->>'solana_address' is not null+ and not exists (select 1 from launcher_queue q where q.agent_id = ai.id)+ limit ${ENROLL_BATCH}+ `+ : await sql`+ select ai.id from agent_identities ai+ where ai.deleted_at is null and ai.user_id = ${cfg.user_id}+ and ai.avatar_id is not null+ and ai.meta->>'solana_address' is not null+ and not exists (select 1 from launcher_queue q where q.agent_id = ai.id)+ limit ${ENROLL_BATCH}+ `;++ for (const r of candidates) {+ await sql`+ insert into launcher_queue (agent_id, scope, user_id, enabled)+ values (${r.id}, ${cfg.scope}, ${cfg.user_id ?? null}, true)+ on conflict (agent_id) do nothing+ `;+ }+ return c + candidates.length;+}++// The next agent up: enabled, avatar-bearing, with a wallet, least-recently-used+// first (weighted, with a touch of jitter so ties don't always resolve the same).+async function pickAgent(cfg) {+ const [agent] = await sql`+ select q.agent_id as id, ai.user_id, ai.name, ai.avatar_id,+ ai.meta->>'solana_address' as solana_address+ from launcher_queue q+ join agent_identities ai on ai.id = q.agent_id and ai.deleted_at is null+ where q.scope = ${cfg.scope} and q.enabled = true+ and ai.avatar_id is not null+ and ai.meta->>'solana_address' is not null+ order by q.last_launched_at asc nulls first, q.weight desc, random()+ limit 1+ `;+ return agent || null;+}++// ── the real launch (metadata → agent-signed create) ─────────────────────────────+async function postAs(ownerUserId, path, body, timeoutMs = 55_000) {+ const token = await createSession({ userId: ownerUserId, userAgent: 'launcher', ip: null });+ let res;+ try {+ res = await fetch(`${ORIGIN}${path}`, {+ method: 'POST',+ headers: {+ 'content-type': 'application/json',+ cookie: `__Host-sid=${token}`,+ 'user-agent': 'threews-launcher/1.0',+ },+ body: JSON.stringify(body),+ signal: AbortSignal.timeout(timeoutMs),+ });+ } catch (err) {+ if (err?.name === 'TimeoutError' || err?.name === 'AbortError') return { status: 0, body: null, timedOut: true };+ throw err;+ }+ let parsed = null;+ try { parsed = await res.json(); } catch { /* non-JSON */ }+ return { status: res.status, body: parsed };+}++async function launchCoin(cfg, agent, coin) {+ const meta = await postAs(agent.user_id, '/api/pump?action=build-metadata', {+ name: coin.name,+ symbol: coin.symbol,+ description: coin.description,+ agent_id: agent.id,+ avatar_id: agent.avatar_id,+ });+ if (meta.timedOut) throw new Error('metadata build timed out');+ if (meta.status !== 200 || !meta.body?.metadata_url) {+ throw new Error(`metadata build ${meta.status}: ${meta.body?.error || 'no url'}`);+ }++ const launch = await postAs(agent.user_id, '/api/pump?action=launch-agent', {+ agent_id: agent.id,+ name: coin.name,+ symbol: coin.symbol,+ uri: meta.body.metadata_url,+ network: cfg.network,+ quote_currency: 'sol',+ sol_buy_in: Number(cfg.dev_buy_sol) || 0,+ buyback_bps: cfg.buyback_bps,+ coin_type: 'agent',+ });+ if (launch.timedOut) throw new Error('launch timed out');+ const mint = launch.body?.mint || launch.body?.data?.mint;+ const sig = launch.body?.sig || launch.body?.signature || launch.body?.data?.sig || null;+ if (launch.status !== 200 || !mint) {+ throw new Error(`launch ${launch.status}: ${launch.body?.error || launch.body?.message || 'no mint'}`);+ }+ return { mint, sig };+}++// ── breaker ───────────────────────────────────────────────────────────────────+async function tripBreaker(cfg, reason) {+ await sql`+ update launcher_config set paused = true, pause_reason = ${reason}, updated_at = now()+ where id = ${cfg.id}+ `;+}++// FAIL_BREAK consecutive failures since the last success ⇒ trip. Counts only real+// launch outcomes (launched/confirmed/failed), ignoring skips.+async function shouldTripBreaker(cfg) {+ const rows = await sql`+ select status from launcher_runs+ where scope = ${cfg.scope}+ and ${cfg.scope === 'user' ? sql`user_id = ${cfg.user_id}` : sql`true`}+ and status in ('launched', 'confirmed', 'failed')+ order by created_at desc+ limit ${FAIL_BREAK}+ `;+ return rows.length >= FAIL_BREAK && rows.every((r) => r.status === 'failed');+}++// ── per-scope tick ───────────────────────────────────────────────────────────────+async function runScopeTick(cfg) {+ if (cfg.paused) return { scope: cfg.scope, skipped: `paused: ${cfg.pause_reason || 'breaker'}` };+ if (cfg.mode === 'off') return { scope: cfg.scope, skipped: 'mode off' };++ const userFilter = cfg.scope === 'user' ? sql`and user_id = ${cfg.user_id}` : sql``;++ // Cadence gate — only one launch attempt per target_cadence_seconds.+ const [last] = await sql`+ select created_at from launcher_runs+ where scope = ${cfg.scope} ${userFilter}+ and status in ('dry_run', 'funded', 'launched', 'confirmed')+ order by created_at desc limit 1+ `;+ if (last) {+ const elapsed = (Date.now() - new Date(last.created_at).getTime()) / 1000;+ if (elapsed < cfg.target_cadence_seconds) {+ return { scope: cfg.scope, skipped: `cadence (${Math.round(elapsed)}s/${cfg.target_cadence_seconds}s)` };+ }+ }++ // Hourly ceiling.+ if (cfg.max_per_hour > 0) {+ const [{ c: hourCount }] = await sql`+ select count(*)::int as c from launcher_runs+ where scope = ${cfg.scope} ${userFilter}+ and status in ('dry_run', 'funded', 'launched', 'confirmed')+ and created_at > now() - interval '1 hour'+ `;+ if (hourCount >= cfg.max_per_hour) {+ return { scope: cfg.scope, skipped: `hourly cap (${hourCount}/${cfg.max_per_hour})` };+ }+ }++ // Daily SOL ceiling (real launches only; dry_run never spends).+ const dailyRemaining = cfg.dry_run+ ? Infinity+ : Number(cfg.daily_sol_cap) - (await dailySpentSol(cfg.scope, cfg.user_id || null));+ if (!cfg.dry_run && dailyRemaining <= 0) {+ return { scope: cfg.scope, skipped: `daily SOL cap reached (${cfg.daily_sol_cap})` };+ }++ // Stock + pick the rotation.+ const queued = await ensureQueue(cfg);+ if (queued < 1) return { scope: cfg.scope, skipped: 'no launch-ready agents (need avatar + wallet)' };+ const agent = await pickAgent(cfg);+ if (!agent) return { scope: cfg.scope, skipped: 'no eligible agent this tick' };++ // Decide WHAT to launch — narrative-driven (launcher-trends via pickSource).+ const coin = await pickSource({+ mode: cfg.mode,+ network: cfg.network,+ categories: Array.isArray(cfg.categories) ? cfg.categories : [],+ sources: Array.isArray(cfg.sources) ? cfg.sources : undefined,+ });++ const runId = await insertRun(cfg, coin, agent);++ // Dry run: chose a coin + agent, recorded it, moved nothing.+ if (cfg.dry_run) {+ await setRun(runId, { status: 'dry_run' });+ await sql`update launcher_queue set last_launched_at = now() where agent_id = ${agent.id}`;+ return { scope: cfg.scope, dry_run: true, agent: agent.name, name: coin.name, symbol: coin.symbol, kind: coin.kind, top: coin.trigger_detail?.top_narrative || null };+ }++ // Master balance breaker — recoverable wait, not a trip.+ const perLaunch = Number(cfg.per_launch_sol);+ const masterSol = await masterBalanceSol(cfg.network);+ if (masterSol == null) {+ await setRun(runId, { status: 'skipped', error: 'master launch wallet not configured' });+ return { scope: cfg.scope, skipped: 'master wallet not configured' };+ }+ if (masterSol < perLaunch + MASTER_FEE_BUFFER_SOL) {+ await setRun(runId, { status: 'skipped', error: `master balance ${masterSol} SOL below ${perLaunch} + buffer` });+ return { scope: cfg.scope, skipped: `master low (${masterSol.toFixed(4)} SOL)` };+ }++ // Fund the agent from master (guarded by per-launch + daily caps).+ const fund = await fundAgentForLaunch({+ agentAddress: agent.solana_address,+ sol: perLaunch,+ perLaunchCapSol: perLaunch,+ dailyCapSol: dailyRemaining,+ scope: cfg.scope,+ network: cfg.network,+ memo: `three.ws launcher · ${coin.symbol}`,+ });+ if (!fund.ok) {+ await setRun(runId, { status: 'skipped', error: fund.reason });+ return { scope: cfg.scope, skipped: `fund refused: ${fund.reason}` };+ }+ await setRun(runId, { status: 'funded', fund_signature: fund.signature, sol_spent: perLaunch });++ // The agent signs its own create.+ try {+ const { mint, sig } = await launchCoin(cfg, agent, coin);+ await setRun(runId, { status: 'confirmed', mint, tx_signature: sig });+ await sql`+ update launcher_queue+ set last_launched_at = now(), launch_count = launch_count + 1+ where agent_id = ${agent.id}+ `;+ return { scope: cfg.scope, agent: agent.name, name: coin.name, symbol: coin.symbol, kind: coin.kind, mint, top: coin.trigger_detail?.top_narrative || null };+ } catch (e) {+ await setRun(runId, { status: 'failed', error: String(e?.message || e).slice(0, 300) });+ // Still advance the rotation so one bad agent can't wedge the whole queue.+ await sql`update launcher_queue set last_launched_at = now() where agent_id = ${agent.id}`;+ if (await shouldTripBreaker(cfg)) {+ await tripBreaker(cfg, `${FAIL_BREAK} consecutive launch failures`);+ return { scope: cfg.scope, error: e?.message, breaker_tripped: true };+ }+ return { scope: cfg.scope, error: e?.message };+ }+}++// ── public entry ────────────────────────────────────────────────────────────────+/**+ * Run one launcher tick across every enabled scope. Safe to call on a schedule;+ * fully inert unless a launcher_config row is enabled. Never throws — each scope is+ * isolated and every failure is contained and recorded.+ * @returns {Promise<{ok:true, scopes:number, results:object[]}>}+ */+export async function runLauncherTick() {+ await ensureSchema();++ const configs = await sql`+ select * from launcher_config where enabled = true order by scope = 'global' desc+ `;+ if (!configs.length) return { ok: true, scopes: 0, results: [], note: 'no enabled launcher config' };++ const results = [];+ for (const cfg of configs) {+ // Normalise jsonb columns the driver may hand back as strings.+ cfg.sources = typeof cfg.sources === 'string' ? safeJson(cfg.sources, []) : cfg.sources;+ cfg.categories = typeof cfg.categories === 'string' ? safeJson(cfg.categories, []) : cfg.categories;+ cfg.target_cadence_seconds = Number(cfg.target_cadence_seconds) || 60;+ cfg.max_per_hour = Number(cfg.max_per_hour) || 0;+ cfg.buyback_bps = cfg.buyback_bps == null ? 5000 : Number(cfg.buyback_bps);+ try {+ results.push({ ok: true, ...(await runScopeTick(cfg)) });+ } catch (e) {+ if (e instanceof Skip) {+ results.push({ ok: false, scope: cfg.scope, skipped: e.message });+ } else {+ console.error('[launcher] scope tick failed', cfg.scope, e?.message);+ results.push({ ok: false, scope: cfg.scope, error: String(e?.message || e).slice(0, 300) });+ }+ }+ }+ return { ok: true, scopes: configs.length, results };+}++function safeJson(s, dflt) {+ try { return JSON.parse(s); } catch { return dflt; }+}diff --git a/api/_lib/launcher-sources.js b/api/_lib/launcher-sources.jsindex 3a87e19a2..5fa5a3b7a 100644--- a/api/_lib/launcher-sources.js+++ b/api/_lib/launcher-sources.js@@ -19,6 +19,7 @@import { sql } from './db.js';import { llmComplete, llmConfigured } from './llm.js';+import { rankNarratives } from './launcher-trends.js';// ── sanitisers ──────────────────────────────────────────────────────────────// pump.fun caps: name ≤ 32, symbol ≤ 10. Symbols are uppercased alphanumerics.@@ -79,65 +80,44 @@ export function randomCoin() {// ── cultural signal ───────────────────────────────────────────────────────────/**- * Mine what's culturally hot from our own intel: the categories, tags, and- * narratives of recently observed, high-quality coins, plus recent X chatter.- * Returns deduped theme strings (never specific tickers).- * @param {{network?:string, categories?:string[], limit?:number}} opts- * @returns {Promise<string[]>}+ * Rank the live cultural currents worth riding, fused across every configured+ * signal (live pump.fun meta, oracle conviction, X chatter, and — when enabled —+ * Hacker News / Reddit / Wikipedia culture). Returns the ranked terms (with+ * momentum + which sources confirmed each) so the coiner can ride the single+ * strongest wave, not a flat bag of words. Always mines THEMES, never tickers.+ * @param {{network?:string, categories?:string[], sources?:string[]}} opts+ * @returns {Promise<Array<{term:string, score:number, sources:string[], kind:string}>>}*/-export async function gatherThemes({ network = 'mainnet', categories = [], limit = 40 } = {}) {- const themes = new Set();-- try {- const rows = await sql`- select category, tags, narrative- from pump_coin_intel- where network = ${network}- and first_seen_at > now() - interval '24 hours'- and quality_score is not null and quality_score >= 55- ${categories.length ? sql`and category = any(${categories})` : sql``}- order by quality_score desc nulls last- limit ${limit}- `;- for (const r of rows) {- if (r.category && r.category !== 'unknown') themes.add(String(r.category));- if (Array.isArray(r.tags)) r.tags.slice(0, 4).forEach((t) => t && themes.add(String(t)));- if (r.narrative) themes.add(String(r.narrative).slice(0, 80));- }- } catch {- /* intel table absent or empty — themes stay sparse, engine falls back */- }-- // Recent X chatter is an optional cultural input; its schema varies, so probe- // defensively and skip cleanly when the column/table isn't there.- try {- const rows = await sql`- select text from x_posts- where text is not null and created_at > now() - interval '48 hours'- order by created_at desc limit 15- `;- for (const r of rows) {- const words = String(r.text || '')- .replace(/https?:\/\/\S+/g, '')- .match(/#?[A-Za-z][A-Za-z0-9]{3,18}/g);- (words || []).slice(0, 3).forEach((w) => themes.add(w.replace(/^#/, '')));- }- } catch {- /* no X signal available — fine */- }+export async function gatherNarratives({ network = 'mainnet', categories = [], sources } = {}) {+ const { terms } = await rankNarratives({ network, categories, sources });+ return terms;+}- return [...themes].slice(0, 24);+/**+ * Backward-compatible theme list (deduped strings, hottest first) over the fused+ * narrative ranker. Never specific tickers.+ * @param {{network?:string, categories?:string[], sources?:string[], limit?:number}} opts+ * @returns {Promise<string[]>}+ */+export async function gatherThemes({ network = 'mainnet', categories = [], sources, limit = 24 } = {}) {+ const terms = await gatherNarratives({ network, categories, sources });+ return terms.map((t) => t.term).slice(0, limit);}// ── LLM synthesis ─────────────────────────────────────────────────────────────const SYNTH_SYSTEM =- 'You are a memecoin naming engine for three.ws, a Solana launch platform. ' +- 'You invent ORIGINAL, punchy, memeable coin identities. Absolute rules: ' ++ 'You are the lead memecoin strategist for three.ws, a Solana launch platform ' ++ 'competing to be the top deployer on pump.fun. Your job: read the live cultural ' ++ 'currents you are given and coin ONE original token that rides the strongest one ' ++ 'while it is still rising — the kind degens screenshot and share. ' ++ 'Absolute rules: ' +'(1) Never copy, reference, or imitate the name or ticker of any existing real ' +- 'cryptocurrency or token — invent something new. (2) name ≤ 32 chars, ' +- 'symbol 3-8 uppercase letters/digits, no spaces. (3) Keep it playful and ' +- 'culturally aware, not offensive or hateful. ' ++ 'cryptocurrency or token — riff on the CULTURE, invent a fresh identity. ' ++ '(2) name ≤ 32 chars; symbol 3-8 uppercase letters/digits, no spaces, instantly ' ++ 'readable and tickerable. (3) Playful, internet-native, culturally sharp — never ' ++ 'offensive, hateful, or referencing real tragedies/victims. ' ++ '(4) The description is one punchy line that makes the meme legible at a glance. ' +'Respond with STRICT JSON only: {"name":"","symbol":"","description":""}.';function parseCoinJson(text) {@@ -158,21 +138,39 @@ function parseCoinJson(text) {}/**- * Ask the LLM to coin an original token, optionally riding a set of themes.- * Degrades to randomCoin() on any LLM failure — never throws, never blocks a tick.- * @param {{themes?:string[], flavor?:'trend'|'meme', triggerSource?:string}} opts+ * Ask the LLM to coin an original token, riding the ranked live narratives when+ * supplied. Degrades to randomCoin() on any LLM failure — never throws, never+ * blocks a tick.+ * @param {{narratives?:Array<{term:string,score:number,sources:string[],kind:string}>, themes?:string[], flavor?:'trend'|'meme', triggerSource?:string}} opts*/-export async function synthesizeCoin({ themes = [], flavor = 'meme', triggerSource } = {}) {+export async function synthesizeCoin({ narratives = [], themes = [], flavor = 'meme', triggerSource } = {}) {if (!llmConfigured()) return { ...randomCoin(), degraded: 'llm_unconfigured' };- const userPrompt = themes.length- ? `These cultural themes are trending on Solana right now: ${themes.join(', ')}. ` +- `Coin ONE original memecoin riding this energy. Do not name it after any of these themes literally if they are existing tokens — riff, don't copy.`- : 'Coin ONE original, funny, internet-native memecoin from current meme culture.';+ // Prefer the ranked narratives (momentum + confirming sources) so the model+ // understands WHICH wave is strongest, not just a flat list.+ const ranked = narratives.length+ ? narratives+ : themes.map((t) => ({ term: t, score: 1, sources: [], kind: 'culture' }));+ const top = ranked[0] || null;++ let userPrompt;+ if (ranked.length) {+ const lines = ranked+ .slice(0, 12)+ .map((n, i) => `${i + 1}. ${n.term}${n.kind ? ` [${n.kind}]` : ''}${n.sources?.length ? ` (confirmed by ${n.sources.length} source${n.sources.length === 1 ? '' : 's'})` : ''}`)+ .join('\n');+ userPrompt =+ `Live cultural currents on the internet right now, strongest first:\n${lines}\n\n` ++ `Coin ONE original memecoin riding ${top ? `"${top.term}"` : 'the strongest current'} ` ++ `(or fuse it with another current below it if that makes a sharper meme). ` ++ `Riff on the culture — never name it after an existing token. Make the ticker instantly memeable.`;+ } else {+ userPrompt = 'Coin ONE original, funny, internet-native memecoin from current meme culture. Make the ticker instantly memeable.';+ }let out;try {- out = await llmComplete({ system: SYNTH_SYSTEM, user: userPrompt, maxTokens: 200, timeoutMs: 12_000 });+ out = await llmComplete({ system: SYNTH_SYSTEM, user: userPrompt, maxTokens: 220, timeoutMs: 12_000 });} catch {return { ...randomCoin(), degraded: 'llm_error' };}@@ -185,8 +183,13 @@ export async function synthesizeCoin({ themes = [], flavor = 'meme', triggerSourname: coin.name,symbol: coin.symbol,description: coin.description,- trigger_source: triggerSource || (flavor === 'trend' ? 'coin_intel' : 'meme-llm'),- trigger_detail: { themes: themes.slice(0, 12) },+ trigger_source: triggerSource || (flavor === 'trend' ? 'narratives' : 'meme-llm'),+ trigger_detail: {+ top_narrative: top?.term || null,+ top_kind: top?.kind || null,+ top_sources: top?.sources || [],+ themes: ranked.slice(0, 12).map((n) => n.term),+ },};}@@ -195,22 +198,24 @@ export async function synthesizeCoin({ themes = [], flavor = 'meme', triggerSour/*** Choose a coin for a tick given the configured mode. Hybrid prefers a live* trend, falls back to a meme, and injects random filler when no signal exists.+ * `sources` selects which narrative providers feed trend/hybrid mode (see+ * launcher-trends.js); empty ⇒ the default internal set.* @param {{mode:string, network?:string, categories?:string[], sources?:string[]}} cfg*/-export async function pickSource({ mode, network = 'mainnet', categories = [] } = {}) {+export async function pickSource({ mode, network = 'mainnet', categories = [], sources } = {}) {if (mode === 'random') return randomCoin();if (mode === 'meme') return synthesizeCoin({ flavor: 'meme' });if (mode === 'trend') {- const themes = await gatherThemes({ network, categories });- if (themes.length >= 2) return synthesizeCoin({ themes, flavor: 'trend' });+ const narratives = await gatherNarratives({ network, categories, sources });+ if (narratives.length >= 2) return synthesizeCoin({ narratives, flavor: 'trend' });// No live trend → still honour 'trend' intent with a meme rather than stall.return synthesizeCoin({ flavor: 'meme', triggerSource: 'trend-fallback' });}// hybrid (default): trend first, meme second, occasional random filler.- const themes = await gatherThemes({ network, categories });- if (themes.length >= 2) return synthesizeCoin({ themes, flavor: 'trend' });+ const narratives = await gatherNarratives({ network, categories, sources });+ if (narratives.length >= 2) return synthesizeCoin({ narratives, flavor: 'trend' });if (Math.random() < 0.5) return synthesizeCoin({ flavor: 'meme', triggerSource: 'hybrid' });return randomCoin();}diff --git a/api/_lib/launcher-trends.js b/api/_lib/launcher-trends.jsnew file mode 100644index 000000000..b5b33b726--- /dev/null+++ b/api/_lib/launcher-trends.js@@ -0,0 +1,447 @@+// @ts-check+// Narrative intelligence for the autonomous coin launcher — the "what is the+// world talking about RIGHT NOW" engine that decides which wave a launch rides.+//+// The launcher's edge is timing the zeitgeist: a coin minted into a live, rising+// narrative catches volume (and creator fees); a coin minted into nothing dies.+// This module fuses several real signals into one ranked list of cultural+// currents, each scored by momentum and cross-source confirmation, so the LLM+// coiner (launcher-sources.js) names an ORIGINAL token riding the strongest wave.+//+// Providers — every one optional, time-bounded, and degrades to silence (never+// throws, never blocks a tick):+//+// INTERNAL (primary — these measure on-chain demand on the exact venue we ship+// to, so they out-predict any generic news feed):+// coin_intel — categories / tags / narratives of high-quality coins observed+// breaking out on pump.fun in the last day (pump_coin_intel).+// trending — conviction-scored hot sectors from the oracle (oracle_conviction).+// x — hashtags / terms from recent X chatter (x_posts).+//+// EXTERNAL (culture + events — broaden beyond crypto into the memes and news+// the next narrative is minted from; key-less public APIs, cached hard):+// hackernews — tech / internet zeitgeist (HN Algolia front page).+// reddit — meme + culture + crypto-community pulse (subreddit hot).+// wikipedia — what the world is actually looking up (top pageviews).+//+// THE ONE COIN RULE ($THREE): we mine THEMES (culture, narratives, events), never+// specific tickers. Provider text is reduced to generic theme words, an explicit+// denylist strips coin/ticker-shaped tokens, and the downstream LLM is instructed+// to invent — never copy — an identity. No external coin name is ever surfaced.++import { sql } from './db.js';+import { cacheGet, cacheSet } from './cache.js';++// ── tunables ──────────────────────────────────────────────────────────────────+const AGG_CACHE_TTL_S = 180; // ranked-narrative aggregate cache+const PROVIDER_CACHE_TTL_S = 300; // per external-provider cache+const EXTERNAL_TIMEOUT_MS = 6_000;+const MAX_TERMS = 32;++// Source weights — internal venue signals dominate; culture sources broaden.+const SOURCE_WEIGHT = {+ coin_intel: 3.0,+ trending: 2.6,+ x: 1.4,+ hackernews: 1.2,+ reddit: 1.2,+ wikipedia: 1.0,+};++// External providers are opt-in via the config `sources` array; internal ones run+// whenever named. These ids are the vocabulary an operator enables.+const EXTERNAL_SOURCES = new Set(['hackernews', 'reddit', 'wikipedia']);+const DEFAULT_SOURCES = ['coin_intel', 'trending', 'x'];++// ── text hygiene ────────────────────────────────────────────────────────────────+const STOPWORDS = new Set([+ 'the', 'and', 'for', 'are', 'but', 'not', 'you', 'all', 'any', 'can', 'has', 'had',+ 'her', 'his', 'one', 'our', 'out', 'day', 'get', 'use', 'man', 'new', 'now', 'old',+ 'see', 'him', 'two', 'how', 'its', 'who', 'did', 'yes', 'his', 'been', 'have', 'this',+ 'that', 'with', 'from', 'they', 'will', 'your', 'what', 'when', 'were', 'them', 'then',+ 'than', 'into', 'just', 'over', 'also', 'back', 'after', 'first', 'about', 'their',+ 'would', 'there', 'could', 'other', 'these', 'which', 'while', 'where', 'being', 'here',+ 'more', 'most', 'some', 'such', 'only', 'very', 'much', 'like', 'make', 'made', 'says',+ 'said', 'time', 'year', 'week', 'today', 'launch', 'launches', 'crypto', 'token', 'tokens',+ 'coin', 'coins', 'price', 'market', 'pump', 'solana', 'bitcoin', 'ethereum', 'usd',+ // crypto-generic noise (we mine culture, not the asset class itself)+ 'sol', 'eth', 'btc', 'nft', 'nfts', 'dao', 'defi', 'web3', 'memecoin', 'altcoin', 'wallet',+ // common verbs / fillers that slip through title extraction as bare words+ 'show', 'gets', 'get', 'using', 'used', 'uses', 'allows', 'allow', 'still', 'stop',+ 'run', 'runs', 'build', 'builds', 'built', 'makes', 'making', 'decide', 'decides',+ 'previewing', 'preview', 'launching', 'introducing', 'announces', 'announce', 'update',+ 'release', 'released', 'report', 'reports', 'study', 'review', 'guide', 'best', 'top',+ 'why', 'way', 'ways', 'thing', 'things', 'people', 'world', 'list', 'video', 'film',+]);++// Tokens shaped like a ticker / contract / explicit coin reference — stripped so we+// follow culture, not other people's coins (the $THREE rule, mechanically enforced).+const TICKER_SHAPE = /(^\$)|(^0x[0-9a-f]{6,})|(pump$)|(^[A-Z0-9]{2,6}usd[t]?$)/i;++// Brand-safety denylist: real tragedies, violence, death and disaster never become+// a coin theme. Belt-and-braces with the LLM system prompt — kept out at the source+// so such terms never even reach the model. Matched per-word with naive plural+// stemming so "earthquakes"/"deaths" are caught as readily as the singular.+const SENSITIVE_WORDS = new Set([+ 'death', 'dead', 'die', 'dying', 'kill', 'killed', 'killing', 'murder', 'shooting',+ 'shooter', 'massacre', 'terror', 'terrorist', 'war', 'invasion', 'genocide', 'earthquake',+ 'quake', 'tsunami', 'hurricane', 'wildfire', 'flood', 'flooding', 'disaster', 'crash',+ 'victim', 'funeral', 'obituary', 'suicide', 'assault', 'abuse', 'rape', 'hostage',+ 'bombing', 'bomb', 'explosion', 'outbreak', 'pandemic', 'famine', 'refugee', 'grief',+ 'mourning', 'tragedy', 'tragic', 'fatal', 'deadly', 'wounded', 'casualty', 'casualties',+]);+function isSensitive(term) {+ return String(term).toLowerCase().split(/\s+/).some((w) => {+ if (SENSITIVE_WORDS.has(w)) return true;+ const stem = w.replace(/(ies)$/, 'y').replace(/(es|s)$/, '');+ return SENSITIVE_WORDS.has(stem) || SENSITIVE_WORDS.has(w.replace(/s$/, ''));+ });+}++/** Normalise a candidate theme word; return null if it should be dropped. */+function normTerm(raw) {+ let t = String(raw || '')+ .replace(/^#/, '')+ .replace(/[^A-Za-z0-9 ]+/g, ' ')+ .replace(/\s+/g, ' ')+ .trim();+ if (!t) return null;+ const lower = t.toLowerCase();+ if (lower.length < 3 || lower.length > 28) return null;+ if (STOPWORDS.has(lower)) return null;+ if (TICKER_SHAPE.test(t)) return null;+ if (/^\d+$/.test(lower)) return null;+ if (isSensitive(lower)) return null;+ // Drop fragments left by stripping accents/punctuation (a stray 1-char word).+ if (/(^|\s)[a-z0-9](\s|$)/i.test(t)) return null;+ return t;+}++/**+ * Pull theme candidates from a free-text title/post. Capitalised proper-noun+ * entities ("Labubu", "World Cup") are the real narrative seeds, so they come+ * first. `entitiesOnly` (used for news/title sources like HN & Reddit) skips the+ * bare-word fallback entirely — that fallback only earns its keep on hashtag-rich+ * sources (X), where lowercase tags carry meaning.+ */+function extractThemes(text, { max = 4, entitiesOnly = false } = {}) {+ const clean = String(text || '').replace(/https?:\/\/\S+/g, ' ');+ const out = [];+ // Capitalised multi-word entities ("Labubu Craze", "World Cup") read as the+ // strongest narrative seeds — grab them first.+ const entities = clean.match(/\b([A-Z][a-z]{2,})(?:\s+[A-Z][a-z]{2,}){0,2}\b/g) || [];+ for (const e of entities) {+ const n = normTerm(e);+ if (n) out.push(n);+ if (out.length >= max) return out;+ }+ if (entitiesOnly) return out;+ const words = clean.match(/#?[A-Za-z][A-Za-z0-9]{3,18}/g) || [];+ for (const w of words) {+ const n = normTerm(w);+ if (n) out.push(n.toLowerCase());+ if (out.length >= max) break;+ }+ return out;+}++// ── shared fetch (key-less, time-bounded, never throws) ─────────────────────────+async function fetchJson(url, { timeoutMs = EXTERNAL_TIMEOUT_MS, headers } = {}) {+ const ctrl = new AbortController();+ const timer = setTimeout(() => ctrl.abort(), timeoutMs);+ try {+ const res = await fetch(url, {+ signal: ctrl.signal,+ headers: {+ 'user-agent': 'three.ws-launcher/1.0 (+https://three.ws)',+ accept: 'application/json',+ ...headers,+ },+ });+ if (!res.ok) return null;+ return await res.json();+ } catch {+ return null;+ } finally {+ clearTimeout(timer);+ }+}++/** Memoise a provider's raw signals so a 60s tick never re-hits an external API. */+async function cached(key, ttl, fn) {+ try {+ const hit = await cacheGet(key);+ if (hit !== null && hit !== undefined) return hit;+ } catch { /* cache down — compute live */ }+ const val = await fn();+ try { await cacheSet(key, val, ttl); } catch { /* ignore */ }+ return val;+}++// ── internal providers ──────────────────────────────────────────────────────────++/**+ * Live pump.fun meta: the categories, tags and narratives of high-quality coins+ * first seen in the last 24h, weighted by their quality score. This is the single+ * best leading indicator of what is catching on the venue we deploy into.+ * @returns {Promise<Array<{term:string, weight:number, kind:string}>>}+ */+async function coinIntelSignals({ network, categories }) {+ const out = [];+ try {+ const rows = await sql`+ select category, tags, narrative, quality_score+ from pump_coin_intel+ where network = ${network}+ and first_seen_at > now() - interval '24 hours'+ and quality_score is not null and quality_score >= 55+ ${categories?.length ? sql`and category = any(${categories})` : sql``}+ order by quality_score desc nulls last+ limit 60+ `;+ for (const r of rows) {+ const q = Math.max(0.4, Math.min(1.4, Number(r.quality_score || 55) / 70));+ if (r.category && r.category !== 'unknown') {+ const n = normTerm(r.category);+ if (n) out.push({ term: n.toLowerCase(), weight: q * 1.2, kind: 'category' });+ }+ if (Array.isArray(r.tags)) {+ for (const t of r.tags.slice(0, 5)) {+ const n = normTerm(t);+ if (n) out.push({ term: n.toLowerCase(), weight: q, kind: 'tag' });+ }+ }+ if (r.narrative) {+ for (const n of extractThemes(r.narrative, { max: 3 })) {+ out.push({ term: n.toLowerCase(), weight: q * 0.9, kind: 'narrative' });+ }+ }+ }+ } catch { /* intel table absent / empty — sparse is fine */ }+ return out;+}++/**+ * Conviction-scored hot sectors from the oracle: categories generating the most+ * prime/strong-tier coins right now. Higher signal than raw counts — these are+ * narratives the platform's own scorer is most convinced about.+ */+async function oracleSignals({ network }) {+ const out = [];+ try {+ const rows = await sql`+ select coalesce(category, 'unknown') as category,+ count(*) filter (where tier = 'prime') as prime_count,+ count(*) filter (where tier = 'strong') as strong_count,+ round(avg(score)::numeric, 1) as avg_score+ from oracle_conviction+ where network = ${network}+ and scored_at > now() - interval '24 hours'+ and category is not null and category <> 'unknown'+ group by 1+ order by (count(*) filter (where tier = 'prime')) * 2+ + (count(*) filter (where tier = 'strong')) desc+ limit 16+ `;+ for (const r of rows) {+ const n = normTerm(r.category);+ if (!n) continue;+ const momentum = Number(r.prime_count || 0) * 1.5 + Number(r.strong_count || 0);+ const score = Math.max(0.5, Math.min(2.0, momentum / 4 + Number(r.avg_score || 0) / 90));+ out.push({ term: n.toLowerCase(), weight: score, kind: 'category' });+ }+ } catch { /* oracle table absent — skip */ }+ return out;+}++/** Recent X chatter → hashtags / capitalised entities. */+async function xSignals() {+ const out = [];+ try {+ const rows = await sql`+ select text from x_posts+ where text is not null and created_at > now() - interval '48 hours'+ order by created_at desc limit 40+ `;+ for (const r of rows) {+ for (const n of extractThemes(r.text, { max: 3 })) {+ out.push({ term: n.toLowerCase(), weight: 0.8, kind: 'culture' });+ }+ }+ } catch { /* no X signal — fine */ }+ return out;+}++// ── external providers ──────────────────────────────────────────────────────────++/** Hacker News front page — the tech / internet zeitgeist. */+async function hackerNewsSignals() {+ return cached('launcher:trend:hn', PROVIDER_CACHE_TTL_S, async () => {+ const data = await fetchJson('https://hn.algolia.com/api/v1/search?tags=front_page&hitsPerPage=30');+ const hits = Array.isArray(data?.hits) ? data.hits : [];+ const out = [];+ for (const h of hits) {+ const pts = Math.max(0.4, Math.min(1.6, Number(h.points || 0) / 200));+ for (const n of extractThemes(h.title, { max: 3, entitiesOnly: true })) {+ out.push({ term: n.toLowerCase(), weight: pts, kind: 'culture' });+ }+ }+ return out;+ });+}++/** Reddit hot across a culture-leaning subreddit set. */+async function redditSignals() {+ return cached('launcher:trend:reddit', PROVIDER_CACHE_TTL_S, async () => {+ const subs = ['memes', 'solana', 'technology', 'worldnews'];+ const out = [];+ const batches = await Promise.all(+ subs.map((s) => fetchJson(`https://www.reddit.com/r/${s}/hot.json?limit=20&raw_json=1`)),+ );+ for (const data of batches) {+ const children = Array.isArray(data?.data?.children) ? data.data.children : [];+ for (const c of children) {+ const d = c?.data;+ if (!d || d.stickied) continue;+ const ups = Math.max(0.4, Math.min(1.8, Number(d.ups || 0) / 5000));+ for (const n of extractThemes(d.title, { max: 3, entitiesOnly: true })) {+ out.push({ term: n.toLowerCase(), weight: ups, kind: 'meme' });+ }+ }+ }+ return out;+ });+}++/**+ * Wikipedia top pageviews — what the world is actually looking up. The article+ * titles ARE the entities (people, events, films, sports), making this a clean+ * "current attention" signal. Uses the most recently completed UTC day.+ */+async function wikipediaSignals() {+ return cached('launcher:trend:wiki', PROVIDER_CACHE_TTL_S, async () => {+ const d = new Date(Date.now() - 36 * 3600 * 1000); // safely-published day+ const yyyy = d.getUTCFullYear();+ const mm = String(d.getUTCMonth() + 1).padStart(2, '0');+ const dd = String(d.getUTCDate()).padStart(2, '0');+ const url = `https://wikimedia.org/api/rest_v1/metrics/pageviews/top/en.wikipedia/all-access/${yyyy}/${mm}/${dd}`;+ const data = await fetchJson(url);+ const articles = Array.isArray(data?.items?.[0]?.articles) ? data.items[0].articles : [];+ const out = [];+ for (const a of articles.slice(0, 60)) {+ const title = String(a.article || '').replace(/_/g, ' ');+ // Drop Wikipedia housekeeping pages — not culture.+ if (/^(Main Page|Special:|Wikipedia:|Portal:|Category:|Help:|Template:)/i.test(title)) continue;+ if (/^\d+$/.test(title)) continue;+ const n = normTerm(title);+ if (!n) continue;+ const rank = Number(a.rank || 60);+ const weight = Math.max(0.5, 1.6 - rank / 50); // higher-ranked = hotter+ out.push({ term: n.toLowerCase(), weight, kind: 'event' });+ }+ return out;+ });+}++const PROVIDERS = {+ coin_intel: coinIntelSignals,+ trending: oracleSignals,+ x: xSignals,+ hackernews: hackerNewsSignals,+ reddit: redditSignals,+ wikipedia: wikipediaSignals,+};++// ── aggregation ────────────────────────────────────────────────────────────────++/**+ * Rank live cultural currents across the selected providers. Terms confirmed by+ * MULTIPLE independent sources are boosted (cross-source agreement is the strongest+ * signal a narrative is real and rising, not one channel's noise).+ *+ * @param {{network?:string, sources?:string[], categories?:string[], limit?:number, fresh?:boolean}} [opts]+ * @returns {Promise<{terms:Array<{term:string,score:number,sources:string[],kind:string}>, themes:string[], top:{term:string,score:number,sources:string[],kind:string}|null, providers:string[]}>}+ */+export async function rankNarratives({ network = 'mainnet', sources, categories = [], limit = MAX_TERMS, fresh = false } = {}) {+ const wanted = (Array.isArray(sources) && sources.length ? sources : DEFAULT_SOURCES)+ .map((s) => String(s).toLowerCase())+ .filter((s) => PROVIDERS[s]);+ const providers = wanted.length ? wanted : DEFAULT_SOURCES;++ const cacheKey = `launcher:narratives:${network}:${providers.slice().sort().join(',')}:${(categories || []).slice().sort().join(',')}`;+ if (!fresh) {+ try {+ const hit = await cacheGet(cacheKey);+ if (hit) return hit;+ } catch { /* compute live */ }+ }++ const settled = await Promise.all(+ providers.map(async (id) => {+ try {+ const rows = await PROVIDERS[id]({ network, categories });+ return { id, rows: Array.isArray(rows) ? rows : [] };+ } catch {+ return { id, rows: [] };+ }+ }),+ );++ /** @type {Map<string, {term:string, score:number, sources:Set<string>, kind:string, kinds:Map<string,number>}>} */+ const merged = new Map();+ for (const { id, rows } of settled) {+ const sw = SOURCE_WEIGHT[id] ?? 1;+ for (const r of rows) {+ const term = String(r.term || '').trim();+ if (!term) continue;+ const add = (Number(r.weight) || 0.6) * sw;+ const cur = merged.get(term);+ if (cur) {+ cur.score += add;+ cur.sources.add(id);+ cur.kinds.set(r.kind || 'culture', (cur.kinds.get(r.kind || 'culture') || 0) + add);+ } else {+ merged.set(term, {+ term,+ score: add,+ sources: new Set([id]),+ kind: r.kind || 'culture',+ kinds: new Map([[r.kind || 'culture', add]]),+ });+ }+ }+ }++ const ranked = [...merged.values()]+ .map((m) => {+ // Cross-source confirmation multiplier: each extra independent source that+ // names a term lifts it well above any single channel's loudest item.+ const diversity = 1 + 0.45 * (m.sources.size - 1);+ // Dominant kind = whichever category contributed the most weight.+ let kind = m.kind;+ let best = -1;+ for (const [k, w] of m.kinds) if (w > best) { best = w; kind = k; }+ return {+ term: m.term,+ score: Number((m.score * diversity).toFixed(3)),+ sources: [...m.sources],+ kind,+ };+ })+ .sort((a, b) => b.score - a.score)+ .slice(0, limit);++ const result = {+ terms: ranked,+ themes: ranked.map((r) => r.term),+ top: ranked[0] || null,+ providers,+ };++ if (ranked.length) {+ try { await cacheSet(cacheKey, result, AGG_CACHE_TTL_S); } catch { /* ignore */ }+ }+ return result;+}++export { EXTERNAL_SOURCES, DEFAULT_SOURCES };diff --git a/api/admin/launcher.js b/api/admin/launcher.jsnew file mode 100644index 000000000..248d5d09d--- /dev/null+++ b/api/admin/launcher.js@@ -0,0 +1,187 @@+// GET/POST /api/admin/launcher — arm + observe the autonomous coin launcher+// (System B: the platform trend firehose driven by api/_lib/launcher-engine.js).+//+// GET → the global launcher_config, the live console (recent launcher_runs),+// today's spend/throughput stats, master-wallet balance, queue size.+// POST → upsert the global config (mode, sources, cadence, caps, arm/disarm),+// or { action: 'resume' } to clear a tripped circuit breaker.+//+// Auth: a real admin session OR `Bearer $CRON_SECRET` (for ops tooling). The+// launcher ships disabled + dry_run; this is the only supported way to arm it,+// so a misclick can't move SOL — enabling real launches takes enabled=true AND+// dry_run=false, set deliberately here.++import { sql } from '../_lib/db.js';+import { requireAdmin } from '../_lib/admin.js';+import { cors, json, error, method, readJson, wrap } from '../_lib/http.js';+import { env } from '../_lib/env.js';+import { constantTimeEquals } from '../_lib/crypto.js';+import { masterBalanceSol, dailySpentSol } from '../_lib/launcher-funding.js';++function isCronAuth(req) {+ const auth = req.headers.authorization || '';+ const bearer = auth.toLowerCase().startsWith('bearer ') ? auth.slice(7).trim() : '';+ return !!env.CRON_SECRET && constantTimeEquals(bearer, env.CRON_SECRET);+}++const MODES = ['off', 'trend', 'meme', 'random', 'hybrid'];+const KNOWN_SOURCES = ['coin_intel', 'trending', 'x', 'oracle', 'hackernews', 'reddit', 'wikipedia'];++async function ensureGlobalRow() {+ await sql`+ insert into launcher_config (scope, enabled, dry_run, mode)+ values ('global', false, true, 'hybrid')+ on conflict do nothing+ `;+}++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,POST,OPTIONS', credentials: true })) return;+ if (!method(req, res, ['GET', 'POST'])) return;++ if (!isCronAuth(req)) {+ const admin = await requireAdmin(req, res);+ if (!admin) return;+ }++ await ensureGlobalRow();++ if (req.method === 'GET') return getState(res);+ return postConfig(req, res);+});++async function getState(res) {+ const [config] = await sql`select * from launcher_config where scope = 'global' limit 1`;+ const network = config?.network || 'mainnet';++ const [recent, stats, queue, master] = await Promise.all([+ sql`+ select id, agent_id, kind, trigger_source, name, symbol, mint, network,+ sol_spent, status, dry_run, tx_signature, error, created_at+ from launcher_runs+ where scope = 'global'+ order by created_at desc+ limit 50+ `,+ sql`+ select+ count(*)::int as runs_today,+ count(*) filter (where status in ('launched','confirmed'))::int as launched_today,+ count(*) filter (where status = 'dry_run')::int as dry_runs_today,+ count(*) filter (where status = 'skipped')::int as skipped_today,+ count(*) filter (where status = 'failed')::int as failed_today,+ coalesce(sum(sol_spent),0)::float8 as sol_spent_today+ from launcher_runs+ where scope = 'global' and created_at >= date_trunc('day', now())+ `,+ sql`select count(*)::int as enabled from launcher_queue where scope = 'global' and enabled = true`,+ masterBalanceSol(network).catch(() => null),+ ]);++ const spentToday = await dailySpentSol('global', null).catch(() => 0);++ return json(res, 200, {+ config: config || null,+ console: recent,+ stats: {+ ...(stats[0] || {}),+ sol_remaining_today: config ? Math.max(0, Number(config.daily_sol_cap) - spentToday) : null,+ },+ queue_enabled: queue[0]?.enabled ?? 0,+ master_balance_sol: master,+ armed: !!(config?.enabled && !config?.dry_run && !config?.paused),+ });+}++async function postConfig(req, res) {+ const body = (await readJson(req).catch(() => ({}))) || {};++ // Clear a tripped breaker without otherwise touching the config.+ if (body.action === 'resume') {+ const [row] = await sql`+ update launcher_config set paused = false, pause_reason = null, updated_at = now()+ where scope = 'global' returning *+ `;+ return json(res, 200, { ok: true, config: row });+ }++ // Validate everything before writing.+ if (body.mode != null && !MODES.includes(body.mode)) {+ return error(res, 400, 'invalid_mode', `mode must be one of ${MODES.join(', ')}`);+ }+ if (body.network != null && !['mainnet', 'devnet'].includes(body.network)) {+ return error(res, 400, 'invalid_network', 'network must be mainnet or devnet');+ }+ if (body.sources != null && (!Array.isArray(body.sources) || body.sources.some((s) => !KNOWN_SOURCES.includes(s)))) {+ return error(res, 400, 'invalid_sources', `sources must be a subset of ${KNOWN_SOURCES.join(', ')}`);+ }+ if (body.categories != null && !Array.isArray(body.categories)) {+ return error(res, 400, 'invalid_categories', 'categories must be an array');+ }+ const num = (v, lo, hi) => {+ const n = Number(v);+ return Number.isFinite(n) && n >= lo && (hi == null || n <= hi);+ };+ if (body.target_cadence_seconds != null && !num(body.target_cadence_seconds, 5, 86_400)) {+ return error(res, 400, 'invalid_cadence', 'target_cadence_seconds must be 5..86400');+ }+ if (body.max_per_hour != null && !num(body.max_per_hour, 0, 100_000)) {+ return error(res, 400, 'invalid_max_per_hour', 'max_per_hour must be >= 0');+ }+ if (body.per_launch_sol != null && !num(body.per_launch_sol, 0, 50)) {+ return error(res, 400, 'invalid_per_launch_sol', 'per_launch_sol must be 0..50');+ }+ if (body.dev_buy_sol != null && !num(body.dev_buy_sol, 0, 50)) {+ return error(res, 400, 'invalid_dev_buy_sol', 'dev_buy_sol must be 0..50');+ }+ if (body.daily_sol_cap != null && !num(body.daily_sol_cap, 0, 100_000)) {+ return error(res, 400, 'invalid_daily_sol_cap', 'daily_sol_cap must be >= 0');+ }+ if (body.buyback_bps != null && !num(body.buyback_bps, 0, 10_000)) {+ return error(res, 400, 'invalid_buyback_bps', 'buyback_bps must be 0..10000');+ }++ const [cur] = await sql`select * from launcher_config where scope = 'global' limit 1`;++ // Partial update: only fields present in the body change.+ const has = (k) => Object.prototype.hasOwnProperty.call(body, k);+ const next = {+ enabled: has('enabled') ? Boolean(body.enabled) : cur.enabled,+ dry_run: has('dry_run') ? Boolean(body.dry_run) : cur.dry_run,+ mode: has('mode') ? body.mode : cur.mode,+ sources: has('sources') ? JSON.stringify(body.sources) : JSON.stringify(cur.sources),+ categories: has('categories') ? JSON.stringify(body.categories) : JSON.stringify(cur.categories),+ target_cadence_seconds: has('target_cadence_seconds') ? Math.round(Number(body.target_cadence_seconds)) : cur.target_cadence_seconds,+ max_per_hour: has('max_per_hour') ? Math.round(Number(body.max_per_hour)) : cur.max_per_hour,+ per_launch_sol: has('per_launch_sol') ? Number(body.per_launch_sol) : cur.per_launch_sol,+ dev_buy_sol: has('dev_buy_sol') ? Number(body.dev_buy_sol) : cur.dev_buy_sol,+ daily_sol_cap: has('daily_sol_cap') ? Number(body.daily_sol_cap) : cur.daily_sol_cap,+ buyback_bps: has('buyback_bps') ? Math.round(Number(body.buyback_bps)) : cur.buyback_bps,+ network: has('network') ? body.network : cur.network,+ };++ const [row] = await sql`+ update launcher_config set+ enabled = ${next.enabled},+ dry_run = ${next.dry_run},+ mode = ${next.mode},+ sources = ${next.sources}::jsonb,+ categories = ${next.categories}::jsonb,+ target_cadence_seconds = ${next.target_cadence_seconds},+ max_per_hour = ${next.max_per_hour},+ per_launch_sol = ${next.per_launch_sol},+ dev_buy_sol = ${next.dev_buy_sol},+ daily_sol_cap = ${next.daily_sol_cap},+ buyback_bps = ${next.buyback_bps},+ network = ${next.network},+ updated_at = now()+ where scope = 'global'+ returning *+ `;++ return json(res, 200, {+ ok: true,+ config: row,+ armed: !!(row.enabled && !row.dry_run && !row.paused),+ });+}diff --git a/api/cron/launcher-tick.js b/api/cron/launcher-tick.jsnew file mode 100644index 000000000..108baa716--- /dev/null+++ b/api/cron/launcher-tick.js@@ -0,0 +1,35 @@+// @ts-check+// GET/POST /api/cron/launcher-tick — drives one tick of the autonomous coin+// launcher engine (api/_lib/launcher-engine.js). Fully inert unless a+// launcher_config row is enabled; the seeded global row ships disabled + dry_run,+// so no SOL moves and no coin mints until an operator explicitly arms it. When+// armed, it makes pool agents mint pump.fun coins riding live cultural narratives+// — the same real on-chain path a human owner uses.++import { json, error, method, wrapCron } from '../_lib/http.js';+import { env } from '../_lib/env.js';+import { constantTimeEquals } from '../_lib/crypto.js';+import { runLauncherTick } from '../_lib/launcher-engine.js';++function requireCron(req, res) {+ const secret = process.env.CRON_SECRET || env.CRON_SECRET;+ if (!secret) {+ error(res, 503, 'not_configured', 'CRON_SECRET unset');+ return false;+ }+ const auth = req.headers['authorization'] || '';+ const presented = auth.startsWith('Bearer ') ? auth.slice(7) : '';+ if (!constantTimeEquals(presented, secret)) {+ error(res, 401, 'unauthorized', 'invalid cron secret');+ return false;+ }+ return true;+}++export default wrapCron(async (req, res) => {+ if (!method(req, res, ['GET', 'POST'])) return;+ if (!requireCron(req, res)) return;++ const out = await runLauncherTick();+ return json(res, 200, out);+});diff --git a/api/deployments.js b/api/deployments.jsnew file mode 100644index 000000000..8d7dc1c5d--- /dev/null+++ b/api/deployments.js@@ -0,0 +1,263 @@+// GET /api/deployments — the on-chain agent deployment feed: every agent+// registered on the ERC-8004 Identity Registry, the moment it lands on-chain,+// across every supported EVM chain.+//+// EVERY row is a real registration crawled from chain logs — there are NO+// synthetic entries. The source is `erc8004_agents_index` (populated by+// api/cron/erc8004-crawl.js via Etherscan getLogs against the registries in+// api/_lib/erc8004-chains.js). If a chain is quiet, the feed is honestly empty.+//+// Views:+// GET /api/deployments — live feed, keyset paginated (newest first)+// GET /api/deployments?cursor=<c> — load older+// GET /api/deployments?view=stats — aggregate registry intelligence+//+// Filters: network=mainnet|testnet, chain=<chainId>, kind=all|3d|x402.++import { sql, isDbUnavailableError } from './_lib/db.js';+import { cors, json, method, error, serverError, rateLimited } from './_lib/http.js';+import { limits, clientIp } from './_lib/rate-limit.js';+import { cacheGet, cacheSet } from './_lib/cache.js';+import { CHAINS, CHAIN_BY_ID, tokenExplorerUrl, addressExplorerUrl } from './_lib/erc8004-chains.js';++const FEED_TTL_S = 20; // feed page cache — registrations land in minutes, not seconds+const STATS_TTL_S = 60; // aggregate stats cache+const MAX_LIMIT = 60;++// Chain-id sets per network class, derived once from the canonical chain table so+// the network toggle never drifts from the deployed registries.+const MAINNET_CHAIN_IDS = CHAINS.filter((c) => !c.testnet).map((c) => c.id);+const TESTNET_CHAIN_IDS = CHAINS.filter((c) => c.testnet).map((c) => c.id);++function txExplorerUrl(chainId, tx) {+ const c = CHAIN_BY_ID[chainId];+ return c && tx ? `${c.explorer}/tx/${tx}` : null;+}++// Keyset cursor = base64("<epoch_ms>|<chain_id>|<agent_id>"). Ordering on+// (registered_at, chain_id, agent_id) gives a stable total order so paging never+// skips or repeats a row even as the crawler inserts concurrently.+function encodeCursor(tsIso, chainId, agentId) {+ const ms = new Date(tsIso).getTime();+ return Buffer.from(`${ms}|${chainId}|${agentId}`, 'utf8').toString('base64url');+}+function decodeCursor(raw) {+ if (!raw || typeof raw !== 'string') return null;+ try {+ const [ms, chainId, agentId] = Buffer.from(raw, 'base64url').toString('utf8').split('|');+ const n = Number(ms);+ const cid = Number(chainId);+ if (!Number.isFinite(n) || !Number.isFinite(cid) || !agentId) return null;+ return { ts: new Date(n).toISOString(), chainId: cid, agentId };+ } catch {+ return null;+ }+}++// Shape one index row into the public deployment event the client renders. Pure.+function shapeRow(r) {+ const chain = CHAIN_BY_ID[r.chain_id] || null;+ return {+ chain_id: r.chain_id,+ chain: chain ? chain.name : `Chain ${r.chain_id}`,+ testnet: chain ? !!chain.testnet : false,+ agent_id: r.agent_id,+ name: r.name || null,+ description: r.description || null,+ image: r.image || null,+ owner: r.owner || null,+ has_3d: !!r.has_3d,+ x402_support: !!r.x402_support,+ registered_at: r.registered_at,+ agent_explorer: tokenExplorerUrl(r.chain_id, r.agent_id),+ owner_explorer: r.owner ? addressExplorerUrl(r.chain_id, r.owner) : null,+ tx_explorer: txExplorerUrl(r.chain_id, r.registered_tx),+ };+}++function chainIdsFor(network) {+ return network === 'testnet' ? TESTNET_CHAIN_IDS : MAINNET_CHAIN_IDS;+}++// ── feed view ───────────────────────────────────────────────────────────────+async function handleFeed({ network, chain, kind, cursor }) {+ const chainIds = chainIdsFor(network);+ const limit = MAX_LIMIT;++ const chainFilter = chain ? sql`AND e.chain_id = ${chain}` : sql``;+ const kindFilter =+ kind === '3d' ? sql`AND e.has_3d = true` : kind === 'x402' ? sql`AND e.x402_support = true` : sql``;++ // Only rows with a known registration time can sit in a chronological feed;+ // lazily-indexed rows without a timestamp are counted in stats but not placed+ // in time here (we never invent an order).+ const cur = decodeCursor(cursor);+ const olderBound = cur+ ? sql`AND (e.registered_at < ${cur.ts}+ OR (e.registered_at = ${cur.ts} AND e.chain_id < ${cur.chainId})+ OR (e.registered_at = ${cur.ts} AND e.chain_id = ${cur.chainId} AND e.agent_id < ${cur.agentId}))`+ : sql``;++ const rows = await sql`+ SELECT e.chain_id, e.agent_id, e.owner, e.name, e.description, e.image,+ e.has_3d, e.x402_support, e.registered_at, e.registered_tx+ FROM erc8004_agents_index e+ WHERE e.active = true+ AND e.registered_at IS NOT NULL+ AND e.chain_id = ANY(${chainIds})+ ${chainFilter}+ ${kindFilter}+ ${olderBound}+ ORDER BY e.registered_at DESC, e.chain_id DESC, e.agent_id DESC+ LIMIT ${limit + 1}+ `;++ const hasMore = rows.length > limit;+ const page = rows.slice(0, limit).map(shapeRow);+ const last = page[page.length - 1];+ const nextCursor = hasMore && last ? encodeCursor(last.registered_at, last.chain_id, last.agent_id) : null;++ return {+ deployments: page,+ has_more: hasMore,+ next_cursor: nextCursor,+ network,+ chain: chain || null,+ kind,+ };+}++// ── aggregate stats view ──────────────────────────────────────────────────────+async function handleStats(network) {+ const chainIds = chainIdsFor(network);++ // Headline totals in one pass: registry size, capability mix, deploy tempo.+ const [totals] = await sql`+ SELECT+ COUNT(*)::int AS total,+ COUNT(*) FILTER (WHERE has_3d)::int AS with_3d,+ COUNT(*) FILTER (WHERE x402_support)::int AS x402,+ COUNT(DISTINCT chain_id)::int AS chains,+ COUNT(*) FILTER (WHERE registered_at > now() - interval '24 hours')::int AS d24,+ COUNT(*) FILTER (WHERE registered_at > now() - interval '7 days')::int AS d7+ FROM erc8004_agents_index+ WHERE active = true AND chain_id = ANY(${chainIds})+ `;++ // Most-populated chains — the registry's footprint at a glance.+ const topChainsRaw = await sql`+ SELECT chain_id, COUNT(*)::int AS n+ FROM erc8004_agents_index+ WHERE active = true AND chain_id = ANY(${chainIds})+ GROUP BY chain_id+ ORDER BY n DESC+ LIMIT 8+ `;++ // 7-day registration series — a zero-filled daily count for the sparkline.+ const series = await sql`+ WITH days AS (+ SELECT generate_series(+ date_trunc('day', now()) - interval '6 days',+ date_trunc('day', now()),+ interval '1 day'+ ) AS day+ ),+ ev AS (+ SELECT date_trunc('day', registered_at) AS day, COUNT(*)::int AS n+ FROM erc8004_agents_index+ WHERE active = true AND chain_id = ANY(${chainIds})+ AND registered_at > date_trunc('day', now()) - interval '6 days'+ GROUP BY 1+ )+ SELECT to_char(days.day, 'Dy') AS label,+ to_char(days.day, 'YYYY-MM-DD') AS day,+ COALESCE(ev.n, 0) AS registrations+ FROM days+ LEFT JOIN ev ON ev.day = days.day+ ORDER BY days.day+ `;++ const total = Number(totals?.total || 0);+ const topChains = topChainsRaw.map((r) => {+ const c = CHAIN_BY_ID[r.chain_id] || null;+ return {+ chain_id: r.chain_id,+ chain: c ? c.name : `Chain ${r.chain_id}`,+ count: Number(r.n || 0),+ explorer: c ? c.explorer : null,+ };+ });++ return {+ network,+ total_agents: total,+ active_chains: Number(totals?.chains || 0),+ deployed_24h: Number(totals?.d24 || 0),+ deployed_7d: Number(totals?.d7 || 0),+ with_3d: Number(totals?.with_3d || 0),+ with_3d_pct: total ? Math.round((Number(totals.with_3d) / total) * 100) : 0,+ x402: Number(totals?.x402 || 0),+ x402_pct: total ? Math.round((Number(totals.x402) / total) * 100) : 0,+ top_chains: topChains,+ series_7d: series.map((r) => ({+ label: r.label,+ day: r.day,+ registrations: Number(r.registrations || 0),+ })),+ };+}++export default async function handler(req, res) {+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;+ if (!method(req, res, ['GET'])) return;++ const rl = await limits.publicIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const url = new URL(req.url, 'http://x');+ const network = url.searchParams.get('network') === 'testnet' ? 'testnet' : 'mainnet';+ const view = url.searchParams.get('view') || 'feed';+ const chainRaw = Number(url.searchParams.get('chain'));+ const chain = Number.isInteger(chainRaw) && chainRaw > 0 ? chainRaw : null;+ const kindRaw = url.searchParams.get('kind');+ const kind = kindRaw === '3d' || kindRaw === 'x402' ? kindRaw : 'all';+ const cursor = url.searchParams.get('cursor');++ try {+ if (view === 'stats') {+ const cacheKey = `deployments:stats:${network}`;+ let body = await cacheGet(cacheKey);+ if (body === null) {+ body = await handleStats(network);+ await cacheSet(cacheKey, body, STATS_TTL_S);+ }+ res.setHeader('cache-control', 'public, max-age=30');+ return json(res, 200, { data: body });+ }++ // First page of the unfiltered global feed is cached briefly to shield the DB+ // from a thundering herd; filtered/paged requests hit the DB directly.+ const isFirstGlobalPage = !cursor && !chain && kind === 'all';+ if (isFirstGlobalPage) {+ const cacheKey = `deployments:feed:${network}`;+ let body = await cacheGet(cacheKey);+ if (body === null) {+ body = await handleFeed({ network, chain, kind, cursor });+ await cacheSet(cacheKey, body, FEED_TTL_S);+ }+ res.setHeader('cache-control', 'public, max-age=12');+ return json(res, 200, { data: body });+ }++ const body = await handleFeed({ network, chain, kind, cursor });+ return json(res, 200, { data: body });+ } catch (e) {+ if (isDbUnavailableError(e)) {+ console.warn('[api/deployments] db unavailable:', e?.message);+ return serverError(res, 503, 'service_unavailable', e);+ }+ console.error('[api/deployments] failed', e?.message, e?.stack);+ return serverError(res, 502, 'deployments_failed', e);+ }+}diff --git a/api/pulse.js b/api/pulse.jsindex 9dc0a8575..05836cd72 100644--- a/api/pulse.js+++ b/api/pulse.js@@ -243,6 +243,11 @@ async function handleFeed(req, res, { network, type, agentId, cursor, since }) {// ── aggregate stats view ──────────────────────────────────────────────────────async function handleStats(network) {+ // Public-agent gate, reused across every aggregate below so each counter honours+ // the same privacy contract as the live feed (no deleted, no private, no opt-out).+ const pubAgent = sql`ai.deleted_at IS NULL AND ai.is_public = true+ AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false`;+// 24h tip flow (count + SOL + USD where priced), platform-wide, public agents.const [tip24] = await sql`SELECT@@ -250,9 +255,7 @@ async function handleStats(network) {COALESCE(SUM(ce.amount_lamports), 0)::text AS lamports,COALESCE(SUM(ce.usd), 0)::float8 AS usdFROM agent_custody_events ce- JOIN agent_identities ai ON ai.id = ce.agent_id- AND ai.deleted_at IS NULL AND ai.is_public = true- AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}WHERE ce.network = ${network} AND ce.event_type = 'tip'AND ce.status IN ('ok', 'confirmed')AND ce.created_at > now() - interval '24 hours'@@ -268,9 +271,7 @@ async function handleStats(network) {COALESCE(SUM(ce.amount_lamports), 0)::text AS lamports,COALESCE(SUM(ce.usd), 0)::float8 AS usdFROM agent_custody_events ce- JOIN agent_identities ai ON ai.id = ce.agent_id- AND ai.deleted_at IS NULL AND ai.is_public = true- AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULLWHERE ce.network = ${network} AND ce.event_type = 'tip'AND ce.status IN ('ok', 'confirmed')@@ -288,9 +289,7 @@ async function handleStats(network) {ai.meta->>'solana_address' AS agent_addr,COUNT(*)::int AS eventsFROM agent_custody_events ce- JOIN agent_identities ai ON ai.id = ce.agent_id- AND ai.deleted_at IS NULL AND ai.is_public = true- AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULLWHERE ce.network = ${network}AND ce.status IN ('ok', 'confirmed')@@ -301,27 +300,100 @@ async function handleStats(network) {LIMIT 6`;- // Launch + trade tempo for the headline counters.const [launch24] = await sql`SELECT COUNT(*)::int AS countFROM pump_agent_mints pam- JOIN agent_identities ai ON ai.id = pam.agent_id- AND ai.deleted_at IS NULL AND ai.is_public = true- AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false+ JOIN agent_identities ai ON ai.id = pam.agent_id AND ${pubAgent}WHERE pam.network = ${network} AND pam.created_at > now() - interval '24 hours'`;- const [trade24] = await sql`- SELECT COUNT(*)::int AS count++ // 24h money tempo in one pass: total volume (SOL + priced USD), distinct active+ // wallets, and the trade/snipe/payment breakdown — so each spend category gets+ // its own honest counter instead of being lumped together.+ const [tempo24] = await sql`+ SELECT+ COUNT(*) FILTER (WHERE ce.event_type = 'spend' AND ce.category = 'trade')::int AS trades,+ COUNT(*) FILTER (WHERE ce.event_type = 'spend' AND ce.category = 'snipe')::int AS snipes,+ COUNT(*) FILTER (WHERE ce.event_type = 'spend' AND ce.category = 'x402')::int AS payments,+ COUNT(DISTINCT ce.agent_id)::int AS active_wallets,+ COALESCE(SUM(ce.amount_lamports), 0)::text AS lamports,+ COALESCE(SUM(ce.usd), 0)::float8 AS usdFROM agent_custody_events ce- JOIN agent_identities ai ON ai.id = ce.agent_id- AND ai.deleted_at IS NULL AND ai.is_public = true- AND COALESCE((ai.meta->>'pulse_opt_out')::boolean, false) = false- WHERE ce.network = ${network} AND ce.event_type = 'spend'- AND ce.category = ANY(${PUBLIC_SPEND_CATEGORIES})+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}+ WHERE ce.network = ${network}AND ce.status IN ('ok', 'confirmed')+ AND (ce.event_type = 'tip' OR (ce.event_type = 'spend' AND ce.category = ANY(${PUBLIC_SPEND_CATEGORIES})))AND ce.created_at > now() - interval '24 hours'`;+ // The single biggest tip of the last 24h — the day's headline moment.+ const [bigTip] = await sql`+ SELECT ai.id AS agent_id, ai.name AS agent_name,+ av.thumbnail_key AS thumb_key, av.visibility AS avatar_vis,+ ai.meta->>'solana_address' AS agent_addr,+ ce.amount_lamports::text AS lamports, ce.usd::float8 AS usd, ce.created_at AS ts+ FROM agent_custody_events ce+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL+ WHERE ce.network = ${network} AND ce.event_type = 'tip'+ AND ce.status IN ('ok', 'confirmed')+ AND ce.created_at > now() - interval '24 hours'+ ORDER BY COALESCE(ce.usd, ce.amount_lamports / 1e9) DESC NULLS LAST+ LIMIT 1+ `;++ // Freshest coins off the launcher — real records from pump_agent_mints.+ const recentLaunches = await sql`+ SELECT pam.mint, pam.symbol, pam.name AS coin_name, pam.created_at AS ts,+ ai.id AS agent_id, ai.name AS agent_name,+ av.thumbnail_key AS thumb_key, av.visibility AS avatar_vis,+ ai.meta->>'solana_address' AS agent_addr+ FROM pump_agent_mints pam+ JOIN agent_identities ai ON ai.id = pam.agent_id AND ${pubAgent}+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL+ WHERE pam.network = ${network}+ ORDER BY pam.created_at DESC+ LIMIT 5+ `;++ // 7-day daily pulse — a zero-filled series the page renders as a sparkline so the+ // headline isn't a single flat number. Wallet events + launches, per UTC day.+ const series = await sql`+ WITH days AS (+ SELECT generate_series(+ date_trunc('day', now()) - interval '6 days',+ date_trunc('day', now()),+ interval '1 day'+ ) AS day+ ),+ ev AS (+ SELECT date_trunc('day', ce.created_at) AS day, COUNT(*)::int AS n+ FROM agent_custody_events ce+ JOIN agent_identities ai ON ai.id = ce.agent_id AND ${pubAgent}+ WHERE ce.network = ${network}+ AND ce.status IN ('ok', 'confirmed')+ AND (ce.event_type = 'tip' OR (ce.event_type = 'spend' AND ce.category = ANY(${PUBLIC_SPEND_CATEGORIES})))+ AND ce.created_at > date_trunc('day', now()) - interval '6 days'+ GROUP BY 1+ ),+ lc AS (+ SELECT date_trunc('day', pam.created_at) AS day, COUNT(*)::int AS n+ FROM pump_agent_mints pam+ JOIN agent_identities ai ON ai.id = pam.agent_id AND ${pubAgent}+ WHERE pam.network = ${network}+ AND pam.created_at > date_trunc('day', now()) - interval '6 days'+ GROUP BY 1+ )+ SELECT to_char(days.day, 'Dy') AS label,+ to_char(days.day, 'YYYY-MM-DD') AS day,+ COALESCE(ev.n, 0) AS events,+ COALESCE(lc.n, 0) AS launches+ FROM days+ LEFT JOIN ev ON ev.day = days.day+ LEFT JOIN lc ON lc.day = days.day+ ORDER BY days.day+ `;+const shapeAgent = (r) => ({id: r.agent_id,name: r.agent_name || 'Agent',@@ -334,6 +406,10 @@ async function handleStats(network) {usd: r.usd != null ? Number(r.usd) : undefined,});+ const trades = Number(tempo24?.trades || 0);+ const snipes = Number(tempo24?.snipes || 0);+ const payments = Number(tempo24?.payments || 0);+return {network,tips_24h: {@@ -342,7 +418,38 @@ async function handleStats(network) {usd: Number(tip24?.usd || 0),},launches_24h: Number(launch24?.count || 0),- trades_24h: Number(trade24?.count || 0),+ // Kept for backward-compat: the combined swap/snipe/payment count.+ trades_24h: trades + snipes + payments,+ trades_only_24h: trades,+ snipes_24h: snipes,+ payments_24h: payments,+ active_wallets_24h: Number(tempo24?.active_wallets || 0),+ volume_24h: {+ sol: Number(tempo24?.lamports || 0) / 1e9,+ usd: Number(tempo24?.usd || 0),+ },+ biggest_tip_24h: bigTip+ ? {+ agent: shapeAgent(bigTip),+ sol: Number(bigTip.lamports || 0) / 1e9,+ usd: bigTip.usd != null ? Number(bigTip.usd) : null,+ ts: bigTip.ts,+ }+ : null,+ series_7d: series.map((r) => ({+ label: r.label,+ day: r.day,+ events: Number(r.events || 0),+ launches: Number(r.launches || 0),+ })),+ recent_launches: recentLaunches.map((r) => ({+ mint: r.mint,+ symbol: r.symbol || null,+ coin_name: r.coin_name || null,+ ts: r.ts,+ mint_explorer: r.mint ? explorerAccountUrl(r.mint, network) : null,+ agent: shapeAgent(r),+ })),top_earners: topEarners.map(shapeAgent),busiest_wallets: busiest.map(shapeAgent),};diff --git a/data/changelog.json b/data/changelog.jsonindex 4eb7120bb..05436aea6 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,13 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-27",+ "title": "Money Pulse redesign — monochrome, with far more live data",+ "summary": "The live activity page at /pulse got a full pass. It's now proper monochrome to match the rest of the site — the violet accent and green/amber feed colors give way to a single clean ink ramp. And it carries a lot more real signal: 24h on-chain volume (SOL + USD), distinct active wallets, and split counters for trades, snipes, and agent-to-agent payments, plus a 7-day activity sparkline, the day's single biggest tip, and a fresh-launches feed alongside the existing top-earners and busiest-wallets boards. Every number is a real on-chain or launch record — never synthetic.",+ "tags": ["improvement", "feature"],+ "link": "/pulse"+ },{"date": "2026-06-27","title": "Hardened Redis credentials against dashboard paste errors",diff --git a/data/pages.json b/data/pages.jsonindex 81b90d121..a17254167 100644--- a/data/pages.json+++ b/data/pages.json@@ -715,6 +715,14 @@"changefreq": "always","added": "2026-06-23"},+ {+ "path": "/deployments",+ "title": "On-chain Deployments",+ "description": "A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.",+ "priority": 0.8,+ "changefreq": "always",+ "added": "2026-06-27"+ },{"path": "/clash","title": "Coin Clash",diff --git a/pages/deployments.html b/pages/deployments.htmlnew file mode 100644index 000000000..77e0e6302--- /dev/null+++ b/pages/deployments.html@@ -0,0 +1,144 @@+<!doctype html>+<html lang="en">+ <head>+ <script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>On-chain Deployments · three.ws</title>+ <meta+ name="description"+ content="A live feed of every agent registered on the ERC-8004 Identity Registry, the moment it lands on-chain — across every supported chain. Real on-chain registrations only."+ />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/deployments" />+ <meta property="og:title" content="On-chain Deployments · three.ws" />+ <meta+ property="og:description"+ content="A live, cross-chain stream of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain."+ />+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=On-chain+Deployments&d=A+live%2C+cross-chain+feed+of+every+agent+registered+on+the+ERC-8004+Identity+Registry+%E2%80%94+the+moment+each+registration+lands+on-chain.&p=%2Fdeployments" />+ <meta property="og:image:width" content="1200" />+ <meta property="og:image:height" content="630" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:site" content="@trythreews" />+ <meta name="twitter:title" content="On-chain Deployments · three.ws" />+ <meta+ name="twitter:description"+ content="A live, cross-chain stream of every agent registered on the ERC-8004 Identity Registry — the moment it lands on-chain."+ />+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=On-chain+Deployments&d=A+live%2C+cross-chain+feed+of+every+agent+registered+on+the+ERC-8004+Identity+Registry+%E2%80%94+the+moment+each+registration+lands+on-chain.&p=%2Fdeployments" />+ <meta name="theme-color" content="#0a0a0a" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/site.webmanifest" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/deployments.css" />+ <link rel="stylesheet" href="/footer.css" />+ <script defer src="/footer-newsletter.js"></script>+ <link rel="canonical" href="https://three.ws/deployments" />+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"On-chain Deployments","description":"A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry.","url":"https://three.ws/deployments","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />+ <meta property="og:locale" content="en_US" />+ <meta property="og:image:alt" content="On-chain Deployments — three.ws" />+ </head>+ <body>+ <header><div id="nav-container"></div></header>+ <script src="/nav.js"></script>++ <main class="dp-shell">+ <section class="dp-hero">+ <p class="dp-kicker"><span class="dp-live-dot" aria-hidden="true"></span> Live on-chain registry</p>+ <h1 class="dp-title">On-chain <em>Deployments</em></h1>+ <p class="dp-sub">+ Every agent registered on the <strong>ERC-8004 Identity Registry</strong> — the moment it lands on-chain,+ across every supported chain. Real registrations only, crawled straight from chain logs.+ </p>+ <div class="dp-net" role="tablist" aria-label="Network">+ <button type="button" class="dp-net-btn active" data-network="mainnet" role="tab" aria-selected="true">Mainnet</button>+ <button type="button" class="dp-net-btn" data-network="testnet" role="tab" aria-selected="false">Testnet</button>+ </div>+ </section>++ <dl class="dp-counters" id="dp-counters">+ <div class="dp-counter dp-counter--lead">+ <dt>Agents registered</dt>+ <dd id="dp-c-total">—</dd>+ <span class="dp-counter-sub">on-chain identities</span>+ </div>+ <div class="dp-counter">+ <dt>Chains live</dt>+ <dd id="dp-c-chains">—</dd>+ <span class="dp-counter-sub">with registrations</span>+ </div>+ <div class="dp-counter">+ <dt>Deployed · 24h</dt>+ <dd id="dp-c-d24">—</dd>+ <span class="dp-counter-sub">new registrations</span>+ </div>+ <div class="dp-counter">+ <dt>Deployed · 7d</dt>+ <dd id="dp-c-d7">—</dd>+ <span class="dp-counter-sub">new registrations</span>+ </div>+ <div class="dp-counter">+ <dt>With 3D avatar</dt>+ <dd id="dp-c-3d">—</dd>+ <span class="dp-counter-sub" id="dp-c-3d-sub">rigged agents</span>+ </div>+ <div class="dp-counter">+ <dt>x402-enabled</dt>+ <dd id="dp-c-x402">—</dd>+ <span class="dp-counter-sub" id="dp-c-x402-sub">accept payments</span>+ </div>+ </dl>++ <section class="dp-spark" aria-label="Registrations, last 7 days">+ <div class="dp-spark-h">+ <span class="dp-spark-title">Last 7 days</span>+ <span class="dp-spark-total" id="dp-spark-total">—</span>+ </div>+ <div class="dp-spark-bars" id="dp-spark-bars" role="img" aria-label="Daily registrations, last 7 days"></div>+ </section>++ <div class="dp-grid">+ <div class="dp-main">+ <div class="dp-feed-head">+ <h2 class="dp-section-h">Live feed</h2>+ <div class="dp-filters" role="tablist" aria-label="Filter deployments">+ <button type="button" class="dp-filter active" data-kind="all" aria-pressed="true">All</button>+ <button type="button" class="dp-filter" data-kind="3d" aria-pressed="false">3D avatar</button>+ <button type="button" class="dp-filter" data-kind="x402" aria-pressed="false">x402</button>+ </div>+ </div>+ <div id="dp-feed" aria-live="polite"></div>+ <button type="button" class="dp-more" id="dp-more" hidden>Load older</button>+ </div>+ <aside class="dp-rail" aria-label="Registry intelligence">+ <section class="dp-card">+ <div class="dp-card-h">Top chains <small>by agents</small></div>+ <div id="dp-chains"><p class="dp-lb-empty">Loading…</p></div>+ </section>+ <section class="dp-card dp-about">+ <div class="dp-card-h">About this feed</div>+ <p class="dp-about-body">+ ERC-8004 is the open standard for portable on-chain agent identity. Every agent here is registered on+ an Identity Registry deployed at the same address on each chain. Deploy yours from+ <a href="/app">the studio</a> or explore the <a href="/showcase">3D agent directory</a>.+ </p>+ </section>+ <p class="dp-sub dp-fineprint">+ Network: <strong id="dp-net-label">mainnet</strong>. Source: <code>erc8004_agents_index</code>, crawled from chain logs. Registrations without a confirmed block time are counted in totals but not placed in the timeline.+ </p>+ </aside>+ </div>+ </main>++ <script type="module" src="/src/deployments.js"></script>+ <script src="/brand.js" defer></script>+ <div id="footer-container"></div>+ <script src="/footer.js"></script>+ </body>+</html>diff --git a/pages/pulse.html b/pages/pulse.htmlindex 8e59500a3..c08c7ba87 100644--- a/pages/pulse.html+++ b/pages/pulse.html@@ -62,7 +62,12 @@</div></section>- <dl class="px-counters">+ <dl class="px-counters" id="px-counters">+ <div class="px-counter px-counter--lead">+ <dt>Volume · 24h</dt>+ <dd id="px-c-vol">—</dd>+ <span class="px-counter-sub" id="px-c-vol-sub">on-chain flow</span>+ </div><div class="px-counter"><dt>Tips · 24h</dt><dd id="px-c-tips">—</dd>@@ -74,18 +79,40 @@<span class="px-counter-sub">coins minted</span></div><div class="px-counter">- <dt>Trades & pays · 24h</dt>+ <dt>Trades · 24h</dt><dd id="px-c-trades">—</dd>- <span class="px-counter-sub">wallet moves</span>+ <span class="px-counter-sub" id="px-c-trades-sub">swaps</span>+ </div>+ <div class="px-counter">+ <dt>Payments · 24h</dt>+ <dd id="px-c-pays">—</dd>+ <span class="px-counter-sub">agent → agent</span>+ </div>+ <div class="px-counter">+ <dt>Active wallets · 24h</dt>+ <dd id="px-c-active">—</dd>+ <span class="px-counter-sub">agents moving</span></div></dl>+ <section class="px-spark" aria-label="Platform activity, last 7 days">+ <div class="px-spark-h">+ <span class="px-spark-title">Last 7 days</span>+ <span class="px-spark-total" id="px-spark-total">—</span>+ </div>+ <div class="px-spark-bars" id="px-spark-bars" role="img" aria-label="Daily activity, last 7 days"></div>+ </section>+<div class="px-grid"><div class="px-main"><h2 class="px-section-h">Live feed</h2><div id="px-feed"></div></div><aside class="px-rail" aria-label="Money intelligence">+ <section class="px-card px-card--hl" id="px-bigtip-card" hidden>+ <div class="px-card-h">Biggest tip <small>24h</small></div>+ <div id="px-bigtip"></div>+ </section><section class="px-card"><div class="px-card-h">Top earners <small>tips · 7d</small></div><div id="px-earners"><p class="px-lb-empty">Loading…</p></div>@@ -94,8 +121,12 @@<div class="px-card-h">Busiest wallets <small>events · 24h</small></div><div id="px-busiest"><p class="px-lb-empty">Loading…</p></div></section>+ <section class="px-card">+ <div class="px-card-h">Fresh launches <small>newest coins</small></div>+ <div id="px-launches"><p class="px-lb-empty">Loading…</p></div>+ </section><div id="px-stats"></div>- <p class="px-sub" style="font-size:var(--text-2xs,.68rem);text-align:left;margin:0;color:var(--ink-faint,#666)">+ <p class="px-sub px-fineprint">Network: <strong id="px-net-label">mainnet</strong>. Private withdrawals and custody events are never shown — only already-public activity.</p></aside>diff --git a/prompts/memetic-launcher/00-README.md b/prompts/memetic-launcher/00-README.mdnew file mode 100644index 000000000..811a77af2--- /dev/null+++ b/prompts/memetic-launcher/00-README.md@@ -0,0 +1,46 @@+# Memetic Launcher · the autonomous coin launcher++## North star+Make three.ws the **#1 deployer on pump.fun** — not a human clicking launch, but a pool+of 3D AI agents minting coins around the clock, each one riding a live cultural+narrative, each one capturing creator rewards. The economics are simple: pump.fun+creator fees are high; a steady stream of well-timed, on-narrative launches compounds+into real revenue. The hard part is **timing the zeitgeist** — and that data is all+available via public APIs and MCPs.++This works exactly like the **autonomous tips engine** (`api/_lib/circulation.js`): a+scheduled tick drives a pool of real agents through real on-chain actions via the same+code paths a human owner uses. The launcher is the minting sibling of that engine.++## The pieces (each has its own brief)+| # | File | What it owns |+|---|------|--------------|+| 01 | [narrative-intelligence.md](01-narrative-intelligence.md) | "What's hot right now" — the multi-source trend/narrative ranker (`launcher-trends.js`). |+| 02 | [coining-engine.md](02-coining-engine.md) | "What to launch" — the LLM that coins an original token riding a narrative (`launcher-sources.js`), incl. the literal prompts. |+| 03 | [launch-engine.md](03-launch-engine.md) | "Launch it autonomously" — the engine tick, caps, breaker, rotation, funding (`launcher-engine.js` + `launcher-tick` cron). |+| 04 | [creator-rewards.md](04-creator-rewards.md) | "Make it pay" — claim + reinvest creator rewards (the profit loop). |+| 05 | [admin-console.md](05-admin-console.md) | "Operate it safely" — arm/disarm, live runs, metrics, kill switch. |++## Data flow (one launch)+```+narrative-intelligence → coining-engine → launch-engine+ rank live currents coin an original pick agent → master funds it →+ (intel+oracle+X+ token riding the agent signs its OWN pump.fun+ HN/Reddit/Wikipedia) strongest wave create → record run → claim fees+```++## Safety contract (non-negotiable)+- **Inert until armed.** Nothing fires unless a `launcher_config` row is `enabled`. The+ seeded global row ships `enabled=false, dry_run=true`.+- **dry_run** picks a coin + agent and records the run but moves zero SOL.+- **Hard caps**: per-launch SOL, daily SOL, hourly count, target cadence. Plus a circuit+ breaker that auto-pauses on consecutive failures.+- **$THREE is the only coin the platform promotes.** The launcher mints *new* coins for+ agents as a product feature; it mines **themes/culture, never other coins' tickers**,+ and routes `buyback_bps` of fees into $THREE buyback-and-burn. It must never hardcode,+ market, or recommend any specific non-$THREE mint.+- **No tragedies.** Brand-safety denylist keeps death/violence/disaster narratives out at+ the source AND in the LLM system prompt.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. `vercel.json` changes are deploy-time. User-visible change → `data/changelog.json` + `npm run build:pages`. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/prompts/memetic-launcher/01-narrative-intelligence.md b/prompts/memetic-launcher/01-narrative-intelligence.mdnew file mode 100644index 000000000..609aa2dad--- /dev/null+++ b/prompts/memetic-launcher/01-narrative-intelligence.md@@ -0,0 +1,60 @@+# 01 · Narrative Intelligence++## Mission+Know, at any second, **what the world is talking about** and which current is rising+fastest — so the launcher mints into live attention instead of into the void. A coin+timed to a real, rising narrative catches volume (and fees); a coin timed to nothing dies.++## Context+- Lives in `api/_lib/launcher-trends.js`, exporting `rankNarratives({network, sources, categories, limit})`.+- Returns ranked currents: `{ terms:[{term, score, sources[], kind}], themes:[…], top, providers }`.+- Consumed by `launcher-sources.js` (`gatherNarratives` / `pickSource`) → fed to the coining LLM.+- Cached (aggregate + per external provider) so a 1-tick/min cadence never hammers an API.++## Providers (all optional · time-bounded · degrade to silence · never throw)+**Internal (primary — they measure on-chain demand on the exact venue we ship to):**+- `coin_intel` — `pump_coin_intel`: categories/tags/narratives of high-quality coins first+ seen in the last 24h, weighted by `quality_score`. The single best leading indicator.+- `trending` — `oracle_conviction`: conviction-scored hot sectors (prime/strong tiers).+- `x` — `x_posts`: recent X chatter → hashtags + capitalised entities.++**External (culture + events — where the next meme is born; key-less, cached hard):**+- `hackernews` — HN Algolia front page (tech/internet zeitgeist).+- `reddit` — subreddit hot across a culture-leaning set (memes/solana/technology/worldnews).+- `wikipedia` — top pageviews (what people are actually looking up: people, films, sport, events).++## Scoring+- Per-term weight = `provider_weight × signal_strength` (quality score / upvotes / pageview rank).+- **Cross-source confirmation multiplier**: a term named by N independent sources is boosted+ `× (1 + 0.45·(N−1))` — agreement across channels is the strongest "this is real and rising" signal.+- Dominant `kind` (category/tag/narrative/culture/meme/event) = whichever contributed most weight.++## Hard rules (mechanical, not just prompt-level)+1. **Themes, never tickers.** Strip `$XXX`, `0x…`, `…usd`, `…pump`-shaped tokens. We follow+ culture, not other people's coins ($THREE rule, enforced in code).+2. **Brand safety.** A tragedy/violence/disaster denylist (with plural stemming) drops+ death/war/earthquake/etc. terms at the source — they never reach the model.+3. **Entities over noise.** Title-based sources (HN/Reddit/Wikipedia) extract capitalised+ proper-noun entities only; generic verbs/stopwords are dropped.++## Tasks (to extend)+1. **Add providers via MCP/APIs** — register new sources in `PROVIDERS` returning the same+ `{term, weight, kind}` shape: e.g. a Google-Trends MCP, TikTok/Twitch trending, GitHub+ trending, Polymarket movers, an LLM-summarised "what's trending" call. Wire each into+ `SOURCE_WEIGHT` and `EXTERNAL_SOURCES`; gate behind the config `sources` array.+2. **Recency/velocity** — prefer *accelerating* terms (delta vs. the prior window) over+ merely-large ones; persist a short rolling history to compute velocity.+3. **Saturation guard** — down-weight a narrative the launcher has already minted into many+ times in the last few hours (avoid self-spam; read `launcher_runs.trigger_detail`).+4. **Per-term safety classifier** — optional LLM/Granite-Guardian pass on the top terms+ before they reach the coiner, for nuanced (not keyword) brand-safety.++## Acceptance+- `rankNarratives` returns real, clean, on-trend terms in < ~1s with the default sources, and+ degrades to internal-only signal when every external API is unreachable.+- No ticker-shaped or tragedy terms ever appear in the output (covered by tests).+- New providers plug in without touching the ranker core; disabling all sources yields an+ empty list, not an error.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. User-visible change → `data/changelog.json` + `npm run build:pages`. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/prompts/memetic-launcher/02-coining-engine.md b/prompts/memetic-launcher/02-coining-engine.mdnew file mode 100644index 000000000..16c10883c--- /dev/null+++ b/prompts/memetic-launcher/02-coining-engine.md@@ -0,0 +1,75 @@+# 02 · Coining Engine++## Mission+Turn a ranked narrative into **one original, memeable coin** — a name, a ticker, and a+one-line description sharp enough that a degen screenshots and shares it. Riff on the+culture; never copy an existing token.++## Context+- Lives in `api/_lib/launcher-sources.js`: `pickSource` → `synthesizeCoin` → `llmComplete`.+- Input: ranked narratives from `launcher-trends.js` (term + kind + confirming sources).+- Output (uniform shape every provider returns):+ `{ kind, name, symbol, description, trigger_source, trigger_detail }`.+- Degrades to `randomCoin()` (wordlist salad — no network/LLM) on any LLM failure, so a tick+ never stalls.+- Sanitisers enforce pump.fun caps: name ≤ 32, symbol 3–10 uppercase alphanumerics.++## Modes (config `mode`)+- `trend` — coin from live ranked narratives; falls back to `meme` if no signal.+- `meme` — coin from open meme culture (no specific narrative needed).+- `random` — wordlist filler (guaranteed, offline).+- `hybrid` (default) — trend first, meme second, occasional random filler.++## The prompts (literal — keep in sync with code)++### System prompt+```+You are the lead memecoin strategist for three.ws, a Solana launch platform competing to+be the top deployer on pump.fun. Your job: read the live cultural currents you are given+and coin ONE original token that rides the strongest one while it is still rising — the+kind degens screenshot and share. Absolute rules: (1) Never copy, reference, or imitate the+name or ticker of any existing real cryptocurrency or token — riff on the CULTURE, invent a+fresh identity. (2) name ≤ 32 chars; symbol 3-8 uppercase letters/digits, no spaces,+instantly readable and tickerable. (3) Playful, internet-native, culturally sharp — never+offensive, hateful, or referencing real tragedies/victims. (4) The description is one punchy+line that makes the meme legible at a glance. Respond with STRICT JSON only:+{"name":"","symbol":"","description":""}.+```++### User prompt (trend mode)+```+Live cultural currents on the internet right now, strongest first:+1. <term> [<kind>] (confirmed by N sources)+2. …++Coin ONE original memecoin riding "<top term>" (or fuse it with another current below it if+that makes a sharper meme). Riff on the culture — never name it after an existing token.+Make the ticker instantly memeable.+```++### User prompt (meme / no-signal mode)+```+Coin ONE original, funny, internet-native memecoin from current meme culture. Make the+ticker instantly memeable.+```++## Tasks (to improve quality)+1. **Few-shot calibration** — add 2–3 in-context examples of strong vs. weak coins to lift+ ticker punchiness (keep examples original, $THREE-safe).+2. **Originality + collision check** — verify the chosen name/symbol isn't an obvious clone:+ reject if it equals a known ticker or appears verbatim in the source narrative.+3. **Image identity** — the agent's avatar fronts the coin (handled by the launch step's+ `build-metadata`). Optionally generate a bespoke coin image from the narrative later.+4. **Self-grade loop** — an optional LLM-judge pass scoring memeability/originality/safety;+ regenerate once if below bar (bounded, never blocks the tick).+5. **Record provenance** — `trigger_detail` already stores `top_narrative`, `top_kind`,+ `top_sources`, `themes`; keep it accurate so the console can show "why this coin."++## Acceptance+- Trend mode produces an original coin clearly tied to the supplied top narrative, valid+ against pump.fun caps, as strict JSON.+- Any LLM failure degrades to `randomCoin()` — never a thrown tick.+- No output ever copies a real token's name/ticker or references a tragedy.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. User-visible change → `data/changelog.json` + `npm run build:pages`. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/prompts/memetic-launcher/03-launch-engine.md b/prompts/memetic-launcher/03-launch-engine.mdnew file mode 100644index 000000000..3b7e38d9d--- /dev/null+++ b/prompts/memetic-launcher/03-launch-engine.md@@ -0,0 +1,61 @@+# 03 · Launch Engine++## Mission+Fire launches **autonomously on a cadence**, exactly like the tips circulation engine —+pick a coin, pick an agent, fund it, let the agent sign its own pump.fun create, record+everything, advance the rotation. Bounded by hard caps and a circuit breaker. Never throws.++## Context+- Engine: `api/_lib/launcher-engine.js` → `runLauncherTick()`. Mirrors `runCirculationTick()`.+- Cron: `api/cron/launcher-tick.js` (CRON_SECRET-gated), scheduled `* * * * *` in `vercel.json`.+- Schema (migration `20260629060000_coin_launcher.sql`, also self-ensured in the engine):+ - `launcher_config` — one `global` row + one per `user`; the master switches + economics.+ - `launcher_queue` — the agent rotation (oldest-launched first, weighted).+ - `launcher_runs` — append-only audit; every attempt, status, cost, mint.+- Funding: `api/_lib/launcher-funding.js` (`masterBalanceSol`, `dailySpentSol`, `fundAgentForLaunch`).+- The mint itself reuses the real human path: `POST /api/pump?action=build-metadata` then+ `?action=launch-agent` via an authenticated session as the agent's owner (`postAs`).++## The tick (per enabled scope)+1. **Gate** — skip if `paused` (breaker) or `mode='off'`.+2. **Cadence** — skip unless `target_cadence_seconds` elapsed since the last real attempt.+3. **Hourly cap** — skip if `max_per_hour` reached in the trailing hour.+4. **Daily SOL cap** — compute remaining `daily_sol_cap`; skip if exhausted (real runs only).+5. **Rotation** — `ensureQueue` (auto-enrol avatar-bearing pool agents) → `pickAgent`+ (least-recently-used, weighted, must have avatar + wallet).+6. **Coin** — `pickSource({mode, network, categories, sources})` (narrative-driven).+7. **Record** — insert a `pending` `launcher_runs` row.+8. **dry_run?** → mark `dry_run`, bump rotation, stop (zero SOL moved).+9. **Master balance** — if below `per_launch_sol + buffer`, record `skipped` (recoverable wait).+10. **Fund** — `fundAgentForLaunch` master→agent (per-launch + daily caps) → `funded`.+11. **Launch** — agent signs its own create → `confirmed` with `mint` + `tx_signature`;+ bump `launcher_queue.last_launched_at` + `launch_count`.+12. **Failure** — `failed` + error; advance rotation anyway (no wedging); trip the breaker+ after `FAIL_BREAK` consecutive failures.++## Arming (operator)+- Default global row is `enabled=false, dry_run=true` — provably inert.+- Required env: `CRON_SECRET`; a master wallet (`LAUNCHER_MASTER_SECRET_KEY_B64`, falling back+ to `PUMP_X402_LAUNCHER_SECRET_KEY_B64`); LLM keys for trend/meme modes (else random filler).+- Arm sequence: set `mode`, `sources`, economics → run in `dry_run` and watch `launcher_runs`+ → flip `dry_run=false` with conservative caps → raise `max_per_hour` / lower cadence to scale.++## Tasks (to finish / harden)+1. **Apply the migration** (`20260629060000_coin_launcher.sql`) in every env; the engine also+ self-ensures the schema so it runs pre-migration.+2. **Enrol/curate the rotation** — global draws from the circulation pool; expose weighting so+ higher-performing avatars launch more often.+3. **Confirm-on-chain** — optionally poll the mint/signature to upgrade `launched`→`confirmed`+ only after on-chain finality (today the launch-agent response is trusted).+4. **Tune cadence/caps for #1-deployer scale** — once stable, push cadence down and+ `max_per_hour` up within the daily SOL ceiling.++## Acceptance+- With no enabled config, a tick is a no-op (`note: 'no enabled launcher config'`).+- In `dry_run`, ticks select coin+agent and write `dry_run` rows; **zero** SOL moves.+- Armed, a tick funds an agent and produces a real mint recorded in `launcher_runs` and+ surfaced in `/launches` + the money feed; caps and breaker observably hold.+- The tick never throws; every scope is isolated and every outcome recorded.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. `vercel.json`/migrations are deploy-time. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/prompts/memetic-launcher/04-creator-rewards.md b/prompts/memetic-launcher/04-creator-rewards.mdnew file mode 100644index 000000000..f2f41d7b6--- /dev/null+++ b/prompts/memetic-launcher/04-creator-rewards.md@@ -0,0 +1,49 @@+# 04 · Creator Rewards & Reinvest++## Mission+Close the money loop. Launching is only half the game — the revenue is in **pump.fun+creator rewards**. Each launching agent must claim its accrued fees on a schedule, route a+configurable share into **$THREE buyback-and-burn**, and reinvest the rest to fund the next+wave of launches. This is what turns "we deploy a lot" into "we make a lot."++## Context+- Per-launch coin records: `agent_launched_coins` (per-agent launcher) and `launcher_runs`+ (global engine) — both carry the `mint` and the launching `agent_id`.+- An auto-claimer already exists for the per-agent path: `workers/agent-sniper/auto-claimer.js`.+- Claim plumbing: `api/_lib/pump-claims.js`; the pump action surface in `api/pump/[action].js`.+- `launcher_config.buyback_bps` (0–10000) = the share of fees routed to $THREE buyback.+- Per-agent config also has `auto_claim_enabled`, `auto_claim_threshold_sol`,+ `auto_claim_reinvest_pct`.++## The loop (per launching agent, on a cadence)+1. **Detect claimable** — query accrued creator rewards for each of the agent's live mints.+2. **Threshold** — only claim once accrued ≥ `auto_claim_threshold_sol` (avoid dust + fees).+3. **Claim** — the agent signs its own claim (same identity that created the coin).+4. **Split** — route `buyback_bps` into $THREE buyback-and-burn (real swap, real burn);+ keep the remainder.+5. **Reinvest** — return `reinvest_pct` of the kept SOL to the launcher master so it funds+ the next launches; the rest accrues to the agent's wallet as earnings.+6. **Record** — log the claim, the buyback signature, and the reinvest transfer so the+ console shows realized revenue, not just launch counts.++## Tasks+1. **Global-engine claimer** — extend/clone the auto-claimer to walk `launcher_runs` mints for+ the global scope (not just `agent_launched_coins`), honouring `buyback_bps`.+2. **$THREE buyback wiring** — execute the buyback through the platform's real trade/burn path+ (never a mock); record the burn tx. $THREE only — never any other mint.+3. **Reinvest transfer** — agent → master top-up so the launcher is self-funding at steady+ state; expose `reinvest_pct` in config.+4. **Revenue accounting** — a rollup of claimed SOL, $THREE bought/burned, and net agent+ earnings per day, surfaced in the admin console (prompt 05).+5. **Safety** — claims/buybacks are real money; reuse the spend-cap/firewall guards and the+ same circuit-breaker discipline as the launch engine.++## Acceptance+- Live mints with accrued rewards above threshold get claimed automatically by the owning agent.+- `buyback_bps` of claimed fees is provably swapped into $THREE and burned (real signatures).+- Reinvest tops the master back up; the loop is self-sustaining under steady launching.+- The console shows realized revenue (claimed SOL, $THREE burned, net earnings), all from real+ on-chain data — no estimates presented as fact.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) — buyback-and-burn is $THREE and nothing else. Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. User-visible change → `data/changelog.json` + `npm run build:pages`. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/prompts/memetic-launcher/05-admin-console.md b/prompts/memetic-launcher/05-admin-console.mdnew file mode 100644index 000000000..3213e3aca--- /dev/null+++ b/prompts/memetic-launcher/05-admin-console.md@@ -0,0 +1,50 @@+# 05 · Admin Console & Observability++## Mission+Give an operator a single surface to **arm, watch, and stop** the autonomous launcher with+total confidence — see what it's about to do, what it did, what it earned, and kill it+instantly. A money-moving autonomous system without a great console is a liability.++## Context+- Engine + data: `launcher-engine.js`, tables `launcher_config` / `launcher_queue` / `launcher_runs`.+- Cron: `/api/cron/launcher-tick` (`* * * * *`). Tips analogue lives under the systems admin panel+ (see `api/admin/all-systems.js`, `src/dashboard-next/pages/systems.js`) — follow that pattern.+- Read endpoints to add (admin-auth): config get/set, live runs feed, aggregate metrics.++## Surfaces to build+1. **Config panel** — edit the global row (and per-user rows): `enabled`, `dry_run`, `mode`,+ `sources` (toggle coin_intel / trending / x / hackernews / reddit / wikipedia), `categories`,+ `target_cadence_seconds`, `max_per_hour`, `per_launch_sol`, `dev_buy_sol`, `daily_sol_cap`,+ `buyback_bps`, `network`. A prominent **Arm / Disarm** and **dry-run** toggle.+2. **Live runs feed** — stream `launcher_runs` newest-first: status pill+ (pending/dry_run/funded/launched/confirmed/skipped/failed), coin name+ticker, the agent, the+ **why** (`trigger_detail.top_narrative` + confirming sources), SOL spent, mint + tx links.+3. **Headline metrics** — launches today / this hour, success rate, SOL spent vs. daily cap,+ master wallet balance, realized creator revenue + $THREE burned (prompt 04), breaker state.+4. **Narrative preview** — render the current `rankNarratives` output (what it would launch into+ next) so an operator sees the zeitgeist the engine is reading.+5. **Kill switch + breaker** — one-click pause (sets `paused`), clear-breaker, and per-agent+ disable in `launcher_queue`.++## States (design every one)+- **Disarmed** — clear "inert, nothing will fire" with the exact arm steps.+- **Dry-run** — runs flowing but labelled "no SOL moved."+- **Armed/healthy** — cadence, caps, balance, revenue all green.+- **Breaker tripped** — loud banner with the failure reason and a clear-and-resume action.+- **Empty** — no runs yet → what to do next. **Error** — endpoint/RPC down → actionable, not blank.++## Tasks+1. Build admin read/write endpoints for config, runs, and metrics (reuse admin auth + rate limits).+2. Build the console page in the dashboard-next systems panel, monochrome + token-driven, every+ state designed, real data only.+3. Wire the narrative preview to `rankNarratives` (cached) and the revenue rollup to prompt 04.+4. Add the changelog entry when this ships user-visibly.++## Acceptance+- An operator can arm in dry-run, watch real runs, flip to live with caps, and kill instantly —+ without touching SQL.+- Every number is real (DB / on-chain); no placeholders, no fake progress.+- Breaker and caps are visible and enforceable from the UI; the kill switch is immediate.++---+### Operating rules — read CLAUDE.md + STRUCTURE.md first. No mocks/fake data/stubs. Real APIs only. $THREE only (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Use design tokens (`public/tokens.css`); monochrome on near-black. Stage explicit paths; never `git add -A`. Don't commit `api/*.js` bundles. User-visible change → `data/changelog.json` + `npm run build:pages`. Push both remotes when asked; never pull from `threeD`. DoD = CLAUDE.md checklist.diff --git a/public/changelog.json b/public/changelog.jsonindex 12c8c334e..0e1bc5e04 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-27T09:28:30.904Z",+ "generated_at": "2026-06-27T10:03:23.024Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -26,6 +26,16 @@"launch"]},+ {+ "date": "2026-06-27",+ "type": "launch",+ "title": "On-chain Deployments",+ "summary": "A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.",+ "link": "/deployments",+ "tags": [+ "launch"+ ]+ },{"date": "2026-06-27","type": "launch",@@ -120,6 +130,17 @@"feature"]},+ {+ "date": "2026-06-27",+ "type": "update",+ "title": "Money Pulse redesign — monochrome, with far more live data",+ "summary": "The live activity page at /pulse got a full pass. It's now proper monochrome to match the rest of the site — the violet accent and green/amber feed colors give way to a single clean ink ramp. And it carries a lot more real signal: 24h on-chain volume (SOL + USD), distinct active wallets, and split counters for trades, snipes, and agent-to-agent payments, plus a 7-day activity sparkline, the day's single biggest tip, and a fresh-launches feed alongside the existing top-earners and busiest-wallets boards. Every number is a real on-chain or launch record — never synthetic.",+ "link": "/pulse",+ "tags": [+ "improvement",+ "feature"+ ]+ },{"date": "2026-06-27","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex cde681e48..3aa861c99 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -22,6 +22,14 @@<category>launch</category><description>Mission control — real-time grid of all AI agents with active screen streams. Watch their screens and avatar feeds live.</description></item>+ <item>+ <title>On-chain Deployments</title>+ <link>https://three.ws/deployments</link>+ <guid isPermaLink="false">2026-06-27:On-chain Deployments</guid>+ <pubDate>Sat, 27 Jun 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.</description>+ </item><item><title>Partner Ecosystem</title><link>https://three.ws/partners</link>@@ -94,6 +102,14 @@<category>feature</category><description>AWS Marketplace subscribers (and anyone with an x402 subscription key) now have a home for it at /billing/keys. See every key with its billing source — AWS Marketplace or on-chain — live status, rate limit, total calls, and when it was last used. Rotate a key to get a fresh secret in one click (AWS-billed keys stay linked to your AWS account and keep metering correctly), or revoke a native key outright. The post-subscribe welcome flow now points here, so a lost key is always recoverable by rotating instead of being stuck.</description></item>+ <item>+ <title>Money Pulse redesign — monochrome, with far more live data</title>+ <link>https://three.ws/pulse</link>+ <guid isPermaLink="false">2026-06-27:Money Pulse redesign — monochrome, with far more live data</guid>+ <pubDate>Sat, 27 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The live activity page at /pulse got a full pass. It's now proper monochrome to match the rest of the site — the violet accent and green/amber feed colors give way to a single clean ink ramp. And it carries a lot more real signal: 24h on-chain volume (SOL + USD), distinct active wallets, and split counters for trades, snipes, and agent-to-agent payments, plus a 7-day activity sparkline, the day's single biggest tip, and a fresh-launches feed alongside the existing top-earners and busiest-wallets boards. Every number is a real on-chain or launch record — never synthetic.</description>+ </item><item><title>Partner ecosystem page</title><link>https://three.ws/partners</link>diff --git a/public/features.json b/public/features.jsonindex e178e644b..7dd07a83b 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-27T09:28:30.845Z",+ "generated_at": "2026-06-27T10:03:23.003Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -876,6 +876,16 @@"tags": [],"showcase": false},+ {+ "path": "/deployments",+ "title": "On-chain Deployments",+ "description": "A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.",+ "added": "2026-06-27",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": false+ },{"path": "/clash","title": "Coin Clash",diff --git a/public/llms-full.txt b/public/llms-full.txtindex e61b888af..765d8636a 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -534,6 +534,12 @@ URL: https://three.ws/pulseThe Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.+### On-chain Deployments++URL: https://three.ws/deployments++A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.+### Coin ClashURL: https://three.ws/clashdiff --git a/public/llms.txt b/public/llms.txtindex 072a4011e..11747b2ab 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -107,6 +107,7 @@ On-chain features: pay-per-call, token launches, vanity wallets.- [Agent Launches](https://three.ws/launches): Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.- [Live Trading Theater](https://three.ws/theater): Watch agents trade in 3D, in real time. Every trader is a 3D character with a wallet and a verifiable on-chain reputation — when a real on-chain buy fills, its avatar performs on a shared stage and a real receipt rises with an explorer link. Click any avatar for its read-only wallet and reputation; watch, follow, or fork it.- [Money Pulse](https://three.ws/pulse): The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.+- [On-chain Deployments](https://three.ws/deployments): A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.- [Coin Clash](https://three.ws/clash): Token-gated community warfare. Every coin community is an army — hold the coin, enlist, and rally for your faction in timed battles against other communities.- [Trader Leaderboard](https://three.ws/leaderboard): Pump.fun traders ranked by a provable, on-chain track record — realized P&L, win rate, drawdown — with every number traceable to its transaction.- [Custody Integrity](https://three.ws/integrity): Provable, on-chain-anchored custody for every three.ws agent wallet. The platform commits a Merkle root over every wallet's on-chain state to Solana — verify the latest root yourself, no account required.diff --git a/public/nav-data.js b/public/nav-data.jsindex fd44e6fdd..1c2dc41be 100644--- a/public/nav-data.js+++ b/public/nav-data.js@@ -123,6 +123,12 @@ export const NAV_GROUPS = [badge: 'New',desc: 'Live, platform-wide feed of real agent wallet activity — tips, launches, trades & payments',},+ {+ title: 'On-chain Deployments',+ href: '/deployments',+ badge: 'New',+ desc: 'Live cross-chain feed of every agent registered on the ERC-8004 Identity Registry, as it lands on-chain',+ },{title: 'Copy Trading',href: '/mirror',diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex a10fd47cc..94dbef019 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -65,7 +65,7 @@<main class="sm-wrap"><div class="sm-hero"><h1>Sitemap</h1>- <p>All 347 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>+ <p>All 348 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p><div class="sm-formats"><a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a><a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>@@ -77,7 +77,7 @@</div><div class="sm-filter"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>- <input id="sm-filter-input" type="search" placeholder="Filter 347 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />+ <input id="sm-filter-input" type="search" placeholder="Filter 348 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" /><kbd aria-hidden="true">/</kbd></div><p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>@@ -648,7 +648,7 @@<section class="sm-section" id="crypto"><header>- <h2>Crypto<span class="sm-count" data-count>70</span></h2>+ <h2>Crypto<span class="sm-count" data-count>71</span></h2><p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p></header><ul class="sm-list">@@ -715,6 +715,13 @@<span class="sm-desc">The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.</span></a></li>+ <li>+ <a href="/deployments">+ <span class="sm-title">On-chain Deployments</span>+ <span class="sm-path">/deployments</span>+ <span class="sm-desc">A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.</span>+ </a>+ </li><li><a href="/clash"><span class="sm-title">Coin Clash</span>diff --git a/src/deployments.css b/src/deployments.cssnew file mode 100644index 000000000..35de50f6e--- /dev/null+++ b/src/deployments.css@@ -0,0 +1,121 @@+/* /deployments — on-chain agent deployment feed. Monochrome on near-black, same+ palette as the rest of the site: the white --ink / --accent ramp only, no+ brand colour. Mirrors the /pulse chrome so the two live feeds feel like one+ product. */++.dp-shell { max-width: 1080px; margin: 0 auto; padding: var(--space-xl, 40px) var(--space-md, 16px) var(--space-2xl, 64px); }++/* Hero */+.dp-hero { text-align: center; margin-bottom: var(--space-xl, 40px); }+.dp-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-2xs, .68rem); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim, #888); margin: 0 0 var(--space-sm, 12px); }+.dp-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-bright, #fff); box-shadow: 0 0 0 0 rgba(255,255,255,.6); animation: dp-ping 2.4s ease infinite; }+@keyframes dp-ping { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45);} 70% { box-shadow: 0 0 0 8px rgba(255,255,255,0);} 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0);} }+.dp-title { font-family: var(--font-display, 'Space Grotesk', sans-serif); font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 700; line-height: 1.02; margin: 0 0 var(--space-sm, 12px); color: var(--ink-dim, #999); letter-spacing: -.02em; }+.dp-title em { font-style: normal; color: var(--ink-bright, #fff); }+.dp-sub { max-width: 640px; margin: 0 auto; color: var(--ink-dim, #999); font-size: var(--text-lg, 1.02rem); line-height: 1.5; }+.dp-sub strong { color: var(--ink, #e8e8e8); font-weight: 600; }++/* Network toggle */+.dp-net { display: inline-flex; gap: 2px; margin-top: var(--space-md, 16px); padding: 3px; background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-pill, 999px); }+.dp-net-btn { appearance: none; font: inherit; font-size: var(--text-sm, .8rem); font-weight: 500; cursor: pointer; color: var(--ink-dim, #888); background: transparent; border: none; border-radius: var(--radius-pill, 999px); padding: 6px 16px; transition: color .14s ease, background .14s ease; }+.dp-net-btn:hover { color: var(--ink, #e8e8e8); }+.dp-net-btn.active { color: var(--ink-bright, #fff); background: var(--surface-3, rgba(255,255,255,.08)); }+.dp-net-btn:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }++/* Headline counters */+.dp-counters { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-sm, 12px); margin: var(--space-xl, 40px) 0 var(--space-md, 16px); }+.dp-counter { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07)); border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px) var(--space-sm, 12px); text-align: center; min-width: 0; transition: border-color .14s ease; }+.dp-counter:hover { border-color: var(--stroke-strong, rgba(255,255,255,.14)); }+.dp-counter--lead { background: var(--surface-2, rgba(255,255,255,.05)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }+.dp-counter dt { font-size: var(--text-2xs, .68rem); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim, #888); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.dp-counter dd { margin: 0; font-family: var(--font-mono, monospace); font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; color: var(--ink-bright, #fff); line-height: 1.05; }+.dp-counter-sub { display: block; margin-top: 5px; font-size: var(--text-2xs, .66rem); font-weight: 500; color: var(--ink-dim, #888); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }++/* 7-day sparkline */+.dp-spark { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07)); border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px) var(--space-lg, 22px); margin: 0 0 var(--space-xl, 40px); }+.dp-spark-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--space-md, 16px); }+.dp-spark-title { font-size: var(--text-sm, .8rem); font-weight: 600; color: var(--ink, #e8e8e8); text-transform: uppercase; letter-spacing: .06em; }+.dp-spark-total { font-family: var(--font-mono, monospace); font-size: var(--text-sm, .8rem); color: var(--ink-faint, #666); }+.dp-spark-bars { display: flex; align-items: flex-end; gap: 8px; height: 72px; padding-bottom: 20px; }+.dp-spark-col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }+.dp-spark-bar { width: 100%; min-height: 4px; background: var(--surface-3, rgba(255,255,255,.08)); border-radius: 4px 4px 0 0; transition: background .14s ease; }+.dp-spark-col:hover .dp-spark-bar { background: var(--ink, #e8e8e8); }+.dp-spark-col--now .dp-spark-bar { background: var(--ink-bright, #fff); }+.dp-spark-lbl { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; font-size: var(--text-2xs, .62rem); color: var(--ink-faint, #666); }++/* Layout */+.dp-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-lg, 24px); align-items: start; }+.dp-main { min-width: 0; }+.dp-feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-md, 16px); flex-wrap: wrap; }+.dp-section-h { font-family: var(--font-display, sans-serif); font-size: var(--text-lg, 1.05rem); font-weight: 600; color: var(--ink-bright, #fff); margin: 0; }++/* Filter pills */+.dp-filters { display: inline-flex; gap: 4px; }+.dp-filter { appearance: none; font: inherit; font-size: var(--text-sm, .78rem); font-weight: 500; cursor: pointer; color: var(--ink-dim, #888); background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-pill, 999px); padding: 5px 13px; transition: color .14s ease, background .14s ease, border-color .14s ease; }+.dp-filter:hover { color: var(--ink, #e8e8e8); background: var(--surface-2, rgba(255,255,255,.05)); }+.dp-filter.active { color: var(--ink-bright, #fff); background: var(--surface-3, rgba(255,255,255,.08)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }+.dp-filter:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }++/* Feed rows */+#dp-feed { display: flex; flex-direction: column; gap: 8px; }+.dp-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.06)); border-radius: var(--radius-md, 10px); transition: background .14s ease, border-color .14s ease; }+.dp-row:hover { background: var(--surface-2, rgba(255,255,255,.05)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }+.dp-av { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; object-fit: cover; background: var(--surface-3, rgba(255,255,255,.08)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); }+.dp-av--mono { display: grid; place-items: center; font-weight: 600; color: var(--ink-dim, #888); font-size: .85rem; }+.dp-row-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }+.dp-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }+.dp-row-name { font-size: var(--text-md, .85rem); font-weight: 600; color: var(--ink-bright, #fff); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }+a.dp-row-name:hover { text-decoration: underline; }+.dp-row-meta { display: flex; align-items: center; gap: 8px; font-size: var(--text-2xs, .68rem); color: var(--ink-faint, #666); min-width: 0; }+.dp-chip { font-size: var(--text-2xs, .64rem); font-weight: 600; letter-spacing: .03em; color: var(--ink-dim, #aaa); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-sm, 6px); padding: 1px 7px; white-space: nowrap; }+.dp-owner { font-family: var(--font-mono, monospace); color: var(--ink-faint, #666); text-decoration: none; }+.dp-owner:hover { color: var(--ink, #e8e8e8); }+.dp-tag { font-size: var(--text-2xs, .6rem); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim, #aaa); border: 1px solid var(--stroke-strong, rgba(255,255,255,.14)); border-radius: var(--radius-sm, 6px); padding: 1px 6px; flex: 0 0 auto; }+.dp-tag--3d { color: var(--ink-bright, #fff); border-color: var(--stroke-strong, rgba(255,255,255,.22)); }+.dp-row-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }+.dp-time { font-family: var(--font-mono, monospace); font-size: var(--text-2xs, .66rem); color: var(--ink-dim, #888); white-space: nowrap; }+.dp-tx { font-size: var(--text-2xs, .66rem); color: var(--ink-faint, #666); text-decoration: none; white-space: nowrap; }+.dp-tx:hover { color: var(--ink-bright, #fff); }++/* Load more */+.dp-more { display: block; width: 100%; margin-top: 12px; font: inherit; font-size: var(--text-sm, .8rem); font-weight: 500; cursor: pointer; color: var(--ink, #e8e8e8); background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md, 10px); padding: 10px; transition: background .14s ease; }+.dp-more:hover { background: var(--surface-2, rgba(255,255,255,.05)); }+.dp-more:disabled { opacity: .5; cursor: progress; }+.dp-more:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }++/* Skeleton / empty / error */+.dp-skeleton { height: 62px; border-radius: var(--radius-md, 10px); background: linear-gradient(90deg, var(--surface-1, rgba(255,255,255,.03)) 25%, var(--surface-2, rgba(255,255,255,.06)) 37%, var(--surface-1, rgba(255,255,255,.03)) 63%); background-size: 400% 100%; animation: dp-shimmer 1.4s ease infinite; margin-bottom: 8px; }+@keyframes dp-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }+.dp-empty, .dp-error { text-align: center; padding: var(--space-xl, 40px) var(--space-md, 16px); color: var(--ink-dim, #888); border: 1px dashed var(--stroke, rgba(255,255,255,.12)); border-radius: var(--radius-lg, 14px); }+.dp-empty-title { color: var(--ink-bright, #fff); font-weight: 600; margin-bottom: 4px; }+.dp-empty-sub a, .dp-error a { color: var(--ink-bright, #fff); }+.dp-retry { appearance: none; font: inherit; cursor: pointer; color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke-strong, rgba(255,255,255,.14)); border-radius: var(--radius-sm, 6px); padding: 3px 10px; margin-left: 4px; }+.dp-retry:hover { background: var(--surface-3, rgba(255,255,255,.08)); }++/* Rail */+.dp-rail { position: sticky; top: 80px; display: flex; flex-direction: column; gap: var(--space-lg, 24px); }+.dp-card { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07)); border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px); }+.dp-card-h { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm, .8rem); font-weight: 600; color: var(--ink-bright, #fff); margin-bottom: var(--space-sm, 12px); }+.dp-card-h small { font-weight: 400; color: var(--ink-faint, #666); font-size: var(--text-2xs, .66rem); }+.dp-lb-empty { color: var(--ink-dim, #888); font-size: var(--text-sm, .8rem); padding: 8px; }++/* Top-chains mini bars */+.dp-chain-row { display: grid; grid-template-columns: 1fr 64px auto; align-items: center; gap: 10px; padding: 5px 0; }+.dp-chain-name { font-size: var(--text-sm, .78rem); color: var(--ink, #e8e8e8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.dp-chain-bar { height: 6px; border-radius: 999px; background: var(--surface-3, rgba(255,255,255,.08)); overflow: hidden; }+.dp-chain-bar span { display: block; height: 100%; background: var(--ink-bright, #fff); border-radius: 999px; }+.dp-chain-n { font-family: var(--font-mono, monospace); font-size: var(--text-2xs, .68rem); color: var(--ink-dim, #888); text-align: right; }++.dp-about-body { margin: 0; font-size: var(--text-sm, .8rem); line-height: 1.5; color: var(--ink-dim, #999); }+.dp-about-body a { color: var(--ink-bright, #fff); }+.dp-fineprint { font-size: var(--text-2xs, .68rem); text-align: left; margin: 0; color: var(--ink-faint, #666); line-height: 1.5; }+.dp-fineprint code { font-family: var(--font-mono, monospace); color: var(--ink-dim, #888); }++@media (max-width: 880px) {+ .dp-grid { grid-template-columns: 1fr; }+ .dp-rail { position: static; }+ .dp-counters { grid-template-columns: repeat(3, 1fr); }+}+@media (max-width: 520px) {+ .dp-counters { grid-template-columns: repeat(2, 1fr); }+}diff --git a/src/deployments.js b/src/deployments.jsnew file mode 100644index 000000000..962e40ab7--- /dev/null+++ b/src/deployments.js@@ -0,0 +1,261 @@+/**+ * /deployments — the on-chain agent deployment feed. Every row is a real+ * agent registered on the ERC-8004 Identity Registry, served by GET+ * /api/deployments. No synthetic entries — if a network is quiet, the feed is+ * honestly empty.+ *+ * Data flow:+ * GET /api/deployments?view=stats&network= headline counters + top chains + 7d series+ * GET /api/deployments?network=&kind=&cursor= keyset-paginated live feed+ */++import { createLogger } from './shared/log.js';++const log = createLogger('deployments');++const state = {+ network: 'mainnet',+ kind: 'all',+ cursor: null,+ items: [],+ hasMore: false,+ loading: false,+ paged: false, // true once the user loads older pages — pauses live top-refresh+};++const $ = (id) => document.getElementById(id);+const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));++function fmtNum(n) {+ const v = Number(n) || 0;+ if (v >= 1_000_000) return `${(v / 1_000_000).toFixed(1)}M`;+ if (v >= 10_000) return `${(v / 1000).toFixed(1)}k`;+ return String(v);+}++function shortAddr(a) {+ if (!a) return '';+ const s = String(a);+ return s.length > 12 ? `${s.slice(0, 6)}…${s.slice(-4)}` : s;+}++function timeAgo(iso) {+ const t = new Date(iso).getTime();+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, Math.round((Date.now() - t) / 1000));+ if (s < 60) return 'just now';+ const m = Math.round(s / 60);+ if (m < 60) return `${m}m ago`;+ const h = Math.round(m / 60);+ if (h < 24) return `${h}h ago`;+ const d = Math.round(h / 24);+ if (d < 30) return `${d}d ago`;+ const mo = Math.round(d / 30);+ if (mo < 12) return `${mo}mo ago`;+ return `${Math.round(mo / 12)}y ago`;+}++// ── stats ─────────────────────────────────────────────────────────────────────+async function loadStats() {+ try {+ const res = await fetch(`/api/deployments?view=stats&network=${state.network}`, { headers: { accept: 'application/json' } });+ if (!res.ok) throw new Error(`stats ${res.status}`);+ const { data } = await res.json();+ renderStats(data);+ } catch (e) {+ log.warn('stats failed', e?.message);+ }+}++function renderStats(d) {+ $('dp-c-total').textContent = fmtNum(d.total_agents ?? 0);+ $('dp-c-chains').textContent = String(d.active_chains ?? 0);+ $('dp-c-d24').textContent = fmtNum(d.deployed_24h ?? 0);+ $('dp-c-d7').textContent = fmtNum(d.deployed_7d ?? 0);+ $('dp-c-3d').textContent = `${d.with_3d_pct ?? 0}%`;+ $('dp-c-3d-sub').textContent = `${fmtNum(d.with_3d ?? 0)} rigged agents`;+ $('dp-c-x402').textContent = `${d.x402_pct ?? 0}%`;+ $('dp-c-x402-sub').textContent = `${fmtNum(d.x402 ?? 0)} accept payments`;++ renderSparkline(d.series_7d);+ renderTopChains(d.top_chains);+}++// 7-day registration sparkline. Bars scale to the busiest day; today highlighted.+function renderSparkline(series) {+ const host = $('dp-spark-bars');+ const totalEl = $('dp-spark-total');+ if (!host) return;+ const days = Array.isArray(series) ? series : [];+ const total = days.reduce((s, d) => s + (d.registrations || 0), 0);+ if (totalEl) totalEl.textContent = `${fmtNum(total)} registration${total === 1 ? '' : 's'}`;+ if (!days.length) { host.innerHTML = `<p class="dp-lb-empty">No registrations yet.</p>`; return; }+ const peak = Math.max(1, ...days.map((d) => d.registrations || 0));+ host.innerHTML = days+ .map((d, i) => {+ const n = d.registrations || 0;+ const h = Math.max(4, Math.round((n / peak) * 100));+ const today = i === days.length - 1;+ return (+ `<div class="dp-spark-col${today ? ' dp-spark-col--now' : ''}" title="${esc(d.day)}: ${n} registration${n === 1 ? '' : 's'}">` ++ `<div class="dp-spark-bar" style="height:${h}%"></div>` ++ `<span class="dp-spark-lbl">${esc(d.label)}</span>` ++ `</div>`+ );+ })+ .join('');+}++function renderTopChains(chains) {+ const host = $('dp-chains');+ if (!host) return;+ if (!chains?.length) {+ host.innerHTML = `<p class="dp-lb-empty">No registrations on this network yet.</p>`;+ return;+ }+ const peak = Math.max(1, ...chains.map((c) => c.count || 0));+ host.innerHTML = chains+ .map((c) => {+ const pct = Math.max(3, Math.round(((c.count || 0) / peak) * 100));+ return (+ `<div class="dp-chain-row">` ++ `<span class="dp-chain-name">${esc(c.chain)}</span>` ++ `<span class="dp-chain-bar"><span style="width:${pct}%"></span></span>` ++ `<span class="dp-chain-n">${fmtNum(c.count)}</span>` ++ `</div>`+ );+ })+ .join('');+}++// ── feed ───────────────────────────────────────────────────────────────────────+async function loadFeed(reset) {+ if (state.loading) return;+ state.loading = true;+ if (reset) { state.cursor = null; state.items = []; state.paged = false; }+ const more = $('dp-more');+ if (more) more.disabled = true;++ const host = $('dp-feed');+ if (reset && host && !host.children.length) host.innerHTML = skeleton();++ try {+ const params = new URLSearchParams({ network: state.network });+ if (state.kind !== 'all') params.set('kind', state.kind);+ if (state.cursor) params.set('cursor', state.cursor);+ const res = await fetch(`/api/deployments?${params}`, { headers: { accept: 'application/json' } });+ if (!res.ok) throw new Error(`feed ${res.status}`);+ const { data } = await res.json();+ state.items = reset ? data.deployments : state.items.concat(data.deployments);+ state.cursor = data.next_cursor;+ state.hasMore = !!data.has_more;+ renderFeed();+ } catch (e) {+ log.warn('feed failed', e?.message);+ if (reset && host) {+ host.innerHTML = `<div class="dp-error"><div class="dp-empty-title">Couldn’t reach the registry</div><p>The deployment feed is reconnecting. <button type="button" class="dp-retry" id="dp-retry">Retry</button></p></div>`;+ $('dp-retry')?.addEventListener('click', () => loadFeed(true));+ }+ } finally {+ state.loading = false;+ const m = $('dp-more');+ if (m) { m.disabled = false; m.hidden = !state.hasMore; }+ }+}++function skeleton() {+ return Array.from({ length: 6 }).map(() => `<div class="dp-skeleton"></div>`).join('');+}++function rowHTML(r) {+ const av = r.image+ ? `<img class="dp-av" src="${esc(r.image)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`+ : `<span class="dp-av dp-av--mono" aria-hidden="true">${esc((r.name || '#').charAt(0).toUpperCase())}</span>`;+ const title = r.name || `Agent #${esc(r.agent_id)}`;+ const nameEl = r.agent_explorer+ ? `<a class="dp-row-name" href="${esc(r.agent_explorer)}" target="_blank" rel="noopener">${esc(title)}</a>`+ : `<span class="dp-row-name">${esc(title)}</span>`;+ const tags =+ (r.has_3d ? `<span class="dp-tag dp-tag--3d" title="Ships a 3D avatar">3D</span>` : '') ++ (r.x402_support ? `<span class="dp-tag dp-tag--x402" title="Accepts x402 payments">x402</span>` : '');+ const tx = r.tx_explorer ? `<a class="dp-tx" href="${esc(r.tx_explorer)}" target="_blank" rel="noopener" title="Registration transaction">tx ↗</a>` : '';+ const owner = r.owner+ ? `<a class="dp-owner" href="${esc(r.owner_explorer)}" target="_blank" rel="noopener" title="Owner">${esc(shortAddr(r.owner))}</a>`+ : '';+ return (+ `<div class="dp-row">` ++ av ++ `<span class="dp-row-body">` ++ `<span class="dp-row-top">${nameEl}${tags}</span>` ++ `<span class="dp-row-meta"><span class="dp-chip">${esc(r.chain)}</span>${owner}</span>` ++ `</span>` ++ `<span class="dp-row-side"><span class="dp-time">${esc(timeAgo(r.registered_at))}</span>${tx}</span>` ++ `</div>`+ );+}++function renderFeed() {+ const host = $('dp-feed');+ if (!host) return;+ if (!state.items.length) {+ const what = state.kind === '3d' ? 'agents with a 3D avatar' : state.kind === 'x402' ? 'x402-enabled agents' : 'on-chain agents';+ host.innerHTML =+ `<div class="dp-empty"><div class="dp-empty-title">No ${esc(what)} yet</div>` ++ `<p class="dp-empty-sub">Nothing registered on ${esc(state.network)} for this filter. <a href="/app">Deploy the first one.</a></p></div>`;+ return;+ }+ host.innerHTML = state.items.map(rowHTML).join('');+}++// ── controls ────────────────────────────────────────────────────────────────────+function wireNetworkToggle() {+ for (const btn of document.querySelectorAll('[data-network]')) {+ btn.addEventListener('click', () => {+ const net = btn.dataset.network === 'testnet' ? 'testnet' : 'mainnet';+ if (net === state.network) return;+ state.network = net;+ for (const b of document.querySelectorAll('[data-network]')) {+ const on = b.dataset.network === net;+ b.classList.toggle('active', on);+ b.setAttribute('aria-selected', String(on));+ }+ $('dp-net-label').textContent = net;+ loadStats();+ loadFeed(true);+ });+ }+}++function wireFilters() {+ for (const btn of document.querySelectorAll('[data-kind]')) {+ btn.addEventListener('click', () => {+ const kind = btn.dataset.kind;+ if (kind === state.kind) return;+ state.kind = kind;+ for (const b of document.querySelectorAll('[data-kind]')) {+ const on = b.dataset.kind === kind;+ b.classList.toggle('active', on);+ b.setAttribute('aria-pressed', String(on));+ }+ loadFeed(true);+ });+ }+}++function init() {+ wireNetworkToggle();+ wireFilters();+ $('dp-more')?.addEventListener('click', () => { state.paged = true; loadFeed(false); });+ loadStats();+ loadFeed(true);+ // Live cadence: refresh stats, and reload the top of the feed only while the+ // user is still on the first page (never yank them back after loading older).+ setInterval(() => {+ if (document.hidden) return;+ loadStats();+ if (!state.paged) loadFeed(true);+ }, 45_000);+}++if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);+else init();diff --git a/src/pulse.css b/src/pulse.cssindex 4db1efaf6..23a58bab9 100644--- a/src/pulse.css+++ b/src/pulse.css@@ -1,10 +1,28 @@/* /pulse — the Money Pulse page. Feed styling lives in the shared component- (src/shared/money-pulse.js); this sheet is the page chrome + stats panel. */+ (src/shared/money-pulse.js); this sheet is the page chrome + stats panel.++ This page is intentionally MONOCHROME — it overrides the wallet violet accent+ (and the feed's green/amber semantics) to the site's ink ramp so the pulse+ reads as one calm, high-contrast surface. The scoped overrides at the bottom+ re-skin the shared feed component for this page only. */.px-shell {max-width: 1080px;margin: 0 auto;padding: var(--space-xl, 40px) var(--space-md, 16px) var(--space-2xl, 64px);+ /* Monochrome accent for everything inside the page, including the shared feed. */+ --px-accent: var(--ink-bright, #fff);+ --px-accent-soft: rgba(255, 255, 255, 0.08);+ /* Re-point the wallet-identity violet to the ink ramp so embedded wallet chips+ read monochrome on this page (the global wallet accent is untouched). */+ --wallet-accent: var(--ink, #e8e8e8);+ --wallet-accent-strong: var(--ink-bright, #fff);+ --wallet-accent-soft: rgba(255, 255, 255, 0.06);+ --wallet-accent-fill: rgba(255, 255, 255, 0.10);+ --wallet-stroke: rgba(255, 255, 255, 0.18);+ --wallet-stroke-strong: rgba(255, 255, 255, 0.30);+ --wallet-glow: rgba(255, 255, 255, 0.30);+ --wallet-focus: rgba(255, 255, 255, 0.60);}/* Hero */@@ -14,16 +32,17 @@font-size: var(--text-2xs, .68rem); letter-spacing: .14em; text-transform: uppercase;color: var(--ink-dim, #888); margin: 0 0 var(--space-sm, 12px);}-.px-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success, #4ade80);- box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: px-ping 2.4s ease infinite; }-@keyframes px-ping { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5);} 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0);} 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0);} }+.px-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-bright, #fff);+ box-shadow: 0 0 0 0 rgba(255,255,255,.6); animation: px-ping 2.4s ease infinite; }+@keyframes px-ping { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45);} 70% { box-shadow: 0 0 0 8px rgba(255,255,255,0);} 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0);} }.px-title {font-family: var(--font-display, 'Space Grotesk', sans-serif);font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 700; line-height: 1.02;margin: 0 0 var(--space-sm, 12px); color: var(--ink-bright, #fff); letter-spacing: -.02em;}-.px-title em { font-style: normal; color: var(--wallet-accent, #c4b5fd); }+.px-title em { font-style: normal; color: var(--ink-bright, #fff); }.px-sub { max-width: 620px; margin: 0 auto; color: var(--ink-dim, #999); font-size: var(--text-lg, 1.02rem); line-height: 1.5; }+.px-fineprint { font-size: var(--text-2xs, .68rem); text-align: left; margin: 0; color: var(--ink-faint, #666); }/* Network toggle */.px-net { display: inline-flex; gap: 2px; margin-top: var(--space-md, 16px); padding: 3px;@@ -34,15 +53,34 @@transition: color .14s ease, background .14s ease; }.px-net-btn:hover { color: var(--ink, #e8e8e8); }.px-net-btn.active { color: var(--ink-bright, #fff); background: var(--surface-3, rgba(255,255,255,.08)); }-.px-net-btn:focus-visible { outline: 2px solid var(--wallet-accent, #c4b5fd); outline-offset: 2px; }+.px-net-btn:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }-/* Headline counters */-.px-counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm, 12px); margin: var(--space-xl, 40px) 0; }+/* Headline counters — a tidy 3×2 grid; the volume lead is emphasised, not wider. */+.px-counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm, 10px); margin: var(--space-xl, 40px) 0 var(--space-md, 16px); }.px-counter { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07));- border-radius: var(--radius-lg, 14px); padding: var(--space-md, 18px); text-align: center; }-.px-counter dt { font-size: var(--text-2xs, .68rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #888); margin-bottom: 8px; }-.px-counter dd { margin: 0; font-family: var(--font-mono, monospace); font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 700; color: var(--ink-bright, #fff); }-.px-counter-sub { display: block; margin-top: 4px; font-family: var(--font-body, sans-serif); font-size: var(--text-2xs, .68rem); font-weight: 500; color: var(--wallet-accent, #c4b5fd); }+ border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px) var(--space-sm, 14px); text-align: center;+ transition: border-color .16s ease, background .16s ease; }+.px-counter:hover { border-color: var(--stroke-strong, rgba(255,255,255,.14)); background: var(--surface-2, rgba(255,255,255,.05)); }+.px-counter--lead { background: var(--surface-2, rgba(255,255,255,.05)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }+.px-counter dt { font-size: var(--text-2xs, .66rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #888); margin-bottom: 6px; }+.px-counter dd { margin: 0; font-family: var(--font-mono, monospace); font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 700; color: var(--ink-bright, #fff); line-height: 1.05; }+.px-counter--lead dd { color: var(--ink-bright, #fff); }+.px-counter-sub { display: block; margin-top: 4px; font-family: var(--font-body, sans-serif); font-size: var(--text-2xs, .66rem); font-weight: 500; color: var(--ink-dim, #888); }++/* 7-day sparkline */+.px-spark { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07));+ border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px); margin-bottom: var(--space-xl, 32px); }+.px-spark-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-sm, 12px); }+.px-spark-title { font-size: var(--text-2xs, .66rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #888); }+.px-spark-total { font-family: var(--font-mono, monospace); font-size: var(--text-sm, .8rem); font-weight: 700; color: var(--ink-bright, #fff); }+.px-spark-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 84px; }+.px-spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }+.px-spark-bar { width: 100%; max-width: 40px; border-radius: 4px 4px 2px 2px; background: rgba(255,255,255,.18);+ min-height: 4px; transition: background .16s ease, transform .16s ease; transform-origin: bottom; }+.px-spark-col:hover .px-spark-bar { background: var(--ink-dim, #aaa); }+.px-spark-col--now .px-spark-bar { background: var(--ink-bright, #fff); }+.px-spark-lbl { font-size: var(--text-2xs, .62rem); color: var(--ink-faint, #666); letter-spacing: .03em; }+.px-spark-col--now .px-spark-lbl { color: var(--ink, #e8e8e8); }/* Layout: feed + stats rail */.px-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-lg, 24px); align-items: start; }@@ -50,26 +88,44 @@.px-section-h { font-family: var(--font-display, sans-serif); font-size: var(--text-lg, 1.05rem); font-weight: 600; color: var(--ink-bright, #fff); margin: 0 0 var(--space-md, 16px); }/* Stats rail */-.px-rail { position: sticky; top: 80px; display: flex; flex-direction: column; gap: var(--space-lg, 24px); }+.px-rail { position: sticky; top: 80px; display: flex; flex-direction: column; gap: var(--space-lg, 20px); }.px-card { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07)); border-radius: var(--radius-lg, 14px); padding: var(--space-md, 16px); }+.px-card--hl { background: var(--surface-2, rgba(255,255,255,.05)); border-color: var(--stroke-strong, rgba(255,255,255,.14)); }.px-card-h { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm, .8rem); font-weight: 600; color: var(--ink-bright, #fff); margin-bottom: var(--space-sm, 12px); }.px-card-h small { font-weight: 400; color: var(--ink-faint, #666); font-size: var(--text-2xs, .66rem); }.px-lb-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md, 9px); text-decoration: none; color: inherit; transition: background .14s ease; }.px-lb-row:hover { background: var(--surface-2, rgba(255,255,255,.05)); }-.px-lb-row:focus-visible { outline: 2px solid var(--wallet-accent, #c4b5fd); outline-offset: 1px; }+.px-lb-row:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 1px; }.px-lb-av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface-3, rgba(255,255,255,.08)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); }.px-lb-av--mono { display: grid; place-items: center; font-weight: 600; color: var(--ink-dim, #888); font-size: .78rem; }.px-lb-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm, .8rem); font-weight: 600; color: var(--ink, #e8e8e8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.px-lb-name small { font-weight: 400; color: var(--ink-faint, #666); font-size: var(--text-2xs, .64rem); }.px-lb-chip { font-weight: 400; }-.px-lb-metric { flex: 0 0 auto; font-family: var(--font-mono, monospace); font-size: var(--text-sm, .8rem); font-weight: 700; color: var(--wallet-accent, #c4b5fd); text-align: right; }+.px-lb-metric { flex: 0 0 auto; font-family: var(--font-mono, monospace); font-size: var(--text-sm, .8rem); font-weight: 700; color: var(--ink-bright, #fff); text-align: right; }.px-lb-metric small { display: block; font-weight: 400; color: var(--ink-faint, #666); font-size: var(--text-2xs, .64rem); }.px-lb-empty, .px-stats-err { color: var(--ink-dim, #888); font-size: var(--text-sm, .8rem); padding: 8px; }+.px-lb-empty a { color: var(--ink-bright, #fff); }++/* ── Monochrome re-skin of the shared Money Pulse feed (this page only) ──+ The component defaults to the wallet violet; on /pulse we drive it to the+ ink ramp so tips/trades/launches read as one calm monochrome stream. */+.px-shell .mp { --mp-accent: var(--ink-bright, #fff); --mp-accent-soft: rgba(255,255,255,.08); }+.px-shell .mp-k-tip .mp-glyph,+.px-shell .mp-k-launch .mp-glyph { color: var(--ink-bright, #fff); }+.px-shell .mp-k-snipe .mp-glyph { color: var(--ink, #e8e8e8); }+.px-shell .mp-k-trade .mp-glyph,+.px-shell .mp-k-pay .mp-glyph { color: var(--ink-dim, #888); }+.px-shell .mp-livedot::before { background: var(--ink-bright, #fff); animation-name: px-ping; }+.px-shell .mp-livedot[data-state="paused"]::before { background: var(--ink-faint, #555); }+.px-shell .mp-empty-sub a { color: var(--ink-bright, #fff); }@media (max-width: 880px) {.px-grid { grid-template-columns: 1fr; }.px-rail { position: static; flex-direction: column; }+ .px-counters { grid-template-columns: repeat(3, 1fr); }}@media (max-width: 520px) {- .px-counters { grid-template-columns: 1fr; }+ .px-counters { grid-template-columns: repeat(2, 1fr); }+ .px-spark-lbl { font-size: 0.55rem; }}diff --git a/src/pulse.js b/src/pulse.jsindex 2b4e0e3f2..736019f8e 100644--- a/src/pulse.js+++ b/src/pulse.js@@ -64,12 +64,39 @@ async function loadStats() {}}+function fmtNum(n) {+ const v = Number(n) || 0;+ if (v >= 10000) return `${(v / 1000).toFixed(1)}k`;+ return String(v);+}++function timeAgo(iso) {+ const t = new Date(iso).getTime();+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, Math.round((Date.now() - t) / 1000));+ if (s < 60) return 'just now';+ const m = Math.round(s / 60);+ if (m < 60) return `${m}m ago`;+ const h = Math.round(m / 60);+ if (h < 24) return `${h}h ago`;+ return `${Math.round(h / 24)}d ago`;+}+function renderStats(d) {// Headline counters.+ const vol = d.volume_24h || {};+ $('px-c-vol').textContent = vol.usd > 0 ? fmtUsd(vol.usd) : fmtSol(vol.sol);+ $('px-c-vol-sub').textContent = vol.usd > 0 ? `${fmtSol(vol.sol)} on-chain` : 'on-chain flow';$('px-c-tips').textContent = String(d.tips_24h?.count ?? 0);$('px-c-tips-sub').textContent = `${fmtSol(d.tips_24h?.sol)} · ${fmtUsd(d.tips_24h?.usd)}`;$('px-c-launches').textContent = String(d.launches_24h ?? 0);- $('px-c-trades').textContent = String(d.trades_24h ?? 0);+ $('px-c-trades').textContent = String(d.trades_only_24h ?? 0);+ $('px-c-trades-sub').textContent = (d.snipes_24h ?? 0) > 0 ? `+${d.snipes_24h} snipe${d.snipes_24h === 1 ? '' : 's'}` : 'swaps';+ $('px-c-pays').textContent = String(d.payments_24h ?? 0);+ $('px-c-active').textContent = String(d.active_wallets_24h ?? 0);++ renderSparkline(d.series_7d);+ renderBigTip(d.biggest_tip_24h);// Top earners (7d tips).const earners = $('px-earners');@@ -92,6 +119,69 @@ function renderStats(d) {} else {busy.innerHTML = `<p class="px-lb-empty">No wallet activity in the last 24 hours yet.</p>`;}++ renderLaunches(d.recent_launches);+}++// 7-day activity sparkline. Bars scale to the busiest day; today is highlighted.+function renderSparkline(series) {+ const host = $('px-spark-bars');+ const totalEl = $('px-spark-total');+ if (!host) return;+ const days = Array.isArray(series) ? series : [];+ const total = days.reduce((s, d) => s + (d.events || 0) + (d.launches || 0), 0);+ if (totalEl) totalEl.textContent = `${fmtNum(total)} event${total === 1 ? '' : 's'}`;+ if (!days.length) { host.innerHTML = `<p class="px-lb-empty">No activity yet.</p>`; return; }+ const peak = Math.max(1, ...days.map((d) => (d.events || 0) + (d.launches || 0)));+ host.innerHTML = days+ .map((d, i) => {+ const n = (d.events || 0) + (d.launches || 0);+ const h = Math.max(4, Math.round((n / peak) * 100));+ const today = i === days.length - 1;+ return (+ `<div class="px-spark-col${today ? ' px-spark-col--now' : ''}" title="${esc(d.day)}: ${n} event${n === 1 ? '' : 's'}">` ++ `<div class="px-spark-bar" style="height:${h}%"></div>` ++ `<span class="px-spark-lbl">${esc(d.label)}</span>` ++ `</div>`+ );+ })+ .join('');+}++function renderBigTip(t) {+ const card = $('px-bigtip-card');+ const host = $('px-bigtip');+ if (!card || !host) return;+ if (!t || !t.agent) { card.hidden = true; return; }+ card.hidden = false;+ const metric = `${t.usd > 0 ? fmtUsd(t.usd) : fmtSol(t.sol)} <small>${esc(timeAgo(t.ts))}</small>`;+ host.innerHTML = agentCardHTML(t.agent, metric);+ wireWalletChips(host);+}++function renderLaunches(list) {+ const host = $('px-launches');+ if (!host) return;+ if (!list?.length) {+ host.innerHTML = `<p class="px-lb-empty">No coins launched yet. <a href="/launch">Launch one.</a></p>`;+ return;+ }+ host.innerHTML = list+ .map((c) => {+ const a = c.agent || {};+ const av = a.avatar_thumbnail_url+ ? `<img class="px-lb-av" src="${esc(a.avatar_thumbnail_url)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`+ : `<span class="px-lb-av px-lb-av--mono" aria-hidden="true">${esc((c.symbol || c.coin_name || '?').charAt(0).toUpperCase())}</span>`;+ const title = c.symbol ? `$${esc(c.symbol)}` : esc(c.coin_name || 'Coin');+ return (+ `<a class="px-lb-row" href="/launches/${esc(c.mint)}">` ++ av ++ `<span class="px-lb-name">${title}<small>by ${esc(a.name || 'agent')}</small></span>` ++ `<span class="px-lb-metric">${esc(timeAgo(c.ts))}</span>` ++ `</a>`+ );+ })+ .join('');}function mountFeed() {diff --git a/vercel.json b/vercel.jsonindex 6d397827d..833f6e104 100644--- a/vercel.json+++ b/vercel.json@@ -76,6 +76,9 @@"api/cron/pulse-tick.js": {"maxDuration": 120},+ "api/cron/launcher-tick.js": {+ "maxDuration": 120+ },"api/cron/avaturn-seed-cron.js": {"maxDuration": 300},@@ -726,6 +729,10 @@"src": "/pulse/?","dest": "/pulse.html"},+ {+ "src": "/deployments/?",+ "dest": "/deployments.html"+ },{"src": "/watchlist/?","dest": "/watchlist.html"@@ -2489,6 +2496,10 @@"src": "/api/pulse","dest": "/api/pulse.js"},+ {+ "src": "/api/deployments",+ "dest": "/api/deployments.js"+ },{"src": "/api/trades/feed","dest": "/api/trades/feed.js"@@ -4599,6 +4610,10 @@"path": "/api/cron/pulse-tick","schedule": "*/2 * * * *"},+ {+ "path": "/api/cron/launcher-tick",+ "schedule": "* * * * *"+ },{"path": "/api/cron/reflect-sweep","schedule": "*/30 * * * *"diff --git a/vite.config.js b/vite.config.jsindex 502d36d92..33a2bb1d3 100644--- a/vite.config.js+++ b/vite.config.js@@ -378,6 +378,7 @@ const appConfig = {guardian: resolve(__dirname, 'pages/guardian.html'),launches: resolve(__dirname, 'pages/launches.html'),pulse: resolve(__dirname, 'pages/pulse.html'),+ deployments: resolve(__dirname, 'pages/deployments.html'),'launch-detail': resolve(__dirname, 'pages/launch-detail.html'),watchlist: resolve(__dirname, 'pages/watchlist.html'),leaderboard: resolve(__dirname, 'pages/leaderboard.html'),@@ -837,6 +838,8 @@ support: resolve(__dirname, 'pages/support.html'),'/launches/': resolve(root, 'pages/launches.html'),'/pulse': resolve(root, 'pages/pulse.html'),'/pulse/': resolve(root, 'pages/pulse.html'),+ '/deployments': resolve(root, 'pages/deployments.html'),+ '/deployments/': resolve(root, 'pages/deployments.html'),'/clash': resolve(root, 'pages/clash.html'),'/clash/': resolve(root, 'pages/clash.html'),'/watchlist': resolve(root, 'pages/watchlist.html'),