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): a living rottweiler in the lead office that can be petted
rubenluetke10-beep3d64019a8633
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex 7236951286..8850c8865b 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -199,7 +199,11 @@ 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:** a golden dog sleeps in a basket by the door, breathing slowly.+- **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.- 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 6e3a927561..5ddf71894b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/LeadSuite.tsx@@ -8,11 +8,11 @@* the origin, front facing +z, inside its `FURNITURE_SIZE` box, from rounded* primitives; materials and canvas textures are module-level singletons.*/-import { memo, useRef } from "react";+import { memo } from "react";import { Html } from "@react-three/drei";-import { useFrame, type ThreeEvent } from "@react-three/fiber";+import type { ThreeEvent } from "@react-three/fiber";import {- CylinderGeometry, DoubleSide, type Group, MeshStandardMaterial, OctahedronGeometry, SphereGeometry, TorusGeometry,+ CylinderGeometry, DoubleSide, MeshStandardMaterial, OctahedronGeometry, SphereGeometry, TorusGeometry,} from "three";import type { SocietyAgent } from "../data";import { canvasMaterial } from "./canvasMaterials";@@ -53,10 +53,6 @@ export const LEAD_MAT = {bottles: L.bottles.map((c) => new MeshStandardMaterial({ color: c, roughness: 0.15, transparent: true, opacity: 0.85 })),globeLand: matte(L.globe.land),rugBorder: matte(L.rug.border, { roughness: 0.95 }),- fur: matte(L.dog.fur, { roughness: 0.95 }),- ear: matte(L.dog.ear, { roughness: 0.95 }),- muzzle: matte(L.dog.muzzle, { roughness: 0.95 }),- nose: matte(L.dog.nose, { roughness: 0.5 }),basket: matte(L.dog.basket, { roughness: 0.95 }),cushion: matte(L.dog.cushion, { roughness: 0.95 }),};@@ -453,43 +449,13 @@ function ExecutiveRug({ w, d }: { w: number; d: number }) {);}-/** A golden office dog curled up asleep in a round basket; it breathes slowly. */+/** The dog's round basket in the corner; the dog itself is a living figure (OfficeDog.tsx). */function DogBed() {- const body = useRef<Group>(null);- useFrame(({ clock }) => {- const b = body.current;- if (!b) return;- const breath = 1 + Math.sin(clock.elapsedTime * 1.6) * 0.035;- b.scale.set(1, breath, 1 + (breath - 1) * 0.6);- });return (<group>- {/* Basket: a padded rim around a soft cushion. */}<mesh geometry={GEO.cyl} material={LEAD_MAT.basket} position={[0, 0.07, 0]} scale={[0.43, 0.14, 0.34]} castShadow receiveShadow /><mesh geometry={GEO.rim} material={LEAD_MAT.basket} position={[0, 0.15, 0]} rotation={[Math.PI / 2, 0, 0]} scale={[0.38, 0.29, 0.5]} castShadow /><mesh geometry={GEO.cyl} material={LEAD_MAT.cushion} position={[0, 0.15, 0]} scale={[0.36, 0.05, 0.27]} receiveShadow />- {/* The dog faces south-east, towards the usual camera, and fills the basket. */}- <group position={[0, 0.17, 0]} rotation={[0, Math.PI, 0]} scale={1.25}>- <group ref={body}>- {/* Curled body and haunch. */}- <Ball radius={[0.24, 0.11, 0.16]} position={[0.02, 0.1, -0.02]} material={LEAD_MAT.fur} />- <Ball radius={[0.12, 0.1, 0.12]} position={[0.16, 0.11, 0.0]} material={LEAD_MAT.fur} />- </group>- {/* Head resting on the front paws, eyes closed. */}- <Ball radius={[0.1, 0.085, 0.1]} position={[-0.2, 0.1, 0.08]} material={LEAD_MAT.fur} />- <Ball radius={[0.055, 0.045, 0.06]} position={[-0.29, 0.08, 0.12]} material={LEAD_MAT.muzzle} />- <Ball radius={0.018} position={[-0.335, 0.095, 0.14]} material={LEAD_MAT.nose} cast={false} />- {[-0.03, 0.035].map((dz) => (- <Box key={dz} size={[0.012, 0.006, 0.03]} position={[-0.25, 0.14, 0.1 + dz]} material={LEAD_MAT.nose} cast={false} />- ))}- <Ball radius={[0.035, 0.07, 0.05]} position={[-0.18, 0.1, -0.01]} material={LEAD_MAT.ear} />- <Ball radius={[0.035, 0.07, 0.05]} position={[-0.2, 0.1, 0.17]} material={LEAD_MAT.ear} />- {/* Paws, tail tucked round, a red collar with a brass tag. */}- {[0.05, 0.13].map((dz) => <Ball key={dz} radius={[0.06, 0.03, 0.035]} position={[-0.26, 0.03, dz + 0.02]} material={LEAD_MAT.muzzle} />)}- <Ball radius={[0.13, 0.03, 0.04]} position={[0.05, 0.04, 0.15]} material={LEAD_MAT.fur} />- <mesh geometry={GEO.ring} material={LEAD_MAT.leather} position={[-0.13, 0.1, 0.08]} rotation={[0, Math.PI / 2, 0]} scale={0.075} />- <Cyl radius={0.014} height={0.006} position={[-0.13, 0.03, 0.08]} rotation={[0, 0, Math.PI / 2]} material={LEAD_MAT.brass} cast={false} />- </group></group>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsxnew file mode 100644index 0000000000..96d90d611d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx@@ -0,0 +1,375 @@+/**+ * The lead office's dog as a living figure: a chunky black-and-tan rottweiler+ * in the toy-office style with a jointed body (legs with knees, head, ears,+ * tail, tongue) whose pose blends between standing, trotting, sniffing,+ * sitting, lying and sleeping. Its day comes from dogLife.ts; it walks on the+ * office navigation grid, and the person can pet it (E or a click).+ */+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,+} 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,+} from "./dogLife";+import type { Furniture, Room } from "./officeLayout";+import { findPath, randomWalkablePoint, type NavGrid } from "./officeNav";+import { stepMover, turnToward, type Mover } from "./officeMotion";+import { player, useOfficeStore } from "./officeStore";++// ---------------------------------------------------------------------------+// Model+// ---------------------------------------------------------------------------++const C = { black: "#1d1a19", tan: "#a8612c", collar: "#7a4a2a", tongue: "#e8768a", eye: "#2a1a10", heart: "#ff5a7a" } as const;+const DM = {+ black: new MeshStandardMaterial({ color: C.black, roughness: 0.75 }),+ tan: new MeshStandardMaterial({ color: C.tan, roughness: 0.8 }),+ collar: new MeshStandardMaterial({ color: C.collar, roughness: 0.6 }),+ brass: new MeshStandardMaterial({ color: "#d8ae52", roughness: 0.3, metalness: 0.75 }),+ tongue: new MeshStandardMaterial({ color: C.tongue, roughness: 0.5 }),+ eye: new MeshStandardMaterial({ color: C.eye, roughness: 0.2 }),+ shine: new MeshStandardMaterial({ color: "#ffffff", emissive: "#ffffff", emissiveIntensity: 0.6 }),+ heart: new MeshStandardMaterial({ color: C.heart, emissive: C.heart, emissiveIntensity: 0.55, roughness: 0.4, transparent: true }),+};+const DG = {+ sphere: new SphereGeometry(1, 20, 14),+ cyl: new CylinderGeometry(1, 1, 1, 14),+ taper: new CylinderGeometry(0.75, 1, 1, 14),+ collar: new TorusGeometry(1, 0.16, 8, 28),+};++function heartGeometry(): ExtrudeGeometry {+ const s = new Shape();+ s.moveTo(0, -0.5);+ s.bezierCurveTo(-0.1, -0.35, -0.55, -0.15, -0.5, 0.15);+ s.bezierCurveTo(-0.45, 0.45, -0.1, 0.5, 0, 0.25);+ s.bezierCurveTo(0.1, 0.5, 0.45, 0.45, 0.5, 0.15);+ s.bezierCurveTo(0.55, -0.15, 0.1, -0.35, 0, -0.5);+ const g = new ExtrudeGeometry(s, { depth: 0.18, bevelEnabled: true, bevelSize: 0.06, bevelThickness: 0.06, bevelSegments: 2 });+ g.center();+ return g;+}+const HEART = heartGeometry();++type Vec3 = [number, number, number];+function Ball({ r, p, m, cast = true }: { r: number | Vec3; p: Vec3; m: MeshStandardMaterial; cast?: boolean }) {+ return <mesh geometry={DG.sphere} material={m} position={p} scale={r} castShadow={cast} />;+}+function Bone({ radius, length, m, y = 0, geometry = DG.cyl }: { radius: number; length: number; m: MeshStandardMaterial; y?: number; geometry?: CylinderGeometry }) {+ return <mesh geometry={geometry} material={m} position={[0, y - length / 2, 0]} scale={[radius, length, radius]} castShadow />;+}++/** 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;+ legs: { hip: Group | null; knee: Group | null }[];+}++/** One leg: an upper bone from the hip, a tan lower bone and paw from the knee. */+function Leg({ at, rig, index, thigh }: { at: Vec3; rig: DogRig; index: number; thigh: number }) {+ return (+ <group position={at} ref={(g) => { rig.legs[index].hip = g; }}>+ <Bone radius={thigh} length={0.19} m={DM.black} geometry={DG.taper} />+ <group position={[0, -0.18, 0]} ref={(g) => { rig.legs[index].knee = g; }}>+ <Bone radius={0.036} length={0.1} m={DM.black} />+ <Bone radius={0.034} length={0.07} m={DM.tan} y={-0.09} />+ <Ball r={[0.045, 0.028, 0.06]} p={[0, -0.165, 0.02]} m={DM.tan} />+ </group>+ </group>+ );+}++/**+ * The rottweiler, facing +z, paws on y = 0 when standing. `body` pivots at the+ * hind hips so sitting tips the front up; legs counter-rotate to stay planted.+ */+function DogModel({ rig }: { rig: DogRig }) {+ return (+ <group>+ <group position={[0, 0.36, -0.2]} ref={(g) => { rig.body = g; }}>+ <group ref={(g) => { rig.torso = g; }}>+ {/* Barrel, chest and rump, with the tan chest patch. */}+ <Rounded size={[0.3, 0.27, 0.56]} radius={0.12} position={[0, 0.07, 0.2]} material={DM.black} />+ <Ball r={[0.16, 0.16, 0.14]} p={[0, 0.05, 0.42]} m={DM.black} />+ <Ball r={[0.15, 0.14, 0.12]} p={[0, 0.07, -0.03]} m={DM.black} />+ <Ball r={[0.09, 0.07, 0.03]} p={[0, 0.0, 0.54]} m={DM.tan} cast={false} />+ </group>+ {/* Stub tail. */}+ <group position={[0, 0.14, -0.12]} ref={(g) => { rig.tail = g; }}>+ <mesh geometry={DG.cyl} material={DM.black} position={[0, 0.04, -0.03]} rotation={[-0.9, 0, 0]} scale={[0.028, 0.1, 0.028]} />+ </group>+ {/* Neck, collar and head. */}+ <Ball r={[0.11, 0.12, 0.11]} p={[0, 0.16, 0.5]} m={DM.black} />+ <group position={[0, 0.15, 0.52]} rotation={[Math.PI / 2 - 0.6, 0, 0]}>+ <mesh geometry={DG.collar} material={DM.collar} scale={[0.115, 0.115, 0.9]} />+ <Ball r={0.018} p={[0, -0.12, -0.02]} m={DM.brass} cast={false} />+ </group>+ <group position={[0, 0.25, 0.6]} scale={1.25} ref={(g) => { rig.head = g; }}>+ <Ball r={[0.13, 0.12, 0.14]} p={[0, 0.03, 0.02]} m={DM.black} />+ {/* Muzzle: tan sides and chin, black bridge and nose. */}+ <Rounded size={[0.13, 0.09, 0.13]} radius={0.04} position={[0, -0.03, 0.14]} material={DM.tan} />+ <Rounded size={[0.08, 0.03, 0.12]} radius={0.012} position={[0, 0.02, 0.14]} material={DM.black} />+ <Ball r={[0.035, 0.028, 0.025]} p={[0, 0.01, 0.21]} m={DM.black} />+ {[-1, 1].map((s) => (+ <group key={s}>+ <Ball r={[0.045, 0.04, 0.035]} p={[s * 0.06, -0.04, 0.09]} m={DM.tan} cast={false} />+ <Ball r={[0.022, 0.013, 0.012]} p={[s * 0.052, 0.095, 0.105]} m={DM.tan} cast={false} />+ {/* Floppy triangular ears. */}+ <mesh geometry={DG.sphere} material={DM.black} position={[s * 0.115, 0.07, 0.0]} rotation={[0.2, 0, s * 0.5]} scale={[0.02, 0.075, 0.055]} castShadow />+ </group>+ ))}+ <group ref={(g) => { rig.eyesOpen = g; }}>+ {[-1, 1].map((s) => (+ <group key={s}>+ <Ball r={0.02} p={[s * 0.05, 0.06, 0.13]} m={DM.eye} cast={false} />+ <Ball r={0.006} p={[s * 0.047, 0.066, 0.148]} m={DM.shine} cast={false} />+ </group>+ ))}+ </group>+ <group ref={(g) => { rig.eyesShut = g; }} visible={false}>+ {[-1, 1].map((s) => (+ <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>+ <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} />+ <Leg at={[0.09, 0.0, 0.4]} rig={rig} index={1} thigh={0.05} />+ <Leg at={[-0.1, 0.0, 0.0]} rig={rig} index={2} thigh={0.065} />+ <Leg at={[0.1, 0.0, 0.0]} rig={rig} index={3} thigh={0.065} />+ </group>+ </group>+ );+}++// ---------------------------------------------------------------------------+// Pose blending+// ---------------------------------------------------------------------------++interface Pose { pitch: number; hipY: number; front: number; frontKnee: number; hind: number; hindKnee: number; head: number }++const POSES: Record<DogPose, Pose> = {+ stand: { pitch: 0, hipY: 0.36, front: 0, frontKnee: 0, hind: 0, hindKnee: 0, head: 0 },+ sniff: { pitch: 0.08, hipY: 0.36, front: -0.1, frontKnee: 0.15, hind: 0, hindKnee: 0, head: 0.75 },+ // Front up on straight front legs; thighs forward along the floor, hocks folded back.+ sit: { pitch: -0.62, hipY: 0.14, front: 0.62, frontKnee: 0, hind: -1.05, hindKnee: 1.7, head: -0.2 },+ // 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 },+};++const damp = (from: number, to: number, k: number) => from + (to - from) * k;++// ---------------------------------------------------------------------------+// The living dog+// ---------------------------------------------------------------------------++export interface OfficeDogProps {+ room: Room;+ bed: Furniture;+ grid: NavGrid;+ awake: boolean;+ reduced: boolean;+}++export function OfficeDog({ room, bed, 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 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 pose = useRef<Pose>({ ...POSES.sleep });+ const gait = useRef(0);+ const [activity, setActivity] = useState<DogActivity>("sleep");+ const [hearts, setHearts] = 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]);++ // A floor plan change (someone joined) puts the dog back in its basket.+ useEffect(() => {+ mover.current = { x: bed.x, z: bed.z, heading: homeHeading, path: [] };+ brain.current.activity = "sleep";+ setActivity("sleep");+ }, [bed.x, bed.z, homeHeading]);+ useEffect(() => () => useOfficeDog.getState().set({ near: false, pending: false }), []);++ const begin = (next: DogActivity, durationMs: number) => {+ const b = brain.current, m = mover.current;+ b.activity = next;+ b.until = Date.now() + durationMs;+ m.path = [];+ if (next === "roam" && !reduced) {+ const target = randomWalkablePoint(grid, rng, within);+ m.path = (target && findPath(grid, m, target)) ?? [];+ } else if (next === "home" && !reduced) {+ 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);+ };++ useFrame(({ clock }, rawDt) => {+ if (!awake) return;+ const dt = Math.min(rawDt, 0.1);+ const now = Date.now();+ const b = brain.current, m = mover.current, dog = useOfficeDog.getState();++ // Petting: a new pet wakes it and turns it to the person.+ if (dog.petSeq !== b.lastPet) {+ b.lastPet = dog.petSeq;+ 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 });+ }++ // Movement and the schedule.+ let moved = 0;+ if (b.activity === "follow") {+ if (now >= b.until) begin("home", Infinity);+ else if (!reduced) {+ if (toPerson > DOG_FOLLOW_FAR && now >= b.repathAt) {+ b.repathAt = now + 600;+ m.path = findPath(grid, m, followPoint(player, m)) ?? [];+ } else if (toPerson < DOG_FOLLOW_NEAR) m.path = [];+ 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);+ 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);+ }+ } 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);+ }+ }++ // 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;+ if (root.current) {+ root.current.position.set(m.x, inBed ? 0.1 : 0, m.z);+ root.current.rotation.y = m.heading;+ }++ // 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;+ (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 time = clock.elapsedTime;+ const sleeping = b.activity === "sleep";+ const happy = b.activity === "petted" || b.activity === "follow";++ if (rig.body) {+ rig.body.position.y = p.hipY + (walking ? Math.abs(Math.sin(gait.current)) * 0.02 : 0);+ rig.body.rotation.x = p.pitch;+ }+ if (rig.torso) {+ 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];+ rig.legs.forEach((leg, i) => {+ const front = i < 2;+ if (leg.hip) leg.hip.rotation.x = (front ? p.front : p.hind) + phase[i];+ if (leg.knee) leg.knee.rotation.x = (front ? p.frontKnee : p.hindKnee) + (walking ? Math.max(0, -phase[i]) * (front ? -0.6 : 0.9) : 0);+ });+ 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;+ 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);+ }+ 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";+ if (rig.eyesOpen) rig.eyesOpen.visible = !sleeping;+ if (rig.eyesShut) rig.eyesShut.visible = sleeping;+ });++ const onClick = (event: ThreeEvent<MouseEvent>) => {+ if (event.delta > 6) return;+ event.stopPropagation();+ const dog = useOfficeDog.getState();+ if (dog.near) { dog.pet(); return; }+ dog.set({ pending: true });+ useOfficeStore.getState().requestWalk({ x: mover.current.x, z: mover.current.z });+ };++ 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>+ );+}++/** Three hearts float up from the dog's head and fade out. */+function Hearts({ animate }: { animate: boolean }) {+ const group = useRef<Group>(null);+ const start = useRef(-1);+ const material = useMemo(() => DM.heart.clone(), []);+ useEffect(() => () => material.dispose(), [material]);+ 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);+ });+ material.opacity = Math.max(0, 1 - Math.max(0, age - 1.6) / 1.2);+ g.visible = age < 3.2;+ });+ return (+ <group ref={group}>+ {[0, 1, 2].map((i) => (+ <Billboard key={i}><mesh geometry={HEART} material={material} /></Billboard>+ ))}+ </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 cc286c8a98..9d742eece7 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx@@ -17,6 +17,7 @@ import { agentPositions, bodiesExcept, companions } from "./walkerRegistry";import { OFFICE_FIGURE_HEIGHT_M } from "./OfficeAgents";import { seatOf, type OfficeLayout } from "./officeLayout";import { chairInReach, useLeadSeat } from "./leadSeat";+import { useOfficeDog } from "./dogLife";import { isRunning, useOfficeSettings } from "./officeSettings";/** The person's pace: a brisk walk, and a sprint on Shift (m/s). */@@ -111,6 +112,7 @@ 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; }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 75fc6ae29c..b61d36ab6b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx@@ -27,6 +27,7 @@ import { CHECKPOINT_ICON, CheckpointMarker } from "./CheckpointMarker";import { ElevatorCallButton } from "./ElevatorCallButton";import { OFFICE_FIGURE_HEIGHT_M, OfficeAgents, type WalkerContext } from "./OfficeAgents";import { OfficePlayer } from "./OfficePlayer";+import { OfficeDog } from "./OfficeDog";import { PlayerBubble } from "./OfficeBubbles";import { OfficeCameraRig } from "./OfficeCameraRig";import { allDesks, type Department, type OfficeLayout, type Point } from "./officeLayout";@@ -175,6 +176,7 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag// Lead desks carry their own size and are built as executive desks, not bench instances.const benchDesks = useMemo(() => desks.filter((d) => !d.size), [desks]);const leadRoom = layout.rooms.find((r) => r.kind === "lead");+ const dogBed = layout.furniture.find((f) => f.kind === "dogBed");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;@@ -231,6 +233,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} />}<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.tsnew file mode 100644index 0000000000..12d4d56746--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/dogLife.test.ts@@ -0,0 +1,55 @@+import { describe, expect, it } from "vitest";+import { createRng } from "./officeBehavior";+import { DOG_FOLLOW_MS, DOG_FOLLOW_NEAR, followPoint, nextDogStep, useOfficeDog, type DogActivity } from "./dogLife";+import { buildOfficeLayout, type OfficeAgentInput } from "./officeLayout";++describe("the office dog's day", () => {+ it("always finds its way back to the basket", () => {+ const rng = createRng("dog-test");+ for (let run = 0; run < 50; 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);+ activity = next.activity;+ roamsLeft = next.roamsLeft;+ seen.add(activity);+ }+ expect(activity).toBe("sleep");+ expect(seen.has("home")).toBe(true);+ expect(seen.has("roam")).toBe(true);+ }+ });++ 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("follow", 0, rng).activity).toBe("home");+ });++ 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 });+ expect(p.z).toBeLessThan(0);+ expect(Math.hypot(p.x, p.z)).toBeGreaterThan(DOG_FOLLOW_NEAR * 0.8);+ });++ it("counts each pet once", () => {+ const before = useOfficeDog.getState().petSeq;+ useOfficeDog.getState().set({ pending: true });+ useOfficeDog.getState().pet();+ expect(useOfficeDog.getState().petSeq).toBe(before + 1);+ expect(useOfficeDog.getState().pending).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]);+ 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);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/dogLife.ts b/jarvis/ui/web/frontend/src/components/society/office/dogLife.tsnew file mode 100644index 0000000000..404f40a3fd--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/dogLife.ts@@ -0,0 +1,98 @@+/**+ * 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.+ *+ * 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";++export type DogActivity = "sleep" | "stretch" | "roam" | "sniff" | "sit" | "lie" | "home" | "petted" | "follow";++/** The body pose an activity shows; walking poses come from movement, not from here. */+export type DogPose = "sleep" | "stand" | "sit" | "lie" | "sniff";++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",+};++/** Petting reach, metres from the person to the dog. */+export const DOG_PET_RANGE = 1.4;+/** How long the dog enjoys being petted, and then follows the person. */+export const DOG_PETTED_MS = 3200;+export const DOG_FOLLOW_MS = 30000;+/** 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;++export interface DogStep { activity: DogActivity; durationMs: number }++function between(rng: () => number, min: number, max: number): number {+ return min + rng() * (max - min);+}++/**+ * What the dog does after `current` ends. `roamsLeft` counts the outings+ * before it heads home; the schedule always ends up back in the basket.+ */+export function nextDogStep(current: DogActivity, roamsLeft: number, rng: () => number): DogStep & { roamsLeft: number } {+ switch (current) {+ case "sleep":+ return { activity: "stretch", durationMs: 1500, roamsLeft: 2 + Math.floor(rng() * 3) };+ case "stretch":+ return { activity: "roam", durationMs: Infinity, roamsLeft };+ case "roam": {+ // Arrived somewhere: have a look around.+ const r = rng();+ if (r < 0.45) return { activity: "sniff", durationMs: between(rng, 2000, 4000), roamsLeft };+ if (r < 0.8) return { activity: "sit", durationMs: between(rng, 4000, 8000), roamsLeft };+ return { activity: "lie", durationMs: between(rng, 6000, 12000), roamsLeft };+ }+ case "sniff":+ case "sit":+ case "lie":+ return roamsLeft > 1+ ? { activity: "roam", durationMs: Infinity, roamsLeft: roamsLeft - 1 }+ : { activity: "home", durationMs: Infinity, roamsLeft: 0 };+ case "petted":+ return { activity: "follow", durationMs: DOG_FOLLOW_MS, roamsLeft: 0 };+ case "follow":+ return { activity: "home", durationMs: Infinity, roamsLeft: 0 };+ case "home":+ return { activity: "sleep", durationMs: between(rng, 20000, 50000), roamsLeft: 0 };+ }+}++/** 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 } {+ 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.+ const dx = dog.x - person.x, dz = dog.z - person.z;+ const d = Math.hypot(dx, dz) || 1;+ return { x: (bx + person.x + (dx / d) * DOG_FOLLOW_NEAR) / 2, z: (bz + person.z + (dz / d) * DOG_FOLLOW_NEAR) / 2 };+}++interface OfficeDogState {+ /** The person stands within petting reach. */+ near: boolean;+ /** Bumped on every pet; 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;+ pet: () => void;+}++export const useOfficeDog = create<OfficeDogState>((set) => ({+ near: false,+ petSeq: 0,+ pending: false,+ 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 })),+}));diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.tsindex 50e58627bf..7c8db368ab 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts@@ -427,8 +427,8 @@ 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, asleep in its basket between the globe and the door.- { id: "lead-dog", kind: "dogBed", x: leadRoom.maxX - 1.65, z: lz0 + 5.75, rotationY: 0, room: "lead" },+ // The office dog's basket, in the north-east corner beside the bookcase.+ { id: "lead-dog", kind: "dogBed", x: leadRoom.maxX - 0.58, z: lz0 + 0.98, rotationY: 0, room: "lead" },];// 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/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.tsindex 5e8a74757e..527c8bf120 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts@@ -159,5 +159,5 @@ export const LEAD_SUITE = {globe: { ocean: "#5f8f96", land: "#e2cd98", line: "#3d5c61" },bottles: ["#b8661e", "#4f7a3a", "#d9e6ea", "#8c2a2a", "#c79a3a"],trophy: "#e8b949",- dog: { fur: "#d9a35b", ear: "#a8702f", muzzle: "#f1d6a6", nose: "#1c1a1a", basket: "#6d4a33", cushion: "#c9b28f" },+ dog: { basket: "#6d4a33", cushion: "#8f2f3a" },} as const;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex d888fe9ff7..48dd00453f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -911,6 +911,7 @@"room_break": "Pausenraum","room_focus": "Ruhezone","room_server": "Serverraum",+ "dog_pet": "Hund streicheln","seat_sit": "Auf den Sessel setzen","seat_seated": "Klick auf die Bildschirme öffnet deinen Chef-Agenten · bewegen zum Aufstehen","prompt_agent": "Mit {0} sprechen",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex c887ed86fb..8b3dd0e5c7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -911,6 +911,7 @@"room_break": "Break room","room_focus": "Focus zone","room_server": "Server room",+ "dog_pet": "Pet the dog","seat_sit": "Sit in the chair","seat_seated": "Click the screens to open your lead · move to stand up","prompt_agent": "Talk to {0}",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex 27d0f2d226..d6afba548d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -911,6 +911,7 @@"room_break": "Sala de descanso","room_focus": "Zona de concentración","room_server": "Sala de servidores",+ "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","prompt_agent": "Hablar con {0}",