Skip to content

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.

feat(office): dress the coding floor's workstations and close each bench with planters

rubenluetke10-beepdcc7b6c1f699
diff --git a/jarvis/ui/web/frontend/src/components/society/office/DeskDressing.tsx b/jarvis/ui/web/frontend/src/components/society/office/DeskDressing.tsx
new file mode 100644
index 0000000000..4d537eadf0
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/DeskDressing.tsx
@@ -0,0 +1,160 @@
+/**
+ * The coding floor's lived-in workstations: desk mats, laptops on stands,
+ * lamps, succulents, books, bottles, notebooks, headphones on hooks, sticky
+ * notes, cable trays under the benches, and a planter box at each bench end.
+ *
+ * `deskKit.ts` decides what goes where; this draws it as one instanced
+ * mesh per part type across the whole floor, rebuilt only when the desks
+ * change. Geometries and materials are module-level singletons.
+ */
+import { useLayoutEffect, useMemo, useRef } from "react";
+import {
+ BufferGeometry, Color, CylinderGeometry, Euler, IcosahedronGeometry, InstancedMesh, Matrix4, MeshStandardMaterial,
+ PlaneGeometry, Quaternion, TorusGeometry, Vector3, type Material,
+} from "three";
+import { RoundedBoxGeometry } from "three-stdlib";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { dressDesk, kitPlacements, planterPlacements, type DressingPart, type Placement } from "./deskKit";
+import { GEO, MAT, matte } from "./OfficeFurniture";
+import { benchPlanters, type Department, type DeskSlot } from "./officeLayout";
+
+/** A few lines of code in a dark editor, for the laptop screens. */
+function drawLaptopScreen(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ ctx.fillStyle = "#15181f";
+ ctx.fillRect(0, 0, w, h);
+ ctx.fillStyle = "#1f2430";
+ ctx.fillRect(0, 0, w * 0.22, h);
+ const colours = ["#7dd3c0", "#c4a7f5", "#f0c987", "#8fb8f0", "#9aa3b2"];
+ let seed = 7;
+ for (let y = 8, line = 0; y < h - 4; y += 7, line += 1) {
+ seed = (seed * 1103515245 + 12345) >>> 0;
+ const indent = 4 + ((seed >>> 8) % 4) * 6;
+ let x = w * 0.22 + indent;
+ for (let word = 0; word < 1 + ((seed >>> 4) % 4); word += 1) {
+ const len = 8 + ((seed >>> (word * 3)) % 22);
+ ctx.fillStyle = colours[(line + word) % colours.length];
+ ctx.fillRect(x, y, len, 3);
+ x += len + 4;
+ }
+ }
+}
+
+const laptopScreen = (() => {
+ const map = cachedCanvasTexture("desk:laptop-code", 128, 80, drawLaptopScreen);
+ return new MeshStandardMaterial({
+ color: map ? "#ffffff" : "#1a1e27", map, roughness: 0.35,
+ emissive: "#ffffff", emissiveMap: map, emissiveIntensity: map ? 0.55 : 0,
+ });
+})();
+
+/** White base for parts coloured per instance. */
+const tintedMatte = matte("#ffffff", { roughness: 0.8 });
+const tintedGloss = matte("#ffffff", { roughness: 0.4 });
+const tintedLeaf = matte("#ffffff", { roughness: 0.75, flatShading: true });
+const aluminium = matte("#c7ccd3", { roughness: 0.35, metalness: 0.55 });
+const blackMetal = matte("#23262c", { roughness: 0.55, metalness: 0.3 });
+
+interface PartSpec { geometry: BufferGeometry; material: Material; tinted: boolean; cast: boolean }
+
+const PARTS: Record<DressingPart, PartSpec> = {
+ mat: { geometry: new RoundedBoxGeometry(0.82, 0.004, 0.34, 2, 0.002), material: tintedMatte, tinted: true, cast: false },
+ standPlate: { geometry: GEO.box, material: aluminium, tinted: false, cast: true },
+ standLeg: { geometry: GEO.box, material: aluminium, tinted: false, cast: false },
+ laptopBase: { geometry: new RoundedBoxGeometry(0.3, 0.012, 0.21, 2, 0.005), material: aluminium, tinted: false, cast: true },
+ laptopLid: { geometry: new RoundedBoxGeometry(0.3, 0.2, 0.007, 2, 0.003), material: aluminium, tinted: false, cast: true },
+ laptopScreen: { geometry: new PlaneGeometry(0.28, 0.18), material: laptopScreen, tinted: false, cast: false },
+ lampBase: { geometry: GEO.cyl, material: tintedGloss, tinted: true, cast: true },
+ lampArm: { geometry: GEO.cyl, material: tintedGloss, tinted: true, cast: true },
+ lampShade: { geometry: new CylinderGeometry(0.45, 1, 1, 16), material: tintedGloss, tinted: true, cast: true },
+ lampBulb: {
+ geometry: GEO.cyl, tinted: false, cast: false,
+ material: new MeshStandardMaterial({ color: "#fff2d6", emissive: "#ffd89a", emissiveIntensity: 1.6, toneMapped: false }),
+ },
+ pot: { geometry: GEO.potCyl, material: tintedGloss, tinted: true, cast: true },
+ soil: { geometry: GEO.cyl, material: MAT.soil, tinted: false, cast: false },
+ succulent: { geometry: new IcosahedronGeometry(1, 0), material: tintedLeaf, tinted: true, cast: true },
+ book: { geometry: GEO.box, material: tintedMatte, tinted: true, cast: true },
+ bottle: { geometry: GEO.cyl, material: tintedGloss, tinted: true, cast: true },
+ bottleCap: { geometry: GEO.cyl, material: blackMetal, tinted: false, cast: false },
+ notebook: { geometry: GEO.box, material: tintedMatte, tinted: true, cast: true },
+ notebookBand: { geometry: GEO.box, material: blackMetal, tinted: false, cast: false },
+ pen: { geometry: GEO.cyl, material: blackMetal, tinted: false, cast: false },
+ hook: { geometry: GEO.box, material: blackMetal, tinted: false, cast: false },
+ headband: { geometry: new TorusGeometry(0.08, 0.01, 8, 24, Math.PI), material: tintedMatte, tinted: true, cast: true },
+ earCup: { geometry: GEO.cyl, material: tintedMatte, tinted: true, cast: true },
+ note: { geometry: new PlaneGeometry(0.065, 0.065), material: tintedMatte, tinted: true, cast: false },
+ tray: { geometry: GEO.box, material: blackMetal, tinted: false, cast: false },
+ snake: { geometry: new CylinderGeometry(1, 1, 1, 10), material: blackMetal, tinted: false, cast: false },
+ puck: { geometry: GEO.box, material: aluminium, tinted: false, cast: false },
+ planterBody: { geometry: GEO.box, material: matte("#7a563b", { roughness: 0.7 }), tinted: false, cast: true },
+ planterPlinth: { geometry: GEO.box, material: blackMetal, tinted: false, cast: false },
+ planterRail: { geometry: GEO.box, material: MAT.wood, tinted: false, cast: false },
+ planterSoil: { geometry: GEO.box, material: MAT.soil, tinted: false, cast: false },
+ foliage: { geometry: GEO.blob, material: tintedLeaf, tinted: true, cast: true },
+ blade: { geometry: new CylinderGeometry(0.15, 1, 1, 4), material: tintedLeaf, tinted: true, cast: true },
+};
+const PART_KEYS = Object.keys(PARTS) as DressingPart[];
+
+interface Batch { matrices: Matrix4[]; colours: Color[] }
+
+const euler = new Euler(0, 0, 0, "YXZ");
+const quat = new Quaternion();
+const pos = new Vector3();
+const scl = new Vector3();
+
+function localMatrix(part: Placement): Matrix4 {
+ const [rx, ry, rz] = part.r ?? [0, 0, 0];
+ euler.set(rx, ry, rz, "YXZ");
+ return new Matrix4().compose(pos.set(...part.p), quat.setFromEuler(euler), scl.set(...(part.s ?? [1, 1, 1])));
+}
+
+/** Every instance of every part on the floor: desk kits (desk space → world) and planters (already world space). */
+export function buildDressing(desks: readonly DeskSlot[], departments: readonly Department[]): Map<DressingPart, Batch> {
+ const batches = new Map<DressingPart, Batch>(PART_KEYS.map((k) => [k, { matrices: [], colours: [] }]));
+ const add = (part: Placement, world?: Matrix4) => {
+ const batch = batches.get(part.part)!;
+ const local = localMatrix(part);
+ batch.matrices.push(world ? world.clone().multiply(local) : local);
+ batch.colours.push(new Color(part.c ?? "#ffffff"));
+ };
+ for (const desk of desks) {
+ const turn = desk.facing === "north" ? 0 : Math.PI;
+ const world = new Matrix4().makeRotationY(turn).setPosition(desk.x, 0, desk.z);
+ for (const part of kitPlacements(dressDesk(desk.id, desk.agentId !== null))) add(part, world);
+ }
+ for (const dept of departments) {
+ for (const { key, rect } of benchPlanters(dept)) for (const part of planterPlacements(rect, key)) add(part);
+ }
+ return batches;
+}
+
+function PartInstances({ spec, batch }: { spec: PartSpec; batch: Batch }) {
+ const ref = useRef<InstancedMesh>(null);
+ useLayoutEffect(() => {
+ const mesh = ref.current;
+ if (!mesh) return;
+ batch.matrices.forEach((m, i) => {
+ mesh.setMatrixAt(i, m);
+ if (spec.tinted) mesh.setColorAt(i, batch.colours[i]);
+ });
+ mesh.count = batch.matrices.length;
+ mesh.instanceMatrix.needsUpdate = true;
+ if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
+ mesh.computeBoundingSphere();
+ }, [spec, batch]);
+ return <instancedMesh ref={ref} args={[spec.geometry, spec.material, batch.matrices.length]} castShadow={spec.cast} receiveShadow frustumCulled={false} />;
+}
+
+/** The dressing of every bench desk on the floor and the planters of every department's benches. */
+export function DeskDressing({ desks, departments }: { desks: readonly DeskSlot[]; departments: readonly Department[] }) {
+ const batches = useMemo(() => buildDressing(desks, departments), [desks, departments]);
+ return (
+ <group>
+ {PART_KEYS.map((key) => {
+ const batch = batches.get(key)!;
+ // Keyed by count: an InstancedMesh cannot grow in place.
+ return batch.matrices.length > 0 ? <PartInstances key={`${key}:${batch.matrices.length}`} spec={PARTS[key]} batch={batch} /> : null;
+ })}
+ </group>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
index d054b81023..b3e0fc09cf 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
@@ -12,6 +12,7 @@ import type { SocietyAgent } from "../data";
import type { ToyLook } from "./toyFigureModel";
import { Railing, SignWall } from "./OfficeFurniture";
import { DeskInstances } from "./DeskInstances";
+import { DeskDressing } from "./DeskDressing";
import { CodingSlab, CodingStudio } from "./CodingFloorLook";
import { ExecutiveDesks, LeadOfficeLight } from "./LeadSuite";
import { LiveMonitors } from "./LiveMonitors";
@@ -255,7 +256,10 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag
<RoomWalls walls={layout.walls} />
{layout.rooms.map((room) => <RoomSign key={room.id} room={room} label={t(`society.office.room_${room.kind}`)} />)}
{coding
- ? layout.departments.map((dept) => <CodingStudio key={dept.id} dept={dept} agents={agents} />)
+ ? <>
+ {layout.departments.map((dept) => <CodingStudio key={dept.id} dept={dept} agents={agents} />)}
+ <DeskDressing desks={benchDesks} departments={layout.departments} />
+ </>
: <>
{layout.departments.map((dept) => <DepartmentArea key={dept.id} dept={dept} />)}
<DeskInstances desks={benchDesks} agents={agents} zones={zones} />
diff --git a/jarvis/ui/web/frontend/src/components/society/office/deskKit.test.ts b/jarvis/ui/web/frontend/src/components/society/office/deskKit.test.ts
new file mode 100644
index 0000000000..7aea31c873
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/deskKit.test.ts
@@ -0,0 +1,69 @@
+import { describe, expect, it } from "vitest";
+import { dressDesk, kitPlacements, planterPlacements } from "./deskKit";
+import { allDesks, benchPlanters, buildOfficeLayout, chairRect, deskRect, seatOf, type Rect } from "./officeLayout";
+
+const overlaps = (a: Rect, b: Rect) => a.minX < b.maxX && b.minX < a.maxX && a.minZ < b.maxZ && b.minZ < a.maxZ;
+
+const roster = (n: number) => Array.from({ length: n }, (_, i) => ({
+ agentId: `a${i}`, name: `A${i}`, tier: "specialist" as const, providerLabel: `ws${i % 3}`, state: "working" as const, createdMs: i,
+}));
+
+describe("desk dressing", () => {
+ it("dresses a desk the same way every time, from its id alone", () => {
+ for (const id of ["dept-0:0:north:0", "dept-2:1:south:3", "x"]) {
+ expect(dressDesk(id, true)).toEqual(dressDesk(id, true));
+ expect(kitPlacements(dressDesk(id, false))).toEqual(kitPlacements(dressDesk(id, false)));
+ }
+ });
+
+ it("varies from desk to desk", () => {
+ const kits = Array.from({ length: 32 }, (_, i) => dressDesk(`dept-0:${i >> 3}:north:${i & 7}`, true));
+ expect(new Set(kits.map((k) => k.mat)).size).toBeGreaterThan(2);
+ expect(new Set(kits.map((k) => k.side)).size).toBeGreaterThan(1);
+ expect(new Set(kits.map((k) => k.corner)).size).toBeGreaterThan(2);
+ });
+
+ it("keeps a desk's mat, plant and lamp when an agent sits down; only personal things are added", () => {
+ for (let i = 0; i < 40; i += 1) {
+ const id = `dept-1:0:south:${i}`;
+ const empty = dressDesk(id, false), taken = dressDesk(id, true);
+ expect(empty.mat).toBe(taken.mat);
+ expect(empty.notebook).toBeNull();
+ expect(empty.headphones).toBeNull();
+ expect(empty.notes).toBe(0);
+ expect(empty.side === "laptop").toBe(false);
+ if (empty.corner === "succulent") expect(taken.corner).toBe("succulent");
+ if (empty.side === "lamp") expect(taken.side).toBe("lamp");
+ }
+ });
+
+ it("never reaches into the monitor, so the live terminal screen stays clear", () => {
+ for (let i = 0; i < 60; i += 1) {
+ for (const part of kitPlacements(dressDesk(`d:${i}`, true))) {
+ const [x, y, z] = part.p;
+ // The screen: |x| ≤ 0.36, 0.965–1.395 m high, at z ≈ -0.21; nothing in front of it above the desk.
+ if (Math.abs(x) < 0.4 && z > -0.3 && z < 0.2) expect(y, part.part).toBeLessThan(0.96);
+ }
+ }
+ });
+
+ it("seeds each planter by its key", () => {
+ const rect = { minX: 0, maxX: 0.36, minZ: 0, maxZ: 1.56 };
+ expect(planterPlacements(rect, "k")).toEqual(planterPlacements(rect, "k"));
+ expect(planterPlacements(rect, "k")).not.toEqual(planterPlacements(rect, "other"));
+ });
+
+ it("stands the bench planters clear of every desk and chair", () => {
+ const layout = buildOfficeLayout(roster(20), { variant: "coding" });
+ const desks = allDesks(layout);
+ const planters = layout.departments.flatMap(benchPlanters);
+ expect(planters.length).toBe(layout.departments.reduce((n, d) => n + new Set(d.desks.map((k) => k.id.split(":").at(-3))).size * 2, 0));
+ for (const { rect } of planters) {
+ for (const desk of desks) {
+ expect(overlaps(rect, deskRect(desk))).toBe(false);
+ expect(overlaps(rect, chairRect(seatOf(desk)))).toBe(false);
+ }
+ expect(layout.obstacles).toContainEqual(rect);
+ }
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/deskKit.ts b/jarvis/ui/web/frontend/src/components/society/office/deskKit.ts
new file mode 100644
index 0000000000..c3b8b37e6d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/deskKit.ts
@@ -0,0 +1,285 @@
+/**
+ * What sits on (and under) every workstation of the coding floor, and the
+ * planter boxes at the ends of each bench. Pure: it says which parts go
+ * where; `DeskDressing.tsx` draws them, one instanced mesh per part.
+ *
+ * A desk's kit is seeded by its id, so the same desk always carries the same
+ * things and nothing jumps when the roster refetches. A desk nobody sits at
+ * is a clean hot desk (mat, maybe a plant or a lamp); an occupied one is
+ * lived in (a laptop on a stand, a notebook, headphones on a hook, sticky
+ * notes on the felt screen).
+ *
+ * Desk-local space matches `DeskInstances`: origin under the desk centre, the
+ * seated agent at +z looking north (-z) at its monitor, the top at 0.77 m.
+ * Nothing here reaches the monitor (|x| ≤ 0.36, above 0.96 m), so the live
+ * terminal screens stay readable and clickable.
+ */
+import { hashString } from "./toyFigureModel";
+import type { Rect } from "./officeLayout";
+
+export type Vec3 = [number, number, number];
+
+/** Every part type drawn; each is one instanced mesh across the whole floor. */
+export type DressingPart =
+ | "mat" | "standPlate" | "standLeg" | "laptopBase" | "laptopLid" | "laptopScreen"
+ | "lampBase" | "lampArm" | "lampShade" | "lampBulb"
+ | "pot" | "soil" | "succulent" | "book" | "bottle" | "bottleCap"
+ | "notebook" | "notebookBand" | "pen" | "hook" | "headband" | "earCup" | "note"
+ | "tray" | "snake" | "puck"
+ | "planterBody" | "planterPlinth" | "planterRail" | "planterSoil" | "foliage" | "blade";
+
+/**
+ * One part in place. `r` is an Euler rotation applied in YXZ order (a yaw,
+ * then a tilt), `s` the scale (the size, for the unit box and cylinder), `c`
+ * the instance colour of a tinted part.
+ */
+export interface Placement { part: DressingPart; p: Vec3; r?: Vec3; s?: Vec3; c?: string }
+
+export const DRESSING_COLOURS = {
+ mat: ["#2e3136", "#454a52", "#7f9a86", "#c98f6f", "#d9d0c1", "#3d4b63"],
+ lamp: ["#1f2226", "#f1efe9", "#7f9a86", "#c96f4a"],
+ pot: ["#c56f4f", "#eeeae3", "#34373d", "#9fb4a0"],
+ leaf: ["#5f8f5a", "#78a86a", "#8fb89a", "#4d7a52"],
+ book: ["#c8553d", "#e9b44c", "#4f7cac", "#5e9c76", "#8d6cab", "#e7e2d8", "#2f3a4f"],
+ bottle: ["#c9ced6", "#8fae96", "#e27d60", "#34507a", "#f3f1ec"],
+ notebook: ["#1f2226", "#b08a5f", "#34507a", "#8a3b34", "#5e7d63"],
+ headphones: ["#1f2226", "#eeeae3", "#7f9a86", "#c9b79c"],
+ note: ["#f7d65a", "#f29fb5", "#9fe0c3", "#9cc8f2"],
+ foliage: ["#4f8f52", "#2f6b3f", "#77ad64", "#3e7d4a", "#5f9a58"],
+ blade: ["#2f6b3f", "#3f7d45", "#5a8f4c"],
+} as const;
+
+/** The things one desk carries; every field is decided by the desk id alone (and whether someone sits there). */
+export interface DeskKit {
+ /** Desk mat colour index. */
+ mat: number;
+ /** Back-left corner. */
+ corner: "succulent" | "books" | "bottle" | null;
+ /** Back-right, beside the monitor. */
+ side: "laptop" | "lamp" | null;
+ /** Colour index per part, and small turns so no two desks are laid out alike. */
+ cornerColour: number;
+ sideColour: number;
+ notebook: number | null;
+ headphones: number | null;
+ /** Sticky notes on the felt screen, 0–3. */
+ notes: number;
+ /** Seeded jitter in [-1, 1) for yaw and placement. */
+ jitter: [number, number, number];
+}
+
+/** A small deterministic generator (mulberry32) seeded from a string. */
+export function seeded(key: string): () => number {
+ let state = hashString(key);
+ return () => {
+ state = (state + 0x6d2b79f5) >>> 0;
+ let t = state;
+ t = Math.imul(t ^ (t >>> 15), t | 1);
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
+ return ((t ^ (t >>> 14)) >>> 0) / 0x1_0000_0000;
+ };
+}
+
+const pick = (n: number, r: number) => Math.min(n - 1, Math.floor(r * n));
+
+/**
+ * The kit of one desk. Every random draw is taken in the same order whether
+ * or not the desk is occupied, so a desk that gains an agent keeps its mat,
+ * plant and lamp and only gains the personal things.
+ */
+export function dressDesk(deskId: string, occupied: boolean): DeskKit {
+ const rand = seeded(`desk-dressing:${deskId}`);
+ const mat = pick(DRESSING_COLOURS.mat.length, rand());
+ const cornerRoll = rand(), sideRoll = rand();
+ const cornerColour = Math.floor(rand() * 64), sideColour = Math.floor(rand() * 64);
+ const notebookRoll = rand(), notebookColour = pick(DRESSING_COLOURS.notebook.length, rand());
+ const headRoll = rand(), headColour = pick(DRESSING_COLOURS.headphones.length, rand());
+ const notes = pick(4, rand());
+ const jitter: [number, number, number] = [rand() * 2 - 1, rand() * 2 - 1, rand() * 2 - 1];
+ if (!occupied) {
+ return {
+ mat, corner: cornerRoll < 0.45 ? "succulent" : null, side: sideRoll < 0.35 ? "lamp" : null,
+ cornerColour, sideColour, notebook: null, headphones: null, notes: 0, jitter,
+ };
+ }
+ return {
+ mat,
+ corner: cornerRoll < 0.45 ? "succulent" : cornerRoll < 0.7 ? "books" : cornerRoll < 0.92 ? "bottle" : null,
+ side: sideRoll < 0.35 ? "lamp" : sideRoll < 0.88 ? "laptop" : null,
+ cornerColour, sideColour,
+ notebook: notebookRoll < 0.6 ? notebookColour : null,
+ headphones: headRoll < 0.5 ? headColour : null,
+ notes, jitter,
+ };
+}
+
+/** Places a sub-assembly's parts: rotate by `yaw` about the assembly origin, then move it to (x, z). */
+function assembly(x: number, z: number, yaw: number, parts: Placement[]): Placement[] {
+ const cos = Math.cos(yaw), sin = Math.sin(yaw);
+ return parts.map((part) => {
+ const [px, py, pz] = part.p;
+ const [rx, ry, rz] = part.r ?? [0, 0, 0];
+ return { ...part, p: [x + px * cos + pz * sin, py, z - px * sin + pz * cos], r: [rx, ry + yaw, rz] };
+ });
+}
+
+const TOP = 0.77;
+const at = <T>(list: readonly T[], i: number): T => list[((i % list.length) + list.length) % list.length];
+
+/** A laptop open on an aluminium stand, its front at +z. */
+function laptop(): Placement[] {
+ const tilt = 0.3, lid = -0.25;
+ return [
+ { part: "standPlate", p: [0, 0.815, 0], r: [tilt, 0, 0], s: [0.24, 0.008, 0.22] },
+ { part: "standLeg", p: [0, 0.807, -0.1], s: [0.2, 0.075, 0.012] },
+ { part: "laptopBase", p: [0, 0.826, 0.002], r: [tilt, 0, 0] },
+ { part: "laptopLid", p: [0, 0.954, -0.125], r: [lid, 0, 0] },
+ { part: "laptopScreen", p: [0, 0.9552, -0.1206], r: [lid, 0, 0] },
+ ];
+}
+
+/** An anglepoise desk lamp; its head reaches out along +z. */
+function lamp(colour: string): Placement[] {
+ return [
+ { part: "lampBase", p: [0, TOP + 0.0075, 0], s: [0.06, 0.015, 0.06], c: colour },
+ { part: "lampArm", p: [0, 0.9225, -0.03], r: [-0.215, 0, 0], s: [0.008, 0.2815, 0.008], c: colour },
+ { part: "lampArm", p: [0, 1.04, 0.07], r: [1.723, 0, 0], s: [0.008, 0.263, 0.008], c: colour },
+ { part: "lampShade", p: [0, 0.995, 0.2], s: [0.055, 0.07, 0.055], c: colour },
+ { part: "lampBulb", p: [0, 0.957, 0.2], s: [0.042, 0.004, 0.042] },
+ ];
+}
+
+/** A succulent in a small ceramic pot: a rosette of fleshy leaves round a heart. */
+function succulent(colour: number, turn: number): Placement[] {
+ const potH = 0.07;
+ const leaf = (i: number) => at(DRESSING_COLOURS.leaf, colour + i);
+ const ring = Array.from({ length: 5 }, (_, i): Placement => {
+ const a = turn + (i * 2 * Math.PI) / 5;
+ return { part: "succulent", p: [Math.sin(a) * 0.03, TOP + potH + 0.012, Math.cos(a) * 0.03], r: [0, a, 0], s: [0.022, 0.014, 0.034], c: leaf(i % 2) };
+ });
+ return [
+ { part: "pot", p: [0, TOP + potH / 2, 0], s: [0.048, potH, 0.048], c: at(DRESSING_COLOURS.pot, colour) },
+ { part: "soil", p: [0, TOP + potH + 0.001, 0], s: [0.043, 0.004, 0.043] },
+ ...ring,
+ { part: "succulent", p: [0, TOP + potH + 0.024, 0], s: [0.02, 0.022, 0.02], c: leaf(2) },
+ ];
+}
+
+/** Two or three hardbacks stacked flat, each a little askew. */
+function books(colour: number, jitter: number): Placement[] {
+ const count = 2 + (colour % 2);
+ const sizes: Vec3[] = [[0.2, 0.032, 0.26], [0.18, 0.026, 0.235], [0.16, 0.022, 0.21]];
+ let y = TOP;
+ return sizes.slice(0, count).map((s, i) => {
+ const placed: Placement = { part: "book", p: [0, y + s[1] / 2, 0], r: [0, (i - 1) * 0.18 + jitter * 0.1, 0], s, c: at(DRESSING_COLOURS.book, colour + i * 3) };
+ y += s[1];
+ return placed;
+ });
+}
+
+function bottle(colour: number): Placement[] {
+ return [
+ { part: "bottle", p: [0, TOP + 0.11, 0], s: [0.034, 0.22, 0.034], c: at(DRESSING_COLOURS.bottle, colour) },
+ { part: "bottleCap", p: [0, TOP + 0.235, 0], s: [0.027, 0.03, 0.027] },
+ ];
+}
+
+/** A closed notebook with an elastic band, a pen lying on it. */
+function notebook(colour: number): Placement[] {
+ return [
+ { part: "notebook", p: [0, TOP + 0.007, 0], s: [0.15, 0.014, 0.21], c: at(DRESSING_COLOURS.notebook, colour) },
+ { part: "notebookBand", p: [0.055, TOP + 0.0075, 0], s: [0.008, 0.0155, 0.212] },
+ { part: "pen", p: [-0.01, TOP + 0.019, 0.01], r: [Math.PI / 2, 0.35, 0], s: [0.005, 0.14, 0.005] },
+ ];
+}
+
+/** Over-ear headphones hanging from a hook under the desk's front edge; the band parallel to the edge. */
+function headphones(colour: string): Placement[] {
+ const z = 0.43, top = 0.708, radius = 0.08;
+ return [
+ { part: "hook", p: [0, 0.726, 0.42], s: [0.026, 0.012, 0.06] },
+ { part: "hook", p: [0, 0.713, 0.449], s: [0.026, 0.03, 0.008] },
+ { part: "headband", p: [0, top - radius, z], c: colour },
+ ...[-1, 1].map((side): Placement => ({
+ part: "earCup", p: [side * (radius + 0.004), top - radius - 0.035, z], r: [0, 0, Math.PI / 2], s: [0.046, 0.034, 0.046], c: colour,
+ })),
+ ];
+}
+
+/** Every part of one desk's kit, in desk-local space. */
+export function kitPlacements(kit: DeskKit): Placement[] {
+ const [j0, j1, j2] = kit.jitter;
+ const out: Placement[] = [
+ // Felt desk mat under the keyboard and mouse.
+ { part: "mat", p: [0.06, TOP + 0.002, 0.22], c: DRESSING_COLOURS.mat[kit.mat] },
+ // Cable tray under the back of the desk and the snake that feeds it from a floor box.
+ { part: "tray", p: [0, 0.64, -0.3], s: [1.2, 0.05, 0.14] },
+ { part: "snake", p: [-0.25, 0.3075, -0.34], s: [0.022, 0.615, 0.022] },
+ { part: "puck", p: [-0.25, 0.012, -0.34], s: [0.13, 0.024, 0.13] },
+ ];
+ if (kit.side === "laptop") out.push(...assembly(0.56 + j0 * 0.02, -0.1, -0.45 + j1 * 0.08, laptop()));
+ if (kit.side === "lamp") out.push(...assembly(0.62, -0.27, -1.0 + j1 * 0.15, lamp(at(DRESSING_COLOURS.lamp, kit.sideColour))));
+ const cornerX = -0.6 + j2 * 0.03, cornerZ = -0.24;
+ if (kit.corner === "succulent") out.push(...assembly(cornerX, cornerZ, 0, succulent(kit.cornerColour, j0 * Math.PI)));
+ if (kit.corner === "books") out.push(...assembly(cornerX + 0.02, cornerZ + 0.02, 0.2 + j0 * 0.2, books(kit.cornerColour, j1)));
+ if (kit.corner === "bottle") out.push(...assembly(cornerX - 0.02, cornerZ + 0.02, 0, bottle(kit.cornerColour)));
+ if (kit.notebook !== null) out.push(...assembly(-0.48, 0.26, 0.12 + j2 * 0.22, notebook(kit.notebook)));
+ if (kit.headphones !== null) out.push(...assembly(-0.52, 0, 0, headphones(DRESSING_COLOURS.headphones[kit.headphones])));
+ for (let i = 0; i < kit.notes; i += 1) {
+ // Pinned to the felt screen left of the monitor, a hair in front of its face.
+ out.push({
+ part: "note", p: [-0.44 - i * 0.085, 1.02 + ((i * 37 + Math.round(j1 * 10)) % 5) * 0.012, -0.3935],
+ r: [0, 0, (i % 2 === 0 ? 1 : -1) * 0.08 + j0 * 0.05], c: at(DRESSING_COLOURS.note, kit.cornerColour + i),
+ });
+ }
+ return out;
+}
+
+/** Planter box: height, rail width, and how far the soil sits below the rim. */
+export const PLANTER_H = 0.46;
+const RAIL = 0.035;
+
+/**
+ * A low walnut planter box on a recessed black plinth, oak-rimmed, full of
+ * mixed foliage and tall snake-plant blades, filling `rect` (world space, long
+ * side along z). Seeded by `key`.
+ */
+export function planterPlacements(rect: Rect, key: string): Placement[] {
+ const rand = seeded(`planter:${key}`);
+ const cx = (rect.minX + rect.maxX) / 2, cz = (rect.minZ + rect.maxZ) / 2;
+ const w = rect.maxX - rect.minX, d = rect.maxZ - rect.minZ;
+ const plinth = 0.05;
+ const out: Placement[] = [
+ { part: "planterPlinth", p: [cx, plinth / 2, cz], s: [w - 0.06, plinth, d - 0.06] },
+ { part: "planterBody", p: [cx, plinth + (PLANTER_H - plinth) / 2, cz], s: [w, PLANTER_H - plinth, d] },
+ { part: "planterSoil", p: [cx, PLANTER_H - 0.03, cz], s: [w - RAIL * 2, 0.01, d - RAIL * 2] },
+ { part: "planterRail", p: [rect.minX + RAIL / 2, PLANTER_H + 0.01, cz], s: [RAIL, 0.02, d + 0.01] },
+ { part: "planterRail", p: [rect.maxX - RAIL / 2, PLANTER_H + 0.01, cz], s: [RAIL, 0.02, d + 0.01] },
+ { part: "planterRail", p: [cx, PLANTER_H + 0.01, rect.minZ + RAIL / 2], s: [w - RAIL * 2, 0.02, RAIL] },
+ { part: "planterRail", p: [cx, PLANTER_H + 0.01, rect.maxZ - RAIL / 2], s: [w - RAIL * 2, 0.02, RAIL] },
+ ];
+ // Foliage in two staggered rows of mixed sizes, so it reads as plants, not a clipped hedge.
+ const clusters = Math.max(4, Math.round(d / 0.16));
+ for (let i = 0; i < clusters; i += 1) {
+ const z = rect.minZ + RAIL + 0.08 + (i + 0.5) * ((d - RAIL * 2 - 0.16) / clusters);
+ const size = 0.06 + rand() * rand() * 0.16;
+ out.push({
+ part: "foliage", p: [cx + (i % 2 === 0 ? -1 : 1) * w * 0.14 + (rand() - 0.5) * 0.04, PLANTER_H + size * 0.5, z],
+ r: [0, rand() * Math.PI, 0], s: [size * 1.1, size * (0.7 + rand() * 0.6), size], c: at(DRESSING_COLOURS.foliage, Math.floor(rand() * 16)),
+ });
+ }
+ // Snake-plant blades rising out of the foliage, in a few tufts.
+ const tufts = 2 + Math.floor(rand() * 2);
+ for (let t = 0; t < tufts; t += 1) {
+ const tz = rect.minZ + 0.2 + ((t + 0.5) / tufts) * (d - 0.4);
+ const blades = 3 + Math.floor(rand() * 3);
+ for (let i = 0; i < blades; i += 1) {
+ const h = 0.3 + rand() * 0.28;
+ out.push({
+ part: "blade", p: [cx + (rand() - 0.5) * 0.08, PLANTER_H + h / 2 - 0.02, tz + (rand() - 0.5) * 0.1],
+ r: [(rand() - 0.5) * 0.35, rand() * Math.PI, (rand() - 0.5) * 0.35], s: [0.032, h, 0.012], c: at(DRESSING_COLOURS.blade, Math.floor(rand() * 8)),
+ });
+ }
+ }
+ return out;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
index 4763d852e1..ca06a0f744 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
@@ -308,6 +308,32 @@ export function deskRect(desk: Pick<DeskSlot, "x" | "z" | "size">): Rect {
return { minX: desk.x - w / 2, maxX: desk.x + w / 2, minZ: desk.z - d / 2, maxZ: desk.z + d / 2 };
}
+/** A planter box at each end of a coding-floor bench: its width, length and the gap to the end desk. */
+export const BENCH_PLANTER = { w: 0.36, d: 1.56, gap: 0.14 } as const;
+
+/**
+ * The planter boxes closing off each bench of a department, west and east,
+ * keyed "<deptId>:<bench>:w|e". They stand in the dead end between the two
+ * desk rows, clear of the chairs and the walkway behind them.
+ */
+export function benchPlanters(dept: Pick<Department, "id" | "desks">): { key: string; rect: Rect }[] {
+ const benches = new Map<string, DeskSlot[]>();
+ for (const desk of dept.desks) {
+ const bench = desk.id.split(":").at(-3) ?? "0";
+ benches.set(bench, [...(benches.get(bench) ?? []), desk]);
+ }
+ const half = DESK_SIZE.w / 2 + BENCH_PLANTER.gap;
+ return [...benches.entries()].flatMap(([bench, desks]) => {
+ const z = desks.reduce((sum, d) => sum + d.z, 0) / desks.length;
+ const west = Math.min(...desks.map((d) => d.x)) - half, east = Math.max(...desks.map((d) => d.x)) + half;
+ const zs = { minZ: z - BENCH_PLANTER.d / 2, maxZ: z + BENCH_PLANTER.d / 2 };
+ return [
+ { key: `${dept.id}:${bench}:w`, rect: { minX: west - BENCH_PLANTER.w, maxX: west, ...zs } },
+ { key: `${dept.id}:${bench}:e`, rect: { minX: east, maxX: east + BENCH_PLANTER.w, ...zs } },
+ ];
+ });
+}
+
/** Half the width of the executive chair; unlike bench chairs it is solid, so nobody walks through it. */
export const EXECUTIVE_CHAIR_HALF = 0.32;
@@ -640,6 +666,8 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
...departments.map((d) => ({ minX: d.minX + 0.2, maxX: d.maxX - 0.2, minZ: d.minZ + 0.02, maxZ: d.minZ + 0.2 })),
...furniture.filter((f) => FURNITURE_SIZE[f.kind].solid).map(footprint),
...(coding ? commandDeskObstacles(commandDeskAt) : []),
+ // Planter boxes at the bench ends on the coding floor.
+ ...(coding ? departments.flatMap(benchPlanters).map((p) => p.rect) : []),
// The posts of an open room's name arch are solid too; nobody walks through them.
...rooms.filter((r) => !r.walled).flatMap(archPosts).map((p) => ({
minX: p.x - ARCH.post / 2, maxX: p.x + ARCH.post / 2, minZ: p.z - ARCH.post / 2, maxZ: p.z + ARCH.post / 2,