1
0

Spaces: the inside of the world, and a sun that is actually where it should be

Ten agents wrote this in parallel against CONTRACT.md, which exists because the
five design agents before them collided on fifteen blocking points — four files
specified twice with incompatible contents, three separate backends for one box,
and `Environment` exported twice meaning different things.

What landed: a Stage owning only the renderer and the loop, with the city and an
office as two scenes over it. They cannot share one — San Francisco is ~94 m per
scene unit with 3.6x vertical exaggeration and an office is 1 unit = 1 m — and
the city is paused rather than disposed on the way in, because rebuilding its
336,864-point heightfield costs about a second on the way back out.

Offices are data. `src/offices/lumbridge-hq.ts` is fifteen rooms and seventy-six
seats, and it is the file a self-hoster copies. Walls are a segment list with
1-D openings, so doors and windows are holes punched in a wall rather than
placed objects, and the pass that splits a wall around its openings hands the
walk-mode collider its segments for free.

The sun is real. `solar.ts` is a NOAA/Meeus implementation with no imports at
all — not even three.js — so time of day keeps working on a laptop in a field.
Verified against known values: 75.45 degrees at the June solstice in SF, 28.79
at December, sunset at 03:15Z. The first screenshot after wiring it was a black
rectangle, which turned out to be correct: it was midnight in San Francisco.

Presence binds to a seat id and never to a coordinate. The pack knows where
`eng-04` is; who is sitting in it is private data behind an API. Same shape as
the marker rule, one level in.

Two corrections to ARCHITECTURE.md are in here. Containment does not discharge
ODbL — publishing OSM-derived coordinates is Public Use of a Derivative Database
wherever the rows live, so the rule is about the geocoder (US Census, public
domain) and not the storage. And a person at a desk is not a Marker; markers are
geographic.

