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
feat(society): add agent roster context actions
rubenluetke10-beep71a83261cd31
diff --git a/docs/os-parity.md b/docs/os-parity.mdindex 09693c35f3..67af938319 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -387,7 +387,7 @@ implementations, not stubs.| Core (launcher, config, keyring, restart, autostart, tray, elevation, paths) | Clean; per-OS autostart (Registry / LaunchAgent / XDG `.desktop`), keyring falls back to a 0600 file on headless hosts || Data / agents (wiki, contacts, telephony, sessions, missions, skills, self-mod, channels, MCP) | Clean; mission workers run on POSIX with a real process-group reaper || Agent society hands (own shell, browser via browser-use, learned skills) | Shell: local subprocess in the agent's workspace on every OS (Git Bash/PowerShell/bash/sh pick as the chat's folder tools), no container by decision. Browser: browser-use lives in a managed venv under the data dir (its pins collide with the app's), installed on demand — `uv`/`venv`, a 3.11–3.13 interpreter preferred, Chromium downloaded once; headless runs need no display, so a headless Linux box runs agents' browsers; the headed login session needs a display (409 without one is the follow-up); attach mode needs a running Chrome with `--remote-debugging-port`. Learning is pure files + the brain, OS-neutral |-| Agent society substrate (roster, typed board, scheduler, rooms, mission bridge, `/api/society`) | Clean; pure asyncio + SQLite (`data/society.db`, WAL) and FastAPI, no OS API, no GPU, no audio. Full REST parity from a headless `python:3.11-slim` (`tests/contract/test_society_substrate.py` seeds two agents and exchanges typed messages with fakes only); the dynamic `jarvis api society …` CLI layer covers every route. FTS5 over knowledge summaries is optional — a SQLite without it degrades to plain reads (same class as P-05). Per-agent screens (`agent_screen`) are M6 and keep their own per-OS probes |+| Agent society substrate (roster, typed board, scheduler, rooms, mission bridge, `/api/society`) | Clean; pure asyncio + SQLite (`data/society.db`, WAL) and FastAPI, no OS API, no GPU, no audio. Full REST parity from a headless `python:3.11-slim` (`tests/contract/test_society_substrate.py` covers messages, rename with stable agent/chat IDs, and archive). The agent sidebar's hide choice is a browser-local display preference on every desktop OS; it does not change roster state. The dynamic `jarvis api society …` CLI layer covers every route. FTS5 over knowledge summaries is optional — a SQLite without it degrades to plain reads (same class as P-05). Per-agent screens (`agent_screen`) are M6 and keep their own per-OS probes || Typed chat on the Jarvis surface (brain runner, folder tools, approval card, CLI seats as Jarvis) | Clean; pure asyncio + SQLite, no OS API. Every CLI spawn keeps `NO_WINDOW_CREATIONFLAGS` and UTF-8 stdio. The identity for a Claude Code seat travels as a FILE under the app data dir (`jarvis_harness.write_identity_file`, removed after the turn) because Windows caps a command line at 32 767 characters; Codex and agy take it on stdin (no limit), Grok Build a compact cut on argv (`COMPACT_MAX_CHARS`). The MCP session header and the approval bridge are transport-level and OS-neutral |## Open parity gapsdiff --git a/jarvis/society/roster.py b/jarvis/society/roster.pyindex f56e7f3b86..0f062d1569 100644--- a/jarvis/society/roster.py+++ b/jarvis/society/roster.py@@ -15,6 +15,7 @@ from __future__ import annotationsimport jsonimport re+import sqlite3import unicodedatafrom dataclasses import dataclass, fieldfrom typing import Any, Final@@ -209,6 +210,7 @@ class AgentRecord:_EDITABLE: Final[frozenset[str]] = frozenset({+ "name","title","description","tier",@@ -286,6 +288,8 @@ def _enum(kind: Any, value: Any, field_name: str) -> str:def _coerce(field_name: str, value: Any) -> Any:"""Validate one editable field and return its column value."""+ if field_name == "name":+ return _validate_name(value)if field_name == "title":return str(value or "")[:_MAX_TITLE]if field_name == "description":@@ -470,6 +474,13 @@ class Roster:current = await self._store.get_agent_row(agent_id)if current is None:raise RosterError(FailureReason.TARGET_UNKNOWN, f"agent {agent_id!r} not found")+ if "name" in fields:+ clean_name = _validate_name(fields["name"])+ if agent_id == LEAD_AGENT_ID and clean_name != current["name"]:+ raise RosterError(FailureReason.TIER_NOT_ALLOWED, "Jarvis keeps the lead name")+ existing = await self._store.get_agent_row_by_name(clean_name)+ if existing is not None and existing["agent_id"] != agent_id:+ raise RosterError(FailureReason.BLOCKED_BY_POLICY, "agent name already exists")columns: dict[str, Any] = {}for key, value in fields.items():if key not in _EDITABLE:@@ -486,7 +497,12 @@ class Roster:if await self._store.get_agent_row(str(value)) is None:raise RosterError(FailureReason.TARGET_UNKNOWN, f"parent {value!r} not found")columns[_JSON_FIELDS.get(key, key)] = _coerce(key, value)- await self._store.update_agent(agent_id, columns)+ try:+ await self._store.update_agent(agent_id, columns)+ except sqlite3.IntegrityError as exc:+ if "name" not in fields:+ raise+ raise RosterError(FailureReason.BLOCKED_BY_POLICY, "agent name already exists") from excrow = await self._store.get_agent_row(agent_id)assert row is not Nonerecord = await self._hydrate(row)diff --git a/jarvis/ui/web/frontend/src/components/society/roster/AgentRosterActions.tsx b/jarvis/ui/web/frontend/src/components/society/roster/AgentRosterActions.tsxnew file mode 100644index 0000000000..6039418a69--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/roster/AgentRosterActions.tsx@@ -0,0 +1,159 @@+import { useCallback, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent } from "react";+import { createPortal } from "react-dom";+import * as Dialog from "@radix-ui/react-dialog";+import { EyeOff, Eye, Pencil, Trash2 } from "lucide-react";+import { useQueryClient } from "@tanstack/react-query";++import { Button } from "@/components/ui/button";+import { useT } from "@/i18n";+import { findLead, useRetireAgent, type SocietyAgent } from "../data";++interface Props {+ agent: SocietyAgent;+ roster: SocietyAgent[];+ sample: boolean;+ hidden: boolean;+ x: number;+ y: number;+ onVisibilityChange: (agentId: string, hidden: boolean) => void;+ onDismiss: () => void;+}++export function AgentRosterActions({ agent, roster, sample, hidden, x, y, onVisibilityChange, onDismiss }: Props) {+ const t = useT();+ const client = useQueryClient();+ const retire = useRetireAgent();+ const menuRef = useRef<HTMLDivElement>(null);+ const [mode, setMode] = useState<"rename" | "delete" | null>(null);+ const [name, setName] = useState(agent.name);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState(false);+ const isLead = agent.tier === "lead";++ useEffect(() => {+ if (mode) return;+ const onPointerDown = (event: PointerEvent) => {+ if (!menuRef.current?.contains(event.target as Node)) onDismiss();+ };+ const onKeyDown = (event: globalThis.KeyboardEvent) => {+ if (event.key === "Escape") onDismiss();+ };+ document.addEventListener("pointerdown", onPointerDown, true);+ document.addEventListener("keydown", onKeyDown, true);+ document.addEventListener("scroll", onDismiss, true);+ window.addEventListener("resize", onDismiss);+ return () => {+ document.removeEventListener("pointerdown", onPointerDown, true);+ document.removeEventListener("keydown", onKeyDown, true);+ document.removeEventListener("scroll", onDismiss, true);+ window.removeEventListener("resize", onDismiss);+ };+ }, [mode, onDismiss]);++ useLayoutEffect(() => {+ const menu = menuRef.current;+ if (!menu || mode) return;+ const { width, height } = menu.getBoundingClientRect();+ menu.style.left = `${Math.max(8, Math.min(x, window.innerWidth - width - 8))}px`;+ menu.style.top = `${Math.max(8, Math.min(y, window.innerHeight - height - 8))}px`;+ menu.style.visibility = "visible";+ menu.querySelector<HTMLButtonElement>('button:not([disabled])')?.focus();+ }, [x, y, mode]);++ const onMenuKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;+ event.preventDefault();+ const items = Array.from(menuRef.current?.querySelectorAll<HTMLButtonElement>('button:not([disabled])') ?? []);+ if (!items.length) return;+ const index = items.indexOf(document.activeElement as HTMLButtonElement);+ items[(index + (event.key === "ArrowDown" ? 1 : -1) + items.length) % items.length]?.focus();+ };++ const rename = useCallback(async () => {+ const cleaned = name.trim();+ if (!cleaned || cleaned === agent.name || busy) return;+ setBusy(true);+ setError(false);+ try {+ const response = await fetch(`/api/society/agents/${encodeURIComponent(agent.agentId)}`, {+ method: "PATCH",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ name: cleaned }),+ });+ if (!response.ok) throw new Error(`rename ${response.status}`);+ await client.invalidateQueries({ queryKey: ["society", "roster"] });+ onDismiss();+ } catch {+ setError(true);+ } finally {+ setBusy(false);+ }+ }, [agent.agentId, agent.name, busy, client, name, onDismiss]);++ const remove = useCallback(async () => {+ if (busy) return;+ setBusy(true);+ setError(false);+ try {+ await retire(agent, findLead(roster));+ onDismiss();+ } catch {+ setError(true);+ } finally {+ setBusy(false);+ }+ }, [agent, busy, onDismiss, retire, roster]);++ const closeDialog = (open: boolean) => {+ if (!open && !busy) onDismiss();+ };++ return createPortal(<>+ {!mode && <div ref={menuRef} role="menu" aria-label={t("society.roster.menu")} onKeyDown={onMenuKeyDown}+ style={{ width: 260, visibility: "hidden" }}+ className="fixed z-[100] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-float">+ <button type="button" role="menuitem" disabled={sample || isLead} onClick={() => { setMode("rename"); setError(false); }}+ className="flex w-full items-center gap-2 rounded px-3 py-2 text-left text-sm hover:bg-secondary focus:bg-secondary focus:outline-none disabled:opacity-40">+ <Pencil className="h-4 w-4" aria-hidden />{t("society.roster.rename")}+ </button>+ <button type="button" role="menuitem" onClick={() => { onVisibilityChange(agent.agentId, !hidden); onDismiss(); }}+ className="flex w-full items-center gap-2 rounded px-3 py-2 text-left text-sm hover:bg-secondary focus:bg-secondary focus:outline-none">+ {hidden ? <Eye className="h-4 w-4" aria-hidden /> : <EyeOff className="h-4 w-4" aria-hidden />}+ {t(hidden ? "society.roster.show" : "society.roster.hide")}+ </button>+ <div className="my-1 border-t border-border" aria-hidden />+ <button type="button" role="menuitem" disabled={isLead} onClick={() => { setMode("delete"); setError(false); }}+ className="flex w-full items-center gap-2 rounded px-3 py-2 text-left text-sm text-destructive hover:bg-destructive/10 focus:bg-destructive/10 focus:outline-none disabled:opacity-40">+ <Trash2 className="h-4 w-4" aria-hidden />{t("society.roster.delete")}+ </button>+ </div>}+ <Dialog.Root open={mode !== null} onOpenChange={closeDialog}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 z-[101] bg-scrim/60" />+ <Dialog.Content className="fixed left-1/2 top-1/2 z-[102] w-[min(400px,calc(100vw-24px))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-popover p-5 text-popover-foreground shadow-float outline-none">+ <Dialog.Title className="text-base font-semibold">{t(mode === "rename" ? "society.roster.rename" : "society.roster.delete")}</Dialog.Title>+ <Dialog.Description className="mt-2 text-sm text-muted-foreground">+ {mode === "rename" ? t("society.roster.rename_hint") : t("society.roster.delete_confirm").replace("{0}", agent.name)}+ </Dialog.Description>+ {mode === "rename" && <form onSubmit={(event) => { event.preventDefault(); void rename(); }}>+ <input autoFocus value={name} maxLength={40} onChange={(event) => setName(event.target.value)}+ aria-label={t("society.roster.name")}+ className="mt-4 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" />+ {error && <p role="alert" className="mt-2 text-sm text-destructive">{t("society.roster.rename_error")}</p>}+ <div className="mt-5 flex justify-end gap-2">+ <Button type="button" variant="ghost" disabled={busy} onClick={onDismiss}>{t("society.roster.cancel")}</Button>+ <Button type="submit" disabled={busy || !name.trim() || name.trim() === agent.name}>{t("society.roster.save")}</Button>+ </div>+ </form>}+ {mode === "delete" && <>+ {error && <p role="alert" className="mt-2 text-sm text-destructive">{t("society.roster.delete_error")}</p>}+ <div className="mt-5 flex justify-end gap-2">+ <Button variant="ghost" disabled={busy} onClick={onDismiss}>{t("society.roster.cancel")}</Button>+ <Button variant="destructive" disabled={busy} onClick={() => void remove()}>{t("society.roster.delete")}</Button>+ </div>+ </>}+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ </>, document.body);+}diff --git a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.test.tsx b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.test.tsxindex 9bbcb19a4c..7bb66e6f5d 100644--- a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.test.tsx+++ b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.test.tsx@@ -1,14 +1,18 @@-import { cleanup, render, screen } from "@testing-library/react";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { afterEach, describe, expect, it, vi } from "vitest";import type { SocietyAgent } from "@/components/society/data";+import { useRetireStore } from "@/components/society/world/retireStore";import { RosterRail } from "./RosterRail";vi.mock("@/i18n", () => ({ useT: () => (key: string) => key }));afterEach(() => {+ useRetireStore.getState().cutShort();cleanup();localStorage.clear();+ vi.unstubAllGlobals();});function agent(over: Partial<SocietyAgent> & Pick<SocietyAgent, "agentId" | "name">): SocietyAgent {@@ -99,3 +103,69 @@ describe("RosterRail status", () => {expect(screen.queryByLabelText("society.roster.unread")).toBeNull();});});++describe("RosterRail agent actions", () => {+ const renderRail = (agents: SocietyAgent[]) => {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return render(<QueryClientProvider client={client}>+ <RosterRail {...baseProps} agents={agents} activeAgentId={null} />+ </QueryClientProvider>);+ };++ it("opens exactly the three requested actions on right click", () => {+ renderRail([agent({ agentId: "a", name: "A" })]);+ fireEvent.contextMenu(screen.getByText("A"));+ expect(screen.getAllByRole("menuitem")).toHaveLength(3);+ expect(screen.getByRole("menuitem", { name: "society.roster.rename" })).toBeTruthy();+ expect(screen.getByRole("menuitem", { name: "society.roster.hide" })).toBeTruthy();+ expect(screen.getByRole("menuitem", { name: "society.roster.delete" })).toBeTruthy();+ expect(screen.queryByText(/copy|kopieren/i)).toBeNull();+ });++ it("hides an agent persistently and restores it from the hidden list", () => {+ const agents = [agent({ agentId: "a", name: "A" })];+ const { unmount } = renderRail(agents);+ fireEvent.contextMenu(screen.getByText("A"));+ fireEvent.click(screen.getByRole("menuitem", { name: "society.roster.hide" }));+ expect(screen.queryByText("A")).toBeNull();+ unmount();++ renderRail(agents);+ expect(screen.queryByText("A")).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "society.roster.show_hidden" }));+ fireEvent.contextMenu(screen.getByText("A"));+ fireEvent.click(screen.getByRole("menuitem", { name: "society.roster.show" }));+ expect(JSON.parse(localStorage.getItem("society.roster.hidden-agent-ids") ?? "[]")).toEqual([]);+ expect(screen.getByText("A")).toBeTruthy();+ });++ it("renames via the existing roster API and confirms before deleting", async () => {+ const fetchMock = vi.fn().mockResolvedValue({ ok: true });+ vi.stubGlobal("fetch", fetchMock);+ renderRail([agent({ agentId: "a", name: "A" })]);+ fireEvent.contextMenu(screen.getByText("A"));+ fireEvent.click(screen.getByRole("menuitem", { name: "society.roster.rename" }));+ fireEvent.change(screen.getByRole("textbox", { name: "society.roster.name" }), { target: { value: "Renamed" } });+ fireEvent.click(screen.getByRole("button", { name: "society.roster.save" }));+ await waitFor(() => expect(fetchMock).toHaveBeenCalledWith("/api/society/agents/a", expect.objectContaining({ method: "PATCH", body: JSON.stringify({ name: "Renamed" }) })));+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());++ fireEvent.contextMenu(screen.getByText("A"));+ fireEvent.click(screen.getByRole("menuitem", { name: "society.roster.delete" }));+ expect(screen.getByRole("dialog")).toBeTruthy();+ expect(fetchMock).toHaveBeenCalledTimes(1);+ fireEvent.click(screen.getByRole("button", { name: "society.roster.cancel" }));+ expect(fetchMock).toHaveBeenCalledTimes(1);+ });++ it("archives only after the delete confirmation", async () => {+ const fetchMock = vi.fn().mockResolvedValue({ ok: true });+ vi.stubGlobal("fetch", fetchMock);+ renderRail([agent({ agentId: "a", name: "A" })]);+ fireEvent.contextMenu(screen.getByText("A"));+ fireEvent.click(screen.getByRole("menuitem", { name: "society.roster.delete" }));+ expect(fetchMock).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole("button", { name: "society.roster.delete" }));+ await waitFor(() => expect(fetchMock).toHaveBeenCalledWith("/api/society/agents/a", { method: "DELETE" }));+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsxindex 1bc107399b..cbb436b9b4 100644--- a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx+++ b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx@@ -14,8 +14,8 @@* 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 { lazy, Suspense, useMemo, useState } from "react";-import { Loader2, Plus, Search } from "lucide-react";+import { lazy, Suspense, useCallback, useMemo, useState, type MouseEvent } from "react";+import { Eye, Loader2, Plus, Search } from "lucide-react";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";@@ -25,8 +25,20 @@ import { cn } from "@/lib/utils";import { AgentSwatch } from "../AgentSwatch";import type { AgentRunState, SocietyAgent } from "../data";+import { AgentRosterActions } from "./AgentRosterActions";import { useRosterUnread } from "./useRosterUnread";+const HIDDEN_AGENTS_KEY = "society.roster.hidden-agent-ids";++function readHiddenAgents(): string[] {+ try {+ const value: unknown = JSON.parse(localStorage.getItem(HIDDEN_AGENTS_KEY) ?? "[]");+ return Array.isArray(value) ? value.filter((id): id is string => typeof id === "string") : [];+ } catch {+ return [];+ }+}+const AgentProfileDialog = lazy(() => import("../card/AgentProfileDialog").then((module) => ({ default: module.AgentProfileDialog })));const STATE_DOT: Record<AgentRunState, string> = {@@ -63,16 +75,35 @@ export function RosterRail({const t = useT();const [query, setQuery] = useState("");const [profileId, setProfileId] = useState<string | null>(null);+ const [hiddenIds, setHiddenIds] = useState(readHiddenAgents);+ const [showHidden, setShowHidden] = useState(false);+ const [menu, setMenu] = useState<{ agentId: string; x: number; y: number } | null>(null);const profile = agents.find((agent) => agent.agentId === profileId);+ const menuAgent = agents.find((agent) => agent.agentId === menu?.agentId);const unread = useRosterUnread(agents, activeAgentId);+ const setHidden = useCallback((agentId: string, hidden: boolean) => {+ setHiddenIds((current) => {+ const next = hidden ? [...new Set([...current, agentId])] : current.filter((id) => id !== agentId);+ localStorage.setItem(HIDDEN_AGENTS_KEY, JSON.stringify(next));+ return next;+ });+ }, []);+ const closeMenu = useCallback(() => setMenu(null), []);+ const openMenu = (event: MouseEvent, agentId: string) => {+ event.preventDefault();+ event.stopPropagation();+ setMenu({ agentId, x: event.clientX, y: event.clientY });+ };+const lead = useMemo(() => agents.find((a) => a.tier === "lead") ?? null, [agents]);const { leadVisible, rows } = useMemo(() => {const q = query.trim().toLowerCase();- const filtered = q- ? agents.filter((a) => `${a.name} ${a.title}`.toLowerCase().includes(q))- : agents;+ const filtered = agents.filter((a) =>+ (showHidden || !hiddenIds.includes(a.agentId)) &&+ (!q || `${a.name} ${a.title}`.toLowerCase().includes(q)),+ );const masterVisible = lead ? filtered.some((a) => a.agentId === lead.agentId) : false;// Orchestrators, then specialists; stable within a tier. The lead lives// in its own centered hero above and never repeats in the list.@@ -81,7 +112,9 @@ export function RosterRail({.filter((a) => a.agentId !== lead?.agentId).sort((a, b) => rank[a.tier] - rank[b.tier]);return { leadVisible: masterVisible, rows: rest };- }, [agents, lead, query]);+ }, [agents, hiddenIds, lead, query, showHidden]);++ const hiddenCount = agents.filter((agent) => hiddenIds.includes(agent.agentId)).length;return (<aside@@ -128,11 +161,17 @@ export function RosterRail({className="h-8 w-full rounded-md border border-border bg-background pl-8 pr-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong"/></label>+ {hiddenCount > 0 && <button type="button" onClick={() => setShowHidden((value) => !value)}+ className="mx-3 mt-2 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <Eye className="h-3.5 w-3.5" aria-hidden />+ {t(showHidden ? "society.roster.hide_hidden" : "society.roster.show_hidden").replace("{0}", String(hiddenCount))}+ </button>}<ScrollArea className="mt-2 min-h-0 flex-1">{lead && leadVisible ? (<div className="flex justify-center px-2 pb-2"><divdata-testid="society-lead-hero"+ onContextMenu={(event) => openMenu(event, lead.agentId)}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",@@ -179,9 +218,11 @@ export function RosterRail({{rows.map((agent) => (<li key={agent.agentId}><div+ onContextMenu={(event) => openMenu(event, agent.agentId)}className={cn("flex w-full items-center rounded-md px-2 text-left transition-colors hover:bg-secondary",agent.agentId === activeAgentId && "bg-secondary",+ hiddenIds.includes(agent.agentId) && "opacity-60",)}><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">@@ -206,6 +247,8 @@ export function RosterRail({))}</ul></ScrollArea>+ {menu && menuAgent && <AgentRosterActions key={menu.agentId} agent={menuAgent} roster={agents} sample={sample}+ hidden={hiddenIds.includes(menu.agentId)} x={menu.x} y={menu.y} onVisibilityChange={setHidden} onDismiss={closeMenu} />}{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/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 4d6161abba..74e5bb92cc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5303,7 +5303,21 @@"loading": "Agenten werden geladen…","empty": "Kein Agent passt.","thinking": "Denkt nach…",- "unread": "Neues Ergebnis — öffnen zum Lesen"+ "unread": "Neues Ergebnis — öffnen zum Lesen",+ "menu": "Agentenaktionen",+ "rename": "Agent umbenennen",+ "rename_hint": "Gib dem Agenten einen neuen Namen. Chat und Dateien bleiben verknüpft.",+ "name": "Agentenname",+ "rename_error": "Der Agent konnte nicht umbenannt werden. Prüfe den Namen oder wähle einen anderen.",+ "hide": "Aus der Seitenleiste ausblenden",+ "show": "In der Seitenleiste anzeigen",+ "show_hidden": "Ausgeblendete Agenten anzeigen ({0})",+ "hide_hidden": "Ausgeblendete Agenten verbergen ({0})",+ "delete": "Löschen",+ "delete_confirm": "{0} löschen? Der Agent wird aus deinem aktiven Team entfernt.",+ "delete_error": "Der Agent konnte nicht gelöscht werden. Versuche es erneut.",+ "cancel": "Abbrechen",+ "save": "Speichern"},"tier": {"lead": "Leitung",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex ca8e6d94cb..da6156d9a4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5336,7 +5336,21 @@"loading": "Loading agents…","empty": "No agent matches.","thinking": "Thinking…",- "unread": "New results — open to read"+ "unread": "New results — open to read",+ "menu": "Agent actions",+ "rename": "Rename agent",+ "rename_hint": "Choose a new name for this agent. Its chat and files stay linked.",+ "name": "Agent name",+ "rename_error": "Could not rename this agent. Check the name or try another one.",+ "hide": "Hide from sidebar",+ "show": "Show in sidebar",+ "show_hidden": "Show hidden agents ({0})",+ "hide_hidden": "Hide hidden agents ({0})",+ "delete": "Delete",+ "delete_confirm": "Delete {0}? This removes the agent from your active team.",+ "delete_error": "Could not delete this agent. Try again.",+ "cancel": "Cancel",+ "save": "Save"},"tier": {"lead": "Lead",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 6fb1fd8b1e..294440b235 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5349,7 +5349,21 @@"loading": "Cargando agentes…","empty": "Ningún agente coincide.","thinking": "Pensando…",- "unread": "Nuevos resultados — abre para leer"+ "unread": "Nuevos resultados — abre para leer",+ "menu": "Acciones del agente",+ "rename": "Cambiar nombre del agente",+ "rename_hint": "Elige un nombre nuevo. El chat y los archivos seguirán vinculados.",+ "name": "Nombre del agente",+ "rename_error": "No se pudo cambiar el nombre. Compruébalo o elige otro.",+ "hide": "Ocultar de la barra lateral",+ "show": "Mostrar en la barra lateral",+ "show_hidden": "Mostrar agentes ocultos ({0})",+ "hide_hidden": "Ocultar agentes ocultos ({0})",+ "delete": "Eliminar",+ "delete_confirm": "¿Eliminar a {0}? El agente dejará de aparecer en el equipo activo.",+ "delete_error": "No se pudo eliminar al agente. Inténtalo de nuevo.",+ "cancel": "Cancelar",+ "save": "Guardar"},"tier": {"lead": "Líder",diff --git a/jarvis/ui/web/society_routes.py b/jarvis/ui/web/society_routes.pyindex 182a06891b..de4532a258 100644--- a/jarvis/ui/web/society_routes.py+++ b/jarvis/ui/web/society_routes.py@@ -88,6 +88,7 @@ class CreateAgentBody(BaseModel):class PatchAgentBody(BaseModel):+ name: str | None = Field(default=None, min_length=1, max_length=40)title: str | None = Nonedescription: str | None = Nonetier: str | None = Nonediff --git a/tests/contract/test_society_substrate.py b/tests/contract/test_society_substrate.pyindex 3b3fc2f98d..d5a1461d74 100644--- a/tests/contract/test_society_substrate.py+++ b/tests/contract/test_society_substrate.py@@ -90,3 +90,28 @@ def test_two_agents_exchange_typed_messages_headless(tmp_path: Path) -> None:status = c.get("/api/society/status").json()assert status["agents"] == 3 # jarvis + scout + archivistassert status["kill_switch"] is False+++def test_roster_rename_and_archive_keep_identity_headless(tmp_path: Path) -> None:+ runtime = SocietyRuntime(+ tmp_path, seed_starter_team=False, mission_manager=lambda: FakeManager()+ )+ app = FastAPI()+ app.include_router(router)+ app.state.society_factory = lambda: runtime++ with TestClient(app) as client:+ created = client.post("/api/society/agents", json={"name": "Scout"}).json()["agent"]+ renamed = client.patch(+ f"/api/society/agents/{created['agent_id']}", json={"name": "Research Scout"}+ ).json()["agent"]+ assert renamed["agent_id"] == created["agent_id"]+ assert renamed["session_id"] == created["session_id"]+ assert renamed["name"] == "Research Scout"+ assert client.delete(f"/api/society/agents/{created['agent_id']}").status_code == 200+ visible = client.get("/api/society/agents").json()["agents"]+ assert all(agent["agent_id"] != created["agent_id"] for agent in visible)+ archived = client.get(+ "/api/society/agents", params={"include_archived": "true"}+ ).json()["agents"]+ assert any(agent["agent_id"] == created["agent_id"] for agent in archived)diff --git a/tests/unit/society/test_roster.py b/tests/unit/society/test_roster.pyindex 00640e156f..ca00018936 100644--- a/tests/unit/society/test_roster.py+++ b/tests/unit/society/test_roster.py@@ -131,6 +131,29 @@ async def test_archive_hides_from_default_list(roster: Roster):assert [a.state for a in archived] == [AgentState.ARCHIVED]+async def test_rename_keeps_identity_and_rejects_duplicate_name(roster: Roster):+ scout, _ = await roster.create(name="Scout")+ await roster.create(name="Planner")+ renamed = await roster.update(scout.agent_id, {"name": " Research Scout "})+ assert renamed.name == "Research Scout"+ assert renamed.agent_id == "scout"+ assert renamed.session_id == "society:scout"+ assert (await roster.resolve("Research Scout")).agent_id == "scout"++ with pytest.raises(RosterError) as duplicate:+ await roster.update(scout.agent_id, {"name": "planner"})+ assert duplicate.value.reason is FailureReason.BLOCKED_BY_POLICY+ assert (await roster.get("scout")).name == "Research Scout"++ with pytest.raises(RosterError):+ await roster.update(scout.agent_id, {"name": "bad/name"})++ await roster.create(name="Jarvis", tier=Tier.LEAD)+ with pytest.raises(RosterError) as lead:+ await roster.update("jarvis", {"name": "Other Lead"})+ assert lead.value.reason is FailureReason.TIER_NOT_ALLOWED++async def test_resolve_by_id_name_or_slug(roster: Roster):await roster.create(name="Mail Bot")assert (await roster.resolve("mail-bot")) is not Nonediff --git a/tests/unit/ui/web/test_society_routes.py b/tests/unit/ui/web/test_society_routes.pyindex 3a62398676..a447117408 100644--- a/tests/unit/ui/web/test_society_routes.py+++ b/tests/unit/ui/web/test_society_routes.py@@ -98,6 +98,20 @@ def test_patch_rederives_focus_on_description_change(client):assert explicit["focus"] == []+def test_rename_agent_keeps_chat_identity_and_rejects_duplicates(client):+ c, _ = client+ c.post("/api/society/agents", json={"name": "Scout"})+ c.post("/api/society/agents", json={"name": "Planner"})+ response = c.patch("/api/society/agents/scout", json={"name": "Research Scout"})+ assert response.status_code == 200+ agent = response.json()["agent"]+ assert agent["agent_id"] == "scout"+ assert agent["session_id"] == "society:scout"+ assert agent["name"] == "Research Scout"+ assert c.patch("/api/society/agents/scout", json={"name": "Planner"}).status_code == 409+ assert c.patch("/api/society/agents/jarvis", json={"name": "Other Lead"}).status_code == 409++def test_typed_errors(client):c, _ = clientassert c.get("/api/society/agents/ghost").status_code == 404