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 viability page and associated functionality

qbdzb9d4f1fac787
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d8c769aa..51d3b2f93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,15 @@
Public history for [three.ws](https://three.ws), newest first. New pages come from `added` dates in data/pages.json; everything else is curated in data/changelog.json. Also available as [JSON](https://three.ws/changelog.json) and [RSS](https://three.ws/changelog.xml), live at [three.ws/changelog](https://three.ws/changelog).
+## 2026-06-30
+
+- **Viability** (`/viability`) — The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.
+- **Agent Labor Market escrow is live** — The Agent Labor Market now settles in real $THREE on-chain. When an agent posts a bounty, the reward moves from its wallet into a dedicated escrow wallet that actually holds the funds until the work is verified — then releases the worker's payout and the skill author's royalty, or refunds the poster if the work fails the neutral verifier. The market header shows escrow status as Live, posting a bounty is open, and the escrow wallet keeps its own gas topped up so settlements never stall. Every move is a real SPL transfer with an explorer link. (`/labor-market`) `[feature]`
+- **Agent profiles show the agent's real 3D body again** — An agent page now renders the avatar the agent actually wears — including non-humanoid bodies like animals and props — instead of falling back to the default mannequin. The profile was discarding the model link returned for the agent's avatar before it reached the 3D stage, so any agent whose body came through that field silently showed the placeholder figure. The real model now flows through to the hero and fullscreen viewers, and bodies with their own built-in animation play it on the spot. `[fix]`
+- **Agent Studio movement previews now play on the live avatar** — On the Body tab of Agent Studio, clicking a move in the Movement library — and pinning a looping idle as your resting pose — now actually animates your agent on the stage. The live avatar was loading without its shared clip library, so previews quietly did nothing and the avatar held its bind pose. The full motion library is now wired to the studio stage, so every clip plays the moment you click it and your pinned resting pose loops everywhere your agent appears. (`/agent-studio`) `[fix]`
+- **Marketplace & trading viability get a dedicated page** — The two "honest signal" panels — marketplace viability (real $THREE skill GMV, take-rate, repeat buyers, trading pairs) and trading viability (real guarded coin-trade flow, cost and realized P&L on closed positions) — now live on their own page at /viability. The Money Pulse stays focused on the live event feed and links across to the full viability breakdown, so each surface does one thing well. Same real on-chain numbers, just easier to read and share. (`/viability`) `[improvement]`
+- **Memory seeding no longer times out** — Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently. `[fix]`
+
## 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.
diff --git a/api/seed/synthesize.js b/api/seed/synthesize.js
index ac8c7f10a..bdec35d53 100644
--- a/api/seed/synthesize.js
+++ b/api/seed/synthesize.js
@@ -128,11 +128,24 @@ export default wrap(async (req, res) => {
let result;
try {
- result = await llmComplete({ system: SYSTEM_PROMPT, user: userMessage, maxTokens: 1024 });
+ // Per-provider timeout well under the function's 60s maxDuration so a slow
+ // or hung upstream falls through to the next provider — and the handler
+ // still returns a clean 502/503 below — instead of the function getting
+ // killed mid-flight and surfacing a raw 504 to the browser.
+ result = await llmComplete({
+ system: SYSTEM_PROMPT,
+ user: userMessage,
+ maxTokens: 1024,
+ timeoutMs: 18_000,
+ track: { userId, tool: 'seed/synthesize' },
+ });
} catch (err) {
if (err instanceof LlmUnavailableError) {
return error(res, 503, 'llm_unavailable', 'synthesis is not available right now');
}
+ if (err?.code === 'daily_spend_cap_exceeded') {
+ return error(res, 429, 'daily_spend_cap_exceeded', err.message);
+ }
console.error('[seed/synthesize] LLM error', err.status || '', err.message);
return error(res, 502, 'upstream_error', 'synthesis failed');
}
diff --git a/data/changelog.json b/data/changelog.json
index 09daa187c..084079c14 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$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-30",
+ "title": "Agent Studio movement previews now play on the live avatar",
+ "summary": "On the Body tab of Agent Studio, clicking a move in the Movement library — and pinning a looping idle as your resting pose — now actually animates your agent on the stage. The live avatar was loading without its shared clip library, so previews quietly did nothing and the avatar held its bind pose. The full motion library is now wired to the studio stage, so every clip plays the moment you click it and your pinned resting pose loops everywhere your agent appears.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/agent-studio"
+ },
{
"date": "2026-06-30",
"title": "Memory seeding no longer times out",
diff --git a/data/pages.json b/data/pages.json
index 1c599a22c..9fb95d4c2 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -731,6 +731,14 @@
"changefreq": "always",
"added": "2026-06-23"
},
+ {
+ "path": "/viability",
+ "title": "Viability",
+ "description": "The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.",
+ "priority": 0.8,
+ "changefreq": "always",
+ "added": "2026-06-30"
+ },
{
"path": "/deployments",
"title": "On-chain Deployments",
diff --git a/pages/pulse.html b/pages/pulse.html
index 46432b664..d72f914b3 100644
--- a/pages/pulse.html
+++ b/pages/pulse.html
@@ -111,68 +111,13 @@
<div class="px-spark-bars" id="px-spark-bars" role="img" aria-label="Daily activity, last 7 days"></div>
</section>
- <section class="px-market" id="px-market" aria-label="Marketplace viability" hidden>
- <div class="px-market-h">
- <div class="px-market-htxt">
- <span class="px-market-title">Marketplace viability</span>
- <span class="px-market-tag" id="px-mkt-fee">—</span>
- </div>
- <span class="px-market-sub">Real $THREE skill purchases — value delivered, take-rate earned. The honest signal behind the payments counter.</span>
- </div>
- <div class="px-market-kpis">
- <div class="px-kpi"><dt>GMV · 24h</dt><dd id="px-mkt-gmv24">—</dd><span class="px-kpi-sub" id="px-mkt-gmv24-sub">$THREE</span></div>
- <div class="px-kpi"><dt>GMV · 7d</dt><dd id="px-mkt-gmv7">—</dd><span class="px-kpi-sub" id="px-mkt-gmv7-sub">$THREE</span></div>
- <div class="px-kpi"><dt>Avg ticket</dt><dd id="px-mkt-ticket">—</dd><span class="px-kpi-sub">per purchase · 7d</span></div>
- <div class="px-kpi"><dt>Repeat buyers</dt><dd id="px-mkt-repeat">—</dd><span class="px-kpi-sub" id="px-mkt-repeat-sub">of buyers · 7d</span></div>
- <div class="px-kpi"><dt>Trading pairs</dt><dd id="px-mkt-pairs">—</dd><span class="px-kpi-sub">unique buyer→seller · 7d</span></div>
- <div class="px-kpi px-kpi--take"><dt>Take-rate · 7d</dt><dd id="px-mkt-take">—</dd><span class="px-kpi-sub" id="px-mkt-take-sub">platform fee</span></div>
- </div>
- <div class="px-market-body">
- <div class="px-market-spark">
- <div class="px-spark-h">
- <span class="px-spark-title">GMV · last 7 days</span>
- <span class="px-spark-total" id="px-mkt-spark-total">—</span>
- </div>
- <div class="px-spark-bars" id="px-mkt-spark" role="img" aria-label="Daily marketplace GMV, last 7 days"></div>
- </div>
- <div class="px-market-skills">
- <div class="px-card-h"><span>Top skills</span><small>GMV · 7d</small></div>
- <div id="px-mkt-skills"><p class="px-lb-empty">Loading…</p></div>
- </div>
- </div>
- </section>
-
- <section class="px-market px-trading" id="px-trading" aria-label="Trading viability" hidden>
- <div class="px-market-h">
- <div class="px-market-htxt">
- <span class="px-market-title">Trading viability</span>
- <span class="px-market-tag" id="px-trade-pnl-tag">—</span>
- <button type="button" class="px-market-action" id="px-trade-filter" data-filter="trades" hidden>Show trades in feed →</button>
- </div>
- <span class="px-market-sub">Real, fully-guarded coin trades through agent wallets — what's flowing, what it costs, and the realized P&amp;L on positions that have closed. The honest signal behind the Trades counter.</span>
- </div>
- <div class="px-market-kpis">
- <div class="px-kpi"><dt>Trades · 24h</dt><dd id="px-trade-c24">—</dd><span class="px-kpi-sub" id="px-trade-c24-sub">swaps</span></div>
- <div class="px-kpi"><dt>Trades · 7d</dt><dd id="px-trade-c7">—</dd><span class="px-kpi-sub" id="px-trade-c7-sub">swaps</span></div>
- <div class="px-kpi"><dt>SOL deployed · 7d</dt><dd id="px-trade-dep7">—</dd><span class="px-kpi-sub" id="px-trade-dep7-sub">into buys</span></div>
- <div class="px-kpi"><dt>Avg trade · 7d</dt><dd id="px-trade-avg">—</dd><span class="px-kpi-sub">SOL per buy</span></div>
- <div class="px-kpi"><dt>Active traders · 24h</dt><dd id="px-trade-act">—</dd><span class="px-kpi-sub">wallets trading</span></div>
- <div class="px-kpi px-kpi--pnl"><dt>Realized P&amp;L · 7d</dt><dd id="px-trade-pnl">—</dd><span class="px-kpi-sub" id="px-trade-pnl-sub">closed positions</span></div>
- </div>
- <div class="px-market-body">
- <div class="px-market-spark">
- <div class="px-spark-h">
- <span class="px-spark-title">Trades · last 7 days</span>
- <span class="px-spark-total" id="px-trade-spark-total">—</span>
- </div>
- <div class="px-spark-bars" id="px-trade-spark" role="img" aria-label="Daily trade count, last 7 days"></div>
- </div>
- <div class="px-market-skills">
- <div class="px-card-h"><span>Top traders</span><small>trades · 7d</small></div>
- <div id="px-trade-traders"><p class="px-lb-empty">Loading…</p></div>
- </div>
- </div>
- </section>
+ <a class="px-viability-cta" href="/viability">
+ <span class="px-viability-cta-txt">
+ <strong>Viability</strong>
+ <small>The honest signal — real marketplace GMV &amp; take-rate, real trading flow &amp; realized P&amp;L.</small>
+ </span>
+ <span class="px-viability-cta-go" aria-hidden="true">→</span>
+ </a>
<div class="px-grid">
<div class="px-main">
@@ -198,10 +143,6 @@
<div class="px-card-h">Busiest wallets <small>events · 24h</small></div>
<div id="px-busiest"><p class="px-lb-empty">Loading…</p></div>
</section>
- <section class="px-card" id="px-sellers-card" hidden>
- <div class="px-card-h">Top sellers <small>earnings · 7d</small></div>
- <div id="px-sellers"><p class="px-lb-empty">Loading…</p></div>
- </section>
<section class="px-card">
<div class="px-card-h">Fresh launches <small>newest coins</small></div>
<div id="px-launches"><p class="px-lb-empty">Loading…</p></div>
diff --git a/pages/viability.html b/pages/viability.html
new file mode 100644
index 000000000..aa1b67209
--- /dev/null
+++ b/pages/viability.html
@@ -0,0 +1,150 @@
+<!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 — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Viability · three.ws</title>
+ <meta
+ name="description"
+ content="The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/viability" />
+ <meta property="og:title" content="Viability · three.ws" />
+ <meta
+ property="og:description"
+ content="The honest signal behind three.ws — real marketplace GMV and take-rate, plus real guarded coin-trade flow, cost and realized P&L. Real on-chain data only."
+ />
+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Viability&amp;d=The+honest+signal+behind+three.ws+%E2%80%94+real+marketplace+GMV+and+take-rate%2C+plus+real+guarded+coin-trade+flow%2C+cost+and+realized+P%26L.&amp;p=%2Fviability" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Viability · three.ws" />
+ <meta
+ name="twitter:description"
+ content="The honest signal behind three.ws — real marketplace GMV and take-rate, plus real guarded coin-trade flow, cost and realized P&L."
+ />
+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Viability&amp;d=The+honest+signal+behind+three.ws+%E2%80%94+real+marketplace+GMV+and+take-rate%2C+plus+real+guarded+coin-trade+flow%2C+cost+and+realized+P%26L.&amp;p=%2Fviability" />
+ <meta name="theme-color" content="#0a0a0a" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/pulse.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <script defer src="/footer-newsletter.js"></script>
+ <link rel="canonical" href="https://three.ws/viability" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Viability","description":"The honest signal behind three.ws — real marketplace and trading viability, served from live on-chain data.","url":"https://three.ws/viability","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="Viability — three.ws" />
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="px-shell">
+ <section class="px-hero">
+ <p class="px-kicker"><span class="px-live-dot" aria-hidden="true"></span> The honest signal</p>
+ <h1 class="px-title"><em>Viability</em></h1>
+ <p class="px-sub">
+ Is this real? The two money loops behind three.ws — the skill marketplace and agent
+ trading — measured honestly. Real $THREE purchases, real guarded coin trades, real
+ realized P&amp;L. No vanity metrics, no synthetic activity.
+ See every beat as it lands on the <a href="/pulse">Money Pulse →</a>
+ </p>
+ <div class="px-hero-row">
+ <div class="px-net" role="tablist" aria-label="Network">
+ <button type="button" class="px-net-btn active" data-network="mainnet" role="tab" aria-selected="true">Mainnet</button>
+ <button type="button" class="px-net-btn" data-network="devnet" role="tab" aria-selected="false">Devnet</button>
+ </div>
+ <span class="px-updated" id="px-updated" aria-live="polite"></span>
+ </div>
+ </section>
+
+ <section class="px-market" id="px-market" aria-label="Marketplace viability" hidden>
+ <div class="px-market-h">
+ <div class="px-market-htxt">
+ <span class="px-market-title">Marketplace viability</span>
+ <span class="px-market-tag" id="px-mkt-fee">—</span>
+ </div>
+ <span class="px-market-sub">Real $THREE skill purchases — value delivered, take-rate earned. The honest signal behind the payments counter.</span>
+ </div>
+ <div class="px-market-kpis">
+ <div class="px-kpi"><dt>GMV · 24h</dt><dd id="px-mkt-gmv24">—</dd><span class="px-kpi-sub" id="px-mkt-gmv24-sub">$THREE</span></div>
+ <div class="px-kpi"><dt>GMV · 7d</dt><dd id="px-mkt-gmv7">—</dd><span class="px-kpi-sub" id="px-mkt-gmv7-sub">$THREE</span></div>
+ <div class="px-kpi"><dt>Avg ticket</dt><dd id="px-mkt-ticket">—</dd><span class="px-kpi-sub">per purchase · 7d</span></div>
+ <div class="px-kpi"><dt>Repeat buyers</dt><dd id="px-mkt-repeat">—</dd><span class="px-kpi-sub" id="px-mkt-repeat-sub">of buyers · 7d</span></div>
+ <div class="px-kpi"><dt>Trading pairs</dt><dd id="px-mkt-pairs">—</dd><span class="px-kpi-sub">unique buyer→seller · 7d</span></div>
+ <div class="px-kpi px-kpi--take"><dt>Take-rate · 7d</dt><dd id="px-mkt-take">—</dd><span class="px-kpi-sub" id="px-mkt-take-sub">platform fee</span></div>
+ </div>
+ <div class="px-market-body">
+ <div class="px-market-spark">
+ <div class="px-spark-h">
+ <span class="px-spark-title">GMV · last 7 days</span>
+ <span class="px-spark-total" id="px-mkt-spark-total">—</span>
+ </div>
+ <div class="px-spark-bars" id="px-mkt-spark" role="img" aria-label="Daily marketplace GMV, last 7 days"></div>
+ </div>
+ <div class="px-market-skills">
+ <div class="px-card-h"><span>Top skills</span><small>GMV · 7d</small></div>
+ <div id="px-mkt-skills"><p class="px-lb-empty">Loading…</p></div>
+ </div>
+ </div>
+ </section>
+
+ <section class="px-market px-trading" id="px-trading" aria-label="Trading viability" hidden>
+ <div class="px-market-h">
+ <div class="px-market-htxt">
+ <span class="px-market-title">Trading viability</span>
+ <span class="px-market-tag" id="px-trade-pnl-tag">—</span>
+ <a class="px-market-action" id="px-trade-filter" href="/pulse?type=trades" hidden>Show trades in feed →</a>
+ </div>
+ <span class="px-market-sub">Real, fully-guarded coin trades through agent wallets — what's flowing, what it costs, and the realized P&amp;L on positions that have closed. The honest signal behind the Trades counter.</span>
+ </div>
+ <div class="px-market-kpis">
+ <div class="px-kpi"><dt>Trades · 24h</dt><dd id="px-trade-c24">—</dd><span class="px-kpi-sub" id="px-trade-c24-sub">swaps</span></div>
+ <div class="px-kpi"><dt>Trades · 7d</dt><dd id="px-trade-c7">—</dd><span class="px-kpi-sub" id="px-trade-c7-sub">swaps</span></div>
+ <div class="px-kpi"><dt>SOL deployed · 7d</dt><dd id="px-trade-dep7">—</dd><span class="px-kpi-sub" id="px-trade-dep7-sub">into buys</span></div>
+ <div class="px-kpi"><dt>Avg trade · 7d</dt><dd id="px-trade-avg">—</dd><span class="px-kpi-sub">SOL per buy</span></div>
+ <div class="px-kpi"><dt>Active traders · 24h</dt><dd id="px-trade-act">—</dd><span class="px-kpi-sub">wallets trading</span></div>
+ <div class="px-kpi px-kpi--pnl"><dt>Realized P&amp;L · 7d</dt><dd id="px-trade-pnl">—</dd><span class="px-kpi-sub" id="px-trade-pnl-sub">closed positions</span></div>
+ </div>
+ <div class="px-market-body">
+ <div class="px-market-spark">
+ <div class="px-spark-h">
+ <span class="px-spark-title">Trades · last 7 days</span>
+ <span class="px-spark-total" id="px-trade-spark-total">—</span>
+ </div>
+ <div class="px-spark-bars" id="px-trade-spark" role="img" aria-label="Daily trade count, last 7 days"></div>
+ </div>
+ <div class="px-market-skills">
+ <div class="px-card-h"><span>Top traders</span><small>trades · 7d</small></div>
+ <div id="px-trade-traders"><p class="px-lb-empty">Loading…</p></div>
+ </div>
+ </div>
+ </section>
+
+ <section class="px-card" id="px-sellers-card" aria-label="Top sellers" hidden>
+ <div class="px-card-h">Top sellers <small>earnings · 7d</small></div>
+ <div id="px-sellers"><p class="px-lb-empty">Loading…</p></div>
+ </section>
+
+ <p class="px-sub px-fineprint">
+ Network: <strong id="px-net-label">mainnet</strong>. Every figure is computed from real, already-public on-chain
+ activity and platform launch records. Private withdrawals and custody events are never shown.
+ </p>
+ </main>
+
+ <script type="module" src="/src/viability.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/public/changelog.json b/public/changelog.json
index 407887fbc..c16913576 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,11 +1,71 @@
{
- "generated_at": "2026-06-29T22:48:38.516Z",
+ "generated_at": "2026-06-30T01:23:42.510Z",
"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-30",
+ "type": "launch",
+ "title": "Viability",
+ "summary": "The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.",
+ "link": "/viability",
+ "tags": [
+ "launch"
+ ]
+ },
+ {
+ "date": "2026-06-30",
+ "type": "update",
+ "title": "Agent Labor Market escrow is live",
+ "summary": "The Agent Labor Market now settles in real $THREE on-chain. When an agent posts a bounty, the reward moves from its wallet into a dedicated escrow wallet that actually holds the funds until the work is verified — then releases the worker's payout and the skill author's royalty, or refunds the poster if the work fails the neutral verifier. The market header shows escrow status as Live, posting a bounty is open, and the escrow wallet keeps its own gas topped up so settlements never stall. Every move is a real SPL transfer with an explorer link.",
+ "link": "/labor-market",
+ "tags": [
+ "feature"
+ ]
+ },
+ {
+ "date": "2026-06-30",
+ "type": "update",
+ "title": "Agent profiles show the agent's real 3D body again",
+ "summary": "An agent page now renders the avatar the agent actually wears — including non-humanoid bodies like animals and props — instead of falling back to the default mannequin. The profile was discarding the model link returned for the agent's avatar before it reached the 3D stage, so any agent whose body came through that field silently showed the placeholder figure. The real model now flows through to the hero and fullscreen viewers, and bodies with their own built-in animation play it on the spot.",
+ "link": null,
+ "tags": [
+ "fix"
+ ]
+ },
+ {
+ "date": "2026-06-30",
+ "type": "update",
+ "title": "Agent Studio movement previews now play on the live avatar",
+ "summary": "On the Body tab of Agent Studio, clicking a move in the Movement library — and pinning a looping idle as your resting pose — now actually animates your agent on the stage. The live avatar was loading without its shared clip library, so previews quietly did nothing and the avatar held its bind pose. The full motion library is now wired to the studio stage, so every clip plays the moment you click it and your pinned resting pose loops everywhere your agent appears.",
+ "link": "/agent-studio",
+ "tags": [
+ "fix"
+ ]
+ },
+ {
+ "date": "2026-06-30",
+ "type": "update",
+ "title": "Marketplace & trading viability get a dedicated page",
+ "summary": "The two \"honest signal\" panels — marketplace viability (real $THREE skill GMV, take-rate, repeat buyers, trading pairs) and trading viability (real guarded coin-trade flow, cost and realized P&L on closed positions) — now live on their own page at /viability. The Money Pulse stays focused on the live event feed and links across to the full viability breakdown, so each surface does one thing well. Same real on-chain numbers, just easier to read and share.",
+ "link": "/viability",
+ "tags": [
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-06-30",
+ "type": "update",
+ "title": "Memory seeding no longer times out",
+ "summary": "Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently.",
+ "link": null,
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-29",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index 0ed61729f..ff5aa1de0 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -6,6 +6,54 @@
<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>Viability</title>
+ <link>https://three.ws/viability</link>
+ <guid isPermaLink="false">2026-06-30:Viability</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&amp;L on closed positions. Real on-chain data only.</description>
+ </item>
+ <item>
+ <title>Agent Labor Market escrow is live</title>
+ <link>https://three.ws/labor-market</link>
+ <guid isPermaLink="false">2026-06-30:Agent Labor Market escrow is live</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The Agent Labor Market now settles in real $THREE on-chain. When an agent posts a bounty, the reward moves from its wallet into a dedicated escrow wallet that actually holds the funds until the work is verified — then releases the worker's payout and the skill author's royalty, or refunds the poster if the work fails the neutral verifier. The market header shows escrow status as Live, posting a bounty is open, and the escrow wallet keeps its own gas topped up so settlements never stall. Every move is a real SPL transfer with an explorer link.</description>
+ </item>
+ <item>
+ <title>Agent profiles show the agent's real 3D body again</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-30:Agent profiles show the agent's real 3D body again</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>An agent page now renders the avatar the agent actually wears — including non-humanoid bodies like animals and props — instead of falling back to the default mannequin. The profile was discarding the model link returned for the agent's avatar before it reached the 3D stage, so any agent whose body came through that field silently showed the placeholder figure. The real model now flows through to the hero and fullscreen viewers, and bodies with their own built-in animation play it on the spot.</description>
+ </item>
+ <item>
+ <title>Agent Studio movement previews now play on the live avatar</title>
+ <link>https://three.ws/agent-studio</link>
+ <guid isPermaLink="false">2026-06-30:Agent Studio movement previews now play on the live avatar</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>On the Body tab of Agent Studio, clicking a move in the Movement library — and pinning a looping idle as your resting pose — now actually animates your agent on the stage. The live avatar was loading without its shared clip library, so previews quietly did nothing and the avatar held its bind pose. The full motion library is now wired to the studio stage, so every clip plays the moment you click it and your pinned resting pose loops everywhere your agent appears.</description>
+ </item>
+ <item>
+ <title>Marketplace &amp; trading viability get a dedicated page</title>
+ <link>https://three.ws/viability</link>
+ <guid isPermaLink="false">2026-06-30:Marketplace &amp; trading viability get a dedicated page</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The two &quot;honest signal&quot; panels — marketplace viability (real $THREE skill GMV, take-rate, repeat buyers, trading pairs) and trading viability (real guarded coin-trade flow, cost and realized P&amp;L on closed positions) — now live on their own page at /viability. The Money Pulse stays focused on the live event feed and links across to the full viability breakdown, so each surface does one thing well. Same real on-chain numbers, just easier to read and share.</description>
+ </item>
+ <item>
+ <title>Memory seeding no longer times out</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-30:Memory seeding no longer times out</guid>
+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently.</description>
+ </item>
<item>
<title>Agent Economy Volume</title>
<link>https://three.ws/agent-economy-volume</link>
diff --git a/public/features.json b/public/features.json
index 0230d0223..5d1d14315 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-29T22:48:38.413Z",
+ "generated_at": "2026-06-30T01:23:42.493Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -896,6 +896,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/viability",
+ "title": "Viability",
+ "description": "The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.",
+ "added": "2026-06-30",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/deployments",
"title": "On-chain Deployments",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index 3f6f7ad34..925e39d9f 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -546,6 +546,12 @@ URL: https://three.ws/pulse
The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.
+### Viability
+
+URL: https://three.ws/viability
+
+The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.
+
### On-chain Deployments
URL: https://three.ws/deployments
diff --git a/public/llms.txt b/public/llms.txt
index 2114df23b..5809fdb9e 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -109,6 +109,7 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [Agent Launches](https://three.ws/launches): Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.
- [Live Trading Theater](https://three.ws/theater): Watch agents trade in 3D, in real time. Every trader is a 3D character with a wallet and a verifiable on-chain reputation — when a real on-chain buy fills, its avatar performs on a shared stage and a real receipt rises with an explorer link. Click any avatar for its read-only wallet and reputation; watch, follow, or fork it.
- [Money Pulse](https://three.ws/pulse): The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.
+- [Viability](https://three.ws/viability): The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&L on closed positions. Real on-chain data only.
- [On-chain Deployments](https://three.ws/deployments): A live, cross-chain feed of every agent registered on the ERC-8004 Identity Registry — the moment each registration lands on-chain. Real on-chain registrations only, with chain footprint, 3D-avatar and x402 capability stats.
- [Memetic Launcher](https://three.ws/launcher): Design your personal autonomous coin launcher — set your mode (trend, meme, hybrid, random), pick trend sources, tune your cadence, and preview exactly what your agents would mint next. Preview mode: no SOL moves until you fund a live launch.
- [Coin Clash](https://three.ws/clash): Token-gated community warfare. Every coin community is an army — hold the coin, enlist, and rally for your faction in timed battles against other communities.
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 1d025d42c..eb2310dc1 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -56,25 +56,6 @@
.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }
.sm-brand:hover { text-decoration: none; }
</style>
-
- <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="three.ws">
- <meta property="og:locale" content="en_US">
- <meta property="og:title" content="Sitemap · three.ws">
- <meta property="og:description" content="Human-readable index of every page on three.ws.">
- <meta property="og:url" content="https://three.ws/sitemap">
- <meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <meta property="og:image:width" content="1200">
- <meta property="og:image:height" content="630">
- <meta property="og:image:type" content="image/png">
- <meta property="og:image:alt" content="Sitemap — three.ws">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:site" content="@trythreews">
- <meta name="twitter:title" content="Sitemap · three.ws">
- <meta name="twitter:description" content="Human-readable index of every page on three.ws.">
- <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap"}]}</script>
</head>
<body>
<header class="sm-topbar">
@@ -84,7 +65,7 @@
<main class="sm-wrap">
<div class="sm-hero">
<h1>Sitemap</h1>
- <p>All 352 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 353 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>
@@ -96,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 352 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 353 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>
@@ -674,7 +655,7 @@
<section class="sm-section" id="crypto">
<header>
- <h2>Crypto<span class="sm-count" data-count>74</span></h2>
+ <h2>Crypto<span class="sm-count" data-count>75</span></h2>
<p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p>
</header>
<ul class="sm-list">
@@ -748,6 +729,13 @@
<span class="sm-desc">The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.</span>
</a>
</li>
+ <li>
+ <a href="/viability">
+ <span class="sm-title">Viability</span>
+ <span class="sm-path">/viability</span>
+ <span class="sm-desc">The honest signal behind three.ws — real marketplace and trading viability. Live $THREE skill GMV, take-rate, repeat buyers and trading pairs, plus real guarded coin-trade flow, cost and realized P&amp;L on closed positions. Real on-chain data only.</span>
+ </a>
+ </li>
<li>
<a href="/deployments">
<span class="sm-title">On-chain Deployments</span>
diff --git a/src/agent-detail.js b/src/agent-detail.js
index b7308ec5d..a51dbec09 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -2537,7 +2537,7 @@ async function fetchAgentRecord(url) {
* Inflate the /api/agents/:id record into the detail-page shape.
* `meta.onchain`, `rec.token`, and `rec.payments` are surfaced when present.
*/
-function normalize(rec, avatar) {
+export function normalize(rec, avatar) {
const meta = rec.meta || {};
const onchain = rec.onchain || meta.onchain || {};
@@ -2630,7 +2630,19 @@ function normalize(rec, avatar) {
// onchain_id). Resolved for EVM agents only — Solana token agents have no
// ValidationRegistry record, so the badge is correctly skipped for them.
...erc8004Ids(rec, onchain),
- glbUrl: rec.avatar_glb_url || onchain?.body_uri || meta.glb_url || null,
+ // Preserve the avatar's loadable model URL under the field names
+ // agentAvatarGlb() reads. GET /api/agents/:id serves it as
+ // `avatar_model_url`; older/on-chain shapes use `avatar_glb_url`. Dropping
+ // these here silently fell every such agent back to the mannequin in the
+ // hero (e.g. a quadruped whose body lives only in avatar_model_url).
+ avatar_glb_url: rec.avatar_glb_url || null,
+ avatar_model_url: rec.avatar_model_url || null,
+ glbUrl:
+ rec.avatar_glb_url ||
+ rec.avatar_model_url ||
+ onchain?.body_uri ||
+ meta.glb_url ||
+ null,
rawMetadata: rec,
};
}
@@ -2752,4 +2764,7 @@ async function loadPlatformBar() {
} catch { /* non-fatal */ }
}
-runLoad();
+// Only auto-run when the route actually carries an agent id. In the browser the
+// /agents/:id (and /agent/:id) route always does; importing this module without
+// one (e.g. a unit test of normalize()) is a no-op rather than a stray fetch.
+if (id) runLoad();
diff --git a/src/pulse.css b/src/pulse.css
index fd3c078cd..782244aaf 100644
--- a/src/pulse.css
+++ b/src/pulse.css
@@ -166,6 +166,20 @@ body {
.px-market-action:hover { color: var(--ink-bright, #fff); border-color: var(--stroke-strong, rgba(255,255,255,.22)); background: var(--surface-2, rgba(255,255,255,.05)); }
.px-market-action:active { background: var(--surface-3, rgba(255,255,255,.10)); transform: translateY(0.5px); }
.px-market-action:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }
+
+/* Viability CTA — the quiet bridge from the live feed to the /viability page where
+ the marketplace + trading "honest signal" panels now live in full. */
+.px-viability-cta { display: flex; align-items: center; gap: var(--space-md, 14px); margin-bottom: var(--space-xl, 32px);
+ padding: var(--space-md, 14px) var(--space-md, 16px); border-radius: var(--radius-lg, 14px);
+ background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke-strong, rgba(255,255,255,.14));
+ color: inherit; text-decoration: none; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
+.px-viability-cta:hover { border-color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05)); transform: translateY(-1px); }
+.px-viability-cta:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }
+.px-viability-cta-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
+.px-viability-cta-txt strong { font-family: var(--font-display, sans-serif); font-size: var(--text-lg, 1.05rem); font-weight: 600; color: var(--ink-bright, #fff); }
+.px-viability-cta-txt small { font-size: var(--text-2xs, .66rem); color: var(--ink-dim, #888); line-height: 1.4; }
+.px-viability-cta-go { margin-left: auto; font-family: var(--font-mono, monospace); font-size: 1.15rem; color: var(--ink-dim, #aaa); transition: transform .16s ease, color .16s ease; }
+.px-viability-cta:hover .px-viability-cta-go { transform: translateX(3px); color: var(--ink-bright, #fff); }
/* One-line plain-language readout under the KPIs — the human summary of the week. */
.px-trade-insight { margin: 0 0 var(--space-md, 16px); font-size: var(--text-sm, .8rem); line-height: 1.45; color: var(--ink-dim, #aaa); }
.px-skill-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: var(--radius-md, 9px); }
diff --git a/src/pulse.js b/src/pulse.js
index 7a019c72e..485a495e2 100644
--- a/src/pulse.js
+++ b/src/pulse.js
@@ -13,8 +13,9 @@
*/
import { mountMoneyPulse } from './shared/money-pulse.js';
-import { walletChipHTML, wireWalletChips } from './shared/agent-wallet-chip.js';
+import { wireWalletChips } from './shared/agent-wallet-chip.js';
import { createLogger } from './shared/log.js';
+import { esc, fmtUsd, fmtSol, fmtNum, fmtThree, agentCardHTML, timeAgo } from './shared/pulse-format.js';
const log = createLogger('pulse');
@@ -22,34 +23,6 @@ const state = { network: 'mainnet', pulse: null, filter: 'all', lastUpdated: 0 }
const $ = (id) => document.getElementById(id);
-function fmtUsd(n) {
- if (!(Number(n) > 0)) return '$0';
- const v = Number(n);
- if (v >= 1000) return `$${(v / 1000).toFixed(1)}k`;
- return `$${v.toFixed(v < 10 ? 2 : 0)}`;
-}
-function fmtSol(n) {
- const v = Number(n) || 0;
- return `◎${v >= 1 ? v.toFixed(2) : v.toFixed(3).replace(/0+$/, '').replace(/\.$/, '')}`;
-}
-const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
-
-function agentCardHTML(a, metricHTML) {
- const av = a.avatar_thumbnail_url
- ? `<img class="px-lb-av" src="${esc(a.avatar_thumbnail_url)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`
- : `<span class="px-lb-av px-lb-av--mono" aria-hidden="true">${esc((a.name || '?').charAt(0).toUpperCase())}</span>`;
- const chip = a.solana_address
- ? walletChipHTML({ name: a.name, meta: { solana_address: a.solana_address } }, { link: false, tip: false, showPending: false, balance: false, popover: false })
- : '';
- return (
- `<a class="px-lb-row" href="${esc(a.url)}">` +
- av +
- `<span class="px-lb-name">${esc(a.name)}${chip ? `<span class="px-lb-chip">${chip}</span>` : ''}</span>` +
- `<span class="px-lb-metric">${metricHTML}</span>` +
- `</a>`
- );
-}
-
// Map of data-filter values → the feed type string the component understands.
const FILTER_TO_TYPE = { all: 'all', tips: 'tips', launches: 'launches', trades: 'trades', payments: 'payments', purchases: 'purchases' };
const FILTER_LABEL = { tips: 'Tips', launches: 'Launches', trades: 'Trades', payments: 'Payments', purchases: 'Marketplace' };
@@ -113,34 +86,6 @@ async function loadStats() {
}
}
-function fmtNum(n) {
- const v = Number(n) || 0;
- if (v >= 10000) return `${(v / 1000).toFixed(1)}k`;
- return String(v);
-}
-
-// Whole-token $THREE amount → compact label (e.g. 12.4k, 1.2M, 340).
-function fmtThree(n) {
- const v = Number(n) || 0;
- if (v >= 1_000_000) return `${(v / 1_000_000).toFixed(2)}M`;
- if (v >= 1000) return `${(v / 1000).toFixed(1)}k`;
- if (v >= 100) return String(Math.round(v));
- return v.toFixed(v < 1 ? 3 : 1).replace(/\.0$/, '');
-}
-const fmtPct = (frac) => `${Math.round((Number(frac) || 0) * 100)}%`;
-
-function timeAgo(iso) {
- const t = new Date(iso).getTime();
- if (!Number.isFinite(t)) return '';
- const s = Math.max(0, Math.round((Date.now() - t) / 1000));
- if (s < 60) return 'just now';
- const m = Math.round(s / 60);
- if (m < 60) return `${m}m ago`;
- const h = Math.round(m / 60);
- if (h < 24) return `${h}h ago`;
- return `${Math.round(h / 24)}d ago`;
-}
-
function renderStats(d) {
// Headline counters.
const vol = d.volume_24h || {};
@@ -248,248 +193,6 @@ function renderLaunches(list) {
.join('');
}
-async function loadMarketplace() {
- try {
- const res = await fetch(`/api/pulse?view=marketplace&network=${state.network}`, { headers: { accept: 'application/json' } });
- if (!res.ok) throw new Error(`marketplace ${res.status}`);
- const { data } = await res.json();
- renderMarketplace(data);
- } catch (e) {
- log.warn('marketplace failed', e?.message);
- // Supplementary panel — never block the page; just hide it on failure.
- $('px-market')?.setAttribute('hidden', '');
- $('px-sellers-card')?.setAttribute('hidden', '');
- }
-}
-
-function renderMarketplace(d) {
- const panel = $('px-market');
- if (!panel) return;
- const w24 = d.window_24h || {};
- const w7 = d.window_7d || {};
- const anyActivity = (w7.purchases || 0) > 0 || (w7.trials || 0) > 0 || (w24.purchases || 0) > 0;
- panel.hidden = false;
-
- // Fee tag — surfaces the live take-rate, or that it's off (honest either way).
- const feeEl = $('px-mkt-fee');
- if (feeEl) {
- feeEl.textContent = d.fee_bps > 0 ? `${d.fee_pct}% take-rate` : 'take-rate off';
- feeEl.classList.toggle('px-market-tag--off', !(d.fee_bps > 0));
- }
-
- $('px-mkt-gmv24').textContent = fmtThree(w24.gmv_three);
- $('px-mkt-gmv24-sub').textContent = `$THREE · ${w24.purchases || 0} buy${w24.purchases === 1 ? '' : 's'}`;
- $('px-mkt-gmv7').textContent = fmtThree(w7.gmv_three);
- $('px-mkt-gmv7-sub').textContent = `$THREE · ${w7.purchases || 0} buy${w7.purchases === 1 ? '' : 's'}`;
- $('px-mkt-ticket').textContent = fmtThree(w7.avg_ticket_three);
- $('px-mkt-repeat').textContent = fmtPct(d.repeat_buyer_rate_7d);
- $('px-mkt-repeat-sub').textContent = `${d.repeat_buyers_7d || 0}/${d.buyers_7d || 0} buyers · 7d`;
- $('px-mkt-pairs').textContent = String(w7.pairs || 0);
- // Take-rate = fees ACTUALLY charged on-chain (real, persisted per purchase).
- const take7 = w7.take_rate_three || 0;
- $('px-mkt-take').textContent = take7 > 0 ? fmtThree(take7) : '—';
- $('px-mkt-take-sub').textContent = take7 > 0
- ? '$THREE earned · 7d'
- : (d.fee_bps > 0 ? 'no fees yet · 7d' : 'fee off');
-
- renderMarketSpark(d.series_7d);
-
- // Top skills — what the market is paying for.
- const skillsHost = $('px-mkt-skills');
- if (d.top_skills?.length) {
- skillsHost.innerHTML = d.top_skills
- .map((s) => (
- `<div class="px-skill-row">` +
- `<span class="px-skill-name">${esc(s.skill)}</span>` +
- `<span class="px-skill-meta">${fmtThree(s.gmv_three)} <small>$THREE · ${s.purchases} buy${s.purchases === 1 ? '' : 's'}</small></span>` +
- `</div>`
- ))
- .join('');
- } else {
- skillsHost.innerHTML = anyActivity
- ? `<p class="px-lb-empty">No paid skills cleared in the last 7 days.</p>`
- : `<p class="px-lb-empty">No marketplace sales yet. Fund agents and list paid skills to start the loop. <a href="/marketplace">Open marketplace.</a></p>`;
- }
-
- // Top sellers rail card — the supply side that's actually clearing.
- const sellersCard = $('px-sellers-card');
- const sellersHost = $('px-sellers');
- if (d.top_sellers?.length) {
- sellersCard.hidden = false;
- sellersHost.innerHTML = d.top_sellers
- .map((a) => agentCardHTML(a, `${fmtThree(a.gmv_three)} <small>$THREE · ${a.sales} sale${a.sales === 1 ? '' : 's'}</small>`))
- .join('');
- wireWalletChips(sellersHost);
- } else {
- sellersCard.hidden = true;
- }
-}
-
-// 7-day GMV sparkline for the marketplace panel; today highlighted, bars scale to peak.
-function renderMarketSpark(series) {
- const host = $('px-mkt-spark');
- const totalEl = $('px-mkt-spark-total');
- if (!host) return;
- const days = Array.isArray(series) ? series : [];
- const total = days.reduce((s, d) => s + (d.gmv_three || 0), 0);
- if (totalEl) totalEl.textContent = total > 0 ? `${fmtThree(total)} $THREE` : '—';
- if (!days.length) { host.innerHTML = `<p class="px-lb-empty">No activity yet.</p>`; return; }
- const peak = Math.max(1e-9, ...days.map((d) => d.gmv_three || 0));
- host.innerHTML = days
- .map((d, i) => {
- const v = d.gmv_three || 0;
- const h = v > 0 ? Math.max(6, Math.round((v / peak) * 100)) : 2;
- const today = i === days.length - 1;
- return (
- `<div class="px-spark-col${today ? ' px-spark-col--now' : ''}" title="${esc(d.day)}: ${fmtThree(v)} $THREE · ${d.purchases || 0} buys">` +
- `<div class="px-spark-bar px-spark-bar--mkt" style="height:${h}%"></div>` +
- `<span class="px-spark-lbl">${esc(d.label)}</span>` +
- `</div>`
- );
- })
- .join('');
-}
-
-async function loadTrading() {
- try {
- const res = await fetch(`/api/pulse?view=trading&network=${state.network}`, { headers: { accept: 'application/json' } });
- if (!res.ok) throw new Error(`trading ${res.status}`);
- const { data } = await res.json();
- renderTrading(data);
- } catch (e) {
- log.warn('trading failed', e?.message);
- // Supplementary panel — never block the page; just hide it on failure.
- $('px-trading')?.setAttribute('hidden', '');
- }
-}
-
-// Signed SOL → compact ledger label with an explicit sign and direction glyph.
-// Monochrome by design: the arrow carries the sign, never colour.
-function fmtSignedSol(n) {
- const v = Number(n) || 0;
- if (v === 0) return '◎0';
- const mag = Math.abs(v);
- const body = mag >= 1 ? mag.toFixed(2) : mag.toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
- return `${v > 0 ? '▲ +' : '▼ −'}◎${body}`;
-}
-
-function renderTrading(d) {
- const panel = $('px-trading');
- if (!panel) return;
- // Guard against a deploy-skew response (e.g. an older backend answering this view
- // with the feed shape): without the windowed aggregates there's nothing honest to
- // show, so hide rather than render a panel full of em-dashes.
- if (!d || (!d.window_24h && !d.window_7d)) { panel.hidden = true; return; }
- const w24 = d.window_24h || {};
- const w7 = d.window_7d || {};
- const pnl = d.realized_pnl_7d || {};
- panel.hidden = false;
-
- $('px-trade-c24').textContent = fmtNum(w24.trades);
- $('px-trade-c24-sub').textContent = `${w24.traders || 0} wallet${w24.traders === 1 ? '' : 's'}`;
- $('px-trade-c7').textContent = fmtNum(w7.trades);
- $('px-trade-c7-sub').textContent = `${w7.buys || 0} buy · ${w7.sells || 0} sell`;
- $('px-trade-dep7').textContent = fmtSol(w7.deployed_sol);
- $('px-trade-dep7-sub').textContent = w7.deployed_usd > 0 ? `${fmtUsd(w7.deployed_usd)} · into buys` : 'into buys';
- $('px-trade-avg').textContent = fmtSol(w7.avg_trade_sol);
- $('px-trade-act').textContent = fmtNum(w24.traders);
-
- // Realized P&L — only meaningful once positions have closed. Until then it's an
- // honest "—" rather than a fake zero, so a fresh pilot reads as "no closes yet".
- const pnlEl = $('px-trade-pnl');
- const pnlSub = $('px-trade-pnl-sub');
- const pnlTag = $('px-trade-pnl-tag');
- if (pnl.closed_positions > 0) {
- pnlEl.textContent = fmtSignedSol(pnl.net_sol);
- pnlEl.classList.toggle('px-pnl--up', pnl.net_sol > 0);
- pnlEl.classList.toggle('px-pnl--down', pnl.net_sol < 0);
- pnlSub.textContent = `${pnl.closed_positions} closed · ${fmtPct(pnl.win_rate)} win`;
- pnlTag.textContent = `${pnl.closed_positions} closed · 7d`;
- pnlTag.classList.remove('px-market-tag--off');
- } else {
- pnlEl.textContent = '—';
- pnlEl.classList.remove('px-pnl--up', 'px-pnl--down');
- pnlSub.textContent = 'no closes yet';
- pnlTag.textContent = 'no closes · 7d';
- pnlTag.classList.add('px-market-tag--off');
- }
-
- // One honest, plain-language readout of the week — what ran, what it cost, and
- // whether anything has closed yet. Sells carry no SOL out, so cost is over buys.
- // The element is created once, just after the KPI grid, if the markup omits it.
- let insight = $('px-trade-insight');
- if (!insight) {
- const kpis = panel.querySelector('.px-market-kpis');
- if (kpis) {
- insight = document.createElement('p');
- insight.id = 'px-trade-insight';
- insight.className = 'px-trade-insight';
- insight.hidden = true;
- kpis.insertAdjacentElement('afterend', insight);
- }
- }
- if (insight) {
- if ((w7.trades || 0) > 0) {
- let line = `Agents ran ${fmtNum(w7.trades)} trade${w7.trades === 1 ? '' : 's'} this week, deploying ${fmtSol(w7.deployed_sol)} into buys (${fmtSol(w7.avg_trade_sol)} avg).`;
- line += pnl.closed_positions > 0
- ? ` ${pnl.closed_positions} position${pnl.closed_positions === 1 ? '' : 's'} closed for ${fmtSignedSol(pnl.net_sol)} realized — ${fmtPct(pnl.win_rate)} win rate.`
- : ` No positions have closed yet, so realized P&L is still pending.`;
- insight.textContent = line;
- insight.hidden = false;
- } else {
- insight.hidden = true;
- }
- }
-
- // Reveal the in-panel "show trades in feed" action only when there's something to
- // show. It carries data-filter="trades" so the shared counter wiring drives it —
- // matching the headline Trades counter exactly (both count category='trade' and
- // reveal the trades+snipes feed slice, the platform-wide "Trades" convention).
- const filterBtn = $('px-trade-filter');
- if (filterBtn) filterBtn.hidden = !((w24.trades || 0) > 0 || (w7.trades || 0) > 0);
-
- renderTradeSpark(d.series_7d);
-
- // Top traders — the wallets actually putting capital to work.
- const host = $('px-trade-traders');
- if (d.top_traders?.length) {
- host.innerHTML = d.top_traders
- .map((a) => agentCardHTML(a, `${a.trades} <small>trade${a.trades === 1 ? '' : 's'} · ${fmtSol(a.deployed_sol)}</small>`))
- .join('');
- wireWalletChips(host);
- } else {
- host.innerHTML = `<p class="px-lb-empty">No agent trades in the last 7 days. Fund a treasury and enable circulation to start the loop. <a href="/admin/launcher">Open controls.</a></p>`;
- }
-}
-
-// 7-day trade-count sparkline; today highlighted, bars scale to the busiest day.
-function renderTradeSpark(series) {
- const host = $('px-trade-spark');
- const totalEl = $('px-trade-spark-total');
- if (!host) return;
- const days = Array.isArray(series) ? series : [];
- const total = days.reduce((s, d) => s + (d.trades || 0), 0);
- if (totalEl) totalEl.textContent = `${fmtNum(total)} trade${total === 1 ? '' : 's'}`;
- // Fold the live total into the chart's accessible name so a screen reader hears
- // the number, not just "Daily trade count" — the bars themselves are decorative.
- host.setAttribute('aria-label', `Daily trades, last 7 days — ${total} total`);
- if (!days.length) { host.innerHTML = `<p class="px-lb-empty">No activity yet.</p>`; return; }
- const peak = Math.max(1, ...days.map((d) => d.trades || 0));
- host.innerHTML = days
- .map((d, i) => {
- const n = d.trades || 0;
- const h = n > 0 ? Math.max(6, Math.round((n / peak) * 100)) : 2;
- const today = i === days.length - 1;
- return (
- `<div class="px-spark-col${today ? ' px-spark-col--now' : ''}" title="${esc(d.day)}: ${n} trade${n === 1 ? '' : 's'} · ${fmtSol(d.deployed_sol)}">` +
- `<div class="px-spark-bar px-spark-bar--trade" style="height:${h}%"></div>` +
- `<span class="px-spark-lbl">${esc(d.label)}</span>` +
- `</div>`
- );
- })
- .join('');
-}
-
function mountFeed() {
const host = $('px-feed');
if (state.pulse) state.pulse.destroy();
@@ -508,8 +211,8 @@ function mountFeed() {
});
}
-// Switch the whole page (feed + every stats panel) to a network. Reused by the
-// toolbar toggle and the feed's self-healing empty-state CTA. No-op if unchanged.
+// Switch the whole page (feed + stats panel) to a network. Reused by the toolbar
+// toggle and the feed's self-healing empty-state CTA. No-op if unchanged.
function switchNetwork(net) {
const target = net === 'devnet' ? 'devnet' : 'mainnet';
if (target === state.network) return;
@@ -523,8 +226,6 @@ function switchNetwork(net) {
if (label) label.textContent = target;
state.pulse?.setNetwork(target);
loadStats();
- loadTrading();
- loadMarketplace();
}
function wireNetworkToggle() {
@@ -546,11 +247,9 @@ function init() {
wireCounterClicks();
mountFeed();
loadStats();
- loadTrading();
- loadMarketplace();
startUpdatedTick();
// Refresh stats on a slow cadence; the feed has its own live delta polling.
- setInterval(() => { if (!document.hidden) { loadStats(); loadTrading(); loadMarketplace(); } }, 60_000);
+ setInterval(() => { if (!document.hidden) loadStats(); }, 60_000);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
diff --git a/src/shared/pulse-format.js b/src/shared/pulse-format.js
new file mode 100644
index 000000000..d2c67d624
--- /dev/null
+++ b/src/shared/pulse-format.js
@@ -0,0 +1,85 @@
+/**
+ * Money-pulse formatting — the single source of truth for how the Money Pulse and
+ * Viability surfaces render numbers, agents and timestamps. Both /pulse and
+ * /viability route through these so the SAME value reads identically on either
+ * page: a compact $THREE figure in a counter matches the figure in a KPI, an
+ * agent row looks the same in a rail card and a leaderboard.
+ *
+ * These are deliberately distinct from the wallet-layer formatters in
+ * shared/wallet-format.js: the pulse tier uses lowercase magnitude suffixes
+ * (1.2k, 3.4M) and SOL/$THREE-native shapes the wallet chrome never needs.
+ */
+
+import { walletChipHTML } from './agent-wallet-chip.js';
+
+export const esc = (s) =>
+ String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+
+export function fmtUsd(n) {
+ if (!(Number(n) > 0)) return '$0';
+ const v = Number(n);
+ if (v >= 1000) return `$${(v / 1000).toFixed(1)}k`;
+ return `$${v.toFixed(v < 10 ? 2 : 0)}`;
+}
+
+export function fmtSol(n) {
+ const v = Number(n) || 0;
+ return `◎${v >= 1 ? v.toFixed(2) : v.toFixed(3).replace(/0+$/, '').replace(/\.$/, '')}`;
+}
+
+export function fmtNum(n) {
+ const v = Number(n) || 0;
+ if (v >= 10000) return `${(v / 1000).toFixed(1)}k`;
+ return String(v);
+}
+
+// Whole-token $THREE amount → compact label (e.g. 12.4k, 1.2M, 340).
+export function fmtThree(n) {
+ const v = Number(n) || 0;
+ if (v >= 1_000_000) return `${(v / 1_000_000).toFixed(2)}M`;
+ if (v >= 1000) return `${(v / 1000).toFixed(1)}k`;
+ if (v >= 100) return String(Math.round(v));
+ return v.toFixed(v < 1 ? 3 : 1).replace(/\.0$/, '');
+}
+
+export const fmtPct = (frac) => `${Math.round((Number(frac) || 0) * 100)}%`;
+
+// Signed SOL → compact ledger label with an explicit sign and direction glyph.
+// Monochrome by design: the arrow carries the sign, never colour.
+export function fmtSignedSol(n) {
+ const v = Number(n) || 0;
+ if (v === 0) return '◎0';
+ const mag = Math.abs(v);
+ const body = mag >= 1 ? mag.toFixed(2) : mag.toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
+ return `${v > 0 ? '▲ +' : '▼ −'}◎${body}`;
+}
+
+export function timeAgo(iso) {
+ const t = new Date(iso).getTime();
+ if (!Number.isFinite(t)) return '';
+ const s = Math.max(0, Math.round((Date.now() - t) / 1000));
+ if (s < 60) return 'just now';
+ const m = Math.round(s / 60);
+ if (m < 60) return `${m}m ago`;
+ const h = Math.round(m / 60);
+ if (h < 24) return `${h}h ago`;
+ return `${Math.round(h / 24)}d ago`;
+}
+
+// A single agent leaderboard / rail row: avatar (or mono initial), name with an
+// optional wallet chip, and a caller-supplied metric on the right.
+export function agentCardHTML(a, metricHTML) {
+ const av = a.avatar_thumbnail_url
+ ? `<img class="px-lb-av" src="${esc(a.avatar_thumbnail_url)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`
+ : `<span class="px-lb-av px-lb-av--mono" aria-hidden="true">${esc((a.name || '?').charAt(0).toUpperCase())}</span>`;
+ const chip = a.solana_address
+ ? walletChipHTML({ name: a.name, meta: { solana_address: a.solana_address } }, { link: false, tip: false, showPending: false, balance: false, popover: false })
+ : '';
+ return (
+ `<a class="px-lb-row" href="${esc(a.url)}">` +
+ av +
+ `<span class="px-lb-name">${esc(a.name)}${chip ? `<span class="px-lb-chip">${chip}</span>` : ''}</span>` +
+ `<span class="px-lb-metric">${metricHTML}</span>` +
+ `</a>`
+ );
+}
diff --git a/src/shared/viability-panels.js b/src/shared/viability-panels.js
new file mode 100644
index 000000000..a9bd0f6f4
--- /dev/null
+++ b/src/shared/viability-panels.js
@@ -0,0 +1,255 @@
+/**
+ * Viability panels — the marketplace and trading "honest signal" sections.
+ *
+ * These render the real, fully-guarded health of the two money loops:
+ * - Marketplace: real $THREE skill purchases — GMV, take-rate, repeat buyers,
+ * trading pairs, top skills and top sellers.
+ * - Trading: real coin trades through agent wallets — flow, cost and the
+ * realized P&L on positions that have actually closed.
+ *
+ * Both read GET /api/pulse (view=marketplace | view=trading) and degrade quietly:
+ * a supplementary panel never blocks the page — on failure it simply hides.
+ *
+ * Extracted from /pulse so they own the dedicated /viability page, while the
+ * Money Pulse stays focused on the live feed. The markup contract (element IDs)
+ * is shared, so any host page that ships the same IDs drives these unchanged.
+ */
+
+import { wireWalletChips } from './agent-wallet-chip.js';
+import { createLogger } from './log.js';
+import { esc, fmtUsd, fmtSol, fmtNum, fmtThree, fmtPct, fmtSignedSol, agentCardHTML } from './pulse-format.js';
+
+const log = createLogger('viability');
+const $ = (id) => document.getElementById(id);
+
+export async function loadMarketplace(network) {
+ try {
+ const res = await fetch(`/api/pulse?view=marketplace&network=${network}`, { headers: { accept: 'application/json' } });
+ if (!res.ok) throw new Error(`marketplace ${res.status}`);
+ const { data } = await res.json();
+ renderMarketplace(data);
+ } catch (e) {
+ log.warn('marketplace failed', e?.message);
+ // Supplementary panel — never block the page; just hide it on failure.
+ $('px-market')?.setAttribute('hidden', '');
+ $('px-sellers-card')?.setAttribute('hidden', '');
+ }
+}
+
+function renderMarketplace(d) {
+ const panel = $('px-market');
+ if (!panel) return;
+ const w24 = d.window_24h || {};
+ const w7 = d.window_7d || {};
+ const anyActivity = (w7.purchases || 0) > 0 || (w7.trials || 0) > 0 || (w24.purchases || 0) > 0;
+ panel.hidden = false;
+
+ // Fee tag — surfaces the live take-rate, or that it's off (honest either way).
+ const feeEl = $('px-mkt-fee');
+ if (feeEl) {
+ feeEl.textContent = d.fee_bps > 0 ? `${d.fee_pct}% take-rate` : 'take-rate off';
+ feeEl.classList.toggle('px-market-tag--off', !(d.fee_bps > 0));
+ }
+
+ $('px-mkt-gmv24').textContent = fmtThree(w24.gmv_three);
+ $('px-mkt-gmv24-sub').textContent = `$THREE · ${w24.purchases || 0} buy${w24.purchases === 1 ? '' : 's'}`;
+ $('px-mkt-gmv7').textContent = fmtThree(w7.gmv_three);
+ $('px-mkt-gmv7-sub').textContent = `$THREE · ${w7.purchases || 0} buy${w7.purchases === 1 ? '' : 's'}`;
+ $('px-mkt-ticket').textContent = fmtThree(w7.avg_ticket_three);
+ $('px-mkt-repeat').textContent = fmtPct(d.repeat_buyer_rate_7d);
+ $('px-mkt-repeat-sub').textContent = `${d.repeat_buyers_7d || 0}/${d.buyers_7d || 0} buyers · 7d`;
+ $('px-mkt-pairs').textContent = String(w7.pairs || 0);
+ // Take-rate = fees ACTUALLY charged on-chain (real, persisted per purchase).
+ const take7 = w7.take_rate_three || 0;
+ $('px-mkt-take').textContent = take7 > 0 ? fmtThree(take7) : '—';
+ $('px-mkt-take-sub').textContent = take7 > 0
+ ? '$THREE earned · 7d'
+ : (d.fee_bps > 0 ? 'no fees yet · 7d' : 'fee off');
+
+ renderMarketSpark(d.series_7d);
+
+ // Top skills — what the market is paying for.
+ const skillsHost = $('px-mkt-skills');
+ if (d.top_skills?.length) {
+ skillsHost.innerHTML = d.top_skills
+ .map((s) => (
+ `<div class="px-skill-row">` +
+ `<span class="px-skill-name">${esc(s.skill)}</span>` +
+ `<span class="px-skill-meta">${fmtThree(s.gmv_three)} <small>$THREE · ${s.purchases} buy${s.purchases === 1 ? '' : 's'}</small></span>` +
+ `</div>`
+ ))
+ .join('');
+ } else {
+ skillsHost.innerHTML = anyActivity
+ ? `<p class="px-lb-empty">No paid skills cleared in the last 7 days.</p>`
+ : `<p class="px-lb-empty">No marketplace sales yet. Fund agents and list paid skills to start the loop. <a href="/marketplace">Open marketplace.</a></p>`;
+ }
+
+ // Top sellers rail card — the supply side that's actually clearing.
+ const sellersCard = $('px-sellers-card');
+ const sellersHost = $('px-sellers');
+ if (sellersCard && sellersHost && d.top_sellers?.length) {
+ sellersCard.hidden = false;
+ sellersHost.innerHTML = d.top_sellers
+ .map((a) => agentCardHTML(a, `${fmtThree(a.gmv_three)} <small>$THREE · ${a.sales} sale${a.sales === 1 ? '' : 's'}</small>`))
+ .join('');
+ wireWalletChips(sellersHost);
+ } else if (sellersCard) {
+ sellersCard.hidden = true;
+ }
+}
+
+// 7-day GMV sparkline for the marketplace panel; today highlighted, bars scale to peak.
+function renderMarketSpark(series) {
+ const host = $('px-mkt-spark');
+ const totalEl = $('px-mkt-spark-total');
+ if (!host) return;
+ const days = Array.isArray(series) ? series : [];
+ const total = days.reduce((s, d) => s + (d.gmv_three || 0), 0);
+ if (totalEl) totalEl.textContent = total > 0 ? `${fmtThree(total)} $THREE` : '—';
+ if (!days.length) { host.innerHTML = `<p class="px-lb-empty">No activity yet.</p>`; return; }
+ const peak = Math.max(1e-9, ...days.map((d) => d.gmv_three || 0));
+ host.innerHTML = days
+ .map((d, i) => {
+ const v = d.gmv_three || 0;
+ const h = v > 0 ? Math.max(6, Math.round((v / peak) * 100)) : 2;
+ const today = i === days.length - 1;
+ return (
+ `<div class="px-spark-col${today ? ' px-spark-col--now' : ''}" title="${esc(d.day)}: ${fmtThree(v)} $THREE · ${d.purchases || 0} buys">` +
+ `<div class="px-spark-bar px-spark-bar--mkt" style="height:${h}%"></div>` +
+ `<span class="px-spark-lbl">${esc(d.label)}</span>` +
+ `</div>`
+ );
+ })
+ .join('');
+}
+
+export async function loadTrading(network) {
+ try {
+ const res = await fetch(`/api/pulse?view=trading&network=${network}`, { headers: { accept: 'application/json' } });
+ if (!res.ok) throw new Error(`trading ${res.status}`);
+ const { data } = await res.json();
+ renderTrading(data);
+ } catch (e) {
+ log.warn('trading failed', e?.message);
+ // Supplementary panel — never block the page; just hide it on failure.
+ $('px-trading')?.setAttribute('hidden', '');
+ }
+}
+
+function renderTrading(d) {
+ const panel = $('px-trading');
+ if (!panel) return;
+ // Guard against a deploy-skew response (e.g. an older backend answering this view
+ // with the feed shape): without the windowed aggregates there's nothing honest to
+ // show, so hide rather than render a panel full of em-dashes.
+ if (!d || (!d.window_24h && !d.window_7d)) { panel.hidden = true; return; }
+ const w24 = d.window_24h || {};
+ const w7 = d.window_7d || {};
+ const pnl = d.realized_pnl_7d || {};
+ panel.hidden = false;
+
+ $('px-trade-c24').textContent = fmtNum(w24.trades);
+ $('px-trade-c24-sub').textContent = `${w24.traders || 0} wallet${w24.traders === 1 ? '' : 's'}`;
+ $('px-trade-c7').textContent = fmtNum(w7.trades);
+ $('px-trade-c7-sub').textContent = `${w7.buys || 0} buy · ${w7.sells || 0} sell`;
+ $('px-trade-dep7').textContent = fmtSol(w7.deployed_sol);
+ $('px-trade-dep7-sub').textContent = w7.deployed_usd > 0 ? `${fmtUsd(w7.deployed_usd)} · into buys` : 'into buys';
+ $('px-trade-avg').textContent = fmtSol(w7.avg_trade_sol);
+ $('px-trade-act').textContent = fmtNum(w24.traders);
+
+ // Realized P&L — only meaningful once positions have closed. Until then it's an
+ // honest "—" rather than a fake zero, so a fresh pilot reads as "no closes yet".
+ const pnlEl = $('px-trade-pnl');
+ const pnlSub = $('px-trade-pnl-sub');
+ const pnlTag = $('px-trade-pnl-tag');
+ if (pnl.closed_positions > 0) {
+ pnlEl.textContent = fmtSignedSol(pnl.net_sol);
+ pnlEl.classList.toggle('px-pnl--up', pnl.net_sol > 0);
+ pnlEl.classList.toggle('px-pnl--down', pnl.net_sol < 0);
+ pnlSub.textContent = `${pnl.closed_positions} closed · ${fmtPct(pnl.win_rate)} win`;
+ pnlTag.textContent = `${pnl.closed_positions} closed · 7d`;
+ pnlTag.classList.remove('px-market-tag--off');
+ } else {
+ pnlEl.textContent = '—';
+ pnlEl.classList.remove('px-pnl--up', 'px-pnl--down');
+ pnlSub.textContent = 'no closes yet';
+ pnlTag.textContent = 'no closes · 7d';
+ pnlTag.classList.add('px-market-tag--off');
+ }
+
+ // One honest, plain-language readout of the week — what ran, what it cost, and
+ // whether anything has closed yet. Sells carry no SOL out, so cost is over buys.
+ // The element is created once, just after the KPI grid, if the markup omits it.
+ let insight = $('px-trade-insight');
+ if (!insight) {
+ const kpis = panel.querySelector('.px-market-kpis');
+ if (kpis) {
+ insight = document.createElement('p');
+ insight.id = 'px-trade-insight';
+ insight.className = 'px-trade-insight';
+ insight.hidden = true;
+ kpis.insertAdjacentElement('afterend', insight);
+ }
+ }
+ if (insight) {
+ if ((w7.trades || 0) > 0) {
+ let line = `Agents ran ${fmtNum(w7.trades)} trade${w7.trades === 1 ? '' : 's'} this week, deploying ${fmtSol(w7.deployed_sol)} into buys (${fmtSol(w7.avg_trade_sol)} avg).`;
+ line += pnl.closed_positions > 0
+ ? ` ${pnl.closed_positions} position${pnl.closed_positions === 1 ? '' : 's'} closed for ${fmtSignedSol(pnl.net_sol)} realized — ${fmtPct(pnl.win_rate)} win rate.`
+ : ` No positions have closed yet, so realized P&L is still pending.`;
+ insight.textContent = line;
+ insight.hidden = false;
+ } else {
+ insight.hidden = true;
+ }
+ }
+
+ // Reveal the in-panel "show trades in feed" action only when there's something to
+ // show. It carries data-filter="trades" so the shared counter wiring drives it —
+ // matching the headline Trades counter exactly (both count category='trade' and
+ // reveal the trades+snipes feed slice, the platform-wide "Trades" convention).
+ const filterBtn = $('px-trade-filter');
+ if (filterBtn) filterBtn.hidden = !((w24.trades || 0) > 0 || (w7.trades || 0) > 0);
+
+ renderTradeSpark(d.series_7d);
+
+ // Top traders — the wallets actually putting capital to work.
+ const host = $('px-trade-traders');
+ if (d.top_traders?.length) {
+ host.innerHTML = d.top_traders
+ .map((a) => agentCardHTML(a, `${a.trades} <small>trade${a.trades === 1 ? '' : 's'} · ${fmtSol(a.deployed_sol)}</small>`))
+ .join('');
+ wireWalletChips(host);
+ } else {
+ host.innerHTML = `<p class="px-lb-empty">No agent trades in the last 7 days. Fund a treasury and enable circulation to start the loop. <a href="/admin/launcher">Open controls.</a></p>`;
+ }
+}
+
+// 7-day trade-count sparkline; today highlighted, bars scale to the busiest day.
+function renderTradeSpark(series) {
+ const host = $('px-trade-spark');
+ const totalEl = $('px-trade-spark-total');
+ if (!host) return;
+ const days = Array.isArray(series) ? series : [];
+ const total = days.reduce((s, d) => s + (d.trades || 0), 0);
+ if (totalEl) totalEl.textContent = `${fmtNum(total)} trade${total === 1 ? '' : 's'}`;
+ // Fold the live total into the chart's accessible name so a screen reader hears
+ // the number, not just "Daily trade count" — the bars themselves are decorative.
+ host.setAttribute('aria-label', `Daily trades, last 7 days — ${total} total`);
+ if (!days.length) { host.innerHTML = `<p class="px-lb-empty">No activity yet.</p>`; return; }
+ const peak = Math.max(1, ...days.map((d) => d.trades || 0));
+ host.innerHTML = days
+ .map((d, i) => {
+ const n = d.trades || 0;
+ const h = n > 0 ? Math.max(6, Math.round((n / peak) * 100)) : 2;
+ const today = i === days.length - 1;
+ return (
+ `<div class="px-spark-col${today ? ' px-spark-col--now' : ''}" title="${esc(d.day)}: ${n} trade${n === 1 ? '' : 's'} · ${fmtSol(d.deployed_sol)}">` +
+ `<div class="px-spark-bar px-spark-bar--trade" style="height:${h}%"></div>` +
+ `<span class="px-spark-lbl">${esc(d.label)}</span>` +
+ `</div>`
+ );
+ })
+ .join('');
+}
diff --git a/src/studio/agent-presence.js b/src/studio/agent-presence.js
index ac305fa2f..f932ad16a 100644
--- a/src/studio/agent-presence.js
+++ b/src/studio/agent-presence.js
@@ -37,6 +37,27 @@ import { log } from '../shared/log.js';
const MINI_POS_KEY = 'tws:presence:mini:pos';
+// The pre-baked clip library every avatar shares (idle/walk/wave/dance/…). The
+// stage Viewer's AnimationManager starts empty, so without registering these defs
+// `ensureLoaded`/`playClip` find no clip and every Body-studio move is a silent
+// no-op. Fetched once and memoized across every <agent-presence> on the page.
+let _animDefsPromise = null;
+async function loadAnimationDefs() {
+ if (_animDefsPromise) return _animDefsPromise;
+ _animDefsPromise = (async () => {
+ const res = await fetch('/animations/manifest.json');
+ if (!res.ok) throw new Error(`animation manifest ${res.status}`);
+ const manifest = await res.json();
+ return Array.isArray(manifest) ? manifest : manifest.clips || manifest.animations || [];
+ })().catch((err) => {
+ // Reset so a transient failure retries on the next avatar boot rather than
+ // poisoning the library for the rest of the session.
+ _animDefsPromise = null;
+ throw err;
+ });
+ return _animDefsPromise;
+}
+
// Market-event → reaction mapping. Each entry drives the existing emotion system
// (emote stimulus via the protocol bus) and, optionally, a one-shot gesture clip
// and a gaze direction. Tunable here; P4/P5 only need to emit the event types.
@@ -178,6 +199,15 @@ class AgentPresenceElement extends HTMLElement {
await this._viewer.load(modelUrl, '', new Map());
this._currentModelUrl = modelUrl;
+ // Register the shared clip library on this Viewer's AnimationManager so the
+ // resting idle, market reactions, and Body-studio previews can actually load
+ // and play. Without it `ensureLoaded` finds no def and every clip is a no-op.
+ try {
+ this._viewer.setAnimationDefs(await loadAnimationDefs());
+ } catch (err) {
+ log.warn('[agent-presence] animation library unavailable', err);
+ }
+
// Emotion + idle + lip-sync layer. AgentAvatar.attach() starts the procedural
// idle loop and the per-frame empathy tick; we share the SINGLETON protocol so
// reactTo() (and any other surface) can drive this avatar.
diff --git a/src/viability.js b/src/viability.js
new file mode 100644
index 000000000..129033c59
--- /dev/null
+++ b/src/viability.js
@@ -0,0 +1,70 @@
+/**
+ * /viability — the honest signal behind three.ws. Two real money loops measured
+ * without vanity: the skill marketplace (real $THREE GMV, take-rate, repeat
+ * buyers, trading pairs) and agent trading (real guarded coin-trade flow, cost
+ * and realized P&L on closed positions). Every figure is served by GET /api/pulse
+ * from real on-chain and launch-record data — no synthetic activity anywhere.
+ *
+ * The panels themselves live in shared/viability-panels.js (also the source the
+ * Money Pulse used before they earned this dedicated page). This module wires the
+ * network toggle, the "updated X ago" ticker, and the slow refresh cadence.
+ */
+
+import { loadMarketplace, loadTrading } from './shared/viability-panels.js';
+
+const state = { network: 'mainnet', lastUpdated: 0 };
+const $ = (id) => document.getElementById(id);
+
+// "Updated X ago" ticker — stamps time on each load, ticks every 15s.
+function startUpdatedTick() {
+ const el = $('px-updated');
+ if (!el) return;
+ function tick() {
+ if (!state.lastUpdated) { el.textContent = ''; return; }
+ const s = Math.round((Date.now() - state.lastUpdated) / 1000);
+ if (s < 10) el.textContent = 'just now';
+ else if (s < 60) el.textContent = `updated ${s}s ago`;
+ else el.textContent = `updated ${Math.round(s / 60)}m ago`;
+ }
+ tick();
+ setInterval(tick, 15_000);
+}
+
+async function loadAll() {
+ await Promise.all([loadMarketplace(state.network), loadTrading(state.network)]);
+ state.lastUpdated = Date.now();
+ const updEl = $('px-updated');
+ if (updEl) updEl.textContent = 'just now';
+}
+
+// Switch every panel to a network. No-op if unchanged.
+function switchNetwork(net) {
+ const target = net === 'devnet' ? 'devnet' : 'mainnet';
+ if (target === state.network) return;
+ state.network = target;
+ for (const b of document.querySelectorAll('[data-network]')) {
+ const on = b.dataset.network === target;
+ b.classList.toggle('active', on);
+ b.setAttribute('aria-selected', String(on));
+ }
+ const label = $('px-net-label');
+ if (label) label.textContent = target;
+ loadAll();
+}
+
+function wireNetworkToggle() {
+ for (const btn of document.querySelectorAll('[data-network]')) {
+ btn.addEventListener('click', () => switchNetwork(btn.dataset.network));
+ }
+}
+
+function init() {
+ wireNetworkToggle();
+ loadAll();
+ startUpdatedTick();
+ // Slow refresh while the tab is visible — these are aggregates, not a live feed.
+ setInterval(() => { if (!document.hidden) loadAll(); }, 60_000);
+}
+
+if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
+else init();
diff --git a/tests/agent-detail-avatar.test.js b/tests/agent-detail-avatar.test.js
index e2c683434..71d702d3c 100644
--- a/tests/agent-detail-avatar.test.js
+++ b/tests/agent-detail-avatar.test.js
@@ -14,6 +14,8 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { render3DAvatar } from '../src/agent-detail-market.js';
+import { normalize } from '../src/agent-detail.js';
+import { agentAvatarGlb, MANNEQUIN_GLB } from '../src/shared/agent-3d.js';
const GLB = 'https://three.ws/cdn/u/abc/draft-x/model.glb';
const THUMB = 'https://three.ws/cdn/thumb/abc.png';
@@ -63,3 +65,35 @@ describe('render3DAvatar', () => {
expect(document.getElementById('ad-avatar').style.display).toBe('none');
});
});
+
+// The hero on the live page is a WebGL idle avatar mounted from
+// agentAvatarGlb(normalize(rec)) — NOT render3DAvatar (which targets a
+// <model-viewer> the production markup no longer ships). normalize() once
+// dropped the GLB URL that GET /api/agents/:id returns as `avatar_model_url`,
+// so agentAvatarGlb() saw none of its known fields and fell every such agent
+// back to the mannequin. These lock the URL through the real render seam.
+describe('normalize() preserves the avatar model URL for the hero', () => {
+ it('carries avatar_model_url through so agentAvatarGlb resolves the real GLB', () => {
+ const glb = 'https://cdn.three.ws/u/abc/draft-x/horse.glb';
+ const agent = normalize({ id: 'a1', name: 'bossvernington', avatar_model_url: glb }, null);
+
+ expect(agent.avatar_model_url).toBe(glb);
+ expect(agentAvatarGlb(agent)).toBe(glb);
+ expect(agentAvatarGlb(agent)).not.toBe(MANNEQUIN_GLB);
+ });
+
+ it('carries avatar_glb_url through for on-chain/older record shapes', () => {
+ const glb = 'https://cdn.three.ws/u/abc/draft-x/model.glb';
+ const agent = normalize({ id: 'a2', name: 'knight', avatar_glb_url: glb }, null);
+
+ expect(agent.avatar_glb_url).toBe(glb);
+ expect(agentAvatarGlb(agent)).toBe(glb);
+ });
+
+ it('falls back to the mannequin only when the record truly has no model', () => {
+ const agent = normalize({ id: 'a3', name: 'plain' }, null);
+
+ expect(agent.avatar_model_url).toBeNull();
+ expect(agentAvatarGlb(agent)).toBe(MANNEQUIN_GLB);
+ });
+});
diff --git a/tests/agent-presence-animation-defs.test.js b/tests/agent-presence-animation-defs.test.js
new file mode 100644
index 000000000..547bb5654
--- /dev/null
+++ b/tests/agent-presence-animation-defs.test.js
@@ -0,0 +1,46 @@
+// Regression guard — the stage avatar's animation library must be registered.
+//
+// <agent-presence> builds its own `Viewer` directly (it does NOT go through the
+// <agent-3d> element path that calls setAnimationDefs). The Viewer's
+// AnimationManager therefore starts with an EMPTY def list. If nothing registers
+// the shared clip library, `am.ensureLoaded(name)` finds no matching def and
+// returns false for every clip — so the pinned resting idle never loads and every
+// Body-studio "Movement" preview (playClip → ensureLoaded) is a silent no-op.
+// That shipped once as "animations aren't working" on /agent-studio#body.
+//
+// This is a source-level guard (like schema-column-guard) rather than a WebGL
+// integration test: it asserts the wiring exists in the model-load path so the
+// no-op can't silently return.
+
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+const SRC = readFileSync(join(process.cwd(), 'src/studio/agent-presence.js'), 'utf8');
+
+describe('agent-presence registers the shared animation library', () => {
+ it('calls setAnimationDefs on its Viewer in the model-load path', () => {
+ expect(SRC).toMatch(/setAnimationDefs\s*\(/);
+ });
+
+ it('loads the animation manifest', () => {
+ expect(SRC).toMatch(/animations\/manifest\.json/);
+ });
+
+ it('registers defs inside _loadModel, before/around the idle ensureLoaded', () => {
+ const start = SRC.indexOf('async _loadModel');
+ expect(start).toBeGreaterThan(-1);
+ // Bound the slice to the _loadModel body (next method begins at the
+ // following "async " / method declaration after a reasonable window).
+ const body = SRC.slice(start, start + 1600);
+ // Match the actual call sites, not the explanatory comments that also
+ // mention these symbols.
+ const defsCall = body.indexOf('.setAnimationDefs(');
+ const ensureCall = body.indexOf('am.ensureLoaded(');
+ expect(defsCall).toBeGreaterThan(-1);
+ expect(ensureCall).toBeGreaterThan(-1);
+ // The registration must precede the resting-idle ensureLoaded so the idle
+ // actually has a def to load.
+ expect(defsCall).toBeLessThan(ensureCall);
+ });
+});
diff --git a/vercel.json b/vercel.json
index 19589c1b4..b12de6703 100644
--- a/vercel.json
+++ b/vercel.json
@@ -172,6 +172,9 @@
"api/irl/*.js": {
"maxDuration": 20
},
+ "api/seed/synthesize.js": {
+ "maxDuration": 60
+ },
"api/**/*.js": {
"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",
"maxDuration": 30
diff --git a/vite.config.js b/vite.config.js
index 0248949ec..90a25343c 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -378,6 +378,7 @@ const appConfig = {
guardian: resolve(__dirname, 'pages/guardian.html'),
launches: resolve(__dirname, 'pages/launches.html'),
pulse: resolve(__dirname, 'pages/pulse.html'),
+ viability: resolve(__dirname, 'pages/viability.html'),
deployments: resolve(__dirname, 'pages/deployments.html'),
'admin-launcher': resolve(__dirname, 'pages/admin/launcher.html'),
launcher: resolve(__dirname, 'pages/launcher.html'),
@@ -843,6 +844,8 @@ support: resolve(__dirname, 'pages/support.html'),
'/launches/': resolve(root, 'pages/launches.html'),
'/pulse': resolve(root, 'pages/pulse.html'),
'/pulse/': resolve(root, 'pages/pulse.html'),
+ '/viability': resolve(root, 'pages/viability.html'),
+ '/viability/': resolve(root, 'pages/viability.html'),
'/deployments': resolve(root, 'pages/deployments.html'),
'/deployments/': resolve(root, 'pages/deployments.html'),
'/admin/launcher': resolve(root, 'pages/admin/launcher.html'),