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(ui): draw the user's pet everywhere the static Gigi image was

rubenluetke10-beep040c8c12c8c3
diff --git a/jarvis/ui/web/frontend/src/components/GigiMark.tsx b/jarvis/ui/web/frontend/src/components/GigiMark.tsx
deleted file mode 100644
index de48f1d8d7..0000000000
--- a/jarvis/ui/web/frontend/src/components/GigiMark.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import gigiMark from "@/assets/jarvis-mark.png";
-import { cn } from "@/lib/utils";
-
-/**
- * The Gigi app mark: the desktop app icon itself, at any size.
- *
- * The tile — pool of light, ink Gigi, hairline edge — is baked into the PNG by
- * `scripts/make_gigi_app_icon.py`, so this renders no background, no radius and
- * no shadow of its own. Anything drawn here would sit behind an already masked
- * shape and show as a square.
- *
- * The image is imported rather than referenced as `/jarvis-gigi-256.png`, so
- * Vite fingerprints it: a public/ file keeps its name across every redraw and
- * browsers go on serving the cached one. Do not swap this for the live SVG
- * mascot in chrome; that one moves, this one identifies the app.
- */
-export function GigiMark({
- size,
- className,
- alt = "",
-}: {
- size: number;
- className?: string;
- alt?: string;
-}) {
- return (
- <img
- src={gigiMark}
- width={size}
- height={size}
- alt={alt}
- className={cn("shrink-0 select-none", className)}
- style={{ width: size, height: size }}
- draggable={false}
- />
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/JarvisDock.tsx b/jarvis/ui/web/frontend/src/components/JarvisDock.tsx
index 9ddc62f81f..8c3c588e5d 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisDock.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisDock.tsx
@@ -4,7 +4,7 @@ import { getWSClient } from "@/hooks/useWebSocket";
import { useOverlayStyle } from "@/hooks/useOverlayStyle";
import { useEventStore } from "@/store/events";
import { useMissionDrag } from "@/store/missionDrag";
-import { MascotGigi } from "@/components/MascotGigi";
+import { PetMark } from "@/components/pets/PetMark";
import { playDropConfirm } from "@/lib/sound";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
@@ -260,7 +260,7 @@ export function JarvisDock() {
<span className="h-4 w-1 rounded-sm bg-primary/80" />
</span>
) : (
- <MascotGigi size={28} reactToVoice enableComments={false} />
+ <PetMark size={28} reactive />
)}
</span>
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index ce37a3a7a0..d9acbf8058 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -38,7 +38,7 @@ import { ComposerChipField, type ComposerChipFieldHandle } from "@/components/ag
import type { ToolChoice } from "@/components/agentchat/toolChoices";
import { readComposerDraft, useComposerDraft, writeComposerDraft } from "./composerDrafts";
import { useAppshotClaim } from "@/components/agentchat/useAppshotClaim";
-import { GigiMark } from "@/components/GigiMark";
+import { PetMark } from "@/components/pets/PetMark";
import { useVoiceModeSwitch } from "@/components/home/assistantStatus";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
@@ -833,7 +833,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
className="inline-flex h-7 max-w-[180px] shrink-0 items-center gap-1.5 rounded-lg bg-secondary px-2 text-xs font-medium text-foreground"
>
{surface === "jarvis" ? (
- <GigiMark size={18} />
+ <PetMark size={20} />
) : (
<FolderCode className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
)}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
index 41c3e82480..75017ca51f 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
@@ -20,6 +20,7 @@ export function AgentTimeline({
agentsById,
bubbles = false,
traceLook = "rail",
+ traceCompanion = false,
}: {
items: TimelineItem[];
assistantName: string;
@@ -39,6 +40,8 @@ export function AgentTimeline({
bubbles?: boolean;
/** How turns draw their work; the Agentic IDE keeps the classic rows. */
traceLook?: TraceLook;
+ /** Jarvis's own chat: live traces show the user's pet at work. */
+ traceCompanion?: boolean;
}) {
const t = useT();
const stamps = bubbles ? timeStamps(items) : null;
@@ -196,6 +199,7 @@ export function AgentTimeline({
onDecide={onDecide}
bubbles={bubbles}
traceLook={traceLook}
+ traceCompanion={traceCompanion}
/>
);
}
@@ -236,8 +240,8 @@ function stampLabel(at: Date, now: Date): string {
return `${date}, ${time}`;
}
-const Turn = memo(function Turn({ turn, assistantName, providerLabel, onDecide, bubbles = false, traceLook }: {
- turn: TurnItem; assistantName: string; providerLabel: string; onDecide: Decide; bubbles?: boolean; traceLook: TraceLook;
+const Turn = memo(function Turn({ turn, assistantName, providerLabel, onDecide, bubbles = false, traceLook, traceCompanion = false }: {
+ turn: TurnItem; assistantName: string; providerLabel: string; onDecide: Decide; bubbles?: boolean; traceLook: TraceLook; traceCompanion?: boolean;
}) {
const t = useT();
return <div className="flex min-w-0 flex-col gap-3" data-testid="agent-turn" data-message-id={turn.id} data-status={turn.status}>
@@ -249,7 +253,7 @@ const Turn = memo(function Turn({ turn, assistantName, providerLabel, onDecide,
{turn.effort ? <span>{effortLabel(turn.effort, t)}</span> : null}
</div>
)}
- <TurnTrace turn={turn} look={traceLook} onDecide={onDecide} renderText={(text, id) => <Prose block={{ kind: "text", text, id }} />} />
+ <TurnTrace turn={turn} look={traceLook} companion={traceCompanion} onDecide={onDecide} renderText={(text, id) => <Prose block={{ kind: "text", text, id }} />} />
</div>;
});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/VoiceWorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/VoiceWorkTrace.tsx
index 14d8370407..93cb054bfb 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/VoiceWorkTrace.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/VoiceWorkTrace.tsx
@@ -27,5 +27,5 @@ export function VoiceWorkTrace({ steps, live = false, durationMs, className }: {
startedMs: step.startedTs, approval: null };
}), [steps, live, t]);
return <WorkTrace blocks={blocks} status={live ? "running" : steps.some(step => step.status === "error") ? "error" : "done"}
- startedMs={steps[0]?.startedTs ?? Date.now()} durationMs={durationMs ?? null} className={className} />;
+ startedMs={steps[0]?.startedTs ?? Date.now()} durationMs={durationMs ?? null} className={className} companion />;
}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
index 507ef6da43..fc08cdf279 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
@@ -65,6 +65,21 @@
.trace-node-live {
color: hsl(var(--accent));
}
+/* A Jarvis trace's live line: the user's pet (32 px) stands where the
+ spinner was, centred on the thread. It is wider than the 16 px node
+ column and exactly as tall as the 32 px status row, so it overhangs
+ sideways and nothing below moves when the turn ends and it turns back
+ into a check. */
+.trace-node-pet {
+ position: relative;
+ overflow: visible;
+}
+.trace-node-pet > * {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+}
.trace-dot {
display: block;
height: 5px;
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
index 44453d5b14..53b9291943 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
@@ -1,6 +1,6 @@
import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
-import { groupTrace, groupActivityTrace, splitConversationTurn, WorkTrace, traceDuration } from "./WorkTrace";
+import { groupTrace, groupActivityTrace, livePetState, splitConversationTurn, WorkTrace, traceDuration } from "./WorkTrace";
import { traceToolIdentity } from "./traceActivity";
import type { TextBlock, ToolBlock, TurnBlock, TurnStatus } from "./reduce";
@@ -210,6 +210,25 @@ describe("rail look", () => {
expect(screen.getByRole("status").querySelector(".trace-shimmer")?.textContent).toBe("Working");
});
+ it("puts the pet on a live Jarvis trace and the plain node everywhere else", () => {
+ const blocks = [tool("a", { name: "exec_command", output: null })];
+ const { container, rerender } = render(<WorkTrace {...props} status="running" durationMs={null} blocks={blocks} companion />);
+ expect(container.querySelector("[data-trace-pet]")?.getAttribute("data-trace-pet")).toBe("working");
+ rerender(<WorkTrace {...props} status="running" durationMs={null} blocks={blocks} />);
+ expect(container.querySelector("[data-trace-pet]")).toBeNull();
+ rerender(<WorkTrace {...props} blocks={[tool("a", { name: "exec_command" })]} companion />);
+ expect(container.querySelector("[data-trace-pet]")).toBeNull();
+ });
+
+ it("lets the pet think, search, work and talk along with the live step", () => {
+ expect(livePetState([])).toBe("thinking");
+ expect(livePetState([{ ...thought, live: true } as TurnBlock])).toBe("thinking");
+ expect(livePetState([tool("s", { name: "grep", output: null })])).toBe("searching");
+ expect(livePetState([tool("x", { name: "exec_command", output: null })])).toBe("working");
+ expect(livePetState([tool("x", { name: "exec_command" })])).toBe("thinking");
+ expect(livePetState([reply("r", "Here it is")])).toBe("talking");
+ });
+
it("drops the shimmer once the turn is finished", () => {
const { container } = render(<WorkTrace {...props} blocks={[tool("a", { name: "exec_command" })]} />);
expect(container.querySelector(".trace-shimmer")).toBeNull();
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
index 3cb96c26db..70c83709d1 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
@@ -3,6 +3,8 @@ import { Brain, Check, ChevronRight, CircleAlert, CircleDashed, FilePenLine, Fil
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { useT } from "@/i18n";
+import { PetMark } from "@/components/pets/PetMark";
+import type { PetState } from "@/lib/petStates";
import { cn } from "@/lib/utils";
import type { ApprovalDecision } from "@/lib/agentChatApi";
import { isQuestionTool, type ReasoningBlock, type TextBlock, type ToolBlock, type TurnBlock, type TurnItem, type TurnStatus } from "./reduce";
@@ -199,6 +201,21 @@ function Node({ children, live = false }: { children: ReactNode; live?: boolean
return <span aria-hidden className={cn("trace-node", live && "trace-node-live")}>{children}</span>;
}
+/**
+ * What the user's pet does on a live Jarvis trace: it thinks while the model
+ * reasons (or before anything has arrived), searches while a search or
+ * listing runs, works through any other tool, and talks while the reply
+ * streams in.
+ */
+export function livePetState(blocks: TurnBlock[]): PetState {
+ const last = blocks[blocks.length - 1];
+ if (!last || last.kind === "reasoning") return "thinking";
+ if (last.kind === "text") return last.text.trim() ? "talking" : "thinking";
+ if (last.output !== null) return "thinking";
+ const family = operation(last.name);
+ return family === "search" || family === "list" ? "searching" : "working";
+}
+
/** The words of whatever is happening right now, with a slow light sweep. */
function Live({ on, children }: { on: boolean; children: ReactNode }) {
return on ? <span className="trace-shimmer">{children}</span> : <>{children}</>;
@@ -620,9 +637,15 @@ type WorkTraceProps = {
blocks: TurnBlock[]; status: TurnStatus; startedMs: number; durationMs: number | null; error?: string | null;
onDecide?: Decide; renderText?: (text: string, id: string) => ReactNode; className?: string;
receipt?: ReactNode; completionLabel?: string; conversation?: boolean;
+ /**
+ * The trace is Jarvis's own (the front-page chat, a voice turn): the live
+ * line shows the user's pet at work instead of a spinning circle. Agent
+ * and coding-pane traces keep the plain node.
+ */
+ companion?: boolean;
};
-function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error, onDecide, renderText, className, receipt, completionLabel, conversation = false }: WorkTraceProps) {
+function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error, onDecide, renderText, className, receipt, completionLabel, conversation = false, companion = false }: WorkTraceProps) {
const t = useT();
const rail = useRail();
const blocks = useMemo(() => withoutQuestionPolls(rawBlocks), [rawBlocks]);
@@ -666,10 +689,13 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error
// whenever the trace has no reply between it and the work); a finished
// conversation turn closes with a quiet line under its reply instead.
const statusOnRail = !conversation || live;
+ const petState = companion && working ? livePetState(blocks) : null;
const statusLine = <div role="status" aria-live="polite" data-trace-status={outcome}
className={cn("flex min-w-0 flex-wrap items-start gap-x-3 text-xs leading-6 text-muted-foreground",
statusOnRail ? "py-1" : "pb-2 pt-1", status === "error" && "text-destructive", pending && "text-foreground")}>
- <Node live={working}><Icon className={cn(nodeIcon, working && "motion-safe:animate-spin")} /></Node>
+ {petState
+ ? <span aria-hidden className="trace-node trace-node-pet" data-trace-pet={petState}><PetMark size={32} state={petState} /></span>
+ : <Node live={working}><Icon className={cn(nodeIcon, working && "motion-safe:animate-spin")} /></Node>}
<span className="inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2">
<span><Live on={working}>{outcomeLabel}</Live></span>
{(live || durationMs !== null) ? <span aria-live="off" className="tabular-nums">{traceDuration(live ? elapsed : durationMs ?? 0)}</span> : null}
@@ -715,7 +741,7 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error
</div>;
}
-export function TurnTrace({ turn, ...props }: { turn: TurnItem; onDecide?: Decide; renderText?: (text: string, id: string) => ReactNode; conversation?: boolean; look?: TraceLook }) {
+export function TurnTrace({ turn, ...props }: { turn: TurnItem; onDecide?: Decide; renderText?: (text: string, id: string) => ReactNode; conversation?: boolean; look?: TraceLook; companion?: boolean }) {
const t = useT();
const tokens = outputTokens(turn.usage ?? turn.liveUsage);
const answered = turn.blocks.some(block => block.kind === "text" && block.text.trim());
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckOrb.test.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckOrb.test.tsx
index def4b06aca..e6a09c93b8 100644
--- a/jarvis/ui/web/frontend/src/components/deck/DeckOrb.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/deck/DeckOrb.test.tsx
@@ -79,14 +79,13 @@ describe("DeckOrb", () => {
}
});
- test("the centre is the mascot itself, drawn as vectors — no bitmap left", () => {
+ test("the centre is the user's pet — no bitmap image left", () => {
render(<DeckOrb steps={[]} busy={false} />);
const orb = screen.getByTestId("jarvis-orb");
expect(orb.getAttribute("data-voice")).toBe("idle");
// The PNG is gone from the tree, so it cannot come back in through here.
expect(orb.querySelectorAll("img")).toHaveLength(0);
- expect(orb.querySelector(".gigi-root")).toBeTruthy();
- expect(orb.querySelector("svg")).toBeTruthy();
+ expect(orb.querySelector('[data-testid="pet-mark"]')).toBeTruthy();
});
test("a press on the orb fires the handler and carries its label", () => {
diff --git a/jarvis/ui/web/frontend/src/components/deck/JarvisOrb.tsx b/jarvis/ui/web/frontend/src/components/deck/JarvisOrb.tsx
index 5619f74c21..a3d2998da9 100644
--- a/jarvis/ui/web/frontend/src/components/deck/JarvisOrb.tsx
+++ b/jarvis/ui/web/frontend/src/components/deck/JarvisOrb.tsx
@@ -1,5 +1,5 @@
import { motion, useReducedMotion, type TargetAndTransition } from "framer-motion";
-import { MascotGigi } from "@/components/MascotGigi";
+import { PetMark } from "@/components/pets/PetMark";
import type { VoiceState } from "@/store/events";
import { cn } from "@/lib/utils";
@@ -11,14 +11,15 @@ import { cn } from "@/lib/utils";
* pixels, so on the dark deck it read as a grey box, and the reticle around
* it sliced that box off at the ring. The maintainer asked repeatedly for the
* PNG to go and for the mascot to carry the product instead (2026-08-20), so
- * both PNGs are gone from the tree and the middle is Gigi, drawn as vectors:
- * sharp at any size, no edge to cut, no bitmap to ship.
+ * both PNGs are gone from the tree and the middle is the mascot. Since
+ * 2026-10-02 that is the user's own pet (Settings -> My Pets, Gigi by
+ * default), drawn from its sprite sheet by `PetMark`.
*
* The staging is a dark figure standing in golden light. The glow behind it
* (`.deck-orb-glow`, DeckOrb.tsx) throws the silhouette forward; the corona's
- * slow rays come up behind it in the voice. Gigi brings its own life — it
- * blinks, the pupils drift, it waves now and then, and with `reactToVoice` it
- * listens, thinks and speaks along. That is why the reticle around it no
+ * slow rays come up behind it in the voice. The pet brings its own life —
+ * its idle row floats and blinks, and with `reactive` it listens, thinks and
+ * talks along. That is why the reticle around it no
* longer needs to dance: the living thing is alive, the instruments stay
* still until they have something to show.
*
@@ -98,7 +99,7 @@ export function JarvisOrb({
: { duration: 0.4 }
}
>
- <MascotGigi size={size} reactToVoice enableComments={false} />
+ <PetMark size={size} reactive />
</motion.div>
</div>
</div>
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx
index fc66adc2b4..03d80eec80 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx
@@ -244,6 +244,7 @@ function ChatStageContent() {
// The Agentic IDE mirrors Claude Code and Codex, whose own traces
// the maintainer kept; every other surface draws the rail.
traceLook={isJarvis ? "rail" : "classic"}
+ traceCompanion={isJarvis}
/>
<div ref={spacerRef} aria-hidden data-testid="chat-bottom-spacer" className="shrink-0" />
</div>
diff --git a/jarvis/ui/web/frontend/src/components/home/Greeting.tsx b/jarvis/ui/web/frontend/src/components/home/Greeting.tsx
index 6a2fbba8af..2650d78c37 100644
--- a/jarvis/ui/web/frontend/src/components/home/Greeting.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/Greeting.tsx
@@ -1,7 +1,7 @@
import { useUserName } from "@/hooks/useUserName";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
-import { GigiMark } from "@/components/GigiMark";
+import { PetMark } from "@/components/pets/PetMark";
/**
* "Good morning, Ruben" — the front page's opening line, on both stages.
@@ -32,9 +32,10 @@ export function Greeting({
)}
data-testid="home-greeting"
>
- {/* The mark above, the line under it in regular weight — the Codex
- app's opening, quieter than a bold headline beside a logo. */}
- <GigiMark size={40} className="mb-4 rounded-xl opacity-90" />
+ {/* The user's pet above, the line under it in regular weight — the
+ Codex app's opening, quieter than a bold headline beside a logo.
+ The pet follows the voice: it listens, thinks and talks along. */}
+ <PetMark size={48} reactive className="mb-3" />
<h1 className="text-2xl font-normal tracking-tight text-foreground [text-wrap:balance]">
{text}
</h1>
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
index f065a91f2f..d31b6ca235 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
@@ -11,7 +11,7 @@ import { cn } from "@/lib/utils";
import { ScrollArea } from "@/components/ui/scroll-area";
import { ScrollToEndButton } from "@/components/ui/scroll-to-end-button";
import { Greeting } from "@/components/home/Greeting";
-import { GigiMark } from "@/components/GigiMark";
+import { PetMark } from "@/components/pets/PetMark";
import { VoiceComposer } from "@/components/home/VoiceComposer";
import { VoiceGlow } from "@/components/home/VoiceGlow";
import { useSpokenCursor } from "@/components/home/useSpokenCursor";
@@ -29,8 +29,8 @@ import { traceModel } from "@/lib/thinkingSteps";
* says what is happening and carries Start / Stop. Behind it a soft light
* rises from the bottom edge and breathes with the voices
* (components/home/VoiceGlow) — and keeps moving while the assistant
- * thinks, so a silent turn never looks dead; while it thinks or speaks, its
- * mark pulses under the last line. While the answer is being spoken, the
+ * thinks, so a silent turn never looks dead; while it thinks or speaks, the
+ * user's pet thinks or talks under the last line. While the answer is being spoken, the
* words not yet said stay grey and light up as the voice reaches them
* (components/home/useSpokenCursor — an estimate from the playback level,
* since no voice path reports a per-word position). `onExit`, where the host page has a typed
@@ -92,6 +92,9 @@ 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);
const spoken = useSpokenCursor(
liveAnswer || (lastIsAnswer ? lastLine.text : ""),
speaking,
@@ -157,9 +160,9 @@ export function VoiceStage({ onExit }: { onExit?: () => void } = {}) {
{liveAnswer && (
<TranscriptLine who={assistantName} text={liveAnswer} user={false} live spoken={spoken} />
)}
- {active && (voiceState === "thinking" || voiceState === "speaking") && (
+ {active && (voiceState === "thinking" || voiceState === "speaking") && !traceShowsPet && (
<div className="pl-0.5" data-testid="voice-turn-indicator" aria-hidden>
- <GigiMark size={22} className="rounded-md animate-pulse motion-reduce:animate-none" />
+ <PetMark size={48} state={voiceState === "speaking" ? "talking" : "thinking"} />
</div>
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
index 0f8aecace7..1b22256101 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
@@ -234,10 +234,9 @@ describe("Sidebar header avatar", () => {
overlayMock.style = "jarvis_bar";
});
- // The mark is a bundled import, so its URL carries a build hash and there is
- // nothing stable to assert. What matters is that the avatar shows the mark
- // and not a stale public/ path a browser would serve from cache.
- test("renders the Gigi app mark from the bundle, not a public path", () => {
+ // The mark is the user's pet (Gigi by default), drawn by PetMark from the
+ // pets answer — never the old static Gigi image.
+ test("renders the pet mark, not the old Gigi image", () => {
// The mark heads the identity row, which returns when the quick
// switcher (and with it the search bar) is switched off.
useQuickSwitchSettings.setState({ enabled: false });
@@ -246,10 +245,8 @@ describe("Sidebar header avatar", () => {
const avatar = container.querySelector('[data-testid="sidebar-style-avatar"]');
expect(avatar).not.toBeNull();
expect(avatar?.getAttribute("data-variant")).toBe("logo");
- const logo = avatar?.querySelector("img") as HTMLImageElement;
- const src = logo.getAttribute("src") ?? "";
- expect(src).toContain("jarvis-mark");
- expect(src.startsWith("/jarvis-")).toBe(false);
+ expect(avatar?.querySelector('[data-testid="pet-mark"]')).toBeTruthy();
+ expect(avatar?.querySelector("img")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index f9ba7fee0e..dedec66466 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -30,7 +30,7 @@ import { SidebarSearchBar } from "@/components/layout/SidebarSearchBar";
import { useQuickSwitchSettings } from "@/store/quickSwitchSettings";
import { useAppInstance } from "@/hooks/useAppInstance";
import { usePublishIdentity } from "@/components/marketplace/PublishIdentity";
-import { GigiMark } from "@/components/GigiMark";
+import { PetMark } from "@/components/pets/PetMark";
import { MarketplaceIcon } from "@/components/icons/sectionIcons";
import { startNewTextChat } from "@/lib/newChat";
import { useUserName } from "@/hooks/useUserName";
@@ -396,7 +396,7 @@ export function Sidebar({
{devTag}
</span>
)}
- <GigiMark size={railed ? 36 : 20} />
+ <PetMark size={railed ? 36 : 20} reactive />
</span>}
{/* One quiet row, like the workspace switcher in Linear or Cursor:
mark, name, status dot. It used to be a two-line identity card
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/pet/GuidePet.tsx b/jarvis/ui/web/frontend/src/components/onboarding/pet/GuidePet.tsx
index f85b59f975..9b53b26ff1 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/pet/GuidePet.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/pet/GuidePet.tsx
@@ -17,12 +17,11 @@ import { useReducedMotion } from "framer-motion";
import { useEffect, useState, type ReactNode } from "react";
import { MascotGigi } from "@/components/MascotGigi";
import { PetSprite } from "@/components/pets/PetSprite";
-import { NO_PET_ID, type PetState } from "@/lib/petStates";
-import type { Pet } from "@/lib/petsApi";
+import { pickActivePet } from "@/hooks/usePets";
+import type { PetState } from "@/lib/petStates";
+import type { Pet, PetsState } from "@/lib/petsApi";
import { cn } from "@/lib/utils";
-/** The pet shown when none is chosen. */
-const DEFAULT_PET_ID = "gigi";
/** Typing speed of a line, ms per character. */
const TYPE_MS = 18;
@@ -33,10 +32,7 @@ function loadGuidePet(): Promise<Pet | null> {
try {
const res = await fetch("/api/pets");
if (!res.ok) return null;
- const data = (await res.json()) as { active?: string; pets?: Pet[] };
- const pets = Array.isArray(data.pets) ? data.pets : [];
- const id = data.active && data.active !== NO_PET_ID ? data.active : DEFAULT_PET_ID;
- return pets.find((p) => p.id === id) ?? pets.find((p) => p.id === DEFAULT_PET_ID) ?? pets[0] ?? null;
+ return pickActivePet((await res.json()) as PetsState);
} catch {
// No pets endpoint: the mascot stands in.
return null;
diff --git a/jarvis/ui/web/frontend/src/components/pets/PetMark.test.tsx b/jarvis/ui/web/frontend/src/components/pets/PetMark.test.tsx
new file mode 100644
index 0000000000..84a39a83b1
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/pets/PetMark.test.tsx
@@ -0,0 +1,105 @@
+import { cleanup, render, screen } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { PetMark, petStateForVoice } from "@/components/pets/PetMark";
+import { petKeys, pickActivePet } from "@/hooks/usePets";
+import type { Pet, PetsState } from "@/lib/petsApi";
+import { NO_PET_ID } from "@/lib/petStates";
+import { useEventStore } from "@/store/events";
+
+function pet(id: string): Pet {
+ return {
+ id,
+ name: id,
+ description: "",
+ builtin: true,
+ frame_size: 48,
+ animations: {
+ idle: { row: 0, frames: 1, fps: 1, loop: true },
+ thinking: { row: 2, frames: 1, fps: 1, loop: true },
+ talking: { row: 3, frames: 1, fps: 1, loop: true },
+ },
+ sheet_url: `/api/pets/${id}/sheet.png`,
+ };
+}
+
+function pets(active: string): PetsState {
+ return { active, scale: 1, bubble: true, strip_always: false, visible: true, pets: [pet("gigi"), pet("bolt")] };
+}
+
+/** A client already holding the pets answer, so nothing is fetched. */
+function renderWith(state: PetsState, ui: React.ReactElement) {
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ client.setQueryData(petKeys.all, state);
+ return render(<QueryClientProvider client={client}>{ui}</QueryClientProvider>);
+}
+
+afterEach(() => {
+ cleanup();
+ useEventStore.setState({ voiceState: "idle" });
+});
+
+describe("pickActivePet", () => {
+ it("returns the chosen pet", () => {
+ expect(pickActivePet(pets("bolt"))?.id).toBe("bolt");
+ });
+
+ it("falls back to Gigi when none, an unknown one or nothing is chosen", () => {
+ expect(pickActivePet(pets(NO_PET_ID))?.id).toBe("gigi");
+ expect(pickActivePet(pets("gone"))?.id).toBe("gigi");
+ expect(pickActivePet({ active: "", pets: [pet("gigi")] })?.id).toBe("gigi");
+ });
+
+ it("has no pet before the answer arrives", () => {
+ expect(pickActivePet(undefined)).toBeNull();
+ expect(pickActivePet({ active: "bolt", pets: [] })).toBeNull();
+ });
+});
+
+describe("PetMark", () => {
+ it("draws the chosen pet at the exact size, smoothly when shrunk", () => {
+ renderWith(pets("bolt"), <PetMark size={20} />);
+ expect(screen.getByTestId("pet-mark").dataset.pet).toBe("bolt");
+ const sprite = screen.getByTestId("pet-sprite");
+ expect(sprite.style.width).toBe("20px");
+ const cell = screen.getByTestId("pet-sprite-cell");
+ expect(cell.style.backgroundImage).toContain("/api/pets/bolt/sheet.png");
+ expect(cell.className).not.toContain("pixelated");
+ });
+
+ it("stays pixel-crisp at a whole-number size", () => {
+ renderWith(pets("gigi"), <PetMark size={96} />);
+ expect(screen.getByTestId("pet-sprite-cell").className).toContain("pixelated");
+ });
+
+ it("shows Gigi when the user chose no pet", () => {
+ renderWith(pets(NO_PET_ID), <PetMark size={32} />);
+ expect(screen.getByTestId("pet-mark").dataset.pet).toBe("gigi");
+ });
+
+ it("plays the given state, or follows the voice when reactive", () => {
+ renderWith(pets("gigi"), <><PetMark size={32} state="thinking" /><PetMark size={32} reactive /></>);
+ const [fixed, reactive] = screen.getAllByTestId("pet-sprite");
+ expect(fixed.dataset.state).toBe("thinking");
+ expect(reactive.dataset.state).toBe("idle");
+ });
+
+ it("keeps an empty box of the final size outside a query client", () => {
+ render(<PetMark size={40} />);
+ const box = screen.getByTestId("pet-mark");
+ expect(box.style.width).toBe("40px");
+ expect(screen.queryByTestId("pet-sprite")).toBeNull();
+ });
+});
+
+describe("petStateForVoice", () => {
+ it("maps the voice to the pet's rows", () => {
+ expect(petStateForVoice("listening")).toBe("listening");
+ expect(petStateForVoice("thinking")).toBe("thinking");
+ expect(petStateForVoice("connecting")).toBe("thinking");
+ expect(petStateForVoice("speaking")).toBe("talking");
+ expect(petStateForVoice("error")).toBe("error");
+ expect(petStateForVoice("idle")).toBe("idle");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/pets/PetMark.tsx b/jarvis/ui/web/frontend/src/components/pets/PetMark.tsx
new file mode 100644
index 0000000000..16ce4c06bc
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/pets/PetMark.tsx
@@ -0,0 +1,95 @@
+import { useContext, type ReactNode } from "react";
+import { QueryClientContext } from "@tanstack/react-query";
+
+import { PetSprite } from "@/components/pets/PetSprite";
+import { useActivePet } from "@/hooks/usePets";
+import type { PetState } from "@/lib/petStates";
+import { cn } from "@/lib/utils";
+import { useEventStore, type VoiceState } from "@/store/events";
+
+/**
+ * Jarvis as the app draws it: the user's chosen pet (Settings -> My Pets),
+ * animated from its own sprite sheet, at any size. With no pet chosen it is
+ * Gigi, the built-in default. Every in-app spot that used to show the static
+ * Gigi image (sidebar, greeting, composer chip, deck header, the live line of
+ * a reasoning trace) draws this instead, so picking a pet changes them all
+ * at once — `PetChanged` refetches the shared query.
+ *
+ * `state` fixes the animation row; `reactive` follows the voice instead
+ * (listening while you talk, thinking, talking while it answers). Until the
+ * pets answer arrives the box stays empty at its final size, so nothing
+ * jumps and no stand-in image flashes.
+ */
+export function PetMark({
+ size,
+ state,
+ reactive = false,
+ label,
+ className,
+}: {
+ size: number;
+ state?: PetState;
+ reactive?: boolean;
+ /** Accessible name; decorative without one. */
+ label?: string;
+ className?: string;
+}) {
+ // Outside a query client (an isolated test render, a bare preview) there
+ // is no pets answer to read; the empty box keeps the layout.
+ const client = useContext(QueryClientContext);
+ const box = (
+ <span
+ aria-hidden
+ data-testid="pet-mark"
+ className={cn("inline-block shrink-0", className)}
+ style={{ width: size, height: size }}
+ />
+ );
+ if (!client) return box;
+ return <ActivePetMark size={size} state={state} reactive={reactive} label={label} className={className} fallback={box} />;
+}
+
+function ActivePetMark({
+ size,
+ state,
+ reactive,
+ label,
+ className,
+ fallback,
+}: {
+ size: number;
+ state?: PetState;
+ reactive: boolean;
+ label?: string;
+ className?: string;
+ fallback: ReactNode;
+}) {
+ const pet = useActivePet();
+ const voiceState = useEventStore((s) => s.voiceState);
+ if (!pet) return <>{fallback}</>;
+ const shown = state ?? (reactive ? petStateForVoice(voiceState) : "idle");
+ return (
+ <span data-testid="pet-mark" data-pet={pet.id} className={cn("inline-flex shrink-0 select-none", className)}>
+ <PetSprite pet={pet} state={shown} px={size} label={label} />
+ </span>
+ );
+}
+
+/** The pet row that mirrors what the voice is doing right now. */
+export function petStateForVoice(voice: VoiceState): PetState {
+ switch (voice) {
+ case "listening":
+ return "listening";
+ case "connecting":
+ case "thinking":
+ return "thinking";
+ case "speaking":
+ return "talking";
+ case "error":
+ return "error";
+ case "paused":
+ return "sleeping";
+ default:
+ return "idle";
+ }
+}
diff --git a/jarvis/ui/web/frontend/src/components/pets/PetSprite.tsx b/jarvis/ui/web/frontend/src/components/pets/PetSprite.tsx
index ef514a24cc..bc28078c69 100644
--- a/jarvis/ui/web/frontend/src/components/pets/PetSprite.tsx
+++ b/jarvis/ui/web/frontend/src/components/pets/PetSprite.tsx
@@ -21,18 +21,27 @@ import { cn } from "@/lib/utils";
* frame, and the talking row (drawn closed to widest) swings back and forth.
* The timer stops while the sprite is off-screen, and under
* `prefers-reduced-motion` the sprite shows frame 0 and never moves.
+ *
+ * `px` asks for an exact edge length instead: the app's own marks (the
+ * sidebar, the greeting, a trace's live line) are smaller than one source
+ * frame. A whole-number factor stays pixel-crisp; a fractional one is
+ * resampled smoothly, because nearest-neighbour at, say, 0.42 drops whole
+ * rows of the outline.
*/
export function PetSprite({
pet,
state,
- scale,
+ scale = 1,
+ px,
label,
className,
}: {
pet: Pick<Pet, "sheet_url" | "frame_size" | "animations">;
state: PetState;
/** Display factor; rounded to a whole number so pixels stay square. */
- scale: number;
+ scale?: number;
+ /** Exact edge length in CSS pixels; overrides `scale`. */
+ px?: number;
/** Accessible name; the sprite is decorative without one. */
label?: string;
className?: string;
@@ -43,7 +52,8 @@ export function PetSprite({
const onScreen = useOnScreen(boxRef);
const size = pet.frame_size;
- const factor = Math.max(1, Math.round(scale));
+ const factor = px !== undefined && px > 0 ? px / size : Math.max(1, Math.round(scale));
+ const crisp = Number.isInteger(factor);
const animation = resolvePetAnimation(pet.animations, state);
const row = animation?.row ?? 0;
const frames = animation?.frames ?? 1;
@@ -104,7 +114,7 @@ export function PetSprite({
<div
ref={cellRef}
data-testid="pet-sprite-cell"
- className="absolute left-0 top-0 bg-no-repeat [image-rendering:pixelated]"
+ className={cn("absolute left-0 top-0 bg-no-repeat", crisp && "[image-rendering:pixelated]")}
style={{
width: size,
height: size,
diff --git a/jarvis/ui/web/frontend/src/hooks/usePets.ts b/jarvis/ui/web/frontend/src/hooks/usePets.ts
index a44b95203e..e667165461 100644
--- a/jarvis/ui/web/frontend/src/hooks/usePets.ts
+++ b/jarvis/ui/web/frontend/src/hooks/usePets.ts
@@ -6,7 +6,9 @@
* made from another window, the shortcut or the CLI repaints here too. No
* polling: an idle settings page opens no requests (AP-33).
*/
+import { useMemo } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { NO_PET_ID } from "@/lib/petStates";
import {
createPet,
deletePet,
@@ -15,6 +17,7 @@ import {
selectPet,
setPetVisible,
type CreatePetInput,
+ type Pet,
type PetSettingsPatch,
type PetsState,
} from "@/lib/petsApi";
@@ -27,6 +30,30 @@ export function usePets() {
return useQuery({ queryKey: petKeys.all, queryFn: fetchPets });
}
+/** The pet that stands in when the user has chosen none (or "None"). */
+export const DEFAULT_PET_ID = "gigi";
+
+/**
+ * The pet the app draws as Jarvis: the one chosen in My Pets, or Gigi when
+ * nothing (or "None", which only hides the desktop figure) is chosen.
+ */
+export function pickActivePet(state: Pick<PetsState, "active" | "pets"> | null | undefined): Pet | null {
+ if (!state) return null;
+ const pets = Array.isArray(state.pets) ? state.pets : [];
+ const id = state.active && state.active !== NO_PET_ID ? state.active : DEFAULT_PET_ID;
+ return pets.find((p) => p.id === id) ?? pets.find((p) => p.id === DEFAULT_PET_ID) ?? pets[0] ?? null;
+}
+
+/**
+ * The active pet for the app's own marks. The cached answer never goes stale
+ * on a timer: every mark in the window shares it, and `PetChanged` (or a
+ * mutation here) invalidates it, so a new mark mounting opens no request.
+ */
+export function useActivePet(): Pet | null {
+ const { data } = useQuery({ queryKey: petKeys.all, queryFn: fetchPets, staleTime: Infinity });
+ return useMemo(() => pickActivePet(data), [data]);
+}
+
function useInvalidatePets() {
const qc = useQueryClient();
return () => qc.invalidateQueries({ queryKey: petKeys.all });
diff --git a/jarvis/ui/web/frontend/src/views/ChatsView.tsx b/jarvis/ui/web/frontend/src/views/ChatsView.tsx
index b1e0156e14..4ca41029c5 100644
--- a/jarvis/ui/web/frontend/src/views/ChatsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ChatsView.tsx
@@ -11,7 +11,7 @@ import {
import { ScrollArea } from "@/components/ui/scroll-area";
import { ScrollToEndButton } from "@/components/ui/scroll-to-end-button";
import { ChatInput } from "@/components/ChatInput";
-import { MascotGigi } from "@/components/MascotGigi";
+import { PetMark } from "@/components/pets/PetMark";
import { ThinkingTrace, ThoughtTraceDisclosure } from "@/components/ThinkingTrace";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
@@ -499,7 +499,7 @@ function EmptyState() {
return (
<div className="flex h-full flex-col items-center justify-center px-6 py-10 text-center">
<div className="profile-rise mb-6 h-24 w-24" style={{ animationDelay: "0ms" }}>
- <MascotGigi size={96} reactToVoice enableComments={false} />
+ <PetMark size={96} reactive />
</div>
<h3
className="profile-rise font-display text-display text-foreground-strong"
diff --git a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
index 4bd8bb358f..29481d1689 100644
--- a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
+++ b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
@@ -14,7 +14,7 @@ import { VoiceWaveform, type WaveformPhase } from "@/components/overlay/VoiceWav
import { voiceInputLevelRef } from "@/lib/voiceInputLevel";
import { DockRail } from "@/components/layout/DockRail";
-import { GigiMark } from "@/components/GigiMark";
+import { PetMark } from "@/components/pets/PetMark";
import { DeckOrb, type OrbReadouts } from "@/components/deck/DeckOrb";
import type { ThinkingStep } from "@/lib/thinkingSteps";
import { DeckStandby, ORB_TRAVEL } from "@/components/deck/DeckStandby";
@@ -248,7 +248,7 @@ export function MissionDeckView({
className="flex h-8 w-8 shrink-0 items-center justify-center"
data-testid="deck-header-gigi"
>
- <GigiMark size={32} />
+ <PetMark size={32} reactive />
</span>
<div className="flex items-center gap-3">
<VoiceWaveform