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(world): agents that talk to each other now look like it
rubenluetke10-beep3eb5f6ab8ee1
diff --git a/jarvis/ui/web/frontend/src/components/society/world/ConversationScene.tsx b/jarvis/ui/web/frontend/src/components/society/world/ConversationScene.tsxnew file mode 100644index 0000000000..b287f1216f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/world/ConversationScene.tsx@@ -0,0 +1,481 @@+/**+ * Two agents talking, drawn — the R3F half of `conversation.ts`.+ *+ * Everything it needs about WHERE the figures are it reads from+ * `walkerRegistry.ts`, the same per-frame map the minimap reads: positions+ * change 60 times a second and putting them through React would be absurd.+ * Everything it needs about WHO said WHAT it reads from the conversation+ * store, which changes a few times per sentence.+ *+ * What it writes back is one `SpeechPose` per participant: a heading to turn+ * toward and a flag for the `talk` clip. Never a position. A conversation+ * cannot move a figure (`world-behaviour-manual.md` §1) — the backend owns+ * where an agent is, and a figure that walked to another shop because it said+ * something would be the island inventing a third truth.+ *+ * Mounted OUTSIDE `<Shadowed>`: the ground pips are additive halos and a+ * translucent glow that casts a shadow reads as a hole in the grass.+ */+import { memo, useEffect, useMemo, useRef } from "react";+import { Html } from "@react-three/drei";+import { useFrame, useThree } from "@react-three/fiber";+import type { Group, Mesh } from "three";++import { fill, useT } from "@/i18n";+import type { SocietyAgent } from "../data";+import { WORLD_HERO_SCALE } from "./WalkerFigure";+import { useKit } from "./WorldKit";+import { useBuildingPoses } from "./buildingPoses";+import {+ HEAD_Y_M,+ MAX_CONCURRENT,+ MIN_FACE_M,+ PIP_R_M,+ ROOM_RING_R_M,+ bubbleSeconds,+ classify,+ driftedApart,+ facingBetween,+ pipScale,+ tangentFacing,+ type ConvoKind,+ type TalkKind,+} from "./conversation";+import {+ clearSpeechPoses,+ orderedTalks,+ setSpeechPose,+ useConversationStore,+ type Conversation,+} from "./conversationStore";+import { buildIsland, groundY, tileToWorld } from "./islandLayout";+import { walkerPins, type WalkerPin } from "./walkerRegistry";++/**+ * How high a bubble floats over a figure's own head, in metres.+ *+ * High enough to clear the nameplate: at 0.5 m the bubble sat exactly on it+ * and hid the one thing the viewer needs — WHO is speaking.+ */+const BUBBLE_LIFT_M = 1.75;+/** Stacked conversations lift their bubbles by this much each, so none overlap. */+const BUBBLE_STACK_M = 0.9;+/** Head height for a figure whose recipe carries no height. */+const DEFAULT_HEAD_M = 2.0;++/** One participant, resolved: the roster row, the live pin, the head height. */+interface Party {+ agent: SocietyAgent;+ pin: WalkerPin;+ headY: number;+}++function headHeight(agent: SocietyAgent): number {+ if (!agent.figure) return DEFAULT_HEAD_M;+ return (agent.figure.heightM ?? 1.75) * WORLD_HERO_SCALE;+}++/**+ * A conversation with both ends resolved against the live island, or null when+ * there is nothing to draw. `partner` is null for the one-sided case: a message+ * from the scheduler, or to a row that has no figure yet.+ */+interface Staged {+ talk: Conversation;+ speaker: Party;+ partner: Party | null;+ kind: ConvoKind;+ distanceM: number;+ /** Index among the live conversations — decides the bubble's stack height. */+ slot: number;+}++function stage(+ talks: Conversation[],+ byId: Map<string, SocietyAgent>,+ pins: ReadonlyMap<string, WalkerPin>,+): Staged[] {+ const out: Staged[] = [];+ talks.forEach((talk, slot) => {+ const speakerAgent = byId.get(talk.speakerId);+ const speakerPin = pins.get(talk.speakerId);+ const partnerAgent = talk.partnerId ? byId.get(talk.partnerId) : undefined;+ const partnerPin = talk.partnerId ? pins.get(talk.partnerId) : undefined;++ // Whoever we can see is the anchor. When only the partner has a figure —+ // the scheduler messaging Scout — the bubble belongs over the partner.+ const speaker: Party | null =+ speakerAgent && speakerPin+ ? { agent: speakerAgent, pin: speakerPin, headY: headHeight(speakerAgent) }+ : null;+ const partner: Party | null =+ partnerAgent && partnerPin+ ? { agent: partnerAgent, pin: partnerPin, headY: headHeight(partnerAgent) }+ : null;+ const anchor = speaker ?? partner;+ if (!anchor) return; // neither end is on the island yet: nothing to draw++ const other = anchor === speaker ? partner : null;+ const distanceM = other+ ? Math.hypot(anchor.pin.x - other.pin.x, anchor.pin.z - other.pin.z)+ : 0;+ // Decided once and cached on the row: a wandering figure must not flip a+ // running conversation from a talk into a call mid-sentence.+ const kind: ConvoKind = talk.kind ?? (other ? classify(distanceM) : "talk");+ out.push({ talk, speaker: anchor, partner: other, kind, distanceM, slot });+ });+ return out;+}++export interface ConversationSceneProps {+ agents: SocietyAgent[];+ /** Reduced motion: the island holds still and so does every conversation. */+ paused: boolean;+}++export function ConversationScene({ agents, paused }: ConversationSceneProps) {+ const talks = useConversationStore((s) => s.talks);+ const room = useConversationStore((s) => s.room);+ const byId = useMemo(() => new Map(agents.map((a) => [a.agentId, a])), [agents]);+ const live = useMemo(() => orderedTalks(talks).slice(0, MAX_CONCURRENT), [talks]);++ // A conversation whose line has run its course hands the queue on. Kept out+ // of `useFrame` on purpose: it is a state change, not an animation.+ useEffect(() => {+ if (live.length === 0) return;+ const timers = live+ .filter((t) => t.line !== null)+ .map((t) => {+ const left = t.lineStartedMs + bubbleSeconds(t.line?.chars ?? 0) * 1000 - Date.now();+ return setTimeout(+ () => useConversationStore.getState().advance(t.key),+ Math.max(0, left),+ );+ });+ return () => timers.forEach(clearTimeout);+ }, [live]);++ // A conversation left with no line and nothing queued is over.+ useEffect(() => {+ const empty = live.filter((t) => t.line === null && t.queued.length === 0);+ if (empty.length === 0) return;+ const timers = empty.map((t) =>+ setTimeout(() => useConversationStore.getState().closeTalk(t.key), 800),+ );+ return () => timers.forEach(clearTimeout);+ }, [live]);++ // The scene is going away (unmount, a lost WebGL context): every figure it+ // was driving goes back to its own sim (AP-32 — nothing survives the loss).+ useEffect(() => clearSpeechPoses, []);++ if (live.length === 0 && !room) return null;++ return (+ <group>+ {live.map((talk) => (+ <ConversationView+ key={talk.key}+ talk={talk}+ byId={byId}+ paused={paused}+ slot={live.indexOf(talk)}+ />+ ))}+ {room && <RoomSign room={room} paused={paused} />}+ </group>+ );+}++/**+ * One conversation. The heavy work is per frame and writes to refs; the only+ * React state it reads is the line, which changes once per sentence.+ */+function ConversationView({+ talk,+ byId,+ paused,+ slot,+}: {+ talk: Conversation;+ byId: Map<string, SocietyAgent>;+ paused: boolean;+ slot: number;+}) {+ const kit = useKit();+ const invalidate = useThree((s) => s.invalidate);+ const anchorRef = useRef<Group>(null);+ const pipA = useRef<Mesh>(null);+ const pipB = useRef<Mesh>(null);++ useFrame(({ clock }) => {+ const pins = walkerPins();+ const [next] = stage([talk], byId, pins);+ const anchor = anchorRef.current;+ if (!next || !anchor) {+ if (pipA.current) pipA.current.visible = false;+ if (pipB.current) pipB.current.visible = false;+ return;+ }++ const { speaker, partner } = next;+ anchor.position.set(+ speaker.pin.x,+ speaker.headY + BUBBLE_LIFT_M + slot * BUBBLE_STACK_M,+ speaker.pin.z,+ );++ if (!paused && partner) {+ // Two figures on one stand tile have no usable vector between them: the+ // heading would jitter and they would turn INTO each other. Below the+ // floor they turn along the building's front instead, across each other.+ const close = next.distanceM < MIN_FACE_M;+ const facing = close+ ? tangentFacing(speaker.pin.x <= partner.pin.x ? 0 : Math.PI, 1)+ : facingBetween(speaker.pin.x, speaker.pin.z, partner.pin.x, partner.pin.z);+ const back = close+ ? tangentFacing(speaker.pin.x <= partner.pin.x ? 0 : Math.PI, -1)+ : facingBetween(partner.pin.x, partner.pin.z, speaker.pin.x, speaker.pin.z);+ // A talk that has drifted apart keeps its bubbles and drops the facing:+ // shouting across the island should not look like a quiet word.+ const holdFacing = next.kind === "talk" && !driftedApart(next.distanceM);+ setSpeechPose(talk.speakerId, {+ heading: holdFacing ? facing : null,+ talking: talk.line !== null,+ });+ setSpeechPose(partner.agent.agentId, {+ heading: holdFacing ? back : null,+ talking: false,+ });+ } else if (!paused) {+ setSpeechPose(talk.speakerId, { heading: null, talking: talk.line !== null });+ }++ // The ground pips: a soft breathing pool under whoever is in this+ // conversation. One draw call each, and they read at any zoom where the+ // bubble text has already become unreadable.+ const t = clock.getElapsedTime();+ const scale = paused ? 1 : pipScale(t);+ const { map } = buildIsland();+ if (pipA.current) {+ pipA.current.visible = true;+ pipA.current.position.set(speaker.pin.x, groundY(map, speaker.pin.x, speaker.pin.z) + 0.03, speaker.pin.z);+ pipA.current.scale.setScalar(PIP_R_M * scale);+ }+ if (pipB.current) {+ pipB.current.visible = partner !== null;+ if (partner) {+ pipB.current.position.set(partner.pin.x, groundY(map, partner.pin.x, partner.pin.z) + 0.03, partner.pin.z);+ pipB.current.scale.setScalar(PIP_R_M * scale);+ }+ }+ if (paused) invalidate();+ });++ // The figures go back to their own sims the moment this conversation ends.+ useEffect(() => {+ const speakerId = talk.speakerId;+ const partnerId = talk.partnerId;+ return () => {+ setSpeechPose(speakerId, { heading: null, talking: false });+ if (partnerId) setSpeechPose(partnerId, { heading: null, talking: false });+ };+ }, [talk.speakerId, talk.partnerId]);++ const lineSpeaker = talk.line ? byId.get(talk.line.speakerId) : undefined;+ const speakerAgent =+ lineSpeaker ?? byId.get(talk.speakerId) ?? (talk.partnerId ? byId.get(talk.partnerId) : undefined);+ const accent = speakerAgent?.palette.accent ?? "#1f2a3a";+ const speakerName = speakerAgent?.name ?? talk.speakerId;++ return (+ <group>+ <mesh ref={pipA} geometry={kit.g.disc} material={kit.m.halo(accent, 0.22)} visible={false} />+ <mesh ref={pipB} geometry={kit.g.disc} material={kit.m.halo(accent, 0.16)} visible={false} />+ <group ref={anchorRef}>+ {talk.line && (+ <Html center zIndexRange={[34, 12]} style={{ pointerEvents: "none" }}>+ <SpeechBubble+ who={speakerName}+ text={talk.line.text}+ kind={talk.line.kind}+ accent={accent}+ skipped={talk.skipped}+ truncated={talk.line.truncated}+ />+ </Html>+ )}+ </group>+ {talk.partnerId && talk.line && (+ <ListeningBubble byId={byId} partnerId={talk.partnerId} slot={slot} />+ )}+ </group>+ );+}++/** The three dots over whoever is being spoken to. */+function ListeningBubble({+ byId,+ partnerId,+ slot,+}: {+ byId: Map<string, SocietyAgent>;+ partnerId: string;+ slot: number;+}) {+ const t = useT();+ const group = useRef<Group>(null);+ const agent = byId.get(partnerId);++ useFrame(() => {+ const pin = walkerPins().get(partnerId);+ const node = group.current;+ if (!node) return;+ if (!pin || !agent) {+ node.visible = false;+ return;+ }+ node.visible = true;+ node.position.set(+ pin.x,+ headHeight(agent) + BUBBLE_LIFT_M + slot * BUBBLE_STACK_M,+ pin.z,+ );+ });++ if (!agent) return null;+ return (+ <group ref={group} visible={false}>+ <Html center zIndexRange={[33, 12]} style={{ pointerEvents: "none" }}>+ <div className="sw-bubble" data-listening aria-label={t("society.world.talk_listening")}>+ <span className="sw-bubble-dots" aria-hidden>+ <i />+ <i />+ <i />+ </span>+ </div>+ </Html>+ </group>+ );+}++const KIND_KEY: Record<TalkKind, string | null> = {+ say: null,+ query: "society.world.talk_kind_query",+ answer: "society.world.talk_kind_answer",+ propose: "society.world.talk_kind_propose",+};++/** The bubble itself. Memoised: it is DOM, and it changes once per sentence. */+const SpeechBubble = memo(function SpeechBubble({+ who,+ text,+ kind,+ accent,+ skipped,+ truncated,+}: {+ who: string;+ text: string;+ kind: TalkKind;+ accent: string;+ skipped: number;+ truncated: boolean;+}) {+ const t = useT();+ const label = KIND_KEY[kind];+ return (+ <div+ className="sw-bubble"+ data-kind={kind}+ data-accent=""+ style={{ ["--sw-accent" as string]: accent }}+ >+ <span className="sw-bubble-kind">+ <i className="sw-bubble-dot" style={{ background: accent }} />+ {who}+ {label && <em>{t(label)}</em>}+ </span>+ {text}+ {truncated ? t("society.world.talk_more") : ""}+ {skipped > 0 && (+ <span className="sw-bubble-digest">+ {fill(t("society.world.talk_digest"), { count: skipped }).replace("{0}", String(skipped))}+ </span>+ )}+ </div>+ );+});++/**+ * A bounded room in session: a ring on the ground at the Town Hall and a sign+ * saying which round it is on. The members are already standing there — the+ * checkpoint engine put them at `civic` — so this adds no movement of its own.+ */+function RoomSign({+ room,+ paused,+}: {+ room: NonNullable<ReturnType<typeof useConversationStore.getState>["room"]>;+ paused: boolean;+}) {+ const t = useT();+ const kit = useKit();+ const ring = useRef<Mesh>(null);+ // The viewer can turn the Town Hall; the ring follows it.+ const generation = useBuildingPoses((s) => s.generation);+ const anchor = useMemo(() => {+ const { map, content } = buildIsland();+ const [tx, tz] = content.places.civic.standTile;+ const [x, z] = tileToWorld(tx, tz);+ return { x, y: groundY(map, x, z) + 0.04, z };+ // `generation` is the island's rebuild counter, not an unused value.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [generation]);++ useFrame(({ clock }) => {+ if (paused || !ring.current) return;+ ring.current.scale.setScalar(ROOM_RING_R_M * pipScale(clock.getElapsedTime() * 0.6));+ });++ const round = fill(t("society.world.room_round"), { count: room.round })+ .replace("{0}", String(room.round))+ .replace("{1}", String(room.maxRounds));+ const reasonKey = `society.world.room_reason_${room.reason}`;+ const reason = room.reason ? t(reasonKey) : "";++ return (+ <group position={[anchor.x, anchor.y, anchor.z]}>+ <mesh+ ref={ring}+ geometry={kit.g.disc}+ material={kit.m.halo("#ffd166", room.settled ? 0.1 : 0.18)}+ scale={ROOM_RING_R_M}+ />+ <Html+ position={[0, HEAD_Y_M + 1.4, 0]}+ center+ zIndexRange={[32, 12]}+ style={{ pointerEvents: "none" }}+ >+ <div className="sw-roomsign">+ {room.settled ? (+ <>+ <span>{t("society.world.room_settled")}</span>+ {reason && reason !== reasonKey && (+ <span className="sw-roomsign-topic">{reason}</span>+ )}+ </>+ ) : (+ <>+ <span className="sw-roomsign-round">{round}</span>+ {room.topic && <span className="sw-roomsign-topic">{room.topic}</span>}+ </>+ )}+ </div>+ </Html>+ </group>+ );+}++export default ConversationScene;diff --git a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsxindex 83e0395c75..27b676463d 100644--- a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx+++ b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx@@ -41,6 +41,7 @@ import {} from "./walkerKinematics";import { WORLD_HERO_SCALE, WalkerFigure, type WalkerAnim, type WalkerMode } from "./WalkerFigure";import { forgetRetired, retirementPose } from "./retireStore";+import { speechPose } from "./conversationStore";import { claimEntrance } from "./spawnStore";import { clearWalkerPin, setWalkerPin } from "./walkerRegistry";import { mulberry32, nextBeat, seedFromString } from "./wander";@@ -348,6 +349,17 @@ function Walker({s.y += (targetY - s.y) * Math.min(1, step * 12);}+ // A conversation turns the head and opens the mouth. It NEVER moves the+ // figure (world-behaviour-manual.md §1), and it never touches one that is+ // walking or asleep — so the sim above is never fought over.+ const say = speechPose(agent.agentId);+ if (say && !paused && (s.mode === "rest" || s.mode === "work")) {+ if (say.heading !== null) {+ s.heading = turnToward(s.heading, say.heading, TURN_RATE_RAD_S * step);+ }+ if (say.talking) s.mode = "talk";+ }+anim.current.mode = s.mode;g.position.set(s.x, s.y, s.z);g.rotation.y = s.heading;diff --git a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsxindex 30d3f5bc72..471cca3eb5 100644--- a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx+++ b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx@@ -30,6 +30,7 @@ import { useSocietyRoster } from "../data";import { syncBuildingPoses, useBuildingPoses } from "./buildingPoses";import { useCameraStore } from "./cameraStore";import { Clouds } from "./Clouds";+import { ConversationScene } from "./ConversationScene";import { FoundryDrawer } from "./FoundryDrawer";import { Landmarks } from "./Landmarks";import { MemoryDrawer } from "./MemoryDrawer";@@ -45,6 +46,7 @@ import { Terrain, Water } from "./Terrain";import { Trees } from "./Trees";import { Village } from "./Village";import { Walkers } from "./Walkers";+import { useConversationFeed } from "./useConversationFeed";import { useWorldControls } from "./useWorldControls";import { WorldCameraRig } from "./WorldCameraRig";import { WorldComposer } from "./WorldComposer";@@ -103,6 +105,9 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent, onSelectPlacconst [memoryOpen, setMemoryOpen] = useState(false);useWorldControls(hostRef, webgl);+ // The island listens to the board only while it is actually drawing:+ // reduced motion and a window with no WebGL cost nothing at all.+ useConversationFeed(agents, webgl && !reduced);// An agent created in this window: look at the foundry, so its maker sees// the figure come out instead of it happening on a mountain off screen.@@ -220,6 +225,7 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent, onSelectPlac{/* A retirement drives the walkers above; it must mount after them. */}<RetirementScene paused={reduced} /></Shadowed>+ <ConversationScene agents={agents} paused={reduced} />{shadows && <Clouds paused={reduced} />}{ready && <PlaceLabels />}</WorldKitProvider>diff --git a/jarvis/ui/web/frontend/src/components/society/world/conversationStore.test.ts b/jarvis/ui/web/frontend/src/components/society/world/conversationStore.test.tsindex 4e5b05306f..98a52dc6fc 100644--- a/jarvis/ui/web/frontend/src/components/society/world/conversationStore.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/world/conversationStore.test.ts@@ -145,6 +145,16 @@ describe("who is on the island", () => {expect(talk.partnerId).toBe("scout");});+ it("keeps a line that arrived before the roster query resolved", () => {+ // The island mounts a moment before /api/society/agents answers. An empty+ // set means "not loaded yet", not "nobody exists" — dropping the opening+ // sentence of a conversation over that race is invisible and maddening.+ useConversationStore.getState().noteMessage(message(), new Set());+ const talk = useConversationStore.getState().talks[pairKey("scout", "archivist")];+ expect(talk).toBeDefined();+ expect(talk.partnerId).toBe("archivist");+ });+it("draws nothing at all when neither side has a figure", () => {send(message({ fromAgent: "scheduler", toAgent: "user" }));expect(useConversationStore.getState().talks).toEqual({});diff --git a/jarvis/ui/web/frontend/src/components/society/world/conversationStore.ts b/jarvis/ui/web/frontend/src/components/society/world/conversationStore.tsindex 41b04b1d10..21cd727e5a 100644--- a/jarvis/ui/web/frontend/src/components/society/world/conversationStore.ts+++ b/jarvis/ui/web/frontend/src/components/society/world/conversationStore.ts@@ -183,8 +183,12 @@ export const useConversationStore = create<ConvoState & ConvoActions>((set, get)// monotone row number, which is exactly why it rides on the event.if (m.seq > 0 && m.seq <= state.lastSeq) return;- const speakerKnown = known.has(m.fromAgent);- const partnerKnown = m.toAgent !== "" && known.has(m.toAgent);+ // An empty roster means "not loaded yet", never "nobody exists": dropping+ // the first sentence of a conversation because the query had not resolved+ // is a race nobody would ever reproduce on purpose.+ const rosterKnown = known.size > 0;+ const speakerKnown = !rosterKnown || known.has(m.fromAgent);+ const partnerKnown = m.toAgent !== "" && (!rosterKnown || known.has(m.toAgent));// Nobody on the island said this and nobody on the island heard it — the// board's own plumbing talking to itself. There is nothing to draw.if (!speakerKnown && !partnerKnown) {diff --git a/jarvis/ui/web/frontend/src/components/society/world/useConversationFeed.ts b/jarvis/ui/web/frontend/src/components/society/world/useConversationFeed.tsindex b80ae495cf..27778a889d 100644--- a/jarvis/ui/web/frontend/src/components/society/world/useConversationFeed.ts+++ b/jarvis/ui/web/frontend/src/components/society/world/useConversationFeed.ts@@ -13,7 +13,7 @@* the store is emptied, so an idle society costs exactly nothing (MASTERPLAN* §2.8).*/-import { useEffect } from "react";+import { useEffect, useRef } from "react";import { useEventStore } from "@/store/events";import type { SocietyAgent } from "../data";@@ -76,9 +76,11 @@ function asRoom(payload: unknown): IncomingRoom | null {* one-sided or dropped rather than drawn as a beam into empty water.*/export function useConversationFeed(agents: SocietyAgent[], enabled: boolean): void {- // The set is rebuilt whenever the roster identity changes; the roster query- // hands back the same array between refetches, so this is not per-render.- const ids = agents.map((a) => a.agentId).join(",");+ // The roster lives in a ref, not in the subscription's closure: it arrives a+ // moment after the island mounts, and a subscription rebuilt on every roster+ // refetch would reset its cursor and replay whatever was in flight.+ const known = useRef<Set<string>>(new Set());+ known.current = new Set(agents.map((a) => a.agentId));useEffect(() => {const store = useConversationStore.getState();@@ -86,7 +88,6 @@ export function useConversationFeed(agents: SocietyAgent[], enabled: boolean): vstore.reset();return;}- const known = new Set(ids ? ids.split(",") : []);let cursor: string | null = useEventStore.getState().events[0]?.id ?? null;return useEventStore.subscribe((state) => {@@ -108,14 +109,14 @@ export function useConversationFeed(agents: SocietyAgent[], enabled: boolean): vconst item = fresh[i];if (item.name === MESSAGE_EVENT) {const message = asMessage(item.payload);- if (message) convo.noteMessage(message, known);+ if (message) convo.noteMessage(message, known.current);} else if (item.name === ROOM_EVENT) {const room = asRoom(item.payload);if (room) convo.noteRoom(room);}}});- }, [enabled, ids]);+ }, [enabled]);useEffect(() => () => useConversationStore.getState().reset(), []);}diff --git a/jarvis/ui/web/frontend/src/components/society/world/world.css b/jarvis/ui/web/frontend/src/components/society/world/world.cssindex b838ae0f60..b634988483 100644--- a/jarvis/ui/web/frontend/src/components/society/world/world.css+++ b/jarvis/ui/web/frontend/src/components/society/world/world.css@@ -91,6 +91,192 @@text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);}+/* ---- speech: what an agent just said ------------------------------------ */++/* A bubble is a nameplate that grew a tail. Same parchment, same hard shadow,+ same island type -- a viewer should read it as the figure speaking, not as+ an app notification that wandered onto the map. */+.sw-bubble {+ font-family: "Pixelify Sans", "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;+ position: relative;+ display: block;+ /* drei's <Html> wrapper is zero-width, so a bare max-width made every word+ wrap onto its own line. Take the natural width first, then cap it. */+ width: max-content;+ max-width: 216px;+ padding: 6px 9px 7px;+ font-size: 12.5px;+ font-weight: 500;+ line-height: 1.32;+ color: #1f2a3a;+ text-align: left;+ overflow-wrap: break-word;+ background: rgba(255, 252, 245, 0.94);+ border: 1px solid rgba(31, 42, 58, 0.2);+ border-left-width: 3px;+ border-radius: 6px;+ box-shadow: 0 2px 0 rgba(31, 42, 58, 0.25);+ animation: sw-bubble-in 180ms cubic-bezier(0.34, 1.42, 0.64, 1) both;+}++/* The tail points down at the head it belongs to. Two triangles: the rim, then+ the fill a pixel above it, so the border reads all the way round. */+.sw-bubble::after,+.sw-bubble::before {+ content: "";+ position: absolute;+ left: 50%;+ width: 0;+ height: 0;+ transform: translateX(-50%);+ border-left: 6px solid transparent;+ border-right: 6px solid transparent;+}+.sw-bubble::before {+ bottom: -7px;+ border-top: 7px solid rgba(31, 42, 58, 0.2);+}+.sw-bubble::after {+ bottom: -5px;+ border-top: 6px solid rgba(255, 252, 245, 0.94);+}++/* The speaker's accent runs down the left edge -- the same colour as their+ nameplate dot and their minimap pin, so nothing new has to be learned. */+.sw-bubble[data-accent] {+ border-left-color: var(--sw-accent, rgba(31, 42, 58, 0.2));+}++/* A question leans forward, an answer sits back, a proposal is marked. The+ label is a word, not an icon: an icon here would need its own legend. */+/* Who is speaking, and what kind of line it is. The bubble floats above the+ nameplate rather than over it, but the name rides along anyway: at a wide+ zoom the plate is a smudge and the bubble is the only readable thing left. */+.sw-bubble-kind {+ display: flex;+ align-items: center;+ gap: 4px;+ margin-bottom: 3px;+ font-size: 10.5px;+ font-weight: 700;+ letter-spacing: 0.03em;+ color: rgba(31, 42, 58, 0.78);+}+.sw-bubble-kind em {+ font-style: normal;+ font-weight: 500;+ text-transform: lowercase;+ color: rgba(31, 42, 58, 0.5);+}+.sw-bubble-dot {+ width: 7px;+ height: 7px;+ border-radius: 2px;+ border: 1px solid rgba(31, 42, 58, 0.4);+ flex: none;+}++/* "+3 more" -- the lines that arrived faster than anyone could read them. */+.sw-bubble-digest {+ display: inline-block;+ margin-top: 3px;+ padding: 1px 5px 2px;+ font-size: 10.5px;+ font-weight: 600;+ color: #fffaf0;+ background: rgba(31, 42, 58, 0.62);+ border-radius: 4px;+}++/* The listener's end: three dots, the cheapest possible "is being spoken to". */+.sw-bubble[data-listening] {+ max-width: none;+ padding: 5px 8px 6px;+ line-height: 0;+}+.sw-bubble-dots {+ display: inline-flex;+ gap: 3px;+}+.sw-bubble-dots i {+ width: 4px;+ height: 4px;+ border-radius: 50%;+ background: rgba(31, 42, 58, 0.55);+ animation: sw-bubble-dot 1.1s ease-in-out infinite;+}+.sw-bubble-dots i:nth-child(2) {+ animation-delay: 0.16s;+}+.sw-bubble-dots i:nth-child(3) {+ animation-delay: 0.32s;+}++@keyframes sw-bubble-in {+ from {+ opacity: 0;+ transform: translateY(5px) scale(0.86);+ }+ to {+ opacity: 1;+ transform: translateY(0) scale(1);+ }+}++@keyframes sw-bubble-dot {+ 0%,+ 100% {+ opacity: 0.32;+ transform: translateY(0);+ }+ 50% {+ opacity: 1;+ transform: translateY(-2px);+ }+}++/* The island freezes under reduced motion; a bubble that still pops would be+ the one thing left moving. It stays, it just arrives already there. */+@media (prefers-reduced-motion: reduce) {+ .sw-bubble {+ animation: none;+ }+ .sw-bubble-dots i {+ animation: none;+ opacity: 0.6;+ }+}++/* A room in session over the Town Hall: the topic and which round it is on. */+.sw-roomsign {+ font-family: "Pixelify Sans", "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;+ display: flex;+ align-items: center;+ gap: 6px;+ max-width: 240px;+ padding: 4px 9px 5px;+ font-size: 12.5px;+ font-weight: 600;+ color: #fffaf0;+ background: rgba(31, 42, 58, 0.72);+ border-radius: 5px;+ white-space: nowrap;+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);+}+.sw-roomsign-topic {+ overflow: hidden;+ text-overflow: ellipsis;+ font-weight: 500;+ opacity: 0.86;+}+.sw-roomsign-round {+ flex: none;+ padding: 1px 5px 2px;+ font-size: 10.5px;+ background: rgba(255, 252, 245, 0.2);+ border-radius: 4px;+}+/* ---- the game HUD ------------------------------------------------------- */.sw-hud {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex 6110db35df..746298db1f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -1,6 +1,21 @@{"society": {"world": {+ "talk_kind_query": "fragt",+ "talk_kind_answer": "antwortet",+ "talk_kind_propose": "schlägt vor",+ "talk_digest": "+{0} weitere",+ "talk_listening": "hört zu",+ "talk_calling": "ruft {0} an",+ "talk_more": "…",+ "hud_talking": "{0} im Gespräch",+ "room_round": "Runde {0}/{1}",+ "room_settled": "Runde beendet",+ "room_reason_message_cap": "alles gesagt",+ "room_reason_round_cap": "die Runden sind aufgebraucht",+ "room_reason_silence": "niemand hat gesprochen",+ "room_reason_user": "von dir beendet",+ "room_reason_kill_switch": "die Society wurde gestoppt","mode_label": "Agenten-Ansicht","mode_world": "Welt","mode_ledger": "Ledger",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex 4f9aadeeea..f5695a2ff7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -1,6 +1,21 @@{"society": {"world": {+ "talk_kind_query": "asks",+ "talk_kind_answer": "answers",+ "talk_kind_propose": "proposes",+ "talk_digest": "+{0} more",+ "talk_listening": "is listening",+ "talk_calling": "calling {0}",+ "talk_more": "…",+ "hud_talking": "{0} talking",+ "room_round": "Round {0}/{1}",+ "room_settled": "Room closed",+ "room_reason_message_cap": "everything was said",+ "room_reason_round_cap": "the rounds ran out",+ "room_reason_silence": "nobody spoke",+ "room_reason_user": "closed by you",+ "room_reason_kill_switch": "the society was halted","mode_label": "Agents view","mode_world": "World","mode_ledger": "Ledger",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex 88d9193402..55d5bcb73d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -1,6 +1,21 @@{"society": {"world": {+ "talk_kind_query": "pregunta",+ "talk_kind_answer": "responde",+ "talk_kind_propose": "propone",+ "talk_digest": "+{0} más",+ "talk_listening": "está escuchando",+ "talk_calling": "llamando a {0}",+ "talk_more": "…",+ "hud_talking": "{0} hablando",+ "room_round": "Ronda {0}/{1}",+ "room_settled": "Sala cerrada",+ "room_reason_message_cap": "ya se dijo todo",+ "room_reason_round_cap": "se acabaron las rondas",+ "room_reason_silence": "nadie habló",+ "room_reason_user": "la cerraste tú",+ "room_reason_kill_switch": "la sociedad se detuvo","mode_label": "Vista de agentes","mode_world": "Mundo","mode_ledger": "Registro",