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.

fix(voice): show one pet while the answer streams under a live trace

rubenluetke10-beepf3f965b1aed3
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceStage.test.tsx
index 7d04c5b340..17ade43551 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceStage.test.tsx
@@ -16,8 +16,9 @@ const t = (key: string) => key;
vi.mock("@/components/home/VoiceComposer", () => ({
VoiceComposer: ({ hint }: { hint: string }) => <div data-testid="voice-composer">{hint}</div>,
}));
+const call = vi.hoisted(() => ({ active: false }));
vi.mock("@/components/agentic/useVoiceCall", () => ({
- useVoiceCall: () => ({ active: false, busy: false, connecting: false, toggleCall: () => {} }),
+ useVoiceCall: () => ({ active: call.active, busy: false, connecting: false, toggleCall: () => {} }),
}));
vi.mock("@/hooks/useVoiceReadiness", () => ({
useVoiceReadiness: () => ({
@@ -72,7 +73,9 @@ function viewport(): HTMLElement {
afterEach(() => {
cleanup();
+ call.active = false;
useHomeStore.getState().resetTranscript();
+ useEventStore.setState({ voiceState: "idle" });
});
describe("VoiceStage transcript", () => {
@@ -160,6 +163,43 @@ describe("VoiceStage transcript", () => {
});
});
+describe("VoiceStage turn pet", () => {
+ function liveSteps(i: number): TranscriptLine {
+ return {
+ id: `s${i}`,
+ who: "steps",
+ text: "",
+ ts: i,
+ live: true,
+ startedTs: i,
+ lastTs: i,
+ steps: [{ id: "t1", kind: "tool", labelKey: "thinking.tool", detail: "web_search", status: "active", startedTs: i }],
+ };
+ }
+
+ it("draws the pet under the lane while the turn has no live trace", () => {
+ call.active = true;
+ act(() => useHomeStore.getState().seedTranscript([said("user", "hello", 1)]));
+ act(() => useEventStore.setState({ voiceState: "thinking" }));
+ render();
+
+ expect(screen.getByTestId("voice-turn-indicator")).toBeTruthy();
+ });
+
+ it("draws no second pet while a live trace sits above the answer", () => {
+ // The live trace already carries the pet on its status line; the answer
+ // streaming in under it must not add another one below.
+ call.active = true;
+ act(() =>
+ useHomeStore.getState().seedTranscript([said("user", "hello", 1), liveSteps(2), said("assistant", "Alles klar", 3)]),
+ );
+ act(() => useEventStore.setState({ voiceState: "speaking" }));
+ render();
+
+ expect(screen.queryByTestId("voice-turn-indicator")).toBeNull();
+ });
+});
+
describe("VoiceStage helpers", () => {
it("follows new output only while the view is at the end", () => {
// Exactly at the bottom, and a hair short of it: still following.
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
index eb1ff47e24..94812761f2 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
@@ -92,9 +92,10 @@ export function VoiceStage({ onExit }: { onExit?: () => void } = {}) {
// once its final line has landed while the audio still plays — that line.
const speaking = active && voiceState === "speaking";
const lastIsAnswer = !liveAnswer && lastLine?.who === "assistant";
- // A live work trace at the bottom already shows the pet on its live line;
- // a second one under it would say the same thing twice.
- const traceShowsPet = !liveLine && !liveAnswer && lastLine?.who === "steps" && Boolean(lastLine.live);
+ // A live work trace already shows the pet on its live line — also while
+ // the answer streams in under it — so a second pet below would say the
+ // same thing twice.
+ const traceShowsPet = lines.some((m) => m.who === "steps" && m.live);
const spoken = useSpokenCursor(
liveAnswer || (lastIsAnswer ? lastLine.text : ""),
speaking,