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
fix(office): never get stuck at the treat jar, hold the bone in the hand, the dog is solid
rubenluetke10-beep4a8e8d43308f
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsxindex a624b8c1b3..3c386afb9d 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeDog.tsx@@ -21,10 +21,12 @@ import {type DogActivity, type DogPose,} from "./dogLife";import { TreatBone } from "./dogProps";-import type { Furniture, Rect, Room } from "./officeLayout";+import type { Furniture, Point, Rect, Room } from "./officeLayout";import { findPath, randomWalkablePoint, type NavGrid } from "./officeNav";-import { stepMover, turnToward, type Mover } from "./officeMotion";+import { stepMoverAvoiding, turnToward, type Mover } from "./officeMotion";import { player, useOfficeStore } from "./officeStore";+import { bodiesExcept, extraBodies } from "./walkerRegistry";+import { isWalkable } from "./officeNav";// ---------------------------------------------------------------------------// Model@@ -154,6 +156,9 @@ function DogModel({ rig }: { rig: DogRig }) {);}+/** The dog's id among the solid bodies on the floor. */+const DOG_ID = "office-dog";+// ---------------------------------------------------------------------------// Pose blending// ---------------------------------------------------------------------------@@ -233,7 +238,10 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogPsetActivity("sleep");// eslint-disable-next-line react-hooks/exhaustive-deps}, [basketKey, headingAt]);- useEffect(() => () => useOfficeDog.getState().set({ near: false, nearJar: false, pending: null }), []);+ useEffect(() => () => {+ useOfficeDog.getState().set({ near: false, nearJar: false, pending: null });+ extraBodies.delete(DOG_ID);+ }, []);// Dev-only handle for runtime checks (hold the dog still, read where it is).useEffect(() => {if (!import.meta.env.DEV) return;@@ -264,6 +272,9 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogPsetActivity(b.activity);};+ const walkable = useMemo(() => (q: Point) => isWalkable(grid, q), [grid]);+ const others = () => Array.from(bodiesExcept(DOG_ID, player));+useFrame(({ clock }, rawDt) => {if (!awake) return;const dt = Math.min(rawDt, 0.1);@@ -311,11 +322,11 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogPb.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;+ moved = stepMoverAvoiding(m, toPerson > 4 ? DOG_RUN_SPEED : DOG_WALK_SPEED * 1.4, dt, others(), walkable).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" || b.activity === "move") {- const step = stepMover(m, b.activity === "move" ? DOG_WALK_SPEED * 1.2 : DOG_WALK_SPEED, dt);+ const step = stepMoverAvoiding(m, b.activity === "move" ? DOG_WALK_SPEED * 1.2 : DOG_WALK_SPEED, dt, others(), walkable);moved = step.moved;if (step.arrived) {if (b.activity !== "roam") { m.x = bed.x; m.z = bed.z; }@@ -332,6 +343,9 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogP}}+ // A solid body for everyone else: nobody walks through the dog.+ extraBodies.set(DOG_ID, { x: m.x, z: m.z });+// Place the figure; it lies a little higher on the basket's cushion.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;@@ -396,7 +410,9 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogPconst dog = useOfficeDog.getState();if (dog.near) { dog.interact(); return; }dog.set({ pending: "pet" });- useOfficeStore.getState().requestWalk({ x: mover.current.x, z: mover.current.z });+ const m = mover.current;+ const dx = player.x - m.x, dz = player.z - m.z, d = Math.hypot(dx, dz) || 1;+ useOfficeStore.getState().requestWalk({ x: m.x + (dx / d) * 0.95, z: m.z + (dz / d) * 0.95 });};const onJarClick = (event: ThreeEvent<MouseEvent>) => {if (event.delta > 6 || !jar) return;@@ -405,7 +421,8 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogPif (dog.hasBone) return;if (dog.nearJar) { dog.takeBone(); return; }dog.set({ pending: "jar" });- useOfficeStore.getState().requestWalk({ x: jar.x, z: jar.z });+ // The jar faces +z (turned by its rotation): stand in front of it.+ useOfficeStore.getState().requestWalk({ x: jar.x + Math.sin(jar.rotationY) * 0.8, z: jar.z + Math.cos(jar.rotationY) * 0.8 });};const hover = (cursor: string) => () => { document.body.style.cursor = cursor; };const busy = activity === "petted" || activity === "trick";@@ -440,24 +457,10 @@ export function OfficeDog({ beds, rooms, jar, grid, awake, reduced }: OfficeDogP)}</group>)}- {hasBone && <CarriedBone />}</>);}-/** 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 });diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsxindex 6a7dc84a79..aa0b8d96d3 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx@@ -19,6 +19,7 @@ import { OFFICE_FIGURE_HEIGHT_M } from "./OfficeAgents";import { seatOf, type OfficeLayout } from "./officeLayout";import { chairInReach, useLeadSeat } from "./leadSeat";import { useOfficeDog } from "./dogLife";+import { TreatBone } from "./dogProps";import { isRunning, useOfficeSettings } from "./officeSettings";import { jumpSquash, newJump, pressJump, stepJump } from "./officeJump";@@ -137,6 +138,7 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {if (nearby) useOfficeStore.getState().select(nearby);}, []);const onJump = useMemo(() => () => pressJump(jump), [jump]);+ const hasBone = useOfficeDog((s) => s.hasBone);const { pressed, run, jumpHeld } = useMoveKeys(awake, interact, onJump);// Arrive by the elevator once per app run; coming back to the map keeps the@@ -203,6 +205,11 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {const speed = (sprinting ? PLAYER_SPRINT_SPEED : PLAYER_WALK_SPEED) * jump.speedMul;let moved = 0;if (ix !== 0 || iz !== 0) {+ // Standing inside something solid (a snapped walk ended in it): step out first, or no move is ever free.+ if (!isWalkable(grid, player)) {+ const out = nearestWalkable(grid, player);+ if (out) { player.x = out.x; player.z = out.z; }+ }player.path = [];camera.getWorldDirection(forward);forward.y = 0;@@ -258,7 +265,7 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {<meshBasicMaterial color="#f5b83d" transparent opacity={0.8} side={DoubleSide} depthWrite={false} /></mesh><group ref={body}>- <ToyFigure look={look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} />+ <ToyFigure look={look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} holding={hasBone ? <TreatBone scale={1.15} /> : undefined} /><Html center position={[0, OFFICE_FIGURE_HEIGHT_M + 0.35, 0]} zIndexRange={[25, 0]}><span className="office-plate office-plate-player" data-office-ui><span className="office-plate-badge" style={{ background: "#f5b83d" }} aria-hidden>★</span>diff --git a/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx b/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsxindex 87296b0c7d..fded1b4c84 100644--- a/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx@@ -11,7 +11,7 @@* singletons and materials are cached by colour, so twenty figures share them;* the frame loop allocates nothing.*/-import { useMemo, useRef, type MutableRefObject } from "react";+import { type ReactNode, useMemo, useRef, type MutableRefObject } from "react";import { useFrame } from "@react-three/fiber";import {BoxGeometry, CapsuleGeometry, Color, ConeGeometry, CylinderGeometry, MeshBasicMaterial, MeshStandardMaterial,@@ -460,7 +460,7 @@ type JointRef = MutableRefObject<Group | null>;* sleeve over a bare arm; every other outfit has long sleeves ending in a cuff* at the wrist (a vest shows the shirt's sleeves, a suit the shirt cuff).*/-function Arm({ side, look, shoulder, elbow }: { side: 1 | -1; look: ToyLook; shoulder: JointRef; elbow: JointRef }) {+function Arm({ side, look, shoulder, elbow, holding }: { side: 1 | -1; look: ToyLook; shoulder: JointRef; elbow: JointRef; holding?: ReactNode }) {const skin = matte(look.skin);const sleeveColour = look.outfit === "vest" ? look.inner : look.shirt;const cloth = garment(look, sleeveColour);@@ -479,6 +479,7 @@ function Arm({ side, look, shoulder, elbow }: { side: 1 | -1; look: ToyLook; sho{/* Mitten hand: a soft paddle, palm turned towards the body, with a thumb pointing forward. */}<mesh geometry={GEO.sphere} material={skin} position={[0, hand, 0.004]} scale={[TOY.handRadius * 0.82, TOY.handRadius * 1.08, TOY.handRadius * 0.95]} castShadow /><mesh geometry={GEO.lowSphere} material={skin} position={[-side * 0.03, hand + 0.018, 0.034]} rotation={[0.5, 0, side * 0.45]} scale={[0.02, 0.03, 0.02]} castShadow />+ {holding && <group position={[0, hand - 0.01, 0.03]}>{holding}</group>}</group></group>);@@ -519,9 +520,13 @@ export interface ToyFigureProps {heightM?: number;/** Seat-top height in metres for the seated modes (sit, work, sleep). */seatHeight?: number;+ /** Something held in the right hand (e.g. a dog treat); the arm then stays raised forward. */+ holding?: ReactNode;}-export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeight = 0.52 }: ToyFigureProps) {+export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeight = 0.52, holding }: ToyFigureProps) {+ const holds = useRef(false);+ holds.current = !!holding;const scale = heightM / TOY_HEIGHT;const pelvis = useRef<Group>(null);const torso = useRef<Group>(null);@@ -576,6 +581,11 @@ export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeighcopyPose(s.target, s.current);}s.settled = s.blend >= 1;+ // Holding something: the right arm stays raised forward with a bent elbow, whatever the gait does.+ if (holds.current) {+ s.current.rightShoulder[0] = -1.05; s.current.rightShoulder[1] = 0; s.current.rightShoulder[2] = 0.1;+ s.current.rightElbow = -0.7;+ }apply(s.current);});@@ -609,7 +619,7 @@ export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeigh<OutfitDetails look={look} /><mesh geometry={GEO.lowSphere} material={matte(look.skin)} position={[0, TOY.neckY - 0.01, 0]} scale={[0.07, 0.04, 0.07]} /><Arm side={1} look={look} shoulder={lShoulder} elbow={lElbow} />- <Arm side={-1} look={look} shoulder={rShoulder} elbow={rElbow} />+ <Arm side={-1} look={look} shoulder={rShoulder} elbow={rElbow} holding={holding} /><group ref={head} position={[0, TOY.neckY, 0]}><mesh geometry={GEO.sphere} material={matte(look.skin)} position={[0, HD.y, 0]} scale={[HD.rx, HD.ry, HD.rz]} castShadow /><Face look={look} />diff --git a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.test.ts b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.test.tsindex 253130212e..f9c497f989 100644--- a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.test.ts@@ -1,8 +1,8 @@import { afterEach, describe, expect, it } from "vitest";-import { agentPositions, bodiesExcept } from "./walkerRegistry";+import { agentPositions, bodiesExcept, extraBodies } from "./walkerRegistry";describe("bodiesExcept", () => {- afterEach(() => agentPositions.clear());+ afterEach(() => { agentPositions.clear(); extraBodies.clear(); });it("counts every agent, the hovering Gigi included, but never the caller itself", () => {agentPositions.set("gigi", { x: 1, z: 1 });@@ -10,4 +10,10 @@ describe("bodiesExcept", () => {expect(Array.from(bodiesExcept(null, null))).toEqual([{ x: 1, z: 1 }, { x: 2, z: 2 }]);expect(Array.from(bodiesExcept("walker", { x: 5, z: 5 }))).toEqual([{ x: 1, z: 1 }, { x: 5, z: 5 }]);});++ it("counts the office dog as a body for everyone but the dog itself", () => {+ extraBodies.set("office-dog", { x: 3, z: 3 });+ expect(Array.from(bodiesExcept(null, null))).toEqual([{ x: 3, z: 3 }]);+ expect(Array.from(bodiesExcept("office-dog", { x: 5, z: 5 }))).toEqual([{ x: 5, z: 5 }]);+ });});diff --git a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.tsindex 4d2c67ab4c..6461d385c6 100644--- a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts@@ -19,12 +19,16 @@ export const seatedAtDesk = new Set<string>();*/export const companions = new Set<string>();+/** Other solid bodies on the floor that are not agents (the office dog), by id. */+export const extraBodies = new Map<string, Point>();+/**- * Every body except `selfId`: all agents plus, optionally, the person's character.+ * Every body except `selfId`: all agents, the extra bodies (the office dog) plus, optionally, the person's character.* Gigi counts too — it hovers at chest height, so walking "under" it would pass* through it — except while it follows the person as a companion.*/export function* bodiesExcept(selfId: string | null, player: Point | null): Generator<Point> {for (const [id, p] of agentPositions) if (id !== selfId && !companions.has(id)) yield p;+ for (const [id, p] of extraBodies) if (id !== selfId) yield p;if (player) yield player;}