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): place panes and workspaces on computers from the IDE
rubenluetke10-beep38842d9a4b8c
diff --git a/jarvis/agentic_ide/offload_on_quit.py b/jarvis/agentic_ide/offload_on_quit.pynew file mode 100644index 0000000000..a85a4e1dfb--- /dev/null+++ b/jarvis/agentic_ide/offload_on_quit.py@@ -0,0 +1,70 @@+"""Keep working when this PC closes: move running panes to a computer on quit.++Opt-in, one setting: a connected computer's id (or nothing). When the app+quits while it is set, every open workspace with an agent running on THIS+machine is moved there first (``Registry.place_workspace``) — folder,+uncommitted edits and conversations included — so the agents carry on in tmux+on the server while the PC is off, and the next start shows them running there.++Bounded by the quit sequence's timeout: a quit is never held open for long,+and a move that could not finish leaves the pane where it was (the placement+is recorded only after the move completed).+"""++from __future__ import annotations++import json+import os+from pathlib import Path+from typing import Any++from loguru import logger+++def _path() -> Path:+ from jarvis.core.paths import user_data_dir++ return user_data_dir() / "agentic_ide" / "offload_on_quit.json"+++def target() -> str | None:+ """The computer running panes move to on quit, or None (off)."""+ try:+ data = json.loads(_path().read_text(encoding="utf-8"))+ except FileNotFoundError: # never set: the feature is off+ return None+ except (OSError, ValueError) as exc:+ logger.warning("Agentic IDE: unreadable offload-on-quit setting: {}", exc)+ return None+ value = data.get("computer_id") if isinstance(data, dict) else None+ return value if isinstance(value, str) and value else None+++def set_target(computer_id: str | None) -> None:+ path = _path()+ path.parent.mkdir(parents=True, exist_ok=True)+ tmp = path.with_suffix(".json.tmp")+ tmp.write_text(json.dumps({"computer_id": computer_id or None}), encoding="utf-8")+ os.replace(tmp, path)+++async def offload_before_quit(registry: Any) -> list[str]:+ """Move every workspace with a locally running agent. Returns their ids."""+ computer_id = target()+ if not computer_id:+ return []+ moved: list[str] = []+ for workspace in list(registry.sessions()):+ running_here = [+ term for term in workspace.terminals if term.pty_id and not term.computer_id+ ]+ if not running_here:+ continue+ try:+ await registry.place_workspace(workspace.id, computer_id=computer_id)+ except Exception as exc: # noqa: BLE001 - one workspace failing must not block the rest+ logger.warning("Agentic IDE: moving {} before quit failed: {}", workspace.name, exc)+ continue+ moved.append(workspace.id)+ logger.info("Agentic IDE: moved {} to {} before quitting", workspace.name, computer_id)+ return moveddiff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex 2d3c9a1da5..993245f619 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -6239,6 +6239,22 @@ class DesktopApp:# must not hold the whole quit open.pass+ # Keep working when this PC closes (opt-in, Computers section):+ # running IDE panes move to the chosen computer before we exit.+ async def _offload_panes() -> None:+ from jarvis.agentic_ide import offload_on_quit+ from jarvis.agentic_ide.session import get_registry++ if offload_on_quit.target():+ await offload_on_quit.offload_before_quit(get_registry())++ try:+ asyncio.run_coroutine_threadsafe(_offload_panes(), loop).result(timeout=180.0)+ except Exception as exc: # noqa: BLE001 - quitting must go on+ from loguru import logger as _logger++ _logger.warning("Offload before quit did not finish: {}", exc)+# Cleanly close PTY sessions — otherwise zombies remainasync def _pty_cleanup() -> None:try:diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.pyindex 6fdcca0584..5d1015cfb3 100644--- a/jarvis/ui/web/agentic_ide_routes.py+++ b/jarvis/ui/web/agentic_ide_routes.py@@ -2872,6 +2872,34 @@ async def place_terminal(request: Request, name: str, req: PlaceRequest) -> dictreturn {"ok": True, **result, "state": registry.state()}+class OffloadOnQuitRequest(BaseModel):+ computer_id: str | None = Field(+ default=None, description="Computer to move running panes to on quit; null turns it off."+ )++[email protected]("/offload-on-quit", summary="Where running panes move when the app quits")+def get_offload_on_quit() -> dict:+ from jarvis.agentic_ide import offload_on_quit++ return {"computer_id": offload_on_quit.target()}++[email protected]("/offload-on-quit", summary="Move running panes to a computer when the app quits")+def put_offload_on_quit(req: OffloadOnQuitRequest) -> dict:+ """Opt in (a computer id) or out (null) of keeping agents working after quit."""+ from jarvis.agentic_ide import offload_on_quit+ from jarvis.computers.service import ComputerError, get_service++ if req.computer_id:+ try:+ get_service().get(req.computer_id)+ except ComputerError as exc:+ raise HTTPException(status_code=404, detail=exc.message) from exc+ offload_on_quit.set_target(req.computer_id)+ return {"computer_id": offload_on_quit.target()}++@router.post("/workspaces/{workspace_id}/place",summary="Run a whole workspace on a connected computer, or bring it back",diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex ae31943844..475eea83c3 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -439,6 +439,10 @@ interface AgenticTerminalProps {onFork?: () => void;/** Compact header only: the worktree branch this pane runs on, if any. */branch?: string;+ /** Compact header only: the connected computer this pane runs on, if any. */+ computerName?: string;+ /** Compact header only: "Run on …" / "Bring back" menu entries. */+ placementItems?: { label: string; run: () => void }[];/** Registry identity and optional custom logo for the compact header. */agent?: string;agentLogoUrl?: string;@@ -569,6 +573,8 @@ export function AgenticTerminal({headerMode = "legacy",onFork,branch,+ computerName,+ placementItems,agent,agentLogoUrl,recap,@@ -2379,6 +2385,8 @@ export function AgenticTerminal({onRestart={onRestart}onFork={onFork}branch={branch}+ computerName={computerName}+ placementItems={placementItems}/> : <PaneHeaderworkspaceId={workspaceId}status={visibleStatus}diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsxindex 7b93c50ed7..b1a1779076 100644--- a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx@@ -1,9 +1,10 @@import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";import { createPortal } from "react-dom";-import { ArrowUpRight, Check, ChevronDown, ChevronRight, Copy, CopyPlus, Folder, FolderGit2, GitBranch, FolderOpen, FolderPlus, Globe, Loader2, Mic, MoreHorizontal, OctagonPause, Pencil, Pin, PinOff, Plus, SquareCode, Trash2, X, type LucideIcon } from "lucide-react";+import { ArrowUpRight, Check, ChevronDown, ChevronRight, Copy, CopyPlus, Folder, FolderGit2, GitBranch, FolderOpen, FolderPlus, Globe, Loader2, Mic, MoreHorizontal, OctagonPause, Pencil, Pin, PinOff, Plus, Server, SquareCode, Trash2, X, type LucideIcon } from "lucide-react";import { ChatLibraryError, deleteProject, openProject, patchProject, reorderProjects, revealProject, fetchProjectLaunchers, openProjectIn, type ProjectLaunchers } from "@/lib/chatLibraryApi";import { robustCopy } from "@/lib/clipboard";-import { addTerminal, fetchWorkspacePanes, interruptTerminal, removeWorkspace, renameWorkspace, startIdeSession, IdeApiError, reorderWorkspaces, type IdeProject, type ProjectWorkspace, type WorkspacePaneRow } from "@/lib/agenticIdeApi";+import { useComputerChoices } from "@/hooks/useComputers";+import { addTerminal, fetchWorkspacePanes, interruptTerminal, placeWorkspace, removeWorkspace, renameWorkspace, startIdeSession, IdeApiError, reorderWorkspaces, type IdeProject, type ProjectWorkspace, type WorkspacePaneRow } from "@/lib/agenticIdeApi";import { useEventStore } from "@/store/events";import { useIdeProjectsStore } from "@/store/ideProjects";@@ -280,6 +281,19 @@ export function IdeProjectTree() {else pushToast("success", `Interrupted ${panes.length} ${panes.length === 1 ? "agent" : "agents"}.`);};+ // A whole workspace to a connected computer (or back): one folder transfer,+ // every pane's conversation carried, the agents then run there in tmux.+ const computers = useComputerChoices();+ const placeWorkspaceOn = async (workspace: ProjectWorkspace, computerId: string | null) => {+ const target = computerId ? (computers.find((c) => c.id === computerId)?.name ?? "the computer") : "this computer";+ pushToast("info", `Moving ${workspace.name} to ${target}. This can take a minute.`);+ try {+ const { message } = await placeWorkspace(workspace.id, computerId);+ window.dispatchEvent(new CustomEvent("jarvis:ide-panes-reconnect", { detail: { workspaceId: workspace.id } }));+ pushToast("success", `${workspace.name} now runs on ${target}. ${message}`.trim());+ } catch (error) { pushToast("error", (error as Error).message); }+ };+const submitWorkspaceRename = async (workspace: ProjectWorkspace) => {const name = draftWorkspaceName.trim();if (!name || name === workspace.name) {@@ -649,6 +663,14 @@ export function IdeProjectTree() {...launcherItems(project, "workspace"),{ id: "copy", label: "Copy folder path", icon: Copy, testId: "ide-workspace-menu-copy", onSelect: run(() => void copyPath(workspace.folder || project.path)) },],+ isOpen ? [+ ...computers.filter((computer) => computer.health.status !== "provisioning").map((computer) => ({+ id: `place-${computer.id}`, label: `Move workspace to ${computer.name}`, icon: Server,+ testId: `ide-workspace-menu-place-${computer.id}`, hint: "Keeps running while this PC is off",+ onSelect: run(() => void placeWorkspaceOn(workspace, computer.id)) })),+ ...(computers.length ? [{ id: "place-home", label: "Bring workspace back here", icon: ArrowUpRight,+ testId: "ide-workspace-menu-place-home", onSelect: run(() => void placeWorkspaceOn(workspace, null)) }] : []),+ ] : [],isOpen ? [{ id: "git", label: "Git", icon: GitBranch, testId: "ide-workspace-menu-git", hint: "Commit, push, pull request, worktrees",onSelect: run(() => openGitPanel(workspace.id)) },diff --git a/jarvis/ui/web/frontend/src/components/agentic/RunOnPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/RunOnPicker.tsxnew file mode 100644index 0000000000..a011a4ba3c--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/RunOnPicker.tsx@@ -0,0 +1,86 @@+/**+ * "Runs on" — where a new workspace's agents run: this computer, or one of the+ * connected computers (a VPS, a local VM; see the Computers section). On a+ * computer the agents live in tmux there and keep working while this PC is+ * off; the folder is copied there when the workspace opens.+ */+import { Laptop, Server } from "lucide-react";+import { useComputerChoices } from "@/hooks/useComputers";+import { useEventStore } from "@/store/events";+import { cn } from "@/lib/utils";++export function RunOnPicker({+ value,+ onChange,+ disabled,+}: {+ value: string | null;+ onChange: (computerId: string | null) => void;+ disabled?: boolean;+}) {+ const computers = useComputerChoices();+ const setActiveSection = useEventStore((state) => state.setActiveSection);+ const options = [+ { id: null as string | null, name: "This computer", detail: "Stops when this PC sleeps or shuts down", online: true, icon: Laptop },+ ...computers+ .filter((computer) => computer.health.status !== "provisioning")+ .map((computer) => ({+ id: computer.id as string | null,+ name: computer.name,+ detail: computer.health.status === "online"+ ? "Keeps running while this PC is off"+ : "Not reachable right now",+ online: computer.health.status === "online",+ icon: Server,+ })),+ ];+ return (+ <fieldset data-testid="ide-run-on" disabled={disabled}>+ <legend className="text-xs font-medium text-muted-foreground">Runs on</legend>+ <div role="radiogroup" aria-label="Runs on" className="mt-2 grid gap-2 sm:grid-cols-2">+ {options.map((option) => {+ const active = option.id === value;+ const Icon = option.icon;+ return (+ <button+ key={option.id ?? "local"}+ type="button"+ role="radio"+ aria-checked={active}+ data-testid={`ide-run-on-${option.id ?? "local"}`}+ onClick={() => onChange(option.id)}+ className={cn(+ "flex items-start gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",+ active ? "border-accent bg-accent-soft" : "border-border hover:border-border-strong",+ )}+ >+ <Icon className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden="true" />+ <span className="min-w-0">+ <span className="flex items-center gap-2 text-sm font-medium text-foreground">+ <span className="truncate">{option.name}</span>+ {option.id && (+ <span+ aria-hidden="true"+ className={cn("h-1.5 w-1.5 shrink-0 rounded-full", option.online ? "bg-success" : "bg-foreground-faint")}+ />+ )}+ </span>+ <span className="block text-xs text-muted-foreground">{option.detail}</span>+ </span>+ </button>+ );+ })}+ </div>+ {computers.length === 0 && (+ <p className="mt-2 text-xs text-muted-foreground">+ Want agents that keep working while this PC is off?{" "}+ <button type="button" onClick={() => setActiveSection("computers")}+ className="font-medium text-accent underline-offset-4 hover:underline">+ Connect a server+ </button>+ </p>+ )}+ </fieldset>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsxindex 0f59e21c8e..fd26a35f24 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx@@ -4,7 +4,8 @@ import { AgentMark } from "./AgentMark";import { ForkPaneDialog, type ForkMode, type ForkSource } from "./ForkPaneDialog";import type { PaneSplitDirection } from "./WorkspaceTerminalHeader";import type { SessionState, TerminalState } from "@/lib/agenticIdeApi";-import { forkTerminal, moveTerminal, renameTerminal, type PaneMovePosition } from "@/lib/agenticIdeApi";+import { forkTerminal, moveTerminal, placeTerminal, renameTerminal, type PaneMovePosition } from "@/lib/agenticIdeApi";+import { useComputerChoices } from "@/hooks/useComputers";import { useThemeValue } from "@/hooks/useTheme";import { useEventStore } from "@/store/events";import { useIdeSidePanelStore } from "@/store/ideSidePanel";@@ -213,6 +214,50 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSeif (mounted.current) setForkBusy(false);}};+ // "Run on <computer>" / "Bring back": the pane's agent moves with its folder+ // and conversation; the pane reconnects to wherever it runs now.+ const computers = useComputerChoices();+ const [placing, setPlacing] = useState<string | null>(null);+ // A whole-workspace move (sidebar menu) restarted every pane in its new+ // place; reconnect each one so it shows the agent where it runs now.+ useEffect(() => {+ const onReconnect = (event: Event) => {+ const detail = (event as CustomEvent<{ workspaceId?: string }>).detail;+ if (detail?.workspaceId && detail.workspaceId !== latest.current.session.id) return;+ setRestarts((current) => Object.fromEntries(+ latest.current.session.terminals.map((terminal) => [idOf(terminal), (current[idOf(terminal)] ?? 0) + 1])));+ };+ window.addEventListener("jarvis:ide-panes-reconnect", onReconnect);+ return () => window.removeEventListener("jarvis:ide-panes-reconnect", onReconnect);+ }, []);+ const place = async (terminal: TerminalState, computerId: string | null) => {+ const id = idOf(terminal);+ if (placing) return;+ const target = computerId ? (computers.find((c) => c.id === computerId)?.name ?? "the computer") : "this computer";+ setPlacing(id);+ pushToast("info", `Moving ${terminal.name} to ${target}. The folder and the conversation go with it.`);+ latest.current.onMutationStart?.();+ try {+ const { session: next, message } = await placeTerminal(terminal.name, latest.current.session.id, computerId);+ if (!mounted.current) return;+ if (next && next.id === latest.current.session.id) latest.current.onChanged(next);+ setRestarts((current) => ({ ...current, [id]: (current[id] ?? 0) + 1 }));+ pushToast("success", `${terminal.name} now runs on ${target}. ${message}`.trim());+ setAnnouncement(`${terminal.name} now runs on ${target}.`);+ } catch (error) { pushToast("error", (error as Error).message); }+ finally {+ latest.current.onMutationEnd?.();+ if (mounted.current) setPlacing(null);+ }+ };+ const placementItems = (terminal: TerminalState) => {+ if (placing) return [];+ if (terminal.computer_id) return [{ label: "Bring back to this computer", run: () => void place(terminal, null) }];+ return computers.filter((computer) => computer.health.status !== "provisioning")+ .map((computer) => ({ label: `Run on ${computer.name}`, run: () => void place(terminal, computer.id) }));+ };+ const computerName = (terminal: TerminalState) => terminal.computer_id+ ? (computers.find((computer) => computer.id === terminal.computer_id)?.name ?? "another computer") : undefined;const dragged = drag ? session.terminals.find((terminal) => idOf(terminal) === drag.id) : null;// A pane picked from the side panel may sit off-screen on a narrow grid.@@ -271,6 +316,7 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSerestartToken={restarts[id] ?? 0} onRestart={() => setRestarts((current) => ({ ...current, [id]: (current[id] ?? 0) + 1 }))}splitDisabled={tiles.length >= maxPanes} onSplit={(direction) => onAdd(terminal.name, direction)}branch={terminal.branch || undefined}+ computerName={computerName(terminal)} placementItems={placementItems(terminal)}onFork={terminal.accepts_prompts === false ? undefined : () => setForking({ name: terminal.name, agent: terminal.agent, displayName: terminal.display_name, workspaceId: session.id })} />{drag?.target?.id === id && <div aria-hidden="true" data-testid="dock-preview" data-position={drag.target.position}className={cn("pointer-events-none absolute z-20 flex items-center justify-center rounded-xl border-2 p-2", drag.target.allowed ? "border-ring/70 bg-accent/[0.15]" : "border-destructive bg-background/80",diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsxindex 04927defd2..5a27c3b948 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx@@ -1,6 +1,6 @@import { useEffect, useId, useLayoutEffect, useRef, useState, type ComponentType, type CSSProperties, type MouseEvent, type PointerEvent, type SVGProps } from "react";import { createPortal } from "react-dom";-import { Check, GitBranch, Maximize2, Minimize2, MoreHorizontal, Plus, X } from "lucide-react";+import { Check, GitBranch, Maximize2, Minimize2, MoreHorizontal, Plus, Server, X } from "lucide-react";import { AgentMark } from "./AgentMark";import { BranchIcon } from "./branchIcon";import { usePaneTitle } from "@/store/paneRecaps";@@ -35,6 +35,10 @@ interface Props {onFork?: () => void;/** The git worktree branch this pane runs on, when it is a worktree fork. */branch?: string;+ /** The connected computer this pane's agent runs on (a VPS, a local VM). */+ computerName?: string;+ /** "Run on …" / "Bring back" entries for the pane's menu. */+ placementItems?: { label: string; run: () => void }[];}type MenuIcon = ComponentType<SVGProps<SVGSVGElement>>;@@ -54,6 +58,7 @@ export function WorkspaceTerminalHeader({name, workspaceId, promptCount = 0, agent, agentLogoUrl, displayName, status, appearance, arranging = false,maximized = false, addDisabled = false, onArrangeStart, onActivate, onToggleMaximize,onAdd, onClose, onRename, onOpenConversation, onOpenChat, onRestart, onFork, branch,+ computerName, placementItems,}: Props) {const brand = PANE_BRAND[appearance];// The pane's goal in a few words, in place of its call-sign; the call-sign@@ -152,6 +157,9 @@ export function WorkspaceTerminalHeader({<AgentMark agent={agent} label={displayName} logoUrl={agentLogoUrl} variant="plain" size="sm"className="!text-[color:var(--pane-ink)] [&>.bg-foreground]:!bg-[color:var(--pane-ink)]" /><span data-testid={`pane-title-${name}`} title={title ? `${title} (${name})` : name} className="truncate">{title || name}</span>+ {computerName && <span data-testid={`pane-computer-${name}`} title={`Runs on ${computerName}. It keeps working while this app is closed.`}+ className="flex min-w-0 max-w-[35%] shrink items-center gap-1 rounded bg-[color:var(--pane-chip)] px-1.5 py-0.5 text-[11px] font-normal text-[color:var(--pane-ink-muted)]">+ <Server className="h-3 w-3 shrink-0" aria-hidden="true" /><span className="truncate">{computerName}</span></span>}{branch && <span data-testid={`pane-branch-${name}`} title={`Runs in its own git worktree on branch ${branch}`}className="flex min-w-0 max-w-[45%] shrink items-center gap-1 rounded bg-[color:var(--pane-chip)] px-1.5 py-0.5 font-mono text-[11px] font-normal text-[color:var(--pane-ink-muted)]"><GitBranch className="h-3 w-3 shrink-0" aria-hidden="true" /><span className="truncate">{branch}</span>@@ -212,6 +220,7 @@ export function WorkspaceTerminalHeader({onOpenConversation && { label: "Conversation history", run: onOpenConversation },onOpenChat && { label: "Open as chat", run: onOpenChat },stopped && onRestart && { label: "Restart agent", run: onRestart },+ ...(placementItems ?? []).map((item, index) => ({ ...item, Icon: Server, separated: index === 0 })),] as (MenuItem | false | undefined | null)[]).filter((item): item is MenuItem => Boolean(item)).map((item) =><button type="button" role="menuitem" key={item.label} onClick={() => choose(item.run)}className={`flex w-full items-center gap-2 rounded px-2.5 py-2 text-left text-xs hover:bg-[color:var(--pane-chip)] focus:bg-[color:var(--pane-chip)] focus:outline-none ${item.separated ? "mt-1 border-t border-[color:var(--pane-chip)] pt-2" : ""}`}>diff --git a/jarvis/ui/web/frontend/src/hooks/useComputers.ts b/jarvis/ui/web/frontend/src/hooks/useComputers.tsindex badc7f0f29..af1a22255f 100644--- a/jarvis/ui/web/frontend/src/hooks/useComputers.ts+++ b/jarvis/ui/web/frontend/src/hooks/useComputers.ts@@ -6,6 +6,7 @@* page opens no sockets (AP-33). Every mutation writes its answer straight* into the cached list, so a check or a rename paints without a refetch.*/+import { useEffect, useState } from "react";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import {computersApi,@@ -107,3 +108,29 @@ export function useRemoveComputer() {},});}++/**+ * The computer list for surfaces that live outside the query provider (the+ * IDE's panes and menus). One quiet fetch per mount; any failure — no backend,+ * an older backend, a test without the route — is simply "no computers".+ */+export function useComputerChoices(): Computer[] {+ const [rows, setRows] = useState<Computer[]>([]);+ useEffect(() => {+ let alive = true;+ try {+ void computersApi+ .list()+ .then((list) => {+ if (alive && Array.isArray(list)) setRows(list);+ })+ .catch(() => undefined);+ } catch {+ /* fetch unavailable: no computers */+ }+ return () => {+ alive = false;+ };+ }, []);+ return rows;+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/de.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/de.jsonindex 38f358bfe4..794bdbe20d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/computers/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/de.json@@ -166,6 +166,26 @@"unit_cpu": "Kerne","unit_days": "T","unit_hours": "Std",- "unit_minutes": "Min"+ "unit_minutes": "Min",+ "ready_title": "Bereit für Coding-Agenten",+ "ready_yes": "Bereit",+ "ready_no": "Noch nicht bereit",+ "ready_body": "IDE-Sitzungen und Agenten, die hier laufen, brauchen tmux, git und eine angemeldete Coding-CLI. Dann arbeiten sie weiter, auch wenn dieser PC aus ist.",+ "ready_offline": "Prüfe zuerst den Computer; diese Liste wird per SSH gelesen.",+ "ready_missing": "Nicht installiert",+ "ready_not_logged_in": "Installiert, nicht angemeldet",+ "ready_installed": "Installiert",+ "ready_copy_login": "Meine Anmeldung nutzen",+ "ready_copy_login_hint": "Kopiert die Anmeldedatei dieser CLI von diesem Computer auf den Server. Nur auf einem eigenen Server tun.",+ "ready_login_copied": "{agent} ist jetzt auf dem Server angemeldet.",+ "ready_install": "{items} installieren",+ "ready_needs_root": "Braucht root oder sudo für diesen Login.",+ "ready_installing": "Wird auf dem Server installiert…",+ "ready_install_done": "Installiert.",+ "ready_install_failed": "Die Installation ist fehlgeschlagen.",+ "keep_title": "Weiterarbeiten, wenn dieser PC zugeht",+ "keep_body": "Beim Beenden der App ziehen laufende Agentic-IDE-Sitzungen samt Ordner und Gespräch auf diesen Computer um und arbeiten dort weiter.",+ "keep_off": "Aus",+ "keep_failed": "Die Einstellung konnte nicht gespeichert werden."}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/en.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/en.jsonindex 2fde0944b8..2b246a7d82 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/computers/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/en.json@@ -166,6 +166,26 @@"unit_cpu": "cores","unit_days": "d","unit_hours": "h",- "unit_minutes": "min"+ "unit_minutes": "min",+ "ready_title": "Ready for coding agents",+ "ready_yes": "Ready",+ "ready_no": "Not ready yet",+ "ready_body": "IDE sessions and agents that run here need tmux, git and a logged-in coding CLI. They then keep working while this PC is off.",+ "ready_offline": "Check the computer first; this list is read over SSH.",+ "ready_missing": "Not installed",+ "ready_not_logged_in": "Installed, not logged in",+ "ready_installed": "Installed",+ "ready_copy_login": "Use my login",+ "ready_copy_login_hint": "Copies this computer's login file for this CLI to the server. Only do this on a server you own.",+ "ready_login_copied": "{agent} is now logged in on the server.",+ "ready_install": "Install {items}",+ "ready_needs_root": "Needs root or sudo on this login.",+ "ready_installing": "Installing on the server…",+ "ready_install_done": "Installed.",+ "ready_install_failed": "The installation failed.",+ "keep_title": "Keep working when this PC closes",+ "keep_body": "When you quit the app, running Agentic IDE sessions move to this computer with their folder and conversation, and carry on there.",+ "keep_off": "Off",+ "keep_failed": "The setting could not be saved."}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/es.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/es.jsonindex 0c54ceb5e4..d5ee455248 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/computers/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/es.json@@ -166,6 +166,26 @@"unit_cpu": "núcleos","unit_days": "d","unit_hours": "h",- "unit_minutes": "min"+ "unit_minutes": "min",+ "ready_title": "Listo para agentes de código",+ "ready_yes": "Listo",+ "ready_no": "Aún no está listo",+ "ready_body": "Las sesiones del IDE y los agentes que se ejecutan aquí necesitan tmux, git y una CLI de código con sesión iniciada. Así siguen trabajando aunque este PC esté apagado.",+ "ready_offline": "Comprueba primero el ordenador; esta lista se lee por SSH.",+ "ready_missing": "No instalado",+ "ready_not_logged_in": "Instalado, sin sesión",+ "ready_installed": "Instalado",+ "ready_copy_login": "Usar mi sesión",+ "ready_copy_login_hint": "Copia el archivo de sesión de esta CLI de este ordenador al servidor. Hazlo solo en un servidor propio.",+ "ready_login_copied": "{agent} ya tiene sesión iniciada en el servidor.",+ "ready_install": "Instalar {items}",+ "ready_needs_root": "Necesita root o sudo en este usuario.",+ "ready_installing": "Instalando en el servidor…",+ "ready_install_done": "Instalado.",+ "ready_install_failed": "La instalación ha fallado.",+ "keep_title": "Seguir trabajando cuando este PC se cierra",+ "keep_body": "Al cerrar la app, las sesiones del Agentic IDE en marcha se mueven a este ordenador con su carpeta y su conversación, y continúan allí.",+ "keep_off": "Desactivado",+ "keep_failed": "No se pudo guardar el ajuste."}}diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.tsindex 05f667ee44..afd590ba88 100644--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts@@ -231,6 +231,12 @@ export interface TerminalState {folder?: string;/** That worktree's branch, shown in the pane header. */branch?: string;+ /**+ * Set only for a pane whose agent runs on a connected computer (a VPS or a+ * local VM, see Computers): that computer's id and the folder there.+ */+ computer_id?: string;+ remote_folder?: string;/** Can a fork of this pane copy its chat? False: the fork starts a fresh chat. */can_fork?: boolean;/**@@ -1247,12 +1253,19 @@ export async function resolveDroppedFolder(payload: {export async function startIdeSession(folder: string,terminals: TerminalPlan[],- options: { projectId?: string; name?: string } = {},+ options: { projectId?: string; name?: string; computerId?: string } = {},): Promise<IdeState> {const res = await fetch("/api/agentic-ide/session", {method: "POST",headers: { "Content-Type": "application/json" },- body: JSON.stringify({ folder, terminals, project_id: options.projectId, name: options.name }),+ body: JSON.stringify({+ folder,+ terminals,+ project_id: options.projectId,+ name: options.name,+ // Run every pane on this connected computer; the folder is copied there first.+ computer_id: options.computerId,+ }),});if (!res.ok) throw new Error(await detail(res));const body = (await res.json()) as { session: SessionState; state: IdeState };@@ -1582,6 +1595,46 @@ export async function forkTerminal(return { session: body.state.session, terminal: body.terminal };}+/** What a placement answered: the new workspace state and a sentence for the user. */+export interface PlacementResult {+ session: SessionState | null;+ message: string;+}++/**+ * Run one pane's agent on a connected computer, or bring it back here+ * (`computerId: null`). The folder and the conversation travel with it.+ */+export async function placeTerminal(+ name: string,+ workspaceId: string,+ computerId: string | null,+): Promise<PlacementResult> {+ const res = await fetch(`/api/agentic-ide/terminals/${encodeURIComponent(name)}/place`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ workspace_id: workspaceId, computer_id: computerId }),+ });+ if (!res.ok) throw new Error(await detail(res));+ const body = (await res.json()) as { state: IdeState; message?: string };+ return { session: body.state.session, message: body.message ?? "" };+}++/** Every pane of a workspace to a connected computer, or all of them back. */+export async function placeWorkspace(+ workspaceId: string,+ computerId: string | null,+): Promise<PlacementResult> {+ const res = await fetch(`/api/agentic-ide/workspaces/${encodeURIComponent(workspaceId)}/place`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ computer_id: computerId }),+ });+ if (!res.ok) throw new Error(await detail(res));+ const body = (await res.json()) as { state: IdeState; messages?: string[] };+ return { session: body.state.session, message: (body.messages ?? []).join(" ") };+}+/** Stop one terminal's agent and remove its pane. Returns the updated workspace. */export async function closeTerminal(name: string,diff --git a/jarvis/ui/web/frontend/src/lib/computersApi.ts b/jarvis/ui/web/frontend/src/lib/computersApi.tsindex e130104692..1c7ad5f833 100644--- a/jarvis/ui/web/frontend/src/lib/computersApi.ts+++ b/jarvis/ui/web/frontend/src/lib/computersApi.ts@@ -225,3 +225,47 @@ export const computersApi = {localStatus: () => request<LocalStatus>("/local"),createLocalVm: (input: LocalVmInput) => request<Computer>("/local", post(input)),};++// ---------------------------------------------------------------------------+// Readiness for coding agents (tmux, git, the CLIs and their logins)+// ---------------------------------------------------------------------------++export type ToolId = "tmux" | "git" | "node" | "claude" | "codex";++export interface ToolState {+ id: ToolId;+ installed: boolean;+ version: string | null;+}++export interface InstallJob {+ computer_id: string;+ items: ToolId[];+ state: "running" | "done" | "failed";+ log: string[];+ started_at: number;+ finished_at: number | null;+ message: string | null;+}++export interface Readiness {+ tools: ToolState[];+ logins: Record<"claude" | "codex", boolean>;+ package_manager: string | null;+ root: boolean;+ sudo: boolean;+ os: string | null;+ ready: boolean;+ checked_at: number;+ install: InstallJob | null;+}++export const readinessApi = {+ get: (id: string) => request<Readiness>(`/${encodeURIComponent(id)}/readiness`),+ install: (id: string, items: ToolId[]) =>+ request<InstallJob>(`/${encodeURIComponent(id)}/install`, post({ items })),+ job: (id: string) =>+ request<{ install: InstallJob | null }>(`/${encodeURIComponent(id)}/install`).then((r) => r.install),+ copyLogin: (id: string, agent: "claude" | "codex") =>+ request<{ copied: string }>(`/${encodeURIComponent(id)}/copy-login`, post({ agent })),+};diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex d8c2e6069a..52d3569f12 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -4,6 +4,7 @@ import { FolderPicker } from "@/components/agentic/FolderPicker";import { VoiceBubble, storedVoiceBubbleOpen, storeVoiceBubbleOpen } from "@/components/agentic/VoiceBubble";import { WorkspaceTerminalGrid } from "@/components/agentic/WorkspaceTerminalGrid";import { WorkspaceAgentSetup } from "@/components/agentic/WorkspaceAgentSetup";+import { RunOnPicker } from "@/components/agentic/RunOnPicker";import { WorkspaceOptionsDialog } from "@/components/agentic/WorkspaceOptionsDialog";import { FONT_DEFAULT } from "@/components/agentic/paneFont";import { IdeSidePanelFrame } from "@/components/agentic/sidePanel/IdeSidePanel";@@ -74,6 +75,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {// The git half of "New workspace" and "Add coding agent": keep the checkout,// branch, or give the agents a worktree of their own.const [workspaceGit, setWorkspaceGit] = useState<GitPlan>(KEEP_CHECKOUT);+ // Where the new workspace's agents run: null = this computer (see RunOnPicker).+ const [workspaceComputer, setWorkspaceComputer] = useState<string | null>(null);const [agentGit, setAgentGit] = useState<GitPlan>(KEEP_CHECKOUT);const [gitOpen, setGitOpen] = useState(false);const [selected, setSelected] = useState("");@@ -302,6 +305,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const ownCheckout = workspaceGit.mode === "new_worktree" || workspaceGit.mode === "open_worktree";const next = await startIdeSession(prepared?.folder ?? workspaceProject.path, workspaceAgents.map((agent) => ({ agent })), {projectId: workspaceProject.id, name: workspaceName.trim() || (ownCheckout && prepared?.branch ? prepared.branch : undefined),+ computerId: workspaceComputer ?? undefined,});setState(next);setWorkspaceProject(null);@@ -543,6 +547,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {</label><WorkspaceAgentSetup agents={installed} sessions={workspaceAgents} onChange={setWorkspaceAgents} disabled={busy} maxSessions={maxPanes} /><GitCheckoutPicker folder={workspaceProject.path} value={workspaceGit} onChange={setWorkspaceGit} disabled={busy} context="workspace" />+ <RunOnPicker value={workspaceComputer} onChange={setWorkspaceComputer} disabled={busy} /></div><footer className="flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border bg-muted/20 px-6 py-4 sm:px-8"><span className="text-xs text-muted-foreground" aria-live="polite">{workspaceAgents.length} {workspaceAgents.length === 1 ? "session" : "sessions"} · {new Set(workspaceAgents.filter(Boolean)).size} {new Set(workspaceAgents.filter(Boolean)).size === 1 ? "agent" : "agents"}</span>diff --git a/jarvis/ui/web/frontend/src/views/ComputersView.tsx b/jarvis/ui/web/frontend/src/views/ComputersView.tsxindex ae247c2d72..4edaee2d18 100644--- a/jarvis/ui/web/frontend/src/views/ComputersView.tsx+++ b/jarvis/ui/web/frontend/src/views/ComputersView.tsx@@ -34,6 +34,7 @@ import { AddComputerDialog, PathChoices, type AddPath } from "@/views/computers/import { ComputerDetail } from "@/views/computers/ComputerDetail";import { ComputerRow } from "@/views/computers/ComputerRow";import { CopyField, needsAttention } from "@/views/computers/parts";+import { KeepWorking } from "@/views/computers/KeepWorking";/** Keyframes the provisioning bar uses; scoped by name, shipped with the view. */const KEYFRAMES = `@keyframes computers-indeterminate {@@ -220,6 +221,8 @@ export function ComputersView() {</ul></Panel>+ <KeepWorking computers={rows} />+<IdentityStrip /></>)}diff --git a/jarvis/ui/web/frontend/src/views/computers/AgentReadiness.tsx b/jarvis/ui/web/frontend/src/views/computers/AgentReadiness.tsxnew file mode 100644index 0000000000..11f5205cdd--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/AgentReadiness.tsx@@ -0,0 +1,217 @@+/**+ * "Ready for coding agents" — what this computer needs so IDE sessions and+ * Jarvis agents can run on it (tmux, git, Node, the claude / codex CLIs and+ * their logins), with the one action per missing piece.+ *+ * Nothing is installed unasked: the install button names exactly what it+ * installs, runs as a job on the server and streams its log here. Copying+ * this computer's CLI login to the server is its own explicit button.+ */+import { useEffect, useMemo, useState } from "react";+import { useQuery, useQueryClient } from "@tanstack/react-query";+import { Bot, Check, Download, KeyRound, Loader2, RefreshCw, X } from "lucide-react";+import { Panel } from "@/components/extensions/primitives";+import { Button } from "@/components/ui/button";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import { readinessApi, type Computer, type InstallJob, type ToolId } from "@/lib/computersApi";++const TOOL_LABELS: Record<ToolId, string> = {+ tmux: "tmux",+ git: "git",+ node: "Node.js",+ claude: "Claude Code",+ codex: "Codex",+};++function errorText(error: unknown): string {+ return error instanceof Error ? error.message : String(error);+}++export function AgentReadiness({ computer }: { computer: Computer }) {+ const t = useT();+ const qc = useQueryClient();+ const online = computer.health.status === "online";+ const key = ["computers", computer.id, "readiness"] as const;+ const readiness = useQuery({+ queryKey: key,+ queryFn: () => readinessApi.get(computer.id),+ enabled: online,+ retry: false,+ staleTime: 60_000,+ });+ const [job, setJob] = useState<InstallJob | null>(null);+ const [busy, setBusy] = useState<string | null>(null);+ const [error, setError] = useState<string | null>(null);+ const [notice, setNotice] = useState<string | null>(null);++ useEffect(() => {+ if (readiness.data?.install) setJob(readiness.data.install);+ }, [readiness.data]);++ // Poll the install job while it runs; refresh the checklist when it ends.+ useEffect(() => {+ if (job?.state !== "running") return;+ const timer = window.setInterval(() => {+ void readinessApi.job(computer.id).then((next) => {+ setJob(next);+ if (next && next.state !== "running") void qc.invalidateQueries({ queryKey: key });+ }).catch(() => undefined);+ }, 2500);+ return () => window.clearInterval(timer);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [job?.state, computer.id]);++ const missing = useMemo(+ () => (readiness.data?.tools ?? []).filter((tool) => !tool.installed).map((tool) => tool.id),+ [readiness.data],+ );++ async function install() {+ setBusy("install");+ setError(null);+ try {+ setJob(await readinessApi.install(computer.id, missing));+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(null);+ }+ }++ async function copyLogin(agent: "claude" | "codex") {+ setBusy(agent);+ setError(null);+ setNotice(null);+ try {+ await readinessApi.copyLogin(computer.id, agent);+ setNotice(t("computers.ready_login_copied").replace("{agent}", TOOL_LABELS[agent]));+ await qc.invalidateQueries({ queryKey: key });+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(null);+ }+ }++ const data = readiness.data;+ return (+ <div data-testid="computer-readiness">+ <Panel className="p-5">+ <div className="mb-4 flex items-center gap-2.5">+ <Bot className="h-4 w-4 text-muted-foreground" aria-hidden />+ <h3 className="flex-1 text-base font-semibold text-foreground-strong">{t("computers.ready_title")}</h3>+ {data && (+ <span+ className={cn(+ "rounded-full px-2 py-0.5 text-xs font-medium",+ data.ready ? "bg-success/15 text-success" : "bg-warning/15 text-warning",+ )}+ >+ {data.ready ? t("computers.ready_yes") : t("computers.ready_no")}+ </span>+ )}+ <Button+ type="button"+ variant="ghost"+ size="icon"+ aria-label={t("computers.refresh")}+ disabled={!online || readiness.isFetching}+ onClick={() => void readiness.refetch()}+ >+ {readiness.isFetching ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ </Button>+ </div>+ <p className="mb-4 text-sm text-muted-foreground">{t("computers.ready_body")}</p>++ {!online && <p className="text-sm text-muted-foreground">{t("computers.ready_offline")}</p>}+ {readiness.isError && <p role="alert" className="text-sm text-destructive">{errorText(readiness.error)}</p>}++ {data && (+ <>+ <ul className="grid gap-2 sm:grid-cols-2">+ {data.tools.map((tool) => {+ const loginNeeded = (tool.id === "claude" || tool.id === "codex") && tool.installed;+ const loggedIn = loginNeeded ? data.logins[tool.id as "claude" | "codex"] : true;+ return (+ <li+ key={tool.id}+ className="flex items-center gap-2.5 rounded-md border border-border px-3 py-2"+ data-testid={`readiness-${tool.id}`}+ >+ {tool.installed && loggedIn ? (+ <Check className="h-4 w-4 shrink-0 text-success" aria-hidden />+ ) : (+ <X className="h-4 w-4 shrink-0 text-foreground-faint" aria-hidden />+ )}+ <span className="min-w-0 flex-1">+ <span className="block text-sm font-medium text-foreground-strong">{TOOL_LABELS[tool.id]}</span>+ <span className="block truncate text-xs text-muted-foreground">+ {!tool.installed+ ? t("computers.ready_missing")+ : !loggedIn+ ? t("computers.ready_not_logged_in")+ : tool.version ?? t("computers.ready_installed")}+ </span>+ </span>+ {loginNeeded && !loggedIn && (+ <Button+ type="button"+ variant="outline"+ size="sm"+ disabled={busy !== null}+ onClick={() => void copyLogin(tool.id as "claude" | "codex")}+ title={t("computers.ready_copy_login_hint")}+ >+ {busy === tool.id ? <Loader2 className="animate-spin" /> : <KeyRound />}+ {t("computers.ready_copy_login")}+ </Button>+ )}+ </li>+ );+ })}+ </ul>++ {missing.length > 0 && job?.state !== "running" && (+ <div className="mt-4 flex flex-wrap items-center gap-3">+ <Button type="button" disabled={busy !== null} onClick={() => void install()} data-testid="readiness-install">+ {busy === "install" ? <Loader2 className="animate-spin" /> : <Download />}+ {t("computers.ready_install").replace(+ "{items}",+ missing.map((id) => TOOL_LABELS[id]).join(", "),+ )}+ </Button>+ {!data.root && !data.sudo && (+ <span className="text-xs text-muted-foreground">{t("computers.ready_needs_root")}</span>+ )}+ </div>+ )}+ </>+ )}++ {job && (+ <div className="mt-4 overflow-hidden rounded-lg border border-border bg-surface-raised">+ <div className="flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground">+ {job.state === "running" && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}+ {job.state === "done" && <Check className="h-3.5 w-3.5 text-success" aria-hidden />}+ {job.state === "failed" && <X className="h-3.5 w-3.5 text-destructive" aria-hidden />}+ <span>+ {job.state === "running"+ ? t("computers.ready_installing")+ : job.state === "done"+ ? t("computers.ready_install_done")+ : job.message ?? t("computers.ready_install_failed")}+ </span>+ </div>+ <pre className="max-h-40 overflow-y-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] leading-4 text-foreground-secondary scrollbar-jarvis">+ {job.log.slice(-40).join("\n") || "…"}+ </pre>+ </div>+ )}++ {notice && <p className="mt-3 text-sm text-success">{notice}</p>}+ {error && <p role="alert" className="mt-3 text-sm text-destructive">{error}</p>}+ </Panel>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsx b/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsxindex 1ff6f0e442..da98c7889b 100644--- a/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsx+++ b/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsx@@ -30,6 +30,7 @@ import {import { useT } from "@/i18n";import { cn } from "@/lib/utils";import { computersApi, type CommandResult, type Computer } from "@/lib/computersApi";+import { AgentReadiness } from "./AgentReadiness";import { statusLabel } from "./ComputerRow";import {CopyField,@@ -679,7 +680,8 @@ export function ComputerDetail({ computer, onBack }: { computer: Computer; onBac</Card></div>- <div className="min-w-0">+ <div className="flex min-w-0 flex-col gap-5">+ <AgentReadiness computer={computer} /><Console computer={computer} /></div></div>diff --git a/jarvis/ui/web/frontend/src/views/computers/KeepWorking.tsx b/jarvis/ui/web/frontend/src/views/computers/KeepWorking.tsxnew file mode 100644index 0000000000..5e84472960--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/KeepWorking.tsx@@ -0,0 +1,104 @@+/**+ * "Keep working when this PC closes" — the one opt-in that makes closing the+ * app safe for running coding agents: on quit, every IDE workspace with an+ * agent running on this machine moves to the chosen computer (folder,+ * uncommitted edits and conversation included) and carries on there in tmux.+ */+import { useEffect, useState } from "react";+import { Loader2, MoonStar } from "lucide-react";+import { Panel } from "@/components/extensions/primitives";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import type { Computer } from "@/lib/computersApi";++const ENDPOINT = "/api/agentic-ide/offload-on-quit";++export function KeepWorking({ computers }: { computers: Computer[] }) {+ const t = useT();+ const [value, setValue] = useState<string | null>(null);+ const [loaded, setLoaded] = useState(false);+ const [saving, setSaving] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ let alive = true;+ void fetch(ENDPOINT)+ .then((res) => (res.ok ? res.json() : null))+ .then((body: { computer_id?: string | null } | null) => {+ if (!alive) return;+ setValue(body?.computer_id ?? null);+ setLoaded(true);+ })+ .catch(() => {+ if (alive) setLoaded(true);+ });+ return () => {+ alive = false;+ };+ }, []);++ async function choose(next: string | null) {+ setSaving(true);+ setError(null);+ try {+ const res = await fetch(ENDPOINT, {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ computer_id: next }),+ });+ if (!res.ok) throw new Error(`${res.status}`);+ setValue(next);+ } catch {+ setError(t("computers.keep_failed"));+ } finally {+ setSaving(false);+ }+ }++ const options = [+ { id: null as string | null, label: t("computers.keep_off") },+ ...computers+ .filter((computer) => computer.health.status !== "provisioning")+ .map((computer) => ({ id: computer.id as string | null, label: computer.name })),+ ];++ return (+ <Panel className="p-5">+ <div className="flex items-start gap-3">+ <MoonStar className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <span className="text-base font-semibold text-foreground-strong">{t("computers.keep_title")}</span>+ {saving && <Loader2 className="h-3.5 w-3.5 animate-spin text-muted-foreground" aria-hidden />}+ </div>+ <p className="mt-0.5 text-sm text-muted-foreground">{t("computers.keep_body")}</p>+ <div role="radiogroup" aria-label={t("computers.keep_title")} className="mt-4 flex flex-wrap gap-1.5" data-testid="computers-keep-working">+ {options.map((option) => {+ const active = loaded && option.id === value;+ return (+ <button+ key={option.id ?? "off"}+ type="button"+ role="radio"+ aria-checked={active}+ disabled={!loaded || saving}+ onClick={() => void choose(option.id)}+ className={cn(+ "h-8 rounded-md border px-3 text-sm font-medium transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",+ active+ ? "border-accent bg-accent-soft text-foreground-strong"+ : "border-border text-muted-foreground hover:border-border-strong hover:text-foreground",+ )}+ >+ {option.label}+ </button>+ );+ })}+ </div>+ {error && <p role="alert" className="mt-2 text-sm text-destructive">{error}</p>}+ </div>+ </div>+ </Panel>+ );+}