Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agents): Gigi flies to an agent to deliver the task Jarvis hands it

rubenluetke10-beep2437c8d2405e
diff --git a/jarvis/core/events.py b/jarvis/core/events.py
index 5ec2ded59b..63a09884a8 100644
--- a/jarvis/core/events.py
+++ b/jarvis/core/events.py
@@ -2226,7 +2226,7 @@ class SocietyMessageSent(Event):
#: Server-assigned board sequence, monotonic. The client drops anything
#: it has already drawn, so an overlapping subscription is harmless.
seq: int = 0
- #: ``MsgType``: SAY | QUERY | ANSWER | PROPOSE.
+ #: ``MsgType``: SAY | QUERY | ANSWER | PROPOSE | ASSIGN.
msg_type: str = ""
from_agent: str = ""
#: "" means the line went into a room rather than to one teammate.
diff --git a/jarvis/society/world_feed.py b/jarvis/society/world_feed.py
index 70364eb65b..d49bd9ff5e 100644
--- a/jarvis/society/world_feed.py
+++ b/jarvis/society/world_feed.py
@@ -1,8 +1,9 @@
"""Speech on the board, projected onto the island.
-The society bus carries every envelope. The island only cares about the six
-that are somebody TALKING -- ``SAY | QUERY | ANSWER | PROPOSE`` and the two
-room brackets. Everything else already reaches the world through the
+The society bus carries every envelope. The island only cares about the seven
+that are somebody TALKING -- ``SAY | QUERY | ANSWER | PROPOSE``, a handed-over
+task (``ASSIGN``: the office draws the lead flying over to deliver it) and the
+two room brackets. Everything else already reaches the world through the
checkpoint engine, and pushing it twice would tell the same story in two
voices.
@@ -31,8 +32,9 @@ log = logging.getLogger(__name__)
__all__ = ["ROOM_TYPES", "VISIBLE_TYPES", "WorldFeed", "preview"]
#: A line one agent addressed to another; the island draws a bubble for each.
+#: ``ASSIGN`` is a task handed over; the office animates its delivery.
VISIBLE_TYPES: Final[frozenset[MsgType]] = frozenset(
- {MsgType.SAY, MsgType.QUERY, MsgType.ANSWER, MsgType.PROPOSE}
+ {MsgType.SAY, MsgType.QUERY, MsgType.ANSWER, MsgType.PROPOSE, MsgType.ASSIGN}
)
#: The brackets around a bounded room (rooms.py).
ROOM_TYPES: Final[frozenset[MsgType]] = frozenset({MsgType.ROOM_OPEN, MsgType.ROOM_SETTLE})
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx
index 5b90c2b4e6..07ba53659d 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx
@@ -7,7 +7,7 @@
* everything else is client-side choreography that costs no tokens and never
* starts or stops work.
*/
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState, type RefObject } from "react";
import { Html } from "@react-three/drei";
import { useFrame } from "@react-three/fiber";
import { DoubleSide, Vector3, type Group, type Mesh, type MeshBasicMaterial } from "three";
@@ -33,6 +33,7 @@ import { AgentBubble } from "./OfficeBubbles";
import type { ChatLine } from "./deskChat";
import type { DeskChat } from "./useDeskChats";
import { officeTalkChat, useOfficeTalk } from "./officeTalk";
+import { deliverySpot, ERRAND_SPEED, useErrandFeed, useGigiErrands } from "./gigiErrands";
/** The agent's symbol walks behind it as a little pet, about a fifth of its height. */
export const PET_SIZE_M = 0.26;
@@ -102,6 +103,33 @@ function Nameplate({ agent, activity, selected, onSelect, height = OFFICE_FIGURE
);
}
+/** The sealed envelope Gigi carries on an errand, bobbing under it. */
+function ErrandEnvelope({ owner }: { owner: RefObject<Group | null> }) {
+ const env = useRef<Group>(null);
+ useFrame(({ clock }) => {
+ if (!env.current || !owner.current) return;
+ const p = owner.current.position;
+ env.current.position.set(p.x, 0.62 + Math.sin(clock.elapsedTime * 5) * 0.04, p.z);
+ env.current.rotation.y = clock.elapsedTime * 1.6;
+ });
+ return (
+ <group ref={env}>
+ <mesh castShadow>
+ <boxGeometry args={[0.26, 0.17, 0.02]} />
+ <meshStandardMaterial color="#fffaf0" roughness={0.6} />
+ </mesh>
+ <mesh position={[0, 0.02, 0.012]} rotation={[0, 0, Math.PI / 4]}>
+ <boxGeometry args={[0.13, 0.13, 0.004]} />
+ <meshStandardMaterial color="#efe3c8" roughness={0.7} />
+ </mesh>
+ <mesh position={[0, -0.01, 0.016]}>
+ <circleGeometry args={[0.03, 16]} />
+ <meshStandardMaterial color="#c0392b" roughness={0.4} />
+ </mesh>
+ </group>
+ );
+}
+
export interface WalkerContext {
layout: OfficeLayout;
grid: NavGrid;
@@ -133,6 +161,8 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,
const isGigi = agent.tier === "lead";
const [gigiPose, setGigiPose] = useState<{ pose: Pose | null; travelling: boolean }>({ pose: null, travelling: false });
const speaking = useEventStore((s) => isGigi && s.voiceState === "speaking");
+ const errandKey = useRef("");
+ const carrying = useGigiErrands((s) => isGigi && s.current?.phase === "fly");
// Leaving the office releases the agent's spot and its registry entry.
useEffect(() => () => {
@@ -150,6 +180,35 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,
const dt = Math.min(rawDt, 0.1);
const now = Date.now();
const m = mover.current;
+ // Gigi on an errand: fly straight to the recipient, hover and deliver, then back to its day.
+ const errand = isGigi ? useGigiErrands.getState().current : null;
+ const recipient = errand ? agentPositions.get(errand.to) : undefined;
+ if (errand && !recipient) useGigiErrands.getState().finish(errand.id);
+ if (errand && recipient) {
+ const key = `${errand.id}:${errand.phase}`;
+ if (errand.phase === "fly") {
+ const spot = deliverySpot(recipient, m);
+ const end = m.path[m.path.length - 1];
+ if (errandKey.current !== key || !end || Math.hypot(end.x - spot.x, end.z - spot.z) > 0.4) m.path = [spot];
+ if (reduced) { m.x = spot.x; m.z = spot.z; m.path = []; }
+ const { arrived } = stepMover(m, ERRAND_SPEED, dt);
+ if (arrived) useGigiErrands.getState().arrive(errand.id);
+ } else {
+ m.heading = turnToward(m.heading, Math.atan2(recipient.x - m.x, recipient.z - m.z), 8 * dt);
+ if (now >= errand.untilMs) useGigiErrands.getState().finish(errand.id);
+ }
+ if (errandKey.current !== key) {
+ errandKey.current = key;
+ setGigiPose({ pose: errand.phase === "deliver" ? "talk" : null, travelling: errand.phase === "fly" });
+ }
+ // The day resumes from wherever the errand ended.
+ plan.current = null;
+ 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;
+ }
+ errandKey.current = "";
const summon = useOfficeStore.getState().summons[agent.agentId];
const calledTo = summon && summon.untilMs > now ? summon.target : null;
const sKey = calledTo ? `${calledTo.x.toFixed(2)},${calledTo.z.toFixed(2)}` : "";
@@ -174,6 +233,8 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,
dwellUntil.current = now + next.dwellMs;
} else {
m.path = findPath(ctx.grid, m, next.target) ?? [];
+ // Gigi flies: after an errand it may hover over a desk, where no floor path starts.
+ if (m.path.length === 0 && isGigi && Math.hypot(next.target.x - m.x, next.target.z - m.z) > 0.05) m.path = [next.target];
if (m.path.length === 0) { m.x = next.target.x; m.z = next.target.z; }
phase.current = m.path.length > 0 ? "travel" : "dwell";
if (phase.current === "dwell") dwellUntil.current = now + next.dwellMs;
@@ -230,6 +291,7 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,
<AgentBubble agent={agent} lines={lines} selected={selected} onSelect={onSelect}
height={(isGigi ? 1.75 : OFFICE_FIGURE_HEIGHT_M + 0.35) + 0.14} />
</group>
+ {carrying && <ErrandEnvelope owner={group} />}
{isGigi
? <GigiFlyer owner={mover} mode={gigiModeFor(gigiPose.pose, gigiPose.travelling)} speaking={speaking} paused={!awake} reduced={reduced} />
: <AgentFollower owner={group} appearance={pet} paused={!awake || reduced} clear={petClear} />}
@@ -242,6 +304,7 @@ export function OfficeAgents({ desks, agents, ctx, newcomers, awake, reduced, se
awake: boolean; reduced: boolean; selectedId: string | null; chats?: ReadonlyMap<string, DeskChat>; onSelect: (id: string) => void;
}) {
const deskOf = useMemo(() => new Map(desks.filter((d) => d.agentId).map((d) => [d.agentId as string, d])), [desks]);
+ useErrandFeed(agents, awake);
// Leaving the office hangs up: the talk socket closes, the chat keeps running on the server.
useEffect(() => () => { officeTalkChat.getState().disconnect(); useOfficeTalk.getState().setAgent(null); }, []);
return (
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeBubbles.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeBubbles.tsx
index ed96ce8505..19b5a71780 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeBubbles.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeBubbles.tsx
@@ -17,8 +17,9 @@ import type { SocietyAgent } from "../data";
import type { ChatLine } from "./deskChat";
import { player } from "./officeStore";
import { plateScale } from "./OfficeAgents";
+import { useGigiErrands } from "./gigiErrands";
import {
- ambientBubble, conversationBubble, itemsFor, PLAYER_LINE_MS, REPLY_LINGER_MS, talkStoreFor, useOfficeTalk,
+ ambientBubble, bubbleText, conversationBubble, itemsFor, PLAYER_LINE_MS, REPLY_LINGER_MS, talkStoreFor, useOfficeTalk,
type Bubble, type BubbleLabels,
} from "./officeTalk";
@@ -38,6 +39,22 @@ export function useBubbleLabels(): BubbleLabels {
}), [t]);
}
+/** Gigi's side of an errand ("on my way to Nora", then the task) and the recipient's "Got it". */
+function useErrandBubble(agent: SocietyAgent): Bubble | null {
+ const t = useT();
+ const errand = useGigiErrands((s) => s.current);
+ if (!errand) return null;
+ if (agent.tier === "lead") {
+ return errand.phase === "fly"
+ ? { kind: "thought", text: t("society.office.errand_flying").replace("{0}", errand.toName || "…"), live: true, atMs: 0 }
+ : { kind: "speech", text: bubbleText(errand.text || t("society.office.errand_task"), 180), live: false, atMs: 0 };
+ }
+ if (agent.agentId === errand.to && errand.phase === "deliver") {
+ return { kind: "speech", text: t("society.office.errand_ack"), live: false, atMs: 0 };
+ }
+ return null;
+}
+
/** Re-renders once a second while `active`, so a settled bubble can expire. */
function useClock(active: boolean): number {
const [now, setNow] = useState(() => Date.now());
@@ -105,6 +122,8 @@ export function AgentBubble({ agent, lines, selected, height, onSelect }: {
const lingering = !!talk && !talk.live && !selected;
const now = useClock(lingering);
const open = () => onSelect(agent.agentId);
+ const errand = useErrandBubble(agent);
+ if (errand) return <BubbleView bubble={errand} height={height} onClick={open} />;
if (talk && (talk.live || selected || now - talk.atMs < REPLY_LINGER_MS)) {
return <BubbleView bubble={talk} height={height} onClick={open} />;
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.feed.test.tsx b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.feed.test.tsx
new file mode 100644
index 0000000000..babda477fe
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.feed.test.tsx
@@ -0,0 +1,25 @@
+import { afterEach, describe, expect, it } from "vitest";
+import { act, renderHook } from "@testing-library/react";
+import { useEventStore } from "@/store/events";
+import type { SocietyAgent } from "../data";
+import { useErrandFeed, useGigiErrands } from "./gigiErrands";
+
+const agents = new Map([
+ ["jarvis", { agentId: "jarvis", name: "Jarvis", tier: "lead" } as SocietyAgent],
+ ["nora", { agentId: "nora", name: "Nora", tier: "specialist" } as SocietyAgent],
+]);
+
+afterEach(() => useGigiErrands.getState().reset());
+
+describe("useErrandFeed", () => {
+ it("queues Gigi's errand when the lead hands an agent a task", () => {
+ renderHook(() => useErrandFeed(agents, true));
+ act(() => {
+ useEventStore.getState().pushEvent({
+ id: "e-1", name: "SocietyMessageSent", layer: "society", ts: Date.now(),
+ payload: { event_id: "a1", msg_type: "ASSIGN", from_agent: "jarvis", to_agent: "nora", room_id: "", text: "Do it" },
+ });
+ });
+ expect(useGigiErrands.getState().current).toMatchObject({ id: "a1", to: "nora", toName: "Nora", phase: "fly" });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.test.ts b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.test.ts
new file mode 100644
index 0000000000..b24bce5dff
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.test.ts
@@ -0,0 +1,71 @@
+import { afterEach, describe, expect, it } from "vitest";
+import { deliverySpot, errandFrom, ERRAND_STALE_MS, MAX_QUEUED, useGigiErrands, type Errand } from "./gigiErrands";
+
+const agents = new Map([
+ ["jarvis", { tier: "lead" as const, name: "Jarvis" }],
+ ["nora", { tier: "specialist" as const, name: "Nora" }],
+ ["max", { tier: "specialist" as const, name: "Max" }],
+]);
+
+const assign = (patch: Record<string, unknown> = {}) => ({
+ event_id: "e1", msg_type: "ASSIGN", from_agent: "jarvis", to_agent: "nora", room_id: "", text: "Check the inbox", ...patch,
+});
+
+function errand(id: string, queuedMs = Date.now()): Errand {
+ return { id, to: "nora", toName: "Nora", text: id, msgType: "ASSIGN", queuedMs };
+}
+
+afterEach(() => useGigiErrands.getState().reset());
+
+describe("errandFrom", () => {
+ it("turns the lead's task for an agent into an errand", () => {
+ expect(errandFrom(assign(), agents, 5)).toEqual({ id: "e1", to: "nora", toName: "Nora", text: "Check the inbox", msgType: "ASSIGN", queuedMs: 5 });
+ });
+
+ it("ignores lines that are not the lead handing something to a present agent", () => {
+ expect(errandFrom(assign({ from_agent: "max" }), agents, 0)).toBeNull();
+ expect(errandFrom(assign({ to_agent: "ghost" }), agents, 0)).toBeNull();
+ expect(errandFrom(assign({ to_agent: "jarvis" }), agents, 0)).toBeNull();
+ expect(errandFrom(assign({ room_id: "r1" }), agents, 0)).toBeNull();
+ expect(errandFrom(assign({ msg_type: "ANSWER" }), agents, 0)).toBeNull();
+ expect(errandFrom(null, agents, 0)).toBeNull();
+ });
+});
+
+describe("deliverySpot", () => {
+ it("hovers next to the recipient on the side Gigi comes from", () => {
+ expect(deliverySpot({ x: 0, z: 0 }, { x: 10, z: 0 }, 1)).toEqual({ x: 1, z: 0 });
+ expect(deliverySpot({ x: 2, z: 2 }, { x: 2, z: 2 }, 1)).toEqual({ x: 3, z: 2 });
+ });
+});
+
+describe("errand queue", () => {
+ it("flies, delivers, then takes the next errand", () => {
+ const store = useGigiErrands.getState();
+ store.enqueue(errand("a"));
+ store.enqueue(errand("b"));
+ store.enqueue(errand("a"));
+ expect(useGigiErrands.getState().current).toMatchObject({ id: "a", phase: "fly" });
+ expect(useGigiErrands.getState().queue.map((e) => e.id)).toEqual(["b"]);
+ store.arrive("a");
+ expect(useGigiErrands.getState().current).toMatchObject({ id: "a", phase: "deliver" });
+ store.finish("a");
+ expect(useGigiErrands.getState().current).toMatchObject({ id: "b", phase: "fly" });
+ store.finish("b");
+ expect(useGigiErrands.getState().current).toBeNull();
+ });
+
+ it("caps the queue and skips errands whose moment has passed", () => {
+ const store = useGigiErrands.getState();
+ store.enqueue(errand("now"));
+ store.enqueue(errand("old", Date.now() - ERRAND_STALE_MS - 1));
+ for (let i = 0; i < MAX_QUEUED + 2; i += 1) store.enqueue(errand(`q${i}`));
+ expect(useGigiErrands.getState().queue).toHaveLength(MAX_QUEUED);
+ store.reset();
+ store.enqueue(errand("first"));
+ store.enqueue(errand("stale", Date.now() - ERRAND_STALE_MS - 1));
+ store.enqueue(errand("fresh"));
+ store.finish("first");
+ expect(useGigiErrands.getState().current?.id).toBe("fresh");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.ts b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.ts
new file mode 100644
index 0000000000..0f9cf7f0f1
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiErrands.ts
@@ -0,0 +1,130 @@
+/**
+ * Gigi's errands: when Jarvis (the lead) hands an agent a task, Gigi flies
+ * over to that agent's figure, delivers the message in a speech bubble, and
+ * flies back to its day.
+ *
+ * The source is the board's own `SocietyMessageSent` event (msg_type ASSIGN,
+ * or a direct line from the lead), which the WebSocket already forwards; the
+ * errand is pure choreography on top of it — it never starts, stops or
+ * changes work. Errands queue, so three tasks in a row are three flights.
+ */
+import { useEffect, useRef } from "react";
+import { create } from "zustand";
+import { useEventStore } from "@/store/events";
+import type { SocietyAgent } from "../data";
+import type { Point } from "./officeLayout";
+
+/** The board types that count as the lead sending an agent something. */
+const ERRAND_TYPES = new Set(["ASSIGN", "SAY", "QUERY"]);
+const MESSAGE_EVENT = "SocietyMessageSent";
+/** How long Gigi hovers next to the agent while the message is read out. */
+export const DELIVER_MS = 5_000;
+/** An errand still waiting after this long is stale: the moment has passed. */
+export const ERRAND_STALE_MS = 60_000;
+/** Queue cap — a burst of delegations never becomes minutes of flying. */
+export const MAX_QUEUED = 4;
+/** Gigi stops this far from the agent, on the side it comes from (metres). */
+export const DELIVERY_GAP_M = 0.95;
+/** Gigi's errand speed: brisk, faster than anyone walks (m/s). */
+export const ERRAND_SPEED = 3.4;
+/** Newest events inspected per update, same bound as the island's feed. */
+const MAX_CATCHUP = 64;
+
+export interface Errand {
+ id: string;
+ /** Recipient agent id. */
+ to: string;
+ /** Recipient's name, for Gigi's "on my way to …" bubble. */
+ toName: string;
+ /** Bubble-sized preview of what was handed over. */
+ text: string;
+ msgType: string;
+ queuedMs: number;
+}
+
+export type ErrandPhase = "fly" | "deliver";
+
+interface ErrandState {
+ queue: Errand[];
+ current: (Errand & { phase: ErrandPhase; untilMs: number }) | null;
+ enqueue: (errand: Errand) => void;
+ arrive: (id: string) => void;
+ /** Ends the current errand and starts the next one that is still fresh. */
+ finish: (id: string) => void;
+ reset: () => void;
+}
+
+function nextFresh(queue: Errand[], now: number): { current: ErrandState["current"]; queue: Errand[] } {
+ const fresh = queue.filter((e) => now - e.queuedMs < ERRAND_STALE_MS);
+ const [head, ...rest] = fresh;
+ return { current: head ? { ...head, phase: "fly", untilMs: 0 } : null, queue: rest };
+}
+
+export const useGigiErrands = create<ErrandState>((set) => ({
+ queue: [],
+ current: null,
+ enqueue: (errand) => set((s) => {
+ if (s.current?.id === errand.id || s.queue.some((e) => e.id === errand.id)) return s;
+ if (!s.current) return { current: { ...errand, phase: "fly", untilMs: 0 } };
+ return { queue: [...s.queue, errand].slice(-MAX_QUEUED) };
+ }),
+ arrive: (id) => set((s) => (s.current?.id === id && s.current.phase === "fly"
+ ? { current: { ...s.current, phase: "deliver", untilMs: Date.now() + DELIVER_MS } } : s)),
+ finish: (id) => set((s) => (s.current?.id === id ? nextFresh(s.queue, Date.now()) : s)),
+ reset: () => set({ queue: [], current: null }),
+}));
+
+/**
+ * The errand a board event describes, or null: only the lead sending a live
+ * agent (never itself) a task or a direct line counts.
+ */
+export function errandFrom(payload: unknown, agents: ReadonlyMap<string, Pick<SocietyAgent, "tier" | "name">>, now: number): Errand | null {
+ if (!payload || typeof payload !== "object") return null;
+ const p = payload as Record<string, unknown>;
+ const from = typeof p.from_agent === "string" ? p.from_agent : "";
+ const to = typeof p.to_agent === "string" ? p.to_agent : "";
+ const msgType = typeof p.msg_type === "string" ? p.msg_type : "";
+ if (!ERRAND_TYPES.has(msgType) || !to || to === from || p.room_id) return null;
+ if (agents.get(from)?.tier !== "lead" || !agents.has(to)) return null;
+ const id = typeof p.event_id === "string" && p.event_id ? p.event_id : `${from}>${to}:${now}`;
+ return { id, to, toName: agents.get(to)?.name ?? "", text: typeof p.text === "string" ? p.text : "", msgType, queuedMs: now };
+}
+
+/** Where Gigi hovers to deliver: next to the recipient, on the side Gigi comes from. */
+export function deliverySpot(recipient: Point, from: Point, gap = DELIVERY_GAP_M): Point {
+ const dx = from.x - recipient.x, dz = from.z - recipient.z;
+ const d = Math.hypot(dx, dz);
+ if (d < 1e-6) return { x: recipient.x + gap, z: recipient.z };
+ return { x: recipient.x + (dx / d) * gap, z: recipient.z + (dz / d) * gap };
+}
+
+/**
+ * Queue an errand for every board line the lead sends while the office is
+ * awake. Drains the event log from a cursor (like the island's feed), so a
+ * burst of delegations is never half-lost; asleep, it forgets everything.
+ */
+export function useErrandFeed(agents: ReadonlyMap<string, SocietyAgent>, enabled: boolean): void {
+ const roster = useRef(agents);
+ roster.current = agents;
+ useEffect(() => {
+ if (!enabled) { useGigiErrands.getState().reset(); return; }
+ let cursor: string | null = useEventStore.getState().events[0]?.id ?? null;
+ return useEventStore.subscribe((state) => {
+ const log = state.events;
+ const top = log[0];
+ if (!top || top.id === cursor) return;
+ const fresh = [];
+ for (let i = 0; i < log.length && i < MAX_CATCHUP; i += 1) {
+ if (log[i].id === cursor) break;
+ fresh.push(log[i]);
+ }
+ cursor = top.id;
+ const now = Date.now();
+ for (let i = fresh.length - 1; i >= 0; i -= 1) {
+ if (fresh[i].name !== MESSAGE_EVENT) continue;
+ const errand = errandFrom(fresh[i].payload, roster.current, now);
+ if (errand) useGigiErrands.getState().enqueue(errand);
+ }
+ });
+ }, [enabled]);
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/world/conversation.ts b/jarvis/ui/web/frontend/src/components/society/world/conversation.ts
index 9cb0c6521c..d8c23e83b6 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/conversation.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/conversation.ts
@@ -352,6 +352,7 @@ export const WORLD_MSG_TYPES: readonly string[] = [
"QUERY",
"ANSWER",
"PROPOSE",
+ "ASSIGN",
"ROOM_OPEN",
"ROOM_SETTLE",
];
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index 2f37a30a8a..5368663047 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -925,7 +925,10 @@
"hair_slick": "Zurückgegelt",
"hair_sidepart": "Seitenscheitel",
"hair_buzz": "Buzz Cut",
- "hair_ponytail": "Pferdeschwanz"
+ "hair_ponytail": "Pferdeschwanz",
+ "errand_flying": "Bringt {0} eine Aufgabe",
+ "errand_task": "Hier ist eine neue Aufgabe für dich.",
+ "errand_ack": "Verstanden, bin dran!"
}
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index 1d0d440a34..0ff4fed5de 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -925,7 +925,10 @@
"hair_slick": "Slicked back",
"hair_sidepart": "Side part",
"hair_buzz": "Buzz cut",
- "hair_ponytail": "Ponytail"
+ "hair_ponytail": "Ponytail",
+ "errand_flying": "Taking {0} a task",
+ "errand_task": "Here is a new task for you.",
+ "errand_ack": "Got it, on it!"
}
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index 809f70b41c..a29e432762 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -925,7 +925,10 @@
"hair_slick": "Hacia atrás",
"hair_sidepart": "Raya al lado",
"hair_buzz": "Rapado",
- "hair_ponytail": "Coleta"
+ "hair_ponytail": "Coleta",
+ "errand_flying": "Lleva una tarea a {0}",
+ "errand_task": "Aquí tienes una tarea nueva.",
+ "errand_ack": "¡Entendido, voy!"
}
}
}
diff --git a/tests/unit/society/test_world_feed.py b/tests/unit/society/test_world_feed.py
index a5890fd63a..0a81d79842 100644
--- a/tests/unit/society/test_world_feed.py
+++ b/tests/unit/society/test_world_feed.py
@@ -88,9 +88,9 @@ async def test_a_message_between_two_agents_reaches_the_island_once(rt):
async def test_every_talking_type_is_forwarded(rt):
runtime, pushed = rt
- for kind in (MsgType.QUERY, MsgType.ANSWER, MsgType.PROPOSE):
+ for kind in (MsgType.QUERY, MsgType.ANSWER, MsgType.PROPOSE, MsgType.ASSIGN):
await runtime.say(from_agent="scout", to_agent="archivist", text="ping", msg_type=kind)
- assert [e.msg_type for e in _messages(pushed)] == ["QUERY", "ANSWER", "PROPOSE"]
+ assert [e.msg_type for e in _messages(pushed)] == ["QUERY", "ANSWER", "PROPOSE", "ASSIGN"]
async def test_a_body_is_never_broadcast_in_full(rt):