1
0

feat: tone-mapped render rig, studio devices, LA fidelity pass, UI overhaul

The build the studios needed, across eight workstreams and one strict file
partition.

**The render rig was the quality ceiling.** The renderer ran three's
NoToneMapping default while atmosphere drove the sun to 2.35 and assets set
emissives to 3.2, so every value above 1.0 hard-clipped to flat white — which is
why walls blew out and every fitting looked like a white rectangle. ACES filmic
tone mapping and an explicit output colour space land in `stage.ts`, and the
atmosphere intensity table and palette headroom are re-tuned against the new
curve rather than left tuned for the clipping we removed.

`engine/environmentRig.ts` builds a PMREM environment at runtime, procedurally,
so nothing binary is committed. There was no environment map anywhere before, so
every `metalness > 0` role had nothing to reflect and rendered dull grey — a
defect the code already documented against itself in `office/optimus.ts`, where a
whole material role was abandoned over it, and worked around in `modelX.ts` with
a fake emissive that this change deletes. Atmosphere remains the sole light
owner; the rig derives from the `LightingState` it already produced.

**Studio hardware exists.** There was no device concept anywhere in the product:
no type, no route, no state. `devices/types.ts` fixes a declaration/state/
capability/command contract that a smart light, a thermostat, a door sensor and a
charger all fit without a schema change, and both studios now carry a desk mic
and a computer speaker with deterministic simulated behaviour behind an adapter
seam a real API can occupy later. Reads are the demo and are open; commands are a
signed-in action and are kept off the read body entirely, because a shared cache
replaying a GET that turned a microphone on is exactly what the fail-closed
cache default exists to prevent.

**The ADS-B licence hole is closed.** `TERA_ADSB_ENDPOINT` accepted any URL, the
response was served publicly cacheable, and the attribution hardcoded adsb.lol
regardless of where the endpoint pointed — one env var away from republishing
non-redistributable data under an open-terms credit. The host is now allowlisted,
the credit is derived from the host actually configured, public cacheability is
conditional on redistributability, and a refused endpoint demotes to simulated
flights and says so in `degraded[]`. The gate is on the source, not the feature:
live aircraft and their detail cards stay open to anonymous visitors.

**The LA studio was never the smaller pack** — 16 rooms and 248 props against
SF's 4 and 28. Its deficit was fidelity per square metre: 98 of those props were
ceiling troffers, it bound no props to seats, placed none of the habitat kit, and
12 of its 16 rooms had no viewpoint. Density comes from new asset kinds rather
than more instances, because `furnish.ts` draws once per kind and folds colour
into the batch key, so repeat instances add nothing the eye can read.

**The interface stops being forty imperative mutations.** Every visibility
decision moves into a pure, tested `ui/chromeState.ts` and one applier, so the
chrome has coverage for the first time. Deleted: ~100 lines of CSS and two
bindings targeting elements that no longer exist, and a `body:has()` rule that
shifted the desktop layout by 160px for touch controls hidden there. Fixed: the
office picker tabs that drew their label and their badge on top of each other.
Added: a first-run flow, because the product is two verbs and neither was ever
stated on screen. Mobile is designed on its own terms instead of being the
desktop with things hidden — the plan view comes back, and the keyboard-only
shortcuts button is replaced by touch controls.

`arena/studioOps.ts` frames the whole thing as the multi-variable environment it
is, wrapping the same simulators the renderer drives rather than a headless copy.

Also removed `input/vehicle.ts`, which nothing but its own test imported.

