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(office): the office dog lives in three rooms and does a trick for a bone
rubenluetke10-beep99dd942e0321
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex 7aff93c645..55aa3d02cd 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -199,11 +199,14 @@ purpose, so the boss's room reads as the most precious place on the floorthrough it. Walk up and press E, or click the chair, to sit (`leadSeat.ts`);any movement stands the character up. Clicking the monitors dives into themand opens the lead agent in the agents view, like any agent's desk screen.-- **Office dog (`OfficeDog.tsx`, `dogLife.ts`):** a black-and-tan rottweiler figure with- jointed legs, head, ears, tail and tongue. It sleeps in its basket in the north-east- corner, gets up, roams the lead office, sniffs, sits and lies down, then goes home.- Pet it with E or a click: it sits, wags, shows hearts and follows the person for- 30 s before trotting back to bed. Client-side only, like the agents' idle life.+- **Office dog (`OfficeDog.tsx`, `dogLife.ts`, `dogProps.tsx`):** a black-and-tan+ rottweiler figure with jointed legs, head, ears, tail and tongue. It has baskets in+ the lead office, the team room and the break room and lives in the room of its+ current basket: sleeps, roams, sniffs, sits, lies down. Now and then it walks (never+ jumps) to another basket. Pet it with E or a click: it sits, wags, shows hearts and+ follows the person inside its room for 30 s. Easter egg: the treat jar beside the+ break room's coffee bar hands out a bone; give it to the dog and it begs, catches+ it, spins twice in the air with gold sparks and chews it in its basket.- Every piece stays inside its `FURNITURE_SIZE` footprint (props test) and thenavigation tests still reach every seat, spot and checkpoint.diff --git a/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsx b/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsxindex 5ddf71894b..0f4297b3f4 100644--- a/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsx@@ -18,6 +18,7 @@ import type { SocietyAgent } from "../data";import { canvasMaterial } from "./canvasMaterials";import { Box, matte, MAT, Rounded, screenMaterial } from "./OfficeFurniture";import { useT } from "@/i18n";+import { TreatJar } from "./dogProps";import { useLeadSeat } from "./leadSeat";import { SEAT_OFFSET, seatOf, type DeskSlot, type Furniture, type FurnitureKind, type Point, type Room } from "./officeLayout";import { useOfficeStore } from "./officeStore";@@ -471,6 +472,7 @@ export const LEAD_RENDERERS = {globe: () => <Globe />,floorLamp: () => <FloorLamp />,dogBed: () => <DogBed />,+ treatJar: () => <TreatJar />,} satisfies Partial<Record<FurnitureKind, (props: { item: Furniture }) => JSX.Element>>;// ---------------------------------------------------------------------------diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsxindex 96d90d611d..a624b8c1b3 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx@@ -9,16 +9,19 @@ import { useEffect, useMemo, useRef, useState } from "react";import { Billboard, Html } from "@react-three/drei";import { useFrame, type ThreeEvent } from "@react-three/fiber";import {- CylinderGeometry, ExtrudeGeometry, MeshStandardMaterial, Shape, SphereGeometry, TorusGeometry, type Group, type Mesh,+ CylinderGeometry, ExtrudeGeometry, MeshStandardMaterial, OctahedronGeometry, Shape, SphereGeometry, TorusGeometry,+ type Group, type Mesh,} from "three";import { useT } from "@/i18n";import { Rounded } from "./OfficeFurniture";import { createRng } from "./officeBehavior";import {- DOG_FOLLOW_FAR, DOG_FOLLOW_NEAR, DOG_PET_RANGE, DOG_PETTED_MS, DOG_POSE, DOG_RUN_SPEED, DOG_WALK_SPEED,- followPoint, nextDogStep, useOfficeDog, type DogActivity, type DogPose,+ DOG_CHEW_MS, DOG_FOLLOW_FAR, DOG_FOLLOW_NEAR, DOG_PET_RANGE, DOG_PETTED_MS, DOG_POSE, DOG_RUN_SPEED, DOG_TRICK_MS,+ DOG_WALK_SPEED, TREAT_JAR_RANGE, followPoint, insideRoom, nextDogStep, pickOtherBasket, useOfficeDog,+ type DogActivity, type DogPose,} from "./dogLife";-import type { Furniture, Room } from "./officeLayout";+import { TreatBone } from "./dogProps";+import type { Furniture, Rect, Room } from "./officeLayout";import { findPath, randomWalkablePoint, type NavGrid } from "./officeNav";import { stepMover, turnToward, type Mover } from "./officeMotion";import { player, useOfficeStore } from "./officeStore";@@ -69,7 +72,7 @@ function Bone({ radius, length, m, y = 0, geometry = DG.cyl }: { radius: number;/** Joint handles the animator writes every frame. */interface DogRig {body: Group | null; torso: Group | null; head: Group | null; tail: Group | null; tongue: Mesh | null;- eyesOpen: Group | null; eyesShut: Group | null;+ eyesOpen: Group | null; eyesShut: Group | null; mouthBone: Group | null;legs: { hip: Group | null; knee: Group | null }[];}@@ -139,6 +142,7 @@ function DogModel({ rig }: { rig: DogRig }) {<mesh key={s} geometry={DG.cyl} material={DM.eye} position={[s * 0.05, 0.058, 0.135]} rotation={[0, 0, Math.PI / 2]} scale={[0.004, 0.035, 0.004]} />))}</group>+ <group ref={(g) => { rig.mouthBone = g; }} position={[0, -0.06, 0.2]} visible={false}><TreatBone scale={0.75} /></group><mesh ref={(m) => { rig.tongue = m; }} geometry={DG.sphere} material={DM.tongue} position={[0, -0.085, 0.17]} scale={[0.028, 0.008, 0.045]} visible={false} /></group><Leg at={[-0.09, 0.0, 0.4]} rig={rig} index={0} thigh={0.05} />@@ -164,6 +168,8 @@ const POSES: Record<DogPose, Pose> = {// Sphinx: body low, forelegs stretched forward, hind legs tucked.lie: { pitch: 0, hipY: 0.15, front: -1.45, frontKnee: 0.1, hind: -1.25, hindKnee: 1.9, head: 0.05 },sleep: { pitch: 0, hipY: 0.14, front: -1.45, frontKnee: 0.1, hind: -1.25, hindKnee: 1.9, head: 0.55 },+ // Begging: up on the hind legs, front paws tucked against the chest.+ beg: { pitch: -1.2, hipY: 0.2, front: 0.5, frontKnee: -1.6, hind: -0.35, hindKnee: 1.35, head: -0.45 },};const damp = (from: number, to: number, k: number) => from + (to - from) * k;@@ -173,51 +179,89 @@ const damp = (from: number, to: number, k: number) => from + (to - from) * k;// ---------------------------------------------------------------------------export interface OfficeDogProps {- room: Room;- bed: Furniture;+ /** Every dog basket on the floor; the dog lives in the room of the one it last slept in. */+ beds: Furniture[];+ rooms: Room[];+ /** The treat jar that hands out bones, when the floor has one. */+ jar: Furniture | null;grid: NavGrid;awake: boolean;reduced: boolean;}-export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {+/** The part of a room the dog roams: its floor, a little in from the walls. */+function roamArea(room: Room): Rect {+ return { minX: room.minX + 0.4, maxX: room.maxX - 0.4, minZ: room.minZ + 0.5, maxZ: room.maxZ - 0.4 };+}++export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogProps) {const t = useT();const root = useRef<Group>(null);- const rig = useMemo<DogRig>(() => ({ body: null, torso: null, head: null, tail: null, tongue: null, eyesOpen: null, eyesShut: null, legs: [0, 1, 2, 3].map(() => ({ hip: null, knee: null })) }), []);+ const spin = useRef<Group>(null);+ const rig = useMemo<DogRig>(() => ({+ body: null, torso: null, head: null, tail: null, tongue: null, eyesOpen: null, eyesShut: null, mouthBone: null,+ legs: [0, 1, 2, 3].map(() => ({ hip: null, knee: null })),+ }), []);const rng = useMemo(() => createRng("office-dog"), []);- // Facing out of the corner, towards the middle of the room.- const homeHeading = useMemo(() => Math.atan2((room.minX + room.maxX) / 2 - bed.x, (room.minZ + room.maxZ) / 2 - bed.z), [room, bed]);- const mover = useRef<Mover>({ x: bed.x, z: bed.z, heading: homeHeading, path: [] });- const brain = useRef({ activity: "sleep" as DogActivity, until: Date.now() + 8000, roamsLeft: 0, lastPet: useOfficeDog.getState().petSeq, repathAt: 0 });+ const roomOf = useMemo(() => (bed: Furniture) => rooms.find((r) => r.kind === bed.room) ?? null, [rooms]);+ // Facing out of its corner, towards the middle of the basket's room.+ const headingAt = useMemo(() => (bed: Furniture) => {+ const room = roomOf(bed);+ return room ? Math.atan2((room.minX + room.maxX) / 2 - bed.x, (room.minZ + room.maxZ) / 2 - bed.z) : 0;+ }, [roomOf]);+ const basketKey = beds.map((b) => `${b.id}:${b.x.toFixed(2)}:${b.z.toFixed(2)}`).join("|");+ const first = beds[0];+ const mover = useRef<Mover>({ x: first.x, z: first.z, heading: headingAt(first), path: [] });+ const brain = useRef({+ activity: "sleep" as DogActivity, until: Date.now() + 8000, roamsLeft: 0, basket: 0, bone: false, startedAt: 0,+ lastPet: useOfficeDog.getState().petSeq, lastTreat: useOfficeDog.getState().treatSeq, repathAt: 0,+ });const pose = useRef<Pose>({ ...POSES.sleep });const gait = useRef(0);const [activity, setActivity] = useState<DogActivity>("sleep");const [hearts, setHearts] = useState(0);+ const [sparkles, setSparkles] = useState(0);const near = useOfficeDog((s) => s.near);- const within = useMemo(() => ({ minX: room.minX + 0.4, maxX: room.maxX - 0.4, minZ: room.minZ + 0.6, maxZ: room.maxZ - 0.4 }), [room]);+ const nearJar = useOfficeDog((s) => s.nearJar);+ const hasBone = useOfficeDog((s) => s.hasBone);- // A floor plan change (someone joined) puts the dog back in its basket.+ // A changed floor plan (someone joined) puts the dog back in its first basket.useEffect(() => {- mover.current = { x: bed.x, z: bed.z, heading: homeHeading, path: [] };- brain.current.activity = "sleep";+ const bed = beds[0];+ mover.current = { x: bed.x, z: bed.z, heading: headingAt(bed), path: [] };+ Object.assign(brain.current, { activity: "sleep", basket: 0, bone: false, until: Date.now() + 8000 });setActivity("sleep");- }, [bed.x, bed.z, homeHeading]);- useEffect(() => () => useOfficeDog.getState().set({ near: false, pending: false }), []);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [basketKey, headingAt]);+ useEffect(() => () => useOfficeDog.getState().set({ near: false, nearJar: false, pending: null }), []);+ // Dev-only handle for runtime checks (hold the dog still, read where it is).+ useEffect(() => {+ if (!import.meta.env.DEV) return;+ const w = window as unknown as Record<string, unknown>;+ w.__officeDog = { get brain() { return brain.current; }, get mover() { return mover.current; } };+ return () => { delete w.__officeDog; };+ }, []);const begin = (next: DogActivity, durationMs: number) => {const b = brain.current, m = mover.current;+ // Moving house: pick another basket; the walk there is the activity.+ if (next === "move") b.basket = pickOtherBasket(b.basket, beds.length, rng);+ const bed = beds[b.basket] ?? beds[0];+ const room = roomOf(bed);b.activity = next;b.until = Date.now() + durationMs;+ b.startedAt = Date.now();m.path = [];- if (next === "roam" && !reduced) {- const target = randomWalkablePoint(grid, rng, within);+ if (reduced) {+ // No walking with reduced motion: the dog stays where it is and just changes pose.+ if (next === "roam" || next === "home" || next === "move") { b.activity = "sleep"; b.until = Infinity; }+ } else if (next === "roam" && room) {+ const target = randomWalkablePoint(grid, rng, roamArea(room));m.path = (target && findPath(grid, m, target)) ?? [];- } else if (next === "home" && !reduced) {+ } else if (next === "home" || next === "move") {m.path = findPath(grid, m, bed) ?? [];- } else if (next === "home" || (next === "roam" && reduced)) {- m.x = bed.x; m.z = bed.z; m.heading = homeHeading;}- setActivity(next);+ setActivity(b.activity);};useFrame(({ clock }, rawDt) => {@@ -225,26 +269,44 @@ export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {const dt = Math.min(rawDt, 0.1);const now = Date.now();const b = brain.current, m = mover.current, dog = useOfficeDog.getState();+ const bed = beds[b.basket] ?? beds[0];+ const room = roomOf(bed);- // Petting: a new pet wakes it and turns it to the person.- if (dog.petSeq !== b.lastPet) {+ // A bone beats everything; a pet wakes it and turns it to the person.+ if (dog.treatSeq !== b.lastTreat) {+ b.lastTreat = dog.treatSeq;+ b.bone = true;+ begin("trick", DOG_TRICK_MS);+ setSparkles((n) => n + 1);+ } else if (dog.petSeq !== b.lastPet) {b.lastPet = dog.petSeq;- begin("petted", DOG_PETTED_MS);+ if (b.activity !== "trick") begin("petted", DOG_PETTED_MS);setHearts((h) => h + 1);}const toPerson = Math.hypot(player.x - m.x, player.z - m.z);const isNear = toPerson <= DOG_PET_RANGE;if (isNear !== dog.near) dog.set({ near: isNear });- if (dog.pending) {- if (isNear) dog.pet();- else if (player.path.length === 0) dog.set({ pending: false });+ const atJar = !!jar && Math.hypot(player.x - jar.x, player.z - jar.z) <= TREAT_JAR_RANGE;+ if (atJar !== dog.nearJar) dog.set({ nearJar: atJar });+ if (dog.pending === "pet") {+ if (isNear) dog.interact();+ else if (player.path.length === 0) dog.set({ pending: null });+ } else if (dog.pending === "jar") {+ if (atJar) dog.takeBone();+ else if (player.path.length === 0) dog.set({ pending: null });}// Movement and the schedule.let moved = 0;+ const advance = () => {+ const next = nextDogStep(b.activity, b.roamsLeft, rng, beds.length);+ b.roamsLeft = next.roamsLeft;+ begin(next.activity, next.durationMs);+ };if (b.activity === "follow") {- if (now >= b.until) begin("home", Infinity);- else if (!reduced) {+ // It follows inside its own room only; when the person leaves, it goes back to bed.+ if (now >= b.until || !room || !insideRoom(room, player)) begin("home", Infinity);+ else {if (toPerson > DOG_FOLLOW_FAR && now >= b.repathAt) {b.repathAt = now + 600;m.path = findPath(grid, m, followPoint(player, m)) ?? [];@@ -252,43 +314,49 @@ export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {moved = stepMover(m, toPerson > 4 ? DOG_RUN_SPEED : DOG_WALK_SPEED * 1.4, dt).moved;if (moved === 0) m.heading = turnToward(m.heading, Math.atan2(player.x - m.x, player.z - m.z), 6 * dt);}- } else if (b.activity === "roam" || b.activity === "home") {- const step = stepMover(m, DOG_WALK_SPEED, dt);+ } else if (b.activity === "roam" || b.activity === "home" || b.activity === "move") {+ const step = stepMover(m, b.activity === "move" ? DOG_WALK_SPEED * 1.2 : DOG_WALK_SPEED, dt);moved = step.moved;if (step.arrived) {- if (b.activity === "home") { m.x = bed.x; m.z = bed.z; }- const next = nextDogStep(b.activity, b.roamsLeft, rng);- b.roamsLeft = next.roamsLeft;- begin(next.activity, next.durationMs);+ if (b.activity !== "roam") { m.x = bed.x; m.z = bed.z; }+ // Carrying the bone home: settle down and chew on it.+ if (b.activity === "home" && b.bone) begin("chew", DOG_CHEW_MS);+ else advance();}} else {- if (b.activity === "petted") m.heading = turnToward(m.heading, Math.atan2(player.x - m.x, player.z - m.z), 8 * dt);- if (b.activity === "sleep" && m.x === bed.x && m.z === bed.z) m.heading = turnToward(m.heading, homeHeading, 4 * dt);- if (now >= b.until && !(reduced && b.activity === "sleep")) {- const next = nextDogStep(b.activity, b.roamsLeft, rng);- b.roamsLeft = next.roamsLeft;- begin(next.activity, next.durationMs);+ if (b.activity === "petted" || b.activity === "trick") m.heading = turnToward(m.heading, Math.atan2(player.x - m.x, player.z - m.z), 8 * dt);+ if ((b.activity === "sleep" || b.activity === "chew") && m.x === bed.x && m.z === bed.z) m.heading = turnToward(m.heading, headingAt(bed), 4 * dt);+ if (now >= b.until) {+ if (b.activity === "chew") b.bone = false;+ advance();}}// Place the figure; it lies a little higher on the basket's cushion.- const inBed = Math.hypot(m.x - bed.x, m.z - bed.z) < 0.05;+ const inBed = beds.some((d) => Math.hypot(m.x - d.x, m.z - d.z) < 0.05);+ const trickT = b.activity === "trick" ? (now - b.startedAt) / 1000 : -1;+ // The trick: beg (0–0.9 s), catch, then two spins in the air (0.9–2.7 s), land and sit proud.+ const spinning = trickT >= 0.9 && trickT < 2.7 && !reduced;+ const hop = spinning ? Math.abs(Math.sin(((trickT - 0.9) / 0.9) * Math.PI)) * 0.35 : 0;if (root.current) {- root.current.position.set(m.x, inBed ? 0.1 : 0, m.z);+ root.current.position.set(m.x, (inBed ? 0.1 : 0) + hop, m.z);root.current.rotation.y = m.heading;}+ if (spin.current) spin.current.rotation.y = spinning ? ((trickT - 0.9) / 1.8) * Math.PI * 4 : 0;// Blend the pose, then layer the gait, breathing, wag and head life on top.const walking = moved > 1e-4;- const target = POSES[walking ? "stand" : DOG_POSE[b.activity]];- const k = 1 - Math.exp(-8 * dt), p = pose.current;+ const trickPose: DogPose = trickT < 0 ? DOG_POSE[b.activity] : trickT < 0.9 ? "beg" : spinning ? "stand" : "sit";+ const target = POSES[walking ? "stand" : trickPose];+ const k = 1 - Math.exp(-(spinning ? 14 : 8) * dt), p = pose.current;(Object.keys(p) as (keyof Pose)[]).forEach((key) => { p[key] = damp(p[key], target[key], k); });const speed = moved / Math.max(dt, 1e-3);gait.current += dt * (walking ? 5 + speed * 3.2 : 0);- const swing = walking ? Math.sin(gait.current) * Math.min(0.6, 0.25 + speed * 0.12) : 0;+ const swing = walking ? Math.sin(gait.current) * Math.min(0.6, 0.25 + speed * 0.12) : spinning ? -0.5 : 0;const time = clock.elapsedTime;const sleeping = b.activity === "sleep";- const happy = b.activity === "petted" || b.activity === "follow";+ const chewing = b.activity === "chew";+ const happy = b.activity === "petted" || b.activity === "follow" || b.activity === "trick" || chewing;if (rig.body) {rig.body.position.y = p.hipY + (walking ? Math.abs(Math.sin(gait.current)) * 0.02 : 0);@@ -298,8 +366,8 @@ export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {const breath = 1 + Math.sin(time * (sleeping ? 1.4 : 2.6)) * (sleeping ? 0.03 : 0.012);rig.torso.scale.set(breath, breath, 1);}- // Diagonal pairs swing together: front-left with hind-right.- const phase = [swing, -swing, -swing, swing];+ // Diagonal pairs swing together: front-left with hind-right. Mid-spin all legs tuck.+ const phase = spinning ? [swing, swing, -swing, -swing] : [swing, -swing, -swing, swing];rig.legs.forEach((leg, i) => {const front = i < 2;if (leg.hip) leg.hip.rotation.x = (front ? p.front : p.hind) + phase[i];@@ -307,13 +375,17 @@ export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {});if (rig.head) {const sniffBob = b.activity === "sniff" ? Math.sin(time * 9) * 0.08 : 0;- rig.head.rotation.x = p.head + sniffBob + (sleeping ? Math.sin(time * 1.4) * 0.02 : 0);- const look = happy && !walking ? Math.sin(time * 1.3) * 0.25 : b.activity === "sniff" ? Math.sin(time * 1.7) * 0.4 : 0;+ const chew = chewing ? Math.sin(time * 7) * 0.08 : 0;+ rig.head.rotation.x = p.head + sniffBob + chew + (sleeping ? Math.sin(time * 1.4) * 0.02 : 0);+ const look = happy && !walking && !chewing ? Math.sin(time * 1.3) * 0.25 : b.activity === "sniff" ? Math.sin(time * 1.7) * 0.4 : 0;rig.head.rotation.y = damp(rig.head.rotation.y, look, k);- rig.head.rotation.z = damp(rig.head.rotation.z, b.activity === "petted" ? 0.22 : 0, k);+ rig.head.rotation.z = damp(rig.head.rotation.z, b.activity === "petted" || chewing ? 0.22 : 0, k);}if (rig.tail) rig.tail.rotation.y = Math.sin(time * (happy ? 22 : 6)) * (sleeping ? 0.05 : happy ? 0.7 : walking ? 0.35 : 0.15);- if (rig.tongue) rig.tongue.visible = happy || (walking && speed > 2) || b.activity === "sit";+ // The bone sits in its mouth from the catch until the chewing is done.+ const holding = b.bone && (trickT < 0 || trickT >= 0.7);+ if (rig.mouthBone) rig.mouthBone.visible = holding;+ if (rig.tongue) rig.tongue.visible = !holding && (happy || (walking && speed > 2) || b.activity === "sit");if (rig.eyesOpen) rig.eyesOpen.visible = !sleeping;if (rig.eyesShut) rig.eyesShut.visible = sleeping;});@@ -322,54 +394,109 @@ export function OfficeDog({ room, bed, grid, awake, reduced }: OfficeDogProps) {if (event.delta > 6) return;event.stopPropagation();const dog = useOfficeDog.getState();- if (dog.near) { dog.pet(); return; }- dog.set({ pending: true });+ if (dog.near) { dog.interact(); return; }+ dog.set({ pending: "pet" });useOfficeStore.getState().requestWalk({ x: mover.current.x, z: mover.current.z });};+ const onJarClick = (event: ThreeEvent<MouseEvent>) => {+ if (event.delta > 6 || !jar) return;+ event.stopPropagation();+ const dog = useOfficeDog.getState();+ if (dog.hasBone) return;+ if (dog.nearJar) { dog.takeBone(); return; }+ dog.set({ pending: "jar" });+ useOfficeStore.getState().requestWalk({ x: jar.x, z: jar.z });+ };+ const hover = (cursor: string) => () => { document.body.style.cursor = cursor; };+ const busy = activity === "petted" || activity === "trick";return (- <group ref={root} name="office-dog">- <DogModel rig={rig} />- {/* Generous invisible hit box: the dog is small from the usual camera distance. */}- <mesh position={[0, 0.35, 0.1]} visible={false} onClick={onClick}- onPointerOver={() => { document.body.style.cursor = "pointer"; }} onPointerOut={() => { document.body.style.cursor = ""; }}>- <boxGeometry args={[0.6, 0.7, 1.1]} />- </mesh>- {hearts > 0 && <Hearts key={hearts} animate={!reduced} />}- {near && activity !== "petted" && (- <Html center position={[0, 1.0, 0]} zIndexRange={[24, 0]}>- <span className="office-plate office-seat-prompt" data-office-ui><kbd>E</kbd>{t("society.office.dog_pet")}</span>- </Html>+ <>+ <group ref={root} name="office-dog">+ <group ref={spin}><DogModel rig={rig} /></group>+ {/* Generous invisible hit box: the dog is small from the usual camera distance. */}+ <mesh position={[0, 0.35, 0.1]} visible={false} onClick={onClick} onPointerOver={hover("pointer")} onPointerOut={hover("")}>+ <boxGeometry args={[0.6, 0.7, 1.1]} />+ </mesh>+ {hearts > 0 && <Burst key={`h${hearts}`} kind="heart" animate={!reduced} />}+ {sparkles > 0 && <Burst key={`s${sparkles}`} kind="spark" animate={!reduced} />}+ {near && !busy && (+ <Html center position={[0, 1.0, 0]} zIndexRange={[24, 0]}>+ <span className="office-plate office-seat-prompt" data-office-ui>+ <kbd>E</kbd>{t(hasBone ? "society.office.dog_treat" : "society.office.dog_pet")}+ </span>+ </Html>+ )}+ </group>+ {jar && (+ <group position={[jar.x, 0, jar.z]}>+ <mesh position={[0, 0.6, 0]} visible={false} onClick={onJarClick} onPointerOver={hover("pointer")} onPointerOut={hover("")}>+ <boxGeometry args={[0.6, 1.2, 0.6]} />+ </mesh>+ {nearJar && !hasBone && (+ <Html center position={[0, 1.55, 0]} zIndexRange={[24, 0]}>+ <span className="office-plate office-seat-prompt" data-office-ui><kbd>E</kbd>{t("society.office.dog_take_bone")}</span>+ </Html>+ )}+ </group>)}- </group>+ {hasBone && <CarriedBone />}+ </>);}-/** Three hearts float up from the dog's head and fade out. */-function Hearts({ animate }: { animate: boolean }) {+/** The bone the person carries from the jar, held out in front at hand height. */+function CarriedBone() {+ const group = useRef<Group>(null);+ useFrame(({ clock }) => {+ const g = group.current;+ if (!g) return;+ const reach = 0.32;+ g.position.set(player.x + Math.sin(player.heading) * reach, 0.72 + Math.sin(clock.elapsedTime * 3) * 0.02, player.z + Math.cos(player.heading) * reach);+ g.rotation.y = player.heading + Math.PI / 2;+ });+ return <group ref={group}><TreatBone scale={0.9} /></group>;+}++const SPARK = new OctahedronGeometry(1, 0);+const SPARK_MAT = new MeshStandardMaterial({ color: "#ffd44d", emissive: "#ffb300", emissiveIntensity: 1.2, roughness: 0.3, transparent: true });++/** Hearts float up from the dog's head (petting); gold sparks burst around it (the treat trick). */+function Burst({ kind, animate }: { kind: "heart" | "spark"; animate: boolean }) {const group = useRef<Group>(null);const start = useRef(-1);- const material = useMemo(() => DM.heart.clone(), []);+ const material = useMemo(() => (kind === "heart" ? DM.heart : SPARK_MAT).clone(), [kind]);useEffect(() => () => material.dispose(), [material]);+ const count = kind === "heart" ? 3 : 12;+ const life = kind === "heart" ? 3.2 : 2.6;useFrame(({ clock }) => {if (start.current < 0) start.current = clock.elapsedTime;const age = clock.elapsedTime - start.current;const g = group.current;if (!g) return;g.children.forEach((child, i) => {- const a = Math.max(0, age - i * 0.35);- child.position.set(Math.sin(a * 3 + i * 2) * 0.12 + (i - 1) * 0.12, 0.75 + (animate ? a * 0.45 : 0.1 * i), 0.25);- const s = a > 0 ? Math.min(1, a * 4) * 0.09 : 0;- child.scale.setScalar(s);+ if (kind === "heart") {+ const a = Math.max(0, age - i * 0.35);+ child.position.set(Math.sin(a * 3 + i * 2) * 0.12 + (i - 1) * 0.12, 0.75 + (animate ? a * 0.45 : 0.1 * i), 0.25);+ child.scale.setScalar(a > 0 ? Math.min(1, a * 4) * 0.09 : 0);+ } else {+ // Sparks fly out in a ring from mid-trick and drift down.+ const a = Math.max(0, age - 0.9);+ const angle = (i / count) * Math.PI * 2;+ const r = animate ? 0.2 + a * 0.9 : 0.5;+ child.position.set(Math.cos(angle) * r, 0.55 + (animate ? a * 0.6 - a * a * 0.35 : 0.2), Math.sin(angle) * r);+ child.rotation.set(age * 4, age * 3, 0);+ child.scale.setScalar(a > 0 ? 0.035 * Math.min(1, a * 5) : 0);+ }});- material.opacity = Math.max(0, 1 - Math.max(0, age - 1.6) / 1.2);- g.visible = age < 3.2;+ material.opacity = Math.max(0, 1 - Math.max(0, age - (life - 1.2)) / 1.2);+ g.visible = age < life;});return (<group ref={group}>- {[0, 1, 2].map((i) => (- <Billboard key={i}><mesh geometry={HEART} material={material} /></Billboard>- ))}+ {Array.from({ length: count }, (_, i) => (kind === "heart"+ ? <Billboard key={i}><mesh geometry={HEART} material={material} /></Billboard>+ : <mesh key={i} geometry={SPARK} material={material} />))}</group>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsxindex 8c2d2afec1..6a7dc84a79 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx@@ -131,7 +131,8 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {const seat = useLeadSeat.getState();if (seat.seated) { seat.set({ seated: null, standUp: true }); return; }if (seat.near) { seat.set({ seated: seat.near, pending: null }); return; }- if (useOfficeDog.getState().near) { useOfficeDog.getState().pet(); return; }+ // The dog: pet it, or hand over the bone; the treat jar hands one out.+ if (useOfficeDog.getState().interact()) return;const nearby = nearbyRef.current;if (nearby) useOfficeStore.getState().select(nearby);}, []);diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsxindex 0b4a1d70aa..d054b81023 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx@@ -222,7 +222,8 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag// Each desk takes its department's zone colour for the felt screen and the seat fabric.const zones = useMemo(() => new Map(layout.departments.flatMap((dept) => dept.desks.map((desk) => [desk.id, dept.tint] as const))), [layout]);const leadRoom = layout.rooms.find((r) => r.kind === "lead");- const dogBed = layout.furniture.find((f) => f.kind === "dogBed");+ const dogBeds = useMemo(() => layout.furniture.filter((f) => f.kind === "dogBed"), [layout]);+ const treatJar = layout.furniture.find((f) => f.kind === "treatJar") ?? null;const coding = floor === "coding";// The coding floor floats in a violet night of its own, so a glance tells the floors apart.const space = coding ? CODING_SCENE.space : OFFICE.space;@@ -279,7 +280,7 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag)}<FloorArrival floor={floor} layout={layout} grid={grid} ready={ready} /><OfficePlayer layout={layout} grid={grid} look={player.look} name={player.name} awake={awake} reduced={reduced} />- {leadRoom && dogBed && <OfficeDog room={leadRoom} bed={dogBed} grid={grid} awake={awake} reduced={reduced} />}+ {dogBeds.length > 0 && <OfficeDog beds={dogBeds} rooms={layout.rooms} jar={treatJar} grid={grid} awake={awake} reduced={reduced} />}<PlayerBubble height={OFFICE_FIGURE_HEIGHT_M + 0.49} /><OfficeAgents desks={desks} agents={agents} ctx={walkers} newcomers={newcomers} awake={awake} reduced={reduced} chats={chats}selectedId={selection?.kind === "agent" ? selection.id : null} onSelect={(id) => select({ kind: "agent", id })} />diff --git a/jarvis/ui/web/frontend/src/components/society/office/dogLife.test.ts b/jarvis/ui/web/frontend/src/components/society/office/dogLife.test.tsindex 12d4d56746..cd0dea0992 100644--- a/jarvis/ui/web/frontend/src/components/society/office/dogLife.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/dogLife.test.ts@@ -1,55 +1,132 @@-import { describe, expect, it } from "vitest";+import { beforeEach, describe, expect, it } from "vitest";import { createRng } from "./officeBehavior";-import { DOG_FOLLOW_MS, DOG_FOLLOW_NEAR, followPoint, nextDogStep, useOfficeDog, type DogActivity } from "./dogLife";+import {+ DOG_FOLLOW_MS, DOG_FOLLOW_NEAR, followPoint, insideRoom, nextDogStep, pickOtherBasket, useOfficeDog, type DogActivity,+} from "./dogLife";import { buildOfficeLayout, type OfficeAgentInput } from "./officeLayout";+import { buildNavGrid, findPath } from "./officeNav";++const lead: OfficeAgentInput = { agentId: "l", name: "L", tier: "lead", providerLabel: "", state: "idle", createdMs: 1 };describe("the office dog's day", () => {- it("always finds its way back to the basket", () => {+ it("always finds its way back to a basket, and sometimes moves to another one", () => {const rng = createRng("dog-test");- for (let run = 0; run < 50; run += 1) {+ let moves = 0;+ for (let run = 0; run < 60; run += 1) {let activity: DogActivity = "sleep";let roamsLeft = 0;- const seen = new Set<DogActivity>();for (let step = 0; step < 40 && !(step > 0 && activity === "sleep"); step += 1) {- const next = nextDogStep(activity, roamsLeft, rng);+ const next = nextDogStep(activity, roamsLeft, rng, 3);activity = next.activity;roamsLeft = next.roamsLeft;- seen.add(activity);+ if (activity === "move") moves += 1;}expect(activity).toBe("sleep");- expect(seen.has("home")).toBe(true);- expect(seen.has("roam")).toBe(true);}+ expect(moves).toBeGreaterThan(0);+ });++ it("never moves house when there is only one basket", () => {+ const rng = createRng("one-basket");+ for (let i = 0; i < 100; i += 1) expect(nextDogStep("sleep", 0, rng, 1).activity).not.toBe("move");+ });++ it("picks a different basket to move to", () => {+ const rng = createRng("pick");+ for (let i = 0; i < 50; i += 1) {+ const next = pickOtherBasket(1, 3, rng);+ expect(next).not.toBe(1);+ expect(next).toBeGreaterThanOrEqual(0);+ expect(next).toBeLessThan(3);+ }+ expect(pickOtherBasket(0, 1, rng)).toBe(0);});it("follows the person after being petted, then goes home", () => {const rng = createRng("dog-pet");- const follow = nextDogStep("petted", 0, rng);- expect(follow).toMatchObject({ activity: "follow", durationMs: DOG_FOLLOW_MS });+ expect(nextDogStep("petted", 0, rng)).toMatchObject({ activity: "follow", durationMs: DOG_FOLLOW_MS });expect(nextDogStep("follow", 0, rng).activity).toBe("home");});+ it("carries the treat home after the trick and falls asleep after chewing", () => {+ const rng = createRng("dog-treat");+ expect(nextDogStep("trick", 0, rng).activity).toBe("home");+ expect(nextDogStep("chew", 0, rng).activity).toBe("sleep");+ });+it("follows from a little behind the person, never on top of them", () => {- const person = { x: 0, z: 0, heading: 0 };- const p = followPoint(person, { x: 0, z: -3 });+ const p = followPoint({ x: 0, z: 0, heading: 0 }, { x: 0, z: -3 });expect(p.z).toBeLessThan(0);expect(Math.hypot(p.x, p.z)).toBeGreaterThan(DOG_FOLLOW_NEAR * 0.8);});- it("counts each pet once", () => {+ it("knows when the person has left its room", () => {+ const room = { minX: 0, maxX: 5, minZ: 0, maxZ: 4 };+ expect(insideRoom(room, { x: 2, z: 2 })).toBe(true);+ expect(insideRoom(room, { x: 2, z: 4.2 })).toBe(true);+ expect(insideRoom(room, { x: 2, z: 6 })).toBe(false);+ });+});++describe("petting and the treat", () => {+ beforeEach(() => useOfficeDog.setState({ near: false, nearJar: false, hasBone: false, pending: null }));++ it("pets once per press", () => {const before = useOfficeDog.getState().petSeq;- useOfficeDog.getState().set({ pending: true });- useOfficeDog.getState().pet();+ useOfficeDog.setState({ near: true, pending: "pet" });+ expect(useOfficeDog.getState().interact()).toBe(true);expect(useOfficeDog.getState().petSeq).toBe(before + 1);- expect(useOfficeDog.getState().pending).toBe(false);+ expect(useOfficeDog.getState().pending).toBeNull();+ });++ it("takes a bone at the jar and gives it to the dog instead of petting", () => {+ const { petSeq, treatSeq } = useOfficeDog.getState();+ useOfficeDog.setState({ nearJar: true });+ expect(useOfficeDog.getState().interact()).toBe(true);+ expect(useOfficeDog.getState().hasBone).toBe(true);+ useOfficeDog.setState({ nearJar: false, near: true });+ useOfficeDog.getState().interact();+ expect(useOfficeDog.getState()).toMatchObject({ hasBone: false, treatSeq: treatSeq + 1, petSeq });+ });++ it("does nothing when neither the dog nor the jar is in reach", () => {+ expect(useOfficeDog.getState().interact()).toBe(false);});+});- it("keeps the basket in the lead office's north-east corner", () => {- const lead: OfficeAgentInput = { agentId: "l", name: "L", tier: "lead", providerLabel: "", state: "idle", createdMs: 1 };- const layout = buildOfficeLayout([lead]);+describe("the dog on the floor plan", () => {+ const layout = buildOfficeLayout([lead]);+ const grid = buildNavGrid(layout);+ const beds = layout.furniture.filter((f) => f.kind === "dogBed");++ it("has a basket in the lead office, the team room and the break room", () => {+ expect(beds.map((b) => b.room).sort()).toEqual(["break", "lead", "team"]);const room = layout.rooms.find((r) => r.kind === "lead")!;- const bed = layout.furniture.find((f) => f.kind === "dogBed")!;- expect(bed.x).toBeGreaterThan(room.maxX - 1);- expect(bed.z).toBeLessThan(room.minZ + 1.5);+ const leadBed = beds.find((b) => b.room === "lead")!;+ expect(leadBed.x).toBeGreaterThan(room.maxX - 1);+ expect(leadBed.z).toBeLessThan(room.minZ + 1.5);+ });++ it("can walk from every basket to every other one", () => {+ for (const a of beds) {+ for (const b of beds) {+ if (a === b) continue;+ const path = findPath(grid, a, b);+ expect(path, `${a.id} -> ${b.id}`).not.toBeNull();+ const last = path![path!.length - 1];+ expect(Math.hypot(last.x - b.x, last.z - b.z)).toBeLessThan(0.01);+ }+ }+ });++ it("keeps the treat jar in the break room, reachable from the elevator", () => {+ const jar = layout.furniture.find((f) => f.kind === "treatJar")!;+ expect(jar.room).toBe("break");+ expect(findPath(grid, layout.spawn, { x: jar.x, z: jar.z + 0.6 })).not.toBeNull();+ });++ it("has no dog on the coding floor", () => {+ const coding = buildOfficeLayout([lead], { variant: "coding" });+ expect(coding.furniture.some((f) => f.kind === "dogBed" || f.kind === "treatJar")).toBe(false);});});diff --git a/jarvis/ui/web/frontend/src/components/society/office/dogLife.ts b/jarvis/ui/web/frontend/src/components/society/office/dogLife.tsindex 404f40a3fd..04c962f392 100644--- a/jarvis/ui/web/frontend/src/components/society/office/dogLife.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/dogLife.ts@@ -1,34 +1,51 @@/**- * The lead office's dog: a black-and-tan rottweiler with a day of its own.- * It sleeps in its basket in the corner, gets up, roams the lead office,- * sniffs, sits and lies down, and goes back to bed. The person can pet it- * (E nearby, or click it): it sits, wags, shows hearts and then follows the- * person around for a while before trotting home.+ * The office dog: a black-and-tan rottweiler with a day of its own. It has a+ * basket in several rooms (lead office, team room, break room) and lives in+ * the room of its current basket: it sleeps, gets up, roams that room,+ * sniffs, sits and lies down, and goes back to bed. Now and then it walks —+ * never jumps — over to another basket and settles in there.+ *+ * The person can pet it (E nearby, or a click): it sits, wags, shows hearts+ * and follows the person around inside its room for a while. Easter egg: a+ * treat jar in the break room hands out a bone; give it to the dog and it+ * begs, catches it, spins twice in the air and carries the bone to its basket+ * to chew on it.** Pure schedule + a small store; OfficeDog.tsx moves and animates the figure.* Like the agents' idle life, all of it is client-side and costs nothing.*/import { create } from "zustand";+import type { Point, Rect } from "./officeLayout";-export type DogActivity = "sleep" | "stretch" | "roam" | "sniff" | "sit" | "lie" | "home" | "petted" | "follow";+export type DogActivity =+ | "sleep" | "stretch" | "roam" | "sniff" | "sit" | "lie" | "home" | "move"+ | "petted" | "follow" | "trick" | "chew";/** The body pose an activity shows; walking poses come from movement, not from here. */-export type DogPose = "sleep" | "stand" | "sit" | "lie" | "sniff";+export type DogPose = "sleep" | "stand" | "sit" | "lie" | "sniff" | "beg";export const DOG_POSE: Record<DogActivity, DogPose> = {- sleep: "sleep", stretch: "stand", roam: "stand", sniff: "sniff", sit: "sit", lie: "lie", home: "stand", petted: "sit", follow: "stand",+ sleep: "sleep", stretch: "stand", roam: "stand", sniff: "sniff", sit: "sit", lie: "lie", home: "stand", move: "stand",+ petted: "sit", follow: "stand", trick: "beg", chew: "lie",};/** Petting reach, metres from the person to the dog. */export const DOG_PET_RANGE = 1.4;+/** Reach to take a bone from the treat jar. */+export const TREAT_JAR_RANGE = 1.3;/** How long the dog enjoys being petted, and then follows the person. */export const DOG_PETTED_MS = 3200;export const DOG_FOLLOW_MS = 30000;+/** The treat trick (beg, catch, two spins) and the chewing afterwards. */+export const DOG_TRICK_MS = 3600;+export const DOG_CHEW_MS = 18000;/** Following: trot after the person beyond this distance, stop inside the lower one. */export const DOG_FOLLOW_FAR = 1.7;export const DOG_FOLLOW_NEAR = 1.15;export const DOG_WALK_SPEED = 1.5;export const DOG_RUN_SPEED = 3.6;+/** Chance that waking up sends the dog over to another basket instead of roaming. */+export const DOG_MOVE_CHANCE = 0.35;export interface DogStep { activity: DogActivity; durationMs: number }@@ -38,11 +55,13 @@ function between(rng: () => number, min: number, max: number): number {/*** What the dog does after `current` ends. `roamsLeft` counts the outings- * before it heads home; the schedule always ends up back in the basket.+ * before it heads home; `baskets` is how many baskets it could move between.+ * The schedule always ends up back in a basket.*/-export function nextDogStep(current: DogActivity, roamsLeft: number, rng: () => number): DogStep & { roamsLeft: number } {+export function nextDogStep(current: DogActivity, roamsLeft: number, rng: () => number, baskets = 1): DogStep & { roamsLeft: number } {switch (current) {case "sleep":+ if (baskets > 1 && rng() < DOG_MOVE_CHANCE) return { activity: "move", durationMs: Infinity, roamsLeft: 0 };return { activity: "stretch", durationMs: 1500, roamsLeft: 2 + Math.floor(rng() * 3) };case "stretch":return { activity: "roam", durationMs: Infinity, roamsLeft };@@ -63,13 +82,31 @@ export function nextDogStep(current: DogActivity, roamsLeft: number, rng: () =>return { activity: "follow", durationMs: DOG_FOLLOW_MS, roamsLeft: 0 };case "follow":return { activity: "home", durationMs: Infinity, roamsLeft: 0 };+ case "trick":+ // Off to the basket with the bone, then chew there.+ return { activity: "home", durationMs: Infinity, roamsLeft: 0 };+ case "chew":+ return { activity: "sleep", durationMs: between(rng, 20000, 40000), roamsLeft: 0 };case "home":+ case "move":return { activity: "sleep", durationMs: between(rng, 20000, 50000), roamsLeft: 0 };}}+/** Another basket to move to (never the current one), or the current one when it is the only one. */+export function pickOtherBasket(current: number, count: number, rng: () => number): number {+ if (count <= 1) return current;+ const offset = 1 + Math.floor(rng() * (count - 1));+ return (current + offset) % count;+}++/** Is `p` inside `room`, allowing a margin (a doorway step still counts as inside)? */+export function insideRoom(room: Rect, p: Point, margin = 0.3): boolean {+ return p.x >= room.minX - margin && p.x <= room.maxX + margin && p.z >= room.minZ - margin && p.z <= room.maxZ + margin;+}+/** Where to stand while following: a little behind the person, on the side the dog comes from. */-export function followPoint(person: { x: number; z: number; heading: number }, dog: { x: number; z: number }): { x: number; z: number } {+export function followPoint(person: { x: number; z: number; heading: number }, dog: Point): Point {const bx = person.x - Math.sin(person.heading) * DOG_FOLLOW_NEAR;const bz = person.z - Math.cos(person.heading) * DOG_FOLLOW_NEAR;// Blend towards the dog's own side so it does not cut across the person's feet.@@ -81,18 +118,38 @@ export function followPoint(person: { x: number; z: number; heading: number }, dinterface OfficeDogState {/** The person stands within petting reach. */near: boolean;- /** Bumped on every pet; the dog reacts to each new value once. */+ /** The person stands at the treat jar. */+ nearJar: boolean;+ /** The person carries a bone from the treat jar. */+ hasBone: boolean;+ /** Bumped on every pet / every bone given; the dog reacts to each new value once. */petSeq: number;- /** The dog was clicked from afar: pet it once the walk there brings it within reach. */- pending: boolean;- set: (patch: Partial<Pick<OfficeDogState, "near" | "pending">>) => void;+ treatSeq: number;+ /** Clicked from afar: pet the dog / take a bone once the walk there brings the person within reach. */+ pending: "pet" | "jar" | null;+ set: (patch: Partial<Pick<OfficeDogState, "near" | "nearJar" | "pending">>) => void;pet: () => void;+ takeBone: () => void;+ giveTreat: () => void;+ /** E next to the dog: give the bone when carrying one, else pet it. Next to the jar: take a bone. */+ interact: () => boolean;}-export const useOfficeDog = create<OfficeDogState>((set) => ({+export const useOfficeDog = create<OfficeDogState>((set, get) => ({near: false,+ nearJar: false,+ hasBone: false,petSeq: 0,- pending: false,+ treatSeq: 0,+ pending: null,set: (patch) => set((s) => (Object.entries(patch).every(([k, v]) => s[k as keyof typeof patch] === v) ? s : patch)),- pet: () => set((s) => ({ petSeq: s.petSeq + 1, pending: false })),+ pet: () => set((s) => ({ petSeq: s.petSeq + 1, pending: null })),+ takeBone: () => set({ hasBone: true, pending: null }),+ giveTreat: () => set((s) => (s.hasBone ? { hasBone: false, treatSeq: s.treatSeq + 1, pending: null } : s)),+ interact: () => {+ const s = get();+ if (s.near) { if (s.hasBone) s.giveTreat(); else s.pet(); return true; }+ if (s.nearJar && !s.hasBone) { s.takeBone(); return true; }+ return false;+ },}));diff --git a/jarvis/ui/web/frontend/src/components/society/office/dogProps.tsx b/jarvis/ui/web/frontend/src/components/society/office/dogProps.tsxnew file mode 100644index 0000000000..4de639755d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/dogProps.tsx@@ -0,0 +1,49 @@+/**+ * Small props of the office dog: the treat bone (carried by the person and by+ * the dog) and the treat jar in the break room that hands the bones out.+ * Built like every office prop: centred on the origin, front towards +z,+ * inside its FURNITURE_SIZE footprint.+ */+import { CylinderGeometry, MeshStandardMaterial, SphereGeometry } from "three";+import { Box } from "./OfficeFurniture";++const M = {+ bone: new MeshStandardMaterial({ color: "#f3ead7", roughness: 0.7 }),+ wood: new MeshStandardMaterial({ color: "#6d4a33", roughness: 0.7 }),+ woodDark: new MeshStandardMaterial({ color: "#4a3122", roughness: 0.7 }),+ brass: new MeshStandardMaterial({ color: "#d8ae52", roughness: 0.3, metalness: 0.75 }),+ glass: new MeshStandardMaterial({ color: "#dff1ff", roughness: 0.05, transparent: true, opacity: 0.28, depthWrite: false }),+ label: new MeshStandardMaterial({ color: "#8f2f3a", roughness: 0.8 }),+};+const G = { cyl: new CylinderGeometry(1, 1, 1, 14), sphere: new SphereGeometry(1, 14, 10) };++/** A cartoon bone along local x, about 0.2 m long at scale 1. */+export function TreatBone({ scale = 1 }: { scale?: number }) {+ return (+ <group scale={scale}>+ <mesh geometry={G.cyl} material={M.bone} rotation={[0, 0, Math.PI / 2]} scale={[0.022, 0.16, 0.022]} castShadow />+ {[-0.08, 0.08].flatMap((x) => [-0.022, 0.022].map((z) => (+ <mesh key={`${x}${z}`} geometry={G.sphere} material={M.bone} position={[x, 0, z]} scale={0.032} castShadow />+ )))}+ </group>+ );+}++/** A wooden stand with a glass jar of bones on top and a bone plaque on the front. */+export function TreatJar() {+ return (+ <group>+ <Box size={[0.46, 0.78, 0.46]} position={[0, 0.39, 0]} material={M.wood} />+ <Box size={[0.5, 0.04, 0.5]} position={[0, 0.8, 0]} material={M.woodDark} />+ <Box size={[0.3, 0.12, 0.012]} position={[0, 0.55, 0.236]} material={M.label} cast={false} />+ <group position={[0, 0.55, 0.246]} rotation={[Math.PI / 2, 0, 0]}><TreatBone scale={0.7} /></group>+ {/* The jar: bones inside, a brass lid with a knob. */}+ {[[-0.05, 0.88, 0.02, 0.5], [0.05, 0.9, -0.03, -0.6], [0, 0.97, 0.03, 1.2]].map(([x, y, z, r], i) => (+ <group key={i} position={[x, y, z]} rotation={[0, r, 0.4]}><TreatBone scale={0.6} /></group>+ ))}+ <mesh geometry={G.cyl} material={M.glass} position={[0, 0.96, 0]} scale={[0.16, 0.28, 0.16]} />+ <mesh geometry={G.cyl} material={M.brass} position={[0, 1.115, 0]} scale={[0.165, 0.03, 0.165]} castShadow />+ <mesh geometry={G.sphere} material={M.brass} position={[0, 1.15, 0]} scale={0.03} />+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.tsindex 433e211a11..08e08ddd75 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts@@ -101,7 +101,7 @@ export type FurnitureKind =| "bookshelf" | "plant" | "rug" | "elevator"// Lead office: the executive suite.| "leadWall" | "executiveRug" | "guestChair" | "chesterfield" | "loungeTable" | "executiveBar" | "globe" | "floorLamp"- | "dogBed"+ | "dogBed" | "treatJar"// Coding floor: Mission Control's console ring.| "missionConsole";@@ -138,6 +138,7 @@ export const FURNITURE_SIZE: Record<FurnitureKind, { w: number; d: number; h: nuglobe: { w: 0.92, d: 0.72, h: 1.2, solid: true },floorLamp: { w: 0.46, d: 0.46, h: 1.8, solid: true },dogBed: { w: 0.9, d: 0.72, h: 0.45, solid: true },+ treatJar: { w: 0.5, d: 0.5, h: 1.2, solid: true },// Round, so not a solid box: navigation walks around missionDeckObstacles instead.missionConsole: { w: 3.9, d: 3.9, h: 3.1, solid: false },};@@ -485,8 +486,14 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:{ id: "lead-lamp-e", kind: "floorLamp", x: leadRoom.maxX - 0.34, z: lz0 + 2.9, rotationY: 0, room: "lead" },{ id: "lead-plant", kind: "plant", x: lx0 + 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "lead" },{ id: "lead-plant-e", kind: "plant", x: leadRoom.maxX - 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "lead" },- // The office dog's basket, in the north-east corner beside the bookcase.+ // The office dog's baskets: the lead office's north-east corner beside the+ // bookcase, the team room's north-west corner and the break room's corner+ // by the bookshelf. It walks between them now and then.{ id: "lead-dog", kind: "dogBed", x: leadRoom.maxX - 0.58, z: lz0 + 0.98, rotationY: 0, room: "lead" },+ { id: "team-dog", kind: "dogBed", x: teamRoom.minX + 0.62, z: topZ + 0.95, rotationY: 0, room: "team" },+ { id: "break-dog", kind: "dogBed", x: breakRoom.minX + 0.62, z: breakRoom.minZ + 1.6, rotationY: 0, room: "break" },+ // Easter egg: the jar of dog treats next to the coffee bar.+ { id: "break-treats", kind: "treatJar", x: breakRoom.minX + 9.95, z: breakRoom.minZ + 0.5, rotationY: 0, room: "break" },];// Coding floor, west: a quiet focus zone — a wall of shelves, a couch facing// them on a rug, a beanbag in each corner, palms beside the door.diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex ddb20e686d..c6140369fc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -986,6 +986,8 @@"room_break": "Pausenraum","room_focus": "Ruhezone","room_server": "Serverraum",+ "dog_treat": "Knochen geben",+ "dog_take_bone": "Leckerli nehmen","dog_pet": "Hund streicheln","seat_sit": "Auf den Sessel setzen","seat_seated": "Klick auf die Bildschirme öffnet deinen Chef-Agenten · bewegen zum Aufstehen",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex 1588e1bd4a..42a36da53a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -986,6 +986,8 @@"room_break": "Break room","room_focus": "Focus zone","room_server": "Server room",+ "dog_treat": "Give the bone",+ "dog_take_bone": "Take a dog treat","dog_pet": "Pet the dog","seat_sit": "Sit in the chair","seat_seated": "Click the screens to open your lead · move to stand up",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex 6fae8268fc..d6730dfb06 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -986,6 +986,8 @@"room_break": "Sala de descanso","room_focus": "Zona de concentración","room_server": "Sala de servidores",+ "dog_treat": "Darle el hueso",+ "dog_take_bone": "Coger una golosina","dog_pet": "Acariciar al perro","seat_sit": "Sentarse en el sillón","seat_seated": "Haz clic en las pantallas para abrir tu líder · muévete para levantarte",