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
import { cleanup, render } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { AgentSwatch } from "./AgentSwatch";
import { symbolAppearance } from "./AgentSymbol";
import { useCreatureDefault } from "./companion/creatureDefault";
import type { SocietyAgent } from "./data";
const agent: Pick<SocietyAgent, "agentId" | "tier" | "figure" | "palette" | "name"> = {
agentId: "research-worker",
tier: "specialist",
name: "Research",
figure: null,
palette: { primary: "#111111", secondary: "#222222", accent: "#333333" },
};
describe("an agent that never picked a look", () => {
afterEach(cleanup);
it("shows as a pixel creature that acts out the agent's run state", () => {
const { container, rerender } = render(<AgentSwatch agent={{ ...agent, state: "idle" }} />);
const face = () => container.querySelector<HTMLElement>("[data-agent-creature]")!;
expect(container.querySelector("svg")).toBeNull();
expect(face().dataset.creatureState).toBe("idle");
rerender(<AgentSwatch agent={{ ...agent, state: "working" }} />);
expect(face().dataset.creatureState).toBe("working");
expect(face().querySelector("[data-agent-working]")).not.toBeNull();
rerender(<AgentSwatch agent={{ ...agent, state: "waiting" }} />);
expect(face().dataset.creatureState).toBe("asking");
expect(face().querySelector("[data-agent-working]")).toBeNull();
});
});
describe("agent vector identities", () => {
// The shape symbols, as they show with pixel creatures switched off on this device.
beforeEach(() => useCreatureDefault.setState({ enabled: false }));
afterEach(() => { cleanup(); useCreatureDefault.setState({ enabled: true }); });
it("animates only a real working status, including the lead", () => {
const { container, rerender } = render(<AgentSwatch agent={{ ...agent, state: "working" }} />);
expect(container.querySelector("[data-thinking=true]")).not.toBeNull();
for (const state of ["idle", "waiting", "paused"] as const) {
rerender(<AgentSwatch agent={{ ...agent, state }} />);
expect(container.querySelector("[data-thinking=true]")).toBeNull();
}
rerender(<AgentSwatch agent={{ ...agent, tier: "lead", state: "working" }} />);
// The lead stays in the picture at work and carries the same bubble as everyone else.
expect(container.querySelector("[data-agent-mascot=gigi]")).not.toBeNull();
expect(container.querySelector("[data-thinking=true]")).not.toBeNull();
expect(container.querySelector("[data-agent-working]")).not.toBeNull();
expect(container.querySelector(".society-agent-symbol [data-agent-mascot=gigi]")).toBeNull();
});
it("renders a symbol immediately without a portrait, image request or canvas", () => {
const { container } = render(<AgentSwatch agent={agent} size={40} />);
expect(container.querySelector("svg[data-agent-symbol]")).not.toBeNull();
expect(container.querySelector("img, canvas")).toBeNull();
expect(container.firstElementChild?.getAttribute("style")).toContain("width: 40px");
expect(container.firstElementChild?.getAttribute("aria-hidden")).toBe("true");
});
it("keeps the same appearance on rename and figure edits", () => {
const { container, rerender } = render(<AgentSwatch agent={agent} />);
const before = container.querySelector("svg")?.outerHTML;
rerender(<AgentSwatch agent={{ ...agent, name: "New name", figure: { contract: 1, archetype: "spirit", base: "gigi", parts: {}, palette: {} } }} />);
expect(container.querySelector("svg")?.outerHTML).toBe(before);
expect(container.querySelector("[data-agent-mascot]")).toBeNull();
});
it("draws the animated companion for the lead, even with an old figure recipe", () => {
const { container } = render(<AgentSwatch agent={{ ...agent, tier: "lead", name: "Coordinator" }} size={56} />);
expect(container.querySelector("[data-agent-mascot=gigi] svg")).not.toBeNull();
expect(container.querySelector("img, canvas")).toBeNull();
expect(container.querySelector("[data-agent-symbol]")).toBeNull();
});
it("supports historical name-only participants and the legacy Gigi recipe", () => {
const { container, rerender } = render(<AgentSwatch agent={{ name: "Worker", figure: null, palette: agent.palette }} />);
expect(container.querySelector("svg")).not.toBeNull();
rerender(<AgentSwatch agent={{ name: "Jarvis", palette: agent.palette, figure: { contract: 1, archetype: "spirit", base: "gigi", parts: {}, palette: {} } }} />);
expect(container.querySelector("[data-agent-mascot=gigi]")).not.toBeNull();
});
it("distributes a roster across multiple silhouettes and colours deterministically", () => {
const identities = Array.from({ length: 40 }, (_, i) => `agent-${i}`);
const first = identities.map(symbolAppearance);
expect(identities.map(symbolAppearance)).toEqual(first);
expect(new Set(first.map(a => a.shape)).size).toBe(7);
expect(new Set(first.map(a => a.color)).size).toBe(11);
});
});