Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: enhance swarms UI with game-feel elements
qbdzad9c62e50f06
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 87c5723fd..2effa79b3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,10 +10,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **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 Sniper is now a standalone open-source package** — The engine that lets three.ws agents snipe pump.fun launches is now its own lightweight, embeddable package: @three-ws/agent-sniper. Run it four ways — as a library, a CLI, an MCP server your AI agent can drive, or a paid x402 API that other agents pay in USDC to use. It ships with pluggable wallet, storage, RPC, and launch-feed adapters, so you can run a fully self-custodial sniper from your own keypair or a multi-tenant hosted service from one engine. Every agent gets its own wallet, its own budget and concurrency caps, a mandatory stop-loss, a price-impact circuit breaker, and a simulate-first default — plus the 3D-agent layer that puts a live trading desk on screen. Multiple agents and multiple users can snipe side by side, each embodied by its own 3D AI agent. `[sdk, feature]`- **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]`+- **Fixed the agent wallet page returning a 404** — Opening the agent wallet at /agent-wallet no longer hits a 404. The page was built and shipping, but the clean URL had no route, so it fell through to the not-found page. It now loads correctly and, when opened without a specific agent, shows a clear prompt to pick or create one. (`/agent-wallet`) `[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]`- **Oracle now has full documentation** — Everything behind the conviction score, in one place. The new Oracle docs explain — in plain English and, where you want it, full mathematical detail — how Oracle reads every pump.fun launch: the four pillars (who's buying, how it's structured, what story it rides, how it's moving), exactly how they fuse into a 0–100 score, where the hard caps come from, how the engine is calibrated and backtested against real outcomes, how to arm an agent on it, the full public API, and where it's headed. Real screenshots throughout, a quickstart for traders, builders, and skeptics, and a researcher-level appendix. (`/oracle/docs`) `[docs, feature]`+- **Swarm dashboards now show consensus building and firing live** — When you watch a trading swarm, you can now see the moment it decides. Every consensus vote animates in and fills a meter toward the swarm's firing threshold in real time. When member consensus clears the line and the treasury actually fires a buy, the meter visibly crosses the threshold with a hot success glow, the vote stamps a pulsing “fire” badge, and a single accent ripple sweeps the panel — so the most important event on the page lands instead of slipping by as a quiet log line. Skips fill toward the line and stop short. Respects reduced-motion preferences. (`/swarms`) `[improvement]`+- **Swarm treasury figures now count up and flash when money moves** — On a live swarm dashboard, the treasury tiles — balance, realized P&L, open positions and win rate — no longer hard-swap to a new number. When a live update lands, each figure smoothly counts from its current value to the new one and the tile flashes in the direction of the change: green when it rises, red when it drops. A confirmed payout pulses the balance and P&L tiles the instant the money lands. It animates only between two real values, never from zero, and respects reduced-motion preferences (those users get an instant, exact update). (`/swarms`) `[improvement]`+- **The swarm members panel is now a live standings board** — A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip that visibly grows with the score, because in a swarm your track record is literally your voting power. The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences. (`/swarms`) `[improvement]`## 2026-06-29diff --git a/api/swarms/[id].js b/api/swarms/[id].jsindex 75b799bf6..ae14e6412 100644--- a/api/swarms/[id].js+++ b/api/swarms/[id].js@@ -65,7 +65,7 @@ async function streamSwarm(req, res, id) {try {const [votes, payouts, posAgg] = await Promise.all([sql`select id, mint, decision, consensus, min_consensus, conviction, size_lamports,- members_long, members_total, smart_money_score, reason, position_id, created_at+ members_long, members_total, smart_money_score, breakdown, reason, position_id, created_atfrom swarm_votes where swarm_id = ${id} and created_at > ${lastVoteAt}order by created_at asc limit 20`,sql`select id, kind, amount_lamports, share_bps, agent_id, signature, status, created_at@@ -73,6 +73,7 @@ async function streamSwarm(req, res, id) {order by created_at asc limit 20`,sql`select count(*) filter (where status in ('open','opening','closing'))::int as open,count(*) filter (where status='closed')::int as closed,+ count(*) filter (where status='closed' and realized_pnl_lamports > 0)::int as wins,coalesce(sum(realized_pnl_lamports),0)::numeric as pnlfrom agent_sniper_positions where agent_id = ${swarm.treasury_agent_id} and network = ${swarm.network}`,]);@@ -90,12 +91,14 @@ async function streamSwarm(req, res, id) {balanceSol = lam == null ? null : Number(lam) / 1e9;}const cur = await getSwarm(id);+ const closedCount = posAgg[0]?.closed || 0;send('tick', {status: cur?.status || swarm.status,balance_sol: balanceSol,open_positions: posAgg[0]?.open || 0,- closed_trades: posAgg[0]?.closed || 0,+ closed_trades: closedCount,realized_pnl_sol: Number(String(posAgg[0]?.pnl || '0').split('.')[0]) / 1e9,+ win_rate: closedCount > 0 ? (posAgg[0]?.wins || 0) / closedCount : null,});} catch {/* transient DB blip — keep the stream open, retry next tick */diff --git a/data/changelog.json b/data/changelog.jsonindex 73eb1c68b..c7a0422ae 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,42 @@{"$comment": "Curated changelog entries for three.ws \u2014 the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-30",+ "title": "The swarm members panel is now a live standings board",+ "summary": "A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip that visibly grows with the score, because in a swarm your track record is literally your voting power. The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences.",+ "tags": [+ "improvement"+ ],+ "link": "/swarms"+ },+ {+ "date": "2026-06-30",+ "title": "Swarm treasury figures now count up and flash when money moves",+ "summary": "On a live swarm dashboard, the treasury tiles — balance, realized P&L, open positions and win rate — no longer hard-swap to a new number. When a live update lands, each figure smoothly counts from its current value to the new one and the tile flashes in the direction of the change: green when it rises, red when it drops. A confirmed payout pulses the balance and P&L tiles the instant the money lands. It animates only between two real values, never from zero, and respects reduced-motion preferences (those users get an instant, exact update).",+ "tags": [+ "improvement"+ ],+ "link": "/swarms"+ },+ {+ "date": "2026-06-30",+ "title": "Swarm dashboards now show consensus building and firing live",+ "summary": "When you watch a trading swarm, you can now see the moment it decides. Every consensus vote animates in and fills a meter toward the swarm's firing threshold in real time. When member consensus clears the line and the treasury actually fires a buy, the meter visibly crosses the threshold with a hot success glow, the vote stamps a pulsing “fire” badge, and a single accent ripple sweeps the panel — so the most important event on the page lands instead of slipping by as a quiet log line. Skips fill toward the line and stop short. Respects reduced-motion preferences.",+ "tags": [+ "improvement"+ ],+ "link": "/swarms"+ },+ {+ "date": "2026-06-30",+ "title": "Fixed the agent wallet page returning a 404",+ "summary": "Opening the agent wallet at /agent-wallet no longer hits a 404. The page was built and shipping, but the clean URL had no route, so it fell through to the not-found page. It now loads correctly and, when opened without a specific agent, shows a clear prompt to pick or create one.",+ "tags": [+ "fix"+ ],+ "link": "/agent-wallet"+ },{"date": "2026-06-30","title": "Agent Sniper is now a standalone open-source package",diff --git a/prompts/swarms-ui/00-README.md b/prompts/swarms-ui/00-README.mdnew file mode 100644index 000000000..108170b24--- /dev/null+++ b/prompts/swarms-ui/00-README.md@@ -0,0 +1,25 @@+# Swarms UI — game-feel prompt set++Five self-contained prompts that add **game-feel** to the `/swarms` page without+changing the economics. Each file is a complete brief — open it in a **fresh chat**+and run it on its own. They don't depend on each other, but this is a sensible order+(cheapest/highest-impact first):++1. [`01-firing-moment.md`](01-firing-moment.md) — the consensus meter as a tension bar; a real "FIRE" moment when a vote clears threshold.+2. [`02-counting-tiles.md`](02-counting-tiles.md) — count-up + value-change flash on the treasury tiles when ticks/payouts land.+3. [`03-member-standings.md`](03-member-standings.md) — members panel becomes a live scoreboard; winning voters light up.+4. [`04-equity-curve.md`](04-equity-curve.md) — a real equity-curve sparkline + win-rate ring above the tiles.+5. [`05-directory-ladder.md`](05-directory-ladder.md) — the directory becomes a ranked ladder with sort + "hot" markers.++## The shared rails (every prompt restates these — they are non-negotiable)++- **Design tokens only.** All color/space/type come from `/tokens.css` CSS variables. Never hardcode a hex or px where a token exists. Match the existing restrained, Linear/Stripe-grade aesthetic in `src/swarms.css`.+- **Motion signals, never decorates.** No confetti, no sound, no gratuitous shimmer. A single accent ripple, a count-up, a snap — that's the vocabulary. Gate **every** new animation behind `@media (prefers-reduced-motion: reduce)` (the file already does this at `src/swarms.css:234`).+- **No fake data.** Animating a transition between two *real* values (count-up between two real numbers) is fine. Inventing data, fake progress bars, or `setTimeout` fake-loading is forbidden (CLAUDE.md hard rule). Every pixel must trace to a real SSE event or API field.+- **Concurrent agents share this worktree.** Stage explicit paths only, re-check `git status` before committing, never `git add -A`. Don't commit unless the user asks.++## Phase 2 (not in this set)++After these land, the same treatment goes **site-wide** — auditing UX/UI across every+surface (`STRUCTURE.md` maps them) and bringing each to this bar. That's a separate+effort; these five prove the pattern on one page first.diff --git a/prompts/swarms-ui/01-firing-moment.md b/prompts/swarms-ui/01-firing-moment.mdnew file mode 100644index 000000000..2960981ca--- /dev/null+++ b/prompts/swarms-ui/01-firing-moment.md@@ -0,0 +1,37 @@+# Swarms UI — the firing moment++You are working in `/workspaces/three.ws`. The `/swarms` page renders a live trading+swarm: a pooled treasury that fires buys when reputation-weighted member consensus+clears a threshold. Today, a consensus vote arrives over SSE and is rendered as a+**quiet new row in a log**. That's the gap. A swarm clearing consensus and firing a+real trade is the single most dramatic event on the page — and the UI lets it pass+silently. Make it land.++## What exists today (read these first)++- `src/swarms.js` — `voteRowHTML(v)` builds each vote row; `subscribeStream(id)` (~line 528) wires the SSE `vote` event: it parses the row, inserts it `afterbegin` into `#sw-votes`, calls `flash()`, and toasts only on `decision === 'fire'`. `flash(el)` (~line 568) is a 1.2s background sweep — the only existing juice.+- `src/swarms.css` — the vote meter is already built: `.sw-meter-track`, `.sw-meter-fill` (gradient bar), `.sw-meter-thresh` (the goal-line tick) at lines ~192–194. `.sw-vote .verdict.fire` is the green "fire" badge.+- The SSE `vote` payload (sent from `api/swarms/[id].js`, `streamSwarm`) carries: `decision` (`'fire'|'skip'`), `mint`, `consensus` (0..1), `min_consensus` (0..1), `conviction`, `members_long`, `members_total`, `smart_money_score`, `size_sol`, `reason`.++## Build this++1. **The meter fills, it doesn't just appear.** When a `vote` row enters, animate `.sw-meter-fill` from 0 → `consensus%` (CSS transition on width). When `consensus >= min_consensus` (a **fire**), the fill should visibly *cross* the `.sw-meter-thresh` line and snap/pulse at it — a brief glow on the threshold tick, the fill shifting to a "hot" success-tinted gradient. A skip fills toward the line and stops short, muted.+2. **The row enters with intent.** Slide + fade the new vote row in from the top (not an instant insert). On a fire, stamp it clearly — the `✓ fire` verdict badge should pulse once.+3. **A restrained whole-card signal on fire only.** When the treasury actually fires, a single accent ripple along the top edge of the dashboard (or the votes panel header) — one pass, then gone. No confetti. This is the "something happened" beat. Skips get nothing beyond the meter.+4. **Keep the toast**, but make it feel connected to the visual (same timing).++## Rails (non-negotiable)++- Tokens only from `/tokens.css` (`--success`, `--wallet-accent`, `--wallet-accent-strong`, spacing/radius vars). No hardcoded colors.+- **Gate every animation** behind `@media (prefers-reduced-motion: reduce)` → reduced-motion users get the final state with no transition (mirror the existing block at `src/swarms.css:234`).+- No fake data: the meter animates to the *real* `consensus` value from the event. Don't invent intermediate numbers.+- Match the existing aesthetic — subtle, fast (`--duration-fast`/`--duration-base`, `--ease-emphasized`). If it looks like a slot machine, you've overshot.+- Concurrent agents edit `main` here: stage explicit paths only, re-check `git status` before any commit, never `git add -A`.++## Definition of done++- `npm run dev` (port 3000), open `/swarms`, open a swarm with live votes (or trigger one), watch a real fire and a real skip. Confirm the meter crosses the line on fire and the row animates in.+- No console errors/warnings. `npm test` still passes (`tests/swarms.test.js`).+- `prefers-reduced-motion` verified (DevTools emulation) — no motion, correct end state.+- Add a `data/changelog.json` entry (tag: `improvement`), holder-readable: the swarm dashboard now shows consensus building and firing live.+- Review your `git diff`. Don't commit unless asked.diff --git a/prompts/swarms-ui/02-counting-tiles.md b/prompts/swarms-ui/02-counting-tiles.mdnew file mode 100644index 000000000..f595abc76--- /dev/null+++ b/prompts/swarms-ui/02-counting-tiles.md@@ -0,0 +1,39 @@+# Swarms UI — count-up treasury tiles++You are working in `/workspaces/three.ws`. The `/swarms` dashboard has a row of+treasury tiles — Treasury balance, Net contributed, Realized P&L, Open positions,+Win rate. They update live over SSE, but they **hard-swap** the text: a number jumps+from one value to another with no signal that money just moved. The single cheapest,+highest-impact piece of game-feel is making those numbers *count* to their new value+and flash on change. This is legitimate juice (a transition between two real values),+not fake data.++## What exists today (read these first)++- `src/swarms.js` — `paintDashboard()` (~line 190) renders the tiles. IDs: `#sw-bal` (balance), `#sw-pnl` (realized P&L), `#sw-open` (open positions). The win-rate tile has **no id** — add one (e.g. `#sw-wr`) as part of this work.+- `subscribeStream(id)` (~line 528): the `tick` SSE event updates `#sw-bal`, `#sw-open`, `#sw-pnl` via `textContent` (instant). The `payout` event inserts a row and `flash()`es it.+- `tick` payload fields: `status`, `balance_sol`, `open_positions`, `closed_trades`, `realized_pnl_sol`. (Win rate is derived from closed trades on full render; recompute on tick from the same numbers, or expose it on the tick payload in `api/swarms/[id].js` — your call, keep it real.)+- `src/swarms.css` — `.sw-tile-v` is the big number; `.pos` / `.neg` color it green/red.++## Build this++1. **A reusable count-up.** Add a small helper that animates a tile's numeric value from its current value to the new one over ~400–600ms with easing, preserving the existing formatting (`SOL()`, the `+`/`−` sign on P&L, `%` on win rate, integer on open positions). Use `requestAnimationFrame`, not a library — it's a dozen lines. Cancel any in-flight count-up on the same element before starting a new one.+2. **Flash on change, direction-aware.** When a value increases, a brief green tint on the tile; when it decreases, a brief red/neutral tint — then settle. Reuse/extend the existing `flash()` idea but make it directional and scoped to the tile. P&L going up should *feel* good; balance dropping should register.+3. **Wire every live update through it.** `tick` → count-up balance, open positions, P&L, win rate. A confirmed `payout` should also pulse the P&L / balance tiles (money landed). Keep `#sw-pnl`'s `.pos`/`.neg` class correct after the animation.+4. **No layout shift.** Tiles already use `font-variant-numeric: tabular-nums` — keep widths stable through the count so nothing jitters.++## Rails (non-negotiable)++- Tokens only from `/tokens.css`. No hardcoded colors.+- **Gate the animation** behind `@media (prefers-reduced-motion: reduce)` → those users get an instant set to the final value (current behavior), no count, no flash.+- No fake data: count *between two real values* only. Never animate from 0 on every tick (that fakes activity) — animate from the previously displayed real value to the new real value.+- Fast and subtle — if the counting is slow enough to read digit-by-digit, shorten it.+- Concurrent agents edit `main`: stage explicit paths only, re-check `git status`, never `git add -A`.++## Definition of done++- `npm run dev`, open a live swarm, watch a real `tick`/`payout` move the tiles — confirm count-up + directional flash, no jitter, P&L sign/color correct.+- No console errors/warnings. `npm test` passes.+- `prefers-reduced-motion` verified — instant, correct final values.+- `data/changelog.json` entry (tag: `improvement`): treasury figures now animate and flash on live updates.+- Review your `git diff`. Don't commit unless asked.diff --git a/prompts/swarms-ui/03-member-standings.md b/prompts/swarms-ui/03-member-standings.mdnew file mode 100644index 000000000..39a03f232--- /dev/null+++ b/prompts/swarms-ui/03-member-standings.md@@ -0,0 +1,37 @@+# Swarms UI — members become a live scoreboard++You are working in `/workspaces/three.ws`. On the `/swarms` dashboard, the "Members &+shares" panel lists each member with a share bar, share %, contribution, and a `rep`+number. It reads like a table. But a swarm is a *competition between members* —+reputation is literal vote weight, and on every fired trade some members were on the+winning side of the consensus and some weren't. Turn the list into a standings board+where being a strong, correct member is **visible**.++## What exists today (read these first)++- `src/swarms.js` — `membersHTML(members)` (~line 240) renders each `.sw-row` with `.sw-bar` (share progress) and `rep <n>`. Member fields: `name`, `is_creator`, `share_bps`, `contribution_sol`, `reputation` (0..100), `agent_id`, `status`.+- `src/swarms.css` — `.sw-row`, `.sw-bar` / `.sw-bar > span` (the fill), `.sw-pill` (used for the `creator` tag), `.pos`/`.neg`.+- The SSE `vote` event (in `api/swarms/[id].js` → `streamSwarm`) is **missing the per-member breakdown** today. The DB column `swarm_votes.breakdown` exists as `[{agent_id, name, reputation, long, weight}]` but the stream's SELECT omits it. To light up winning voters you must add `breakdown` to the vote SELECT and the `send('vote', …)` payload.++## Build this++1. **Rank ordinals.** Order members by share (or reputation — pick the one that reads as "standing" and is consistent) and show `#1 / #2 / #3 …`. The top member gets a subtle marker (a small crown/flame glyph or accent ring) — restrained, token-colored, not a trophy emoji dump.+2. **Reputation as a weight badge.** Render `reputation` as a visible vote-weight chip, not a trailing `rep 42`. Make its prominence scale with the value (a stronger member visibly carries more weight). This is the in-product expression of "your track record is your power."+3. **Light up the winning side on a fire.** When a `vote` with `decision === 'fire'` arrives, briefly highlight the member rows whose `breakdown` entry had `long === true` (they were right to push the trade) — a green edge pulse that fades. Requires extending the SSE payload (above). Members who voted against / abstained stay neutral.+4. **Animate share changes.** When a contribution/exit shifts `share_bps`, animate `.sw-bar` width transitions and re-sort with a smooth reorder (FLIP or a simple transform) rather than a hard re-render snap.++## Rails (non-negotiable)++- Tokens only from `/tokens.css`. No hardcoded colors.+- **Gate every animation** behind `@media (prefers-reduced-motion: reduce)` → static final state, correct order, no pulses.+- No fake data: the breakdown highlight must come from the **real** `swarm_votes.breakdown`. Don't guess who voted long. If `breakdown` is empty for a row, light up nothing.+- Keep it legible at 0, 1, and 20+ members — the empty state already exists (`emptyRow`); don't regress it.+- Concurrent agents edit `main`: stage explicit paths only (you'll touch `src/swarms.js`, `src/swarms.css`, and `api/swarms/[id].js`), re-check `git status`, never `git add -A`.++## Definition of done++- `npm run dev`, open a multi-member swarm, watch a real fire — confirm the long-voters light up and the breakdown is real (cross-check against the vote log).+- Contribute/exit (or simulate) and confirm shares animate + reorder without a snap.+- No console errors/warnings. `npm test` passes. If you changed the `/api/swarms/:id` or stream shape, confirm nothing else consuming it broke.+- `data/changelog.json` entry (tag: `improvement`): the members panel is now a live standings board that shows who carried each trade.+- Review your `git diff`. Don't commit unless asked.diff --git a/prompts/swarms-ui/04-equity-curve.md b/prompts/swarms-ui/04-equity-curve.mdnew file mode 100644index 000000000..bfa4d5924--- /dev/null+++ b/prompts/swarms-ui/04-equity-curve.md@@ -0,0 +1,37 @@+# Swarms UI — equity curve + win-rate ring++You are working in `/workspaces/three.ws`. The `/swarms` dashboard shows the treasury's+realized P&L and win rate as bare numbers. A swarm has a *trajectory* — it's making or+losing money over time — and nothing on the page shows the shape of that story. Add the+heartbeat: a real equity-curve sparkline and a win-rate ring above the tiles. This is+what makes someone screenshot the page.++## What exists today (read these first)++- `src/swarms.js` — `paintDashboard()` (~line 190) renders the `.sw-tiles` row. `getSwarmState` (in `api/_lib/swarms.js`) provides `s.positions` (each closed position has `pnl_sol`, plus status/exit info) and `s.track_record` (`realized_pnl_sol`, `win_rate`, `closed_trades`, `open_positions`).+- The SSE `tick` event already streams `realized_pnl_sol`, `closed_trades`, `open_positions` live.+- `src/swarms.css` — tiles use `.sw-tile` / `.sw-tile-v`; `.pos`/`.neg` for color.++## Build this++1. **Equity-curve sparkline.** Build a cumulative realized-P&L series from the **real** closed positions (order by close time, running sum of `pnl_sol`). Render as a lightweight inline SVG sparkline — a hero element above or beside the tiles, larger than a tile, with a subtle area fill (green when net-positive, red when net-negative, token-colored). Last point gets a dot. No charting library unless one is already in `package.json` and clearly justified — a sparkline is ~30 lines of SVG path math; check `package.json` first per the open-source-first rule, but don't pull a 100KB dep for one curve.+2. **Live extension.** When a `tick` raises `closed_trades` / `realized_pnl_sol`, append the new point and animate the line drawing to it (stroke-dashoffset or a width reveal). The curve should visibly *grow* as trades close.+3. **Win-rate ring.** Replace (or augment) the win-rate number with a small ring/arc gauge filling to the real win-rate %, with the number centered. Color by band if you like, but keep it token-driven.+4. **Designed empty state.** A brand-new swarm with 0 closed trades has no curve — show a flat baseline with a helpful one-liner ("No closed trades yet — the curve starts on the first exit"), not a broken/blank SVG.++## Rails (non-negotiable)++- Tokens only from `/tokens.css`. No hardcoded colors.+- **Gate the draw animation** behind `@media (prefers-reduced-motion: reduce)` → render the final curve/ring statically, no animated draw.+- No fake data: the curve is the **real cumulative realized P&L** from real closed positions. Do not smooth in invented points or pad the series. If you need a per-position timestamp the state doesn't expose, add it to `getSwarmState`/the API from real data — don't fabricate ordering.+- Responsive: the sparkline must scale cleanly at 320px / 768px / 1440px and not overflow the tile row.+- Concurrent agents edit `main`: stage explicit paths only, re-check `git status`, never `git add -A`.++## Definition of done++- `npm run dev`, open a swarm with closed trades — confirm the curve matches the realized P&L and the ring matches the win rate. Open a fresh swarm — confirm the empty state, not a blank box.+- Watch a real `tick` close a trade and confirm the curve extends live.+- No console errors/warnings. `npm test` passes.+- `prefers-reduced-motion` verified — static curve/ring, correct values.+- `data/changelog.json` entry (tag: `improvement`): swarm dashboards now show a live equity curve and win-rate gauge.+- Review your `git diff`. Don't commit unless asked.diff --git a/prompts/swarms-ui/05-directory-ladder.md b/prompts/swarms-ui/05-directory-ladder.mdnew file mode 100644index 000000000..84e601cb5--- /dev/null+++ b/prompts/swarms-ui/05-directory-ladder.md@@ -0,0 +1,38 @@+# Swarms UI — the directory becomes a ladder++You are working in `/workspaces/three.ws`. The `/swarms` directory shows swarm cards in+a grid where every card is a visual equal. But swarms *compete* — some are crushing it,+some are bleeding, some just fired a trade thirty seconds ago. Turn the flat grid into a+ranked, sortable ladder where the standings are obvious at a glance and the live ones+feel alive.++## What exists today (read these first)++- `src/swarms.js` — `renderDirectory()` (~line 69) builds the hero + toolbar (network toggle, "My swarms"); `loadList()` fetches `/api/swarms?network=…`; `cardHTML(s)` (~line 141) renders each `.sw-card`. Card fields per swarm: `id`, `name`, `description`, `status` (`open|active|paused|killed|closed`), `members`, `contributed_sol`, `realized_pnl_sol`, `closed_trades`, win rate (`wr`), `policy.min_consensus`.+- `src/swarms.css` — `.sw-grid` (responsive `auto-fill minmax(310px,1fr)`), `.sw-card` (hover lift + shadow), `.sw-stats` (3-col), `.sw-pill--*` (status pills), `.pos`/`.neg`.+- The list API is `api/swarms/index.js`. It does **not** currently return a "last fired" timestamp — to mark swarms as "hot," add a real `last_fire_at` (max `swarm_votes.created_at where decision='fire'`) to the list query.++## Build this++1. **Rank the grid.** Add a sort control (segmented, matching `.sw-seg`): **Top P&L** (default), **Hottest** (most recent fire), **Most pooled**, **Newest**. Sorting is client-side over the fetched list unless the set is large enough to warrant a server `sort` param — use judgment, keep it real.+2. **Standings markers.** Under "Top P&L", the #1 swarm gets a restrained medal/glow treatment, #2–#3 a position badge. Token-colored, subtle — a tasteful highlight, not a leaderboard carnival. Markers update when the sort changes.+3. **"Hot" marker.** A swarm that fired within the last hour (from real `last_fire_at`) gets a small live/flame indicator and a faint pulse on the card — reuse the live-dot vocabulary from the dashboard (`.sw-live`). Only real recency drives it.+4. **Card hierarchy.** Make P&L the dominant stat on each card (it's the score), with members/pooled/win-rate secondary. Keep the existing 6 stats but let the eye land on the number that ranks the swarm.+5. **States.** Preserve and polish the existing empty ("no swarms yet"), loading (skeletons), and error/retry states — don't regress them. Empty under a sort should still guide the user to create one.++## Rails (non-negotiable)++- Tokens only from `/tokens.css`. No hardcoded colors.+- **Gate any pulse/animation** behind `@media (prefers-reduced-motion: reduce)` → static markers, no pulse.+- No fake data: ranks and "hot" come from **real** fields. `last_fire_at` must be real (add it to the query); never fake recency. If a value is null, render the neutral state.+- Responsive: ladder must hold at 320 / 768 / 1440. Don't break the `auto-fill` grid.+- Concurrent agents edit `main`: stage explicit paths only (`src/swarms.js`, `src/swarms.css`, `api/swarms/index.js`), re-check `git status`, never `git add -A`.++## Definition of done++- `npm run dev`, open `/swarms` with multiple swarms — confirm each sort reorders correctly, #1 gets its marker, and a recently-fired swarm shows "hot" (cross-check the timestamp).+- Confirm empty / loading / error states still work (kill the network to test error+retry).+- No console errors/warnings. `npm test` passes. Confirm the added `last_fire_at` field doesn't break the existing list consumers.+- `prefers-reduced-motion` verified.+- `data/changelog.json` entry (tag: `improvement`): the swarms directory is now a ranked, sortable ladder with live "hot" markers.+- Review your `git diff`. Don't commit unless asked.diff --git a/public/changelog.json b/public/changelog.jsonindex 0cd9ef21d..98f484164 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T02:51:06.573Z",+ "generated_at": "2026-06-30T03:48:58.716Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -46,6 +46,17 @@"fix"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "Agent Sniper is now a standalone open-source package",+ "summary": "The engine that lets three.ws agents snipe pump.fun launches is now its own lightweight, embeddable package: @three-ws/agent-sniper. Run it four ways — as a library, a CLI, an MCP server your AI agent can drive, or a paid x402 API that other agents pay in USDC to use. It ships with pluggable wallet, storage, RPC, and launch-feed adapters, so you can run a fully self-custodial sniper from your own keypair or a multi-tenant hosted service from one engine. Every agent gets its own wallet, its own budget and concurrency caps, a mandatory stop-loss, a price-impact circuit breaker, and a simulate-first default — plus the 3D-agent layer that puts a live trading desk on screen. Multiple agents and multiple users can snipe side by side, each embodied by its own 3D AI agent.",+ "link": null,+ "tags": [+ "sdk",+ "feature"+ ]+ },{"date": "2026-06-30","type": "update",@@ -56,6 +67,16 @@"fix"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "Fixed the agent wallet page returning a 404",+ "summary": "Opening the agent wallet at /agent-wallet no longer hits a 404. The page was built and shipping, but the clean URL had no route, so it fell through to the not-found page. It now loads correctly and, when opened without a specific agent, shows a clear prompt to pick or create one.",+ "link": "/agent-wallet",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-30","type": "update",@@ -87,6 +108,36 @@"feature"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "Swarm dashboards now show consensus building and firing live",+ "summary": "When you watch a trading swarm, you can now see the moment it decides. Every consensus vote animates in and fills a meter toward the swarm's firing threshold in real time. When member consensus clears the line and the treasury actually fires a buy, the meter visibly crosses the threshold with a hot success glow, the vote stamps a pulsing “fire” badge, and a single accent ripple sweeps the panel — so the most important event on the page lands instead of slipping by as a quiet log line. Skips fill toward the line and stop short. Respects reduced-motion preferences.",+ "link": "/swarms",+ "tags": [+ "improvement"+ ]+ },+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "Swarm treasury figures now count up and flash when money moves",+ "summary": "On a live swarm dashboard, the treasury tiles — balance, realized P&L, open positions and win rate — no longer hard-swap to a new number. When a live update lands, each figure smoothly counts from its current value to the new one and the tile flashes in the direction of the change: green when it rises, red when it drops. A confirmed payout pulses the balance and P&L tiles the instant the money lands. It animates only between two real values, never from zero, and respects reduced-motion preferences (those users get an instant, exact update).",+ "link": "/swarms",+ "tags": [+ "improvement"+ ]+ },+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "The swarm members panel is now a live standings board",+ "summary": "A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip that visibly grows with the score, because in a swarm your track record is literally your voting power. The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences.",+ "link": "/swarms",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-29","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex cadaf4459..13ce99f5b 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -38,6 +38,14 @@<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 Sniper is now a standalone open-source package</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-30:Agent Sniper is now a standalone open-source package</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>sdk</category>+ <description>The engine that lets three.ws agents snipe pump.fun launches is now its own lightweight, embeddable package: @three-ws/agent-sniper. Run it four ways — as a library, a CLI, an MCP server your AI agent can drive, or a paid x402 API that other agents pay in USDC to use. It ships with pluggable wallet, storage, RPC, and launch-feed adapters, so you can run a fully self-custodial sniper from your own keypair or a multi-tenant hosted service from one engine. Every agent gets its own wallet, its own budget and concurrency caps, a mandatory stop-loss, a price-impact circuit breaker, and a simulate-first default — plus the 3D-agent layer that puts a live trading desk on screen. Multiple agents and multiple users can snipe side by side, each embodied by its own 3D AI agent.</description>+ </item><item><title>Agent Studio movement previews now play on the live avatar</title><link>https://three.ws/agent-studio</link>@@ -46,6 +54,14 @@<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>Fixed the agent wallet page returning a 404</title>+ <link>https://three.ws/agent-wallet</link>+ <guid isPermaLink="false">2026-06-30:Fixed the agent wallet page returning a 404</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Opening the agent wallet at /agent-wallet no longer hits a 404. The page was built and shipping, but the clean URL had no route, so it fell through to the not-found page. It now loads correctly and, when opened without a specific agent, shows a clear prompt to pick or create one.</description>+ </item><item><title>Marketplace & trading viability get a dedicated page</title><link>https://three.ws/viability</link>@@ -70,6 +86,30 @@<category>docs</category><description>Everything behind the conviction score, in one place. The new Oracle docs explain — in plain English and, where you want it, full mathematical detail — how Oracle reads every pump.fun launch: the four pillars (who's buying, how it's structured, what story it rides, how it's moving), exactly how they fuse into a 0–100 score, where the hard caps come from, how the engine is calibrated and backtested against real outcomes, how to arm an agent on it, the full public API, and where it's headed. Real screenshots throughout, a quickstart for traders, builders, and skeptics, and a researcher-level appendix.</description></item>+ <item>+ <title>Swarm dashboards now show consensus building and firing live</title>+ <link>https://three.ws/swarms</link>+ <guid isPermaLink="false">2026-06-30:Swarm dashboards now show consensus building and firing live</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>When you watch a trading swarm, you can now see the moment it decides. Every consensus vote animates in and fills a meter toward the swarm's firing threshold in real time. When member consensus clears the line and the treasury actually fires a buy, the meter visibly crosses the threshold with a hot success glow, the vote stamps a pulsing “fire” badge, and a single accent ripple sweeps the panel — so the most important event on the page lands instead of slipping by as a quiet log line. Skips fill toward the line and stop short. Respects reduced-motion preferences.</description>+ </item>+ <item>+ <title>Swarm treasury figures now count up and flash when money moves</title>+ <link>https://three.ws/swarms</link>+ <guid isPermaLink="false">2026-06-30:Swarm treasury figures now count up and flash when money moves</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>On a live swarm dashboard, the treasury tiles — balance, realized P&L, open positions and win rate — no longer hard-swap to a new number. When a live update lands, each figure smoothly counts from its current value to the new one and the tile flashes in the direction of the change: green when it rises, red when it drops. A confirmed payout pulses the balance and P&L tiles the instant the money lands. It animates only between two real values, never from zero, and respects reduced-motion preferences (those users get an instant, exact update).</description>+ </item>+ <item>+ <title>The swarm members panel is now a live standings board</title>+ <link>https://three.ws/swarms</link>+ <guid isPermaLink="false">2026-06-30:The swarm members panel is now a live standings board</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip that visibly grows with the score, because in a swarm your track record is literally your voting power. The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences.</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.jsonindex 92a5886bf..e4dbb0821 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T02:51:06.552Z",+ "generated_at": "2026-06-30T03:48:58.673Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/agent-screen.js b/src/agent-screen.jsindex cd963936a..8e5861387 100644--- a/src/agent-screen.js+++ b/src/agent-screen.js@@ -538,25 +538,31 @@ async function renderSetup() {// ── workspace layout persistence ─────────────────────────────────────────────-const LS_KEY = 'twx_asc_workspace_v1';+// Bumped v1 → v2 to retire the old six-panels-open layout. Returning visitors+// get the calm two-panel default once, then their re-arrangements persist again.+const LS_KEY = 'twx_asc_workspace_v2';function defaultLayout() {return {zen: false,zenCam: true, // keep the avatar cam visible in zen by defaultfit: 'contain', // 'contain' | 'cover'+ // Calm default: the avatar is the hero, so it owns the whole stage. Only two+ // panels open on first load — Reputation and Activity Log — docked to a tidy+ // right rail (reputation top, log bottom, no overlap). Everything else is one+ // toolbar click away. Bumping LS_KEY resets returning visitors to this baseline.panels: {- cam: { hidden: false, min: false, x: null, y: null, w: 260 },- log: { hidden: false, min: false, x: null, y: null, w: 320, h: null },+ cam: { hidden: true, min: false, x: null, y: null, w: 260 },+ log: { hidden: false, min: false, x: null, y: null, w: 320, h: 280 },stats: { hidden: true, min: false, x: null, y: null, w: 218 },- treasury: { hidden: false, min: false, x: null, y: null, w: 344, h: null },+ treasury: { hidden: true, min: false, x: null, y: null, w: 344, h: null },mirror: { hidden: true, min: false, x: null, y: null, w: 380, h: null },- stage: { hidden: false, min: false, x: null, y: null, w: 320, h: null },+ stage: { hidden: true, min: false, x: null, y: null, w: 320, h: null },heatmap: { hidden: true, min: false, x: null, y: null, w: 460, h: 340 },- hud: { hidden: false, min: false, x: null, y: null, w: 288, h: null },+ hud: { hidden: true, min: false, x: null, y: null, w: 288, h: null },diary: { hidden: true, min: false, x: null, y: null, w: 360, h: 332 },- hire: { hidden: false, min: false, x: null, y: null, w: 340, h: null },- reputation: { hidden: false, min: false, x: null, y: null, w: 320, h: null },+ hire: { hidden: true, min: false, x: null, y: null, w: 340, h: null },+ reputation: { hidden: false, min: false, x: null, y: null, w: 320, h: 340 },},};}@@ -2839,13 +2845,17 @@ async function boot(id) {if (name === 'stats') { x = M; y = M; }else if (name === 'treasury') { x = M; y = M + 6; } // treasury → top-left cockpitelse if (name === 'mirror') { x = M; y = sr.height - ph - M; } // mirror → bottom-left- else if (name === 'log') { x = sr.width - pw - M; y = M; }+ else if (name === 'log') { // log → right rail, stacked directly under reputation+ const rep = layout.panels.reputation;+ const repBottom = (rep && !rep.hidden) ? M + (rep.h || 340) + 12 : sr.height - ph - M;+ x = sr.width - pw - M; y = repBottom;+ }else if (name === 'heatmap') { x = M; y = sr.height - ph - M; } // heatmap → bottom-leftelse if (name === 'stage') { x = M; y = sr.height - ph - M; } // stage → bottom-leftelse if (name === 'hud') { x = M; y = sr.height - ph - M; } // HUD → bottom-left scoreboardelse if (name === 'hire') { x = sr.width - pw - M; y = sr.height - ph - M - 8; } // hire → bottom-right above camelse if (name === 'diary') { x = Math.round((sr.width - pw) / 2); y = M + 40; } // diary → centre, beside the log- else if (name === 'reputation') { x = sr.width - pw * 2 - M * 2; y = M; } // reputation → top-right, just left of the log+ else if (name === 'reputation') { x = sr.width - pw - M; y = M; } // reputation → top-right rail (log sits below)else { x = sr.width - pw - M; y = sr.height - ph - M; } // cam → bottom-right}x = clamp(x, 0, Math.max(0, sr.width - pw));diff --git a/src/swarms.css b/src/swarms.cssindex 978625a1a..dc6f44e24 100644--- a/src/swarms.css+++ b/src/swarms.css@@ -158,6 +158,17 @@ body {.sw-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-sm); margin-bottom: var(--space-lg); }.sw-tile { padding: var(--space-md); border: 1px solid var(--stroke); border-radius: var(--radius-lg); background: var(--surface-1); }+/* Directional flash when a live value moves: green up, red down, then settle. */+.sw-tile--up { animation: sw-tile-up 0.9s ease-out; }+.sw-tile--down { animation: sw-tile-down 0.9s ease-out; }+@keyframes sw-tile-up {+ 0% { background: color-mix(in srgb, var(--success) 24%, var(--surface-1)); border-color: color-mix(in srgb, var(--success) 45%, var(--stroke)); }+ 100% { background: var(--surface-1); border-color: var(--stroke); }+}+@keyframes sw-tile-down {+ 0% { background: color-mix(in srgb, var(--danger) 22%, var(--surface-1)); border-color: color-mix(in srgb, var(--danger) 40%, var(--stroke)); }+ 100% { background: var(--surface-1); border-color: var(--stroke); }+}.sw-tile-v { font-size: var(--text-lg); font-weight: 700; color: var(--ink-bright); font-variant-numeric: tabular-nums; }.sw-tile-l { font-size: var(--text-2xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }.sw-tile a { color: var(--wallet-accent); text-decoration: none; font-size: var(--text-sm); }@@ -179,7 +190,66 @@ body {.sw-row .muted { color: var(--ink-dim); }.sw-row .name { color: var(--ink-bright); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.sw-bar { height: 5px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; margin-top: 3px; }-.sw-bar > span { display: block; height: 100%; background: var(--wallet-accent-strong); border-radius: inherit; }+.sw-bar > span { display: block; height: 100%; background: var(--wallet-accent-strong); border-radius: inherit; transition: width var(--duration-base) var(--ease-emphasized); }++/* ── members standings board ──────────────────────────────────────────────── */+.sw-member { position: relative; }+.sw-rank {+ flex: none;+ min-width: 2.2em;+ text-align: right;+ font-size: var(--text-2xs);+ font-weight: 700;+ color: var(--ink-faint);+ font-variant-numeric: tabular-nums;+}+.sw-member.is-lead {+ background: linear-gradient(90deg, var(--wallet-accent-soft), transparent 62%);+ box-shadow: inset 2px 0 0 var(--wallet-accent-strong);+}+.sw-member.is-lead .sw-rank { color: var(--wallet-accent); }+.sw-lead-mark { color: var(--wallet-accent); margin-right: 4px; font-size: 0.9em; }++.sw-member-meta { flex: none; text-align: right; }++/* Reputation = literal vote weight. Chip prominence scales with --rep (0..100):+ stronger members visibly carry more weight. data-tier gives discrete accent steps. */+.sw-rep {+ flex: none;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ line-height: 1.05;+ min-width: 2.7em;+ padding: calc(2px + var(--rep) * 0.02px) var(--space-2xs);+ border-radius: var(--radius-md);+ border: 1px solid var(--wallet-stroke);+ background: var(--wallet-accent-soft);+ font-variant-numeric: tabular-nums;+}+.sw-rep .sw-rep-v { font-weight: 800; color: var(--ink-bright); font-size: calc(var(--text-sm) + var(--rep) * 0.06px); }+.sw-rep .sw-rep-l { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }+.sw-rep[data-tier='0'] { background: var(--surface-2); border-color: var(--stroke); }+.sw-rep[data-tier='0'] .sw-rep-v { color: var(--ink-dim); }+.sw-rep[data-tier='2'] { border-color: var(--wallet-stroke-strong); }+.sw-rep[data-tier='3'] {+ border-color: var(--wallet-stroke-strong);+ background: var(--wallet-accent-fill);+ box-shadow: 0 0 0 1px var(--wallet-stroke), 0 0 14px var(--wallet-glow);+}++/* Winning-side pulse: a green edge that lands then fades on a fired consensus. */+@keyframes swMemberWin {+ 0% { box-shadow: inset 3px 0 0 var(--success), 0 0 0 1px color-mix(in srgb, var(--success) 55%, transparent); background: color-mix(in srgb, var(--success) 14%, transparent); }+ 100% { box-shadow: inset 0 0 0 0 transparent; background: transparent; }+}+.sw-member.sw-win { animation: swMemberWin 1.6s var(--ease-standard) forwards; }++@media (prefers-reduced-motion: reduce) {+ .sw-bar > span { transition: none; }+ .sw-member.sw-win { animation: none; }+}.sw-vote { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--surface-1); font-size: var(--text-sm); }.sw-vote:last-child { border-bottom: 0; }@@ -190,10 +260,46 @@ body {.sw-vote .mint { font-family: var(--font-mono, monospace); font-size: var(--text-2xs); color: var(--ink-dim); }.sw-vote .meter { display: flex; align-items: center; gap: var(--space-xs); margin-top: var(--space-2xs); }.sw-meter-track { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); position: relative; overflow: hidden; }-.sw-meter-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--wallet-accent), var(--wallet-accent-strong)); border-radius: inherit; }+.sw-meter-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--wallet-accent), var(--wallet-accent-strong)); border-radius: inherit; transition: width var(--duration-base) var(--ease-emphasized), background var(--duration-base) var(--ease-emphasized), box-shadow var(--duration-base) var(--ease-emphasized); }+.sw-meter-fill.fire { background: linear-gradient(90deg, var(--wallet-accent-strong), var(--success)); box-shadow: 0 0 8px var(--success); }.sw-meter-thresh { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink-bright); opacity: 0.8; }+.sw-meter-thresh.glow { animation: swThreshGlow var(--duration-base) var(--ease-emphasized) var(--duration-base); }.sw-vote .reason { color: var(--ink-faint); font-size: var(--text-2xs); margin-top: 2px; }+/* ── the firing moment ───────────────────────────────────────────────────── */+.sw-vote.sw-enter { animation: swVoteIn var(--duration-base) var(--ease-emphasized); }+.sw-vote .verdict.fire.sw-pulse { animation: swVerdictPulse var(--duration-base) var(--ease-emphasized) var(--duration-base); }++@keyframes swVoteIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }+@keyframes swThreshGlow {+ 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); opacity: 0.8; }+ 45% { box-shadow: 0 0 10px 2px var(--success); background: var(--success); opacity: 1; }+ 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); opacity: 0.8; }+}+@keyframes swVerdictPulse {+ 0%, 100% { transform: scale(1); box-shadow: none; }+ 50% { transform: scale(1.16); box-shadow: 0 0 8px var(--success); }+}++/* whole-card signal: one accent ripple along the top edge of the votes header */+.sw-panel-h.sw-fired { position: relative; overflow: hidden; }+.sw-panel-h.sw-fired::after {+ content: ''; position: absolute; left: 0; top: 0; height: 2px; width: 100%;+ background: linear-gradient(90deg, transparent, var(--success), transparent);+ animation: swRipple var(--duration-base) var(--ease-emphasized);+}+@keyframes swRipple { from { transform: translateX(-100%); } to { transform: translateX(100%); } }++@media (prefers-reduced-motion: reduce) {+ .sw-meter-fill { transition: none; }+ .sw-vote.sw-enter,+ .sw-meter-thresh.glow,+ .sw-vote .verdict.fire.sw-pulse,+ .sw-tile--up,+ .sw-tile--down,+ .sw-panel-h.sw-fired::after { animation: none; }+}+/* ── disclosure ───────────────────────────────────────────────────────────── */.sw-disclose {border: 1px solid rgba(251, 191, 36, 0.3);diff --git a/src/swarms.js b/src/swarms.jsindex 331a89be2..a8ddcb6b4 100644--- a/src/swarms.js+++ b/src/swarms.js@@ -165,6 +165,8 @@ function msg(title, body, action, onAction) {// ── dashboard ──────────────────────────────────────────────────────────────────let activeStream = null;+let pendingMemberAnim = null; // FLIP snapshot captured before a re-render shifts shares+let paintedSwarmId = null; // so first paint of a swarm animates bars from 0, re-paints don'tfunction closeStream() {if (activeStream) { try { activeStream.close(); } catch {} activeStream = null; }@@ -210,11 +212,11 @@ function paintDashboard(dash, s) {</div><div class="sw-tiles">- <div class="sw-tile"><div class="sw-tile-v" id="sw-bal">${tr.balance_sol == null ? '—' : SOL(tr.balance_sol)}</div><div class="sw-tile-l">Treasury (on-chain)</div><a href="${esc(tr.explorer)}" target="_blank" rel="noopener">${short(tr.address)} ↗</a></div>+ <div class="sw-tile"><div class="sw-tile-v" id="sw-bal" data-val="${tr.balance_sol == null ? '' : tr.balance_sol}">${tr.balance_sol == null ? '—' : SOL(tr.balance_sol)}</div><div class="sw-tile-l">Treasury (on-chain)</div><a href="${esc(tr.explorer)}" target="_blank" rel="noopener">${short(tr.address)} ↗</a></div><div class="sw-tile"><div class="sw-tile-v">${SOL(tr.net_contributed_sol)}</div><div class="sw-tile-l">Net contributed</div></div>- <div class="sw-tile"><div class="sw-tile-v ${pnlCls}" id="sw-pnl">${rec.realized_pnl_sol >= 0 ? '+' : ''}${SOL(rec.realized_pnl_sol)}</div><div class="sw-tile-l">Realized P&L</div></div>- <div class="sw-tile"><div class="sw-tile-v" id="sw-open">${rec.open_positions}</div><div class="sw-tile-l">Open positions</div></div>- <div class="sw-tile"><div class="sw-tile-v">${rec.win_rate == null ? '—' : Math.round(rec.win_rate * 100) + '%'}</div><div class="sw-tile-l">Win rate · ${rec.closed_trades} closed</div></div>+ <div class="sw-tile"><div class="sw-tile-v ${pnlCls}" id="sw-pnl" data-val="${rec.realized_pnl_sol}">${rec.realized_pnl_sol >= 0 ? '+' : ''}${SOL(rec.realized_pnl_sol)}</div><div class="sw-tile-l">Realized P&L</div></div>+ <div class="sw-tile"><div class="sw-tile-v" id="sw-open" data-val="${rec.open_positions}">${rec.open_positions}</div><div class="sw-tile-l">Open positions</div></div>+ <div class="sw-tile"><div class="sw-tile-v" id="sw-wr" data-val="${rec.win_rate == null ? '' : rec.win_rate * 100}">${rec.win_rate == null ? '—' : Math.round(rec.win_rate * 100) + '%'}</div><div class="sw-tile-l">Win rate · ${rec.closed_trades} closed</div></div></div><div class="sw-hero-actions" id="sw-actions" style="margin-bottom:var(--space-lg);flex-wrap:wrap"></div>@@ -230,6 +232,11 @@ function paintDashboard(dash, s) {</div></div>`;+ const firstPaint = paintedSwarmId !== sw.id;+ paintedSwarmId = sw.id;+ animateMembers(pendingMemberAnim, firstPaint);+ pendingMemberAnim = null;+renderActions(s);}@@ -237,19 +244,50 @@ function panel(title, count, body, bodyId) {return `<div class="sw-panel"><div class="sw-panel-h"><h2>${esc(title)}</h2><span class="count">${count}</span></div><div class="sw-panel-body"${bodyId ? ` id="${bodyId}"` : ''}>${body}</div></div>`;}-function membersHTML(members) {- if (!members.length) return emptyRow('No members yet.');- return members.map((m) => `- <div class="sw-row">+// Standings order: biggest stake first (share = standing), ties broken by the+// stronger track record, then name for stability.+function rankMembers(members) {+ return [...members].sort((a, b) =>+ (b.share_bps || 0) - (a.share_bps || 0) ||+ ((b.reputation || 0) - (a.reputation || 0)) ||+ String(a.name || '').localeCompare(String(b.name || '')));+}++// Reputation IS vote weight. Bucket it so the chip's prominence reads at a glance.+function repTier(rep) {+ if (rep == null) return 0;+ if (rep >= 75) return 3;+ if (rep >= 50) return 2;+ if (rep >= 25) return 1;+ return 0;+}++function memberRowHTML(m, i) {+ const rep = m.reputation == null ? null : Math.round(m.reputation);+ const sharePct = Math.min(100, (m.share_bps || 0) / 100);+ const lead = i === 0;+ const repTitle = rep == null ? 'Vote weight — unrated track record' : `Vote weight ${rep}/100 — verified track record`;+ return `+ <div class="sw-row sw-member${lead ? ' is-lead' : ''}" data-agent="${esc(m.agent_id)}">+ <div class="sw-rank">#${i + 1}</div><div class="grow">- <div class="name">${esc(m.name)}${m.is_creator ? ' <span class="sw-pill" style="font-size:9px">creator</span>' : ''}</div>- <div class="sw-bar"><span style="width:${Math.min(100, (m.share_bps || 0) / 100)}%"></span></div>+ <div class="name">${lead ? '<span class="sw-lead-mark" aria-hidden="true">✦</span>' : ''}${esc(m.name)}${m.is_creator ? ' <span class="sw-pill" style="font-size:9px">creator</span>' : ''}</div>+ <div class="sw-bar"><span style="width:${sharePct}%"></span></div></div>- <div style="text-align:right">+ <div class="sw-member-meta"><div class="mono name">${(m.share_bps / 100).toFixed(1)}%</div>- <div class="muted mono" style="font-size:var(--text-2xs)">${SOL(m.contribution_sol)} · rep ${m.reputation == null ? '—' : Math.round(m.reputation)}</div>+ <div class="muted mono" style="font-size:var(--text-2xs)">${SOL(m.contribution_sol)}</div></div>- </div>`).join('');+ <div class="sw-rep" data-tier="${repTier(rep)}" style="--rep:${rep == null ? 0 : rep}" title="${esc(repTitle)}" aria-label="${esc(repTitle)}">+ <span class="sw-rep-v mono">${rep == null ? '—' : rep}</span>+ <span class="sw-rep-l">wt</span>+ </div>+ </div>`;+}++function membersHTML(members) {+ if (!members.length) return emptyRow('No members yet.');+ return rankMembers(members).map(memberRowHTML).join('');}function positionsHTML(positions) {@@ -276,7 +314,7 @@ function voteRowHTML(v) {<span class="muted mono" style="font-size:var(--text-2xs)">${v.members_long}/${v.members_total} long</span></div><div class="meter">- <div class="sw-meter-track"><div class="sw-meter-fill" style="width:${pct}%"></div><div class="sw-meter-thresh" style="left:${thr}%"></div></div>+ <div class="sw-meter-track"><div class="sw-meter-fill${v.decision === 'fire' ? ' fire' : ''}" style="width:${pct}%"></div><div class="sw-meter-thresh" style="left:${thr}%"></div></div><span class="mono muted" style="font-size:var(--text-2xs)">${Math.round(pct)}%</span></div><div class="reason">${esc(v.reason || '')}${v.smart_money_score ? ` · smart-money ${Math.round(v.smart_money_score)}` : ''}${v.size_sol ? ` · sized ${SOL(v.size_sol)}` : ''}</div>@@ -461,6 +499,7 @@ async function openContributeModal(s, mode) {if (!r.ok) { errEl.textContent = r.error || 'Contribution failed.'; btn.disabled = false; btn.textContent = 'Send'; return; }close();toast(`Contributed ${SOL(sol)} — share updated`);+ pendingMemberAnim = captureMemberState();renderDashboard(sw.id);};}@@ -492,6 +531,7 @@ async function openExitModal(s) {if (!r.ok) { errEl.textContent = r.error || 'Exit failed.'; btn.disabled = false; btn.textContent = 'Exit & redeem'; return; }close();toast(`Redeemed ${SOL(r.data.redeemed_sol)}${r.data.capped ? ' (capped to liquid SOL)' : ''}`);+ pendingMemberAnim = captureMemberState();renderDashboard(sw.id);};}@@ -541,8 +581,13 @@ function subscribeStream(id) {try {const v = JSON.parse(e.data);const box = document.getElementById('sw-votes');- if (box) { if (box.querySelector('.sw-msg, .sw-row')) box.innerHTML = ''; box.insertAdjacentHTML('afterbegin', voteRowHTML(v)); flash(box.firstElementChild); }- if (v.decision === 'fire') toast(`Consensus fired · ${short(v.mint)}`);+ if (box) {+ if (box.querySelector('.sw-msg, .sw-row')) box.innerHTML = '';+ box.insertAdjacentHTML('afterbegin', voteRowHTML(v));+ animateVoteRow(box.firstElementChild, v);+ if (v.decision === 'fire') ripplePanel(box);+ }+ if (v.decision === 'fire') { highlightWinners(v.breakdown); toast(`Consensus fired · ${short(v.mint)}`); }} catch {}});es.addEventListener('payout', (e) => {@@ -550,14 +595,23 @@ function subscribeStream(id) {const p = JSON.parse(e.data);const box = document.getElementById('sw-payouts');if (box) { if (box.querySelector('.sw-msg, .sw-row[style]')) box.innerHTML = ''; box.insertAdjacentHTML('afterbegin', payoutRowHTML({ ...p, amount_sol: p.amount_sol })); flash(box.firstElementChild); }+ // Money landed — pulse the treasury and P&L tiles so the change registers+ // even before the next tick redraws their values.+ flashTile(document.getElementById('sw-bal'), 1);+ flashTile(document.getElementById('sw-pnl'), 1);} catch {}});es.addEventListener('tick', (e) => {try {const t = JSON.parse(e.data);- const bal = document.getElementById('sw-bal'); if (bal && t.balance_sol != null) bal.textContent = SOL(t.balance_sol);- const op = document.getElementById('sw-open'); if (op) op.textContent = t.open_positions;- const pnl = document.getElementById('sw-pnl'); if (pnl) { pnl.textContent = `${t.realized_pnl_sol >= 0 ? '+' : ''}${SOL(t.realized_pnl_sol)}`; pnl.className = 'sw-tile-v ' + (t.realized_pnl_sol > 0 ? 'pos' : t.realized_pnl_sol < 0 ? 'neg' : ''); }+ if (t.balance_sol != null) updateTile(document.getElementById('sw-bal'), t.balance_sol, SOL);+ if (t.open_positions != null) updateTile(document.getElementById('sw-open'), t.open_positions, (v) => String(Math.round(v)));+ const pnl = document.getElementById('sw-pnl');+ if (pnl && t.realized_pnl_sol != null) {+ pnl.className = 'sw-tile-v ' + (t.realized_pnl_sol > 0 ? 'pos' : t.realized_pnl_sol < 0 ? 'neg' : '');+ updateTile(pnl, t.realized_pnl_sol, (v) => `${v >= 0 ? '+' : ''}${SOL(v)}`);+ }+ if (t.win_rate != null) updateTile(document.getElementById('sw-wr'), t.win_rate * 100, (v) => `${Math.round(v)}%`);} catch {}});es.onerror = () => { fails++; setLive('connecting', 'reconnecting'); try { es.close(); } catch {} activeStream = null; setTimeout(connect, Math.min(20000, 1000 * 2 ** fails)); };@@ -572,6 +626,149 @@ function flash(el) {requestAnimationFrame(() => { el.style.background = ''; });}+// ── treasury tile juice: count between two real values, flash on change ──────────+const reduceMotion = () => window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;+const countTimers = new WeakMap();++// Animate a tile's number from its previously displayed real value to the new real+// value, preserving the tile's own formatting. Cancels any in-flight count on the+// same element. Reduced-motion (or no prior value) → instant set, no animation.+function countTile(el, to, format) {+ if (!el) return;+ const prevTimer = countTimers.get(el);+ if (prevTimer) { cancelAnimationFrame(prevTimer); countTimers.delete(el); }+ const prevRaw = el.dataset.val;+ const prev = prevRaw == null || prevRaw === '' ? null : Number(prevRaw);+ el.dataset.val = to == null ? '' : String(to);+ if (to == null || prev == null || prev === to || reduceMotion()) { el.textContent = format(to); return; }+ const dur = 480, start = performance.now(), delta = to - prev;+ const ease = (x) => 1 - Math.pow(1 - x, 3); // easeOutCubic+ const step = (now) => {+ const p = Math.min(1, (now - start) / dur);+ el.textContent = format(prev + delta * ease(p));+ if (p < 1) { countTimers.set(el, requestAnimationFrame(step)); }+ else { el.textContent = format(to); countTimers.delete(el); }+ };+ countTimers.set(el, requestAnimationFrame(step));+}++// Direction-aware tile tint: dir > 0 → green, dir < 0 → red/neutral, then settle.+function flashTile(el, dir) {+ const tile = el && el.closest && el.closest('.sw-tile');+ if (!tile || !dir || reduceMotion()) return;+ tile.classList.remove('sw-tile--up', 'sw-tile--down');+ void tile.offsetWidth; // restart the animation if it's already mid-flight+ tile.classList.add(dir > 0 ? 'sw-tile--up' : 'sw-tile--down');+ const onEnd = () => { tile.classList.remove('sw-tile--up', 'sw-tile--down'); tile.removeEventListener('animationend', onEnd); };+ tile.addEventListener('animationend', onEnd);+}++// Count to the new value and flash in its direction in one call.+function updateTile(el, to, format) {+ if (!el) return;+ const prevRaw = el.dataset.val;+ const prev = prevRaw == null || prevRaw === '' ? null : Number(prevRaw);+ if (prev != null && to != null && to !== prev) flashTile(el, to - prev);+ countTile(el, to, format);+}++const prefersReducedMotion = () => typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;++// Animate a freshly-streamed vote row: slide in, fill the consensus meter from 0+// toward the real value, and — on a fire — drive the fill across the threshold+// tick with a hot gradient, a glow at the line, and a single verdict-badge pulse.+function animateVoteRow(row, v) {+ if (!row) return;+ const fill = row.querySelector('.sw-meter-fill');+ const fire = v.decision === 'fire';+ if (prefersReducedMotion()) return; // HTML already renders the final state+ row.classList.add('sw-enter');+ if (!fill) return;+ const target = fill.style.width || '0%';+ if (fire) fill.classList.remove('fire'); // start cool, shift hot as it crosses+ fill.style.width = '0%';+ void fill.offsetWidth; // commit the 0% start before transitioning+ requestAnimationFrame(() => {+ fill.style.width = target;+ if (fire) {+ fill.classList.add('fire');+ row.querySelector('.sw-meter-thresh')?.classList.add('glow');+ row.querySelector('.verdict.fire')?.classList.add('sw-pulse');+ }+ });+}++// One accent ripple along the top edge of the votes panel header on a fire.+function ripplePanel(box) {+ const header = box?.closest('.sw-panel')?.querySelector('.sw-panel-h');+ if (!header || prefersReducedMotion()) return;+ header.classList.remove('sw-fired');+ void header.offsetWidth; // restart the animation on back-to-back fires+ header.classList.add('sw-fired');+ header.addEventListener('animationend', () => header.classList.remove('sw-fired'), { once: true });+}++// Snapshot each member row's viewport rect + bar width before a re-render, keyed by+// agent, so the next paint can FLIP rows into their new standings and grow bars from+// their previous fill instead of snapping. Returns null when there's nothing to track.+function captureMemberState() {+ const rows = document.querySelectorAll('.sw-member[data-agent]');+ if (!rows.length) return null;+ const map = {};+ rows.forEach((row) => {+ const span = row.querySelector('.sw-bar > span');+ map[row.dataset.agent] = { rect: row.getBoundingClientRect(), width: span ? span.style.width : '0%' };+ });+ return map;+}++// Play the standings transition after a paint: FLIP each row from its old position+// to its new rank, and animate share bars from their prior fill (or from 0 on first+// paint). Reduced-motion → leave the final, correctly-ordered state untouched.+function animateMembers(prev, firstPaint) {+ if (prefersReducedMotion()) return;+ document.querySelectorAll('.sw-member[data-agent]').forEach((row) => {+ const span = row.querySelector('.sw-bar > span');+ if (!span) return;+ const finalW = span.style.width;+ const old = prev && prev[row.dataset.agent];+ if (old) {+ const now = row.getBoundingClientRect();+ const dx = old.rect.left - now.left;+ const dy = old.rect.top - now.top;+ if (dx || dy) {+ row.style.transform = `translate(${dx}px, ${dy}px)`;+ row.style.transition = 'none';+ requestAnimationFrame(() => {+ row.style.transition = 'transform var(--duration-base) var(--ease-emphasized)';+ row.style.transform = '';+ });+ row.addEventListener('transitionend', () => { row.style.transition = ''; row.style.transform = ''; }, { once: true });+ }+ }+ if (old || firstPaint) {+ span.style.width = old ? old.width : '0%';+ requestAnimationFrame(() => { span.style.width = finalW; });+ }+ });+}++// On a fired consensus, briefly pulse the rows of members who were on the winning+// (long) side — straight from the real swarm_votes.breakdown. No breakdown, or no+// long voter present, lights up nothing. Reduced-motion → no pulse.+function highlightWinners(breakdown) {+ if (!Array.isArray(breakdown) || prefersReducedMotion()) return;+ const longIds = new Set(breakdown.filter((b) => b && b.long).map((b) => String(b.agent_id)));+ if (!longIds.size) return;+ document.querySelectorAll('.sw-member[data-agent]').forEach((row) => {+ if (!longIds.has(String(row.dataset.agent))) return;+ row.classList.remove('sw-win');+ void row.offsetWidth; // restart on back-to-back fires+ row.classList.add('sw-win');+ row.addEventListener('animationend', () => row.classList.remove('sw-win'), { once: true });+ });+}+window.addEventListener('beforeunload', closeStream);// ── boot ────────────────────────────────────────────────────────────────────────diff --git a/vercel.json b/vercel.jsonindex c858e8aed..5d24d6988 100644--- a/vercel.json+++ b/vercel.json@@ -227,6 +227,14 @@"src": "/agent-trade/","dest": "/agent-trade.html"},+ {+ "src": "/agent-wallet",+ "dest": "/agent-wallet.html"+ },+ {+ "src": "/agent-wallet/",+ "dest": "/agent-wallet.html"+ },{"src": "/aws-marketplace/welcome","dest": "/aws-marketplace/welcome.html"