Skip to content

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.

Restore independent fixes preserved through the rollback

udvk056bed711d04
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96d8cbd85..8e95c52cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-25
- **Production error sweep: tier page, image understanding, and on-chain indexing** — We pulled a full day of production logs and fixed what was actually failing. The $THREE tier page sometimes flashed a blank screen on a fast or cached load — a startup step ran a moment before it was ready; it now loads reliably every time. Image understanding (the vision service behind Forge upload checks, the fact checker, and gallery alt text) could hang until the request was force-killed with no answer; it now works through its models within a fixed time budget and always returns either a result or a clear error. Behind the scenes, delegation indexing and agent-reputation reads were leaning on public Ethereum RPC nodes that have since gone behind bot-walls or started refusing datacenter traffic, which meant on-chain permissions and ERC-8004 reputation kept failing to resolve; we replaced the entire fallback set with providers verified to answer reliably. We also fixed a crash in the guided feature tour when it launched before a page finished loading, and the fullscreen button in the scene editor on Safari and in-app browsers. No action needed. `[fix, infra]`
+- **Stability sweep: live page, dashboards, and the galaxy feed never hard-fail** — A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed. `[fix, improvement]`
## 2026-06-24
diff --git a/pages/home.html b/pages/home.html
index fa01a3ea2..9d20fb923 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -4975,14 +4975,36 @@
for (const [k, v] of Object.entries(AGENT_ATTRS)) el.setAttribute(k, v);
return el;
}
+ async function fetchAvatarGlb(id) {
+ const r = await fetch(`${location.origin}/api/avatars/${id}`);
+ if (!r.ok) throw new Error('HTTP ' + r.status);
+ const d = await r.json();
+ const glb = devProxyGlb(d.avatar?.model_url || d.avatar?.url);
+ if (!glb) throw new Error('no model url');
+ return glb;
+ }
+ // The curated hero avatar can disappear (deleted, or a fresh deploy whose
+ // DB row hasn't been seeded yet) — fall back to a real featured avatar so
+ // the stage is never just an error card.
+ async function resolveFeaturedGlb() {
+ const r = await fetch(`${location.origin}/api/avatars/featured?limit=12`);
+ if (!r.ok) throw new Error('HTTP ' + r.status);
+ const d = await r.json();
+ const list = Array.isArray(d.avatars) ? d.avatars : [];
+ for (const a of list) {
+ try { return await fetchAvatarGlb(a.id); } catch (_) { /* try next */ }
+ }
+ throw new Error('no featured avatar with a model');
+ }
async function bootHeroAvatar() {
const heroInner = document.getElementById('hero-stage-inner');
try {
- const r = await fetch(`${location.origin}/api/avatars/${AVATAR_ID}`);
- if (!r.ok) throw new Error('HTTP ' + r.status);
- const d = await r.json();
- const glb = devProxyGlb(d.avatar?.model_url || d.avatar?.url);
- if (!glb) throw new Error('no model url');
+ let glb;
+ try {
+ glb = await fetchAvatarGlb(AVATAR_ID);
+ } catch (_) {
+ glb = await resolveFeaturedGlb();
+ }
if (heroInner) {
heroInner.innerHTML = '';
const heroEl = spawnAgent(glb);
diff --git a/pages/pump-dashboard.html b/pages/pump-dashboard.html
index 9f7b0b616..14c413fd2 100644
--- a/pages/pump-dashboard.html
+++ b/pages/pump-dashboard.html
@@ -1764,6 +1764,61 @@
} from '/src/wallet.js';
import { emptyStateHTML } from '/src/shared/state-kit.js';
+ // Some embedded webviews — notably the in-app browsers X/Twitter
+ // and a few Android wrappers ship — expose `window.localStorage`
+ // as `null`, or throw on access in private mode. Reading it
+ // directly during module init crashed the whole page. Route every
+ // storage call through this shim: it probes the real store once,
+ // and silently degrades to an in-memory map when it's unavailable
+ // so the dashboard still loads (config just won't persist).
+ const safeStorage = (() => {
+ let store = null;
+ try {
+ store = window.localStorage;
+ const probe = '__twx_probe__';
+ store.setItem(probe, '1');
+ store.removeItem(probe);
+ } catch {
+ store = null;
+ }
+ const mem = new Map();
+ return {
+ getItem(key) {
+ if (store) {
+ try {
+ return store.getItem(key);
+ } catch {
+ /* fall through to in-memory */
+ }
+ }
+ return mem.has(key) ? mem.get(key) : null;
+ },
+ setItem(key, value) {
+ const v = String(value);
+ if (store) {
+ try {
+ store.setItem(key, v);
+ return;
+ } catch {
+ /* fall through to in-memory */
+ }
+ }
+ mem.set(key, v);
+ },
+ removeItem(key) {
+ if (store) {
+ try {
+ store.removeItem(key);
+ return;
+ } catch {
+ /* fall through to in-memory */
+ }
+ }
+ mem.delete(key);
+ },
+ };
+ })();
+
const PAGE_TITLES = {
dashboard: 'Dashboard',
feed: 'Live Feed',
@@ -1780,16 +1835,16 @@
};
const state = {
- apiUrl: localStorage.getItem('pumpbot-api-url') || location.origin,
- wsUrl: localStorage.getItem('pumpbot-ws-url') || 'wss://pumpportal.fun/api/data',
- apiKey: localStorage.getItem('pumpbot-api-key') || '',
+ apiUrl: safeStorage.getItem('pumpbot-api-url') || location.origin,
+ wsUrl: safeStorage.getItem('pumpbot-ws-url') || 'wss://pumpportal.fun/api/data',
+ apiKey: safeStorage.getItem('pumpbot-api-key') || '',
// Default to the same-origin proxy (/api/solana-rpc), which forwards
// to a keyed Helius upstream server-side. The public RPC 403s
// browser requests, so we also migrate anyone whose stored value is
// that old broken default onto the proxy; genuine custom RPCs are
// preserved untouched.
rpcUrl: (() => {
- const stored = localStorage.getItem('pumpbot-rpc-url');
+ const stored = safeStorage.getItem('pumpbot-rpc-url');
return stored && stored !== 'https://api.mainnet-beta.solana.com'
? stored
: '/api/solana-rpc';
@@ -1802,7 +1857,7 @@
activityCount: 0,
feedPaused: false,
alertRules: (() => {
- const v = safeParseJson(localStorage.getItem('pumpbot-alerts') || '[]', []);
+ const v = safeParseJson(safeStorage.getItem('pumpbot-alerts') || '[]', []);
return Array.isArray(v) ? v : [];
})(),
// Deep-link target: /pump-dashboard?agent=<id> (e.g. straight from the
@@ -3039,7 +3094,7 @@
}
const { rules } = await resp.json();
state.alertRules = Array.isArray(rules) ? rules : [];
- localStorage.setItem('pumpbot-alerts', JSON.stringify(state.alertRules));
+ safeStorage.setItem('pumpbot-alerts', JSON.stringify(state.alertRules));
setRuleFormSignedOut(false);
renderRulesList(state.alertRules);
populateAgentOptions();
@@ -4156,10 +4211,10 @@
state.wsUrl = $('pd-cfg-ws-url').value.trim() || 'wss://pumpportal.fun/api/data';
state.apiKey = $('pd-cfg-api-key').value.trim();
state.rpcUrl = $('pd-cfg-rpc-url').value.trim() || '/api/solana-rpc';
- localStorage.setItem('pumpbot-api-url', state.apiUrl);
- localStorage.setItem('pumpbot-ws-url', state.wsUrl);
- localStorage.setItem('pumpbot-api-key', state.apiKey);
- localStorage.setItem('pumpbot-rpc-url', state.rpcUrl);
+ safeStorage.setItem('pumpbot-api-url', state.apiUrl);
+ safeStorage.setItem('pumpbot-ws-url', state.wsUrl);
+ safeStorage.setItem('pumpbot-api-key', state.apiKey);
+ safeStorage.setItem('pumpbot-rpc-url', state.rpcUrl);
$('pd-api-endpoint-display').textContent = state.apiUrl;
connectApi();
// A manual save is an explicit retry — reset the backoff so the new
diff --git a/public/changelog.json b/public/changelog.json
index 0054e5f4b..ab3468568 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-25T08:09:10.560Z",
+ "generated_at": "2026-06-25T21:43:39.482Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -27,6 +27,17 @@
"infra"
]
},
+ {
+ "date": "2026-06-25",
+ "type": "update",
+ "title": "Stability sweep: live page, dashboards, and the galaxy feed never hard-fail",
+ "summary": "A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-24",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index 0b1d890b9..d2e22ebe7 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -22,6 +22,14 @@
<category>fix</category>
<description>We pulled a full day of production logs and fixed what was actually failing. The $THREE tier page sometimes flashed a blank screen on a fast or cached load — a startup step ran a moment before it was ready; it now loads reliably every time. Image understanding (the vision service behind Forge upload checks, the fact checker, and gallery alt text) could hang until the request was force-killed with no answer; it now works through its models within a fixed time budget and always returns either a result or a clear error. Behind the scenes, delegation indexing and agent-reputation reads were leaning on public Ethereum RPC nodes that have since gone behind bot-walls or started refusing datacenter traffic, which meant on-chain permissions and ERC-8004 reputation kept failing to resolve; we replaced the entire fallback set with providers verified to answer reliably. We also fixed a crash in the guided feature tour when it launched before a page finished loading, and the fullscreen button in the scene editor on Safari and in-app browsers. No action needed.</description>
</item>
+ <item>
+ <title>Stability sweep: live page, dashboards, and the galaxy feed never hard-fail</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-25:Stability sweep: live page, dashboards, and the galaxy feed never hard-fail</guid>
+ <pubDate>Thu, 25 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed.</description>
+ </item>
<item>
<title>Agora — the Commons</title>
<link>https://three.ws/agora</link>
diff --git a/public/features.json b/public/features.json
index d16fc21cc..5dc237310 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-25T08:09:09.821Z",
+ "generated_at": "2026-06-25T21:43:39.466Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/agora/agora-world.js b/src/agora/agora-world.js
index 2a7969758..3c1ce575c 100644
--- a/src/agora/agora-world.js
+++ b/src/agora/agora-world.js
@@ -156,8 +156,15 @@ async function main() {
return population.pick(raycaster);
}
- // ── Fetch + populate (re-runnable for the error-state retry) ───────────────
+ // ── Fetch + populate (re-runnable for the error-state retry + live joins) ──
+ // Guarded against overlap: population.add has an async gap between its dedupe
+ // check and insert, so two concurrent runs could double-place a citizen. A run
+ // requested while one is in flight is coalesced into a single follow-up pass.
+ let loadInFlight = false;
+ let loadAgain = false;
async function loadCitizens() {
+ if (loadInFlight) { loadAgain = true; return; }
+ loadInFlight = true;
hideState();
try {
const res = await fetch('/api/agora/citizens?limit=200', { headers: { accept: 'application/json' } });
@@ -188,6 +195,9 @@ async function main() {
log.warn('[agora] citizens fetch failed', err?.message);
revealWorld();
showErrorState(err?.message || 'The registry could not be reached.');
+ } finally {
+ loadInFlight = false;
+ if (loadAgain) { loadAgain = false; loadCitizens(); }
}
}
@@ -268,6 +278,22 @@ async function main() {
loadCitizens();
progress(100, 'Entering the Commons…');
+ // When a human joins or posts (me-hud emits this after a successful act), the
+ // agora_citizens projection changed — re-fetch so their freshly-placed avatar
+ // streams into the square live, no reload. population.add is idempotent by
+ // citizen id, so this only adds the newcomer; it never duplicates the crowd.
+ // Debounced to coalesce the join + first-action burst into one fetch.
+ let citizensRefresh = null;
+ function onCitizensChanged() {
+ clearTimeout(citizensRefresh);
+ citizensRefresh = setTimeout(() => { loadCitizens(); }, 400);
+ }
+ window.addEventListener('agora:citizens-changed', onCitizensChanged);
+ window.addEventListener('pagehide', () => {
+ clearTimeout(citizensRefresh);
+ window.removeEventListener('agora:citizens-changed', onCitizensChanged);
+ }, { once: true });
+
// ── Economy layer (Task 06) ────────────────────────────────────────────────
// The job board, live ticker, and the completion moment (coin flow + rep tick
// + orbit-able plinth), all driven by a single deduped pulse poll. It's handed
diff --git a/tests/agora-task-supply.test.js b/tests/agora-task-supply.test.js
index 65f6962c1..8f3cc1317 100644
--- a/tests/agora-task-supply.test.js
+++ b/tests/agora-task-supply.test.js
@@ -185,7 +185,10 @@ describe('roster assembly', () => {
const specs = buildRoster([], { maxCitizens: 4 });
expect(specs.length).toBe(4);
expect(specs.every((s) => s.kind === 'agent')).toBe(true);
- expect(specs.every((s) => s.professionBits === 1n)).toBe(true); // all Fetchers in Task 02
+ // Each standalone citizen works a specialty (Task 04) but ALWAYS carries the
+ // Fetcher bit, so it satisfies the devnet dispatcher's task gate and never
+ // idles for lack of work.
+ expect(specs.every((s) => capabilitiesSatisfy(s.professionBits, 1n))).toBe(true);
});
it('respects the citizen cap', () => {
diff --git a/tests/agora-work-proof.test.js b/tests/agora-work-proof.test.js
index 3a3c09dd7..dfe66822f 100644
--- a/tests/agora-work-proof.test.js
+++ b/tests/agora-work-proof.test.js
@@ -40,12 +40,15 @@ describe('proof helpers', () => {
expect(a.equals(b)).toBe(true);
});
- it('packResultData is exactly 64 bytes and truncates', () => {
- const rd = packResultData('agora:sculptor:cid:sha256:' + 'f'.repeat(40));
+ it('packResultData zero-pads to exactly 64 bytes and rejects overflow', () => {
+ // The real builder emits "agora:<profession>:cid:sha256:<32-hex>" (≤64 B).
+ const rd = packResultData('agora:sculptor:cid:sha256:' + 'f'.repeat(32));
expect(rd).toBeInstanceOf(Uint8Array);
expect(rd.length).toBe(64);
- const huge = packResultData('x'.repeat(200));
- expect(huge.length).toBe(64);
+ // The on-chain slot is exactly [u8;64]; silently truncating a content-
+ // addressed pointer would corrupt the reference, so an oversized pointer
+ // must be rejected, never quietly clipped.
+ expect(() => packResultData('x'.repeat(200))).toThrow(/exceeds 64 bytes/);
});
it('proofBytesFromHex round-trips to 32 bytes', () => {
diff --git a/vite.config.js b/vite.config.js
index c2222fbf5..b9430087e 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1689,20 +1689,26 @@ support: resolve(__dirname, 'pages/support.html'),
.split('/')
.pop();
if (EMBED_FILES.has(filename)) return [];
+ // Inline the dependency-free source directly as a classic
+ // (non-module) script. Two failure modes this avoids:
+ // 1. A `type=module` inline script gets externalized by Vite
+ // into a `?html-proxy` request that 404s to the SPA HTML
+ // fallback for repo-root dir-index pages (e.g. /docs).
+ // 2. A dynamic `import('/src/view-transitions.js')` is rewritten
+ // by the prod build into `import('data:text/javascript;…')`,
+ // which the site CSP (no `data:` in script-src) blocks — the
+ // transition wiring then silently never runs.
+ // Inlining the actual source sidesteps both: it runs under the
+ // existing `'unsafe-inline'` allowance with no extra fetch. The
+ // file stays the single source of truth (dev imports it directly).
+ const vtSource = readFileSync(
+ resolve(__dirname, 'src/view-transitions.js'),
+ 'utf8',
+ ).replace(/^export\s+function/m, 'function');
return [
{
tag: 'script',
- // Classic (non-module) inline script on purpose: a `type=module`
- // inline script gets externalized by Vite into a `?html-proxy`
- // request that fails to resolve for repo-root dir-index pages
- // (e.g. /docs → docs/index.html), where the proxy URL falls
- // through to the SPA HTML fallback and the browser throws
- // "Failed to load module script … MIME type text/html". A classic
- // script keeps the dynamic import inline; /src/view-transitions.js
- // is dependency-free browser ESM that Vite serves directly in dev
- // and the copy-src-to-dist plugin mirrors into dist/ for prod, so
- // it resolves in both — no html-proxy needed.
- children: `import('/src/view-transitions.js').then(m=>m.enableViewTransitions()).catch(()=>{});`,
+ children: `(function(){${vtSource}\ntry{enableViewTransitions();}catch(e){}})();`,
injectTo: 'head',
},
];
diff --git a/workers/agora-citizens/work/_skills.js b/workers/agora-citizens/work/_skills.js
index 3e78b327a..733ba7c24 100644
--- a/workers/agora-citizens/work/_skills.js
+++ b/workers/agora-citizens/work/_skills.js
@@ -47,17 +47,19 @@ export function proofBytesFromHex(hex) {
}
// A compact, deterministic 64-byte on-chain resultData pointer — a CID-style
-// sha256 reference to the artifact. The on-chain slot is exactly [u8;64]; a
-// pointer that overflows would be SILENTLY truncated by the copy and corrupt the
-// reference, so we assert the byte length instead of letting it slip through.
+// sha256 reference to the artifact. The on-chain slot is exactly [u8;64], so the
+// pointer is zero-padded into a fixed 64-byte buffer. A content-addressed pointer
+// is meaningless if clipped — a truncated `cid:sha256:<hex>` resolves to the wrong
+// bytes (or nothing) — so an over-long pointer is REJECTED, never quietly clipped.
+// Producer pointers (`agora:<profession>:cid:sha256:<32hex>`) top out at 62 bytes,
+// so the guard is a correctness backstop the real path never trips.
export function packResultData(pointer) {
- const s = String(pointer);
- const len = Buffer.byteLength(s, 'utf8');
- if (len > 64) {
- throw new Error(`resultData pointer exceeds 64 bytes (${len}): ${s}`);
+ const src = Buffer.from(String(pointer), 'utf8');
+ if (src.length > 64) {
+ throw new Error(`resultData pointer exceeds 64 bytes (${src.length}): ${String(pointer).slice(0, 48)}…`);
}
const buf = Buffer.alloc(64);
- Buffer.from(s, 'utf8').copy(buf, 0);
+ src.copy(buf, 0);
return Uint8Array.from(buf);
}