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
fix(autopilot): keep the agent picker on the caller's full roster when a deep link filters it
nirholasc5808633a23d
diff --git a/api/autopilot/activity.js b/api/autopilot/activity.jsindex 589b0d799..041d21bd6 100644--- a/api/autopilot/activity.js+++ b/api/autopilot/activity.js@@ -6,6 +6,8 @@// • its full explanation (rationale) and outcome (created rule / tx / briefing)// • the source memories it was grounded in (provenance), hydrated for linking// Omit agentId to aggregate across all of the caller's agents.+// `agents` is always the caller's full roster (the UI's picker source), never+// just the filtered agent; `receipts` is what agentId narrows.//// This reads the real, append-only agent_actions log — the same provenance trail// every other surface writes to. No mocks. $THREE is the only coin referenced.@@ -41,8 +43,17 @@ export default wrap(async (req, res) => {if (!parsed.ok) return error(res, 400, 'validation_error', parsed.reason);const cursor = parsed.cursor;- // Resolve the set of agents to read. A specific agent must be owned by caller;- // otherwise aggregate across all of the caller's agents.+ // `agents` is always the caller's FULL roster, independent of the agentId+ // filter: it is what the UI builds its agent picker from, so narrowing it to+ // the filtered agent would strand a deep link like+ // /autopilot-activity?agent=<id> with a one-entry picker and no way back to+ // the other agents. `agentIds` is the narrower read set for the log itself.+ const owned = await sql`+ SELECT id, name, avatar_id FROM agent_identities WHERE user_id = ${auth.userId} AND deleted_at IS NULL ORDER BY created_at+ `;+ const agents = owned.map((a) => ({ id: a.id, name: a.name, avatarId: a.avatar_id }));+ const agentById = new Map(agents.map((a) => [a.id, a]));+let agentIds;if (agentId) {const [agent] = await sql`SELECT id, user_id FROM agent_identities WHERE id = ${agentId} AND deleted_at IS NULL`;@@ -50,20 +61,14 @@ export default wrap(async (req, res) => {if (agent.user_id !== auth.userId) return error(res, 403, 'forbidden', 'not your agent');agentIds = [agentId];} else {- const owned = await sql`SELECT id FROM agent_identities WHERE user_id = ${auth.userId} AND deleted_at IS NULL`;- agentIds = owned.map((a) => a.id);+ agentIds = agents.map((a) => a.id);}// A caller with no agents yet has nothing to read: answer before touching the log.if (!agentIds.length) {- return json(res, 200, { receipts: [], next_cursor: null, agents: [], trust: null });+ return json(res, 200, { receipts: [], next_cursor: null, agents, trust: null });}- const agents = await sql`- SELECT id, name, avatar_id FROM agent_identities WHERE id = ANY(${agentIds}::uuid[])- `;- const agentById = new Map(agents.map((a) => [a.id, { id: a.id, name: a.name, avatarId: a.avatar_id }]));-const rows = cursor? await sql`SELECT * FROM agent_actions@@ -106,7 +111,7 @@ export default wrap(async (req, res) => {});const trust = agentId ? await computeTrust({ agentId }) : null;- return json(res, 200, { receipts, next_cursor: nextCursor, agents: [...agentById.values()], trust });+ return json(res, 200, { receipts, next_cursor: nextCursor, agents, trust });});// The receipt's "what happened" — payload minus the provenance fields the UIdiff --git a/pages/autopilot-activity.html b/pages/autopilot-activity.htmlindex 418e18c4a..8cf4627ae 100644--- a/pages/autopilot-activity.html+++ b/pages/autopilot-activity.html@@ -5,13 +5,13 @@<script>/* three.ws theme boot — no-flash */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" />- <title data-i18n="autopilot_activity.meta_title">Autopilot Activity — three.ws</title>- <meta name="description" content="Every autonomous action your three.ws agent took — each with the memory that motivated it, a signed receipt, and a one-tap undo. Explainable autonomy you can trust." data-i18n-attr="content:autopilot_activity.meta_description"/>+ <title data-i18n="autopilot_activity.meta_title">Autopilot Activity · three.ws</title>+ <meta name="description" content="Every autonomous action your three.ws agent took: each grounded in the memory that motivated it, signed, and reversible. Explainable autonomy you can audit." data-i18n-attr="content:autopilot_activity.meta_description"/><link rel="canonical" href="https://three.ws/autopilot-activity" /><meta property="og:type" content="website" /><meta property="og:site_name" content="three.ws" /><meta property="og:url" content="https://three.ws/autopilot-activity" />- <meta property="og:title" content="Autopilot Activity — three.ws" data-i18n-attr="content:autopilot_activity.meta_og_title"/>+ <meta property="og:title" content="Autopilot Activity · three.ws" data-i18n-attr="content:autopilot_activity.meta_og_title"/><meta property="og:description" content="Explainable autonomy: every action your agent took, with the memory that motivated it and a signed receipt." data-i18n-attr="content:autopilot_activity.meta_og_description"/><meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=Autopilot+Activity&d=Explainable+autonomy%3A+every+action+your+agent+took%2C+with+the+memory+that+motivated+it+and+a+signed+receipt.&p=%2Fautopilot-activity" /><meta property="og:image:width" content="1200" />@@ -46,6 +46,8 @@.topbar nav { display: flex; gap: 4px; margin-left: auto; }.topbar nav a { padding: 6px 10px; font-size: 14px; color: var(--text-2); border-radius: 7px; transition: color .12s, background .12s; }.topbar nav a:hover { color: var(--text); background: var(--surface-1); }+ .topbar nav a[aria-current="page"] { color: var(--text); background: var(--surface-1); }+ a:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 7px; }.wrap { max-width: 760px; margin: 0 auto; padding: 28px 24px 80px; }.hero h1 { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -0.03em; margin: 0 0 6px; }.hero p { color: var(--text-2); margin: 0 0 18px; max-width: 60ch; }@@ -79,13 +81,13 @@<main class="wrap"><section class="hero"><h1 data-i18n="autopilot_activity.autopilot_activity">Autopilot activity</h1>- <p data-i18n="autopilot_activity.every_action_your_agent_took_on_your">Every action your agent took on your behalf — each grounded in the memory that motivated it,+ <p data-i18n="autopilot_activity.every_action_your_agent_took_on_your">Every action your agent took on your behalf, each grounded in the memory that motivated it,signed, and reversible where it can be. This is autonomy you can audit.</p></section><div class="controls"><label for="agent-filter" data-i18n="autopilot_activity.agent">Agent</label>- <select id="agent-filter" aria-label="Filter by agent"><option value="" data-i18n="autopilot_activity.all_your_agents">All your agents</option></select>+ <select id="agent-filter"><option value="" data-i18n="autopilot_activity.all_your_agents">All your agents</option></select><span id="trust-slot"></span></div>diff --git a/src/autopilot-activity.js b/src/autopilot-activity.jsindex c7f8f979a..7c302cc7c 100644--- a/src/autopilot-activity.js+++ b/src/autopilot-activity.js@@ -28,7 +28,9 @@ function url() {}function renderState(html) {- $('ledger').innerHTML = html;+ const ledger = $('ledger');+ ledger.innerHTML = html;+ ledger.removeAttribute('aria-busy');$('loadmore').hidden = true;}@@ -51,12 +53,36 @@ function renderTrust(trust) {slot.innerHTML = `<span class="apm-badge ${esc(trust.level)}" title="${esc(trust.blurb)}">${esc(trust.label)} · ${esc(String(trust.stats?.executed ?? 0))} actions</span>`;}+function emptyState() {+ if (agentFilter) {+ return `<div class="state"><div class="ico">🧭</div><h2>Nothing from this agent yet</h2><p>This agent has not acted on your behalf so far. Other agents may have: switch the filter back to every agent.</p><button class="btn" id="clear-filter">Show all agents</button></div>`;+ }+ return `<div class="state"><div class="ico">🧭</div><h2>No actions yet</h2><p>When your agent acts on your behalf (sets an alert, writes a briefing, sends $THREE) every move shows up here with the memory that motivated it.</p><a class="btn" href="/dashboard">Set up autopilot →</a></div>`;+}++function selectAgent(id) {+ agentFilter = id;+ cursor = null;+ const sel = $('agent-filter');+ if (sel.value !== id) sel.value = id;+ const next = new URL(location.href);+ if (agentFilter) next.searchParams.set('agent', agentFilter); else next.searchParams.delete('agent');+ history.replaceState(null, '', next);+ load();+}+async function load({ append = false } = {}) {if (loading) return;loading = true;const ledger = $('ledger');+ const more = $('loadmore');+ // Captured per call so the label restored below is whatever the active+ // locale put there, not a hardcoded English string.+ const moreLabel = more.textContent;+ ledger.setAttribute('aria-busy', 'true');if (!append) ledger.innerHTML = '<div class="skel"></div><div class="skel"></div><div class="skel"></div>';- $('loadmore').disabled = true;+ more.disabled = true;+ if (append) more.textContent = 'Loading…';try {const r = await apiFetch(url(), { credentials: 'include', allowAnonymous: true });if (r.status === 401) {@@ -71,7 +97,8 @@ async function load({ append = false } = {}) {const receipts = j.receipts || [];if (!append && !receipts.length) {- renderState(`<div class="state"><div class="ico">🧭</div><h2>No actions yet</h2><p>When your agent acts on your behalf — sets an alert, writes a briefing, sends $THREE — every move shows up here with the memory that motivated it.</p><a class="btn" href="/dashboard">Set up autopilot →</a></div>`);+ renderState(emptyState());+ $('clear-filter')?.addEventListener('click', () => selectAgent(''));return;}@@ -80,16 +107,23 @@ async function load({ append = false } = {}) {else ledger.innerHTML = html;cursor = j.next_cursor;- $('loadmore').hidden = !cursor;+ more.hidden = !cursor;+ ledger.removeAttribute('aria-busy');wireUndo(ledger);} catch (err) {- if (!append) {+ if (append) {+ // The already-rendered page stays intact; say what failed and leave the+ // button armed so another tap retries the same cursor.+ showReceiptChip(`Couldn't load more: ${err.message}`, { icon: '⚠' });+ ledger.removeAttribute('aria-busy');+ } else {renderState(`<div class="state"><div class="ico">⚠️</div><h2>Couldn't load activity</h2><p>${esc(err.message)}</p><button class="btn" id="retry">Retry</button></div>`);$('retry')?.addEventListener('click', () => load());}} finally {loading = false;- $('loadmore').disabled = false;+ more.disabled = false;+ more.textContent = moreLabel;}}@@ -133,14 +167,7 @@ function resolveAgentForUndo(btn) {return agentFilter;}-$('agent-filter').addEventListener('change', (e) => {- agentFilter = e.target.value;- cursor = null;- const next = new URL(location.href);- if (agentFilter) next.searchParams.set('agent', agentFilter); else next.searchParams.delete('agent');- history.replaceState(null, '', next);- load();-});+$('agent-filter').addEventListener('change', (e) => selectAgent(e.target.value));$('loadmore').addEventListener('click', () => load({ append: true }));diff --git a/src/autopilot-mind.js b/src/autopilot-mind.jsindex e48896271..b4376b0d4 100644--- a/src/autopilot-mind.js+++ b/src/autopilot-mind.js@@ -43,10 +43,15 @@ function injectStyles() {if (_stylesInjected || typeof document === 'undefined') return;_stylesInjected = true;const css = `- .apm { --apm-line: var(--hairline, #1c1c1c); --apm-s1: var(--surface-1, #111); --apm-s2: var(--surface-2, #181818);+ /* Tokens live on :root, not only on .apm, because the pieces this module+ exports are mounted outside an .apm container too: receiptRow() renders+ into the /autopilot-activity ledger and the chip toast is appended to+ <body>. Scoped to .apm alone, every var() below resolved to nothing there+ and the borders, backgrounds and accents silently vanished. */+ :root, .apm { --apm-line: var(--hairline, #1c1c1c); --apm-s1: var(--surface-1, #111); --apm-s2: var(--surface-2, #181818);--apm-txt: var(--text, #f6f6f6); --apm-t2: var(--text-2, #a8a8a8); --apm-t3: var(--text-3, #6a6a6a);- --apm-accent: var(--mint, #78c88c); --apm-red: var(--red, #ef4444); --apm-amber: var(--amber, #f59e0b);- display: flex; flex-direction: column; gap: 1.25rem; }+ --apm-accent: var(--mint, #78c88c); --apm-red: var(--red, #ef4444); --apm-amber: var(--amber, #f59e0b); }+ .apm { display: flex; flex-direction: column; gap: 1.25rem; }.apm-card { border: 1px solid var(--apm-line); border-radius: 12px; background: var(--apm-s1); padding: 1.1rem 1.15rem; }.apm-h { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }.apm-h h3 { margin: 0; font-size: 0.95rem; letter-spacing: -0.01em; }@@ -96,6 +101,7 @@ function injectStyles() {.apm-source { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; padding: 0.22rem 0.5rem; border-radius: 99px;background: var(--apm-s2); border: 1px solid var(--apm-line); font-size: 0.72rem; color: var(--apm-t2); text-decoration: none; }.apm-source:hover { border-color: var(--apm-accent); color: var(--apm-txt); }+ .apm-source:focus-visible { outline: 2px solid var(--apm-accent); outline-offset: 2px; }.apm-source .apm-source-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }.apm-source.forgotten { opacity: 0.5; }.apm-prop-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }@@ -586,6 +592,9 @@ export function mountAutopilotMind(container, { agentId }) {// ── Shared receipt row (used by the tab + the standalone Activity page) ───────export function receiptRow(rc, agentId, { undo = false, showAgent = false } = {}) {+ // Surfaces that reuse the row without mounting the full panel (the+ // /autopilot-activity ledger) get the stylesheet from here.+ injectStyles();const km = KIND_META[rc.kind] || { icon: '•', label: rc.kind };const result = rc.result || {};let line = '';