Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(society): the coding floor as a professional office in the tower (#681)
Ruben Lütke94f3133cd98f
diff --git a/art/studies/coding-floor-foundry/brief.md b/art/studies/coding-floor-foundry/brief.mddeleted file mode 100644index 2fc1d0874a..0000000000--- a/art/studies/coding-floor-foundry/brief.md+++ /dev/null@@ -1,72 +0,0 @@-# Coding floor: the Foundry deck--## Intent--The coding floor shows every coding-agent pane of the Agentic IDE as a figure-at a desk. Its previous dressing was a plain open-plan office (oak floor, rugs,-bookcases, potted trees): readable, but nothing on it said "this is where code-is made", nothing reacted to the agents' work, and every department looked like-the next one. The rebuild turns the floor into a place that is worth walking-through and that reads the agents' real state at a glance.--Direction: an orbital code foundry. The floor is an open deck of a station-floating in a nebula above a ringed planet. Charcoal steel and gold (the brand-colours) carry the architecture; each workspace owns one saturated signal-colour; code-related light is cool cyan. Nothing glows without a reason.--## Pillars--1. **One landmark.** The Core stands at the spawn point in the middle of a wide- concourse: gyroscope rings round a plasma heart and a light column into the- sky. It is visible from every part of the floor and its pace follows how- many agents are working.-2. **The world is the status display.** Every effect maps to real pane state:- - working pane: its desk's signal light breathes in the bay colour;- - pane that asks or failed: a beam of amber (asking) or red (failed) rises- from its desk into the sky, visible across the whole floor;- - pane output: a packet of light runs along the floor rail from its bay to- the Core, which flares when it arrives;- - idle floor: the Core turns slowly and dims; a busy floor spins it up.- No decorative effect pretends activity that is not happening.-3. **Bays, not cubicles.** A workspace is a bay: a steel deck plate framed by a- light strip in its colour, a truss gantry with its name as a holographic- sign, consoles instead of office desks, and its own signal colour on rail,- trim and sign.-4. **Fun to cross.** A wide concourse for sprint-jumping, light that answers the- player's steps, drones overhead, a planet and nebula that make the edge of- the deck worth walking to.--## Shape language, palette, materials--- Shapes: chamfered steel slabs, trusses, rings; long horizontal light lines;- no rounded office furniture.-- Palette: deck `#1b1d22`–`#2a2d34`, steel `#3a3e47`, gold `#d8ae52`, code- cyan `#5fe6ff`, nebula violet/teal; bay signals cyan, magenta, amber, lime,- violet, coral.-- Materials: matte painted steel with panel seams (canvas textures), brushed- gold trim, emissive light strips (tone mapping off, bloomed).-- Lighting: low hemisphere fill, one cool key light for shadows, light pools as- additive decals, bloom on emissives only (threshold above lit surfaces).--## Camera and viewing distance--The office's three-quarter orbit camera (35° FOV, 40° down by default).-Overhead pieces (drones, gantry tops) stay below 5 m and out of the walkways-so the close camera never looks through them; the beams and the Core column-are additive and do not hide figures.--## Budgets--- Draw calls: repeated parts are instanced; static dressing does not grow with- the number of panes beyond one instance per desk.-- Bloom renders at reduced resolution and is skipped in the compact (side- panel) stage; reduced motion freezes rotations, pulses and drones.-- Measured on the maintainer's desktop (see `technical_report`); other devices- remain unverified until measured.--## Scope of this study--Procedural runtime geometry in the existing Three.js stage, like the rest of-the office floors; no GLB is promoted. The floor plan keeps its rooms and-stations (Mission Control, team room, server room, reception, break room,-spawn point); the concourse is widened for the Core.diff --git a/art/studies/coding-floor-foundry/review.md b/art/studies/coding-floor-foundry/review.mddeleted file mode 100644index cc1779ee05..0000000000--- a/art/studies/coding-floor-foundry/review.md+++ /dev/null@@ -1,8 +0,0 @@-# Reference review--Decision: pending.--Separate visual judgement from technical results. Record defects and revisions.-After actual user approval, record its date, scope and an English summary here;-keep private conversation content and personal identifiers outside the repository.-A passing check or an agent's own opinion is not user approval.diff --git a/art/studies/coding-floor-foundry/study.json b/art/studies/coding-floor-foundry/study.jsondeleted file mode 100644index 89aa6d2888..0000000000--- a/art/studies/coding-floor-foundry/study.json+++ /dev/null@@ -1,16 +0,0 @@-{- "schema": 1,- "study": "coding-floor-foundry",- "brief": "brief.md",- "assets": [],- "runtime_evidence": [- "evidence/runtime-overview.jpg",- "evidence/runtime-core-and-bays.jpg"- ],- "technical_report": "evidence/technical-report.md",- "approval": {- "status": "pending",- "record": "review.md",- "evidence_sha256": ""- }-}diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex d530b7d069..c9145efbc2 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -39,7 +39,7 @@ never moves an agent, starts work or invents activity (world-behaviour-manual| Furniture | A contemporary workplace built from rounded primitives: light-oak bench desks on black steel T-legs with a white pedestal and a felt privacy screen, slim monitors on arms, ergonomic chairs with a mesh back on a five-star base, open oak-and-steel shelving, low modular sofas on slim legs, tall charcoal planters with full crowns. Department back walls are fluted acoustic felt with a charcoal name plate in white type and oak ledges with small plants. || Materials | Mostly matte; black steel and chrome arms carry a little metalness. Light microcement floor, a rounded felt rug per department whose colour also dyes that department's felt screens and seat fabric (`DEPARTMENT_ZONES`). Rooms: slate felt (team), terrazzo (wardrobe), pale stone (reception), light oak (break room). Glass walls and the outer balustrade have slim black frames. || Light | Cool sky / neutral ground hemisphere light plus one soft, slightly warm directional sun with PCF shadows. Always bright enough to read, never moody. |-| Setting | The agents floor and the Level Hall are floors of a tower in the city in the singularity: a window wall on the far sides, the tower's glass body falling away below, a megacity and the singularity outside (§5h). The coding floor is the Foundry deck: a steel deck floating in a nebula above a ringed planet (§5j). |+| Setting | The agents floor and the Level Hall are floors of a tower in the city in the singularity: a window wall on the far sides, the tower's glass body falling away below, a megacity and the singularity outside (§5h). The coding floor is a floor of the same tower (§5j). || Camera | Perspective, 35° FOV, three-quarter view from the south-east about 40° below the horizon. Orbit, pan and zoom within limits (20°–72° polar, from 2.5 m out to wherever the overview needs: 140 m at least, more on a large campus). The overview frames the whole floor (§5i). || Labels | From across the floor an agent is one small state dot. The dark translucent plate (hexagon badge with the initial or the lead's star, name, rank chip, state dot and activity) fades in over the dot when the camera or the person is near, when the pointer or keyboard focus rests on the agent, or when it is selected (§5g). Scale is clamped by distance. || State language | Green = working (pulsing floor ring, code on the monitor), amber = waiting for the person, grey = idle (smiley monitor) or paused (dark monitor). |@@ -70,9 +70,9 @@ The plans are pure and tested. `officeLayout.ts` holds the shared vocabularyto shoulder in rows of four, two either side of the boulevard. South strip:café, lobby with the elevator, break room.- **Coding floor:** north strip Mission Control, team room, server room;- departments = IDE workspaces ("bays"), two columns either side of a 6.4 m- concourse, at least four (spare ones are free bays), at most six (the rest- fold into "Other"); south strip lobby and break room.+ departments = IDE workspaces, two columns, at least four (spare ones are+ "Open space"), at most six (the rest fold into "Other"); south strip lobby+ and break room.- **Spawn point (both working floors):** a round pad with a terminal. On theagents floor it stands in the atrium, where the two boulevards cross; on thecoding floor on the crossing of the centre aisle and the cross aisle nearest@@ -235,9 +235,14 @@ the floor plan differ.narrow panel to 520 px once; the user can drag it back. There a monitor clickfocuses the pane in the grid right next to it, and the office's "open theledger" action brings the Agents tab forward.-- **Its own look:** since 2026-10-14 the Foundry deck (§5j), which replaced- the earlier studio look (oak herringbone, a carpet and walnut sign wall per- department).+- **Its own look** (`CodingFloorLook.tsx`, `CODING_SCENE` / `CODING_STUDIOS`+ in `officePalette.ts`): same plan as the agents office, none of its+ surfaces. A violet night instead of navy, a fine terrazzo floor instead of+ warm planks, and a glowing cyan rim under the slab edge. Every workspace+ department is furnished as a studio of its own — carpet pattern (grid,+ stripes, checker, dots, diagonal, zigzag) with a border, a painted sign wall,+ and desk and chair colours — cycled by the department's index. All of it is+ flat or outside the railing, so navigation is unchanged.## 5c. Lead office as an executive suite (2026-09-29)@@ -887,69 +892,26 @@ by a rebuilt floor plan is put on the nearest free ground.- `__officeCamera.cut()` — the walls lowered right now; `.walls()` how manywall objects are tagged; `.limits()` this floor's zoom limits.-## 5j. Coding floor as the Foundry deck (2026-10-14)--The maintainer found the coding floor dull: an office like any other, every-department alike and nothing on it that reacted to the agents. It was rebuilt-with an art direction of its own (`art/studies/coding-floor-foundry/brief.md`):-an orbital code foundry. Charcoal steel and gold carry the architecture, cool-cyan marks anything that is code, and every workspace owns one signal colour.-The rule that governs every effect: nothing glows or moves without a real-reason on the floor.--- **Deck** (`FoundryDeck.tsx`, `FoundrySky.tsx`): steel plates with rivets- and vents on a thick hull with portholes and a gold lip, a glass parapet- with a gold rail and a cyan base light, a nebula dome with stars and a- ringed planet below the deck's north end. The concourse between the bay- columns is widened to 6.4 m (`CONCOURSE` in `officeLayout.ts`).-- **The Core** (`FoundryCore.tsx`): the landmark at the spawn terminal. A- plasma heart inside three gyroscope rings between two crowns of fins, motes- orbiting it and a light column with rising bands into the sky. Its pace and- brightness follow the number of working panes; it flares when a packet- arrives; it hides its hanging parts when the camera comes close underneath.-- **Bays**: a dark grid plate framed by a light strip in the bay's signal- colour (`BAY_SIGNALS`, never amber or red), gold corner brackets, and a- truss gantry on the north edge whose holographic sign shows "DOCK 0n" and- the workspace's name; a free bay says so. The gantry stays inside the sign- wall footprint the layout already walks round.-- **Consoles** (`FoundryConsoles.tsx`): dark steel desks with a light edge,- a signal bar between back-to-back desks, the monitor the live terminal is- drawn on (same screen position as before), pilot chairs with the seat in- the bay's colour, node towers with running lights in the bench-end- footprints. The signal bar reads the pane: working = bay colour breathing,- asking = amber blinking, failed = red, idle = dim, free desk = dark.-- **Beams**: a pane that asks or failed raises a beam of its colour from its- desk into the sky, with a ripple on the floor, so the person sees from- anywhere on the deck who needs them.-- **Data rails and packets** (`foundryLayout.ts`, `FoundryPulses.tsx`): every- bay has a rail laid like a circuit trace (45° turns, one lane each, no two- crossing) along the concourse to the Core's floor ring. When a pane's- `last_output_at` moves on in the shared pane poll, a packet of light runs- along its bay's rail to the Core. The first reading only records, so coming- up to the floor fires nothing.-- **Life** (`FoundryLife.tsx`): rings of light under the person's steps and- four maintenance drones with scanner cones circling above head height.-- **Dressing** (`FoundryAmbience.tsx`): in the footprints `codingAmbience`- already gives the layout, bio domes (a tree under glass with a violet grow- light), archive racks with drive lights and coolant lines with glowing bands.-- **Rooms and lobby**: room floors in dark stone, smoked walnut and slate- (`FOUNDRY_ROOM_FLOORS`), glass walls with steel frames and a cyan light band- (`RoomWalls foundry`), the reception counter and the elevator in steel and- gold through the `FoundryLook` context in `OfficeProps.tsx`. The minimap and- the full map draw the deck too: dark plates, bays outlined in their colours,- the concourse, the rails and the Core.-- **Frame** (`FoundryComposer.tsx`): bloom at half resolution with its- threshold above any lit surface, and a studio environment for the metals;- only on this floor, and not in the compact side-panel stage. Bloom selects- by luminance, so every light colour is scaled to a set luminance- (`glowColour`): a magenta strip glows as much as a lime one.-- **Cost**: measured with a draw-call counter on the same machine and window- size, the old floor drew about 1,530 calls per frame close up and 2,950 in- the overview; the Foundry deck draws about 1,310 and 2,880. Frame rates on- that machine were not comparable (the CPU sat at 100 % from other work);- other devices are unmeasured.-- Reduced motion stills the Core, the rails, the beams' ripples, the drones,- the footsteps and the nebula.+## 5j. Coding floor in the tower (2026-10-14)++A sci-fi rebuild of the coding floor (a "Foundry deck" with a reactor, drones,+sky beams and a nebula) was shipped and rejected the same day as too far from+an office. The maintainer asked for a professional, high-end company office.+The floor now keeps the studio look of §5b and moves into the tower:++- **The tower** (`BuildingShell`): window walls, the balustrade and the city+ outside, like the agents floor and the Level Hall; the violet void and its+ railing are gone. All working floors share the city's backdrop.+- **Floor**: light-oak herringbone (lighter and more neutral than before),+ the concrete band with its brass inlay along the windows.+- **Concourse and town square**: the centre aisle is a 6.4 m concourse+ (`CONCOURSE`); round the spawn terminal a terrazzo medallion with brass+ rings and a compass of fine brass lines under a soft pool of light+ (`CodingPlaza.tsx`). Flat, so navigation is unchanged.+- **Busy lights** (`DeskBusyLights.tsx`): a small frosted lamp on a brass foot+ on every occupied desk, lit in the pane's state (green working, amber+ blinking when it waits for the person, red failed, grey idle). It stays on+ the desk while the agent walks away.## 6. Plandiff --git a/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsxindex b475071bcb..6efa84e87e 100644--- a/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx@@ -19,7 +19,7 @@ import { BENCH_H, PLANTER_H, type AgentsAmbienceItem } from "./agentsAmbience";import { FACADE } from "./BuildingShell";import { AGENTS_SCENE } from "./AgentsFloorLook";import { CampusFittings } from "./CampusFittings";-import { Instances, type Placement } from "./Instances";+import { benchesOf, Instances, type Placement } from "./CodingFloorAmbience";import { GEO, MAT, matte } from "./OfficeFurniture";import type { Department, OfficeLayout } from "./officeLayout";@@ -273,29 +273,6 @@ function pool(): MeshBasicMaterial {}const POOL_GEOMETRY = new PlaneGeometry(1, 1).rotateX(-Math.PI / 2);-interface Bench { x: number; z: number; length: number }--/** One bench per pair of desk rows: its centre and length from the desks it holds. */-export function benchesOf(departments: readonly Pick<Department, "id" | "desks">[]): Bench[] {- const out: Bench[] = [];- for (const dept of departments) {- const groups = new Map<string, { xs: number[]; zs: number[] }>();- for (const desk of dept.desks) {- // Desk ids are "<dept>:<bench>:<facing>:<col>".- const key = desk.id.split(":").slice(0, -2).join(":");- const group = groups.get(key) ?? { xs: [], zs: [] };- group.xs.push(desk.x);- group.zs.push(desk.z);- groups.set(key, group);- }- for (const { xs, zs } of groups.values()) {- const minX = Math.min(...xs), maxX = Math.max(...xs);- out.push({ x: (minX + maxX) / 2, z: zs.reduce((s, v) => s + v, 0) / zs.length, length: maxX - minX + 1.2 });- }- }- return out;-}-/** The housing of every pendant on the floor: its middle, its length along x, its height and its width. Pure. */export function pendantHousings(departments: readonly Pick<Department, "id" | "desks">[]): { x: number; y: number; z: number; length: number; h: number; w: number }[] {return benchesOf(departments).flatMap((bench) => {diff --git a/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx b/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsxindex e233283684..881edf8bdc 100644--- a/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx@@ -16,7 +16,7 @@import { useMemo, useRef } from "react";import { useFrame } from "@react-three/fiber";import { Group, MeshStandardMaterial } from "three";-import { Instances, type Placement } from "./Instances";+import { Instances, type Placement } from "./CodingFloorAmbience";import { Box, GEO, matte, Railing } from "./OfficeFurniture";import type { OfficeLayout, Rect } from "./officeLayout";import { SingularityCity } from "./SingularityCity";diff --git a/jarvis/ui/web/frontend/src/components/society/office/CampusFittings.tsx b/jarvis/ui/web/frontend/src/components/society/office/CampusFittings.tsxindex e5f5942f81..53df450b5b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CampusFittings.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CampusFittings.tsx@@ -16,7 +16,7 @@ import {BOOTH, CABINET, COUNTER, CRATE, HIGH_TABLE, ISLAND, SCREEN, SOFA, STEPS, ownSize, stepsSeats, yawOf, type AgentsAmbienceItem,} from "./agentsAmbience";import { agentsRug, AGENTS_RUGS } from "./AgentsFloorLook";-import { Instances, type Placement } from "./Instances";+import { Instances, type Placement } from "./CodingFloorAmbience";import { GEO, MAT, matte } from "./OfficeFurniture";const FIT = {diff --git a/jarvis/ui/web/frontend/src/components/society/office/CampusGround.tsx b/jarvis/ui/web/frontend/src/components/society/office/CampusGround.tsxindex f82ef603cc..574c7b9ce7 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CampusGround.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CampusGround.tsx@@ -21,7 +21,7 @@ import { useT } from "@/i18n";import { AGENTS_SCENE, limestone } from "./AgentsFloorLook";import { FACADE } from "./BuildingShell";import { cachedCanvasTexture } from "./canvasMaterials";-import { Instances, type Placement } from "./Instances";+import { Instances, type Placement } from "./CodingFloorAmbience";import { GEO, matte } from "./OfficeFurniture";import type { CampusZone, CampusZoneKind, OfficeLayout, Rect } from "./officeLayout";diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsxnew file mode 100644index 0000000000..e38831acac--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx@@ -0,0 +1,354 @@+/**+ * The coding floor's ambience between the rooms: tree planters closing the+ * cross aisles at the windows, a low library of walnut bookcases with reading+ * lamps along the west glass, planter troughs along the east glass, slim+ * linear pendants floating over every bench with warm pools of light below,+ * and one warm fill light for the whole floor.+ *+ * Every repeated part is one instanced mesh, so the whole dressing costs a+ * handful of draw calls. The solid pieces come from `codingAmbience`, which+ * the layout also adds to its obstacles; the pendants and light pools are out+ * of reach (overhead, or flat on the floor). The pendants hide whenever the+ * camera comes down to their height, so they never block a close view.+ */+import { useLayoutEffect, useMemo, useRef } from "react";+import { useFrame } from "@react-three/fiber";+import {+ AdditiveBlending, Color, Euler, Group, InstancedMesh, Matrix4, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3,+ type BufferGeometry, type Material,+} from "three";+import { cachedCanvasTexture } from "./canvasMaterials";+import { codingAmbience, LIBRARY_H, TROUGH_H, type AmbienceItem } from "./codingAmbience";+import { GEO, MAT, matte } from "./OfficeFurniture";+import type { Department, OfficeLayout } from "./officeLayout";+import { CODING_SCENE } from "./officePalette";++// ---------------------------------------------------------------------------+// Instancing+// ---------------------------------------------------------------------------++export interface Placement {+ position: [number, number, number];+ scale: [number, number, number];+ /** Rotation (x, y, z) in radians; absent = none. */+ rotation?: [number, number, number];+ color?: string;+}++const _m = new Matrix4(), _q = new Quaternion(), _e = new Euler(), _p = new Vector3(), _s = new Vector3(), _c = new Color();++/** One instanced mesh for every placement of a part (the agents floor's ambience uses it too). */+export function Instances({ geometry, material, items, cast = true }: {+ geometry: BufferGeometry; material: Material; items: readonly Placement[]; cast?: boolean;+}) {+ const ref = useRef<InstancedMesh>(null);+ useLayoutEffect(() => {+ const mesh = ref.current;+ if (!mesh) return;+ items.forEach((item, i) => {+ _e.set(...(item.rotation ?? [0, 0, 0]));+ _m.compose(_p.set(...item.position), _q.setFromEuler(_e), _s.set(...item.scale));+ mesh.setMatrixAt(i, _m);+ if (item.color) mesh.setColorAt(i, _c.set(item.color));+ });+ mesh.count = items.length;+ mesh.instanceMatrix.needsUpdate = true;+ if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;+ }, [items]);+ if (items.length === 0) return null;+ return <instancedMesh key={items.length} ref={ref} args={[geometry, material, items.length]} castShadow={cast} receiveShadow frustumCulled={false} />;+}++// ---------------------------------------------------------------------------+// Materials+// ---------------------------------------------------------------------------++const AMB = {+ clay: matte("#b9694b", { roughness: 0.75 }),+ cream: matte("#efe7da", { roughness: 0.6 }),+ walnut: matte(CODING_SCENE.walnut.slat, { roughness: 0.6 }),+ walnutDark: matte(CODING_SCENE.walnut.gap, { roughness: 0.7 }),+ brass: matte(CODING_SCENE.brass, { roughness: 0.3, metalness: 0.55 }),+ shade: matte("#fff1d6", { emissive: "#ffd79a", emissiveIntensity: 0.9, roughness: 0.6 }),+ /** White, so each instance's colour is the book's colour. */+ book: matte("#ffffff", { roughness: 0.8 }),+ olive: matte("#6f8a58", { flatShading: true }),+ pendant: matte(CODING_SCENE.pendant.body, { roughness: 0.4, metalness: 0.4 }),+ pendantGlow: matte(CODING_SCENE.pendant.glow, { emissive: CODING_SCENE.pendant.glow, emissiveIntensity: 2, toneMapped: false }),+};++/** Book spines: muted cloth and paper tones, warm like an old library. */+const SPINES = ["#8c3b2b", "#c8553d", "#e0b25c", "#3e5c76", "#5e7d5a", "#e9e0cf", "#2f2a26", "#b08a5a", "#7a5a8c", "#d9c7a4"];++/** Deterministic pseudo-random numbers per seed, so the dressing never changes between loads. */+function lcg(seed: number): () => number {+ let state = seed >>> 0;+ return () => {+ state = (state * 1664525 + 1013904223) >>> 0;+ return state / 0x1_0000_0000;+ };+}++function seedOf(id: string): number {+ let h = 2166136261;+ for (let i = 0; i < id.length; i += 1) h = Math.imul(h ^ id.charCodeAt(i), 16777619);+ return h >>> 0;+}++// ---------------------------------------------------------------------------+// Trees+// ---------------------------------------------------------------------------++/** Crown clusters of a tree in its own space (x, y, z, radius) and which leaf tone each takes. */+const CROWN: readonly [number, number, number, number, 0 | 1 | 2 | 3][] = [+ [0, 1.95, 0, 0.36, 0], [0.24, 1.72, 0.1, 0.27, 1], [-0.22, 1.78, -0.08, 0.28, 2], [0.05, 2.18, 0.08, 0.26, 3],+ [-0.1, 1.55, 0.2, 0.22, 1], [0.16, 2.02, -0.2, 0.24, 2], [-0.2, 2.06, 0.16, 0.22, 0], [0.12, 1.5, -0.14, 0.2, 3],+];+const LEAVES = [MAT.leaf, MAT.leafDark, MAT.leafLight, AMB.olive];++/** A tall tree in a square clay planter with a cream rim, filling its TREE_BOX footprint. */+function Trees({ items }: { items: readonly AmbienceItem[] }) {+ const parts = useMemo(() => {+ const planter: Placement[] = [], rim: Placement[] = [], soil: Placement[] = [], trunk: Placement[] = [];+ const leaves: Placement[][] = LEAVES.map(() => []);+ for (const item of items) {+ const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, size = item.maxX - item.minX;+ const rand = lcg(seedOf(item.id));+ const turn = rand() * Math.PI * 2, s = 0.9 + rand() * 0.18;+ planter.push({ position: [x, 0.27, z], scale: [size - 0.06, 0.54, size - 0.06] });+ rim.push({ position: [x, 0.555, z], scale: [size, 0.03, size] });+ soil.push({ position: [x, 0.572, z], scale: [size - 0.14, 0.006, size - 0.14] });+ trunk.push({ position: [x, 1.1, z], scale: [0.045, 1.1, 0.045], rotation: [0.04, 0, -0.05] });+ for (const [cx, cy, cz, r, tone] of CROWN) {+ const lx = cx * Math.cos(turn) - cz * Math.sin(turn), lz = cx * Math.sin(turn) + cz * Math.cos(turn);+ leaves[tone].push({ position: [x + lx * s, 0.1 + cy * s, z + lz * s], scale: [r * s, r * s * 0.9, r * s] });+ }+ }+ return { planter, rim, soil, trunk, leaves };+ }, [items]);+ return (+ <group>+ <Instances geometry={GEO.box} material={AMB.clay} items={parts.planter} />+ <Instances geometry={GEO.box} material={AMB.cream} items={parts.rim} />+ <Instances geometry={GEO.box} material={MAT.soil} items={parts.soil} cast={false} />+ <Instances geometry={GEO.cyl} material={MAT.trunk} items={parts.trunk} />+ {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={LEAVES[i]} items={list} />)}+ </group>+ );+}++// ---------------------------------------------------------------------------+// Library along the west glass+// ---------------------------------------------------------------------------++/**+ * Low walnut bookcases facing into the office: a carcass with two shelves of+ * books, and on top a reading lamp, vases and small plants.+ */+function Library({ items }: { items: readonly AmbienceItem[] }) {+ const parts = useMemo(() => {+ const carcass: Placement[] = [], back: Placement[] = [], books: Placement[] = [];+ const lampBrass: Placement[] = [], lampShade: Placement[] = [], vases: Placement[] = [], sprigs: Placement[] = [];+ items.forEach((item, index) => {+ const rand = lcg(seedOf(item.id));+ const x0 = item.minX, x1 = item.maxX, depth = x1 - x0, cx = (x0 + x1) / 2;+ const len = item.maxZ - item.minZ, cz = (item.minZ + item.maxZ) / 2;+ // Back panel against the glass, then two ends, the plinth, one shelf and the top.+ back.push({ position: [x0 + 0.015, LIBRARY_H / 2, cz], scale: [0.03, LIBRARY_H, len] });+ for (const z of [item.minZ + 0.02, item.maxZ - 0.02]) carcass.push({ position: [cx, LIBRARY_H / 2, z], scale: [depth, LIBRARY_H, 0.04] });+ carcass.push({ position: [cx, 0.05, cz], scale: [depth, 0.1, len] });+ carcass.push({ position: [cx, 0.54, cz], scale: [depth - 0.02, 0.03, len - 0.06] });+ carcass.push({ position: [cx, LIBRARY_H - 0.02, cz], scale: [depth + 0.02, 0.04, len + 0.02] });+ // A vertical divider every ~0.8 m.+ const bays = Math.max(1, Math.round(len / 0.8));+ for (let b = 1; b < bays; b += 1) carcass.push({ position: [cx, LIBRARY_H / 2, item.minZ + (len * b) / bays], scale: [depth - 0.02, LIBRARY_H - 0.1, 0.025] });+ // Books on both shelves: runs of upright spines, now and then a gap or a small stack lying flat.+ for (const [floor, top] of [[0.1, 0.525], [0.555, LIBRARY_H - 0.04]] as const) {+ let z = item.minZ + 0.06;+ while (z < item.maxZ - 0.1) {+ const roll = rand();+ if (roll < 0.07) { z += 0.12 + rand() * 0.1; continue; }+ if (roll < 0.14) {+ // A stack lying flat.+ let y = floor;+ for (let k = 0; k < 3; k += 1) {+ const t = 0.035 + rand() * 0.02;+ books.push({ position: [cx + 0.01, y + t / 2, z + 0.11], scale: [0.2, t, 0.22 - k * 0.02], color: SPINES[Math.floor(rand() * SPINES.length)] });+ y += t;+ }+ z += 0.26;+ continue;+ }+ const w = 0.03 + rand() * 0.035, h = Math.min(top - floor - 0.03, 0.24 + rand() * 0.14);+ const lean = rand() < 0.06 ? 0.18 : 0;+ books.push({+ position: [cx + 0.01, floor + h / 2, z + w / 2], scale: [0.2 + rand() * 0.04, h, w], rotation: [lean, 0, 0],+ color: SPINES[Math.floor(rand() * SPINES.length)],+ });+ z += w + 0.004;+ }+ }+ // On top: a brass reading lamp on every other case, vases and small plants.+ const topY = LIBRARY_H;+ if (index % 2 === 0) {+ const lz = item.minZ + len * 0.22;+ lampBrass.push({ position: [cx, topY + 0.01, lz], scale: [0.08, 0.02, 0.08] });+ lampBrass.push({ position: [cx, topY + 0.2, lz], scale: [0.008, 0.38, 0.008] });+ lampShade.push({ position: [cx, topY + 0.42, lz], scale: [0.11, 0.14, 0.11] });+ }+ vases.push({ position: [cx, topY + 0.1, item.minZ + len * 0.55], scale: [0.05, 0.2, 0.05] });+ vases.push({ position: [cx - 0.02, topY + 0.07, item.minZ + len * 0.8], scale: [0.07, 0.14, 0.07] });+ sprigs.push({ position: [cx - 0.02, topY + 0.2, item.minZ + len * 0.8], scale: [0.12, 0.1, 0.12] });+ sprigs.push({ position: [cx, topY + 0.23, item.minZ + len * 0.55], scale: [0.06, 0.08, 0.06] });+ });+ return { carcass, back, books, lampBrass, lampShade, vases, sprigs };+ }, [items]);+ return (+ <group>+ <Instances geometry={GEO.box} material={AMB.walnut} items={parts.carcass} />+ <Instances geometry={GEO.box} material={AMB.walnutDark} items={parts.back} />+ <Instances geometry={GEO.box} material={AMB.book} items={parts.books} />+ <Instances geometry={GEO.cyl} material={AMB.brass} items={parts.lampBrass} />+ <Instances geometry={GEO.potCyl} material={AMB.shade} items={parts.lampShade} cast={false} />+ <Instances geometry={GEO.cyl} material={AMB.cream} items={parts.vases} />+ <Instances geometry={GEO.blob} material={MAT.leaf} items={parts.sprigs} />+ </group>+ );+}++// ---------------------------------------------------------------------------+// Planter troughs along the east glass+// ---------------------------------------------------------------------------++/** Long cream troughs on a walnut plinth, planted with low foliage, kept low so they hide nothing. */+function Troughs({ items }: { items: readonly AmbienceItem[] }) {+ const parts = useMemo(() => {+ const body: Placement[] = [], plinth: Placement[] = [], soil: Placement[] = [];+ const leaves: Placement[][] = LEAVES.map(() => []);+ for (const item of items) {+ const rand = lcg(seedOf(item.id));+ const cx = (item.minX + item.maxX) / 2, depth = item.maxX - item.minX;+ const len = item.maxZ - item.minZ, cz = (item.minZ + item.maxZ) / 2;+ plinth.push({ position: [cx, 0.03, cz], scale: [depth - 0.04, 0.06, len - 0.04] });+ body.push({ position: [cx, 0.06 + (TROUGH_H - 0.06) / 2, cz], scale: [depth, TROUGH_H - 0.06, len] });+ soil.push({ position: [cx, TROUGH_H + 0.003, cz], scale: [depth - 0.06, 0.006, len - 0.06] });+ for (let z = item.minZ + 0.18; z < item.maxZ - 0.12; z += 0.2 + rand() * 0.08) {+ const r = 0.13 + rand() * 0.08;+ leaves[Math.floor(rand() * LEAVES.length)].push({ position: [cx + (rand() - 0.5) * 0.08, TROUGH_H + r * 0.7, z], scale: [r * 0.9, r * (1 + rand() * 0.6), r] });+ }+ }+ return { body, plinth, soil, leaves };+ }, [items]);+ return (+ <group>+ <Instances geometry={GEO.box} material={AMB.walnut} items={parts.plinth} />+ <Instances geometry={GEO.box} material={AMB.cream} items={parts.body} />+ <Instances geometry={GEO.box} material={MAT.soil} items={parts.soil} cast={false} />+ {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={LEAVES[i]} items={list} />)}+ </group>+ );+}++// ---------------------------------------------------------------------------+// Pendants over the benches+// ---------------------------------------------------------------------------++const PENDANT_Y = 3.0;+/** Below this camera height the pendants hide, so a close or low view never looks through them. */+const PENDANT_HIDE_BELOW = PENDANT_Y + 4;++interface Bench { x: number; z: number; length: number }++/** One bench per pair of desk rows: its centre and length from the desks it holds. */+export function benchesOf(departments: readonly Pick<Department, "id" | "desks">[]): Bench[] {+ const out: Bench[] = [];+ for (const dept of departments) {+ const groups = new Map<string, { xs: number[]; zs: number[] }>();+ for (const desk of dept.desks) {+ // Desk ids are "<dept>:<bench>:<facing>:<col>".+ const key = desk.id.split(":").slice(0, -2).join(":");+ const group = groups.get(key) ?? { xs: [], zs: [] };+ group.xs.push(desk.x);+ group.zs.push(desk.z);+ groups.set(key, group);+ }+ for (const { xs, zs } of groups.values()) {+ const minX = Math.min(...xs), maxX = Math.max(...xs);+ out.push({ x: (minX + maxX) / 2, z: zs.reduce((s, v) => s + v, 0) / zs.length, length: maxX - minX + 1.2 });+ }+ }+ return out;+}++let poolMaterial: MeshBasicMaterial | null = null;+/** A soft oval of warm light, added onto the floor. */+function pool(): MeshBasicMaterial {+ if (!poolMaterial) {+ const map = cachedCanvasTexture("coding:pool", 128, 128, (ctx, w, h) => {+ const g = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, w / 2);+ g.addColorStop(0, "rgba(255,255,255,1)");+ g.addColorStop(0.5, "rgba(255,255,255,0.45)");+ g.addColorStop(1, "rgba(255,255,255,0)");+ ctx.fillStyle = g;+ ctx.fillRect(0, 0, w, h);+ });+ poolMaterial = new MeshBasicMaterial({+ color: CODING_SCENE.pendant.pool, map, transparent: true, opacity: map ? 0.16 : 0, blending: AdditiveBlending, depthWrite: false,+ });+ }+ return poolMaterial;+}+const POOL_GEOMETRY = new PlaneGeometry(1, 1).rotateX(-Math.PI / 2);++function Pendants({ departments }: { departments: readonly Department[] }) {+ const lamps = useRef<Group>(null);+ const parts = useMemo(() => {+ const body: Placement[] = [], glow: Placement[] = [], cable: Placement[] = [], pools: Placement[] = [];+ for (const bench of benchesOf(departments)) {+ const len = bench.length - 0.4;+ body.push({ position: [bench.x, PENDANT_Y, bench.z], scale: [len, 0.05, 0.07] });+ glow.push({ position: [bench.x, PENDANT_Y - 0.027, bench.z], scale: [len - 0.06, 0.006, 0.045] });+ for (const dx of [-len * 0.38, len * 0.38]) cable.push({ position: [bench.x + dx, PENDANT_Y + 0.6, bench.z], scale: [0.006, 1.2, 0.006] });+ pools.push({ position: [bench.x, 0.012, bench.z], scale: [bench.length + 1.6, 1, 3.6] });+ }+ return { body, glow, cable, pools };+ }, [departments]);+ useFrame(({ camera }) => {+ const group = lamps.current;+ if (group) group.visible = camera.position.y > PENDANT_HIDE_BELOW;+ });+ return (+ <group>+ <group ref={lamps}>+ <Instances geometry={GEO.box} material={AMB.pendant} items={parts.body} cast={false} />+ <Instances geometry={GEO.box} material={AMB.pendantGlow} items={parts.glow} cast={false} />+ <Instances geometry={GEO.box} material={AMB.pendant} items={parts.cable} cast={false} />+ </group>+ <Instances geometry={POOL_GEOMETRY} material={pool()} items={parts.pools} cast={false} />+ </group>+ );+}++// ---------------------------------------------------------------------------+// The floor's ambience+// ---------------------------------------------------------------------------++export function CodingFloorAmbience({ layout }: { layout: OfficeLayout }) {+ const items = useMemo(() => codingAmbience(layout), [layout]);+ const byKind = useMemo(() => ({+ tree: items.filter((i) => i.kind === "tree"),+ library: items.filter((i) => i.kind === "library"),+ trough: items.filter((i) => i.kind === "trough"),+ }), [items]);+ const { minX, maxZ } = layout.bounds;+ return (+ <group>+ {/* Warm late-afternoon fill from the south-west, no shadows: the one extra light the floor pays for. */}+ <directionalLight position={[minX - 12, 12, maxZ + 6]} intensity={0.4} color="#ffc68a" />+ <Trees items={byKind.tree} />+ <Library items={byKind.library} />+ <Troughs items={byKind.trough} />+ <Pendants departments={layout.departments} />+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsxnew file mode 100644index 0000000000..af9f0db5f6--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx@@ -0,0 +1,449 @@+/**+ * The coding floor's own look. It shares the agents office's plan — rooms,+ * desks, paths — but none of its surfaces: honey-oak herringbone framed by a+ * polished concrete band along the windows, a warm glowing rim around the+ * slab, and every workspace department furnished as a studio of its own+ * (bordered rug, a walnut slat wall with brass lettering, desks and chairs).+ *+ * Purely visual. The only solid part is the studio wall, which stays inside+ * the sign-wall footprint the layout already walks round.+ */+import { useEffect, useMemo } from "react";+import type { ThreeEvent } from "@react-three/fiber";+import { AdditiveBlending, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, type Texture } from "three";+import { fill, useT } from "@/i18n";+import type { SocietyAgent } from "../data";+import { cachedCanvasTexture } from "./canvasMaterials";+import { DeskInstances, type DeskTone } from "./DeskInstances";+import { Box, GEO, MAT, matte } from "./OfficeFurniture";+import type { Department, OfficeLayout } from "./officeLayout";+import { CODING_SCENE, CODING_STUDIOS, type CarpetPattern, type StudioStyle } from "./officePalette";++/** The studio a department is furnished as: cycles through the set by the department's tint index. */+export function studioStyle(index: number): StudioStyle {+ const n = CODING_STUDIOS.length;+ return CODING_STUDIOS[((index % n) + n) % n];+}++/** Metres covered by one repeat of the herringbone tile and of a carpet pattern. */+const OAK_METRES = 2.4;+const CARPET_METRES = 2.4;+/** The rug's border band around the patterned field. */+const BORDER_M = 0.22;++/** Deterministic pseudo-random numbers, so the chips never shimmer between loads. */+function lcg(seed: number): () => number {+ let state = seed >>> 0;+ return () => {+ state = (state * 1664525 + 1013904223) >>> 0;+ return state / 0x1_0000_0000;+ };+}++/**+ * Herringbone oak blocks, 4:1, on an axis-aligned lattice: block n of strip m+ * lies at (n + 4m, n - 4m) block widths, one horizontal and one vertical. The+ * pattern repeats every 8 widths, so the 256-px tile (two periods) wraps.+ */+function drawHerringbone(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { seam, planks } = CODING_SCENE.oak;+ const u = 16, k = 4;+ ctx.fillStyle = seam;+ ctx.fillRect(0, 0, w, h);+ const block = (x: number, y: number, bw: number, bh: number) => {+ // The tone hashes the block's wrapped position, so every copy of it agrees.+ const wx = ((x % w) + w) % w, wy = ((y % h) + h) % h;+ const tone = planks[Math.floor((wx * 7 + wy * 13) / u) % planks.length];+ for (const dx of [-w, 0, w]) {+ for (const dy of [-h, 0, h]) {+ const px = wx + dx, py = wy + dy;+ if (px > w || py > h || px + bw < 0 || py + bh < 0) continue;+ ctx.fillStyle = tone;+ ctx.fillRect(px + 0.75, py + 0.75, bw - 1.5, bh - 1.5);+ // A faint grain along the block's length.+ ctx.fillStyle = "rgba(96,64,36,0.10)";+ if (bw > bh) for (const gy of [0.3, 0.62]) ctx.fillRect(px + 2, py + bh * gy, bw - 4, 0.8);+ else for (const gx of [0.3, 0.62]) ctx.fillRect(px + bw * gx, py + 2, 0.8, bh - 4);+ }+ }+ };+ const span = w / u;+ for (let m = -span; m <= span; m += 1) {+ for (let n = -span * 2; n <= span * 2; n += 1) {+ const x = (n + k * m) * u, y = (n - k * m) * u;+ if (x < -k * u * 2 || x > w + k * u || y < -k * u * 2 || y > h + k * u) continue;+ block(x, y, k * u, u);+ block(x, y + u, u, k * u);+ }+ }+}++/** Polished concrete: soft clouds of tone and a fine grain, seamless on both axes. */+function drawConcrete(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { base, cloud } = CODING_SCENE.concrete;+ const rand = lcg(0xc0ffee);+ ctx.fillStyle = base;+ ctx.fillRect(0, 0, w, h);+ for (let i = 0; i < 40; i += 1) {+ const x = rand() * w, y = rand() * h, r = 16 + rand() * 50;+ const tone = cloud[i % cloud.length];+ for (const dx of [-w, 0, w]) {+ for (const dy of [-h, 0, h]) {+ const g = ctx.createRadialGradient(x + dx, y + dy, 0, x + dx, y + dy, r);+ g.addColorStop(0, `${tone}88`);+ g.addColorStop(1, `${tone}00`);+ ctx.fillStyle = g;+ ctx.fillRect(x + dx - r, y + dy - r, r * 2, r * 2);+ }+ }+ }+ for (let i = 0; i < 1800; i += 1) {+ ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.12)" : "rgba(80,70,60,0.08)";+ ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1, 1);+ }+}++function drawCarpet(pattern: CarpetPattern, carpet: string, weave: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {+ ctx.fillStyle = carpet;+ ctx.fillRect(0, 0, w, h);+ ctx.fillStyle = weave;+ switch (pattern) {+ case "grid":+ for (let at = 0; at < w; at += 32) { ctx.fillRect(at, 0, 3, h); ctx.fillRect(0, at, w, 3); }+ break;+ case "stripes":+ for (let y = 0; y < h; y += 64) ctx.fillRect(0, y, w, 26);+ break;+ case "checker":+ for (let y = 0; y < h; y += 64) for (let x = 0; x < w; x += 64) if (((x + y) / 64) % 2 === 0) ctx.fillRect(x, y, 64, 64);+ break;+ case "dots":+ for (let y = 16; y < h; y += 32) for (let x = (y / 32) % 2 === 0 ? 0 : 16; x < w + 16; x += 32) {+ ctx.beginPath();+ ctx.arc(x, y, 6, 0, Math.PI * 2);+ ctx.fill();+ }+ break;+ case "diagonal":+ // 45° bands drawn across a doubled span, so the tile wraps on both axes.+ ctx.save();+ ctx.beginPath();+ ctx.rect(0, 0, w, h);+ ctx.clip();+ for (let k = -h; k < w + h; k += 32) {+ ctx.beginPath();+ ctx.moveTo(k, 0); ctx.lineTo(k + 14, 0); ctx.lineTo(k + 14 + h, h); ctx.lineTo(k + h, h);+ ctx.closePath();+ ctx.fill();+ }+ ctx.restore();+ break;+ case "zigzag":+ ctx.lineWidth = 10;+ ctx.strokeStyle = weave;+ for (let y = 16; y < h + 32; y += 48) {+ ctx.beginPath();+ for (let x = 0; x <= w; x += 32) ctx.lineTo(x, y + ((x / 32) % 2 === 0 ? 0 : 20));+ ctx.stroke();+ }+ break;+ }+}++/** A cached base texture, cloned per surface with its own repeat. */+function repeated(base: Texture | null, repeatX: number, repeatZ: number): Texture | null {+ if (!base) return null;+ const map = base.clone();+ map.wrapS = map.wrapT = RepeatWrapping;+ map.anisotropy = 8;+ map.repeat.set(repeatX, repeatZ);+ map.needsUpdate = true;+ return map;+}++/** Studio materials are shared by every department that cycles onto the same style. */+const studioMaterials = new Map<StudioStyle, { tone: DeskTone; slat: MeshStandardMaterial; border: MeshStandardMaterial }>();+function studioKit(style: StudioStyle) {+ let kit = studioMaterials.get(style);+ if (!kit) {+ kit = {+ tone: {+ top: matte(style.deskTop), body: matte(style.deskBody), leg: matte(style.deskLeg),+ chair: matte(style.chair), seat: matte(style.seat),+ },+ slat: matte(style.slat),+ border: matte(style.border, { roughness: 0.95 }),+ };+ studioMaterials.set(style, kit);+ }+ return kit;+}++/** Width of the polished concrete band along the slab's edge, and of its brass inlay. */+const BAND_M = 1.35;+const INLAY_M = 0.035;++/**+ * The slab and floor of the coding floor: herringbone oak, framed by a+ * concrete band with a brass inlay along the windows, a dark edge and a warm+ * rim. The tower's window walls and balustrade stand round it (BuildingShell).+ */+export function CodingSlab({ layout, onFloorClick }: { layout: OfficeLayout; onFloorClick: (event: ThreeEvent<MouseEvent>) => void }) {+ const { minX, maxX, minZ, maxZ } = layout.bounds;+ const w = maxX - minX, d = maxZ - minZ, cx = (minX + maxX) / 2, cz = (minZ + maxZ) / 2;+ const innerW = w - BAND_M * 2, innerD = d - BAND_M * 2;+ const floor = useMemo(() => {+ const map = repeated(cachedCanvasTexture("coding:herringbone", 256, 256, drawHerringbone), w / OAK_METRES, d / OAK_METRES);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.oak.planks[0], map, roughness: 0.5 });+ }, [w, d]);+ // The band's strips: north and south run the full width, east and west fit between them; one repeat per 3 m.+ const band = useMemo(() => {+ const base = cachedCanvasTexture("coding:concrete", 256, 256, drawConcrete);+ const strip = (along: number, across: number) => {+ const map = repeated(base, along / 3, across / 3);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.concrete.base, map, roughness: 0.4 });+ };+ return { ns: strip(w, BAND_M), ew: strip(BAND_M, innerD) };+ }, [w, innerD]);+ const inlay = useMemo(() => matte(CODING_SCENE.concrete.brass, {+ roughness: 0.35, metalness: 0.5, emissive: CODING_SCENE.concrete.brass, emissiveIntensity: 0.15,+ }), []);+ const edge = useMemo(() => matte(CODING_SCENE.slabEdge, { roughness: 0.7 }), []);+ const rim = useMemo(() => new MeshStandardMaterial({+ color: CODING_SCENE.rim, emissive: CODING_SCENE.rim, emissiveIntensity: 1.4, roughness: 0.4, toneMapped: false,+ }), []);+ useEffect(() => () => {+ for (const m of [floor, band.ns, band.ew]) { m.map?.dispose(); m.dispose(); }+ inlay.dispose(); edge.dispose(); rim.dispose();+ }, [floor, band, inlay, edge, rim]);+ const glow = 0.06;+ return (+ <group>+ <Box size={[w, 0.6, d]} position={[cx, -0.3, cz]} material={edge} cast={false} />+ {/* The glowing rim runs just below the floor's edge on all four sides. */}+ <Box size={[w + glow, glow, glow]} position={[cx, -0.06, minZ]} material={rim} cast={false} />+ <Box size={[w + glow, glow, glow]} position={[cx, -0.06, maxZ]} material={rim} cast={false} />+ <Box size={[glow, glow, d + glow]} position={[minX, -0.06, cz]} material={rim} cast={false} />+ <Box size={[glow, glow, d + glow]} position={[maxX, -0.06, cz]} material={rim} cast={false} />+ <mesh position={[cx, 0.001, cz]} rotation={[-Math.PI / 2, 0, 0]} material={floor} receiveShadow onClick={onFloorClick}>+ <planeGeometry args={[w, d]} />+ </mesh>+ {[minZ + BAND_M / 2, maxZ - BAND_M / 2].map((z) => (+ <mesh key={`ns${z}`} position={[cx, 0.002, z]} rotation={[-Math.PI / 2, 0, 0]} material={band.ns} receiveShadow onClick={onFloorClick}>+ <planeGeometry args={[w, BAND_M]} />+ </mesh>+ ))}+ {[minX + BAND_M / 2, maxX - BAND_M / 2].map((x) => (+ <mesh key={`ew${x}`} position={[x, 0.002, cz]} rotation={[-Math.PI / 2, 0, 0]} material={band.ew} receiveShadow onClick={onFloorClick}>+ <planeGeometry args={[BAND_M, innerD]} />+ </mesh>+ ))}+ {/* The brass inlay where oak meets concrete. */}+ <Box size={[innerW + INLAY_M, 0.004, INLAY_M]} position={[cx, 0.002, minZ + BAND_M]} material={inlay} cast={false} />+ <Box size={[innerW + INLAY_M, 0.004, INLAY_M]} position={[cx, 0.002, maxZ - BAND_M]} material={inlay} cast={false} />+ <Box size={[INLAY_M, 0.004, innerD]} position={[minX + BAND_M, 0.002, cz]} material={inlay} cast={false} />+ <Box size={[INLAY_M, 0.004, innerD]} position={[maxX - BAND_M, 0.002, cz]} material={inlay} cast={false} />+ </group>+ );+}++// ---------------------------------------------------------------------------+// Studio wall+// ---------------------------------------------------------------------------++const WALL_H = 1.9;+const LETTERS = { w: 1024, h: 224 } as const;++/** Vertical walnut slats with dark reveals: four slats per 64-px repeat. */+function drawSlats(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { slat, gap } = CODING_SCENE.walnut;+ ctx.fillStyle = gap;+ ctx.fillRect(0, 0, w, h);+ for (let x = 0; x < w; x += 16) {+ ctx.fillStyle = slat;+ ctx.fillRect(x + 3, 0, 11, h);+ ctx.fillStyle = "rgba(255,220,180,0.08)";+ ctx.fillRect(x + 4, 0, 3, h);+ ctx.fillStyle = "rgba(0,0,0,0.12)";+ ctx.fillRect(x + 12, 0, 2, h);+ }+}++const slatMaterials = new Map<string, MeshStandardMaterial>();+/** Slats about 5 cm apart: one texture repeat per 20 cm of wall. */+function slatMaterial(width: number): MeshStandardMaterial {+ const key = width.toFixed(2);+ let material = slatMaterials.get(key);+ if (!material) {+ const map = repeated(cachedCanvasTexture("coding:slats", 64, 64, drawSlats), width / 0.2, 1);+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.walnut.slat, map, roughness: 0.7 });+ slatMaterials.set(key, material);+ }+ return material;+}++/** Brass letters on a transparent ground: the department's name, and "Studio 0n" in small caps under it. */+function drawLetters(label: string, caption: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {+ ctx.clearRect(0, 0, w, h);+ const tracked = (text: string, font: string, y: number, spacing: number, fill: string | CanvasGradient) => {+ ctx.font = font;+ const chars = [...text];+ const widths = chars.map((ch) => ctx.measureText(ch).width);+ const total = widths.reduce((sum, cw) => sum + cw, 0) + spacing * Math.max(0, chars.length - 1);+ // Squeeze a long name to fit rather than cutting it off.+ const scale = Math.min(1, (w - 60) / total);+ ctx.save();+ ctx.translate(w / 2, y);+ ctx.scale(scale, 1);+ let x = -total / 2;+ chars.forEach((ch, i) => {+ // A dark offset first: the raised letters cast a hairline shadow on the slats.+ ctx.fillStyle = "rgba(20,12,6,0.6)";+ ctx.fillText(ch, x + 3, 3);+ ctx.fillStyle = fill;+ ctx.fillText(ch, x, 0);+ x += widths[i] + spacing;+ });+ ctx.restore();+ };+ ctx.textAlign = "left";+ ctx.textBaseline = "middle";+ const gold = ctx.createLinearGradient(0, 30, 0, 140);+ gold.addColorStop(0, "#f7dc95");+ gold.addColorStop(0.55, CODING_SCENE.brass);+ gold.addColorStop(1, "#a97d2c");+ const name = label.length > 24 ? `${label.slice(0, 23)}…` : label;+ tracked(name.toUpperCase(), "600 100px Georgia, 'Times New Roman', serif", 86, 12, gold);+ ctx.fillStyle = CODING_SCENE.brass;+ ctx.fillRect(w / 2 - 70, 156, 140, 3);+ tracked(caption, "600 36px system-ui, -apple-system, 'Segoe UI', sans-serif", 194, 12, "#ecdcb9");+}++const letterMaterials = new Map<string, MeshStandardMaterial>();+function letterMaterial(label: string, caption: string): MeshStandardMaterial {+ const key = `${caption}:${label}`;+ let material = letterMaterials.get(key);+ if (!material) {+ const map = cachedCanvasTexture(`coding:letters:${key}`, LETTERS.w, LETTERS.h, (ctx, w, h) => drawLetters(label, caption, ctx, w, h));+ material = new MeshStandardMaterial({+ color: map ? "#ffffff" : CODING_SCENE.brass, map, transparent: true, alphaTest: 0.3, roughness: 0.35, metalness: 0.3,+ // Lit by the picture light above: a faint glow keeps the brass readable in any light.+ ...(map ? { emissive: "#ffffff", emissiveMap: map, emissiveIntensity: 0.35 } : {}),+ });+ letterMaterials.set(key, material);+ }+ return material;+}++let washCache: MeshBasicMaterial | null = null;+/** Warm light washing down from the picture light, added over the slats. */+function washMaterial(): MeshBasicMaterial {+ if (!washCache) {+ const map = cachedCanvasTexture("coding:wash", 64, 128, (ctx, w, h) => {+ const g = ctx.createLinearGradient(0, 0, 0, h);+ g.addColorStop(0, "rgba(255,214,150,0.8)");+ g.addColorStop(1, "rgba(255,214,150,0)");+ ctx.fillStyle = g;+ ctx.fillRect(0, 0, w, h);+ // Fade the sides too, so the wash has no hard vertical edge.+ ctx.globalCompositeOperation = "destination-in";+ const sides = ctx.createLinearGradient(0, 0, w, 0);+ sides.addColorStop(0, "rgba(0,0,0,0)");+ sides.addColorStop(0.25, "rgba(0,0,0,1)");+ sides.addColorStop(0.75, "rgba(0,0,0,1)");+ sides.addColorStop(1, "rgba(0,0,0,0)");+ ctx.fillStyle = sides;+ ctx.fillRect(0, 0, w, h);+ });+ washCache = new MeshBasicMaterial({ color: "#ffffff", map, transparent: true, opacity: map ? 0.45 : 0, blending: AdditiveBlending, depthWrite: false });+ }+ return washCache;+}++const STUDIO_MAT = {+ frame: matte(CODING_SCENE.walnut.cap, { roughness: 0.45, metalness: 0.3 }),+ brass: matte(CODING_SCENE.brass, { roughness: 0.3, metalness: 0.55, emissive: CODING_SCENE.brass, emissiveIntensity: 0.12 }),+ lamp: new MeshStandardMaterial({ color: CODING_SCENE.pendant.glow, emissive: CODING_SCENE.pendant.glow, emissiveIntensity: 1.6, toneMapped: false }),+ walnut: matte(CODING_SCENE.walnut.slat, { roughness: 0.6 }),+};++/**+ * A studio's back wall, centred on its front face: a walnut slat wall in a+ * black steel frame, the department's name in brass letters under a brass+ * picture light, a kick band in the studio's colour, and two walnut ledges+ * with books and small planters. It stays inside the layout's sign-wall footprint.+ */+function StudioWall({ label, number, width, position, accent }: {+ label: string; number: number; width: number; position: [number, number, number]; accent: MeshStandardMaterial;+}) {+ const plateW = Math.min(3.2, width * 0.52);+ const plateH = (plateW * LETTERS.h) / LETTERS.w;+ const ledgeX = width / 2 - 0.9;+ const t = useT();+ const caption = fill(t("society.office.studio_n"), { number: String(number).padStart(2, "0") });+ return (+ <group position={position}>+ <Box size={[width, WALL_H, 0.1]} position={[0, WALL_H / 2, -0.02]} material={STUDIO_MAT.frame} />+ <mesh position={[0, WALL_H / 2 + 0.05, 0.031]} material={slatMaterial(width - 0.08)} receiveShadow>+ <planeGeometry args={[width - 0.08, WALL_H - 0.18]} />+ </mesh>+ <Box size={[width - 0.08, 0.1, 0.02]} position={[0, 0.07, 0.04]} material={accent} cast={false} />+ <Box size={[width + 0.02, 0.035, 0.13]} position={[0, WALL_H + 0.0175, -0.02]} material={STUDIO_MAT.frame} />+ <mesh position={[0, 1.36, 0.035]} material={washMaterial()}>+ <planeGeometry args={[plateW * 1.1, 0.6]} />+ </mesh>+ <mesh position={[0, 1.34, 0.04]} material={letterMaterial(label, caption)}>+ <planeGeometry args={[plateW, plateH]} />+ </mesh>+ {/* The brass picture light on two short arms, its lit underside facing the letters. */}+ <Box size={[plateW * 0.7, 0.035, 0.06]} position={[0, 1.7, 0.1]} material={STUDIO_MAT.brass} cast={false} />+ <Box size={[plateW * 0.66, 0.006, 0.03]} position={[0, 1.68, 0.1]} material={STUDIO_MAT.lamp} cast={false} />+ {[-plateW * 0.25, plateW * 0.25].map((x) => (+ <Box key={x} size={[0.015, 0.015, 0.08]} position={[x, 1.71, 0.06]} material={STUDIO_MAT.brass} cast={false} />+ ))}+ {ledgeX > plateW / 2 + 0.55 && [-ledgeX, ledgeX].map((x) => (+ <group key={x} position={[x, 0, 0]}>+ <Box size={[0.9, 0.035, 0.13]} position={[0, 1.12, 0.1]} material={STUDIO_MAT.walnut} />+ <mesh geometry={GEO.cyl} material={MAT.planterLight} position={[-0.22, 1.2, 0.1]} scale={[0.055, 0.13, 0.055]} castShadow />+ <mesh geometry={GEO.blob} material={MAT.leaf} position={[-0.22, 1.33, 0.1]} scale={[0.1, 0.09, 0.1]} castShadow />+ {[0.02, 0.085, 0.15].map((bx, i) => (+ <Box key={bx} size={[0.055, 0.2 + i * 0.025, 0.1]} position={[bx, 1.1375 + (0.2 + i * 0.025) / 2, 0.1]}+ material={MAT.books[(i * 2 + number) % MAT.books.length]} />+ ))}+ <mesh geometry={GEO.cyl} material={MAT.pot} position={[0.32, 1.18, 0.1]} scale={[0.045, 0.09, 0.045]} castShadow />+ <mesh geometry={GEO.blob} material={MAT.leafDark} position={[0.32, 1.27, 0.1]} scale={[0.075, 0.065, 0.075]} castShadow />+ </group>+ ))}+ </group>+ );+}++/** One workspace department as a studio: bordered patterned rug, walnut studio wall, desks in its own colours. */+export function CodingStudio({ dept, agents }: { dept: Department; agents: ReadonlyMap<string, SocietyAgent> }) {+ const t = useT();+ const style = studioStyle(dept.tint);+ const kit = studioKit(style);+ const w = dept.maxX - dept.minX, d = dept.maxZ - dept.minZ;+ const cx = (dept.minX + dept.maxX) / 2, cz = (dept.minZ + dept.maxZ) / 2;+ const fieldW = w - BORDER_M * 2, fieldD = d - BORDER_M * 2;+ const carpet = useMemo(() => {+ const base = cachedCanvasTexture(`coding:carpet:${style.pattern}:${style.carpet}:${style.weave}`, 256, 256,+ (ctx, cw, ch) => drawCarpet(style.pattern, style.carpet, style.weave, ctx, cw, ch));+ const map = repeated(base, fieldW / CARPET_METRES, fieldD / CARPET_METRES);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : style.carpet, map, roughness: 0.95 });+ }, [style, fieldW, fieldD]);+ useEffect(() => () => { carpet.map?.dispose(); carpet.dispose(); }, [carpet]);+ return (+ <group>+ <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.border} receiveShadow>+ <planeGeometry args={[w, d]} />+ </mesh>+ <mesh position={[cx, 0.007, cz]} rotation={[-Math.PI / 2, 0, 0]} material={carpet} receiveShadow>+ <planeGeometry args={[fieldW, fieldD]} />+ </mesh>+ <StudioWall label={dept.label || t("society.office.open_space")} number={dept.tint + 1} width={w - 0.4}+ position={[cx, 0, dept.minZ + 0.1]} accent={kit.slat} />+ <DeskInstances desks={dept.desks} agents={agents} tone={kit.tone} />+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingPlaza.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingPlaza.tsxnew file mode 100644index 0000000000..53bcba7d71--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingPlaza.tsx@@ -0,0 +1,86 @@+/**+ * The coding floor's town square: where the concourse meets the cross aisle+ * round the spawn terminal, a round terrazzo medallion with brass rings and a+ * compass of fine brass lines is set into the oak, under a soft pool of warm+ * light — the floor's centre, readable from every desk.+ *+ * Purely visual and flat, so navigation is unchanged.+ */+import { useEffect, useMemo } from "react";+import { AdditiveBlending, MeshBasicMaterial, MeshStandardMaterial } from "three";+import { cachedCanvasTexture } from "./canvasMaterials";+import type { Point } from "./officeLayout";+import { CODING_SCENE } from "./officePalette";++/** The medallion's radius (m). */+export const PLAZA_RADIUS = 2.7;++/** Terrazzo with brass rings and a compass rose of fine brass lines, on a transparent ground. */+function drawMedallion(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ ctx.clearRect(0, 0, w, h);+ const c = w / 2, r = w / 2 - 2;+ let seed = 0x7e44a20;+ const rand = () => { seed = (seed * 1664525 + 1013904223) >>> 0; return seed / 0x1_0000_0000; };+ // The terrazzo field: a warm pale ground with small chips.+ ctx.save();+ ctx.beginPath();+ ctx.arc(c, c, r, 0, Math.PI * 2);+ ctx.clip();+ ctx.fillStyle = CODING_SCENE.plaza.terrazzo;+ ctx.fillRect(0, 0, w, h);+ for (let i = 0; i < 2600; i += 1) {+ ctx.fillStyle = CODING_SCENE.plaza.chips[Math.floor(rand() * CODING_SCENE.plaza.chips.length)];+ const s = 1.5 + rand() * 3.5;+ ctx.fillRect(rand() * w, rand() * h, s, s * (0.6 + rand() * 0.6));+ }+ ctx.restore();+ // Brass: an outer band, two inner rings and the compass lines between them.+ ctx.strokeStyle = CODING_SCENE.brass;+ ctx.lineWidth = w * 0.018;+ ctx.beginPath(); ctx.arc(c, c, r - ctx.lineWidth / 2, 0, Math.PI * 2); ctx.stroke();+ ctx.lineWidth = w * 0.006;+ ctx.beginPath(); ctx.arc(c, c, r * 0.86, 0, Math.PI * 2); ctx.stroke();+ ctx.beginPath(); ctx.arc(c, c, r * 0.5, 0, Math.PI * 2); ctx.stroke();+ ctx.lineWidth = w * 0.004;+ for (let i = 0; i < 16; i += 1) {+ const a = (i / 16) * Math.PI * 2, inner = i % 4 === 0 ? 0.5 : 0.62;+ ctx.beginPath();+ ctx.moveTo(c + Math.cos(a) * r * inner, c + Math.sin(a) * r * inner);+ ctx.lineTo(c + Math.cos(a) * r * 0.86, c + Math.sin(a) * r * 0.86);+ ctx.stroke();+ }+}++/** A soft round pool of warm light on the floor (white centre fading out; the material tints it). */+function drawPool(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const g = ctx.createRadialGradient(w / 2, h / 2, w * 0.2, w / 2, h / 2, w / 2);+ g.addColorStop(0, "rgba(255,255,255,0.55)");+ g.addColorStop(0.6, "rgba(255,255,255,0.3)");+ g.addColorStop(1, "rgba(255,255,255,0)");+ ctx.fillStyle = g;+ ctx.fillRect(0, 0, w, h);+}++export function CodingPlaza({ at }: { at: Point }) {+ const surfaces = useMemo(() => ({+ medallion: new MeshStandardMaterial({+ map: cachedCanvasTexture("coding:medallion", 1024, 1024, drawMedallion), transparent: true, roughness: 0.4, metalness: 0.1,+ polygonOffset: true, polygonOffsetFactor: -2,+ }),+ pool: new MeshBasicMaterial({+ map: cachedCanvasTexture("coding:plaza-pool", 128, 128, drawPool), color: CODING_SCENE.pendant.pool, transparent: true,+ opacity: 0.3, blending: AdditiveBlending, depthWrite: false,+ }),+ }), []);+ useEffect(() => () => { surfaces.medallion.dispose(); surfaces.pool.dispose(); }, [surfaces]);+ return (+ <group position={[at.x, 0, at.z]}>+ <mesh position={[0, 0.006, 0]} rotation={[-Math.PI / 2, 0, 0]} material={surfaces.medallion} receiveShadow>+ <circleGeometry args={[PLAZA_RADIUS, 96]} />+ </mesh>+ <mesh position={[0, 0.009, 0]} rotation={[-Math.PI / 2, 0, 0]} material={surfaces.pool}>+ <planeGeometry args={[PLAZA_RADIUS * 2.4, PLAZA_RADIUS * 2.4]} />+ </mesh>+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx b/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsxindex 589edb3379..d434b2099c 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx@@ -1,5 +1,5 @@/**- * Mission Control, the coding floor's own office: a steel slat wall with a+ * Mission Control, the coding floor's own office: a walnut slat wall with a* live video wall, and a desk with three live monitors and an executive chair.* Working it (E in the room, or a click on the video wall or the desk) opens* the Mission Control panel: start new coding agents, brief several at once.@@ -289,8 +289,7 @@ function Screen({ w, h, material }: { w: number; h: number; material: MeshBasicMconst CM = {felt: matte("#202328", { roughness: 1 }),- // The Foundry deck's brushed steel.- slat: matte("#3d424c", { roughness: 0.38, metalness: 0.65 }),+ walnut: matte("#5b3b27", { roughness: 0.7 }),// Light strips: lit from within, so they read as light in any scene lighting.cove: new MeshStandardMaterial({ color: "#ffe6c4", emissive: "#ffe6c4", emissiveIntensity: 1.1, toneMapped: false }),ice: new MeshStandardMaterial({ color: "#cfe9ff", emissive: "#cfe9ff", emissiveIntensity: 1.1, toneMapped: false }),@@ -310,9 +309,9 @@ export function CommandWall() {const open = useOpenMission();return (<group>- {/* Dark felt backing, a full-height steel slat screen, warm light in coves top and bottom. */}+ {/* Dark felt backing, a full-height walnut slat screen, warm light in coves top and bottom. */}<Box size={[7.8, 2.7, 0.06]} position={[0, 1.35, -0.12]} material={CM.felt} />- {SLATS.map((x) => <Box key={x} size={[0.06, 2.62, 0.06]} position={[x, 1.35, -0.06]} material={CM.slat} cast={false} />)}+ {SLATS.map((x) => <Box key={x} size={[0.06, 2.62, 0.06]} position={[x, 1.35, -0.06]} material={CM.walnut} cast={false} />)}<Box size={[7.7, 0.012, 0.02]} position={[0, 0.03, -0.02]} material={CM.cove} cast={false} /><Box size={[7.7, 0.012, 0.02]} position={[0, 2.67, -0.02]} material={CM.cove} cast={false} />{/* The video wall, flush on the slats; a floating oak shelf with a pair of speakers under it. */}diff --git a/jarvis/ui/web/frontend/src/components/society/office/DeskBusyLights.tsx b/jarvis/ui/web/frontend/src/components/society/office/DeskBusyLights.tsxnew file mode 100644index 0000000000..daac4ce477--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/DeskBusyLights.tsx@@ -0,0 +1,97 @@+/**+ * A busy light on every occupied desk of the coding floor: a small frosted+ * lamp on a brass foot at the desk's back corner, lit in the pane's state —+ * green while it works, amber blinking while it waits for the person, red+ * when it failed, a dim grey when idle. It stays on the desk while its agent+ * walks off to the coffee bar, so a glance along a bench tells who needs you.+ *+ * Two instanced meshes for the whole floor; the lamp colours are rewritten a+ * few times a second, not every frame.+ */+import { useLayoutEffect, useMemo, useRef } from "react";+import { useFrame } from "@react-three/fiber";+import { Color, CylinderGeometry, InstancedMesh, Matrix4, MeshBasicMaterial, MeshStandardMaterial, Quaternion, Vector3 } from "three";+import type { AgentDotKind } from "@/components/agentic/sidePanel/agentStatus";+import type { PaneOccupant } from "./codingFloor";+import type { DeskSlot } from "./officeLayout";+import { CODING_SCENE } from "./officePalette";++/** Where the lamp stands in the desk's own frame (the agent sits at +z): the back corner beside the monitor. */+const LAMP_LOCAL = new Vector3(-0.6, 0.815, -0.28);+const FOOT = new CylinderGeometry(0.03, 0.034, 0.018, 16);+const LAMP = new CylinderGeometry(0.026, 0.03, 0.07, 16);+/** A moment at which the blinking waiting light is on: the still frame under reduced motion. */+const REST_T = 0.1;++const COLOURS: Record<AgentDotKind, Color> = {+ working: new Color(CODING_SCENE.busy.working),+ waiting: new Color(CODING_SCENE.busy.waiting),+ error: new Color(CODING_SCENE.busy.error),+ idle: new Color(CODING_SCENE.busy.idle),+};++/** A desk lamp's colour at time `t` (s): waiting blinks, failed breathes, the others hold. Pure. */+export function busyColour(state: AgentDotKind, t: number, out: Color): Color {+ out.copy(COLOURS[state]);+ if (state === "waiting") return out.multiplyScalar(Math.sin(t * 6) > 0 ? 1 : 0.2);+ if (state === "error") return out.multiplyScalar(0.65 + 0.35 * (0.5 + 0.5 * Math.sin(t * 3)));+ return out;+}++const FOOT_MAT = new MeshStandardMaterial({ color: CODING_SCENE.brass, roughness: 0.3, metalness: 0.6 });+/** Unlit, so the lamp reads as light in any scene lighting; each instance's colour is its state. */+const LAMP_MAT = new MeshBasicMaterial({ color: "#ffffff" });++const _m = new Matrix4(), _q = new Quaternion(), _p = new Vector3(), _one = new Vector3(1, 1, 1);+function lampMatrix(desk: DeskSlot, lift: number): Matrix4 {+ const turn = desk.facing === "north" ? 0 : Math.PI;+ const x = LAMP_LOCAL.x * Math.cos(turn) + LAMP_LOCAL.z * Math.sin(turn);+ const z = -LAMP_LOCAL.x * Math.sin(turn) + LAMP_LOCAL.z * Math.cos(turn);+ return _m.compose(_p.set(desk.x + x, LAMP_LOCAL.y + lift, desk.z + z), _q.identity(), _one);+}++export function DeskBusyLights({ desks, occupants, animate }: {+ desks: readonly DeskSlot[]; occupants: ReadonlyMap<string, PaneOccupant>; animate: boolean;+}) {+ const lit = useMemo(() => desks.flatMap((desk) => {+ const occupant = desk.agentId ? occupants.get(desk.agentId) : undefined;+ return occupant ? [{ desk, state: occupant.dot }] : [];+ }), [desks, occupants]);+ const foot = useRef<InstancedMesh>(null);+ const lamp = useRef<InstancedMesh>(null);+ const colour = useMemo(() => new Color(), []);+ useLayoutEffect(() => {+ lit.forEach(({ desk, state }, i) => {+ foot.current?.setMatrixAt(i, lampMatrix(desk, 0));+ lamp.current?.setMatrixAt(i, lampMatrix(desk, 0.044));+ lamp.current?.setColorAt(i, busyColour(state, REST_T, colour));+ });+ for (const mesh of [foot.current, lamp.current]) {+ if (!mesh) continue;+ mesh.count = lit.length;+ mesh.instanceMatrix.needsUpdate = true;+ if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;+ }+ }, [lit, colour]);+ const next = useRef(0);+ useFrame(({ clock }) => {+ const mesh = lamp.current;+ if (!animate || !mesh || clock.elapsedTime < next.current) return;+ next.current = clock.elapsedTime + 0.1;+ let changed = false;+ lit.forEach(({ state }, i) => {+ if (state !== "waiting" && state !== "error") return;+ mesh.setColorAt(i, busyColour(state, clock.elapsedTime, colour));+ changed = true;+ });+ if (changed && mesh.instanceColor) mesh.instanceColor.needsUpdate = true;+ });+ if (lit.length === 0) return null;+ // Remount when the count changes: an instanced mesh cannot grow in place.+ return (+ <group>+ <instancedMesh key={`foot${lit.length}`} ref={foot} args={[FOOT, FOOT_MAT, lit.length]} castShadow frustumCulled={false} />+ <instancedMesh key={`lamp${lit.length}`} ref={lamp} args={[LAMP, LAMP_MAT, lit.length]} frustumCulled={false} />+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryAmbience.tsxdeleted file mode 100644index 02eba8f827..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryAmbience.tsx+++ /dev/null@@ -1,205 +0,0 @@-/**- * The Foundry deck's dressing along the glass, in the footprints- * `codingAmbience` gives the layout as obstacles: a bio dome where each cross- * aisle meets the windows (a tree under glass with a violet grow light),- * archive racks with running lights along the west glass, and coolant lines- * with glowing bands and valve wheels along the east glass. Plus the deck's- * two fill lights: a cool rim from the nebula and a warm bounce from below.- *- * Every repeated part is one instanced mesh.- */-import { useEffect, useMemo } from "react";-import { useFrame } from "@react-three/fiber";-import { Color, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, TorusGeometry } from "three";-import { cachedCanvasTexture } from "./canvasMaterials";-import { codingAmbience, LIBRARY_H, TROUGH_H, type AmbienceItem } from "./codingAmbience";-import { Instances, type Placement } from "./Instances";-import { FOUNDRY, glowColour } from "./foundryPalette";-import { GEO, MAT, matte } from "./OfficeFurniture";-import type { OfficeLayout } from "./officeLayout";--const AMB = {- steel: matte(FOUNDRY.steel, { roughness: 0.4, metalness: 0.65 }),- steelDark: matte(FOUNDRY.steelDark, { roughness: 0.5, metalness: 0.5 }),- gold: matte(FOUNDRY.gold, { roughness: 0.28, metalness: 0.85 }),- glass: new MeshStandardMaterial({ color: "#bfe6ff", transparent: true, opacity: 0.16, roughness: 0.05, metalness: 0.1, depthWrite: false }),- soil: matte("#1c1714"),- growLight: new MeshBasicMaterial({ color: glowColour("#d07bff", 1.3), toneMapped: false }),- coolant: new MeshBasicMaterial({ color: new Color(FOUNDRY.code).multiplyScalar(1.7), toneMapped: false }),- pipe: matte("#4a505b", { roughness: 0.3, metalness: 0.8 }),- valve: matte("#c0392b", { roughness: 0.5, metalness: 0.3 }),-};--const VALVE = new TorusGeometry(0.09, 0.018, 6, 16);--/** Deterministic pseudo-random numbers per item. */-function rng(id: string): () => number {- let h = 2166136261;- for (let i = 0; i < id.length; i += 1) h = Math.imul(h ^ id.charCodeAt(i), 16777619);- let state = h >>> 0;- return () => {- state = (state * 1664525 + 1013904223) >>> 0;- return state / 0x1_0000_0000;- };-}--// ----------------------------------------------------------------------------// Bio domes-// -----------------------------------------------------------------------------const CROWN: readonly [number, number, number, number][] = [- [0, 1.25, 0, 0.3], [0.18, 1.08, 0.08, 0.22], [-0.17, 1.12, -0.06, 0.23], [0.04, 1.45, 0.06, 0.2], [-0.08, 0.95, 0.15, 0.17],-];-const LEAVES = [MAT.leaf, MAT.leafDark, MAT.leafLight];--function BioDomes({ items }: { items: readonly AmbienceItem[] }) {- const parts = useMemo(() => {- const base: Placement[] = [], band: Placement[] = [], soil: Placement[] = [], glass: Placement[] = [], cap: Placement[] = [];- const ring: Placement[] = [], trunk: Placement[] = [];- const leaves: Placement[][] = LEAVES.map(() => []);- for (const item of items) {- const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, r = (item.maxX - item.minX) / 2;- const rand = rng(item.id);- base.push({ position: [x, 0.2, z], scale: [r, 0.4, r] });- band.push({ position: [x, 0.36, z], scale: [r + 0.01, 0.04, r + 0.01] });- soil.push({ position: [x, 0.405, z], scale: [r - 0.05, 0.01, r - 0.05] });- glass.push({ position: [x, 1.25, z], scale: [r - 0.03, 1.7, r - 0.03] });- cap.push({ position: [x, 2.15, z], scale: [r, 0.1, r] });- ring.push({ position: [x, 2.08, z], scale: [r - 0.06, 0.025, r - 0.06] });- trunk.push({ position: [x, 0.7, z], scale: [0.035, 0.6, 0.035] });- const turn = rand() * Math.PI * 2;- CROWN.forEach(([cx, cy, cz, cr], i) => {- const px = cx * Math.cos(turn) - cz * Math.sin(turn), pz = cx * Math.sin(turn) + cz * Math.cos(turn);- leaves[i % LEAVES.length].push({ position: [x + px, cy, z + pz], scale: [cr, cr * 0.9, cr] });- });- }- return { base, band, soil, glass, cap, ring, trunk, leaves };- }, [items]);- return (- <group>- <Instances geometry={GEO.cyl} material={AMB.steelDark} items={parts.base} />- <Instances geometry={GEO.cyl} material={AMB.gold} items={parts.band} cast={false} />- <Instances geometry={GEO.cyl} material={AMB.soil} items={parts.soil} cast={false} />- <Instances geometry={GEO.cyl} material={MAT.trunk} items={parts.trunk} />- {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={LEAVES[i]} items={list} />)}- <Instances geometry={GEO.cyl} material={AMB.glass} items={parts.glass} cast={false} />- <Instances geometry={GEO.cyl} material={AMB.steel} items={parts.cap} />- <Instances geometry={GEO.cyl} material={AMB.growLight} items={parts.ring} cast={false} />- </group>- );-}--// ----------------------------------------------------------------------------// Archive racks-// -----------------------------------------------------------------------------function drawRackFront(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.fillStyle = "#1a1c21";- ctx.fillRect(0, 0, w, h);- let seed = 0xa4c1;- const rand = () => { seed = (seed * 1664525 + 1013904223) >>> 0; return seed / 0x1_0000_0000; };- // Drive bays in rows, each with a status LED.- for (let y = 6; y < h - 8; y += 16) {- for (let x = 4; x < w - 4; x += 30) {- ctx.fillStyle = "#2a2e36";- ctx.fillRect(x, y, 26, 12);- ctx.fillStyle = "#121418";- ctx.fillRect(x + 2, y + 9, 22, 1);- const on = rand();- ctx.fillStyle = on > 0.6 ? "#ffffff" : on > 0.3 ? "#6b7480" : "#2f343c";- ctx.fillRect(x + 20, y + 3, 3, 3);- }- }-}--function ArchiveRacks({ items, animate }: { items: readonly AmbienceItem[]; animate: boolean }) {- const front = useMemo(() => {- const base = cachedCanvasTexture("foundry:rack", 128, 128, drawRackFront);- const map = base?.clone() ?? null;- if (map) { map.wrapS = map.wrapT = RepeatWrapping; map.repeat.set(1, 1); map.needsUpdate = true; }- return new MeshStandardMaterial({- color: map ? "#ffffff" : FOUNDRY.steelDark, map, roughness: 0.45, metalness: 0.4,- emissive: new Color("#7dffb0"), emissiveMap: map, emissiveIntensity: map ? 1.3 : 0,- });- }, []);- useEffect(() => () => { front.map?.dispose(); front.dispose(); }, [front]);- useFrame(({ clock }) => {- // The drive lights wander: the front texture steps along now and then.- if (animate && front.map) front.map.offset.x = Math.floor(clock.elapsedTime * 1.5) * 0.37 % 1;- });- const parts = useMemo(() => {- const body: Placement[] = [], face: Placement[] = [], cap: Placement[] = [];- for (const item of items) {- const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, d = item.maxX - item.minX, len = item.maxZ - item.minZ;- const out = item.facing === "east" ? 1 : -1;- body.push({ position: [x, LIBRARY_H / 2, z], scale: [d, LIBRARY_H, len] });- face.push({ position: [x + out * (d / 2 + 0.003), LIBRARY_H * 0.48, z], scale: [0.006, LIBRARY_H * 0.8, len - 0.1] });- cap.push({ position: [x, LIBRARY_H + 0.015, z], scale: [d + 0.02, 0.03, len + 0.02] });- }- return { body, face, cap };- }, [items]);- return (- <group>- <Instances geometry={GEO.box} material={AMB.steelDark} items={parts.body} />- <Instances geometry={GEO.box} material={front} items={parts.face} cast={false} />- <Instances geometry={GEO.box} material={AMB.gold} items={parts.cap} cast={false} />- </group>- );-}--// ----------------------------------------------------------------------------// Coolant lines-// -----------------------------------------------------------------------------function CoolantLines({ items }: { items: readonly AmbienceItem[] }) {- const parts = useMemo(() => {- const base: Placement[] = [], pipe: Placement[] = [], band: Placement[] = [], valve: Placement[] = [], flange: Placement[] = [];- for (const item of items) {- const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, d = item.maxX - item.minX, len = item.maxZ - item.minZ;- base.push({ position: [x, 0.09, z], scale: [d, 0.18, len] });- for (const [dx, y] of [[-d * 0.22, 0.27], [d * 0.22, 0.35]] as const) {- pipe.push({ position: [x + dx, y, z], scale: [0.065, len, 0.065], rotation: [Math.PI / 2, 0, 0] });- for (let s = -len / 2 + 0.4; s < len / 2 - 0.2; s += 0.8) {- band.push({ position: [x + dx, y, z + s], scale: [0.072, 0.05, 0.072], rotation: [Math.PI / 2, 0, 0] });- }- }- flange.push({ position: [x, TROUGH_H - 0.05, z - len / 2 + 0.12], scale: [d * 0.9, 0.1, 0.1] });- flange.push({ position: [x, TROUGH_H - 0.05, z + len / 2 - 0.12], scale: [d * 0.9, 0.1, 0.1] });- valve.push({ position: [x, TROUGH_H + 0.04, z], scale: [1, 1, 1], rotation: [Math.PI / 2, 0, 0] });- }- return { base, pipe, band, valve, flange };- }, [items]);- return (- <group>- <Instances geometry={GEO.box} material={AMB.steelDark} items={parts.base} />- <Instances geometry={GEO.cyl} material={AMB.pipe} items={parts.pipe} />- <Instances geometry={GEO.cyl} material={AMB.coolant} items={parts.band} cast={false} />- <Instances geometry={GEO.box} material={AMB.steel} items={parts.flange} />- <Instances geometry={VALVE} material={AMB.valve} items={parts.valve} />- </group>- );-}--/** The deck's dressing along the glass, and its two fill lights. */-export function FoundryAmbience({ layout, animate }: { layout: OfficeLayout; animate: boolean }) {- // One list per kind, kept while the plan stands: each piece below memoises its placements on it.- const { domes, racks, lines } = useMemo(() => {- const items = codingAmbience({ departments: layout.departments, rooms: layout.rooms });- return {- domes: items.filter((i) => i.kind === "tree"),- racks: items.filter((i) => i.kind === "library"),- lines: items.filter((i) => i.kind === "trough"),- };- }, [layout]);- const { minX, maxX, minZ, maxZ } = layout.bounds;- return (- <group>- {/* A cool rim from the nebula in the north-west, a warm bounce from the planet below. */}- <directionalLight position={[minX - 20, 14, minZ - 16]} intensity={0.55} color="#a98bff" />- <directionalLight position={[maxX + 8, -10, maxZ + 8]} intensity={0.25} color="#ffb27a" />- <BioDomes items={domes} />- <ArchiveRacks items={racks} animate={animate} />- <CoolantLines items={lines} />- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryComposer.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryComposer.tsxdeleted file mode 100644index a441e16119..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryComposer.tsx+++ /dev/null@@ -1,70 +0,0 @@-/**- * The Foundry deck's frame: bloom on everything that glows (rails, signs,- * signal lights, the Core) and a soft studio environment so steel and gold- * reflect something. Only the coding floor mounts it, and only in the full- * stage; the compact side-panel stage renders plainly.- *- * Bloom runs at half the canvas resolution, with its threshold above any lit- * surface: only the self-lit parts (colour above 1) bloom.- * Mounted inside the Canvas; `useFrame` priority 1 takes rendering over from R3F.- */-import { useEffect, useMemo } from "react";-import { useFrame, useThree } from "@react-three/fiber";-import { HalfFloatType, PMREMGenerator, Vector2, WebGLRenderTarget } from "three";-import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js";-import { OutputPass } from "three/examples/jsm/postprocessing/OutputPass.js";-import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass.js";-import { UnrealBloomPass } from "three/examples/jsm/postprocessing/UnrealBloomPass.js";-import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js";--export const FOUNDRY_BLOOM = { strength: 0.6, radius: 0.45, threshold: 1.0 } as const;-/** How strongly the studio environment lights the deck's metals. */-const ENVIRONMENT = 0.32;--/** The studio environment for reflections, while mounted. */-export function FoundryEnvironment() {- const gl = useThree((s) => s.gl);- const scene = useThree((s) => s.scene);- useEffect(() => {- const pmrem = new PMREMGenerator(gl);- const room = new RoomEnvironment();- const target = pmrem.fromScene(room, 0.04);- const before = { environment: scene.environment, intensity: scene.environmentIntensity };- scene.environment = target.texture;- scene.environmentIntensity = ENVIRONMENT;- return () => {- scene.environment = before.environment;- scene.environmentIntensity = before.intensity;- target.dispose();- room.dispose();- pmrem.dispose();- };- }, [gl, scene]);- return null;-}--export function FoundryComposer() {- const gl = useThree((s) => s.gl);- const scene = useThree((s) => s.scene);- const camera = useThree((s) => s.camera);- const size = useThree((s) => s.size);- const dpr = useThree((s) => s.viewport.dpr);- const composer = useMemo(() => {- // A multisampled HDR target: the canvas's own antialiasing does not reach an offscreen render.- const c = new EffectComposer(gl, new WebGLRenderTarget(1, 1, { type: HalfFloatType, samples: 4 }));- c.addPass(new RenderPass(scene, camera));- c.addPass(new UnrealBloomPass(new Vector2(256, 256), FOUNDRY_BLOOM.strength, FOUNDRY_BLOOM.radius, FOUNDRY_BLOOM.threshold));- c.addPass(new OutputPass());- return c;- }, [gl, scene, camera]);- useEffect(() => {- composer.setPixelRatio(dpr);- composer.setSize(size.width, size.height);- // The bloom pass blurs at half of that: wide glows need no full-resolution targets.- const bloom = composer.passes.find((p): p is UnrealBloomPass => p instanceof UnrealBloomPass);- bloom?.setSize(Math.max(2, Math.round((size.width * dpr) / 2)), Math.max(2, Math.round((size.height * dpr) / 2)));- }, [composer, size.width, size.height, dpr]);- useEffect(() => () => composer.dispose(), [composer]);- useFrame(() => composer.render(), 1);- return null;-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryConsoles.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryConsoles.tsxdeleted file mode 100644index f91f534ae4..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryConsoles.tsx+++ /dev/null@@ -1,331 +0,0 @@-/**- * The coding floor's workstations: dark steel consoles with a light edge in- * the bay's colour, a signal bar between each back-to-back pair, the monitor- * the pane's terminal is drawn on, and a pilot's chair. Node towers with- * running lights close every bench's ends (the layout's bench-planter- * footprints).- *- * The signal bar is the desk's status light, read from the pane:- * working = the bay's colour, breathing; asking = amber, blinking; failed =- * red; idle = a dim steel glow; a free desk stays dark. A pane that asks or- * failed also raises a beam of its colour from its desk into the sky, so the- * person sees from anywhere on the deck who needs them.- *- * Every repeated part is one instanced mesh; the status colours are rewritten- * a few times a second, not every frame.- */-import { useEffect, useLayoutEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, BufferGeometry, Color, CylinderGeometry, DoubleSide, Euler, InstancedMesh, Matrix4, MeshBasicMaterial,- MeshStandardMaterial, PlaneGeometry, Quaternion, RepeatWrapping, RingGeometry, Vector3, type Material, type Mesh,-} from "three";-import { RoundedBoxGeometry } from "three-stdlib";-import type { AgentDotKind } from "@/components/agentic/sidePanel/agentStatus";-import { cachedCanvasTexture } from "./canvasMaterials";-import type { PaneOccupant } from "./codingFloor";-import { CHAIR_MAT, TASK_CHAIR_PARTS, type ChairFinish } from "./OfficeChairs";-import { GEO, screenMaterial } from "./OfficeFurniture";-import { benchPlanters, type Department, type DeskSlot } from "./officeLayout";-import { baySignal, FOUNDRY, glowColour } from "./foundryPalette";-import type { ScreenFace } from "./screenTextures";--const rounded = (w: number, h: number, d: number, r: number) => new RoundedBoxGeometry(w, h, d, 1, r);--/** Self-lit parts: white × instance colour × this, past the bloom threshold. */-const LIT = 1.8;--const CMAT = {- top: new MeshStandardMaterial({ color: "#2b2f37", roughness: 0.35, metalness: 0.55 }),- side: new MeshStandardMaterial({ color: FOUNDRY.steel, roughness: 0.4, metalness: 0.65 }),- panel: new MeshStandardMaterial({ color: FOUNDRY.steelDark, roughness: 0.5, metalness: 0.5 }),- gold: new MeshStandardMaterial({ color: FOUNDRY.gold, roughness: 0.28, metalness: 0.85 }),- bezel: new MeshStandardMaterial({ color: "#0d0f13", roughness: 0.3, metalness: 0.3 }),- arm: new MeshStandardMaterial({ color: "#3d424c", roughness: 0.3, metalness: 0.7 }),- keys: new MeshStandardMaterial({ color: "#14161a", roughness: 0.5 }),- /** White: each instance's colour is the light's colour. */- lit: new MeshBasicMaterial({ color: new Color(LIT, LIT, LIT), toneMapped: false }),- chairFrame: new MeshStandardMaterial({ color: "#1b1d22", roughness: 0.45, metalness: 0.3 }),- /** White: the seat takes its bay's colour, darkened, per instance. */- seat: new MeshStandardMaterial({ color: "#ffffff", roughness: 0.7 }),- chairMesh: new MeshStandardMaterial({ color: "#16181c", roughness: 0.9, side: DoubleSide }),-};--type Tint = "edge" | "signal" | "seat";--interface Part {- geometry: BufferGeometry;- material: Material;- position: [number, number, number];- scale?: [number, number, number];- tint?: Tint;- cast: boolean;-}--const CHAIR_Z = 0.62;-const CHAIR_MATERIAL: Record<ChairFinish, Material> = { frame: CMAT.chairFrame, fabric: CMAT.seat, metal: CHAIR_MAT.aluminium, mesh: CMAT.chairMesh };--/** One workstation in its own space: the agent sits at +z, the monitor is at -z. Top surface at 0.77 m. */-const PARTS: Part[] = [- { geometry: rounded(1.5, 0.04, 0.8, 0.012), material: CMAT.top, position: [0, 0.75, 0], cast: true },- // The light edge along the front of the top.- { geometry: GEO.box, material: CMAT.lit, position: [0, 0.735, 0.402], scale: [1.42, 0.012, 0.01], tint: "edge", cast: false },- // Waterfall sides, a modesty panel and a gold kick line.- ...[-0.71, 0.71].map((x): Part => ({ geometry: GEO.box, material: CMAT.side, position: [x, 0.365, 0], scale: [0.06, 0.73, 0.78], cast: true })),- { geometry: GEO.box, material: CMAT.panel, position: [0, 0.45, -0.34], scale: [1.36, 0.5, 0.03], cast: false },- { geometry: GEO.box, material: CMAT.gold, position: [0, 0.025, -0.33], scale: [1.36, 0.02, 0.025], cast: false },- // The signal bar between back-to-back desks: a dark fin with the status light along its top.- { geometry: rounded(1.46, 0.3, 0.035, 0.01), material: CMAT.panel, position: [0, 0.92, -0.41], cast: true },- { geometry: GEO.box, material: CMAT.lit, position: [0, 1.075, -0.41], scale: [1.44, 0.02, 0.04], tint: "signal", cast: false },- // Monitor on an arm, a thin backlight in the bay's colour behind it.- { geometry: GEO.box, material: CMAT.arm, position: [0, 0.795, -0.33], scale: [0.08, 0.05, 0.06], cast: false },- { geometry: GEO.cyl, material: CMAT.arm, position: [0, 0.95, -0.33], scale: [0.018, 0.32, 0.018], cast: true },- { geometry: GEO.box, material: CMAT.arm, position: [0, 1.1, -0.28], scale: [0.04, 0.03, 0.1], cast: false },- { geometry: rounded(0.72, 0.43, 0.022, 0.012), material: CMAT.bezel, position: [0, 1.18, -0.224], cast: true },- { geometry: GEO.box, material: CMAT.lit, position: [0, 0.962, -0.236], scale: [0.6, 0.008, 0.008], tint: "edge", cast: false },- // Keyboard and mouse.- { geometry: GEO.box, material: CMAT.keys, position: [0, 0.777, 0.22], scale: [0.46, 0.014, 0.14], cast: true },- { geometry: GEO.box, material: CMAT.keys, position: [0.34, 0.78, 0.22], scale: [0.05, 0.02, 0.08], cast: false },- // Pilot's chair: the task chair in dark steel, its seat in the bay's colour.- ...TASK_CHAIR_PARTS.map((part): Part => ({- geometry: part.geometry, material: CHAIR_MATERIAL[part.finish], position: [0, 0, CHAIR_Z],- tint: part.finish === "fabric" ? "seat" : undefined, cast: part.cast,- })),-];--const SCREEN_GEOMETRY = new PlaneGeometry(0.66, 0.38);-const SCREEN_LOCAL: [number, number, number] = [0, 1.18, -0.212];-const FACES: ScreenFace[] = ["working", "idle", "waiting", "paused", "empty"];--const _q = new Quaternion(), _e = new Euler(), _p = new Vector3(), _s = new Vector3();-function deskMatrix(desk: DeskSlot, local: [number, number, number], scale: [number, number, number] = [1, 1, 1]): Matrix4 {- const world = new Matrix4().compose(_p.set(desk.x, 0, desk.z), _q.setFromEuler(_e.set(0, desk.facing === "north" ? 0 : Math.PI, 0)), _s.set(1, 1, 1));- return world.multiply(new Matrix4().compose(new Vector3(...local), new Quaternion(), new Vector3(...scale)));-}--/** A moment at which every blinking or breathing signal is lit: the still frame under reduced motion. */-const REST_T = 0.1;--/** The status a desk's light shows. */-export type DeskSignal = AgentDotKind | "free";--const STATUS_COLOUR = {- waiting: glowColour(FOUNDRY.status.asking, 0.8),- error: glowColour(FOUNDRY.status.failed, 0.8),- idle: new Color("#4a5566").multiplyScalar(0.45),- free: new Color("#0c0d10"),-};--/** The colour of a desk's signal light at time `t` (s). Pure. */-export function signalColour(signal: DeskSignal, bay: Color, t: number, out: Color): Color {- switch (signal) {- case "working": return out.copy(bay).multiplyScalar(0.55 + 0.45 * (0.5 + 0.5 * Math.sin(t * 2.4)));- case "waiting": return out.copy(STATUS_COLOUR.waiting).multiplyScalar(Math.sin(t * 6) > 0 ? 1 : 0.25);- case "error": return out.copy(STATUS_COLOUR.error).multiplyScalar(0.6 + 0.4 * (0.5 + 0.5 * Math.sin(t * 3)));- case "idle": return out.copy(STATUS_COLOUR.idle);- default: return out.copy(STATUS_COLOUR.free);- }-}--interface DeskInfo { desk: DeskSlot; bay: Color; seat: Color; signal: DeskSignal }--function PartInstances({ part, infos, animate }: { part: Part; infos: readonly DeskInfo[]; animate: boolean }) {- const ref = useRef<InstancedMesh>(null);- const colour = useMemo(() => new Color(), []);- useLayoutEffect(() => {- const mesh = ref.current;- if (!mesh) return;- infos.forEach((info, i) => {- mesh.setMatrixAt(i, deskMatrix(info.desk, part.position, part.scale));- if (part.tint === "edge") mesh.setColorAt(i, colour.copy(info.bay).multiplyScalar(info.signal === "free" ? 0.25 : 0.8));- if (part.tint === "seat") mesh.setColorAt(i, info.seat);- // At rest (reduced motion) the light holds a lit phase: an asking desk must not sit at its dark blink.- if (part.tint === "signal") mesh.setColorAt(i, signalColour(info.signal, info.bay, REST_T, colour));- });- mesh.count = infos.length;- mesh.instanceMatrix.needsUpdate = true;- if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;- mesh.computeBoundingSphere();- }, [infos, part, colour]);- const next = useRef(0);- useFrame(({ clock }) => {- if (part.tint !== "signal" || !animate || clock.elapsedTime < next.current) return;- next.current = clock.elapsedTime + 0.08;- const mesh = ref.current;- if (!mesh) return;- infos.forEach((info, i) => mesh.setColorAt(i, signalColour(info.signal, info.bay, clock.elapsedTime + i * 0.37, colour)));- if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;- });- return <instancedMesh ref={ref} args={[part.geometry, part.material, Math.max(1, infos.length)]} castShadow={part.cast} receiveShadow frustumCulled={false} />;-}--function ScreenInstances({ face, desks }: { face: ScreenFace; desks: DeskSlot[] }) {- const ref = useRef<InstancedMesh>(null);- useLayoutEffect(() => {- const mesh = ref.current;- if (!mesh) return;- desks.forEach((desk, i) => mesh.setMatrixAt(i, deskMatrix(desk, SCREEN_LOCAL)));- mesh.count = desks.length;- mesh.instanceMatrix.needsUpdate = true;- }, [desks]);- return <instancedMesh key={Math.max(1, desks.length)} ref={ref} args={[SCREEN_GEOMETRY, screenMaterial(face), Math.max(1, desks.length)]} frustumCulled={false} />;-}--// ----------------------------------------------------------------------------// Node towers at the bench ends-// -----------------------------------------------------------------------------const TOWER_H = 1.05;--/** Running lights: rows of small LEDs, most dim, some lit (white; the emissive colour tints them). */-function drawLeds(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.fillStyle = "#15171c";- ctx.fillRect(0, 0, w, h);- let seed = 0x1ed5;- const rand = () => { seed = (seed * 1664525 + 1013904223) >>> 0; return seed / 0x1_0000_0000; };- for (let y = 4; y < h; y += 8) {- for (let x = 4; x < w; x += 8) {- const on = rand();- ctx.fillStyle = on > 0.72 ? "#ffffff" : on > 0.5 ? "#5a6470" : "#262a31";- ctx.fillRect(x, y, 3, 3);- }- }-}--function NodeTowers({ departments, animate }: { departments: readonly Department[]; animate: boolean }) {- const material = useMemo(() => {- const base = cachedCanvasTexture("foundry:leds", 64, 128, drawLeds);- const map = base?.clone() ?? null;- if (map) { map.wrapS = map.wrapT = RepeatWrapping; map.needsUpdate = true; }- return new MeshStandardMaterial({- color: map ? "#ffffff" : FOUNDRY.steelDark, map, roughness: 0.45, metalness: 0.5,- emissive: new Color(FOUNDRY.code), emissiveMap: map, emissiveIntensity: map ? 1.6 : 0,- });- }, []);- useEffect(() => () => { material.map?.dispose(); material.dispose(); }, [material]);- const rects = useMemo(() => departments.flatMap((d) => benchPlanters(d).map((p) => p.rect)), [departments]);- const ref = useRef<InstancedMesh>(null);- const caps = useRef<InstancedMesh>(null);- useLayoutEffect(() => {- const m = new Matrix4();- rects.forEach((r, i) => {- const x = (r.minX + r.maxX) / 2, z = (r.minZ + r.maxZ) / 2, w = r.maxX - r.minX, d = r.maxZ - r.minZ;- ref.current?.setMatrixAt(i, m.compose(_p.set(x, TOWER_H / 2, z), _q.identity(), _s.set(w, TOWER_H, d)));- caps.current?.setMatrixAt(i, m.compose(_p.set(x, TOWER_H + 0.012, z), _q.identity(), _s.set(w + 0.02, 0.024, d + 0.02)));- });- for (const mesh of [ref.current, caps.current]) {- if (!mesh) continue;- mesh.count = rects.length;- mesh.instanceMatrix.needsUpdate = true;- mesh.computeBoundingSphere();- }- }, [rects]);- // The LEDs run: the texture scrolls slowly, so the lit ones move like traffic.- useFrame((_, delta) => {- if (animate && material.map) material.map.offset.y = (material.map.offset.y + Math.min(delta, 0.1) * 0.05) % 1;- });- if (rects.length === 0) return null;- return (- <group>- {/* Remount when the count changes: an instanced mesh cannot grow in place. */}- <instancedMesh key={rects.length} ref={ref} args={[GEO.box, material, rects.length]} castShadow receiveShadow frustumCulled={false} />- <instancedMesh key={`cap${rects.length}`} ref={caps} args={[GEO.box, CMAT.gold, rects.length]} frustumCulled={false} />- </group>- );-}--// ----------------------------------------------------------------------------// Beams for panes that need the person-// -----------------------------------------------------------------------------const BEAM_H = 22;-const BEAM_GEOMETRY = new CylinderGeometry(0.11, 0.11, BEAM_H, 12, 1, true);-const BEAM_HALO = new CylinderGeometry(0.34, 0.34, BEAM_H, 16, 1, true);-const RING_GEOMETRY = new RingGeometry(0.42, 0.5, 40);--/** Fades out upwards (white; tinted). */-function drawFade(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createLinearGradient(0, h, 0, 0);- g.addColorStop(0, "rgba(255,255,255,1)");- g.addColorStop(0.3, "rgba(255,255,255,0.5)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);-}--const beamMaterials = new Map<string, { core: MeshBasicMaterial; halo: MeshBasicMaterial; ring: MeshBasicMaterial }>();-function beamMaterial(signal: "waiting" | "error") {- let set = beamMaterials.get(signal);- if (!set) {- const map = cachedCanvasTexture("foundry:fade", 32, 256, drawFade);- const colour = STATUS_COLOUR[signal];- const make = (k: number) => new MeshBasicMaterial({- map, color: colour.clone().multiplyScalar(k), transparent: true, depthWrite: false, blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- });- set = {- core: make(1.6), halo: make(0.35),- ring: new MeshBasicMaterial({ color: colour.clone().multiplyScalar(1.6), transparent: true, depthWrite: false, blending: AdditiveBlending, toneMapped: false }),- };- beamMaterials.set(signal, set);- }- return set;-}--function SignalBeam({ desk, signal, animate }: { desk: DeskSlot; signal: "waiting" | "error"; animate: boolean }) {- const m = beamMaterial(signal);- // Each ripple fades on its own clock, so it needs its own copy of the ring material.- const ripple = useMemo(() => m.ring.clone(), [m]);- useEffect(() => () => ripple.dispose(), [ripple]);- const ringMesh = useRef<Mesh>(null);- const phase = useMemo(() => Math.abs(desk.x * 3.1 + desk.z * 1.7) % 1, [desk.x, desk.z]);- useFrame(({ clock }) => {- const mesh = ringMesh.current;- if (!mesh) return;- const p = animate ? (clock.elapsedTime * 0.8 + phase) % 1 : 0.4;- mesh.scale.setScalar(1 + p * 2.4);- ripple.opacity = 1 - p;- });- // The beam rises from the signal bar between the desks.- const back = desk.facing === "north" ? -0.41 : 0.41;- return (- <group position={[desk.x, 0, desk.z + back]}>- <mesh geometry={BEAM_GEOMETRY} material={m.core} position={[0, 1.1 + BEAM_H / 2, 0]} renderOrder={3} />- <mesh geometry={BEAM_HALO} material={m.halo} position={[0, 1.1 + BEAM_H / 2, 0]} renderOrder={3} />- <mesh ref={ringMesh} geometry={RING_GEOMETRY} material={ripple} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.02, -back * 0.8]} renderOrder={3} />- </group>- );-}--// -----------------------------------------------------------------------------/** Every console of the coding floor, their status lights and beams, and the node towers. */-export function FoundryConsoles({ departments, occupants, animate }: {- departments: readonly Department[]; occupants: ReadonlyMap<string, PaneOccupant>; animate: boolean;-}) {- const infos = useMemo<DeskInfo[]>(() => departments.flatMap((dept) => {- // The light parts take the bay's colour at a set luminance; the seat its plain colour, darkened.- const bay = glowColour(baySignal(dept.tint), 0.8);- const seat = new Color(baySignal(dept.tint)).lerp(new Color("#1b1d22"), 0.55);- return dept.desks.map((desk) => {- const occupant = desk.agentId ? occupants.get(desk.agentId) : undefined;- return { desk, bay, seat, signal: occupant ? occupant.dot : "free" as DeskSignal };- });- }), [departments, occupants]);- const byFace = useMemo(() => {- const groups = new Map<ScreenFace, DeskSlot[]>(FACES.map((f) => [f, []]));- for (const info of infos) {- const occupant = info.desk.agentId ? occupants.get(info.desk.agentId) : undefined;- groups.get(occupant ? occupant.agent.state : "empty")!.push(info.desk);- }- return groups;- }, [infos, occupants]);- const beams = infos.filter((i) => i.signal === "waiting" || i.signal === "error");- return (- <group>- {PARTS.map((part, i) => <PartInstances key={`${i}:${infos.length}`} part={part} infos={infos} animate={animate} />)}- {FACES.map((face) => (byFace.get(face)!.length > 0 ? <ScreenInstances key={face} face={face} desks={byFace.get(face)!} /> : null))}- <NodeTowers departments={departments} animate={animate} />- {beams.map((info) => <SignalBeam key={info.desk.id} desk={info.desk} signal={info.signal as "waiting" | "error"} animate={animate} />)}- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryCore.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryCore.tsxdeleted file mode 100644index d4b31ed24d..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryCore.tsx+++ /dev/null@@ -1,230 +0,0 @@-/**- * The Core: the coding floor's landmark, hanging above the spawn terminal in- * the middle of the concourse. A plasma heart inside three gyroscope rings,- * held between two crowns of fins, with motes orbiting it and a column of- * light that runs from the terminal up into the nebula — visible from every- * corner of the deck.- *- * It reads the floor's real state and nothing else: the rings turn faster and- * the heart burns brighter the more panes are working, an idle floor lets it- * slow to a drift, and every packet of output that reaches it along a rail- * makes it flare (`coreSignal`). Reduced motion holds it still. When the- * camera comes down close underneath it, the hanging parts step aside so they- * never fill the view.- */-import { useEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, Color, CylinderGeometry, DoubleSide, Group, IcosahedronGeometry, InstancedMesh, Matrix4, MeshBasicMaterial,- RepeatWrapping, TorusGeometry, Vector3,-} from "three";-import { cachedCanvasTexture } from "./canvasMaterials";-import type { Point } from "./officeLayout";-import { FOUNDRY } from "./foundryPalette";-import { GEO, matte } from "./OfficeFurniture";--/** What the rails tell the Core: each arriving packet adds to `flash`, which decays every frame. */-export const coreSignal = { flash: 0 };--const HEART_Y = 5.2;-const COLUMN_H = 60;-const MOTES = 28;--/** A soft radial glow (white; tinted by the material). */-function drawHalo(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, w / 2);- g.addColorStop(0, "rgba(255,255,255,0.95)");- g.addColorStop(0.18, "rgba(255,255,255,0.45)");- g.addColorStop(0.5, "rgba(255,255,255,0.12)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);-}--/** Soft bands of light that rise up the column: the energy flowing into the sky (white; tinted). */-function drawFlow(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.clearRect(0, 0, w, h);- for (const [y, size, alpha] of [[0.12, 0.05, 0.9], [0.4, 0.03, 0.6], [0.63, 0.07, 0.75], [0.86, 0.025, 0.5]] as const) {- const g = ctx.createLinearGradient(0, (y - size) * h, 0, (y + size) * h);- g.addColorStop(0, "rgba(255,255,255,0)");- g.addColorStop(0.5, `rgba(255,255,255,${alpha})`);- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, (y - size) * h, w, size * 2 * h);- }-}--/** A column that is bright at its foot and fades out upwards, with fine vertical streaks (white; tinted). */-function drawColumn(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createLinearGradient(0, h, 0, 0);- g.addColorStop(0, "rgba(255,255,255,0.9)");- g.addColorStop(0.15, "rgba(255,255,255,0.45)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);- ctx.globalCompositeOperation = "destination-out";- for (let x = 0; x < w; x += 4) {- ctx.fillStyle = `rgba(0,0,0,${0.15 + ((x * 37) % 11) / 30})`;- ctx.fillRect(x, 0, 2, h);- }- ctx.globalCompositeOperation = "source-over";-}--const GEOM = {- heart: new IcosahedronGeometry(0.55, 3),- shell: new IcosahedronGeometry(0.78, 1),- ringA: new TorusGeometry(1.3, 0.075, 12, 96),- ringB: new TorusGeometry(1.65, 0.05, 10, 112),- ringC: new TorusGeometry(2.05, 0.03, 8, 128),- crown: new TorusGeometry(1.9, 0.1, 10, 64),- crownLow: new TorusGeometry(1.7, 0.09, 10, 64),- crownBand: new TorusGeometry(1.9, 0.045, 8, 64),- column: new CylinderGeometry(0.42, 0.42, COLUMN_H, 24, 1, true),- columnWide: new CylinderGeometry(1.0, 1.0, COLUMN_H, 24, 1, true),- mote: new IcosahedronGeometry(0.045, 0),-};--const MAT = {- gold: matte(FOUNDRY.gold, { roughness: 0.25, metalness: 0.9 }),- steel: matte(FOUNDRY.steel, { roughness: 0.4, metalness: 0.7 }),- heart: new MeshBasicMaterial({ color: new Color(FOUNDRY.plasma.heart).multiplyScalar(1.25), toneMapped: false }),- shell: new MeshBasicMaterial({- color: new Color(FOUNDRY.plasma.inner).multiplyScalar(1.2), wireframe: true, transparent: true, opacity: 0.55,- blending: AdditiveBlending, depthWrite: false, toneMapped: false,- }),- ringGlow: new MeshBasicMaterial({ color: new Color(FOUNDRY.code).multiplyScalar(2), toneMapped: false }),- fin: matte(FOUNDRY.steelDark, { roughness: 0.4, metalness: 0.7 }),- finLight: new MeshBasicMaterial({ color: new Color(FOUNDRY.code).multiplyScalar(1.6), toneMapped: false }),- mote: new MeshBasicMaterial({ color: new Color(FOUNDRY.plasma.inner).multiplyScalar(2.4), toneMapped: false }),-};--/** Unit vectors of the fins round a crown. */-const FINS = Array.from({ length: 10 }, (_, i) => (i / 10) * Math.PI * 2);--export function FoundryCore({ at, working, animate }: { at: Point; working: number; animate: boolean }) {- const materials = useMemo(() => {- const halo = cachedCanvasTexture("foundry:halo", 128, 128, drawHalo);- const column = cachedCanvasTexture("foundry:column", 64, 256, drawColumn);- const flowBase = cachedCanvasTexture("foundry:flow", 16, 256, drawFlow);- const flow = flowBase?.clone() ?? null;- if (flow) { flow.wrapS = flow.wrapT = RepeatWrapping; flow.repeat.set(1, 8); flow.needsUpdate = true; }- return {- flow: new MeshBasicMaterial({- map: flow, color: new Color(FOUNDRY.plasma.inner).multiplyScalar(0.4), transparent: true, depthWrite: false,- blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }),- halo: new MeshBasicMaterial({- map: halo, color: new Color(FOUNDRY.plasma.inner).multiplyScalar(0.5), transparent: true, depthWrite: false,- blending: AdditiveBlending, toneMapped: false,- }),- column: new MeshBasicMaterial({- map: column, color: new Color(FOUNDRY.plasma.inner).multiplyScalar(0.28), transparent: true, depthWrite: false,- blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }),- columnWide: new MeshBasicMaterial({- map: column, color: new Color(FOUNDRY.plasma.outer).multiplyScalar(0.12), transparent: true, depthWrite: false,- blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }),- };- }, []);- useEffect(() => () => {- materials.halo.dispose(); materials.column.dispose(); materials.columnWide.dispose(); materials.flow.map?.dispose(); materials.flow.dispose();- }, [materials]);-- const hanging = useRef<Group>(null);- const ringA = useRef<Group>(null);- const ringB = useRef<Group>(null);- const ringC = useRef<Group>(null);- const motes = useRef<InstancedMesh>(null);- const heart = useRef<Group>(null);- const halo = useRef<Group>(null);- const spin = useRef({ speed: 0.3, angle: 0 });- const moteSeeds = useMemo(() => Array.from({ length: MOTES }, (_, i) => ({- radius: 0.95 + ((i * 7) % 9) * 0.07, tilt: ((i * 13) % 17) / 17 * Math.PI, phase: (i / MOTES) * Math.PI * 2, rate: 0.6 + ((i * 5) % 7) * 0.12,- })), []);- const tmp = useMemo(() => ({ m: new Matrix4(), v: new Vector3() }), []);-- useFrame(({ camera, clock }, delta) => {- const step = Math.min(delta, 0.1);- // Busy floor, fast core: the target pace follows the panes at work, eased so a change never jerks.- const target = animate ? 0.18 + Math.min(working, 10) * 0.16 : 0;- spin.current.speed += (target - spin.current.speed) * Math.min(1, step * 1.5);- spin.current.angle += spin.current.speed * step;- const a = spin.current.angle;- // The bands rise with the core's pace.- if (materials.flow.map) materials.flow.map.offset.y = (materials.flow.map.offset.y - spin.current.speed * step * 0.6) % 1;- coreSignal.flash = Math.max(0, coreSignal.flash - step * 2.4);- const flash = animate ? Math.min(1.5, coreSignal.flash) : 0;- if (ringA.current) ringA.current.rotation.set(a * 1.1, a * 0.4, 0);- if (ringB.current) ringB.current.rotation.set(0.6, a * -0.8, a * 0.9);- if (ringC.current) ringC.current.rotation.set(Math.PI / 2 + Math.sin(a * 0.3) * 0.25, 0, a * 0.5);- const breath = animate ? Math.sin(clock.elapsedTime * (1.2 + working * 0.15)) * 0.06 : 0;- const glow = 0.8 + Math.min(working, 10) * 0.05 + flash * 0.5;- if (heart.current) heart.current.scale.setScalar(glow + breath);- if (halo.current) {- halo.current.quaternion.copy(camera.quaternion);- halo.current.scale.setScalar(2.8 * (glow + breath * 2));- }- if (motes.current) {- moteSeeds.forEach((s, i) => {- const angle = s.phase + a * s.rate * 2;- tmp.v.set(Math.cos(angle) * s.radius, Math.sin(angle) * s.radius * Math.cos(s.tilt), Math.sin(angle) * s.radius * Math.sin(s.tilt));- tmp.m.makeTranslation(tmp.v.x, tmp.v.y, tmp.v.z);- motes.current!.setMatrixAt(i, tmp.m);- });- motes.current.instanceMatrix.needsUpdate = true;- }- // Step aside when the camera is under the hanging parts.- if (hanging.current) {- const close = Math.hypot(camera.position.x - at.x, camera.position.z - at.z) < 4.5 && camera.position.y < HEART_Y + 2.5;- hanging.current.visible = !close;- }- });-- return (- <group position={[at.x, 0, at.z]}>- {/* The column of light, from the terminal up into the sky. */}- <mesh geometry={GEOM.column} material={materials.column} position={[0, COLUMN_H / 2 + 2.2, 0]} renderOrder={3} />- <mesh geometry={GEOM.columnWide} material={materials.columnWide} position={[0, COLUMN_H / 2 + 2.2, 0]} renderOrder={3} />- <mesh geometry={GEOM.column} material={materials.flow} position={[0, COLUMN_H / 2 + 2.2, 0]} scale={[1.08, 1, 1.08]} renderOrder={3} />- <group ref={hanging}>- {/* Lower crown, fins pointing up. */}- <group position={[0, 3.25, 0]}>- <mesh geometry={GEOM.crownLow} material={MAT.steel} rotation={[Math.PI / 2, 0, 0]} castShadow />- {FINS.map((angle) => (- <group key={angle} rotation={[0, angle, 0]}>- <mesh geometry={GEO.box} material={MAT.fin} position={[1.7, 0.35, 0]} scale={[0.08, 0.7, 0.32]} rotation={[0, 0, 0.35]} castShadow />- <mesh geometry={GEO.box} material={MAT.finLight} position={[1.6, 0.45, 0]} scale={[0.012, 0.5, 0.04]} rotation={[0, 0, 0.35]} />- </group>- ))}- </group>- {/* Upper crown, fins pointing down, with a gold band. */}- <group position={[0, 7.4, 0]}>- <mesh geometry={GEOM.crown} material={MAT.steel} rotation={[Math.PI / 2, 0, 0]} castShadow />- <mesh geometry={GEOM.crownBand} material={MAT.gold} rotation={[Math.PI / 2, 0, 0]} position={[0, 0.14, 0]} />- {FINS.map((angle) => (- <group key={angle} rotation={[0, angle + Math.PI / 10, 0]}>- <mesh geometry={GEO.box} material={MAT.fin} position={[1.82, -0.42, 0]} scale={[0.08, 0.8, 0.3]} rotation={[0, 0, -0.3]} castShadow />- <mesh geometry={GEO.box} material={MAT.finLight} position={[1.73, -0.47, 0]} scale={[0.012, 0.55, 0.04]} rotation={[0, 0, -0.3]} />- </group>- ))}- </group>- <group position={[0, HEART_Y, 0]}>- <group ref={ringA}><mesh geometry={GEOM.ringA} material={MAT.gold} castShadow /></group>- <group ref={ringB}><mesh geometry={GEOM.ringB} material={MAT.steel} castShadow /></group>- <group ref={ringC}><mesh geometry={GEOM.ringC} material={MAT.ringGlow} /></group>- <group ref={heart}>- <mesh geometry={GEOM.heart} material={MAT.heart} />- <mesh geometry={GEOM.shell} material={MAT.shell} />- </group>- <instancedMesh ref={motes} args={[GEOM.mote, MAT.mote, MOTES]} frustumCulled={false} />- <group ref={halo}>- <mesh material={materials.halo} renderOrder={4}>- <planeGeometry args={[1, 1]} />- </mesh>- </group>- </group>- </group>- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryDeck.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryDeck.tsxdeleted file mode 100644index 24e0e41f59..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryDeck.tsx+++ /dev/null@@ -1,497 +0,0 @@-/**- * The Foundry deck: the coding floor's slab, its concourse, the parapet, the- * data rails and the workspace bays (art/studies/coding-floor-foundry).- *- * Steel plates with gold trim on a hull floating in the nebula; the concourse- * between the bay columns runs to the Core at the spawn point; each bay is a- * plate framed by a light strip in its signal colour, with a truss gantry and- * its workspace's name as a holographic sign; and from every bay a data rail- * runs like a circuit trace to the Core's ring.- *- * Purely visual: the only solid part is the gantry, which stands inside the- * strip along each bay's north edge the layout already walks round.- */-import { useEffect, useMemo, useRef } from "react";-import { useFrame, type ThreeEvent } from "@react-three/fiber";-import {- AdditiveBlending, CanvasTexture, Color, DoubleSide, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, SRGBColorSpace, type Texture,-} from "three";-import { fill, useT } from "@/i18n";-import { cachedCanvasTexture, ownedCanvasTexture } from "./canvasMaterials";-import { Instances, type Placement } from "./Instances";-import { CORE_RING, type FoundryFrame, type Rail } from "./foundryLayout";-import { baySignal, FOUNDRY, glowColour } from "./foundryPalette";-import { GEO, matte } from "./OfficeFurniture";-import type { Department, OfficeLayout } from "./officeLayout";--/** Metres covered by one repeat of the deck plate texture and of a bay's grid. */-const DECK_METRES = 4;-const GRID_METRES = 2;--/** Deterministic pseudo-random numbers, so plates and scuffs never shimmer between loads. */-function lcg(seed: number): () => number {- let state = seed >>> 0;- return () => {- state = (state * 1664525 + 1013904223) >>> 0;- return state / 0x1_0000_0000;- };-}--/**- * Steel deck plates, 2 m × 1 m, laid like bricks: each plate its own tone with- * a lit upper bevel and a shadowed lower one, rivets in the corners, a vent- * grille now and then and fine scuffs. 512 px cover 4 m and wrap on both axes.- */-function drawDeck(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const { plates, seam } = FOUNDRY.deck;- const rand = lcg(0xdec4);- const px = w / DECK_METRES;- ctx.fillStyle = seam;- ctx.fillRect(0, 0, w, h);- const plateW = 2 * px, plateH = 1 * px;- for (let row = 0; row < DECK_METRES; row += 1) {- const offset = row % 2 === 0 ? 0 : plateW / 2;- for (let col = -1; col < DECK_METRES / 2 + 1; col += 1) {- const x = col * plateW + offset, y = row * plateH;- const tone = plates[Math.floor(rand() * plates.length)];- const vent = rand() < 0.12;- for (const dx of [-w, 0, w]) {- const x0 = x + dx + 2, y0 = y + 2, pw = plateW - 4, ph = plateH - 4;- if (x0 > w || x0 + pw < 0) continue;- ctx.fillStyle = tone;- ctx.fillRect(x0, y0, pw, ph);- // Bevel: light along the top and left edges, dark along the bottom and right.- ctx.fillStyle = "rgba(255,255,255,0.06)";- ctx.fillRect(x0, y0, pw, 2);- ctx.fillRect(x0, y0, 2, ph);- ctx.fillStyle = "rgba(0,0,0,0.28)";- ctx.fillRect(x0, y0 + ph - 2, pw, 2);- ctx.fillRect(x0 + pw - 2, y0, 2, ph);- // Rivets in the corners.- for (const [rx, ry] of [[8, 8], [pw - 8, 8], [8, ph - 8], [pw - 8, ph - 8]]) {- ctx.fillStyle = "rgba(0,0,0,0.45)";- ctx.beginPath(); ctx.arc(x0 + rx + 0.6, y0 + ry + 0.6, 2.4, 0, Math.PI * 2); ctx.fill();- ctx.fillStyle = "rgba(200,205,215,0.35)";- ctx.beginPath(); ctx.arc(x0 + rx, y0 + ry, 1.8, 0, Math.PI * 2); ctx.fill();- }- if (vent) {- // A vent grille: slots across the plate's middle.- ctx.fillStyle = "rgba(0,0,0,0.5)";- for (let s = 0; s < 9; s += 1) ctx.fillRect(x0 + pw * 0.25 + s * (pw * 0.5 / 9), y0 + ph * 0.3, pw * 0.5 / 18, ph * 0.4);- }- }- }- }- // Fine scuffs and grain.- for (let i = 0; i < 2600; i += 1) {- ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.035)" : "rgba(0,0,0,0.12)";- ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1 + Math.floor(rand() * 3), 1);- }-}--/** A bay's tech grid: dark field, a line every 0.5 m and a brighter one every 2 m (white; the material tints it). */-function drawGrid(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.fillStyle = "#16181d";- ctx.fillRect(0, 0, w, h);- const step = w / (GRID_METRES * 2);- ctx.fillStyle = "rgba(255,255,255,0.10)";- for (let i = 0; i < GRID_METRES * 2; i += 1) {- ctx.fillRect(i * step, 0, 1.5, h);- ctx.fillRect(0, i * step, w, 1.5);- }- ctx.fillStyle = "rgba(255,255,255,0.28)";- ctx.fillRect(0, 0, 3, h);- ctx.fillRect(0, 0, w, 3);- // Small crosses where the major lines meet.- ctx.fillStyle = "rgba(255,255,255,0.5)";- ctx.fillRect(0, 0, 12, 3);- ctx.fillRect(0, 0, 3, 12);- ctx.fillRect(w - 9, 0, 9, 3);- ctx.fillRect(0, h - 9, 3, 9);-}--/** The concourse floor: long steel planks along its length with gold chevrons pointing at the Core every 4 m. */-function drawConcourse(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const rand = lcg(0xc0c0);- ctx.fillStyle = FOUNDRY.deck.seam;- ctx.fillRect(0, 0, w, h);- const planks = 8, pw = w / planks;- for (let i = 0; i < planks; i += 1) {- ctx.fillStyle = ["#2d3139", "#30353d", "#2a2e35"][Math.floor(rand() * 3)];- ctx.fillRect(i * pw + 1.5, 0, pw - 3, h);- ctx.fillStyle = "rgba(255,255,255,0.05)";- ctx.fillRect(i * pw + 1.5, 0, 1.5, h);- }- for (let i = 0; i < 1600; i += 1) {- ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.03)" : "rgba(0,0,0,0.1)";- ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1, 2 + Math.floor(rand() * 4));- }-}--/** The Core's floor ring: a segmented gold band with tick marks, two thin code-cyan rings inside it. */-function drawCoreRing(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.clearRect(0, 0, w, h);- const c = w / 2, scale = w / (CORE_RING.outer * 2);- const ring = (r: number, width: number, colour: string, dash: number[] = []) => {- ctx.strokeStyle = colour; ctx.lineWidth = width; ctx.setLineDash(dash);- ctx.beginPath(); ctx.arc(c, c, r * scale, 0, Math.PI * 2); ctx.stroke();- };- ring(CORE_RING.outer - 0.12, 0.16 * scale, FOUNDRY.gold, [0.55 * scale, 0.12 * scale]);- ring(CORE_RING.outer - 0.32, 0.03 * scale, "rgba(216,174,82,0.7)");- for (let i = 0; i < 72; i += 1) {- const a = (i / 72) * Math.PI * 2, r0 = (CORE_RING.outer - 0.5) * scale, r1 = r0 - (i % 6 === 0 ? 0.22 : 0.1) * scale;- ctx.strokeStyle = "rgba(216,174,82,0.55)"; ctx.lineWidth = 2; ctx.setLineDash([]);- ctx.beginPath(); ctx.moveTo(c + Math.cos(a) * r0, c + Math.sin(a) * r0); ctx.lineTo(c + Math.cos(a) * r1, c + Math.sin(a) * r1); ctx.stroke();- }- ring(CORE_RING.inner + 0.25, 0.04 * scale, FOUNDRY.code);- ring(CORE_RING.inner + 0.05, 0.02 * scale, "rgba(95,230,255,0.6)", [0.2 * scale, 0.1 * scale]);-}--/** A cached base texture, cloned per surface with its own repeat. */-function repeated(base: Texture | null, repeatX: number, repeatZ: number): Texture | null {- if (!base) return null;- const map = base.clone();- map.wrapS = map.wrapT = RepeatWrapping;- map.anisotropy = 8;- map.repeat.set(repeatX, repeatZ);- map.needsUpdate = true;- return map;-}--/** A self-lit part at this luminance (above 1 = past the bloom threshold, whatever its hue); tone mapping stays off. */-function glow(colour: string, luminance = 1.4): MeshBasicMaterial {- return new MeshBasicMaterial({ color: glowColour(colour, luminance), toneMapped: false });-}--const DECK_MAT = {- hull: matte(FOUNDRY.hull, { roughness: 0.7, metalness: 0.4 }),- steel: matte(FOUNDRY.steel, { roughness: 0.45, metalness: 0.6 }),- steelDark: matte(FOUNDRY.steelDark, { roughness: 0.55, metalness: 0.5 }),- gold: matte(FOUNDRY.gold, { roughness: 0.3, metalness: 0.85 }),- glass: new MeshStandardMaterial({ color: "#9fd8ff", transparent: true, opacity: 0.12, roughness: 0.05, metalness: 0.2, side: DoubleSide, depthWrite: false }),- edgeLight: glow(FOUNDRY.code, 1.15),- porthole: glow("#ffd9a0", 1.25),- trim: glow(FOUNDRY.gold, 1.05),-};--/** The parapet's posts along the slab's edge, one every ~2.4 m, and the glass between them. */-const POST_SPACING = 2.4;--function edgePlacements(layout: OfficeLayout) {- const { minX, maxX, minZ, maxZ } = layout.bounds;- const inset = 0.2;- const x0 = minX + inset, x1 = maxX - inset, z0 = minZ + inset, z1 = maxZ - inset;- const posts: Placement[] = [];- const sides: [number, number, number, number][] = [[x0, z0, x1, z0], [x1, z0, x1, z1], [x1, z1, x0, z1], [x0, z1, x0, z0]];- for (const [ax, az, bx, bz] of sides) {- const len = Math.hypot(bx - ax, bz - az), n = Math.max(1, Math.round(len / POST_SPACING));- for (let i = 0; i < n; i += 1) {- const t = i / n;- posts.push({ position: [ax + (bx - ax) * t, 0.55, az + (bz - az) * t], scale: [0.09, 1.1, 0.09] });- }- }- // Portholes along the hull's south and east faces, where the camera looks at them.- const portholes: Placement[] = [];- for (let x = minX + 1; x < maxX - 0.5; x += 1.6) portholes.push({ position: [x, -0.55, maxZ + 0.005], scale: [0.7, 0.12, 0.02] });- for (let z = minZ + 1; z < maxZ - 0.5; z += 1.6) portholes.push({ position: [maxX + 0.005, -0.55, z], scale: [0.02, 0.12, 0.7] });- return { posts, portholes, x0, x1, z0, z1 };-}--/** The slab, its hull, the parapet and the concourse: everything of the deck that is not a bay or a rail. */-export function FoundrySlab({ layout, frame, onFloorClick }: {- layout: OfficeLayout; frame: FoundryFrame | null; onFloorClick: (event: ThreeEvent<MouseEvent>) => void;-}) {- const { minX, maxX, minZ, maxZ } = layout.bounds;- const w = maxX - minX, d = maxZ - minZ, cx = (minX + maxX) / 2, cz = (minZ + maxZ) / 2;- const floor = useMemo(() => {- const map = repeated(cachedCanvasTexture("foundry:deck", 512, 512, drawDeck), w / DECK_METRES, d / DECK_METRES);- return new MeshStandardMaterial({ color: map ? "#ffffff" : FOUNDRY.deck.base, map, roughness: 0.62, metalness: 0.35 });- }, [w, d]);- const concourse = frame?.concourse ?? null;- const runway = useMemo(() => {- if (!concourse) return null;- const cw = concourse.maxX - concourse.minX, cd = concourse.maxZ - concourse.minZ;- const map = repeated(cachedCanvasTexture("foundry:concourse", 256, 256, drawConcourse), cw / 3.2, cd / 3.2);- return new MeshStandardMaterial({ color: map ? "#ffffff" : FOUNDRY.steel, map, roughness: 0.4, metalness: 0.5 });- }, [concourse]);- useEffect(() => () => { floor.map?.dispose(); floor.dispose(); }, [floor]);- useEffect(() => () => { runway?.map?.dispose(); runway?.dispose(); }, [runway]);- const edge = useMemo(() => edgePlacements(layout), [layout]);- const glassRun = (from: [number, number], to: [number, number]) => {- const len = Math.hypot(to[0] - from[0], to[1] - from[1]), angle = Math.atan2(to[1] - from[1], to[0] - from[0]);- return (- <group key={`${from}-${to}`} position={[(from[0] + to[0]) / 2, 0, (from[1] + to[1]) / 2]} rotation={[0, -angle, 0]}>- <mesh geometry={GEO.box} material={DECK_MAT.glass} position={[0, 0.58, 0]} scale={[len, 0.96, 0.025]} />- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[0, 1.08, 0]} scale={[len, 0.04, 0.07]} castShadow />- <mesh geometry={GEO.box} material={DECK_MAT.steelDark} position={[0, 0.05, 0]} scale={[len, 0.1, 0.12]} />- <mesh geometry={GEO.box} material={DECK_MAT.edgeLight} position={[0, 0.105, 0.065]} scale={[len, 0.018, 0.01]} />- </group>- );- };- const { x0, x1, z0, z1 } = edge;- return (- <group>- {/* The hull: a thick dark slab with a gold lip and portholes along the faces the camera sees. */}- <mesh geometry={GEO.box} material={DECK_MAT.hull} position={[cx, -0.7, cz]} scale={[w, 1.4, d]} receiveShadow />- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[cx, -0.04, cz]} scale={[w + 0.06, 0.08, d + 0.06]} />- <mesh geometry={GEO.box} material={DECK_MAT.hull} position={[cx, -1.55, cz]} scale={[w * 0.82, 0.3, d * 0.82]} />- <Instances geometry={GEO.box} material={DECK_MAT.porthole} items={edge.portholes} cast={false} />- <mesh position={[cx, 0.001, cz]} rotation={[-Math.PI / 2, 0, 0]} material={floor} receiveShadow onClick={onFloorClick}>- <planeGeometry args={[w, d]} />- </mesh>- {concourse && runway && (- <group>- <mesh position={[(concourse.minX + concourse.maxX) / 2, 0.003, (concourse.minZ + concourse.maxZ) / 2]} rotation={[-Math.PI / 2, 0, 0]}- material={runway} receiveShadow onClick={onFloorClick}>- <planeGeometry args={[concourse.maxX - concourse.minX, concourse.maxZ - concourse.minZ]} />- </mesh>- {/* Gold trim along both edges of the concourse. */}- {[concourse.minX + 0.05, concourse.maxX - 0.05].map((x) => (- <mesh key={x} geometry={GEO.box} material={DECK_MAT.trim} position={[x, 0.005, (concourse.minZ + concourse.maxZ) / 2]}- scale={[0.05, 0.004, concourse.maxZ - concourse.minZ]} />- ))}- </group>- )}- <Instances geometry={GEO.box} material={DECK_MAT.steel} items={edge.posts} />- {glassRun([x0, z0], [x1, z0])}- {glassRun([x1, z0], [x1, z1])}- {glassRun([x1, z1], [x0, z1])}- {glassRun([x0, z1], [x0, z0])}- </group>- );-}--// ----------------------------------------------------------------------------// Data rails and the Core's ring-// -----------------------------------------------------------------------------const railMaterials = new Map<number, MeshBasicMaterial>();-function railMaterial(tint: number): MeshBasicMaterial {- let m = railMaterials.get(tint);- if (!m) { m = glow(baySignal(tint), 1.1); railMaterials.set(tint, m); }- return m;-}--const RAIL_W = 0.06;--/** One rail as flat glowing strips, a via pad where it leaves its bay and a joint at every turn. */-function RailTrace({ rail }: { rail: Rail }) {- const material = railMaterial(rail.tint);- const segments = rail.points.slice(1).map((b, i) => {- const a = rail.points[i];- const len = Math.hypot(b.x - a.x, b.z - a.z);- return { key: i, x: (a.x + b.x) / 2, z: (a.z + b.z) / 2, len, angle: Math.atan2(b.z - a.z, b.x - a.x) };- });- const start = rail.points[0];- return (- <group>- {segments.map((s) => (- <mesh key={s.key} geometry={GEO.box} material={material} position={[s.x, 0.006, s.z]} rotation={[0, -s.angle, 0]}- scale={[s.len + RAIL_W, 0.004, RAIL_W]} />- ))}- <mesh geometry={GEO.cyl} material={DECK_MAT.gold} position={[start.x, 0.006, start.z]} scale={[0.13, 0.006, 0.13]} />- <mesh geometry={GEO.cyl} material={material} position={[start.x, 0.009, start.z]} scale={[0.07, 0.006, 0.07]} />- </group>- );-}--/** Every bay's rail and the Core's ring on the floor round the spawn terminal. */-export function FoundryRails({ frame }: { frame: FoundryFrame }) {- const ringMaterial = useMemo(() => {- const map = cachedCanvasTexture("foundry:core-ring", 512, 512, drawCoreRing);- return new MeshBasicMaterial({ map, transparent: true, depthWrite: false, toneMapped: false, color: new Color("#ffffff").multiplyScalar(1.15) });- }, []);- useEffect(() => () => ringMaterial.dispose(), [ringMaterial]);- return (- <group>- {frame.rails.map((rail) => <RailTrace key={rail.deptId} rail={rail} />)}- <mesh position={[frame.core.x, 0.008, frame.core.z]} rotation={[-Math.PI / 2, 0, 0]} material={ringMaterial}>- <planeGeometry args={[CORE_RING.outer * 2, CORE_RING.outer * 2]} />- </mesh>- </group>- );-}--// ----------------------------------------------------------------------------// Bays-// -----------------------------------------------------------------------------const GANTRY = { h: 3.0, post: 0.16, panelH: 1.15, beamH: 0.18 } as const;-const SIGN = { w: 1024, h: 256 } as const;--/** The holographic sign: the workspace's name in tracked capitals, the bay number above it, scan lines over both (white; tinted). */-function drawSign(label: string, caption: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.clearRect(0, 0, w, h);- ctx.textBaseline = "middle";- ctx.textAlign = "left";- const tracked = (text: string, font: string, y: number, spacing: number, alpha: number) => {- ctx.font = font;- const chars = [...text];- const widths = chars.map((ch) => ctx.measureText(ch).width);- const total = widths.reduce((s, cw) => s + cw, 0) + spacing * Math.max(0, chars.length - 1);- const scale = Math.min(1, (w - 80) / total);- ctx.save();- ctx.translate(w / 2, y);- ctx.scale(scale, 1);- let x = -total / 2;- ctx.fillStyle = `rgba(255,255,255,${alpha})`;- chars.forEach((ch, i) => { ctx.fillText(ch, x, 0); x += widths[i] + spacing; });- ctx.restore();- };- const name = label.length > 22 ? `${label.slice(0, 21)}…` : label;- tracked(caption, "600 30px system-ui, -apple-system, 'Segoe UI', sans-serif", 44, 14, 0.75);- tracked(name.toUpperCase(), "800 104px system-ui, -apple-system, 'Segoe UI', sans-serif", 144, 8, 1);- // Bracket corners and an underline, like a heads-up display.- ctx.fillStyle = "rgba(255,255,255,0.8)";- for (const [x, y, sx, sy] of [[16, 16, 1, 1], [w - 16, 16, -1, 1], [16, h - 16, 1, -1], [w - 16, h - 16, -1, -1]] as const) {- ctx.fillRect(x, y, 46 * sx, 4 * sy);- ctx.fillRect(x, y, 4 * sx, 46 * sy);- }- ctx.fillRect(w / 2 - 120, 214, 240, 4);- // Scan lines.- ctx.globalCompositeOperation = "destination-out";- ctx.fillStyle = "rgba(0,0,0,0.35)";- for (let y = 0; y < h; y += 4) ctx.fillRect(0, y, w, 1.5);- ctx.globalCompositeOperation = "source-over";-}--/** A soft vertical fade from the projector up into the sign (white; tinted). */-function drawBeam(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createLinearGradient(0, h, 0, 0);- g.addColorStop(0, "rgba(255,255,255,0.55)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);- ctx.globalCompositeOperation = "destination-in";- const sides = ctx.createLinearGradient(0, 0, w, 0);- sides.addColorStop(0, "rgba(0,0,0,0)");- sides.addColorStop(0.2, "rgba(0,0,0,1)");- sides.addColorStop(0.8, "rgba(0,0,0,1)");- sides.addColorStop(1, "rgba(0,0,0,0)");- ctx.fillStyle = sides;- ctx.fillRect(0, 0, w, h);-}--/** A warm pool of light thrown down in front of a gantry (white centre fading out). */-function drawPool(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, w / 2);- g.addColorStop(0, "rgba(255,255,255,0.5)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);-}--interface BayKit { strip: MeshBasicMaterial; plate: MeshStandardMaterial; sign: MeshBasicMaterial; beam: MeshBasicMaterial; pool: MeshBasicMaterial; texture: CanvasTexture | null }--/** The gantry with the holographic sign, the plate and its light strip, for one bay. */-function useBayKit(dept: Department, label: string, caption: string): BayKit {- const colour = baySignal(dept.tint);- const w = dept.maxX - dept.minX, d = dept.maxZ - dept.minZ;- const kit = useMemo<BayKit>(() => {- const plateMap = repeated(cachedCanvasTexture("foundry:grid", 256, 256, drawGrid), w / GRID_METRES, d / GRID_METRES);- const texture = ownedCanvasTexture(SIGN.w, SIGN.h, (ctx, cw, ch) => drawSign(label, caption, ctx, cw, ch)) as CanvasTexture | null;- if (texture) texture.colorSpace = SRGBColorSpace;- const tinted = new Color(colour);- return {- strip: glow(colour, 1.15),- plate: new MeshStandardMaterial({- color: plateMap ? new Color("#ffffff").lerp(tinted, 0.2) : "#16181d", map: plateMap, roughness: 0.5, metalness: 0.4,- emissive: tinted, emissiveMap: plateMap, emissiveIntensity: plateMap ? 0.08 : 0,- }),- sign: new MeshBasicMaterial({- map: texture, color: glowColour(colour, 1.5), transparent: true, depthWrite: false, blending: AdditiveBlending,- toneMapped: false, side: DoubleSide,- }),- beam: new MeshBasicMaterial({- map: cachedCanvasTexture("foundry:beam", 64, 128, drawBeam), color: glowColour(colour, 0.6), transparent: true,- depthWrite: false, blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }),- pool: new MeshBasicMaterial({- map: cachedCanvasTexture("foundry:pool", 128, 128, drawPool), color: new Color("#ffe2b8").multiplyScalar(0.45), transparent: true,- depthWrite: false, blending: AdditiveBlending, toneMapped: false,- }),- texture,- };- }, [colour, w, d, label, caption]);- useEffect(() => () => {- kit.strip.dispose(); kit.plate.map?.dispose(); kit.plate.dispose(); kit.sign.dispose(); kit.beam.dispose(); kit.pool.dispose(); kit.texture?.dispose();- }, [kit]);- return kit;-}--const STRIP = 0.045;--/**- * One workspace as a bay: a grid plate framed by a light strip in its signal- * colour with gold corner brackets, and on its north edge a truss gantry: a- * dark back panel with a light slit, two posts, a beam with a downlight, and- * the workspace's name as a hologram over a gold projector bar.- */-export function FoundryBay({ dept, animate }: { dept: Department; animate: boolean }) {- const t = useT();- const label = dept.label || t("society.office.bay_free");- const caption = fill(t("society.office.bay_n"), { number: String(dept.tint + 1).padStart(2, "0") });- const kit = useBayKit(dept, label, caption);- const w = dept.maxX - dept.minX, d = dept.maxZ - dept.minZ;- const cx = (dept.minX + dept.maxX) / 2, cz = (dept.minZ + dept.maxZ) / 2;- const gw = w - 0.4, gz = dept.minZ + 0.11;- const signW = Math.min(gw * 0.78, 5.2), signH = (signW * SIGN.h) / SIGN.w;- const signRef = useRef<MeshBasicMaterial>(kit.sign);- signRef.current = kit.sign;- const seed = useMemo(() => dept.tint * 1.37 + 0.5, [dept.tint]);- useFrame(({ clock }) => {- if (!animate) return;- // A hologram hums: a slow breath and, now and then, a short flicker.- const time = clock.elapsedTime + seed;- const flicker = Math.sin(time * 37) > 0.97 ? 0.55 : 1;- signRef.current.opacity = (0.86 + Math.sin(time * 1.3) * 0.08) * flicker;- });- const corners: [number, number, number, number][] = [- [dept.minX, dept.minZ, 1, 1], [dept.maxX, dept.minZ, -1, 1], [dept.minX, dept.maxZ, 1, -1], [dept.maxX, dept.maxZ, -1, -1],- ];- return (- <group>- <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.plate} receiveShadow>- <planeGeometry args={[w, d]} />- </mesh>- {/* The light strip round the plate. */}- <mesh geometry={GEO.box} material={kit.strip} position={[cx, 0.008, dept.minZ + STRIP / 2]} scale={[w, 0.006, STRIP]} />- <mesh geometry={GEO.box} material={kit.strip} position={[cx, 0.008, dept.maxZ - STRIP / 2]} scale={[w, 0.006, STRIP]} />- <mesh geometry={GEO.box} material={kit.strip} position={[dept.minX + STRIP / 2, 0.008, cz]} scale={[STRIP, 0.006, d]} />- <mesh geometry={GEO.box} material={kit.strip} position={[dept.maxX - STRIP / 2, 0.008, cz]} scale={[STRIP, 0.006, d]} />- {corners.map(([x, z, sx, sz]) => (- <group key={`${x}:${z}`}>- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[x + sx * 0.35, 0.012, z + sz * 0.06]} scale={[0.7, 0.012, 0.12]} />- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[x + sx * 0.06, 0.012, z + sz * 0.35]} scale={[0.12, 0.012, 0.7]} />- </group>- ))}- {/* Gantry */}- <group position={[cx, 0, gz]}>- <mesh geometry={GEO.box} material={DECK_MAT.steelDark} position={[0, GANTRY.panelH / 2, -0.02]} scale={[gw, GANTRY.panelH, 0.1]} castShadow receiveShadow />- <mesh geometry={GEO.box} material={kit.strip} position={[0, GANTRY.panelH - 0.16, 0.035]} scale={[gw - 0.3, 0.025, 0.01]} />- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[0, GANTRY.panelH + 0.015, -0.02]} scale={[gw + 0.02, 0.03, 0.13]} />- {[-1, 1].map((side) => (- <group key={side} position={[side * (gw / 2 - GANTRY.post / 2), 0, 0]}>- <mesh geometry={GEO.box} material={DECK_MAT.steel} position={[0, GANTRY.h / 2, 0]} scale={[GANTRY.post, GANTRY.h, GANTRY.post]} castShadow />- <mesh geometry={GEO.box} material={kit.strip} position={[-side * (GANTRY.post / 2 + 0.006), GANTRY.h / 2 + 0.3, 0]}- scale={[0.01, GANTRY.h - 1.2, 0.04]} />- </group>- ))}- <mesh geometry={GEO.box} material={DECK_MAT.steel} position={[0, GANTRY.h, 0]} scale={[gw, GANTRY.beamH, 0.24]} castShadow />- <mesh geometry={GEO.box} material={DECK_MAT.porthole} position={[0, GANTRY.h - GANTRY.beamH / 2 - 0.006, 0.06]} scale={[gw - 0.4, 0.012, 0.05]} />- {/* The projector bar, its fan of light, and the sign it throws. */}- <mesh geometry={GEO.box} material={DECK_MAT.gold} position={[0, GANTRY.panelH + 0.08, 0.06]} scale={[signW * 0.5, 0.05, 0.08]} />- <mesh position={[0, GANTRY.panelH + 0.1 + 0.3, 0.07]} material={kit.beam}>- <planeGeometry args={[signW * 0.9, 0.6]} />- </mesh>- <mesh position={[0, GANTRY.panelH + 0.18 + signH / 2 + 0.12, 0.08]} material={kit.sign} renderOrder={2}>- <planeGeometry args={[signW, signH]} />- </mesh>- </group>- {/* The downlight's pool in front of the gantry. */}- <mesh position={[cx, 0.011, gz + 1.4]} rotation={[-Math.PI / 2, 0, 0]} material={kit.pool}>- <planeGeometry args={[gw * 0.95, 2.8]} />- </mesh>- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryLife.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryLife.tsxdeleted file mode 100644index 55b08c0c7f..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryLife.tsx+++ /dev/null@@ -1,167 +0,0 @@-/**- * What moves on the Foundry deck besides the figures: rings of light where the- * person's character steps, and a few maintenance drones circling over the- * bays with a scanner cone under each. Reduced motion stills both (the drones- * hover in place, no rings).- */-import { useEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, Color, ConeGeometry, DoubleSide, Group, Mesh, MeshBasicMaterial, MeshStandardMaterial, RingGeometry, SphereGeometry,-} from "three";-import { RoundedBoxGeometry } from "three-stdlib";-import { cachedCanvasTexture } from "./canvasMaterials";-import { FOUNDRY, glowColour } from "./foundryPalette";-import { GEO } from "./OfficeFurniture";-import type { OfficeLayout } from "./officeLayout";-import { player } from "./officeStore";--// ----------------------------------------------------------------------------// Footsteps-// -----------------------------------------------------------------------------const STEP_S = 0.32;-const RING_LIFE_S = 0.75;-const RINGS = 8;-const STEP_RING = new RingGeometry(0.2, 0.26, 40);--function Footsteps() {- const meshes = useRef<(Mesh | null)[]>([]);- const state = useRef({ next: 0, slot: 0, born: new Array<number>(RINGS).fill(-10) });- const materials = useMemo(() => Array.from({ length: RINGS }, () => new MeshBasicMaterial({- color: new Color(FOUNDRY.code).multiplyScalar(1.6), transparent: true, opacity: 0, depthWrite: false,- blending: AdditiveBlending, toneMapped: false,- })), []);- useEffect(() => () => materials.forEach((m) => m.dispose()), [materials]);- useFrame(({ clock }) => {- const t = clock.elapsedTime, s = state.current;- if (player.moving && t >= s.next) {- s.next = t + STEP_S;- const mesh = meshes.current[s.slot];- if (mesh) mesh.position.set(player.x, 0.015, player.z);- s.born[s.slot] = t;- s.slot = (s.slot + 1) % RINGS;- }- for (let i = 0; i < RINGS; i += 1) {- const mesh = meshes.current[i];- if (!mesh) continue;- const p = (t - s.born[i]) / RING_LIFE_S;- mesh.visible = p >= 0 && p < 1;- if (!mesh.visible) continue;- mesh.scale.setScalar(1 + p * 2.2);- materials[i].opacity = 0.7 * (1 - p) * (1 - p);- }- });- return (- <group>- {materials.map((material, i) => (- <mesh key={i} ref={(m) => { meshes.current[i] = m; }} geometry={STEP_RING} material={material} rotation={[-Math.PI / 2, 0, 0]}- visible={false} renderOrder={3} />- ))}- </group>- );-}--// ----------------------------------------------------------------------------// Drones-// -----------------------------------------------------------------------------const DRONE = {- body: new RoundedBoxGeometry(0.46, 0.13, 0.46, 2, 0.05),- rotor: new RingGeometry(0.02, 0.15, 20),- light: new SphereGeometry(0.03, 8, 6),- cone: new ConeGeometry(0.9, 2.6, 24, 1, true),-};--/** Fades along the cone from its apex down (white; tinted). */-function drawCone(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createLinearGradient(0, 0, 0, h);- g.addColorStop(0, "rgba(255,255,255,0.55)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);-}--const DMAT = {- body: new MeshStandardMaterial({ color: "#2a2e36", roughness: 0.35, metalness: 0.7 }),- trim: new MeshStandardMaterial({ color: FOUNDRY.gold, roughness: 0.3, metalness: 0.85 }),- rotor: new MeshBasicMaterial({ color: "#c8d6e6", transparent: true, opacity: 0.18, depthWrite: false, side: DoubleSide }),- red: new MeshBasicMaterial({ color: glowColour("#ff3b4e", 1.4), toneMapped: false }),- green: new MeshBasicMaterial({ color: glowColour("#5bff8f", 1.4), toneMapped: false }),- eye: new MeshBasicMaterial({ color: new Color(FOUNDRY.code).multiplyScalar(2.2), toneMapped: false }),-};--interface Route { cx: number; cz: number; rx: number; rz: number; y: number; speed: number; phase: number; wobble: number }--/** Each drone's loop over the deck: ellipses of different sizes round the floor's middle. Pure. */-export function droneRoutes(bounds: OfficeLayout["bounds"], count: number): Route[] {- const cx = (bounds.minX + bounds.maxX) / 2, cz = (bounds.minZ + bounds.maxZ) / 2;- const hw = (bounds.maxX - bounds.minX) / 2, hd = (bounds.maxZ - bounds.minZ) / 2;- return Array.from({ length: count }, (_, i) => ({- cx: cx + (i % 2 === 0 ? -1 : 1) * hw * 0.12,- cz: cz + ((i * 0.37) % 1 - 0.5) * hd * 0.3,- rx: hw * (0.45 + 0.12 * (i % 3)),- rz: hd * (0.35 + 0.1 * ((i + 1) % 3)),- y: 4.3 + (i % 3) * 0.35,- speed: (0.07 + 0.025 * i) * (i % 2 === 0 ? 1 : -1),- phase: (i / count) * Math.PI * 2,- wobble: 0.6 + i * 0.27,- }));-}--function Drone({ route, animate }: { route: Route; animate: boolean }) {- const ref = useRef<Group>(null);- const rotors = useRef<Group>(null);- const cone = useMemo(() => new MeshBasicMaterial({- map: cachedCanvasTexture("foundry:cone", 32, 128, drawCone), color: new Color(FOUNDRY.code).multiplyScalar(0.5),- transparent: true, depthWrite: false, blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }), []);- useEffect(() => () => cone.dispose(), [cone]);- const angle = useRef(route.phase);- useFrame(({ camera, clock }, delta) => {- const g = ref.current;- if (!g) return;- if (animate) angle.current += route.speed * Math.min(delta, 0.1);- const a = angle.current, t = clock.elapsedTime;- const x = route.cx + Math.cos(a) * route.rx, z = route.cz + Math.sin(a) * route.rz;- const y = route.y + (animate ? Math.sin(t * route.wobble) * 0.12 : 0);- g.position.set(x, y, z);- // Face along the loop, tilted a little into the direction of travel.- const vx = -Math.sin(a) * route.rx * Math.sign(route.speed), vz = Math.cos(a) * route.rz * Math.sign(route.speed);- g.rotation.set(0, Math.atan2(vx, vz), 0);- g.rotateX(animate ? 0.12 : 0);- if (rotors.current && animate) rotors.current.children.forEach((r, i) => { r.rotation.z = t * 40 + i; });- // Never in the camera's face.- g.visible = camera.position.distanceTo(g.position) > 2.2;- });- return (- <group ref={ref}>- <mesh geometry={DRONE.body} material={DMAT.body} castShadow />- <mesh geometry={GEO.box} material={DMAT.trim} position={[0, 0.07, 0]} scale={[0.3, 0.012, 0.3]} />- <mesh geometry={DRONE.light} material={DMAT.eye} position={[0, -0.03, 0.23]} scale={[1.6, 1, 1]} />- <group ref={rotors}>- {[[-0.3, -0.3], [0.3, -0.3], [-0.3, 0.3], [0.3, 0.3]].map(([x, z]) => (- <mesh key={`${x}${z}`} geometry={DRONE.rotor} material={DMAT.rotor} position={[x, 0.08, z]} rotation={[-Math.PI / 2, 0, 0]} />- ))}- </group>- {[[-0.3, -0.3], [0.3, -0.3], [-0.3, 0.3], [0.3, 0.3]].map(([x, z]) => (- <mesh key={`arm${x}${z}`} geometry={GEO.box} material={DMAT.body} position={[x / 2, 0.04, z / 2]} rotation={[0, Math.atan2(x, z), 0]}- scale={[0.04, 0.03, 0.42]} />- ))}- <mesh geometry={DRONE.light} material={DMAT.red} position={[-0.3, 0.02, 0.3]} />- <mesh geometry={DRONE.light} material={DMAT.green} position={[0.3, 0.02, 0.3]} />- {/* The scanner cone sweeping the deck below. */}- <mesh geometry={DRONE.cone} material={cone} position={[0, -1.35, 0]} renderOrder={3} />- </group>- );-}--export function FoundryLife({ layout, animate }: { layout: OfficeLayout; animate: boolean }) {- const routes = useMemo(() => droneRoutes(layout.bounds, 4), [layout.bounds]);- return (- <group>- {animate && <Footsteps />}- {routes.map((route, i) => <Drone key={i} route={route} animate={animate} />)}- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundryPulses.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundryPulses.tsxdeleted file mode 100644index 04d86cd61f..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundryPulses.tsx+++ /dev/null@@ -1,168 +0,0 @@-/**- * Packets of light on the data rails: whenever a pane prints something new,- * one packet leaves its bay along the bay's rail and runs to the Core, which- * flares when it arrives (`coreSignal`). Real output only: the trigger is the- * pane's `last_output_at` moving on in the shared pane poll, so a quiet floor- * sends nothing and a busy one hums.- *- * All packets are two instanced meshes (the bright body and its trail); a- * bay sends at most one packet per `GAP_S`, and at most `MAX_PACKETS` are on- * the rails at once.- */-import { useEffect, useLayoutEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import { AdditiveBlending, Color, DoubleSide, InstancedMesh, Matrix4, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3 } from "three";-import { useWorkspacePanesStore } from "@/store/workspacePanes";-import { cachedCanvasTexture } from "./canvasMaterials";-import { paneAgentId } from "./codingFloor";-import { coreSignal } from "./FoundryCore";-import { pointAlong, type FoundryFrame, type Rail } from "./foundryLayout";-import { baySignal, glowColour } from "./foundryPalette";-import { GEO } from "./OfficeFurniture";-import type { Department } from "./officeLayout";--const MAX_PACKETS = 48;-const SPEED = 7.5;-const GAP_S = 0.7;--interface Packet { rail: Rail; s: number; colour: Color }--/** Which bay each pane sits in, by the pane's office id. Pure. */-export function deptByAgent(departments: readonly Department[]): Map<string, string> {- const map = new Map<string, string>();- for (const dept of departments) for (const desk of dept.desks) if (desk.agentId) map.set(desk.agentId, dept.id);- return map;-}--/**- * The panes whose output moved on since `seen`, updating `seen`. The first- * reading only records (coming up to the floor fires nothing). Pure but for `seen`.- */-export function freshOutput(- panes: readonly { workspace_id: string; history_id: string; key: string; last_output_at: number | null }[],- seen: Map<string, number>, first: boolean,-): string[] {- const fresh: string[] = [];- const present = new Set<string>();- for (const pane of panes) {- if (pane.last_output_at == null) continue;- const id = paneAgentId(pane);- present.add(id);- const before = seen.get(id);- seen.set(id, pane.last_output_at);- if (!first && before !== undefined && pane.last_output_at > before) fresh.push(id);- }- // Forget panes that closed, so the record never outgrows the roster.- for (const id of [...seen.keys()]) if (!present.has(id)) seen.delete(id);- return fresh;-}--/** A packet's glow trail: brightest at its head, fading backwards (white; tinted per instance). */-function drawTrail(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const g = ctx.createLinearGradient(0, 0, w, 0);- g.addColorStop(0, "rgba(255,255,255,0)");- g.addColorStop(0.85, "rgba(255,255,255,0.7)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, w, h);- ctx.globalCompositeOperation = "destination-in";- const v = ctx.createLinearGradient(0, 0, 0, h);- v.addColorStop(0, "rgba(0,0,0,0)");- v.addColorStop(0.5, "rgba(0,0,0,1)");- v.addColorStop(1, "rgba(0,0,0,0)");- ctx.fillStyle = v;- ctx.fillRect(0, 0, w, h);-}--const TRAIL_GEOMETRY = new PlaneGeometry(1, 1);--export function FoundryPulses({ frame, departments, animate }: { frame: FoundryFrame; departments: readonly Department[]; animate: boolean }) {- const panes = useWorkspacePanesStore((s) => s.panes);- const rails = useMemo(() => new Map(frame.rails.map((r) => [r.deptId, r])), [frame]);- const bays = useMemo(() => deptByAgent(departments), [departments]);- const seen = useRef(new Map<string, number>());- const primed = useRef(false);- const packets = useRef<Packet[]>([]);- const lastSent = useRef(new Map<string, number>());- const clock = useRef(0);-- useEffect(() => {- const fresh = freshOutput(panes, seen.current, !primed.current);- primed.current = true;- if (!animate) return;- for (const id of fresh) {- const deptId = bays.get(id);- const rail = deptId ? rails.get(deptId) : undefined;- if (!rail || rail.points.length < 2) continue;- if (clock.current - (lastSent.current.get(rail.deptId) ?? -Infinity) < GAP_S) continue;- if (packets.current.length >= MAX_PACKETS) break;- lastSent.current.set(rail.deptId, clock.current);- packets.current.push({ rail, s: 0, colour: glowColour(baySignal(rail.tint), 2) });- }- }, [panes, bays, rails, animate]);-- const materials = useMemo(() => ({- body: new MeshBasicMaterial({ color: "#ffffff", toneMapped: false }),- trail: new MeshBasicMaterial({- map: cachedCanvasTexture("foundry:trail", 128, 16, drawTrail), color: "#ffffff", transparent: true, depthWrite: false,- blending: AdditiveBlending, toneMapped: false, side: DoubleSide,- }),- }), []);- useEffect(() => () => { materials.body.dispose(); materials.trail.dispose(); }, [materials]);- const body = useRef<InstancedMesh>(null);- const trail = useRef<InstancedMesh>(null);- const tmp = useMemo(() => ({- m: new Matrix4(), q: new Quaternion(), p: new Vector3(), s: new Vector3(), up: new Vector3(0, 1, 0),- // The trail's plane lies flat: a quarter turn about x, applied before the packet's heading.- flat: new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), -Math.PI / 2),- }), []);- const shown = useRef(0);- useLayoutEffect(() => {- for (const mesh of [body.current, trail.current]) if (mesh) mesh.count = 0;- }, []);-- useFrame((_, delta) => {- const step = Math.min(delta, 0.1);- clock.current += step;- const list = packets.current;- for (let i = list.length - 1; i >= 0; i -= 1) {- const packet = list[i];- packet.s += SPEED * step;- if (packet.s >= packet.rail.lengths[packet.rail.lengths.length - 1]) {- coreSignal.flash += 0.55;- list.splice(i, 1);- }- }- const b = body.current, tr = trail.current;- if (!b || !tr) return;- // Nothing on the rails and nothing drawn last frame: no upload.- if (list.length === 0 && shown.current === 0) return;- shown.current = list.length;- for (let i = 0; i < list.length; i += 1) {- const packet = list[i];- const at = pointAlong(packet.rail, packet.s);- const yaw = Math.atan2(-at.dz, at.dx);- tmp.q.setFromAxisAngle(tmp.up, yaw);- b.setMatrixAt(i, tmp.m.compose(tmp.p.set(at.x, 0.05, at.z), tmp.q, tmp.s.set(0.32, 0.05, 0.08)));- b.setColorAt(i, packet.colour);- // The trail lies flat on the floor behind the packet.- const back = 1.1;- tmp.q.setFromAxisAngle(tmp.up, yaw).multiply(tmp.flat);- tr.setMatrixAt(i, tmp.m.compose(tmp.p.set(at.x - at.dx * back / 2, 0.02, at.z - at.dz * back / 2), tmp.q, tmp.s.set(back + 0.3, 0.32, 1)));- tr.setColorAt(i, packet.colour);- }- b.count = list.length;- tr.count = list.length;- b.instanceMatrix.needsUpdate = true;- tr.instanceMatrix.needsUpdate = true;- if (b.instanceColor) b.instanceColor.needsUpdate = true;- if (tr.instanceColor) tr.instanceColor.needsUpdate = true;- });-- return (- <group>- <instancedMesh ref={body} args={[GEO.box, materials.body, MAX_PACKETS]} frustumCulled={false} />- <instancedMesh ref={trail} args={[TRAIL_GEOMETRY, materials.trail, MAX_PACKETS]} frustumCulled={false} renderOrder={3} />- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/FoundrySky.tsx b/jarvis/ui/web/frontend/src/components/society/office/FoundrySky.tsxdeleted file mode 100644index 6c791c13a7..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/FoundrySky.tsx+++ /dev/null@@ -1,184 +0,0 @@-/**- * The Foundry deck's sky: a nebula dome with a star field, and a ringed planet- * far below the deck's north-west edge, where the office camera (from the- * south-east, looking down) sees past the railing. All three are shaders on- * plain geometry, drawn behind everything (no depth write, no fog), so the sky- * costs three draw calls and no textures.- */-import { useEffect, useMemo } from "react";-import { useFrame } from "@react-three/fiber";-import { AdditiveBlending, BackSide, Color, DoubleSide, ShaderMaterial, Vector3 } from "three";-import { FOUNDRY } from "./foundryPalette";--const SKY_RADIUS = 520;-/** Render order of the planet (the sky follows it): after every opaque part of the deck. */-const SKY_ORDER = 1000;--const SKY_VERTEX = /* glsl */ `- varying vec3 vDir;- void main() {- vDir = normalize(position);- vec4 p = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- gl_Position = p.xyww;- }-`;--/** Value-noise FBM over the view direction; star cells hashed on a sphere grid. */-const SKY_FRAGMENT = /* glsl */ `- uniform float uTime;- uniform vec3 uDeep, uViolet, uMagenta, uTeal, uGlow;- varying vec3 vDir;- float hash(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }- float noise(vec3 p) {- vec3 i = floor(p), f = fract(p);- f = f * f * (3.0 - 2.0 * f);- float n000 = hash(i), n100 = hash(i + vec3(1,0,0)), n010 = hash(i + vec3(0,1,0)), n110 = hash(i + vec3(1,1,0));- float n001 = hash(i + vec3(0,0,1)), n101 = hash(i + vec3(1,0,1)), n011 = hash(i + vec3(0,1,1)), n111 = hash(i + vec3(1,1,1));- return mix(mix(mix(n000, n100, f.x), mix(n010, n110, f.x), f.y), mix(mix(n001, n101, f.x), mix(n011, n111, f.x), f.y), f.z);- }- float fbm(vec3 p) {- float v = 0.0, a = 0.5;- for (int i = 0; i < 5; i++) { v += a * noise(p); p = p * 2.03 + vec3(1.7, 9.2, 3.1); a *= 0.5; }- return v;- }- void main() {- vec3 d = normalize(vDir);- vec3 drift = vec3(uTime * 0.004, 0.0, uTime * 0.002);- float cloud = fbm(d * 2.2 + drift);- float wisp = fbm(d * 5.0 - drift * 2.0 + cloud * 1.6);- // A band of nebula across the sky, brightest where it crosses the north-west.- float band = smoothstep(0.55, 0.0, abs(d.y * 0.8 + d.x * 0.35 - 0.05 + (cloud - 0.5) * 0.6));- vec3 col = uDeep;- col = mix(col, uViolet, smoothstep(0.35, 0.8, cloud) * 0.85);- col = mix(col, uTeal, smoothstep(0.55, 0.9, wisp) * band * 0.7);- col = mix(col, uMagenta, smoothstep(0.6, 0.95, cloud * wisp * 1.6) * band * 0.6);- col += uGlow * pow(smoothstep(0.62, 1.0, wisp * band), 3.0) * 0.55;- col *= 0.55 + band * 0.6;- // Stars: one candidate per cell of a direction grid, a few of them bright.- vec3 cell = floor(d * 180.0);- float h = hash(cell);- float star = step(0.9965, h) * smoothstep(0.42, 0.0, length(fract(d * 180.0) - 0.5));- float twinkle = 0.6 + 0.4 * sin(uTime * (1.0 + h * 3.0) + h * 40.0);- col += vec3(0.85, 0.9, 1.0) * star * twinkle * (0.6 + 1.6 * step(0.9993, h));- gl_FragColor = vec4(col, 1.0);- }-`;--const PLANET_VERTEX = /* glsl */ `- varying vec3 vNormal;- varying vec3 vLocal;- varying vec3 vView;- void main() {- vLocal = normalize(position);- vNormal = normalize(normalMatrix * normal);- vec4 mv = modelViewMatrix * vec4(position, 1.0);- vView = normalize(-mv.xyz);- gl_Position = projectionMatrix * mv;- }-`;--const PLANET_FRAGMENT = /* glsl */ `- uniform vec3 uDay, uBand, uNight, uRim, uSun;- uniform float uTime;- varying vec3 vNormal;- varying vec3 vLocal;- varying vec3 vView;- float hash(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }- float noise(vec3 p) {- vec3 i = floor(p), f = fract(p);- f = f * f * (3.0 - 2.0 * f);- return mix(mix(mix(hash(i), hash(i + vec3(1,0,0)), f.x), mix(hash(i + vec3(0,1,0)), hash(i + vec3(1,1,0)), f.x), f.y),- mix(mix(hash(i + vec3(0,0,1)), hash(i + vec3(1,0,1)), f.x), mix(hash(i + vec3(0,1,1)), hash(i + vec3(1,1,1)), f.x), f.y), f.z);- }- void main() {- float lat = vLocal.y;- float turb = noise(vLocal * 6.0 + vec3(uTime * 0.01, 0.0, 0.0)) * 0.35 + noise(vLocal * 18.0) * 0.12;- float bands = 0.5 + 0.5 * sin(lat * 28.0 + turb * 6.0);- vec3 surface = mix(uDay, uBand, bands * 0.75);- float light = clamp(dot(normalize(vNormal), normalize(uSun)), 0.0, 1.0);- vec3 col = mix(uNight, surface, smoothstep(0.0, 0.55, light));- float fres = pow(1.0 - clamp(dot(normalize(vNormal), vView), 0.0, 1.0), 2.6);- col += uRim * fres * (0.35 + light * 0.9);- gl_FragColor = vec4(col, 1.0);- }-`;--const RING_VERTEX = /* glsl */ `- varying vec3 vPos;- void main() {- vPos = position;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }-`;--const RING_FRAGMENT = /* glsl */ `- uniform vec3 uRing;- uniform float uInner, uOuter;- varying vec3 vPos;- float hash(float n) { return fract(sin(n) * 43758.5453); }- void main() {- float r = (length(vPos.xy) - uInner) / (uOuter - uInner);- float lanes = 0.55 + 0.45 * sin(r * 90.0) * sin(r * 23.0 + 1.3);- float gap = smoothstep(0.42, 0.45, r) * (1.0 - smoothstep(0.49, 0.52, r));- float edge = smoothstep(0.0, 0.06, r) * (1.0 - smoothstep(0.9, 1.0, r));- float a = edge * lanes * (1.0 - gap * 0.85) * 0.32;- gl_FragColor = vec4(uRing * (0.45 + lanes * 0.35), a);- }-`;--const RING = { inner: 1.4, outer: 2.05 } as const;-/** The planet's radius: far out to the west, it fills a corner of the view, not the whole of it. */-const PLANET_R = 78;--/** The nebula dome, the planet and its ring; `animate` drifts the clouds and the planet's storms. */-export function FoundrySky({ centre, animate }: { centre: [number, number]; animate: boolean }) {- const materials = useMemo(() => {- const c = (hex: string) => new Color(hex);- const sky = new ShaderMaterial({- vertexShader: SKY_VERTEX, fragmentShader: SKY_FRAGMENT, side: BackSide, depthWrite: false, fog: false,- uniforms: {- uTime: { value: 0 }, uDeep: { value: c(FOUNDRY.nebula.deep) }, uViolet: { value: c(FOUNDRY.nebula.violet) },- uMagenta: { value: c(FOUNDRY.nebula.magenta) }, uTeal: { value: c(FOUNDRY.nebula.teal) }, uGlow: { value: c(FOUNDRY.nebula.glow) },- },- });- const planet = new ShaderMaterial({- vertexShader: PLANET_VERTEX, fragmentShader: PLANET_FRAGMENT, fog: false,- uniforms: {- uTime: { value: 0 }, uDay: { value: c(FOUNDRY.planet.day) }, uBand: { value: c(FOUNDRY.planet.band) },- uNight: { value: c(FOUNDRY.planet.night) }, uRim: { value: c(FOUNDRY.planet.rim) },- uSun: { value: new Vector3(0.6, 0.55, 0.4).normalize() },- },- });- const ring = new ShaderMaterial({- vertexShader: RING_VERTEX, fragmentShader: RING_FRAGMENT, side: DoubleSide, transparent: true, depthWrite: false,- blending: AdditiveBlending, fog: false,- uniforms: { uRing: { value: c(FOUNDRY.planet.ring) }, uInner: { value: PLANET_R * RING.inner }, uOuter: { value: PLANET_R * RING.outer } },- });- return { sky, planet, ring };- }, []);- useEffect(() => () => { materials.sky.dispose(); materials.planet.dispose(); materials.ring.dispose(); }, [materials]);- useFrame((_, delta) => {- if (!animate) return;- const step = Math.min(delta, 0.1);- materials.sky.uniforms.uTime.value += step;- materials.planet.uniforms.uTime.value += step;- });- const [cx, cz] = centre;- return (- <group>- {/* Sky and planet draw after the deck, so the depth test skips every pixel the deck already covers. */}- <mesh material={materials.sky} renderOrder={SKY_ORDER + 1} frustumCulled={false}>- <sphereGeometry args={[SKY_RADIUS, 48, 24]} />- </mesh>- {/* Far below the deck's north end, off to the right: the camera sees it beside the deck, not behind all of it. */}- <group position={[cx - 5, -190, cz - 330]} rotation={[0.32, 0.6, -0.18]}>- <mesh material={materials.planet} renderOrder={SKY_ORDER}>- <sphereGeometry args={[PLANET_R, 64, 32]} />- </mesh>- <mesh material={materials.ring} rotation={[-Math.PI / 2 + 0.22, 0, 0]} renderOrder={-8}>- <ringGeometry args={[PLANET_R * RING.inner, PLANET_R * RING.outer, 128, 1]} />- </mesh>- </group>- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/Instances.tsx b/jarvis/ui/web/frontend/src/components/society/office/Instances.tsxdeleted file mode 100644index 1d6a61094a..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/Instances.tsx+++ /dev/null@@ -1,39 +0,0 @@-/**- * One instanced mesh for every placement of a part: the floors' dressing- * (campus ground and fittings, the agents floor's ambience, the building- * shell, the Foundry deck) draws its repeated pieces through it, a draw call- * per part instead of one per piece.- */-import { useLayoutEffect, useRef } from "react";-import { Color, Euler, InstancedMesh, Matrix4, Quaternion, Vector3, type BufferGeometry, type Material } from "three";--export interface Placement {- position: [number, number, number];- scale: [number, number, number];- /** Rotation (x, y, z) in radians; absent = none. */- rotation?: [number, number, number];- color?: string;-}--const _m = new Matrix4(), _q = new Quaternion(), _e = new Euler(), _p = new Vector3(), _s = new Vector3(), _c = new Color();--export function Instances({ geometry, material, items, cast = true }: {- geometry: BufferGeometry; material: Material; items: readonly Placement[]; cast?: boolean;-}) {- const ref = useRef<InstancedMesh>(null);- useLayoutEffect(() => {- const mesh = ref.current;- if (!mesh) return;- items.forEach((item, i) => {- _e.set(...(item.rotation ?? [0, 0, 0]));- _m.compose(_p.set(...item.position), _q.setFromEuler(_e), _s.set(...item.scale));- mesh.setMatrixAt(i, _m);- if (item.color) mesh.setColorAt(i, _c.set(item.color));- });- mesh.count = items.length;- mesh.instanceMatrix.needsUpdate = true;- if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;- }, [items]);- if (items.length === 0) return null;- return <instancedMesh key={items.length} ref={ref} args={[geometry, material, items.length]} castShadow={cast} receiveShadow frustumCulled={false} />;-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsxindex 215f1245b7..2a9f0d389d 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx@@ -28,24 +28,6 @@ import { MeetingChair } from "./OfficeChairs";import { Bookshelf, Box, Couch, GEO, MAT, matte, Plant, Rounded, Rug } from "./OfficeFurniture";import { FURNITURE_SIZE, type Furniture, type FurnitureKind } from "./officeLayout";import { PROP_COLOURS as P } from "./officePalette";-import { FOUNDRY } from "./foundryPalette";-import { useFoundryLook } from "./foundryLook";--/** The surfaces of the shared lobby pieces, per look. */-const LOBBY_SURFACES = {- office: { wood: MAT.wood, woodDark: MAT.woodDark, body: MAT.deskBody, top: MAT.deskTop, shaft: matte(P.elevatorShaft) },- foundry: {- wood: matte(FOUNDRY.gold, { roughness: 0.3, metalness: 0.85 }),- woodDark: matte(FOUNDRY.steelDark, { roughness: 0.5, metalness: 0.5 }),- body: matte("#2b2f37", { roughness: 0.35, metalness: 0.55 }),- top: matte(FOUNDRY.steel, { roughness: 0.35, metalness: 0.6 }),- shaft: matte("#30343c", { roughness: 0.4, metalness: 0.6 }),- },-};--function useLobbySurfaces() {- return LOBBY_SURFACES[useFoundryLook() ? "foundry" : "office"];-}type Vec3 = [number, number, number];@@ -272,6 +254,7 @@ function drawMenu(ctx: CanvasRenderingContext2D, w: number, h: number, title: stconst PM = {steel: matte(P.steel, { roughness: 0.35, metalness: 0.25 }),steelDark: matte(P.steelDark, { roughness: 0.45, metalness: 0.2 }),+ shaft: matte(P.elevatorShaft),lockers: P.lockers.map((c) => matte(c)),lockerVent: matte(P.lockerVent),mug: matte(P.mug),@@ -362,13 +345,12 @@ const RECEPTION_SLATS = Array.from({ length: 15 }, (_, i) => -1.26 + i * 0.18);* main keys, so the desk reads as "ask here" from across the floor.*/function ReceptionDesk() {- const S = useLobbySurfaces();return (<group>{/* Back wall: dark panel, light slats, a gold light line on top. */}- <Box size={[2.8, 2.1, 0.05]} position={[0, 1.05, -0.42]} material={S.woodDark} />- {RECEPTION_SLATS.map((x) => <Box key={x} size={[0.07, 2.02, 0.03]} position={[x, 1.05, -0.38]} material={S.wood} />)}- <Box size={[2.8, 0.05, 0.1]} position={[0, 2.125, -0.405]} material={S.woodDark} />+ <Box size={[2.8, 2.1, 0.05]} position={[0, 1.05, -0.42]} material={MAT.woodDark} />+ {RECEPTION_SLATS.map((x) => <Box key={x} size={[0.07, 2.02, 0.03]} position={[x, 1.05, -0.38]} material={MAT.wood} />)}+ <Box size={[2.8, 0.05, 0.1]} position={[0, 2.125, -0.405]} material={MAT.woodDark} /><Box size={[2.7, 0.018, 0.02]} position={[0, 2.09, -0.345]} material={PM.gold} cast={false} />{/* Help display on the wall, facing the visitors. */}<Rounded size={[1.56, 0.64, 0.05]} radius={0.03} position={[0, 1.62, -0.34]} material={PM.displayFrame} />@@ -376,21 +358,21 @@ function ReceptionDesk() {<Box size={[0.6, 0.02, 0.012]} position={[0, 1.95, -0.32]} material={PM.gold} cast={false} />{/* Receptionist side: a low work surface on two pedestals and a keyboard. */}- <Rounded size={[2.5, 0.04, 0.3]} radius={0.015} position={[0, 0.74, -0.17]} material={S.top} />- <Box size={[0.36, 0.72, 0.26]} position={[-1.05, 0.36, -0.17]} material={S.body} />- <Box size={[0.36, 0.72, 0.26]} position={[1.05, 0.36, -0.17]} material={S.body} />+ <Rounded size={[2.5, 0.04, 0.3]} radius={0.015} position={[0, 0.74, -0.17]} material={MAT.deskTop} />+ <Box size={[0.36, 0.72, 0.26]} position={[-1.05, 0.36, -0.17]} material={MAT.deskBody} />+ <Box size={[0.36, 0.72, 0.26]} position={[1.05, 0.36, -0.17]} material={MAT.deskBody} /><Box size={[0.4, 0.02, 0.12]} position={[0.2, 0.77, -0.2]} material={MAT.keyboard} />{/* Visitor counter: plinth, body and wood end caps (body stops short of the caps: no coplanar faces). */}- <Box size={[2.64, 0.08, 0.34]} position={[0, 0.04, 0.22]} material={S.woodDark} />+ <Box size={[2.64, 0.08, 0.34]} position={[0, 0.04, 0.22]} material={MAT.woodDark} /><Box size={[2.5, 0.012, 0.012]} position={[0, 0.07, 0.395]} material={PM.gold} cast={false} />- <Rounded size={[2.6, 0.9, 0.38]} radius={0.12} position={[0, 0.53, 0.24]} material={S.body} />- <Rounded size={[0.1, 0.96, 0.42]} radius={0.03} position={[-1.35, 0.5, 0.23]} material={S.wood} />- <Rounded size={[0.1, 0.96, 0.42]} radius={0.03} position={[1.35, 0.5, 0.23]} material={S.wood} />- <Rounded size={[2.8, 0.05, 0.46]} radius={0.02} position={[0, 1.005, 0.22]} material={S.wood} />+ <Rounded size={[2.6, 0.9, 0.38]} radius={0.12} position={[0, 0.53, 0.24]} material={MAT.deskBody} />+ <Rounded size={[0.1, 0.96, 0.42]} radius={0.03} position={[-1.35, 0.5, 0.23]} material={MAT.wood} />+ <Rounded size={[0.1, 0.96, 0.42]} radius={0.03} position={[1.35, 0.5, 0.23]} material={MAT.wood} />+ <Rounded size={[2.8, 0.05, 0.46]} radius={0.02} position={[0, 1.005, 0.22]} material={MAT.wood} /><Box size={[2.5, 0.016, 0.012]} position={[0, 0.965, 0.432]} material={PM.gold} cast={false} />{/* Front feature panel with the info sign. */}- <Rounded size={[0.92, 0.62, 0.03]} radius={0.02} position={[0, 0.52, 0.43]} material={S.wood} />+ <Rounded size={[0.92, 0.62, 0.03]} radius={0.02} position={[0, 0.52, 0.43]} material={MAT.wood} /><mesh position={[0, 0.54, 0.448]} material={lazy.infoSign()}><circleGeometry args={[0.2, 40]} /></mesh>@@ -535,11 +517,10 @@ function RugPiece({ w, d }: { w: number; d: number }) {/** Steel elevator doors in a free-standing shaft block; doors face +z, wood slats on the back. */function Elevator() {- const S = useLobbySurfaces();return (<group>{/* The back stops 3 cm short of the slats' outer face: coplanar faces z-fight into stripes. */}- <Rounded size={[2.2, 2.4, 0.27]} radius={0.04} position={[0, 1.2, -0.035]} material={S.shaft} />+ <Rounded size={[2.2, 2.4, 0.27]} radius={0.04} position={[0, 1.2, -0.035]} material={PM.shaft} /><Box size={[0.1, 2.08, 0.06]} position={[-0.66, 1.04, 0.12]} material={PM.steelDark} /><Box size={[0.1, 2.08, 0.06]} position={[0.66, 1.04, 0.12]} material={PM.steelDark} /><Box size={[1.42, 0.1, 0.06]} position={[0, 2.13, 0.12]} material={PM.steelDark} />@@ -553,7 +534,7 @@ function Elevator() {<Box size={[0.035, 0.035, 0.01]} position={[0.9, 1.15, 0.122]} material={PM.indicatorLight} cast={false} /><Box size={[0.035, 0.035, 0.01]} position={[0.9, 1.05, 0.122]} material={PM.steelDark} cast={false} />{[-0.9, -0.54, -0.18, 0.18, 0.54, 0.9].map((x) => (- <Box key={x} size={[0.1, 2.1, 0.03]} position={[x, 1.1, -0.185]} material={S.woodDark} cast={false} />+ <Box key={x} size={[0.1, 2.1, 0.03]} position={[x, 1.1, -0.185]} material={MAT.woodDark} cast={false} />))}</group>);diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsxindex 304206da42..b50bdf11d4 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx@@ -4,13 +4,12 @@* Pattern textures and sign textures are drawn once and cached.*/import { useEffect, useMemo } from "react";-import { BoxGeometry, DoubleSide, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, type BufferGeometry, type Texture } from "three";+import { BoxGeometry, DoubleSide, MeshStandardMaterial, RepeatWrapping, type BufferGeometry, type Texture } from "three";import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";-import { Box, GEO, MAT, Rounded } from "./OfficeFurniture";-import { FOUNDRY, glowColour } from "./foundryPalette";+import { Box, MAT, Rounded } from "./OfficeFurniture";import { cachedCanvasTexture } from "./canvasMaterials";import { ARCH, archPosts, type Door, type Room, type RoomKind, type WallSegment } from "./officeLayout";-import { CAMPUS_ROOM_FLOORS, FOUNDRY_ROOM_FLOORS, OFFICE, ROOM_FLOOR_COLOURS } from "./officePalette";+import { CAMPUS_ROOM_FLOORS, OFFICE, ROOM_FLOOR_COLOURS } from "./officePalette";// ---------------------------------------------------------------------------// Floors@@ -31,15 +30,9 @@ const PATTERN_METRES: Record<RoomKind, number> = { lead: 2.6, team: 2, wardrobe:interface FloorTones { base: string; accents: readonly string[] }const CAMPUS_FLOORS: Partial<Record<RoomKind, FloorTones>> = CAMPUS_ROOM_FLOORS;-const FOUNDRY_FLOORS: Partial<Record<RoomKind, FloorTones>> = FOUNDRY_ROOM_FLOORS;--/** Which floor's materials the rooms take: the plain office's, the agents campus's or the coding floor's Foundry deck. */-export type RoomLook = "office" | "campus" | "foundry";--/** A room kind's floor tones: the agents floor's rooms wear the campus's finishes, the coding floor's the deck's. */-function floorTones(kind: RoomKind, look: RoomLook): FloorTones {- const own = look === "campus" ? CAMPUS_FLOORS[kind] : look === "foundry" ? FOUNDRY_FLOORS[kind] : undefined;- return own ?? ROOM_FLOOR_COLOURS[kind];+/** A room kind's floor tones: the agents floor's rooms wear the campus's finishes, every other floor its own. */+function floorTones(kind: RoomKind, campus: boolean): FloorTones {+ return (campus ? CAMPUS_FLOORS[kind] : undefined) ?? ROOM_FLOOR_COLOURS[kind];}function drawFloor(kind: RoomKind, { base, accents }: FloorTones, ctx: CanvasRenderingContext2D, w: number, h: number): void {@@ -158,10 +151,8 @@ function drawFloor(kind: RoomKind, { base, accents }: FloorTones, ctx: CanvasRenctx.fillStyle = accents[Math.floor(rand() * accents.length)];ctx.fillRect(tx * size, ty * size, size, size);if (kind === "reception") {- // Flecks in the stone; on a dark stone (the Foundry deck's) light flecks stay faint, or they read as noise.- const light = parseInt(base.slice(1, 3), 16) < 96 ? "rgba(255,255,255,0.05)" : "rgba(255,255,255,0.18)";for (let i = 0; i < 90; i += 1) {- ctx.fillStyle = rand() > 0.5 ? light : "rgba(120,110,95,0.12)";+ ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.18)" : "rgba(120,110,95,0.12)";ctx.fillRect(tx * size + rand() * size, ty * size + rand() * size, 3, 3);}}@@ -175,8 +166,8 @@ function drawFloor(kind: RoomKind, { base, accents }: FloorTones, ctx: CanvasRen}}-function floorTexture(kind: RoomKind, look: RoomLook): Texture | null {- const tones = floorTones(kind, look);+function floorTexture(kind: RoomKind, campus: boolean): Texture | null {+ const tones = floorTones(kind, campus);const texture = cachedCanvasTexture(`floor:${kind}:${tones.base}`, 256, 256, (ctx, w, h) => drawFloor(kind, tones, ctx, w, h));if (texture) {texture.wrapS = texture.wrapT = RepeatWrapping;@@ -185,23 +176,19 @@ function floorTexture(kind: RoomKind, look: RoomLook): Texture | null {return texture;}-function RoomFloor({ room, look }: { room: Room; look: RoomLook }) {+function RoomFloor({ room, campus }: { room: Room; campus: boolean }) {const w = room.maxX - room.minX;const d = room.maxZ - room.minZ;const material = useMemo(() => {- const base = floorTexture(room.kind, look);+ const base = floorTexture(room.kind, campus);let map: Texture | null = null;if (base) {map = base.clone();map.repeat.set(w / PATTERN_METRES[room.kind], d / PATTERN_METRES[room.kind]);map.needsUpdate = true;}- // The deck's rooms are polished: a little sheen, so the studio environment shows in them.- const foundry = look === "foundry";- return new MeshStandardMaterial({- color: map ? "#ffffff" : floorTones(room.kind, look).base, map, roughness: foundry ? 0.55 : 0.85, metalness: foundry ? 0.2 : 0,- });- }, [room.kind, look, w, d]);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : floorTones(room.kind, campus).base, map, roughness: 0.85 });+ }, [room.kind, campus, w, d]);// The clone and its material belong to this room; the cached base texture stays.useEffect(() => () => { material.map?.dispose(); material.dispose(); }, [material]);return (@@ -214,12 +201,10 @@ function RoomFloor({ room, look }: { room: Room; look: RoomLook }) {/*** A floor overlay per room: a plank chevron (lead), slate felt (team), terrazzo (wardrobe), pale stone (reception),- * light oak (break). `campus`: the agents floor, whose rooms take the campus's own oak, limestone and felt;- * `foundry`: the coding floor, whose rooms take the deck's dark stone, smoked walnut and slate.+ * light oak (break). `campus`: the agents floor, whose rooms take the campus's own oak, limestone and felt.*/-export function RoomFloors({ rooms, campus = false, foundry = false }: { rooms: Room[]; campus?: boolean; foundry?: boolean }) {- const look: RoomLook = foundry ? "foundry" : campus ? "campus" : "office";- return <group>{rooms.map((room) => <RoomFloor key={room.id} room={room} look={look} />)}</group>;+export function RoomFloors({ rooms, campus = false }: { rooms: Room[]; campus?: boolean }) {+ return <group>{rooms.map((room) => <RoomFloor key={room.id} room={room} campus={campus} />)}</group>;}// ---------------------------------------------------------------------------@@ -248,16 +233,7 @@ function boxAt(size: [number, number, number], position: [number, number, number* whatever its length: the whole frame is one merged geometry, the two* frosted bands another.*/-const FOUNDRY_WALL = {- frame: new MeshStandardMaterial({ color: FOUNDRY.steel, roughness: 0.4, metalness: 0.65 }),- glass: new MeshStandardMaterial({- color: "#8fd4ff", transparent: true, opacity: 0.1, roughness: 0.05, metalness: 0.2, side: DoubleSide, depthWrite: false,- }),- /** On the deck the frosted band is a strip of code light. */- band: new MeshBasicMaterial({ color: glowColour(FOUNDRY.code, 1.1), toneMapped: false }),-};--function GlassWall({ wall, foundry }: { wall: WallSegment; foundry: boolean }) {+function GlassWall({ wall }: { wall: WallSegment }) {const length = Math.hypot(wall.x2 - wall.x1, wall.z2 - wall.z1);const angle = Math.atan2(wall.z2 - wall.z1, wall.x2 - wall.x1);const parts = useMemo(() => {@@ -279,24 +255,19 @@ function GlassWall({ wall, foundry }: { wall: WallSegment; foundry: boolean }) {return (// The camera rig finds a wall run by this tag and lowers it while it stands between camera and character.<group position={[(wall.x1 + wall.x2) / 2, 0, (wall.z1 + wall.z2) / 2]} rotation={[0, -angle, 0]} userData={{ officeWall: wall }}>- {parts.frame && <mesh geometry={parts.frame} material={foundry ? FOUNDRY_WALL.frame : MAT.railing} castShadow receiveShadow />}+ {parts.frame && <mesh geometry={parts.frame} material={MAT.railing} castShadow receiveShadow />}<Box size={[length, WALL_HEIGHT - BASE_HEIGHT - 0.04, 0.02]} position={[0, (WALL_HEIGHT + BASE_HEIGHT - 0.04) / 2, 0]}- material={foundry ? FOUNDRY_WALL.glass : MAT.glass} cast={false} />- {foundry- ? <>- <mesh geometry={GEO.box} material={FOUNDRY_WALL.band} position={[0, FROST.stripeY, 0]} scale={[length, 0.02, 0.026]} />- <mesh geometry={GEO.box} material={FOUNDRY_WALL.band} position={[0, BASE_HEIGHT - 0.02, 0]} scale={[length, 0.015, 0.07]} />- </>- : parts.frost && <mesh geometry={parts.frost} material={frostMaterial} />}+ material={MAT.glass} cast={false} />+ {parts.frost && <mesh geometry={parts.frost} material={frostMaterial} />}</group>);}/** Glass walls, 2.1 m high, along every wall segment of the layout. */-export function RoomWalls({ walls, foundry = false }: { walls: WallSegment[]; foundry?: boolean }) {+export function RoomWalls({ walls }: { walls: WallSegment[] }) {return (<group>- {walls.map((wall) => <GlassWall key={`${wall.room}:${wall.x1}:${wall.z1}:${wall.x2}:${wall.z2}`} wall={wall} foundry={foundry} />)}+ {walls.map((wall) => <GlassWall key={`${wall.room}:${wall.x1}:${wall.z1}:${wall.x2}:${wall.z2}`} wall={wall} />)}</group>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsxindex 256e145e2e..b0578b2ed4 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx@@ -3,9 +3,9 @@* singularity (the coding floor in a starry violet night of its own) behind* frameless glass, walled rooms in the north and south and the desks in* between — and everybody in it. The agents floor is a team campus (a studio- * per team round an atrium, boulevards, planted courts), the coding floor is- * the Foundry deck, a bay per IDE workspace round the Core; each dresses its- * plan in its own look (AgentsFloorLook / the Foundry* files). The Level Hall's floor wears the+ * per team round an atrium, boulevards, planted courts), the coding floor has+ * a department per IDE workspace; each dresses its plan in its own look+ * (AgentsFloorLook / CodingFloorLook). The Level Hall's floor wears the* agents floor's materials. The arcade floor has a plan and a look of its own* (ArcadeHall); the person, the elevator and the camera work the same there.*/@@ -17,16 +17,10 @@ import type { SocietyAgent } from "../data";import type { ToyLook } from "./toyFigureModel";import { DeskInstances } from "./DeskInstances";import { DeskDressing } from "./DeskDressing";-import { FoundryBay, FoundryRails, FoundrySlab } from "./FoundryDeck";-import { FoundryAmbience } from "./FoundryAmbience";-import { FoundryComposer, FoundryEnvironment } from "./FoundryComposer";-import { FoundryConsoles } from "./FoundryConsoles";-import { FoundryCore } from "./FoundryCore";-import { foundryFrame } from "./foundryLayout";-import { FoundryLife } from "./FoundryLife";-import { FOUNDRY } from "./foundryPalette";-import { FoundryPulses } from "./FoundryPulses";-import { FoundrySky } from "./FoundrySky";+import { CodingSlab, CodingStudio } from "./CodingFloorLook";+import { CodingFloorAmbience } from "./CodingFloorAmbience";+import { CodingPlaza } from "./CodingPlaza";+import { DeskBusyLights } from "./DeskBusyLights";import { AGENTS_SCENE, AgentsDepartment, agentsRug, AgentsSlab } from "./AgentsFloorLook";import { AgentsFloorAmbience } from "./AgentsFloorAmbience";import { CampusGround } from "./CampusGround";@@ -41,7 +35,6 @@ import { GigiFlyer } from "./GigiFlyer";import { useEventStore } from "@/store/events";import type { DeskChat } from "./useDeskChats";import { FurniturePiece, MeetingChairs } from "./OfficeProps";-import { FoundryLook } from "./foundryLook";import { TeamBoardFace } from "./TeamBoardFace";import { TeamRoomFittings } from "./TeamRoomDecor";import { BreakLoungeFittings } from "./BreakLounge";@@ -60,6 +53,7 @@ import { PlayerBubble } from "./OfficeBubbles";import { OfficeCameraRig } from "./OfficeCameraRig";import { allDesks, leadDesks, type FurnitureKind, type OfficeLayout, type Point } from "./officeLayout";import { isWalkable, nearestWalkable, type NavGrid } from "./officeNav";+import { CODING_SCENE } from "./officePalette";import { officeSession, player as playerBody, useOfficeStore, type OfficeFloor, type Selection } from "./officeStore";import { arrivalPose } from "./officeFloors";import { ProgressionLayer } from "../progression/ProgressionLayer";@@ -108,8 +102,6 @@ export interface OfficeSceneProps {newcomers: ReadonlySet<string>;awake: boolean;reduced: boolean;- /** The small stage in the IDE's side panel: no post-processing there. */- compact?: boolean;overview: number;player: { look: ToyLook; name: string };selection: Selection | null;@@ -187,7 +179,7 @@ const STATION_PROP_KINDS: ReadonlySet<FurnitureKind> = new Set<FurnitureKind>([]);/** Everything that dresses the agents and coding floors: slab, rooms, departments, desks, monitors, furniture. */-function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awake, reduced, compact, chats, onOpenScreen, desks, onFloorClick }: OfficeSceneProps & {+function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awake, reduced, chats, onOpenScreen, desks, onFloorClick }: OfficeSceneProps & {desks: ReturnType<typeof allDesks>;onFloorClick: (event: ThreeEvent<MouseEvent>) => void;}) {@@ -202,11 +194,8 @@ function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awakconst teamRoom = layout.rooms.find((r) => r.kind === "team");const breakRoom = layout.rooms.find((r) => r.kind === "break");const coding = floor === "coding";- // The coding floor is the Foundry deck: a station floating in a nebula, so a glance tells the floors apart; the others stand in the city's haze.- const space = coding ? FOUNDRY.fog : CITY_BACKDROP;- const foundry = useMemo(() => (coding ? foundryFrame(layout) : null), [coding, layout]);- const working = useMemo(() => [...occupants.values()].filter((o) => o.dot === "working").length, [occupants]);- const animate = awake && !reduced;+ // Every working floor is a floor of the same tower: the city's haze stands behind them all.+ const space = CITY_BACKDROP;const background = useMemo(() => new Color(space), [space]);const { minX, maxX, minZ, maxZ } = layout.bounds;const span = Math.max(maxX - minX, maxZ - minZ);@@ -230,39 +219,30 @@ function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awak// eslint-disable-next-line react-hooks/exhaustive-deps].join("|"), [layout, roomLabels.join(";"), t]);return (- <FoundryLook.Provider value={coding}>+ <><primitive attach="background" object={background} /><fog attach="fog" args={[space, span * 2.2, span * 4.5]} />- {/* The city's sky has its own stars; the coding floor has its nebula. */}- {coding && <FoundrySky centre={[(minX + maxX) / 2, (minZ + maxZ) / 2]} animate={animate} />}- <hemisphereLight args={coding ? [FOUNDRY.sky, FOUNDRY.ground, 0.6] : [AGENTS_SCENE.sky, AGENTS_SCENE.ground, 0.95]} />- <ambientLight intensity={coding ? 0.16 : 0.25} />+ {/* The city's sky has its own stars, above a horizon the camera never shows; the coding floor's night is all stars. */}+ <hemisphereLight args={coding ? [CODING_SCENE.sky, CODING_SCENE.ground, 0.95] : [AGENTS_SCENE.sky, AGENTS_SCENE.ground, 0.95]} />+ <ambientLight intensity={0.25} />{/* The campus is twice as long as the other floors: its sun keeps the same shadow detail with a larger map. */}- <directionalLight key={shadowMap} position={[maxX + 10, 26, maxZ + 6]} intensity={coding ? 1.25 : 1.55} color={coding ? "#eef1ff" : "#fff7ec"} castShadow+ <directionalLight key={shadowMap} position={[maxX + 10, 26, maxZ + 6]} intensity={1.55} color="#fff7ec" castShadowshadow-mapSize={[shadowMap, shadowMap]} shadow-bias={-0.0004} shadow-normalBias={0.03}shadow-camera-left={-span * 0.7} shadow-camera-right={span * 0.7}shadow-camera-top={span * 0.7} shadow-camera-bottom={-span * 0.7} shadow-camera-far={Math.max(120, span * 2 + 40)} />- {coding ? <FoundrySlab layout={layout} frame={foundry} onFloorClick={onFloorClick} /> : <AgentsSlab layout={layout} onFloorClick={onFloorClick} />}- {coding ? <FoundryAmbience layout={layout} animate={animate} /> : <AgentsFloorAmbience layout={layout} />}- {coding && <>- <FoundryEnvironment />- {!compact && <FoundryComposer />}- <FoundryLife layout={layout} animate={animate} />- {foundry && <>- <FoundryRails frame={foundry} />- <FoundryCore at={foundry.core} working={working} animate={animate} />- <FoundryPulses frame={foundry} departments={layout.departments} animate={animate} />- </>}- </>}- {/* The agents floor and the Level Hall are floors of a building: window walls, the tower below, the city outside. */}- {!coding && <BuildingShell layout={layout} reduced={reduced} />}- <RoomFloors rooms={layout.rooms} campus={!coding} foundry={coding} />- <RoomWalls walls={layout.walls} foundry={coding} />+ {coding ? <CodingSlab layout={layout} onFloorClick={onFloorClick} /> : <AgentsSlab layout={layout} onFloorClick={onFloorClick} />}+ {coding ? <CodingFloorAmbience layout={layout} /> : <AgentsFloorAmbience layout={layout} />}+ {/* Every working floor is a floor of the tower: window walls, the tower below, the city outside. */}+ <BuildingShell layout={layout} reduced={reduced} />+ <RoomFloors rooms={layout.rooms} campus={!coding} />+ <RoomWalls walls={layout.walls} />{!batch && signs}{coding? <>- {layout.departments.map((dept) => <FoundryBay key={dept.id} dept={dept} animate={animate} />)}- <FoundryConsoles departments={layout.departments} occupants={occupants} animate={animate} />+ {layout.departments.map((dept) => <CodingStudio key={dept.id} dept={dept} agents={agents} />)}+ <DeskDressing desks={benchDesks} departments={layout.departments} />+ <DeskBusyLights desks={benchDesks} occupants={occupants} animate={awake && !reduced} />+ {spawnTerminal && <CodingPlaza at={spawnTerminal} />}</>: <>{/* The campus ground (boulevards, atrium, free plot, planted courts); the Level Hall's floor has none. */}@@ -298,6 +278,6 @@ function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awak{levelStage && <LevelHallFittings stage={levelStage} guide={levelGuide} />}{lobbyLamp && <LobbyFittings lamp={lobbyLamp} />}{spawnTerminal && <SpawnFittings terminal={spawnTerminal} arrival={layout.arrival} floor={floor} newcomers={newcomers} animate={awake && !reduced} />}- </FoundryLook.Provider>+ </>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsxindex de85a2c4e2..17c67cb02a 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx@@ -611,7 +611,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenonPointerMissed={() => select(null)}><OfficeFrameDriver enabled={awake && compact} /><OfficeScene floor={floor} occupants={occupants} ready={ready} layout={layout} grid={grid} walkers={walkers} agents={agents} newcomers={newcomers}- awake={awake} reduced={reduced} compact={compact} overview={overview} player={{ look: playerToyLook, name: playerName }}+ awake={awake} reduced={reduced} overview={overview} player={{ look: playerToyLook, name: playerName }}selection={selection} nearby={nearby} chats={chats} onOpenScreen={openScreen}elevatorCall={{ lit: picking || !!ride, picking, onPress: pressCall }} /></Canvas>diff --git a/jarvis/ui/web/frontend/src/components/society/office/SpawnPoint.tsx b/jarvis/ui/web/frontend/src/components/society/office/SpawnPoint.tsxindex 60f4cb7f8a..2cd2324139 100644--- a/jarvis/ui/web/frontend/src/components/society/office/SpawnPoint.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/SpawnPoint.tsx@@ -46,7 +46,7 @@ interface SpawnLook {}/**- * Downstairs the agents' Scandinavian oak, sage and bronze; upstairs the coding floor's Foundry steel, gold and code cyan.+ * Downstairs the agents' Scandinavian oak, sage and bronze; upstairs the coding floor's walnut, plum and amber.* The arcade floor has no spawn point; its entry only keeps the table complete (neon violet and cyan).*/export const SPAWN_LOOKS: Record<OfficeFloor, SpawnLook> = {@@ -56,9 +56,9 @@ export const SPAWN_LOOKS: Record<OfficeFloor, SpawnLook> = {pad: "#e9e3d8", speck: ["#ddd5c7", "#f3efe7", "#cfc6b6"], padEdge: "#a8865a", padBand: "#9fae93",},coding: {- body: "#2a2e36", plinth: "#16181d", metal: "#d8ae52", bezel: "#0f1115", glow: "#5fe6ff",- screenTop: "#0f2433", screenBottom: "#070d14", text: "#e8fbff", accent: "#5fe6ff", accentDeep: "#0b1a24",- pad: "#1c1f25", speck: ["#262a31", "#14161a", "#5fe6ff"], padEdge: "#d8ae52", padBand: "#5fe6ff",+ body: "#5d3d28", plinth: "#2e1d13", metal: "#d8ae52", bezel: "#1d1b1a", glow: "#ffc27a",+ screenTop: "#271b40", screenBottom: "#0f0a1d", text: "#fff1de", accent: "#f3b16b", accentDeep: "#241a3b",+ pad: "#2e2638", speck: ["#3b3246", "#251f2e", "#c9a24a"], padEdge: "#c9a24a", padBand: "#f3b16b",},arcade: {body: "#2a2348", plinth: "#15112a", metal: "#9b8cff", bezel: "#0e0c1f", glow: "#7df9ff",@@ -634,13 +634,10 @@ export function SpawnFittings({ terminal, arrival, floor, newcomers, animate }:return (<>- {/* Upstairs the Core hangs over the terminal (FoundryCore) and takes the beacon's place. */}- {floor !== "coding" && (- <group position={[terminal.x, SPAWN.beaconY, terminal.z]}>- <group ref={gyroA}><mesh geometry={gyroGeometry[0]} material={m.glow} /></group>- <group ref={gyroB}><mesh geometry={gyroGeometry[1]} material={m.glow} /></group>- </group>- )}+ <group position={[terminal.x, SPAWN.beaconY, terminal.z]}>+ <group ref={gyroA}><mesh geometry={gyroGeometry[0]} material={m.glow} /></group>+ <group ref={gyroB}><mesh geometry={gyroGeometry[1]} material={m.glow} /></group>+ </group><group position={[arrival.x, 0, arrival.z]}><mesh ref={beam} geometry={beamGeometry} material={beams.beam} visible={false} renderOrder={2} /><mesh ref={burst} geometry={burstGeometry} material={beams.burst} position={[0, 0.03, 0]} visible={false} renderOrder={2} />diff --git a/jarvis/ui/web/frontend/src/components/society/office/TeamRoomDecor.tsx b/jarvis/ui/web/frontend/src/components/society/office/TeamRoomDecor.tsxindex 9cfc891bfd..976399ae15 100644--- a/jarvis/ui/web/frontend/src/components/society/office/TeamRoomDecor.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/TeamRoomDecor.tsx@@ -11,8 +11,6 @@* and canvas faces are drawn once and shared.*/import { memo } from "react";-import { useFoundryLook } from "./foundryLook";-import { FOUNDRY, glowColour } from "./foundryPalette";import {BoxGeometry, BufferGeometry, CylinderGeometry, DoubleSide, Euler, Matrix4, MeshStandardMaterial, Quaternion, SphereGeometry, Vector3,} from "three";@@ -41,7 +39,7 @@ const C = {led: "#ffe2bd",} as const;-const TM_OFFICE = {+const TM = {walnut: matte(C.walnut, { roughness: 0.55 }),walnutDark: matte(C.walnutDark, { roughness: 0.6 }),walnutLight: matte(C.walnutLight, { roughness: 0.55 }),@@ -64,29 +62,6 @@ const TM_OFFICE = {books: ["#c4775a", "#e9dcc4", "#51705c", "#2f3d56", "#d9a441", "#8b6246", "#7c8fa8"].map((c) => matte(c)),};-/**- * On the Foundry deck the room keeps every piece and swaps its timber, stone- * and frosted glass for the deck's steel, slate, gold and code light.- */-const TM_FOUNDRY: typeof TM_OFFICE = {- ...TM_OFFICE,- walnut: matte("#3a3f48", { roughness: 0.4, metalness: 0.6 }),- walnutDark: matte(FOUNDRY.steelDark, { roughness: 0.5, metalness: 0.5 }),- walnutLight: matte("#4b515c", { roughness: 0.4, metalness: 0.6 }),- travertine: matte("#2c3037", { roughness: 0.35, metalness: 0.3 }),- brass: matte(FOUNDRY.gold, { roughness: 0.28, metalness: 0.85 }),- led: new MeshStandardMaterial({ color: "#000000", emissive: glowColour(FOUNDRY.code, 1.15), toneMapped: false }),- frosted: new MeshStandardMaterial({ color: "#7fcfff", transparent: true, opacity: 0.16, roughness: 0.2, side: DoubleSide, depthWrite: false }),- frostedLine: new MeshStandardMaterial({ color: "#000000", emissive: glowColour(FOUNDRY.code, 1.1), toneMapped: false }),-};--function useTeamMaterials(): typeof TM_OFFICE {- return useFoundryLook() ? TM_FOUNDRY : TM_OFFICE;-}--/** The Foundry deck's rug: dark slate felt with a gold border. */-const FOUNDRY_RUG = matte("#23272e", { roughness: 1 });-// ---------------------------------------------------------------------------// Canvas faces// ---------------------------------------------------------------------------@@ -398,7 +373,6 @@ const LEAF_GEOMETRIES: BufferGeometry[] = (() => {/** An open laptop; the hinge is on its -z side and the screen faces +z. */function Laptop({ position, rotationY = 0 }: { position: Vec3; rotationY?: number }) {- const TM = useTeamMaterials();return (<group position={position} rotation={[0, rotationY, 0]}><Box size={[0.32, 0.012, 0.22]} position={[0, 0.006, 0]} material={TM.alu} />@@ -418,7 +392,6 @@ function Laptop({ position, rotationY = 0 }: { position: Vec3; rotationY?: numbe* speakerphone puck, a carafe with glasses and a bud vase.*/function TeamTable() {- const TM = useTeamMaterials();return (<group>{/* Legs and the cable spine. */}@@ -463,7 +436,6 @@ function TeamTable() {* The face stays where `TeamBoardFace` expects it.*/function TeamBoard() {- const TM = useTeamMaterials();return (<group><Rounded size={[2.52, 1.24, 0.05]} radius={0.015} position={[0, 1.25, -0.04]} material={TM.walnutLight} />@@ -486,7 +458,6 @@ function TeamBoard() {* of it a video-conference display with its camera bar on top.*/function TeamWall() {- const TM = useTeamMaterials();return (<group><Box size={[WALL.w, 1.98, 0.025]} position={[0, 1.01, -0.0475]} material={TM.walnutDark} />@@ -516,7 +487,6 @@ function TeamWall() {* sculpture and a ceramic vase with branches.*/function Credenza() {- const TM = useTeamMaterials();return (<group>{[-1.0, 1.0].flatMap((x) => [-0.17, 0.17].map((z) => (@@ -563,7 +533,6 @@ function Credenza() {/** A fiddle-leaf fig in a tapered clay planter, nearly two metres tall. */function DesignerPlant() {- const TM = useTeamMaterials();return (<group><mesh geometry={TGEO.planter} material={TM.terracotta} position={[0, 0.26, 0]} castShadow receiveShadow />@@ -580,14 +549,7 @@ function DesignerPlant() {/** A wool rug with a clay border, sized per instance. */function TeamRug({ w, d }: { w: number; d: number }) {- const foundry = useFoundryLook();- return (- <group>- <Box size={[w, 0.016, d]} position={[0, 0.008, 0]} material={foundry ? FOUNDRY_RUG : faces.rug()} cast={false} />- {foundry && <Box size={[w - 0.2, 0.004, d - 0.2]} position={[0, 0.0175, 0]} material={TM_FOUNDRY.brass} cast={false} />}- {foundry && <Box size={[w - 0.26, 0.005, d - 0.26]} position={[0, 0.018, 0]} material={FOUNDRY_RUG} cast={false} />}- </group>- );+ return <Box size={[w, 0.016, d]} position={[0, 0.008, 0]} material={faces.rug()} cast={false} />;}/** Renderers of the team room's furniture kinds; merged into OfficeProps' exhaustive table. */@@ -616,7 +578,6 @@ const BAND = { y: 1.2, h: 0.46 };* the glass front either side of the door.*/export const TeamRoomFittings = memo(function TeamRoomFittings({ room, table }: { room: Room; table: Furniture }) {- const TM = useTeamMaterials();const door = room.doors.find((d) => d.side === "south");const bands = door? [[room.minX, door.at - door.width / 2], [door.at + door.width / 2, room.maxX]]diff --git a/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.tsindex 867ccd13c8..283659fc4b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts@@ -7,7 +7,7 @@ import {toFloor, tree, TREE_BOX, yawOf,} from "./agentsAmbience";import { buildOfficeLayout, type OfficeAgentInput } from "./officeLayout";-import { DEPARTMENT_ZONES } from "./officePalette";+import { CODING_STUDIOS, DEPARTMENT_ZONES } from "./officePalette";const agent = (id: string, provider: string): OfficeAgentInput => ({agentId: id, name: id, tier: "specialist", providerLabel: provider, state: "working", createdMs: 0,@@ -166,12 +166,14 @@ describe("agents floor fittings on the campus", () => {});describe("agents floor rugs", () => {- it("gives the twelve studios a floor can hold twelve different rugs", () => {+ it("gives the twelve studios a floor can hold twelve different rugs, none shared with the coding floor", () => {const rugs = Array.from({ length: 12 }, (_, i) => agentsRug(i));expect(AGENTS_RUGS).toHaveLength(12);expect(new Set(rugs.map((r) => `${r.weave}:${r.field}`)).size).toBe(12);expect(new Set(rugs.map((r) => r.field)).size).toBe(12);expect(new Set(rugs.map((r) => r.border)).size).toBe(12);+ const above = new Set(CODING_STUDIOS.map((s) => s.carpet));+ for (const rug of AGENTS_RUGS) expect(above.has(rug.field)).toBe(false);// Desk screens and seats take their zone from the same index.expect(DEPARTMENT_ZONES).toHaveLength(AGENTS_RUGS.length);});diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.tsnew file mode 100644index 0000000000..2c1680cdc7--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts@@ -0,0 +1,24 @@+import { describe, expect, it } from "vitest";++import { studioStyle } from "./CodingFloorLook";+import { CODING_STUDIOS, DEPARTMENT_TINTS } from "./officePalette";++describe("coding floor look", () => {+ it("furnishes the six departments a floor can hold as six different studios", () => {+ const styles = Array.from({ length: 6 }, (_, i) => studioStyle(i));+ expect(new Set(styles).size).toBe(6);+ expect(new Set(styles.map((s) => s.pattern)).size).toBe(6);+ expect(new Set(styles.map((s) => s.carpet)).size).toBe(6);+ expect(new Set(styles.map((s) => s.slat)).size).toBe(6);+ });++ it("cycles the studios for any tint index, never failing on one past the set", () => {+ expect(studioStyle(CODING_STUDIOS.length)).toBe(studioStyle(0));+ expect(studioStyle(-1)).toBe(studioStyle(CODING_STUDIOS.length - 1));+ });++ it("shares no floor colour with the agents office below", () => {+ const below = new Set<string>(DEPARTMENT_TINTS);+ for (const studio of CODING_STUDIOS) expect(below.has(studio.carpet)).toBe(false);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/deskBusyLights.test.ts b/jarvis/ui/web/frontend/src/components/society/office/deskBusyLights.test.tsnew file mode 100644index 0000000000..51613aa4e5--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/deskBusyLights.test.ts@@ -0,0 +1,21 @@+import { describe, expect, it } from "vitest";+import { Color } from "three";++import { busyColour } from "./DeskBusyLights";+import { CODING_SCENE } from "./officePalette";++describe("desk busy lights", () => {+ it("shows the pane's state: green at work, grey idle, red failed", () => {+ const out = new Color();+ expect(busyColour("working", 0, out).getHexString()).toBe(new Color(CODING_SCENE.busy.working).getHexString());+ expect(busyColour("idle", 3, out).getHexString()).toBe(new Color(CODING_SCENE.busy.idle).getHexString());+ const failed = busyColour("error", 0, out);+ expect(failed.r).toBeGreaterThan(failed.g * 2);+ });++ it("blinks while the pane waits for the person, lit at the still frame", () => {+ const on = busyColour("waiting", 0.1, new Color());+ const off = busyColour("waiting", 0.7, new Color());+ expect(on.r).toBeGreaterThan(off.r * 3);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/foundry.test.ts b/jarvis/ui/web/frontend/src/components/society/office/foundry.test.tsdeleted file mode 100644index e7b5acffb5..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/foundry.test.ts+++ /dev/null@@ -1,145 +0,0 @@-import { describe, expect, it } from "vitest";-import { Color } from "three";--import { signalColour } from "./FoundryConsoles";-import { droneRoutes } from "./FoundryLife";-import { deptByAgent, freshOutput } from "./FoundryPulses";-import { CORE_RING, foundryFrame, pointAlong } from "./foundryLayout";-import { BAY_SIGNALS, FOUNDRY, baySignal, glowColour } from "./foundryPalette";-import { buildOfficeLayout, type OfficeAgentInput, type Point } from "./officeLayout";--const agent = (id: string, provider: string): OfficeAgentInput => ({- agentId: id, name: id, tier: "specialist", providerLabel: provider, state: "working", createdMs: 0,-});--const luminance = (c: Color) => 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;--/** Do the segments ab and cd cross at a point inside both (touching ends do not count)? */-function crosses(a: Point, b: Point, c: Point, d: Point): boolean {- const cross = (o: Point, p: Point, q: Point) => (p.x - o.x) * (q.z - o.z) - (p.z - o.z) * (q.x - o.x);- const d1 = cross(c, d, a), d2 = cross(c, d, b), d3 = cross(a, b, c), d4 = cross(a, b, d);- return ((d1 > 1e-9 && d2 < -1e-9) || (d1 < -1e-9 && d2 > 1e-9)) && ((d3 > 1e-9 && d4 < -1e-9) || (d3 < -1e-9 && d4 > 1e-9));-}--describe("Foundry deck layout", () => {- for (const count of [0, 9, 40]) {- const layout = buildOfficeLayout(Array.from({ length: count }, (_, i) => agent(`a${i}`, `W${i % 6}`)), { variant: "coding" });- const frame = foundryFrame(layout)!;-- it(`puts the Core on the spawn terminal in the middle of the concourse (${count} agents)`, () => {- const terminal = layout.furniture.find((f) => f.kind === "spawnTerminal")!;- expect(frame.core).toEqual({ x: terminal.x, z: terminal.z });- expect(frame.core.x).toBeGreaterThan(frame.concourse.minX + CORE_RING.outer);- expect(frame.core.x).toBeLessThan(frame.concourse.maxX - CORE_RING.outer);- for (const dept of layout.departments) {- const overlap = dept.minX < frame.concourse.maxX && dept.maxX > frame.concourse.minX;- expect(overlap, dept.id).toBe(false);- }- });-- it(`runs one rail per bay from its edge to the Core's ring, inside the concourse (${count} agents)`, () => {- expect(frame.rails.map((r) => r.deptId).sort()).toEqual(layout.departments.map((d) => d.id).sort());- for (const rail of frame.rails) {- const dept = layout.departments.find((d) => d.id === rail.deptId)!;- const start = rail.points[0], end = rail.points[rail.points.length - 1];- expect([dept.minX, dept.maxX]).toContain(start.x);- expect(Math.hypot(end.x - frame.core.x, end.z - frame.core.z)).toBeCloseTo(CORE_RING.outer, 5);- for (const p of rail.points) {- expect(p.x).toBeGreaterThanOrEqual(frame.concourse.minX - 1e-9);- expect(p.x).toBeLessThanOrEqual(frame.concourse.maxX + 1e-9);- }- expect(rail.lengths[rail.lengths.length - 1]).toBeGreaterThan(0);- }- });-- it(`lays the rails like circuit traces: no two cross (${count} agents)`, () => {- const segments = frame.rails.flatMap((rail) => rail.points.slice(1).map((b, i) => ({ id: rail.deptId, a: rail.points[i], b })));- for (const s of segments) {- for (const t of segments) {- if (s.id === t.id) continue;- expect(crosses(s.a, s.b, t.a, t.b), `${s.id} × ${t.id}`).toBe(false);- }- }- });- }-- it("draws nothing on the agents floor", () => {- expect(foundryFrame(buildOfficeLayout([agent("a", "P")]))).toBeNull();- });-- it("walks a rail from its start to its end", () => {- const frame = foundryFrame(buildOfficeLayout([agent("a", "W")], { variant: "coding" }))!;- const rail = frame.rails[0];- const start = pointAlong(rail, -1), end = pointAlong(rail, 1e6);- expect({ x: start.x, z: start.z }).toEqual(rail.points[0]);- expect({ x: end.x, z: end.z }).toEqual(rail.points[rail.points.length - 1]);- const mid = pointAlong(rail, rail.lengths[rail.lengths.length - 1] / 2);- expect(Math.hypot(mid.dx, mid.dz)).toBeCloseTo(1, 5);- });-});--describe("Foundry deck colours", () => {- it("gives every bay its own signal colour, none close to the status amber or red", () => {- expect(new Set(BAY_SIGNALS).size).toBe(BAY_SIGNALS.length);- expect(baySignal(BAY_SIGNALS.length)).toBe(baySignal(0));- expect(baySignal(-1)).toBe(baySignal(BAY_SIGNALS.length - 1));- for (const signal of BAY_SIGNALS) {- for (const status of [FOUNDRY.status.asking, FOUNDRY.status.failed]) {- const a = new Color(signal), b = new Color(status);- expect(Math.hypot(a.r - b.r, a.g - b.g, a.b - b.b), `${signal} vs ${status}`).toBeGreaterThan(0.45);- }- }- });-- it("scales any hue to the same luminance, so every signal blooms alike", () => {- for (const hex of [...BAY_SIGNALS, FOUNDRY.status.asking, FOUNDRY.status.failed, FOUNDRY.gold]) {- expect(luminance(glowColour(hex, 1.3))).toBeCloseTo(1.3, 5);- }- });-- it("lights a desk by its pane: bay colour at work, amber blinking when asking, red when failed, dark when free", () => {- const bay = glowColour(BAY_SIGNALS[1], 0.8);- const out = new Color();- const working = signalColour("working", bay, 0, out).clone();- expect(working.r / working.g).toBeCloseTo(bay.r / bay.g, 5);- const on = signalColour("waiting", bay, 0.1, out).clone();- const off = signalColour("waiting", bay, 0.7, out).clone();- expect(luminance(on)).toBeGreaterThan(luminance(off) * 2);- const failed = signalColour("error", bay, 0, out).clone();- expect(failed.r).toBeGreaterThan(failed.g * 3);- expect(luminance(signalColour("free", bay, 0, out))).toBeLessThan(0.01);- });-});--describe("Foundry deck life", () => {- it("sends packets only for output that moved on, never for the first reading", () => {- const seen = new Map<string, number>();- const pane = (key: string, at: number | null) => ({ workspace_id: "w", history_id: `h-${key}`, key, last_output_at: at });- expect(freshOutput([pane("a", 10), pane("b", 5)], seen, true)).toEqual([]);- expect(freshOutput([pane("a", 10), pane("b", 6)], seen, false)).toEqual(["pane:w:h-b"]);- expect(freshOutput([pane("a", 11), pane("b", 6), pane("c", 3)], seen, false)).toEqual(["pane:w:h-a"]);- expect(freshOutput([pane("a", null)], seen, false)).toEqual([]);- // Closed panes are forgotten: the record never outgrows the roster.- expect([...seen.keys()]).toEqual([]);- });-- it("finds each seated pane's bay", () => {- const layout = buildOfficeLayout([agent("a", "W1"), agent("b", "W2")], { variant: "coding" });- const bays = deptByAgent(layout.departments);- expect(bays.size).toBe(2);- expect(bays.get("a")).not.toBe(bays.get("b"));- });-- it("flies the drones over the deck, above head height", () => {- const layout = buildOfficeLayout([], { variant: "coding" });- const routes = droneRoutes(layout.bounds, 4);- expect(routes).toHaveLength(4);- for (const r of routes) {- expect(r.y).toBeGreaterThan(3.5);- expect(r.cx - r.rx).toBeGreaterThanOrEqual(layout.bounds.minX);- expect(r.cx + r.rx).toBeLessThanOrEqual(layout.bounds.maxX);- expect(r.cz - r.rz).toBeGreaterThanOrEqual(layout.bounds.minZ);- expect(r.cz + r.rz).toBeLessThanOrEqual(layout.bounds.maxZ);- }- });-});diff --git a/jarvis/ui/web/frontend/src/components/society/office/foundryLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/foundryLayout.tsdeleted file mode 100644index 4622713d46..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/foundryLayout.ts+++ /dev/null@@ -1,121 +0,0 @@-/**- * Where the Foundry deck's pieces go, derived from a coding-floor layout: the- * concourse between the two bay columns, the Core at the spawn point, and one- * data rail per bay that runs like a circuit trace — out of the bay's inner- * side, along its own lane of the concourse, to the Core's ring.- *- * Pure: the deck draws the rails, the packets ride them. Every point lies on- * the floor (y = 0) and every rail stays on the concourse and the cross- * aisles, so nothing is drawn under a desk.- */-import type { Department, OfficeLayout, Point, Rect } from "./officeLayout";--/** The Core's ring on the floor round the spawn terminal: rails end on its outer edge. */-export const CORE_RING = { inner: 1.35, outer: 2.6 } as const;-/** Distance between two neighbouring rail lanes on the concourse (m). */-export const RAIL_LANE = 0.2;-/** Length of each 45° chamfer where a rail turns (m). */-const CHAMFER = 0.6;--export interface Rail {- deptId: string;- /** The bay's tint index: its signal colour. */- tint: number;- /** The trace from the bay to the Core's ring, as floor points; consecutive points differ. */- points: Point[];- /** Cumulative length at each point; the last entry is the rail's length. */- lengths: number[];-}--export interface FoundryFrame {- /** The concourse: the strip between the bay columns, from the north rooms to the south strip. */- concourse: Rect;- core: Point;- rails: Rail[];-}--function withLengths(deptId: string, tint: number, raw: Point[]): Rail {- const points: Point[] = [];- for (const p of raw) {- const last = points[points.length - 1];- if (!last || Math.hypot(p.x - last.x, p.z - last.z) > 1e-6) points.push(p);- }- const lengths = [0];- for (let i = 1; i < points.length; i += 1) {- lengths.push(lengths[i - 1] + Math.hypot(points[i].x - points[i - 1].x, points[i].z - points[i - 1].z));- }- return { deptId, tint, points, lengths };-}--/** The point at distance `s` along a rail (clamped to its ends), and the direction it runs there. */-export function pointAlong(rail: Rail, s: number): { x: number; z: number; dx: number; dz: number } {- const { points, lengths } = rail;- const total = lengths[lengths.length - 1];- const at = Math.min(Math.max(s, 0), total);- let i = 1;- while (i < points.length - 1 && lengths[i] < at) i += 1;- const a = points[i - 1], b = points[i] ?? a;- const span = lengths[i] - lengths[i - 1];- const t = span > 0 ? (at - lengths[i - 1]) / span : 0;- const len = Math.hypot(b.x - a.x, b.z - a.z) || 1;- return { x: a.x + (b.x - a.x) * t, z: a.z + (b.z - a.z) * t, dx: (b.x - a.x) / len, dz: (b.z - a.z) / len };-}--/**- * A rail from a bay to the Core: out of the bay's concourse side at its middle,- * a 45° turn into its lane, down the lane, and a last 45° turn onto the ring.- * Bays west of the concourse use lanes west of the centre line, east bays the- * east ones; farther bays take the inner lanes, so a nearer bay's trace turns- * into its outer lane before it would cross theirs.- */-function railFor(dept: Department, concourse: Rect, core: Point, lane: number): Point[] {- const west = (dept.minX + dept.maxX) / 2 < core.x;- const side = west ? -1 : 1;- const startX = west ? dept.maxX : dept.minX;- const z0 = (dept.minZ + dept.maxZ) / 2;- const laneX = core.x + side * (CORE_RING.outer * 0.55 + lane * RAIL_LANE);- const dir = z0 < core.z ? 1 : -1;- // The lane meets the ring where the ring's outer edge crosses its x.- const dx = laneX - core.x;- const ringZ = core.z - dir * Math.sqrt(Math.max(0, CORE_RING.outer ** 2 - dx * dx));- const turn = Math.min(CHAMFER, Math.abs(laneX - startX) / 2, Math.abs(ringZ - z0) / 2);- // Into the concourse, then a 45° step towards the Core into the lane.- const enter = { x: laneX + side * turn, z: z0 };- const points: Point[] = [{ x: startX, z: z0 }, enter, { x: laneX, z: z0 + dir * turn }];- // Down the lane to the ring.- points.push({ x: laneX, z: ringZ });- // Never leave the concourse: the trace is clamped to it (bays sit right on its edges).- return points.map((p) => ({ x: Math.min(concourse.maxX, Math.max(concourse.minX, p.x)), z: p.z }));-}--/** The concourse, the Core and every bay's rail for a coding-floor layout; null for any other floor. */-export function foundryFrame(layout: Pick<OfficeLayout, "variant" | "departments" | "furniture" | "rooms">): FoundryFrame | null {- if (layout.variant !== "coding" || layout.departments.length === 0) return null;- const terminal = layout.furniture.find((f) => f.kind === "spawnTerminal");- if (!terminal) return null;- const core = { x: terminal.x, z: terminal.z };- const west = layout.departments.filter((d) => (d.minX + d.maxX) / 2 < core.x);- const east = layout.departments.filter((d) => (d.minX + d.maxX) / 2 >= core.x);- const firstZ = Math.min(...layout.departments.map((d) => d.minZ));- const lastZ = Math.max(...layout.departments.map((d) => d.maxZ));- const north = layout.rooms.filter((r) => r.maxZ <= firstZ + 1e-6).map((r) => r.maxZ);- const south = layout.rooms.filter((r) => r.minZ >= lastZ - 1e-6).map((r) => r.minZ);- const concourse: Rect = {- minX: west.length > 0 ? Math.max(...west.map((d) => d.maxX)) : core.x - 3,- maxX: east.length > 0 ? Math.min(...east.map((d) => d.minX)) : core.x + 3,- minZ: north.length > 0 ? Math.max(...north) : firstZ,- maxZ: south.length > 0 ? Math.min(...south) : lastZ,- };- // Lanes per side and per direction, farthest bay innermost.- const rails: Rail[] = [];- for (const column of [west, east]) {- for (const dir of [1, -1]) {- const group = column- .filter((d) => ((d.minZ + d.maxZ) / 2 < core.z ? 1 : -1) === dir)- .sort((a, b) => Math.abs((b.minZ + b.maxZ) / 2 - core.z) - Math.abs((a.minZ + a.maxZ) / 2 - core.z));- group.forEach((dept, lane) => rails.push(withLengths(dept.id, dept.tint, railFor(dept, concourse, core, lane))));- }- }- rails.sort((a, b) => a.deptId.localeCompare(b.deptId, undefined, { numeric: true }));- return { concourse, core, rails };-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/foundryLook.ts b/jarvis/ui/web/frontend/src/components/society/office/foundryLook.tsdeleted file mode 100644index a27047594a..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/foundryLook.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Is this the coding floor's Foundry deck? Pieces every floor shares (the- * reception counter, the elevator, the team room) read it and swap their wood,- * white and stone for the deck's steel, slate and gold there. Provided by the- * floor dressing; false everywhere else.- */-import { createContext, useContext } from "react";--export const FoundryLook = createContext(false);--export function useFoundryLook(): boolean {- return useContext(FoundryLook);-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/foundryPalette.ts b/jarvis/ui/web/frontend/src/components/society/office/foundryPalette.tsdeleted file mode 100644index 68eca2c826..0000000000--- a/jarvis/ui/web/frontend/src/components/society/office/foundryPalette.ts+++ /dev/null@@ -1,57 +0,0 @@-import { Color } from "three";--/**- * The coding floor's palette: the Foundry deck (art/studies/coding-floor-foundry).- *- * Charcoal steel and gold carry the architecture, cool cyan marks anything- * that is code, and every workspace bay owns one saturated signal colour. The- * status colours (amber = asks, red = failed) are reserved: no bay wears them,- * so a beam in either colour can only mean a pane that needs the person.- */--export const FOUNDRY = {- /** The night behind the deck when the sky has not drawn yet, and the fog. */- fog: "#120f26",- /** Hemisphere fill: a cool sky over a warm deck bounce. */- sky: "#9fb4ff",- ground: "#3a2c22",- /** Deck plates: base, the tone variations a plate takes, the seams between them. */- deck: { base: "#262a31", plates: ["#252930", "#2a2e36", "#23272d", "#2c3038", "#272b32"], seam: "#111317" },- /** The deck slab's underside and its edge. */- hull: "#15171c",- steel: "#3b4049",- steelDark: "#22252b",- gold: "#d8ae52",- /** Code light: rails, packets, the Core's heart. */- code: "#5fe6ff",- /** The Core's plasma, from its heart outwards. */- plasma: { heart: "#e9fdff", inner: "#7af0ff", outer: "#3a7bff" },- /** Pane states the floor draws as light. */- status: { asking: "#ffb23d", failed: "#ff3b4e" },- /** The nebula's colours, deep to bright, and the ringed planet below the deck. */- nebula: { deep: "#07061a", violet: "#4b2a8f", magenta: "#b23a8a", teal: "#1d8f9c", glow: "#ffd2a8" },- planet: { day: "#b0744c", band: "#6a3628", night: "#120b1e", rim: "#5fb8e6", ring: "#c9ad86" },-} as const;--/**- * One signal colour per workspace bay, cycled by the department's tint index.- * All six are far from the reserved status amber and red, and from each other.- */-export const BAY_SIGNALS = ["#3fd8ff", "#f25cff", "#9dff5a", "#a07bff", "#2ff0a0", "#7aa8ff"] as const;--/**- * A light colour scaled so its luminance is `luminance` (linear). Bloom picks- * pixels by luminance, so a lime strip would glow and a magenta or red one at- * the same intensity would not; scaled like this, every signal colour glows- * alike whatever its hue. Self-lit materials take it with tone mapping off.- */-export function glowColour(hex: string, luminance: number): Color {- const c = new Color(hex);- const own = 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;- return c.multiplyScalar(luminance / Math.max(own, 0.02));-}--export function baySignal(index: number): string {- const n = BAY_SIGNALS.length;- return BAY_SIGNALS[((index % n) + n) % n];-}diff --git a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts b/jarvis/ui/web/frontend/src/components/society/office/minimap.tsindex a9e41f54e5..eeef6c2096 100644--- a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/minimap.ts@@ -10,9 +10,7 @@* transforms, clamping, bearings, grid labels and hit-testing are unit-tested* and the drawing takes any 2D context (an offscreen layer or a test recorder).*/-import { CHECKPOINT_GOLD, DEPARTMENT_TINTS, FOUNDRY_ROOM_FLOORS, ROOM_FLOOR_COLOURS } from "./officePalette";-import { CORE_RING, foundryFrame } from "./foundryLayout";-import { baySignal, FOUNDRY } from "./foundryPalette";+import { CHECKPOINT_GOLD, DEPARTMENT_TINTS, ROOM_FLOOR_COLOURS } from "./officePalette";import {FURNITURE_SIZE, allDesks, deskRect, footprint, roomAt,type CampusZoneKind, type CheckpointKind, type FurnitureKind, type OfficeLayout, type Point, type Rect, type RoomKind,@@ -355,11 +353,6 @@ export const MAP_PAINT = {oak: "#d9bf97",sofa: "#bdb6aa",counter: "#f6f3ee",- // Coding floor (Foundry deck): a bay's plate, the concourse, a console and its edge.- bay: "#1a1d23",- concourse: "#33373f",- console: "#454b56",- consoleEdge: "#14161a",checkpoint: CHECKPOINT_GOLD.face,checkpointDeep: CHECKPOINT_GOLD.faceDeep,checkpointIcon: CHECKPOINT_GOLD.icon,@@ -456,41 +449,6 @@ function seeded(seed: number): () => number {};}-/** The coding floor's ground on the map: the concourse, every bay's data rail and the Core's ring. */-function drawFoundryGround(ctx: Ctx, layout: OfficeLayout, t: MapTransform): void {- const frame = foundryFrame(layout);- if (!frame) return;- ctx.fillStyle = MAP_PAINT.concourse;- rectPath(ctx, t, frame.concourse);- ctx.fill();- ctx.lineCap = "round";- ctx.lineJoin = "round";- ctx.lineWidth = Math.max(1, Math.min(2, t.scale * 0.1));- for (const rail of frame.rails) {- ctx.strokeStyle = baySignal(rail.tint);- ctx.globalAlpha = 0.8;- ctx.beginPath();- rail.points.forEach((p, i) => {- const m = worldToMap(t, p);- if (i === 0) ctx.moveTo(m.x, m.y); else ctx.lineTo(m.x, m.y);- });- ctx.stroke();- }- ctx.globalAlpha = 1;- const c = worldToMap(t, frame.core);- ctx.strokeStyle = FOUNDRY.gold;- ctx.lineWidth = Math.max(1, t.scale * 0.16);- ctx.beginPath();- ctx.arc(c.x, c.y, (CORE_RING.outer - 0.12) * t.scale, 0, Math.PI * 2);- ctx.stroke();- ctx.fillStyle = FOUNDRY.code;- ctx.beginPath();- ctx.arc(c.x, c.y, Math.max(1.5, CORE_RING.inner * 0.55 * t.scale), 0, Math.PI * 2);- ctx.fill();- ctx.lineCap = "butt";- ctx.lineJoin = "miter";-}-/*** The painted floor: night sky with stars, slab and railing, warm planks,* department carpets, rooms, furniture, desks and crisp walls. `area` is the@@ -526,18 +484,14 @@ export function drawFloorArt(ctx: Ctx, layout: OfficeLayout, t: MapTransform, arctx.lineWidth = 1.5;ctx.stroke();- // The coding floor is the Foundry deck: dark steel, bays outlined in their signal colours, rails to the Core.- const foundry = layout.variant === "coding";- ctx.fillStyle = foundry ? FOUNDRY.deck.base : MAP_PAINT.floor;+ ctx.fillStyle = MAP_PAINT.floor;rectPath(ctx, t, layout.floor, 0.4);ctx.fill();- ctx.strokeStyle = foundry ? FOUNDRY.gold : MAP_PAINT.railing;+ ctx.strokeStyle = MAP_PAINT.railing;ctx.lineWidth = 1;ctx.stroke();- if (foundry) {- drawFoundryGround(ctx, layout, t);- } else if (t.scale >= 4) {+ if (t.scale >= 4) {// Faint plank seams, every 0.9 m, running east-west.ctx.save();rectPath(ctx, t, layout.floor, 0.4);@@ -601,16 +555,6 @@ export function drawFloorArt(ctx: Ctx, layout: OfficeLayout, t: MapTransform, ar// Department carpets and rooms: painted areas with soft darker outlines.ctx.lineWidth = Math.max(1, Math.min(2, t.scale * 0.12));for (const dept of layout.departments) {- if (foundry) {- // A bay: a dark plate inside a light strip in its signal colour.- rectPath(ctx, t, dept, 0.1);- ctx.fillStyle = MAP_PAINT.bay;- ctx.fill();- ctx.strokeStyle = baySignal(dept.tint);- ctx.lineWidth = Math.max(1, Math.min(2.5, t.scale * 0.14));- ctx.stroke();- continue;- }const tint = DEPARTMENT_TINTS[dept.tint % DEPARTMENT_TINTS.length];rectPath(ctx, t, dept, 0.5);ctx.globalAlpha = 0.85;@@ -620,10 +564,8 @@ export function drawFloorArt(ctx: Ctx, layout: OfficeLayout, t: MapTransform, arctx.strokeStyle = shade(tint, -0.3);ctx.stroke();}- ctx.lineWidth = Math.max(1, Math.min(2, t.scale * 0.12));for (const room of layout.rooms) {- const own: Partial<Record<string, { base: string }>> = FOUNDRY_ROOM_FLOORS;- const base = (foundry ? own[room.kind]?.base : undefined) ?? ROOM_FLOOR_COLOURS[room.kind].base;+ const base = ROOM_FLOOR_COLOURS[room.kind].base;rectPath(ctx, t, room, room.walled ? 0.15 : 0.5);ctx.globalAlpha = 0.92;ctx.fillStyle = base;@@ -708,9 +650,9 @@ export function drawFloorArt(ctx: Ctx, layout: OfficeLayout, t: MapTransform, arconst deskW = (rect.maxX - rect.minX) * t.scale;const deskD = (rect.maxZ - rect.minZ) * t.scale;roundRectPath(ctx, c.x - deskW / 2, c.y - deskD / 2, deskW, deskD, Math.min(2, deskD * 0.2));- ctx.fillStyle = foundry ? MAP_PAINT.console : MAP_PAINT.deskTop;+ ctx.fillStyle = MAP_PAINT.deskTop;ctx.fill();- ctx.strokeStyle = foundry ? MAP_PAINT.consoleEdge : MAP_PAINT.deskEdge;+ ctx.strokeStyle = MAP_PAINT.deskEdge;ctx.lineWidth = 0.8;ctx.stroke();if (t.scale >= 5) {diff --git a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.tsindex c1f7293302..4a47242fff 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts@@ -74,6 +74,71 @@ export const DEPARTMENT_ZONES = [/** Rug tints per department (kept for callers that only need the floor colour). */export const DEPARTMENT_TINTS = DEPARTMENT_ZONES.map((z) => z.rug);+/**+ * The coding floor's own look, so the two floors of the tower never read as+ * copies: light-oak herringbone where the agents floor has wide planks,+ * walnut studio walls with brass lettering, a terrazzo medallion at the+ * floor's centre, and a studio style per workspace department.+ */+export const CODING_SCENE = {+ slabEdge: "#2b2233",+ rim: "#f3b16b",+ sky: "#fff1de",+ ground: "#5e4c44",+ /** Herringbone oak: the seam between blocks and the block tones. */+ oak: { seam: "#b09778", planks: ["#dcc7a8", "#d5bf9d", "#e2cfb2", "#d0b796", "#e6d5ba", "#d9c3a2"] },+ /** The polished concrete band along the windows, and its brass inlay. */+ concrete: { base: "#cfc6ba", cloud: ["#c6bcaf", "#d8d0c5", "#c9c0b4"], brass: "#c9a24a" },+ /** Walnut slat walls behind each studio, with brass lettering. */+ walnut: { slat: "#5d3d28", gap: "#2e1d13", cap: "#1f1a17" },+ brass: "#d8ae52",+ /** Linear pendants over the desks: body, lit underside and the pool of light below. */+ pendant: { body: "#1d1b1a", glow: "#ffd9a0", pool: "#ffcf8f" },+ /** The town square round the spawn terminal: the terrazzo medallion and its chips. */+ plaza: { terrazzo: "#ebe4d8", chips: ["#cbc0ae", "#a99b86", "#dccfb8", "#8d806d", "#b99f72"] },+ /** The desk's busy light: working, waiting for the person, failed, idle. */+ busy: { working: "#3ccf6e", waiting: "#ffb020", error: "#ff4d4d", idle: "#6b6f76" },+} as const;++export type CarpetPattern = "grid" | "stripes" | "checker" | "dots" | "diagonal" | "zigzag";++export interface StudioStyle {+ pattern: CarpetPattern;+ /** Carpet base, its pattern tone, and the rug border. */+ carpet: string;+ weave: string;+ border: string;+ /** The studio's accent: the kick band along its walnut wall. */+ slat: string;+ /** Desk top, cabinet, leg, chair base and seat. */+ deskTop: string;+ deskBody: string;+ deskLeg: string;+ chair: string;+ seat: string;+}++/**+ * One studio per workspace department, cycled; every one differs in pattern+ * and colours. The patterns are woven tone-on-tone and the furniture stays in+ * the office's contemporary kit (oak or walnut tops, black or white steel,+ * graphite chairs), so a studio reads as a team's corner, not a theme park.+ */+export const CODING_STUDIOS: readonly StudioStyle[] = [+ { pattern: "grid", carpet: "#4a403a", weave: "#544841", border: "#c77b58", slat: "#c77b58",+ deskTop: "#c9ab81", deskBody: "#2b2f36", deskLeg: "#1f2226", chair: "#1d2025", seat: "#3aa99a" },+ { pattern: "stripes", carpet: "#b3bda2", weave: "#a9b398", border: "#7f9471", slat: "#7f9471",+ deskTop: "#dcc39d", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#6f8b77" },+ { pattern: "checker", carpet: "#dcbfae", weave: "#d4b5a3", border: "#bf7a5e", slat: "#bf7a5e",+ deskTop: "#f2f0ec", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#b0705b" },+ { pattern: "dots", carpet: "#cbbfc6", weave: "#c0b3bb", border: "#8f7a8a", slat: "#8f7a8a",+ deskTop: "#dcc39d", deskBody: "#e9e7ef", deskLeg: "#e9e7ef", chair: "#2b2f36", seat: "#766e96" },+ { pattern: "diagonal", carpet: "#b9c3c9", weave: "#afb9c0", border: "#6f8694", slat: "#6f8694",+ deskTop: "#c9ab81", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#5f7894" },+ { pattern: "zigzag", carpet: "#dccaa6", weave: "#d3c09a", border: "#b8955e", slat: "#b8955e",+ deskTop: "#8a6446", deskBody: "#2b2f36", deskLeg: "#1f2226", chair: "#1d2025", seat: "#c79a3a" },+];+/** Colours of the room props (lobby, team room, wardrobe, break room). */export const PROP_COLOURS = {steel: "#aab2bc",@@ -143,20 +208,6 @@ export const CAMPUS_ROOM_FLOORS = {break: { base: "#dcc6a1", accents: ["#e4d0ae", "#dcc6a1", "#e9d8ba", "#d8bf98"] },} as const;-/**- * The coding floor's rooms on the Foundry deck: polished dark stone at- * reception, smoked-walnut planks in the break room, slate felt in the team- * room, a dark raised-floor grid in the server room, graphite microcement in- * Mission Control. Dark enough to sit in the deck, light enough to read as rooms.- */-export const FOUNDRY_ROOM_FLOORS = {- reception: { base: "#2b2e34", accents: ["#2e3238", "#282b31", "#33373e"] },- break: { base: "#3b2d24", accents: ["#413128", "#372a21", "#47372c", "#33271f"] },- team: { base: "#2a2f37", accents: ["#2e343d", "#262b32", "#323843"] },- server: { base: "#2c3138", accents: ["#323740", "#292e35"] },- command: { base: "#2a2e35", accents: ["#262a30", "#30343b", "#2c3037", "#343840"] },-} as const;-/** Checkpoint gold: floor ring, hexagon token and the label badge. */export const CHECKPOINT_GOLD = { ring: "#f5b83d", rim: "#e0a02a", face: "#f7c65a", faceDeep: "#e39b1f", icon: "#ffffff" } as const;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex cc068468ce..97a00cf1f3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -1556,8 +1556,6 @@"spawn_screen_new": "NEUER AGENT","department_n": "ABTEILUNG {number}","studio_n": "STUDIO {number}",- "bay_n": "DOCK {number}",- "bay_free": "Freies Dock","coffee_menu": "KARTE","status_spend": "KOSTEN","status_days": "{days} T",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex c732fb1cf3..c98b353645 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -1556,8 +1556,6 @@"spawn_screen_new": "NEW AGENT","department_n": "DEPARTMENT {number}","studio_n": "STUDIO {number}",- "bay_n": "BAY {number}",- "bay_free": "Free bay","coffee_menu": "MENU","status_spend": "SPEND","status_days": "{days}D",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex ac4172028d..135c9b7654 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -1556,8 +1556,6 @@"spawn_screen_new": "NUEVO AGENTE","department_n": "DEPARTAMENTO {number}","studio_n": "ESTUDIO {number}",- "bay_n": "BAHÍA {number}",- "bay_free": "Bahía libre","coffee_menu": "MENÚ","status_spend": "GASTOS","status_days": "{days} D",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.jsonindex 6e8a9d0ad3..a5b7737ebf 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json@@ -1556,8 +1556,6 @@"spawn_screen_new": "NOVO AGENTE","department_n": "DEPARTAMENTO {number}","studio_n": "ESTÚDIO {number}",- "bay_n": "DOCA {number}",- "bay_free": "Doca livre","coffee_menu": "EMENTA","status_spend": "GASTOS","status_days": "{days} D",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.jsonindex cbb299d9a6..e441c94fa5 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json@@ -1556,8 +1556,6 @@"spawn_screen_new": "新建智能体","department_n": "部门 {number}","studio_n": "工作室 {number}",- "bay_n": "{number} 号舱",- "bay_free": "空闲舱位","coffee_menu": "菜单","status_spend": "支出","status_days": "{days} 天",