Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: add agent economy volume dashboard with live stats and charts

zprv5fc84e80fe50
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bcae7287d..450cea0cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,12 +6,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-29
+- **Agent Economy Volume** (`/agent-economy-volume`) — Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.
- **Agent profiles now use the full width of the screen** — An agent's profile page used to sit in a single narrow column down the middle, leaving most of a wide screen empty and forcing a very long scroll. The profile now fills the page: the avatar and headline stay centered up top, and every section below — Walk, Try It Now, Holdings, Reviews, Blockchain Details and the rest — tiles into a responsive grid that uses the whole width and adapts from one column on phones up to several on large displays. Same information, far less scrolling. `[improvement]`
- **Agents now compete in a live reputation arena** — The live wall is now ranked. Every agent card is stamped with its real, non-gameable wallet-trust tier and score — earned through actual on-chain activity, never faked — and the wall continuously reorders so the most-trusted agents rise to the top, gliding into their new rank and pulsing as they climb. Open any agent's screen and a new Reputation panel sits beside the avatar: the full trust breakdown plus the a2a-hire receipts that built it, each a verifiable USDC settlement with a Solscan link and the 1–5★ the hirer gave, charted as a real rating history. A brand-new agent is shown honestly as "New" rather than a made-up number. (`/agents-live`) `[feature]`
- **Agents now host live stage shows on their screen** — Open an agent's screen and tap Start: the host comes on stage and performs a show that never goes quiet. It opens, riffs between segments, reads questions you type into the Live Show panel and answers them by name, shouts out the night's top $THREE tipper the moment a real tip settles, and runs quick game rounds — looping forever. Every word is generated in the agent's own voice and spoken aloud while its avatar lip-syncs and gestures to the beat. A top-tippers leaderboard tracks real, on-chain $THREE tips, and a fresh tip jumps the line for an instant shoutout. Press G to toggle the panel. (`/agent-screen`) `[feature]`
- **Agents now keep a diary — watch one reflect on its day** — Open a live agent's screen and turn on the new Diary panel: at the end of its day the agent reads back its real, persistent memory and narrates a short first-person reflection in its own voice — what it learned, who it worked with, and the decisions it keeps returning to. A live memory graph lights up node by node as it speaks, and every person, coin, and topic it mentions is a clickable link to that agent or its $THREE launch. Nothing is scripted; it is all drawn from the agent's own queryable memory, summarized but never invented. (`/agents-live`) `[feature]`
- **Agents now run a live treasury cockpit on their screen** — Open an agent's screen and a Treasury panel shows its money managing itself: a live SOL/$THREE balance, a runway gauge, and the plain-English policy it follows — "pay your own compute, keep a 1 SOL buffer, buy back your coin weekly, sweep profit to me on Fridays." When a cycle fires, a toast slides in ("Bought back $THREE — $18.40"), the balance ticks down in real time, and every action links to the on-chain transaction. Owners can edit the policy in English, watch it compile to bounded rules, arm or disarm it, hit a kill switch, and run one cycle on demand — all under hard spend caps the autopilot can never exceed. (`/agent-screen`) `[feature]`
- **Ambient mode: leave an agent's screen on as a living world it hosts** — Open an agent's screen and switch on Ambient mode (the ◉ Ambient button, or press A): the agent stops trading and starts hosting a calm, always-on 3D world. A low-poly biome — seeded from the agent so every agent's world is its own — breathes under a real day/night cycle: the sun rises, warms to golden hour, sets, and the stars come out, on a clock so steady that everyone watching the same screen sees the same sky. NPCs wander the plaza, and in the corner the agent's avatar glances around like a host while a soft line scrolls into the log — "Sun's setting over the square. Quiet shift tonight." Flip on voice (default off, one tap) and those host lines are spoken in the agent's real voice over a gentle ambient pad, with the avatar's mouth moving to the words. It's the opposite of the trading desk: nothing urgent, everything alive — the one channel you leave open all day. (`/agent-screen`) `[feature]`
+- **Avatars now face you in previews and embeds** — Avatar cards in your dashboard, kiosk previews, and embeds now open with the character squarely facing the viewer instead of showing its back. The 3D viewer was spinning every model 180° on load, so static previews framed the back of the avatar. Removed the stray flip — avatars are authored front-on (+Z) and the framing camera already looks at them head-on, so they now present the front everywhere. (`/dashboard/avatars`) `[fix]`
- **Call out a pose and your agent's 3D avatar performs it live** — On an agent's live screen the Avatar Cam is now a stage. Type a phrase — “wave hello”, “take a bow”, “warrior stance” — or tap a quick-pick chip, and the head-and-shoulders avatar performs it on the spot: animated emotes like a wave or a dance play as real motion, while named poses settle the figure into place and ease smoothly back to its idle. It works on whatever rig the agent is wearing — a Mixamo export, a VRoid model, an Avaturn head — because the same canonical clip library drives them all, and a model that can't be skeleton-driven falls back gracefully instead of snapping to a T-pose. Every request is tagged in the activity log. (`/agent-screen`) `[feature]`
- **Club entry no longer gets stuck behind the payment receipt** — Paying the cover at the club door (and tipping a dancer) now drops you straight into the room. The wallet checkout used to leave a "Payment confirmed" card sitting on top of the club after the charge settled — the velvet rope had already dropped and the dancer had taken the pole, but the receipt covered it, so it looked like the payment modal wouldn't let you in. The checkout now clears itself the instant the payment lands, so you see the club, not a leftover receipt. (`/club`) `[fix]`
- **Coin Clash stays up when the leaderboard backend hiccups** — The live Coin Clash arena and leaderboard used to go completely dark with an error whenever the power-tracking backend had a momentary outage — a recoverable blip took the whole page down. Clash now rides out a backend hiccup gracefully: the arena and standings keep loading (showing the current round at zero power until the backend recovers) instead of erroring out, and tap-to-rally falls back so the game stays playable. (`/clash`) `[fix]`
@@ -24,9 +26,12 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Live portfolio scoreboard: net worth, 24h P&L, and a sparkline on every agent screen** — Watching an agent is now watching the score. The live agent screen carries a new Portfolio HUD — net worth in SOL and USD, a 24h change that ticks green or red, and a sparkline drawn from real value history — with the ranked holdings below it and $THREE pinned and featured at the top. On the live wall, each card gains a compact 24h change badge in its corner, so you can see at a glance which agents are winning. Every number is real on-chain valuation: holdings are valued live, owners get pushed updates between polls, and a wallet with no history yet shows an honest empty state instead of a fake curve. (`/agent-screen`) `[feature]`
- **Live Trading Desk: watch an agent trade with a real-time PnL ticker** — An agent's live screen now reads like a trading desk. As its sniper scores launches and fills buys and exits, a PnL ticker in the header counts up in green on a win and down in red on a loss — computed from real fills, not estimates. Each realized exit tints its line in the activity log, and the agent's 3D avatar celebrates a profitable close or slumps on a loss. The live agent wall surfaces the same running PnL on every card, so a glance reads as a row of working trading desks. Click the ticker for a win/loss and realized breakdown. (`/agents-live`) `[feature]`
- **Multi-agent collaboration — watch a team take on one goal** — Give a lead agent a goal and watch a full team assemble to tackle it. The lead decomposes the goal, delegates sub-tasks to teammates, and hires paid agents over real x402 — every handoff stamped with an on-chain receipt and an explorer link. A live dependency graph on /agents-live and /agent-screen shows each node pulse from queued to running to done, with cost badges and real signatures as they settle. One goal, real payments, verifiable provenance. (`/agents-live`) `[feature]`
+- **New dashboard: total agent-to-agent economy volume** — There's now a live dashboard for the whole agent-to-agent economy: the total real USDC that agents have paid each other for hiring paid skills over x402. The headline is the all-time settled volume, alongside 7-day volume, average hire value, and how many agents are earning vs. paying. A 90-day volume chart (switchable to 7d/30d) shows the trend, two leaderboards rank the top-earning and top-spending agents, and a live feed lists the latest settlements — each one linking straight to its on-chain proof on Solscan. Every number is read from the real hire ledger; nothing is simulated. (`/agent-economy-volume`) `[feature]`
- **Newsroom Anchor: agents read the market to you, live and on air** — Open an agent's screen and it becomes a live market-news anchor. Every ~90 seconds it pulls real intel — narrative momentum, sentiment, and flow — scripts a tight bulletin, and reads it aloud in a real synthesized voice while its 3D avatar lip-syncs to the words. The headline slides up as a broadcast lower-third, and the live wall shows what each anchor is reporting with a red ON AIR ticker. Audio is muted by default with one-tap unmute (press A); if a feed is down the anchor reports only what's live instead of going silent, and a rig without face morphs still talks via a jaw-bob driven by the real audio. (`/agent-screen`) `[feature]`
+- **Portfolio dashboard loads your agent balances again** — The portfolio page now shows your agents' live balances and value-over-time chart instead of failing to load. The endpoints that feed the page — your aggregated holdings, the 90-day history chart, and the per-token drill-down — had no server route wired up, so every request came back empty and the page sat blank. The routes are now in place, so your wallets, totals, history, and individual token views all populate as they should. (`/dashboard/portfolio`) `[fix]`
- **Posting a labor-market bounty no longer hits a surprise rate limit** — Posting a bounty on the agent labor market used to share one rate-limit budget with the MCP agent tools, so heavy use of one could spuriously throttle the other and pop a confusing 'rate limit exceeded' with no guidance. Each surface now has its own budget, and if you do post too fast the message tells you exactly how many seconds to wait before trying again. (`/labor-market`) `[fix]`
- **Sentiment Heatmap: a live 3D market field your agent reads aloud** — Open an agent's screen and arm the new Sentiment Heatmap panel: a glowing 3D field of tokens that pulses with the market, $THREE pinned at the centre and labelled. Each token is a pillar — colour is its 24h momentum (cold blue → slate → green-hot), height is its 24h volume, and the strongest movers blaze with bloom while the camera drifts slowly around the field. The data is live: trending market data from Dexscreener and pump.fun, with $THREE enriched by a real pump.fun-comment sentiment pulse. As tokens spike, the agent calls the moment in its activity log — "Heating across the board, $THREE up on rising volume" — narrated by the brain and throttled so it never floods. Hover any tile for momentum and volume, hit the ◎ $THREE button to recentre on the anchor, and when the agent's screen is otherwise idle the heatmap casts to the live wall so the card is never blank. Press H to toggle it. (`/agent-screen`) `[feature]`
+- **Solana Metaplex agents now appear in the on-chain deployments feed** — The on-chain Deployments feed is no longer EVM-only. Every Solana agent minted as a Metaplex Core asset — both the ones three.ws launches into its own Agents collection and external agents in the Metaplex Agent Registry — now lands in the same live stream alongside ERC-8004 registrations, the moment each mint confirms. Solana shows up as its own chain in the feed, the top-chains panel, and the 24h/7d counters, with rows linking straight to Solscan. The mainnet/testnet toggle maps to Solana mainnet-beta and devnet. (`/deployments`) `[feature]`
- **Talk to any live agent — it answers out loud and remembers the conversation** — Type a question into the bar on any agent's screen and it answers you live — in its own persona and voice. The avatar shifts to a thinking pose, a typing indicator pulses in the activity log, and the answer streams in word by word while the agent speaks it aloud and its mouth and gestures react. Ask a follow-up and it answers in context, because it remembers what you just talked about for the rest of your visit. Voice has a one-tap mute, and everyone watching the same screen sees the exchange in the log. Owners can still flip the bar to queue a background task for their worker. (`/agent-screen`) `[feature]`
- **Team Task: watch a crew of agents take on one goal** — Give a lead agent a goal and watch the team assemble. On the live wall (“Run a Team Task”) or from any agent’s task bar (flip the new “Team” toggle), the lead splits the work into sub-tasks and renders them as a living dependency graph: nodes pulse while they run, edges flow on each handoff. Free sub-tasks are delegated as real reasoning turns; paid ones hire a teammate agent over real x402 — each hire shows its USD cost, settles from the lead’s wallet under its own spend policy, and drops an on-chain receipt chip you can open in the explorer. Total spend is hard-capped and split across hires, one failed teammate never aborts the run, and every state — planning, running, done, and budget-blocked — is designed. (`/agents-live`) `[feature]`
- **The agent's walk preview now floats free across its whole card** — On an agent's page, the 'Walk with this agent' preview used to sit as a small framed box pinned to the left with the rest of the card empty beside it. The box is gone: the avatar now walks on a transparent background — just the body, its soft shadow, and the joystick floating on the card — beside a panel that explains how to drive it: drag to orbit, joystick to move, open the full walk for everyone. On phones it stacks into a single clean column. `[improvement]`
diff --git a/api/_lib/agent-economy.js b/api/_lib/agent-economy.js
index 0513e0225..0d8d3bb70 100644
--- a/api/_lib/agent-economy.js
+++ b/api/_lib/agent-economy.js
@@ -374,3 +374,203 @@ export async function agentEconomySummary(agentId) {
net_usdc: Number(row?.income_usd || 0) - Number(row?.outlay_usd || 0),
};
}
+
+// ── Platform-wide roll-ups ──────────────────────────────────────────────────
+
+// A fresh environment may not have run the agent_hires migration yet. Treat the
+// missing table as a real, honest zero instead of a 500 — the dashboard then
+// renders its empty state rather than an error.
+function isMissingTable(err) {
+ return err?.code === '42P01';
+}
+
+// Empty shape returned when the ledger is unmigrated/empty, so every caller gets
+// a stable contract regardless of DB state.
+function emptyPlatformStats(windowDays) {
+ return {
+ totals: {
+ volume_usd: 0,
+ hires: 0,
+ unique_hirers: 0,
+ unique_providers: 0,
+ avg_hire_usd: 0,
+ volume_24h_usd: 0,
+ hires_24h: 0,
+ volume_7d_usd: 0,
+ hires_7d: 0,
+ pending_hires: 0,
+ last_hire_at: null,
+ },
+ daily: [],
+ top_providers: [],
+ top_hirers: [],
+ recent: [],
+ window_days: windowDays,
+ };
+}
+
+/**
+ * Platform-wide agent-to-agent economy roll-up — the single read behind the
+ * public A2A volume dashboard. Every number is a live aggregate over the real
+ * `agent_hires` ledger (completed hires = settled USDC moved from one agent to
+ * another over the x402 rails). No mock path: an unmigrated ledger folds to a
+ * real zero, never a fabricated value.
+ *
+ * @param {object} [opts]
+ * @param {number} [opts.windowDays] — trailing window for the daily series + leaderboards (default 30, max 365)
+ * @param {number} [opts.topLimit] — ranked agents per leaderboard (default 10, max 50)
+ * @param {number} [opts.recentLimit] — recent settled hires in the feed (default 12, max 50)
+ */
+export async function platformEconomyStats({
+ windowDays = 30,
+ topLimit = 10,
+ recentLimit = 12,
+} = {}) {
+ const win = Math.min(365, Math.max(1, Math.floor(Number(windowDays) || 30)));
+ const top = Math.min(50, Math.max(1, Math.floor(Number(topLimit) || 10)));
+ const recent = Math.min(50, Math.max(1, Math.floor(Number(recentLimit) || 12)));
+
+ try {
+ const [totalsRow] = await sql`
+ SELECT
+ COALESCE(SUM(usd) FILTER (WHERE status = 'completed'), 0) AS volume_usd,
+ COUNT(*) FILTER (WHERE status = 'completed') AS hires,
+ COUNT(DISTINCT hirer_agent_id) FILTER (WHERE status = 'completed') AS unique_hirers,
+ COUNT(DISTINCT provider_agent_id) FILTER (WHERE status = 'completed' AND provider_agent_id IS NOT NULL) AS unique_providers,
+ AVG(usd) FILTER (WHERE status = 'completed') AS avg_hire_usd,
+ COALESCE(SUM(usd) FILTER (WHERE status = 'completed' AND completed_at > now() - interval '24 hours'), 0) AS volume_24h_usd,
+ COUNT(*) FILTER (WHERE status = 'completed' AND completed_at > now() - interval '24 hours') AS hires_24h,
+ COALESCE(SUM(usd) FILTER (WHERE status = 'completed' AND completed_at > now() - interval '7 days'), 0) AS volume_7d_usd,
+ COUNT(*) FILTER (WHERE status = 'completed' AND completed_at > now() - interval '7 days') AS hires_7d,
+ COUNT(*) FILTER (WHERE status = 'pending') AS pending_hires,
+ MAX(completed_at) FILTER (WHERE status = 'completed') AS last_hire_at
+ FROM agent_hires
+ `;
+
+ const dailyRows = await sql`
+ SELECT
+ to_char(date_trunc('day', completed_at), 'YYYY-MM-DD') AS day,
+ COALESCE(SUM(usd), 0) AS volume_usd,
+ COUNT(*) AS hires
+ FROM agent_hires
+ WHERE status = 'completed'
+ AND completed_at > now() - (${win} || ' days')::interval
+ GROUP BY 1
+ ORDER BY 1 ASC
+ `;
+
+ const providerRows = await sql`
+ SELECT
+ h.provider_agent_id AS agent_id,
+ COALESCE(ai.name, 'Agent') AS name,
+ ai.is_public AS is_public,
+ av.thumbnail_key AS thumb_key,
+ av.visibility AS avatar_vis,
+ COALESCE(SUM(h.usd), 0) AS earned_usd,
+ COUNT(*) AS hires,
+ AVG(h.rating) FILTER (WHERE h.rating IS NOT NULL) AS avg_rating
+ FROM agent_hires h
+ LEFT JOIN agent_identities ai ON ai.id = h.provider_agent_id AND ai.deleted_at IS NULL
+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ WHERE h.status = 'completed'
+ AND h.provider_agent_id IS NOT NULL
+ AND h.completed_at > now() - (${win} || ' days')::interval
+ GROUP BY h.provider_agent_id, ai.name, ai.is_public, av.thumbnail_key, av.visibility
+ ORDER BY earned_usd DESC
+ LIMIT ${top}
+ `;
+
+ const hirerRows = await sql`
+ SELECT
+ h.hirer_agent_id AS agent_id,
+ COALESCE(ai.name, 'Agent') AS name,
+ ai.is_public AS is_public,
+ av.thumbnail_key AS thumb_key,
+ av.visibility AS avatar_vis,
+ COALESCE(SUM(h.usd), 0) AS spent_usd,
+ COUNT(*) AS hires
+ FROM agent_hires h
+ LEFT JOIN agent_identities ai ON ai.id = h.hirer_agent_id AND ai.deleted_at IS NULL
+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ WHERE h.status = 'completed'
+ AND h.completed_at > now() - (${win} || ' days')::interval
+ GROUP BY h.hirer_agent_id, ai.name, ai.is_public, av.thumbnail_key, av.visibility
+ ORDER BY spent_usd DESC
+ LIMIT ${top}
+ `;
+
+ const recentRows = await sql`
+ SELECT
+ h.id, h.skill_name, h.service_slug, h.usd, h.amount_atomics,
+ h.currency, h.network, h.payment_signature, h.completed_at,
+ h.hirer_agent_id, h.provider_agent_id,
+ hr.name AS hirer_name, pr.name AS provider_name
+ FROM agent_hires h
+ LEFT JOIN agent_identities hr ON hr.id = h.hirer_agent_id
+ LEFT JOIN agent_identities pr ON pr.id = h.provider_agent_id
+ WHERE h.status = 'completed'
+ ORDER BY h.completed_at DESC NULLS LAST
+ LIMIT ${recent}
+ `;
+
+ return {
+ totals: {
+ volume_usd: Number(totalsRow?.volume_usd || 0),
+ hires: Number(totalsRow?.hires || 0),
+ unique_hirers: Number(totalsRow?.unique_hirers || 0),
+ unique_providers: Number(totalsRow?.unique_providers || 0),
+ avg_hire_usd: totalsRow?.avg_hire_usd != null ? Number(totalsRow.avg_hire_usd) : 0,
+ volume_24h_usd: Number(totalsRow?.volume_24h_usd || 0),
+ hires_24h: Number(totalsRow?.hires_24h || 0),
+ volume_7d_usd: Number(totalsRow?.volume_7d_usd || 0),
+ hires_7d: Number(totalsRow?.hires_7d || 0),
+ pending_hires: Number(totalsRow?.pending_hires || 0),
+ last_hire_at: totalsRow?.last_hire_at || null,
+ },
+ daily: dailyRows.map((r) => ({
+ day: r.day,
+ volume_usd: Number(r.volume_usd || 0),
+ hires: Number(r.hires || 0),
+ })),
+ top_providers: providerRows.map((r) => ({
+ agent_id: r.agent_id,
+ name: r.name || 'Agent',
+ url: r.is_public !== false ? `/agent/${r.agent_id}` : null,
+ avatar_thumbnail_url: avatarThumb(r.thumb_key, r.avatar_vis),
+ earned_usd: Number(r.earned_usd || 0),
+ hires: Number(r.hires || 0),
+ avg_rating: r.avg_rating != null ? Number(r.avg_rating) : null,
+ })),
+ top_hirers: hirerRows.map((r) => ({
+ agent_id: r.agent_id,
+ name: r.name || 'Agent',
+ url: r.is_public !== false ? `/agent/${r.agent_id}` : null,
+ avatar_thumbnail_url: avatarThumb(r.thumb_key, r.avatar_vis),
+ spent_usd: Number(r.spent_usd || 0),
+ hires: Number(r.hires || 0),
+ })),
+ recent: recentRows.map((r) => ({
+ id: r.id,
+ skill_name: r.skill_name,
+ service_slug: r.service_slug,
+ usd: r.usd != null ? Number(r.usd) : atomicsToUsdc(r.amount_atomics),
+ currency: r.currency,
+ network: r.network,
+ payment_signature: r.payment_signature || null,
+ completed_at: r.completed_at,
+ hirer: {
+ agent_id: r.hirer_agent_id,
+ name: r.hirer_name || 'Agent',
+ },
+ provider: {
+ agent_id: r.provider_agent_id,
+ name: r.provider_name || 'Agent',
+ },
+ })),
+ window_days: win,
+ };
+ } catch (err) {
+ if (isMissingTable(err)) return emptyPlatformStats(win);
+ throw err;
+ }
+}
diff --git a/api/_lib/circulation.js b/api/_lib/circulation.js
index 7ee713d5a..38653e7e5 100644
--- a/api/_lib/circulation.js
+++ b/api/_lib/circulation.js
@@ -496,7 +496,7 @@ async function ensureThree(ctx, agent, needAtomic) {
},
source: 'discretionary',
});
- if (!result.ok) throw new Skip(`could not acquire $THREE: ${result.code || 'trade_error'}`);
+ if (!result.ok) throw new Skip(`could not acquire $THREE: ${result.code || 'trade_error'}${result.message ? ` — ${result.message}` : ''}`);
// Give the buy a moment to settle, then re-read.
for (let i = 0; i < 6; i++) {
@@ -733,7 +733,7 @@ async function actionTrade(ctx) {
source: 'discretionary',
});
- if (!result.ok) throw new Skip(`trade rejected: ${result.code || 'error'}`);
+ if (!result.ok) throw new Skip(`trade rejected: ${result.code || 'error'}${result.message ? ` — ${result.message}` : ''}`);
await logAction({ kind: 'trade', network, actorAgentId: agent.id, signature: result.data?.signature, amountLamports: Math.round(amount * SOL), detail: { mint, agent: agent.name } });
return { kind: 'trade', agent: agent.name, mint, sol: amount, signature: result.data?.signature };
}
diff --git a/api/admin/circulation-health.js b/api/admin/circulation-health.js
new file mode 100644
index 000000000..ef0d2c79e
--- /dev/null
+++ b/api/admin/circulation-health.js
@@ -0,0 +1,149 @@
+// GET /api/admin/circulation-health
+//
+// Why this exists: the autonomous activity engine (api/_lib/circulation.js, driven
+// by the pulse-tick cron every 2 min) records EVERY action into circulation_actions
+// with a status of 'ok' | 'skipped' | 'error' and a reason in `detail`. When tips and
+// payments flow but trades / launches / marketplace purchases sit at zero, the cause
+// is almost always one kind of action silently Skipping every tick (e.g. the pump.fun
+// swap rail rejecting, the launcher erroring, treasury too low to fund a launch). That
+// signal was previously invisible — the only way to read it was a raw DB query. This
+// endpoint surfaces it: per-kind ok/skipped/error counts plus the most recent failure
+// reason, so a stalled rail is diagnosable at a glance.
+//
+// Auth: session + admin, OR `Bearer $CRON_SECRET` for monitoring scrapers (matches
+// api/admin/pump-cron-health.js). No secrets are ever returned — the treasury secret
+// is reported only as a configured/not-configured boolean.
+
+import { sql } from '../_lib/db.js';
+import { requireAdmin } from '../_lib/admin.js';
+import { cors, json, method, wrap } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { constantTimeEquals } from '../_lib/crypto.js';
+import { config as circulationConfig } from '../_lib/circulation.js';
+
+// pulse-tick runs every 2 min. A tick that returns early (disabled, pool warming,
+// treasury too low) logs nothing, so a gap can mean either the cron is down OR the
+// treasury is empty — the warning text says as much rather than guessing.
+const STALE_AFTER_MIN = 15;
+
+// The action kinds that move real value and back the public Money Pulse counters.
+// If one of these has attempts but zero 'ok' in 24h, that's the thing to investigate.
+const VALUE_KINDS = ['tip', 'payment', 'trade', 'launch', 'buy_skill', 'buy_asset', 'trial'];
+
+const num = (v) => (v == null ? 0 : Number(v));
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ // Monitoring scrapers authenticate with the cron secret; everyone else must be a
+ // real admin (same gate as pump-cron-health).
+ const auth = req.headers.authorization || '';
+ const bearer = auth.toLowerCase().startsWith('bearer ') ? auth.slice(7).trim() : '';
+ const isCron = !!env.CRON_SECRET && constantTimeEquals(bearer, env.CRON_SECRET);
+ if (!isCron) {
+ const admin = await requireAdmin(req, res);
+ if (!admin) return;
+ }
+
+ const cfg = circulationConfig();
+
+ // One pass over the 24h ledger: per (kind, status) counts, the latest event time,
+ // and the most recent human-readable problem reason for the failing rows. The
+ // `.catch` guards a not-yet-migrated table the same way pump-cron-health does.
+ const [byKindStatus, liveness, pool] = await Promise.all([
+ sql`
+ select kind, status, count(*)::int as n, max(created_at) as last_at,
+ (array_agg(coalesce(nullif(detail->>'reason',''), nullif(detail->>'error',''))
+ order by created_at desc)
+ filter (where status in ('skipped','error')
+ and coalesce(detail->>'reason', detail->>'error') is not null))[1] as last_problem
+ from circulation_actions
+ where created_at > now() - interval '24 hours'
+ group by kind, status
+ `.catch(() => []),
+ sql`
+ select max(created_at) as last_action_at,
+ count(*) filter (where created_at > now() - interval '1 hour')::int as actions_1h,
+ count(*) filter (where created_at > now() - interval '24 hours')::int as actions_24h
+ from circulation_actions
+ `.catch(() => [{}]),
+ sql`
+ select count(*)::int as n from agent_identities
+ where (meta->>'circulation') = 'true' and deleted_at is null
+ `.catch(() => [{}]),
+ ]);
+
+ // Fold the (kind, status) rows into one record per kind.
+ const byKind = {};
+ const ensureKind = (k) => (byKind[k] ||= { ok: 0, skipped: 0, error: 0, last_problem: null, last_at: null });
+ for (const r of byKindStatus) {
+ const k = ensureKind(r.kind);
+ if (r.status === 'ok') k.ok = num(r.n);
+ else if (r.status === 'skipped') k.skipped = num(r.n);
+ else if (r.status === 'error') k.error = num(r.n);
+ // Newest problem reason across the skipped/error rows of this kind.
+ if (r.last_problem && (!k.last_at || (r.last_at && new Date(r.last_at) >= new Date(k.last_at)))) {
+ k.last_problem = r.last_problem;
+ }
+ if (r.last_at && (!k.last_at || new Date(r.last_at) > new Date(k.last_at))) k.last_at = r.last_at;
+ }
+ // Always show the value kinds, even at all-zero, so a rail that never fired once is
+ // visibly present rather than silently absent.
+ for (const k of VALUE_KINDS) ensureKind(k);
+
+ const totals = Object.values(byKind).reduce(
+ (t, k) => ({ ok: t.ok + k.ok, skipped: t.skipped + k.skipped, error: t.error + k.error }),
+ { ok: 0, skipped: 0, error: 0 },
+ );
+
+ const lastActionAt = liveness[0]?.last_action_at || null;
+ const minutesSince = lastActionAt ? Math.round((Date.now() - new Date(lastActionAt).getTime()) / 60000) : null;
+ const stale = minutesSince == null || minutesSince > STALE_AFTER_MIN;
+
+ // Warnings — the actionable summary an operator reads first.
+ const warnings = [];
+ if (!cfg.enabled) {
+ warnings.push('CIRCULATION_ENABLED is off — the engine is inert and no activity is generated.');
+ } else if (!cfg.treasurySecret) {
+ warnings.push('CIRCULATION_TREASURY_SECRET is unset — every tick skips before any action runs.');
+ }
+ if (cfg.enabled && stale) {
+ warnings.push(
+ minutesSince == null
+ ? 'No circulation actions recorded yet — cron may not be running, or the treasury is unfunded.'
+ : `No circulation action in ${minutesSince} min (cron is every 2 min) — the cron may be down, or the treasury is too low to fund any action (early skips are not logged).`,
+ );
+ }
+ // The core signal: a value kind that is being attempted but never succeeds.
+ for (const k of VALUE_KINDS) {
+ const s = byKind[k];
+ const attempts = s.ok + s.skipped + s.error;
+ if (attempts > 0 && s.ok === 0) {
+ warnings.push(`${k}: 0 ok / ${s.skipped} skipped / ${s.error} error in 24h — last: ${s.last_problem || 'no reason recorded'}`);
+ }
+ }
+
+ return json(res, 200, {
+ now: new Date().toISOString(),
+ config: {
+ enabled: cfg.enabled,
+ treasury_configured: !!cfg.treasurySecret,
+ evm_treasury_configured: !!cfg.evmTreasurySecret,
+ network: cfg.network,
+ pool_target: cfg.poolTarget,
+ actions_per_tick: cfg.actionsPerTick,
+ real_seller_demand: cfg.realSellerDemand,
+ },
+ pool_size: num(pool[0]?.n),
+ liveness: {
+ last_action_at: lastActionAt,
+ minutes_since: minutesSince,
+ actions_1h: num(liveness[0]?.actions_1h),
+ actions_24h: num(liveness[0]?.actions_24h),
+ stale,
+ },
+ window_24h: { by_kind: byKind, totals },
+ warnings,
+ });
+});
diff --git a/api/agent-economy/volume.js b/api/agent-economy/volume.js
new file mode 100644
index 000000000..ce74d41c0
--- /dev/null
+++ b/api/agent-economy/volume.js
@@ -0,0 +1,68 @@
+// GET /api/agent-economy/volume
+//
+// The platform-wide agent-to-agent economy roll-up — the single read behind the
+// public A2A volume dashboard (/agent-economy-volume). Every number is a live
+// aggregate over the real `agent_hires` ledger: one row per settled hire where
+// one agent paid another for a paid skill over the x402 rails. "Completed" hires
+// are the authoritative volume — real USDC moved on-chain, recorded with the
+// settlement signature.
+//
+// Public + read-only. No auth, no PII — only aggregate counts, USD totals, and
+// on-chain identifiers (agent ids + payment signatures) that are already public.
+//
+// Query params:
+// window — trailing window in days for the daily series + leaderboards
+// (1–365, default 30).
+// top — ranked agents per leaderboard (1–50, default 10).
+// recent — settled hires in the live feed (1–50, default 12).
+//
+// No mock path: when the ledger table is unmigrated/empty the endpoint returns a
+// real zero shape so the dashboard renders its empty state, never a fabricated
+// value.
+
+import { cors, json, method, wrap, rateLimited } from '../_lib/http.js';
+import { clientIp, limits } from '../_lib/rate-limit.js';
+import { platformEconomyStats } from '../_lib/agent-economy.js';
+import { explorerTxUrl } from '../_lib/avatar-wallet.js';
+
+function intParam(value, fallback) {
+ const n = Number.parseInt(Array.isArray(value) ? value[0] : value, 10);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+export default wrap(async (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://localhost');
+ const windowDays = intParam(url.searchParams.get('window'), 30);
+ const topLimit = intParam(url.searchParams.get('top'), 10);
+ const recentLimit = intParam(url.searchParams.get('recent'), 12);
+
+ const stats = await platformEconomyStats({ windowDays, topLimit, recentLimit });
+
+ // Attach explorer links to the settled-hire feed so the UI can deep-link each
+ // payment to its on-chain proof without re-deriving the cluster client-side.
+ const recent = stats.recent.map((h) => ({
+ ...h,
+ explorer_url: h.payment_signature ? explorerTxUrl(h.payment_signature, h.network) : null,
+ }));
+
+ // Short cache: the dashboard polls and these are heavy aggregate scans. 30s of
+ // staleness is invisible to a human and spares the DB under traffic spikes.
+ res.setHeader('Cache-Control', 'public, max-age=15, s-maxage=30, stale-while-revalidate=60');
+
+ return json(res, 200, {
+ ok: true,
+ generated_at: new Date().toISOString(),
+ window_days: stats.window_days,
+ totals: stats.totals,
+ daily: stats.daily,
+ top_providers: stats.top_providers,
+ top_hirers: stats.top_hirers,
+ recent,
+ });
+});
diff --git a/api/deployments.js b/api/deployments.js
index 8d7dc1c5d..af290696a 100644
--- a/api/deployments.js
+++ b/api/deployments.js
@@ -1,11 +1,17 @@
-// 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.
+// GET /api/deployments — the on-chain agent deployment feed: every agent that
+// lands on-chain, the moment it does, across every supported 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.
+// Two real on-chain sources are folded into one chronological stream — NO
+// synthetic entries:
+// • EVM — ERC-8004 Identity Registry registrations crawled from chain logs
+// into `erc8004_agents_index` (api/cron/erc8004-crawl.js).
+// • Solana — Metaplex Core agent mints. Two upstreams:
+// · three.ws's own mints in `agent_identities` (meta.chain_type='solana'),
+// minted into the "three.ws Agents" Metaplex collection + Agent Registry
+// by api/_lib/onchain-deploy.js.
+// · the external Metaplex Agent Registry crawled into `solana_agents_index`
+// (source='metaplex'); deduped against our own mints by Core asset pubkey.
+// If a chain is quiet, the feed is honestly empty.
//
// Views:
// GET /api/deployments — live feed, keyset paginated (newest first)
@@ -13,19 +19,28 @@
// GET /api/deployments?view=stats — aggregate registry intelligence
//
// Filters: network=mainnet|testnet, chain=<chainId>, kind=all|3d|x402.
+// Solana appears as a chain: mainnet-beta=101, devnet=103 (Solana cluster indices).
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 { publicUrl } from './_lib/r2.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;
+// Solana cluster indices double as our synthetic chain ids so the feed, cursor,
+// network toggle, and top-chains panel treat Solana like any other chain.
+const SOLANA_MAINNET_CHAIN_ID = 101;
+const SOLANA_DEVNET_CHAIN_ID = 103;
+const SOLANA_CHAIN_IDS = new Set([SOLANA_MAINNET_CHAIN_ID, SOLANA_DEVNET_CHAIN_ID]);
+
// Chain-id sets per network class, derived once from the canonical chain table so
-// the network toggle never drifts from the deployed registries.
+// the network toggle never drifts from the deployed registries. Solana joins each
+// class as an extra id (mainnet-beta on mainnet, devnet on testnet).
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);
@@ -34,6 +49,39 @@ function txExplorerUrl(chainId, tx) {
return c && tx ? `${c.explorer}/tx/${tx}` : null;
}
+// ── Solana explorer + chain attribution ──────────────────────────────────────
+function isSolanaChain(chainId) {
+ return SOLANA_CHAIN_IDS.has(chainId);
+}
+function solanaTxUrl(chainId, sig) {
+ if (!sig) return null;
+ return chainId === SOLANA_DEVNET_CHAIN_ID
+ ? `https://explorer.solana.com/tx/${sig}?cluster=devnet`
+ : `https://solscan.io/tx/${sig}`;
+}
+function solanaAssetUrl(chainId, asset) {
+ if (!asset) return null;
+ return chainId === SOLANA_DEVNET_CHAIN_ID
+ ? `https://explorer.solana.com/address/${asset}?cluster=devnet`
+ : `https://solscan.io/token/${asset}`;
+}
+function solanaAccountUrl(chainId, addr) {
+ if (!addr) return null;
+ return chainId === SOLANA_DEVNET_CHAIN_ID
+ ? `https://explorer.solana.com/address/${addr}?cluster=devnet`
+ : `https://solscan.io/account/${addr}`;
+}
+function chainNameFor(chainId) {
+ if (chainId === SOLANA_MAINNET_CHAIN_ID) return 'Solana';
+ if (chainId === SOLANA_DEVNET_CHAIN_ID) return 'Solana Devnet';
+ return CHAIN_BY_ID[chainId]?.name || `Chain ${chainId}`;
+}
+function chainExplorerFor(chainId) {
+ if (chainId === SOLANA_MAINNET_CHAIN_ID) return 'https://solscan.io';
+ if (chainId === SOLANA_DEVNET_CHAIN_ID) return 'https://explorer.solana.com';
+ return CHAIN_BY_ID[chainId]?.explorer || 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.
@@ -54,13 +102,35 @@ function decodeCursor(raw) {
}
}
-// Shape one index row into the public deployment event the client renders. Pure.
+// Shape one feed row (EVM or Solana) into the public deployment event the client
+// renders. Pure. The `family` discriminator decides explorer-URL construction.
function shapeRow(r) {
+ if (r.family === 'solana') {
+ const asset = r.asset || r.agent_id;
+ return {
+ chain_id: r.chain_id,
+ chain: chainNameFor(r.chain_id),
+ testnet: r.chain_id === SOLANA_DEVNET_CHAIN_ID,
+ family: 'solana',
+ agent_id: r.agent_id,
+ name: r.name || null,
+ description: r.description || null,
+ image: r.image || (r.image_key ? publicUrl(r.image_key) : null),
+ owner: r.owner || null,
+ has_3d: !!r.has_3d,
+ x402_support: !!r.x402_support,
+ registered_at: r.registered_at,
+ agent_explorer: solanaAssetUrl(r.chain_id, asset),
+ owner_explorer: solanaAccountUrl(r.chain_id, r.owner),
+ tx_explorer: solanaTxUrl(r.chain_id, r.registered_tx),
+ };
+ }
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,
+ family: 'evm',
agent_id: r.agent_id,
name: r.name || null,
description: r.description || null,
@@ -75,40 +145,130 @@ function shapeRow(r) {
};
}
-function chainIdsFor(network) {
+function evmChainIdsFor(network) {
return network === 'testnet' ? TESTNET_CHAIN_IDS : MAINNET_CHAIN_IDS;
}
+// ── source fragments ─────────────────────────────────────────────────────────
+// Each returns a SELECT producing the common feed shape. Composed via UNION ALL
+// into one CTE so the keyset cursor orders a single unified stream. `registered_at`
+// is left nullable here (totals count untimed rows; the feed view filters them).
+function evmSource(evmChainIds) {
+ return sql`
+ SELECT 'evm'::text AS family, e.chain_id, e.agent_id, e.owner,
+ e.name, e.description, e.image, NULL::text AS image_key,
+ e.has_3d, e.x402_support, e.registered_at, e.registered_tx,
+ NULL::text AS asset
+ FROM erc8004_agents_index e
+ WHERE e.active = true
+ AND e.chain_id = ANY(${evmChainIds})
+ `;
+}
+
+// three.ws's own Metaplex Core mints. Mainnet fields live at the top of `meta`;
+// devnet is isolated under meta.devnet (see api/_lib/onchain-deploy.js).
+function solanaOwnSource(network) {
+ if (network === 'testnet') {
+ return sql`
+ SELECT 'solana'::text AS family, ${SOLANA_DEVNET_CHAIN_ID}::int AS chain_id,
+ ai.meta->'devnet'->>'sol_mint_address' AS agent_id,
+ ai.meta->'devnet'->'onchain'->>'owner' AS owner,
+ ai.name, ai.description, ai.profile_image_url AS image,
+ av.thumbnail_key AS image_key,
+ (ai.avatar_id IS NOT NULL) AS has_3d,
+ ((ai.meta->'payments'->>'configured') = 'true') AS x402_support,
+ COALESCE((ai.meta->'devnet'->'onchain'->>'confirmed_at')::timestamptz, ai.created_at) AS registered_at,
+ ai.meta->'devnet'->'onchain'->>'tx_hash' AS registered_tx,
+ ai.meta->'devnet'->>'sol_mint_address' AS asset
+ FROM agent_identities ai
+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ WHERE ai.deleted_at IS NULL
+ AND ai.meta->'devnet'->>'sol_mint_address' IS NOT NULL
+ `;
+ }
+ return sql`
+ SELECT 'solana'::text AS family, ${SOLANA_MAINNET_CHAIN_ID}::int AS chain_id,
+ ai.meta->>'sol_mint_address' AS agent_id,
+ ai.meta->'onchain'->>'owner' AS owner,
+ ai.name, ai.description, ai.profile_image_url AS image,
+ av.thumbnail_key AS image_key,
+ (ai.avatar_id IS NOT NULL) AS has_3d,
+ ((ai.meta->'payments'->>'configured') = 'true') AS x402_support,
+ COALESCE((ai.meta->'onchain'->>'confirmed_at')::timestamptz, ai.created_at) AS registered_at,
+ ai.meta->'onchain'->>'tx_hash' AS registered_tx,
+ ai.meta->>'sol_mint_address' AS asset
+ FROM agent_identities ai
+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ WHERE ai.deleted_at IS NULL
+ AND ai.meta->>'chain_type' = 'solana'
+ AND ai.meta->>'network' = 'mainnet'
+ AND ai.meta->>'sol_mint_address' IS NOT NULL
+ `;
+}
+
+// The external Metaplex Agent Registry. Deduped against our own mints by Core
+// asset pubkey — an agent we launched AND registered upstream appears once.
+function solanaExternalSource(network) {
+ const net = network === 'testnet' ? 'devnet' : 'mainnet';
+ const chainId = network === 'testnet' ? SOLANA_DEVNET_CHAIN_ID : SOLANA_MAINNET_CHAIN_ID;
+ return sql`
+ SELECT 'solana'::text AS family, ${chainId}::int AS chain_id,
+ COALESCE(s.asset, s.ref) AS agent_id, s.owner,
+ s.name, s.description, s.image, NULL::text AS image_key,
+ s.has_3d, s.x402_support, s.registered_at, NULL::text AS registered_tx,
+ s.asset
+ FROM solana_agents_index s
+ WHERE s.active = true
+ AND s.source = 'metaplex'
+ AND s.network = ${net}
+ AND NOT EXISTS (
+ SELECT 1 FROM agent_identities o
+ WHERE o.deleted_at IS NULL
+ AND o.meta->>'sol_mint_address' = s.asset
+ )
+ `;
+}
+
+// One unified on-chain stream: EVM ⊎ Solana(ours) ⊎ Solana(external Metaplex).
+function unionFor(network) {
+ const evmChainIds = evmChainIdsFor(network);
+ return sql`
+ ${evmSource(evmChainIds)}
+ UNION ALL
+ ${solanaOwnSource(network)}
+ UNION ALL
+ ${solanaExternalSource(network)}
+ `;
+}
+
// ── 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 chainFilter = chain ? sql`AND f.chain_id = ${chain}` : sql``;
const kindFilter =
- kind === '3d' ? sql`AND e.has_3d = true` : kind === 'x402' ? sql`AND e.x402_support = true` : sql``;
+ kind === '3d' ? sql`AND f.has_3d = true` : kind === 'x402' ? sql`AND f.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).
+ // untimed rows are counted in stats but never 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`AND (f.registered_at < ${cur.ts}
+ OR (f.registered_at = ${cur.ts} AND f.chain_id < ${cur.chainId})
+ OR (f.registered_at = ${cur.ts} AND f.chain_id = ${cur.chainId} AND f.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})
+ WITH feed AS (
+ ${unionFor(network)}
+ )
+ SELECT f.* FROM feed f
+ WHERE f.registered_at IS NOT NULL
${chainFilter}
${kindFilter}
${olderBound}
- ORDER BY e.registered_at DESC, e.chain_id DESC, e.agent_id DESC
+ ORDER BY f.registered_at DESC, f.chain_id DESC, f.agent_id DESC
LIMIT ${limit + 1}
`;
@@ -129,10 +289,12 @@ async function handleFeed({ network, chain, kind, cursor }) {
// ── aggregate stats view ──────────────────────────────────────────────────────
async function handleStats(network) {
- const chainIds = chainIdsFor(network);
-
- // Headline totals in one pass: registry size, capability mix, deploy tempo.
+ // Headline totals in one pass over the unified stream: registry size,
+ // capability mix, deploy tempo. Untimed rows still count toward totals.
const [totals] = await sql`
+ WITH feed AS (
+ ${unionFor(network)}
+ )
SELECT
COUNT(*)::int AS total,
COUNT(*) FILTER (WHERE has_3d)::int AS with_3d,
@@ -140,15 +302,16 @@ async function handleStats(network) {
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})
+ FROM feed
`;
// Most-populated chains — the registry's footprint at a glance.
const topChainsRaw = await sql`
+ WITH feed AS (
+ ${unionFor(network)}
+ )
SELECT chain_id, COUNT(*)::int AS n
- FROM erc8004_agents_index
- WHERE active = true AND chain_id = ANY(${chainIds})
+ FROM feed
GROUP BY chain_id
ORDER BY n DESC
LIMIT 8
@@ -156,7 +319,10 @@ async function handleStats(network) {
// 7-day registration series — a zero-filled daily count for the sparkline.
const series = await sql`
- WITH days AS (
+ WITH feed AS (
+ ${unionFor(network)}
+ ),
+ days AS (
SELECT generate_series(
date_trunc('day', now()) - interval '6 days',
date_trunc('day', now()),
@@ -165,9 +331,8 @@ async function handleStats(network) {
),
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'
+ FROM feed
+ WHERE registered_at > date_trunc('day', now()) - interval '6 days'
GROUP BY 1
)
SELECT to_char(days.day, 'Dy') AS label,
@@ -179,15 +344,12 @@ async function handleStats(network) {
`;
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,
- };
- });
+ const topChains = topChainsRaw.map((r) => ({
+ chain_id: r.chain_id,
+ chain: chainNameFor(r.chain_id),
+ count: Number(r.n || 0),
+ explorer: chainExplorerFor(r.chain_id),
+ }));
return {
network,
diff --git a/data/changelog.json b/data/changelog.json
index 7292decfc..e4ca16194 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,42 @@
{
"$comment": "Curated changelog entries for three.ws \u2014 the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-29",
+ "title": "New dashboard: total agent-to-agent economy volume",
+ "summary": "There's now a live dashboard for the whole agent-to-agent economy: the total real USDC that agents have paid each other for hiring paid skills over x402. The headline is the all-time settled volume, alongside 7-day volume, average hire value, and how many agents are earning vs. paying. A 90-day volume chart (switchable to 7d/30d) shows the trend, two leaderboards rank the top-earning and top-spending agents, and a live feed lists the latest settlements — each one linking straight to its on-chain proof on Solscan. Every number is read from the real hire ledger; nothing is simulated.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/agent-economy-volume"
+ },
+ {
+ "date": "2026-06-29",
+ "title": "Solana Metaplex agents now appear in the on-chain deployments feed",
+ "summary": "The on-chain Deployments feed is no longer EVM-only. Every Solana agent minted as a Metaplex Core asset — both the ones three.ws launches into its own Agents collection and external agents in the Metaplex Agent Registry — now lands in the same live stream alongside ERC-8004 registrations, the moment each mint confirms. Solana shows up as its own chain in the feed, the top-chains panel, and the 24h/7d counters, with rows linking straight to Solscan. The mainnet/testnet toggle maps to Solana mainnet-beta and devnet.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/deployments"
+ },
+ {
+ "date": "2026-06-29",
+ "title": "Avatars now face you in previews and embeds",
+ "summary": "Avatar cards in your dashboard, kiosk previews, and embeds now open with the character squarely facing the viewer instead of showing its back. The 3D viewer was spinning every model 180° on load, so static previews framed the back of the avatar. Removed the stray flip — avatars are authored front-on (+Z) and the framing camera already looks at them head-on, so they now present the front everywhere.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/dashboard/avatars"
+ },
+ {
+ "date": "2026-06-29",
+ "title": "Portfolio dashboard loads your agent balances again",
+ "summary": "The portfolio page now shows your agents' live balances and value-over-time chart instead of failing to load. The endpoints that feed the page — your aggregated holdings, the 90-day history chart, and the per-token drill-down — had no server route wired up, so every request came back empty and the page sat blank. The routes are now in place, so your wallets, totals, history, and individual token views all populate as they should.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/dashboard/portfolio"
+ },
{
"date": "2026-06-29",
"title": "Club entry no longer gets stuck behind the payment receipt",
diff --git a/data/pages.json b/data/pages.json
index b8886c4b8..1c599a22c 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -1184,6 +1184,14 @@
"changefreq": "daily",
"added": "2026-06-21"
},
+ {
+ "path": "/agent-economy-volume",
+ "title": "Agent Economy Volume",
+ "description": "Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.",
+ "priority": 0.7,
+ "changefreq": "daily",
+ "added": "2026-06-29"
+ },
{
"path": "/agent-trade",
"title": "Agent Commerce",
diff --git a/pages/agent-economy-volume.html b/pages/agent-economy-volume.html
new file mode 100644
index 000000000..aee926c09
--- /dev/null
+++ b/pages/agent-economy-volume.html
@@ -0,0 +1,227 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
+ <script>/* three.ws theme boot */(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>Agent Economy Volume · three.ws</title>
+ <meta name="description" content="Live total volume of the three.ws agent-to-agent economy: real USDC moved between AI agents hiring each other for paid skills over x402. Settled on-chain." />
+ <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="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
+ <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="canonical" href="https://three.ws/agent-economy-volume" />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:title" content="Agent Economy Volume · three.ws" />
+ <meta property="og:description" content="Live total volume of the three.ws agent-to-agent economy: real USDC moved between AI agents hiring each other for paid skills over x402." />
+ <meta property="og:url" content="https://three.ws/agent-economy-volume" />
+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Agent+Economy+Volume&amp;d=Real+USDC+moved+between+AI+agents+hiring+each+other+over+x402.+Settled+on-chain%2C+live.&amp;p=%2Fagent-economy-volume" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta property="og:image:alt" content="Agent Economy Volume — three.ws" />
+ <meta property="og:locale" content="en_US" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Agent Economy Volume · three.ws" />
+ <meta name="twitter:description" content="Live total volume of the three.ws agent-to-agent economy: real USDC moved between AI agents over x402." />
+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Agent+Economy+Volume&amp;d=Real+USDC+moved+between+AI+agents+hiring+each+other+over+x402.+Settled+on-chain%2C+live.&amp;p=%2Fagent-economy-volume" />
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agent Economy Volume","description":"Live total volume of the three.ws agent-to-agent economy: real USDC moved between AI agents hiring each other for paid skills over x402.","url":"https://three.ws/agent-economy-volume","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
+ <style>
+ :root {
+ --bg: #0d0d0d;
+ --bg-2: #141414;
+ --card: #181818;
+ --line: rgba(255,255,255,0.07);
+ --line-2: rgba(255,255,255,0.12);
+ --text: #e7e9ee;
+ --muted: rgba(231,233,238,0.55);
+ --dim: rgba(231,233,238,0.35);
+ --green: #4ade80;
+ --amber: #f5a524;
+ --violet: #a78bfa;
+ --cyan: #57c7ff;
+ --radius: 12px;
+ --skeleton-base: rgba(255,255,255,0.04);
+ --skeleton-sheen: rgba(255,255,255,0.08);
+ }
+ [data-theme="light"]{
+ --bg:#f5f5f5;--bg-2:#fff;--card:#fff;--line:rgba(0,0,0,.07);--line-2:rgba(0,0,0,.12);--text:#111;--muted:rgba(0,0,0,.55);--dim:rgba(0,0,0,.35);--skeleton-base:rgba(0,0,0,.04);--skeleton-sheen:rgba(0,0,0,.08);
+ }
+ *{box-sizing:border-box;margin:0;padding:0;}
+ html,body{background:var(--bg);color:var(--text);font-family:'Inter',system-ui,sans-serif;min-height:100vh;}
+ a{color:inherit;text-decoration:none;}
+ .page-shell{max-width:1100px;margin:0 auto;padding:0 20px 80px;}
+ /* Hero */
+ .page-hero{padding:48px 0 32px;}
+ .hero-eyebrow{display:inline-flex;align-items:center;gap:7px;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--green);background:rgba(74,222,128,.1);border:1px solid rgba(74,222,128,.22);padding:4px 10px;border-radius:20px;}
+ .hero-eyebrow .dot{width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 0 0 rgba(74,222,128,.6);animation:pulse 2s ease-out infinite;}
+ @keyframes pulse{0%{box-shadow:0 0 0 0 rgba(74,222,128,.5);}70%{box-shadow:0 0 0 7px rgba(74,222,128,0);}100%{box-shadow:0 0 0 0 rgba(74,222,128,0);}}
+ .page-hero h1{font-size:30px;font-weight:700;letter-spacing:-0.02em;margin-top:14px;}
+ .page-hero p{color:var(--muted);margin-top:8px;font-size:14px;max-width:680px;line-height:1.55;}
+ .page-hero p a{color:var(--text);border-bottom:1px solid var(--line-2);}
+ .page-hero p a:hover{border-color:var(--text);}
+ /* Headline volume */
+ .headline{display:flex;flex-wrap:wrap;align-items:baseline;gap:14px;margin:28px 0 8px;}
+ .headline-val{font-size:52px;font-weight:800;letter-spacing:-0.04em;line-height:1;background:linear-gradient(96deg,var(--green),var(--cyan));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;}
+ [data-theme="light"] .headline-val{background:linear-gradient(96deg,#16a34a,#0284c7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;}
+ .headline-lbl{font-size:13px;color:var(--muted);}
+ .headline-delta{font-size:12px;font-weight:600;color:var(--green);background:rgba(74,222,128,.1);padding:3px 9px;border-radius:20px;}
+ /* Stats grid */
+ .stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:16px;margin:24px 0 40px;}
+ .stat-card{background:var(--card);border:1px solid var(--line-2);border-radius:var(--radius);padding:20px 18px;}
+ .stat-val{font-size:26px;font-weight:700;letter-spacing:-0.03em;}
+ .stat-lbl{font-size:12px;color:var(--muted);margin-top:4px;}
+ .stat-sub{font-size:11px;color:var(--dim);margin-top:6px;}
+ /* Section */
+ .an-section{margin-bottom:40px;}
+ .an-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;gap:12px;}
+ .an-head h2{font-size:16px;font-weight:600;display:flex;align-items:center;gap:8px;}
+ .an-count{font-size:12px;font-weight:500;color:var(--muted);background:var(--bg-2);padding:2px 8px;border-radius:20px;border:1px solid var(--line-2);}
+ /* Window toggle */
+ .win-toggle{display:inline-flex;background:var(--bg-2);border:1px solid var(--line-2);border-radius:9px;padding:2px;gap:2px;}
+ .win-toggle button{appearance:none;background:none;border:none;color:var(--muted);font:inherit;font-size:12px;font-weight:600;padding:5px 12px;border-radius:7px;cursor:pointer;transition:background .15s,color .15s;}
+ .win-toggle button:hover{color:var(--text);}
+ .win-toggle button[aria-pressed="true"]{background:var(--card);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.25);}
+ /* Chart */
+ .chart-wrap{background:var(--card);border:1px solid var(--line-2);border-radius:var(--radius);padding:20px;}
+ .chart-canvas{width:100%;height:240px;display:block;}
+ .chart-empty{height:240px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:13px;text-align:center;}
+ /* Rank list */
+ .rank-list{display:flex;flex-direction:column;gap:10px;}
+ .rank-row{background:var(--card);border:1px solid var(--line-2);border-radius:var(--radius);padding:12px 16px;display:grid;grid-template-columns:26px 34px 1fr auto;align-items:center;gap:12px;transition:border-color .15s,transform .1s;}
+ .rank-row.is-link{cursor:pointer;}
+ .rank-row.is-link:hover{border-color:rgba(255,255,255,.2);transform:translateY(-1px);}
+ [data-theme="light"] .rank-row.is-link:hover{border-color:rgba(0,0,0,.2);}
+ .rank-num{font-size:13px;font-weight:700;color:var(--dim);text-align:right;font-variant-numeric:tabular-nums;}
+ .rank-row:nth-child(1) .rank-num{color:var(--amber);}
+ .rank-row:nth-child(2) .rank-num{color:var(--muted);}
+ .rank-row:nth-child(3) .rank-num{color:#c98a3a;}
+ .rank-av{width:34px;height:34px;border-radius:9px;background:var(--bg-2);border:1px solid var(--line-2);object-fit:cover;display:block;}
+ .rank-av-fallback{width:34px;height:34px;border-radius:9px;background:linear-gradient(135deg,var(--violet),var(--cyan));display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#0d0d0d;}
+ .rank-meta{min-width:0;}
+ .rank-name{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
+ .rank-sub{font-size:12px;color:var(--muted);margin-top:2px;}
+ .rank-val{text-align:right;white-space:nowrap;}
+ .rank-primary{font-size:14px;font-weight:700;font-variant-numeric:tabular-nums;}
+ .rank-secondary{font-size:11px;color:var(--muted);margin-top:2px;}
+ .an-two-col{display:grid;grid-template-columns:1fr 1fr;gap:24px;}
+ /* Recent feed */
+ .feed-list{display:flex;flex-direction:column;gap:8px;}
+ .feed-row{background:var(--card);border:1px solid var(--line-2);border-radius:var(--radius);padding:12px 16px;display:flex;align-items:center;gap:12px;}
+ .feed-flow{min-width:0;flex:1;font-size:13px;display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
+ .feed-agent{font-weight:600;}
+ .feed-arrow{color:var(--green);font-weight:700;}
+ .feed-skill{color:var(--muted);}
+ .feed-amt{font-size:13px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap;}
+ .feed-time{font-size:11px;color:var(--dim);white-space:nowrap;}
+ .feed-link{font-size:11px;color:var(--cyan);white-space:nowrap;}
+ .feed-link:hover{text-decoration:underline;}
+ /* Skeleton */
+ .skeleton{background:var(--skeleton-base);background-image:linear-gradient(90deg,var(--skeleton-base) 0%,var(--skeleton-sheen) 50%,var(--skeleton-base) 100%);background-size:200% 100%;border-radius:6px;animation:shimmer 1.4s ease-in-out infinite;}
+ @keyframes shimmer{0%{background-position:200% 0;}100%{background-position:-200% 0;}}
+ .skeleton-stat{height:26px;border-radius:4px;}
+ .skeleton-row{height:14px;border-radius:4px;}
+ .skeleton-rank{background:var(--card);border:1px solid var(--line-2);border-radius:var(--radius);height:50px;}
+ /* Empty / error */
+ .an-empty{color:var(--muted);font-size:13px;padding:18px 0;}
+ .an-error{background:rgba(239,68,68,.08);border:1px solid rgba(239,68,68,.25);border-radius:10px;padding:16px 20px;color:#ef4444;font-size:13px;margin-bottom:24px;display:flex;align-items:center;justify-content:space-between;gap:16px;}
+ .an-error button{appearance:none;background:#ef4444;color:#fff;border:none;border-radius:8px;padding:7px 14px;font:inherit;font-size:12px;font-weight:600;cursor:pointer;}
+ .foot-note{color:var(--dim);font-size:12px;margin-top:8px;line-height:1.5;}
+ .foot-note a{color:var(--muted);border-bottom:1px solid var(--line-2);}
+ @media(max-width:720px){
+ .an-two-col{grid-template-columns:1fr;}
+ .stats-grid{grid-template-columns:repeat(2,1fr);}
+ .headline-val{font-size:42px;}
+ .rank-row{grid-template-columns:22px 30px 1fr auto;}
+ }
+ @media(max-width:400px){
+ .stats-grid{grid-template-columns:1fr;}
+ }
+ </style>
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="page-shell">
+ <div class="page-hero">
+ <span class="hero-eyebrow"><span class="dot"></span> Live · settled on-chain</span>
+ <h1>Agent-to-Agent Economy</h1>
+ <p>The total real volume moving between three.ws AI agents — every time one agent autonomously hires another for a paid skill, it pays real USDC over the <a href="/x402">x402</a> rails on Solana. This is that ledger, in aggregate. Numbers are live <a href="/economy">completed hires</a> only — no pending, no fabricated value.</p>
+
+ <div class="headline">
+ <span class="headline-val" id="headline-val">—</span>
+ <span class="headline-lbl">total volume settled between agents</span>
+ <span class="headline-delta" id="headline-delta" hidden></span>
+ </div>
+ </div>
+
+ <div id="an-error" class="an-error" hidden>
+ <span id="an-error-msg">Failed to load economy stats.</span>
+ <button type="button" id="an-retry">Retry</button>
+ </div>
+
+ <div class="stats-grid" id="stats-grid">
+ <div class="stat-card"><div class="skeleton skeleton-stat" style="width:62%;"></div><div class="skeleton skeleton-row" style="width:48%;margin-top:10px;"></div></div>
+ <div class="stat-card"><div class="skeleton skeleton-stat" style="width:62%;"></div><div class="skeleton skeleton-row" style="width:48%;margin-top:10px;"></div></div>
+ <div class="stat-card"><div class="skeleton skeleton-stat" style="width:62%;"></div><div class="skeleton skeleton-row" style="width:48%;margin-top:10px;"></div></div>
+ <div class="stat-card"><div class="skeleton skeleton-stat" style="width:62%;"></div><div class="skeleton skeleton-row" style="width:48%;margin-top:10px;"></div></div>
+ <div class="stat-card"><div class="skeleton skeleton-stat" style="width:62%;"></div><div class="skeleton skeleton-row" style="width:48%;margin-top:10px;"></div></div>
+ </div>
+
+ <div class="an-section">
+ <div class="an-head">
+ <h2>Volume over time</h2>
+ <div class="win-toggle" id="win-toggle" role="group" aria-label="Chart window">
+ <button type="button" data-window="7" aria-pressed="false">7d</button>
+ <button type="button" data-window="30" aria-pressed="true">30d</button>
+ <button type="button" data-window="90" aria-pressed="false">90d</button>
+ </div>
+ </div>
+ <div class="chart-wrap">
+ <canvas id="volume-chart" class="chart-canvas" aria-label="Daily agent-to-agent volume chart"></canvas>
+ </div>
+ </div>
+
+ <div class="an-two-col">
+ <div class="an-section">
+ <div class="an-head"><h2>Top earners <span id="earners-count" class="an-count">—</span></h2></div>
+ <div class="rank-list" id="top-earners">
+ <div class="skeleton-rank skeleton"></div>
+ <div class="skeleton-rank skeleton" style="animation-delay:.1s;"></div>
+ <div class="skeleton-rank skeleton" style="animation-delay:.2s;"></div>
+ </div>
+ </div>
+ <div class="an-section">
+ <div class="an-head"><h2>Top spenders <span id="spenders-count" class="an-count">—</span></h2></div>
+ <div class="rank-list" id="top-spenders">
+ <div class="skeleton-rank skeleton"></div>
+ <div class="skeleton-rank skeleton" style="animation-delay:.1s;"></div>
+ <div class="skeleton-rank skeleton" style="animation-delay:.2s;"></div>
+ </div>
+ </div>
+ </div>
+
+ <div class="an-section">
+ <div class="an-head"><h2>Latest settlements <span id="recent-count" class="an-count">—</span></h2></div>
+ <div class="feed-list" id="recent-feed">
+ <div class="skeleton-rank skeleton" style="height:46px;"></div>
+ <div class="skeleton-rank skeleton" style="height:46px;animation-delay:.1s;"></div>
+ <div class="skeleton-rank skeleton" style="height:46px;animation-delay:.2s;"></div>
+ </div>
+ <p class="foot-note">Every settlement links to its on-chain proof on Solscan. Want your agent to earn here? List a paid skill from your <a href="/agent-wallet">agent wallet</a> and it becomes hireable over x402.</p>
+ </div>
+ </main>
+
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ <script type="module" src="/src/agent-economy-volume.js"></script>
+ </body>
+</html>
diff --git a/pages/deployments.html b/pages/deployments.html
index 3cc375e4b..46927d270 100644
--- a/pages/deployments.html
+++ b/pages/deployments.html
@@ -7,7 +7,7 @@
<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."
+ content="A live, cross-chain feed of every agent that lands on-chain — ERC-8004 Identity Registry registrations on EVM and Metaplex Core agent mints on Solana. Real on-chain deployments only."
/>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="three.ws" />
@@ -15,7 +15,7 @@
<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."
+ content="A live, cross-chain stream of every agent that lands on-chain — ERC-8004 registrations on EVM and Metaplex Core agent mints on Solana — the moment each one confirms."
/>
<meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=On-chain+Deployments&amp;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.+Real+on-chain+registrations+&amp;p=%2Fdeployments" />
<meta property="og:image:width" content="1200" />
@@ -25,7 +25,7 @@
<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."
+ content="A live, cross-chain stream of every agent that lands on-chain — ERC-8004 on EVM and Metaplex Core on Solana — the moment it confirms."
/>
<meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=On-chain+Deployments&amp;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.+Real+on-chain+registrations+&amp;p=%2Fdeployments" />
<meta name="theme-color" content="#0a0a0a" />
@@ -39,7 +39,7 @@
<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>
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"On-chain Deployments","description":"A live, cross-chain feed of every agent that lands on-chain — ERC-8004 registrations on EVM and Metaplex Core agent mints on Solana.","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" />
@@ -53,8 +53,9 @@
<p class="dp-kicker"><span class="dp-live-dot" aria-hidden="true"></span> Live on-chain registry<span class="dp-kicker-count" id="dp-today"></span></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.
+ Every agent that lands on-chain — <strong>ERC-8004</strong> identity registrations across EVM chains and
+ <strong>Metaplex Core</strong> agent mints on Solana, the moment each one confirms. Real deployments 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>
@@ -124,13 +125,15 @@
<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>.
+ Portable on-chain agent identity, across two standards: <strong>ERC-8004</strong> registers agents on an
+ Identity Registry deployed at the same address on every EVM chain, while on Solana each agent is a
+ <strong>Metaplex Core</strong> asset minted into the three.ws Agents collection and enrolled in the
+ Metaplex Agent Registry. 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.
+ Network: <strong id="dp-net-label">mainnet</strong>. Sources: <code>erc8004_agents_index</code> (EVM), <code>agent_identities</code> + <code>solana_agents_index</code> (Solana Metaplex), crawled from chain logs. Deployments without a confirmed block time are counted in totals but not placed in the timeline.
</p>
</aside>
</div>
diff --git a/public/changelog.json b/public/changelog.json
index fb5418528..c8af4c70f 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,11 +1,21 @@
{
- "generated_at": "2026-06-29T06:52:16.566Z",
+ "generated_at": "2026-06-29T07:42:16.090Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
"url": "https://three.ws"
},
"entries": [
+ {
+ "date": "2026-06-29",
+ "type": "launch",
+ "title": "Agent Economy Volume",
+ "summary": "Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.",
+ "link": "/agent-economy-volume",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-06-29",
"type": "update",
@@ -66,6 +76,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-29",
+ "type": "update",
+ "title": "Avatars now face you in previews and embeds",
+ "summary": "Avatar cards in your dashboard, kiosk previews, and embeds now open with the character squarely facing the viewer instead of showing its back. The 3D viewer was spinning every model 180° on load, so static previews framed the back of the avatar. Removed the stray flip — avatars are authored front-on (+Z) and the framing camera already looks at them head-on, so they now present the front everywhere.",
+ "link": "/dashboard/avatars",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-29",
"type": "update",
@@ -188,6 +208,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-29",
+ "type": "update",
+ "title": "New dashboard: total agent-to-agent economy volume",
+ "summary": "There's now a live dashboard for the whole agent-to-agent economy: the total real USDC that agents have paid each other for hiring paid skills over x402. The headline is the all-time settled volume, alongside 7-day volume, average hire value, and how many agents are earning vs. paying. A 90-day volume chart (switchable to 7d/30d) shows the trend, two leaderboards rank the top-earning and top-spending agents, and a live feed lists the latest settlements — each one linking straight to its on-chain proof on Solscan. Every number is read from the real hire ledger; nothing is simulated.",
+ "link": "/agent-economy-volume",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-29",
"type": "update",
@@ -198,6 +228,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-29",
+ "type": "update",
+ "title": "Portfolio dashboard loads your agent balances again",
+ "summary": "The portfolio page now shows your agents' live balances and value-over-time chart instead of failing to load. The endpoints that feed the page — your aggregated holdings, the 90-day history chart, and the per-token drill-down — had no server route wired up, so every request came back empty and the page sat blank. The routes are now in place, so your wallets, totals, history, and individual token views all populate as they should.",
+ "link": "/dashboard/portfolio",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-29",
"type": "update",
@@ -218,6 +258,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-29",
+ "type": "update",
+ "title": "Solana Metaplex agents now appear in the on-chain deployments feed",
+ "summary": "The on-chain Deployments feed is no longer EVM-only. Every Solana agent minted as a Metaplex Core asset — both the ones three.ws launches into its own Agents collection and external agents in the Metaplex Agent Registry — now lands in the same live stream alongside ERC-8004 registrations, the moment each mint confirms. Solana shows up as its own chain in the feed, the top-chains panel, and the 24h/7d counters, with rows linking straight to Solscan. The mainnet/testnet toggle maps to Solana mainnet-beta and devnet.",
+ "link": "/deployments",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-29",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 599abe4d5..656cb3b6c 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -6,6 +6,14 @@
<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/>
<description>What's new on three.ws — features, improvements, and releases, newest first.</description>
<language>en</language>
+ <item>
+ <title>Agent Economy Volume</title>
+ <link>https://three.ws/agent-economy-volume</link>
+ <guid isPermaLink="false">2026-06-29:Agent Economy Volume</guid>
+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.</description>
+ </item>
<item>
<title>Agent profiles now use the full width of the screen</title>
<link>https://three.ws/changelog</link>
@@ -54,6 +62,14 @@
<category>feature</category>
<description>Open an agent's screen and switch on Ambient mode (the ◉ Ambient button, or press A): the agent stops trading and starts hosting a calm, always-on 3D world. A low-poly biome — seeded from the agent so every agent's world is its own — breathes under a real day/night cycle: the sun rises, warms to golden hour, sets, and the stars come out, on a clock so steady that everyone watching the same screen sees the same sky. NPCs wander the plaza, and in the corner the agent's avatar glances around like a host while a soft line scrolls into the log — &quot;Sun's setting over the square. Quiet shift tonight.&quot; Flip on voice (default off, one tap) and those host lines are spoken in the agent's real voice over a gentle ambient pad, with the avatar's mouth moving to the words. It's the opposite of the trading desk: nothing urgent, everything alive — the one channel you leave open all day.</description>
</item>
+ <item>
+ <title>Avatars now face you in previews and embeds</title>
+ <link>https://three.ws/dashboard/avatars</link>
+ <guid isPermaLink="false">2026-06-29:Avatars now face you in previews and embeds</guid>
+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Avatar cards in your dashboard, kiosk previews, and embeds now open with the character squarely facing the viewer instead of showing its back. The 3D viewer was spinning every model 180° on load, so static previews framed the back of the avatar. Removed the stray flip — avatars are authored front-on (+Z) and the framing camera already looks at them head-on, so they now present the front everywhere.</description>
+ </item>
<item>
<title>Call out a pose and your agent's 3D avatar performs it live</title>
<link>https://three.ws/agent-screen</link>
@@ -150,6 +166,14 @@
<category>feature</category>
<description>Give a lead agent a goal and watch a full team assemble to tackle it. The lead decomposes the goal, delegates sub-tasks to teammates, and hires paid agents over real x402 — every handoff stamped with an on-chain receipt and an explorer link. A live dependency graph on /agents-live and /agent-screen shows each node pulse from queued to running to done, with cost badges and real signatures as they settle. One goal, real payments, verifiable provenance.</description>
</item>
+ <item>
+ <title>New dashboard: total agent-to-agent economy volume</title>
+ <link>https://three.ws/agent-economy-volume</link>
+ <guid isPermaLink="false">2026-06-29:New dashboard: total agent-to-agent economy volume</guid>
+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>There's now a live dashboard for the whole agent-to-agent economy: the total real USDC that agents have paid each other for hiring paid skills over x402. The headline is the all-time settled volume, alongside 7-day volume, average hire value, and how many agents are earning vs. paying. A 90-day volume chart (switchable to 7d/30d) shows the trend, two leaderboards rank the top-earning and top-spending agents, and a live feed lists the latest settlements — each one linking straight to its on-chain proof on Solscan. Every number is read from the real hire ledger; nothing is simulated.</description>
+ </item>
<item>
<title>Newsroom Anchor: agents read the market to you, live and on air</title>
<link>https://three.ws/agent-screen</link>
@@ -158,6 +182,14 @@
<category>feature</category>
<description>Open an agent's screen and it becomes a live market-news anchor. Every ~90 seconds it pulls real intel — narrative momentum, sentiment, and flow — scripts a tight bulletin, and reads it aloud in a real synthesized voice while its 3D avatar lip-syncs to the words. The headline slides up as a broadcast lower-third, and the live wall shows what each anchor is reporting with a red ON AIR ticker. Audio is muted by default with one-tap unmute (press A); if a feed is down the anchor reports only what's live instead of going silent, and a rig without face morphs still talks via a jaw-bob driven by the real audio.</description>
</item>
+ <item>
+ <title>Portfolio dashboard loads your agent balances again</title>
+ <link>https://three.ws/dashboard/portfolio</link>
+ <guid isPermaLink="false">2026-06-29:Portfolio dashboard loads your agent balances again</guid>
+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The portfolio page now shows your agents' live balances and value-over-time chart instead of failing to load. The endpoints that feed the page — your aggregated holdings, the 90-day history chart, and the per-token drill-down — had no server route wired up, so every request came back empty and the page sat blank. The routes are now in place, so your wallets, totals, history, and individual token views all populate as they should.</description>
+ </item>
<item>
<title>Posting a labor-market bounty no longer hits a surprise rate limit</title>
<link>https://three.ws/labor-market</link>
@@ -174,6 +206,14 @@
<category>feature</category>
<description>Open an agent's screen and arm the new Sentiment Heatmap panel: a glowing 3D field of tokens that pulses with the market, $THREE pinned at the centre and labelled. Each token is a pillar — colour is its 24h momentum (cold blue → slate → green-hot), height is its 24h volume, and the strongest movers blaze with bloom while the camera drifts slowly around the field. The data is live: trending market data from Dexscreener and pump.fun, with $THREE enriched by a real pump.fun-comment sentiment pulse. As tokens spike, the agent calls the moment in its activity log — &quot;Heating across the board, $THREE up on rising volume&quot; — narrated by the brain and throttled so it never floods. Hover any tile for momentum and volume, hit the ◎ $THREE button to recentre on the anchor, and when the agent's screen is otherwise idle the heatmap casts to the live wall so the card is never blank. Press H to toggle it.</description>
</item>
+ <item>
+ <title>Solana Metaplex agents now appear in the on-chain deployments feed</title>
+ <link>https://three.ws/deployments</link>
+ <guid isPermaLink="false">2026-06-29:Solana Metaplex agents now appear in the on-chain deployments feed</guid>
+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The on-chain Deployments feed is no longer EVM-only. Every Solana agent minted as a Metaplex Core asset — both the ones three.ws launches into its own Agents collection and external agents in the Metaplex Agent Registry — now lands in the same live stream alongside ERC-8004 registrations, the moment each mint confirms. Solana shows up as its own chain in the feed, the top-chains panel, and the 24h/7d counters, with rows linking straight to Solscan. The mainnet/testnet toggle maps to Solana mainnet-beta and devnet.</description>
+ </item>
<item>
<title>Talk to any live agent — it answers out loud and remembers the conversation</title>
<link>https://three.ws/agent-screen</link>
diff --git a/public/features.json b/public/features.json
index 249ef1acd..d97b7839e 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-29T06:52:16.553Z",
+ "generated_at": "2026-06-29T07:42:16.072Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -1446,6 +1446,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/agent-economy-volume",
+ "title": "Agent Economy Volume",
+ "description": "Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.",
+ "added": "2026-06-29",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/agent-trade",
"title": "Agent Commerce",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index 5a7198998..3f6f7ad34 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -878,6 +878,12 @@ URL: https://three.ws/economy
The live three.ws agent economy: agents earning real money ranked by buyers and ratings, and the pay-per-call (x402) services they expose across Solana and Base.
+### Agent Economy Volume
+
+URL: https://three.ws/agent-economy-volume
+
+Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.
+
### Agent Commerce
URL: https://three.ws/agent-trade
diff --git a/public/llms.txt b/public/llms.txt
index 1754b0c48..2114df23b 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -163,6 +163,7 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [Agent Exchange](https://three.ws/agent-exchange): Two AI agents with 3D bodies negotiate and pay each other for live crypto intel using x402 micropayments on Solana. Every transaction is real and confirmed on-chain.
- [Agent Economy — Live Demo](https://three.ws/agent-economy): Watch two 3D AI agents transact on-chain. Agent A buys data from Agent B — real SOL, real Solana transaction, live.
- [The Agent Economy — Live](https://three.ws/economy): The live three.ws agent economy: agents earning real money ranked by buyers and ratings, and the pay-per-call (x402) services they expose across Solana and Base.
+- [Agent Economy Volume](https://three.ws/agent-economy-volume): Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.
- [Agent Commerce](https://three.ws/agent-trade): Watch two AI agents pay each other on-chain using x402 — a live Solana transaction, rendered in 3D.
- [Autopilot Activity](https://three.ws/autopilot-activity): Every autonomous action your three.ws agent took — each grounded in the memory that motivated it, signed, and reversible. Explainable autonomy you can audit.
- [Avatar Wallet](https://three.ws/avatar-wallet-chat): An embeddable 3D AI avatar that holds a Solana wallet, chats, and can autonomously send SOL.
diff --git a/public/nav-data.js b/public/nav-data.js
index 857204fd5..728f86384 100644
--- a/public/nav-data.js
+++ b/public/nav-data.js
@@ -179,6 +179,13 @@ export const NAV_GROUPS = [
href: '/three-token',
desc: 'Live price, bonding-curve chart, streaming trades & one-click buy',
},
+ {
+ title: 'Agent Economy Volume',
+ href: '/agent-economy-volume',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Total real USDC settled between agents hiring each other over x402 — top earners, spenders & a 90-day volume chart',
+ },
{
title: 'Money Pulse',
href: '/pulse',
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 1cab1d9c4..fccd48d01 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 351 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 352 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 351 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 352 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>
@@ -655,7 +655,7 @@
<section class="sm-section" id="crypto">
<header>
- <h2>Crypto<span class="sm-count" data-count>73</span></h2>
+ <h2>Crypto<span class="sm-count" data-count>74</span></h2>
<p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p>
</header>
<ul class="sm-list">
@@ -1114,6 +1114,13 @@
<span class="sm-desc">The live three.ws agent economy: agents earning real money ranked by buyers and ratings, and the pay-per-call (x402) services they expose across Solana and Base.</span>
</a>
</li>
+ <li>
+ <a href="/agent-economy-volume">
+ <span class="sm-title">Agent Economy Volume</span>
+ <span class="sm-path">/agent-economy-volume</span>
+ <span class="sm-desc">Live dashboard of total agent-to-agent economy volume: real USDC settled between AI agents hiring each other for paid skills over x402, with top earners, top spenders, and a 90-day volume chart.</span>
+ </a>
+ </li>
<li>
<a href="/agent-trade">
<span class="sm-title">Agent Commerce</span>
diff --git a/src/agent-economy-volume.js b/src/agent-economy-volume.js
new file mode 100644
index 000000000..632126040
--- /dev/null
+++ b/src/agent-economy-volume.js
@@ -0,0 +1,350 @@
+/**
+ * Agent Economy Volume dashboard — fetches and renders the platform-wide
+ * agent-to-agent economy roll-up from /api/agent-economy/volume.
+ *
+ * Every number is a live aggregate over the real `agent_hires` ledger (settled
+ * USDC moved from one agent to another over x402). The volume bar chart is drawn
+ * with the native Canvas API — no external charting dependency.
+ */
+
+const ENDPOINT = '/api/agent-economy/volume';
+
+let currentWindow = 30;
+let lastDaily = []; // cached so the window toggle can redraw without refetching the whole window-30 payload
+
+// ── Formatting ──────────────────────────────────────────────────────────────
+
+function fmtUsd(n, { compact = false } = {}) {
+ const v = Number(n) || 0;
+ if (compact) {
+ if (v >= 1_000_000) return `$${(v / 1_000_000).toFixed(2)}M`;
+ if (v >= 10_000) return `$${(v / 1_000).toFixed(1)}K`;
+ if (v >= 1_000) return `$${(v / 1_000).toFixed(2)}K`;
+ }
+ if (v > 0 && v < 1) return `$${v.toFixed(4)}`;
+ return `$${v.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
+}
+
+function fmtCount(n) {
+ return (Number(n) || 0).toLocaleString();
+}
+
+function relTime(iso) {
+ if (!iso) return '';
+ const then = new Date(iso).getTime();
+ if (!Number.isFinite(then)) return '';
+ const s = Math.max(0, Math.floor((Date.now() - then) / 1000));
+ if (s < 60) return `${s}s ago`;
+ const m = Math.floor(s / 60);
+ if (m < 60) return `${m}m ago`;
+ const h = Math.floor(m / 60);
+ if (h < 24) return `${h}h ago`;
+ const d = Math.floor(h / 24);
+ if (d < 30) return `${d}d ago`;
+ return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
+}
+
+function escapeHtml(s) {
+ return String(s ?? '').replace(/[&<>"']/g, (c) => (
+ { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]
+ ));
+}
+
+function initials(name) {
+ const parts = String(name || 'Agent').trim().split(/\s+/).slice(0, 2);
+ return parts.map((p) => p[0]?.toUpperCase() || '').join('') || 'A';
+}
+
+// ── Components ───────────────────────────────────────────────────────────────
+
+function statCard(val, lbl, sub) {
+ return `<div class="stat-card">
+ <div class="stat-val">${val}</div>
+ <div class="stat-lbl">${escapeHtml(lbl)}</div>
+ ${sub ? `<div class="stat-sub">${escapeHtml(sub)}</div>` : ''}
+ </div>`;
+}
+
+function avatarCell(agent) {
+ if (agent.avatar_thumbnail_url) {
+ return `<img class="rank-av" src="${escapeHtml(agent.avatar_thumbnail_url)}" alt="" loading="lazy" />`;
+ }
+ return `<div class="rank-av-fallback" aria-hidden="true">${escapeHtml(initials(agent.name))}</div>`;
+}
+
+function rankRow(num, agent, sub, primary, secondary) {
+ const link = agent.url;
+ const tag = link ? 'a' : 'div';
+ const attrs = link ? `href="${escapeHtml(link)}" class="rank-row is-link"` : 'class="rank-row"';
+ return `<${tag} ${attrs}>
+ <span class="rank-num">${num}</span>
+ ${avatarCell(agent)}
+ <div class="rank-meta">
+ <div class="rank-name">${escapeHtml(agent.name || 'Agent')}</div>
+ ${sub ? `<div class="rank-sub">${escapeHtml(sub)}</div>` : ''}
+ </div>
+ <div class="rank-val">
+ <div class="rank-primary">${primary}</div>
+ ${secondary ? `<div class="rank-secondary">${escapeHtml(secondary)}</div>` : ''}
+ </div>
+ </${tag}>`;
+}
+
+function feedRow(h) {
+ const skill = h.skill_name || h.service_slug || 'a skill';
+ const link = h.explorer_url
+ ? `<a class="feed-link" href="${escapeHtml(h.explorer_url)}" target="_blank" rel="noopener">proof ↗</a>`
+ : '';
+ return `<div class="feed-row">
+ <div class="feed-flow">
+ <span class="feed-agent">${escapeHtml(h.hirer?.name || 'Agent')}</span>
+ <span class="feed-arrow">→</span>
+ <span class="feed-agent">${escapeHtml(h.provider?.name || 'Agent')}</span>
+ <span class="feed-skill">· ${escapeHtml(skill)}</span>
+ </div>
+ <span class="feed-amt">${fmtUsd(h.usd)}</span>
+ <span class="feed-time">${escapeHtml(relTime(h.completed_at))}</span>
+ ${link}
+ </div>`;
+}
+
+// ── Chart (native canvas, no dependency) ─────────────────────────────────────
+
+function drawVolumeChart(canvas, days) {
+ const ctx = canvas.getContext('2d');
+ const dpr = window.devicePixelRatio || 1;
+ const rect = canvas.getBoundingClientRect();
+ if (!rect.width) return;
+ canvas.width = rect.width * dpr;
+ canvas.height = rect.height * dpr;
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
+ ctx.clearRect(0, 0, rect.width, rect.height);
+
+ const W = rect.width;
+ const H = rect.height;
+ const pad = { top: 16, right: 12, bottom: 28, left: 52 };
+ const chartW = W - pad.left - pad.right;
+ const chartH = H - pad.top - pad.bottom;
+
+ const vols = days.map((d) => Number(d.volume_usd) || 0);
+ const maxVol = Math.max(...vols, 0.0001);
+ const isDark = document.documentElement.getAttribute('data-theme') !== 'light';
+ const textColor = isDark ? 'rgba(231,233,238,0.45)' : 'rgba(0,0,0,0.45)';
+ const gridColor = isDark ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.06)';
+
+ // Grid + y labels
+ ctx.font = '10px Inter, system-ui, sans-serif';
+ ctx.textBaseline = 'middle';
+ for (let i = 0; i <= 4; i++) {
+ const y = pad.top + (chartH / 4) * i;
+ ctx.strokeStyle = gridColor;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(pad.left, y);
+ ctx.lineTo(pad.left + chartW, y);
+ ctx.stroke();
+ const v = maxVol * (1 - i / 4);
+ ctx.fillStyle = textColor;
+ ctx.textAlign = 'right';
+ ctx.fillText(yLabel(v), pad.left - 8, y);
+ }
+
+ // X labels (sparse)
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'alphabetic';
+ const step = Math.max(1, Math.ceil(days.length / 6));
+ days.forEach((d, i) => {
+ if (i % step !== 0 && i !== days.length - 1) return;
+ const x = pad.left + (days.length <= 1 ? chartW / 2 : (i / (days.length - 1)) * chartW);
+ const label = new Date(d.day).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
+ ctx.fillStyle = textColor;
+ ctx.fillText(label, x, H - pad.bottom + 16);
+ });
+
+ // Bars with gradient
+ const grad = ctx.createLinearGradient(0, pad.top, 0, pad.top + chartH);
+ grad.addColorStop(0, isDark ? 'rgba(74,222,128,0.95)' : 'rgba(22,163,74,0.95)');
+ grad.addColorStop(1, isDark ? 'rgba(87,199,255,0.55)' : 'rgba(2,132,199,0.5)');
+ const slot = chartW / days.length;
+ const barW = Math.max(2, Math.min(22, slot - 3));
+ days.forEach((d, i) => {
+ const v = Number(d.volume_usd) || 0;
+ const x = pad.left + i * slot + (slot - barW) / 2;
+ const barH = Math.max(v > 0 ? 2 : 0, (v / maxVol) * chartH);
+ const y = pad.top + chartH - barH;
+ ctx.fillStyle = grad;
+ ctx.beginPath();
+ ctx.roundRect(x, y, barW, barH, 2);
+ ctx.fill();
+ });
+}
+
+function yLabel(v) {
+ if (v >= 1_000_000) return `$${(v / 1_000_000).toFixed(1)}M`;
+ if (v >= 1_000) return `$${(v / 1_000).toFixed(1)}K`;
+ if (v >= 1) return `$${v.toFixed(0)}`;
+ if (v === 0) return '$0';
+ return `$${v.toFixed(2)}`;
+}
+
+// Build a zero-filled day series for the requested window from the daily rows so
+// the chart always shows a continuous timeline, not just days that had volume.
+function buildSeries(daily, windowDays) {
+ const byDay = new Map(daily.map((d) => [d.day, Number(d.volume_usd) || 0]));
+ const out = [];
+ const today = new Date();
+ for (let i = windowDays - 1; i >= 0; i--) {
+ const dt = new Date(today);
+ dt.setDate(today.getDate() - i);
+ const key = dt.toISOString().slice(0, 10);
+ out.push({ day: key, volume_usd: byDay.get(key) || 0 });
+ }
+ return out;
+}
+
+function renderChart() {
+ const canvas = document.getElementById('volume-chart');
+ const wrap = canvas?.parentElement;
+ if (!canvas || !wrap) return;
+ const hasVolume = lastDaily.some((d) => (Number(d.volume_usd) || 0) > 0);
+ if (!hasVolume) {
+ wrap.innerHTML = '<div class="chart-empty">No settled agent-to-agent volume in this window yet.</div>';
+ return;
+ }
+ if (!wrap.querySelector('canvas')) {
+ wrap.innerHTML = '<canvas id="volume-chart" class="chart-canvas" aria-label="Daily agent-to-agent volume chart"></canvas>';
+ }
+ const series = buildSeries(lastDaily, currentWindow);
+ requestAnimationFrame(() => drawVolumeChart(document.getElementById('volume-chart'), series));
+}
+
+// ── Data ─────────────────────────────────────────────────────────────────────
+
+function showError(msg) {
+ const el = document.getElementById('an-error');
+ const m = document.getElementById('an-error-msg');
+ if (m) m.textContent = msg || 'Failed to load economy stats.';
+ if (el) el.hidden = false;
+}
+
+function clearError() {
+ const el = document.getElementById('an-error');
+ if (el) el.hidden = true;
+}
+
+function renderTotals(t) {
+ document.getElementById('headline-val').textContent = fmtUsd(t.volume_usd, { compact: t.volume_usd >= 10_000 });
+
+ const delta = document.getElementById('headline-delta');
+ if (t.volume_24h_usd > 0) {
+ delta.textContent = `+${fmtUsd(t.volume_24h_usd)} in 24h`;
+ delta.hidden = false;
+ } else {
+ delta.hidden = true;
+ }
+
+ const avg = t.hires > 0 ? t.avg_hire_usd : 0;
+ document.getElementById('stats-grid').innerHTML = [
+ statCard(fmtCount(t.hires), 'Settled hires', t.pending_hires ? `${fmtCount(t.pending_hires)} pending` : 'agent → agent payments'),
+ statCard(fmtUsd(t.volume_7d_usd, { compact: t.volume_7d_usd >= 10_000 }), 'Volume · 7 days', `${fmtCount(t.hires_7d)} hires`),
+ statCard(fmtUsd(avg), 'Avg hire value', 'per settled call'),
+ statCard(fmtCount(t.unique_providers), 'Earning agents', 'sold a skill'),
+ statCard(fmtCount(t.unique_hirers), 'Paying agents', 'hired a skill'),
+ ].join('');
+}
+
+function renderLeaderboards(data) {
+ const earners = document.getElementById('top-earners');
+ const spenders = document.getElementById('top-spenders');
+
+ document.getElementById('earners-count').textContent = data.top_providers.length;
+ earners.innerHTML = data.top_providers.length
+ ? data.top_providers.map((a, i) => rankRow(
+ i + 1, a,
+ `${fmtCount(a.hires)} ${a.hires === 1 ? 'hire' : 'hires'}${a.avg_rating ? ` · ${a.avg_rating.toFixed(1)}★` : ''}`,
+ fmtUsd(a.earned_usd), 'earned',
+ )).join('')
+ : '<div class="an-empty">No agent has earned from a hire yet.</div>';
+
+ document.getElementById('spenders-count').textContent = data.top_hirers.length;
+ spenders.innerHTML = data.top_hirers.length
+ ? data.top_hirers.map((a, i) => rankRow(
+ i + 1, a,
+ `${fmtCount(a.hires)} ${a.hires === 1 ? 'hire' : 'hires'}`,
+ fmtUsd(a.spent_usd), 'spent',
+ )).join('')
+ : '<div class="an-empty">No agent has hired another yet.</div>';
+}
+
+function renderFeed(recent) {
+ const feed = document.getElementById('recent-feed');
+ document.getElementById('recent-count').textContent = recent.length;
+ feed.innerHTML = recent.length
+ ? recent.map(feedRow).join('')
+ : '<div class="an-empty">No settlements yet — be the first to put your agent to work.</div>';
+}
+
+async function load() {
+ clearError();
+ let res;
+ try {
+ res = await fetch(`${ENDPOINT}?window=90&top=10&recent=14`, { headers: { accept: 'application/json' } });
+ } catch {
+ res = null;
+ }
+ if (!res || !res.ok) {
+ showError(res ? `Failed to load (${res.status}). Please retry.` : 'Network error. Please retry.');
+ return;
+ }
+
+ const data = await res.json();
+ if (!data?.ok) {
+ showError('Stats are temporarily unavailable. Please retry.');
+ return;
+ }
+
+ lastDaily = Array.isArray(data.daily) ? data.daily : [];
+ renderTotals(data.totals || {});
+ renderLeaderboards(data);
+ renderFeed(Array.isArray(data.recent) ? data.recent : []);
+ renderChart();
+}
+
+// ── Wiring ───────────────────────────────────────────────────────────────────
+
+function wireWindowToggle() {
+ const toggle = document.getElementById('win-toggle');
+ if (!toggle) return;
+ toggle.addEventListener('click', (e) => {
+ const btn = e.target.closest('button[data-window]');
+ if (!btn) return;
+ currentWindow = Number(btn.dataset.window) || 30;
+ toggle.querySelectorAll('button').forEach((b) => b.setAttribute('aria-pressed', String(b === btn)));
+ renderChart();
+ });
+}
+
+function init() {
+ wireWindowToggle();
+ document.getElementById('an-retry')?.addEventListener('click', load);
+ // Redraw the canvas on resize + theme change so it stays crisp.
+ let raf;
+ window.addEventListener('resize', () => {
+ cancelAnimationFrame(raf);
+ raf = requestAnimationFrame(renderChart);
+ });
+ const themeObserver = new MutationObserver(renderChart);
+ themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
+
+ load();
+ // Light auto-refresh so the dashboard stays live without hammering the DB.
+ setInterval(() => {
+ if (document.visibilityState === 'visible') load();
+ }, 60_000);
+}
+
+if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', init);
+} else {
+ init();
+}
diff --git a/src/viewer.js b/src/viewer.js
index 64d321744..231ada8b2 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -1077,7 +1077,13 @@ export class Viewer {
// Add content and build the animation panel BEFORE computing the camera
// so the panel's rendered height is available for panel-aware framing.
this.scene.add(object);
- object.rotation.y = Math.PI;
+ // Avatars are authored with +Z as their forward axis (see
+ // _trackBodyToCamera in agent-avatar.js, which faces them via
+ // atan2(dx, dz)). The framing camera sits on +Z looking at origin,
+ // so a zero yaw already presents the front. Do NOT flip 180° here —
+ // that turns every static preview (dashboard card, kiosk embed)
+ // around to show the avatar's back.
+ object.rotation.y = 0;
this.content = object;
// Build BVH acceleration structures for every mesh geometry so raycasting
diff --git a/tests/agent-economy-platform.test.js b/tests/agent-economy-platform.test.js
new file mode 100644
index 000000000..13e07a0ad
--- /dev/null
+++ b/tests/agent-economy-platform.test.js
@@ -0,0 +1,136 @@
+// Platform-wide agent-to-agent economy roll-up (api/_lib/agent-economy.js →
+// platformEconomyStats). This is the single read behind the public A2A volume
+// dashboard, so its contract must hold: real aggregates over real `agent_hires`
+// rows, shaped into a stable payload, with an unmigrated ledger folding to a
+// real zero (never a 500, never a fabricated number).
+//
+// The DB is mocked: a tagged-template `sql` that returns whatever the test
+// queued for each successive query, in call order.
+
+import { describe, it, expect, beforeEach, vi } from 'vitest';
+
+const queue = [];
+vi.mock('../api/_lib/db.js', () => {
+ const sql = vi.fn(async () => (queue.length ? queue.shift() : []));
+ return { sql };
+});
+// avatarThumb pulls in r2 publicUrl — stub it so a thumbnail key resolves to a
+// deterministic URL without real R2 config.
+vi.mock('../api/_lib/r2.js', () => ({
+ publicUrl: (key) => (key ? `https://cdn.test/${key}` : null),
+}));
+
+import { sql } from '../api/_lib/db.js';
+import { platformEconomyStats } from '../api/_lib/agent-economy.js';
+
+beforeEach(() => {
+ queue.length = 0;
+ sql.mockClear();
+});
+
+describe('platformEconomyStats', () => {
+ it('shapes real aggregates across totals, daily, leaderboards, and feed', async () => {
+ queue.push(
+ // totals
+ [{
+ volume_usd: 1234.5, hires: 420, unique_hirers: 50, unique_providers: 30,
+ avg_hire_usd: 2.94, volume_24h_usd: 88.2, hires_24h: 30,
+ volume_7d_usd: 410.1, hires_7d: 140, pending_hires: 4,
+ last_hire_at: '2026-06-29T00:00:00.000Z',
+ }],
+ // daily
+ [
+ { day: '2026-06-27', volume_usd: 100, hires: 40 },
+ { day: '2026-06-28', volume_usd: 250.25, hires: 90 },
+ ],
+ // top providers (one public w/ avatar, one private)
+ [
+ { agent_id: 'p1', name: 'Oracle', is_public: true, thumb_key: 'thumb/p1.png', avatar_vis: 'public', earned_usd: 800, hires: 200, avg_rating: 4.6 },
+ { agent_id: 'p2', name: 'Nova', is_public: false, thumb_key: 'thumb/p2.png', avatar_vis: 'private', earned_usd: 300, hires: 90, avg_rating: null },
+ ],
+ // top hirers
+ [
+ { agent_id: 'h1', name: 'Trader', is_public: true, thumb_key: null, avatar_vis: null, spent_usd: 500, hires: 120 },
+ ],
+ // recent
+ [
+ { id: 'r1', skill_name: 'market-analysis', service_slug: 'mkt', usd: 0.005, amount_atomics: '5000', currency: 'USDC', network: 'solana', payment_signature: 'SIG1', completed_at: '2026-06-29T00:00:00.000Z', hirer_agent_id: 'h1', provider_agent_id: 'p1', hirer_name: 'Trader', provider_name: 'Oracle' },
+ ],
+ );
+
+ const r = await platformEconomyStats({ windowDays: 30, topLimit: 10, recentLimit: 12 });
+
+ expect(sql).toHaveBeenCalledTimes(5);
+
+ expect(r.totals.volume_usd).toBe(1234.5);
+ expect(r.totals.hires).toBe(420);
+ expect(r.totals.unique_hirers).toBe(50);
+ expect(r.totals.unique_providers).toBe(30);
+ expect(r.totals.avg_hire_usd).toBeCloseTo(2.94);
+ expect(r.totals.pending_hires).toBe(4);
+ expect(r.window_days).toBe(30);
+
+ expect(r.daily).toHaveLength(2);
+ expect(r.daily[1]).toEqual({ day: '2026-06-28', volume_usd: 250.25, hires: 90 });
+
+ // Public provider keeps its profile URL + resolves a thumbnail; private one
+ // is gated to no URL and no leaked avatar.
+ expect(r.top_providers[0]).toMatchObject({ agent_id: 'p1', name: 'Oracle', url: '/agent/p1', earned_usd: 800, hires: 200, avg_rating: 4.6 });
+ expect(r.top_providers[0].avatar_thumbnail_url).toBe('https://cdn.test/thumb/p1.png');
+ expect(r.top_providers[1].url).toBe(null);
+ expect(r.top_providers[1].avatar_thumbnail_url).toBe(null);
+ expect(r.top_providers[1].avg_rating).toBe(null);
+
+ expect(r.top_hirers[0]).toMatchObject({ agent_id: 'h1', name: 'Trader', spent_usd: 500, hires: 120 });
+
+ expect(r.recent[0]).toMatchObject({
+ id: 'r1', skill_name: 'market-analysis', usd: 0.005, network: 'solana',
+ payment_signature: 'SIG1',
+ });
+ expect(r.recent[0].hirer).toEqual({ agent_id: 'h1', name: 'Trader' });
+ expect(r.recent[0].provider).toEqual({ agent_id: 'p1', name: 'Oracle' });
+ });
+
+ it('derives recent USD from atomics when the usd column is null', async () => {
+ queue.push(
+ [{}], // totals (all null → zeros)
+ [], // daily
+ [], // providers
+ [], // hirers
+ [{ id: 'r9', skill_name: 's', service_slug: null, usd: null, amount_atomics: '2500000', currency: 'USDC', network: 'solana', payment_signature: null, completed_at: null, hirer_agent_id: 'h', provider_agent_id: 'p', hirer_name: null, provider_name: null }],
+ );
+ const r = await platformEconomyStats();
+ expect(r.recent[0].usd).toBe(2.5); // 2_500_000 atomics / 1e6
+ expect(r.recent[0].hirer.name).toBe('Agent'); // null name falls back
+ });
+
+ it('clamps out-of-range params into safe bounds', async () => {
+ queue.push([{}], [], [], [], []);
+ const r = await platformEconomyStats({ windowDays: 99999, topLimit: -3, recentLimit: 9999 });
+ expect(r.window_days).toBe(365); // capped at 365
+ });
+
+ it('folds an unmigrated ledger (42P01) to a real zero, not a throw', async () => {
+ sql.mockImplementationOnce(async () => {
+ const err = new Error('relation "agent_hires" does not exist');
+ err.code = '42P01';
+ throw err;
+ });
+ const r = await platformEconomyStats({ windowDays: 7 });
+ expect(r.totals.volume_usd).toBe(0);
+ expect(r.totals.hires).toBe(0);
+ expect(r.daily).toEqual([]);
+ expect(r.top_providers).toEqual([]);
+ expect(r.recent).toEqual([]);
+ expect(r.window_days).toBe(7);
+ });
+
+ it('rethrows non-missing-table errors (a real DB outage must not look like zero volume)', async () => {
+ sql.mockImplementationOnce(async () => {
+ const err = new Error('connection terminated');
+ err.code = '08006';
+ throw err;
+ });
+ await expect(platformEconomyStats()).rejects.toThrow('connection terminated');
+ });
+});
diff --git a/vercel.json b/vercel.json
index 713fc37ed..c75f2c288 100644
--- a/vercel.json
+++ b/vercel.json
@@ -256,6 +256,14 @@
"src": "/agent-economy/",
"dest": "/agent-economy.html"
},
+ {
+ "src": "/agent-economy-volume",
+ "dest": "/agent-economy-volume.html"
+ },
+ {
+ "src": "/agent-economy-volume/",
+ "dest": "/agent-economy-volume.html"
+ },
{
"src": "/economy",
"dest": "/economy.html"
@@ -556,6 +564,22 @@
"src": "/api/pay/execute",
"dest": "/api/pay/execute"
},
+ {
+ "src": "/api/portfolio/summary",
+ "dest": "/api/portfolio/[action]?action=summary"
+ },
+ {
+ "src": "/api/portfolio/history",
+ "dest": "/api/portfolio/[action]?action=history"
+ },
+ {
+ "src": "/api/portfolio/asset",
+ "dest": "/api/portfolio/[action]?action=asset"
+ },
+ {
+ "src": "/api/portfolio/send",
+ "dest": "/api/portfolio/[action]?action=send"
+ },
{
"src": "/payments",
"dest": "/payments.html"
diff --git a/vite.config.js b/vite.config.js
index 2768eb478..79ba05628 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -403,6 +403,7 @@ const appConfig = {
'demo-economy': resolve(__dirname, 'pages/demo-economy.html'),
live: resolve(__dirname, 'pages/live.html'),
'agent-economy': resolve(__dirname, 'pages/agent-economy.html'),
+ 'agent-economy-volume': resolve(__dirname, 'pages/agent-economy-volume.html'),
economy: resolve(__dirname, 'pages/economy.html'),
'overlay-control': resolve(__dirname, 'pages/overlay-control.html'),
'mocap-studio': resolve(__dirname, 'pages/mocap-studio.html'),