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(analytics): count agents' creator fees on /analytics from the per-coin earnings snapshot

nirholasf4995fe8be08
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 0c87fcc59..133257c8a 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -64,7 +64,7 @@ bottom.
| KOL Tracker | [pages/tracker.html](pages/tracker.html) `→ /tracker`, backend [api/kol/[action].js](api/kol/%5Baction%5D.js) `→ GET /api/kol/tracker?window=&limit=`, aggregator [src/kol/tracker.js](src/kol/tracker.js), wallet list [src/kol/wallet-store.js](src/kol/wallet-store.js) (bundled [src/kol/wallets.json](src/kol/wallets.json) + admin R2 imports via `POST /api/kol/import-gmgn`), FIFO P&L engine [src/kol/wallet-pnl.js](src/kol/wallet-pnl.js), cached X follower/avatar lookup [src/kol/x-profile.js](src/kol/x-profile.js) | Live | Solana crypto KOLs ranked by realized P&L computed from each tracked wallet's own on-chain trade history (24h/7d/30d), with win rate, volume, and trade count — every number traceable to real trades, never a competitor's computed leaderboard. A wallet only shows an X handle/avatar/follower-count when an admin has explicitly attached a verified `xHandle` via `import-gmgn`'s `xHandles` map (never inferred or scraped); unattached wallets rank by wallet address alone. Rows with no configured trade source (`PUMPFUN_BOT_URL`) fall back to an imported `pnlUsd`/`winRate` labeled with its `pnlSource` rather than fabricating on-chain numbers. Prewarm cron: [api/cron/kol-tracker-refresh.js](api/cron/kol-tracker-refresh.js). |
| Agent Galaxy (every agent as a star, positioned by meaning) | [pages/galaxy.html](pages/galaxy.html) `→ /galaxy` + [src/galaxy.js](src/galaxy.js), backend [api/galaxy.js](api/galaxy.js) `→ GET/POST /api/galaxy`, assembler [api/_lib/galaxy.js](api/_lib/galaxy.js), embedding cache [api/_lib/agent-embeddings.js](api/_lib/agent-embeddings.js), live-economy overlay over `GET /api/galaxy/flows` | In-repo · awaits watsonx credentials | Every published agent embedded with an IBM Granite model on watsonx.ai, projected to 3D by PCA and grouped into k-means constellations that Granite then names, rendered as a Three.js point cloud. Typing a phrase embeds the query in the same space and lights the matching stars; the Money-Cam layer animates real on-chain transfers between them, and star brightness comes from each agent’s real wallet net worth. No mock path anywhere: with no watsonx credentials on the service `GET /api/galaxy` answers 503 and the page says so, offering the agent list and the integration doc instead of an empty universe. Tests: [tests/e2e/galaxy.spec.js](tests/e2e/galaxy.spec.js), [tests/galaxy-flows.test.js](tests/galaxy-flows.test.js) |
| The Agent Economy (live, network wide) | [pages/economy.html](pages/economy.html) `→ /economy` + page module [src/economy-live.js](src/economy-live.js), hire panel [src/shared/agent-hire.js](src/shared/agent-hire.js), feeds `GET /api/agents/economy?view=offers` ([api/agents/economy.js](api/agents/economy.js)), `GET /api/marketplace/agents`, `GET /api/agenc/x402-services` ([api/agenc/[action].js](api/agenc/%5Baction%5D.js)) over the shared discovery client [api/_lib/x402/bazaar-client.js](api/_lib/x402/bazaar-client.js) | Live | The wide-angle counterpart to the curated two-agent demo at `/agent-economy`: the real population of agents earning on three.ws, the agent-to-agent service market they hire each other through, and the live x402 bazaar of pay-per-call endpoints across Solana and Base. Three feeds, each owning its own loading / empty / error state so a slow or failing one never blanks the page, each retryable in place, and each polled every 45s while the tab is visible. Service rows name themselves from the facilitator's `metadata` when it publishes one and from the endpoint URL when it does not (most listings carry no name), show the endpoint they charge for, and never render a link to a path template or a rejected URL scheme. The A2A offers feed is empty until an owner prices an agent skill (`agent_paid_services`), which is a real state with a route out of it, not a stub. Tests: [tests/api/bazaar-endpoints.test.js](tests/api/bazaar-endpoints.test.js) |
-| Platform analytics (every platform total, one page) | [pages/analytics.html](pages/analytics.html) `→ /analytics` + page module [src/platform-analytics.js](src/platform-analytics.js), endpoint [api/platform/analytics.js](api/platform/analytics.js) `→ GET /api/platform/analytics?window=30d\|90d\|all`, data layer [api/_lib/platform-analytics.js](api/_lib/platform-analytics.js) | Live | The partner and investor view: agents, agents with a wallet, coins launched, 3D models generated, LLM tokens processed, x402 settlements and volume, marketplace sales and volume, and agent-to-agent hire volume, each with an all-time total, a zero-filled daily series and a `method` string rendered under "How each number is calculated". Counting predicates match the endpoints that already publish the same figure (`/api/home-stats`, the `MARKET_PAID_KINDS` gate, `platformEconomyStats()`), so no two pages disagree. A failing source is `null` plus a named `errors` entry, never a zero; the page shows an unavailable tile for it and a whole-page retry only when nothing could be read. Creator fees are listed as pending until per-agent earnings (parity order 015) ship. Docs: [docs/api-reference.md](docs/api-reference.md#platform-analytics-api). Tests: [tests/platform-analytics.test.js](tests/platform-analytics.test.js) |
+| Platform analytics (every platform total, one page) | [pages/analytics.html](pages/analytics.html) `→ /analytics` + page module [src/platform-analytics.js](src/platform-analytics.js), endpoint [api/platform/analytics.js](api/platform/analytics.js) `→ GET /api/platform/analytics?window=30d\|90d\|all`, data layer [api/_lib/platform-analytics.js](api/_lib/platform-analytics.js) | Live | The partner and investor view: agents, agents with a wallet, coins launched, 3D models generated, LLM tokens processed, x402 settlements and volume, marketplace sales and volume, and agent-to-agent hire volume, each with an all-time total, a zero-filled daily series and a `method` string rendered under "How each number is calculated". Counting predicates match the endpoints that already publish the same figure (`/api/home-stats`, the `MARKET_PAID_KINDS` gate, `platformEconomyStats()`), so no two pages disagree. A failing source is `null` plus a named `errors` entry, never a zero; the page shows an unavailable tile for it and a whole-page retry only when nothing could be read. Creator fees (SOL) read the `agent_coin_earnings` snapshot from parity order 015 with the same per-wallet counting rule as `/api/agents/:id/earnings`. Docs: [docs/api-reference.md](docs/api-reference.md#platform-analytics-api). Tests: [tests/platform-analytics.test.js](tests/platform-analytics.test.js) |
| Agent Symphony (economy as generative music) | [pages/symphony.html](pages/symphony.html) `→ /symphony`, engine [src/symphony.js](src/symphony.js), grammar [src/symphony-score.js](src/symphony-score.js) | Live | The live activity bus (`GET /api/feed` + `/api/feed-stream` SSE) rendered as WebAudio generative music: one synthesized note per real platform event, voice by event type (payments pluck, coin buys land as bass, new agents chime, guard refusals play dissonance, jackpots glissando), pitch register by amount (whales sit lower), stable per-actor motif + stereo position via FNV-1a hash, all quantized to one pentatonic scale so arbitrary event streams harmonize. Canvas visualization, live ledger with real click-throughs, and a MediaRecorder tap that exports a shareable audio clip of the master bus. A burst gate collapses event floods (a sniper sweep emitting dozens of identical guard events) into one accented note per actor per 1.5s. Solo mode narrows the stream to one participant client-side (`?agent=<id>` exact, `?actor=<label>` case-insensitive), reachable from the per-row "solo" control and from the "Listen →" link on every agent profile's Wallet Story card. No audio assets, no synthetic events. Tests: [tests/symphony-score.test.js](tests/symphony-score.test.js) |
| Platform activity feed | [pages/feed.html](pages/feed.html) `→ /feed` + [pages/community.html](pages/community.html) `→ /community`, backend [api/users/me/feed.js](api/users/me/feed.js) | Live | Reverse-chronological creation events (avatars, agents, coins, models, worlds) plus follow activity, merged at read time from `forge_creations`, `dioramas`, and `user_follows` (no separate event log to drift out of sync). `?scope=following` (default; session-gated, anonymous gets 401) vs `?scope=all` (public; powers `/community` and first-visit feeds); `limit` 1..50, `before` ISO cursor. Items deep-link to creator portfolios. Distinct from the Money Pulse ticker `GET /api/feed` ([docs/money-feed.md](docs/money-feed.md)). Docs: [docs/social-layer.md](docs/social-layer.md) |
| Contributor thank-you roll | [pages/contributors.html](pages/contributors.html) `→ /contributors`, linked from [pages/community.html](pages/community.html) and [README.md](README.md) | In-repo | A public acknowledgment page for people improving three.ws through code, reviews, issue reports, and design ideas. The code-contributor roll reads GitHub's public contributor record live, excludes bots and anonymous-email records, and has explicit loading, failure, and retry states; a curated section credits non-code contributions that led to concrete improvements, beginning with the Forge/R2 outage report in issue #164. |
diff --git a/api/_lib/platform-analytics.js b/api/_lib/platform-analytics.js
index b60182218..a9ca0d187 100644
--- a/api/_lib/platform-analytics.js
+++ b/api/_lib/platform-analytics.js
@@ -220,6 +220,46 @@ async function marketplaceSource(sinceDay) {
};
}
+// Creator fees, from the agent_coin_earnings snapshot parity order 015 fills.
+// The launchpad reports fees per creator WALLET, so this counts exactly the
+// wallets api/_lib/agent-earnings.js counts toward an agent: the agent's own
+// custodial wallet, not shared with another agent's coin. Each wallet is
+// counted once however many coins it launched.
+const COUNTED_CREATOR_WALLETS = () => sql`
+ SELECT DISTINCT ON (e.creator) e.creator, e.earned_lamports
+ FROM agent_coin_earnings e
+ JOIN agent_identities ai ON ai.id = e.agent_id AND ai.deleted_at IS NULL
+ WHERE e.network = 'mainnet'
+ AND e.source = 'pumpfun_creator_fees'
+ AND e.wallet_agent_count = 1
+ AND e.creator = ai.meta->>'solana_address'
+ ORDER BY e.creator, e.refreshed_at DESC NULLS LAST
+`;
+
+async function creatorFeesSource(sinceDay) {
+ const [totals, daily] = await Promise.all([
+ sql`
+ WITH w AS (${COUNTED_CREATOR_WALLETS()})
+ SELECT COALESCE(SUM(earned_lamports), 0)::text AS lamports FROM w
+ `,
+ sql`
+ WITH w AS (${COUNTED_CREATOR_WALLETS()})
+ SELECT
+ to_char((b.bucket_start AT TIME ZONE 'UTC')::date, 'YYYY-MM-DD') AS day,
+ COALESCE(SUM(b.fee_lamports), 0)::text AS lamports
+ FROM creator_fee_buckets b
+ JOIN w ON w.creator = b.creator
+ WHERE b.bucket_interval = '1d'
+ GROUP BY 1
+ `,
+ ]);
+ const rows = daily.map((r) => ({ day: r.day, creator_fees: atomicToUnits(r.lamports, 9) }));
+ return {
+ total: { creator_fees: atomicToUnits(totals[0]?.lamports, 9) },
+ daily: sinceDay ? rows.filter((r) => r.day >= sinceDay) : rows,
+ };
+}
+
async function hiresSource(sinceDay, now) {
// Reuses the /api/agent-economy/volume read so hire volume is one number
// platform-wide. Its daily series is a trailing window in days; the all-time
@@ -236,7 +276,7 @@ async function hiresSource(sinceDay, now) {
// ── Metric catalogue ────────────────────────────────────────────────────────
// Order here is the order the page renders. `unit` drives formatting:
-// count | tokens | usd | three.
+// count | tokens | usd | three | sol.
export const METRICS = Object.freeze([
{
@@ -318,10 +358,10 @@ export const METRICS = Object.freeze([
},
{
key: 'creator_fees',
- source: null,
+ source: 'creatorFees',
label: 'Creator fees earned',
- unit: 'usd',
- method: 'coming with per-agent earnings',
+ unit: 'sol',
+ method: 'Trading fees earned by agents as the creator of the coins they launched, in SOL, from the per-coin earnings snapshot refreshed every 30 minutes (agent_coin_earnings). The launchpad reports fees per creator wallet, so a wallet is counted once, and only when it is the agent\'s own custodial wallet and no other agent\'s coin shares it, the same rule each agent\'s earnings page uses. The daily series sums the index\'s daily fee buckets for those wallets, which reach back about 100 days, so the all-time series can add up to less than the lifetime total.',
},
]);
@@ -333,6 +373,7 @@ const SOURCES = {
x402: x402Source,
marketplace: marketplaceSource,
hires: hiresSource,
+ creatorFees: creatorFeesSource,
};
function withTimeout(promise, ms, name) {
@@ -392,10 +433,6 @@ export async function readPlatformAnalytics({ window = DEFAULT_WINDOW, now = Dat
const errors = [];
for (const m of METRICS) {
const base = { key: m.key, label: m.label, unit: m.unit, method: m.method };
- if (!m.source) {
- metrics[m.key] = { ...base, available: false, pending: true, total: null, window_total: null, daily: null };
- continue;
- }
const r = results[m.source];
if (!r) {
const err = failures[m.source];
diff --git a/docs/api-reference.md b/docs/api-reference.md
index c3e29ae9b..1070b7623 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -6706,7 +6706,7 @@ Cached 5 minutes in the shared cache and at the CDN
|---|---|---|
| `window` | `30d`, `90d`, `all` (anything else falls back to `30d`) | `30d` |
-**Response** (one metric shown in full, the rest have the same shape)
+**Response** (one metric in full, and one whose source failed; every metric has the same shape)
```json
{
@@ -6726,19 +6726,25 @@ Cached 5 minutes in the shared cache and at the CDN
"window_total": 724,
"daily": [{ "day": "2026-09-29", "value": 23 }, { "day": "2026-09-30", "value": 2 }]
},
- "creator_fees": {
- "key": "creator_fees",
- "label": "Creator fees earned",
- "unit": "usd",
- "method": "coming with per-agent earnings",
+ "x402_settlements": {
+ "key": "x402_settlements",
+ "label": "x402 settlements",
+ "unit": "count",
+ "method": "Successful on-chain settlements by the three.ws self-hosted Solana x402 facilitator (x402_self_facilitator_log, action settle, ok). Failed and verify-only attempts are excluded. This includes the platform's own self-cycled agent ring, reported on its own at /api/x402-ring.",
"available": false,
- "pending": true,
"total": null,
"window_total": null,
"daily": null
}
},
- "errors": []
+ "errors": [
+ {
+ "metric": "x402_settlements",
+ "source": "x402",
+ "error": "timeout",
+ "message": "The x402 settlements figure could not be read, so it is shown as unavailable rather than as zero."
+ }
+ ]
}
```
@@ -6755,7 +6761,7 @@ Cached 5 minutes in the shared cache and at the CDN
| `marketplace_volume_three` | three | price of those sales paid in $THREE, in whole tokens |
| `marketplace_volume_usd` | usd | price of those sales paid in USDC |
| `hire_volume_usd` | usd | completed `agent_hires`, read through the same helper as `/api/agent-economy/volume` |
-| `creator_fees` | usd | pending (`pending: true`) until per-agent earnings ship |
+| `creator_fees` | sol | lifetime creator fees of agents' own custodial wallets from the `agent_coin_earnings` snapshot (same counting rule as `/api/agents/:id/earnings`); daily series from the fee index's daily buckets, about 100 days deep |
`total` is all time; `window_total` is the sum of `daily`; `daily` has one
entry per UTC day from `from` to `to`, zeros included. For `window=all`,
diff --git a/pages/analytics.html b/pages/analytics.html
index 154795bf6..6aa6329fa 100644
--- a/pages/analytics.html
+++ b/pages/analytics.html
@@ -91,7 +91,7 @@
.pa-tile-value { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.03em; margin-top: 6px; color: var(--ink-bright, var(--ink)); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pa-tile-value.is-muted { font-size: 1.15rem; font-weight: 650; color: var(--ink-dim); letter-spacing: -0.01em; margin-top: 10px; }
.pa-tile-sub { font-size: 0.78rem; color: var(--ink-dim); margin-top: 6px; line-height: 1.45; }
- .pa-tile.is-pending, .pa-tile.is-unavailable { border-style: dashed; }
+ .pa-tile.is-unavailable { border-style: dashed; }
/* charts */
.pa-section { margin-top: 40px; }
diff --git a/prompts/finish/016-parity-02-analytics.md b/prompts/finish/016-parity-02-analytics.md
deleted file mode 100644
index 19e3643e9..000000000
--- a/prompts/finish/016-parity-02-analytics.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# parity 02: /analytics, one page of live platform totals and growth
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first, then [_context/parity-00-CONTEXT.md](_context/parity-00-CONTEXT.md). CLAUDE.md overrides everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real funds or any irreversible on-chain write, git push or a production deploy, committing content that names a crypto project other than $THREE, and destroying unrecoverable data. Where this order hits one, it says so, and you batch every such ask into ONE message after everything else is done.
-- Never name Competitor X in anything you commit. If a reference is unavoidable, write "Competitor X".
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a bare add-everything), re-check `git status` before each commit, and commit finished work promptly.
-- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.
-
-## Why this matters
-
-Competitor X's `/analytics` is the page partners and investors open first: total volume, agents, fees, compute used per day, a growth chart, and a footnote under every number saying how it was calculated. three.ws has more of this data than it does, but it is spread over seven endpoints and four pages, and nobody can see the whole platform in one place.
-
-What exists (from a code read on 2026-09-30; re-verify in step 0):
-
-| Source | Route | What it gives |
-|---|---|---|
-| `api/home-stats.js` | `/api/home-stats` | agents, on-chain agents, widgets, chains, attestations, forge models |
-| `api/platform/stats.js` | `/api/platform/stats` | agents, views, chats, avatars, countries, widgets, chains |
-| `api/pulse.js` `view=stats` | `/api/pulse?view=stats` | 24h tips, launches, trades, payments, marketplace, active wallets, 7-day series |
-| `api/agent-economy/volume.js` | `/api/agent-economy/volume` | agent-to-agent hire volume, daily series, top providers |
-| `api/marketplace/analytics.js` | `/api/marketplace/analytics` | skill sales, buyers, sellers, trial funnel, daily |
-| `api/status.js` | `/api/status` | uptime and latency |
-
-Tables for the rest: agents `agent_identities`; launches `pump_agent_mints` (plus `fixed_supply_launches`); 3D generations `forge_creations` (`status='done'`); LLM tokens `usage_events` where `kind='llm'` (`input_tokens`, `output_tokens`, indexed by `usage_events_llm_time`); x402 settlements `x402_self_facilitator_log` (`action='settle' and ok`), `x402_receipts`, `agent_hires`; marketplace `skill_purchases` (`status='confirmed'`). `/analytics` is free: no route, no page, no `data/pages.json` entry. Charts elsewhere are drawn on a native canvas with a screen-reader table (`drawVolumeChart()` in `src/agent-economy-volume.js`); `lightweight-charts` is installed but is for price charts.
-
-## Step 0: re-derive the current state
-
- grep -n '"/analytics' vercel.json; ls pages/analytics.html 2>/dev/null
- for p in home-stats platform/stats "pulse?view=stats" agent-economy/volume marketplace/analytics; do printf "%s " $p; curl -s -o /dev/null -w "%{http_code}\n" "https://three.ws/api/$p"; done
- sed -n 150,310p src/agent-economy-volume.js
- grep -n "usage_events_llm_time\|create table.*usage_events" -r api/_lib/migrations | head
-
-Load the `dataviz` skill before choosing chart colors and marks.
-
-## Tasks
-
-1. **One aggregate endpoint.** `GET /api/platform/analytics?window=30d|90d|all`: totals (agents, agents with a wallet, coins launched, 3D models generated, LLM tokens processed, x402 settlements count and USD, marketplace sales count and volume, agent-to-agent hire volume, creator fees earned once order 015's snapshot exists) and a daily series for each over the window. Each figure carries a `method` string. Reuse the queries the existing endpoints already run (import their helpers; do not fork SQL), add the missing ones against the tables above, cache in KV for 5 minutes and at the CDN (`public, s-maxage=300, stale-while-revalidate=600`). A failing sub-query yields `null` for that metric plus an `errors` entry, never a 500 for the page.
-2. **The page.** `/analytics`, wired per the context file's five steps: a headline row of totals, a growth chart per metric (canvas pattern from `src/agent-economy-volume.js`, with the screen-reader table), the window switcher (URL-synced), "updated at" from the response, and a "How each number is calculated" section rendered from the `method` strings. States: skeletons, a metric-level "unavailable" tile, whole-page error with retry.
-3. **Link it.** From the footer's Resources column, `/docs/start-here`, and `llms.txt` (`site.llms` "Economy and $THREE" group in `data/pages.json`). Nav entry at the advanced tier.
-4. **Docs.** `docs/api-reference.md` entry for the endpoint; `STRUCTURE.md` row; changelog entry.
-
-## Definition of done
-
-- [ ] `curl -s localhost:3000/api/platform/analytics?window=30d` returns every metric above (or `null` with a named error) and a daily series, read from production data.
-- [ ] No figure is a literal in the page code (`grep` proof).
-- [ ] `/analytics` renders at 375, 768 and 1440 px in both themes, zero console errors, window switcher and every state exercised.
-- [ ] Linked from the footer, `/docs/start-here` and `llms.txt` (`npm run build:pages` shows it in `public/llms.txt`).
-- [ ] `npm test` passes for touched suites; `npm run audit:links` passes; docs, `STRUCTURE.md`, changelog updated.
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| A sub-query is slow on production volume | Pre-aggregate into a daily rollup table filled by a cron, and read the rollup; do not drop the metric. |
-| Two tables disagree on a count (for example launches) | Use `pump_agent_mints` plus `fixed_supply_launches` as the launch source, and say so in `method`. |
-| 015 not shipped | Omit creator fees with `method: "coming with per-agent earnings"`; add them when 015 lands. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house style: `type(scope): what changed and why a reader cares`).
-3. If every Definition of done line passes, delete this file in that same commit (`git rm prompts/finish/016-parity-02-analytics.md`) and append a dated entry to [_context/parity-PROGRESS.md](_context/parity-PROGRESS.md) with the commit SHAs. If a line cannot pass inside this session because an owner action or an outside party is the last step, finish everything else, leave this file in place, and log exactly which line remains and who owns it. Never delete this file on a partial.
-4. Final report, in this order: what step 0 measured; what changed (file list with commit SHAs); evidence for each Definition of done line; the single batched owner message, if the order has a gate; one-line judgment calls. No trailing questions.
diff --git a/prompts/finish/_context/parity-PROGRESS.md b/prompts/finish/_context/parity-PROGRESS.md
index 105ca7b49..a2e860054 100644
--- a/prompts/finish/_context/parity-PROGRESS.md
+++ b/prompts/finish/_context/parity-PROGRESS.md
@@ -15,3 +15,9 @@ Cross-session handoff for the `parity-` orders ([parity-00-CONTEXT.md](parity-00
- Shipped: `05faebd92` (live wallets API `GET /api/three-token/wallets`, `src/three-token-fee-flow.js`, light theme for the page, tests) and the close-out commit that carries this entry (segment-label and stamp polish, light-theme state-kit tokens, API reference "$THREE Fee Flow API", thesis section 6 pointer, changelog).
- Measured in production: `treasury: null`, `rewards_wallet: null` on `/api/token/config`; neither `THREE_TREASURY_WALLET` nor `THREE_REWARDS_WALLET` exists on the Cloud Run service. 6 `POST /api/token/quote` answered 503 in the 7 days to 2026-09-30 and none succeeded (Cloud Run request log). The textPayload search for `treasury_unavailable` finds nothing because the quote handler returns that typed 503 without logging it; count refusals from the request log instead.
- Remaining owner action (not a line of the order): publish the two wallet addresses with `gcloud run services update three-ws-api --region us-central1 --update-env-vars THREE_TREASURY_WALLET=...,THREE_REWARDS_WALLET=...`. The page shows "not yet published" until then and fills itself in afterwards with no code change.
+
+## 2026-09-30: order 016, /analytics (platform totals and growth)
+
+- Shipped: `0af815c5b` (data layer `api/_lib/platform-analytics.js` + `GET /api/platform/analytics`), `7a739e177` (page module), `d0212823a` (page, route, build input, tests), `f04f022ce` (footer and nav links), `85318b030` (`data/pages.json` entry, `llms.txt` "Economy and $THREE" group, regenerated feeds), `f60d919b8` (STRUCTURE.md row), `a4187c39f` (changelog), `796803608` (link-audit fix in `src/syndicates.js`, a `#` stub that failed `npm run audit:links`), and the close-out commit that carries this entry (creator fees from order 015's snapshot, API reference update). The API reference section and the `/docs/start-here` link were swept into `1806064d3` by a concurrent agent.
+- Measured on production data 2026-09-30 (30d window): 4,165 agents (+724), 920 with a wallet (+176), 90 mainnet coins (+3), 39,488 finished 3D models (+19,646), 244.3M LLM tokens (+109.1M), 191,488 x402 settlements (+60,572) moving $11,760.36 in USDC (+$9,141.69), 0 paid marketplace sales, $0 agent-to-agent hire volume, 5.515 SOL lifetime creator fees across 48 counted creator wallets. Every source answered in under 5 s, so no rollup table was needed; the response is cached 5 minutes.
+- Note for readers of these numbers: the x402 settlement count includes the platform's self-cycled ring (`/api/x402-ring`), and the method string says so.
diff --git a/src/platform-analytics.js b/src/platform-analytics.js
index 24ad6d6e5..58a5411c1 100644
--- a/src/platform-analytics.js
+++ b/src/platform-analytics.js
@@ -26,6 +26,7 @@ const NEXT_STEP = {
marketplace_volume_three: { href: '/marketplace', text: 'Browse the skill marketplace' },
marketplace_volume_usd: { href: '/marketplace', text: 'Browse the skill marketplace' },
hire_volume_usd: { href: '/agent-economy-volume', text: 'Open the agent economy dashboard' },
+ creator_fees: { href: '/launch', text: 'Launch a coin for your agent' },
};
const WINDOW_PHRASE = { '30d': 'in the last 30 days', '90d': 'in the last 90 days', all: 'since launch' };
@@ -53,6 +54,11 @@ function fmtValue(unit, v, { compact = false } = {}) {
if (compact && Math.abs(n) >= 100_000) return `$${compactNf.format(n)}`;
return n.toLocaleString(undefined, { style: 'currency', currency: 'USD', minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
+ if (unit === 'sol') {
+ const digits = Math.abs(n) >= 100 ? 2 : Math.abs(n) >= 1 ? 3 : 4;
+ const body = compact && Math.abs(n) >= 100_000 ? compactNf.format(n) : n.toLocaleString(undefined, { maximumFractionDigits: digits });
+ return `${body} SOL`;
+ }
if (unit === 'three') {
const body = compact && Math.abs(n) >= 100_000 ? compactNf.format(n) : n.toLocaleString(undefined, { maximumFractionDigits: 2 });
return `${body} $THREE`;
@@ -62,8 +68,9 @@ function fmtValue(unit, v, { compact = false } = {}) {
}
function axisLabel(unit, v) {
- if (unit === 'usd') return v >= 1000 ? `$${compactNf.format(v)}` : `$${Number(v.toFixed(v < 10 ? 2 : 0))}`;
- return v >= 1000 ? compactNf.format(v) : String(Number(v.toFixed(v < 10 && v % 1 ? 1 : 0)));
+ const prefix = unit === 'usd' ? '$' : '';
+ if (Math.abs(v) >= 1000) return `${prefix}${compactNf.format(v)}`;
+ return `${prefix}${Number(v.toPrecision(3))}`;
}
function escapeHtml(s) {
@@ -168,13 +175,6 @@ function clearError() {
// ── Tiles ───────────────────────────────────────────────────────────────────
function tile(m) {
- if (m.pending) {
- return `<div class="pa-tile is-pending">
- <div class="pa-tile-label">${escapeHtml(m.label)}</div>
- <div class="pa-tile-value is-muted">Coming soon</div>
- <div class="pa-tile-sub">${escapeHtml(m.method)}</div>
- </div>`;
- }
if (!m.available) {
return `<div class="pa-tile is-unavailable">
<div class="pa-tile-label">${escapeHtml(m.label)}</div>
@@ -426,7 +426,7 @@ function wireChart(entry) {
function renderCharts(metrics) {
const el = document.getElementById('pa-charts');
- const charted = metrics.filter((m) => !m.pending);
+ const charted = metrics;
el.innerHTML = charted.map(chartCard).join('');
el.removeAttribute('aria-busy');
charts.clear();
@@ -452,7 +452,7 @@ function redrawAll() {
function renderMethods(metrics, body) {
const items = metrics.map((m) => `<div class="pa-method">
- <dt>${escapeHtml(m.label)}${m.pending ? ' <span class="pa-badge">Coming soon</span>' : ''}${!m.pending && !m.available ? ' <span class="pa-badge is-warn">Unavailable now</span>' : ''}</dt>
+ <dt>${escapeHtml(m.label)}${m.available ? '' : ' <span class="pa-badge is-warn">Unavailable now</span>'}</dt>
<dd>${escapeHtml(m.method)}</dd>
</div>`);
items.push(`<div class="pa-method">
@@ -519,7 +519,7 @@ async function load({ force = false } = {}) {
state.loading = false;
document.getElementById('pa-retry').disabled = false;
clearError();
- const everyMetricFailed = Object.values(body.metrics).every((m) => m.pending || !m.available);
+ const everyMetricFailed = Object.values(body.metrics).every((m) => !m.available);
if (everyMetricFailed) {
state.byWindow.delete(windowKey);
state.data = null;
diff --git a/tests/platform-analytics.test.js b/tests/platform-analytics.test.js
index 5d66c4964..2dd0e0bb6 100644
--- a/tests/platform-analytics.test.js
+++ b/tests/platform-analytics.test.js
@@ -38,6 +38,7 @@ function okSources(overrides = {}) {
daily: [],
}),
hires: async () => ({ total: { hire_volume_usd: 0 }, daily: [] }),
+ creatorFees: async () => ({ total: { creator_fees: 5.5 }, daily: [{ day: '2026-09-28', creator_fees: 0.25 }] }),
...overrides,
};
}
@@ -81,14 +82,10 @@ describe('readPlatformAnalytics', () => {
expect(body.metrics.x402_volume_usd.total).toBe(0.3);
});
- it('marks creator fees as pending until per-agent earnings exist', async () => {
+ it('reports creator fees in SOL from the earnings snapshot', async () => {
const body = await readPlatformAnalytics({ window: '30d', now: NOW, sources: okSources() });
- expect(body.metrics.creator_fees).toMatchObject({
- available: false,
- pending: true,
- total: null,
- method: 'coming with per-agent earnings',
- });
+ expect(body.metrics.creator_fees).toMatchObject({ available: true, unit: 'sol', total: 5.5, window_total: 0.25 });
+ expect(body.metrics.creator_fees.method).toMatch(/custodial wallet/);
});
it('turns a failing source into null metrics plus named errors, never zero', async () => {