One contract gap surfaced only in a screenshot: two agents read `height` on a
viewpoint differently, so the establishing shot aimed at empty air fourteen
metres above the roof. It now means what the same field means for a city.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Karti Tripathi
2026-08-05 00:11:01 -07:00
parent 36471bbad7
commit d464459838
77 changed files with 14266 additions and 216 deletions
+135
View File
@@ -0,0 +1,135 @@
/**
* The simulated sky, as a plan rather than as positions.
*
* The engine's `SimulatedFlights` already evaluates a `SimRoute[]` in closed
* form against wall-clock time, so the server has nothing to simulate — it hands
* over the routes, a fixed phase origin and a seed, and every browser arrives at
* the same answer. One cacheable request replaces a poll per second, and two
* people on different machines see the same aircraft in the same places, which
* a per-client simulation cannot promise and which is the point of doing it this
* way.
*
* ### Where the coordinates came from
*
* The three Bay Area airport positions are published FAA airport reference
* points, typed in by hand. They are US government facts in the public domain,
* and — as with every other coordinate in this repo — emphatically not derived
* from OpenStreetMap. Everything else here is a waypoint someone made up so the
* legs go the right way. See ARCHITECTURE.md §3.2 and CONTRACT.md §8.
*
* The callsigns are invented, with operator prefixes that belong to nobody. A
* repo that refuses to ship other people's logos should not ship their flight
* numbers either.
*/
import type { WireSimRoute } from "../../../src/server/wire.ts";
const SFO: [number, number] = [37.6188, -122.375];
const OAK: [number, number] = [37.7213, -122.2207];
const SJC: [number, number] = [37.3639, -121.9289];
/**
* Departures climb, arrivals descend, and a third of the traffic is just passing
* through at cruise. That mix is what makes the sky read as a working airspace
* rather than a carousel.
*/
const BAY_AREA: WireSimRoute[] = [
// Departures — out over the Pacific, north-east over the Central Valley, and
// south down the peninsula.
{ callsign: "LMB231", from: SFO, to: [37.3, -123.2], fromAlt: 20, toAlt: 10500, duration: 420 },
{ callsign: "LMB778", from: SFO, to: [38.4, -121.3], fromAlt: 20, toAlt: 11000, duration: 480 },
{ callsign: "PAC1082", from: SFO, to: [38.6, -122.9], fromAlt: 20, toAlt: 10000, duration: 460 },
{ callsign: "BAY412", from: OAK, to: [37.0, -121.2], fromAlt: 20, toAlt: 9500, duration: 400 },
{ callsign: "SIE1440", from: SJC, to: [36.6, -121.6], fromAlt: 20, toAlt: 9800, duration: 430 },
// Arrivals — the long descent over Point Reyes, the south-east downwind, and
// the two east-bay finals.
{ callsign: "GLD566", from: [38.3, -123.1], to: SFO, fromAlt: 6000, toAlt: 20, duration: 500 },
{ callsign: "LMB1889", from: [37.1, -121.6], to: SFO, fromAlt: 5500, toAlt: 20, duration: 520 },
{ callsign: "RDW915", from: [37.9, -121.3], to: OAK, fromAlt: 5200, toAlt: 20, duration: 470 },
{ callsign: "PAC331", from: [38.1, -122.3], to: SJC, fromAlt: 5800, toAlt: 20, duration: 540 },
// Overflights, level the whole way.
{
callsign: "GLD55",
from: [38.8, -122.6],
to: [36.6, -121.4],
fromAlt: 11000,
toAlt: 11000,
duration: 620,
},
{
callsign: "PAC21",
from: [37.9, -121.4],
to: [37.2, -123.4],
fromAlt: 10500,
toAlt: 10500,
duration: 700,
},
{
callsign: "RDW1205",
from: [36.5, -122.4],
to: [38.9, -122.0],
fromAlt: 10800,
toAlt: 10800,
duration: 660,
},
// Low and slow across the bay: general aviation is most of what is actually
// visible from the ground, and it is the only traffic that reads as *near*.
{
callsign: "BAY7789",
from: [37.45, -122.1],
to: [38.05, -122.45],
fromAlt: 900,
toAlt: 900,
duration: 520,
},
{
callsign: "SIE4402",
from: [37.95, -122.55],
to: [37.35, -121.85],
fromAlt: 1400,
toAlt: 1400,
duration: 560,
},
];
/** Degrees, roughly the distance from downtown SF to the far end of the bay. */
const BAY_AREA_RADIUS = 0.75;
/**
* A plan for a city this file has never heard of.
*
* A self-hoster pointing `TERA_ORIGIN_LAT/LNG` at somewhere that is not San
* Francisco should get moving aircraft rather than an empty sky, so eight legs
* are laid out on evenly-spaced bearings through their origin. It is not their
* city's real airspace and does not pretend to be — it is motion in the right
* kind of place, which is all the map ever wanted from this.
*/
function genericPlan(lat: number, lng: number): WireSimRoute[] {
const routes: WireSimRoute[] = [];
const span = 0.55;
for (let i = 0; i < 8; i++) {
const bearing = (i / 8) * Math.PI * 2;
const dLat = Math.cos(bearing) * span;
const dLng = (Math.sin(bearing) * span) / Math.max(0.2, Math.cos((lat * Math.PI) / 180));
const cruise = 8000 + (i % 4) * 900;
routes.push({
callsign: `LMB${100 + i * 37}`,
from: [lat - dLat, lng - dLng],
to: [lat + dLat, lng + dLng],
fromAlt: i % 3 === 0 ? 600 : cruise,
toAlt: cruise,
duration: 380 + i * 45,
});
}
return routes;
}
export function planFor(origin: { lat: number; lng: number }): WireSimRoute[] {
const nearSf =
Math.abs(origin.lat - 37.7749) < BAY_AREA_RADIUS &&
Math.abs(origin.lng + 122.4194) < BAY_AREA_RADIUS;
return nearSf ? BAY_AREA : genericPlan(origin.lat, origin.lng);
}