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): Gigi follows the person on the agents floor too
rubenluetke10-beepfff83cae8653
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsxindex 07ba53659d..260e61b388 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx@@ -16,7 +16,7 @@ import type { SocietyAgent } from "../data";import type { FigureDrive, FigureMode } from "../figures/FigureRig";import { ToyFigure } from "./ToyFigure";import { GigiFlyer } from "./GigiFlyer";-import type { GigiFlightMode } from "./gigiFlight";+import { followAnchor, type GigiFlightMode } from "./gigiFlight";import { useEventStore } from "@/store/events";import { SEAT_HEIGHT, toyLookFor } from "./toyFigureModel";import { OFFICE } from "./officePalette";@@ -28,7 +28,7 @@ import type { TrailPoint } from "../companion/trail";import { stepMover, stepMoverAvoiding, turnToward, WALK_SPEED, type Mover } from "./officeMotion";import { createRng, planFor, type ActivityKind, type Plan, type Pose, type SpotBook } from "./officeBehavior";import { player, useOfficeStore } from "./officeStore";-import { agentPositions, bodiesExcept, seatedAtDesk } from "./walkerRegistry";+import { agentPositions, bodiesExcept, companions, seatedAtDesk } from "./walkerRegistry";import { AgentBubble } from "./OfficeBubbles";import type { ChatLine } from "./deskChat";import type { DeskChat } from "./useDeskChats";@@ -39,6 +39,11 @@ import { deliverySpot, ERRAND_SPEED, useErrandFeed, useGigiErrands } from "./gigexport const PET_SIZE_M = 0.26;const PET_FOLLOW_M = 0.7;+/** The person's character as a mover for Gigi to follow (the body object itself, mutated every frame). */+const PLAYER_OWNER = { current: player };+/** Farther than this from the person's shoulder and Gigi flies back first instead of hovering beside them. */+const FOLLOW_CATCH_M = 1;+/** Every figure shares one toy scale, so desks and couches read the same everywhere. */export const OFFICE_FIGURE_HEIGHT_M = 1.3;@@ -163,12 +168,17 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,const speaking = useEventStore((s) => isGigi && s.voiceState === "speaking");const errandKey = useRef("");const carrying = useGigiErrands((s) => isGigi && s.current?.phase === "fly");+ const [following, setFollowing] = useState(false);+ const followingRef = useRef(false);+ const gigiSide = useRef<1 | -1>(1);+ const airClear = useMemo(() => (x: number, z: number) => isWalkable(ctx.grid, { x, z }), [ctx.grid]);// Leaving the office releases the agent's spot and its registry entry.useEffect(() => () => {ctx.book.release(agent.agentId);agentPositions.delete(agent.agentId);seatedAtDesk.delete(agent.agentId);+ companions.delete(agent.agentId);}, [ctx.book, agent.agentId]);const pet = useMemo(() => ({ ...resolveCompanion(agent.agentId, agent.figure?.companion), sizeM: PET_SIZE_M, followDistanceM: PET_FOLLOW_M }),[agent.agentId, agent.figure?.companion]);@@ -185,6 +195,8 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,const recipient = errand ? agentPositions.get(errand.to) : undefined;if (errand && !recipient) useGigiErrands.getState().finish(errand.id);if (errand && recipient) {+ if (followingRef.current) { followingRef.current = false; setFollowing(false); }+ companions.delete(agent.agentId);const key = `${errand.id}:${errand.phase}`;if (errand.phase === "fly") {const spot = deliverySpot(recipient, m);@@ -205,6 +217,37 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,plan.current = null;agentPositions.set(agent.agentId, { x: m.x, z: m.z });seatedAtDesk.delete(agent.agentId);+ if (isGigi && !calledTo) {+ // Gigi keeps the person company, as on the coding floor; an errand or a summons still takes it away.+ const anchor = followAnchor(player.x, player.z, player.heading, gigiSide.current, airClear);+ gigiSide.current = anchor.side;+ const far = Math.hypot(anchor.x - m.x, anchor.z - m.z) > FOLLOW_CATCH_M;+ if (!placed.current || reduced || !far) {+ m.x = anchor.x; m.z = anchor.z; m.path = [];+ placed.current = true;+ } else if (awake) {+ // Back from an errand or a meeting: fly over to the person, then fall in beside them.+ m.path = [anchor];+ stepMover(m, ERRAND_SPEED, dt);+ }+ const nowFollowing = Math.hypot(anchor.x - m.x, anchor.z - m.z) <= FOLLOW_CATCH_M;+ if (nowFollowing) { m.heading = player.heading; companions.add(agent.agentId); } else companions.delete(agent.agentId);+ if (followingRef.current !== nowFollowing || plan.current) {+ followingRef.current = nowFollowing;+ setFollowing(nowFollowing);+ setGigiPose({ pose: null, travelling: !nowFollowing });+ setActivity(null);+ }+ // The day resumes from wherever the person leaves Gigi (a summons).+ plan.current = null;+ summonKey.current = "";+ agentPositions.set(agent.agentId, { x: m.x, z: m.z });+ seatedAtDesk.delete(agent.agentId);+ if (group.current) group.current.position.set(m.x, 0, m.z);+ return;+ }+ if (followingRef.current) { followingRef.current = false; setFollowing(false); }+ companions.delete(agent.agentId);if (group.current) group.current.position.set(m.x, 0, m.z);return;}@@ -293,7 +336,9 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,</group>{carrying && <ErrandEnvelope owner={group} />}{isGigi- ? <GigiFlyer owner={mover} mode={gigiModeFor(gigiPose.pose, gigiPose.travelling)} speaking={speaking} paused={!awake} reduced={reduced} />+ // One flyer for both roles, so switching keeps its flight state instead of re-spawning it.+ ? <GigiFlyer owner={following ? PLAYER_OWNER : mover} mode={following ? "follow" : gigiModeFor(gigiPose.pose, gigiPose.travelling)}+ speaking={speaking} paused={!awake} reduced={reduced} clear={following ? airClear : undefined} />: <AgentFollower owner={group} appearance={pet} paused={!awake || reduced} clear={petClear} />}</>);diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsxindex f6d147b1d8..b890d3077a 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx@@ -13,7 +13,7 @@ import type { ToyLook } from "./toyFigureModel";import { findPath, isWalkable, nearestWalkable, type NavGrid } from "./officeNav";import { applySeparation, separation, stepClearOfBodies, stepMover, turnToward } from "./officeMotion";import { officeSession, player, sameSelection, useOfficeStore, type Selection } from "./officeStore";-import { agentPositions, bodiesExcept } from "./walkerRegistry";+import { agentPositions, bodiesExcept, companions } from "./walkerRegistry";import { OFFICE_FIGURE_HEIGHT_M } from "./OfficeAgents";import { seatOf, type OfficeLayout } from "./officeLayout";import { chairInReach, useLeadSeat } from "./leadSeat";@@ -82,6 +82,7 @@ function nearestInteractable(layout: OfficeLayout): Selection | null {if (d <= cp.radius && d < bestDistance) { best = { kind: "checkpoint", id: cp.id }; bestDistance = d; }}for (const [id, p] of agentPositions) {+ if (companions.has(id)) continue;const d = Math.hypot(p.x - player.x, p.z - player.z);if (d <= AGENT_TALK_RANGE && d < bestDistance) { best = { kind: "agent", id }; bestDistance = d; }}diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.tsindex 672f1783ec..baf90e9e3b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts@@ -1,9 +1,10 @@/*** Flight of Gigi, the lead agent's mascot, over the office floor. The lead is* not drawn as a figure: Gigi hovers at chest/head height of the toy figures- * and follows the walker's ground position (x, z). On the coding floor Gigi is- * no walker at all: in "follow" mode it trails the person's own character,- * hovering behind-beside its shoulder (`followAnchor`).+ * and follows the walker's ground position (x, z). In "follow" mode it trails+ * the person's own character instead, hovering behind-beside its shoulder+ * (`followAnchor`): always on the coding floor, and on the agents floor+ * whenever no errand or summons takes it away.** Pure and deterministic: the same state and inputs give the same pose. With* an `out` object a step allocates nothing, so it can run every frame.diff --git a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.tsindex d5ca187a58..4d2c67ab4c 100644--- a/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/walkerRegistry.ts@@ -13,11 +13,18 @@ export const knownAgents = new Set<string>();/** Agents sitting at their own desk right now — their monitor shows their chat. */export const seatedAtDesk = new Set<string>();+/**+ * Agents flying along at the person's shoulder right now (Gigi). They are no+ * obstacle and no "nearby" target: they would always be the closest one.+ */+export const companions = new Set<string>();+/*** Every body except `selfId`: all agents plus, optionally, the person's character.- * Gigi counts too — it hovers at chest height, so walking "under" it would pass through it.+ * 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) yield p;+ for (const [id, p] of agentPositions) if (id !== selfId && !companions.has(id)) yield p;if (player) yield player;}