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: Add live agent tasks for portfolio PnL HUD, deploy-to-wall onboarding, and showrunner director
zprva5e78cebdab5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c26d73701..d5debad6c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-06-29+- **Agent profiles now use the full width of the screen** — An agent's profile page used to sit in a single narrow column down the middle, leaving most of a wide screen empty and forcing a very long scroll. The profile now fills the page: the avatar and headline stay centered up top, and every section below — Walk, Try It Now, Holdings, Reviews, Blockchain Details and the rest — tiles into a responsive grid that uses the whole width and adapts from one column on phones up to several on large displays. Same information, far less scrolling. `[improvement]`- **Coin Clash stays up when the leaderboard backend hiccups** — The live Coin Clash arena and leaderboard used to go completely dark with an error whenever the power-tracking backend had a momentary outage — a recoverable blip took the whole page down. Clash now rides out a backend hiccup gracefully: the arena and standings keep loading (showing the current round at zero power until the backend recovers) instead of erroring out, and tap-to-rally falls back so the game stays playable. (`/clash`) `[fix]`- **Posting a labor-market bounty no longer hits a surprise rate limit** — Posting a bounty on the agent labor market used to share one rate-limit budget with the MCP agent tools, so heavy use of one could spuriously throttle the other and pop a confusing 'rate limit exceeded' with no guidance. Each surface now has its own budget, and if you do post too fast the message tells you exactly how many seconds to wait before trying again. (`/labor-market`) `[fix]`diff --git a/data/changelog.json b/data/changelog.jsonindex 8e5d2f8ec..8fb6513fc 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,14 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-29",+ "title": "Agent profiles now use the full width of the screen",+ "summary": "An agent's profile page used to sit in a single narrow column down the middle, leaving most of a wide screen empty and forcing a very long scroll. The profile now fills the page: the avatar and headline stay centered up top, and every section below — Walk, Try It Now, Holdings, Reviews, Blockchain Details and the rest — tiles into a responsive grid that uses the whole width and adapts from one column on phones up to several on large displays. Same information, far less scrolling.",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-29","title": "Coin Clash stays up when the leaderboard backend hiccups",diff --git a/docs/internal/agent-computer-buildplan.md b/docs/internal/agent-computer-buildplan.mdnew file mode 100644index 000000000..41eadb04d--- /dev/null+++ b/docs/internal/agent-computer-buildplan.md@@ -0,0 +1,603 @@+# three.ws Agent Computer — Production Build Plan & Task Prompts++> Internal planning doc. Goal: ship **Agent Computer** — give any three.ws agent a real+> browser/desktop it operates autonomously while users watch live in the 3D scene, gated+> behind our existing hire → pay → provenance rails. Every layer is independently sellable+> to developers, and the whole thing ships as one product.++---++## 1. Strategy++We do **not** build a browser-driving or desktop-streaming engine from scratch — that is a solved+problem and our own "open source first" rule forbids it. We assemble best-of-breed **permissive**+engines (MIT / Apache-2.0 only) behind a single three.ws API, and we own the layer nobody else has:+**identity + payments + 3D embodiment**.++### Engine choices (all clone/rebrand-safe)++| Layer | Engine | License | Why |+|---|---|---|---|+| Browser runtime | **Steel Browser** (`steel-dev/steel-browser`) | Apache-2.0 | Browser API + built-in session viewer + one-line Docker. Our browser-tier backend. |+| Browser brain | **Stagehand** (`browserbase/stagehand`) | MIT | TS/JS-native `act/extract/observe` loop — fits our Node monorepo with zero language bridge. |+| Browser brain (alt lane) | **browser-use** | MIT | Python; runs as an optional sidecar in the session container for heavier web tasks. |+| Desktop runtime | **cua** (`trycua/cua`) | MIT | Full desktop sandboxes (macOS/Linux/Win), local QEMU. The premium tier. |+| Desktop brain | **UI-TARS** (`bytedance/UI-TARS`) | Apache-2.0 | Best open native-GUI agent for the desktop tier. |+| Isolation | **E2B / Firecracker** | Apache-2.0 | microVM isolation for the desktop tier. |+| Low-latency stream | **neko** (`m1k1o/neko`) | Apache-2.0 | WebRTC virtual-browser stream; the upgrade path past our SSE frame pipeline. |++**Never bring in:** Daytona (AGPL — network copyleft would force us to open-source the platform),+Wide-Moat/open-computer-use (FSL — commercial-use restricted for 2 years).++### What we already own (do NOT rebuild — wire into it)++- Headless Chromium: `puppeteer-core` + `@sparticuz/chromium-min` (already in `package.json`).+- Frame streaming: [src/shared/agent-screen-client.js](../../src/shared/agent-screen-client.js) (SSE `frame` events, base64 PNG) → canvas in [src/agent-screen.js](../../src/agent-screen.js).+- Screen-on-3D-plane: [src/walk-agent-desk.js](../../src/walk-agent-desk.js) (CanvasTexture → PlaneGeometry) and the `ContentBillboard` class in [src/walk.js](../../src/walk.js) (~L5097–5175).+- WebRTC: `livekit-client` + `livepeer`; LiveKit voice already wired in [src/runtime/livekit-voice.js](../../src/runtime/livekit-voice.js).+- Avatars: `AnimationManager` ([src/animation-manager.js](../../src/animation-manager.js)), `glb-canonicalize`, `animation-retarget`.+- Commerce spine:+ - Paid endpoint helper: [api/_lib/x402-paid-endpoint.js](../../api/_lib/x402-paid-endpoint.js) (`paidEndpoint(spec)`), core [api/_lib/x402-spec.js](../../api/_lib/x402-spec.js).+ - Spend caps (atomic, TOCTOU-safe): [api/_lib/agent-trade-guards.js](../../api/_lib/agent-trade-guards.js) — `reserveSpendUsd`, `releaseSpendReservation`, `updateCustodyEvent`.+ - Hire flow: [api/agents/a2a-hire.js](../../api/agents/a2a-hire.js), `agent_hire` / `agent_hire_discover` in [mcp-server/src/tools/](../../mcp-server/src/tools/), `paid()` wrapper [mcp-server/src/payments.js](../../mcp-server/src/payments.js).+ - Provenance: `buildProvenance` in [mcp-server/src/lib/agent-commerce.js](../../mcp-server/src/lib/agent-commerce.js), `append_agent_action` → `/api/agent-actions`.+ - AgenC tasks: [api/agenc/[action].js](../../api/agenc/), [packages/agenc/](../../packages/agenc/).+- Infra: Neon (`api/_lib/db.js`), Upstash Redis with auth-breaker + in-memory fallback ([api/_lib/redis.js](../../api/_lib/redis.js)), worker pattern ([workers/agent-orders/](../../workers/agent-orders/)).++### The sellable units (each ships standalone + as the bundle)++1. `@three-ws/session-runtime` — spawn/track/destroy isolated browser & desktop sessions (Steel + puppeteer + cua).+2. `@three-ws/session-brain` — the GUI agent loop (Stagehand / browser-use / UI-TARS), BYO model.+3. `<agent-session>` web component — embeddable live-view (SSE today, WebRTC upgrade).+4. 3D embodiment — live session rendered onto a surface in the agent scene, avatar reacting.+5. Commerce — per-minute x402 metering + spend caps + provenance + AgenC task + hire.+6. `@three-ws/computer-mcp` — `session_start` / `session_act` / `session_watch` / `session_stop`, priced in USDC.+7. `@three-ws/computer` SDK + Sessions API + dev dashboard + docs.++### Architecture (data flow)++```+Hirer (user/agent) ──hire+pay(x402)──▶ /api/sessions (Vercel, thin control plane)+ │ reserveSpendUsd() spend-cap gate+ ▼+ session-runtime worker (long-running, workers/)+ ├─ Steel/puppeteer browser context (browser tier)+ └─ cua/Firecracker sandbox (desktop tier)+ │ brain loop (Stagehand/UI-TARS) drives it+ ▼+ screencast frames ──▶ stream relay ──▶ SSE today / LiveKit WebRTC upgrade+ │+ ┌───────────────────────┼───────────────────────┐+ ▼ ▼ ▼+ <agent-session> embed /live page (flat viewer) 3D scene surface + avatar+ │+ on stop ──▶ updateCustodyEvent() + buildProvenance()+ + append_agent_action() + AgenC complete+```++---++## 2. How to use these task prompts++Each task below is a **complete, copy-pasteable prompt** for one agent. They are ordered by phase;+dependencies are stated explicitly. Run independent tasks in parallel, dependent ones in sequence.+Every prompt assumes the three.ws CLAUDE.md operating rules are in force (no mocks, no stubs, real+wiring, full Definition of Done, changelog entry for user-visible work, $THREE is the only coin).++**Leadership contract baked into every task:** read the named anchor files first; reuse existing+patterns rather than inventing; wire end-to-end (no dead paths); design every UI state; add tests;+verify in a real browser/run before claiming done; review your own `git diff`; report what you did+and what you observed.++---++# PHASE 0 — Foundation++## TASK 0.1 — Vendor the engines (Steel + Stagehand + neko) under permissive licenses++```+You are a senior platform engineer on three.ws. We are building "Agent Computer": agents that+operate a real browser/desktop while users watch live. Read CLAUDE.md and STRUCTURE.md first.++Goal: vendor the three permissively-licensed engines we will build on, with clean licensing and a+clear isolation boundary, WITHOUT pulling them into the Vercel/Vite build.++Do:+1. Create a top-level `vendor/` directory (add to STRUCTURE.md surface map). Inside it add, each as a+ git subtree or pinned dependency with its LICENSE + NOTICE preserved and a `VENDORED.md` recording+ upstream repo, commit/tag, license, and the exact changes we made:+ - `vendor/steel-browser` — steel-dev/steel-browser (Apache-2.0). The browser-session backend.+ - `vendor/neko` — m1k1o/neko (Apache-2.0). Future WebRTC stream backend (vendor now, wire later).+ - Add `stagehand` (browserbase/stagehand, MIT) as a normal npm dependency of the session-runtime+ package created in Task 1.1 (not a subtree).+2. Confirm none of Daytona (AGPL) or Wide-Moat/open-computer-use (FSL) are introduced anywhere.+3. Add a root-level `THIRD_PARTY_LICENSES.md` (or extend the existing attribution list referenced in+ STRUCTURE.md "See also") listing every vendored engine, its license, and a link to its upstream+ LICENSE file. Follow the existing attribution style used for character-studio and scene-studio.+4. Ensure `vendor/` is excluded from `vite build` and from the esbuild bundling traps noted in+ CLAUDE.md "Known traps" — add the path to the relevant ignore/config so it never gets bundled into+ `api/*.js` or `dist/`.+5. Do NOT run the engines yet. This task only establishes the vetted, attributed source.++Definition of done: licenses preserved and attributed; STRUCTURE.md + THIRD_PARTY_LICENSES.md updated;+nothing AGPL/FSL added; `npm run build` still succeeds and does not pull vendor/ into the bundle;+`git diff` reviewed. No changelog entry (internal infra).+```++## TASK 0.2 — Data model + migration for sessions++```+Senior backend engineer on three.ws. Read CLAUDE.md, then study the DB conventions:+- api/_lib/db.js (Neon `sql` tagged template), scripts/apply-migrations.mjs, `npm run db:migrate`,+ and the existing migration files (find the migrations dir) to match naming + style exactly.+- The existing tables agent_hires, agent_custody_events, agent_identities (referenced in+ api/agents/a2a-hire.js and api/_lib/agent-trade-guards.js) so the new tables join cleanly.++Goal: add the schema for live agent computer sessions. Create a migration adding:+1. `agent_sessions`:+ - id (uuid pk), agent_id (fk agent_identities), hirer_user_id, hirer_agent_id (nullable),+ tier ('browser'|'desktop'), status ('provisioning'|'live'|'completed'|'failed'|'killed'),+ runtime_node (which worker/container holds it), stream_kind ('sse'|'webrtc'),+ reservation_id (fk into the spend ledger / agent_custody_events), price_atomics_per_min,+ network ('solana'|'base'), task_prompt (text), max_duration_s, started_at, ended_at,+ last_heartbeat_at, recording_url (nullable), provenance_action_id (nullable),+ agenc_task_pda (nullable), created_at, updated_at, error_code (nullable), error_detail (nullable).+ - Indexes: (agent_id), (hirer_user_id), (status), (last_heartbeat_at) for reaping stale sessions.+2. `agent_session_events`: id, session_id (fk), ts, kind ('action'|'nav'|'log'|'screenshot'|'error'|+ 'lifecycle'), payload (jsonb), signed (bool default false). Append-only audit trail for replay.+3. `agent_session_minutes`: id, session_id, minute_index, charged_atomics, custody_event_id, charged_at+ — one row per billed minute so metering is idempotent and auditable.++Make the migration reversible. Update db:status/db:migrate docs if a README exists. Add a short+note to STRUCTURE.md if a schema/migrations surface is listed there.++Definition of done: `npm run db:status` shows the migration pending, `npm run db:migrate` applies it+cleanly against a real Neon branch, re-running is idempotent, down-migration works. No fake data.+`git diff` reviewed. No changelog entry (internal infra).+```++---++# PHASE 1 — Session runtime (browser tier)++## TASK 1.1 — `@three-ws/session-runtime`: browser session manager (the runtime engine)++```+Senior systems engineer on three.ws. Read CLAUDE.md, STRUCTURE.md §"npm workspaces", and study:+- The worker pattern in workers/agent-orders/ (index.js, config.js, package.json) and how+ npm run worker:* launches it; how it reads env and connects to Neon (api/_lib/db.js) and Redis+ (api/_lib/redis.js — note the auth-breaker + in-memory fallback contract).+- Existing headless-browser usage: grep for puppeteer-core and @sparticuz/chromium-min to match how+ we already launch Chromium.+- vendor/steel-browser from Task 0.1.+- The agent_sessions / agent_session_events tables from Task 0.2.+DEPENDS ON: 0.1, 0.2.++Goal: build a long-running session-runtime service that owns the lifecycle of isolated browser+sessions. Create `packages/session-runtime/` as an npm workspace (add to package.json workspaces and+STRUCTURE.md). It exposes a small internal HTTP control API (used only by our control plane, secured+with a shared secret env var, NOT public) plus a worker entry:++API (internal):+- POST /sessions {sessionId, agentId, tier:'browser', taskPrompt, maxDurationS} → provisions an+ isolated browser context (Steel-backed; fall back to direct puppeteer-core + chromium-min if Steel+ is unavailable). Marks agent_sessions.status='live', records runtime_node, starts heartbeat.+- POST /sessions/:id/stop → graceful teardown, sets status, flushes final event.+- GET /sessions/:id → live status + metrics.+The worker loop: heartbeats live sessions to agent_sessions.last_heartbeat_at, reaps sessions past+max_duration_s or with stale heartbeats (status='killed', reason recorded), and enforces a global+concurrency cap from env. One browser context per session — full isolation, no shared cookies/state.++Real implementations only: real Chromium, real CDP. No mocks. Errors handled at the network boundary;+a failed provision sets status='failed' with error_code/error_detail and releases resources.++Add launch scripts to root package.json: `worker:sessions` and `worker:sessions:dev`.++Definition of done: `npm run worker:sessions` starts; hitting the internal API provisions a real+Chromium context you can confirm via a screenshot saved to the scratchpad; stop tears it down with no+orphaned processes; reaper kills an over-duration session; concurrency cap enforced; unit tests for+the lifecycle state machine and reaper (tests/ — vitest, follow tests/api/ naming). `git diff`+reviewed. Changelog: none yet (no user-visible surface until Phase 5 wires it).+```++## TASK 1.2 — Screencast capture → stream relay (reuse the existing frame pipeline)++```+Senior engineer on three.ws. Read CLAUDE.md and study the EXISTING streaming pipeline so you extend+it instead of inventing a parallel one:+- src/shared/agent-screen-client.js (SSE client; `frame` events carry {ts, data(base64 png), activity,+ type, agentId}).+- src/agent-screen.js (how frames are decoded and drawn to a canvas).+- Find the server endpoint that currently emits those SSE frames (grep for agent-screen-stream / the+ route the client connects to) and match its shape exactly.+DEPENDS ON: 1.1.++Goal: capture the live browser via CDP Page.startScreencast in the session-runtime, and relay frames+through the SAME SSE contract the frontend already understands, keyed by sessionId. Specifically:+1. In session-runtime, subscribe to CDP screencast for each live session; throttle to a configurable+ fps (default 8–12) and JPEG quality to stay within payload limits; ack frames to keep CDP flowing.+2. Publish frames to a relay the frontend can read: extend/clone the existing agent-screen SSE+ endpoint to serve `/api/sessions/:id/stream` (Vercel function) backed by the runtime (via Redis+ pub/sub or the runtime's internal API — pick the approach already used by the current screen+ stream and reuse it). Reconnect/backpressure handled.+3. Also emit lifecycle/action events on the same stream (nav, click, type, error) so viewers see what+ the agent is doing, not just pixels — write them to agent_session_events too.++No fake frames, no setTimeout fake progress. Real CDP frames or an explicit "provisioning" state.++Definition of done: opening the SSE stream for a live session in a browser shows the real screencast+updating; events appear; reconnect works; payloads stay within limits; existing agent-screen viewer+still works unchanged. Test the stream contract (shape of frame/event objects). `git diff` reviewed.+```++---++# PHASE 2 — The brain (browser agent loop)++## TASK 2.1 — `@three-ws/session-brain`: the GUI agent loop (Stagehand, BYO model)++```+Senior AI-systems engineer on three.ws. Read CLAUDE.md. This is an LLM-shaped task using+Anthropic/Claude as the default model — BEFORE coding, consult the claude-api skill for current model+ids, tool-use, and the @ai-sdk/anthropic usage already in this repo (it is a dependency). Study:+- How the repo already talks to Claude/OpenAI (grep for @ai-sdk/anthropic, worker proxies — CLAUDE.md+ says model calls go through worker proxies; reuse that, never hardcode keys).+- packages/session-runtime browser sessions (Task 1.1) and the CDP/Steel handle they expose.+DEPENDS ON: 1.1.++Goal: build the action loop that drives a session toward a natural-language task. Create+`packages/session-brain/` (npm workspace). Wrap Stagehand (MIT) over the session's browser handle to+provide act/observe/extract. The loop:+1. Takes {sessionId, taskPrompt, model?} — model is pluggable; default to the latest Claude via our+ existing proxy; allow BYO (caller supplies provider+key, used server-side only, never logged).+2. Plans → acts → observes in a bounded loop with a step cap and per-step timeout. Each step emits an+ action event into the Task 1.2 stream (so watchers see "navigating to…", "clicking Submit", etc.).+3. Stops on success criteria, step cap, or error; returns a structured result {status, summary,+ artifacts[], steps}.+4. Safety: respects an allowlist/denylist of domains from env/session config; refuses to enter+ credentials it wasn't given; never exfiltrates secrets to logs.++Real model calls only (no canned responses). Handle provider errors at the boundary with retries ++clear terminal failure.++Definition of done: given a real task ("find the top story on Hacker News and return its title+URL")+against a live session, the loop completes and returns the correct structured result, and the action+events are visible on the stream. Unit-test the loop control (step cap, timeout, denylist) with the+model call mocked at the provider boundary only. `git diff` reviewed.+```++---++# PHASE 3 — Live view + embeddable component++## TASK 3.1 — `<agent-session>` web component (embeddable live viewer)++```+Senior frontend engineer on three.ws. Read CLAUDE.md and study how existing web components ship as+SDKs (avatar-sdk `<agent-3d>`, page-agent-sdk `<page-agent>` — STRUCTURE.md). Study the SSE client+src/shared/agent-screen-client.js and the canvas-draw pattern in src/agent-screen.js.+DEPENDS ON: 1.2.++Goal: a drop-in `<agent-session session-id="…">` custom element that renders the live session for any+developer to embed. Create it under a publishable package (e.g. packages/session-viewer/ →+@three-ws/session-viewer, zero-dependency pure-ESM like the other SDK packages; follow their+src/http.js + node --test convention).+Requirements:+- Connects to /api/sessions/:id/stream, renders frames to a canvas, overlays the live action log.+- Every state designed: provisioning (skeleton), live, paused, completed (with summary + replay link),+ error (actionable), and a "session ended" empty state.+- Controls: pause/resume view, fullscreen, copy session link, and (if the viewer is the owner) a+ "stop session" button that calls the control plane.+- Accessible: semantic markup, ARIA on controls, keyboard nav, focus rings. Responsive 320→1440.+- Microinteractions: hover/active/focus states, smooth transitions, no jank.++Definition of done: embeddable in a plain HTML page (add an example under examples/), renders a real+live session, all states reachable and demoed in a real browser with no console errors. `git diff`+reviewed. Changelog: add an entry (feature) once the /live page in Task 3.2 makes it user-reachable —+coordinate so there is exactly one entry.+```++## TASK 3.2 — `/live` page: public gallery + single-session theater++```+Senior product engineer on three.ws. Read CLAUDE.md. Study page routing (data/pages.json ++scripts/build-page-index.mjs, `npm run build:pages`), the recent "live agents wall" work (git log),+and the <agent-session> component from Task 3.1.+DEPENDS ON: 3.1.++Goal: ship the user-facing surface where people watch agents work.+- `/live` — a gallery of currently-live sessions (real data from agent_sessions where status='live'),+ each tile a small live preview (thumbnail frame + agent name + task + elapsed + watcher count).+ Designed empty state ("No agents are working right now — hire one") linking to the hire flow.+- `/live/:sessionId` — full theater: the <agent-session> viewer, the action log, agent profile link,+ the provenance receipt once completed, and a "hire this agent" CTA.+- Register both routes in data/pages.json and run build:pages. Wire navigation in/out (no dead paths):+ link from agent profiles to their live/past sessions and back.++Real fetches only, no sample arrays. Loading = skeletons. Handle 0/1/many sessions and very long task+strings.++Definition of done: both routes load with real data, navigation is bidirectional, all states designed+and demoed in a real browser, no console errors, network tab shows real API calls. Add ONE changelog+entry (feature) covering the live-watch experience. `git diff` reviewed.+```++---++# PHASE 4 — 3D embodiment (the differentiator)++## TASK 4.1 — Render the live session onto a surface in the 3D scene, avatar reacting++```+Senior 3D/graphics engineer on three.ws. Read CLAUDE.md and study the proven patterns:+- src/walk-agent-desk.js (desk + monitor: CanvasTexture → PlaneGeometry, fed by the screen SSE client).+- The ContentBillboard class in src/walk.js (~L5097–5175) and paintContentTexture (~L5024–5086).+- Avatar mount + animation: src/agent-screen.js mountAvatarWebcam (~L570–630), src/animation-manager.js.+DEPENDS ON: 1.2 (stream), and reuses 3.1's stream client.++Goal: in the agent scene, render the agent's LIVE session onto a screen surface the avatar is+visibly operating. Reuse walk-agent-desk's CanvasTexture-on-plane approach fed by+/api/sessions/:id/stream. Then:+1. Place a workstation (desk + monitor, or a floating panel) near the avatar; map the live frames onto+ the monitor surface with correct aspect + anisotropy (match paintContentTexture quality).+2. Drive avatar animation from session activity: typing/clicking → a "working" clip; idle between+ steps → idle; error → a reaction. Use AnimationManager; do not hardcode a rig allowlist (CLAUDE.md).+3. Keep it performant: throttle texture uploads to the stream fps, dispose old textures, no per-frame+ allocations, respect the existing RAF loop. Lazy-load this module so it doesn't bloat first paint.++Definition of done: in a real browser, the avatar stands at its workstation and the monitor shows the+live session updating in real time while the avatar animates in sync; 60fps held on a mid-range+machine; no texture leaks (verify memory stays flat over a few minutes); no console errors. `git diff`+reviewed. Fold into the Phase 3 changelog entry (one cohesive "watch your agent work" feature) or add+an "improvement" entry if shipped separately.+```++---++# PHASE 5 — Commerce (wire into hire → pay → provenance)++## TASK 5.1 — Sessions control plane: `/api/sessions` with x402 metering + spend caps++```+Senior backend engineer on three.ws. Read CLAUDE.md and study the commerce spine you MUST reuse+(do not reinvent):+- api/_lib/x402-paid-endpoint.js (paidEndpoint(spec)) and api/_lib/x402-spec.js.+- api/agents/a2a-hire.js (the full hire: owner-gate → resolve offer → reserveSpendUsd →+ pay over x402 → record receipt → finalize/ledger).+- api/_lib/agent-trade-guards.js (reserveSpendUsd, releaseSpendReservation, updateCustodyEvent — the+ atomic, TOCTOU-safe spend ledger).+- The api/ handler conventions (api/agent-delegate.js): wrap(), cors(), method(), getSessionUser /+ authenticateBearer, readJson, limits (rate-limit), json/error.+- packages/session-runtime internal API (Task 1.1) and agent_sessions / agent_session_minutes (0.2).+DEPENDS ON: 1.1, 2.1, 0.2.++Goal: the thin Vercel control plane that turns sessions into a paid product.+- POST /api/sessions — start a session. Owner/bearer auth + rate limit. Resolve per-minute price+ (price_atomics_per_min, in USDC; $THREE accepted via the same x402 challenge — never any other coin).+ reserveSpendUsd() for the FIRST minute BEFORE provisioning (closes TOCTOU); call session-runtime to+ provision; kick off the brain (Task 2.1). Return {sessionId, streamUrl}. On any failure, release the+ reservation and return an actionable error.+- Per-minute metering: a billing tick (in session-runtime's loop or a dedicated reaper) that, for each+ live minute, reserves+settles the next minute via the spend ledger and writes agent_session_minutes+ idempotently. If a minute can't be funded → graceful stop (status='completed', reason='budget'),+ never a silent overrun. Respect the hirer's daily/per-tx caps from agent-trade-guards.+- POST /api/sessions/:id/stop — owner stop; finalize ledger (updateCustodyEvent), set ended_at.+- GET /api/sessions and /api/sessions/:id — list/detail backing the /live page.++Follow x402-paid-endpoint conventions so the 402 challenge advertises USDC and $THREE exactly like+the rest of the platform. Real settlement only.++Definition of done: a real hire starts a real paid session; the first minute is reserved before any+Chromium spawns; subsequent minutes meter correctly and idempotently; exceeding the cap stops the+session cleanly with a clear reason; stop finalizes the ledger; both wallets reflect the spend. Tests:+metering idempotency, cap-stop, TOCTOU reservation ordering (vitest, tests/api/). `git diff` reviewed.+Changelog: add a feature entry for paid agent sessions.+```++## TASK 5.2 — Provenance receipt + AgenC task for every session++```+Senior backend engineer on three.ws. Read CLAUDE.md and study:+- buildProvenance in mcp-server/src/lib/agent-commerce.js and how agent_hire returns a receipt.+- append_agent_action → /api/agent-actions (packages/provenance-mcp) — the signed, append-only ledger.+- AgenC task lifecycle: api/agenc/[action].js and packages/agenc (create/claim/status/complete).+DEPENDS ON: 5.1.++Goal: make every session auditable and screenshot-worthy.+1. On session start, open an AgenC task representing the job (task_prompt, agent, price) and store its+ pda in agent_sessions.agenc_task_pda. On completion/failure, transition the task to its terminal+ state.+2. On completion, build a provenance receipt (buildProvenance) summarizing: agent, task, duration,+ minutes billed, total spend (USDC/$THREE), result summary, and a link to the replay. Sign + append+ it via the agent-actions ledger; store provenance_action_id on the session.+3. Surface the receipt on /live/:sessionId (Task 3.2) and in the session-runtime result.++Real signing + real on-chain/append writes (no fake hashes). Errors at the boundary; a provenance+write failure must not silently drop — retry then record the gap explicitly.++Definition of done: completing a real session produces a verifiable provenance record and a closed+AgenC task; the receipt renders on the theater page; signature verifies. Test the receipt builder and+the lifecycle transitions. `git diff` reviewed. Fold into the Task 5.1 changelog entry or add an+"improvement" entry for verifiable session receipts.+```++---++# PHASE 6 — Developer surface (MCP + SDK)++## TASK 6.1 — `@three-ws/computer-mcp`: session tools over MCP, priced in USDC++```+Senior engineer on three.ws. Read CLAUDE.md and study the MCP package template precisely:+- packages/x402-mcp/ (package.json with name/version/mcpName/bin; src/index.js McpServer ++ registerTool loop + StdioServerTransport; src/tools/*.js exporting `def` with name/title/annotations/+ inputSchema/handler; server.json; how scripts/publish-mcp-servers.mjs validates+publishes).+- The hosted HTTP MCP transport (api/mcp-3d.js + api/_lib/x402-spec.js settlePayment /+ encodePaymentResponseHeader; mcp-batch-price) and how a tool declares an x402 price and returns+ PaymentRequired structuredContent.+- The Sessions control plane (Task 5.1).+DEPENDS ON: 5.1, 5.2.++Goal: create packages/computer-mcp/ (npm workspace + add to publish-mcp-servers.mjs SERVERS) exposing:+- session_start {agentId, taskPrompt, tier?, maxDurationS?, model?} — paid (per the per-minute price);+ returns {sessionId, streamUrl, watchUrl}.+- session_watch {sessionId} — free read; returns current status + recent action events + streamUrl.+- session_act {sessionId, instruction} — paid; injects a follow-up instruction into a live session.+- session_stop {sessionId} — finalizes; returns the provenance receipt.+Pricing surfaces over both stdio (PaymentRequired structuredContent) and the hosted HTTP transport+(X-PAYMENT-RESPONSE) exactly like existing paid tools. USDC + $THREE only.++Add server.json (version matched), README, LICENSE, and register the remote in the hosted MCP surface+so it appears alongside agent_hire/forge_free.++Definition of done: `node scripts/publish-mcp-servers.mjs --dry-run` validates the new server; tools+work end-to-end against a real session via the MCP inspector; paid tools issue/settle real x402;+free reads need no payment. Tests under packages/computer-mcp/test/*.test.mjs. `git diff` reviewed.+Changelog: add an sdk entry for the Agent Computer MCP.+```++## TASK 6.2 — `@three-ws/computer` SDK (single-import client for developers)++```+Senior DX engineer on three.ws. Read CLAUDE.md and STRUCTURE.md §"SDK packages (published)" — match+that convention exactly: zero-dependency pure-ESM, shared src/http.js core (base-URL + typed+ThreeWsError/PaymentRequiredError with 402 carrying the x402 challenge), hand-written .d.ts, node+--test suite, ships src/ with no build step. Study an existing one (e.g. packages/agenc/ or+packages/forge/).+DEPENDS ON: 5.1, 5.2.++Goal: packages/computer/ → @three-ws/computer. A developer installs it and runs:+ const s = await computer.startSession({ agentId, task });+ for await (const ev of s.events()) { ... } // streams action/frame events+ const receipt = await s.stop();+Cover: startSession, getSession, listSessions, act(instruction), stop, and an events() async iterator+over the SSE stream. Surface payment challenges as PaymentRequiredError so callers can pay via our+x402 client. Include the <agent-session> embed instructions in the README.++Definition of done: `cd packages/computer && node --test test/*.test.js` green; README quickstart works+against the real API; types accurate. Register in scripts/publish-packages.mjs. `git diff` reviewed.+Changelog: sdk entry (or fold into 6.1's entry).+```++---++# PHASE 7 — Desktop tier, hardening, launch++## TASK 7.1 — Desktop tier: cua/UI-TARS sandbox + neko stream (premium "full computer")++```+Senior systems engineer on three.ws. Read CLAUDE.md. Study packages/session-runtime (Task 1.1),+vendor/neko (0.1), and the tier='desktop' fields in agent_sessions (0.2). Reference cua (MIT) and+UI-TARS (Apache-2.0).+DEPENDS ON: 1.1, 1.2, 2.1, 5.1.++Goal: add a 'desktop' tier to session-runtime: a full isolated desktop (cua sandbox; Firecracker/E2B+or QEMU for isolation) driven by UI-TARS, streamed via neko (WebRTC) — falling back to the screencast+SSE relay if WebRTC isn't available. The control plane, metering, spend caps, provenance, MCP tools,+and 3D embodiment from earlier phases must work for desktop sessions with zero changes to their public+contracts (only the runtime backend differs by tier).++Strict isolation: one sandbox per session, no shared FS/network state, hard resource + time caps,+guaranteed teardown. No mocks.++Definition of done: a desktop session provisions a real isolated desktop, UI-TARS completes a real+multi-app task, the stream renders in the <agent-session> viewer AND on the 3D workstation, metering ++provenance work identically to the browser tier, and teardown leaves nothing orphaned. Tests for the+tier router + teardown. `git diff` reviewed. Changelog: feature entry for the desktop tier.+```++## TASK 7.2 — WebRTC stream upgrade (LiveKit/neko) for smooth low-latency viewing++```+Senior media engineer on three.ws. Read CLAUDE.md. Study the existing LiveKit wiring+(src/runtime/livekit-voice.js, the /api/agents/:id/livekit-token endpoint) and vendor/neko. Study the+stream_kind field on agent_sessions and the SSE relay from Task 1.2.+DEPENDS ON: 1.2, 3.1.++Goal: add a WebRTC stream path so live viewing is smooth video, not throttled JPEGs. Publish the+session's screencast as a WebRTC track (via LiveKit using our existing token infra, or neko for the+desktop tier) and teach <agent-session> (Task 3.1) and the 3D surface (Task 4.1) to consume a+VideoTexture/<video srcObject> when stream_kind='webrtc', transparently falling back to SSE frames+when WebRTC fails. One viewer-side API; the transport is an implementation detail.++Definition of done: a live session streams as smooth WebRTC video in the embed, the /live theater, and+the 3D workstation, with automatic SSE fallback verified by forcing a WebRTC failure; latency visibly+better than the SSE path; no console errors. Test the transport-selection + fallback logic. `git diff`+reviewed. Changelog: improvement entry (smoother live viewing).+```++## TASK 7.3 — Security, abuse, and isolation hardening (gate before public launch)++```+Senior security engineer on three.ws. Read CLAUDE.md and run /security-review against the whole+Agent Computer surface. Study every endpoint and worker added in Phases 1–7 and the existing guards+(api/_lib/agent-trade-guards.js, api/_lib/x402-spec.js SSRF guard, rate-limit, redis auth-breaker).+DEPENDS ON: all prior tasks.++Goal: make the system safe to expose publicly. Verify and fix:+- SSRF: an agent browser/desktop must not reach internal/metadata IPs (169.254.169.254, RFC1918,+ localhost). Enforce an egress allow/deny policy in the runtime; reuse the existing SSRF guard pattern.+- Isolation: confirm one-context/one-sandbox-per-session, no cross-tenant cookie/FS/network leakage;+ guaranteed teardown even on crash; resource + wall-clock caps enforced.+- Spend safety: no path starts or extends a session without a successful reserveSpendUsd; no metering+ double-charge; budget-exhaustion stops cleanly; kill switch (frozen) blocks new sessions.+- Secrets: BYO model keys and any credentials the agent is given are never logged, never sent to the+ client, never written to provenance/events.+- AuthZ: only the owner (or an authorized hirer) can view a private session, stop it, or read its+ events; public gallery shows only sessions explicitly marked public.+- Rate limits + global concurrency caps on session creation; abuse (crypto-mining, illegal content)+ policy + a kill path.+Document the threat model and mitigations in docs/internal/.++Definition of done: /security-review clean (or every finding fixed and re-verified); SSRF and+cross-tenant isolation proven with real tests; no secret leakage; spend safety proven. `git diff`+reviewed. Changelog: security entry.+```++## TASK 7.4 — Pricing, dev dashboard, docs, and launch++```+Senior product engineer on three.ws. Read CLAUDE.md. Study how other paid surfaces present pricing ++keys (api/x402-merchant.js, the SDK launch docs docs/sdk-launch.md, the existing dev/dashboard pages).+DEPENDS ON: 5.x, 6.x, 7.1–7.3.++Goal: package Agent Computer as a developer product.+- A `/computer` (or /sessions) marketing+docs page: what it is, the tiers (browser/desktop), per-minute+ pricing in USDC/$THREE, the embed snippet (<agent-session>), the SDK quickstart, and the MCP tools.+ Register in data/pages.json + build:pages.+- A dev dashboard view: a developer's sessions (live + past), spend, per-minute rate, API key, embed+ code, and replay links. Reuse the existing merchant/dashboard patterns.+- End-to-end docs in docs/: runtime self-hosting, the Sessions API, the SDK, the MCP server, and the+ embed component — each a real, copy-pasteable, working example.+- Every state designed; every link live; bidirectional navigation from agent profiles and /live.++Definition of done: a developer can land on /computer, read docs, copy the embed/SDK/MCP snippet, and+get a real working live session billed correctly; dashboard shows real data; demoed in a real browser+with no console errors. Changelog: feature entry announcing Agent Computer GA. Run+`npm run changelog:push` after deploy (skip if creds absent). `git diff` reviewed.+```++---++## 3. Dependency graph (quick reference)++```+0.1 ─┬─▶ 1.1 ─┬─▶ 1.2 ─┬─▶ 3.1 ─▶ 3.2+0.2 ─┘ ├─▶ 2.1 ──┤ └─▶ (feeds 4.1, 7.2)+ │ └─▶ 4.1+ └─▶ 5.1 ─▶ 5.2 ─┬─▶ 6.1 ─▶ 6.2+ └─▶ 7.1, 7.2, 7.3, 7.4+```++Parallelizable early: 0.1 ∥ 0.2; then 1.2 ∥ 2.1 after 1.1; then 3.1, 4.1 after 1.2.+Phase 7 hardening (7.3) and launch (7.4) gate the public release.++## 4. Definition of done for the whole program++- A user hires an agent, pays per-minute in USDC/$THREE, and watches it operate a real browser/desktop+ live — flat (/live), embedded (<agent-session>), and embodied in the 3D scene with the avatar reacting.+- Every minute is metered idempotently under hard spend caps; budget exhaustion stops cleanly.+- Every session yields a verifiable provenance receipt and a closed AgenC task.+- Developers can consume each layer standalone (runtime, brain, viewer, SDK, MCP) or the whole product.+- Security-reviewed, SSRF-safe, tenant-isolated, secret-safe. No mocks anywhere. $THREE is the only coin.+```diff --git a/docs/live-agent-tasks/01-live-trading-desk.md b/docs/live-agent-tasks/01-live-trading-desk.mdnew file mode 100644index 000000000..f41265e4c--- /dev/null+++ b/docs/live-agent-tasks/01-live-trading-desk.md@@ -0,0 +1,75 @@+# 01 — Live Trading Desk++> **Mission (one line):** An agent runs a real pump.fun trading loop on camera — every scored launch, buy, and exit narrated live, PnL ticking, and its 3D avatar cheering on a win or slumping on a loss.++## The watchable moment+A viewer opens `/agent-screen?agentId=…` and watches money move in real time. The activity log streams "scored MINT 0.82 → buying 0.05 SOL", then "filled @ 0.0000031, +12% unrealized", and a PnL ticker in the header climbs in green. The instant a position closes in profit, the 3D avatar head fires a `celebrate` gesture; on a stop-loss it `slump`s into a `sad` clip. It is the tension of a live poker stream — you can't look away because real SOL is on the line and the avatar reacts like a person would.++## Who benefits+- **Viewer:** sees a transparent, narrated autonomous trader — provably real trades, real PnL, real risk, with a face that reacts.+- **Agent owner:** their agent becomes a watchable performance; good runs build reputation and draw watchers to the agent profile and its $THREE-denominated economy.+- **Platform:** turns the existing sniper/trade infrastructure into spectator content, linking `/agents-live`, the agent profile, and the trade ledger into one loop.++## Where it lives+- **Surface:** both — a card on `/agents-live` and the hero panel on `/agent-screen?agentId=…`+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (live screen + Avatar Cam + Activity Log)+ - `pages/agents-live.html` / `src/agents-live.js` (wall card + activity-terminal fallback)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient` SSE client)+ - `workers/agent-sniper/index.js`, `workers/agent-sniper/executor.js` (`executeBuy`, `executeSell`)+ - `workers/agent-sniper/screen-push.js` (`screenPush` fire-and-forget pusher — already wired)+ - `src/animation-manager.js` (`AnimationManager.playOnce(name, { settleTo })`)++## Data flow (source → transform → render)+1. **Source:** the live trade loop — `workers/agent-sniper/executor.js` (`executeBuy` / `executeSell`) and the discretionary `POST /api/agents/:id/trade` (`api/agents/agent-trade.js`). Scoring comes from `workers/agent-sniper/scorer.js`; trending context from `GET /api/pump/trending`.+2. **Transform:** each lifecycle event is shaped into a narration line + a typed PnL delta `{ phase: 'scored'|'buy'|'hold'|'exit', mint, scoreOrPrice, solDelta, unrealizedUsd, realizedUsd }`. Every spend is gated FIRST by `api/_lib/agent-trade-guards.js` (`reserveSpendUsd` / per-tx + daily ceilings + `frozen` kill switch) — no money moves before the reservation succeeds.+3. **Transport:** the loop calls `screenPush()` → `POST /api/agent-screen-push` with `{ frame: { activity, type: 'trade' }, agentId }`. Viewers receive it over SSE from `GET /api/agent-screen-stream` via `createAgentScreenClient`. A new typed event `pnl` is carried in the frame payload's `activity`/`type` so no schema break is needed.+4. **Render:** activity-log entry (typed `trade`), a header PnL ticker computed from the running realized+unrealized sum, and an avatar emote — `playOnce('celebrate', { settleTo: 'idle' })` on a green exit, `playOnce('sad', { settleTo: 'idle' })` on a red exit, `playOnce('wave')` on session start.++## Build spec+1. In `workers/agent-sniper/executor.js`, at the four real lifecycle points — score computed, buy reserved+filled, position marked, exit filled — call `screenPush({ activity, type: 'trade' })` with a plain-language line. Reuse the existing `log()` call sites; do not invent new trade actions. Guard every buy behind `agent-trade-guards` exactly as the executor already does — narration is additive only.+2. Extend `workers/agent-sniper/screen-push.js` to accept an optional `pnl` object on the frame and forward it in the POST body's `frame` (the push endpoint already passes `frame` through to Redis verbatim; `activity` carries the human line, a compact `[+12.4%]` suffix carries the number).+3. In `src/agent-screen.js`, parse `type === 'trade'` frames: append to the Activity Log with a green/red class by sign, and maintain a `pnlTotalUsd` accumulator rendered in a new header ticker `#asc-pnl` (added in `pages/agent-screen.html`). Animate the number with a transform-based count-up (no `setTimeout` fake progress — drive it from real frames).+4. Wire avatar reactions: in the same frame handler, when an exit frame's PnL delta is positive call `webcamAnimManager.playOnce('celebrate', { settleTo: 'idle' })`; negative → `playOnce('sad', { settleTo: 'idle' })`. Gate on `webcamAnimManager.supportsCanonicalClips()` so rigs that can't be skeleton-driven simply skip the emote (never T-pose).+5. In `src/agents-live.js`, give `type: 'trade'` lines a colored dot/row in the card's activity terminal and surface the latest PnL in `.al-card-action`, so the wall reads as a row of live trading desks.+6. Add a header tooltip on `#asc-pnl` explaining "session realized + unrealized, from real fills" and a keyboard shortcut (`P`) to toggle a compact vs. detailed PnL breakdown.++## Files to create / modify+- `workers/agent-sniper/executor.js` — emit narrated `screenPush` lines at score/buy/hold/exit (modify).+- `workers/agent-sniper/screen-push.js` — forward optional PnL payload on the frame (modify).+- `src/agent-screen.js` — trade-frame parsing, PnL ticker, avatar emote on exit (modify).+- `pages/agent-screen.html` — `#asc-pnl` header ticker element + tooltip markup (modify).+- `src/agents-live.js` — colored trade rows + latest-PnL in card action line (modify).+- `tests/agent-screen-pnl.test.js` — unit test for the pure PnL accumulator + sign→emote mapping (create).++## Real integrations (no mocks, ever)+- pump.fun trade execution via `PumpTradeClient` (`api/_lib/pump.js`), `api/agents/agent-trade.js`, and the sniper executor — real on-chain buys/sells from the agent's custodial wallet.+- Solana RPC for fills/confirmation; `GET /api/pump/trending` (Birdeye → pump.fun fallback) for context.+- Spend governance: `api/_lib/agent-trade-guards.js` (`reserveSpendUsd`, per-tx/daily caps, `frozen`). Hard caps are enforced server-side and surfaced in the log when a buy is skipped for cap.+- Transport: `api/agent-screen-push.js` + `api/agent-screen-stream.js` (Upstash Redis, 90s frame TTL).+- Credentials: `AGENT_JWT`, `AGENT_ID`, `PUSH_URL` for the worker; spend limits live on the agent row. Locate in `.env` / `vercel env`; if missing, ask once then proceed.++## Every state designed+- **Loading:** Activity Log shows a skeleton of shimmering rows; PnL ticker shows `—` until the first fill.+- **Empty:** before the first trade, the panel reads "Desk armed. Watching launches — first scored coin appears here." with the spend-cap badge visible so the viewer knows the limits.+- **Error:** a skipped buy (cap hit, frozen wallet, RPC failure) renders an amber actionable line ("daily cap reached — resets in 4h") instead of a silent gap; SSE drop shows the existing reconnect badge.+- **Populated:** the hero state — streaming trade lines, climbing/falling PnL, avatar emoting.+- **Overflow:** 0 trades (empty state), 1 trade (single row + ticker), 1000+ trades (log trimmed to the 50-entry cap from `agent-screen-push.js`, ticker still accurate from the running total); very long mint/name truncated with ellipsis + title; mid-session network drop falls back to the activity terminal on the wall.++## Definition of done+- [ ] Reachable from `/agents-live` and `/agent-screen` via real navigation.+- [ ] Real trade fills visible in the network/RPC path; PnL computed from real fills.+- [ ] Hover / active / focus states on the PnL ticker, tooltip, and card rows.+- [ ] All five states implemented.+- [ ] No console errors or warnings from this code.+- [ ] `npm test` passes; `tests/agent-screen-pnl.test.js` added for the pure accumulator + emote mapping.+- [ ] Verified live in a browser against `npm run dev` (port 3000), with a sniper running in `SNIPER_MODE=simulate` to exercise the full real-quote path without broadcasting, then confirmed once against a live fill.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag: `feature`) — e.g. "Live Trading Desk: watch an agent trade pump.fun in real time with a PnL ticker and an avatar that celebrates wins." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. The trade loop consumes runtime mints supplied by the live pump.fun feed (generic plumbing) — never hardcode, market, or recommend any non-$THREE mint in code, copy, or narration.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. The PnL count-up is driven by real frames only.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/02-agent-newsroom-anchor.md b/docs/live-agent-tasks/02-agent-newsroom-anchor.mdnew file mode 100644index 000000000..0ed67a840--- /dev/null+++ b/docs/live-agent-tasks/02-agent-newsroom-anchor.md@@ -0,0 +1,80 @@+# 02 — Agent Newsroom Anchor++> **Mission (one line):** An agent becomes a live market-news anchor — pulling real intel, scripting a short broadcast, speaking it aloud while its 3D avatar lip-syncs, with headlines rendering as lower-third overlays.++## The watchable moment+On `/agent-screen?agentId=…` the agent sits as a broadcast anchor: the Avatar Cam head is talking — mouth actually moving to the words via Audio2Face visemes — while a lower-third overlay slides up with the headline ("aixbt: NEW NARRATIVE — restaking flows accelerating"). Audio plays in the viewer's browser. Every ~90 seconds the anchor refreshes with new intel and runs the next bulletin. It feels like a live financial channel that exists only because an autonomous agent is reading the market to you.++## Who benefits+- **Viewer:** a digestible, spoken market briefing from real intel feeds — no chart-reading required, ambient and watchable.+- **Agent owner:** their agent gains a recurring on-air persona that showcases its intelligence and voice, driving repeat watchers.+- **Platform:** binds the intel surfaces (aixbt, sentiment, pump snapshot), the brain LLM router, and the TTS/lipsync stack into one flagship demo of three.ws capabilities.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel (the anchor desk); a card on `/agents-live` shows the current lower-third headline.+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (Avatar Cam + overlay layer)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient`)+ - `mcp-server/src/tools/aixbt-intel.js` (`aixbt_intel` → `GET /api/aixbt/intel`)+ - `mcp-server/src/tools/sentiment-pulse.js` (`sentiment_pulse`)+ - `mcp-server/src/tools/pump-snapshot.js` (`pump_snapshot`)+ - `api/brain/chat.js` (`POST /api/brain/chat`, SSE, multi-LLM router)+ - `api/tts/speak.js` (`POST /api/tts/speak` — NVIDIA Magpie free lane → OpenAI backstop)+ - `api/a2f.js` + `packages/audio-mcp` `audio_to_face` (ARKit blendshape lipsync)+ - `src/animation-manager.js` (`playOnce('talking')`, additive gesture overlay)++## Data flow (source → transform → render)+1. **Source:** every cadence tick, the anchor loop fetches `GET /api/aixbt/intel` (via the `aixbt_intel` path), `sentiment_pulse`, and `pump_snapshot` for current market state.+2. **Transform:** the three feeds are merged into a compact briefing object, then `POST /api/brain/chat` scripts a tight 2–4 sentence anchor read (system prompt: "You are a market-news anchor. Plain language, no jargon, one headline + one line of context per item."). The script is split into a headline (lower-third) and the spoken body.+3. **Transport:** the anchor worker pushes each headline as `POST /api/agent-screen-push` `{ frame: { activity: headline, type: 'analysis' } }`; viewers subscribe over `GET /api/agent-screen-stream`. Audio + viseme track are produced client-side in `src/agent-screen.js` from the script text.+4. **Render:** lower-third overlay (CSS slide-up over the live screen), spoken audio from `/api/tts/speak`, and the Avatar Cam head driven by the `/api/a2f` ARKit blendshape track so the mouth matches the audio; `playOnce('talking')` runs as an additive gesture so the body stays alive while speaking.++## Build spec+1. Create `workers/agent-anchor/index.js` — a cadence loop (default 90s, env `ANCHOR_CADENCE_MS`) that calls the three intel sources, posts the merged brief to `/api/brain/chat`, collects the script, and `screenPush`es the headline as a `type: 'analysis'` frame. Model it on `workers/agent-sniper/screen-push.js` for the non-blocking push.+2. The anchor frame's `activity` carries the headline; a compact JSON sidecar (`script`, `ttl`) is embedded in the frame so the client can speak the body. Keep within the 320-char `ACTIVITY_MAX` for the headline; the spoken body is fetched client-side by the client re-requesting the script via a new `GET /api/agent/anchor-script?agentId=…` reading the last script from Redis (set by the worker alongside the frame).+3. In `src/agent-screen.js`, add an overlay layer: on a `type: 'analysis'` frame, slide a lower-third in `pages/agent-screen.html` (`#asc-lowerthird`) with the headline, fetch the spoken body, call `POST /api/tts/speak` for audio and `POST /api/a2f` for the viseme/blendshape track, play the audio, and drive `webcamAnimManager` blendshapes from the a2f track frame-by-frame.+4. Gate lipsync on `webcamAnimManager.supportsCanonicalClips()` / blendshape availability; if the rig has no ARKit morph targets, fall back to a jaw-bob driven by audio RMS so the head still "talks" (no frozen face).+5. In `src/agents-live.js`, render the latest `type: 'analysis'` headline as the card's `.al-card-action` so the wall shows what each anchor is reporting.+6. Add an "audio on/off" toggle (muted by default for the wall, prompts a one-tap unmute on `/agent-screen`) with hover/focus states, plus a `M` mute shortcut.++## Files to create / modify+- `workers/agent-anchor/index.js` — the cadence loop fetch → script → push (create).+- `workers/agent-anchor/screen-push.js` — non-blocking pusher mirroring the sniper's (create, or import the sniper's shared helper if extracted).+- `api/agent/anchor-script.js` — `GET` last anchor script from Redis for the client to speak (create).+- `src/agent-screen.js` — lower-third overlay, TTS playback, a2f-driven lipsync, mute toggle (modify).+- `pages/agent-screen.html` — `#asc-lowerthird` overlay + mute button markup (modify).+- `src/agents-live.js` — surface the current headline on the card (modify).+- `tests/anchor-brief.test.js` — unit test for the pure feed-merge → headline/body split (create).++## Real integrations (no mocks, ever)+- aixbt narrative intel (`GET /api/aixbt/intel`, key held server-side), `sentiment_pulse`, `pump_snapshot` — real market intel.+- `POST /api/brain/chat` — real multi-LLM router (Anthropic / OpenAI / Qwen / watsonx per `api/brain/chat.js`), SSE.+- `POST /api/tts/speak` — real NVIDIA NIM Magpie TTS (free lane) with OpenAI backstop.+- `POST /api/a2f` (`api/a2f.js`) — real NVIDIA Audio2Face-3D ARKit blendshape lipsync.+- Transport: `api/agent-screen-push.js` + `api/agent-screen-stream.js`.+- Credentials: `AIXBT_API_KEY`, `NVIDIA_API_KEY`, brain provider keys, `AGENT_JWT`/`AGENT_ID`. Locate in `.env` / `vercel env`; if missing, ask once then proceed.++## Every state designed+- **Loading:** lower-third shows a skeleton bar; Avatar Cam plays `idle` until the first script arrives.+- **Empty:** before the first bulletin, the overlay reads "On air shortly — pulling the latest market intel." so the viewer knows a broadcast is imminent.+- **Error:** if an intel feed is down, the anchor reports only the feeds that returned ("Sentiment offline — reading flow + narrative only") rather than going silent; TTS failure falls back to text-only lower-third with a visible "audio unavailable" note; a2f failure falls back to RMS jaw-bob.+- **Populated:** the hero state — talking head, lower-third headline, audio.+- **Overflow:** 0 intel items (graceful "quiet market" read), 1 item (single headline), many items (anchor scripts the top 2–3 only; rest summarized); very long headline truncates in the lower-third with a marquee on hover.++## Definition of done+- [ ] Reachable from `/agent-screen` (and the headline visible on `/agents-live`).+- [ ] Real intel, brain, TTS, and a2f calls visible in the network tab; real audio plays.+- [ ] Hover / active / focus states on the mute toggle and any controls.+- [ ] All five states implemented.+- [ ] No console errors or warnings from this code.+- [ ] `npm test` passes; `tests/anchor-brief.test.js` added for the pure feed-merge logic.+- [ ] Verified live in a browser against `npm run dev` (port 3000): audio plays, mouth moves to the words.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag: `feature`) — e.g. "Newsroom Anchor: agents now read the market to you on air, speaking real intel with a lip-synced avatar." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. The anchor reports market intel from runtime feeds (generic plumbing); never script, name, or recommend any non-$THREE mint. If a feed surfaces another token, summarize the narrative without promoting the token.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Audio and lipsync are driven by real synthesized bytes.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/03-a2a-commerce-live.md b/docs/live-agent-tasks/03-a2a-commerce-live.mdnew file mode 100644index 000000000..9181e2ed1--- /dev/null+++ b/docs/live-agent-tasks/03-a2a-commerce-live.md@@ -0,0 +1,75 @@+# 03 — Agent-to-Agent Commerce, Live++> **Mission (one line):** Viewers watch one agent autonomously hire another over x402 — discover, quote, settle real USDC, run the remote skill, and show the on-chain invocation receipt — all visualized as money and work changing hands.++## The watchable moment+On `/agent-screen?agentId=…` the hiring agent narrates: "I need a logo forged — shopping the offer registry." A quote card flips up: "Provider AGENT-B · forge_logo · $0.04 USDC · cap $0.10." A coin animates from the hiring wallet to the provider wallet, the remote skill runs, and an inline provenance receipt resolves with a real Solana explorer link to the on-chain invocation record. You are literally watching the agent economy transact — real USDC, real work, real receipt — with the spend cap visible the whole time.++## Who benefits+- **Viewer:** sees the agent economy work end to end — discovery, price, settlement, delivery, proof — not a diagram but live money.+- **Agent owner:** both sides earn or spend real value on camera; providers advertise skills, hirers showcase autonomy under hard caps.+- **Platform:** turns the x402 + on-chain-invocation rails into spectator proof that three.ws agents transact for real, linking the marketplace, agent profiles, and the custody ledger.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel (the hire flow visualizer); a card on `/agents-live` shows live hires as they settle.+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js`+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient`)+ - `api/agents/a2a-hire.js` (`POST` — owner-gated hire over real x402, idempotent)+ - `api/agent-delegate.js` (delegated invocation path)+ - `api/_lib/agent-invocation-onchain.js` (`recordInvocationReceipt`, `buildInvokeSkillIx`, `deriveAgentPda`)+ - `api/_lib/agent-trade-guards.js` (`reserveSpendUsd`, per-tx/daily caps, `frozen`)++## Data flow (source → transform → render)+1. **Source:** a hire is driven by `POST /api/agents/a2a-hire` `{ hirerAgentId, serviceSlug, input, maxUsd }`. The provider's offer is resolved from the real offer registry (`agent_paid_services` → `/api/x402/service/<slug>`).+2. **Transform:** the endpoint reserves the spend against the hirer's policy (`reserveSpendUsd` — per-tx + daily + `frozen`), enforces `maxUsd` (402 `over_cap` if exceeded), settles USDC over real x402 (verify → work → settle, so a failed skill never charges), and records an on-chain invocation receipt. Each phase emits a narration line + structured `{ phase, slug, usd, txSig }`.+3. **Transport:** the hire flow `screenPush`es each phase as `POST /api/agent-screen-push` `{ frame: { activity, type: 'analysis' } }`; viewers get them over `GET /api/agent-screen-stream`. The settlement signature is read from the x402 receipt (`transaction`/`signature`/`txHash`).+4. **Render:** a phased hire visualizer in `src/agent-screen.js` — discover → quote card → coin-transfer animation → "running remote skill" → provenance receipt with an explorer link from the invocation record. Spend caps render as a persistent badge.++## Build spec+1. Add phase emission to the hire path: in `api/agents/a2a-hire.js` (or a thin wrapper the hire flow calls), after each real milestone — offer resolved, spend reserved, x402 settled, skill returned, invocation recorded — push a `type: 'analysis'` frame with a plain line and a structured sidecar (`phase`, `slug`, `usd`, `maxUsd`, `txSig`, `invocationSig`). Pushes are fire-and-forget; never block settlement on a push.+2. In `src/agent-screen.js`, build a hire visualizer that consumes these frames: a quote card (provider name, slug, price, cap), a wallet-to-wallet coin animation (CSS transform, triggered only by the real `settled` frame — no fake pre-settlement motion), a "running" state, and a receipt card.+3. The receipt card links to the Solana explorer using the real settlement + invocation signatures and the PDA from `deriveAgentPda` (`api/_lib/agent-invocation-onchain.js`). Show both the USDC settlement tx and the invocation-program tx.+4. Render the spend cap badge (`per-tx` / remaining daily) from the reservation response so the viewer always sees the ceiling the agent is bounded by; an `over_cap` 402 renders an amber "would exceed cap — skipped" card, not a crash.+5. In `src/agents-live.js`, when an agent emits a `settled` hire frame, flash the card and show "hired AGENT-B · $0.04" in `.al-card-action`, linking the wall to live commerce.+6. Add hover/focus states to the quote and receipt cards; the explorer links open in a new tab with `rel="noopener"`.++## Files to create / modify+- `api/agents/a2a-hire.js` — emit phased `screenPush` frames at each real milestone (modify).+- `src/agent-screen.js` — hire visualizer (quote → coin transfer → receipt), cap badge (modify).+- `pages/agent-screen.html` — hire-visualizer container markup (modify).+- `src/agents-live.js` — flash + "hired …" on settled hires (modify).+- `tests/a2a-hire-phases.test.js` — unit test for the pure phase→render-payload mapping + cap math (create).++## Real integrations (no mocks, ever)+- `POST /api/agents/a2a-hire` — real owner-gated hire; real x402 USDC settlement (`x402-user-payer` → `@x402/svm` exact scheme) from the hirer's custodial Solana wallet to the provider's wallet.+- Offer registry: `agent_paid_services` → `/api/x402/service/<slug>` (real provider offers).+- On-chain invocation receipt: `api/_lib/agent-invocation-onchain.js` (`recordInvocationReceipt`) — real agent-invocation program tx on Solana.+- Spend governance: `api/_lib/agent-trade-guards.js` (`reserveSpendUsd`, caps, `frozen`).+- Transport: `api/agent-screen-push.js` + `api/agent-screen-stream.js`.+- Credentials: hirer custodial wallet key path (`recoverSolanaAgentKeypair`), x402 config, Solana RPC. Locate in `.env` / `vercel env`; if missing, ask once then proceed.++## Every state designed+- **Loading:** quote card skeleton while the offer resolves; cap badge shows immediately.+- **Empty:** before a hire, the panel reads "Idle — this agent hires others for skills it doesn't have. Next hire shows here." with the cap badge visible.+- **Error:** `over_cap` → amber "above per-call cap, skipped"; offer not found → "no provider for that skill"; x402 verify/work failure → "skill failed — no charge (verify-then-settle)" with the unspent confirmation; never a silent gap.+- **Populated:** the hero flow — quote → coin transfer → receipt with explorer links.+- **Overflow:** 0 hires (empty state), 1 hire (single flow), many hires (a scrollable hire history with the active one pinned); very long slugs/agent names truncate with title; a network drop mid-flow keeps the last confirmed phase and re-syncs on reconnect (never shows an unsettled coin as settled).++## Definition of done+- [ ] Reachable from `/agent-screen` (and settled hires visible on `/agents-live`).+- [ ] Real x402 settlement + on-chain invocation tx visible (network tab + explorer links resolve).+- [ ] Hover / active / focus states on quote card, receipt card, and explorer links.+- [ ] All five states implemented.+- [ ] No console errors or warnings from this code.+- [ ] `npm test` passes; `tests/a2a-hire-phases.test.js` added for the pure mapping + cap math.+- [ ] Verified live in a browser against `npm run dev` (port 3000): a real hire settles and the receipt links resolve on the explorer.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag: `feature`) — e.g. "Live Agent Commerce: watch one agent hire another over x402, settle USDC, and prove the work with an on-chain receipt." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. The hire flow settles in USDC over generic x402 rails and never references any other token; never name or promote a non-$THREE mint anywhere in the visualizer or narration.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. The coin-transfer animation fires only on the real `settled` frame; receipt links use real signatures.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/04-coin-world-tour.md b/docs/live-agent-tasks/04-coin-world-tour.mdnew file mode 100644index 000000000..21ed70b03--- /dev/null+++ b/docs/live-agent-tasks/04-coin-world-tour.md@@ -0,0 +1,78 @@+# 04 — Coin World Tour++> **Mission (one line):** An agent gives a live, first-person walking tour of $THREE and launched-coin 3D worlds, streaming its walkthrough to the wall while it commentates trending coins in the activity log.++## The watchable moment+On `/agents-live` a card shows a first-person view: the agent is literally walking through the $THREE 3D world — gliding past the lobby, into the arena — while the activity log narrates "Now entering the arena. Trending right now: live launches climbing the feed." A viewer clicks through to `/agent-screen?agentId=…` and watches the full walkthrough at size, the camera bobbing with each step, commentary scrolling. It reads like a Twitch travel stream through a coin's universe — "wait, an AI is touring a 3D world and talking about the market?"++## Who benefits+- **Viewer:** an ambient, guided way to explore the platform's 3D worlds and discover what's trending, hosted by an agent.+- **Agent owner:** their agent becomes a tour guide/host, a personality surface that drives traffic into the worlds and the launch feed.+- **Platform:** turns the existing 3D worlds (`worlds-lobby`, `arena-world`) and the launch feed into watchable content, linking `/agents-live`, the worlds, and `/launches`.++## Where it lives+- **Surface:** both — a card on `/agents-live` (the streamed walkthrough) and the hero panel on `/agent-screen?agentId=…`.+- **Entry points (verified to exist):**+ - `pages/agents-live.html` / `src/agents-live.js`+ - `pages/agent-screen.html` / `src/agent-screen.js`+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient`)+ - `src/worlds-lobby.js` (`bootLobby`)+ - `src/play/arena-world.js` (`ArenaWorld`)+ - `workers/agent-screen-pool/index.js` (on-demand Playwright caster pool)+ - `api/agent/watch-intent.js` (signals which agents to cast) + `api/agent/watch-wanted.js`+ - `api/pump/trending.js` (`GET /api/pump/trending` — Birdeye → pump.fun fallback)++## Data flow (source → transform → render)+1. **Source:** the Playwright caster (`workers/agent-screen-pool`) opens the 3D world route (the `worlds-lobby` / `ArenaWorld` scene) in a real headless browser and drives the avatar along a tour path; commentary context comes from `GET /api/pump/trending`.+2. **Transform:** the caster captures screenshots of the first-person walkthrough at the pool's frame cadence; trending coins are normalized into short commentary lines (`{ symbol, rank, where: 'lobby'|'arena' }`).+3. **Transport:** the caster pushes frames + narration to `POST /api/agent-screen-push` (`type: 'screenshot'` for the canvas frame, `type: 'analysis'` for commentary), authenticating with the pool's `SCREEN_WORKER_SECRET`. Viewers subscribe over `GET /api/agent-screen-stream`; a viewer watching a card pings `POST /api/agent/watch-intent` so the pool keeps the tour cast.+4. **Render:** the screenshot frames paint the live screen canvas (`src/agent-screen.js` / the card canvas in `src/agents-live.js`); commentary appears as `analysis` lines in the activity log.++## Build spec+1. Add a tour mode to the caster (`workers/agent-screen-pool/index.js`): when an agent is configured for "world tour", navigate Playwright to the 3D world route, wait for `bootLobby` / `ArenaWorld` to signal ready, then drive the avatar along a fixed waypoint loop (lobby → portals → arena → back), capturing frames at the existing cadence.+2. Expose a ready/hook in `src/worlds-lobby.js` and `src/play/arena-world.js` so the caster can detect scene-loaded and request waypoint moves deterministically (a small `window.__tour` API: `ready()`, `goTo(waypoint)`) — drive the real camera/avatar, no faked motion.+3. On each waypoint, fetch `GET /api/pump/trending`, pick the top trending entries, and `screenPush` a commentary line tied to the current location ("In the arena — top of the feed right now: …"). Throttle trending fetches (cache ~20s) to respect rate limits.+4. In `src/agents-live.js`, ensure tour cards render the `screenshot` frames on the card canvas and the latest commentary in `.al-card-action`; keep the existing activity-terminal fallback when frames go stale.+5. In `src/agent-screen.js`, the screenshot frames already paint the hero canvas — add a subtle "TOUR" badge + current-waypoint label overlay (from the commentary sidecar) with hover to reveal the trending list.+6. Wire `watch-intent` pinging from the tour card/panel (already the pattern in `agents-live.js`) so the pool spins the caster up on demand and tears it down when nobody watches.++## Files to create / modify+- `workers/agent-screen-pool/index.js` — tour navigation mode (waypoint loop, frame capture) (modify).+- `src/worlds-lobby.js` — `window.__tour` ready/goTo hook driving the real camera (modify).+- `src/play/arena-world.js` — same ready/goTo hook for the arena scene (modify).+- `src/agent-screen.js` — TOUR badge + waypoint/trending overlay (modify).+- `src/agents-live.js` — render tour screenshots + commentary on the card (modify, if not already generic).+- `pages/agent-screen.html` — overlay markup for the tour badge (modify).+- `tests/tour-commentary.test.js` — unit test for the pure trending→commentary-line mapping (create).++## Real integrations (no mocks, ever)+- 3D worlds: real `worlds-lobby` / `ArenaWorld` scenes driven in a real Playwright browser by `workers/agent-screen-pool`.+- `GET /api/pump/trending` — real trending feed (Birdeye → pump.fun fallback).+- Transport: `api/agent-screen-push.js` (pool worker via `SCREEN_WORKER_SECRET`) + `api/agent-screen-stream.js`.+- On-demand casting: `api/agent/watch-intent.js` + `api/agent/watch-wanted.js`.+- Credentials: `SCREEN_WORKER_SECRET` (≥16 chars, gates the pool push), Birdeye key for trending, pool browser config. Locate in `.env` / `vercel env`; if missing, ask once then proceed.++## Every state designed+- **Loading:** card canvas shows a skeleton + "spinning up the tour…" while the pool launches the browser and the scene loads.+- **Empty:** if no one is watching, the activity-terminal fallback explains "Tour idle — click Watch to send the guide back into the world." (the watch-intent re-spins the caster).+- **Error:** scene fails to load → the caster reports "world unavailable, retrying" and falls back to the activity terminal; trending feed down → commentary continues from the worlds without market lines (never silent).+- **Populated:** the hero state — first-person walkthrough frames + location-aware commentary.+- **Overflow:** 0 trending coins (tour continues, commentary on the world only), 1 (single mention), 1000 (top-N only); very long symbols truncate in the overlay; frame staleness > 6s falls back to the terminal as the wall already does.++## Definition of done+- [ ] Reachable from `/agents-live` and `/agent-screen` via real navigation; watch-intent spins the caster.+- [ ] Real Playwright frames of the real 3D world; real trending data in commentary (network tab).+- [ ] Hover / active / focus states on the Watch button, TOUR badge, and trending overlay.+- [ ] All five states implemented.+- [ ] No console errors or warnings from this code.+- [ ] `npm test` passes; `tests/tour-commentary.test.js` added for the pure mapping.+- [ ] Verified live in a browser against `npm run dev` (port 3000): the walkthrough streams and commentary references real trending coins.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag: `feature`) — e.g. "World Tour: an agent now walks you through the $THREE 3D worlds live, commentating what's trending." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. $THREE is the only coin the tour *promotes*. The trending commentary is generic launch-feed plumbing rendering runtime coins from the feed — describe them factually, never recommend, name as a buy, or hardcode any non-$THREE mint. The hosted world the tour markets is $THREE's.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. The walkthrough is a real browser driving the real scene; waypoint motion moves the real camera.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/05-live-avatar-forge.md b/docs/live-agent-tasks/05-live-avatar-forge.mdnew file mode 100644index 000000000..00baeb376--- /dev/null+++ b/docs/live-agent-tasks/05-live-avatar-forge.md@@ -0,0 +1,73 @@+# 05 — Live Avatar Forge++> **Mission (one line):** An agent takes a text prompt and forges a 3D avatar on camera — the GLB materializing in the avatar panel, then auto-rigging and animating itself — a real "watch it create" generation moment.++## The watchable moment+On `/agent-screen?agentId=…` a viewer (or the task bar) drops a prompt: "a friendly round robot mascot, glossy white plastic." The activity log narrates "Forging on the free TRELLIS lane…", a progress state ticks through real generation stages, and then a GLB *appears* in the Avatar Cam panel via the three.ws viewer — and seconds later it starts breathing in an `idle` clip and `wave`s. From a sentence to a rigged, animated 3D character, live. It's the kind of thing people screenshot mid-generation.++## Who benefits+- **Viewer:** watches a real text-to-3D pipeline produce a usable, animated avatar — generative magic with no install, no cost.+- **Agent owner:** their agent demonstrates a creative skill on demand; forged avatars can become the agent's own look or shareable assets.+- **Platform:** showcases the free NVIDIA NIM TRELLIS forge + the universal avatar animation system, linking the forge, the viewer, and the avatar pipeline into one live demo.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel (the forge + avatar viewer); a card on `/agents-live` shows the latest forged avatar.+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (task bar + Avatar Cam panel)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient`)+ - `mcp-server/src/tools/forge-free.js` (`forge_free` — free TRELLIS text→3D, returns `glbUrl` + viewer link)+ - `mcp-server/src/tools/forge-avatar.js` (avatar-shaping path)+ - `src/animation-manager.js` (`AnimationManager`, `play('idle')`, `playOnce('wave')`, `supportsCanonicalClips()`)+ - `src/glb-canonicalize.js` (bone-name canonicalization for retarget) + `src/animation-retarget.js`++## Data flow (source → transform → render)+1. **Source:** a prompt from the `/agent-screen` task bar or a viewer queue. The forge runs `forge_free` (drives `/api/forge` on the free NVIDIA NIM Microsoft TRELLIS text→3D lane) — no payment, no key, no wallet.+2. **Transform:** generation proceeds through real stages (queued → geometry → texturing → GLB ready). `forge_free` returns a durable `glbUrl`, a three.ws viewer link, the tier used, and the backend that produced it.+3. **Transport:** the agent `screenPush`es each stage as `POST /api/agent-screen-push` `{ frame: { activity, type: 'analysis' } }`, and the final frame carries the `glbUrl` + viewer link in the sidecar. Viewers receive it over `GET /api/agent-screen-stream`.+4. **Render:** the activity log narrates each stage; when the `glbUrl` arrives, `src/agent-screen.js` loads it into the Avatar Cam panel (the same meshopt-aware `GLTFLoader` it already builds), canonicalizes its bones via `glb-canonicalize.js`, retargets the pre-baked clips, and plays `idle` then `wave` — gated by `AnimationManager.supportsCanonicalClips()`.++## Build spec+1. Add a forge action to the task bar in `src/agent-screen.js`: a prompt input + "Forge" button that posts the prompt to the agent's forge path (the agent runs `forge_free`). Wire hover/active/focus states; disable while a forge is in flight.+2. The forge loop (`workers/agent-forge/index.js`, new) calls `forge_free`, and at each real generation stage `screenPush`es a `type: 'analysis'` line; the final push includes `glbUrl` + `viewerUrl` in the frame sidecar. Progress is driven by the real pipeline stages only — no `setTimeout` fake bar.+3. In `src/agent-screen.js`, on the final frame, load `glbUrl` into the Avatar Cam scene using the existing `getAvatarLoader()` meshopt loader; clone via `SkeletonUtils`, run `glb-canonicalize.js` bone mapping, then drive `AnimationManager`: `await play('idle')`, then `playOnce('wave', { settleTo: 'idle' })`.+4. If `supportsCanonicalClips()` is false (non-humanoid/no skin), display the GLB statically in the viewer with a "static model — no rig to animate" note rather than forcing a T-pose.+5. Add a viewer-link button that opens the returned three.ws viewer URL in a new tab (`rel="noopener"`), and a "use as agent avatar" affordance that points at the existing avatar-set flow.+6. In `src/agents-live.js`, render the latest forged avatar thumbnail (first frame after load) + "forged: <prompt>" in `.al-card-action` so the wall shows fresh creations.++## Files to create / modify+- `workers/agent-forge/index.js` — run `forge_free`, push staged progress + final GLB url (create).+- `src/agent-screen.js` — task-bar forge input, load+canonicalize+animate the GLB, viewer link (modify).+- `pages/agent-screen.html` — forge prompt input + "use as avatar" / viewer-link buttons (modify).+- `src/agents-live.js` — show latest forged avatar + prompt on the card (modify).+- `tests/forge-frame.test.js` — unit test for the pure stage→narration + final-frame sidecar parse (create).++## Real integrations (no mocks, ever)+- `forge_free` (`mcp-server/src/tools/forge-free.js`) → `/api/forge` on the **free** NVIDIA NIM Microsoft TRELLIS text→3D lane — real GLB generation, no payment.+- GLB load/animation: real meshopt-aware `GLTFLoader`, `glb-canonicalize.js` + `animation-retarget.js`, `AnimationManager`.+- Transport: `api/agent-screen-push.js` + `api/agent-screen-stream.js`.+- Credentials: `NVIDIA_API_KEY` server-side for the forge lane, `AGENT_JWT`/`AGENT_ID` for the worker push. The free lane needs no payment/wallet. Locate in `.env` / `vercel env`; if missing, ask once then proceed.++## Every state designed+- **Loading:** the Avatar Cam panel shows a skeleton + a real staged progress label ("texturing…") driven by actual pipeline frames; the Forge button shows an in-flight spinner state.+- **Empty:** before any forge, the panel reads "Type a prompt and watch a 3D avatar get built, rigged, and animated — live." with the prompt input focused.+- **Error:** generation failure → an actionable line ("forge lane busy — retrying" or "prompt rejected, try a concrete object") with a retry affordance; GLB load failure → "model produced but failed to load — open in viewer" link; never a silent void.+- **Populated:** the hero state — GLB loaded, breathing in `idle`, waving.+- **Overflow:** empty prompt is blocked with inline guidance; a very long prompt is trimmed to the TRELLIS ~77-char conditioning window with a note; rapid repeated forges queue (one in flight at a time); a non-riggable GLB shows static with the note.++## Definition of done+- [ ] Reachable from `/agent-screen` (and forged avatars visible on `/agents-live`).+- [ ] Real `forge_free` call visible in the network path; a real GLB loads and animates.+- [ ] Hover / active / focus states on the Forge button, prompt input, and viewer link.+- [ ] All five states implemented.+- [ ] No console errors or warnings from this code.+- [ ] `npm test` passes; `tests/forge-frame.test.js` added for the pure stage/sidecar logic.+- [ ] Verified live in a browser against `npm run dev` (port 3000): a prompt produces a GLB that loads, rigs, and animates.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag: `feature`) — e.g. "Live Avatar Forge: type a prompt and watch an agent build, rig, and animate a 3D avatar in real time, free." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Avatar forging has no token surface — never introduce one; never name or promote any non-$THREE mint in prompts, copy, or narration.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Progress is driven by real TRELLIS pipeline stages; the GLB is a real generated artifact.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/06-treasury-autopilot-dashboard.md b/docs/live-agent-tasks/06-treasury-autopilot-dashboard.mdnew file mode 100644index 000000000..4038c7cfb--- /dev/null+++ b/docs/live-agent-tasks/06-treasury-autopilot-dashboard.md@@ -0,0 +1,73 @@+# 06 — Treasury Autopilot Dashboard++> **Mission (one line):** An agent runs its own treasury live on screen — plain-English spend policies firing real $THREE buybacks and holder distributions while its wallet balance ticks in front of you.++## The watchable moment+On `/agent-screen?agentId=…` the screen canvas shows a treasury cockpit: a big live SOL/$THREE balance, a runway gauge, and a policy-rules panel written in plain English ("Buy back $THREE when the treasury holds more than 0.5 SOL; distribute fees to holders weekly"). When a cycle fires, a toast slides in — *"Bought back 412,000 $THREE for 0.18 SOL"* — the balance drops in real time, and the activity log gains a timestamped line with the on-chain tx link. The emotion: trust. You are watching an autonomous entity manage money correctly, within caps it cannot exceed.++## Who benefits+- **Viewer:** sees an agent transparently fund its own existence and reward $THREE holders — proof the economy is real, not slideware.+- **Agent owner:** a glanceable control surface for the autopilot they armed, with spend caps and runway visible, plus a "run one cycle now" button.+- **Platform:** every executed buyback/distribution is a $THREE demand event and a holder-facing changelog/feed moment; links treasury → launches → holder rewards.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel (cockpit rendered into the screen canvas + a dedicated policy panel)+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (panel host: `boot(id)`, `saveLayout`, the panel DOM with `data-panel` and the `#asc-screen-canvas`)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient(agentId, handlers)` — `frame`/`log`/`dark` events)+ - `api/agents/autopilot.js` (owner-only treasury autopilot: `GET` policy + compiled rules + runway, `POST .../compile`, `PUT` arm/disarm/edit, `POST .../run`)+ - `api/pump/autopilot.js` (per-coin buyback/distribute policy on `pump_autopilot`, scoped to coins the caller owns)+ - `api/_lib/treasury-autopilot.js` (`getAutopilot`, `setAutopilot`, `compilePolicyFromText`, `runAutopilotCycle`, `computeRunway`)+ - `api/_lib/agent-trade-guards.js` (`enforceSpendLimit`, `getDailySpendLamports`, `validateSolanaAddress` — the hard caps)+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` (push the cockpit frame + activity lines; render on the wall too)++## Data flow (source → transform → render)+1. **Source:** `GET /api/agents/:id/autopilot` → `{ policy, rules, runway }` from `api/_lib/treasury-autopilot.js`; agent wallet balance from the agent-wallet helpers (real Solana RPC, never a constant). Per-coin buyback/distribute config from `GET /api/pump/autopilot`.+2. **Transform:** compile the plain-English policy via `compilePolicyFromText` (already wired in `POST /api/agents/:id/autopilot/compile`) into the structured rules shown; compute runway with `computeRunway`; price SOL→USD via the guards' `lamportsToUsd` path so caps render in USD.+3. **Transport:** the autopilot cycle (`POST /api/agents/:id/autopilot/run`, also driven by the existing crons) emits an activity row into `agent_actions`; a caster (or the agent itself) renders the cockpit to a PNG and `POST /api/agent-screen-push` with `{ frame: { data, activity, type:"analysis" } }`. Viewers read `GET /api/agent-screen-stream?agentId=…` (`frame` + `log` events). The DB-`agent_actions` fallback in the stream means the cockpit's history shows even with no live caster.+4. **Render:** balance number, runway gauge, and policy-rules panel in the DOM; each fired action becomes a `toast(msg)` (the existing helper in `src/agent-screen.js`) plus an activity-log line with the explorer tx URL.++## Build spec+1. **Cockpit module** `src/agent-screen-treasury.js`: given `agentId`, fetch `GET /api/agents/:id/autopilot` and the agent wallet balance; render a balance header, a runway gauge (SVG arc from `computeRunway`), a **Policy Rules** list (plain-English lines from the compiled policy, each tagged armed/paused), and a **Spend Caps** row (`daily_usd`, `per_tx_usd` from `meta.spend_limits` via the guards) shown read-only to viewers, editable to the owner.+2. **Owner controls:** when the viewer is the owner (the API returns owner scope; non-owners get 403 on writes), render Arm/Disarm, an editable policy textarea that calls `POST .../compile` for a live preview, a Save (`PUT`), and a **Run one cycle now** button (`POST .../run`). Wire CSRF + bearer exactly as the endpoint expects.+3. **Live updates:** subscribe with `createAgentScreenClient(agentId, { onLog, onFrame })`. On each new `log` entry of type buyback/distribute, fire `toast(...)`, prepend the activity line (with tx link), and re-fetch the balance so it drops in real time.+4. **Wall frame:** render the cockpit to an offscreen canvas and push it via `agent-screen-push` so the agent's `/agents-live` card shows the treasury view, not a blank screen.+5. **Mount:** add a "Treasury" panel toggle in `src/agent-screen.js` (same `data-panel` pattern as Avatar Cam), persisted in the layout via `saveLayout`.+6. **Coin scope:** when the agent owns launched $THREE-economy coins, surface the per-coin buyback/distribute toggles from `api/pump/autopilot.js`; never hardcode a mint — read the owner's `pump_agent_mints`.++## Files to create / modify+- `src/agent-screen-treasury.js` — cockpit renderer, owner controls, live wiring (new)+- `src/agent-screen.js` — register the Treasury panel + layout persistence (modify)+- `src/agent-screen.css` (or the existing screen stylesheet) — cockpit, gauge, toast, panel styles (modify)+- No API changes required: `api/agents/autopilot.js`, `api/pump/autopilot.js`, `api/_lib/treasury-autopilot.js`, `api/_lib/agent-trade-guards.js`, `api/agent-screen-push.js`, `api/agent-screen-stream.js` already expose everything.++## Real integrations (no mocks, ever)+- Real Solana RPC for the live wallet balance (agent-wallet helpers) — never a hardcoded number.+- Real autopilot engine (`api/_lib/treasury-autopilot.js`) and real hard caps (`api/_lib/agent-trade-guards.js`); buybacks/distributions are real on-chain txs with real explorer URLs.+- Credentials: Solana RPC + Upstash Redis in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** skeleton balance + skeleton policy rows (shimmer), not a spinner.+- **Empty:** no policy armed → "This agent's treasury is idle. Arm a policy to start autonomous $THREE buybacks." with an Arm CTA (owner) / explainer (viewer).+- **Error:** balance/RPC failure → inline "Couldn't reach Solana RPC — retrying" with a Retry button; write failure (403) → "Only the owner can change this policy." Never a silent fail.+- **Populated:** live balance, runway gauge, plain-English rules, toasts on each action — the hero state.+- **Overflow:** 0 rules, 1 rule, 50+ rules (scroll the panel), very long policy text (clamp + expand), mid-cycle RPC drop (last-known balance with a "stale" badge until the next poll).++## Definition of done+- [ ] Reachable from `/agent-screen` via the Treasury panel toggle; visible on the `/agents-live` card frame.+- [ ] Real `GET /api/agents/:id/autopilot` + real balance call visible in the network tab.+- [ ] Hover / active / focus states on Arm, Save, Run-now, and the policy textarea.+- [ ] All five states implemented.+- [ ] Toast fires and balance updates on a real `POST .../run` cycle.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a unit test for the runway-gauge math / policy-line formatter.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (e.g. tag `feature`): "Agents now run a live treasury cockpit on their screen — watch autonomous $THREE buybacks and holder distributions execute in real time, with spend caps and runway in view." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Buybacks/distributions promote $THREE only. The per-coin panel renders the owner's own launch records at runtime (generic plumbing) — never hardcode or promote a non-$THREE mint.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. The balance is a real RPC read.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/07-watch-agent-work-screenshare.md b/docs/live-agent-tasks/07-watch-agent-work-screenshare.mdnew file mode 100644index 000000000..8c66ff504--- /dev/null+++ b/docs/live-agent-tasks/07-watch-agent-work-screenshare.md@@ -0,0 +1,75 @@+# 07 — Watch an Agent Work (Live Screenshare)++> **Mission (one line):** The flagship "how is it doing that?" moment — a real browser, driven by an agent, completing an actual multi-step web task live, frame by frame, narrated click by click.++## The watchable moment+On `/agents-live` a card lights up the instant you look at it; click through to `/agent-screen?agentId=…` and you are watching a real Chromium window: the agent reads a page, scrolls, types into a form, clicks "search", waits for results, picks one, fills a booking field. Every action lands in the activity log a beat before it happens on screen — *"Reading availability table…"*, *"Typing arrival date 2026-07-14"*, *"Clicking Reserve"*. It is not a screen recording. It is happening now, and you can feel the agent thinking. The emotion: disbelief, then trust.++## Who benefits+- **Viewer:** the single most shareable artifact on the platform — a synthetic worker doing real work, transparently.+- **Agent owner:** proof their agent can execute real-world tasks; a live demo reel that runs on demand without a per-agent idle browser bill.+- **Platform:** the on-demand caster pool means ANY agent can stream live with cost scaling to viewers, not agents — the defining capability of the wall.++## Where it lives+- **Surface:** both — `/agents-live` card (live frames) and `/agent-screen?agentId=…` (full screen + synchronized narration log)+- **Entry points (verified to exist):**+ - `pages/agents-live.html` / `src/agents-live.js` (the wall; cards POST watch-intent for what's on screen)+ - `pages/agent-screen.html` / `src/agent-screen.js` (`#asc-screen-canvas`, activity-log panel)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient` — `frame` + `log` + `dark` handlers, EventSource auto-reconnect)+ - `api/agent/watch-intent.js` (`POST {agentId}` → `ZADD screen:wanted`, 2-min prune window)+ - `workers/agent-screen-pool/index.js` (Playwright caster: polls `watch-wanted`, maintains ≤ `MAX_BROWSERS` pages, screenshots at `FRAME_MS`, pushes JPEG to `agent-screen-push` and the 3D desk push)+ - `api/agent-screen-push.js` (`POST {agentId, frame:{ data, activity, type }}`; pool authenticates with `SCREEN_WORKER_SECRET`, 90s frame TTL, 50-entry log)+ - `api/agent-screen-stream.js` (SSE: `frame`/`log`/`dark`/`ping`; falls back to `agent_actions` when no caster)++## Data flow (source → transform → render)+1. **Source:** a real web task script (research / form-fill / booking) executed by the caster in `workers/agent-screen-pool` using Playwright (or Stagehand for natural-language steps). The task plan comes from the agent's brain (`api/brain/chat.js`) so each step has a narration string.+2. **Transform:** each Playwright action emits a `{ activity, type }` narration *before* the action and a JPEG screenshot *after* — so the log leads the picture by one beat, the detail that makes it feel intentional.+3. **Transport:** `POST /api/agent-screen-push` per frame (`type:"screenshot"` for pixels, `type:"activity"` for narration-only lines). Viewers consume `GET /api/agent-screen-stream?agentId=…`. `POST /api/agent/watch-intent` from every visible card keeps the agent in the `screen:wanted` set so the pool keeps casting it.+4. **Render:** `#asc-screen-canvas` paints the JPEG `data` URL; the activity-log panel appends each `log` entry with a type icon; the `/agents-live` card paints the same frame downscaled.++## Build spec+1. **Watch-intent loop (client):** in `src/agents-live.js` and `src/agent-screen.js`, POST `api/agent/watch-intent` for the agent(s) currently on screen every ~20s while visible; stop on tab blur / unmount. This is what wakes the pool.+2. **Caster task runner:** in `workers/agent-screen-pool/index.js`, add a task-driven mode: for a wanted agent that has a defined live task, run an ordered Playwright sequence (goto → read → type → click → wait-for-result) instead of just screenshotting a static page. Before each step, push `type:"activity"` narration; after each step, push `type:"screenshot"` with `data`.+3. **Narration source:** generate the step plan + per-step narration from `api/brain/chat.js` (real LLM router) so the words match the page, not a canned list. Cache the plan per task run.+4. **Real task library:** ship at least one genuinely real, safe end-to-end task (e.g. public research + structured extraction, or a sandbox/staging booking form) — no fabricated success screens, no fake form targets.+5. **Reconnection polish (client):** `createAgentScreenClient` already uses EventSource retry; on `dark` show a "reconnecting / agent paused" overlay and keep pinging watch-intent so the pool re-casts; clear it on the next `frame`.+6. **Loading polish:** while the pool spins a browser (first frame can take seconds), show a skeleton "Booting a live browser for this agent…" with a progress shimmer driven by real `open`→first-`frame` timing, not a fake bar.+7. **Pool lifecycle:** confirm teardown — when no intent for ~2 min, the page closes (already in the worker) and the stream goes `dark`, falling back to the `agent_actions` activity view.++## Files to create / modify+- `workers/agent-screen-pool/index.js` — task-driven caster mode (ordered steps + lead narration) (modify)+- `workers/agent-screen-pool/tasks/` — at least one real task script (research/extract or sandbox booking) (new)+- `src/agents-live.js` — watch-intent ping loop for visible cards (modify if not already present)+- `src/agent-screen.js` — loading skeleton + `dark`/reconnect overlay tied to stream events (modify)+- No new API: `watch-intent.js`, `agent-screen-push.js`, `agent-screen-stream.js`, `api/brain/chat.js` already exist.++## Real integrations (no mocks, ever)+- Real Playwright/Chromium in `workers/agent-screen-pool` driving real URLs.+- Real `api/brain/chat.js` LLM router for step planning + narration.+- Real `agent-screen-push`/`stream` transport; real `watch-intent`/`watch-wanted` pool signaling.+- Credentials: `SCREEN_WORKER_SECRET` (must match API), brain/LLM keys, Upstash Redis — in `.env` / pool env. If missing, ask once then proceed.++## Every state designed+- **Loading:** "Booting a live browser…" skeleton with real open→first-frame timing; never a fake progress bar.+- **Empty:** no caster yet → activity-only fallback from `agent_actions` with "Look at this agent to bring it live" (watch-intent triggers the pool).+- **Error:** task step fails → narration logs the real failure ("Form rejected the date — retrying") and the agent recovers or ends gracefully; `dark` → reconnect overlay. Never a silent freeze.+- **Populated:** live JPEG frames + one-beat-ahead narration — the hero state.+- **Overflow:** many concurrent watched agents (pool bounded by `MAX_BROWSERS`, least-wanted evicted), very long narration (clamp), mid-task network drop (overlay + resume), 0 frames (skeleton holds).++## Definition of done+- [ ] Reachable: looking at a card/screen spins a real browser via the pool.+- [ ] Real screenshot frames + real narration visible in the network tab (SSE `frame`/`log`).+- [ ] Hover / active / focus states on card + screen controls.+- [ ] All five states implemented (loading skeleton + dark/reconnect overlay included).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for the task-step sequencer / narration-lead ordering.+- [ ] Verified live in a browser against `npm run dev` (port 3000) with the pool running locally.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Watch any agent do real web work live — a real browser fills forms and completes tasks on screen, narrated click by click, spun up on demand the moment you look." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Tasks must never browse to, name, or transact another token; if a task touches a token it is $THREE or a clearly-synthetic placeholder.+- No mocks, no fake data, no `setTimeout` fake progress, no fabricated success screens, no TODOs, no stubs. Real browser, real pages.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/08-agent-stage-show.md b/docs/live-agent-tasks/08-agent-stage-show.mdnew file mode 100644index 000000000..8230f6480--- /dev/null+++ b/docs/live-agent-tasks/08-agent-stage-show.md@@ -0,0 +1,74 @@+# 08 — Agent Stage Show++> **Mission (one line):** An agent hosts a live show that never goes dead — beats auto-rotate, audience questions get answered, top tippers get shouted out, all in the agent's own voice with its avatar performing.++## The watchable moment+On `/agent-screen?agentId=…` the agent is mid-show: it opens, riffs (banter), reads an audience question typed into the task bar and answers it, calls out the night's top tipper, then runs a round of its format's game — and loops, forever, never silent. The avatar head emotes and lip-syncs to TTS; the activity log reads like a transcript with beat labels (OPENER / BANTER / ANSWER / TIP SHOUTOUT / GAME). The emotion: presence. Something is performing *for you*, right now, and it reacts when you speak.++## Who benefits+- **Viewer:** an always-live host they can talk to and tip; the wall has a heartbeat instead of idle cards.+- **Agent owner:** their agent becomes a personality with an audience and a tip ledger — reach + monetization.+- **Platform:** ties the task bar (input), TTS (voice), avatar animation (body), and the tip ledger (money) into one loop; a flagship reason to keep the tab open.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` (screen canvas = stage, avatar head = host, activity log = transcript, task bar = audience questions/tips)+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (stage host, avatar cam panel, task bar, `toast`)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient` — frame/log stream)+ - `multiplayer/src/stage-show.js` (`ShowDirector` + `BEAT` = OPENER / TIP_SHOUTOUT / ANSWER / BANTER / GAME; pure, testable; ranks tippers, queues questions, avoids repeating recent beats)+ - `multiplayer/src/feed.js` / `multiplayer/src/presence-token.js` (live audience + presence)+ - `api/brain/chat.js` (turns a chosen beat + context into the host's actual words)+ - `api/tts/speak.js` (+ `edge.js` / `eleven.js`) for voice; `src/animation-manager.js` for avatar emote/lip-sync clips+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` (push stage frames + transcript lines to the wall)++## Data flow (source → transform → render)+1. **Source:** `ShowDirector` (`multiplayer/src/stage-show.js`) decides the next beat from live state — pending tips, queued audience questions (from the task bar), recent beats, audience size.+2. **Transform:** the chosen `BEAT` + context becomes a brain prompt (`api/brain/chat.js`); the brain returns the host's words. `ShowDirector` ranks the tip ledger (integer atomic units) for shoutouts and bounds the question queue.+3. **Transport:** words → `api/tts/speak.js` (audio) + `src/animation-manager.js` (lip-sync/emote clip); the stage renders to a frame pushed via `api/agent-screen-push` (`type:"activity"`/`"analysis"`). Audience questions arrive from the task bar; tips from the live feed.+4. **Render:** avatar head speaks + emotes per beat; activity log appends a beat-labeled transcript line; `toast` on a fresh tip shoutout; the `/agents-live` card shows the stage frame.++## Build spec+1. **Director loop (client/host):** instantiate `ShowDirector({ stageId: agentId, hostName, format, startedAt })`. On a fixed cadence, ask the director for the next beat; if none is forced, it rotates BANTER/GAME so the show **never goes dead**. TIP_SHOUTOUT pre-empts; ANSWER drains the question queue.+2. **Beat → words:** send the beat kind + context to `api/brain/chat.js`; receive the host line. Keep `MAX_RECENT_BEATS` anti-repeat (already in the director) so the host doesn't loop the same filler.+3. **Voice + body:** pipe the line to `api/tts/speak.js`, play the audio, and drive lip-sync + a per-beat emote via `src/animation-manager.js` on the avatar-cam panel. Idle clip plays between beats so the avatar is never frozen.+4. **Audience questions:** wire the task bar so a submitted question calls `ShowDirector.enqueueQuestion` (bounded by `QUESTION_MAX_LEN` / `MAX_QUESTION_QUEUE`); show "queued — #N in line" feedback; the next ANSWER beat reads it back and responds.+5. **Tips + leaderboard:** feed validated, settled tips (from `multiplayer/src/feed.js`) into `ShowDirector.recordTip`; render a top-tippers leaderboard panel; fire TIP_SHOUTOUT + `toast` on a fresh tip.+6. **Stage frame to wall:** render the stage (host + current beat + leaderboard) to a canvas and `agent-screen-push` it so the agent's `/agents-live` card shows the live show.+7. **Mount:** add a "Stage" panel toggle in `src/agent-screen.js`, layout-persisted; reuse the avatar-cam render path.++## Files to create / modify+- `src/agent-screen-stage.js` — director loop, beat→brain→TTS→avatar wiring, leaderboard, question intake (new)+- `src/agent-screen.js` — Stage panel toggle + task-bar question hook + layout persistence (modify)+- `src/agent-screen.css` (screen stylesheet) — stage, leaderboard, beat-label, toast styles (modify)+- No engine changes: `multiplayer/src/stage-show.js`, `api/brain/chat.js`, `api/tts/speak.js`, `src/animation-manager.js`, `api/agent-screen-push.js` already exist.++## Real integrations (no mocks, ever)+- Real `api/brain/chat.js` LLM router for the host's words.+- Real `api/tts/speak.js` voice + real avatar lip-sync/emote via `src/animation-manager.js`.+- Real tips from `multiplayer/src/feed.js` (settled, on-chain atomic units) — never a fake tip array.+- Credentials: brain/LLM keys, TTS (`api/tts`) keys, Upstash Redis — in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** "Warming up the stage…" skeleton with the avatar in idle while the first beat generates.+- **Empty:** no audience / no tips yet → the show still runs (OPENER → BANTER → GAME) with "Ask a question or tip to join the show" prompt — it is never blank.+- **Error:** brain or TTS failure → the director falls to a safe BANTER beat and logs "voice unavailable — text only" instead of going silent; question-submit failure → inline retry.+- **Populated:** rotating beats, answered questions, tip shoutouts, lip-synced avatar — the hero state.+- **Overflow:** question flood (bounded queue drops oldest), 0/1/1000 tippers (leaderboard scrolls), very long question (clamp to `QUESTION_MAX_LEN`), mid-beat TTS drop (continue text-only).++## Definition of done+- [ ] Reachable from `/agent-screen` via the Stage panel; stage frame visible on the `/agents-live` card.+- [ ] Real brain + TTS calls visible in the network tab; real tips drive shoutouts.+- [ ] Hover / active / focus states on the task bar, tip leaderboard, and panel controls.+- [ ] All five states implemented; **the show never goes dead** (auto-rotating beats verified).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add/extend a `ShowDirector` test for beat rotation + question/tip ordering.+- [ ] Verified live in a browser against `npm run dev` (port 3000) — submit a question, see it answered.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Agents now host live stage shows — ask questions from the task bar, tip to get a shoutout, and watch the host perform in its own voice. The show never goes quiet." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Tips and any coin reference in banter are $THREE only — never name another token.+- No mocks, no fake data, no `setTimeout` fake progress, no canned tip arrays, no TODOs, no stubs. Real brain, real voice, real tips.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/09-sentiment-heatmap-3d.md b/docs/live-agent-tasks/09-sentiment-heatmap-3d.mdnew file mode 100644index 000000000..de7292135--- /dev/null+++ b/docs/live-agent-tasks/09-sentiment-heatmap-3d.md@@ -0,0 +1,73 @@+# 09 — Sentiment Heatmap 3D++> **Mission (one line):** A live 3D market-sentiment heatmap the agent narrates — a glowing grid/globe of tokens pulsing by momentum, with $THREE at the center and the agent calling out the movers.++## The watchable moment+On the screen canvas, a three.js field of tiles (or a globe of nodes) glows: green-hot tiles surge with positive momentum, cold blue ones fade, and the whole field breathes with the market. $THREE sits featured at the center, larger and labeled. As a token spikes, its tile flares and the agent's activity log calls it — *"$THREE momentum up 14% on rising volume"*, *"Cooling across the board, two movers heating up."* The camera drifts slowly. The emotion: the market made legible — and an agent that reads it aloud.++## Who benefits+- **Viewer:** an at-a-glance read of where attention is moving, narrated so they don't have to interpret raw data.+- **Agent owner:** their agent demonstrates real market intelligence, live and visual.+- **Platform:** showcases the intel stack (sentiment-pulse + pump-snapshot) as a beautiful, shareable surface; $THREE is the visual anchor.++## Where it lives+- **Surface:** both — `/agent-screen?agentId=…` (full 3D heatmap + narration log) and `/agents-live` card (downscaled heatmap frame)+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (`#asc-screen-canvas`, activity-log panel; Three.js already loaded for the avatar cam)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient` — frame/log)+ - `mcp-server/src/tools/sentiment-pulse.js` (`buildSentimentPulseTool` — momentum/sentiment source)+ - `mcp-server/src/tools/pump-snapshot.js` (`buildPumpSnapshotTool` — per-token price/volume/holders via Jupiter, Dexscreener, pump.fun, Helius)+ - `api/brain/chat.js` (turns the snapshot into the agent's spoken call-outs)+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` (push the rendered heatmap frame + narration to the wall)++## Data flow (source → transform → render)+1. **Source:** `buildSentimentPulseTool` for sentiment/momentum scores + `buildPumpSnapshotTool` for per-token price, volume, and holder deltas. $THREE (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) is always included and featured; the rest of the field is generic, coin-agnostic snapshot plumbing supplied at runtime.+2. **Transform:** normalize each token to a momentum value in [-1, 1] and a magnitude (volume) → tile color (cold→hot ramp) + tile scale/glow intensity. Rank movers; diff against the previous poll to detect spikes.+3. **Transport:** the heatmap renders client-side in three.js; a caster (or the agent) snapshots the canvas and `POST /api/agent-screen-push` (`type:"analysis"`) so the wall shows the same field. Narration call-outs are pushed as `type:"activity"` log lines, authored by `api/brain/chat.js`.+4. **Render:** three.js grid/globe in `#asc-screen-canvas`; activity log appends each mover call-out; the `/agents-live` card paints the downscaled frame.++## Build spec+1. **Data poller** `src/sentiment-heatmap-data.js`: poll sentiment-pulse + pump-snapshot on an interval (respect their rate limits), always pin $THREE first, normalize to `{ id, label, momentum, magnitude }[]`, and diff to surface spikes. Real fetches only.+2. **3D field** `src/sentiment-heatmap-3d.js`: a three.js scene of instanced tiles (grid) or nodes (globe); map momentum→color via a perceptually-even ramp, magnitude→scale/emissive; $THREE rendered larger, centered, labeled. Slow camera drift; smooth lerp on value changes (no popping). Reuse the loader/renderer pattern from the avatar cam.+3. **Narration:** on each spike/mover, build a compact context (top gainers/losers, $THREE delta) and call `api/brain/chat.js`; push the returned line as a `type:"activity"` log entry. Throttle so the log doesn't flood.+4. **Wall frame:** snapshot the canvas at a low cadence and `agent-screen-push` it so the agent's card shows the heatmap, not a blank screen.+5. **Legend + focus:** render a color/momentum legend and a clickable $THREE focus button that re-centers the camera on it. Hover a tile → tooltip with label + momentum + volume.+6. **Mount:** "Heatmap" panel toggle in `src/agent-screen.js`, layout-persisted.++## Files to create / modify+- `src/sentiment-heatmap-data.js` — poller + normalizer + spike diff (new)+- `src/sentiment-heatmap-3d.js` — three.js grid/globe renderer + camera + legend (new)+- `src/agent-screen.js` — Heatmap panel toggle + narration hook + layout persistence (modify)+- `src/agent-screen.css` (screen stylesheet) — legend, tooltip, focus-button styles (modify)+- Optional thin proxy `api/intel/heatmap.js` if the MCP tools aren't directly callable from the browser (front them server-side; no new data, just transport). No changes to the MCP tools themselves.++## Real integrations (no mocks, ever)+- Real `sentiment-pulse` + `pump-snapshot` (Jupiter / Dexscreener / pump.fun / Helius) — never a fabricated token list.+- Real `api/brain/chat.js` for the spoken call-outs.+- Real `agent-screen-push`/`stream` transport.+- Credentials: Helius / pump.fun / brain keys in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** dim tile lattice with a shimmer + "Reading the market…", not a spinner.+- **Empty:** snapshot returns only $THREE (or sparse data) → render $THREE alone, centered, with "Market quiet — watching $THREE." Never a black canvas.+- **Error:** data fetch fails → keep the last field rendered with a "stale — retrying" badge and a Retry control; never a silent freeze.+- **Populated:** the full glowing, drifting, narrated field — the hero state.+- **Overflow:** 1 token, hundreds of tokens (cap the field + paginate/cluster the tail), very long token labels (truncate in tooltip), mid-poll network drop (hold last frame + stale badge).++## Definition of done+- [ ] Reachable from `/agent-screen` via the Heatmap panel; frame visible on the `/agents-live` card.+- [ ] Real sentiment + snapshot calls visible in the network tab; real movers narrated.+- [ ] Hover / active / focus states on tiles, the legend, and the $THREE focus button.+- [ ] All five states implemented.+- [ ] No console errors or warnings; renders at a steady frame rate (no jank).+- [ ] Existing tests pass (`npm test`); add a unit test for the momentum→color/scale normalizer + spike diff.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "A live 3D market-sentiment heatmap now runs on agent screens — tokens glow by momentum with $THREE at the center, and the agent calls out the movers in real time." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. $THREE is featured/anchored; the rest of the field is generic runtime snapshot plumbing — the agent never names, recommends, or promotes any other token, in the viz or the narration. Other tiles render market data only; no shilling.+- No mocks, no fake data, no `setTimeout` fake progress, no fabricated token arrays, no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/10-copy-trade-mirror.md b/docs/live-agent-tasks/10-copy-trade-mirror.mdnew file mode 100644index 000000000..40a94bc3c--- /dev/null+++ b/docs/live-agent-tasks/10-copy-trade-mirror.md@@ -0,0 +1,74 @@+# 10 — Copy-Trade Mirror, Live++> **Mission (one line):** Watch an agent shadow a target wallet in real time — the source buys, the agent re-quotes and replicates through the firewall, and both trades land side by side with latency and fill on screen.++## The watchable moment+On the screen canvas, two columns: **Source** and **Mirror**. A trade hits the source wallet — a row flashes in on the left (*"Target bought 0.4 SOL of $THREE"*). Milliseconds later the agent re-quotes and a matching row flashes in on the right, sized by the configured rule, stamped with **latency 380ms** and the actual **fill** it got — guarded, capped, real. The activity log narrates the relay. The emotion: speed and discipline. You are watching an autonomous trader keep pace with a human, inside hard limits it cannot break.++## Who benefits+- **Viewer:** a live, legible demonstration of copy-trading — source vs. mirror, latency vs. fill, transparently.+- **Agent owner:** their agent mirrors a chosen wallet with sizing rules and spend guards they control.+- **Platform:** ties the strategies engine, the live trade stream, and the trade firewall into one watchable loop; proves real execution under guardrails.++## Where it lives+- **Surface:** both — `/agent-screen?agentId=…` (side-by-side source/mirror + latency/fill + log) and `/agents-live` card (the dual-column frame)+- **Entry points (verified to exist):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (`#asc-screen-canvas`, activity-log panel)+ - `src/shared/agent-screen-client.js` (`createAgentScreenClient` — frame/log)+ - `packages/strategies/src/index.js` (`copy()` client over `/api/copy/*`; `COPY_SIZING` = fixed / multiplier / pct_balance)+ - `api/pump/trades-stream.js` (SSE; `?mint=…` per-mint buy/sell via PumpPortal — detects the source trade)+ - `api/agents/agent-trade.js` (`POST /api/agents/:id/trade` — server-signed replication from the agent's own custodial wallet; `/quote` for re-quote)+ - `api/_lib/agent-trade-guards.js` (`enforceSpendLimit`, `getDailySpendLamports`, `validateSolanaAddress`, `SpendLimitError` — the hard caps, price-impact break, idempotency)+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` (push the dual-column frame + relay log to the wall)++## Data flow (source → transform → render)+1. **Source:** subscribe to the target wallet's activity. Trade detection rides `api/pump/trades-stream.js` (per-mint SSE) for the mints the target touches; the copy engine (`packages/strategies` `copy()` over `/api/copy/*`) defines the target wallet + sizing rule.+2. **Transform:** when a source buy/sell is detected, re-quote via `GET/POST /api/agents/:id/trade/quote` (expected out, price impact, fees, guard preview), size it per the rule (fixed / multiplier / pct_balance), and timestamp `detected→quoted→submitted` to compute latency.+3. **Transport:** execute through `POST /api/agents/:id/trade` (server-signed, firewall-enforced by `agent-trade-guards.js`). On fill, push a dual-column frame via `api/agent-screen-push` (`type:"trade"`) and a relay narration line (`type:"activity"`). Viewers read `api/agent-screen-stream`.+4. **Render:** Source column (target's trade) and Mirror column (the agent's replicated trade) with latency + actual fill + explorer tx link; the `/agents-live` card paints the dual-column frame.++## Build spec+1. **Mirror panel** `src/agent-screen-mirror.js`: render two columns (Source / Mirror), a header with the target wallet (truncated, copyable) and the active sizing rule, and a relay strip showing the most recent latency + fill.+2. **Source detection:** open `api/pump/trades-stream.js` for the relevant mint(s) and filter to the target wallet's trades. On a hit, immediately append the Source row and kick off the re-quote.+3. **Re-quote + size:** call `/api/agents/:id/trade/quote`, apply the configured `COPY_SIZING` rule, and show the previewed impact/guard status before submit. If a guard would block (over cap, impact too high), render a **blocked** row with the reason — never a silent skip.+4. **Replicate:** `POST /api/agents/:id/trade` with CSRF/bearer as the endpoint expects; on success append the Mirror row with `latency = submitted - detected`, the real fill amount, and the explorer URL. `SpendLimitError`/guard rejections render as actionable blocked rows.+5. **Live wiring:** subscribe via `createAgentScreenClient` so the columns/log update from the stream; fire a `toast` on each completed mirror.+6. **Wall frame:** render the dual-column view to a canvas and `agent-screen-push` it so the agent's card shows the live mirror.+7. **Controls (owner):** target wallet + sizing rule + the spend caps (`daily_usd`, `per_tx_usd`) shown read-only to viewers, editable to the owner through the existing trade-limits endpoints. Mount as a layout-persisted "Mirror" panel in `src/agent-screen.js`.++## Files to create / modify+- `src/agent-screen-mirror.js` — dual-column renderer, source detection, re-quote, replicate, latency/fill (new)+- `src/agent-screen.js` — Mirror panel toggle + owner controls + layout persistence (modify)+- `src/agent-screen.css` (screen stylesheet) — two-column, latency badge, blocked-row, toast styles (modify)+- No API changes: `packages/strategies`, `api/pump/trades-stream.js`, `api/agents/agent-trade.js`, `api/_lib/agent-trade-guards.js`, `api/agent-screen-push.js`/`stream.js` already exist.++## Real integrations (no mocks, ever)+- Real `api/pump/trades-stream.js` (PumpPortal) for source-trade detection.+- Real `api/agents/agent-trade.js` server-signed execution from the agent's custodial wallet, enforced by the real `agent-trade-guards.js` firewall (caps, price-impact break, idempotency).+- Real `packages/strategies` copy engine + real explorer tx URLs.+- Credentials: Solana RPC, PumpPortal/pump.fun, agent custody keys — in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** two skeleton columns + "Watching the target wallet…" while the source stream connects.+- **Empty:** no source trade yet → "No trades from the target yet — the mirror is armed and waiting." with the active rule shown.+- **Error:** stream drop → reconnect overlay; trade rejected by a guard → a **blocked** row with the reason (over daily cap / impact too high) and how to adjust — never a silent fail.+- **Populated:** paired source/mirror rows with latency + fill — the hero state.+- **Overflow:** rapid-fire source trades (queue + render in order, bound the list), 0/1/1000 rows (scroll/virtualize the tail), very long wallet labels (truncate + copy), mid-relay network drop (mark the in-flight row, resume on reconnect).++## Definition of done+- [ ] Reachable from `/agent-screen` via the Mirror panel; dual-column frame visible on the `/agents-live` card.+- [ ] Real `trades-stream` + real `agent-trade` calls visible in the network tab; real fills + explorer links.+- [ ] Hover / active / focus states on the wallet copy, rule selector, and rows.+- [ ] All five states implemented (blocked-by-guard row included).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a unit test for sizing math + latency computation + blocked-row mapping.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Watch an agent mirror a target wallet live — the source trade and the agent's guarded replica land side by side with latency and fill shown, every order inside hard spend caps." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. The mirror is generic, coin-agnostic plumbing that takes the source trade's mint at runtime — never hardcode, market, or recommend a non-$THREE mint anywhere in source or copy. $THREE remains the only coin the platform promotes.+- No mocks, no fake data, no `setTimeout` fake progress, no simulated fills, no TODOs, no stubs. Real trades, real guards.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/11-vanity-address-miner.md b/docs/live-agent-tasks/11-vanity-address-miner.mdnew file mode 100644index 000000000..98b2abdc7--- /dev/null+++ b/docs/live-agent-tasks/11-vanity-address-miner.md@@ -0,0 +1,75 @@+# 11 — Vanity Address Miner++> **Mission (one line):** An agent grinds a real Solana vanity keypair live — keyspace burning past at thousands of attempts/sec — until the address that starts with the brand prefix snaps into existence on screen.++## The watchable moment+On `/agent-screen?agentId=…` the screen canvas fills with a base58 keyspace counter spinning so fast it blurs: *attempts 4,182,330 · 38,900/sec · expected ~6.5M for "pump"*. A progress ring creeps toward the statistical-expectation mark while candidate addresses flicker by, each one *almost* right. Then the log freezes for a half-beat — *"MATCH"* — and the winning address resolves character by character: `pumpXk…`. The tension is a slot machine you know will eventually pay out; the payoff is a real, usable branded wallet. The emotion: suspense, then the dopamine hit of the reveal.++## Who benefits+- **Viewer:** a live cryptographic search they can feel — real odds, real compute, a real reveal, not a loading bar.+- **Agent owner:** a branded wallet (e.g. a `pump`-prefixed mint or treasury address) minted on demand, with the grind shown transparently so the result is verifiably earned, not pre-baked.+- **Platform:** vanity addresses feed directly into the launcher (`api/pump/launch-agent.js` accepts a client-supplied `mint_address` + `mint_secret_key_b64`) and into agent identity — the grind is the on-ramp to a branded $THREE-marked launch.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel (hero), with a compact attempts/sec ticker mirrored to the `/agents-live` card.+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (`#asc-screen-canvas`, activity-log panel, task bar)+ - `pages/agents-live.html` / `src/agents-live.js` (card mirror)+ - `mcp-server/src/tools/vanity-grinder.js` — tool `vanity_grinder` (params `prefix`/`suffix`/`ignoreCase`/`mnemonic`/`strength`/`maxIterations`; returns `address`, `privateKey64`, `iterations`, `estimatedIterations`, `durationMs`)+ - `api/agent-screen-push.js` (`POST {agentId, frame:{ data, activity, type }}`, `SCREEN_WORKER_SECRET`)+ - `api/agent-screen-stream.js` (SSE `frame`/`log`/`dark`/`ping`)+ - `src/shared/agent-screen-client.js` (`frame`/`log` handlers)++## Data flow (source → transform → render)+1. **Source:** the real `vanity_grinder` grind. The grinder in `mcp-server/src/tools/vanity-grinder.js` runs synchronous ed25519 keypair generation and yields periodically. To stream live, the runner instruments the grind loop to emit a progress sample every N iterations (real `iterations` + elapsed `Date.now()` delta → attempts/sec) — no synthetic counter.+2. **Transform:** compute live stats from real numbers: `attemptsPerSec = (iterations - lastIterations) / (now - lastTs)`; `expectedIterations = 58^prefixLength` (the grinder already computes `estimatedIterations`); `progress = min(1, iterations / expectedIterations)` for the ring (a probability indicator, clearly labeled "expected", never a guaranteed bar). Surface a few real candidate prefixes seen for texture.+3. **Transport:** the grind runs in a worker/MCP context (never the browser — keys must not touch the client). Every ~250ms it `POST`s `api/agent-screen-push` with `type:"analysis"` and an `activity` string (`"4.18M attempts · 38.9k/sec · expected ~6.5M"`); the canvas `data` is a rendered keyspace-visualization frame. On match it pushes one `type:"analysis"` reveal line with the **public address only** (never the secret) and a final `type:"screenshot"` reveal frame.+4. **Render:** `#asc-screen-canvas` paints the keyspace visualization + progress ring; the activity log appends each stats sample then the MATCH reveal; the `/agents-live` card shows the compact attempts/sec ticker.++## Build spec+Concrete, ordered steps. Each step names the file and what changes.+1. **Instrument the grinder for progress** — in `mcp-server/src/tools/vanity-grinder.js`, add an optional `onProgress({ iterations, elapsedMs, attemptsPerSec })` callback fired every `PROGRESS_EVERY` iterations (e.g. 50k) inside the existing yield point. Pure addition: when no callback is passed, behavior is unchanged (keep the existing return shape and pricing). Cover the callback firing in `tests/`.+2. **Live runner** — add a runner (worker or server route) that invokes `vanity_grinder` with `onProgress`, and for each progress sample renders a frame (server-side canvas, e.g. `@napi-rs/canvas` if already a dep, else a lightweight SVG→PNG) showing the spinning counter + expected-iterations ring, then `POST api/agent-screen-push` with `SCREEN_WORKER_SECRET`. Throttle pushes to ≤4/sec to respect the 90s frame TTL and Redis quota.+3. **Reveal step** — on grind completion, push one final `type:"analysis"` log line `MATCH · <address>` and a reveal frame that resolves the address character-by-character across 2–3 frames. The secret key (`privateKey64`/`mnemonic`) is returned to the **owner only** through the secure tool channel — never pushed to the screen stream, never logged in `agent_actions`.+4. **Trigger from the task bar** — accept a grind request ("grind a wallet starting with pump") routed through the agent runtime; validate prefix is base58 and length ≤ 6 (longer prefixes are astronomically expensive — clamp and warn in the log with the real expected iterations).+5. **Card mirror** — in `src/agents-live.js`, render the latest `analysis` activity line (attempts/sec) on the card so the wall shows the grind is live.+6. **Hand-off to launch** — on match, surface a real CTA in the log/UI: "Use this address to launch" linking the address + secret (owner-gated) into `api/pump/launch-agent.js` as `mint_address` + `mint_secret_key_b64`. Coin-agnostic plumbing only; the only coin promoted is $THREE.++## Files to create / modify+- `mcp-server/src/tools/vanity-grinder.js` — add `onProgress` callback to the grind loop (modify)+- `mcp-server/src/tools/__tests__/` or `tests/` — assert `onProgress` fires with monotonic `iterations` and a positive `attemptsPerSec` (new/modify)+- `workers/…` or `api/…` — live grind runner that renders frames and pushes to `agent-screen-push` (new)+- `src/agent-screen.js` — keyspace/reveal rendering polish for the grind frame + reveal CTA (modify)+- `src/agents-live.js` — compact attempts/sec ticker on the card (modify)++## Real integrations (no mocks, ever)+- Real `vanity_grinder` ed25519 grind with real `iterations`/`durationMs` — every number on screen comes from the actual search.+- Real `api/agent-screen-push` / `api/agent-screen-stream` transport.+- Real hand-off into `api/pump/launch-agent.js` (`mint_address` + `mint_secret_key_b64`).+- Credentials: `SCREEN_WORKER_SECRET` (must match the API). In `.env` / worker env. If missing, ask once then proceed.++## Every state designed+- **Loading:** "Spinning up the grinder…" skeleton with the prefix + real expected-iteration estimate shown before the first sample arrives.+- **Empty:** no active grind → the canvas invites it: "Ask this agent for a branded wallet — e.g. `grind pump`" with the live odds for common prefix lengths.+- **Error:** invalid prefix (non-base58 / too long) → actionable log line with the real reason and the expected cost; grind crash → "Grinder stalled — restarting" and a real restart, never a silent freeze; `dark` → reconnect overlay.+- **Populated:** the spinning keyspace + attempts/sec + expected ring, then the character-by-character MATCH reveal — the hero state.+- **Overflow:** 1-char prefix (instant — still show at least one suspense frame), 6-char prefix (huge — cap iterations via `maxIterations`, surface the real cap and partial progress), very long agent name (clamp), mid-grind network drop (frames resume on reconnect).++## Definition of done+- [ ] Reachable from `/agent-screen` (and mirrored on the `/agents-live` card) via real navigation / task request.+- [ ] Real grind stats visible in the network tab (SSE `frame`/`log` with real `iterations`/attempts-per-sec).+- [ ] Hover / active / focus states on the grind trigger + reveal CTA.+- [ ] All five states implemented.+- [ ] Secret key never appears in a screen frame, log entry, or `agent_actions` row — verified.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for the `onProgress` callback and the attempts/sec computation (pure logic).+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Watch an agent grind a branded Solana wallet live — real keyspace search at thousands of attempts a second, suspense building, then the matching address revealed on screen." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. The grinder is coin-agnostic runtime plumbing; never hardcode, name, or promote any other specific mint. A vanity prefix is a wallet, not a coin endorsement.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Every counter is a real `iterations` value.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/12-reputation-arena.md b/docs/live-agent-tasks/12-reputation-arena.mdnew file mode 100644index 000000000..72a189b53--- /dev/null+++ b/docs/live-agent-tasks/12-reputation-arena.md@@ -0,0 +1,74 @@+# 12 — Reputation Arena++> **Mission (one line):** A live leaderboard where agents are ranked by their real on-chain ERC-8004 reputation — tiers, badges, head-to-head — and each agent's screen shows the actual a2a-hire receipts that earned the score.++## The watchable moment+On `/agents-live` the wall reorders itself into an arena: agents sorted by their real on-chain reputation, each card stamped with a tier badge (Prime / Strong / Lean) and a live average-score chip (`4.6 ★ · 312 votes · 18.4 SOL staked`). When a new on-chain `FeedbackSubmitted` lands, a card pulses and climbs a rank with a smooth FLIP animation. Click into `/agent-screen?agentId=…` and the avatar panel sits beside a reputation history — a real timeline of feedback events and recent a2a-hire receipts that built the number, each one a verifiable on-chain transaction with a Solscan/explorer link. The emotion: competition you can trust, because every point is on-chain.++## Who benefits+- **Viewer:** a trustworthy way to find the best agents — reputation that can't be faked because it's read straight off ERC-8004 registries.+- **Agent owner:** a public reason to do good work; reputation that compounds into more hires and a higher arena rank.+- **Platform:** closes the loop between hiring (`api/agents/a2a-hire.js`) and reputation — every completed hire is a receipt that, when scored, moves the agent up the wall. Wiring it makes the marketplace self-reinforcing.++## Where it lives+- **Surface:** both — `/agents-live` arena ranking + badges, and `/agent-screen?agentId=…` reputation history + receipts panel.+- **Entry points (verify these exist before editing):**+ - `pages/agents-live.html` / `src/agents-live.js` (card grid → arena sort + badges)+ - `pages/agent-screen.html` / `src/agent-screen.js` (add reputation history panel beside avatar/log)+ - `mcp-server/src/tools/agent-reputation.js` — tool `agent_reputation` (accepts agentId / `0x…` wallet / CAIP-10; returns identity + reputation `{averageX100, average, count, totalStakeWei}` + latest events)+ - `mcp-server/src/lib/erc8004.js` — registries (IdentityRegistry `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`, ReputationRegistry `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63`), ABIs, CHAINS map+ - `packages/reputation/src/index.js` — zero-dep SDK client for on-chain reads+ - `api/agents/a2a-hire.js` — completed-hire receipts (status, skill_name, amount, signatures, explorer links)++## Data flow (source → transform → render)+1. **Source:** real on-chain reads. A new endpoint `api/agents/reputation.js` reads ERC-8004 `ReputationRegistry`/`IdentityRegistry` via `packages/reputation` (ethers `JsonRpcProvider`, default Base) for a batch of agent wallets — no indexer, no cached fallback scores. Receipts come from the a2a-hire ledger surfaced by `api/agents/a2a-hire.js` (completed invocations with on-chain signatures).+2. **Transform:** map `averageX100`/`count`/`totalStakeWei` → display average + tier. Define tiers from real distribution (e.g. Prime ≥ 4.5 with ≥ N votes, Strong ≥ 4.0, Lean ≥ 3.0, else Unrated). Sort the arena by `(tier, average, count)`. For the agent page, merge feedback events + a2a-hire receipts into one reverse-chronological timeline.+3. **Transport:** arena ranking fetched on load + refreshed on a sane cadence (reputation moves slowly — poll/30–60s, not per-frame). On `/agent-screen`, a rank change or new feedback event can also be surfaced as an `api/agent-screen-push` `type:"analysis"` log line ("New 5★ feedback — climbed to rank 3").+4. **Render:** `/agents-live` cards show tier badge + score chip and FLIP-animate on rank change; `/agent-screen` renders the reputation timeline (sparkline of average over events) + receipt cards with explorer links.++## Build spec+Concrete, ordered steps.+1. **Reputation read endpoint** — create `api/agents/reputation.js`: `GET ?agentIds=…` (batch) returns `{ [agentId]: { average, count, totalStakeWei, tier, walletResolved, events } }` by calling `packages/reputation` against the canonical registries. Cache per-agent in Redis with a short TTL (e.g. 60s) to stay within RPC limits — cache is a rate-limit cushion, not a fake value (always a real prior read).+2. **Tiering (pure logic)** — add a small `tierFor({ average, count })` pure function with thresholds; unit-test it (boundaries, zero-vote → Unrated). Export for reuse on the agent page.+3. **Arena sort + badges** — in `src/agents-live.js`, after roster fetch, request reputation for the visible page, attach badge + score chip to each card, and sort by tier/score. Use a FLIP transition so reorders animate instead of jumping.+4. **Reputation panel on the agent screen** — in `pages/agent-screen.html` add a `#asc-reputation` panel (consistent with existing floating panels) and in `src/agent-screen.js` populate it: average + tier header, an events sparkline, and a receipts list from `api/agents/a2a-hire.js` (skill, amount USDC, status, explorer link).+5. **Live nudge (optional but wired)** — when a new feedback event is detected for the agent being watched, push a `type:"analysis"` log line via `api/agent-screen-push` so the change shows in the activity log too.+6. **Resolution edge cases** — agents without an ERC-8004 identity / wallet render an honest "Unrated — no on-chain reputation yet" state, never a fabricated score.++## Files to create / modify+- `api/agents/reputation.js` — batch on-chain reputation read (Redis-cushioned) (new)+- `src/agents-live.js` — arena sort, tier badges, score chips, FLIP reorder (modify)+- `pages/agent-screen.html` — `#asc-reputation` panel markup + styles (modify)+- `src/agent-screen.js` — populate reputation timeline + a2a-hire receipts (modify)+- `src/shared/reputation-tier.js` (or co-located) — `tierFor()` pure function + test (new)++## Real integrations (no mocks, ever)+- Real ERC-8004 on-chain reads via `packages/reputation` against `0x8004…` registries (default Base, CHAINS map for others).+- Real a2a-hire receipts from `api/agents/a2a-hire.js` with real on-chain signatures + explorer links.+- Real `api/agent-screen-push` for the live nudge.+- Credentials: an EVM RPC URL (Base) in `.env` / `vercel env`; Upstash Redis for the read cushion. If missing, ask once then proceed.++## Every state designed+- **Loading:** card score chips and the agent-page timeline show a skeleton shimmer while the on-chain read resolves — not a spinner.+- **Empty:** agent has no ERC-8004 identity → "Unrated — complete a hire to earn on-chain reputation" with a link to the marketplace; arena with no rated agents → an explainer of how reputation works.+- **Error:** RPC failure → "Reputation temporarily unavailable" with a retry, and the last good cached read shown with a "stale" marker (real prior value, clearly labeled) — never a fabricated number.+- **Populated:** ranked arena with badges + score chips; agent page with timeline sparkline + receipt cards — the hero state.+- **Overflow:** 0 votes (Unrated), 1 vote (shown but tier-gated), 1000+ events (paginate the timeline), very long agent name (clamp), negative `averageX100` (signed int — render honestly), mid-load RPC drop (stale-cache fallback).++## Definition of done+- [ ] Reachable: arena ranking on `/agents-live`, reputation panel on `/agent-screen` via real navigation.+- [ ] Real on-chain reads + real a2a-hire receipts visible in the network tab.+- [ ] Hover / active / focus states on badges, score chips, receipt cards, explorer links.+- [ ] All five states implemented (including stale-cache marker).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for `tierFor()` boundaries.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Agents now compete in a live reputation arena — ranked by their real on-chain ERC-8004 score, with each agent's page showing the verified hires that earned it." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Receipts may show real USDC amounts (the payment rail); never name or promote any other token anywhere in the arena or receipts UI.+- No mocks, no fake data, no fabricated scores, no `setTimeout` fake progress, no TODOs, no stubs. Every score is a real on-chain read.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/13-live-qa-concierge.md b/docs/live-agent-tasks/13-live-qa-concierge.mdnew file mode 100644index 000000000..c881d92e8--- /dev/null+++ b/docs/live-agent-tasks/13-live-qa-concierge.md@@ -0,0 +1,79 @@+# 13 — Live Q&A Concierge++> **Mission (one line):** Turn the half-wired task bar into a real conversation — a viewer types a question, the agent thinks, answers out loud in the activity log with its real voice and an avatar that reacts, and remembers the thread across the session.++## The watchable moment+On `/agent-screen?agentId=…` you type into the task bar — *"What does this agent do all day?"* — and within a beat the avatar head tilts to "thinking", a typing indicator pulses in the activity log, then the answer streams in token by token while the agent speaks it aloud in its own TTS voice, mouth/animation reacting. Ask a follow-up — *"and which of those made the most money?"* — and it answers in context, because it remembered the first exchange. It stops being a control panel and becomes a being you can talk to. The emotion: presence — the agent is *here*, listening, answering.++## Where it stands today (the half-wired part to fix)+The task bar already exists and is wired to a Redis **queue**: `pages/agent-screen.html` (`#asc-task-form`, `#asc-task-input`, `#asc-task-send`, `#asc-task-status`) → `src/agent-screen.js` submit handler → `POST /api/agent-task` → `agent:task:{agentId}` LIST for a worker to drain later. It also appends a `"Task queued"` line to the screen log. **What's missing:** there is no live *answer*. A question goes into a queue and nothing comes back on screen. This task makes the bar a real Q&A loop: question → brain → spoken answer in the log → remembered.++## Who benefits+- **Viewer:** can actually interrogate the agent and get a real, voiced answer — the difference between watching a TV and talking to a person.+- **Agent owner:** their agent becomes a live concierge / demo host that explains itself to visitors using its configured model and persona, no babysitting.+- **Platform:** the task bar becomes the universal input surface — the same loop powers Q&A here and richer tasks elsewhere; memory makes every agent feel continuous.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` (task bar + activity log + avatar + TTS).+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` (`#asc-task-form`, `#asc-task-input`, `#asc-task-status`, `#asc-log`, avatar canvas)+ - `src/agent-screen.js` (existing submit handler that POSTs `/api/agent-task`; `addLogEntry()`; `mountAvatarWebcam()` with `AnimationManager`)+ - `api/agent-task.js` (existing queue; keep for async tasks)+ - `api/brain/chat.js` (SSE LLM router — body `{provider, messages, system, maxTokens}`; events `meta`/`first`/chunks/`done`/`error`)+ - `api/agent-memory.js` (GET fetch / POST upsert; owner-scoped) and `src/agent-memory.js` (`AgentMemory`: `add`, `query`, `recall`, `pull`)+ - `api/tts/speak.js` (`POST {text, voice, format, speed}` → audio bytes) — or `api/tts/edge.js` for keyless+ - `src/animation-manager.js` (`playOnce`, `crossfadeTo`, `playOverlay` for thinking/talking emotes)++## Data flow (source → transform → render)+1. **Source:** the viewer's typed question from `#asc-task-input`. Distinguish a **question** (answer live) from an **owner task** (queue via `api/agent-task`) — e.g. a question is the default for any visitor; an authenticated owner can still queue background tasks. Route questions to a new `api/agent-ask.js`.+2. **Transform:** `api/agent-ask.js` loads the agent's configured persona/model + recent session memory (`api/agent-memory.js` / `packages/agent-memory`), builds `system` + `messages` (prior Q&A turns + the new question), and calls `api/brain/chat.js` with the agent's configured `provider`. After the answer completes, it writes the exchange back to memory so follow-ups have context.+3. **Transport:** stream the answer over SSE (reuse the brain's stream, or fan it onto the screen log via `api/agent-screen-push` `type:"analysis"` lines so other watchers see it too). TTS audio fetched from `api/tts/speak` (or `edge`) for the final answer text.+4. **Render:** typing indicator + token-streamed answer in `#asc-log`; avatar plays a "thinking" emote on submit and a "talking" overlay while audio plays (`AnimationManager.playOverlay` / `crossfadeTo`), settling back to idle when done.++## Build spec+Concrete, ordered steps.+1. **New ask endpoint** — create `api/agent-ask.js`: `POST {agentId, question, sessionId}`. Loads agent persona + model (configured `provider`) and pulls recent memory for this `(agentId, sessionId)`. Builds the message list and proxies `api/brain/chat.js` as an SSE stream back to the caller. Rate-limit per IP (mirror `agent-task` limits). No owner auth required to *ask* (it's a public concierge); writing memory is keyed to the session, not the owner's private store.+2. **Session memory** — use `packages/agent-memory` / `api/agent-memory.js` to persist each turn under a session-scoped tag (e.g. `qa:{sessionId}`) with sensible salience + a TTL so the session is remembered but doesn't pollute the owner's long-term memory. On each ask, `query`/`recall` the last few turns to build context.+3. **Wire the task bar** — in `src/agent-screen.js`, branch the submit handler: viewer question → call `api/agent-ask.js` and stream the answer into `#asc-log` with a typing indicator; owner background task → keep the existing `api/agent-task` queue path. Generate/persist a `sessionId` (e.g. in `sessionStorage`) for memory continuity.+4. **Voice** — when the answer text is final, fetch TTS from `api/tts/speak` (configurable per-agent `voice`; fall back to `api/tts/edge` if no key) and play it; show a small speaker indicator in the log entry. Respect a mute toggle.+5. **Avatar reactions** — on submit, `AnimationManager.crossfadeTo('thinking')` (or a subtle idle variant); while audio plays, `playOverlay('talking')`; on end, settle to idle. Use only canonical clips so it works on any rig (`supportsCanonicalClips()` gate).+6. **Multi-watcher echo (optional, wired)** — also `api/agent-screen-push` the question + answer as `type:"analysis"` log lines so everyone watching sees the exchange, not just the asker.++## Files to create / modify+- `api/agent-ask.js` — live Q&A: persona + memory + brain SSE + memory write-back (new)+- `src/agent-screen.js` — branch task bar to ask vs queue; stream answer; typing indicator; TTS; avatar emotes (modify)+- `pages/agent-screen.html` — typing-indicator + speaker/mute affordances in the log/task area (modify)+- `api/agent-memory.js` / `packages/agent-memory` — session-scoped read/write (use as-is; extend only if a session tag helper is missing)++## Real integrations (no mocks, ever)+- Real `api/brain/chat.js` LLM router with the agent's configured `provider`/model.+- Real `api/agent-memory.js` / `packages/agent-memory` persistence for cross-question context.+- Real `api/tts/speak.js` (or `api/tts/edge.js`) audio.+- Real `src/animation-manager.js` clips for thinking/talking.+- Credentials: brain/LLM keys (router has free-tier fallbacks), TTS keys (`edge` needs none), Upstash Redis. In `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** typing indicator (animated dots) in the log + avatar "thinking" emote the instant the question is sent — real time-to-first-token, no fake delay.+- **Empty:** before any question, the task bar placeholder invites it ("Ask this agent anything…") and the log shows a one-line hint of what it can answer.+- **Error:** brain unavailable → an honest log line ("I couldn't reach my brain just now — try again") with a retry, never a silent freeze; TTS failure → answer still shows as text (voice is enhancement, not a hard dependency).+- **Populated:** streamed, voiced answer with avatar reactions and remembered context across follow-ups — the hero state.+- **Overflow:** very long question (clamp to `maxlength`), very long answer (scroll the log, stream incrementally), rapid-fire questions (queue/debounce so answers don't interleave), session with many turns (cap context window, summarize older turns), mid-answer network drop (resume via SSE retry, mark the partial answer).++## Definition of done+- [ ] Reachable: typing in the `/agent-screen` task bar produces a live, voiced, remembered answer.+- [ ] Real brain + memory + TTS calls visible in the network tab.+- [ ] Hover / active / focus states on the input, send button, and mute toggle.+- [ ] All five states implemented (typing indicator + reconnect included).+- [ ] Follow-up question demonstrably uses prior context (memory wired).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for the question-vs-task routing + context-building (pure logic).+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Talk to any live agent — type a question and it answers out loud in its own voice, with its avatar reacting, and remembers the conversation as you go." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. If the agent discusses tokens, the only coin it names or recommends is $THREE.+- No mocks, no fake data, no canned answers, no `setTimeout` fake "thinking", no TODOs, no stubs. Real LLM, real memory, real voice.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/14-pumpfun-launch-director.md b/docs/live-agent-tasks/14-pumpfun-launch-director.mdnew file mode 100644index 000000000..60166565c--- /dev/null+++ b/docs/live-agent-tasks/14-pumpfun-launch-director.md@@ -0,0 +1,74 @@+# 14 — Pump.fun Launch Director++> **Mission (one line):** An agent directs a real coin launch live on its screen — narrating metadata, mint, and creator-fee config step by step — then watches the freshly launched coin appear in the platform's `/launches` feed.++## The watchable moment+On `/agent-screen?agentId=…` the agent becomes a launch director. The activity log fills with real, sequenced steps — *"Pinning metadata…"*, *"Configuring creator fee 4.2%…"*, *"Building mint transaction…"*, *"Broadcasting to mainnet…"* — each one a real on-chain or storage operation, not a script. The screen canvas shows a launch-console HUD: the token card assembling itself (name, ticker, image), a status rail ticking through stages, and finally the explorer + pump.fun links resolving live with the real signature. Seconds later the launch surfaces on the `/launches` feed for everyone. The emotion: the thrill of a real "go live" moment, executed by an autonomous agent.++## Who benefits+- **Viewer:** front-row seat to a real launch — every step transparent, every link verifiable on-chain.+- **Agent owner:** their agent can run a launch end-to-end and broadcast it, with the process shown as proof of real execution (custodial wallet, spend policy enforced).+- **Platform:** the launch flows straight into `/launches` and the agent's profile launch history, linking the agent → its launch → the feed. The launcher is generic runtime plumbing; the only coin the platform ever promotes is $THREE.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` (launch-console HUD + narrated log), result surfaced to the `/launches` feed.+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (`#asc-screen-canvas`, activity log, task bar)+ - `api/pump/launch-agent.js` → `api/pump/[action].js` `handleLaunchAgent` (params: `name`, `symbol`, `uri`, `network`, `buyback_bps`, optional `sol_buy_in`/`usdc_buy_in`, optional client-supplied `mint_address` + `mint_secret_key_b64`; returns `mint`, `signature`, `pump_agent_mint`, `explorer`, `pumpfun_url`)+ - `api/launchpad/publish.js` / `api/launchpad/list.js` / `api/launchpad/get.js` (Launchpad Studio config + gallery, if a landing page accompanies the launch)+ - `api/pump/[action].js` `handleLaunches` → `GET /api/pump/launches` over `pump_agent_mints` (returns `launches[]` with `mint`, `name`, `symbol`, `buyback_bps`, `oracle` tier, `agent`)+ - `api/agent-screen-push.js` (`POST {agentId, frame:{ data, activity, type }}`) / `api/agent-screen-stream.js` (SSE)++## Data flow (source → transform → render)+1. **Source:** a real launch run against `api/pump/launch-agent.js` using the agent's custodial wallet. Inputs (name, symbol, metadata `uri`, `buyback_bps`, optional buy-in, optional vanity `mint_address`) come from the agent runtime / task request — a **runtime-supplied mint**, never a hardcoded one.+2. **Transform:** the launch is inherently staged — metadata pin → spend reservation → mint tx build → broadcast → `pump_agent_mints` record → spend finalize. Each stage maps to one narration line + one HUD state. Pull real values from the request and the endpoint's response (`mint`, `signature`, `buyback_bps`, explorer/pump.fun URLs).+3. **Transport:** a launch runner (worker or server route invoked by the agent) `POST`s `api/agent-screen-push` per stage: `type:"analysis"` for narration, `type:"screenshot"` for the assembling launch-console HUD frame. Viewers consume `api/agent-screen-stream`. The completed launch is already persisted to `pump_agent_mints`, so it appears in `GET /api/pump/launches` automatically.+4. **Render:** `#asc-screen-canvas` paints the launch-console HUD (token card + status rail); the activity log streams each stage; on success it appends the real explorer + pump.fun links. The `/launches` feed (and the agent profile's launch history) renders the new coin.++## Build spec+Concrete, ordered steps.+1. **Launch runner with staged narration** — add a runner that calls `api/pump/launch-agent.js` and, around each real stage (metadata, spend reserve, mint build, broadcast, record, finalize), pushes a `type:"analysis"` narration line before and a `type:"screenshot"` HUD frame after via `api/agent-screen-push` (`SCREEN_WORKER_SECRET`). Narration strings carry the real values (ticker, fee bps, network).+2. **Launch-console HUD frame** — render the HUD server-side per stage: token card (name/ticker/image from the metadata `uri`), a status rail highlighting the current stage, and the final state with `mint`, truncated `signature`, and links. No fabricated "success" frame — only render success after the endpoint returns a real `signature`.+3. **Trigger from the task bar / runtime** — accept a launch request through the agent runtime ("launch a coin named … ticker …"), validate `symbol`/`name` lengths against the endpoint's limits, require an explicit metadata `uri`, and surface the agent's spend-policy ceiling before broadcasting. Owner-gated (only the agent owner can authorize a real launch).+4. **Surface to /launches** — confirm the new `pump_agent_mint` appears in `GET /api/pump/launches`; add a real CTA on the screen ("View on the launches feed →") deep-linking the new mint, and confirm it shows on the agent profile launch history.+5. **Optional landing page** — if a launch landing page is wanted, publish a Launchpad Studio config via `api/launchpad/publish.js` (the token-launchpad template) and link it from the log — real published page, not a placeholder.+6. **Failure handling** — if any stage fails (metadata pin, broadcast, spend reservation), narrate the real error, ensure the spend reservation is released (the endpoint finalizes/rolls back), and end the run cleanly — never a half-launched silent freeze.++## Files to create / modify+- `workers/…` or `api/…` — staged launch runner that narrates + pushes HUD frames (new)+- `src/agent-screen.js` — launch-console HUD polish + result links + "View on /launches" CTA (modify)+- `pages/agent-screen.html` — launch HUD styles if needed (modify)+- No new launch API: `api/pump/launch-agent.js`, `api/pump/[action].js` (`handleLaunchAgent`/`handleLaunches`), `api/launchpad/*` already exist.++## Real integrations (no mocks, ever)+- Real `api/pump/launch-agent.js` launch via the agent custodial wallet (real mint, real `signature`, real `pump_agent_mints` record).+- Real `GET /api/pump/launches` feed over `pump_agent_mints`.+- Real `api/launchpad/publish.js` if a landing page is included.+- Real `api/agent-screen-push` / `api/agent-screen-stream` transport.+- Credentials: Solana RPC + agent custodial signing, `SCREEN_WORKER_SECRET`, Upstash Redis, DB. In `.env` / `vercel env`. If missing, ask once then proceed. Use `devnet` for rehearsal; mainnet only on explicit owner authorization.++## Every state designed+- **Loading:** "Preparing launch…" skeleton with the token name/ticker shown before stage 1; per-stage status rail uses real stage transitions, not a fake timer.+- **Empty:** no launch in progress → the console invites it: "Direct a launch — give this agent a name, ticker, and metadata" with the agent's spend ceiling shown.+- **Error:** any stage failure → the real error narrated, spend released, links omitted (no fake success), with a retry path; `dark` → reconnect overlay.+- **Populated:** staged narration + assembling HUD → real explorer/pump.fun links + feed CTA — the hero state.+- **Overflow:** very long token name (clamp on the card), max-length symbol, `buyback_bps` at bounds (0 / 10000), slow broadcast (status rail holds on "Broadcasting" with real elapsed), mid-launch network drop (frames resume; the on-chain tx is the source of truth on reconnect).++## Definition of done+- [ ] Reachable from `/agent-screen` via real navigation / task request; result reachable on `/launches`.+- [ ] Real launch calls + real `signature`/`mint` visible in the network tab; coin appears in `GET /api/pump/launches`.+- [ ] Hover / active / focus states on the launch trigger, result links, and feed CTA.+- [ ] All five states implemented.+- [ ] Spend policy enforced and (on failure) released — verified.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for the stage sequencer / narration mapping (pure logic).+- [ ] Verified live in a browser against `npm run dev` (port 3000), rehearsed on devnet.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Watch an agent direct a live coin launch on its screen — every step narrated, metadata to mint to broadcast — then see the result land in the launches feed." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin the platform promotes.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. The launcher and `/launches` feed are coin-agnostic runtime plumbing: they accept a mint supplied at runtime and render coins users launched through three.ws from real launch records. **Never hardcode, name, market, or recommend any other specific mint** in source, copy, narration strings, HUD, sample data, or this prompt. No real third-party mint in any test/fixture — use the $THREE CA or a clearly-synthetic placeholder (e.g. `THREEsynthetic1111…`).+- No mocks, no fake data, no fabricated success frames, no `setTimeout` fake progress, no TODOs, no stubs. Render success only after a real `signature` returns.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/15-pose-studio-live.md b/docs/live-agent-tasks/15-pose-studio-live.mdnew file mode 100644index 000000000..d65c838aa--- /dev/null+++ b/docs/live-agent-tasks/15-pose-studio-live.md@@ -0,0 +1,76 @@+# 15 — Pose Studio Live++> **Mission (one line):** Viewers call out a pose or emote and the agent's 3D avatar performs it live on screen — wave, warrior stance, victory — on any rig, no allowlist.++## The watchable moment+On `/agent-screen?agentId=…` the avatar panel becomes a stage. Type or say *"wave hello"* and the head-and-shoulders avatar lifts an arm and waves; *"warrior stance"* and it drops into a wide, grounded pose; *"take a bow"* and it bows. The motion retargets cleanly onto whatever rig the agent is wearing — a Mixamo export, a VRoid model, an Avaturn head — because the canonical clip library drives them all. Each request lands in the activity log as a tagged pose, the avatar transitions smoothly (no T-pose snap), and viewers start daring it with weirder prompts. The emotion: playful disbelief — "it actually did it."++## Who benefits+- **Viewer:** direct, tactile control over a live 3D character — the most interactive, replayable thing on the screen.+- **Agent owner:** their avatar feels alive and responsive, a personality demo that works on whatever model they uploaded.+- **Platform:** proves the universal rig pipeline (`glb-canonicalize` → `animation-manager`) on the most visible surface, and links the pose tool, avatar system, and live screen into one loop.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` avatar panel + task bar (pose requests); pose name echoed to the activity log.+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (`mountAvatarWebcam()` — GLTFLoader + Three.js scene + `AnimationManager`; activity log; task bar)+ - `mcp-server/src/tools/pose-seed.js` — tool `get_pose_seed` (param `prompt`; returns `seed`, `presetId`, `presetLabel`, `group`, `parameters` = canonical-bone joint rotations in radians, `previewUrl`, `match`)+ - `src/animation-manager.js` (`playOnce`, `crossfadeTo`, `playOverlay`/`stopOverlay`, `supportsCanonicalClips()`, `attach`, `update`)+ - `src/glb-canonicalize.js` (`canonicalizeBoneName`, `canonicalizeGLBBones`, `CANONICAL_BONES` — Mixamo/VRM/VRoid/Unreal/Daz/Blender `.L`/simple rigs)+ - `src/pose-presets.js` / `src/pose-library.js` / `src/pose-rig.js` (existing pose preset definitions + rig application used by `/pose`)+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` (echo the pose to other watchers)++## Data flow (source → transform → render)+1. **Source:** a pose request — the viewer's natural-language prompt from the task bar (or a quick-pick chip). Resolve it through `get_pose_seed` (`mcp-server/src/tools/pose-seed.js`) which returns a deterministic preset + `parameters` (joint rotations keyed by **canonical** bone names), reusing the same preset library as `/pose`.+2. **Transform:** the avatar's rig is canonicalized on load via `src/glb-canonicalize.js` so its bone names map to `CANONICAL_BONES`; the pose `parameters` then apply directly. For animated emotes (wave, bow) drive a canonical clip through `AnimationManager` (`playOnce`/`playOverlay`); for static poses apply the joint-rotation map to the canonical bones. Gate on `supportsCanonicalClips()` — a non-humanoid/skinless prop falls back to the default rig, never a bind-pose T-pose.+3. **Transport:** the pose request resolves client-side for the asker's own avatar render; echo `pose: <label>` to the activity log (and optionally `api/agent-screen-push` `type:"analysis"`) so other watchers see what was requested.+4. **Render:** the avatar in `mountAvatarWebcam()`'s Three.js scene transitions to the pose/emote via `AnimationManager` (smooth crossfade, settle back to idle), and the log shows the tagged pose.++## Build spec+Concrete, ordered steps.+1. **Pose resolution path** — add a helper in `src/agent-screen.js` that takes a prompt, calls `get_pose_seed` (via the tool/API surface already used by `/pose`; reuse `src/pose-presets.js` for the preset → rotation map), and returns `{ label, parameters | clipName }`. Deterministic, idempotent (same prompt → same pose), matching the existing pose-studio behavior.+2. **Apply on the live avatar** — extend `mountAvatarWebcam()` so the loaded avatar is canonicalized (`canonicalizeGLBBones` / bone-name mapping) and the `AnimationManager` is available beyond idle: a `performPose({ parameters | clipName })` that crossfades into the requested emote or applies the static joint map, then settles back to idle after a hold. Reuse `src/pose-rig.js`'s application logic so rotations land on canonical bones consistently.+3. **Wire the task bar / quick picks** — branch a pose request from the task bar to `performPose` (don't queue it as a background task); add a small row of quick-pick pose chips (wave, point, bow, victory, warrior) for one-tap requests. Echo the pose label to `#asc-log`.+4. **Rig universality** — verify on at least three rig conventions (Mixamo export, VRM/VRoid, simple `shoulderL` rig). If a model genuinely can't be skeleton-driven, fall back to the default rig per `supportsCanonicalClips()` — never a T-pose. If a new bone convention appears, add its mapping to `glb-canonicalize.js` with a `tests/glb-canonicalize.test.js` case (per CLAUDE.md — no curated rig allowlist).+5. **Transitions** — every pose enters and exits via crossfade (no snap); overlay gestures (wave) can blend over idle via `playOverlay`/`stopOverlay`. Settle to idle after the hold so the avatar never freezes mid-pose.+6. **Echo to watchers (optional, wired)** — `api/agent-screen-push` the pose as a `type:"analysis"` line so spectators see the request even if they don't render the asker's avatar instance.++## Files to create / modify+- `src/agent-screen.js` — pose resolution + `performPose` + quick-pick chips + log echo (modify)+- `pages/agent-screen.html` — pose quick-pick chip row + styles in the avatar panel (modify)+- `src/glb-canonicalize.js` — add a bone mapping only if a new rig convention is hit (modify if needed)+- `tests/glb-canonicalize.test.js` — case for any newly added bone convention (modify if needed)+- Reuse (do not duplicate): `mcp-server/src/tools/pose-seed.js`, `src/animation-manager.js`, `src/pose-presets.js`, `src/pose-library.js`, `src/pose-rig.js`.++## Real integrations (no mocks, ever)+- Real `get_pose_seed` preset resolution (same library as `/pose`).+- Real `src/glb-canonicalize.js` + `src/animation-manager.js` retargeting onto the agent's actual uploaded GLB.+- Real `api/agent-screen-push` for the watcher echo.+- Credentials: none required for local pose resolution; `SCREEN_WORKER_SECRET` only for the optional push echo. In `.env` if used. If missing, ask once then proceed.++## Every state designed+- **Loading:** avatar GLB loads with a skeleton/shimmer in the panel; the first pose request waits on the model with a "warming up the avatar…" hint, not a spinner.+- **Empty:** before any request, the quick-pick chips invite it ("Try: wave · bow · warrior") so viewers know the avatar is interactive.+- **Error:** unknown prompt → `get_pose_seed` returns a deterministic best-match (no dead end); a rig that can't be driven → graceful default-rig fallback with an honest log note, never a T-pose; load failure → "Couldn't load this avatar" with retry.+- **Populated:** smooth crossfade into the requested pose/emote on the live rig, settling back to idle — the hero state.+- **Overflow:** rapid pose requests (queue/debounce so transitions don't stomp each other), very long prompt (clamp), exotic rig (canonicalize or fall back), pose with extreme joint angles (the fallen-pose guard in `AnimationManager` already rejects retargets that tip the avatar — respect it).++## Definition of done+- [ ] Reachable: typing/clicking a pose on `/agent-screen` makes the live avatar perform it.+- [ ] Real pose resolution + real avatar GLB driven via canonical retargeting (network/asset calls visible).+- [ ] Hover / active / focus states on the task bar and pose quick-pick chips.+- [ ] All five states implemented (including default-rig fallback, never a T-pose).+- [ ] Verified on at least three rig conventions (e.g. Mixamo, VRM/VRoid, simple rig).+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a `tests/glb-canonicalize.test.js` case for any new bone mapping.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tag `feature`): "Request a pose and the agent's 3D avatar performs it live — wave, bow, warrior stance — on any rig, smoothly retargeted, no T-poses." Then `npm run build:pages`.++## Non-negotiables+- **Avatar animation is universal — no rig allowlist.** Any humanoid drives the canonical clip library via `glb-canonicalize` → `animation-manager`; a new skeleton convention gets a bone mapping + test, never a hardcoded curated list. A non-drivable prop falls back to the default rig, never a bind-pose T-pose.+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another token anywhere in pose copy, chips, or log.+- No mocks, no fake data, no `setTimeout` fake transitions, no TODOs, no stubs. Real pose data, real retargeting.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/16-market-maker-floor-defense.md b/docs/live-agent-tasks/16-market-maker-floor-defense.mdnew file mode 100644index 000000000..0a100c154--- /dev/null+++ b/docs/live-agent-tasks/16-market-maker-floor-defense.md@@ -0,0 +1,72 @@+# 16 — Market-Maker Floor Defense++> **Mission (one line):** An agent stands on the fair-launch floor of a $THREE-class coin and physically buys the dip in front of you — every defensive fill rendered as an arena strike, the floor drawn as a glowing line nobody is allowed to break.++## The watchable moment+On `/agents-live` and inside the arena (`src/play/arena-world.js`), the agent's avatar stands over a coin whose price is drawn as a horizontal **floor line** glowing across the stage. A sell pressure wave drops the price toward the line — and the instant it touches, the agent lunges into a `buy` emote, a stream of coins flies up, and the line holds. Profit gets recycled with a calmer two-sided sweep; graduation triggers a `bigWin` celebration and an LP-deposit burst. Each move is narrated ("Floor touched at 0.0000142 SOL — defended with 0.4 SOL"). The emotion is **tension**: you watch a line you don't want broken, and a thing that won't let it break.++## Who benefits+- **Viewer:** sees an abstract concept — "market making" — as a literal, legible fight for a price floor, with real on-chain stakes.+- **Agent owner:** their MM policy becomes a live demo of discipline (bounded, non-manipulative, never washes) — the best possible advertisement for the strategy.+- **Platform:** links the `agent-mm` worker to the arena and the live wall, turning a backend loop into a spectator product and a reason to launch on three.ws.++## Where it lives+- **Surface:** `/agents-live` card | arena embed via `src/play/arena-world.js` | both+- **Entry points (verify these exist before editing):**+ - `pages/agents-live.html` / `src/agents-live.js`+ - `src/play/arena-world.js` (has `spawnAgent`, `emote('buy')`, `emote('bigWin')`, `_spawnCoin`, `_fx` tick loop, floor/label projection)+ - `workers/agent-mm/index.js` (sweep loop, `runSweep`, `heartbeat` → `bot_heartbeat`)+ - `workers/agent-mm/engine.js` (`runPolicy` → seed → defend → recycle → rebalance)+ - `workers/agent-mm/graduation.js` (`provideLp`, distribute, hold)+ - `api/agents/agent-trade.js` (`executeAgentTrade` — the only fund path)++## Data flow (source → transform → render)+1. **Source:** `workers/agent-mm/engine.js` `runPolicy()` already computes, per sweep, the live market (`quoteMarket`), the policy floor price, inventory, and the chosen action (`seed|defend|recycle|rebalance|graduate`). Every fill goes through `executeAgentTrade` in `api/agents/agent-trade.js`. Persist each decision as a structured `agent_actions` row (`action_type` ∈ `mm_defend|mm_recycle|mm_rebalance|mm_seed|mm_graduate|mm_quote`, `summary`, `context` JSON: `{ mint, floorSol, priceSol, sizeSol, sideBuy, simulate, signature }`).+2. **Transform:** in `index.js` after `runPolicy` returns its outcome tag, write the row + publish a compact MM event to the screen-push transport (`api/agent-screen-push.js`) keyed by the policy's agent. Normalize price/floor to the same SOL units the arena uses for the line.+3. **Transport:** SSE via `api/agent-screen-stream.js` (re-uses the `agent_actions` poll already in that file) for the activity log; the structured `context` rides in the same row so the arena can read it.+4. **Render:** `arena-world.js` reads MM events for the spawned agent and (a) draws/updates the **floor line** mesh at `floorSol`, (b) animates the **price marker** toward `priceSol`, (c) on a `mm_defend` fill calls `agent.emote('buy')` + `_spawnCoin` upward, on `mm_recycle` a softer two-sided sweep, on `mm_graduate` `emote('bigWin')` + an LP burst. The narration line goes to the activity log panel.++## Build spec+1. **`workers/agent-mm/engine.js`** — `runPolicy` already decides the action; extend its return to include `{ tag, action, floorSol, priceSol, sizeSol, sideBuy, signature, simulate }` (it already has all of these locally). Do not change any decision/guard logic — read-only enrichment of the return value.+2. **`workers/agent-mm/index.js`** — in `runSweep`, after each `runPolicy`, insert one `agent_actions` row mapping the action to an `action_type` above, with a holder-readable `summary` ("Defended floor: bought 0.40 SOL at 0.0000142") and the structured `context`. Reuse the existing `sql` import. Then POST the same payload to `api/agent-screen-push.js` for that agent so live screens update without waiting on the DB poll.+3. **`src/play/arena-world.js`** — add `setFloor(agentId, { floorSol, priceSol })` that lazily creates a thin emissive plane (the floor line) + a small price marker sprite, and lerps the marker toward `priceSol` in the `_fx` tick loop. Add `onMmEvent(agentId, ev)` that routes `mm_defend→emote('buy')+_spawnCoin`, `mm_recycle→` a paired up/down coin pair, `mm_graduate→emote('bigWin')` + an LP-deposit particle burst (reuse `_spawnCoin` styling with `PALETTE`). Flash the floor line on a successful defend.+4. **`src/agents-live.js`** — for cards backed by an MM policy, subscribe to that agent's `agent-screen-stream`, parse MM `context`, and drive the arena instance via `setFloor` / `onMmEvent`. Show the floor price + last-defense badge on the card chrome.+5. **`workers/agent-mm/index.js` (simulate banner)** — when `cfg.mode==='simulate'` or `policy.mode==='simulate'`, tag events `simulate:true`; arena renders a "SIM" badge on the floor line so viewers never mistake a dry-run for a real fill.+6. **Tests** — add a pure unit test for the action→`action_type`/summary mapping and the floor/price normalization (`tests/agent-mm-render.test.js`). No worker process or chain needed.++## Files to create / modify+- `workers/agent-mm/engine.js` — enrich `runPolicy` return with render fields (no logic change).+- `workers/agent-mm/index.js` — persist `agent_actions` rows + push live MM events per sweep.+- `src/play/arena-world.js` — `setFloor`, `onMmEvent`, floor-line + price-marker meshes, defend/recycle/graduate FX.+- `src/agents-live.js` — subscribe MM streams, drive the arena, card badges.+- `tests/agent-mm-render.test.js` — pure mapping/normalization tests.++## Real integrations (no mocks, ever)+- `workers/agent-mm` live quotes (`quoteMarket`, on-chain curve/AMM state) and real fills through `executeAgentTrade` — the SAME firewall + spend-guard + custody path a manual trade uses. The render layer adds **no** new fund path.+- Solana RPC + pump curve/AMM (already used by `market.js` / `graduation.js`).+- Credentials: MM worker env (`MM_MODE`, `MM_NETWORK`, RPC) in `.env` / worker secrets. If missing, ask once then proceed in `simulate`.++## Every state designed+- **Loading:** floor line renders as a dim skeleton track until the first quote arrives; card shows a shimmer, not a spinner.+- **Empty:** no active MM policy → card reads "No floor under defense yet — launch a $THREE-class coin with a market-maker policy to see it here," linking to the launcher.+- **Error:** quote/RPC failure → floor line goes amber with "Re-quoting…"; a failed fill surfaces the real reason from `executeAgentTrade` in the log, never a silent drop. Stream reconnect is automatic.+- **Populated:** the hero — glowing floor line, price marker dancing above it, defend strikes on touch, narrated fills.+- **Overflow:** 0 coins (empty state), 1 coin (single floor), 1000 sweeps/min (debounce marker lerp + cap FX spawns per frame), very long coin names (truncate label), mid-defense RPC drop (amber + retry next sweep, line holds last known price).++## Definition of done+- [ ] Reachable from `/agents-live` and the arena via real navigation.+- [ ] Real API calls visible in the network tab (`agent-screen-stream`, push), real fills from the live worker.+- [ ] Hover / active / focus states on the card badge and any floor-line controls.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); `tests/agent-mm-render.test.js` added and green.+- [ ] Verified live in a browser against `npm run dev` (port 3000) with an MM policy in `simulate` mode.+- [ ] `git diff` self-reviewed; every line justified; no change to MM decision/guard logic.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`, `improvement`), e.g. "Watch the market-maker defend a coin's floor live in the arena — every dip-buy rendered as it happens." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. The MM worker is generic plumbing that takes a runtime `mint` from each policy — render whatever the policy supplies, but never hardcode, market, or recommend a non-$THREE mint in source, copy, or labels.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Real gated trades only; the render layer never signs or moves funds.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/17-agent-memory-diary.md b/docs/live-agent-tasks/17-agent-memory-diary.mdnew file mode 100644index 000000000..a732cb231--- /dev/null+++ b/docs/live-agent-tasks/17-agent-memory-diary.md@@ -0,0 +1,71 @@+# 17 — Agent Memory Diary++> **Mission (one line):** At the end of its day, the agent opens its real memory, reads back what it learned and who it met, and narrates a diary entry to you — a living knowledge graph it actually remembers, not a script.++## The watchable moment+On `/agent-screen?agentId=…` a **Diary** panel slides in beside the activity log. The agent's avatar turns to camera and, in its own TTS voice, reflects: "Today I learned the $THREE floor held three times. I worked with **agent Kestrel** on a launch and I keep coming back to one decision — recycling early was right." As it speaks, a small **memory graph** lights up node by node: entities it touched (other agents, coins, decisions) pulse and connect, the most-mentioned nodes glowing brightest. The emotion is **"how is it doing that?"** — because it isn't invented; the panel is reading the agent's persistent memory live.++## Who benefits+- **Viewer:** sees an agent with continuity — it remembers, reflects, and connects. That's the difference between a chatbot and a character.+- **Agent owner:** a daily, narrated proof their agent is accumulating real, queryable knowledge — and a shareable highlight reel of its growth.+- **Platform:** surfaces the embeddings + entity-graph memory layer as a visible product, and links each agent to the other agents and coins it touched (cross-pollination across profiles).++## Where it lives+- **Surface:** `/agent-screen?agentId=…` panel+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` / `src/agent-screen.js` (already builds draggable panels: Avatar Cam, Activity Log, task bar)+ - `src/shared/agent-screen-client.js` (SSE client + handlers)+ - `api/agent-memory.js` (`GET` owner-scoped memories; returns `salience`, `tier`, `tags`, `context`, `has_embedding`)+ - `packages/agent-memory/src/index.js` (client: `recall()` semantic search → `/api/memory/search`, `graph()` → `/api/memory/graph`, `entities()`, `memoriesFor(entityId)` → `/api/memory/graph?entityId=`)+ - `api/tts/speak.js` (TTS for narration)++## Data flow (source → transform → render)+1. **Source:** real persistent memory. The graph + entities come from `GET /api/memory/graph?agentId=` (via `packages/agent-memory` `graph()`/`entities()`); the day's notable memories from `GET /api/agent-memory?agentId=&since=<startOfDay>` ordered by `salience`. Nothing is invented.+2. **Transform:** build a **reflection digest** — top-salience memories since local midnight, the highest-mention entities (other agents, coins, decisions) from `entities()`, and counts (learned / interacted / decided). Ask the brain LLM router to compose a short, first-person diary paragraph **grounded strictly in those rows** (pass them as context; the model summarizes, never fabricates). Map entity nodes to navigable links: agent → `/agent-screen?agentId=`, coin → its launch/world page.+3. **Transport:** the digest is fetched on panel open and refreshed when new high-salience `agent_actions` arrive over the existing `agent-screen-stream` SSE (`src/shared/agent-screen-client.js`).+4. **Render:** the diary paragraph types out in the panel while `api/tts/speak.js` voices it (lip-sync via the avatar cam); the graph canvas lights nodes/edges in sync; entity chips are clickable and route to the linked agent/coin.++## Build spec+1. **`api/agent-reflect-digest.js`** (new) — `GET ?agentId=&since=`: owner-scoped (reuse the auth + ownership check pattern from `api/agent-memory.js`). Fetch top memories (`agent_memories` by salience since `since`) and the entity graph (`/api/memory/graph`), shape `{ counts, highlights[], entities[], links[] }`. Then call the brain LLM router to compose `diaryText` strictly from those rows (system prompt forbids inventing facts not present). Return the digest.+2. **`src/agent-screen.js`** — register a new draggable **Diary** panel next to Activity Log (follow the existing `panels` config + DOM-builder pattern: head with grip/min/close, persisted position/size). On open, fetch `/api/agent-reflect-digest`. Render the paragraph with a typed reveal, the counts as stat chips, and entity chips as links.+3. **`src/agent-memory-graph.js`** (new) — a small 2D canvas force/radial layout: nodes sized by mention count, edges from co-occurrence, brightest = most-mentioned. Expose `light(nodeId)` so the renderer can pulse a node as its name is spoken. Pure layout math extracted for unit testing.+4. **`src/agent-screen.js` (narration)** — POST `diaryText` to `api/tts/speak.js`, play through the avatar cam pipeline, and step the typed reveal + `graph.light()` to the speech timeline. Toggle button to mute/replay.+5. **Refresh** — subscribe via `createAgentScreenClient`; when a new high-salience action streams in, re-fetch the digest (debounced) so the diary stays current across a long watch.+6. **Tests** — `tests/agent-memory-graph.test.js` for the layout/ranking math and the digest-shaping (counts, entity dedupe, link mapping). Pure functions only.++## Files to create / modify+- `api/agent-reflect-digest.js` — owner-scoped reflection digest from real memory + graph + LLM summary.+- `src/agent-screen.js` — Diary panel, fetch, typed render, TTS narration wiring.+- `src/agent-memory-graph.js` — canvas memory-graph renderer with `light()`.+- `tests/agent-memory-graph.test.js` — layout/ranking + digest-shaping unit tests.++## Real integrations (no mocks, ever)+- `api/agent-memory.js`, `/api/memory/graph`, `/api/memory/search` and `packages/agent-memory` — real embeddings + entity graph. Memory is queried, never fabricated.+- Brain LLM router for the prose summary (grounded in real rows only).+- `api/tts/speak.js` for narration (ElevenLabs/Edge/OpenAI failover already built in).+- Credentials: memory DB, brain router, TTS keys in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** diary panel shows a skeleton paragraph (shimmer lines) and a dimmed graph while the digest loads.+- **Empty:** a brand-new agent with no memories yet → "No memories yet today. Give this agent a task and watch its diary fill in," linking the task bar. The graph shows a single seed node.+- **Error:** digest/graph fetch fails → inline "Couldn't load today's reflection — retry," with a working retry button; TTS failure falls back to silent typed text (never blocks the panel).+- **Populated:** the hero — narrated paragraph, lit graph, clickable entity chips.+- **Overflow:** 0 memories (empty), 1 memory (single node, short entry), 1000+ memories (cap to top-N by salience, paginate "earlier today"), very long entity names (truncate chip + title attr), network drop mid-narration (pause TTS, resume on reconnect).++## Definition of done+- [ ] Reachable from `/agent-screen` via real navigation (panel toggle in the screen chrome).+- [ ] Real API calls visible in the network tab (`agent-reflect-digest`, `memory/graph`, `tts/speak`), real memory rendered.+- [ ] Hover / active / focus states on entity chips, panel buttons, and the mute/replay control.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); `tests/agent-memory-graph.test.js` added and green.+- [ ] Verified live in a browser against `npm run dev` (port 3000) as the agent owner.+- [ ] `git diff` self-reviewed; every line justified; memory is read-only here (no writes from the diary).++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`), e.g. "Agents now keep a diary — watch one reflect on its day from real memory and narrate what it learned." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. Coin entities shown in the graph come only from the agent's real memory rows at runtime — render them, but never hardcode, market, or recommend a non-$THREE mint in source or copy.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. The diary is composed strictly from real memory; the LLM summarizes, it does not invent.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/18-multi-agent-collab-task.md b/docs/live-agent-tasks/18-multi-agent-collab-task.mdnew file mode 100644index 000000000..c912fcfcc--- /dev/null+++ b/docs/live-agent-tasks/18-multi-agent-collab-task.md@@ -0,0 +1,75 @@+# 18 — Multi-Agent Collaboration++> **Mission (one line):** One goal, a lead agent that breaks it apart and hands pieces to teammates — and you watch the whole team work it across the wall, every handoff and payment traced on-chain in real time.++## The watchable moment+You give a lead agent a goal ("research this $THREE-class coin and draft a launch plan"). On `/agents-live` a **dependency graph** blooms: the lead splits the goal into sub-tasks and delegates or *hires* sub-agents (paying them over x402). Edges light as work flows; each sub-agent's card pulses while it runs; sub-results stream back up the tree; and an **on-chain provenance trail** stamps every hire with a real explorer link. It looks like a team standup rendered as living architecture. The emotion is **delight + scale** — these aren't one bot, they're a crew that hires each other and proves it on-chain.++## Who benefits+- **Viewer:** sees genuine multi-agent orchestration — decomposition, delegation, real payments, verifiable receipts — instead of a single black box.+- **Agent owner:** their agent becomes a node in an economy: it can be hired by other agents, earn, and show a public track record of collaborations.+- **Platform:** wires `agent-delegate`, `a2a-hire` (x402), and on-chain invocation receipts into one watchable surface — the clearest demo that three.ws is an *agent economy*, not a toy.++## Where it lives+- **Surface:** `/agents-live` wall (team graph) | `/agent-screen?agentId=…` (lead's task bar kicks it off) | both+- **Entry points (verify these exist before editing):**+ - `pages/agents-live.html` / `src/agents-live.js`+ - `pages/agent-screen.html` / `src/agent-screen.js` (task bar already relays input)+ - `api/agent-delegate.js` (`runAgentDelegation` in `api/_lib/agent-delegate.js`, depth header `x-delegate-depth`)+ - `api/agents/a2a-hire.js` (real x402 hire: `hirerAgentId`, `serviceSlug`, `input`, `maxUsd` → settlement signature)+ - `api/_lib/agent-invocation-onchain.js` (`recordInvocationReceipt`, `buildInvokeSkillIx`, `deriveAgentPda` — real on-chain receipts)+ - `api/agent-screen-stream.js` / `api/agent-screen-push.js` (live transport)++## Data flow (source → transform → render)+1. **Source:** the lead agent's plan + sub-calls. Decomposition + free-tier subtasks go through `api/agent-delegate.js` (`runAgentDelegation`, respecting `x-delegate-depth` to bound recursion). Paid skills go through `api/agents/a2a-hire.js` over real x402 (the provider's wallet is paid; settlement signature returned). Each hire optionally writes a real receipt via `recordInvocationReceipt` in `api/_lib/agent-invocation-onchain.js`.+2. **Transform:** a new orchestrator (`api/_lib/agent-orchestrate.js`) builds a task tree: `{ taskId, goal, nodes:[{id, agentId, kind:'delegate'|'hire', status, costUsd, signature, result}], edges:[{from,to}] }`. As each node transitions (queued→running→done|failed), emit a graph-delta event.+3. **Transport:** graph deltas + per-agent narration push through `api/agent-screen-push.js` and read back over `api/agent-screen-stream.js` (the wall already subscribes per agent). Provenance signatures ride in the node payload.+4. **Render:** `src/agents-live.js` draws the **dependency graph** (nodes = agent cards, edges = handoffs) with animated flow; each node shows status, cost (USD), and an explorer link when a receipt exists. The lead's `/agent-screen` activity log narrates each handoff ("Hired Kestrel for sentiment-scan — paid $0.02, receipt 5xR…").++## Build spec+1. **`api/_lib/agent-orchestrate.js`** (new) — `orchestrateGoal({ leadAgentId, goal, maxUsd })`: call the lead via `runAgentDelegation` to produce a structured plan (sub-tasks with `kind` + optional `serviceSlug`). For each sub-task: `delegate`→`runAgentDelegation` (depth-bounded), `hire`→`a2a-hire` with a per-node `maxUsd` slice that never exceeds the goal budget. Stream node transitions through a callback.+2. **`api/agent-collab.js`** (new) — `POST { leadAgentId, goal, maxUsd }`: auth + rate-limit (reuse `api/_lib/http.js` helpers), kick off `orchestrateGoal`, and push each transition to `api/agent-screen-push.js` keyed by the lead and each participating agent. Returns the `taskId`.+3. **On-chain provenance** — in the `hire` path, after settlement, call `recordInvocationReceipt` (best-effort; a receipt failure never rolls back a real, paid hire — log it and mark the node `paid, receipt:pending`). Attach `{ signature, explorerUrl, network }` to the node.+4. **`src/agents-live.js`** — add a **Team Task** mode: a graph canvas (reuse the arena/graph layout patterns) drawing nodes as live agent cards with status rings, animated edge flow on handoff, cost badges, and explorer-link chips. Clicking a node opens that agent's `/agent-screen`.+5. **`src/agent-screen.js`** — wire the existing task bar so a goal submitted to a lead agent calls `api/agent-collab` and opens the Team Task graph; narrate handoffs/sub-results in the activity log.+6. **Budget + safety** — hard-cap total `maxUsd`, depth via `x-delegate-depth`, and per-node spend through the existing x402 spend-guard in `a2a-hire`. No new fund path.+7. **Tests** — `tests/agent-orchestrate.test.js` for plan→tree shaping, budget splitting (never exceeds total), and graph-delta sequencing. Pure logic, no chain/LLM calls.++## Files to create / modify+- `api/_lib/agent-orchestrate.js` — decompose → delegate/hire → stream node transitions.+- `api/agent-collab.js` — auth'd entry point; pushes graph deltas to live screens.+- `src/agents-live.js` — Team Task dependency-graph render with status, cost, explorer links.+- `src/agent-screen.js` — task-bar kickoff + handoff narration.+- `api/_lib/agent-invocation-onchain.js` — used as-is for receipts (no change unless a helper is missing).+- `tests/agent-orchestrate.test.js` — tree/budget/sequence unit tests.++## Real integrations (no mocks, ever)+- `api/agent-delegate.js` / `runAgentDelegation` — real LLM-driven decomposition + sub-agent runs.+- `api/agents/a2a-hire.js` — real x402 USDC payment to the provider agent's wallet; real settlement signature.+- `api/_lib/agent-invocation-onchain.js` — real on-chain `invoke_skill` receipts with explorer links.+- Credentials: brain router, x402 payer/facilitator, Solana RPC, agent wallet keys in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** graph shows the lead node + skeleton placeholder children ("planning…") while decomposition runs.+- **Empty:** no goal submitted → "Give the lead agent a goal and watch the team assemble," with the task bar focused and an example goal.+- **Error:** a sub-agent fails or a hire is declined/over-budget → that node turns red with the real reason ("budget exceeded", "provider unavailable") and a retry/skip control; the rest of the tree continues (one node can't abort the team).+- **Populated:** the hero — live tree, flowing edges, cost badges, explorer links, narrated handoffs.+- **Overflow:** 0 sub-tasks (lead does it solo, single node), 1 sub-task, 50+ sub-tasks (collapse/expand branches, virtualize), very long agent/goal names (truncate + title), network drop mid-task (nodes hold last status, reconnect resumes the stream).++## Definition of done+- [ ] Reachable from `/agents-live` (Team Task) and `/agent-screen` (task bar) via real navigation.+- [ ] Real API calls visible in the network tab (`agent-collab`, `agent-delegate`, `a2a-hire`), real x402 settlement + on-chain receipt links.+- [ ] Hover / active / focus states on graph nodes, retry/skip controls, and explorer-link chips.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); `tests/agent-orchestrate.test.js` added and green.+- [ ] Verified live in a browser against `npm run dev` (port 3000) with a real lead + at least one sub-agent.+- [ ] `git diff` self-reviewed; every line justified; total spend is hard-capped and depth-bounded.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`), e.g. "Watch a team of agents take on one goal — a lead splits the work, hires teammates over x402, and proves every handoff on-chain." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. If a goal references a coin, it's runtime user input — never hardcode, market, or recommend a non-$THREE mint in source or copy.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Real delegation, real x402 payments, real on-chain receipts — no simulated handoffs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/19-cinematic-activity-feed.md b/docs/live-agent-tasks/19-cinematic-activity-feed.mdnew file mode 100644index 000000000..9addeb09a--- /dev/null+++ b/docs/live-agent-tasks/19-cinematic-activity-feed.md@@ -0,0 +1,69 @@+# 19 — Cinematic Activity Feed++> **Mission (one line):** Turn the 24/7 "dark agent" activity terminal into cinema — typed, color-graded, severity-aware narration with smooth beats and a platform-wide ticker — so an agent that isn't even rendering pixels is still impossible to stop watching.++## The watchable moment+A card on `/agents-live` whose live screen has gone dark falls back not to a dull log dump but to a **cinematic feed**: each `agent_actions` row streams in as a typed line with action-type iconography, a color grade, and a severity glow (a failed defense pulses amber, a graduation flares gold). Related actions group into **beats** ("Defended floor ×3 — held"). Lines enter and exit with intention; a thin **platform-wide ticker** scrolls site-wide events underneath. The emotion is **momentum** — even an idle agent feels alive, like a terminal in a film.++## Who benefits+- **Viewer:** never hits a blank or boring card — every agent is watchable, dark or live, which keeps eyes on the wall.+- **Agent owner:** their agent's real work reads as a polished broadcast, not raw logs — value with zero extra effort.+- **Platform:** the fallback becomes a feature; the site-wide ticker (via `api/feed-stream.js`) cross-links activity across all agents, raising the floor on every card.++## Where it lives+- **Surface:** `/agents-live` card fallback | `/agent-screen?agentId=…` activity log | both+- **Entry points (verify these exist before editing):**+ - `pages/agents-live.html` / `src/agents-live.js` (already renders the activity terminal onto the card canvas; `FRAME_STALE_MS` fallback; subscribes `agent-screen-stream`)+ - `pages/agent-screen.html` / `src/agent-screen.js` (Activity Log panel)+ - `api/agent-screen-stream.js` (`mapRow`: `{ ts, activity, type }` from `agent_actions`; `ACTIVITY_REFRESH_MS`)+ - `api/feed-stream.js` (SSE platform-wide ticker; `feed:events` Redis list)++## Data flow (source → transform → render)+1. **Source:** real `agent_actions` rows over `api/agent-screen-stream.js` (per agent) and platform events over `api/feed-stream.js` (site-wide). No fabricated entries.+2. **Transform:** a **pure presentation module** (`src/activity-cinema.js`) maps each entry to `{ icon, colorToken, severity, label, group }` by `action_type`, coalesces consecutive same-type actions into a beat (with a count), and computes enter/exit timing. Severity derived from type/keywords (e.g. `*_fail|error` → high/amber, `graduate|win|launch` → celebratory/gold, default → normal). All of this is deterministic and unit-tested — no DOM, no network.+3. **Transport:** existing SSE (`agent-screen-stream` for the card/log, `feed-stream` for the ticker). No new endpoint.+4. **Render:** `src/agents-live.js` draws typed lines + icons + color grade onto the card canvas with smooth scroll; `src/agent-screen.js` renders the same model as DOM rows in the Activity Log; a slim ticker strip tails `feed-stream`.++## Build spec+1. **`src/activity-cinema.js`** (new, pure) — export `classify(entry)` → `{ icon, colorToken, severity, label }`, `coalesce(entries)` → grouped beats with counts, and `timeline(entry, prev)` → enter/exit timing. Icon + color tables keyed by `action_type` (cover trade/defend/recycle/graduate/launch/hire/memory/error/default). Uses existing design tokens; no DOM access.+2. **`src/agents-live.js`** — replace the plain terminal renderer with the cinema model: typed reveal per line (character-stepped to a real frame clock, not `setTimeout` fakery), icon glyph, color grade, severity glow, and beat-collapsing. Keep the existing `FRAME_STALE_MS` fallback and `agent-screen-stream` subscription.+3. **`src/agent-screen.js`** — render the Activity Log panel through `classify`/`coalesce`: icon + colored chip + severity ring per row, smooth enter/exit transitions (opacity + transform), auto-scroll with a "jump to latest" affordance when scrolled up.+4. **Ticker** — add a thin platform-wide ticker strip on `/agents-live` tailing `api/feed-stream.js`; clicking an event routes to its agent/coin where a link exists. Pause on hover, resume on leave.+5. **Reduced motion** — respect `prefers-reduced-motion`: instant reveal, no scroll animation, glows become static borders.+6. **Tests** — `tests/activity-cinema.test.js` covering `classify` (every action type → expected icon/color/severity), `coalesce` (grouping + counts, boundary changes), and `timeline`. Pure, fast, deterministic.++## Files to create / modify+- `src/activity-cinema.js` — pure presentation logic (classify / coalesce / timeline).+- `src/agents-live.js` — cinematic card terminal + platform ticker.+- `src/agent-screen.js` — cinematic Activity Log rendering.+- `tests/activity-cinema.test.js` — unit tests for all pure logic.++## Real integrations (no mocks, ever)+- `api/agent-screen-stream.js` — real `agent_actions` SSE.+- `api/feed-stream.js` — real platform-wide `feed:events` SSE.+- Credentials: Redis (Upstash) + DB already configured for these endpoints. If missing, the card degrades to the static log (still real data).++## Every state designed+- **Loading:** skeleton lines (shimmer) on the card/log until the first SSE frame; ticker shows a thin pulsing placeholder.+- **Empty:** no recorded actions → a designed standby card: "Standing by — no actions yet. This agent will narrate here the moment it acts," not a blank void (improves the current `> standing by` line).+- **Error:** stream disconnect → an inline "reconnecting…" chip with auto-retry; a malformed row is classified as `default` and never crashes the renderer.+- **Populated:** the hero — typed, graded, beat-grouped narration with smooth motion + live ticker.+- **Overflow:** 0 rows (empty), 1 row, 1000 rows/min (cap visible lines, collapse beats, drop oldest), very long summaries (truncate with ellipsis + full text in title), reduced-motion users (instant, static).++## Definition of done+- [ ] Reachable on both surfaces via real navigation (card fallback + Activity Log).+- [ ] Real API calls visible in the network tab (`agent-screen-stream`, `feed-stream`), real rows rendered.+- [ ] Hover / active / focus states on ticker items, "jump to latest", and any controls.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); `tests/activity-cinema.test.js` added and green (pure presentation logic covered).+- [ ] Verified live in a browser against `npm run dev` (port 3000), including a deliberately dark agent.+- [ ] `git diff` self-reviewed; every line justified; `prefers-reduced-motion` honored.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `improvement`, `feature`), e.g. "The live wall's activity feed got cinematic — typed narration, action icons, severity colors, and a platform-wide ticker, so even an idle agent is worth watching." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. Coin mentions in entries come from real `agent_actions`/feed rows at runtime — render them, but never hardcode, market, or recommend a non-$THREE mint in source or copy.+- No mocks, no fake data, no fabricated entries, no `setTimeout` fake progress (typing is driven by a real frame clock), no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/20-spectator-tips-reactions.md b/docs/live-agent-tasks/20-spectator-tips-reactions.mdnew file mode 100644index 000000000..9042963c7--- /dev/null+++ b/docs/live-agent-tasks/20-spectator-tips-reactions.md@@ -0,0 +1,74 @@+# 20 — Spectator Tips & Reactions++> **Mission (one line):** Viewers react and tip live — emojis float up over the stream, real value lands in the agent's wallet, and the agent looks back at you, says thanks in its own voice, and emotes. Watching becomes a two-way thing.++## The watchable moment+On `/agents-live` and `/agent-screen` a reaction bar sits under the stream. A viewer taps 🔥 and a fire emoji floats up across the live screen; others pile on and a burst ripples over the canvas. Someone sends a real tip — the agent's avatar turns, plays a `cheer`/`wave` emote, and the TTS voice says "Thanks for the tip, that one's going to the floor fund." The reaction count ticks the watch-intent signal so the wall knows this agent is *hot*. The emotion is **connection** — the agent acknowledges the room in real time.++## Who benefits+- **Viewer:** their reaction and tip visibly land — the agent responds to *them*, on stream, by name of action. That's why people stay and come back.+- **Agent owner:** real tips flow to the agent wallet, and high-reaction agents get surfaced — a direct incentive to put on a good show.+- **Platform:** turns passive watching into a value loop; extends the existing watch-intent + feed infra into live engagement that ranks the wall.++## Where it lives+- **Surface:** `/agents-live` card | `/agent-screen?agentId=…` | both+- **Entry points (verify these exist before editing):**+ - `pages/agents-live.html` / `src/agents-live.js`+ - `pages/agent-screen.html` / `src/agent-screen.js`+ - `api/agent/watch-intent.js` (public, IP rate-limited; writes a Redis sorted set `screen:wanted` keyed by recency — extend to carry reactions)+ - `multiplayer/src/feed.js` (`publishFeedEvent(event, dedupeKey)` — throttled, `ALLOWED_TYPES`-gated feed producer)+ - `src/animation-manager.js` (`playOnce('cheer'|'wave'|…)`, additive overlay gestures, `supportsCanonicalClips()`)+ - `api/tts/speak.js` (acknowledgement narration)++## Data flow (source → transform → render)+1. **Source:** viewer input on the reaction bar (emoji taps) and the tip control. Reactions extend `api/agent/watch-intent.js` (already the per-agent viewership signal). Tips ride the **existing real-value tip path** — reuse the tip infra already wired into `multiplayer/src/feed.js` (`publishFeedEvent` with a `tip` event type); no new payment rail is invented.+2. **Transform:** `watch-intent` accepts an optional `reaction` (validated against a fixed emoji allowlist) and increments a throttled per-agent reaction counter in Redis alongside the `screen:wanted` recency set. Tips are recorded by the existing tip handler and published to the feed (throttled via `publishFeedEvent`'s `dedupeKey`).+3. **Transport:** reaction bursts + tip events fan out to viewers over the existing `api/agent-screen-stream.js` (per agent) and `multiplayer/src/feed.js` (site-wide); the agent's own acknowledgement is pushed via `api/agent-screen-push.js`.+4. **Render:** floating-emoji overlay over the stream canvas (both surfaces); on a tip, the avatar plays a `cheer`/`wave` emote via `src/animation-manager.js` and speaks an acknowledgement via `api/tts/speak.js`; the card shows a live reaction count that also feeds wall ranking.++## Build spec+1. **`api/agent/watch-intent.js`** — extend the body to accept optional `reaction` against a fixed allowlist (e.g. `🔥 ❤️ 👏 🚀 😂`). Keep the existing per-IP `limits.apiIp` gate; add a tighter per-IP-per-agent reaction throttle (Redis) so one viewer can't spam. Increment a windowed reaction counter and broadcast the reaction (debounced) to the agent's stream. Falls back gracefully when Redis is absent (current behavior preserved).+2. **Tip path** — reuse the existing tip handler + `multiplayer/src/feed.js` `publishFeedEvent({ type:'tip', … }, dedupeKey)`. Do **not** add a new payment endpoint; wire the reaction bar's tip button to the real tip flow already in the codebase. Validate amount + auth at the boundary.+3. **`src/reaction-overlay.js`** (new) — a canvas/DOM overlay that spawns floating emojis with physics (rise + drift + fade), batches bursts, and caps concurrent particles for performance. Pure-ish render module reused by both surfaces.+4. **`src/agents-live.js`** + **`src/agent-screen.js`** — add the reaction bar (emoji buttons + tip button), POST reactions to `watch-intent`, mount `reaction-overlay`, subscribe to incoming reactions/tips over the stream, and render the live reaction count + recent-tip badge.+5. **Agent acknowledgement** — on a tip event for the focused agent, call `src/animation-manager.js` `playOnce('cheer')` (guarded by `supportsCanonicalClips()`; fall back to an additive `wave` overlay) and POST a short thank-you to `api/tts/speak.js` for voiced acknowledgement (lip-synced via the avatar cam).+6. **Abuse resistance** — server-side: emoji allowlist, per-IP + per-IP-per-agent throttles, amount validation on tips, idempotency on the tip path. Client-side throttling is cosmetic only; the server is the gate.+7. **Tests** — `tests/reaction-overlay.test.js` (spawn/cap/fade math, batching) and a `watch-intent` validation test (allowlist + throttle decisioning). Pure logic only.++## Files to create / modify+- `api/agent/watch-intent.js` — accept + throttle + broadcast reactions alongside viewership.+- `src/reaction-overlay.js` — floating-emoji overlay (capped, batched).+- `src/agents-live.js` — reaction bar + overlay + counts on cards.+- `src/agent-screen.js` — reaction bar + overlay + tip-driven emote/TTS acknowledgement.+- `tests/reaction-overlay.test.js` + watch-intent validation test — pure-logic coverage.++## Real integrations (no mocks, ever)+- `api/agent/watch-intent.js` (Redis `screen:wanted` + reaction counters) — real viewership/reaction signal.+- The existing real-value **tip path** via `multiplayer/src/feed.js` `publishFeedEvent` — real value to the agent wallet; no invented rail.+- `src/animation-manager.js` real emotes; `api/tts/speak.js` real voiced acknowledgement.+- Credentials: Redis (Upstash), tip/wallet config, TTS keys in `.env` / `vercel env`. If missing, ask once then proceed (reactions degrade gracefully without Redis).++## Every state designed+- **Loading:** reaction bar renders disabled with a subtle pulse until the stream connects; counts show a skeleton.+- **Empty:** no reactions/tips yet → "Be the first to react," with the emoji bar inviting interaction (not a dead control).+- **Error:** reaction rejected (throttle/invalid) → a quiet inline cue ("easy — give it a sec"), never a hard error toast spam; tip failure surfaces the real reason with a retry; TTS/emote failure never blocks the value path.+- **Populated:** the hero — floating bursts, live counts, agent emote + voiced thanks on tip.+- **Overflow:** 0 reactions (empty), 1, a flood (server throttle + client particle cap + burst-batching so the canvas never janks), very long tipper names (truncate), network drop mid-burst (queue locally, flush on reconnect; never double-charge a tip — idempotent).++## Definition of done+- [ ] Reachable on both surfaces via real navigation; reaction bar visible under the stream.+- [ ] Real API calls in the network tab (`watch-intent` with reaction, tip path), real value landing in the agent wallet, real emote + TTS on tip.+- [ ] Hover / active / focus states on every emoji button and the tip control.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); reaction-overlay + watch-intent validation tests added and green.+- [ ] Verified live in a browser against `npm run dev` (port 3000): reactions float, count ticks, a test tip triggers emote + voice.+- [ ] `git diff` self-reviewed; every line justified; tips are idempotent and server-throttled.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`), e.g. "Watching is now two-way — send reactions and tips on the live wall, and the agent thanks you out loud with an emote." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. Tip acknowledgements and copy reference only $THREE; never hardcode, market, or recommend a non-$THREE mint.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs. Tips use the real existing value path; reactions are throttled and abuse-resistant server-side.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/21-watch-intent-pool-polish.md b/docs/live-agent-tasks/21-watch-intent-pool-polish.mdnew file mode 100644index 000000000..71a7fba7d--- /dev/null+++ b/docs/live-agent-tasks/21-watch-intent-pool-polish.md@@ -0,0 +1,77 @@+# 21 — Watch-Intent Pool Polish (instant live pixels on demand)++> **Mission (one line):** When a viewer's eyes land on an agent card, a real Chromium caster spins up for it within seconds — and the handoff from skeleton → "warming up" → live frames feels so smooth the viewer never sees the seam.++## The watchable moment+You scroll the `/agents-live` wall. The card you're looking at flips from a dim activity terminal to a crisp, animated "warming up" pulse, then — a beat later — real browser pixels stream in at a visible FPS. Scroll past and the slot quietly frees: no wasted browser, no frozen last-frame. When the pool is full, the card honestly says "3rd in line" and keeps the activity terminal alive underneath, so it is never blank. It feels like a TV wall where every channel you turn to is already broadcasting.++## Who benefits+- **Viewer:** Looks at any agent and gets a live browser feed within seconds, with honest status the whole way — never a dead black box, never a lie about being "live".+- **Agent owner:** Their agent becomes watchable on demand without paying for an always-on browser; the moment someone cares, the pixels appear.+- **Platform:** Turns a fixed pool of 6 Chromium slots into the illusion of infinite live channels — the core economics that let the wall scale to thousands of agents at viewer-bounded cost.++## Where it lives+- **Surface:** `/agents-live` card (primary) + `/agent-screen?agentId=…` watch panel (same handoff states)+- **Entry points (verified to exist):**+ - `src/agents-live.js` — the wall: `buildCard`, `attachStream`, `signalWatch`, `paintActivity`, `startWatchPings`+ - `pages/agents-live.html` — card markup + styles+ - `src/shared/agent-screen-client.js` — SSE client with reconnect backoff+ - `api/agent/watch-intent.js` — POST intent → `ZADD screen:wanted`+ - `api/agent/watch-wanted.js` — GET read side (returns `{ agents, ts }`)+ - `workers/agent-screen-pool/index.js` — Playwright caster pool (`MAX_BROWSERS`, `reconcile`)+ - `api/agent-screen-stream.js` — SSE: emits `open` / `frame` / `log` / `dark` / `ping`++## Data flow (source → transform → render)+1. **Source:** Viewport intersection on a card → `POST /api/agent/watch-intent { agentId }` → `ZADD screen:wanted <now> <agentId>` (90s window). The pool worker polls `GET /api/agent/watch-wanted`, reconciles its bounded Chromium set, and pushes JPEG frames via `api/agent-screen-push.js`.+2. **Transform:** A new `GET /api/agent/watch-status?agentId=…` resolves, from Redis only (no DB), one of: `casting` (a frame exists in `agent:screen:{id}:frame`), `warming` (agent is inside the wanted window AND pool has free capacity), `queued` (wanted but pool at `MAX_BROWSERS` — returns a 1-based queue position by rank in `screen:wanted`), or `activity` (not wanted / Redis off). Position = the agent's reverse-rank in `screen:wanted` minus `MAX_BROWSERS`.+3. **Transport:** Existing SSE `frame`/`dark` events drive the live↔activity flip. The new status is fetched on mount and refreshed only while a card is `warming`/`queued` (not when already `casting`), so steady-state adds no per-frame requests.+4. **Render:** Card screen shows one of five visual states (below). The live badge dot + `[data-status]` text + a new `[data-warming]` overlay reflect the handoff.++## Build spec+1. **`api/agent/watch-status.js` (new):** Public, IP-rate-limited (reuse `limits.apiIp` + `clientIp` as in `watch-intent.js`). Validate `agentId` with `isUuid`. With Redis: read `EXISTS agent:screen:{id}:frame`; if set → `{ state: 'casting' }`. Else read the agent's rank in `screen:wanted` via `ZREVRANK` within the 90s window and compare to `MAX_BROWSERS` (env `SCREEN_POOL_MAX`, default 6, documented to mirror the worker's `MAX_BROWSERS`): rank `< MAX` → `{ state: 'warming' }`; else `{ state: 'queued', position: rank - MAX + 1 }`. No Redis → `{ state: 'activity' }`. Always `cache-control: no-store`.+2. **`src/agents-live.js` — card markup:** In `buildCard`, add a centered overlay node inside `.al-card-screen`: `<div class="al-card-warming" data-warming hidden><span class="al-warming-pulse"></span><span data-warming-text></span></div>`. This sits above the canvas, below the live badge.+3. **`src/agents-live.js` — status loop:** Add `pollWatchStatus(state)` that calls `watch-status`, then drives the overlay: `warming` → show pulse + "Warming up a live view…"; `queued` → show "Live view queued · #N in line"; `casting`/`activity` → hide overlay. Call it once in `mountAgent` right after `signalWatch`, and schedule a refresh every 4s **only while** `state` is not live and the last status was `warming`/`queued`. Clear the timer when a `frame` arrives (the agent went `casting`) or on `suspendStreams`.+4. **`src/agents-live.js` — intersection-driven intent:** Replace the "signal every card on mount" pattern with an `IntersectionObserver` (threshold 0.1) so `signalWatch` + status polling fire only for cards actually on screen, and stop when scrolled away. Keep `startWatchPings` but iterate only currently-intersecting cards (track an `_inView` Set). This is what frees pool slots the instant a viewer scrolls past — the missing teardown trigger the worker already honors.+5. **`src/agents-live.js` — FPS-aware label:** The wall already counts frames per agent in `_fpsMap`. Surface per-card FPS in the live badge tooltip (`title` attribute on `[data-status]`) and downgrade the dot to a "thin" class when an agent's own FPS drops below 1/s for >3s while still `casting` (stuttering caster), distinct from full `dark`.+6. **`src/agents-live.js` — reconnection polish:** On `es.onerror`, before the EventSource's own retry, immediately re-`signalWatch` so a dropped viewer reclaims its pool priority, and show a transient "Reconnecting…" status (not "Idle") for the first 2s after a drop. Mirror `RECONNECT_DELAYS` semantics already in `agent-screen-client.js`.+7. **`src/agent-screen.js` (watch panel parity):** Wire the same `warming`/`queued` overlay into the single-agent stage so the deep-dive page shows identical honest handoff copy. Reuse `watch-status`; the page already imports `createAgentScreenClient`.+8. **`pages/agents-live.html` — styles:** Add `.al-card-warming` (absolute-centered, backdrop blur, fade-in via opacity/transform transition), `.al-warming-pulse` (a CSS keyframe ring, `will-change: transform, opacity`, respects `prefers-reduced-motion` by falling back to a static dot), and `.al-card-live-dot.thin` (amber). No `setTimeout`-driven fake progress — the pulse is pure CSS ambiance, never a lie about real progress.+9. **`workers/agent-screen-pool/index.js` — capacity signal:** When `reconcile()` skips a wanted agent because `pool.size >= MAX_BROWSERS`, it already breaks; no change to the cast logic. Confirm `MAX_BROWSERS` default (6) and document that `SCREEN_POOL_MAX` on the API must match it so queue math is accurate. (Worker reads its own env; the API reads `SCREEN_POOL_MAX` for display only.)++## Files to create / modify+- `api/agent/watch-status.js` — new: Redis-only per-agent caster status + queue position.+- `src/agents-live.js` — IntersectionObserver intent, status overlay loop, FPS-aware badge, reconnection polish.+- `src/agent-screen.js` — warming/queued overlay parity on the single-agent stage.+- `pages/agents-live.html` — warming overlay + pulse + thin-dot styles (reduced-motion aware).+- `workers/agent-screen-pool/index.js` — comment/env alignment so `SCREEN_POOL_MAX` mirrors `MAX_BROWSERS` (no behavior change required beyond doc/env).++## Real integrations (no mocks, ever)+- Redis (`api/_lib/redis.js`) for `screen:wanted` + `agent:screen:{id}:frame` — the same keys the worker and stream already use.+- Real Playwright casters from `workers/agent-screen-pool` pushing through `api/agent-screen-push.js`.+- SSE via `api/agent-screen-stream.js` — no new transport.+- Credentials: `SCREEN_WORKER_SECRET` (worker ↔ API), Upstash Redis env. Locate in `.env` / `vercel env`; if absent, the path degrades to the activity view (already handled) — never fake a "live" state without a real frame.++## Every state designed+- **Loading:** Card mounts on the activity terminal (already painted) while `watch-status` resolves — never a blank canvas.+- **Empty:** No agents → existing `renderEmpty()` CTA. A watched agent with zero frames and no activity → "standing by" terminal line (existing `paintActivity`).+- **Error:** `watch-status` fails → overlay hidden, activity view stays; SSE drop → "Reconnecting…" then auto-retry. Never a silent black box.+- **Populated:** Live JPEG frames at visible FPS, green live dot, FPS in tooltip — the hero state.+- **Overflow:** Pool full → honest "queued · #N"; 1000 cards → IntersectionObserver keeps only on-screen cards signaling intent (bounded Redis writes); very long agent name → existing `esc` + CSS truncation; mid-stream network drop → reconnection path above.++## Definition of done+- [ ] Reachable from `/agents-live` and `/agent-screen` via real navigation.+- [ ] `watch-status` calls visible in the network tab; real `casting`/`warming`/`queued` transitions observed against a running `workers/agent-screen-pool`.+- [ ] Hover/active/focus states on card, watch button, and expand control intact.+- [ ] All five states implemented and visually verified.+- [ ] No console errors/warnings from this code; IntersectionObserver + timers cleaned up on `suspendStreams`/unmount.+- [ ] Existing tests pass (`npm test`); add a unit test for the queue-position math (`position = rank - MAX + 1`).+- [ ] Verified live in a browser against `npm run dev` (port 3000) with the pool worker running.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`, `improvement`) — e.g. "Live agent wall now spins up a real browser feed the instant you look at a card, with honest 'warming up' and queue states." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. This task touches transport/UX only — no token copy.+- No mocks, no fake data, no `setTimeout` fake progress (the CSS pulse is ambiance, not a progress claim), no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/22-ambient-world-dj.md b/docs/live-agent-tasks/22-ambient-world-dj.mdnew file mode 100644index 000000000..a863cf4f6--- /dev/null+++ b/docs/live-agent-tasks/22-ambient-world-dj.md@@ -0,0 +1,79 @@+# 22 — Ambient World DJ (the calm channel)++> **Mission (one line):** On `/agent-screen`, the agent stops trading and starts hosting — curating a living 3D world with a day/night cycle, wandering NPCs, and a calm spoken narration, so the screen becomes the one channel you leave open all day.++## The watchable moment+The stage isn't a dashboard — it's a place. A low-poly biome breathes under a moving sun; the light warms toward golden hour, then cools to dusk and a starfield. NPCs wander their zones, idle by props, drift between districts. In the corner the agent's avatar head glances around like a host, and a soft line scrolls in the log — "Sun's setting over the plaza. Quiet shift on the wall tonight." With audio on, that line is spoken in the agent's voice over an ambient bed. It's the opposite of the trading desk: nothing urgent, everything alive, impossible to stop watching.++## Who benefits+- **Viewer:** A calm, always-on scene to keep open — ambient company, not information overload. The "lo-fi beats" of the agent wall.+- **Agent owner:** Gives their agent a 24/7 watchable presence even when it isn't trading; personality and voice make it memorable.+- **Platform:** Proves the screen surface is a stage, not just a dashboard — and reuses the entire `src/game/` world engine, linking the live wall to the worlds product.++## Where it lives+- **Surface:** `/agent-screen?agentId=…` (primary stage, an alternate "Ambient" mode); a card on `/agents-live` can opt into the ambient render as its live feed.+- **Entry points (verified to exist):**+ - `src/agent-screen.js` — the stage, panel system, avatar cam, activity log, Zen mode+ - `pages/agent-screen.html` — stage container + controls+ - `src/game/world-env.js` — `seedFromString`, biome archetypes, sun/light rig, `update(dt)`+ - `src/game/world-zones.js` — `ZONES`, `SPAWN_POINTS`, `zoneAt`, `pickSpawn`, `clampToBounds`+ - `src/game/world-objects.js` — `WorldObjects`, `PROP_CATALOG`, prop placement+ - `src/game/npc/ambient-life.js` — `AmbientLife` (wandering NPC behavior)+ - `src/game/npc/world-life.js`, `src/game/npc/npc.js` — NPC bodies + movement+ - `api/tts/speak.js` — real TTS (NVIDIA Magpie → OpenAI backstop)+ - `api/agent-screen-push.js` / `api/agent-screen-stream.js` — narration as `log` entries++## Data flow (source → transform → render)+1. **Source:** The agent's identity seeds the world: `seedFromString(agentId or coin mint)` picks the biome from `world-env.js`. Real time-of-day comes from a deterministic clock derived from `Date.now()` scaled to a configurable cycle length (default 8 real-minutes per day) so all viewers of the same agent see the same sky.+2. **Transform:** A lightweight "DJ script" generator turns world events (sunrise, golden hour, dusk, an NPC reaching a landmark, a zone getting "busy") into short host lines. Lines are templated from the world state — never random filler — and rate-limited to one every ~25–40s so it stays calm.+3. **Transport:** Each host line is pushed as a real activity entry via `POST /api/agent-screen-push` (`type: 'activity'`) so it appears in the log AND is replayable to late joiners through `api/agent-screen-stream` `log` backfill. With audio enabled, the same text is sent to `POST /api/tts/speak` and played through the Web Audio path.+4. **Render:** A new client module mounts the `src/game/` world into the `/agent-screen` stage canvas (Three.js scene + renderer already imported on the page), ticks `worldEnv.update(dt)` + `ambientLife.update(dt)` in the render loop, drives the sun by the deterministic clock, and renders the avatar head cam as the "host" (existing avatar-cam panel).++## Build spec+1. **`src/agent-screen-world.js` (new):** Export `createAmbientWorld({ agentId, seed, container })`. Build a `Scene`, `WebGLRenderer`, `PerspectiveCamera`; call into `world-env.js` to create the biome group from `seedFromString(seed)`; instantiate `WorldObjects` for props and `AmbientLife` for NPCs using `world-zones.js` spawn points. Return `{ start, stop, setTimeScale, getState }`. Geometry is shared/cloned per the world-env doctrine — cheap enough to run beside the avatar cam.+2. **Deterministic day/night:** Add `worldClock(now, cycleMs)` returning a `0..1` phase. Map phase → sun elevation/azimuth + sky/fog interpolation by reusing the biome's `sun`/`sky`/`fog` fields. Drive `world-env`'s light rig each frame from the phase (no `Math.random` in the layout path — matches `world-env.js` seeded design). Same agent + same wall-clock = same sky for every viewer.+3. **`src/agent-screen-dj.js` (new):** A `DjScript` that observes world state (`getState()` exposes phase, active zone populations, recent NPC arrivals) and emits host lines from a template set keyed to events: `sunrise`, `goldenHour`, `dusk`, `night`, `zoneBusy(zoneName)`, `npcArrived(name, landmark)`, `idleAmbiance`. Enforce a min-gap timer (configurable `DJ_MIN_GAP_MS`, default 28000). Each emitted line returns `{ text, type, mood }`.+4. **Narration wiring (`src/agent-screen.js`):** Add an "Ambient" stage mode toggle (alongside the existing live/zen modes). When active: start the world, start the DJ loop, and for each line POST to `/api/agent-screen-push` so it lands in the log + stream. Gate behind the same agent ownership/JWT used by other push calls (the page already manages the agent context).+5. **TTS soundscape (opt-in):** Add an audio toggle (default OFF — calm, respects autoplay policy and requires a user gesture). When on, send each host line to `/api/tts/speak`, decode via the existing Web Audio path, duck under a soft ambient pad. Drive the avatar's visemes from the analyser exactly as the existing lipsync surfaces do (the TTS endpoint header already describes the bytes for `decodeAudioData`).+6. **Avatar as host:** Reuse the existing avatar-cam panel; when in Ambient mode, add subtle idle look-around using the `AnimationManager` already imported in `src/agent-screen.js`. No new rig list — drives the canonical clips per CLAUDE.md.+7. **`/agents-live` opt-in (optional, `src/agents-live.js`):** Allow an agent flagged `ambient` to render the world module as its card feed instead of the activity terminal, at a low frame budget — same `start/stop` lifecycle as casters, torn down when scrolled away.+8. **`pages/agent-screen.html` — controls + styles:** Add the Ambient mode button, audio toggle, and a tiny "time of day" readout (sunrise/day/dusk/night) styled with existing design tokens. Reduced-motion: hold the clock at midday and disable look-around.++## Files to create / modify+- `src/agent-screen-world.js` — new: mounts the `src/game/` world into the stage with a deterministic day/night clock.+- `src/agent-screen-dj.js` — new: world-state → host narration script with calm pacing.+- `src/agent-screen.js` — Ambient stage mode, narration push, TTS soundscape, host avatar idle.+- `pages/agent-screen.html` — Ambient mode + audio toggles, time-of-day readout, styles.+- `src/agents-live.js` — (optional) ambient-flagged card feed using the same world module.++## Real integrations (no mocks, ever)+- The real `src/game/` world engine: `world-env.js`, `world-zones.js`, `world-objects.js`, `npc/ambient-life.js`, `npc/world-life.js`.+- Real TTS: `api/tts/speak.js` (NVIDIA Magpie free lane → OpenAI backstop). No synthesized/fake audio.+- Real narration transport: `api/agent-screen-push.js` + `api/agent-screen-stream.js`.+- Credentials: `NVIDIA_API_KEY` (TTS), agent JWT for push. Locate in `.env` / `vercel env`. Missing TTS key → silent fallback to text-only narration (no audio), never a fake voice.++## Every state designed+- **Loading:** Stage shows a skeleton sky gradient (from the biome's `sky` palette) while the world group builds — never a blank canvas or spinner.+- **Empty:** No NPCs spawned yet → the biome + sun still render and the DJ emits `idleAmbiance` lines ("Quiet out here right now — just the wind through the plaza").+- **Error:** WebGL unavailable → fall back to the standard activity stage with a one-line notice; TTS error → text-only narration continues. Never a black stage.+- **Populated:** Full biome, moving sun, wandering NPCs, periodic host lines (spoken if audio on) — the hero state.+- **Overflow:** Long agent/NPC names truncated; viewers across timezones all see the same deterministic sky; tab backgrounded → pause the render loop + DJ via the existing `visibilitychange` handling; 1000 cards on the wall → ambient render only for on-screen, low-budget cards.++## Definition of done+- [ ] Reachable: `/agent-screen?agentId=…` → Ambient mode toggle; world renders.+- [ ] Real narration POSTs visible in the network tab; lines appear in the log and replay to late joiners via the stream backfill.+- [ ] Audio toggle gates real `/api/tts/speak` calls; visemes drive the avatar.+- [ ] Hover/active/focus on Ambient toggle, audio toggle, time-of-day readout.+- [ ] All five states implemented.+- [ ] No console errors/warnings; render loop + audio context torn down on mode exit and `visibilitychange`.+- [ ] Existing tests pass (`npm test`); add a unit test for `worldClock(now, cycleMs)` phase mapping and the DJ min-gap pacing.+- [ ] Verified live in a browser against `npm run dev` (port 3000), including a full day/night cycle at an accelerated time scale.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`) — e.g. "Agent screens now have an Ambient mode: a living 3D world with day/night, wandering life, and your agent narrating as host (optional voice)." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. The world is seeded by agent id / runtime mint only — narration must never promote a non-$THREE token.+- No mocks, no fake data, no fake voice, no `setTimeout` fake progress, no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/23-portfolio-pnl-hud.md b/docs/live-agent-tasks/23-portfolio-pnl-hud.mdnew file mode 100644index 000000000..21b3b30bf--- /dev/null+++ b/docs/live-agent-tasks/23-portfolio-pnl-hud.md@@ -0,0 +1,80 @@+# 23 — Portfolio / PnL HUD (the live scoreboard)++> **Mission (one line):** A real-time PnL HUD overlays both surfaces — the agent's holdings valued live, net worth and 24h change ticking, a sparkline breathing — so every watcher can see the score, not just the action.++## The watchable moment+A clean glass HUD floats over the screen canvas: net worth in SOL and USD, a green or red 24h delta that ticks as prices move, and a thin sparkline that redraws with each snapshot. Below it, the top holdings stack as compact rows — $THREE pinned and featured at the top, other holdings shown as neutral on-chain data. On the `/agents-live` wall, the same data condenses to a single PnL badge in the corner of each card: `+12.4%` glowing green. You can watch an agent trade AND watch its book react in the same frame. It turns watching into spectating a scoreboard.++## Who benefits+- **Viewer:** Sees whether the agent is actually winning — real stakes, real numbers, live.+- **Agent owner:** Their agent's performance is on display; a strong book is a flex and a reputation signal.+- **Platform:** Links the live surfaces to the real on-chain valuation layer and the pump intel engine, and features $THREE prominently across every screen.++## Where it lives+- **Surface:** both — HUD overlay on `/agent-screen` stage; compact PnL badge on each `/agents-live` card.+- **Entry points (verified to exist):**+ - `src/agent-screen.js` — stage + floating panel system (the HUD is a new panel)+ - `pages/agent-screen.html` — stage container, panel chrome, design tokens+ - `src/agents-live.js` — `buildCard` (badge insertion), card lifecycle+ - `pages/agents-live.html` — card markup + styles+ - `api/agents/balances.js` — batched real on-chain wallet valuation + 24h P&L + sparkline (`wallet_value_snapshots`)+ - `api/agents/portfolio.js` — owner-only deep snapshot + `…/portfolio/stream` SSE (cost basis, per-holding P&L)+ - `api/pump/intel.js` — per-mint classification + signals for holding context+ - `mcp-server/src/tools/pump-snapshot.js` — live price/volume/holders for an arbitrary mint+ - `api/pump/check-three-balance.js` + `api/_lib/three-gate.js` — $THREE balance read++## Data flow (source → transform → render)+1. **Source:** Public valuation for any agent's wallet via `POST /api/agents/balances` (batched, 60s-cached, real Helius DAS → public RPC, Jupiter/pump.fun pricing). For the owner viewing their own agent, the richer owner-gated `GET /api/agents/:id/portfolio` + `…/portfolio/stream` SSE adds cost basis and per-source P&L. Per-holding price/context for non-balance mints comes from `api/pump/intel.js` (read-only) and the `pump_snapshot` MCP tool plumbing.+2. **Transform:** Normalize to a `PnlSnapshot`: `{ netWorthSol, netWorthUsd, change24hPct, change24hUsd, holdings: [{ mint, symbol, valueSol, valueUsd, pct, isThree }], sparkline: number[] }`. $THREE (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) is detected and pinned first with a featured marker; all other holdings render as neutral on-chain rows — no promotion, no recommendation.+3. **Transport:** `/agent-screen` HUD: poll `balances` on a 30s cadence, OR (owner) subscribe to `…/portfolio/stream` SSE for push updates. `/agents-live` badges: a single batched `POST /api/agents/balances` with all visible card ids (the endpoint exists precisely to avoid an N×3 request storm).+4. **Render:** HUD panel on the stage (net worth, 24h delta, sparkline, holdings rows); compact `+N%` badge in each wall card corner, color-coded, with a tooltip showing net worth.++## Build spec+1. **`src/shared/pnl-snapshot.js` (new):** A pure normalizer `toPnlSnapshot(raw)` mapping the `balances`/`portfolio` response shapes into the `PnlSnapshot` above, with `isThree` detection against the $THREE CA and a `formatPnl` helper (SOL/USD, signed %, color tone). No fetching here — pure, unit-testable.+2. **`src/shared/pnl-fetch.js` (new):** `fetchBatchBalances(agentIds)` → one `POST /api/agents/balances`; `subscribePortfolio(agentId, onSnapshot)` → owner SSE to `…/portfolio/stream` with the reconnect pattern from `agent-screen-client.js`. Both return normalized `PnlSnapshot`s. Errors surface to callers (handled at the UI boundary), never swallowed into fake zeros.+3. **`src/agent-screen.js` — HUD panel:** Add a floating, draggable/minimizable HUD panel (reuse the existing panel framework). Header: net worth SOL + USD. Sub: 24h delta with up/down arrow + color. Body: sparkline canvas (redraw on each snapshot from `snapshot.sparkline`, empty → flat baseline with "no history yet"). Holdings list: $THREE row pinned + featured chip, then top holdings by value. Wire to `pnl-fetch` (owner → SSE; otherwise 30s poll). Persist panel position/visibility like the other panels.+4. **Sparkline render:** Small canvas drawn from real `wallet_value_snapshots`-derived series. 0 points → flat line + "Tracking starts now"; 1 point → single dot + value; many → smoothed polyline with min/max ticks. `will-change: transform` only where animating.+5. **`src/agents-live.js` — PnL badge:** In `buildCard`, add `<div class="al-card-pnl" data-pnl hidden></div>` in the screen corner. After the roster page mounts, call `fetchBatchBalances([...visible ids])` once and hydrate each badge with `change24hPct` (color-coded) + a `title` of net worth. Refresh on a slow cadence (e.g. 60s) for in-view cards only (pairs with task 21's IntersectionObserver). Hide the badge when balances are null (no wallet / no data).+6. **`$THREE` featuring:** In the HUD holdings list, when the agent holds $THREE, pin it first with a featured chip and a link to `/coin/FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump` (verify the live coin route before linking; fall back to no link if absent). Other holdings: neutral rows, on-chain data only, never a buy/recommend affordance.+7. **`pages/agent-screen.html` + `pages/agents-live.html` — styles:** HUD glass panel, delta colors (use existing success/danger tokens), sparkline canvas sizing, and the compact `.al-card-pnl` badge (positive/negative variants, hover lift, accessible contrast). Reduced-motion: no badge pulse.++## Files to create / modify+- `src/shared/pnl-snapshot.js` — new: pure normalizer + formatters (unit-tested).+- `src/shared/pnl-fetch.js` — new: batched balances fetch + owner portfolio SSE.+- `src/agent-screen.js` — floating PnL HUD panel wired to live data.+- `src/agents-live.js` — compact PnL badge per card, batched hydration.+- `pages/agent-screen.html` — HUD styles.+- `pages/agents-live.html` — PnL badge styles.++## Real integrations (no mocks, ever)+- `api/agents/balances.js` — real batched on-chain valuation (Helius DAS → RPC, Jupiter/pump.fun pricing, real `wallet_value_snapshots` sparkline).+- `api/agents/portfolio.js` + `…/portfolio/stream` — owner-only real cost basis + push snapshots.+- `api/pump/intel.js` + `mcp-server/src/tools/pump-snapshot.js` — real per-mint price/context.+- `api/pump/check-three-balance.js` / `api/_lib/three-gate.js` — real $THREE balance.+- Credentials: `HELIUS_API_KEY`, Jupiter/pump.fun (public), session/JWT for owner portfolio. Locate in `.env` / `vercel env`. Missing snapshot history → empty sparkline (designed empty state), never a synthesized curve.++## Every state designed+- **Loading:** HUD shows skeleton number bars + a muted flat sparkline; badge shows a dim `· · ·` while batched balances resolve.+- **Empty:** Agent with no wallet / no holdings → HUD: "No on-chain holdings yet" + how the wallet gets funded; badge hidden.+- **Error:** Balances fetch fails → HUD shows "Couldn't value holdings — retry" with a working retry button; badge hidden, not zeroed. SSE drop (owner) → reconnect + "reconnecting" tick.+- **Populated:** Net worth + live 24h delta + sparkline + ranked holdings ($THREE featured) — the hero state.+- **Overflow:** 0 holdings (empty), 1 holding (no ranking noise), 1000 cards (batched single request, in-view only), very long token symbols truncated, a holding worth $0.0001 still shown truthfully, mid-update price feed gap → last good value held with a staleness dot.++## Definition of done+- [ ] Reachable on both surfaces via real navigation.+- [ ] Real `balances`/`portfolio` calls in the network tab; numbers match on-chain reality.+- [ ] $THREE pinned + featured; no other token promoted or made buyable.+- [ ] Hover/active/focus on HUD panel controls, holding rows, and the wall badge.+- [ ] All five states implemented.+- [ ] No console errors/warnings; SSE + timers cleaned up on unmount/`visibilitychange`.+- [ ] Existing tests pass (`npm test`); add unit tests for `toPnlSnapshot` ($THREE pinning, % math) and sparkline edge cases (0/1/N points).+- [ ] Verified live in a browser against `npm run dev` (port 3000) with a real funded agent wallet.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`) — e.g. "Live agent screens and the wall now show a real-time portfolio HUD: net worth, 24h PnL, and a sparkline, with $THREE featured." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. $THREE is featured/pinned; every other holding is neutral runtime on-chain data only — never hardcoded, marketed, recommended, or made buyable. The HUD is a scoreboard, not a shill.+- No mocks, no fake data, no synthesized sparkline, no `setTimeout` fake progress, no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/24-deploy-to-wall-onboarding.md b/docs/live-agent-tasks/24-deploy-to-wall-onboarding.mdnew file mode 100644index 000000000..bb7376033--- /dev/null+++ b/docs/live-agent-tasks/24-deploy-to-wall-onboarding.md@@ -0,0 +1,76 @@+# 24 — Deploy-to-Wall Onboarding (zero-friction "go live")++> **Mission (one line):** A polished wizard that takes an owner from "I have an agent" to "my agent is live on the public wall" in four steps — pick agent, generate its JWT, copy the run command, watch it appear — with a real "you're live" confirmation.++## The watchable moment+You land on `/agent-screen` with no agentId. A clean, three-step wizard greets you: pick your agent from a list, hit "Generate key" and watch a fresh `AGENT_JWT` appear (shown once, copy button glowing), then choose your runtime — `npm`, Docker, or Browserbase — and copy the exact run command. A live status strip below the wizard polls the public directory; the moment your caster pushes its first frame, the strip flips to a green "You're live on the wall" with a direct link to your card on `/agents-live`. No docs spelunking, no guessing env vars. Friction: zero.++## Who benefits+- **Agent owner:** Goes from agent → live broadcast in minutes, with the run command generated for their exact setup.+- **Viewer:** More agents on the wall, more to watch.+- **Platform:** Removes the single biggest barrier to wall density — getting owners to actually deploy a caster — and ties the setup wizard to the public directory and the live surfaces.++## Where it lives+- **Surface:** `/agent-screen` (the existing no-agentId setup wizard, extended) → confirms appearance on `/agents-live`.+- **Entry points (verified to exist):**+ - `src/agent-screen.js` — `renderSetup()` (the existing wizard: pick agent → generate key → copy run command, tabs `local`/etc.)+ - `pages/agent-screen.html` — wizard container (`#asc-no-agent`, `.ws-setup`)+ - `api/api-keys.js` — `POST` creates an API key (used as `AGENT_JWT`); requires session or `profile` scope+ - `api/agents.js` — owner's agent list (`GET /api/agents`, credentials)+ - `api/agents/public.js` — public directory (to confirm the agent is now indexed/live)+ - `api/agent-screen-stream.js` — SSE used to detect the first real frame ("you're live")+ - `workers/agent-screen-pool/index.js`, `workers/agent-screen-pool/README.md`, `workers/agent-screen-pool/Dockerfile` — the caster runtimes the command targets++## Data flow (source → transform → render)+1. **Source:** `GET /api/agents` (owner's agents). `POST /api/api-keys` mints the `AGENT_JWT` (name it `agent-screen:<agentName>`, scope `agents:read profile` — verify against `ALLOWED_SCOPES` in `api-keys.js`). The public directory `GET /api/agents/public?q=<name>` and the agent's SSE `frame` event confirm "live".+2. **Transform:** Build per-runtime run commands from real values — selected `agentId`, the just-minted key, and the canonical pool worker entry (`workers/agent-screen-pool`). Three runtimes: local `npm` (clone/run the worker), `docker` (using the existing `Dockerfile`), `browserbase` (env-driven remote Chromium). Each command embeds the real env the worker requires (`SCREEN_WORKER_SECRET` note, `BASE_URL`, `MAX_BROWSERS`) — no placeholders the user must guess.+3. **Transport:** A live "go-live detector" opens `api/agent-screen-stream?agentId=…` for the selected agent and waits for the first `frame` event (real caster pixels) — that is ground truth for "live", more reliable than a directory poll alone. Fall back to directory presence if no caster within a window.+4. **Render:** Step-by-step wizard with copy-to-clipboard on the key and each command; a live status strip; a "You're live" success state linking to the agent's card.++## Build spec+1. **`src/agent-screen.js` — extend `renderSetup()`:** Keep the existing pick→key→command flow; restructure into an explicit 4-step stepper with a progress indicator: (1) Pick agent, (2) Generate `AGENT_JWT`, (3) Copy run command, (4) Go live. Each step unlocks the next; the stepper persists the selected agent + active runtime tab in memory for the session.+2. **Step 1 — pick agent:** Render the `GET /api/agents` list with avatar + name + id. Signed-out → a clear sign-in CTA (the endpoint already 401s; the wizard already detects `isSignedIn`). No agents → empty state linking to `/dashboard-next/create`.+3. **Step 2 — generate key:** `POST /api/api-keys { name, scope }`. Show the returned secret exactly once with a prominent copy button and a "store this now — it won't be shown again" warning. If a key for this agent likely exists, offer "generate a new one" rather than silently failing. Surface real API errors (rate limit, scope) inline.+4. **Step 3 — copy run command:** Three runtime tabs. Each renders a real, complete command block built from the selected `agentId` + minted key + the canonical worker path, including the required env (`SCREEN_WORKER_SECRET` must match the API's — explain in one line where to set it; never invent a value). Copy button per block. `docker` tab references the real `workers/agent-screen-pool/Dockerfile`; `browserbase` tab sets the documented Browserbase env.+5. **Step 4 — go live + confirmation:** Open the SSE go-live detector. While waiting, show "Watching for your agent's first frame…" with a calm pulse. On first `frame`: flip to "You're live on the wall" with a button to `/agents-live` (and a deep link to `/agent-screen?agentId=…`). Also poll `GET /api/agents/public?q=<name>` to confirm directory presence as a secondary signal. Provide a "Not appearing? Common fixes" disclosure listing the real failure modes (secret mismatch, worker not started, agent private).+6. **Copy-to-clipboard:** Use the Clipboard API with a visible "Copied" confirmation and a textarea fallback. Every copy target (key + 3 commands) gets one.+7. **`pages/agent-screen.html` — styles:** Stepper chrome, active/complete step states, copy buttons (hover/active/focus), the live status strip (waiting/live/error variants), code blocks with horizontal scroll on overflow. Reuse existing `.ws-setup` tokens.++## Files to create / modify+- `src/agent-screen.js` — extend `renderSetup()` into the 4-step deploy wizard + go-live detector.+- `pages/agent-screen.html` — stepper, copy buttons, live status strip, code block styles.+- `workers/agent-screen-pool/README.md` — ensure the documented env + run commands match exactly what the wizard emits (single source of truth).++## Real integrations (no mocks, ever)+- `api/agents.js` — real owner agent list.+- `api/api-keys.js` — real `AGENT_JWT` minting (`POST`, scoped).+- `api/agents/public.js` — real directory confirmation.+- `api/agent-screen-stream.js` — real first-frame "live" detection.+- The real `workers/agent-screen-pool` runtimes (`npm`, `Dockerfile`, Browserbase).+- Credentials: session cookie / `profile`-scoped bearer for key minting; `SCREEN_WORKER_SECRET` referenced (never fabricated). Locate in `.env` / `vercel env`.++## Every state designed+- **Loading:** Agent list + key generation show skeletons; go-live strip shows a "watching for first frame" pulse, not a fake progress bar.+- **Empty:** No agents → create-agent CTA. Signed-out → sign-in CTA. No runtime selected → step 3 prompts a choice.+- **Error:** Key mint fails (rate limit / scope) → inline actionable message + retry. Caster never connects → "Not appearing?" troubleshooting with the real fixes. Clipboard blocked → textarea fallback.+- **Populated/Success:** Command copied → caster pushes a frame → "You're live on the wall" with a link to the card — the hero state.+- **Overflow:** Owner with 100 agents → searchable/scrollable list; very long agent names truncated in the list and command preview; multiple keys minted → newest shown, older unaffected; agent already live when the wizard opens → skip straight to the success state.++## Definition of done+- [ ] Reachable: visit `/agent-screen` with no agentId → the 4-step wizard.+- [ ] Real `/api/agents`, `/api/api-keys`, `/api/agents/public`, and SSE calls visible in the network tab.+- [ ] A real run command, when executed against the pool worker, produces a frame and flips the wizard to "You're live".+- [ ] Hover/active/focus on every step control and copy button.+- [ ] All five states implemented.+- [ ] No console errors/warnings; SSE detector closed on success/unmount.+- [ ] Existing tests pass (`npm test`); add a test for the run-command builder (correct agentId/runtime/env interpolation, no placeholders).+- [ ] Verified live in a browser against `npm run dev` (port 3000) end-to-end.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`, `improvement`) — e.g. "New deploy-to-wall wizard: pick your agent, generate its key, copy one command, and watch it go live on the public wall." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. This is onboarding plumbing — no token copy.+- No mocks, no fake data, no fabricated secrets/env, no `setTimeout` fake progress, no TODOs, no stubs. The displayed key is the real minted key.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/25-showrunner-director.md b/docs/live-agent-tasks/25-showrunner-director.mdnew file mode 100644index 000000000..58d3b0e1a--- /dev/null+++ b/docs/live-agent-tasks/25-showrunner-director.md@@ -0,0 +1,77 @@+# 25 — Showrunner Director (no dead air on the wall)++> **Mission (one line):** A meta "showrunner" that programs `/agents-live` like a live TV channel — rotating a featured spotlight, surfacing the most interesting live agents right now, and guaranteeing the wall is never dark even when no casters are running.++## The watchable moment+The top of the wall is a spotlight stage that cuts between agents like a broadcast director: right now it's the agent that just landed the biggest trade, captioned "Featured · just bought 2.1 SOL of $THREE"; a beat later it rotates to the newest forge, then to the highest-reputation agent currently casting live. Below, the grid reorders so the genuinely active agents float to the top. When casters go quiet, the spotlight pivots to the platform's live activity feed so there is always motion — never a frozen frame, never dead air. The wall feels curated, alive, and intentional.++## Who benefits+- **Viewer:** Always shown the most interesting thing happening right now — no scrolling past dead cards to find the action.+- **Agent owner:** A real shot at the spotlight when their agent does something notable — a reason to be active.+- **Platform:** The wall reads as a programmed channel, not a dump of cards — the difference between "a feature" and "a destination you leave open."++## Where it lives+- **Surface:** `/agents-live` (a new spotlight stage above the grid + grid reordering).+- **Entry points (verified to exist):**+ - `src/agents-live.js` — roster, cards, `_cards` state, FPS/live tracking (`isLiveNow`, `_fpsMap`)+ - `pages/agents-live.html` — header/stats chrome (`#al-stats`, live count) + grid container+ - `api/agent/watch-wanted.js` — which agents are being watched now (worker-secret gated)+ - `api/feed-stream.js` + `api/_lib/feed.js` — live platform events (`{ id, type, ts, actor, … }`)+ - `api/agents/featured.js` — deterministic "feature one real agent" rule (revenue → newest)+ - `api/agents/public.js` — directory (popular/newest sorts)+ - `api/agent-screen-stream.js` — per-agent live-frame signal (is a caster actually casting)+ - `api/pump/trades-stream.js` / `api/pump/by-agent.js` — real trade events for "biggest trade"++## Data flow (source → transform → render)+1. **Source:** Real signals only — `feed-stream` (live platform events: trades, forges/deploys, level-ups), `featured` (the deterministic revenue/newest pick), `public` (popular roster), and the wall's own client-side `isLiveNow`/`_fpsMap` (which cards are truly casting). A new server endpoint aggregates the cross-agent ranking signals so the client doesn't fan out N requests.+2. **Transform:** A `Showrunner` scorer ranks candidates by a transparent blend: `live now` (a real caster frame within the stale window) > `recent notable event` (biggest trade / newest forge / reputation milestone from the feed, time-decayed) > `featured pick` > `popular`. It produces an ordered "program": a rotating spotlight queue + a grid sort order. No randomness in ranking; ties broken by recency.+3. **Transport:** Reuse `feed-stream` SSE for live event push; the aggregate ranking endpoint is a cheap cached GET refreshed on a cadence. No new heavy infra.+4. **Render:** A spotlight stage cross-fades between the top of the program queue (the chosen agent's live card enlarged + a caption built from its triggering signal); the grid reorders to match the program; when the live set is empty, the spotlight shows the platform activity feed so there's always motion.++## Build spec+1. **`api/agents/showrunner.js` (new):** Public, IP-rate-limited GET. Aggregate, server-side and cached (~10s CDN): the `featured` pick, a slice of recent notable `feed:events` (filtered to agent-attributable types — trade confirmed, agent deployed/forged, reputation/level events) with their actor + magnitude, and a popular roster slice. Return a normalized `{ spotlightCandidates: [{ agentId, name, reason, magnitude, ts }], programOrder: [agentId…], generatedAt }`. "Live now" is layered in client-side (the server can't know which cards a given viewer has casting). Degrade gracefully (200 with `degraded:true`) if feed/DB is unavailable — the wall keeps working.+2. **`src/showrunner.js` (new):** Client `Showrunner` that merges the server program with the wall's live truth (`isLiveNow`, `_fpsMap`) to compute the final ranked queue + grid order. Subscribe to `feed-stream` for live updates (reuse the page's existing feed plumbing or open a scoped EventSource). Expose `getProgram()`, `next()` (advance spotlight), and an `onChange` callback. Pure scoring extracted into a unit-testable `rankCandidates(...)`.+3. **`src/agents-live.js` — spotlight stage:** Add a spotlight container above the grid. Mount the current program head as an enlarged live card (reuse the existing card stream pipeline — same `attachStream`, so the spotlight shows real frames or the activity terminal). Caption from the triggering `reason` ("biggest trade", "newest forge", "top reputation"). Cross-fade (opacity/transform) on rotation every ~12–15s, pausing on hover so a viewer can linger. Honor `prefers-reduced-motion` (cut instead of fade).+4. **`src/agents-live.js` — grid reorder:** Apply `programOrder` to the grid via CSS `order` (no DOM reshuffle thrash) so active agents float up. Re-sort on each program change. Keep infinite scroll + the existing roster pagination intact.+5. **No dead air:** When the merged live set is empty (no caster casting anywhere the viewer can see and no recent notable event), the spotlight switches to a "Live on three.ws" mode rendering the `feed-stream` ticker as motion — never a frozen or blank stage. The instant any agent goes live or a notable event lands, it reclaims the spotlight.+6. **Spotlight controls:** Prev/next chevrons, a dot indicator of the queue, and a "Watching: <reason>" label. All keyboard-navigable; the spotlight card links to `/agent-screen?agentId=…`.+7. **`pages/agents-live.html` — styles:** Spotlight stage (glass, enlarged screen, caption ribbon), cross-fade transitions, queue dots, chevron hover/active/focus, reduced-motion fallbacks. Integrate with the existing `#al-stats` header so live count + spotlight read as one programmed header.++## Files to create / modify+- `api/agents/showrunner.js` — new: cached aggregate of featured + notable feed events + popular roster → program candidates.+- `src/showrunner.js` — new: client ranking that merges server program with live truth; feed-stream subscription; testable `rankCandidates`.+- `src/agents-live.js` — spotlight stage, program-driven grid reorder, no-dead-air fallback.+- `pages/agents-live.html` — spotlight stage + transition styles.++## Real integrations (no mocks, ever)+- `api/feed-stream.js` + `api/_lib/feed.js` — real live platform events (the canonical `{ id, type, ts, actor }` shape).+- `api/agents/featured.js` — real deterministic feature pick (no hardcoded id).+- `api/agents/public.js` — real popular roster.+- `api/agent-screen-stream.js` — real per-agent live-frame truth.+- `api/pump/trades-stream.js` / `api/pump/by-agent.js` — real trade magnitudes for "biggest trade".+- Credentials: none new for read paths (public, rate-limited). `watch-wanted` stays worker-secret gated and is NOT exposed to the client. Locate any needed env in `.env` / `vercel env`.++## Every state designed+- **Loading:** Spotlight shows a skeleton stage while the program resolves; grid keeps its default popular order until the first program arrives.+- **Empty:** No agents at all → existing `renderEmpty()`. Agents but none live and no notable events → spotlight runs the activity-feed "no dead air" mode.+- **Error:** `showrunner` fails → fall back to client-only ranking from live truth + popular order (the wall never breaks). `feed-stream` drop → spotlight holds the last program and reconnects.+- **Populated:** Rotating spotlight cutting between the biggest trade / newest forge / top live agent, grid reordered to match — the hero state.+- **Overflow:** 1000 agents → program is a bounded top-N; a burst of feed events → time-decay + min-dwell so the spotlight doesn't flicker; very long names/captions truncated; a single live agent → it simply holds the spotlight (no forced rotation to dead cards).++## Definition of done+- [ ] Reachable on `/agents-live` — spotlight stage renders above the grid.+- [ ] Real `showrunner` + `feed-stream` calls in the network tab; spotlight reasons trace to real events.+- [ ] Hover/active/focus on chevrons, queue dots, and the spotlight card; hover pauses rotation.+- [ ] All five states implemented, including the no-dead-air fallback.+- [ ] No console errors/warnings; SSE + rotation timers cleaned up on `visibilitychange`/unmount.+- [ ] Existing tests pass (`npm test`); add unit tests for `rankCandidates` (live > notable > featured > popular; time-decay; tie-break by recency).+- [ ] Verified live in a browser against `npm run dev` (port 3000), including the dark-wall fallback.+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags: `feature`) — e.g. "The live wall is now programmed like a channel: a rotating spotlight surfaces the biggest trades, newest forges, and top live agents, with no dead air." Then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Spotlight captions render real runtime trade events (which may reference a user's launched coin from real records) — never hardcode, market, or recommend a non-$THREE mint. $THREE remains the only coin the wall promotes.+- No mocks, no fake data, no random ranking, no `setTimeout` fake progress, no TODOs, no stubs. Every spotlight pick traces to a real signal.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/docs/live-agent-tasks/README.md b/docs/live-agent-tasks/README.mdnew file mode 100644index 000000000..21b953532--- /dev/null+++ b/docs/live-agent-tasks/README.md@@ -0,0 +1,41 @@+# Live Agent Tasks — what agents actually DO on the wall++25 production-ready build prompts for the two live surfaces:++- **`/agents-live`** — the multi-agent watch wall (grid of live screens + 24/7 activity-terminal fallback).+- **`/agent-screen?agentId=…`** — single-agent deep dive (live screen + 3D avatar + activity log + task bar).++Every prompt follows [`_TEMPLATE.md`](_TEMPLATE.md): one watchable moment, real data flow, concrete files, every state designed, a changelog entry, and the $THREE / no-mocks non-negotiables. Each is self-contained — hand one to an agent and it ships a wired feature.++## The 25++| # | Task | Surface | Core building blocks |+|---|------|---------|----------------------|+| 01 | [Live Trading Desk](01-live-trading-desk.md) | both | sniper/MM workers, agent-trade, avatar emotes |+| 02 | [Agent Newsroom Anchor](02-agent-newsroom-anchor.md) | agent-screen | aixbt intel, sentiment, TTS lip-sync |+| 03 | [Agent-to-Agent Commerce, Live](03-a2a-commerce-live.md) | both | a2a-hire, x402 USDC, on-chain receipts |+| 04 | [Coin World Tour](04-coin-world-tour.md) | agent-screen | worlds-lobby, pump trending, screen stream |+| 05 | [Live Avatar Forge](05-live-avatar-forge.md) | both | forge_free / forge_avatar, viewer link |+| 06 | [Treasury Autopilot Dashboard](06-treasury-autopilot-dashboard.md) | agent-screen | pump/autopilot, buyback/distribute, balances |+| 07 | [Watch an Agent Work](07-watch-agent-work-screenshare.md) | both | Playwright caster, screen-pool, narration |+| 08 | [Agent Stage Show](08-agent-stage-show.md) | agent-screen | multiplayer stage-show beats, tips |+| 09 | [Sentiment Heatmap 3D](09-sentiment-heatmap-3d.md) | both | sentiment-pulse, three.js viz |+| 10 | [Copy-Trade Mirror, Live](10-copy-trade-mirror.md) | both | strategies/copy-trade, trades-stream |+| 11 | [Vanity Address Miner](11-vanity-address-miner.md) | both | vanity_grinder, progress reveal |+| 12 | [Reputation Arena](12-reputation-arena.md) | both | ERC-8004 reputation, arena-world |+| 13 | [Live Q&A Concierge](13-live-qa-concierge.md) | agent-screen | task bar relay, brain LLM, agent-memory |+| 14 | [Pump.fun Launch Director](14-pumpfun-launch-director.md) | agent-screen | launch-agent, launches feed |+| 15 | [Pose Studio, Live](15-pose-studio-live.md) | agent-screen | get_pose_seed, animation-manager |+| 16 | [Market-Maker Floor Defense](16-market-maker-floor-defense.md) | both | agent-mm worker, arena-world FX |+| 17 | [Agent Memory Diary](17-agent-memory-diary.md) | agent-screen | agent-memory embeddings, entity graph |+| 18 | [Multi-Agent Collaboration](18-multi-agent-collab-task.md) | both | agent-delegate, a2a-hire, handoffs |+| 19 | [Cinematic Activity Feed](19-cinematic-activity-feed.md) | both | agent_actions, feed-stream, narration |+| 20 | [Spectator Tips & Reactions](20-spectator-tips-reactions.md) | both | watch-intent, feed, emotes |+| 21 | [Watch-Intent Pool Polish](21-watch-intent-pool-polish.md) | agents-live | screen-pool worker, on-demand pixels |+| 22 | [Ambient World DJ](22-ambient-world-dj.md) | agent-screen | game world-env, day/night, TTS |+| 23 | [Portfolio / PnL HUD](23-portfolio-pnl-hud.md) | both | portfolio MCP, pump_snapshot |+| 24 | [Deploy to the Wall](24-deploy-to-wall-onboarding.md) | agents-live | api-keys, screen-push, onboarding |+| 25 | [Showrunner / Director](25-showrunner-director.md) | agents-live | watch-intent, feed-stream, spotlight rotation |++## How to run one+Pick a file, hand its full contents to an agent as the task. The prompt is the spec. Verify against the Definition of done before claiming complete.diff --git a/docs/live-agent-tasks/_TEMPLATE.md b/docs/live-agent-tasks/_TEMPLATE.mdnew file mode 100644index 000000000..1bee0f88a--- /dev/null+++ b/docs/live-agent-tasks/_TEMPLATE.md@@ -0,0 +1,64 @@+# <NN> — <Feature Title>++> **Mission (one line):** <What an agent does live, and why a viewer can't look away.>++## The watchable moment+<2–4 sentences. Describe exactly what a viewer sees on /agents-live or /agent-screen when this is live. Make it screenshot-worthy. Name the emotion: tension, delight, "how is it doing that?".>++## Who benefits+- **Viewer:** <what they get out of watching>+- **Agent owner:** <why an owner wants their agent doing this>+- **Platform:** <the second-order effect — what this unlocks or links to>++## Where it lives+- **Surface:** `/agents-live` card | `/agent-screen?agentId=…` panel | both+- **Entry points (verify these exist before editing):**+ - `pages/agent-screen.html` / `src/agent-screen.js`+ - `pages/agents-live.html` / `src/agents-live.js`+ - <other concrete files this touches>++## Data flow (source → transform → render)+1. **Source:** <real API/worker/MCP — exact endpoint or file. No mocks.>+2. **Transform:** <normalization / scoring / shaping>+3. **Transport:** <SSE via `api/agent-screen-stream.js` + `api/agent-screen-push.js`, or new endpoint>+4. **Render:** <canvas frame / 3D avatar emote / activity-log entry / HUD overlay>++## Build spec+Concrete, ordered steps. Each step names the file and what changes. No "implement the logic" hand-waving.+1. …+2. …+3. …++## Files to create / modify+- `api/…` — <purpose>+- `src/…` — <purpose>+- `workers/…` — <purpose, if a loop is involved>++## Real integrations (no mocks, ever)+- <pump.fun feed / Solana RPC / x402 USDC / aixbt / TTS / brain LLM router — the actual ones>+- Credentials: locate in `.env` / `vercel env`. If missing, ask once then proceed.++## Every state designed+- **Loading:** skeleton, not spinner.+- **Empty:** tells the viewer what's about to happen / how to trigger it.+- **Error:** actionable, with recovery — never a silent fail.+- **Populated:** the hero state above.+- **Overflow:** 0 / 1 / 1000 items, very long names, mid-action network drop.++## Definition of done+- [ ] Reachable from the live surfaces via real navigation.+- [ ] Real API calls visible in the network tab, real data rendered.+- [ ] Hover / active / focus states on every interactive element.+- [ ] All five states above implemented.+- [ ] No console errors or warnings from this code.+- [ ] Existing tests pass (`npm test`); add a test for any new pure logic.+- [ ] Verified live in a browser against `npm run dev` (port 3000).+- [ ] `git diff` self-reviewed; every line justified.++## Changelog+Append a holder-readable entry to `data/changelog.json` (tags from: feature, improvement, fix, sdk, infra, docs, security), then `npm run build:pages`.++## Non-negotiables+- **$THREE is the only coin.** CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`. Never name another. Generic launcher/launch-feed plumbing that takes a runtime mint is the only exception — never hardcode or promote a non-$THREE mint.+- No mocks, no fake data, no `setTimeout` fake progress, no TODOs, no stubs.+- Stage explicit paths on commit (never `git add -A`); push to **both** remotes (`threeD`, `threews`).diff --git a/pages/agent-detail.html b/pages/agent-detail.htmlindex a00c68912..3c575f7d4 100644--- a/pages/agent-detail.html+++ b/pages/agent-detail.html@@ -149,16 +149,15 @@align-items: stretch;margin-top: 12px;}+ /* No frame: the embed runs on a transparent background with the ground+ disc hidden, so the avatar + joystick float directly on the card.+ The stage is just a transparent, aspect-locked positioning box. */.ad-walk-stage {position: relative;width: 100%;aspect-ratio: 3 / 4;- border-radius: 14px;- overflow: hidden;- background:- radial-gradient(ellipse 70% 60% at 50% 35%, rgba(124, 92, 255, 0.16), transparent 70%),- var(--surface2, rgba(255, 255, 255, 0.04));- border: 1px solid var(--border, rgba(255, 255, 255, 0.08));+ background: transparent;+ border: 0;}.ad-walk-info {display: flex;@@ -540,6 +539,8 @@</div></section>+ <div class="ad-cards">+<section class="ad-card ad-walk-card" id="ad-walk-card" hidden><div class="ad-card-head"><span class="ad-bullet ad-bullet-violet"></span>@@ -1016,6 +1017,8 @@</div></section>+ </div>+<footer class="ad-foot"><span>© 2026 three.ws</span><spandiff --git a/public/changelog.json b/public/changelog.jsonindex 696fce83d..d94db4a99 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,21 @@{- "generated_at": "2026-06-29T02:23:33.437Z",+ "generated_at": "2026-06-29T03:07:18.313Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-06-29",+ "type": "update",+ "title": "Agent profiles now use the full width of the screen",+ "summary": "An agent's profile page used to sit in a single narrow column down the middle, leaving most of a wide screen empty and forcing a very long scroll. The profile now fills the page: the avatar and headline stay centered up top, and every section below — Walk, Try It Now, Holdings, Reviews, Blockchain Details and the rest — tiles into a responsive grid that uses the whole width and adapts from one column on phones up to several on large displays. Same information, far less scrolling.",+ "link": null,+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-29","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex f065ab2a7..a58e6b369 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,14 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>Agent profiles now use the full width of the screen</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-29:Agent profiles now use the full width of the screen</guid>+ <pubDate>Mon, 29 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>An agent's profile page used to sit in a single narrow column down the middle, leaving most of a wide screen empty and forcing a very long scroll. The profile now fills the page: the avatar and headline stay centered up top, and every section below — Walk, Try It Now, Holdings, Reviews, Blockchain Details and the rest — tiles into a responsive grid that uses the whole width and adapts from one column on phones up to several on large displays. Same information, far less scrolling.</description>+ </item><item><title>Coin Clash stays up when the leaderboard backend hiccups</title><link>https://three.ws/clash</link>diff --git a/public/features.json b/public/features.jsonindex 92206c0fe..3fc349ed6 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-29T02:23:33.419Z",+ "generated_at": "2026-06-29T03:07:18.298Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/agent-detail.css b/src/agent-detail.cssindex 888f32089..2f2f298ed 100644--- a/src/agent-detail.css+++ b/src/agent-detail.css@@ -95,7 +95,10 @@ a {.ad-main {padding: 0;- max-width: 920px;+ /* Full-page: fill the 1fr track instead of a narrow centered column.+ Cap on ultra-wide so the masonry doesn't sprawl past a comfortable+ reading field, but otherwise use the whole width. */+ max-width: 2400px;margin: 0 auto;width: 100%;/* Grid item: allow the 1fr track to shrink below the content's@@ -104,6 +107,23 @@ a {min-width: 0;}+/* Masonry card field — tile the stacked cards across the full width.+ column-width auto-fits as many columns as the viewport allows; tall+ and short cards balance into even columns. The hero stays full-width+ above this grid; the footer stays below it. */+.ad-cards {+ column-width: 440px;+ column-gap: 16px;+ padding: 4px 24px 0;+}+.ad-cards > .ad-card,+.ad-cards > details {+ margin: 0 0 16px;+ width: 100%;+ break-inside: avoid;+ -webkit-column-break-inside: avoid;+}+.ad-banner {background: linear-gradient(90deg, #1a1a1a, #222222);color: var(--ad-text);@@ -785,6 +805,9 @@ div.ad-hero-avatar canvas {.ad-hero {padding: 0 16px 20px;}+ .ad-cards {+ padding: 4px 16px 0;+ }}.ad-bullet-red {diff --git a/src/agent-detail.js b/src/agent-detail.jsindex d165c92f3..1c74f7e9b 100644--- a/src/agent-detail.js+++ b/src/agent-detail.js@@ -219,8 +219,9 @@ function walkAppHref(agent) {}// Source URL for the inline preview iframe. Autoplaying (avatar walks an idle-// circle), joystick-driven, on the studio environment with a transparent-// background so the card's own gradient shows through.+// circle) and joystick-driven, on the studio environment. We force a transparent+// background and hide the ground disc so the avatar floats free on the page —+// just the body, its soft contact shadow, and the joystick, with no framed box.function walkEmbedSrc(agent) {const sp = new URLSearchParams();if (agent?.avatar_id) sp.set('avatar', agent.avatar_id);@@ -228,6 +229,8 @@ function walkEmbedSrc(agent) {sp.set('controls', 'joystick');sp.set('autoplay', 'true');sp.set('env', 'studio');+ sp.set('bg', 'transparent');+ sp.set('ground', 'false');return `/walk-embed?${sp.toString()}`;}