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(society): the lead agent wears the wake-word name instead of "Jarvis"

rubenluetke10-beep7cf0afd7c5e7
diff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.ts
index b97979b8df..072352d7cd 100644
--- a/jarvis/ui/web/frontend/src/components/society/data.ts
+++ b/jarvis/ui/web/frontend/src/components/society/data.ts
@@ -17,6 +17,8 @@ import { useQuery, useQueryClient, type QueryClient } from "@tanstack/react-quer
import type { MentionPlugin } from "./chat/mentionItems";
import type { Checkpoint, SocietyAgentRow } from "@/lib/societyApi";
+import { NEUTRAL_ASSISTANT_NAME } from "@/lib/assistantNameCache";
+import { useEventStore } from "@/store/events";
import { PALETTE_PRESETS, resolvePalette, type FigureRecipe } from "./figures/figureRecipe";
import { SAMPLE_ROSTER } from "./mockRoster";
@@ -295,10 +297,25 @@ function patchRoster(
void client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });
}
+/**
+ * The lead is the assistant itself, so it wears the name the user gave it
+ * through the wake phrase ("George"), not the roster row's seeded name. The
+ * neutral fallback never replaces a real row name while the seed is pending.
+ */
+export function withLeadName(data: RosterData, assistantName: string): RosterData {
+ const name = assistantName.trim();
+ if (!name || name === NEUTRAL_ASSISTANT_NAME) return data;
+ if (!data.agents.some((a) => a.tier === "lead" && a.name !== name)) return data;
+ return { ...data, agents: data.agents.map((a) => (a.tier === "lead" ? { ...a, name } : a)) };
+}
+
export function useSocietyRoster() {
+ const assistantName = useEventStore((s) => s.assistantName) ?? "";
+ const select = useCallback((data: RosterData) => withLeadName(data, assistantName), [assistantName]);
return useQuery({
queryKey: ROSTER_QUERY_KEY,
queryFn: fetchSocietyRoster,
+ select,
staleTime: 15_000,
// A refetch mid-ceremony would delete the figure being carried to the
// mine out from under the animation; the commit invalidates instead.
diff --git a/jarvis/ui/web/frontend/src/components/society/leadName.test.ts b/jarvis/ui/web/frontend/src/components/society/leadName.test.ts
new file mode 100644
index 0000000000..e81fe96e62
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/leadName.test.ts
@@ -0,0 +1,23 @@
+import { describe, expect, it } from "vitest";
+import { withLeadName, type RosterData, type SocietyAgent } from "./data";
+
+const roster = (): RosterData => ({
+ sample: false,
+ agents: [
+ { agentId: "jarvis", name: "Jarvis", tier: "lead" } as SocietyAgent,
+ { agentId: "gmail", name: "Mailer", tier: "specialist" } as SocietyAgent,
+ ],
+});
+
+describe("withLeadName", () => {
+ it("names the lead after the wake phrase and leaves others alone", () => {
+ const names = withLeadName(roster(), "George").agents.map((a) => a.name);
+ expect(names).toEqual(["George", "Mailer"]);
+ });
+
+ it("keeps the row name while only the neutral fallback is known", () => {
+ const data = roster();
+ expect(withLeadName(data, "Assistant")).toBe(data);
+ expect(withLeadName(data, " ")).toBe(data);
+ });
+});