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(agentic-ide): IDE tools and a command palette in the window caption
rubenluetke10-beep21abacb04f5e
diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeCommandPalette.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeCommandPalette.tsxnew file mode 100644index 0000000000..167fe64ce5--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeCommandPalette.tsx@@ -0,0 +1,175 @@+/**+ * The Agentic IDE's command palette: every IDE action in one searchable list,+ * each row showing the keys that reach it without the palette.+ *+ * Opened from the search field in the window caption or its chord (Ctrl+Shift+P,+ * ⌘⇧P on a Mac, rebindable under Settings → Keyboard shortcuts). The rows come+ * from `buildIdeCommands`; picking one closes the palette first, so a command+ * that opens a dialog or acts on the selected pane gets the keyboard back.+ *+ * Radix Dialog owns Escape, the focus trap and handing focus back to the pane+ * the user came from.+ */+import * as Dialog from "@radix-ui/react-dialog";+import { Command } from "cmdk";+import {+ ArrowRightLeft, Building2, Columns2, CopyPlus, CornerDownLeft, FolderPlus, GitBranch, GitFork, LayoutGrid,+ Maximize2, MessagesSquare, Mic, PanelRight, Pencil, Plus, Rows2, Search, Settings2, SquareTerminal, X,+ type LucideIcon,+} from "lucide-react";+import { useMemo, useState } from "react";+import { cn } from "@/lib/utils";+import { AgentMark } from "./AgentMark";+import {+ IDE_COMMAND_GROUPS, IDE_COMMAND_GROUP_LABEL, ideCommandMatches,+ type IdeCommand, type IdeCommandRun,+} from "./ideCommands";++const ROW = cn(+ "group flex h-10 cursor-default select-none items-center gap-3 rounded-lg px-2.5 text-sm",+ "text-foreground outline-none",+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground",+);++const TILE = cn(+ "grid h-6 w-6 shrink-0 place-items-center rounded-md bg-secondary text-muted-foreground",+ "group-data-[selected=true]:bg-white/20 group-data-[selected=true]:text-accent-foreground",+);++const GROUP = cn(+ "[&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2.5",+ "[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",+ "[&_[cmdk-group-heading]]:text-muted-foreground",+);++const CAP = cn(+ "inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded border border-border bg-muted px-1",+ "font-mono text-[11px] font-medium leading-none text-foreground",+ "group-data-[selected=true]:border-white/30 group-data-[selected=true]:bg-white/15 group-data-[selected=true]:text-accent-foreground",+);++/** The glyph a row wears, by what it does. */+function iconFor(command: IdeCommand): LucideIcon {+ const run = command.run;+ if (run.type === "face") return run.face === "grid" ? LayoutGrid : run.face === "threads" ? MessagesSquare : Building2;+ if (run.type === "panel-tab" || run.type === "panel-toggle") return PanelRight;+ switch (run.action.kind) {+ case "agent-picker": return Plus;+ case "split": return run.action.direction === "right" ? Columns2 : Rows2;+ case "maximize-pane": return Maximize2;+ case "balance": return LayoutGrid;+ case "fork-pane": return GitFork;+ case "close-pane":+ case "close-workspace": return X;+ case "new-workspace": return CopyPlus;+ case "new-worktree-workspace":+ case "git-panel": return GitBranch;+ case "workspace-options": return Settings2;+ case "rename-workspace": return Pencil;+ case "connect-project": return FolderPlus;+ case "workspace-step":+ case "workspace-index": return ArrowRightLeft;+ case "toggle-voice": return Mic;+ default: return SquareTerminal;+ }+}++/** "Ctrl B · W · N": one cap group per key press, a dot between presses. */+function KeySequence({ keys }: { keys: string[][] }) {+ if (keys.length === 0) return null;+ return <span className="ml-auto inline-flex shrink-0 items-center gap-1.5 pl-3" aria-hidden>+ {keys.map((press, index) => <span key={index} className="inline-flex items-center gap-1">+ {index > 0 && <span className="text-[10px] text-muted-foreground group-data-[selected=true]:text-accent-foreground/70">·</span>}+ {press.map((key) => <kbd key={key} className={CAP}>{key}</kbd>)}+ </span>)}+ </span>;+}++/** The keys as one sentence for a screen reader, which skips the caps. */+function spokenKeys(keys: string[][]): string {+ return keys.map((press) => press.join("+")).join(", then ");+}++export function IdeCommandPalette({ open, onOpenChange, commands, onRun }: {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ commands: readonly IdeCommand[];+ onRun: (run: IdeCommandRun) => void;+}) {+ const [query, setQuery] = useState("");+ const [selected, setSelected] = useState("");+ const shown = useMemo(() => commands.filter((command) => ideCommandMatches(command, query)), [commands, query]);++ const close = () => {+ onOpenChange(false);+ setQuery("");+ };+ const pick = (command: IdeCommand) => {+ close();+ // After the dialog has handed focus back, so a pane command finds its pane+ // and a dialog the command opens does not fight this one for focus.+ window.setTimeout(() => onRun(command.run), 0);+ };++ return <Dialog.Root open={open} onOpenChange={(next) => { if (!next) setQuery(""); onOpenChange(next); }}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 z-[80]" />+ <Dialog.Content+ data-testid="ide-command-palette"+ aria-describedby={undefined}+ className={cn(+ "fixed left-1/2 top-12 z-[90] w-[min(640px,calc(100vw-2rem))] -translate-x-1/2",+ "overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-float",+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1",+ "motion-reduce:animate-none",+ )}+ >+ <Dialog.Title className="sr-only">IDE commands</Dialog.Title>+ <Command shouldFilter={false} loop label="IDE commands" value={selected} onValueChange={setSelected}>+ <div className="flex items-center gap-2.5 border-b border-border px-3.5">+ <Search className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />+ <Command.Input+ autoFocus+ value={query}+ onValueChange={(value) => { setQuery(value); setSelected(""); }}+ placeholder="Type a command — split, git, new workspace, Claude …"+ data-testid="ide-command-palette-input"+ className="h-12 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"+ />+ </div>+ <Command.List className="max-h-[min(28rem,60dvh)] overflow-y-auto p-1.5 scrollbar-jarvis">+ <Command.Empty className="px-3 py-6 text-center text-sm text-muted-foreground">No command matches.</Command.Empty>+ {IDE_COMMAND_GROUPS.map((group) => {+ const rows = shown.filter((command) => command.group === group);+ if (rows.length === 0) return null;+ return <Command.Group key={group} heading={IDE_COMMAND_GROUP_LABEL[group]} className={GROUP}>+ {rows.map((command) => {+ const Icon = iconFor(command);+ return <Command.Item key={command.id} value={command.id} onSelect={() => pick(command)}+ data-testid={`ide-command-${command.id}`} className={ROW}+ aria-label={command.keys.length ? `${command.label} (${spokenKeys(command.keys)})` : command.label}>+ {command.agent+ ? <AgentMark agent={command.agent} label={command.label} size="sm" variant="plain" />+ : <span className={TILE}><Icon className="h-3.5 w-3.5" aria-hidden /></span>}+ <span className="min-w-0 truncate">{command.label}</span>+ <KeySequence keys={command.keys} />+ </Command.Item>;+ })}+ </Command.Group>;+ })}+ </Command.List>+ <div className="flex items-center justify-end gap-4 border-t border-border px-3.5 py-2 text-xs text-muted-foreground">+ <span className="inline-flex items-center gap-1.5">+ <kbd className="inline-flex h-5 items-center rounded border border-border px-1 font-sans"><CornerDownLeft className="h-3 w-3" aria-hidden /></kbd>+ run+ </span>+ <span className="inline-flex items-center gap-1.5">+ <kbd className="inline-flex h-5 items-center rounded border border-border px-1 font-sans">esc</kbd>+ close+ </span>+ </div>+ </Command>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>;+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/ideCommands.test.ts b/jarvis/ui/web/frontend/src/components/agentic/ideCommands.test.tsnew file mode 100644index 0000000000..572f7fab9f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/ideCommands.test.ts@@ -0,0 +1,88 @@+import { describe, expect, it } from "vitest";+import { buildIdeCommands, ideCommandMatches, type IdeCommandContext } from "./ideCommands";++const base: IdeCommandContext = {+ agents: [{ name: "claude", label: "Claude Code", key: "c" }, { name: "codex", label: "Codex", key: "x" }],+ leaderCaps: ["Ctrl", "B"],+ hasSession: true,+ threads: false,+ workspaces: [{ id: "w1", name: "Jarvis" }, { id: "w2", name: "Website" }],+ activeWorkspaceId: "w1",+ panelTabs: [{ id: "agents", label: "Agents" }, { id: "git", label: "Git" }],+ panelOpen: false,+ face: "grid",+};++const ids = (context: IdeCommandContext) => buildIdeCommands(context).map((command) => command.id);++describe("buildIdeCommands", () => {+ it("offers a pane per installed agent with the key menu's own keys", () => {+ const claude = buildIdeCommands(base).find((command) => command.id === "spawn:claude");+ expect(claude?.label).toBe("New Claude Code pane");+ expect(claude?.keys).toEqual([["Ctrl", "B"], ["C"], ["Enter"]]);+ expect(claude?.run).toEqual({ type: "hotkey", action: { kind: "spawn", agent: "claude", direction: null } });+ });++ it("teaches the two-step workspace keys", () => {+ const git = buildIdeCommands(base).find((command) => command.id === "git-panel");+ expect(git?.keys).toEqual([["Ctrl", "B"], ["W"], ["G"]]);+ });++ it("leaves out pane and workspace commands without a workspace", () => {+ const list = ids({ ...base, hasSession: false, workspaces: [], activeWorkspaceId: null });+ expect(list).not.toContain("split-right");+ expect(list).not.toContain("spawn:claude");+ expect(list).not.toContain("git-panel");+ expect(list).toContain("new-workspace");+ expect(list).toContain("connect-project");+ });++ it("drops grid commands and every shortcut in the thread layout", () => {+ const commands = buildIdeCommands({ ...base, threads: true, face: "threads" });+ expect(commands.map((command) => command.id)).not.toContain("split-right");+ expect(commands.every((command) => command.keys.length === 0)).toBe(true);+ expect(commands.map((command) => command.id)).toContain("face:grid");+ expect(commands.map((command) => command.id)).not.toContain("face:threads");+ });++ it("shows no keys when the key menu chord is switched off", () => {+ expect(buildIdeCommands({ ...base, leaderCaps: [] }).every((command) => command.keys.length === 0)).toBe(true);+ });++ it("lists the other workspaces by number, never the one in front", () => {+ const list = ids(base);+ expect(list).toContain("workspace:w2");+ expect(list).not.toContain("workspace:w1");+ const website = buildIdeCommands(base).find((command) => command.id === "workspace:w2");+ expect(website?.keys).toEqual([["Ctrl", "B"], ["2"]]);+ });++ it("names the side panel toggle after what it will do", () => {+ const closed = buildIdeCommands(base).find((command) => command.id === "panel-toggle");+ const open = buildIdeCommands({ ...base, panelOpen: true }).find((command) => command.id === "panel-toggle");+ expect(closed?.label).toBe("Open side panel");+ expect(open?.label).toBe("Close side panel");+ });++ it("gives every command a unique id", () => {+ const list = ids(base);+ expect(new Set(list).size).toBe(list.length);+ });+});++describe("ideCommandMatches", () => {+ const commands = buildIdeCommands(base);+ const find = (query: string) => commands.filter((command) => ideCommandMatches(command, query)).map((command) => command.id);++ it("matches every word in any order", () => {+ expect(find("right split")).toEqual(["split-right"]);+ });++ it("matches keywords, not only the label", () => {+ expect(find("maximize")).toContain("maximize-pane");+ });++ it("keeps everything for an empty query", () => {+ expect(find(" ")).toHaveLength(commands.length);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/ideCommands.ts b/jarvis/ui/web/frontend/src/components/agentic/ideCommands.tsnew file mode 100644index 0000000000..5f88109322--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/ideCommands.ts@@ -0,0 +1,171 @@+/**+ * Every command the Agentic IDE's command palette offers, as plain data.+ *+ * The palette is the searchable twin of the Ctrl+B key menu: each row runs the+ * same `IdeHotkeyAction` the key menu runs, and shows the keys that reach it+ * from the keyboard, so picking a command once teaches its shortcut. The views+ * (grid, threads, Verse) and the side panel tabs are here too, because the+ * caption and the panel header are the only other way to reach them.+ *+ * Pure on purpose: the list is built from what the view knows (installed+ * agents, open workspaces, the layout) and is testable without a DOM.+ */+import type { SidePanelTabId } from "@/store/ideSidePanel";+import type { IdeFace } from "./threads/IdeLayoutSwitch";+import type { AgentKey, IdeHotkeyAction } from "./ideHotkeys";++export type IdeCommandGroup = "agents" | "panes" | "workspaces" | "view";++/** The order the palette lists its groups in. */+export const IDE_COMMAND_GROUPS: readonly IdeCommandGroup[] = ["agents", "panes", "workspaces", "view"];++export const IDE_COMMAND_GROUP_LABEL: Record<IdeCommandGroup, string> = {+ agents: "Agents",+ panes: "Panes",+ workspaces: "Workspaces",+ view: "View",+};++/** What picking a command does. */+export type IdeCommandRun =+ | { type: "hotkey"; action: IdeHotkeyAction }+ | { type: "face"; face: IdeFace }+ | { type: "panel-tab"; tab: SidePanelTabId }+ | { type: "panel-toggle" };++export interface IdeCommand {+ /** Stable and unique: the palette's row value and test id. */+ id: string;+ group: IdeCommandGroup;+ label: string;+ /** Extra words the search matches besides the label. */+ keywords: string[];+ /**+ * The key presses that reach the same command, one inner list per press:+ * `[["Ctrl", "B"], ["V"]]` reads "Ctrl+B, then V". Empty when no key does.+ */+ keys: string[][];+ run: IdeCommandRun;+ /** Agent rows carry the agent so the palette can draw its mark. */+ agent?: string;+}++export interface IdeCommandContext {+ /** Installed coding agents with their key-menu letters. */+ agents: readonly AgentKey[];+ /** Keycaps of the key-menu chord; empty when the user switched it off. */+ leaderCaps: readonly string[];+ /** A workspace is open, so pane and workspace commands have a target. */+ hasSession: boolean;+ /** The thread layout is on: the grid and its key menu are out of view. */+ threads: boolean;+ /** Open workspaces in tab order, and which one is in front. */+ workspaces: readonly { id: string; name: string }[];+ activeWorkspaceId: string | null;+ /** Side panel tabs with their labels already translated. */+ panelTabs: readonly { id: SidePanelTabId; label: string }[];+ panelOpen: boolean;+ face: IdeFace;+}++/**+ * The palette's full list for this moment.+ *+ * Commands that cannot do anything right now are left out rather than greyed:+ * without a workspace there is no pane to split, and in the thread layout the+ * grid commands would act on terminals nobody can see.+ */+export function buildIdeCommands(context: IdeCommandContext): IdeCommand[] {+ const { agents, leaderCaps, hasSession, threads, workspaces, activeWorkspaceId, panelTabs, panelOpen, face } = context;+ // The key menu only listens in the grid; a shortcut that does nothing in the+ // threads would teach the wrong thing.+ const viaLeader = (...steps: string[][]): string[][] =>+ !threads && leaderCaps.length > 0 ? [[...leaderCaps], ...steps] : [];+ const commands: IdeCommand[] = [];+ const hotkey = (+ id: string, group: IdeCommandGroup, label: string, action: IdeHotkeyAction,+ keys: string[][], keywords: string[] = [],+ ) => commands.push({ id, group, label, keywords, keys, run: { type: "hotkey", action } });++ if (hasSession && !threads) {+ hotkey("agent-picker", "agents", "Add coding agent…", { kind: "agent-picker" }, viaLeader(["+"]), ["new", "pane", "terminal", "spawn"]);+ for (const agent of agents) {+ commands.push({+ id: `spawn:${agent.name}`,+ group: "agents",+ label: `New ${agent.label} pane`,+ keywords: [agent.name, "open", "start", "terminal", "agent"],+ keys: viaLeader([agent.key.toUpperCase()], ["Enter"]),+ run: { type: "hotkey", action: { kind: "spawn", agent: agent.name, direction: null } },+ agent: agent.name,+ });+ }+ hotkey("split-right", "panes", "Split pane right", { kind: "split", direction: "right" }, viaLeader(["V"]), ["vertical", "side"]);+ hotkey("split-down", "panes", "Split pane down", { kind: "split", direction: "down" }, viaLeader(["-"]), ["horizontal", "below"]);+ hotkey("maximize-pane", "panes", "Zoom pane (fill the grid)", { kind: "maximize-pane" }, viaLeader(["Z"]), ["maximize", "fullscreen", "focus"]);+ hotkey("balance", "panes", "Even out the grid", { kind: "balance" }, viaLeader(["E"]), ["balance", "equal", "layout", "arrange"]);+ hotkey("fork-pane", "panes", "Fork pane", { kind: "fork-pane" }, viaLeader(["F"]), ["copy", "duplicate", "branch"]);+ hotkey("close-pane", "panes", "Close pane", { kind: "close-pane" }, viaLeader(["Q"]), ["stop", "kill", "end"]);+ }++ hotkey("new-workspace", "workspaces", "New workspace", { kind: "new-workspace" }, viaLeader(["W"], ["N"]), ["create", "session"]);+ if (hasSession) {+ hotkey("new-worktree-workspace", "workspaces", "New workspace in a git worktree", { kind: "new-worktree-workspace" }, viaLeader(["W"], ["T"]), ["branch", "git", "isolated"]);+ hotkey("git-panel", "workspaces", "Git: branches, commits and worktrees", { kind: "git-panel" }, viaLeader(["W"], ["G"]), ["commit", "branch", "push", "diff"]);+ hotkey("workspace-options", "workspaces", "Workspace options", { kind: "workspace-options" }, viaLeader(["W"], ["O"]), ["settings", "appearance", "style"]);+ hotkey("rename-workspace", "workspaces", "Rename workspace", { kind: "rename-workspace" }, viaLeader(["W"], ["R"]), ["name", "title"]);+ hotkey("close-workspace", "workspaces", "Close workspace", { kind: "close-workspace" }, viaLeader(["W"], ["Q"]), ["stop", "end"]);+ }+ hotkey("connect-project", "workspaces", "Connect a project folder…", { kind: "connect-project" }, viaLeader(["W"], ["P"]), ["open", "folder", "add", "repository"]);+ if (workspaces.length > 1) {+ hotkey("workspace-next", "workspaces", "Next workspace", { kind: "workspace-step", step: 1 }, viaLeader(["N"]), ["switch", "forward"]);+ hotkey("workspace-previous", "workspaces", "Previous workspace", { kind: "workspace-step", step: -1 }, viaLeader(["P"]), ["switch", "back"]);+ workspaces.slice(0, 9).forEach((workspace, index) => {+ if (workspace.id === activeWorkspaceId) return;+ hotkey(`workspace:${workspace.id}`, "workspaces", `Go to workspace ${workspace.name}`,+ { kind: "workspace-index", index }, viaLeader([String(index + 1)]), ["switch", "open"]);+ });+ }++ const faces: { face: IdeFace; label: string; keywords: string[] }[] = [+ { face: "grid", label: "Show the terminal grid", keywords: ["layout", "panes", "terminals"] },+ { face: "threads", label: "Show threads", keywords: ["layout", "chat", "conversation"] },+ { face: "verse", label: "Show the Jarvis Verse", keywords: ["office", "world", "3d", "map"] },+ ];+ for (const entry of faces) {+ if (entry.face === face) continue;+ commands.push({ id: `face:${entry.face}`, group: "view", label: entry.label, keywords: entry.keywords, keys: [], run: { type: "face", face: entry.face } });+ }+ commands.push({+ id: "panel-toggle",+ group: "view",+ label: panelOpen ? "Close side panel" : "Open side panel",+ keywords: ["sidebar", "right", "panel", "toggle"],+ keys: [],+ run: { type: "panel-toggle" },+ });+ for (const tab of panelTabs) {+ commands.push({+ id: `panel:${tab.id}`,+ group: "view",+ label: `Side panel: ${tab.label}`,+ keywords: ["open", "show", "tab", tab.id],+ keys: [],+ run: { type: "panel-tab", tab: tab.id },+ });+ }+ hotkey("toggle-voice", "view", "Show or hide voice", { kind: "toggle-voice" }, viaLeader(["M"]), ["microphone", "talk", "speak", "call"]);+ return commands;+}++/**+ * Does `command` match what was typed? Every word of the query must appear in+ * the label, a keyword or the group — so "split right" and "right split" both+ * find the same row, and "git" finds every git command.+ */+export function ideCommandMatches(command: IdeCommand, query: string): boolean {+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);+ if (words.length === 0) return true;+ const haystack = [command.label, IDE_COMMAND_GROUP_LABEL[command.group], ...command.keywords].join(" ").toLowerCase();+ return words.every((word) => haystack.includes(word));+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsxindex 9a0cbdec3d..99f3c5fc69 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx@@ -2,6 +2,7 @@ import { act, cleanup, fireEvent, render, screen } from "@testing-library/react"import { useIdeChatStore } from "@/store/ideChat";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { IdeSidePanelFrame } from "./IdeSidePanel";+import { IdeSidePanelToggle } from "./IdeSidePanelToggle";import { useEventStore } from "@/store/events";import { useIdeProjectsStore } from "@/store/ideProjects";import { useIdeSidePanelStore } from "@/store/ideSidePanel";@@ -25,6 +26,7 @@ vi.mock("@/components/society/office/OfficeStage", () => ({function Harness() {return (<>+ <IdeSidePanelToggle /><IdeSidePanelFrame><div data-testid="grid">grid</div></IdeSidePanelFrame>@@ -63,7 +65,7 @@ describe("IdeSidePanel", () => {expect(screen.getByRole("tab", { name: "Terminal 2" })).toBeTruthy();fireEvent.click(screen.getByTestId("ide-side-panel-tab-agents"));expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);- fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);expect(firstNode.dataset.active).toBe("false");fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));@@ -113,7 +115,7 @@ describe("IdeSidePanel", () => {expect(screen.getByTestId("ide-side-panel-resizer")).toBeTruthy();expect(localStorage.getItem("jarvis.agenticIde.sidePanelOpen")).toBe("1");- fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));expect(screen.queryByTestId("ide-side-panel")).toBeNull();expect(localStorage.getItem("jarvis.agenticIde.sidePanelOpen")).toBe("0");});@@ -122,7 +124,7 @@ describe("IdeSidePanel", () => {render(<Harness />);const grid = screen.getByTestId("grid");fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));- fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));expect(screen.getByTestId("grid")).toBe(grid);});@@ -237,7 +239,7 @@ describe("IdeSidePanel", () => {act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["agents"], active: "agents" }));render(<Harness />);fireEvent.click(screen.getByTestId("ide-side-panel-maximize"));- fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));expect(useIdeSidePanelStore.getState().maximized).toBe(false);});diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsxindex 55e86ee429..be24cc587b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx@@ -1,5 +1,5 @@import { useEffect, useRef, useState, type ReactNode } from "react";-import { Check, Maximize2, Minimize2, MoveHorizontal, PanelRightClose, Plus, SquareTerminal, X } from "lucide-react";+import { Check, Maximize2, Minimize2, MoveHorizontal, Plus, SquareTerminal, X } from "lucide-react";import { fill, useT } from "@/i18n";import { cn } from "@/lib/utils";import { useResizablePane } from "@/hooks/useResizablePane";@@ -215,7 +215,10 @@ function IdeSidePanelRail() {);}-/** The panel itself: tab header ("+" and collapse) over the active tab's content. */+/**+ * The panel itself: tab header ("+" and maximize) over the active tab's content.+ * It opens and closes from the window caption (`IdeSidePanelToggle`).+ */export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: TerminalAppearance; onScreen?: boolean }) {const t = useT();const allTabs = useIdeSidePanelStore((state) => state.tabs);@@ -230,7 +233,6 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Terconst select = useIdeSidePanelStore((state) => state.select);const openTab = useIdeSidePanelStore((state) => state.openTab);const closeTab = useIdeSidePanelStore((state) => state.closeTab);- const setOpen = useIdeSidePanelStore((state) => state.setOpen);const maximized = useIdeSidePanelStore((state) => state.maximized);const setMaximized = useIdeSidePanelStore((state) => state.setMaximized);const [menuOpen, setMenuOpen] = useState(false);@@ -358,18 +360,6 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Ter>{maximized ? <Minimize2 className="h-4 w-4" aria-hidden /> : <Maximize2 className="h-4 w-4" aria-hidden />}</button>- <button- type="button"- data-testid="ide-side-panel-collapse"- aria-label={t("ide_side_panel.collapse")}- title={t("ide_side_panel.collapse")}- aria-controls={SIDE_PANEL_ID}- aria-expanded- onClick={() => setOpen(false)}- className={HEADER_BTN}- >- <PanelRightClose className="h-4 w-4" aria-hidden />- </button></div>{/* Keyed by tab: Changes and Folder share one component and must not share its state. */}<div id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="relative min-h-0 flex-1">diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsxnew file mode 100644index 0000000000..3d8d10f21f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx@@ -0,0 +1,41 @@+import { PanelRightClose, PanelRightOpen } from "lucide-react";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import { useIdeSidePanelStore } from "@/store/ideSidePanel";+import { SIDE_PANEL_ID } from "./sidePanelIds";++/**+ * Opens and shuts the Agentic IDE's right-hand side panel.+ *+ * It lives at the right end of the window caption, beside the window buttons,+ * so it stays in the same place whether the panel is open or shut; the closed+ * panel's rail is the second way in. Kept free of the panel's own module: the+ * caption is in the startup chunk and must not pull the panel's tabs into it.+ */+export function IdeSidePanelToggle({ className }: { className?: string }) {+ const t = useT();+ const open = useIdeSidePanelStore((state) => state.open);+ const setOpen = useIdeSidePanelStore((state) => state.setOpen);+ const label = t(open ? "ide_side_panel.collapse" : "ide_side_panel.expand");+ const Icon = open ? PanelRightClose : PanelRightOpen;+ return (+ <button+ type="button"+ onClick={() => setOpen(!open)}+ title={label}+ aria-label={label}+ aria-expanded={open}+ aria-controls={SIDE_PANEL_ID}+ data-testid="ide-side-panel-toggle"+ className={cn(+ "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md",+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ open && "text-foreground",+ className,+ )}+ >+ <Icon aria-hidden className="h-4 w-4" />+ </button>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsxindex a05be7f86d..a0320ee613 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx@@ -1,4 +1,3 @@-import { useRef } from "react";import { Building2, LayoutGrid, MessagesSquare } from "lucide-react";import { cn } from "@/lib/utils";import {@@ -8,9 +7,10 @@ import {import { useIdeSidePanelStore, type SidePanelTabId } from "@/store/ideSidePanel";import { useIdeThreadsStore, type IdeLayout } from "@/store/ideThreads";-type Choice = IdeLayout | "verse";+/** One face of the Agentic IDE: a layout of the terminals, or the Verse over them. */+export type IdeFace = IdeLayout | "verse";-const CHOICES: { choice: Choice; label: string; Icon: typeof LayoutGrid }[] = [+const CHOICES: { choice: IdeFace; label: string; Icon: typeof LayoutGrid }[] = [{ choice: "grid", label: "Terminal grid", Icon: LayoutGrid },{ choice: "threads", label: "Threads", Icon: MessagesSquare },{ choice: "verse", label: "Jarvis Verse", Icon: Building2 },@@ -23,6 +23,47 @@ interface PanelBefore {hadOffice: boolean;}+// Module-level, not per component: the caption switch and the command palette+// both change faces, and leaving the Verse must restore the panel whichever+// of them entered it.+let before: PanelBefore | null = null;++/** Is the Verse (the office, maximized over the whole view) on right now? */+function verseIsOn(): boolean {+ const panel = useIdeSidePanelStore.getState();+ return panel.open && panel.maximized && panel.active === "office";+}++function enterVerse(): void {+ const panel = useIdeSidePanelStore.getState();+ before = { open: panel.open, active: panel.active, hadOffice: panel.tabs.includes("office") };+ panel.openTab("office");+ useIdeSidePanelStore.getState().setMaximized(true);+}++function leaveVerse(): void {+ const panel = useIdeSidePanelStore.getState();+ panel.setMaximized(false);+ const prior = before;+ before = null;+ // Entered some other way (the panel's own maximize button): just restore.+ if (!prior) return;+ if (!prior.hadOffice) panel.closeTab("office");+ const after = useIdeSidePanelStore.getState();+ if (!prior.open) after.setOpen(false);+ else after.select(prior.active);+}++/** Show one face of the IDE, from the caption switch or anywhere else. */+export function pickIdeFace(choice: IdeFace): void {+ if (choice === "verse") {+ if (!verseIsOn()) enterVerse();+ return;+ }+ if (verseIsOn()) leaveVerse();+ useIdeThreadsStore.getState().setLayout(choice);+}+/*** Grid, threads or the Jarvis Verse — the three faces of the Agentic IDE. Sits* in the middle of the window caption: a rounded track with one thumb that@@ -35,41 +76,10 @@ interface PanelBefore {*/export function IdeLayoutSwitch({ className }: { className?: string }) {const layout = useIdeThreadsStore((state) => state.layout);- const setLayout = useIdeThreadsStore((state) => state.setLayout);const verseOn = useIdeSidePanelStore((state) => state.open && state.maximized && state.active === "office");- const before = useRef<PanelBefore | null>(null);- const current: Choice = verseOn ? "verse" : layout;+ const current: IdeFace = verseOn ? "verse" : layout;const index = Math.max(0, CHOICES.findIndex((item) => item.choice === current));- const enterVerse = () => {- const panel = useIdeSidePanelStore.getState();- before.current = { open: panel.open, active: panel.active, hadOffice: panel.tabs.includes("office") };- panel.openTab("office");- useIdeSidePanelStore.getState().setMaximized(true);- };-- const leaveVerse = () => {- const panel = useIdeSidePanelStore.getState();- panel.setMaximized(false);- const prior = before.current;- before.current = null;- // Entered some other way (the panel's own maximize button): just restore.- if (!prior) return;- if (!prior.hadOffice) panel.closeTab("office");- const after = useIdeSidePanelStore.getState();- if (!prior.open) after.setOpen(false);- else after.select(prior.active);- };-- const pick = (choice: Choice) => {- if (choice === "verse") {- if (!verseOn) enterVerse();- return;- }- if (verseOn) leaveVerse();- setLayout(choice);- };-return <div role="radiogroup" aria-label="IDE layout" data-testid="ide-layout-switch"className={cn(CAPTION_TRACK, className)}><span aria-hidden@@ -77,7 +87,7 @@ export function IdeLayoutSwitch({ className }: { className?: string }) {className={CAPTION_THUMB} />{CHOICES.map(({ choice, label, Icon }) => <button key={choice} type="button" role="radio"data-testid={`ide-layout-${choice}`} aria-checked={current === choice} aria-label={label} title={label}- onClick={() => pick(choice)}+ onClick={() => pickIdeFace(choice)}style={{ width: SEGMENT_PX }}className={cn(CAPTION_SEGMENT, current === choice ? CAPTION_SEGMENT_ON : CAPTION_SEGMENT_OFF)}><Icon aria-hidden className={CAPTION_ICON_CLASS} strokeWidth={CAPTION_ICON_STROKE} />diff --git a/jarvis/ui/web/frontend/src/components/layout/IdeCaptionTools.tsx b/jarvis/ui/web/frontend/src/components/layout/IdeCaptionTools.tsxnew file mode 100644index 0000000000..c0200a073d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/layout/IdeCaptionTools.tsx@@ -0,0 +1,116 @@+import { GitBranch, Mic, Plus, Search } from "lucide-react";+import { clsx } from "clsx";++import { IdeSidePanelToggle } from "@/components/agentic/sidePanel/IdeSidePanelToggle";+import { appZoomCaps } from "@/lib/appZoom";+import { useAppChordSettings } from "@/store/appChordSettings";+import { useIdeChatStore } from "@/store/ideChat";+import { useIdeProjectsStore } from "@/store/ideProjects";+import { useIdeThreadsStore } from "@/store/ideThreads";++/**+ * The Agentic IDE's tools in the window caption.+ *+ * The caption is the one row that is on screen whatever the IDE shows — grid,+ * threads or the Verse — so the actions used all day live here instead of+ * behind a pane menu or the Ctrl+B key menu: a search field for every IDE+ * command, and at the right end "add an agent", voice, git and the side panel.+ *+ * Every button asks the IDE view to act through `useIdeProjectsStore`, the+ * same channel the sidebar's project tree uses, so the caption never owns IDE+ * state and stays light enough for the startup chunk.+ */++/** One shape for the icon buttons, matching the caption's back/forward buttons. */+const TOOL_BUTTON =+ "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground " ++ "transition-colors hover:bg-secondary hover:text-foreground " ++ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " ++ "disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground";++/**+ * The command search, left of the grid / threads / Verse switch. A button that+ * looks like a field: the palette it opens has the real one, with focus, so+ * typing starts at once.+ */+export function IdeCommandSearch({ className }: { className?: string }) {+ const openPalette = useIdeProjectsStore((state) => state.openCommandPalette);+ const chord = useAppChordSettings((state) => state.bindings.ide_commands);+ const caps = chord ? appZoomCaps(chord) : [];+ const label = caps.length ? `Search IDE commands (${caps.join("+")})` : "Search IDE commands";+ return (+ <button+ type="button"+ onClick={openPalette}+ title={label}+ aria-label={label}+ aria-haspopup="dialog"+ data-testid="ide-command-search"+ className={clsx(+ "h-6 w-56 shrink-0 items-center gap-2 rounded-md border border-border bg-secondary/60 px-2 text-xs",+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground dark:bg-card",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ className,+ )}+ >+ <Search aria-hidden className="h-3.5 w-3.5 shrink-0" />+ <span className="min-w-0 flex-1 truncate text-left">Search commands</span>+ {caps.length > 0 && (+ <span aria-hidden className="shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground">+ {caps.join("+")}+ </span>+ )}+ </button>+ );+}++/** Add agent, voice, git and the side panel, at the caption's right end. */+export function IdeCaptionTools() {+ const workspaceId = useIdeChatStore((state) => state.workspace?.id ?? null);+ const grid = useIdeThreadsStore((state) => state.layout === "grid");+ const runCommand = useIdeProjectsStore((state) => state.runCommand);+ const toggleVoice = useIdeProjectsStore((state) => state.toggleVoice);+ const openGitPanel = useIdeProjectsStore((state) => state.openGitPanel);+ const noWorkspace = workspaceId === null;++ return (+ <div className="flex shrink-0 items-center" role="toolbar" aria-label="IDE tools" data-testid="ide-caption-tools">+ {grid && (+ <button+ type="button"+ onClick={() => runCommand({ kind: "agent-picker" })}+ disabled={noWorkspace}+ title={noWorkspace ? "Open a workspace to add a coding agent" : "Add coding agent"}+ aria-label="Add coding agent"+ data-testid="ide-caption-add-agent"+ className={TOOL_BUTTON}+ >+ <Plus aria-hidden className="h-4 w-4" />+ </button>+ )}+ <button+ type="button"+ onClick={toggleVoice}+ title="Show or hide voice"+ aria-label="Show or hide voice"+ data-testid="ide-caption-voice"+ className={TOOL_BUTTON}+ >+ <Mic aria-hidden className="h-4 w-4" />+ </button>+ <button+ type="button"+ onClick={() => { if (workspaceId) openGitPanel(workspaceId); }}+ disabled={noWorkspace}+ title={noWorkspace ? "Open a workspace to use git" : "Git: branches, commits and worktrees"}+ aria-label="Git"+ data-testid="ide-caption-git"+ className={TOOL_BUTTON}+ >+ <GitBranch aria-hidden className="h-4 w-4" />+ </button>+ <span aria-hidden className="mx-1 h-4 w-px bg-border" />+ <IdeSidePanelToggle />+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsxindex 3a38562dee..34c1463c3b 100644--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx@@ -3,6 +3,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { TopBar } from "./TopBar";import { useEventStore } from "@/store/events";import { resetSectionHistory } from "@/hooks/useSectionHistory";+import { useIdeChatStore } from "@/store/ideChat";+import { useIdeProjectsStore } from "@/store/ideProjects";+import { useIdeSidePanelStore } from "@/store/ideSidePanel";+import { useIdeThreadsStore } from "@/store/ideThreads";vi.mock("@/hooks/useUpdate", () => ({useUpdate: () => ({ status: { managed: false, update_available: false } }),@@ -23,17 +27,63 @@ beforeEach(() => {afterEach(() => vi.restoreAllMocks());describe("TopBar caption buttons", () => {- it("carries no theme, restart, own-window or panel toggles", () => {+ it("carries no theme, restart or own-window toggles", () => {useEventStore.setState({ activeSection: "agentic-ide" });render(<TopBar />);expect(screen.queryByTestId("theme-toggle")).toBeNull();expect(screen.queryByTestId("detach-view-button")).toBeNull();- expect(screen.queryByTestId("ide-side-panel-toggle")).toBeNull();expect(screen.queryByTestId("section-nav-sidebar")).toBeNull();expect(screen.queryByRole("button", { name: /restart/i })).toBeNull();});});+describe("TopBar Agentic IDE tools", () => {+ beforeEach(() => {+ useIdeChatStore.setState({ workspace: { id: "w1", name: "Jarvis", path: "/repo" } });+ useIdeThreadsStore.setState({ layout: "grid" });+ useIdeSidePanelStore.setState({ open: false, maximized: false });+ useIdeProjectsStore.setState({ action: null });+ });++ it("stays out of every other section", () => {+ render(<TopBar />);+ expect(screen.queryByTestId("ide-caption-tools")).toBeNull();+ expect(screen.queryByTestId("ide-command-search")).toBeNull();+ });++ it("asks the IDE for the agent picker, the palette and git", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });+ render(<TopBar />);+ fireEvent.click(screen.getByTestId("ide-caption-add-agent"));+ expect(useIdeProjectsStore.getState().action).toMatchObject({ kind: "command", command: { kind: "agent-picker" } });+ fireEvent.click(screen.getByTestId("ide-command-search"));+ expect(useIdeProjectsStore.getState().action).toMatchObject({ kind: "command-palette" });+ fireEvent.click(screen.getByTestId("ide-caption-git"));+ expect(useIdeProjectsStore.getState().action).toMatchObject({ kind: "git-panel", workspaceId: "w1" });+ });++ it("opens and closes the side panel from the caption", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });+ render(<TopBar />);+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));+ expect(useIdeSidePanelStore.getState().open).toBe(true);+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));+ expect(useIdeSidePanelStore.getState().open).toBe(false);+ });++ it("disables workspace tools until a workspace is open, and hides add agent in threads", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });+ useIdeChatStore.setState({ workspace: null });+ const { rerender } = render(<TopBar />);+ expect((screen.getByTestId("ide-caption-add-agent") as HTMLButtonElement).disabled).toBe(true);+ expect((screen.getByTestId("ide-caption-git") as HTMLButtonElement).disabled).toBe(true);+ act(() => useIdeThreadsStore.setState({ layout: "threads" }));+ rerender(<TopBar />);+ expect(screen.queryByTestId("ide-caption-add-agent")).toBeNull();+ expect(screen.getByTestId("ide-caption-voice")).toBeTruthy();+ });+});+describe("TopBar section navigation", () => {beforeEach(() => {resetSectionHistory();diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsxindex 53964be54e..a31339dc34 100644--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx@@ -14,6 +14,7 @@ import { CodingModeBadge } from "@/components/layout/CodingModeBadge";import { SectionNavButtons } from "@/components/layout/SectionNavButtons";import { IdeLayoutSwitch } from "@/components/agentic/threads/IdeLayoutSwitch";import { IDE_SECTIONS } from "@/lib/ideSections";+import { IdeCaptionTools, IdeCommandSearch } from "@/components/layout/IdeCaptionTools";import { useDesktopChrome, WindowControls } from "@/components/layout/WindowControls";/**@@ -22,7 +23,9 @@ import { useDesktopChrome, WindowControls } from "@/components/layout/WindowCont* It is one thin row at the top of the window: back/forward at the left, the* empty middle to drag the window, and minimize, maximize and close at the* right. Theme, restart and the sidebar toggles are not caption buttons; the- * theme lives in Settings.+ * theme lives in Settings. On the Agentic IDE the caption also carries the+ * IDE's own tools: command search and the layout switch in the middle, add+ * agent, voice, git and the side panel at the right end.** The update button below (rendered in the sidebar) restarts through* ``/api/settings/restart-app``, which spawns a detached relauncher (see@@ -95,6 +98,7 @@ export function TopBar() {<IdeCaptionSwitch /><div className="flex shrink-0 items-center"><CodingModeBadge />+ <IdeCaptionRight />{controls === "trailing" && (<WindowControls controls={controls} maximized={chrome.maximized} onCommand={chrome.command} />)}@@ -104,21 +108,32 @@ export function TopBar() {}/**- * The Agentic IDE's grid / threads switch, centred in the caption. Only on the- * IDE: everywhere else the caption's middle stays the window's drag handle.- * It floats over that handle rather than splitting it, so the strip keeps- * dragging on both sides of the switch.+ * The Agentic IDE's grid / threads switch, centred in the caption, with the+ * command search to its left. Only on the IDE: everywhere else the caption's+ * middle stays the window's drag handle. Both float over that handle rather+ * than splitting it, so the strip keeps dragging on both sides. The search+ * hangs off the switch's left edge, so the switch stays exactly centred, and+ * it steps aside on a narrow window where it would reach back/forward.*/function IdeCaptionSwitch() {const onIde = useEventStore((s) => IDE_SECTIONS.includes(s.activeSection));if (!onIde) return null;return (<div className="pointer-events-none absolute inset-y-0 left-1/2 flex -translate-x-1/2 items-center">- <IdeLayoutSwitch className="pointer-events-auto" />+ <div className="relative flex items-center">+ <IdeCommandSearch className="pointer-events-auto absolute right-full mr-2 hidden lg:flex" />+ <IdeLayoutSwitch className="pointer-events-auto" />+ </div></div>);}+/** The IDE's tools at the caption's right end, beside the window buttons. */+function IdeCaptionRight() {+ const onIde = useEventStore((s) => IDE_SECTIONS.includes(s.activeSection));+ return onIde ? <IdeCaptionTools /> : null;+}+// The restart can fail transiently right after an apply (the backend is busy,// the desktop shell still warming) — retry briefly before giving up honestly.const RESTART_ATTEMPTS = 3;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex bf0b7a06ef..5e3bb4c476 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1739,7 +1739,8 @@"app_zoom_reset": "App-Zoom auf 100 % zurücksetzen","open_overlay": "Diese Liste öffnen","quick_switch": "Schnell zu jedem Bereich springen",- "ide_menu": "Tastenmenü der Agentic IDE (zweimal drücken: an das Fenster senden)"+ "ide_menu": "Tastenmenü der Agentic IDE (zweimal drücken: an das Fenster senden)",+ "ide_commands": "Befehlspalette der Agentic IDE (alle IDE-Befehle durchsuchen)"}},"quick_switch": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex d6e0d2936a..9823eb7dc9 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1739,7 +1739,8 @@"app_zoom_reset": "Reset the app zoom to 100 %","open_overlay": "Open this list","quick_switch": "Quick switch to any section",- "ide_menu": "Agentic IDE key menu (press twice to send it to the pane)"+ "ide_menu": "Agentic IDE key menu (press twice to send it to the pane)",+ "ide_commands": "Agentic IDE command palette (search every IDE command)"}},"quick_switch": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 3be782d896..d758e4653a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1739,7 +1739,8 @@"app_zoom_reset": "Restablecer el zoom de la aplicación al 100 %","open_overlay": "Abrir esta lista","quick_switch": "Saltar rápido a cualquier sección",- "ide_menu": "Menú de teclas del IDE agéntico (pulsa dos veces para enviarlo al panel)"+ "ide_menu": "Menú de teclas del IDE agéntico (pulsa dos veces para enviarlo al panel)",+ "ide_commands": "Paleta de comandos del IDE agéntico (busca cualquier comando del IDE)"}},"quick_switch": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.jsonindex 252a9e092e..a69167ac81 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json@@ -1739,7 +1739,8 @@"app_zoom_reset": "将应用缩放重置为 100 %","open_overlay": "打开此列表","quick_switch": "快速切换到任意板块",- "ide_menu": "Agentic IDE 按键菜单(按两次会把按键发送给窗格)"+ "ide_menu": "Agentic IDE 按键菜单(按两次会把按键发送给窗格)",+ "ide_commands": "Agentic IDE 命令面板(搜索所有 IDE 命令)"}},"quick_switch": {diff --git a/jarvis/ui/web/frontend/src/lib/appChords.ts b/jarvis/ui/web/frontend/src/lib/appChords.tsindex 0f045d7618..aa31a9755a 100644--- a/jarvis/ui/web/frontend/src/lib/appChords.ts+++ b/jarvis/ui/web/frontend/src/lib/appChords.ts@@ -1,6 +1,7 @@/*** The in-app chords that used to be compiled in: the terminal text size steps,- * the `?` shortcut overview and the Agentic IDE key menu. Each one now has a+ * the `?` shortcut overview, the Agentic IDE key menu and its command+ * palette. Each one now has a* default and can be recorded anew under Settings → Keyboard shortcuts.** They are matched and recorded by CHARACTER exactly like the whole-app zoom@@ -19,7 +20,8 @@ export type AppChordId =| "terminal_zoom_out"| "terminal_zoom_reset"| "shortcut_overlay"- | "ide_menu";+ | "ide_menu"+ | "ide_commands";export const APP_CHORD_IDS: readonly AppChordId[] = ["terminal_zoom_in",@@ -27,6 +29,7 @@ export const APP_CHORD_IDS: readonly AppChordId[] = ["terminal_zoom_reset","shortcut_overlay","ide_menu",+ "ide_commands",];export type AppChordBindings = Record<AppChordId, string>;@@ -34,7 +37,8 @@ export type AppChordBindings = Record<AppChordId, string>;/*** The shipped chords. The terminal steps use the platform modifier (⌘ on a* Mac, Ctrl elsewhere); the IDE key menu is Ctrl+B on every OS, the terminal- * key tmux users already have in their hands.+ * key tmux users already have in their hands. The IDE command palette is+ * Ctrl+Shift+P (⌘⇧P on a Mac), the chord editors already use for theirs.*/export function defaultAppChords(platform: ChordPlatform = hostChordPlatform()): AppChordBindings {const mod = platform === "mac" ? "cmd" : "ctrl";@@ -44,6 +48,7 @@ export function defaultAppChords(platform: ChordPlatform = hostChordPlatform()):terminal_zoom_reset: `${mod}+0`,shortcut_overlay: "question",ide_menu: "ctrl+b",+ ide_commands: `${mod}+shift+p`,};}diff --git a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.tsindex 9611ca978b..6df3fb99f3 100644--- a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts+++ b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts@@ -140,6 +140,13 @@ export const SHORTCUTS: readonly Shortcut[] = [setting: "ide_menu",labelKey: "shortcut_overlay.workspace.ide_menu",},+ {+ kind: "app",+ area: "workspace",+ scope: "window",+ setting: "ide_commands",+ labelKey: "shortcut_overlay.workspace.ide_commands",+ },] as const;/** Areas in the order the overlay renders them. */diff --git a/jarvis/ui/web/frontend/src/store/ideProjects.ts b/jarvis/ui/web/frontend/src/store/ideProjects.tsindex 2ae569a24e..e5683a9afd 100644--- a/jarvis/ui/web/frontend/src/store/ideProjects.ts+++ b/jarvis/ui/web/frontend/src/store/ideProjects.ts@@ -1,5 +1,6 @@import { create } from "zustand";import type { IdeProject } from "@/lib/agenticIdeApi";+import type { IdeHotkeyAction } from "@/components/agentic/ideHotkeys";type IdeAction =| { kind: "connect-project"; nonce: number }@@ -8,7 +9,10 @@ type IdeAction =| { kind: "activate-workspace"; workspaceId: string; nonce: number }| { kind: "workspace-options"; workspaceId: string; nonce: number }| { kind: "git-panel"; workspaceId: string; nonce: number }- | { kind: "toggle-voice"; nonce: number };+ | { kind: "toggle-voice"; nonce: number }+ // Any key-menu command, asked for from outside the view (the window caption).+ | { kind: "command"; command: IdeHotkeyAction; nonce: number }+ | { kind: "command-palette"; nonce: number };interface IdeProjectsStore {projects: IdeProject[];@@ -25,6 +29,8 @@ interface IdeProjectsStore {openWorkspaceOptions: (workspaceId: string) => void;openGitPanel: (workspaceId: string) => void;toggleVoice: () => void;+ runCommand: (command: IdeHotkeyAction) => void;+ openCommandPalette: () => void;}export const useIdeProjectsStore = create<IdeProjectsStore>((set) => ({@@ -42,4 +48,6 @@ export const useIdeProjectsStore = create<IdeProjectsStore>((set) => ({openWorkspaceOptions: (workspaceId) => set((state) => ({ action: { kind: "workspace-options", workspaceId, nonce: (state.action?.nonce ?? 0) + 1 } })),openGitPanel: (workspaceId) => set((state) => ({ action: { kind: "git-panel", workspaceId, nonce: (state.action?.nonce ?? 0) + 1 } })),toggleVoice: () => set((state) => ({ action: { kind: "toggle-voice", nonce: (state.action?.nonce ?? 0) + 1 } })),+ runCommand: (command) => set((state) => ({ action: { kind: "command", command, nonce: (state.action?.nonce ?? 0) + 1 } })),+ openCommandPalette: () => set((state) => ({ action: { kind: "command-palette", nonce: (state.action?.nonce ?? 0) + 1 } })),}));diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsxindex 3228c3ee39..aa61667bc8 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx@@ -22,7 +22,7 @@ const git = vi.hoisted(() => ({ inspectGit: vi.fn(), prepareGit: vi.fn() }));vi.mock("@/lib/gitApi", async (importOriginal) => ({ ...(await importOriginal<object>()), ...git }));vi.mock("@/lib/agenticIdeApi", () => api);vi.mock("@/lib/chatLibraryApi", () => ({ openProject }));-vi.mock("@/store/events", () => ({ useEventStore: (select: (value: unknown) => unknown) => select({ pushToast: api.pushToast }) }));+vi.mock("@/store/events", () => ({ useEventStore: Object.assign((select: (value: unknown) => unknown) => select({ pushToast: api.pushToast }), { getState: () => ({ pushToast: api.pushToast, activeSection: "agentic-ide" }) }) }));vi.mock("@/components/agentic/FolderPicker", () => ({ FolderPicker: ({ onSelect }: { onSelect: (path: string) => void }) => <button onClick={() => onSelect("/code/app")}>Pick folder</button> }));vi.mock("@/components/agentic/VoiceBubble", () => ({ VoiceBubble: () => null, storedVoiceBubbleOpen: () => false, storeVoiceBubbleOpen: vi.fn() }));vi.mock("@/components/agentic/WorkspaceTerminalGrid", () => ({ WorkspaceTerminalGrid: ({ session, onAdd }: { session: { id: string }; onAdd: () => void }) => <><div data-testid="live-grid">{session.id}</div><button onClick={onAdd}>Pane add</button></> }));@@ -277,6 +277,30 @@ describe("Agentic IDE project flow", () => {await waitFor(() => expect(screen.queryByRole("dialog", { name: "Rename workspace" })).toBeNull());});+ it("runs caption commands and the command palette against the open workspace", async () => {+ const session = { id: "w1", project_id: "p1", folder: "/code/app", name: "App work", created_at: 0,+ focus_mode: false, project: { name: "App" }, terminals: [] };+ api.fetchIdeState.mockResolvedValue({ ...emptyState, active: true, active_id: "w1", session });+ api.fetchIdeProjects.mockResolvedValue({ projects: [project], active_project_id: "p1", active_workspace_id: "w1", max_terminals: 8 });+ // cmdk measures its list and scrolls the selected row into view; jsdom has neither.+ vi.stubGlobal("ResizeObserver", class { observe() {} unobserve() {} disconnect() {} });+ if (!("scrollIntoView" in Element.prototype)) Object.assign(Element.prototype, { scrollIntoView() {} });+ render(<AgenticIdeView />);+ await screen.findByTestId("live-grid");+ // The caption's "+" asks through the store, like the sidebar does.+ act(() => useIdeProjectsStore.getState().runCommand({ kind: "agent-picker" }));+ expect(await screen.findByRole("dialog", { name: "Add coding agent" })).toBeTruthy();+ fireEvent.click(screen.getByRole("button", { name: "Close" }));+ // Ctrl+Shift+P opens the palette; a picked row runs the same command.+ fireEvent.keyDown(window, { key: "P", code: "KeyP", ctrlKey: true, shiftKey: true });+ const input = await screen.findByTestId("ide-command-palette-input");+ fireEvent.change(input, { target: { value: "add coding" } });+ fireEvent.click(await screen.findByTestId("ide-command-agent-picker"));+ await waitFor(() => expect(screen.queryByTestId("ide-command-palette")).toBeNull());+ expect(await screen.findByRole("dialog", { name: "Add coding agent" })).toBeTruthy();+ vi.unstubAllGlobals();+ });+it("keeps six incrementally added agents in a balanced 3 by 2 layout", async () => {const terminals = Array.from({ length: 6 }, (_, index) => ({ key: `t${index}`, history_id: `id${index}`, name: `T${index}` }));const session = { id: "w1", project_id: "p1", folder: "/code/app", name: "App work", created_at: 0,diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex 6cd2e64625..5e49c03f46 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -15,8 +15,13 @@ import { isBalancedWorkspace } from "@/components/agentic/workspaceDocking";import { AgentMark } from "@/components/agentic/AgentMark";import { CloseAgentDialog, type CloseTarget } from "@/components/agentic/CloseAgentDialog";import { IdeHotkeyMenu } from "@/components/agentic/IdeHotkeyMenu";-import { leaderPassthrough, PANE_COMMAND_EVENT, PANE_INPUT_EVENT, type IdeHotkeyAction, type PaneCommand, type PaneCommandDetail, type PaneInputDetail } from "@/components/agentic/ideHotkeys";-import { appChord } from "@/store/appChordSettings";+import { assignAgentKeys, leaderPassthrough, PANE_COMMAND_EVENT, PANE_INPUT_EVENT, type IdeHotkeyAction, type PaneCommand, type PaneCommandDetail, type PaneInputDetail } from "@/components/agentic/ideHotkeys";+import { IdeCommandPalette } from "@/components/agentic/IdeCommandPalette";+import { buildIdeCommands, type IdeCommandRun } from "@/components/agentic/ideCommands";+import { SIDE_PANEL_TABS } from "@/components/agentic/sidePanel/sidePanelTabs";+import { pickIdeFace } from "@/components/agentic/threads/IdeLayoutSwitch";+import { appZoomCaps, appZoomChordMatches } from "@/lib/appZoom";+import { appChord, useAppChordSettings } from "@/store/appChordSettings";import { GitCheckoutPicker } from "@/components/agentic/git/GitCheckoutPicker";import { GitPanelDialog } from "@/components/agentic/git/GitPanelDialog";import { KEEP_CHECKOUT, prepareGit, type GitPlan } from "@/lib/gitApi";@@ -128,6 +133,14 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {{ kind: "terminal"; terminal: TerminalState; workspaceId: string } | { kind: "workspace"; workspaceId: string } | null>(null);const [voiceOpen, setVoiceOpen] = useState(storedVoiceBubbleOpen);+ // The command palette (caption search or its chord, see components/agentic/ideCommands).+ const [paletteOpen, setPaletteOpen] = useState(false);+ const leaderChord = useAppChordSettings((settings) => settings.bindings.ide_menu);+ const panelOpen = useIdeSidePanelStore((panel) => panel.open);+ const verseOn = useIdeSidePanelStore((panel) => panel.open && panel.maximized && panel.active === "office");+ // The caption asks for key-menu commands through the store; they run through+ // `runHotkey`, which is declared further down and changes every render.+ const runHotkeyRef = useRef<(hotkey: IdeHotkeyAction) => void>(() => undefined);// One fixed, dense text size (the look of a standalone terminal); the// maintainer does not want a per-user zoom for the workspace terminals.const fontSize = FONT_DEFAULT;@@ -315,6 +328,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {setVoiceOpen((current) => { const next = !current; storeVoiceBubbleOpen(next); return next; });return;}+ if (action.kind === "command") { runHotkeyRef.current(action.command); return; }+ if (action.kind === "command-palette") { setPaletteOpen(true); return; }if (action.kind === "new-workspace") {const project = projects.find((entry) => entry.id === action.projectId);if (project) {@@ -487,7 +502,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {// Ctrl+B, then a key (see components/agentic/ideHotkeys): the IDE's// key menu. Pane commands go to the grid that owns the pane; the rest are// the same calls the buttons and the sidebar make.- const hotkeysEnabled = onScreen && !threads && !dialogOpen && !optionsOpen && !gitOpen && !closeRequest;+ const hotkeysEnabled = onScreen && !threads && !dialogOpen && !optionsOpen && !gitOpen && !closeRequest && !paletteOpen;const hotkeyAgents = installed.map((agent) => ({ name: agent.name, label: agent.display_name }));const sendPaneCommand = (command: PaneCommand) => {if (!session || !selected) return;@@ -556,6 +571,45 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {case "connect-project": setProjectDialog(true); return;}};+ runHotkeyRef.current = runHotkey;++ // Ctrl+Shift+P (rebindable) opens the command palette from anywhere in the+ // IDE. Capture phase, like the key menu, so a focused terminal never sees it.+ useEffect(() => {+ if (!onScreen) return;+ const onKeyDown = (event: KeyboardEvent) => {+ const combo = appChord("ide_commands");+ if (!combo || event.isComposing || !appZoomChordMatches(event, combo)) return;+ event.preventDefault();+ event.stopPropagation();+ setPaletteOpen((open) => !open);+ };+ window.addEventListener("keydown", onKeyDown, true);+ return () => window.removeEventListener("keydown", onKeyDown, true);+ }, [onScreen]);+ const runCommand = (run: IdeCommandRun): void => {+ switch (run.type) {+ case "hotkey": runHotkey(run.action); return;+ case "face": pickIdeFace(run.face); return;+ case "panel-tab": useIdeSidePanelStore.getState().openTab(run.tab); return;+ case "panel-toggle": {+ const panel = useIdeSidePanelStore.getState();+ panel.setOpen(!panel.open);+ return;+ }+ }+ };+ const paletteCommands = paletteOpen ? buildIdeCommands({+ agents: assignAgentKeys(hotkeyAgents),+ leaderCaps: leaderChord ? appZoomCaps(leaderChord) : [],+ hasSession: Boolean(session),+ threads,+ workspaces: openWorkspaces.map((workspace) => ({ id: workspace.id, name: workspace.name })),+ activeWorkspaceId: session?.id ?? null,+ panelTabs: SIDE_PANEL_TABS.map((tab) => ({ id: tab.id, label: t(tab.labelKey) })),+ panelOpen,+ face: verseOn ? "verse" : layout,+ }) : [];const closeTarget: CloseTarget | null = !closeRequest ? null: closeRequest.kind === "terminal"? { kind: "terminal", name: closeRequest.terminal.name, agent: closeRequest.terminal.agent, displayName: closeRequest.terminal.display_name }@@ -609,6 +663,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {window.dispatchEvent(new CustomEvent(PANE_INPUT_EVENT, { detail }));}} /><VoiceBubble open={voiceOpen} onClose={closeVoice} onScreen={onScreen} onJumpToPane={jumpToPane} promptTarget={selected} />+ <IdeCommandPalette open={paletteOpen && onScreen} onOpenChange={setPaletteOpen} commands={paletteCommands} onRun={runCommand} />{agentPicker && <div className="fixed inset-0 z-[80] flex items-center justify-center bg-background/75 p-4 backdrop-blur-sm"role="presentation" onMouseDown={(event) => { if (event.target === event.currentTarget) setAgentPicker(null); }}>diff --git a/jarvis/ui/web/frontend/src/views/ShortcutsView.test.tsx b/jarvis/ui/web/frontend/src/views/ShortcutsView.test.tsxindex f4b0a8971e..f7487d2290 100644--- a/jarvis/ui/web/frontend/src/views/ShortcutsView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/ShortcutsView.test.tsx@@ -53,9 +53,9 @@ describe("ShortcutsView", () => {render(<ShortcutsView />);const list = screen.getByTestId("shortcuts-list");const rows = list.querySelectorAll("li");- // 14 registry entries + the three appshot keys.- expect(rows.length).toBe(17);- expect(screen.getByTestId("shortcuts-count").textContent).toContain("17");+ // 15 registry entries + the three appshot keys.+ expect(rows.length).toBe(18);+ expect(screen.getByTestId("shortcuts-count").textContent).toContain("18");expect(rows[0].textContent).toContain("Anywhere on this computer");expect(rows[rows.length - 1].textContent).toContain("In an agent terminal");for (const id of ["call", "hangup", "dictate", "quick_switch", "appshot-hotkey"]) {diff --git a/jarvis/ui/web/frontend/src/views/ShortcutsView.tsx b/jarvis/ui/web/frontend/src/views/ShortcutsView.tsxindex 7955861034..50bad119c5 100644--- a/jarvis/ui/web/frontend/src/views/ShortcutsView.tsx+++ b/jarvis/ui/web/frontend/src/views/ShortcutsView.tsx@@ -38,7 +38,7 @@ import { AppZoomChordRow, AppZoomKeybinds, sameChord } from "@/views/settings/Apimport { CharacterChordRow } from "@/views/settings/CharacterChordRow";import { KeyCaps, NoKeys, ShortcutListRow } from "@/views/settings/ShortcutListRow";import { AppshotShortcutField } from "@/views/AppshotShortcutField";-import { appZoomIntentFor, type AppZoomComboProblem, type AppZoomIntent } from "@/lib/appZoom";+import { appZoomChordMatches, appZoomIntentFor, type AppZoomComboProblem, type AppZoomIntent } from "@/lib/appZoom";import { APP_CHORD_IDS, appChordProblem, defaultAppChords, type AppChordId } from "@/lib/appChords";import { useAppZoomSettings } from "@/store/appZoomSettings";import { terminalZoomBindings, useAppChordSettings } from "@/store/appChordSettings";@@ -213,6 +213,8 @@ function KeyTester({ config }: { config: KeybindsConfig | null }) {meaningKey = "shortcut_overlay.workspace.open_overlay";} else if (isLeaderChord(event, appChords.ide_menu)) {meaningKey = "shortcut_overlay.workspace.ide_menu";+ } else if (appChords.ide_commands && appZoomChordMatches(event, appChords.ide_commands)) {+ meaningKey = "shortcut_overlay.workspace.ide_commands";} else if (combo) {const mine = [...normalizedComboTokens(combo)].sort().join("+");const hit = Object.entries(config?.keybinds ?? {}).find(@@ -443,7 +445,7 @@ function AppChordRow({ shortcut, id }: { shortcut: AppSettingShortcut; id: AppCh// purpose: inside a terminal the terminal wins. Everything else must be// unique among the in-window chords.const others = APP_CHORD_IDS.filter((other) => other !== id).map((other) => bindings[other]);- if (id === "shortcut_overlay" || id === "ide_menu") others.push(...Object.values(appZoom));+ if (id === "shortcut_overlay" || id === "ide_menu" || id === "ide_commands") others.push(...Object.values(appZoom));const problem = appChordProblem(id, next, others);if (problem) return t(CHORD_PROBLEM_KEY[problem]);if (quickSwitch.enabled && sameChord(next, quickSwitch.combo)) {