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): redesign the coding floor as a tech campus floor (#689)
Ruben Lütke89b67ebb8fa8
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex c08970c095..84b2a9b93a 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -959,26 +959,34 @@ 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 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.+## 5j. Coding floor as a tech campus floor (2026-10-14)++Two looks were rejected on the same day: a sci-fi "Foundry deck" (reactor,+drones, sky beams) as no office at all, and the studio look of §5b moved into+the tower as "as boring as before". The maintainer asked for a floor built the+way large technology companies build theirs. The floor plan stays (rooms,+stations, desk slots, the 6.4 m concourse); everything on it is new:++- **Zones by material** (`CodingFloorLook.tsx`): polished pale concrete with+ saw-cut joints is the ground; the concourse is a terrazzo main street with+ brass strips; every workspace is a team neighbourhood on an island of+ white-oak planks.+- **Team neighbourhoods**: a living moss wall in a white-oak frame on the+ north edge carries the team's name on an oak header with a stripe of the+ team's colour (`CODING_TEAMS`), over a planter with trailing plants.+- **Long shared tables** (`CodingTables.tsx`): each bench of desk slots is one+ continuous white-oak table on dark steel A-frames with a low felt screen in+ the team's colour down its spine; every seat keeps its monitor (the live+ terminal is drawn where it was), keyboard and a task chair in the team's felt.+- **Along the glass** (`codingAmbience.ts`): per outer neighbourhood a glass+ phone booth lined in the team's felt and a planter trough, either side of the+ window spot; tree planters at the cross aisles.+- **Main street**: a grove in the middle of every row — a tall tree in a round+ planter ringed by an oak bench — and the terrazzo medallion round the spawn+ terminal (`CodingPlaza.tsx`).+- **Busy lights** (`DeskBusyLights.tsx`): a lamp on every occupied desk in the+ pane's state (green working, amber blinking when it waits, red failed, grey idle).+- The floor stands in the tower like the agents floor (`BuildingShell`).## 6. Plandiff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsxindex e38831acac..97e1f7fa42 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx@@ -1,9 +1,9 @@/*** 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.+ * cross aisles at the windows; along the glass, beside every neighbourhood, a+ * phone booth in the team's colour and a planter trough; down the main street+ * a grove of tall trees ringed by oak benches; slim white pendants over every+ * long table with soft pools of light below; and one warm fill light.** Every repeated part is one instanced mesh, so the whole dressing costs a* handful of draw calls. The solid pieces come from `codingAmbience`, which@@ -14,14 +14,14 @@import { useLayoutEffect, useMemo, useRef } from "react";import { useFrame } from "@react-three/fiber";import {- AdditiveBlending, Color, Euler, Group, InstancedMesh, Matrix4, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3,+ AdditiveBlending, Color, Euler, Group, InstancedMesh, Matrix4, MeshBasicMaterial, MeshStandardMaterial, PlaneGeometry, Quaternion, Vector3,type BufferGeometry, type Material,} from "three";import { cachedCanvasTexture } from "./canvasMaterials";-import { codingAmbience, LIBRARY_H, TROUGH_H, type AmbienceItem } from "./codingAmbience";+import { BOOTH, codingAmbience, GROVE_H, TROUGH_H, type AmbienceItem } from "./codingAmbience";import { GEO, MAT, matte } from "./OfficeFurniture";import type { Department, OfficeLayout } from "./officeLayout";-import { CODING_SCENE } from "./officePalette";+import { CODING_SCENE, codingTeam } from "./officePalette";// ---------------------------------------------------------------------------// Instancing@@ -64,22 +64,21 @@ export function Instances({ geometry, material, items, cast = true }: {// ---------------------------------------------------------------------------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 }),+ /** Planters in pale fibre-cement with a white-oak rim. */+ planter: matte("#e4e1db", { roughness: 0.8 }),+ rim: matte(CODING_SCENE.oak.planks[0], { roughness: 0.55 }),+ oak: matte(CODING_SCENE.oak.planks[3], { roughness: 0.55 }),+ oakDark: matte(CODING_SCENE.oak.seam, { roughness: 0.6 }),+ steel: matte("#2a2c30", { roughness: 0.4, metalness: 0.5 }),+ glass: new MeshStandardMaterial({ color: "#dfeff5", transparent: true, opacity: 0.22, roughness: 0.05, depthWrite: false }),+ /** White, so each instance's colour is the team's felt. */+ felt: matte("#ffffff", { roughness: 0.95 }),+ shade: matte("#fff1d6", { emissive: "#ffe2b8", emissiveIntensity: 0.8, roughness: 0.6 }),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;@@ -106,7 +105,7 @@ const CROWN: readonly [number, number, number, number, 0 | 1 | 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. */+/** A tall tree in a square fibre-cement planter with an oak rim, filling its TREE_BOX footprint. */function Trees({ items }: { items: readonly AmbienceItem[] }) {const parts = useMemo(() => {const planter: Placement[] = [], rim: Placement[] = [], soil: Placement[] = [], trunk: Placement[] = [];@@ -128,8 +127,8 @@ function Trees({ items }: { items: readonly AmbienceItem[] }) {}, [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={AMB.planter} items={parts.planter} />+ <Instances geometry={GEO.box} material={AMB.rim} 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} />)}@@ -138,89 +137,106 @@ function Trees({ items }: { items: readonly AmbienceItem[] }) {}// ----------------------------------------------------------------------------// Library along the west glass+// Phone booths along the 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.+ * A phone booth: a steel frame with glass walls, its back and floor lined in+ * the team's felt, a small bench seat and a lamp under the roof. The open+ * front faces into the office.*/-function Library({ items }: { items: readonly AmbienceItem[] }) {+function Booths({ 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 frame: Placement[] = [], glass: Placement[] = [], felt: Placement[] = [], seat: Placement[] = [], lamp: Placement[] = [];+ for (const item of items) {+ const cx = (item.minX + item.maxX) / 2, cz = (item.minZ + item.maxZ) / 2;+ const d = item.maxX - item.minX, len = item.maxZ - item.minZ, h = BOOTH.h;+ // Which way is the back wall: away from the office.+ const back = item.facing === "east" ? -1 : 1;+ const colour = codingTeam(item.tint ?? 0).felt;+ frame.push({ position: [cx, h - 0.04, cz], scale: [d, 0.08, len] });+ frame.push({ position: [cx, 0.03, cz], scale: [d, 0.06, len] });+ for (const [dx, dz] of [[-1, -1], [-1, 1], [1, -1], [1, 1]] as const) {+ frame.push({ position: [cx + dx * (d / 2 - 0.025), h / 2, cz + dz * (len / 2 - 0.025)], scale: [0.05, h, 0.05] });+ }+ // Glass on the two short sides, felt on the back.+ for (const dz of [-1, 1]) glass.push({ position: [cx, h / 2, cz + dz * (len / 2 - 0.02)], scale: [d - 0.06, h - 0.14, 0.02] });+ felt.push({ position: [cx + back * (d / 2 - 0.03), h / 2, cz], scale: [0.04, h - 0.14, len - 0.08], color: colour });+ felt.push({ position: [cx, 0.065, cz], scale: [d - 0.08, 0.01, len - 0.08], color: colour });+ seat.push({ position: [cx + back * (d / 2 - 0.25), 0.44, cz], scale: [0.4, 0.08, len - 0.2] });+ seat.push({ position: [cx + back * (d / 2 - 0.25), 0.22, cz], scale: [0.36, 0.38, len - 0.3] });+ lamp.push({ position: [cx, h - 0.1, cz], scale: [0.18, 0.03, 0.18] });+ }+ return { frame, glass, felt, seat, lamp };+ }, [items]);+ return (+ <group>+ <Instances geometry={GEO.box} material={AMB.steel} items={parts.frame} />+ <Instances geometry={GEO.box} material={AMB.glass} items={parts.glass} cast={false} />+ <Instances geometry={GEO.box} material={AMB.felt} items={parts.felt} />+ <Instances geometry={GEO.box} material={AMB.oak} items={parts.seat} />+ <Instances geometry={GEO.cyl} material={AMB.shade} items={parts.lamp} cast={false} />+ </group>+ );+}++// ---------------------------------------------------------------------------+// Groves down the main street+// ---------------------------------------------------------------------------++/** A grove's crown in its own space (x, y, z, radius, leaf tone): broad and high, like a street tree. */+const GROVE_CROWN: readonly [number, number, number, number, 0 | 1 | 2 | 3][] = [+ [0, 3.5, 0, 0.95, 0], [0.7, 3.2, 0.2, 0.7, 1], [-0.65, 3.3, -0.25, 0.72, 2], [0.15, 4.0, 0.3, 0.65, 3],+ [-0.25, 3.0, 0.6, 0.6, 1], [0.4, 3.6, -0.6, 0.62, 2], [-0.6, 3.8, 0.35, 0.55, 0], [0.55, 2.9, -0.35, 0.5, 3],+];++/**+ * A grove: a round planter of pale fibre-cement ringed by an oak bench, a tall+ * tree in it whose crown spreads over the street, and low planting at its foot.+ */+function Groves({ items }: { items: readonly AmbienceItem[] }) {+ const parts = useMemo(() => {+ const planter: Placement[] = [], rim: Placement[] = [], soil: Placement[] = [], bench: 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 = 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;- }+ bench.push({ position: [x, 0.2, z], scale: [r, 0.4, r] });+ bench.push({ position: [x, 0.43, z], scale: [r + 0.02, 0.05, r + 0.02] });+ planter.push({ position: [x, 0.36, z], scale: [r - 0.42, 0.72, r - 0.42] });+ rim.push({ position: [x, 0.73, z], scale: [r - 0.4, 0.03, r - 0.4] });+ soil.push({ position: [x, 0.745, z], scale: [r - 0.5, 0.01, r - 0.5] });+ trunk.push({ position: [x, 1.9, z], scale: [0.09, 2.4, 0.09], rotation: [0.03, 0, -0.04] });+ const turn = rand() * Math.PI * 2, s = 0.92 + rand() * 0.14;+ for (const [cx, cy, cz, cr, tone] of GROVE_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, cy * s * (GROVE_H / 4.4), z + lz * s], scale: [cr * s, cr * s * 0.85, cr * s] });}- // 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] });+ // Low planting round the trunk.+ for (let k = 0; k < 6; k += 1) {+ const a = (k / 6) * Math.PI * 2 + rand(), d = (r - 0.6) * (0.5 + rand() * 0.4);+ leaves[k % LEAVES.length].push({ position: [x + Math.cos(a) * d, 0.84, z + Math.sin(a) * d], scale: [0.18, 0.14, 0.18] });}- 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 };+ }+ return { planter, rim, soil, bench, trunk, leaves };}, [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} />+ <Instances geometry={GEO.cyl} material={AMB.oak} items={parts.bench} />+ <Instances geometry={GEO.cyl} material={AMB.planter} items={parts.planter} />+ <Instances geometry={GEO.cyl} material={AMB.rim} items={parts.rim} />+ <Instances geometry={GEO.cyl} 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>);}// ----------------------------------------------------------------------------// Planter troughs along the east glass+// Planter troughs along the glass// ----------------------------------------------------------------------------/** Long cream troughs on a walnut plinth, planted with low foliage, kept low so they hide nothing. */+/** Long fibre-cement troughs on an oak 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[] = [];@@ -241,8 +257,8 @@ function Troughs({ items }: { items: readonly AmbienceItem[] }) {}, [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={AMB.oak} items={parts.plinth} />+ <Instances geometry={GEO.box} material={AMB.planter} 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>@@ -337,8 +353,9 @@ 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"),+ booth: items.filter((i) => i.kind === "booth"),trough: items.filter((i) => i.kind === "trough"),+ grove: items.filter((i) => i.kind === "grove"),}), [items]);const { minX, maxZ } = layout.bounds;return (@@ -346,8 +363,9 @@ export function CodingFloorAmbience({ layout }: { layout: OfficeLayout }) {{/* 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} />+ <Booths items={byKind.booth} /><Troughs items={byKind.trough} />+ <Groves items={byKind.grove} /><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.tsxindex af9f0db5f6..caff817dea 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx@@ -1,37 +1,31 @@/**- * 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).+ * The coding floor's own look: a tech campus floor in the tower. Polished+ * pale concrete is the ground; a terrazzo main street with brass edges runs+ * down the concourse; and every workspace is a team neighbourhood — an island+ * of white oak with long shared tables (CodingTables) and, along its north+ * edge, a living moss wall in a white-oak frame carrying the team's name on+ * an oak header with a stripe of the team's colour.*- * Purely visual. The only solid part is the studio wall, which stays inside- * the sign-wall footprint the layout already walks round.+ * Purely visual. The only solid part is the moss 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 { 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";+import { cachedCanvasTexture, ownedCanvasTexture } from "./canvasMaterials";+import { CodingTables } from "./CodingTables";+import { Box, matte } from "./OfficeFurniture";+import type { Department, OfficeLayout, Rect } from "./officeLayout";+import { CODING_SCENE, codingTeam } 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;+/** Metres covered by one repeat of the concrete, the terrazzo and the oak. */+const CONCRETE_METRES = 4.5;+const TERRAZZO_METRES = 3;+const OAK_METRES = 3.6;-/** Deterministic pseudo-random numbers, so the chips never shimmer between loads. */+/** Deterministic pseudo-random numbers, so the surfaces never shimmer between loads. */function lcg(seed: number): () => number {let state = seed >>> 0;return () => {@@ -40,187 +34,141 @@ function lcg(seed: number): () => number {};}-/**- * 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);- }- }+/** 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;}-/** Polished concrete: soft clouds of tone and a fine grain, seamless on both axes. */+/** Polished concrete: soft clouds of tone, a fine aggregate, and saw-cut joints every 1.5 m; seamless. */function drawConcrete(ctx: CanvasRenderingContext2D, w: number, h: number): void {- const { base, cloud } = CODING_SCENE.concrete;- const rand = lcg(0xc0ffee);+ const { base, cloud, joint } = CODING_SCENE.concrete;+ const rand = lcg(0xc0c4e7e);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;+ for (let i = 0; i < 46; i += 1) {+ const x = rand() * w, y = rand() * h, r = 20 + rand() * 70;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(0, `${tone}aa`);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)";+ for (let i = 0; i < 3200; i += 1) {+ ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.10)" : "rgba(90,84,76,0.07)";ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1, 1);}+ // Saw cuts: three per repeat (4.5 m), on both axes.+ ctx.fillStyle = joint;+ for (let i = 0; i < 3; i += 1) {+ ctx.fillRect((i * w) / 3, 0, 1.5, h);+ ctx.fillRect(0, (i * h) / 3, w, 1.5);+ }}-function drawCarpet(pattern: CarpetPattern, carpet: string, weave: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.fillStyle = carpet;+/** Terrazzo: a warm pale ground with chips of stone in several sizes; seamless. */+function drawTerrazzo(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { base, chips } = CODING_SCENE.terrazzo;+ const rand = lcg(0x7e4a);+ ctx.fillStyle = base;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;+ for (let i = 0; i < 1900; i += 1) {+ ctx.fillStyle = chips[Math.floor(rand() * chips.length)];+ const s = 1 + rand() * (rand() > 0.92 ? 7 : 3);+ const x = rand() * w, y = rand() * h;+ ctx.beginPath();+ ctx.ellipse(x, y, s, s * (0.55 + rand() * 0.45), rand() * Math.PI, 0, Math.PI * 2);+ ctx.fill();}}-/** 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);+/** White-oak planks, 18 cm wide, staggered ends, a fine grain; seamless along both axes. */+function drawOak(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { seam, planks } = CODING_SCENE.oak;+ const rand = lcg(0x0a4);+ const rows = 20, rowH = h / rows;+ ctx.fillStyle = seam;+ ctx.fillRect(0, 0, w, h);+ for (let r = 0; r < rows; r += 1) {+ // One row is exactly one period long, drawn twice (at x and x + w), so it wraps without a seam.+ const start = -rand() * w * 0.5;+ let x = start;+ while (x < start + w - 1) {+ const len = Math.min(w * (0.35 + rand() * 0.4), start + w - x);+ const tone = planks[Math.floor(rand() * planks.length)];+ for (const dx of [0, w]) {+ ctx.fillStyle = tone;+ ctx.fillRect(x + dx + 1, r * rowH + 1, len - 2, rowH - 2);+ ctx.fillStyle = "rgba(120,92,58,0.08)";+ for (const gy of [0.3, 0.65]) ctx.fillRect(x + dx + 1, r * rowH + rowH * gy, len - 2, 1);+ }+ x += len;+ }}- 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;+/** Width of the concrete band's brass strip along the main street's edges. */+const STRIP_M = 0.04;++/** The concourse: the strip between the two neighbourhood columns, from the north rooms to the south strip. */+export function mainStreet(layout: Pick<OfficeLayout, "departments" | "rooms">): Rect | null {+ const depts = layout.departments;+ if (depts.length === 0) return null;+ const colMinX = Math.min(...depts.map((d) => d.minX)), colMaxX = Math.max(...depts.map((d) => d.maxX));+ const west = depts.filter((d) => d.minX <= colMinX + 1e-6);+ const east = depts.filter((d) => d.maxX >= colMaxX - 1e-6 && d.minX > colMinX + 1e-6);+ if (west.length === 0 || east.length === 0) return null;+ const firstZ = Math.min(...depts.map((d) => d.minZ)), lastZ = Math.max(...depts.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);+ return {+ minX: Math.max(...west.map((d) => d.maxX)), maxX: Math.min(...east.map((d) => d.minX)),+ minZ: north.length > 0 ? Math.max(...north) : firstZ, maxZ: south.length > 0 ? Math.min(...south) : lastZ,+ };+}/**- * 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).+ * The slab and floor of the coding floor: polished concrete everywhere, the+ * terrazzo main street with brass strips down the concourse, 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 street = useMemo(() => mainStreet(layout), [layout]);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 });+ const map = repeated(cachedCanvasTexture("coding:concrete", 512, 512, drawConcrete), w / CONCRETE_METRES, d / CONCRETE_METRES);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.concrete.base, map, roughness: 0.42, metalness: 0.05 });}, [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 terrazzo = useMemo(() => {+ if (!street) return null;+ const map = repeated(cachedCanvasTexture("coding:terrazzo", 512, 512, drawTerrazzo),+ (street.maxX - street.minX) / TERRAZZO_METRES, (street.maxZ - street.minZ) / TERRAZZO_METRES);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.terrazzo.base, map, roughness: 0.35 });+ }, [street]);+ const brass = useMemo(() => matte(CODING_SCENE.brass, { roughness: 0.35, metalness: 0.55 }), []);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,+ color: CODING_SCENE.rim, emissive: CODING_SCENE.rim, emissiveIntensity: 0.9, 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;+ floor.map?.dispose(); floor.dispose(); terrazzo?.map?.dispose(); terrazzo?.dispose();+ brass.dispose(); edge.dispose(); rim.dispose();+ }, [floor, terrazzo, brass, edge, rim]);+ const glow = 0.05;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} />@@ -228,222 +176,185 @@ export function CodingSlab({ layout, onFloorClick }: { layout: OfficeLayout; onF<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} />+ {street && terrazzo && (+ <group>+ <mesh position={[(street.minX + street.maxX) / 2, 0.003, (street.minZ + street.maxZ) / 2]} rotation={[-Math.PI / 2, 0, 0]}+ material={terrazzo} receiveShadow onClick={onFloorClick}>+ <planeGeometry args={[street.maxX - street.minX, street.maxZ - street.minZ]} />+ </mesh>+ {[street.minX + 0.3, street.maxX - 0.3].map((x) => (+ <Box key={x} size={[STRIP_M, 0.004, street.maxZ - street.minZ]} position={[x, 0.004, (street.minZ + street.maxZ) / 2]}+ material={brass} cast={false} />+ ))}+ </group>+ )}</group>);}// ----------------------------------------------------------------------------// Studio wall+// The living wall// ----------------------------------------------------------------------------const WALL_H = 1.9;-const LETTERS = { w: 1024, h: 224 } as const;+const WALL_H = 1.95;+const HEADER = { h: 0.42, w: 1024, px: 160 } 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;+/** Moss: dense tufts in several greens with fern sprays; seamless (white-free, lit by the scene). */+function drawMoss(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { base, tones, fern } = CODING_SCENE.moss;+ const rand = lcg(0x3055);+ ctx.fillStyle = base;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);+ for (let i = 0; i < 1400; i += 1) {+ const x = rand() * w, y = rand() * h, r = 2 + rand() * 7;+ ctx.fillStyle = tones[Math.floor(rand() * tones.length)];+ for (const dx of [-w, 0, w]) {+ for (const dy of [-h, 0, h]) {+ ctx.beginPath();+ ctx.arc(x + dx, y + dy, r, 0, Math.PI * 2);+ ctx.fill();+ }+ }}-}--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);+ // Fern sprays: a stem with short leaflets either side.+ ctx.strokeStyle = fern;+ ctx.lineWidth = 1.4;+ for (let i = 0; i < 26; i += 1) {+ const x = rand() * w, y = rand() * h, len = 14 + rand() * 18, a = -Math.PI / 2 + (rand() - 0.5) * 1.2;+ for (let k = 0; k < len; k += 3) {+ const px = x + Math.cos(a) * k, py = y + Math.sin(a) * k, leaf = (len - k) * 0.35;+ ctx.beginPath();+ ctx.moveTo(px, py); ctx.lineTo(px + Math.cos(a + 1.1) * leaf, py + Math.sin(a + 1.1) * leaf);+ ctx.moveTo(px, py); ctx.lineTo(px + Math.cos(a - 1.1) * leaf, py + Math.sin(a - 1.1) * leaf);+ ctx.stroke();+ }}- 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";+/** The oak header: the team's name in dark capitals, the room number small beside it, a stripe of the team's colour below. */+function drawHeader(label: string, caption: string, accent: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const { planks, seam } = CODING_SCENE.oak;+ ctx.fillStyle = planks[2];+ ctx.fillRect(0, 0, w, h);+ ctx.fillStyle = "rgba(120,92,58,0.10)";+ for (let y = 6; y < h; y += 9) ctx.fillRect(0, y, w, 1);+ ctx.fillStyle = seam;+ ctx.fillRect(0, h - 3, w, 3);+ ctx.fillStyle = accent;+ ctx.fillRect(0, h - 18, w, 12);+ const name = label.length > 26 ? `${label.slice(0, 25)}…` : label;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");+ ctx.font = "700 72px system-ui, -apple-system, 'Segoe UI', sans-serif";+ const nameW = Math.min(ctx.measureText(name).width, w - 260);+ ctx.save();+ ctx.translate(48, (h - 18) / 2);+ ctx.scale(nameW / Math.max(1, ctx.measureText(name).width), 1);+ ctx.fillStyle = "#2b2622";+ ctx.fillText(name, 0, 2);+ ctx.restore();+ ctx.font = "600 30px system-ui, -apple-system, 'Segoe UI', sans-serif";+ ctx.fillStyle = "#6b5d4c";+ ctx.textAlign = "right";+ ctx.fillText(caption, w - 40, (h - 18) / 2 + 2);}-const letterMaterials = new Map<string, MeshStandardMaterial>();-function letterMaterial(label: string, caption: string): MeshStandardMaterial {- const key = `${caption}:${label}`;- let material = letterMaterials.get(key);+const WALL_MAT = {+ frame: matte(CODING_SCENE.moss.frame, { roughness: 0.55 }),+ planter: matte(CODING_SCENE.oak.planks[3], { roughness: 0.55 }),+ leaf: matte(CODING_SCENE.moss.tones[2], { flatShading: true, roughness: 0.8 }),+};++const mossMaterials = new Map<string, MeshStandardMaterial>();+function mossMaterial(width: number, height: number): MeshStandardMaterial {+ const key = `${width.toFixed(2)}x${height.toFixed(2)}`;+ let material = mossMaterials.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);+ const map = repeated(cachedCanvasTexture("coding:moss", 256, 256, drawMoss), width / 1.1, height / 1.1);+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.moss.base, map, roughness: 1 });+ mossMaterials.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.+ * A neighbourhood's living wall, centred on its front face: a white-oak frame+ * round a field of moss and ferns, an oak header carrying the team's name, and+ * an oak planter along its foot with trailing plants.*/-function StudioWall({ label, number, width, position, accent }: {- label: string; number: number; width: number; position: [number, number, number]; accent: MeshStandardMaterial;+function LivingWall({ label, caption, accent, width, position }: {+ label: string; caption: string; accent: string; width: number; position: [number, number, number];}) {- 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") });+ const header = useMemo(() => {+ const map = ownedCanvasTexture(HEADER.w, HEADER.px, (ctx, w, h) => drawHeader(label, caption, accent, ctx, w, h));+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.oak.planks[2], map, roughness: 0.6 });+ }, [label, caption, accent]);+ useEffect(() => () => { header.map?.dispose(); header.dispose(); }, [header]);+ const mossH = WALL_H - HEADER.h - 0.42;+ const headerW = Math.min(width - 0.2, (HEADER.h * HEADER.w) / HEADER.px);+ const trailing = useMemo(() => {+ const count = Math.max(2, Math.floor(width / 0.7));+ return Array.from({ length: count }, (_, i) => -width / 2 + 0.35 + (i * (width - 0.7)) / (count - 1));+ }, [width]);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]} />+ <Box size={[width, WALL_H, 0.12]} position={[0, WALL_H / 2, -0.02]} material={WALL_MAT.frame} />+ <mesh position={[0, 0.36 + mossH / 2, 0.041]} material={mossMaterial(width - 0.14, mossH)} receiveShadow>+ <planeGeometry args={[width - 0.14, mossH]} /></mesh>- <mesh position={[0, 1.34, 0.04]} material={letterMaterial(label, caption)}>- <planeGeometry args={[plateW, plateH]} />+ <mesh position={[0, WALL_H - HEADER.h / 2 - 0.04, 0.042]} material={header}>+ <planeGeometry args={[headerW, HEADER.h]} /></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>+ {/* The planter at the wall's foot, with trailing plants spilling over its lip. */}+ <Box size={[width, 0.36, 0.3]} position={[0, 0.18, 0.13]} material={WALL_MAT.planter} />+ {trailing.map((x) => (+ <mesh key={x} position={[x, 0.38, 0.18]} scale={[0.26, 0.14, 0.16]} material={WALL_MAT.leaf} castShadow>+ <icosahedronGeometry args={[1, 0]} />+ </mesh>))}</group>);}-/** One workspace department as a studio: bordered patterned rug, walnut studio wall, desks in its own colours. */+// ---------------------------------------------------------------------------+// Neighbourhoods+// ---------------------------------------------------------------------------++const oakMaterials = new Map<string, MeshStandardMaterial>();+function oakMaterial(w: number, d: number): MeshStandardMaterial {+ const key = `${w.toFixed(2)}x${d.toFixed(2)}`;+ let material = oakMaterials.get(key);+ if (!material) {+ const map = repeated(cachedCanvasTexture("coding:oak", 512, 512, drawOak), w / OAK_METRES, d / OAK_METRES);+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.oak.planks[0], map, roughness: 0.55 });+ oakMaterials.set(key, material);+ }+ return material;+}++const EDGE_MAT = matte(CODING_SCENE.oak.seam, { roughness: 0.5 });++/** One workspace as a team neighbourhood: a white-oak island, its living wall with the team's name, and its long tables. */export function CodingStudio({ dept, agents }: { dept: Department; agents: ReadonlyMap<string, SocietyAgent> }) {const t = useT();- const style = studioStyle(dept.tint);- const kit = studioKit(style);+ const team = codingTeam(dept.tint);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]);+ const caption = fill(t("society.office.studio_n"), { number: String(dept.tint + 1).padStart(2, "0") });return (<group>- <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.border} receiveShadow>+ <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} material={oakMaterial(w, d)} 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} />+ {/* A thin darker oak edge round the island. */}+ {([[cx, dept.minZ, w, 0.04], [cx, dept.maxZ, w, 0.04]] as const).map(([x, z, sx, sz]) => (+ <Box key={`z${z}`} size={[sx, 0.008, sz]} position={[x, 0.006, z]} material={EDGE_MAT} cast={false} />+ ))}+ {([[dept.minX, cz, 0.04, d], [dept.maxX, cz, 0.04, d]] as const).map(([x, z, sx, sz]) => (+ <Box key={`x${x}`} size={[sx, 0.008, sz]} position={[x, 0.006, z]} material={EDGE_MAT} cast={false} />+ ))}+ <LivingWall label={dept.label || t("society.office.open_space")} caption={caption} accent={team.accent}+ width={w - 0.4} position={[cx, 0, dept.minZ + 0.1]} />+ <CodingTables desks={dept.desks} agents={agents} team={team} /></group>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingTables.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingTables.tsxnew file mode 100644index 0000000000..4e95530c30--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingTables.tsx@@ -0,0 +1,143 @@+/**+ * The coding floor's long shared tables. Each bench of the layout — two rows+ * of desk slots facing each other — is one continuous white-oak table on dark+ * steel A-frames, with a low felt screen in the team's colour down its spine.+ * Every seat keeps what a desk had: a monitor on an arm (the live terminal is+ * drawn on its screen, exactly where it was), a keyboard and a task chair+ * whose seat is upholstered in the team's felt.+ *+ * Every repeated part is one instanced mesh per neighbourhood; the slots and+ * their footprints are the layout's, so seating and navigation are unchanged.+ */+import { useEffect, useLayoutEffect, useMemo, useRef } from "react";+import { BufferGeometry, Euler, InstancedMesh, Matrix4, MeshStandardMaterial, PlaneGeometry, Quaternion, Vector3, type Material } from "three";+import { RoundedBoxGeometry } from "three-stdlib";+import type { SocietyAgent } from "../data";+import { CHAIR_MAT, TASK_CHAIR_PARTS, type ChairFinish } from "./OfficeChairs";+import { GEO, MAT, screenMaterial } from "./OfficeFurniture";+import { DESK_SIZE, type DeskSlot } from "./officeLayout";+import { CODING_SCENE, type TeamColours } from "./officePalette";+import type { ScreenFace } from "./screenTextures";++const TM = {+ top: new MeshStandardMaterial({ color: CODING_SCENE.table.top, roughness: 0.5 }),+ edge: new MeshStandardMaterial({ color: CODING_SCENE.table.edge, roughness: 0.5 }),+ leg: new MeshStandardMaterial({ color: CODING_SCENE.table.leg, roughness: 0.4, metalness: 0.5 }),+ spine: new MeshStandardMaterial({ color: CODING_SCENE.table.spine, roughness: 0.5, metalness: 0.3 }),+ chairFrame: new MeshStandardMaterial({ color: "#2a2c30", roughness: 0.45, metalness: 0.2 }),+};++/** A table: one bench's slots, its centre, length along x and depth across. */+export interface LongTable { key: string; x: number; z: number; length: number; depth: number }++/** One long table per bench of desk slots ("<dept>:<bench>:<facing>:<col>"). Pure. */+export function longTables(desks: readonly DeskSlot[]): LongTable[] {+ const benches = new Map<string, DeskSlot[]>();+ for (const desk of desks) {+ if (desk.size) continue;+ const key = desk.id.split(":").slice(0, -2).join(":");+ benches.set(key, [...(benches.get(key) ?? []), desk]);+ }+ return [...benches.entries()].map(([key, slots]) => {+ const xs = slots.map((s) => s.x), zs = slots.map((s) => s.z);+ const minX = Math.min(...xs) - DESK_SIZE.w / 2, maxX = Math.max(...xs) + DESK_SIZE.w / 2;+ const minZ = Math.min(...zs) - DESK_SIZE.d / 2, maxZ = Math.max(...zs) + DESK_SIZE.d / 2;+ return { key, x: (minX + maxX) / 2, z: (minZ + maxZ) / 2, length: maxX - minX, depth: maxZ - minZ };+ });+}++const _q = new Quaternion(), _e = new Euler(), _p = new Vector3(), _s = new Vector3();+function compose(position: [number, number, number], scale: [number, number, number], rotY = 0): Matrix4 {+ return new Matrix4().compose(_p.set(...position), _q.setFromEuler(_e.set(0, rotY, 0)), _s.set(...scale));+}++function seatMatrix(desk: DeskSlot, local: [number, number, number], scale: [number, number, number] = [1, 1, 1]): Matrix4 {+ const turn = desk.facing === "north" ? 0 : Math.PI;+ return compose([desk.x, 0, desk.z], [1, 1, 1], turn).multiply(compose(local, scale));+}++function InstancedParts({ geometry, material, matrices, cast = true }: {+ geometry: BufferGeometry; material: Material; matrices: readonly Matrix4[]; cast?: boolean;+}) {+ const ref = useRef<InstancedMesh>(null);+ useLayoutEffect(() => {+ const mesh = ref.current;+ if (!mesh) return;+ matrices.forEach((m, i) => mesh.setMatrixAt(i, m));+ mesh.count = matrices.length;+ mesh.instanceMatrix.needsUpdate = true;+ mesh.computeBoundingSphere();+ }, [matrices]);+ if (matrices.length === 0) return null;+ // Remount when the count changes: an instanced mesh cannot grow in place.+ return <instancedMesh key={matrices.length} ref={ref} args={[geometry, material, matrices.length]} castShadow={cast} receiveShadow frustumCulled={false} />;+}++const TOP = new RoundedBoxGeometry(1, 1, 1, 1, 0.02);+const MONITOR = new RoundedBoxGeometry(0.72, 0.43, 0.022, 1, 0.012);+const SCREEN = new PlaneGeometry(0.66, 0.38);+const FACES: ScreenFace[] = ["working", "idle", "waiting", "paused", "empty"];+const CHAIR_FINISH: Record<ChairFinish, "frame" | "seat" | "metal" | "mesh"> = { frame: "frame", fabric: "seat", metal: "metal", mesh: "mesh" };++/** The long tables of one neighbourhood and everything at their seats. */+export function CodingTables({ desks, agents, team }: {+ desks: readonly DeskSlot[]; agents: ReadonlyMap<string, SocietyAgent>; team: TeamColours;+}) {+ const felt = useMemo(() => new MeshStandardMaterial({ color: team.felt, roughness: 0.95 }), [team.felt]);+ useEffect(() => () => felt.dispose(), [felt]);+ const tables = useMemo(() => longTables(desks), [desks]);+ const parts = useMemo(() => {+ const top: Matrix4[] = [], edge: Matrix4[] = [], legs: Matrix4[] = [], spine: Matrix4[] = [], screen: Matrix4[] = [];+ for (const t of tables) {+ top.push(compose([t.x, 0.755, t.z], [t.length, 0.035, t.depth]));+ edge.push(compose([t.x, 0.728, t.z], [t.length - 0.04, 0.022, t.depth - 0.04]));+ // A-frames at both ends and, on a long table, in the middle.+ const frames = t.length > 4 ? [-t.length / 2 + 0.28, 0, t.length / 2 - 0.28] : [-t.length / 2 + 0.28, t.length / 2 - 0.28];+ for (const fx of frames) {+ legs.push(compose([t.x + fx, 0.36, t.z - t.depth / 2 + 0.22], [0.06, 0.72, 0.06]));+ legs.push(compose([t.x + fx, 0.36, t.z + t.depth / 2 - 0.22], [0.06, 0.72, 0.06]));+ legs.push(compose([t.x + fx, 0.03, t.z], [0.06, 0.04, t.depth - 0.4]));+ }+ // The spine: a cable rail and a low felt screen in the team's colour.+ spine.push(compose([t.x, 0.79, t.z], [t.length - 0.3, 0.04, 0.1]));+ screen.push(compose([t.x, 0.98, t.z], [t.length - 0.4, 0.34, 0.03]));+ }+ const seats = desks.filter((desk) => !desk.size);+ const arm = seats.flatMap((d) => [+ seatMatrix(d, [0, 0.8, -0.3], [0.08, 0.05, 0.06]),+ seatMatrix(d, [0, 0.95, -0.3], [0.018, 0.3, 0.018]),+ seatMatrix(d, [0, 1.1, -0.26], [0.04, 0.03, 0.08]),+ ]);+ const monitor = seats.map((d) => seatMatrix(d, [0, 1.18, -0.224]));+ const keys = seats.flatMap((d) => [+ seatMatrix(d, [0, 0.784, 0.2], [0.46, 0.014, 0.14]),+ seatMatrix(d, [0.34, 0.786, 0.2], [0.05, 0.02, 0.08]),+ ]);+ const chair = seats.map((d) => seatMatrix(d, [0, 0, 0.62]));+ const faces = new Map<ScreenFace, Matrix4[]>(FACES.map((f) => [f, []]));+ for (const d of seats) {+ const agent = d.agentId ? agents.get(d.agentId) : undefined;+ faces.get(agent ? agent.state : "empty")!.push(seatMatrix(d, [0, 1.18, -0.212]));+ }+ return { top, edge, legs, spine, screen, arm, monitor, keys, chair, faces };+ }, [tables, desks, agents]);+ const chairMaterial: Record<"frame" | "seat" | "metal" | "mesh", Material> = {+ frame: TM.chairFrame, seat: felt, metal: CHAIR_MAT.aluminium, mesh: CHAIR_MAT.mesh,+ };+ return (+ <group>+ <InstancedParts geometry={TOP} material={TM.top} matrices={parts.top} />+ <InstancedParts geometry={GEO.box} material={TM.edge} matrices={parts.edge} cast={false} />+ <InstancedParts geometry={GEO.box} material={TM.leg} matrices={parts.legs} />+ <InstancedParts geometry={GEO.box} material={TM.spine} matrices={parts.spine} cast={false} />+ <InstancedParts geometry={GEO.box} material={felt} matrices={parts.screen} />+ <InstancedParts geometry={GEO.box} material={MAT.monitorArm} matrices={parts.arm} cast={false} />+ <InstancedParts geometry={MONITOR} material={MAT.monitor} matrices={parts.monitor} />+ <InstancedParts geometry={GEO.box} material={MAT.keyboard} matrices={parts.keys} cast={false} />+ {TASK_CHAIR_PARTS.map((part, i) => (+ <InstancedParts key={i} geometry={part.geometry} material={chairMaterial[CHAIR_FINISH[part.finish]]} matrices={parts.chair} cast={part.cast} />+ ))}+ {FACES.map((face) => <InstancedParts key={face} geometry={SCREEN} material={screenMaterial(face)} matrices={parts.faces.get(face)!} cast={false} />)}+ </group>+ );+}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 283659fc4b..867ccd13c8 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 { CODING_STUDIOS, DEPARTMENT_ZONES } from "./officePalette";+import { DEPARTMENT_ZONES } from "./officePalette";const agent = (id: string, provider: string): OfficeAgentInput => ({agentId: id, name: id, tier: "specialist", providerLabel: provider, state: "working", createdMs: 0,@@ -166,14 +166,12 @@ describe("agents floor fittings on the campus", () => {});describe("agents floor rugs", () => {- it("gives the twelve studios a floor can hold twelve different rugs, none shared with the coding floor", () => {+ it("gives the twelve studios a floor can hold twelve different rugs", () => {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/codingAmbience.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.tsindex d59355d85f..325de46d94 100644--- a/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.ts@@ -14,10 +14,8 @@ describe("coding floor ambience", () => {const layout = buildOfficeLayout(Array.from({ length: count }, (_, i) => agent(`a${i}`, `P${i % 5}`)), { variant: "coding" });const items = codingAmbience(layout);- it(`stands in the window strip, clear of every department and room (${count} agents)`, () => {- expect(items.some((i) => i.kind === "tree")).toBe(true);- expect(items.some((i) => i.kind === "library")).toBe(true);- expect(items.some((i) => i.kind === "trough")).toBe(true);+ it(`stands clear of every neighbourhood and room (${count} agents)`, () => {+ for (const kind of ["tree", "booth", "trough", "grove"] as const) expect(items.some((i) => i.kind === kind), kind).toBe(true);for (const item of items) {for (const area of [...layout.departments, ...layout.rooms]) expect(overlaps(item, area), item.id).toBe(false);expect(item.minX, item.id).toBeGreaterThan(layout.bounds.minX + 0.2);@@ -35,6 +33,26 @@ describe("coding floor ambience", () => {});}+ it("plants a grove on the concourse in every row, clear of the town square round the spawn terminal", () => {+ const layout = buildOfficeLayout(Array.from({ length: 30 }, (_, i) => agent(`a${i}`, `P${i % 6}`)), { variant: "coding" });+ const groves = codingAmbience(layout).filter((i) => i.kind === "grove");+ const rows = new Set(layout.departments.map((d) => d.minZ));+ expect(groves).toHaveLength(rows.size);+ const terminal = layout.furniture.find((f) => f.kind === "spawnTerminal")!;+ for (const grove of groves) {+ const cx = (grove.minX + grove.maxX) / 2, cz = (grove.minZ + grove.maxZ) / 2;+ expect(Math.hypot(cx - terminal.x, cz - terminal.z), grove.id).toBeGreaterThan(4);+ }+ });++ it("gives every phone booth the colour of the neighbourhood beside it", () => {+ const layout = buildOfficeLayout(Array.from({ length: 30 }, (_, i) => agent(`a${i}`, `P${i % 6}`)), { variant: "coding" });+ for (const booth of codingAmbience(layout).filter((i) => i.kind === "booth")) {+ const index = Number(booth.id.split("-")[1]);+ expect(booth.tint, booth.id).toBe(layout.departments[index].tint);+ }+ });+it("adds nothing to the agents office and keeps ids unique", () => {const agents = buildOfficeLayout([]);for (const item of codingAmbience(agents)) {diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.tsindex afdd19775c..5cbfe7f281 100644--- a/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts@@ -1,45 +1,53 @@/*** The coding floor's open-plan dressing as data: tree planters closing every- * cross aisle at the windows, a low library of bookcases along the west glass- * and planter troughs along the east glass, each beside a department and- * split round its window spot.+ * cross aisle at the windows; beside each outer neighbourhood a phone booth+ * and a planter trough along the glass, either side of its window spot; and+ * down the concourse, the floor's main street, a grove — a tall tree in a+ * round planter ringed by a bench — in the middle of every row of+ * neighbourhoods.** Pure and shared: the layout adds every item to its obstacles, the renderer- * builds each piece inside the same box. Everything stands in the 1.6 m window- * strip between the departments and the railing, so no desk, room door or- * checkpoint loses its way in.+ * builds each piece inside the same box. The window pieces stand in the+ * 1.6 m strip between the neighbourhoods and the glass; the groves stand on+ * the concourse's centre line, clear of the cross aisles and the town square.*/import type { Rect } from "./officeLayout";-export type AmbienceKind = "tree" | "library" | "trough";+export type AmbienceKind = "tree" | "booth" | "trough" | "grove";export interface AmbienceItem extends Rect {id: string;kind: AmbienceKind;- /** The side the piece's front looks at: bookcases face into the office. */+ /** The side the piece's front looks at: a booth's door faces into the office. */facing: "east" | "west";- /** Height of the piece in metres (the tree's crown top). */+ /** Height of the piece in metres (a tree's crown top). */h: number;+ /** The neighbourhood a booth belongs to (its tint index): the booth wears that team's colour. */+ tint?: number;}-/** A tree planter's square footprint, and how far its centre stands out from the department column. */+/** A tree planter's square footprint, and how far its centre stands out from the neighbourhood column. */export const TREE_BOX = 0.84;const TREE_OUT = 0.8;-/** Bookcases and troughs: depth, and the band they stand in, measured out from the department column. */-const SHELF_DEPTH = 0.32;-const SHELF_OUT = 1.04;-/** Half the gap left round a department's window spot, and the margin at the department's ends. */+/** Troughs: depth, and the band they stand in, measured out from the neighbourhood column. */+const TROUGH_DEPTH = 0.32;+const TROUGH_OUT = 1.04;+/** A phone booth: depth across the strip, length along it, and its gap to the neighbourhood column. */+export const BOOTH = { d: 1.0, len: 1.15, out: 0.28, h: 2.25 } as const;+/** Half the gap left round a neighbourhood's window spot, and the margin at its ends. */const WINDOW_GAP = 0.85;const END_MARGIN = 0.35;const MIN_RUN = 1.2;+/** A grove's round footprint (its square box) on the concourse. */+export const GROVE_BOX = 2.1;-export const LIBRARY_H = 1.02;export const TROUGH_H = 0.46;export const TREE_H = 2.35;+export const GROVE_H = 4.4;-/** Where the aisles are: the department rows and the room strips north and south of them. */+/** Where the aisles are: the neighbourhood rows and the room strips north and south of them. */export interface AmbienceFrame {- departments: readonly Rect[];+ departments: readonly (Rect & { tint?: number })[];rooms: readonly Rect[];}@@ -54,7 +62,7 @@ export function codingAmbience({ departments, rooms }: AmbienceFrame): AmbienceIconst south = rooms.filter((r) => r.minZ >= lastZ - 1e-6).map((r) => r.minZ);const items: AmbienceItem[] = [];- // Cross aisles: in front of the north rooms, between department rows, in front of the south strip.+ // Cross aisles: in front of the north rooms, between neighbourhood rows, in front of the south strip.const rowStarts = [...new Set(departments.map((d) => d.minZ))].sort((a, b) => a - b);const aisles: number[] = [];if (north.length > 0) aisles.push((Math.max(...north) + firstZ) / 2);@@ -72,23 +80,45 @@ export function codingAmbience({ departments, rooms }: AmbienceFrame): AmbienceI}});- // Beside each outer department: two runs, one either side of its window spot.+ // Beside each outer neighbourhood: a phone booth in the run north of its window spot, a trough in the run south of it.departments.forEach((dept, index) => {- const west = dept.minX <= colMinX + 1e-6;- const east = dept.maxX >= colMaxX - 1e-6;const zc = (dept.minZ + dept.maxZ) / 2;const runs = [[dept.minZ + END_MARGIN, zc - WINDOW_GAP], [zc + WINDOW_GAP, dept.maxZ - END_MARGIN]] as const;- runs.forEach(([z0, z1], run) => {- if (z1 - z0 < MIN_RUN) return;- if (west) {- items.push({ id: `library-${index}-${run}`, kind: "library", facing: "east", h: LIBRARY_H,- minX: colMinX - SHELF_OUT - SHELF_DEPTH, maxX: colMinX - SHELF_OUT, minZ: z0, maxZ: z1 });- }- if (east) {- items.push({ id: `trough-${index}-${run}`, kind: "trough", facing: "west", h: TROUGH_H,- minX: colMaxX + SHELF_OUT, maxX: colMaxX + SHELF_OUT + SHELF_DEPTH, minZ: z0, maxZ: z1 });- }- });+ for (const side of ["west", "east"] as const) {+ const outer = side === "west" ? dept.minX <= colMinX + 1e-6 : dept.maxX >= colMaxX - 1e-6;+ if (!outer) continue;+ const facing = side === "west" ? "east" : "west";+ runs.forEach(([z0, z1], run) => {+ if (z1 - z0 < MIN_RUN) return;+ if (run === 0) {+ const [minX, maxX] = side === "west"+ ? [colMinX - BOOTH.out - BOOTH.d, colMinX - BOOTH.out]+ : [colMaxX + BOOTH.out, colMaxX + BOOTH.out + BOOTH.d];+ items.push({ id: `booth-${index}-${side}`, kind: "booth", facing, h: BOOTH.h, tint: dept.tint ?? index,+ minX, maxX, minZ: z0, maxZ: z0 + BOOTH.len });+ return;+ }+ const [minX, maxX] = side === "west"+ ? [colMinX - TROUGH_OUT - TROUGH_DEPTH, colMinX - TROUGH_OUT]+ : [colMaxX + TROUGH_OUT, colMaxX + TROUGH_OUT + TROUGH_DEPTH];+ items.push({ id: `trough-${index}-${side}`, kind: "trough", facing, h: TROUGH_H, minX, maxX, minZ: z0, maxZ: z1 });+ });+ }});++ // The main street: a grove in the middle of every row, on the concourse's centre line.+ const west = departments.filter((d) => d.minX <= colMinX + 1e-6);+ const east = departments.filter((d) => d.maxX >= colMaxX - 1e-6 && d.minX > colMinX + 1e-6);+ if (west.length > 0 && east.length > 0) {+ const cx = (Math.max(...west.map((d) => d.maxX)) + Math.min(...east.map((d) => d.minX))) / 2;+ rowStarts.forEach((start, i) => {+ const row = departments.filter((d) => d.minZ === start);+ const z = (start + Math.max(...row.map((d) => d.maxZ))) / 2;+ items.push({+ id: `grove-${i}`, kind: "grove", facing: "east", h: GROVE_H,+ minX: cx - GROVE_BOX / 2, maxX: cx + GROVE_BOX / 2, minZ: z - GROVE_BOX / 2, maxZ: z + GROVE_BOX / 2,+ });+ });+ }return items;}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.tsindex 2c1680cdc7..b560a2670d 100644--- a/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts@@ -1,24 +1,22 @@import { describe, expect, it } from "vitest";+import { Color } from "three";-import { studioStyle } from "./CodingFloorLook";-import { CODING_STUDIOS, DEPARTMENT_TINTS } from "./officePalette";+import { CODING_SCENE, CODING_TEAMS, codingTeam } 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("gives the six neighbourhoods a floor can hold six different team colours, cycled for any index", () => {+ expect(new Set(CODING_TEAMS.map((t) => t.accent)).size).toBe(CODING_TEAMS.length);+ expect(CODING_TEAMS.length).toBeGreaterThanOrEqual(6);+ expect(codingTeam(CODING_TEAMS.length)).toBe(codingTeam(0));+ expect(codingTeam(-1)).toBe(codingTeam(CODING_TEAMS.length - 1));});- 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);+ it("keeps team colours apart from the busy lights' status colours", () => {+ for (const team of CODING_TEAMS) {+ for (const status of [CODING_SCENE.busy.working, CODING_SCENE.busy.waiting, CODING_SCENE.busy.error]) {+ const a = new Color(team.accent), b = new Color(status);+ expect(Math.hypot(a.r - b.r, a.g - b.g, a.b - b.b), `${team.accent} vs ${status}`).toBeGreaterThan(0.2);+ }+ }});});diff --git a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.tsindex 4a47242fff..caaab38f98 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts@@ -75,70 +75,64 @@ export const DEPARTMENT_ZONES = [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.+ * The coding floor's own look: a tech campus floor. Polished pale concrete is+ * the ground, a terrazzo main street runs down the middle, and every team+ * neighbourhood is an island of white oak with long shared tables, a living+ * moss wall carrying its name, and phone booths in its colour along the+ * glass. The agents floor below keeps its wide oak planks and limestone.*/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" },+ slabEdge: "#2b2a28",+ rim: "#ffe2bd",+ /** Daylight from a pale sky, a warm bounce off the oak. */+ sky: "#f6f4ef",+ ground: "#8a8076",+ /** Polished concrete: base, soft clouds of tone, and the saw-cut joints. */+ concrete: { base: "#d9d6d0", cloud: ["#d2cec7", "#e0ddd8", "#cfcbc4"], joint: "#b9b4ac" },+ /** The terrazzo main street, its chips, and the brass strip along its edges. */+ terrazzo: { base: "#ece7de", chips: ["#cfc5b5", "#b3a690", "#ddd2bf", "#93887a", "#c2a97e", "#7f8f86"] },+ /** White oak: the neighbourhoods' floor and the long tables. */+ oak: { seam: "#c4ad8c", planks: ["#e8dac2", "#e2d2b6", "#ecdfc9", "#ddcbad", "#efe4d0", "#e4d5bb"] },+ /** The living walls: moss tones, fern tones, and the white-oak frame. */+ moss: { base: "#4f6b3a", tones: ["#5d7b42", "#46613a", "#6e8a4b", "#3d5532", "#7a9655"], fern: "#86a85c", frame: "#d9c7a8" },+ /** The long tables' spine, legs and screens. */+ table: { top: "#e6d6ba", edge: "#cdb894", leg: "#2a2c30", spine: "#3a3d42", screen: "#eceae5" },+ brass: "#c9a24a",+ /** Linear pendants over the tables: body, lit underside and the pool of light below. */+ pendant: { body: "#f2f1ee", glow: "#fff1dc", pool: "#fff0d6" },/** The town square round the spawn terminal: the terrazzo medallion and its chips. */- plaza: { terrazzo: "#ebe4d8", chips: ["#cbc0ae", "#a99b86", "#dccfb8", "#8d806d", "#b99f72"] },+ plaza: { terrazzo: "#efe9df", 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;+/** A team neighbourhood's colour: the phone booths, chair seats and the stripe under its name. */+export interface TeamColours {+ /** The team's colour itself. */+ accent: string;+ /** A soft felt in that colour: booth interiors and seat fabric. */+ felt: 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.+ * One colour per neighbourhood, cycled by the department's tint index: clear,+ * friendly colours a company would paint its team areas in, each distinct+ * from the others and from the status colours of the busy lights.*/-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" },+export const CODING_TEAMS: readonly TeamColours[] = [+ { accent: "#3f7fd9", felt: "#6f9ee0" },+ { accent: "#e36a4f", felt: "#e99079" },+ { accent: "#e2b33c", felt: "#e8c56c" },+ { accent: "#2f9e8f", felt: "#62b5a9" },+ { accent: "#8a63c9", felt: "#a68bd6" },+ { accent: "#d1557f", felt: "#dc7f9e" },];+export function codingTeam(index: number): TeamColours {+ const n = CODING_TEAMS.length;+ return CODING_TEAMS[((index % n) + n) % n];+}+/** Colours of the room props (lobby, team room, wardrobe, break room). */export const PROP_COLOURS = {steel: "#aab2bc",