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(tour): renumber every atlas stop from the curriculum on a partial capture
nirholasf76bf58b31a1
diff --git a/scripts/build-tour-atlas.mjs b/scripts/build-tour-atlas.mjsindex abe67ae38..36628eac1 100644--- a/scripts/build-tour-atlas.mjs+++ b/scripts/build-tour-atlas.mjs@@ -41,6 +41,33 @@ export function renderPublicAtlas(manifest) {return `${JSON.stringify(manifest, null, '\t')}\n`;}+/**+ * The manifest summary, derived from the stops it describes.+ *+ * This lives here rather than in the capture script because both sides need it:+ * the capture writes it, and --check re-derives it to prove the committed+ * numbers still describe the committed stops. A summary that drifted from its+ * stops is not cosmetic, the page prints it as a headline stat ("264 stops")+ * directly above a grid that renders a different number.+ */+export function summarizeStops(stops) {+ const resolved = stops.filter((s) => s.anchor?.state === 'resolved');+ return {+ total: stops.length,+ anchored: resolved.length,+ missingAnchor: stops.filter((s) => s.anchor?.state === 'missing').length,+ // A curated anchor points at the feature the narration is about. A+ // fallback anchor points at whatever heading the page happens to have, so+ // the count is the size of the "this stop deserves a real anchor" backlog.+ curatedAnchor: resolved.filter((s) => s.anchor.source === 'curriculum').length,+ fallbackAnchor: resolved.filter((s) => s.anchor.source === 'fallback').length,+ navScopedAnchor: resolved.filter((s) => s.anchor.scope === 'nav').length,+ unreachable: stops.filter((s) => s.status >= 400 || s.status === 0).length,+ withConsoleErrors: stops.filter((s) => s.consoleErrors > 0).length,+ captured: stops.filter((s) => Boolean(s.media)).length,+ };+}+/*** Every reason the committed atlas would be lying, as plain strings.* Pure so tests can drive it with fixtures instead of the real files.@@ -68,6 +95,32 @@ export function atlasProblems(manifest, curriculum, mediaExists) {}}+ // A stop's index is its position in the curriculum, and the page prints it as+ // the stop number on every card and in the lightbox ("stop 12 of 263"). A+ // partial capture used to merge freshly numbered stops with stops numbered+ // against an older curriculum, which shipped duplicate and skipped numbers.+ const order = new Map(curriculum.stops.map((s, i) => [s.id, i]));+ const misnumbered = manifest.stops.filter((s) => order.has(s.id) && s.index !== order.get(s.id));+ if (misnumbered.length) {+ problems.push(+ `${misnumbered.length} atlas stop(s) carry a stale index, so /tour/atlas renders duplicate stop ` ++ `numbers and an out-of-order grid (first: "${misnumbered[0].id}" is numbered ` ++ `${misnumbered[0].index} but sits at ${order.get(misnumbered[0].id)}). Re-run: npm run tour:atlas`,+ );+ }++ // The headline stats on /tour/atlas come straight from summary, so a summary+ // that no longer describes the stops is a visible lie on the page.+ const expected = summarizeStops(manifest.stops);+ const drifted = Object.keys(expected).filter((k) => manifest.summary?.[k] !== expected[k]);+ if (drifted.length) {+ problems.push(+ `the atlas summary no longer matches its stops (${drifted+ .map((k) => `${k}: ${manifest.summary?.[k]} should be ${expected[k]}`)+ .join(', ')}). Re-run: npm run tour:atlas`,+ );+ }+for (const stop of manifest.stops) {if (stop.status === 0 || stop.status >= 400) {problems.push(diff --git a/scripts/capture-tour-atlas.mjs b/scripts/capture-tour-atlas.mjsindex 4732f5e11..d0cf23382 100644--- a/scripts/capture-tour-atlas.mjs+++ b/scripts/capture-tour-atlas.mjs@@ -57,6 +57,9 @@ import {TOUR_FALLBACK_SELECTORS,TOUR_CONTENT_ROOT_SELECTOR,} from '../src/feature-tour/curriculum.js';+// The summary shape is owned by the gate that verifies it, so the writer and the+// checker can never disagree about what a number means.+import { summarizeStops } from './build-tour-atlas.mjs';const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');const CURRICULUM_PATH = resolve(ROOT, 'public/tour/curriculum.json');@@ -336,7 +339,7 @@ async function settleImages() {// a heavy WebGL stop like /walk or /temporary parses its DOM in under two// seconds but does not fire DOMContentLoaded for another ten-plus while its// module graph boots, and on a loaded runner that pushes past the timeout. The-// navigation then throws, the status stays 0, and summarize() counts a page+// navigation then throws, the status stays 0, and summarizeStops() counts a page// that answered HTTP 200 in 200ms as unreachable, telling whoever reads the// report to "fix the page or drop the stop" about a page with nothing wrong.//@@ -518,24 +521,6 @@ function readExistingManifest() {}}-function summarize(stops) {- const resolved = stops.filter((s) => s.anchor.state === 'resolved');- return {- total: stops.length,- anchored: resolved.length,- missingAnchor: stops.filter((s) => s.anchor.state === 'missing').length,- // A curated anchor points at the feature the narration is about. A- // fallback anchor points at whatever heading the page happens to have, so- // the count is the size of the "this stop deserves a real anchor" backlog.- curatedAnchor: resolved.filter((s) => s.anchor.source === 'curriculum').length,- fallbackAnchor: resolved.filter((s) => s.anchor.source === 'fallback').length,- navScopedAnchor: resolved.filter((s) => s.anchor.scope === 'nav').length,- unreachable: stops.filter((s) => s.status >= 400 || s.status === 0).length,- withConsoleErrors: stops.filter((s) => s.consoleErrors > 0).length,- captured: stops.filter((s) => Boolean(s.media)).length,- };-}-function writeManifest(curriculum, fresh) {const previous = readExistingManifest();const merged = new Map();@@ -546,9 +531,18 @@ function writeManifest(curriculum, fresh) {// A stop that left the curriculum has to leave the atlas, or the guard would// keep checking media for a page nobody can reach any more.- const live = new Set(curriculum.stops.map((s) => s.id));+ //+ // The curriculum's own order is the only truth about a stop's position, so+ // every merged stop is re-numbered from it rather than trusting the `index`+ // it carried in. A partial run (`--only`) keeps the previous manifest's+ // entries verbatim, and those were numbered against whatever curriculum+ // existed the day they were captured; sorting a mixed set by that stale+ // number produced duplicate and skipped stop numbers on /tour/atlas (58+ // duplicated badges by 2026-09-02) and shuffled the grid out of tour order.+ const order = new Map(curriculum.stops.map((s, i) => [s.id, i]));const stops = [...merged.values()]- .filter((s) => live.has(s.id))+ .filter((s) => order.has(s.id))+ .map((s) => ({ ...s, index: order.get(s.id) })).sort((a, b) => a.index - b.index);const manifest = {@@ -560,7 +554,7 @@ function writeManifest(curriculum, fresh) {curriculumGeneratedAt: curriculum.generatedAt ?? null,sections: (curriculum.sections || []).map((s) => ({ id: s.id, title: s.title })),tracks: (curriculum.tracks || []).map((t) => ({ id: t.id, title: t.title })),- summary: summarize(stops),+ summary: summarizeStops(stops),stops,};writeFileSync(MANIFEST_PATH, `${JSON.stringify(manifest, null, '\t')}\n`);@@ -631,7 +625,7 @@ async function main() {results.sort((a, b) => a.index - b.index);if (HEALTH_ONLY) {- const s = summarize(results);+ const s = summarizeStops(results);console.log(`\nAnchors: ${s.anchored} resolved (${s.curatedAnchor} curated, ${s.fallbackAnchor} fallback), ` +`${s.missingAnchor} missing. ${s.unreachable} unreachable page(s), ` +