Tests 385 -> 961, all passing. Typecheck, build, performance budgets across six
matrix cells, no-binaries, provenance, dependency licences, zero-config boot and
arena source hashes all green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-21 19:44:24 -07:00
parent 8738367258
commit db074e9cf7
150 changed files with 36237 additions and 2586 deletions
+63 -9
View File
@@ -65,6 +65,7 @@
* tokens; when the tokens are there it matches the rest of the chrome exactly.
*/
import { GODMODE_HOTKEY } from "../ui/shortcuts.ts";
import {
moonPosition,
observe,
@@ -285,11 +286,21 @@ export interface GodmodeOptions {
/** Start with the drawer open. Default `false`: the tab, and nothing else. */
open?: boolean;
/**
* The key that opens the drawer, lower case. Default `g`.
* The key that opens the drawer, lower case. Defaults to `GODMODE_HOTKEY` —
* the backtick.
*
* `1`-`9`, `[`, `]`, `M`, `O`, `?` and `Esc` belong to `main.ts` and are not
* available; `Esc` is borrowed back only while focus is inside this panel, so
* that closing the drawer never also walks you out of the office.
* **It was `g`, and `g` was already taken.** `controlForKey` has mapped `g` to
* `secondary` — the crow's glide — since the play modes landed, and this
* handler is registered in the *capture* phase and calls `preventDefault()`.
* So for the one visitor in a deployment who has godmode, glide silently did
* nothing, and the `?` card grew a `G` row advertising this panel while the
* table of shortcuts said `G` was glide. Two bindings, one key, and the loser
* was the one that belonged to everybody.
*
* The backtick is the conventional key for a developer console and collides
* with nothing. Every other binding lives in `KEYMAP` in `src/ui/shortcuts.ts`
* — including this one — and a test asserts no key in that table has two
* meanings, which is what stops this happening again.
*/
hotkey?: string;
}
@@ -453,7 +464,7 @@ const MARINE_PEAK_HOUR = 5.5;
let instances = 0;
export function createGodmode(options: GodmodeOptions): Godmode {
const hotkey = (options.hotkey ?? "g").toLowerCase();
const hotkey = (options.hotkey ?? GODMODE_HOTKEY).toLowerCase();
const id = `gm-${++instances}`;
let place = options.initial.place;
@@ -1964,8 +1975,12 @@ const STYLE = `
position: fixed;
left: 0;
right: 0;
bottom: calc(var(--s4, 16px) + 2.4rem);
z-index: 6;
bottom: calc(var(--s4, 16px) + 2.4rem + env(safe-area-inset-bottom));
/* The instrument layer, named rather than numbered. See src/ui/tokens.ts:
above the play surfaces on purpose — a debug readout that a play HUD can
hide is a debug readout you will misread — and below the modal layer, so a
dialog can still open over it. */
z-index: var(--z-instrument, 6);
display: flex;
flex-direction: column;
align-items: center;
@@ -2158,13 +2173,52 @@ const STYLE = `
.gm-ledger-d { flex: none; min-width: 2.6rem; text-align: right; }
.gm-leak { color: var(--amber-lit, #ffc555); }
/*
* The pose editor's dock, styled here rather than in index.html.
*
* main.ts builds #pose-dock and used to set its whole geometry through
* Object.assign(dock.style, ...) — position, offsets, width, max-height, flex —
* with a comment explaining why: every visitor downloads index.html, and a
* #pose-dock rule sitting in it that can never match is a trace of an
* instrument that was not shipped to them.
*
* That reasoning is right and the conclusion was one file off. This stylesheet
* is injected by createGodmode, which is reached only through the dynamic
* import behind access.can.debug, so these bytes reach exactly the same
* audience the inline styles did — and unlike them, they can carry a media
* query and a safe-area inset. The dock had neither, which put it under the home
* indicator on the one device class that has one.
*/
#pose-dock {
position: fixed;
right: var(--s4, 16px);
bottom: calc(var(--s4, 16px) + 5rem + env(safe-area-inset-bottom));
z-index: var(--z-play, 5);
width: min(20rem, calc(100vw - var(--s4, 16px) * 2));
max-height: min(52dvh, calc(100dvh - 26rem));
display: flex;
flex-direction: column;
align-items: stretch;
gap: var(--s1, 4px);
}
#pose-dock > button { align-self: flex-end; font-family: inherit; }
#pose-dock > div { flex: 1; min-height: 0; display: flex; }
@media (max-width: 600px) {
#pose-dock {
right: var(--s3, 12px);
left: var(--s3, 12px);
width: auto;
bottom: calc(var(--s3, 12px) + 8.5rem + env(safe-area-inset-bottom));
}
}
.gm-hud {
position: fixed;
top: var(--s4, 16px);
top: calc(var(--s4, 16px) + env(safe-area-inset-top));
left: 50%;
transform: translateX(-50%);
margin: 0;
z-index: 6;
z-index: var(--z-instrument, 6);
max-width: min(34rem, calc(100vw - var(--s4, 16px) * 2));
overflow-x: auto;
padding: var(--s2, 8px) var(--s3, 12px);