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(chat): one glyph per permission mode in the composer's pill and list

rubenluetke10-beepb88a51a7b82b
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index 1b4da9fe68..c9371c17f7 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -18,6 +18,7 @@ import { useAgentChatStore, type ProviderOption } from "@/store/agentChat";
import { useEventStore } from "@/store/events";
import { pickAgentChatFolder } from "@/lib/agentChatApi";
import { runningTurn } from "@/components/agentchat/reduce";
+import { permissionModeIcon } from "@/components/agentchat/permissionIcons";
import { useComposerDictation } from "@/components/agentchat/useComposerDictation";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
@@ -240,11 +241,23 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
);
const hasPlan = Boolean((provider?.permission_modes ?? []).some((m) => m.id === "plan"));
const planOn = draft.permissionMode === "plan";
+ // Every mode wears its stance's glyph (permissionIcons.ts) in the list and,
+ // once picked, on the pill — the Combobox draws the selected option's icon
+ // on its trigger, so the column's shield below only shows for a pick the
+ // catalog no longer lists.
const permissionGroups = useMemo<ComboboxGroup[]>(
() => [
{
id: "permission",
- options: permissionModes.map((m) => ({ value: m.id, label: m.label, searchText: m.description })),
+ options: permissionModes.map((m) => {
+ const Icon = permissionModeIcon(m.id);
+ return {
+ value: m.id,
+ label: m.label,
+ searchText: m.description,
+ icon: <Icon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />,
+ };
+ }),
},
],
[permissionModes],
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.test.ts
new file mode 100644
index 0000000000..3912d76f46
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.test.ts
@@ -0,0 +1,45 @@
+import {
+ Eye,
+ FilePen,
+ NotebookPen,
+ ShieldCheck,
+ ShieldOff,
+ ShieldQuestion,
+ ShieldX,
+ Sparkles,
+} from "lucide-react";
+import { describe, expect, it } from "vitest";
+
+import { permissionModeIcon } from "./permissionIcons";
+
+describe("permissionModeIcon", () => {
+ it("maps every vendor spelling of a stance onto the stance's one glyph", () => {
+ // Ask before acting — the unified ladder, Claude Code, and agy.
+ expect(permissionModeIcon("ask")).toBe(ShieldQuestion);
+ expect(permissionModeIcon("default")).toBe(ShieldQuestion);
+ expect(permissionModeIcon("approve-for-me")).toBe(ShieldQuestion);
+ // Edits go through.
+ expect(permissionModeIcon("accept-edits")).toBe(FilePen);
+ expect(permissionModeIcon("acceptEdits")).toBe(FilePen);
+ // Nothing asks.
+ expect(permissionModeIcon("bypass")).toBe(ShieldOff);
+ expect(permissionModeIcon("bypassPermissions")).toBe(ShieldOff);
+ expect(permissionModeIcon("full-access")).toBe(ShieldOff);
+ expect(permissionModeIcon("skip-permissions")).toBe(ShieldOff);
+ // The reading stances and the runner's own judgement.
+ expect(permissionModeIcon("plan")).toBe(NotebookPen);
+ expect(permissionModeIcon("read-only")).toBe(Eye);
+ expect(permissionModeIcon("auto")).toBe(Sparkles);
+ expect(permissionModeIcon("dontAsk")).toBe(ShieldX);
+ });
+
+ it("gives an id it has never seen the column's shield, never nothing", () => {
+ expect(permissionModeIcon("something-new")).toBe(ShieldCheck);
+ expect(permissionModeIcon("")).toBe(ShieldCheck);
+ });
+
+ it("keeps the four stances of the unified ladder visually distinct", () => {
+ const glyphs = ["ask", "accept-edits", "plan", "bypass"].map(permissionModeIcon);
+ expect(new Set(glyphs).size).toBe(glyphs.length);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.ts b/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.ts
new file mode 100644
index 0000000000..0c1090b502
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentchat/permissionIcons.ts
@@ -0,0 +1,49 @@
+import {
+ Eye,
+ FilePen,
+ NotebookPen,
+ ShieldCheck,
+ ShieldOff,
+ ShieldQuestion,
+ ShieldX,
+ Sparkles,
+ type LucideIcon,
+} from "lucide-react";
+
+/**
+ * One glyph per permission STANCE, not per vendor spelling.
+ *
+ * The composer's permission pill draws whatever ladder the catalog delivers
+ * (jarvis/agent_chat/permissions.py): the unified ladder on the front page
+ * (`ask` / `accept-edits` / `plan` / `bypass`) and, for an IDE session, a
+ * runner's own ids (`default`, `acceptEdits`, `bypassPermissions`, `auto`,
+ * `read-only`, `full-access`, …). Several of those mean the same thing, so
+ * they wear the same glyph — a person who learned "the pen means edits go
+ * through" recognises it on every provider. Anything unknown falls back to
+ * the column's shield so a new ladder entry is never blank.
+ */
+const GLYPHS: Record<string, LucideIcon> = {
+ // Ask before acting.
+ ask: ShieldQuestion,
+ default: ShieldQuestion,
+ "approve-for-me": ShieldQuestion,
+ // Edits go through, everything else asks.
+ "accept-edits": FilePen,
+ acceptEdits: FilePen,
+ // Nothing asks.
+ bypass: ShieldOff,
+ bypassPermissions: ShieldOff,
+ "full-access": ShieldOff,
+ "skip-permissions": ShieldOff,
+ // Reads and plans, changes nothing.
+ plan: NotebookPen,
+ "read-only": Eye,
+ // The runner decides on its own.
+ auto: Sparkles,
+ // Never asks — and refuses what it would have asked about.
+ dontAsk: ShieldX,
+};
+
+export function permissionModeIcon(id: string): LucideIcon {
+ return GLYPHS[id] ?? ShieldCheck;
+}
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
index 241381c524..696cfbf9be 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
@@ -228,6 +228,46 @@ describe("ChatStage (agent chat)", () => {
expect(new Set(glyphs).size).toBe(glyphs.length);
});
+ it("wears one glyph per stance on the unified ladder", async () => {
+ // The front page's catalog hands every provider the same four-step ladder
+ // (jarvis/agent_chat/permissions.py, surface=jarvis); the composer draws
+ // what it is given and never a ladder typed here.
+ const unified = [
+ { id: "ask", label: "Ask before acting", description: "" },
+ { id: "accept-edits", label: "Auto-accept edits", description: "" },
+ { id: "plan", label: "Plan", description: "" },
+ { id: "bypass", label: "Bypass permissions", description: "" },
+ ];
+ useAgentChatStore.setState((s) => ({
+ catalog: {
+ ...CATALOG,
+ providers: CATALOG.providers.map((p) => ({
+ ...p,
+ permission_modes: unified,
+ default_permission_mode: "ask",
+ })),
+ },
+ draft: { ...s.draft, permissionMode: "ask", buildMode: "ask" },
+ }));
+ render(<ChatStage />);
+ const pill = screen.getByTestId("composer-permission");
+ expect(pill.getAttribute("data-value")).toBe("ask");
+ expect(pill.querySelector("svg.lucide-shield-question")).not.toBeNull();
+ expect(pill.querySelector("svg.lucide-shield-check")).toBeNull();
+ fireEvent.click(pill);
+ const panel = await screen.findByTestId("composer-permission-panel");
+ const rows = within(panel).getAllByRole("option");
+ // Plan is the switch next door, so the list holds the other three.
+ expect(rows.map((el) => el.getAttribute("data-value"))).toEqual(["ask", "accept-edits", "bypass"]);
+ const glyphs = rows.map((el) => el.querySelector("svg")?.getAttribute("class") ?? "");
+ expect(glyphs[0]).toContain("lucide-shield-question");
+ expect(glyphs[1]).toContain("lucide-file-pen");
+ expect(glyphs[2]).toContain("lucide-shield-off");
+ expect(new Set(glyphs).size).toBe(glyphs.length);
+ // The plan entry still powers the Build | Plan switch.
+ expect(screen.getByTestId("composer-plan").getAttribute("aria-checked")).toBe("false");
+ });
+
it("grows the text box with the typed text and caps it at its max height", () => {
render(<ChatStage />);
const box = screen.getByPlaceholderText("Ask anything…") as HTMLTextAreaElement;