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
docs(ux-flows): rewrite the trading, discovery, and coin-launch walkthroughs to match today's pages
nirholas303e9487708e
diff --git a/docs/ux-flows/05-discovery-social.md b/docs/ux-flows/05-discovery-social.mdindex 7b8780f70..29badd191 100644--- a/docs/ux-flows/05-discovery-social.md+++ b/docs/ux-flows/05-discovery-social.md@@ -10,7 +10,7 @@ Routing recap (from `vercel.json`):| `/gallery` | `public/gallery/index.html` | `public/gallery/gallery.js` || `/animations` | `pages/animations.html` | `src/animations-gallery.js` || `/characters` | `public/characters.html` | `src/characters.js` |-| `/community` | `pages/community.html` | (static content) |+| `/community` | `pages/community.html` | inline live-activity module in page || `/walk` | `pages/walk.html` | `src/walk.js` (+ `src/community/coin-world-boot.js`) || `/irl` | `pages/irl.html` | `src/irl.js` (+ `src/irl/*`, `src/irl-net.js`) || `/irl-privacy` | `pages/irl-privacy.html` | (static content) |@@ -27,7 +27,7 @@ Routing recap (from `vercel.json`):- **Entry point:** Page load auto-calls `loadPage()`. URL params hydrate filters (`?q=`, `?chain=`, `?source=`, `?only3d=`, `?sort=`). Default view (no params) is **3D-only**.- **Prerequisites / gates:** None to browse. Auth (`/api/auth/me`) only reveals the "View my agents" chip + nav link; no gate.- **Steps (8):**- 1. User lands on `/discover`. System fetches `/api/auth/me` (best effort) to maybe show the my-agents chip, populates the chain `<select>` (22 chains), reflects any URL params in controls, renders 12 skeleton cards, and calls `loadPage()`.+ 1. User lands on `/discover`. System fetches `/api/auth/me` (best effort) to maybe show the my-agents chip, populates the chain `<select>` (23 chains), reflects any URL params in controls, renders 12 skeleton cards, and calls `loadPage()`.2. System fetches `GET /api/explore?only3d=1&limit=48` (params from state), clears skeletons, renders cards (onchain / avatar / solana variants). Each card thumbnail prefers static image, else lazy `<model-viewer>` auto-rotate preview, else emoji. First page also renders directory totals.3. (optional) User types in the search box → 250ms debounce → `syncUrl()` + `resetAndLoad()` re-queries with `q`.4. (optional) User clicks a source filter (All / On-chain / Avatar / Solana) or the 3D / x402 filter chip → state updates, URL synced, grid reloads. x402 + sort overlays applied client-side.@@ -44,8 +44,8 @@ Routing recap (from `vercel.json`):---### Avatar Gallery — `/gallery`-- **Source:** `public/gallery/index.html`, `public/gallery/gallery.js`, `public/gallery/gallery.css`, `/api/avatars/public`, `/api/forge-gallery`, `/api/avatars` (equip modal)-- **Entry point:** Page load calls `renderCats()` then `resetAndLoad()`, then `loadForgeSection()`. Filters hydrate from URL (`?q=`, `?category=`, `?tag=`, `?sort=`).+- **Source:** `public/gallery/index.html`, `public/gallery/gallery.js`, `public/gallery/surprise.js` (one-click instant avatar), `public/gallery/gallery.css`, `/api/avatars/public`, `/api/forge-gallery`, `/api/avatars` (equip modal), `/api/avatars/surprise`+- **Entry point:** Page load calls `renderCats()` then `resetAndLoad()`, then `loadForgeSection()`. Filters hydrate from URL (`?q=`, `?category=`, `?tag=`, `?sort=`); `?surprise=<seed>` auto-opens the shared Surprise-me avatar.- **Prerequisites / gates:** None to browse. Auth (`/api/auth/me`) only reveals the "My avatars" chip. Equipping an accessory requires sign-in (gated inside the equip modal via `/api/avatars` 401).- **Steps (8):**1. User lands on `/gallery`. System fetches `/api/auth/me` (chip), renders 8 skeleton cards, calls `loadPage()`.@@ -53,7 +53,7 @@ Routing recap (from `vercel.json`):3. (optional) Search box → 250ms debounce → reload with `q`.4. (optional) Click a category chip (Avatars / Accessories / Items / Scenes / Creatures) or a tag chip → reload filtered. Sort dropdown (newest / alpha) re-sorts.5. (optional) Scroll → IntersectionObserver auto-loads next cursor page, or "Load more" button.- 6. (optional) Click "Embed" on a card → avatar embed modal (Web component / iframe / Link / Markdown tabs, copy buttons).+ 6. (optional) Click "Embed" on a card → avatar embed modal (Web component / iframe / Link / Markdown tabs, copy buttons); or click the hero's "✨ Surprise me" button (`data-surprise-avatar`) → `POST /api/avatars/surprise` composes a unique rigged GLB, revealed live in a tinted-stage modal with Reroll, a shareable `/gallery?surprise=<seed>` link, and "Make it mine" (stages the GLB into the guest flow → `/create-review`). No sign-in needed to see it.7. (optional) For accessory cards, click "Equip" → modal fetches `GET /api/avatars` (user's own); if 401, shows Sign-in CTA; else lists up to 12 avatars; choosing one navigates to `/avatars/:id/edit?equip-glb=…&equip-bone=Head`.8. **Payoff:** Click a card thumbnail → `/app#model=<glb>` (3D viewer); or "Use" → `/studio?avatar=<id>`; or "Animate" → `/pose?avatar=<id>`; or "View avatar" → `/avatars/<id>`. Below the grid, the **From the Forge** section renders community 3D models (`GET /api/forge-gallery?scope=community&limit=16`, deduped by prompt) with View/Remix actions.- **Decision points / branches:** accessory category → Equip flow vs Use/Animate; model_url present → model-viewer vs img; signed-in chip; forge section enabled vs hidden (additive, never blocks).@@ -65,18 +65,18 @@ Routing recap (from `vercel.json`):---### Animation Gallery — `/animations`-- **Source:** `pages/animations.html`, `src/animations-gallery.js`, `/api/animations/clips`, `/avatar-embed` (preview iframe), `/pose` (studio)-- **Entry point:** Module runs `load(true)` on import. Query (`?q=`, `?filter=loop|once`) hydrates state and the search box.-- **Prerequisites / gates:** None. Clips fetched with `credentials: 'include'` but public visibility is the query; no sign-in required to browse.+- **Source:** `pages/animations.html`, `src/animations-gallery.js`, `src/animation-categories.js` (derived categories), `src/animations-live-preview.js` (shared WebGL preview engine), `/api/animations/clips`, `/animations/manifest.json`, `/api/animations/library`, `/pose` (studio)+- **Entry point:** Module runs `loadAll()` on import. Query (`?q=`, `?cat=`, `?filter=loop|once`, `?sort=`) round-trips through the URL; `?clip=<id>` deep-links straight into the detail modal.+- **Prerequisites / gates:** None. Community clips fetched with `credentials: 'include'` but public visibility is the query; no sign-in required to browse.- **Steps (5):**- 1. User lands on `/animations`. System shows loading state, calls `load(true)`.- 2. System fetches `GET /api/animations/clips?include_public=true&visibility=public&limit=24`, renders animation cards (thumbnail or 🎬 placeholder, loop/once badge, duration, optional price/tags).- 3. (optional) User types in search → 280ms debounce → `syncUrl()` + reload; or clicks a filter chip (loop / once) mapping to `kind=loop|animation`.- 4. (optional) User hovers/clicks/keys a card's preview zone → lazy-loads an `<iframe>` to `/avatar-embed?model=/avatars/cz.glb&anim=<id>` playing the clip on a live avatar; mouseleave hides it. Scroll sentinel infinite-loads more.- 5. **Payoff:** User clicks "Open in Studio" (or the implicit "use on my avatar") → navigates to `/pose?anim=<id>` to apply/remix the clip on an avatar.-- **Decision points / branches:** thumbnail present vs placeholder; loop vs once filter (kind param); IntersectionObserver vs Load-more button; search/filter active → empty-search state.-- **External calls / dependencies:** `GET /api/animations/clips`, `/avatar-embed` iframe (sandboxed), `/pose` nav.-- **Success state:** Grid of animation cards each previewable in-place on a live avatar; "Open in Studio" reaches the editor.+ 1. User lands on `/animations`. System shows loading state and merges three sources into one grid: community clips (`GET /api/animations/clips?include_public=true&visibility=public`, capped at 300, newest first), the built-in three.ws motion library (`/animations/manifest.json`, the same curated clips `/pose` ships with), and the full Mixamo-sourced catalog (`GET /api/animations/library`, fetched from the R2 CDN in bounded 1000-clip pages).+ 2. System normalizes every clip to one card shape (poster thumbnail, derived category, duration, loop/once badge) and paginates client-side (36 per page, infinite scroll, lazy thumbnails).+ 3. (optional) User searches (`/` hotkey focuses the box), picks a category chip, a loop/once filter, or a sort → grid re-filters client-side; the URL stays shareable.+ 4. (optional) User hovers a card's preview zone → the ONE shared WebGL engine moves its singleton canvas into that card and plays the retargeted clip on the preview avatar (no iframes, no per-card GL contexts; skipped for touch and reduced-motion users, who get the preview inside the detail modal instead).+ 5. **Payoff:** Click a card → detail modal (arrow keys step between clips, Space toggles play, Copy link copies `/animations?clip=<id>`, Copy embed copies an `/embed/avatar?anim=<id>` iframe snippet) → "Open in Studio" navigates to `/pose?anim=<id>` to apply/remix the clip on an avatar.+- **Decision points / branches:** community vs library vs full-catalog card (community listed first); thumbnail present vs placeholder; touch/reduced-motion (modal-only preview) vs hover preview; search/filter active → empty-search state.+- **External calls / dependencies:** `GET /api/animations/clips`, `GET /animations/manifest.json`, `GET /api/animations/library` (R2 CDN pages), shared live-preview engine, `/pose` nav.+- **Success state:** One searchable grid across all three clip sources, each card live-previewable in place; "Open in Studio" reaches the editor.- **Empty / error states:** No results + no filter → empty state; with filter/query → empty-search state with the query echoed + Clear-search; fetch failure → error state with Retry.- **Step count:** 2 required (+3 optional)@@ -100,18 +100,19 @@ Routing recap (from `vercel.json`):---### Community — `/community`-- **Source:** `pages/community.html` (static content + footer newsletter)-- **Entry point:** Static page load. Read-only content page.+- **Source:** `pages/community.html` (content + inline live-activity module + footer newsletter)+- **Entry point:** Page load; the inline module fetches the live activity feed.- **Prerequisites / gates:** None.-- **Steps (3):**+- **Steps (4):**1. User lands on `/community` and reads the hero ("Build with us.").- 2. (optional) User clicks a channel card: Follow on X (`@trythreews`), GitHub (`nirholas/three.ws`), Docs (`/docs`), Tutorials (`/tutorials`).- 3. (optional) User reads "Ways to get involved" (ship an agent at `/create`, report bugs on GitHub issues, share feedback to `[email protected]`) or subscribes via the footer newsletter form.-- **Decision points / branches:** which outbound channel the user follows; newsletter subscribe vs not.-- **External calls / dependencies:** External links (x.com, github.com), mailto, `footer-newsletter.js` (subscribe). No data fetch for content.-- **Success state:** User reaches a community channel / submits the newsletter form.-- **Empty / error states:** None (static content). Newsletter form handles its own submit feedback.-- **Step count:** 1 required (+2 optional) — content page (read)+ 2. System: the "Live activity" section fetches `GET /api/users/me/feed?scope=all&limit=10` (3 skeleton rows while loading) and renders the latest platform activity rows (avatar, actor + verb, title, relative time, thumbnail); "Open the full feed →" links to `/feed`.+ 3. (optional) User clicks a channel card: Follow on X (`@trythreews`), GitHub (`nirholas/three.ws`), Docs (`/docs`), Tutorials (`/tutorials`).+ 4. (optional) User reads "Ways to get involved" (ship an agent at `/create`, report bugs on GitHub issues, share feedback to `[email protected]`) or subscribes via the footer newsletter form.+- **Decision points / branches:** activity populated vs empty vs error; which outbound channel the user follows; newsletter subscribe vs not.+- **External calls / dependencies:** `GET /api/users/me/feed?scope=all` (live activity), external links (x.com, github.com), mailto, footer newsletter script.+- **Success state:** Live activity rows render; user reaches a community channel / submits the newsletter form / opens `/feed`.+- **Empty / error states:** Activity empty → "Nothing has happened yet" with a `/create` CTA; fetch failure → "Could not load live activity right now." Newsletter form handles its own submit feedback.+- **Step count:** 2 required (+2 optional); content page with a live feed section---@@ -135,7 +136,7 @@ Routing recap (from `vercel.json`):---### IRL — `/irl`-- **Source:** `pages/irl.html` (WebGL-gate inline boot), `src/irl.js`, `src/irl/*` (`onboarding.js`, `floor-anchor.js`, `room-anchor.js`, `room-session.js`, `tap-pick.js`, `gps-lifecycle.js`, `discovery.js`, `privacy-center.js`, `proximity-band.js`, `proximity-cue.js`, `sensor-fusion.js`, `share-frame.js`, `map-place.js`, `camera-fov.js`, `load-queue.js`, `perf-budget.js`), `src/irl-net.js`+- **Source:** `pages/irl.html` (WebGL-gate inline boot), `src/irl.js`, `src/irl/*` (`onboarding.js`, `floor-anchor.js`, `room-anchor.js`, `room-session.js`, `room-mode.js`, `tap-pick.js`, `gps-lifecycle.js`, `discovery.js`, `privacy-center.js`, `proximity-band.js`, `proximity-cue.js`, `sensor-fusion.js`, `share-frame.js`, `map-place.js`, `marker-mode.js` + `marker-anchor.js`/`marker-pose.js`/`qr-detect.js` (QR-marker indoor colocalization), `camera-fov.js`, `load-queue.js`, `perf-budget.js`, `pin-celebration.js`, `pin-idle.js`, and more), `src/ar/*` (`pinch-scale.js`, `quick-look.js`, `quicklook-banner.js`, `placement-capability.js`, `depth-occlusion.js`, `estimated-lighting.js`), `src/irl-net.js`- **Entry point:** `pages/irl.html` runs an inline WebGL-support check; if supported it `import('/src/irl.js')`, else it renders a designed "This device can't run IRL AR" state with "Browse agents"/"Open marketplace" actions. URL param `?avatar=` chooses the placed agent.- **Prerequisites / gates:** No auth, no wallet (anonymous `irl_device_token` in localStorage). **WebGL** required (hard gate at HTML load). Requested progressively via `onboarding.ensurePermission(...)`: **camera** (`getUserMedia`) on first "Camera AR" tap; **motion** (`DeviceOrientationEvent.requestPermission` on iOS 13+) when locking; **geolocation** (`navigator.geolocation.watchPosition`, enableHighAccuracy) when locking/discovering. None are hard blockers — each has a designed fallback.- **Steps (7 required + optional):**@@ -146,9 +147,9 @@ Routing recap (from `vercel.json`):5. User aims at the floor spot and **taps the canvas** → optional caption → Confirm → `commitPin()` → `POST /api/irl/pins` with `{ lat, lng, heading, caption, avatarUrl, avatarName, deviceToken, agentId, anchor: { yawDeg, source: 'gyro-gps'… } }`.6. System polls `GET /api/irl/pins?lat=&lng=&radius=60` every 10s; nearby agents spawn (LOD: dot → impostor → full mesh), name labels + confidence rings render; crossing the ~40m ENTER band fires the proximity-arrival cue (haptic + chime + directional glow). Tapping a nearby agent opens a bottom sheet → "View" (`GET /api/irl/agent-card`), "Pay" ($THREE x402), "Message"; interactions `POST /api/irl/interactions`.7. **Payoff:** The user's chosen agent is anchored and visible in AR on the real floor, persisted for nearby users to discover; the user can also discover and interact with other agents pinned around them.- 8. (optional alt placement) **Place on floor** WebXR (Android Chrome): `XRSession.requestSession('immersive-ar')` hit-test → `POST /api/irl/pins` with `anchor.quat` + shared room frame; iOS Safari → AR Quick Look (USDZ). **Place on map** (privacy-first): Leaflet picker → `commitMapPin()` `POST /api/irl/pins source:'map'`.+ 8. (optional alt placement) **Place in AR** (WebXR, Android Chrome) now fronts the dock's secondary row on AR-capable devices: `XRSession.requestSession('immersive-ar')` hit-test → `POST /api/irl/pins` with `anchor.quat` + shared room frame; a two-finger pinch resizes the agent (0.25x to 4x, `src/ar/pinch-scale.js`) and the chosen size persists (`anchor.scale` on POST, owner-gated `PATCH {id, scale}` after placement; every viewer renders the owner's size). Camera-mode AR gets the same pinch-to-resize without WebXR. iOS Safari → AR Quick Look (USDZ) with an in-AR "Pin it here for people nearby" banner whose tap lands back on `/irl` with Pin here pulsing. **Anchor to a marker** (indoor, no GPS/compass): scan or print a QR marker; once locked it becomes a shared origin, so "Place here" anchors the agent relative to the marker for anyone who scans the same one. **Place on map** (privacy-first): Leaflet picker → `commitMapPin()` `POST /api/irl/pins source:'map'`.9. (optional) Privacy center (`openPrivacyCenter`): geolocation precision Exact vs Nearby, "Appear nearby" ghost toggle. Share button flattens camera + canvas to PNG. "My pins" sheet → `GET /api/irl/pins/mine`, map + list, `DELETE /api/irl/pins?id=` or `?all=1`. Calibrate / refine-on-floor → `PATCH /api/irl/pins`.-- **Decision points / branches:** WebGL supported vs fatal overlay; placement path (gyro-GPS / WebXR floor / iOS Quick Look / map); camera/motion/location granted vs denied (each → fallback); compass available (north-aligned) vs relative-only (`gyro-gps:rel`); GPS ready vs warm-up hold; agent crosses ENTER vs EXIT band; tap on mesh vs label vs background; precision Exact vs Nearby; room mode (shared frame) vs solo.+- **Decision points / branches:** WebGL supported vs fatal overlay; placement path (gyro-GPS / WebXR floor / iOS Quick Look / QR marker / map); camera/motion/location granted vs denied (each → fallback); compass available (north-aligned) vs relative-only (`gyro-gps:rel`); GPS ready vs warm-up hold; agent crosses ENTER vs EXIT band; tap on mesh vs label vs background; precision Exact vs Nearby; room mode (shared frame) vs solo.- **External calls / dependencies:** `POST/PATCH/DELETE /api/irl/pins`, `GET /api/irl/pins` (+ `/mine`), `GET /api/irl/agent-card`, `POST /api/irl/interactions`, `GET /api/irl/interactions-stream` (SSE), `POST /api/irl/report`, `POST /api/irl/fix-token`. Device: `getUserMedia` (camera), `DeviceOrientationEvent.requestPermission` / `deviceorientation(absolute)` (motion), `navigator.geolocation.watchPosition`, `navigator.permissions.query`, `navigator.vibrate`, `AudioContext`, WebXR `immersive-ar`. Realtime: Colyseus WebSocket (`IrlNet`, room `irl_world`). Libs: GLTFLoader (+Draco/meshopt), Leaflet/CARTO, in-browser USDZ exporter.- **Success state:** Agent anchored to a real-world spot, visible in AR; nearby agents discovered by proximity (dots→impostors→meshes) with name labels, arrival cues, and an interaction sheet.- **Empty / error states:** WebGL unsupported → fatal designed overlay. Camera/motion/location denied → designed recovery cards with platform Settings steps + fallbacks. GPS warm-up → shimmer "Acquiring…". No nearby agents → calm "0 nearby" + "Place an agent here" CTA. Poll fail → amber "refresh failed" (15s retry). Rate-limited → calm blue chip, self-recovers. Avatar load fail → "Couldn't load this agent" + Retry. WebGL context lost → "AR paused" + Reload. Placement rejected (moderation/full/rate) → status message, lock released.@@ -208,18 +209,18 @@ Routing recap (from `vercel.json`):---### Agents Index — `/agents`-- **Source:** `public/agents/index.html` (inline module), `/api/agents/public`, `public/agents/boot.js`+- **Source:** `public/agents/index.html` (inline module), `/api/explore` (`source=agents` meta-source), `public/agents/boot.js`- **Entry point:** Inline module runs `load(true)` on load.- **Prerequisites / gates:** None to browse.- **Steps (4):**- 1. User lands on `/agents`. System renders 8 skeleton cards and fetches `GET /api/agents/public?limit=24&sort=popular`.- 2. System renders agent cards: avatar thumbnail (or initial fallback), on-chain badge if registered, name + description, top skills, chat count. Count label shows total.- 3. (optional) Search box → 320ms debounce → reload with `q`; sort select (popular / newest / name) → reload; "On-chain only" checkbox → reload with `onchain=1`; "Load more" → cursor pagination (`before`).- 4. **Payoff:** Click a card → navigates to the agent's `home_url` (agent profile / chat). Hero CTAs link to `/create-agent` and `/marketplace`.-- **Decision points / branches:** registered (on-chain badge) vs not; avatar thumbnail vs initial fallback; sort/onchain filters; has_more (Load more shown) vs not.-- **External calls / dependencies:** `GET /api/agents/public`.-- **Success state:** Grid of public 3D agents, each linking to its profile.-- **Empty / error states:** Query-empty → "No agents found" for the term; unfiltered-empty → "No public agents yet" + create CTA; fetch error → "Couldn't load agents — Try refreshing."+ 1. User lands on `/agents` ("Agent Index"). System renders 8 skeleton cards and fetches `GET /api/explore?source=agents&limit=24`, one unified feed across every registry the platform crawls: ERC-8004 (EVM, erc8004-crawl cron), the Metaplex Agent Registry + AgenC protocol (Solana, solana-agents-crawl cron), and three.ws's own agents. The meta-source returns on-chain agents only, never avatars.+ 2. System renders agent cards: thumbnail proxied through `/api/img` (lettered-initial fallback), a source badge (chain short-name for EVM / Metaplex / AgenC / three.ws), name + description, up to 3 service/skill chips, and an `x402` chip when the agent accepts x402 payments. Count label shows loaded total.+ 3. (optional) Source chips All sources / Solana / EVM → reload; search box → 320ms debounce → reload with `q`; sort select (Newest first / Name A-Z, client-side re-sort); "Load more" → cursor pagination (`cursor`).+ 4. **Payoff:** Click a card → its natural detail surface: EVM agents → `/a/<chain>/<id>`, three.ws Solana agents → `/agent/<id>`, external Solana agents → their 3D viewer or on-chain explorer (new tab). Hero CTAs link to `/create-agent` and `/marketplace`.+- **Decision points / branches:** source chip (all / solana / onchain); card kind → internal vs external (target="_blank") destination; thumbnail vs initial fallback; nextCursor present (Load more shown) vs not.+- **External calls / dependencies:** `GET /api/explore?source=agents`, `/api/img` (thumbnail proxy).+- **Success state:** Grid of on-chain agents across all crawled registries, each linking to its detail surface.+- **Empty / error states:** Query-empty → "No agents found" for the term; unfiltered-empty → "No agents in this source yet" + create-first CTA (registries are crawled continuously); fetch error → "Couldn't load agents" with "Try refreshing the page."- **Step count:** 1 required (+3 optional)---diff --git a/docs/ux-flows/07-crypto-trading-analytics.md b/docs/ux-flows/07-crypto-trading-analytics.mdindex 6f08c5756..05c40a5fe 100644--- a/docs/ux-flows/07-crypto-trading-analytics.md+++ b/docs/ux-flows/07-crypto-trading-analytics.md@@ -6,27 +6,27 @@ that sit on the pump.fun + Oracle + sniper data engines. Every route traced to rRouting convention in this repo: `/foo` is served from `pages/foo.html` (Vite multi-page input)or a pre-built `public/foo.html` (static), wired by `vercel.json` rewrites. Client logic is theinline `<script type="module">` and/or imported `src/*.js` modules. Watchlist state is a single-shared `localStorage` key `ld_watchlist` used by oracle, radar, trades, watchlist, smart-money,-coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows up on `/watchlist`.+shared `localStorage` key `ld_watchlist` used by oracle, radar, watchlist, smart-money,+coin-intel, pump-visualizer and pump-live: adding a coin on any surface shows up on `/watchlist`.---### Oracle — `/oracle`-- **Source:** `pages/oracle.html`, `src/oracle.js` (1850 lines), lazy `src/oracle-graph.js` (3D force graph), `src/oracle-tape.js` (live trade tape in the coin drawer)-- **Entry point:** nav link "Oracle"; direct URL; deep links `/oracle/coin/<mint>` open that coin's drawer; SEO/share links from `coinShareUrl()`.+- **Source:** `pages/oracle.html`, `src/oracle.js` (~2400 lines), lazy `src/oracle-graph.js` (3D force graph), `src/oracle-tape.js` (live trade tape in the coin drawer)+- **Entry point:** nav link "Oracle"; direct URL; SEO/share links from `coinShareUrl()`. `/oracle/coin/<mint>` is now a standalone full conviction coin page (server-rendered by `api/oracle-share.js` in the markets-hub style: score dial, pillar bars, chart, launch intelligence), reached from the drawer's "Full page ↗" action.- **Prerequisites / gates:** Public dashboard for all read views (feed, movers, wallets, edge, proof, agents, activity, graph). The **Agent** (arm) tab requires sign-in + an existing 3D agent with a custodial Solana wallet; Live mode spends real (capped) SOL.- **Steps (N):**1. Arrive on `/oracle` → `boot()` populates category filter, binds tab/seg listeners, reads URL filters (`tier`, `category`, `minScore`, `view`), loads the **feed** view.2. System: `GET /api/oracle/feed?...` renders conviction cards (0–100 score, tier pill prime/strong/lean/watch/avoid). If backend not migrated → "Oracle is warming up" honest empty state.3. System: opens SSE `EventSource('/api/oracle/action-stream')` — new scored coins stream in live; "Live · fused conviction" / "Reconnecting…" indicator.- 4. (optional) Filter: click `#tierSeg` tier buttons / category select / min-score → `syncFilterUrl()` + `loadFeed()` (URL is shareable).+ 4. (optional) Filter: click `#tierSeg` tier buttons / category select / min-score / sort seg / ★-watchlist-only toggle / breadth-bar tier segments → `syncFilterUrl()` + `loadFeed()` (URL is shareable). A hero "Join the live Telegram feed" button appears when `/api/oracle/stats` reports a configured public signals channel.5. (optional) Switch view tab: `movers`, `wallets` (reputation leaderboard), `edge` (tier backtest win-rate), `proof` (resolved wins), `agents` (agent win-rate ledger), `activity` (live agent actions), `graph` (3D force graph, lazy-imports oracle-graph.js).6. (optional) Click a coin card → `openDrawer(mint)` → `GET /api/oracle/coin?mint=...` renders the 4-pillar conviction breakdown (who/how/what/move); oracle-tape.js streams that coin's live trades.- 7. (optional) In the drawer: ☆/★ Watch (writes `ld_watchlist`), Copy mint, Copy link, Share to X.+ 7. (optional) In the drawer: Full page ↗ (`/oracle/coin/<mint>`), pump.fun ↗, GMGN ↗ (via `src/shared/trading-terminals.js`, referral-tagged), solscan ↗, Details ↗ (`/launches/<mint>`), View in 3D ↗ (`/coin3d?mint=`), ☆/★ Watch (writes `ld_watchlist`), Copy mint, Copy link, Share to X; the live Market panel adds GMGN/DexScreener/GeckoTerminal/Birdeye links when available.8. (optional, agents view) Follow an agent's signals: expand follow-panel → enter Telegram chat ID → `POST /api/oracle/follow`.9. **Arm payoff (gated):** open **Agent** tab → `loadAgentPanel()` → `GET /api/agents`. Pick agent, set Min conviction (Prime/Strong+/Lean+), Size/trade SOL, Max daily SOL, Max open, category filters, optional Telegram chat ID (Send test → server push), toggle Armed + Live/Simulate switches → **Save configuration** → `POST /api/oracle/watch` `{armed, mode, min_score, per_trade_sol, max_daily_sol, max_open, ...}`. Confirmation: "Armed in simulate/live mode. Your agent is watching the stream."- **Decision points / branches:** view tabs (9); feed warming vs populated vs filtered-empty; drawer coin scored vs "not scored yet"; agent has wallet vs needs creation (`/create/studio`); simulate vs live mode; signed-out → "Sign in and arm an agent".-- **External calls / dependencies:** `/api/oracle/feed`, `/api/oracle/coin`, `/api/oracle/search`, `/api/oracle/movers`, `/api/oracle/categories`, `/api/oracle/backtest`, `/api/oracle/wins`, `/api/oracle/watch` (GET+POST), `/api/oracle/follow` (GET+POST), `/api/agents`; SSE `/api/oracle/action-stream`; oracle-tape live trade stream in drawer.+- **External calls / dependencies:** `/api/oracle/feed`, `/api/oracle/coin`, `/api/oracle/search`, `/api/oracle/movers`, `/api/oracle/categories`, `/api/oracle/backtest`, `/api/oracle/wins`, `/api/oracle/stats` (hero statline + Telegram channel link), `/api/oracle/activity`, `/api/oracle/watch` (GET+POST), `/api/oracle/follow` (GET+POST), `/api/agents`; SSE `/api/oracle/action-stream`; oracle-tape live trade stream in drawer.- **Success state:** live conviction feed scoring every pump.fun launch in real time; coin drawer with pillar breakdown; armed agent acting on the stream (simulate logs / live spends capped SOL), actions graded into a win-rate ledger.- **Empty / error states:** "Oracle is warming up" (backend not live); "No launches clear your filters" + Reset; drawer "not scored"; "No ranked agents yet"; SSE auto-reconnects ("Reconnecting…"); `api()` returns `{ok:false}` on timeout (12s abort) and degrades gracefully.- **Step count:** 3 required (arrive → feed → live stream, all automatic) + ~6 optional read interactions, + a 6-field gated arm flow (steps 8–9).@@ -70,25 +70,23 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows----### Live Trade Feed — `/trades`-- **Source:** `pages/trades.html`, `src/trades.js` (imports `src/trader-format.js`)-- **Entry point:** nav; footer newsletter page link.-- **Prerequisites / gates:** None — explicitly "public, no-auth feed" of notable closed positions from all three.ws agents.+### Trade Terminal - `/trades`+- **Source:** `pages/trades.html`, `src/trades.js` (controller), `src/trades-detail.js` (deep-dive; imports `src/mission-control/chart.js`, `src/widgets/bonding-curve.js`, `src/trades-bubblemap.js`, `src/trades-tape.js`, `src/trader-format.js`)+- **Entry point:** nav; footer newsletter page link; deep link `?mint=<base58>` (+ `&tab=exits`, `&network=devnet`).+- **Prerequisites / gates:** None; public two-pane pump.fun analytics workstation. Only three.ws data (platform launches + agent exits) feeds the left rail; any mint can be pasted for a deep-dive.- **Steps (N):**- 1. Arrive → `readUrl()` + `applyStateToControls()` restores window/minPnl/network from URL+localStorage (`tf_network`).- 2. System: `GET /api/trades/feed?window=24h&minPnl=25&network=mainnet` renders closed-position rows; auto-refresh every 30s (paused when deep in pagination).- 3. (optional) Pick time window via `#tfWinSeg` (ARIA tablist, keyboard arrows/Home/End) → reload.- 4. (optional) Change Min PnL (`#tfMinPnl`) → reload from cursor null.- 5. (optional) Change network (`#tfNetwork`, persisted to localStorage) → reload.- 6. (optional) Manual Refresh (`#tfRefresh`).- 7. (optional) Watch button per row (`.tf-watch-btn`) → toggles mint in `ld_watchlist`.- 8. (optional) Load more (`#tfLoadMore`) → cursor pagination.- 9. (optional) Click a trade row → trader/coin deep link.-- **Decision points / branches:** window/minPnl/network filters; auto-refresh suspended while paginating; watch toggle state.-- **External calls / dependencies:** `GET /api/trades/feed` (cursor-paginated).-- **Success state:** filterable, shareable (URL-reflected) live feed of real closed trades with PnL.-- **Empty / error states:** empty-feed state; standard boundary error handling on fetch.-- **Step count:** 2 required (arrive → feed) + ~7 optional (filters, watch, paginate).+ 1. Arrive → `readUrl()` restores mint/tab/network (network persisted to localStorage `tf_network`); the deep-dive mounts immediately with the URL mint, or $THREE by default (never an empty void).+ 2. System: left rail loads the active tab: **Launches** (`GET /api/pump/launches?network=&limit=40`, $THREE pinned at the top) or **Exits** (`GET /api/trades/feed?network=&window=7d&min_pnl_pct=10&limit=40`); refreshes every 30s. Header pulse (`GET /api/pump/helius-stats`, 20s) shows network mint rate, graduations/hour, and SOL price ± 24h change.+ 3. System: centre deep-dive (`mountDetail`) paints header + skeleton instantly from the clicked row, then fills progressively from five live endpoints (`/api/pump/launch-detail`, `/api/pump/curve`, `/api/pump/intel`, `/api/pump/smart-money`, `/api/coin/:mint/cohorts`; cohorts only for platform-tracked coins) plus three self-fetching widgets: candlestick chart, bonding-curve ring, live trade tape.+ 4. (optional) Switch tab Launches ↔ Exits (`#ttTabs`) → reload rail; URL synced.+ 5. (optional) Change network mainnet/devnet (`#ttNetwork`, persisted) → reload rail + remount deep-dive.+ 6. (optional) Paste a mint into `#ttSearch` (base58-validated) → drives the deep-dive for that coin.+ 7. (optional) Click any rail row → `select(mint)` remounts the deep-dive (re-selecting the mounted coin is a no-op); URL reflects `?mint=` for sharing.+- **Decision points / branches:** Launches vs Exits tab; mainnet vs devnet; platform-tracked coin (cohorts fetched) vs external mint (designed no-data state); each detail section degrades independently to an honest "unavailable" note.+- **External calls / dependencies:** `GET /api/pump/launches`, `GET /api/trades/feed`, `GET /api/pump/helius-stats`, `GET /api/pump/launch-detail`, `GET /api/pump/curve`, `GET /api/pump/intel`, `GET /api/pump/smart-money`, `GET /api/coin/:mint/cohorts`.+- **Success state:** live two-pane terminal: rail of platform launches/exits, deep-dive with chart, bonding curve, holders/cohorts, funder bubblemap, smart money, wallet footprint, trade tape, outcome, agent economics; shareable `?mint=` URL.+- **Empty / error states:** per-tab empty copy ("No launches on this network yet" / "No profitable agent exits in this window yet"); per-section "unavailable" degradation in the deep-dive; pulse failures silent (decorative).+- **Step count:** 3 required (arrive → rail + deep-dive) + ~4 optional (tab, network, search, row select).---@@ -103,7 +101,7 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows4. (optional) Network: mainnet/devnet (`#lb-network`).5. (optional) Sort: score/pnl/winrate/roi (`#lb-sort` select).6. (optional) "Verified only" checkbox (`#lb-verified`).- 7. (optional) Click a row → trader profile (`src/trader.js`, `/trader?wallet=...`) — full track record, equity curve, proof tab with on-chain tx, copy-trading panel, shareable PnL card.+ 7. (optional) Click a row → trader profile (`src/trader.js`, `/trader/<agent_id>`) with full track record, equity curve, proof tab with on-chain tx, copy-trading panel, shareable PnL card.- **Decision points / branches:** 4 windows × sort × network × verified; stale/reconnecting badge when a background refresh fails with a board already on screen.- **External calls / dependencies:** `GET /api/sniper/leaderboard`; row payoff `GET /api/sniper/trader` (on trader page).- **Success state:** shareable ranked board; every number deep-links to its on-chain transaction via the trader profile.@@ -122,7 +120,7 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows3. (optional) Filter by category chips (meme/ai/tech/…) → URL + reload.4. (optional) Min-quality slider → reload on change.5. (optional) Watch toggle per coin → `ld_watchlist`.- 6. (optional) Click a coin card → detail drawer → `GET /api/pump/coin-intel?mint=<mint>&wallets=1` (single-coin wallet breakdown).+ 6. (optional) Click a coin card → detail drawer → `GET /api/pump/coin-intel?mint=<mint>&wallets=1` (single-coin wallet breakdown). Each mainnet card's "Full intel →" action and the drawer's "Open full page" link go straight to the coin's full intelligence page at `/oracle/coin/<mint>`; devnet coins have no page, so their button keeps opening the drawer.- **Decision points / branches:** category × quality filters; risk-flag pills (bundle_launch, dev_dumped, single_whale, low_diversity, fresh_wallet_swarm, sell_pressure, sniped) with danger/warn tones; drawer open/closed.- **External calls / dependencies:** `GET /api/pump/coin-intel` (list) and `?mint=&wallets=1` (detail); `/api/img` for logos.- **Success state:** live launch-intelligence feed; every number traces to an observed on-chain trade.@@ -289,7 +287,7 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows7. (optional) Hover sphere (tooltip), click → detail panel (`selectToken`), legend click → camera tween + panel.8. (optional) In detail panel: Watch (`ld_watchlist`), Oracle badge (`GET /api/oracle/coin?mint=`), Buy (lazy `src/game/coin-buy.js` on-chain trade modal); double-click sphere → `/coin3d?mint=`.- **Decision points / branches:** WebGL present vs list fallback; Feed/Migrations/Trending mode; search/sort; Oracle enrichment optional; Buy is the real interactive (on-chain) action.-- **External calls / dependencies:** `GET /api/pump/trending`, `/api/pump/recent-graduations`, `/api/pump/helius-stats`, `/api/img`, `GET /api/oracle/coin`; optional SSE `/api/agents/pumpfun-feed`; `wss://pumpportal.fun/api/data` referenced for live mode.+- **External calls / dependencies:** `GET /api/pump/trending`, `/api/pump/recent-graduations`, `/api/pump/helius-stats`, `/api/img`, `GET /api/oracle/coin`; optional SSE `/api/agents/pumpfun-feed` (server-side PumpPortal WS bridge) for Feed/Migrations live mode.- **Success state:** 50 glowing spheres in an auto-rotating galaxy, sized/colored by market cap, with detail panel, search/sort, and on-chain Buy.- **Empty / error states:** WebGL warning banner + DOM list fallback; "Could not load trending tokens" + Retry; image canvas fallback; Oracle badge silently empty if down.- **Step count:** 2 required (arrive → spheres render) + ~6 optional (orbit, search/sort, mode, inspect, Buy/Watch). Live-monitor + interaction hybrid.@@ -304,11 +302,11 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows1. Arrive → feed module starts immediately (does NOT wait on Three.js); skeleton cards; viewer.js + GLB load in parallel.2. System: `GET /api/pump/helius-stats` for SOL price (caps shown in SOL until USD lands, then rehydrated).3. System: connect `wss://pumpportal.fun/api/data`, send `subscribeNewToken` → "● Live"; each `create` event → render token card (image via `/api/img?meta=`, MC, links, empty Oracle slot), prepend (cap 100), update stats, dispatch `pumplive:token`.- 4. System: every 30s batch `POST /api/oracle/batch?mints=...` (chunks ≤20, retry 2×) → conviction badges on cards; "🔮 Prime scored" counter.+ 4. System: every 30s batch `GET /api/oracle/batch?mints=...` (chunks ≤20, bounded retries with backoff) → conviction badges on cards; "🔮 Prime scored" counter.5. (optional) 3D agent loads `robotexpressive.glb`, plays Idle, waves on each `pumplive:token`.6. (optional) Pause button (queues events); conviction filter All/Strong+/Prime (hides cards); Watch toggle (`ld_watchlist`); click card → `/coin3d?mint=` or external links.- **Decision points / branches:** WebGL/GLB present vs feed-only; paused vs streaming; conviction filter level; Oracle up vs down (badges empty).-- **External calls / dependencies:** `wss://pumpportal.fun/api/data`; `GET /api/pump/helius-stats`; `POST /api/oracle/batch`; `GET /api/img`; `robotexpressive.glb`.+- **External calls / dependencies:** `wss://pumpportal.fun/api/data`; `GET /api/pump/helius-stats`; `GET /api/oracle/batch`; `GET /api/img`; `robotexpressive.glb`.- **Success state:** live launches stream as cards, stats tick, agent waves per launch, Oracle conviction badges enrich after ~30s, filterable.- **Empty / error states:** "Waiting for new launches…"; WS backoff 2s→60s, terminal error panel + Reconnect after 8 fails; SOL-price hint until USD lands; image seeded placeholder; agent load failure suppressed (feed unaffected).- **Step count:** 1 required (arrive → live feed) + ~4 optional (pause, filter, watch, drill-in). Pure live monitor + reactive avatar.diff --git a/docs/ux-flows/08-coin-launch-wallets.md b/docs/ux-flows/08-coin-launch-wallets.mdindex 587ee8e6a..4fb0e57ca 100644--- a/docs/ux-flows/08-coin-launch-wallets.md+++ b/docs/ux-flows/08-coin-launch-wallets.md@@ -24,9 +24,10 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.1. Page boots: `fetchMe()` then `fetchAvatars()` (`GET /api/avatars?limit=100`). Picker shows 3 shimmer skeletons while loading.2. Picker renders agent cards; `?avatar=<id|slug>` deep link is honored, else the first agent is auto-selected. Panel pre-fills name/symbol/description from the avatar.3. Panel auto-checks for an existing mint for the selected agent (`GET /api/pump/by-agent?agent_id=|avatar_id=`). If one exists, it shows the "Token already launched" card with stats + Fees & rewards panel (skip to step 16) unless the user clicks "Launch a new token."- 4. (optional) User edits the **token image** — click/drag-drop a file (≤4 MB), or "📸 Use 3D view" to snapshot the preview canvas (only when a preview viewer is present, i.e. studio mount).+ 4. (optional) User edits the **token image**: click/drag-drop an image file, or "📸 Use 3D view" to snapshot the preview canvas (only when a preview viewer is present, i.e. studio mount). Files over ~3 MB are downscaled in the browser (1024px max, PNG then JPEG fallback) instead of rejected; only an unshrinkable image errors ("Could not shrink that image under 4 MB").5. User edits **name** (≤32 chars), **symbol** (≤10 codepoints, any chars incl. emoji; auto-derived from name until edited), **description** (≤500).- 6. User picks a **coin type**: Regular / Mayhem / Agent (default, buyback-bound) / USDC / Reward.+ 5b. User picks a **launch lane**: pump.fun (default, the reach lane) or the **three.ws native bonding curve** (the economics lane). The native toggle only renders when `GET /api/native-launch/config` returns a pinned curve config for the network; its fee split and graduation target are rendered from that server config. The native lane is SOL-quoted, takes the base fields only (no coin variants, no buyback binding), and forces the connected-wallet signer (no custodial path yet).+ 6. User picks a **coin type** (pump.fun lane): Regular / Mayhem / Agent (default, buyback-bound) / USDC / Reward.7. (optional, Agent/USDC only) User sets the **buyback share** slider (0–50%, `buybackBps` 0–5000).8. (optional) User sets an **initial buy** (SOL, max 50; or USDC, max 1,000,000). Live cost line in the wallet bar updates as they type.9. User picks **wallet source** via the tab toggle: "Connected wallet" or "Agent wallet (custodial · server-signed)."@@ -35,18 +36,19 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.10c. **Agent-wallet path:** `POST /api/pump/agent-wallet` provisions/resolves the custodial wallet, returns address + lamports/sol. (optional) "Fund" opens a deposit modal (QR + address); balance polls every 30s.11. User clicks **Launch $SYMBOL**. The button's `data-action` routes: sign-in / focus-first-missing-field / connect / link / agent-fund / agent-retry / launch.12. **Build metadata** (both paths): phase `building` — if image present, `fileToDataUrl`, then `POST /api/pump/build-metadata` → `metadata_url` (cached by name|symbol|desc|hasImage key).- 13a. **Connected-wallet launch:** phase `stamping` — client grinds the `3ws` mint keypair via `grindVanity(THREE_WS_VANITY)` with live k/s + ETA progress. Then phase `signing` → `POST /api/pump/launch-prep` (sends `wallet_address`, `mint_address` = ground pubkey, coin_type, buyback_bps, buy-in, network=mainnet) → returns `tx_base64` + `prep_id`. Deserialize `VersionedTransaction`, `wallet.signTransaction`, then co-sign with the ground mint keypair.- 13b. Phase `confirming` — `conn.sendRawTransaction(skipPreflight:false)` over `/api/solana-rpc`, then `pollConfirmation` (75s, 2s interval). On confirm → `finalizeConfirm`: `POST /api/pump/launch-confirm` with `prep_id` + `tx_signature` → echoes `pump_agent_mint.mint`.+ 13a. **Connected-wallet launch:** phase `stamping`: client grinds the `3ws` mint keypair via `grindVanity(THREE_WS_VANITY)` with live k/s + ETA progress. Then phase `signing` → `POST /api/pump/launch-prep` (pump.fun lane; sends `wallet_address`, `mint_address` = ground pubkey, coin_type, buyback_bps, buy-in, network=mainnet) or `POST /api/native-launch/launch-prep` (native lane; base fields + `sol_buy_in` only) → returns `tx_base64` + `prep_id`. Deserialize `VersionedTransaction`, `wallet.signTransaction`, then co-sign with the ground mint keypair.+ 13b. Phase `confirming`: `conn.sendRawTransaction(skipPreflight:false)` over `/api/solana-rpc`, then `pollConfirmation` (75s, 2s interval). On confirm → `finalizeConfirm`: `POST /api/pump/launch-confirm` (or `/api/native-launch/launch-confirm` on the native lane) with `prep_id` + `tx_signature` → echoes `pump_agent_mint.mint`.14a. **Agent-wallet launch:** phase `stamping` (server stamps `3ws`), then phase `confirming` → `POST /api/pump/launch-agent` (server signs + submits with the custodial key, ~10s) → returns `mint`. Agent balance refreshes.15. Phase `success` — success card shows the stamped mint (with the `3ws` mark visually emphasized), "✓ three.ws coin" badge, links to pump.fun / Solscan / the agent page, "Copy launch announcement," and "Launch another token."16. (existing-token branch) Fees & rewards panel mounts against the mint for claim/delegation management.- **Decision points / branches:**- Existing mint found → existing-token card vs. "force new."+ - Launch lane: pump.fun (default; coin types + custodial path available) vs. three.ws native curve (only offered when a curve config is deployed for the network; connected-wallet signer only; base fields only).- Coin type: Regular / Mayhem (high-volatility, no buyback) / Agent (SOL buyback+burn) / USDC (stablecoin-paired agent) / Reward (delegated creator fees; launches as a plain coin, fees split post-graduation). USDC & Reward both remap server-side (`coin_type: 'agent'` / `'regular'`).- Wallet source: connected (client-grinds mark, client-signs) vs. agent (server-grinds, server-signs).- Connected path may require a one-time SIWS link, and a link may hit a takeover branch.- Confirmation timeout → escape-hatch screen ("Finalize once confirmed" re-checks signature status, "Start over").-- **External calls / dependencies:** `/api/auth/me`, `/api/avatars`, `/api/pump/by-agent`, `/api/auth/wallets`, `/api/auth/wallets/nonce-solana`, `/api/auth/wallets/link-solana`, `/api/pump/agent-wallet`, `/api/pump/build-metadata`, `/api/pump/launch-prep`, `/api/pump/launch-confirm`, `/api/pump/launch-agent`, `/api/solana-rpc` (Connection RPC). External: `esm.sh/@solana/[email protected]`, `esm.sh/[email protected]`, pump.fun (mint target), Solscan (links).+- **External calls / dependencies:** `/api/auth/me`, `/api/avatars`, `/api/pump/by-agent`, `/api/auth/wallets`, `/api/auth/wallets/nonce-solana`, `/api/auth/wallets/link-solana`, `/api/pump/agent-wallet`, `/api/pump/build-metadata`, `/api/pump/launch-prep`, `/api/pump/launch-confirm`, `/api/pump/launch-agent`, `/api/native-launch/config`, `/api/native-launch/launch-prep`, `/api/native-launch/launch-confirm`, `/api/solana-rpc` (Connection RPC). External: `esm.sh/@solana/[email protected]`, `esm.sh/[email protected]`, pump.fun (mint target), Solscan (links).- **Success state:** `lp-ok` card — stamped mint, verified badge, pump.fun/Solscan/agent-page links, share-announcement copy, relaunch button. The coin appears in `/launches` within 60s via live refresh.- **Empty / error states:** signed-out / no-avatar guided onboarding (4-step explainer + coin-type legend + cost note); "Checking for existing token…"; per-phase `lp-phase` status line; `friendlyError()` maps rejections/insufficient SOL/no-wallet/rate-limit to plain copy; confirmation-timeout escape hatch; agent-wallet error/retry/provision states; insufficient-balance "Fund" CTA.- **Step count:** 15 required (+5 optional)@@ -96,8 +98,8 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.---### Solana Vanity Wallet — `/vanity-wallet`-- **Source:** `public/vanity-wallet.html` (self-contained inline module). Grinder: `src/solana/vanity/grinder.js` (`grindVanity`); validation: `src/solana/vanity/validation.js`.-- **Entry point:** Prefix / suffix inputs, case-insensitive toggle, CPU-core slider, Generate button.+- **Source:** `public/vanity-wallet.html` (self-contained inline module). Grinder: `src/solana/vanity/grinder.js` (`grindVanity`); validation: `src/solana/vanity/validation.js`. Sealed gifts: `src/pages/sealed-drops.js` (+ `src/solana/vanity/sealed-envelope.js`, `drop-protocol.js`; backend `api/vanity/drops.js`).+- **Entry point:** Prefix / suffix inputs, case-insensitive toggle, CPU-core slider, Generate button; a "🎁 Send a sealed gift" section sits below the grinder.- **Prerequisites / gates:** None to grind (runs entirely in-browser; keys never leave the device). Assigning the result to an agent requires sign-in.- **Steps (N):**1. User types a **prefix** ("Starts with", ≤6) and/or **suffix** ("Ends with", ≤6); live base-58 validation, difficulty meter, and per-core ETA update.@@ -107,8 +109,9 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.5. On hit → result card: highlighted address, attempts/duration/rate stats, **Download keypair (Solana CLI JSON)**, **Copy public key**, and a "save before leaving" warning.6. (optional) **Assign to an agent**: `GET /api/agents`. If 401 → sign-in prompt; if none → create-agent prompt; else select an agent + check the custody-ack box.7. (optional, assign) If the agent already has a wallet, the flow switches to "Replace" — `DELETE /api/agents/:id/solana` first, then `POST /api/agents/:id/solana` with `secret_key` (array) + `vanity_prefix`/`vanity_suffix`. 409 handled. Success confirms "encrypted server-side" custody transfer.-- **Decision points / branches:** prefix vs suffix vs both; case-sensitive vs insensitive; assign vs keep self-custody; replace-existing-wallet branch.-- **External calls / dependencies:** None for grinding (client-side WASM ed25519 workers). Assign: `/api/agents`, `/api/agents/:id/solana` (POST + DELETE).+ 8. (optional) **Send a sealed gift** (`sealed-drops.js`): compose a funded wallet drop (asset/amount, optional vanity pattern reusing the page's grind fields, seal mode "Bearer link" vs direct X25519 key, message/theme, expiry, optional reclaim address) → pays the x402 create fee → shareable `/drop/:id` link + QR + OG card. The recipient's claim page opens the ECIES sealed envelope entirely client-side (claim key rides the URL fragment in bearer mode), then offers import / download / sweep; three.ws never sees the plaintext key. "Gifts you've sent from this browser" lists sent drops with reclaim for expired ones.+- **Decision points / branches:** prefix vs suffix vs both; case-sensitive vs insensitive; assign vs keep self-custody; replace-existing-wallet branch; gift seal mode bearer vs direct-key; gift claimed vs expired (reclaim).+- **External calls / dependencies:** None for grinding (client-side WASM ed25519 workers). Assign: `/api/agents`, `/api/agents/:id/solana` (POST + DELETE). Gifts: `/api/vanity/drops` (+ x402 create fee, on-chain funding/reclaim server-side).- **Success state:** vanity address found + downloadable keypair; optionally "Assigned to <agent>" with an open-agent link.- **Empty / error states:** invalid-Base58 preview; combined-length-over-max warning; grind-failed error; assign 401/empty/409/network errors each handled inline.- **Step count:** 3 required (+4 optional)@@ -192,7 +195,7 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.---### threews.sol Name Claim (SNS subdomain) — `/threews/claim`-- **Source:** route `/threews/claim` → `pages/threews-claim.html` (self-contained inline module). Pay-by-name plumbing: `src/sns/pay-by-name.js`. Surfaced from `/three`'s rare-name studio.+- **Source:** route `/threews/claim` → `pages/threews-claim.html` (self-contained inline module). Pay-by-name plumbing: `src/sns/pay-by-name.js`. Surfaced from the profile page's "Claim <username>.threews.sol" wallet pill (`pages/profile.html`).- **Entry point:** `#tw-label` label input + `#tw-mint` Mint button; `#tw-status` availability line; `#tw-result`.- **Prerequisites / gates:** Sign-in required to mint (CSRF token from `/api/csrf-token`; "not signed in" if absent). Minting an on-chain SNS subdomain under `*.threews.sol`.- **Steps (N):**@@ -200,7 +203,7 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.2. `GET /api/threews/subdomain?label=` → shows "<full> is available" (enables Mint) or "claimed by @user / owned by <addr>".3. User clicks **Mint** → `getCsrf()` (`GET /api/csrf-token`) → `POST /api/threews/subdomain` with `{ label }` + `x-csrf-token`.4. On success → "<full> minted" with the showcase URL and a Solscan tx link for the on-chain mint signature.-- **Decision points / branches:** available vs taken; pricing tier (common = free; short/dictionary/reserved are priced in $THREE, surfaced via `/three` name-quote before landing here); signed-in vs not.+- **Decision points / branches:** available vs taken; label must equal the account's username (the server 409s `username_mismatch` otherwise, and requires a username to be set); signed-in vs not; optional `owner_wallet` must be a Solana wallet already linked to the account.- **External calls / dependencies:** `/api/threews/subdomain` (GET check + POST mint), `/api/csrf-token`; Solscan (tx link). On-chain SNS mint.- **Success state:** Minted name card with showcase URL + tx signature link.- **Empty / error states:** "Type a label to check"; availability "bad" state for taken names; mint-failed (re-enables button); not-signed-in CSRF failure.@@ -208,19 +211,19 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.----### $THREE Economy — `/three`-- **Source:** `pages/three.html` → `src/three-economy.js`. Wallet/tier via `src/three-access.js` (`getAccess`) + `src/wallet.js` (`initWalletButton`).-- **Entry point:** "The Flow" canvas viz, live stats, treasury/rewards wallets, holder-tier ladder, pricing explorer, rare-name studio.-- **Prerequisites / gates:** All read-only. Connecting a wallet resolves the holder tier from on-chain $THREE; no purchase happens on this page (CTAs link out to `/three-token` to buy and `/threews/claim` to mint names).+### $THREE Holder Tiers - `/three`+- **Source:** `pages/three.html` → `src/three-tier-page.js`. Wallet via `src/wallet.js` (`getConnectedWalletAddress` / `connectWallet`); swap via `src/swap-jupiter.js` (`openSwapModal`); mint from `src/pump/three-token-data.js`.+- **Entry point:** `#tier-root` renders the canonical hold-to-access ladder. Every locked state across the platform (nav tier chip, in-place lock panels) routes here as the single upgrade path.+- **Prerequisites / gates:** All read-only. Connecting a wallet (or being signed in) resolves the holder tier from on-chain $THREE; buying happens in the in-page Jupiter swap modal, price detail links to `/three-token`.- **Steps (N):**- 1. Boot fetches `/api/three/{catalog,stats,tier,access}` + `/api/token/price`; renders the flow viz, animated stats, and on-chain-verifiable treasury/rewards wallet addresses.- 2. (optional) User clicks **Connect wallet to see your tier** (hidden `#connect-wallet-btn` wired by `initWalletButton`); a `wallet:changed` event re-reads the tier and applies the discount live in the pricing explorer.- 3. (optional) **Rare-name studio:** user types a `*.threews.sol` name → `GET /api/three/name-quote?name=` → "Free to mint" (common) or a $THREE rarity price; links to `/threews/claim` to mint.- 4. (optional) Explore the holder-tier ladder (Live vs Planned feature matrix from `/api/three/access`) and the pricing explorer (tier discount applied).-- **Decision points / branches:** wallet connected (real tier) vs synthesized-from-wallet vs no-wallet; name common (free) vs rare (priced).-- **External calls / dependencies:** `/api/three/catalog`, `/api/three/stats`, `/api/three/tier`, `/api/three/access`, `/api/three/name-quote`, `/api/token/price`. Wallet connect via the global `initWalletButton`.-- **Success state:** fully populated economy dashboard reflecting live treasury/rewards/holder data; tier + discount applied for a connected wallet.-- **Empty / error states:** connect-wallet prompts where no tier is resolved; designed loading/empty states throughout; name-quote validation feedback.+ 1. Boot fetches `GET /api/three/tier` + `GET /api/three/access` (both accept `?wallet=` for an account-less visitor with a connected Phantom); renders every tier with its perks, the live fee discount, and the free-quota multiplier. Truth comes from the server; both endpoints degrade to the Member floor on any hiccup so a price/RPC outage still shows the ladder.+ 2. (optional) User connects a wallet / signs in → their current tier is highlighted with the exact $-to-next-tier delta.+ 3. (optional) **Hold more $THREE** → opens the Jupiter swap modal (SOL → $THREE) in place.+ 4. (optional) Per-feature access matrix from `/api/three/access` shows what each tier unlocks (`enforced` / `eligible` / `required`).+- **Decision points / branches:** wallet connected or signed in (tier highlighted) vs neither (connect/sign-in prompt); ladder loaded vs outage (retry); holdings overflow handled gracefully at $10M+.+- **External calls / dependencies:** `/api/three/tier`, `/api/three/access` (both `?wallet=`-aware), Jupiter swap modal, `/three-token` (price page link).+- **Success state:** populated tier ladder with the visitor's real tier, delta to the next tier, and a working in-page path to hold more.+- **Empty / error states:** all five states designed: skeleton ladder while loading, connect/sign-in prompt with the public ladder, actionable error with retry, populated ladder, $10M+ overflow formatting.- **Step count:** 1 required (+3 optional)---