Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: enhance Live Trading Theater with fallback rigs for avatar-less agents and add ui-arm-swarm script for arming Swarm agents
nrpo18ed5ff46e39
diff --git a/packages/agent-sniper/runbooks/LOG.md b/packages/agent-sniper/runbooks/LOG.mdindex dacbd5e14..4ca7cda54 100644--- a/packages/agent-sniper/runbooks/LOG.md+++ b/packages/agent-sniper/runbooks/LOG.md@@ -104,6 +104,14 @@ idempotent. Swarm 1 ✓, Swarm 2 in progress at log time.**Pipeline:** A create → B vanity (UI) → C fund from niChP → D arm (UI) → E run worker + recordcontinuously until last buy → F sweep + rotate secrets. Fable layer deferred (API key unfunded).+**Phase E — worker boot VERIFIED (simulate, vs live Neon):** `node workers/agent-sniper/index.js`+boots clean — `mayhem filter enabled=true`, `feed connected` (live pump.fun), strategies refreshed,+intel/radar/market-maker armed, live candidate scoring with `has_socials`/`mc_usd` reasons,+`intel llm:false` (Fable off, as intended). The engine works end-to-end against the real DB.+Scripts ready: `scripts/fund-swarm.mjs` (DB-driven fund from niChP), funding-verified.+Note: currently 1 non-Swarm armed strategy in DB (agent 4959a139…) — check its balance before+live; fund ONLY Swarm so only Swarm trades.+**Open / next (blocking, owner decisions):**- Vanity vs random UI wallets? (vanity ⇒ a non-UI import step).- Account: register a fresh three.ws account in-UI, or use the owner's login?diff --git a/packages/agent-sniper/scripts/ui-arm-swarm.mjs b/packages/agent-sniper/scripts/ui-arm-swarm.mjsnew file mode 100644index 000000000..09b2fe884--- /dev/null+++ b/packages/agent-sniper/scripts/ui-arm-swarm.mjs@@ -0,0 +1,73 @@+// ui-arm-swarm.mjs — arm every Swarm agent's pump.fun sniper through the real+// /dashboard/sniper "Arm an agent +" modal, signed in via the saved session,+// recorded. Per agent: select it, set daily budget / per-trade / oracle-conviction,+// confirm. Run AFTER funding (the platform keeps an unfunded agent disarmed).+//+// Env from ~/.three-ws-fleet/env. Usage: DAILY=0.02 PER_TRADE=0.002 ORACLE=55 node scripts/ui-arm-swarm.mjs++import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { chromium } from 'playwright';++const BASE = process.env.BASE || 'https://three.ws';+const OUT = process.env.OUT || '/tmp/ui-arm-swarm';+const STATE = path.join(os.homedir(), '.three-ws-fleet', 'state.json');+const DAILY = process.env.DAILY || '0.02';+const PER_TRADE = process.env.PER_TRADE || '0.002';+const ORACLE = process.env.ORACLE || '55';++fs.mkdirSync(OUT, { recursive: true });+const browser = await chromium.launch({ args: ['--use-gl=angle', '--use-angle=swiftshader', '--no-sandbox', '--disable-dev-shm-usage'] });+const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, storageState: STATE, recordVideo: { dir: OUT, size: { width: 1280, height: 900 } } });+const page = await ctx.newPage();+const shot = (n) => page.screenshot({ path: path.join(OUT, `${n}.png`) }).catch(() => {});++async function armOne(name) {+ await page.goto(`${BASE}/dashboard/sniper`, { waitUntil: 'domcontentloaded', timeout: 45_000 });+ await page.waitForTimeout(3500);+ // already armed? a strategy card with this name means done+ const has = await page.evaluate((nm) => [...document.querySelectorAll('h1,h2,h3,h4,[class*="name"],[class*="title"]')].some((h) => (h.textContent || '').trim().startsWith(nm)), name).catch(() => false);+ if (has) return 'exists';+ const armBtn = await page.$('#sn-arm-btn') || await page.$('button:has-text("Arm an agent")');+ if (!armBtn) return 'no-arm-btn';+ await armBtn.click().catch(() => {});+ await page.waitForTimeout(2000);+ // select the agent option matching this name+ const val = await page.evaluate((nm) => {+ const sel = document.querySelector('#sn-arm-agent'); if (!sel) return null;+ for (const o of sel.options) if ((o.textContent || '').trim() === nm || (o.textContent || '').includes(nm)) return o.value;+ return null;+ }, name).catch(() => null);+ if (!val) return 'not-in-dropdown';+ await page.selectOption('#sn-arm-agent', val).catch(() => {});+ await page.fill('#sn-arm-budget', DAILY).catch(() => {});+ await page.fill('#sn-arm-per-trade', PER_TRADE).catch(() => {});+ const orc = await page.$('#sn-arm-oracle'); if (orc) await orc.fill(ORACLE).catch(() => {});+ await page.waitForTimeout(400);+ const confirm = await page.$('#sn-arm-confirm');+ if (!confirm) return 'no-confirm';+ await confirm.click().catch(() => {});+ await page.waitForTimeout(3500);+ return 'armed';+}++try {+ let armed = 0;+ for (let i = 1; i <= 33; i++) {+ const name = `Swarm ${i}`;+ process.stdout.write(`arming ${name} … `);+ let r = '';+ try { r = await armOne(name); } catch (e) { r = 'err:' + e.message.slice(0, 50); }+ if (r === 'armed' || r === 'exists') armed++;+ console.log(r);+ }+ await shot('final');+ console.log(`\narmed/exists: ${armed}/33`);+} catch (err) {+ console.log('✗', err.message.slice(0, 160)); await shot('error');+} finally {+ await page.waitForTimeout(400); await ctx.close();+ const vid = fs.readdirSync(OUT).find((f) => f.endsWith('.webm')); await browser.close();+ console.log('out:', OUT, vid ? `(video: ${vid})` : '');+}diff --git a/public/changelog.json b/public/changelog.jsonindex 8ffba80b5..cda5afb8d 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T11:00:11.257Z",+ "generated_at": "2026-07-03T11:11:32.886Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",diff --git a/public/features.json b/public/features.jsonindex 36e308690..ffba4e3c2 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T11:00:11.207Z",+ "generated_at": "2026-07-03T11:11:32.855Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/theater-stage.js b/src/theater-stage.jsindex 452113bc5..b695d886f 100644--- a/src/theater-stage.js+++ b/src/theater-stage.js@@ -72,6 +72,27 @@ const REACTIONS = {};const ALL_REACTION_CLIPS = [...new Set(Object.values(REACTIONS).flat())];+// Distinct rigged bodies for agents that don't ship their own avatar. A trading+// floor of identical mannequins reads as clones, so each avatar-less agent is+// dressed in a different humanoid rig from this pool — assigned round-robin so no+// two adjacent desks match. Every entry is a rigged humanoid that drives the+// canonical clips; anything that fails the rig gate still falls back to the+// mannequin (rare), it just costs one repeat rather than a T-pose.+// Only standard, clean rigs whose skeleton retargets the canonical clips without+// detonating (Mixamo, Khronos CesiumMan, ReadyPlayerMe, our mannequin). Ordered+// lightest first so the most-visible front desks paint fast. Unknown-provenance+// GLBs are excluded on purpose: some pass the rest-pose gate but explode once the+// idle clip drives them (a giant blob), so we don't gamble the floor on them.+const FALLBACK_RIGS = [+ '/avatars/cesium-man.glb', // ~0.4 MB, classic rigged human+ '/avatars/mannequin.glb', // ~0.2 MB+ '/avatars/xbot.glb', // ~2.9 MB, Mixamo+ '/avatars/michelle.glb', // ~3.2 MB, Mixamo+ '/avatars/realistic-female.glb',// ~5.7 MB, ReadyPlayerMe+ '/avatars/realistic-male.glb', // ~9.7 MB, ReadyPlayerMe+ '/avatars/selfie-girl.glb', // ~11 MB, ReadyPlayerMe+];+// The colour a trader's monitor flashes for each event — green on a fill, violet// on a verify/pay, amber when a safety rule refuses a buy. The resting glow is a// dim blue so a room of idle desks still reads as "screens on, market open".@@ -225,6 +246,11 @@ export function createStage({ canvas, overlay, onSelect, reducedMotion = false,let orbitYaw = 0;let swayT = 0;let highlightId = null;+ let lastExplodeCheck = 0;+ // A humanoid — even mid-celebration with arms overhead — never exceeds a couple+ // of metres. A retargeted skin that detonates balloons far past this, so any+ // performer whose animated body crosses it is swapped to the clean mannequin.+ const EXPLODE_LIMIT = 5;// Build a workstation (desk + monitor) in front of a performer, toward the// camera, so the trader stands behind a lit terminal. The monitor's emissive@@ -323,14 +349,14 @@ export function createStage({ canvas, overlay, onSelect, reducedMotion = false,return { model, anim, drivable: drivable && humanoid };}- async function addPerformer(agent, index, total) {+ async function addPerformer(agent, index, total, rigUrl = null) {if (disposed || performers.has(agent.id)) return;const slot = deskSlot(index, total);- // Rigged avatars only. Try the agent's own model first; if it isn't a- // drivable humanoid, swap in the rigged mannequin (the platform's designed- // fallback) rather than staging forge geometry as-is.- const url = agentAvatarGlb(agent);+ // Rigged avatars only. Try the resolved body first (the agent's own avatar,+ // or a distinct fallback rig assigned by setRoster); if it isn't a drivable+ // humanoid, swap in the mannequin rather than staging forge geometry as-is.+ const url = rigUrl || agentAvatarGlb(agent);let body = await buildBody(url, slot);if (disposed || performers.has(agent.id)) { body?.anim?.dispose?.(); return; }if ((!body || !body.drivable) && url !== MANNEQUIN_GLB) {@@ -415,15 +441,44 @@ export function createStage({ canvas, overlay, onSelect, reducedMotion = false,for (const [id, rec] of [...performers]) {if (!keep.has(id)) removePerformer(id, rec);}+ // Resolve each body, giving avatar-less agents a DISTINCT fallback rig so the+ // floor isn't a row of clones. A running counter (not the loop index) walks+ // the pool, so only agents that actually need a fallback consume a slot —+ // agents with their own avatar never collide with the rotation.+ let fbN = 0;// Add sequentially with a micro-yield so a full room fills progressively// instead of stalling one frame on a dozen GLB clones.for (let i = 0; i < agents.length; i++) {if (disposed) return;- await addPerformer(agents[i], i, agents.length);+ const base = agentAvatarGlb(agents[i]);+ const rigUrl = base !== MANNEQUIN_GLB ? base : FALLBACK_RIGS[fbN++ % FALLBACK_RIGS.length];+ await addPerformer(agents[i], i, agents.length, rigUrl);if ((i & 3) === 3) await new Promise((r) => setTimeout(r, 0));}}+ // A rig detonated under animation — hide the wreck and hot-swap the clean+ // mannequin into the same desk so the floor never shows a blob. Idempotent per+ // performer via `_fixing`. The desk/plate/shadow stay; only the body changes.+ async function neutralizeExploded(rec) {+ if (rec._fixing) return;+ rec._fixing = true;+ rec.model.visible = false;+ try { rec.anim?.dispose?.(); } catch {}+ rec.drivable = false;+ const body = await buildBody(MANNEQUIN_GLB, rec.slot);+ if (disposed || !performers.has(rec.agent.id) || !body?.model) { body?.anim?.dispose?.(); return; }+ const old = rec.model;+ rec.group.remove(old);+ old.traverse?.((n) => { if (n.isMesh) { n.geometry?.dispose?.(); disposeMaterial(n.material); } });+ rec.group.add(body.model);+ rec.model = body.model;+ rec.anim = body.anim;+ rec.drivable = body.drivable;+ if (rec.drivable && !reducedMotion) rec.anim.play('idle');+ rec._fixing = false;+ }+function removePerformer(id, rec) {performers.delete(id);try { rec.anim?.dispose?.(); } catch {}@@ -590,6 +645,19 @@ export function createStage({ canvas, overlay, onSelect, reducedMotion = false,if (rec.screenFlash && now > rec.screenFlash) { rec.screenMat.emissive.setHex(SCREEN_IDLE); rec.screenFlash = 0; }}}++ // Explosion guard (throttled): a rig that detonates under the idle clip is+ // hot-swapped to the mannequin so the floor never shows a blob. Cheap — a+ // bbox measure per performer twice a second.+ if (now - lastExplodeCheck > 500) {+ lastExplodeCheck = now;+ for (const rec of performers.values()) {+ if (!rec.drivable || rec._fixing || !rec.model?.visible) continue;+ _box.setFromObject(rec.model, true);+ const hh = _box.max.y - _box.min.y;+ if (!(hh < EXPLODE_LIMIT)) { log.warn('[theater] rig exploded, swapping to mannequin', rec.agent?.id); neutralizeExploded(rec); }+ }+ }}// Centerpiece coins: rise (0–0.6s), hold, sink + remove (after 3.4s).