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(home-page): earn the Community live chip from the newest model
nirholasddd8b53f8b8e
diff --git a/pages/home.html b/pages/home.htmlindex 748624212..ad19fd9c4 100644--- a/pages/home.html+++ b/pages/home.html@@ -1514,6 +1514,26 @@ import { attendRotation } from '/src/shared/attended-rotation.js';var reqSeq = 0; // ignore a slow response after a tab switchvar hasRendered = false; // a first successful render happened (keep the section on later empties)+ // The "live" chip claims the strip is moving right now, so it has to be earned+ // by the data rather than by which tab happens to be selected. When the object+ // store rejected our credential on 2026-09-07 no new model could be recorded+ // for two days, and the chip kept pulsing "live" over a strip whose newest card+ // was 48h old. Older models are still worth showing, they just are not live.+ var LIVE_MAX_AGE_MS = 6 * 3600 * 1000;++ function feedIsLive(list) {+ var newest = 0;+ (list || []).forEach(function(c) {+ var t = Date.parse(c && c.created_at);+ if (t > newest) newest = t;+ });+ return newest > 0 && (Date.now() - newest) < LIVE_MAX_AGE_MS;+ }++ function syncLiveChip() {+ if (liveChip) liveChip.hidden = sort !== 'fresh' || !feedIsLive(items);+ }+function dedupe(all) {var seen = new Set();return (Array.isArray(all) ? all : []).filter(function(c) {@@ -1596,6 +1616,7 @@ import { attendRotation } from '/src/shared/attended-rotation.js';// Keep the grid tidy: never exceed the current visible cap.var cap = expanded ? MAX : INITIAL;while (track.children.length > cap) track.removeChild(track.lastChild);+ syncLiveChip();}).catch(function() { /* transient: keep the current stage */ });}, POLL_MS);}@@ -1623,7 +1644,7 @@ import { attendRotation } from '/src/shared/attended-rotation.js';items = res.items;expanded = false;render();- if (liveChip) liveChip.hidden = (s !== 'fresh');+ syncLiveChip();startPolling();}).catch(function() {if (seq !== reqSeq) return;diff --git a/tests/home-community-forge-live.test.js b/tests/home-community-forge-live.test.jsnew file mode 100644index 000000000..0639a9b1b--- /dev/null+++ b/tests/home-community-forge-live.test.js@@ -0,0 +1,85 @@+// Regression guard: the homepage "live" chip must be earned by the data.+//+// The Community strip on the homepage is titled "Made with Forge. Right now."+// and carries a pulsing "live" chip. Both used to be unconditional on the Fresh+// tab: the chip was toggled straight off the selected sort, so it asserted+// liveness no matter how old the newest card was.+//+// On 2026-09-07 the object store began rejecting our credential, which stopped+// forge_creations rows ever reaching status='done' with a glb_url. The gallery+// query selects exactly those rows, so no new model could enter the feed and the+// strip froze on the last model stored before the outage. The chip kept pulsing+// "live" over a 48h-old strip for two days, and nothing on the page contradicted+// it. A stale feed is fine to show; claiming it is live is not.+//+// The freshness helper is authored inline in pages/home.html, so the test lifts+// it out of the page source and runs it. That keeps this a behavioural guard on+// the shipped code rather than a grep over it: if the page stops exporting a+// recognisable helper, the extraction fails and the test fails with it.++import { describe, it, expect, beforeAll } from 'vitest';+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';++const root = resolve(__dirname, '..');+const HOME = 'pages/home.html';++const HOUR = 3600 * 1000;+const iso = (msAgo) => new Date(Date.now() - msAgo).toISOString();++describe('homepage community strip: the "live" chip tracks real freshness', () => {+ let source;+ let feedIsLive;++ beforeAll(() => {+ source = readFileSync(resolve(root, HOME), 'utf8');++ // Lift `var LIVE_MAX_AGE_MS = ...` and `function feedIsLive(list) {...}`+ // out of the inline module and evaluate just those two.+ const maxAge = source.match(/var LIVE_MAX_AGE_MS = [^;]+;/);+ const helper = source.match(/function feedIsLive\(list\) \{[\s\S]*?\n\t\}/);+ expect(maxAge, `${HOME} no longer declares LIVE_MAX_AGE_MS`).not.toBeNull();+ expect(helper, `${HOME} no longer declares feedIsLive()`).not.toBeNull();++ // eslint-disable-next-line no-new-func+ feedIsLive = new Function(`${maxAge[0]}\n${helper[0]}\nreturn feedIsLive;`)();+ });++ it('calls a feed with a model from minutes ago live', () => {+ expect(feedIsLive([{ created_at: iso(3 * 60 * 1000) }])).toBe(true);+ });++ it('does not call the two-day-old strip of the 2026-09-07 storage outage live', () => {+ const stalled = Array.from({ length: 12 }, (_, i) => ({ created_at: iso(48 * HOUR + i * 60000) }));+ expect(feedIsLive(stalled)).toBe(false);+ });++ it('reads the newest model in the list, not the first one it is handed', () => {+ // Ordering is the API's business, so the chip must not assume it.+ const outOfOrder = [{ created_at: iso(30 * HOUR) }, { created_at: iso(2 * 60 * 1000) }];+ expect(feedIsLive(outOfOrder)).toBe(true);+ });++ it('is not live with nothing to be live about', () => {+ expect(feedIsLive([])).toBe(false);+ expect(feedIsLive(null)).toBe(false);+ expect(feedIsLive(undefined)).toBe(false);+ });++ it('survives a row with a missing or unparseable timestamp', () => {+ expect(feedIsLive([{}, { created_at: null }, { created_at: 'not a date' }])).toBe(false);+ expect(feedIsLive([{ created_at: 'not a date' }, { created_at: iso(60 * 1000) }])).toBe(true);+ });++ it('never toggles the chip from the selected sort alone', () => {+ // The exact bug: `liveChip.hidden = (s !== 'fresh')` made the Fresh tab+ // self-certifying. Every write to the chip now goes through syncLiveChip().+ const writes = source.match(/liveChip\.hidden\s*=\s*[^;]+;/g) || [];+ expect(writes.length).toBeGreaterThan(0);+ for (const write of writes) {+ const honest = /feedIsLive\(/.test(write) || /=\s*true\s*;/.test(write);+ expect(honest, `chip written without a freshness check: ${write}`).toBe(true);+ }+ expect(source).toMatch(/syncLiveChip\(\);/);+ });+});