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 health check endpoint and corresponding tests; enhance multiplayer features with VR keyboard support
nirholas83d62e8cde89
diff --git a/.claude/hooks/done-gate.sh b/.claude/hooks/done-gate.shindex 38de57c19..a371045b2 100755--- a/.claude/hooks/done-gate.sh+++ b/.claude/hooks/done-gate.sh@@ -52,9 +52,12 @@ while IFS= read -r line; do[ -z "$cur_file" ] && continue# Skip exempt paths/extensionscase "$cur_file" in- */.claude/*|*/memory/*|*/node_modules/*|*/dist/*|*/dist-lib/*|*/public/*) continue ;;- */tests/*|*/test/*|*.test.*|*.spec.*) continue ;;- */specs/*|*/docs/*) continue ;;+ .claude/*|*/.claude/*) continue ;;+ memory/*|*/memory/*) continue ;;+ node_modules/*|*/node_modules/*) continue ;;+ dist/*|*/dist/*|dist-lib/*|*/dist-lib/*|public/*|*/public/*) continue ;;+ tests/*|*/tests/*|test/*|*/test/*|*.test.*|*.spec.*) continue ;;+ specs/*|*/specs/*|docs/*|*/docs/*) continue ;;*.md|*.json|*.lock|*.svg|*.png|*.jpg|*.jpeg|*.gif|*.webp|*.glb|*.gltf|*.wasm|*.ico|*.woff|*.woff2|*.ttf|*.map) continue ;;esacif printf '%s' "$add" | grep -Eqi "$LAZY_RE"; then@@ -69,9 +72,12 @@ while IFS= read -r f; do[ -n "$f" ] || continue[ -f "$f" ] || continuecase "$f" in- */.claude/*|*/memory/*|*/node_modules/*|*/dist/*|*/dist-lib/*|*/public/*) continue ;;- */tests/*|*/test/*|*.test.*|*.spec.*) continue ;;- */specs/*|*/docs/*) continue ;;+ .claude/*|*/.claude/*) continue ;;+ memory/*|*/memory/*) continue ;;+ node_modules/*|*/node_modules/*) continue ;;+ dist/*|*/dist/*|dist-lib/*|*/dist-lib/*|public/*|*/public/*) continue ;;+ tests/*|*/tests/*|test/*|*/test/*|*.test.*|*.spec.*) continue ;;+ specs/*|*/specs/*|docs/*|*/docs/*) continue ;;*.md|*.json|*.lock|*.svg|*.png|*.jpg|*.jpeg|*.gif|*.webp|*.glb|*.gltf|*.wasm|*.ico|*.woff|*.woff2|*.ttf|*.map) continue ;;esacwhile IFS= read -r line; dodiff --git a/api/_lib/pumpfun-ws-feed.js b/api/_lib/pumpfun-ws-feed.jsindex d0390c351..993deffff 100644--- a/api/_lib/pumpfun-ws-feed.js+++ b/api/_lib/pumpfun-ws-feed.js@@ -152,7 +152,29 @@ async function enrichMint(d) {getSolPrice(),fetchMeta(d.uri),]);- return normalizeMint(d, meta, solPrice);+ const base = normalizeMint(d, meta, solPrice);+ // Add creator history so mint cards can flag "10 launches, 0 graduated"+ // rugger profiles at a glance. Best-effort — if the creator endpoint+ // times out we keep the base card.+ try {+ const userCoins = d.traderPublicKey ? await fetchCreatorCoins(d.traderPublicKey) : null;+ if (Array.isArray(userCoins)) {+ base.creator_launches = userCoins.length;+ base.creator_graduated = userCoins.reduce((n, c) => n + (isGraduated(c) ? 1 : 0), 0);+ base.creator_tokens = userCoins+ .map((c) => ({+ mint: c.mint,+ symbol: c.symbol,+ name: c.name,+ mc: pickMc(c, solPrice),+ graduated: isGraduated(c),+ }))+ .filter((c) => c.symbol);+ }+ } catch (err) {+ console.warn('[pumpportal-ws] mint creator-history failed:', err?.message);+ }+ return base;}function normalizeMint(d, meta, solPrice) {diff --git a/api/healthz.js b/api/healthz.jsnew file mode 100644index 000000000..02dea9169--- /dev/null+++ b/api/healthz.js@@ -0,0 +1,30 @@+// GET /api/healthz+// ----------------+// Lightweight liveness/readiness endpoint. Returns 200 with uptime + a small+// summary block compatible with the pump-dashboard's API status panel.+//+// Intentionally has no DB / RPC dependencies — this should stay green even+// when downstream systems are degraded so it's safe to wire to uptime probes.++import { cors, json, method, wrap } from './_lib/http.js';++const STARTED_AT = Date.now();+const VERSION = process.env.VERCEL_GIT_COMMIT_SHA || process.env.npm_package_version || 'dev';++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;+ if (!method(req, res, ['GET'])) return;++ const uptimeMs = Date.now() - STARTED_AT;+ return json(res, 200, {+ status: 'ok',+ service: '3d-agent',+ version: VERSION,+ uptime: Math.floor(uptimeMs / 1000),+ uptimeMs,+ // Match the pump-dashboard health shape so the existing UI binding works+ // without conditional logic.+ monitor: { running: true, mode: 'serverless', claimsDetected: 0 },+ watches: { total: 0, active: 0 },+ }, { 'cache-control': 'public, max-age=2, s-maxage=2' });+});diff --git a/api/openapi-json.js b/api/openapi-json.jsindex 96c4264f4..3c027a694 100644--- a/api/openapi-json.js+++ b/api/openapi-json.js@@ -183,6 +183,16 @@ export default wrap(async (req, res) => {},},},+ '/api/healthz': {+ get: {+ operationId: 'healthz',+ summary: 'Service liveness',+ description: 'Lightweight liveness probe with uptime + service version. No auth.',+ responses: {+ 200: { description: 'Health summary JSON' },+ },+ },+ },'/api/pump/curve': {get: {operationId: 'pump_curve',diff --git a/public/pumpfun.html b/public/pumpfun.htmlindex db0d7d566..fffa3e871 100644--- a/public/pumpfun.html+++ b/public/pumpfun.html@@ -30,6 +30,7 @@.dot.live { background: #4ade80; animation: pulse 1.6s ease-in-out infinite; }.dot.connecting { background: #fbbf24; }.dot.down { background: #f87171; }+ .dot.quiet { background: #94a3b8; animation: pulse 4s ease-in-out infinite; }@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }.status-pill { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; }@@ -329,6 +330,11 @@</button></div><button id="ctl-narrate" class="toggle" type="button" data-on="1" title="Toggle agent narration">🔊 Narration</button>+ <select id="ctl-mood" title="Avatar mood — biases reaction intensity">+ <option value="chill">😎 Chill</option>+ <option value="normal" selected>🙂 Normal</option>+ <option value="hype">🤩 Hype</option>+ </select><button id="ctl-share" class="pf-icon-btn" type="button" title="Copy a shareable link with current filters">🔗 <span id="ctl-share-label">Share</span></button><button id="side-toggle" class="pf-icon-btn" type="button" aria-pressed="false" aria-controls="side" title="Toggle live feed">📡 Feed</button></div>@@ -345,6 +351,18 @@<h2>Reputation signals</h2><div class="signal-grid" id="signals"></div></div>+ <div id="first-claims-section">+ <h2>+ <span>First-time fee claims</span>+ <select id="fc-window" title="Lookback window" style="margin-left:8px;background:#0f0f17;color:#e6e6f0;border:1px solid #20202c;border-radius:6px;padding:2px 6px;font-size:12px">+ <option value="60">1h</option>+ <option value="360">6h</option>+ <option value="1440" selected>24h</option>+ </select>+ <button type="button" id="fc-refresh" class="pf-icon-btn" title="Refresh first-time claims" style="margin-left:6px">↻</button>+ </h2>+ <div id="first-claims"><div class="empty">Loading first-time claims…</div></div>+ </div><div id="feed-wrap"><h2><span id="feed-title">Live feed</span><a id="helius-pill" class="helius-pill" href="https://helius.dev" target="_blank" rel="noopener" title="Real-time Solana data via Helius webhooks"><span class="helius-dot" aria-hidden="true"></span><span id="helius-count" class="helius-count">0</span>Powered by Helius</a></h2><button type="button" class="feed-jump" id="feed-jump" data-visible="false" aria-live="polite">↑ <span id="feed-jump-count">0</span> new</button>@@ -402,13 +420,16 @@minTier: url.searchParams.get('minTier') || '',network: url.searchParams.get('network') || 'mainnet',narrate: url.searchParams.get('narrate') !== '0',+ mood: url.searchParams.get('mood') || 'normal',avatar: url.searchParams.get('avatar') || '/avatars/cz.glb',};+ if (!['chill', 'normal', 'hype'].includes(params.mood)) params.mood = 'normal';$('ctl-asset').value = params.asset;$('ctl-mint').value = params.mint;$('ctl-kind').value = params.kind;$('ctl-tier').value = params.minTier;$('ctl-narrate').dataset.on = params.narrate ? '1' : '0';+ $('ctl-mood').value = params.mood;// ── Avatar picker ────────────────────────────────────────────────────const DEFAULT_AVATARS = [@@ -1343,6 +1364,55 @@if (feedIsAtTop() && feedQueue.length) flushQueued();}, { passive: true });+ // Cross-source dedupe (HTTP backfill + SSE replay + live) by tx signature.+ // Without this the same graduation can render twice when the page calls+ // the backfill endpoint AND the WS layer replays its in-memory buffer.+ const SEEN_SIG_LIMIT = 500;+ const _seenSigs = new Map();+ function sigOf(ev) { return ev?.signature || ev?.tx_signature || null; }+ function seenSig(sig) {+ if (!sig) return false;+ if (_seenSigs.has(sig)) return true;+ _seenSigs.set(sig, Date.now());+ if (_seenSigs.size > SEEN_SIG_LIMIT) {+ const drop = Math.floor(SEEN_SIG_LIMIT / 4);+ const it = _seenSigs.keys();+ for (let i = 0; i < drop; i++) _seenSigs.delete(it.next().value);+ }+ return false;+ }++ // Stale-upstream watchdog. The SSE socket can read `live` while+ // PumpPortal's upstream WS is silent (their maintenance windows). Surface+ // a "quiet" state so users see the silence isn't their connection.+ const STALE_AFTER_MS = 5 * 60_000;+ let staleTimer = null;+ function bumpAlive() {+ if (staleTimer) { clearTimeout(staleTimer); staleTimer = null; }+ const dot = $('status-dot');+ if (dot && dot.classList.contains('quiet')) setStatus('live', 'live');+ staleTimer = setTimeout(() => {+ const d = $('status-dot');+ if (d && d.classList.contains('live')) setStatus('quiet', 'upstream quiet');+ }, STALE_AFTER_MS);+ }++ // HTTP backfill before the SSE opens — gives the user a non-empty feed+ // instantly even on a cold container that has no WS buffer yet.+ async function backfillFromHttp() {+ try {+ const r = await fetch('/api/pump/recent-graduations?limit=15', { credentials: 'include' });+ if (!r.ok) return;+ const { items } = await r.json();+ if (!Array.isArray(items)) return;+ for (const ev of items.slice().reverse()) {+ if (!eventMatchesMint(ev)) continue;+ if (seenSig(sigOf(ev))) continue;+ pushEvent(renderGraduation({ ...ev, replay: true }));+ }+ } catch {}+ }+function connectFeed() {if (es) { try { es.close(); } catch {} }const qs = new URLSearchParams();@@ -1350,25 +1420,31 @@if (params.minTier) qs.set('minTier', params.minTier);setStatus('connecting', 'connecting…');es = new EventSource(`/api/agents/pumpfun-feed?${qs.toString()}`, { withCredentials: true });- es.addEventListener('open', () => setStatus('live', 'live'));+ es.addEventListener('open', () => { setStatus('live', 'live'); bumpAlive(); });es.addEventListener('error', () => {if (es.readyState === EventSource.CLOSED) setStatus('down', 'disconnected');else setStatus('connecting', 'reconnecting…');});es.addEventListener('claim', (msg) => {const ev = safeJson(msg.data); if (!ev || !eventMatchesMint(ev)) return;+ if (seenSig(sigOf(ev))) return;pushEvent(renderClaim(ev));- dispatchReaction('claim', ev);+ if (!ev.replay) dispatchReaction('claim', ev);+ bumpAlive();});es.addEventListener('graduation', (msg) => {const ev = safeJson(msg.data); if (!ev || !eventMatchesMint(ev)) return;+ if (seenSig(sigOf(ev))) return;pushEvent(renderGraduation(ev));- dispatchReaction('graduation', ev);+ if (!ev.replay) dispatchReaction('graduation', ev);+ bumpAlive();});es.addEventListener('mint', (msg) => {const ev = safeJson(msg.data); if (!ev || !eventMatchesMint(ev)) return;+ if (seenSig(sigOf(ev))) return;pushEvent(renderMint(ev));- dispatchReaction('mint', ev);+ if (!ev.replay) dispatchReaction('mint', ev);+ bumpAlive();});}@@ -1461,8 +1537,77 @@$('side-toggle').setAttribute('aria-pressed', String(open));});- // Initial load- connectFeed();+ // First-time fee claims panel — pulls historical first-claims from+ // /api/pump/first-claims (a backend scan over the pump.fun program's+ // recent signatures). Refreshes via button or window selector, plus+ // every 90s while the page is visible.+ const fcState = { loading: false, timer: 0 };+ async function loadFirstClaims() {+ if (fcState.loading) return;+ fcState.loading = true;+ const host = $('first-claims');+ const win = Number($('fc-window').value) || 1440;+ const btn = $('fc-refresh');+ btn.dataset.flash = 'true';+ try {+ const r = await fetch(+ `/api/pump/first-claims?sinceMinutes=${win}&limit=20`,+ { credentials: 'include' },+ );+ if (!r.ok) throw new Error('status ' + r.status);+ const data = await r.json();+ const items = data?.items || [];+ if (!items.length) {+ host.innerHTML = `<div class="empty">No first-time claims in the last ${win >= 60 ? Math.round(win / 60) + 'h' : win + 'm'}.</div>`;+ } else {+ host.innerHTML = items.map(renderFirstClaim).join('');+ }+ } catch (err) {+ host.innerHTML = `<div class="empty">Could not load first claims: ${escapeHtml(err.message || 'error')}</div>`;+ } finally {+ fcState.loading = false;+ setTimeout(() => delete btn.dataset.flash, 350);+ }+ }+ function renderFirstClaim(c) {+ const sol = (Number(c.lamports) / 1e9).toFixed(4);+ const tsSec = Number(c.ts || 0);+ const when = tsSec ? timeAgo(tsSec) : '';+ const creator = c.creator || '';+ const mint = c.mint || '';+ const sig = c.signature || '';+ const cShort = creator ? `${creator.slice(0, 4)}…${creator.slice(-4)}` : '';+ const mShort = mint ? `${mint.slice(0, 4)}…${mint.slice(-4)}` : '';+ return `+ <div style="background:#0d2d1a;border:1px solid rgba(108,224,200,0.25);border-radius:8px;padding:8px 10px;margin-bottom:6px;font-size:12px;line-height:1.5">+ <div style="display:flex;justify-content:space-between;font-size:11px;opacity:0.8">+ <span style="color:#6ce0c8;font-weight:600">🚨 First claim</span>+ <span>${escapeHtml(when)}</span>+ </div>+ <div style="font-weight:600;margin-top:2px">${sol} SOL</div>+ ${creator ? `<div style="font-family:ui-monospace,monospace;font-size:11px;opacity:0.8"><a href="https://solscan.io/account/${encodeURIComponent(creator)}" target="_blank" rel="noopener" style="color:#6ce0c8">${escapeHtml(cShort)}</a></div>` : ''}+ ${mint ? `<div style="font-family:ui-monospace,monospace;font-size:11px;opacity:0.8"><a href="https://pump.fun/coin/${encodeURIComponent(mint)}" target="_blank" rel="noopener" style="color:#6ce0c8">${escapeHtml(mShort)}</a></div>` : ''}+ ${sig ? `<div style="margin-top:2px"><a href="https://solscan.io/tx/${encodeURIComponent(sig)}" target="_blank" rel="noopener" style="color:#6ce0c8;font-size:11px">view tx ↗</a></div>` : ''}+ </div>+ `;+ }+ $('fc-refresh').addEventListener('click', loadFirstClaims);+ $('fc-window').addEventListener('change', loadFirstClaims);+ function scheduleFcRefresh() {+ if (fcState.timer) clearInterval(fcState.timer);+ fcState.timer = setInterval(() => {+ if (document.visibilityState === 'visible') loadFirstClaims();+ }, 90_000);+ }+ document.addEventListener('visibilitychange', () => {+ if (document.visibilityState === 'visible') loadFirstClaims();+ });+ loadFirstClaims();+ scheduleFcRefresh();++ // Initial load — paint historical graduations from Postgres before the+ // SSE opens so the feed is never blank. Then start the live stream.+ backfillFromHttp().finally(connectFeed);mountAgent();buildAnimChips();diff --git a/pump-dashboard.html b/pump-dashboard.htmlindex 90cabf8ca..6f977d430 100644--- a/pump-dashboard.html+++ b/pump-dashboard.html@@ -781,7 +781,7 @@<table><thead><tr><th>Method</th><th>Path</th><th>Description</th><th>Auth</th></tr></thead><tbody>- <tr><td><span class="tag tag-buy">GET</span></td><td>/api/v1/health</td><td>Health check</td><td>No</td></tr>+ <tr><td><span class="tag tag-buy">GET</span></td><td>/api/healthz</td><td>Health check</td><td>No</td></tr><tr><td><span class="tag tag-buy">GET</span></td><td>/api/v1/status</td><td>Detailed status</td><td>Yes</td></tr><tr><td><span class="tag tag-buy">GET</span></td><td>/api/v1/claims</td><td>Query claims (paginated, filterable)</td><td>Yes</td></tr><tr><td><span class="tag tag-buy">GET</span></td><td>/api/v1/claims/stream</td><td>Real-time SSE claim stream</td><td>Yes</td></tr>@@ -941,7 +941,7 @@ async function connectApi() {updateApiStatus('connecting');try {- const resp = await apiFetch('/api/v1/health');+ const resp = await apiFetch('/api/healthz');if (resp.ok) {const data = await resp.json();updateApiStatus('connected');@@ -960,7 +960,7 @@ async function connectApi() {async function pollHealth() {try {- const resp = await apiFetch('/api/v1/health');+ const resp = await apiFetch('/api/healthz');if (resp.ok) {const data = await resp.json();updateApiStatus('connected');@@ -1032,6 +1032,14 @@ function connectWebSocket() {wsDot.className = 'dot connected';wsLabel.textContent = 'WS: Connected';toast('WebSocket connected', 'success');+ // Auto-subscribe to PumpPortal's new-token stream when connected to+ // their public endpoint so the Live Feed populates without manual setup.+ if (/pumpportal\.fun/.test(state.wsUrl)) {+ try {+ state.ws.send(JSON.stringify({ method: 'subscribeNewToken' }));+ state.ws.send(JSON.stringify({ method: 'subscribeMigration' }));+ } catch { /* socket closing race; reconnect will retry */ }+ }};state.ws.onmessage = (event) => {diff --git a/rider/src/components/menu-mode.js b/rider/src/components/menu-mode.jsindex 6ae675823..bd73ff0c8 100644--- a/rider/src/components/menu-mode.js+++ b/rider/src/components/menu-mode.js@@ -28,17 +28,67 @@ AFRAME.registerComponent('multiplayer-button', {});/**- * Click prompts for a 4-char room code and dispatches mpjoin.- * Falls back to window.prompt — works in 2D viewer + Quest browser.+ * Click opens the VR room-code keyboard when in VR; falls back to prompt().*/AFRAME.registerComponent('multiplayer-join-button', {init: function () {this.el.addEventListener('click', () => {+ const sceneEl = this.el.sceneEl;+ const state = sceneEl.systems.state.state;+ if (state.inVR) {+ sceneEl.emit('mpkeyboardopen', null, false);+ return;+ }const code = window.prompt('Enter 4-letter room code:');- if (!code) { return; }+ if (!code) return;const normalized = code.toUpperCase().trim().slice(0, 4);- this.el.sceneEl.emit('mpcodeinput', normalized, false);- this.el.sceneEl.emit('mpjoin', { code: normalized }, false);+ sceneEl.emit('mpcodeinput', normalized, false);+ sceneEl.emit('mpjoin', { code: normalized }, false);+ });+ }+});++/**+ * Submit handler for the VR room-code keyboard: dismiss + fire join.+ */+AFRAME.registerComponent('multiplayer-keyboard-bridge', {+ init: function () {+ const sceneEl = this.el.sceneEl;+ sceneEl.addEventListener('mpkeyboardsubmit', () => {+ const state = sceneEl.systems.state.state;+ const code = (state.multiplayer.joinCodeInput || '').toUpperCase().slice(0, 4);+ sceneEl.emit('mpkeyboardclose', null, false);+ if (code.length === 4) {+ sceneEl.emit('mpjoin', { code }, false);+ } else {+ sceneEl.emit('mperror', { message: 'Enter all 4 letters' }, false);+ }+ });+ sceneEl.addEventListener('mpnamekeyboardsubmit', () => {+ const state = sceneEl.systems.state.state;+ const name = (state.multiplayer.nameInput || '').trim().slice(0, 14) || 'Player';+ sceneEl.emit('mpnamekeyboardclose', null, false);+ sceneEl.emit('mpsetname', { value: name }, false);+ });+ }+});++/**+ * Opens the VR name keyboard, or prompt() in 2D.+ */+AFRAME.registerComponent('multiplayer-name-button', {+ init: function () {+ this.el.addEventListener('click', () => {+ const sceneEl = this.el.sceneEl;+ const state = sceneEl.systems.state.state;+ if (state.inVR) {+ sceneEl.emit('mpnamekeyboardopen', null, false);+ return;+ }+ const name = window.prompt('Your display name:',+ localStorage.getItem('threewsusername') || 'Player');+ if (!name) return;+ sceneEl.emit('mpsetname', { value: name.trim().slice(0, 14) }, false);});}});@@ -67,6 +117,7 @@ AFRAME.registerComponent('menu-mode', {init: function () {this.el.addEventListener('click', evt => {const item = evt.target.closest('[data-mode]');+ if (!item) return; // non-mode click (e.g. multiplayer button)const mode = item.dataset.mode;const name = item.dataset.name;this.el.sceneEl.emit('gamemode', mode, false);diff --git a/rider/src/state/index.js b/rider/src/state/index.jsindex ec4b3d4df..a95a0bf8b 100644--- a/rider/src/state/index.js+++ b/rider/src/state/index.js@@ -147,6 +147,9 @@ AFRAME.registerState({joinCodeInput: '',countdownText: '',countdownActive: false,+ keyboardOpen: false,+ nameKeyboardOpen: false,+ nameInput: '',// Pre-rendered fixed-slot row strings for the lobby (4 slots).row0Name: '', row0Score: '', row0Visible: false, row0IsMe: false, row0IsHost: false, row0Ready: false,row1Name: '', row1Score: '', row1Visible: false, row1IsMe: false, row1IsHost: false, row1Ready: false,@@ -661,7 +664,30 @@ AFRAME.registerState({},mpcodeinput: (state, payload) => {- state.multiplayer.joinCodeInput = (payload || '').toUpperCase().slice(0, 4);+ const value = typeof payload === 'string' ? payload : (payload && payload.value) || '';+ state.multiplayer.joinCodeInput = value.toUpperCase().slice(0, 4);+ },++ mpnameinput: (state, payload) => {+ const value = typeof payload === 'string' ? payload : (payload && payload.value) || '';+ state.multiplayer.nameInput = value.slice(0, 14);+ },++ mpkeyboardopen: state => {+ state.multiplayer.keyboardOpen = true;+ },++ mpkeyboardclose: state => {+ state.multiplayer.keyboardOpen = false;+ },++ mpnamekeyboardopen: state => {+ state.multiplayer.nameKeyboardOpen = true;+ state.multiplayer.nameInput = localStorage.getItem('threewsusername') || '';+ },++ mpnamekeyboardclose: state => {+ state.multiplayer.nameKeyboardOpen = false;},mpconnecting: state => {@@ -1152,6 +1178,8 @@ AFRAME.registerState({state.mpInLobbyPhase =state.mpInRoom && state.multiplayer.status === 'lobby';state.mpCountdownVisible = state.multiplayer.countdownActive;+ state.mpKeyboardOpen = state.multiplayer.keyboardOpen;+ state.mpNameKeyboardOpen = state.multiplayer.nameKeyboardOpen;state.mpRoomCodeText = state.multiplayer.roomCode? 'ROOM ' + state.multiplayer.roomCode: '';diff --git a/src/agent-avatar.js b/src/agent-avatar.jsindex 2ed6fe124..c4b222519 100644--- a/src/agent-avatar.js+++ b/src/agent-avatar.js@@ -1049,4 +1049,3 @@ export class AgentAvatar {function _lerp(a, b, t) {return a + (b - a) * Math.min(1, Math.max(0, t));}-// TODO injected for testdiff --git a/src/app.js b/src/app.jsindex 1c544eab9..27362a8e9 100644--- a/src/app.js+++ b/src/app.js@@ -1170,6 +1170,14 @@ class App {}),);}+ if (data.type === 'pumpfun-feed:set-mood') {+ document.body.dispatchEvent(+ new CustomEvent('pumpfun-feed:set-mood', {+ detail: { mood: data.mood },+ bubbles: true,+ }),+ );+ }// Host-page reaction bridge: when the parent /pumpfun.html page// observes a feed event, it can ask the avatar to emote/dance@@ -1179,6 +1187,7 @@ class App {const proto = window.VIEWER?.agent_protocol || protocol;const r = data.reaction;if (proto && r.emote) proto.emit({ type: 'emote', payload: r.emote });+ if (proto && r.lookAt) proto.emit({ type: 'look-at', payload: { target: r.lookAt } });if (proto && r.gesture) proto.emit({ type: 'gesture', payload: r.gesture });if (proto && r.speak && data.speak !== false) {proto.emit({ type: 'speak', payload: r.speak });diff --git a/src/widgets/pumpfun-feed.js b/src/widgets/pumpfun-feed.jsindex cc0ae733b..5484ee266 100644--- a/src/widgets/pumpfun-feed.js+++ b/src/widgets/pumpfun-feed.js@@ -60,7 +60,10 @@ export async function mountPumpfunFeed(viewer, config, container, ctx = {}) {const maxCards = Math.max(1, Math.min(50, config.maxCards || 8));const protocol = ctx.protocol || (typeof window !== 'undefined' ? window.VIEWER?.agent_protocol : null);let narrateOn = config.autoNarrate !== false;- const dispatcher = createReactionDispatcher();+ const dispatcher = createReactionDispatcher({+ mood: config.mood || 'normal',+ });+ const detachToast = mountReactionToast(container || document.body, dispatcher);const react = (kind, ev) => {dispatcher.dispatch(kind, ev, (reaction) => {// Even with narration off, still drive emote+gesture so the avatar@@ -134,15 +137,22 @@ export async function mountPumpfunFeed(viewer, config, container, ctx = {}) {status.textContent = 'Reconnecting…';});+ const onMood = (e) => {+ const m = e.detail?.mood;+ if (m) dispatcher.setMood(m);+ };+ (container || document.body).addEventListener('pumpfun-feed:set-mood', onMood);+return {destroy() {- try {- es.close();- } catch {}+ try { es.close(); } catch {}(container || document.body).removeEventListener('pumpfun-feed:focus-mint', onFocus);(container || document.body).removeEventListener('pumpfun-feed:set-narrate', onNarrateToggle);+ (container || document.body).removeEventListener('pumpfun-feed:set-mood', onMood);+ detachToast?.();root.remove();},+ dispatcher,};}diff --git a/tests/api/healthz.test.js b/tests/api/healthz.test.jsnew file mode 100644index 000000000..942e27723--- /dev/null+++ b/tests/api/healthz.test.js@@ -0,0 +1,47 @@+// Smoke test for /api/healthz. Stays free of any DB/RPC dependencies — this+// endpoint is the canary that uptime probes will hit, so it must stay green+// even when downstream systems are degraded.++import { describe, it, expect, vi } from 'vitest';++vi.mock('../../api/_lib/zauth.js', () => ({ instrument: () => {}, drain: async () => {} }));+vi.mock('../../api/_lib/sentry.js', () => ({ captureException: () => {} }));++import healthz from '../../api/healthz.js';++function makeReq({ method = 'GET' } = {}) { return { url: '/api/healthz', method, headers: {} }; }+function makeRes() {+ return {+ statusCode: 200,+ _h: {},+ setHeader(k, v) { this._h[k.toLowerCase()] = v; },+ getHeader(k) { return this._h[k.toLowerCase()]; },+ end(body) { this._body = body; },+ };+}++describe('GET /api/healthz', () => {+ it('returns 200 with status=ok and uptime fields', async () => {+ const res = makeRes();+ await healthz(makeReq(), res);+ expect(res.statusCode).toBe(200);+ const body = JSON.parse(res._body);+ expect(body.status).toBe('ok');+ expect(body.service).toBe('3d-agent');+ expect(typeof body.uptime).toBe('number');+ expect(typeof body.uptimeMs).toBe('number');+ expect(body.monitor.running).toBe(true);+ });++ it('rejects non-GET methods', async () => {+ const res = makeRes();+ await healthz(makeReq({ method: 'POST' }), res);+ expect(res.statusCode).toBe(405);+ });++ it('cache-control allows brief edge caching', async () => {+ const res = makeRes();+ await healthz(makeReq(), res);+ expect(res.getHeader('cache-control')).toMatch(/max-age=/);+ });+});