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
Add DEV simulated-location guard, IBM Plex fonts, IRL production specs
nirholas36337938e37b
diff --git a/pages/ibm/fonts/IBMPlexMono-400.woff2 b/pages/ibm/fonts/IBMPlexMono-400.woff2new file mode 100644index 000000000..0804aaff9Binary files /dev/null and b/pages/ibm/fonts/IBMPlexMono-400.woff2 differdiff --git a/pages/ibm/fonts/IBMPlexMono-500.woff2 b/pages/ibm/fonts/IBMPlexMono-500.woff2new file mode 100644index 000000000..090f82f7eBinary files /dev/null and b/pages/ibm/fonts/IBMPlexMono-500.woff2 differdiff --git a/pages/ibm/fonts/IBMPlexSans-300.woff2 b/pages/ibm/fonts/IBMPlexSans-300.woff2new file mode 100644index 000000000..d0a42af74Binary files /dev/null and b/pages/ibm/fonts/IBMPlexSans-300.woff2 differdiff --git a/pages/ibm/fonts/IBMPlexSans-400.woff2 b/pages/ibm/fonts/IBMPlexSans-400.woff2new file mode 100644index 000000000..f0ee65dd7Binary files /dev/null and b/pages/ibm/fonts/IBMPlexSans-400.woff2 differdiff --git a/pages/ibm/fonts/IBMPlexSans-500.woff2 b/pages/ibm/fonts/IBMPlexSans-500.woff2new file mode 100644index 000000000..6d5527eefBinary files /dev/null and b/pages/ibm/fonts/IBMPlexSans-500.woff2 differdiff --git a/pages/ibm/fonts/IBMPlexSans-600.woff2 b/pages/ibm/fonts/IBMPlexSans-600.woff2new file mode 100644index 000000000..08c0d5adcBinary files /dev/null and b/pages/ibm/fonts/IBMPlexSans-600.woff2 differdiff --git a/src/irl.js b/src/irl.jsindex 7a8ef0601..d6879c6fc 100644--- a/src/irl.js+++ b/src/irl.js@@ -1121,6 +1121,11 @@ if (!_deviceToken) {}const gpsState = { lat: null, lng: null, ready: false, watchId: null, accuracy: null, altitude: null };+// DEV-only simulated-location guard (L1). Always false in production — the mock+// machinery that flips it lives entirely inside an `import.meta.env.DEV` block and+// is tree-shaken out, leaving this as an inert, always-false check. When set, the+// real geolocation watch is suppressed so no real coordinate is ever read.+let _mockLocation = false;let gpsPin = null; // { lat, lng, id?, heightM } — the user's own anchored pinlet gpsModeActive = false;// True when the user locked before the first GPS fix landed: onGPSPosition()@@ -1359,6 +1364,7 @@ function onGPSError(err) {}function initGPS() {+ if (_mockLocation) return; // DEV simulated location active — never attach the real watchif (!navigator.geolocation) return;if (gpsState.watchId != null) return; // idempotent — onboarding, boot, and Pin may all callgpsState.watchId = navigator.geolocation.watchPosition(diff --git a/tasks/irl-production/06-memory-gpu-hygiene.md b/tasks/irl-production/06-memory-gpu-hygiene.mdnew file mode 100644index 000000000..a70fb0771--- /dev/null+++ b/tasks/irl-production/06-memory-gpu-hygiene.md@@ -0,0 +1,61 @@+# Task 06 — Memory, GPU resource, and context-loss hygiene++**Phase:** 1 (AR correctness) · **Effort:** M · **Files:** `src/irl.js`, `src/irl/load-queue.js`++## Why+IRL is a long-lived single-page session: users swap avatars, walk through dense+pin areas, and leave the tab backgrounded. Three.js does not auto-free GPU+resources — every undisposed geometry/material/texture/render-target is a leak+that eventually crashes the WebGL context on mobile. A production AR app must run+for an hour without degrading.++## Read first (verify before fixing)+- Avatar (re)load + clear — `src/irl.js:742-770` (`loadAvatar`, `_clearAvatar`, mixer handling)+- Pin disposal — `src/irl.js:~1896-1905` (`disposePin`, `disposeObject3D`)+- Impostor render targets — `src/irl.js:~2250-2260` (creation) + disposal site+- Load queue + cancel — `src/irl/load-queue.js` (priority pump, `cancel()`)+- LOD/eviction — `enforceLOD()` `src/irl.js:~3448-3550`+- Renderer creation — `src/irl.js:150-158` (single WebGL context, per memory `irl-perf-e2`)++## Scope — confirm, then fix++1. **Animation mixer leak on avatar swap.** On hot-swap, confirm the old mixer is+ stopped (`stopAllAction()` / `uncacheRoot`) and detached before the new model+ loads, and that a **failed** load leaves the manager in a clean state (not a+ nulled mixer with orphaned clips). Fix any dangling references.++2. **Impostor render-target / texture disposal order.** Before disposing a pin's+ `_impostorRT`, null the sprite material's texture reference so no live material+ points at a freed texture. Dispose RT + texture + sprite material/geometry.++3. **Cancel in-flight loads on large distance jumps.** When a pin's live camera+ distance jumps far (teleport, unlock snap, walking past), cancel its queued/+ in-flight GLB load so a now-distant pin doesn't hold a slot ahead of the nearest+ one. Use the queue's `cancel()` hook from `enforceLOD()`.++4. **WebGL context-loss recovery.** Add `webglcontextlost`/`webglcontextrestored`+ handlers: preventDefault on loss, pause the tick, and on restore rebuild what's+ needed (or show a designed "tap to reload AR" recovery state). Today a context+ loss likely leaves a black canvas with no recovery.++5. **Backgrounded-tab throttling.** On `visibilitychange` to hidden, pause the RAF /+ stop the camera track to save battery and avoid sensor churn; resume cleanly on+ return. Confirm no leak across pause/resume cycles.++## Implementation guidance+- There is an existing DEV harness (`__irlSeedPins(30)`, `__irlPerf()` per memory+ `irl-perf-e2`). Use it to drive churn and watch `renderer.info.memory`+ (geometries/textures) across repeated swaps + seed/clear cycles — counts must+ return to baseline, not climb.++## Out of scope+The LOD band tuning itself (shipped); adding new visual effects.++## Definition of done+- [ ] Repeated avatar swaps and `__irlSeedPins`/clear cycles return+ `renderer.info.memory` to baseline (no monotonic growth) — paste the numbers.+- [ ] Impostor RTs/textures provably disposed; no console GL warnings.+- [ ] Context loss recovers (or shows a designed recovery), never a silent black canvas.+- [ ] Backgrounding pauses/resumes cleanly with no leak.+- [ ] esbuild clean; `npm test` green; changelog entry if user-visible (e.g. "AR runs+ stably in long sessions").diff --git a/tasks/irl-production/07-accessibility-pass.md b/tasks/irl-production/07-accessibility-pass.mdnew file mode 100644index 000000000..bf95a37a9--- /dev/null+++ b/tasks/irl-production/07-accessibility-pass.md@@ -0,0 +1,62 @@+# Task 07 — Accessibility pass++**Phase:** 2 (UX / polish) · **Effort:** M · **Files:** `pages/irl.html`, `src/irl.js`++## Why+Accessibility is not optional (CLAUDE.md). The IRL controls today have hover/active+states but inconsistent keyboard focus, no Escape-to-dismiss on sheets, and a few+ARIA/contrast/reduced-motion gaps. A production launch must be keyboard- and+screen-reader-navigable and respect motion preferences.++## Read first (verify before fixing)+- Hero camera button — `pages/irl.html` `#irl-camera-btn` (~1558) + its CSS (~310-351)+- Pill buttons — `.irl-pill-btn` CSS + the secondary control row markup+- Object picker buttons — `.irl-obj-btn` (~539-570)+- Sheets: inspect card, caption panel, My Pins, report — their markup + open/close in `src/irl.js`+- Lock-icon gyro pulse animation — `pages/irl.html` `#irl-lock-icon` `@keyframes irl-gyro-pulse` (~513)+- Radar markup + `aria-hidden` — `pages/irl.html` `.irl-radar` (~1704)++## Scope — confirm, then fix++1. **`:focus-visible` on every interactive control.** Hero Camera AR button, all+ `.irl-pill-btn`, `.irl-obj-btn`, report reasons, sheet close buttons, topbar+ Back/Share. Use a consistent ring (`outline: 2px solid …; outline-offset: 2px`)+ matching existing focused elements. No control may be reachable by keyboard+ without a visible focus indicator.++2. **Keyboard dismiss for every sheet/overlay.** Escape closes the inspect card,+ caption panel, My Pins, report sheet, and the full-screen overlay. Trap focus+ within an open modal sheet and restore focus to the trigger on close.++3. **Reduced-motion.** Wrap the lock gyro-pulse and any continuous/decorative+ animation in `@media (prefers-reduced-motion: reduce)` to pause it. Avatar+ movement is content, not decoration — leave it, but kill ambient UI motion.++4. **ARIA correctness.** Buttons that toggle (Pin here, Add object, Appear nearby)+ expose accurate `aria-pressed`. Status toasts use `aria-live` (verify polite vs+ assertive). The radar: either expose its compass labels meaningfully or keep it+ `aria-hidden` but ensure the same info exists in text (nearby count). Sheets use+ `role="dialog"`/`aria-modal` + labelledby.++5. **Color contrast.** Audit muted-grey text (status toasts, pin captions, "polling"+ pill, service descriptions) against WCAG AA on the dark/AR background. Lift any+ that fail. The degraded "polling" state should read as amber (degraded), not grey+ (disabled).++## Implementation guidance+- Prefer a shared focus-ring utility class over per-element rules.+- A reusable `openSheet(el, { onClose })`/`closeSheet()` that wires Escape + focus+ trap + restore would dedupe the four sheets — but match existing patterns; don't+ over-refactor.++## Out of scope+Empty/error state content (task 08); copy rewrites (task 09); responsive layout (task 10).++## Definition of done+- [ ] Full keyboard walkthrough: every control reachable + visibly focused; every+ sheet dismissible with Escape; focus restored to trigger.+- [ ] `prefers-reduced-motion` stops all decorative UI animation.+- [ ] Contrast checked (note tool/values) — no AA failures on key text.+- [ ] VoiceOver/TalkBack spot check on the main controls (document what you tested).+- [ ] esbuild clean; `npm test` green; changelog entry ("IRL is fully keyboard- and+ screen-reader-accessible").