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(agora): fetch citizens in parallel with the map, give the HUD title the page h1, unstack mobile chips
nirholas8c9ebf8790e7
diff --git a/pages/agora.html b/pages/agora.htmlindex 118d73b88..a34866ed3 100644--- a/pages/agora.html+++ b/pages/agora.html@@ -54,11 +54,14 @@<canvas id="agora-canvas" tabindex="0" aria-label="The Commons — a 3D world of citizens. Use the citizen list to inspect individuals."></canvas><div id="agora-hud" style="display:none">- <div id="agora-hud-tl">+ <!-- The page's one h1. The Commons is a full-bleed canvas, so the title+ chip carries the document heading rather than duplicating it in a+ hidden node that could drift from what the HUD shows. -->+ <h1 id="agora-hud-tl"><img src="/three.svg" alt="" width="22" height="22" /><span data-i18n="agora.agora">AGORA</span><span id="agora-hud-sub" data-i18n="agora.the_commons">the Commons</span>- </div>+ </h1><div id="agora-pop"><span id="agora-count" aria-live="polite">0</span>diff --git a/src/agora/agora-world.js b/src/agora/agora-world.jsindex 92b75b2bb..49387a7d9 100644--- a/src/agora/agora-world.js+++ b/src/agora/agora-world.js@@ -64,6 +64,20 @@ function citizenPosition(citizen, i) {return layoutPosition(i);}+const CITIZENS_URL = '/api/agora/citizens?limit=200';++// The citizens and the buildings are independent fetches, but the population one+// used to start only after the OSM ladder settled. When Overpass is slow that+// serialized two waits: a measured production boot spent 40s on the map before+// the first citizen request even left the browser. Start it here, in parallel+// with the map, and hold the settled result for loadCitizens. Reveal ordering is+// unchanged (the world still opens after the square is built), so this is pure+// latency the visitor no longer waits through. The promise settles into a plain+// object rather than rejecting, so a failure sits here harmlessly until+// loadCitizens is ready to render its error state.+let citizensPrefetch = fetch(CITIZENS_URL, { headers: { accept: 'application/json' } })+ .then((res) => ({ res }), (err) => ({ err }));+async function main() {progress(6, 'Setting up renderer…');const { renderer, scene, camera } = createCityScene(canvas);@@ -213,7 +227,18 @@ async function main() {loadInFlight = true;hideState();try {- const res = await fetch('/api/agora/citizens?limit=200', { headers: { accept: 'application/json' } });+ // First pass consumes the boot prefetch above; every later pass (retry,+ // live join) is a fresh request. A Response body reads once, so the+ // prefetch is cleared as it is taken.+ let res;+ if (citizensPrefetch) {+ const settled = await citizensPrefetch;+ citizensPrefetch = null;+ if (settled.err) throw settled.err;+ res = settled.res;+ } else {+ res = await fetch(CITIZENS_URL, { headers: { accept: 'application/json' } });+ }if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();const citizens = Array.isArray(data.citizens) ? data.citizens : [];diff --git a/src/agora/agora.css b/src/agora/agora.cssindex c6087c3ea..87f6d68ea 100644--- a/src/agora/agora.css+++ b/src/agora/agora.css@@ -409,6 +409,12 @@ html, body {.agora-passport.open { transform: none; }#agora-controls-hint { display: none; }.agora-state-card { padding: 28px 22px; }+ /* The bottom-left population chip (146px) and the bottom-centre CTA (169px)+ collide below ~500px viewport width: at 320px they overlap by 86px. The+ hint is already hidden at this breakpoint, so the top-left column is free.+ Stack the chip under the title there and leave the whole bottom edge to the+ CTA and play mode's touch stick. */+ #agora-pop { top: 48px; bottom: auto; }}@media (max-width: 380px) {