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(ide): replace native close confirm with an in-app dialog
rubenluetke10-beep9f8f829a1f67
diff --git a/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.test.tsxnew file mode 100644index 0000000000..bbda8e25f1--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.test.tsx@@ -0,0 +1,27 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, expect, it, vi } from "vitest";+import { CloseAgentDialog } from "./CloseAgentDialog";++afterEach(cleanup);++it("asks in-app before closing a pane and defaults focus to keeping it", () => {+ const onCancel = vi.fn(), onConfirm = vi.fn();+ render(<CloseAgentDialog target={{ kind: "terminal", name: "T8", agent: "claude", displayName: "Claude Code" }}+ busy={false} onCancel={onCancel} onConfirm={onConfirm} />);+ expect(screen.getByRole("dialog", { name: "Close T8?" })).toBeTruthy();+ expect(document.activeElement).toBe(screen.getByRole("button", { name: "Keep running" }));+ fireEvent.click(screen.getByRole("button", { name: "Close agent" }));+ expect(onConfirm).toHaveBeenCalledOnce();+ fireEvent.keyDown(document.activeElement!, { key: "Escape" });+ expect(onCancel).toHaveBeenCalledOnce();+});++it("names every agent a workspace close stops and locks while busy", () => {+ const onCancel = vi.fn();+ render(<CloseAgentDialog busy onCancel={onCancel} onConfirm={vi.fn()} target={{ kind: "workspace", name: "Installer",+ agents: [{ agent: "claude", displayName: "Claude Code" }, { agent: "codex", displayName: "Codex" }] }} />);+ expect(screen.getByText(/All 2 coding agents stop/)).toBeTruthy();+ expect((screen.getByRole("button", { name: /Close workspace/ }) as HTMLButtonElement).disabled).toBe(true);+ fireEvent.keyDown(document.activeElement!, { key: "Escape" });+ expect(onCancel).not.toHaveBeenCalled();+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.tsx b/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.tsxnew file mode 100644index 0000000000..955c08c96d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/CloseAgentDialog.tsx@@ -0,0 +1,73 @@+import * as Dialog from "@radix-ui/react-dialog";+import { Loader2, Power } from "lucide-react";+import { AgentMark } from "./AgentMark";++/** What is about to close: one pane, or a whole workspace with its panes. */+export type CloseTarget =+ | { kind: "terminal"; name: string; agent: string; displayName: string }+ | { kind: "workspace"; name: string; agents: { agent: string; displayName: string }[] };++interface Props {+ target: CloseTarget | null;+ busy: boolean;+ onCancel: () => void;+ onConfirm: () => void;+}++/**+ * In-app replacement for `window.confirm` when a pane or workspace closes.+ * The desktop shell renders a native confirm as an unstyled host-named box+ * ("127.0.0.1:47821 says") in the OS language, and it blocks the event loop.+ */+export function CloseAgentDialog({ target, busy, onCancel, onConfirm }: Props) {+ const terminal = target?.kind === "terminal" ? target : null;+ const workspace = target?.kind === "workspace" ? target : null;+ const count = workspace?.agents.length ?? 1;+ const title = terminal ? `Close ${terminal.name}?` : `Close ${workspace?.name ?? "workspace"}?`;+ const body = terminal+ ? `The coding agent in this pane stops right away, including any task it is still working on.`+ : count === 0+ ? "The workspace closes. You can restore it from Projects at any time."+ : `${count === 1 ? "Its coding agent stops" : `All ${count} coding agents stop`} right away. You can restore the workspace from Projects at any time.`;++ return <Dialog.Root open={target !== null} onOpenChange={(open) => { if (!open && !busy) onCancel(); }}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 z-[80] bg-background/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0" />+ <Dialog.Content data-testid="close-agent-dialog"+ onOpenAutoFocus={(event) => { event.preventDefault(); (event.currentTarget as HTMLElement).querySelector<HTMLElement>("[data-close-cancel]")?.focus(); }}+ className="fixed left-1/2 top-1/2 z-[90] w-[min(400px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-2xl data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95">+ <div className="flex items-start gap-4">+ <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-destructive/10 text-destructive">+ <Power className="h-[18px] w-[18px]" aria-hidden />+ </div>+ <div className="min-w-0 flex-1">+ <Dialog.Title className="truncate text-base font-semibold">{title}</Dialog.Title>+ <Dialog.Description className="mt-1.5 text-sm leading-relaxed text-muted-foreground">{body}</Dialog.Description>+ </div>+ </div>++ {terminal && <div className="mt-4 flex items-center gap-2.5 rounded-xl border border-border bg-muted/40 px-3 py-2.5">+ <AgentMark agent={terminal.agent} label={terminal.displayName} variant="plain" size="sm" />+ <span className="truncate text-sm font-medium">{terminal.displayName}</span>+ <span className="ml-auto shrink-0 font-mono text-xs text-muted-foreground">{terminal.name}</span>+ </div>}+ {workspace && workspace.agents.length > 0 && <div className="mt-4 flex flex-wrap gap-1.5">+ {workspace.agents.map((entry, index) => <span key={`${entry.agent}-${index}`}+ className="flex items-center gap-1.5 rounded-lg border border-border bg-muted/40 px-2 py-1 text-xs text-muted-foreground">+ <AgentMark agent={entry.agent} label={entry.displayName} variant="plain" size="sm" />{entry.displayName}+ </span>)}+ </div>}++ <div className="mt-6 flex justify-end gap-2">+ <button type="button" data-close-cancel disabled={busy} onClick={onCancel}+ className="rounded-lg border border-border px-3.5 py-2 text-sm font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40">+ Keep running</button>+ <button type="button" disabled={busy} onClick={onConfirm}+ className="flex items-center gap-1.5 rounded-lg bg-destructive px-3.5 py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive focus-visible:ring-offset-2 focus-visible:ring-offset-popover disabled:opacity-60">+ {busy && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}+ {terminal ? "Close agent" : "Close workspace"}</button>+ </div>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>;+}diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex dc008ee5e8..6570f18a09 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -8,6 +8,7 @@ import { WorkspaceOptionsDialog } from "@/components/agentic/WorkspaceOptionsDiaimport { IdeSidePanelFrame } from "@/components/agentic/sidePanel/IdeSidePanel";import { GRID_LIMIT_HINT, MAX_WORKSPACE_PANES, canSplitFit, fitsWorkspace, isBalancedWorkspace } from "@/components/agentic/workspaceDocking";import { AgentMark } from "@/components/agentic/AgentMark";+import { CloseAgentDialog, type CloseTarget } from "@/components/agentic/CloseAgentDialog";import { SplitRightIcon, SplitBelowIcon, SplitLeftIcon, SplitAboveIcon } from "@/components/agentic/splitIcons";import type { PaneSplitDirection } from "@/components/agentic/WorkspaceTerminalHeader";import { cn } from "@/lib/utils";@@ -77,6 +78,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const [renameOpen, setRenameOpen] = useState(false);const [renameValue, setRenameValue] = useState("");const [busy, setBusy] = useState(false);+ const [closeRequest, setCloseRequest] = useState<+ { kind: "terminal"; terminal: TerminalState; workspaceId: string } | { kind: "workspace"; workspaceId: string } | null+ >(null);const [voiceOpen, setVoiceOpen] = useState(storedVoiceBubbleOpen);const [fontSize, setFontSize] = useState(() => Number(localStorage.getItem(FONT_KEY)) || 13);const [appearance, setAppearance] = useState<"light" | "dark" | null>(() => {@@ -304,9 +308,21 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {setState((current) => current?.session?.id === next.id ? { ...current, session: next } : current);});- const closeAgent = (terminal: TerminalState) => void run(async () => {- if (!session || !window.confirm(`Close ${terminal.name}? Its coding agent will stop.`)) return;- await closeTerminal(terminal.history_id ? `pane:${terminal.history_id}` : terminal.name, session.id);+ // Closing asks first in an in-app dialog, never window.confirm (the shell+ // shows that as an unstyled host-named box in the OS language).+ const closeAgent = (terminal: TerminalState) => {+ if (session) setCloseRequest({ kind: "terminal", terminal, workspaceId: session.id });+ };+ const confirmClose = () => void run(async () => {+ const request = closeRequest;+ if (!request) return;+ try {+ if (request.kind === "terminal") {+ await closeTerminal(request.terminal.history_id ? `pane:${request.terminal.history_id}` : request.terminal.name, request.workspaceId);+ } else {+ setState(await closeWorkspace(request.workspaceId));+ }+ } finally { setCloseRequest(null); }});const saveFont = (size: number) => { const next = Math.max(9, Math.min(22, size)); setFontSize(next); localStorage.setItem(FONT_KEY, String(next)); };@@ -355,10 +371,14 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {setState(await renameWorkspace(session.id, renameValue.trim()));setRenameOpen(false);});- const stopWorkspace = () => void run(async () => {- if (!session || !window.confirm(`Close ${session.name ?? session.project.name}? Its coding agents will stop.`)) return;- setState(await closeWorkspace(session.id));- });+ const stopWorkspace = () => {+ if (session) setCloseRequest({ kind: "workspace", workspaceId: session.id });+ };+ const closeTarget: CloseTarget | null = !closeRequest ? null+ : closeRequest.kind === "terminal"+ ? { kind: "terminal", name: closeRequest.terminal.name, agent: closeRequest.terminal.agent, displayName: closeRequest.terminal.display_name }+ : { kind: "workspace", name: session?.name ?? session?.project.name ?? "workspace",+ agents: (session?.terminals ?? []).map((terminal) => ({ agent: terminal.agent, displayName: terminal.display_name })) };if (state === null) return <div data-testid="agentic-ide-loading" className="flex h-full items-center justify-center gap-2 text-sm text-muted-foreground"><Loader2 className="h-4 w-4 animate-spin" />Loading projects…</div>;@@ -368,6 +388,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {onAdd={openAgentPicker} onBalance={balanceLayout} onRename={() => { setRenameValue(session?.name ?? session?.project.name ?? ""); setRenameOpen(true); }}onClose={stopWorkspace} fontSize={fontSize} onFontSize={saveFont} appearance={appearance} onAppearance={saveAppearance}/>+ <CloseAgentDialog target={closeTarget} busy={busy} onCancel={() => setCloseRequest(null)} onConfirm={confirmClose} /><main className="min-h-0 flex-1"><IdeSidePanelFrame>