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 alpha co-pilot interface with agent gallery and improved loading states
udvkf17d47a59111
diff --git a/pages/alpha-copilot.html b/pages/alpha-copilot.htmlindex 0fdb2256d..c43d6bcb2 100644--- a/pages/alpha-copilot.html+++ b/pages/alpha-copilot.html@@ -56,14 +56,25 @@Pick an agent. It reads a <strong>real</strong> live launch in character — citing the liveliquidity, holder, and smart-money signals it actually saw — and speaks its verdict aloudthrough its 3D avatar. If you own it, you can act on the call within- <strong>hard, server-enforced spend limits</strong>. The persona advises; the limits govern; you consent.+ <strong>hard, server-enforced spend limits</strong>.</p>- <div class="ac-agentpick">- <label class="ac-field" for="ac-agent-input">- <span>Agent</span>- <input type="text" id="ac-agent-input" placeholder="agent id or paste a profile URL" autocomplete="off" spellcheck="false" />- </label>- <button type="button" class="ac-btn" id="ac-agent-load">Load agent</button>+ <ul class="ac-hero-rail" aria-hidden="true">+ <li><span class="ac-hero-dot"></span> Reads live mints in character</li>+ <li><span class="ac-hero-dot"></span> Speaks its verdict aloud</li>+ <li><span class="ac-hero-dot"></span> Acts within hard spend limits</li>+ </ul>+ </section>++ <!-- Agent picker: a real gallery of public agents, not a bare UUID box -->+ <section class="ac-pick" aria-label="Choose an agent">+ <div class="ac-pick-head">+ <h2 class="ac-pick-title">Choose your co-pilot</h2>+ <button type="button" class="ac-pick-idtoggle" id="ac-id-toggle" aria-expanded="false">Use an agent ID</button>+ </div>+ <div class="ac-pick-rail" id="ac-agent-gallery" role="listbox" aria-label="Public agents" aria-live="polite"></div>+ <div class="ac-pick-id" id="ac-id-row" hidden>+ <input type="text" id="ac-agent-input" class="ac-id-input" placeholder="agent id or paste a profile URL" autocomplete="off" spellcheck="false" aria-label="Agent ID or profile URL" />+ <button type="button" class="ac-btn" id="ac-agent-load">Load</button></div></section>@@ -71,14 +82,23 @@<!-- The narrator: avatar + spoken verdict --><section class="ac-stage" aria-label="Agent narrator"><div class="ac-stage-avatar" id="ac-avatar-host">- <div class="ac-stage-placeholder" id="ac-avatar-placeholder">Load an agent to begin.</div>+ <div class="ac-stage-placeholder" id="ac-avatar-placeholder">+ <span class="ac-stage-orb" aria-hidden="true"></span>+ <span>Pick a co-pilot above to bring it on stage.</span>+ </div>+ <div class="ac-eq" id="ac-eq" aria-hidden="true"><span></span><span></span><span></span><span></span><span></span></div></div><div class="ac-stage-meta">- <div class="ac-stage-name" id="ac-agent-name">—</div>- <div class="ac-stage-role" id="ac-agent-role">Alpha co-pilot</div>+ <div class="ac-stage-id">+ <div class="ac-stage-name" id="ac-agent-name">No agent</div>+ <div class="ac-stage-role" id="ac-agent-role">Pick an agent to hear its read</div>+ </div>+ <a class="ac-stage-link" id="ac-agent-link" href="#" target="_blank" rel="noopener" hidden title="Open agent profile">Profile ↗</a></div><div class="ac-speak" id="ac-speak" aria-live="polite" hidden>- <button type="button" class="ac-speak-btn" id="ac-replay" title="Replay aloud" aria-label="Replay aloud">▶</button>+ <button type="button" class="ac-speak-btn" id="ac-replay" title="Replay aloud" aria-label="Replay aloud">+ <svg viewBox="0 0 24 24" width="13" height="13" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>+ </button><p class="ac-speak-line" id="ac-speak-line"></p></div></section>@@ -86,7 +106,11 @@<!-- The verdict --><section class="ac-read" aria-label="The read" id="ac-read-panel"><div class="ac-read-empty" id="ac-read-empty">- <p>Choose a live launch and ask your agent for a read. Its verdict, conviction, and the exact signals it used will appear here.</p>+ <div class="ac-read-empty-mark" aria-hidden="true">+ <svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h4l3 8 4-16 3 8h4"/></svg>+ </div>+ <p class="ac-read-empty-title">No read yet</p>+ <p>Pick a live launch on the right and ask your agent for a read. Its verdict, conviction, and the exact on-chain signals it used land here.</p></div><div class="ac-read-body" id="ac-read-body" hidden></div></section>@@ -94,8 +118,11 @@<!-- Live launches --><section class="ac-launches" aria-label="Live launches"><header class="ac-launches-head">- <h2><span class="ac-live-dot" aria-hidden="true"></span> Live launches</h2>- <button type="button" class="ac-btn ac-btn-ghost" id="ac-refresh" title="Refresh feed">Refresh</button>+ <h2><span class="ac-live-dot" aria-hidden="true"></span> Live launches <span class="ac-launches-count" id="ac-launches-count" hidden></span></h2>+ <button type="button" class="ac-btn ac-btn-ghost ac-refresh" id="ac-refresh" title="Refresh feed" aria-label="Refresh feed">+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-3-6.7L21 8"/><path d="M21 3v5h-5"/></svg>+ <span>Refresh</span>+ </button></header><div class="ac-launches-list" id="ac-launches-list" aria-live="polite"></div></section>diff --git a/public/gallery/gallery.js b/public/gallery/gallery.jsindex 7ebab4bdd..76525a8c9 100644--- a/public/gallery/gallery.js+++ b/public/gallery/gallery.js@@ -321,6 +321,7 @@ async function loadPage() {}function updateStats() {+ if (!els.statCount) return;els.statCount.textContent =state.total != null ? state.total.toLocaleString() : state.totalLoaded.toLocaleString();}diff --git a/public/gallery/index.html b/public/gallery/index.htmlindex 8aadd367c..7854aa20f 100644--- a/public/gallery/index.html+++ b/public/gallery/index.html@@ -73,13 +73,6 @@the viewer, then embed it anywhere or remix into a new agent.</p>- <div class="gallery-stats">- <div class="gallery-stat">- <div class="gallery-stat-value" data-role="stat-count">—</div>- <div class="gallery-stat-label">Avatars</div>- </div>- </div>-<div class="gallery-hero-ctas"><a class="gallery-hero-btn gallery-hero-btn--primary" href="/create/prompt">Create from a prompt</a><button type="button" class="gallery-hero-btn" data-create-from-template>Create from template</button>diff --git a/src/alpha-copilot.js b/src/alpha-copilot.jsindex 69b1cb0d3..f983830b6 100644--- a/src/alpha-copilot.js+++ b/src/alpha-copilot.js@@ -53,7 +53,9 @@ const state = {agent: null, // full GET /api/agents/:id objectavatarEl: null, // <agent-3d>candidates: [],+ gallery: [], // public agent directory (the picker)read: null, // last /alpha/read response+ activeMint: null, // mint currently being / last readlastSpoken: '',speaking: false,loadingRead: false,@@ -62,23 +64,81 @@ const state = {// ── DOM refs ────────────────────────────────────────────────────────────────const dom = {};function cacheDom() {+ dom.gallery = $('#ac-agent-gallery');+ dom.idToggle = $('#ac-id-toggle');+ dom.idRow = $('#ac-id-row');dom.agentInput = $('#ac-agent-input');dom.agentLoad = $('#ac-agent-load');dom.avatarHost = $('#ac-avatar-host');dom.avatarPlaceholder = $('#ac-avatar-placeholder');+ dom.eq = $('#ac-eq');dom.agentName = $('#ac-agent-name');dom.agentRole = $('#ac-agent-role');+ dom.agentLink = $('#ac-agent-link');dom.speak = $('#ac-speak');dom.speakLine = $('#ac-speak-line');dom.replay = $('#ac-replay');dom.readEmpty = $('#ac-read-empty');dom.readBody = $('#ac-read-body');dom.launchesList = $('#ac-launches-list');+ dom.launchesCount = $('#ac-launches-count');dom.refresh = $('#ac-refresh');dom.actDrawer = $('#ac-act-drawer');dom.actBody = $('#ac-act-body');}+// ── agent gallery (the picker) ───────────────────────────────────────────────+function initials(name) {+ return String(name || '?').trim().split(/\s+/).slice(0, 2).map((w) => w[0] || '').join('').toUpperCase() || '?';+}++async function loadGallery() {+ dom.gallery.innerHTML = Array.from({ length: 6 }, () => `<div class="ac-agent-card ac-skel"><div class="ac-skel-orb"></div><div class="ac-skel-line w80"></div><div class="ac-skel-line w60"></div></div>`).join('');+ let agents = [];+ try {+ const r = await fetch('/api/agents/public?sort=popular&limit=12', { credentials: 'include' });+ const j = await r.json().catch(() => ({}));+ agents = Array.isArray(j.agents) ? j.agents : [];+ } catch { /* fall through to error state */ }+ state.gallery = agents;+ if (!agents.length) {+ dom.gallery.innerHTML = `<div class="ac-gallery-empty">No public agents to feature right now. Paste an agent ID instead.</div>`;+ revealIdRow(true);+ return;+ }+ dom.gallery.innerHTML = '';+ for (const a of agents) dom.gallery.appendChild(agentCard(a));+}++function agentCard(a) {+ const node = document.createElement('button');+ node.type = 'button';+ node.className = 'ac-agent-card';+ node.setAttribute('role', 'option');+ node.dataset.id = a.id;+ const skill = (a.skills && a.skills[0]) ? a.skills[0].replace(/[-_]/g, ' ') : null;+ const meta = a.onchain ? `${esc(a.onchain.network || 'on-chain')}` : (a.chat_count ? `${a.chat_count.toLocaleString()} chats` : (skill ? esc(skill) : 'agent'));+ node.innerHTML = `+ <span class="ac-agent-av">${a.avatar_thumbnail ? `<img src="${esc(a.avatar_thumbnail)}" alt="" loading="lazy" />` : `<span class="ac-agent-initials">${esc(initials(a.name))}</span>`}</span>+ <span class="ac-agent-info">+ <span class="ac-agent-name">${esc(a.name || 'Agent')}</span>+ <span class="ac-agent-meta">${meta}</span>+ </span>`;+ node.addEventListener('click', () => loadAgent(a.id));+ return node;+}++function markActiveCard(id) {+ dom.gallery.querySelectorAll('.ac-agent-card').forEach((c) => c.classList.toggle('is-active', c.dataset.id === id));+}++function revealIdRow(open) {+ dom.idRow.hidden = !open;+ dom.idToggle.setAttribute('aria-expanded', String(open));+ dom.idToggle.textContent = open ? 'Hide ID entry' : 'Use an agent ID';+ if (open) dom.agentInput.focus();+}+// ── agent loading ───────────────────────────────────────────────────────────function parseAgentId(raw) {if (!raw) return null;@@ -87,8 +147,11 @@ function parseAgentId(raw) {}async function loadAgent(id) {+ if (!id) return;+ markActiveCard(id);dom.agentName.textContent = 'Loading…';- dom.agentRole.textContent = 'Alpha co-pilot';+ dom.agentRole.textContent = 'Bringing it on stage';+ dom.agentLink.hidden = true;let agent;try {const r = await fetch(`/api/agents/${encodeURIComponent(id)}`, { credentials: 'include' });@@ -105,6 +168,8 @@ async function loadAgent(id) {try { localStorage.setItem(LS_KEY, agent.id); } catch { /* ignore */ }dom.agentName.textContent = agent.name || 'Agent';dom.agentRole.textContent = agent.is_owner ? 'Your alpha co-pilot' : 'Alpha co-pilot · public read';+ dom.agentLink.href = agent.home_url || `/agent/${agent.id}`;+ dom.agentLink.hidden = false;mountAvatar(agent);resetRead();loadCandidates();@@ -122,6 +187,9 @@ async function mountAvatar(agent) {el.setAttribute('height', '100%');el.setAttribute('autorotate', '');el.className = 'ac-avatar';+ // The element renders behind opacity:0 until it boots — reveal on ready so the+ // stage fades the body in instead of popping a half-loaded mesh.+ el.addEventListener('agent:ready', () => el.classList.add('ready'), { once: true });dom.avatarHost.appendChild(el);state.avatarEl = el;}