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): open agent profiles and memory files from avatars

rubenluetke10-beep76220e6b4c70
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.test.tsx
new file mode 100644
index 0000000000..229e4151b8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.test.tsx
@@ -0,0 +1,108 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, expect, it, vi } from "vitest";
+import { SAMPLE_ROSTER } from "../mockRoster";
+import { AgentProfileDialog, agentMemoryFiles } from "./AgentProfileDialog";
+import { RosterRail } from "../roster/RosterRail";
+
+vi.mock("@/i18n", () => ({ useT: () => (key: string) => key, useLocaleChunk: () => true }));
+vi.mock("../AgentSwatch", () => ({ AgentSwatch: () => <span /> }));
+
+const agent = { ...SAMPLE_ROSTER[1], agentId: "research", name: "Research", title: "Researcher", description: "Check primary sources.", tier: "specialist" as const };
+const json = (value: unknown, status = 200) => new Response(JSON.stringify(value), { status });
+const row = { slug: "memory", title: "Memory", mtime: 1, size: 50 };
+const tree = { ok: true, folders: [
+ { name: "society/research", files: [row, { ...row, slug: "notes", title: "Notes", mtime: 2 }] },
+ { name: "society/research/nested", files: [{ ...row, slug: "nested" }] },
+ { name: "society/research-other", files: [row] },
+ { name: "society/other", files: [row] },
+] };
+
+function setup(options: { lead?: boolean; sample?: boolean; fetcher?: typeof fetch } = {}) {
+ const fetcher = vi.fn(options.fetcher ?? (async () => json({})));
+ vi.stubGlobal("fetch", fetcher);
+ const onClose = vi.fn();
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
+ render(<QueryClientProvider client={client}><AgentProfileDialog agent={options.lead ? { ...agent, agentId: "jarvis", tier: "lead" } : agent} sample={options.sample ?? false} onClose={onClose} /></QueryClientProvider>);
+ return { onClose, fetcher };
+}
+afterEach(() => { cleanup(); vi.unstubAllGlobals(); vi.restoreAllMocks(); });
+
+it("saves the role and instructions without overwriting model, grants or approval rules", async () => {
+ const { fetcher } = setup();
+ fireEvent.change(screen.getByLabelText("society.profile_card.role"), { target: { value: "Source researcher" } });
+ fireEvent.change(screen.getByLabelText("society.profile_card.instructions"), { target: { value: "Check dates too." } });
+ fireEvent.click(screen.getByRole("button", { name: "society.card.save" }));
+ await screen.findByText("society.profile_card.saved");
+ expect(fetcher).toHaveBeenCalledWith("/api/society/agents/research", expect.objectContaining({ method: "PATCH", body: JSON.stringify({ title: "Source researcher", description: "Check dates too." }) }));
+});
+
+it("keeps failed edits and protects them from accidental dismissal", async () => {
+ const { onClose } = setup({ fetcher: async () => json({}, 500) });
+ fireEvent.change(screen.getByLabelText("society.profile_card.instructions"), { target: { value: "Unsaved instructions" } });
+ fireEvent.click(screen.getByRole("button", { name: "society.card.save" }));
+ await screen.findByText("society.profile_card.save_error");
+ expect((screen.getByLabelText("society.profile_card.instructions") as HTMLTextAreaElement).value).toBe("Unsaved instructions");
+ fireEvent.click(screen.getAllByRole("button", { name: "society.card.close" })[0]);
+ expect(onClose).not.toHaveBeenCalled();
+ expect(screen.getByText("society.profile_card.unsaved")).toBeTruthy();
+ fireEvent.click(screen.getByRole("button", { name: "society.profile_card.keep_editing" }));
+ fireEvent.keyDown(screen.getByRole("dialog"), { key: "Escape" });
+ fireEvent.click(screen.getByRole("button", { name: "society.profile_card.discard" }));
+ expect(onClose).toHaveBeenCalledOnce();
+});
+
+it("uses the shared instructions endpoint for the lead", async () => {
+ const { fetcher } = setup({ lead: true, fetcher: async (_url, init) => json({ content: init?.method === "PUT" ? "New shared rule" : "Shared rule", filename: "AGENTS.md" }) });
+ await screen.findByDisplayValue("Shared rule");
+ fireEvent.change(screen.getByLabelText("society.profile_card.instructions"), { target: { value: "New shared rule" } });
+ fireEvent.click(screen.getByRole("button", { name: "society.card.save" }));
+ await screen.findByText("society.profile_card.saved");
+ expect(fetcher).toHaveBeenCalledWith("/api/settings/agent-instructions", expect.objectContaining({ method: "PUT", body: JSON.stringify({ content: "New shared rule" }) }));
+ expect(fetcher.mock.calls.some(([url]) => String(url).includes("/agents/jarvis"))).toBe(false);
+});
+
+it("lists only this agent's files, including nested notes and memory.md first", () => {
+ expect(agentMemoryFiles(tree, agent.agentId).map((file) => file.path)).toEqual(["society/research/memory.md", "society/research/notes.md", "society/research/nested/nested.md"]);
+});
+
+it("loads memory on demand, opens another file and filters filenames", async () => {
+ const { fetcher } = setup({ fetcher: async (url) => String(url).includes("/tree") ? json(tree) : json({ content: String(url).includes("notes.md") ? "Dated note" : "Durable memory" }) });
+ expect(fetcher).not.toHaveBeenCalled();
+ fireEvent.mouseDown(screen.getByRole("tab", { name: "society.profile_card.memory" }), { button: 0, ctrlKey: false });
+ await screen.findByText("Durable memory");
+ fireEvent.click(screen.getByRole("button", { name: "notes.md Notes" }));
+ await screen.findByText("Dated note");
+ expect(fetcher).toHaveBeenCalledWith("/api/society/memory/file?path=society%2Fresearch%2Fnotes.md", expect.anything());
+ fireEvent.change(screen.getByRole("searchbox"), { target: { value: "nested" } });
+ expect(screen.queryByRole("button", { name: "notes.md Notes" })).toBeNull();
+ expect(screen.getByRole("button", { name: "nested/nested.md Memory" })).toBeTruthy();
+});
+
+it("reports listing failures instead of presenting an empty memory", async () => {
+ setup({ fetcher: async () => json({ ok: false }) });
+ fireEvent.mouseDown(screen.getByRole("tab", { name: "society.profile_card.memory" }), { button: 0, ctrlKey: false });
+ await screen.findByRole("alert");
+ expect(screen.queryByText("society.profile_card.empty")).toBeNull();
+});
+
+it("does not read live data or save a sample agent", async () => {
+ const { fetcher } = setup({ sample: true, lead: true });
+ expect((screen.getByLabelText("society.profile_card.instructions") as HTMLTextAreaElement).disabled).toBe(true);
+ fireEvent.mouseDown(screen.getByRole("tab", { name: "society.profile_card.memory" }), { button: 0, ctrlKey: false });
+ expect(fetcher).not.toHaveBeenCalled();
+ expect((screen.getByRole("button", { name: "society.card.save" }) as HTMLButtonElement).disabled).toBe(true);
+});
+
+it("opens the avatar profile without selecting the chat and leaves name-click navigation intact", async () => {
+ const onOpen = vi.fn();
+ const client = new QueryClient();
+ render(<QueryClientProvider client={client}><RosterRail agents={[agent]} sample={false} loading={false} activeAgentId={null} onOpen={onOpen} onCreate={() => undefined} /></QueryClientProvider>);
+ fireEvent.click(screen.getByRole("button", { name: "society.profile_card.open" }));
+ await screen.findByRole("dialog");
+ expect(onOpen).not.toHaveBeenCalled();
+ fireEvent.click(screen.getAllByRole("button", { name: "society.card.close" })[0]);
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ fireEvent.click(screen.getByRole("button", { name: /Research Researcher/ }));
+ expect(onOpen).toHaveBeenCalledWith("research");
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.tsx
new file mode 100644
index 0000000000..e4045339dd
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentProfileDialog.tsx
@@ -0,0 +1,196 @@
+import { useRef, useState } from "react";
+import * as Dialog from "@radix-ui/react-dialog";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { FileText, RefreshCw, Search, X } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { Badge } from "@/components/ui/badge";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { useLocaleChunk, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { AgentSwatch } from "../AgentSwatch";
+import type { SocietyAgent } from "../data";
+
+const fieldClass = "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60";
+
+async function readJson<T>(url: string, signal?: AbortSignal): Promise<T> {
+ const response = await fetch(url, { signal });
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ return response.json() as Promise<T>;
+}
+
+/** An independent profile surface; opening it never changes the active chat. */
+export function AgentProfileDialog({ agent, sample, onClose }: {
+ agent: SocietyAgent;
+ sample: boolean;
+ onClose: () => void;
+}) {
+ const t = useT();
+ useLocaleChunk("society");
+ const client = useQueryClient();
+ const opener = useRef(document.activeElement instanceof HTMLElement ? document.activeElement : null);
+ const lead = agent.tier === "lead";
+ const [title, setTitle] = useState(agent.title);
+ const [description, setDescription] = useState(agent.description);
+ const [leadDraft, setLeadDraft] = useState<string | null>(null);
+ const [saved, setSaved] = useState({ title: agent.title, description: agent.description });
+ const [discard, setDiscard] = useState(false);
+ const [tab, setTab] = useState("profile");
+ const instructions = useQuery({
+ queryKey: ["society", "profile-instructions", agent.agentId],
+ enabled: lead && !sample,
+ retry: false,
+ queryFn: ({ signal }) => readJson<{ content: string; filename: string }>("/api/settings/agent-instructions", signal),
+ });
+ const content = lead ? (leadDraft ?? instructions.data?.content ?? "") : description;
+ const dirty = lead ? leadDraft !== null && leadDraft !== (instructions.data?.content ?? "")
+ : title !== saved.title || description !== saved.description;
+ const save = useMutation({
+ mutationFn: async () => {
+ const response = await fetch(lead ? "/api/settings/agent-instructions" : `/api/society/agents/${encodeURIComponent(agent.agentId)}`, {
+ method: lead ? "PUT" : "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(lead ? { content } : { title: title.trim(), description }),
+ });
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ return response.json() as Promise<{ content?: string; filename?: string }>;
+ },
+ onSuccess: (result) => {
+ if (lead) {
+ client.setQueryData(["society", "profile-instructions", agent.agentId], result);
+ setLeadDraft(null);
+ } else {
+ setTitle(title.trim());
+ setSaved({ title: title.trim(), description });
+ }
+ setDiscard(false);
+ void client.invalidateQueries({ queryKey: ["society", "roster"] });
+ },
+ });
+ const close = () => {
+ if (save.isPending) return;
+ if (dirty) setDiscard(true);
+ else onClose();
+ };
+
+ return (
+ <Dialog.Root open onOpenChange={(open) => { if (!open) close(); }}>
+ <Dialog.Portal>
+ <Dialog.Overlay className="fixed inset-0 z-50 bg-scrim/60 backdrop-blur-sm" />
+ <Dialog.Content data-testid="agent-profile-dialog" onCloseAutoFocus={(event) => { event.preventDefault(); opener.current?.focus(); }} className="fixed left-1/2 top-1/2 z-50 flex h-[min(82dvh,780px)] w-[min(800px,calc(100vw-24px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-border bg-popover text-foreground shadow-float outline-none">
+ <header className="flex shrink-0 items-center gap-4 border-b border-border p-6">
+ <AgentSwatch agent={agent} size={56} />
+ <div className="min-w-0 flex-1">
+ <Dialog.Title className="truncate text-xl font-semibold">{agent.name}</Dialog.Title>
+ <Dialog.Description className="mt-1 truncate text-sm text-muted-foreground">{agent.title || t("society.profile_card.subtitle")}</Dialog.Description>
+ <div className="mt-2 flex flex-wrap gap-2">
+ <Badge variant="secondary">{t(`society.tier.${agent.tier}`)}</Badge>
+ <Badge variant="outline">{t(`society.state.${agent.state}`)}</Badge>
+ {sample && <Badge variant="outline">{t("society.sample_badge")}</Badge>}
+ </div>
+ </div>
+ <button type="button" onClick={close} aria-label={t("society.card.close")} className="self-start rounded-lg p-2 text-muted-foreground hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><X size={18} aria-hidden /></button>
+ </header>
+ <Tabs value={tab} onValueChange={setTab} className="flex min-h-0 flex-1 flex-col">
+ <TabsList className="mx-6 mt-4 w-fit shrink-0" aria-label={t("society.profile_card.subtitle")}>
+ <TabsTrigger value="profile">{t("society.profile_card.profile")}</TabsTrigger>
+ <TabsTrigger value="memory">{t("society.profile_card.memory")}</TabsTrigger>
+ </TabsList>
+ <TabsContent value="profile" className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
+ <div className="grid gap-4 sm:grid-cols-2">
+ <label className="space-y-1.5 text-sm">{t("society.profile_card.name")}<input className={fieldClass} value={agent.name} readOnly /></label>
+ <label className="space-y-1.5 text-sm">{t("society.profile_card.role")}<input className={fieldClass} value={title} onChange={(event) => setTitle(event.target.value)} disabled={lead || sample || save.isPending} /></label>
+ </div>
+ <div className="mt-5">
+ <label htmlFor="agent-profile-instructions" className="text-sm font-medium">{t("society.profile_card.instructions")}</label>
+ <p className="mb-2 mt-1 text-xs leading-relaxed text-muted-foreground">{t(lead ? "society.card.instructions_hint" : "society.profile_card.instructions_hint")}</p>
+ {instructions.isError ? <p role="alert" className="mb-2 text-sm text-destructive">{t("society.profile_card.load_error")} <Button variant="ghost" size="sm" onClick={() => void instructions.refetch()}>{t("society.profile_card.retry")}</Button></p> : null}
+ <textarea id="agent-profile-instructions" className={cn(fieldClass, "min-h-[220px] resize-y leading-relaxed")} value={content} onChange={(event) => lead ? setLeadDraft(event.target.value) : setDescription(event.target.value)} disabled={sample || save.isPending || (lead && !instructions.data)} placeholder={t("society.card.no_description")} />
+ </div>
+ <dl className="mt-5 grid gap-4 rounded-xl border border-border p-4 text-sm sm:grid-cols-2">
+ <div><dt className="text-xs text-muted-foreground">{t("society.profile_card.model")}</dt><dd className="mt-1 break-words">{lead || !agent.model ? t("society.card.default_brain") : `${agent.providerLabel || agent.provider} · ${agent.model}`}</dd></div>
+ <div><dt className="text-xs text-muted-foreground">{t("society.profile_card.access")}</dt><dd className="mt-1">{t(`society.profile_card.access_${agent.grantMode}`)}</dd></div>
+ <div><dt className="text-xs text-muted-foreground">{t("society.profile_card.id")}</dt><dd className="mt-1 break-all font-mono text-xs">{agent.agentId}</dd></div>
+ <div><dt className="text-xs text-muted-foreground">{t("society.profile_card.location")}</dt><dd className="mt-1 break-all font-mono text-xs">{`society/${agent.agentId}/`}</dd></div>
+ </dl>
+ </TabsContent>
+ <TabsContent value="memory" className="mt-3 min-h-0 flex-1 overflow-hidden"><AgentMemoryFiles agentId={agent.agentId} sample={sample} /></TabsContent>
+ </Tabs>
+ <footer className="flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border px-6 py-4">
+ {discard ? <>
+ <span role="alert" className="mr-auto text-sm">{t("society.profile_card.unsaved")}</span>
+ <Button variant="ghost" onClick={() => setDiscard(false)}>{t("society.profile_card.keep_editing")}</Button>
+ <Button variant="secondary" onClick={onClose}>{t("society.profile_card.discard")}</Button>
+ </> : <>
+ {save.isError && <span role="alert" className="mr-auto text-sm text-destructive">{t("society.profile_card.save_error")}</span>}
+ {save.isSuccess && !dirty && <span role="status" className="mr-auto text-sm text-muted-foreground">{t("society.profile_card.saved")}</span>}
+ {sample && <span className="mr-auto text-xs text-muted-foreground">{t("society.profile_card.sample_hint")}</span>}
+ <Button variant="ghost" onClick={close} disabled={save.isPending}>{t("society.card.close")}</Button>
+ <Button onClick={() => save.mutate()} disabled={!dirty || sample || save.isPending}>{t(save.isPending ? "society.card.saving" : "society.card.save")}</Button>
+ </>}
+ </footer>
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}
+
+interface WikiFile { slug: string; title: string; mtime: number; size: number }
+interface WikiTree { ok: boolean; folders: { name: string; files: WikiFile[] }[] }
+
+/** Folder-qualified filenames avoid collisions between agents' memory.md files. */
+export function agentMemoryFiles(tree: WikiTree, agentId: string) {
+ const namespace = `society/${agentId}`;
+ return tree.folders.filter((folder) => folder.name === namespace || folder.name.startsWith(`${namespace}/`))
+ .flatMap((folder) => folder.files.map((file) => ({ ...file, path: `${folder.name}/${file.slug}.md` })))
+ .sort((a, b) => Number(b.path === `${namespace}/memory.md`) - Number(a.path === `${namespace}/memory.md`) || b.mtime - a.mtime || a.path.localeCompare(b.path));
+}
+
+function AgentMemoryFiles({ agentId, sample }: { agentId: string; sample: boolean }) {
+ const t = useT();
+ const [search, setSearch] = useState("");
+ const [selected, setSelected] = useState<string | null>(null);
+ const tree = useQuery({
+ queryKey: ["society", "profile-memory-tree"],
+ enabled: !sample,
+ retry: false,
+ staleTime: 10_000,
+ queryFn: async ({ signal }) => {
+ const result = await readJson<WikiTree>("/api/wiki/tree", signal);
+ if (!result.ok) throw new Error("Memory listing unavailable");
+ return result;
+ },
+ });
+ const files = tree.data ? agentMemoryFiles(tree.data, agentId) : [];
+ const visible = files.filter((file) => `${file.path} ${file.title}`.toLowerCase().includes(search.toLowerCase()));
+ const path = selected && files.some((file) => file.path === selected) ? selected : files[0]?.path;
+ const file = useQuery({
+ queryKey: ["society", "profile-memory-file", agentId, path],
+ enabled: !sample && Boolean(path),
+ retry: false,
+ queryFn: ({ signal }) => readJson<{ path: string; content: string; updated_ms: number }>(`/api/society/memory/file?path=${encodeURIComponent(path!)}`, signal),
+ });
+ return <div className="flex h-full min-h-0 flex-col">
+ <div className="mx-6 mb-3 flex items-center gap-2">
+ <Search size={16} className="shrink-0 text-muted-foreground" aria-hidden />
+ <input type="search" value={search} onChange={(event) => setSearch(event.target.value)} placeholder={t("society.profile_card.search")} aria-label={t("society.profile_card.search")} className={fieldClass} />
+ <Button size="sm" variant="ghost" disabled={sample || tree.isFetching || file.isFetching} aria-label={t("society.profile_card.refresh")} onClick={() => { void tree.refetch(); if (path) void file.refetch(); }}><RefreshCw size={16} aria-hidden /></Button>
+ </div>
+ {sample || tree.isError || tree.isLoading || files.length === 0 ? <div className="px-6 py-4 text-sm text-muted-foreground" role={tree.isError ? "alert" : "status"}>
+ {t(sample ? "society.profile_card.sample_hint" : tree.isError ? "society.profile_card.load_error" : tree.isLoading ? "society.roster.loading" : "society.profile_card.empty")}
+ {tree.isError && <Button size="sm" variant="ghost" onClick={() => void tree.refetch()}>{t("society.profile_card.retry")}</Button>}
+ </div> : <div className="grid min-h-0 flex-1 grid-rows-[140px_minmax(0,1fr)] border-t border-border sm:grid-cols-[240px_minmax(0,1fr)] sm:grid-rows-1">
+ <nav aria-label={t("society.profile_card.memory")} className="overflow-y-auto border-b border-border bg-card p-2 sm:border-b-0 sm:border-r">
+ {visible.length === 0 && <p className="p-3 text-xs text-muted-foreground">{t("society.profile_card.no_results")}</p>}
+ {visible.map((entry) => <button type="button" key={entry.path} aria-current={entry.path === path ? "true" : undefined} onClick={() => setSelected(entry.path)} className={cn("mb-1 flex w-full select-none items-start gap-2 rounded-lg p-3 text-left text-sm hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", entry.path === path && "bg-secondary")}>
+ <FileText size={16} className="mt-0.5 shrink-0 text-muted-foreground" aria-hidden />
+ <span className="min-w-0"><span className="block break-all font-medium">{entry.path.slice(`society/${agentId}/`.length)}</span><span className="mt-1 block truncate text-xs text-muted-foreground">{entry.title}</span></span>
+ </button>)}
+ </nav>
+ <section aria-label={path} className="min-w-0 overflow-auto p-5">
+ <div className="mb-4 border-b border-border pb-3"><p className="break-all font-mono text-xs">{path}</p><p className="mt-1 text-xs text-muted-foreground">{t("society.profile_card.read_only")}</p></div>
+ {file.isLoading ? <p role="status" className="text-sm text-muted-foreground">{t("society.roster.loading")}</p> : file.isError ? <p role="alert" className="text-sm text-destructive">{t("society.profile_card.load_error")} <Button variant="ghost" size="sm" onClick={() => void file.refetch()}>{t("society.profile_card.retry")}</Button></p> : <pre className="whitespace-pre-wrap break-words font-mono text-xs leading-6">{file.data?.content || t("society.profile_card.empty_file")}</pre>}
+ </section>
+ </div>}
+ </div>;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx
index dfc88bb56e..1bc107399b 100644
--- a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx
@@ -2,9 +2,8 @@
* The fixed agents rail beside the stage (MASTERPLAN §4.1): the lead as a
* compact centered master above the team — swatch and name in a small box —
* then a search field and one row per remaining agent, plus the "+" that
- * opens the creator. One click on the master or a row opens the model card
- * (the row-click doctrine: open and activate in one click, never a
- * double-click split).
+ * opens the creator. Names open the chat; avatars open a compact profile
+ * dialog without switching the conversation.
*
* The layout follows the Chef Bot reference: the master is centered and
* larger, the team stays a compact list below the search. The rail is app
@@ -15,7 +14,7 @@
* fixed width; inside the agent card it is the LEFT eighth and takes its width
* from the grid cell — same rows, same sizes, only the divider swaps sides.
*/
-import { useMemo, useState } from "react";
+import { lazy, Suspense, useMemo, useState } from "react";
import { Loader2, Plus, Search } from "lucide-react";
import { Badge } from "@/components/ui/badge";
@@ -28,6 +27,8 @@ import { AgentSwatch } from "../AgentSwatch";
import type { AgentRunState, SocietyAgent } from "../data";
import { useRosterUnread } from "./useRosterUnread";
+const AgentProfileDialog = lazy(() => import("../card/AgentProfileDialog").then((module) => ({ default: module.AgentProfileDialog })));
+
const STATE_DOT: Record<AgentRunState, string> = {
idle: "bg-muted-foreground/50",
working: "bg-success",
@@ -61,6 +62,8 @@ export function RosterRail({
}: RosterRailProps) {
const t = useT();
const [query, setQuery] = useState("");
+ const [profileId, setProfileId] = useState<string | null>(null);
+ const profile = agents.find((agent) => agent.agentId === profileId);
const unread = useRosterUnread(agents, activeAgentId);
const lead = useMemo(() => agents.find((a) => a.tier === "lead") ?? null, [agents]);
@@ -128,17 +131,14 @@ export function RosterRail({
<ScrollArea className="mt-2 min-h-0 flex-1">
{lead && leadVisible ? (
<div className="flex justify-center px-2 pb-2">
- <button
- type="button"
- onClick={() => onOpen(lead.agentId)}
- aria-current={lead.agentId === activeAgentId ? "true" : undefined}
+ <div
data-testid="society-lead-hero"
className={cn(
"flex flex-col items-center gap-1.5 rounded-xl bg-secondary/50 px-5 py-3 text-center transition-colors hover:bg-secondary/80",
lead.agentId === activeAgentId && "bg-secondary",
)}
>
- <span className="relative">
+ <button type="button" onClick={() => setProfileId(lead.agentId)} aria-label={t("society.profile_card.open").replace("{0}", lead.name)} className="relative rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<AgentSwatch agent={lead} size={56} />
{lead.state === "working" ? (
<span
@@ -156,14 +156,14 @@ export function RosterRail({
className="absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full bg-sky-400 ring-2 ring-sidebar"
/>
) : null}
- </span>
- <span className="flex max-w-full items-center justify-center gap-1.5">
+ </button>
+ <button type="button" onClick={() => onOpen(lead.agentId)} aria-current={lead.agentId === activeAgentId ? "true" : undefined} className="flex max-w-full items-center justify-center gap-1.5 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<span className="truncate text-sm font-medium text-foreground">{lead.name}</span>
<Badge variant="secondary" className="shrink-0 px-1.5 py-0 text-xs">
{t("society.tier.lead")}
</Badge>
- </span>
- </button>
+ </button>
+ </div>
</div>
) : null}
{leadVisible ? (
@@ -178,16 +178,16 @@ export function RosterRail({
) : null}
{rows.map((agent) => (
<li key={agent.agentId}>
- <button
- type="button"
- onClick={() => onOpen(agent.agentId)}
- aria-current={agent.agentId === activeAgentId ? "true" : undefined}
+ <div
className={cn(
- "flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-left transition-colors hover:bg-secondary",
+ "flex w-full items-center rounded-md px-2 text-left transition-colors hover:bg-secondary",
agent.agentId === activeAgentId && "bg-secondary",
)}
>
- <AgentSwatch agent={agent} size={34} />
+ <button type="button" onClick={() => setProfileId(agent.agentId)} aria-label={t("society.profile_card.open").replace("{0}", agent.name)} className="shrink-0 rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ <AgentSwatch agent={agent} size={34} />
+ </button>
+ <button type="button" onClick={() => onOpen(agent.agentId)} aria-current={agent.agentId === activeAgentId ? "true" : undefined} className="flex min-w-0 flex-1 select-none items-center gap-2.5 rounded-md py-2 pl-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<span className="min-w-0 flex-1">
<span className="flex items-center gap-1.5">
<span className="truncate text-sm font-medium text-foreground">{agent.name}</span>
@@ -200,11 +200,13 @@ export function RosterRail({
<span className="block truncate text-xs text-muted-foreground">{agent.title}</span>
</span>
<RowStatus agent={agent} hasUnread={unread.has(agent.agentId)} />
- </button>
+ </button>
+ </div>
</li>
))}
</ul>
</ScrollArea>
+ {profile && <Suspense fallback={null}><AgentProfileDialog key={profile.agentId} agent={profile} sample={sample} onClose={() => setProfileId(null)} /></Suspense>}
</aside>
);
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index f7c912c6b5..3a35b3a9b5 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -1,5 +1,35 @@
{
"society": {
+ "profile_card": {
+ "open": "Profil von {0} öffnen",
+ "subtitle": "Agent-Profil",
+ "profile": "Profil & Anweisungen",
+ "memory": "Memory-Dateien",
+ "name": "Name",
+ "role": "Rolle / Kurzbeschreibung",
+ "instructions": "Systemanweisungen",
+ "instructions_hint": "Diese dauerhaften Anweisungen beschreiben Aufgabe und Verhalten des Agenten. Änderungen gelten für nachfolgende Ausführungen.",
+ "access": "Werkzeugzugriff",
+ "access_all": "Alle erlaubten Werkzeuge",
+ "access_allowlist": "Nur ausgewählte Werkzeuge",
+ "id": "Agent-ID",
+ "location": "Memory-Ordner",
+ "load_error": "Die Daten konnten nicht geladen werden.",
+ "save_error": "Speichern fehlgeschlagen. Deine Änderungen bleiben erhalten.",
+ "retry": "Erneut versuchen",
+ "saved": "Änderungen gespeichert",
+ "unsaved": "Du hast ungespeicherte Änderungen.",
+ "keep_editing": "Weiter bearbeiten",
+ "discard": "Änderungen verwerfen",
+ "sample_hint": "Beispielprofil — Bearbeiten und echte Memory-Dateien sind hier nicht verfügbar.",
+ "search": "Memory-Dateien suchen…",
+ "refresh": "Dateien aktualisieren",
+ "empty": "Dieser Agent hat noch keine Memory-Dateien.",
+ "empty_file": "Diese Datei ist leer.",
+ "no_results": "Keine passenden Dateien.",
+ "read_only": "Nur lesen · Von diesem Agenten gepflegt",
+ "model": "Modell"
+ },
"routine_detail": {
"test_started": "Testlauf gestartet.",
"active": "Aktiv",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index 0ebdbe70b8..1dd99e2f1c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -1,5 +1,35 @@
{
"society": {
+ "profile_card": {
+ "open": "Open profile of {0}",
+ "subtitle": "Agent profile",
+ "profile": "Profile & instructions",
+ "memory": "Memory files",
+ "name": "Name",
+ "role": "Role / description",
+ "instructions": "System instructions",
+ "instructions_hint": "These standing instructions describe the agent’s job and behavior. Changes apply to subsequent runs.",
+ "access": "Tool access",
+ "access_all": "All permitted tools",
+ "access_allowlist": "Selected tools only",
+ "id": "Agent ID",
+ "location": "Memory folder",
+ "load_error": "Could not load this data.",
+ "save_error": "Could not save. Your changes are still here.",
+ "retry": "Try again",
+ "saved": "Changes saved",
+ "unsaved": "You have unsaved changes.",
+ "keep_editing": "Keep editing",
+ "discard": "Discard changes",
+ "sample_hint": "Sample profile — editing and live memory are unavailable.",
+ "search": "Search memory files…",
+ "refresh": "Refresh files",
+ "empty": "This agent has no memory files yet.",
+ "empty_file": "This file is empty.",
+ "no_results": "No matching files.",
+ "read_only": "Read-only · Maintained by this agent",
+ "model": "Model"
+ },
"routine_detail": {
"test_started": "Test run started.",
"active": "Active",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index 5177a4cde4..7631740a6d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -1,5 +1,35 @@
{
"society": {
+ "profile_card": {
+ "open": "Abrir perfil de {0}",
+ "subtitle": "Perfil del agente",
+ "profile": "Perfil e instrucciones",
+ "memory": "Archivos de memoria",
+ "name": "Nombre",
+ "role": "Rol / descripción breve",
+ "instructions": "Instrucciones del sistema",
+ "instructions_hint": "Estas instrucciones permanentes describen la tarea y el comportamiento del agente. Los cambios se aplican a las siguientes ejecuciones.",
+ "access": "Acceso a herramientas",
+ "access_all": "Todas las herramientas permitidas",
+ "access_allowlist": "Solo herramientas seleccionadas",
+ "id": "ID del agente",
+ "location": "Carpeta de memoria",
+ "load_error": "No se pudieron cargar los datos.",
+ "save_error": "No se pudo guardar. Los cambios se conservan.",
+ "retry": "Reintentar",
+ "saved": "Cambios guardados",
+ "unsaved": "Hay cambios sin guardar.",
+ "keep_editing": "Seguir editando",
+ "discard": "Descartar cambios",
+ "sample_hint": "Perfil de ejemplo: la edición y la memoria real no están disponibles.",
+ "search": "Buscar archivos de memoria…",
+ "refresh": "Actualizar archivos",
+ "empty": "Este agente aún no tiene archivos de memoria.",
+ "empty_file": "Este archivo está vacío.",
+ "no_results": "No hay archivos coincidentes.",
+ "read_only": "Solo lectura · Mantenido por este agente",
+ "model": "Modelo"
+ },
"routine_detail": {
"test_started": "Prueba iniciada.",
"active": "Activo",