Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): right-click a coding session to archive it or close its terminal

rubenluetke10-beep2e6f61cd4772
diff --git a/docs/jarvis-cli-reference.md b/docs/jarvis-cli-reference.md
index 54bfa7c3c0..1f1355dc70 100644
--- a/docs/jarvis-cli-reference.md
+++ b/docs/jarvis-cli-reference.md
@@ -108,6 +108,7 @@ _Generated from the curated command tree by `scripts/ci/gen_cli_reference.py`
## ide
+- `jarvis ide archive-terminal <name> --restore --workspace --dry-run` — Hide a coding session from the chat list, or restore it.
- `jarvis ide close-terminals <names> --yes --dry-run` — Stop several coding agents and close their terminal panes.
- `jarvis ide rename-terminal <name> <new_name> --dry-run` — Rename a running terminal pane without restarting its agent.
diff --git a/jarvis/agentic_ide/resume_store.py b/jarvis/agentic_ide/resume_store.py
index 8cb696a356..d797f69969 100644
--- a/jarvis/agentic_ide/resume_store.py
+++ b/jarvis/agentic_ide/resume_store.py
@@ -64,6 +64,9 @@ class SnapshotTerminal:
# Opaque identity of the pane's on-demand prompt-history stream. Additive:
# older snapshots leave it empty and receive a fresh id when restored.
history_id: str = ""
+ # Hidden from the chat-mode session list. Additive: older snapshots
+ # leave it false, which is the list as it was before archive existed.
+ archived: bool = False
column: int = 0
slot: int = 0
resume: ResumeHandle | None = None
@@ -100,6 +103,7 @@ class SnapshotTerminal:
"name": self.name,
"agent": self.agent,
"history_id": self.history_id,
+ "archived": self.archived,
"column": self.column,
"slot": self.slot,
"resume": self.resume.to_dict() if self.resume else None,
@@ -125,6 +129,7 @@ class SnapshotTerminal:
name=name,
agent=agent,
history_id=str(data.get("history_id") or "").strip(),
+ archived=data.get("archived") is True,
column=_as_int(data.get("column")),
slot=_as_int(data.get("slot")),
resume=ResumeHandle.from_dict(data.get("resume")),
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index a6640c1fe0..cb727a89cb 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -881,6 +881,10 @@ class Terminal:
# still the same pane. Prompt-history files use this id to preserve exactly
# that boundary across app restarts.
history_id: str = field(default_factory=lambda: uuid4().hex)
+ # Hidden from the chat-mode session list. The pane itself keeps running —
+ # archive is a list filter, not a close. Survives a restart because the
+ # resume snapshot carries it, so a cleaned-up sidebar stays cleaned up.
+ archived: bool = False
# Coarse "where does this pane roughly sit" HINTS, derived from the
# workspace's layout tree by `_renumber` after every structural change —
# never authoritative. The tree (``Session.layout``) is the geometry now:
@@ -1272,6 +1276,8 @@ class Terminal:
# Whether a handle EXISTS, never the handle itself: it is an
# internal pointer into the CLI's history and no client needs it.
"has_resume": self.resume is not None,
+ # Chat-mode session list only. The grid still draws every pane.
+ "archived": self.archived,
"account": self.account,
"account_label": account_label(self.account),
}
@@ -1325,6 +1331,7 @@ class Terminal:
# Whether one is actually on disk is the transcript endpoint's
# answer; this only says the pane holds a handle to look up.
"has_resume": self.resume is not None,
+ "archived": self.archived,
"account": self.account,
"account_label": account_label(self.account),
}
@@ -1352,6 +1359,7 @@ class Terminal:
name=self.name,
agent=self.agent,
history_id=self.history_id,
+ archived=self.archived,
column=self.column,
slot=self.slot,
resume=self.resume,
@@ -2290,6 +2298,7 @@ class Registry:
display_name=agent_display(entry.agent),
index=index,
history_id=entry.history_id or uuid4().hex,
+ archived=entry.archived,
column=entry.column,
slot=entry.slot,
resume=entry.resume,
@@ -4438,15 +4447,44 @@ class Registry:
logger.info("Agentic IDE: renamed terminal {} to {}", previous, cleaned)
return session, term
- async def close_terminal(self, wanted: str) -> Terminal:
+ async def set_terminal_archived(
+ self, wanted: str, archived: bool, *, workspace_id: str | None = None
+ ) -> tuple[Session, Terminal]:
+ """Hide or restore a pane in the chat-mode session list.
+
+ The pane keeps running. Archive is a list filter: a workspace with two
+ dozen agents is unusable as a conversation list, and closing them would
+ throw the conversations away. The flag survives a restart because the
+ resume snapshot carries it.
+
+ ``workspace_id`` pins the search to one tab. Every workspace numbers
+ its panes from T1, so without it the front workspace would archive
+ the wrong T1 whenever two tabs are open.
+ """
+ async with self._lock:
+ found = self.find_terminal(wanted, workspace_id)
+ if found is None:
+ raise self._unknown_terminal(wanted)
+ session, term = found
+ term.archived = bool(archived)
+ await self._persist()
+ logger.info(
+ "Agentic IDE: {} terminal {} in workspace {}",
+ "archived" if term.archived else "restored",
+ term.name,
+ session.id,
+ )
+ return session, term
+
+ async def close_terminal(self, wanted: str, *, workspace_id: str | None = None) -> Terminal:
"""Stop one terminal's agent and remove its pane from the workspace."""
- closed, failed = await self.close_terminals([wanted])
+ closed, failed = await self.close_terminals([wanted], workspace_id=workspace_id)
if failed:
raise SessionError(failed[0]["detail"])
return closed[0]
async def close_terminals(
- self, wanted: list[str]
+ self, wanted: list[str], *, workspace_id: str | None = None
) -> tuple[list[Terminal], list[dict[str, str]]]:
"""Stop several panes under one registry lock and persist once.
@@ -4454,11 +4492,18 @@ class Registry:
terminal is closed. Resolving the complete selection before teardown
keeps concurrent callers from changing which pane a name refers to
halfway through the batch.
+
+ ``workspace_id`` pins the batch to one tab. The default is the workspace
+ on screen, which is what the grid's own close is asking about.
"""
async with self._lock:
- session = self.session
+ session = self.get(workspace_id) if workspace_id is not None else self.session
if session is None:
- raise SessionError("No Agentic-IDE session is running.")
+ raise SessionError(
+ "That workspace is not open."
+ if workspace_id is not None
+ else "No Agentic-IDE session is running."
+ )
known = ", ".join(t.name for t in session.terminals) or "none"
resolved: list[Terminal] = []
failed: list[dict[str, str]] = []
diff --git a/jarvis/cli_ctl/commands/ide.py b/jarvis/cli_ctl/commands/ide.py
index 8246e0ea1f..f428fbd2dd 100644
--- a/jarvis/cli_ctl/commands/ide.py
+++ b/jarvis/cli_ctl/commands/ide.py
@@ -1,4 +1,5 @@
"""ide: control Agentic IDE workspaces and terminal panes."""
+
from __future__ import annotations
from typing import Annotated
@@ -27,6 +28,34 @@ def rename_terminal(
)
[email protected]("archive-terminal")
+def archive_terminal(
+ name: Annotated[str, typer.Argument(help="Terminal call-sign.")],
+ restore: bool = typer.Option(
+ False, "--restore", help="Show the chat in the session list again."
+ ),
+ workspace: Annotated[
+ str | None,
+ typer.Option("--workspace", help="Workspace id when several tabs are open."),
+ ] = None,
+ dry_run: bool = options.dry_opt(),
+) -> None:
+ """Hide a coding session from the chat list, or restore it.
+
+ The terminal keeps running. Closing it is `ide close-terminals`.
+ """
+ body: dict[str, object] = {"archived": not restore}
+ if workspace:
+ body["workspace_id"] = workspace
+ invoke.run(
+ "POST",
+ f"/api/agentic-ide/terminals/{quote(name, safe='')}/archive",
+ body=body,
+ dry_run=dry_run,
+ dangerous=False,
+ )
+
+
@app.command("close-terminals")
def close_terminals(
names: Annotated[list[str], typer.Argument(help="Terminal call-signs to close.")],
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 1f792b63cc..1c7474a901 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -39,6 +39,7 @@ Endpoints (prefix ``/api/agentic-ide``):
(open the panes, divide the work, brief each one, report who was reached)
* ``GET /terminals/{name}/report`` → what one named terminal is doing
* ``PATCH /terminals/{terminal}`` → give that pane another call-sign
+* ``POST /terminals/{name}/archive`` → hide or restore a chat in the session list
* ``GET /terminals/{name}/prompts`` → every prompt handed to that pane
* ``POST /terminals/{name}/prompt`` → type a prompt into it and press Enter
* ``POST /terminals/{name}/attach`` → drop/paste files onto a pane
@@ -117,6 +118,7 @@ from jarvis.agentic_ide.session import (
SessionError,
SessionNotReady,
Terminal,
+ accepts_prompts,
account_home,
agent_argv,
coding_mode_event,
@@ -488,6 +490,17 @@ class RenameTerminalRequest(BaseModel):
)
+class ArchiveTerminalRequest(BaseModel):
+ """Hide or restore one pane in the chat-mode session list."""
+
+ archived: bool
+ #: Pins the search to one tab. Every workspace numbers its panes from T1,
+ #: so without this the front workspace would archive the wrong pane
+ #: whenever two tabs are open. The session list always knows which tab a
+ #: row came from.
+ workspace_id: str | None = None
+
+
class WorkspaceCard(BaseModel):
"""One open workspace, as the workspace bar shows it."""
@@ -673,6 +686,15 @@ class AgentStatus(BaseModel):
"with no logo, which falls back to a monogram."
),
)
+ accepts_prompts: bool = Field(
+ default=True,
+ description=(
+ "Can Jarvis type a message into a pane of this entry at all? False "
+ "for an entry whose own interface is somewhere else (DeepSeek "
+ "Harness boots a server and puts its chat in the browser), which a "
+ "surface that opens a CHAT has to know before it offers the entry."
+ ),
+ )
# --- What a pane of this entry can be OPENED on -------------------------
#
# Deliberately the agent chat's own catalog shape (``AgentChatProvider`` in
@@ -1376,6 +1398,7 @@ async def get_agents() -> AgentsResponse:
description=info.description,
custom=info.custom,
logo_url=info.logo_url,
+ accepts_prompts=accepts_prompts(info.name),
**launch_picks.offered(info.name, live),
)
for info in infos
@@ -1461,9 +1484,7 @@ async def search(q: str, limit: int = 40) -> SearchResponse:
)
- "/folders/create", response_model=CreateFolderResponse, summary="Create a new folder"
-)
[email protected]("/folders/create", response_model=CreateFolderResponse, summary="Create a new folder")
async def create_new_folder(req: CreateFolderRequest) -> CreateFolderResponse:
"""Make one folder so a workspace can start in a place that did not exist yet.
@@ -1604,8 +1625,7 @@ def _resolve_terminal_target(workspace_folder: str, printed: str) -> Path:
_WORKSPACE_PREVIEW_MAX_CHARS = 2 * 1024 * 1024
_WORKSPACE_HEX_PREVIEW_BYTES = 256
_WORKSPACE_FILE_CSP = (
- "default-src 'none'; style-src 'unsafe-inline'; img-src data:; "
- "media-src 'self'; sandbox"
+ "default-src 'none'; style-src 'unsafe-inline'; img-src data:; media-src 'self'; sandbox"
)
@@ -1685,9 +1705,7 @@ async def get_workspace_file(workspace_id: str, path: str) -> FileResponse:
response_model=WorkspaceFilePreviewResponse,
summary="Preview one file from an open workspace",
)
-async def get_workspace_file_preview(
- workspace_id: str, path: str
-) -> WorkspaceFilePreviewResponse:
+async def get_workspace_file_preview(workspace_id: str, path: str) -> WorkspaceFilePreviewResponse:
"""Return bounded readable text or a safe hexadecimal fallback."""
target = await asyncio.to_thread(_resolve_workspace_file, workspace_id, path)
try:
@@ -1824,8 +1842,7 @@ async def resolve_folder(req: ResolveRequest) -> ResolveResponse:
if not items:
return ResolveResponse(
detail=(
- f'No folder called "{wanted}" was found on this computer. '
- "Pick one from the list."
+ f'No folder called "{wanted}" was found on this computer. Pick one from the list.'
)
)
return ResolveResponse(
@@ -2642,6 +2659,38 @@ async def close_terminals_by_agent(request: Request, agent: str) -> dict:
}
+ "/terminals/{name}/archive",
+ summary="Hide or restore a chat in the session list",
+)
+async def archive_terminal(name: str, req: ArchiveTerminalRequest) -> dict:
+ """Hide a pane from the chat-mode session list, or put it back.
+
+ The pane keeps running — archive is a list filter, not a close. The grid
+ still draws it. Closing the terminal is a separate, destructive action.
+ """
+ try:
+ session, term = await get_registry().set_terminal_archived(
+ name, req.archived, workspace_id=req.workspace_id
+ )
+ except SessionError as exc:
+ message = str(exc)
+ if message.startswith("No terminal called"):
+ status = 404
+ elif "not open" in message:
+ status = 404
+ else:
+ status = 409
+ raise HTTPException(status_code=status, detail=message) from exc
+ return {
+ "ok": True,
+ "archived": term.archived,
+ "name": term.name,
+ "workspace_id": session.id,
+ "terminal": term.to_dict(),
+ }
+
+
@router.patch("/terminals/{terminal}", summary="Rename one terminal")
async def rename_terminal(request: Request, terminal: str, req: RenameTerminalRequest) -> dict:
"""Give the pane ``terminal`` another call-sign.
@@ -2685,12 +2734,17 @@ async def rename_terminal(request: Request, terminal: str, req: RenameTerminalRe
summary="Close one terminal",
openapi_extra={"x-jarvis-dangerous": True},
)
-async def close_terminal(request: Request, name: str) -> dict:
- """Stop the agent in the terminal called ``name`` and remove its pane."""
+async def close_terminal(request: Request, name: str, workspace_id: str | None = None) -> dict:
+ """Stop the agent in the terminal called ``name`` and remove its pane.
+
+ ``workspace_id`` pins the search to one tab. The session list shows every
+ open workspace, and each of them has a T1 — without the id, closing T1
+ from a background tab would stop the front workspace's T1 instead.
+ """
registry = get_registry()
- session = registry.session
+ session = registry.get(workspace_id) if workspace_id is not None else registry.session
try:
- term = await registry.close_terminal(name)
+ term = await registry.close_terminal(name, workspace_id=workspace_id)
except SessionError as exc:
raise HTTPException(status_code=404, detail=str(exc)) from exc
bus = getattr(request.app.state, "bus", None)
@@ -3782,9 +3836,7 @@ async def terminal_prompt(request: Request, name: str, req: PromptRequest) -> di
# Fire-and-forget: a beat that cannot be delivered must
# cost the line, never the brief (and never a warning
# about an unobserved task at teardown).
- task.add_done_callback(
- lambda done: done.cancelled() or done.exception()
- )
+ task.add_done_callback(lambda done: done.cancelled() or done.exception())
on_progress = _publish_beat
@@ -3830,9 +3882,7 @@ async def terminal_prompt(request: Request, name: str, req: PromptRequest) -> di
try:
# The receipt beside the brief: the sentence as typed and the files
# that went with it, for the pane's chat stage (prompt_receipts).
- term = await registry.send_prompt(
- name, text, typed=req.prompt, attachments=attachments
- )
+ term = await registry.send_prompt(name, text, typed=req.prompt, attachments=attachments)
except SessionError as exc:
raise HTTPException(status_code=409, detail=str(exc)) from exc
@@ -4247,9 +4297,7 @@ async def agentic_pty(ws: WebSocket, name: str) -> None:
_safe_int(msg.get("cols"), cols),
_safe_int(msg.get("rows"), rows),
)
- registry.claim_viewer(
- term.key, *want, pane_workspace, viewer=on_output
- )
+ registry.claim_viewer(term.key, *want, pane_workspace, viewer=on_output)
await report_geometry(want)
finally:
# The viewer went away — switched tab, reloaded, closed the browser.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
index 241a312d65..5fe4927bcc 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
@@ -3,13 +3,22 @@
* sessions, a way to open one more — the active one marked, and every click
* travelling through the store to the view that performs it.
*/
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { WorkspaceChats } from "@/components/agentic/WorkspaceChats";
import { useIdeChatStore } from "@/store/ideChat";
import { resetWorkspacePanesPoll, useWorkspacePanesStore } from "@/store/workspacePanes";
-import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";
+import { archiveTerminal, closeTerminal, type WorkspacePaneRow } from "@/lib/agenticIdeApi";
+
+vi.mock("@/lib/agenticIdeApi", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("@/lib/agenticIdeApi")>();
+ return {
+ ...actual,
+ archiveTerminal: vi.fn().mockResolvedValue(undefined),
+ closeTerminal: vi.fn().mockResolvedValue({ terminals: [] }),
+ };
+});
const HERE = "C:\\Users\\dev\\Personal Jarvis";
const THERE = "C:\\Users\\dev\\Jarvis Web UI";
@@ -62,6 +71,8 @@ const CODEX = { name: "codex", displayName: "Codex", installed: true, kind: "cli
describe("the sidebar's chat face", () => {
beforeEach(() => {
+ vi.mocked(archiveTerminal).mockClear().mockResolvedValue(undefined);
+ vi.mocked(closeTerminal).mockClear().mockResolvedValue({ terminals: [] } as never);
resetWorkspacePanesPoll();
useWorkspacePanesStore.setState({
panes: PANES,
@@ -293,4 +304,105 @@ describe("the sidebar's chat face", () => {
expect(badges[1].querySelector("[class*='shadow']")).not.toBeNull();
expect(badges[4].querySelector("[class*='shadow']")).toBeNull();
});
+
+ it("opens an options menu on right-click of a session", () => {
+ render(<WorkspaceChats />);
+ fireEvent.contextMenu(screen.getAllByTestId("workspace-session-row")[0], {
+ clientX: 40,
+ clientY: 80,
+ });
+ const menu = screen.getByTestId("workspace-session-menu");
+ expect(menu.dataset.pane).toBe("T1");
+ expect(screen.getByTestId("workspace-session-archive").textContent).toContain("Archive chat");
+ expect(screen.getByTestId("workspace-session-close").textContent).toContain("Close terminal");
+ });
+
+ it("archives a chat out of the list and keeps it findable under the workspace", async () => {
+ render(<WorkspaceChats />);
+ const row = screen.getAllByTestId("workspace-session-row")[0];
+ fireEvent.contextMenu(row);
+ fireEvent.click(screen.getByTestId("workspace-session-archive"));
+
+ await waitFor(() =>
+ expect(archiveTerminal).toHaveBeenCalledWith("T1", true, "w1"),
+ );
+ const band = screen.getAllByTestId("workspace-chats-band")[0];
+ const live = Array.from(
+ band.querySelectorAll<HTMLElement>("[data-testid='workspace-session-row']"),
+ ).filter((el) => el.dataset.archived === "false");
+ expect(live.map((el) => el.dataset.pane)).toEqual(["T2"]);
+ expect(screen.getByTestId("workspace-chats-archived-toggle-w1").textContent).toContain(
+ "Archived chats (1)",
+ );
+
+ fireEvent.click(screen.getByTestId("workspace-chats-archived-toggle-w1"));
+ const hidden = screen
+ .getAllByTestId("workspace-session-row")
+ .filter((el) => el.dataset.archived === "true");
+ expect(hidden.map((el) => el.dataset.pane)).toEqual(["T1"]);
+ });
+
+ it("restores an archived chat back into the list", async () => {
+ useWorkspacePanesStore.setState({
+ panes: [
+ pane("T1", "Claude Code", "w1", "live", { archived: true, recap: "Old work" }),
+ pane("T2", "Codex", "w1"),
+ ],
+ activeId: "w1",
+ loaded: true,
+ });
+ render(<WorkspaceChats />);
+ fireEvent.click(screen.getByTestId("workspace-chats-archived-toggle-w1"));
+ fireEvent.contextMenu(screen.getAllByTestId("workspace-session-row").find((el) => el.dataset.archived === "true")!);
+ fireEvent.click(screen.getByTestId("workspace-session-archive"));
+
+ await waitFor(() =>
+ expect(archiveTerminal).toHaveBeenCalledWith("T1", false, "w1"),
+ );
+ expect(screen.queryByTestId("workspace-chats-archived")).toBeNull();
+ expect(
+ screen.getAllByTestId("workspace-session-row").map((el) => el.dataset.pane),
+ ).toEqual(["T1", "T2"]);
+ });
+
+ it("asks before closing a terminal, then removes the row", async () => {
+ render(<WorkspaceChats />);
+ fireEvent.contextMenu(screen.getAllByTestId("workspace-session-row")[0]);
+ fireEvent.click(screen.getByTestId("workspace-session-close"));
+ expect(closeTerminal).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByTestId("workspace-chats-confirm-close-confirm"));
+
+ await waitFor(() => expect(closeTerminal).toHaveBeenCalledWith("T1", "w1"));
+ expect(screen.queryByTestId("workspace-chats-confirm-close")).toBeNull();
+ const band = screen.getAllByTestId("workspace-chats-band")[0];
+ expect(
+ Array.from(band.querySelectorAll<HTMLElement>("[data-testid='workspace-session-row']")).map(
+ (el) => el.dataset.pane,
+ ),
+ ).toEqual(["T2"]);
+ });
+
+ it("lets an archived chat be found by name once the archive is long", () => {
+ useWorkspacePanesStore.setState({
+ panes: [
+ pane("T1", "Claude Code", "w1", "live", { archived: true, recap: "Fix the login" }),
+ pane("T2", "Claude Code", "w1", "live", { archived: true, recap: "Rewrite the parser" }),
+ pane("T3", "Claude Code", "w1", "live", { archived: true, recap: "Update the docs" }),
+ pane("T4", "Claude Code", "w1", "live", { archived: true, recap: "Paint the orb" }),
+ pane("T5", "Claude Code", "w1", "live", { archived: true, recap: "Tune the wake word" }),
+ ],
+ activeId: "w1",
+ loaded: true,
+ });
+ render(<WorkspaceChats />);
+ fireEvent.click(screen.getByTestId("workspace-chats-archived-toggle-w1"));
+ const search = screen.getByTestId("workspace-chats-archived-search");
+ fireEvent.change(search, { target: { value: "parser" } });
+ const shown = screen
+ .getAllByTestId("workspace-session-row")
+ .filter((el) => el.dataset.archived === "true");
+ expect(shown.map((el) => el.textContent)).toEqual([
+ expect.stringContaining("Rewrite the parser"),
+ ]);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
index ccacc6113d..83985f309d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
@@ -426,19 +426,26 @@ function SessionRow({
data-activity={pane.activity}
data-archived={pane.archived ? "true" : "false"}
className={cn(
- "flex w-full items-center gap-2 rounded-lg py-1.5 pl-8 pr-2 text-left transition-colors",
+ "flex w-full items-start gap-2 rounded-lg py-1.5 pl-8 pr-2 text-left transition-colors",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
active ? "bg-card text-foreground shadow-sm" : "hover:bg-background/60",
)}
>
- <AgentMark agent={pane.agent} label={cli} logoUrl={logoUrl} variant="plain" size="sm" />
+ <AgentMark
+ agent={pane.agent}
+ label={cli}
+ logoUrl={logoUrl}
+ variant="plain"
+ size="sm"
+ className="mt-0.5"
+ />
<span
- className="min-w-0 flex-1 truncate text-xs text-foreground"
+ className="min-w-0 flex-1 line-clamp-2 text-xs text-foreground"
data-testid="workspace-session-title"
>
{label}
</span>
- <span className="shrink-0 truncate font-mono text-[10px] text-muted-foreground/70">
+ <span className="mt-0.5 shrink-0 truncate font-mono text-[10px] text-muted-foreground/70">
{pane.name}
</span>
{/* The grid's own badge, not a second reading of the same facts.
@@ -451,12 +458,14 @@ function SessionRow({
hollow ring for a pane nobody has asked anything, a beacon for one
holding a question. Same component as the pane's header, so the
list and the grid can never disagree about one pane. */}
- <PaneActivityPill
- status={pane.status}
- activity={pane.activity}
- since={pane.activity_since}
- worked={pane.worked}
- />
+ <span className="mt-0.5 shrink-0">
+ <PaneActivityPill
+ status={pane.status}
+ activity={pane.activity}
+ since={pane.activity_since}
+ worked={pane.worked}
+ />
+ </span>
</button>
</li>
);
@@ -511,10 +520,10 @@ function ArchivedChats({
{open && (
<div className="pb-1">
{panes.length >= ARCHIVED_SEARCH_AT && (
- <div className="relative px-2 pb-1 pt-0.5">
+ <div className="relative mx-2 mb-1">
<Search
aria-hidden
- className="pointer-events-none absolute left-10 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"
+ className="pointer-events-none absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"
/>
<input
type="search"
@@ -523,7 +532,7 @@ function ArchivedChats({
placeholder={t("ide_chats.archived_search")}
aria-label={t("ide_chats.archived_search")}
data-testid="workspace-chats-archived-search"
- className="w-full rounded-md border border-border bg-background/60 py-1 pl-8 pr-2 text-[11px] text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="w-full rounded-md border border-border bg-background/60 py-1 pl-7 pr-2 text-[11px] text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
/>
</div>
)}
@@ -675,6 +684,9 @@ function ConfirmCloseTerminal({
aria-label={fill(t("ide_chats.close_title"), { name: pane.name })}
data-testid="workspace-chats-confirm-close"
className="fixed inset-0 z-[100] flex items-center justify-center bg-background/70 p-6 backdrop-blur-sm"
+ onClick={(event) => {
+ if (event.target === event.currentTarget && !busy) onCancel();
+ }}
onKeyDown={(event) => {
if (event.key === "Escape" && !busy) onCancel();
}}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 49ae385f34..f546227025 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -568,6 +568,10 @@
"chat_empty_title": "Wie kann ich helfen?",
"composer_hint": "Enter sendet · Shift+Enter für eine neue Zeile",
"model_hint": "Verwendetes Modell — zum Ändern klicken",
+ "prompt_mode_pill": "Prompt",
+ "prompt_mode_on": "Prompt-Modus ist an — jedes Diktat kommt als fertiger Prompt für einen Coding-Agenten an, mit einem Dank am Schluss. Klicken zum Ausschalten.",
+ "prompt_mode_off": "Prompt-Modus ist aus — Diktate kommen so an, wie gesprochen. Klicken, damit jedes Diktat zu einem fertigen Prompt für einen Coding-Agenten wird.",
+ "prompt_mode_failed": "Der Prompt-Modus konnte nicht umgeschaltet werden.",
"theme_to_light": "Zum hellen Modus wechseln",
"theme_to_dark": "Zum dunklen Modus wechseln",
"background_label": "Hintergrund",
@@ -4855,7 +4859,21 @@
"pick_cli_title": "Terminal öffnen — womit?",
"new_session": "Neue Sitzung — ein Workspace ohne Projektordner",
"new_workspace": "Neuer Workspace — einen Projektordner wählen",
- "pick_cli_aria": "Was soll im neuen Terminal laufen?"
+ "pick_cli_aria": "Was soll im neuen Terminal laufen?",
+ "menu_aria": "Was mit dieser Coding-Sitzung tun",
+ "archive": "Chat archivieren",
+ "archive_hint": "Diesen Chat aus der Liste nehmen. Das Terminal läuft weiter, bis du es schließt.",
+ "restore": "Chat wiederherstellen",
+ "restore_hint": "Diesen Chat wieder in der Liste zeigen.",
+ "close_terminal": "Terminal schließen",
+ "close_hint": "Diesen Agenten stoppen und das Terminal entfernen. Das lässt sich nicht rückgängig machen.",
+ "archived_section": "Archivierte Chats",
+ "archived_count": "Archivierte Chats ({n})",
+ "archived_search": "Archivierten Chat finden",
+ "close_title": "{name} schließen?",
+ "close_body": "Der Coding-Agent in diesem Terminal wird gestoppt und diese Sitzung ist weg. Was schon auf die Platte geschrieben wurde, bleibt.",
+ "close_keep": "Offen lassen",
+ "close_confirm": "{name} schließen"
},
"agentic_grid": {
"view_switch": {
@@ -5505,7 +5523,11 @@
"col_calls": "Aufrufe",
"billing_label": "Welche Ausgaben zeigen",
"top_refs_subtitle_counted": "Die {shown} teuersten von {total} Gesprächen, Chats und Missionen — {share} der Gesamtsumme. Zum Filtern anklicken.",
- "billing": {"all": "Alle", "billed": "Über Keys bezahlt", "subscription": "Über Abos"},
+ "billing": {
+ "all": "Alle",
+ "billed": "Über Keys bezahlt",
+ "subscription": "Über Abos"
+ },
"speech_area_note": "Hören und Sprechen werden in Audiosekunden und Zeichen abgerechnet — nie in Tokens. Ein Sprache-zu-Sprache-Modell hat kein eigenes Ohr und keinen eigenen Mund; seine Turns stehen unter {name} → Realtime-Stimme. Eine Zeile mit 0,00 $ ist entweder eine lokale Engine (kostenlos) oder ein Anbieter ohne veröffentlichten Tarif — die Spalte „Tarif“ sagt, was zutrifft.",
"col_rate": "Tarif",
"stat_total_hint_seat_only": "API-Gegenwert — vollständig durch Abos gedeckt, nichts über einen Key abgerechnet",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 0b35b672e3..2124387c63 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -568,6 +568,10 @@
"chat_empty_title": "How can I help?",
"composer_hint": "Enter to send · Shift+Enter for a new line",
"model_hint": "Model in use — click to change it",
+ "prompt_mode_pill": "Prompt",
+ "prompt_mode_on": "Prompt Mode is on — every dictation comes out as a finished prompt for a coding agent, closing with thanks. Click to switch it off.",
+ "prompt_mode_off": "Prompt Mode is off — dictations arrive as spoken. Click to turn every dictation into a finished prompt for a coding agent.",
+ "prompt_mode_failed": "Prompt Mode could not be switched.",
"theme_to_light": "Switch to light mode",
"theme_to_dark": "Switch to dark mode",
"background_label": "Background",
@@ -4855,7 +4859,21 @@
"pick_cli_title": "Open a terminal — what?",
"new_session": "New session — a workspace with no project folder",
"new_workspace": "New workspace — pick a project folder",
- "pick_cli_aria": "What should run in the new terminal?"
+ "pick_cli_aria": "What should run in the new terminal?",
+ "menu_aria": "What to do with this coding session",
+ "archive": "Archive chat",
+ "archive_hint": "Hide this chat from the list. The terminal keeps running until you close it.",
+ "restore": "Restore chat",
+ "restore_hint": "Show this chat in the list again.",
+ "close_terminal": "Close terminal",
+ "close_hint": "Stop this agent and remove its terminal. There is no undo.",
+ "archived_section": "Archived chats",
+ "archived_count": "Archived chats ({n})",
+ "archived_search": "Find an archived chat",
+ "close_title": "Close {name}?",
+ "close_body": "The coding agent in this terminal is stopped and this session is gone. Anything it already wrote to disk stays.",
+ "close_keep": "Keep it open",
+ "close_confirm": "Close {name}"
},
"agentic_grid": {
"view_switch": {
@@ -5505,7 +5523,11 @@
"col_calls": "Calls",
"billing_label": "Which spend to show",
"top_refs_subtitle_counted": "The {shown} most expensive of {total} conversations, chats and missions — {share} of the total. Click one to filter by it.",
- "billing": {"all": "All", "billed": "Billed to keys", "subscription": "On subscriptions"},
+ "billing": {
+ "all": "All",
+ "billed": "Billed to keys",
+ "subscription": "On subscriptions"
+ },
"speech_area_note": "Hearing and speaking are billed in audio seconds and characters — never tokens. A speech-to-speech model has no separate ear or mouth, so its turns sit under {name} → Realtime voice. A row at $0.00 is either a local engine (free) or a vendor that publishes no rate — the Rate column says which.",
"col_rate": "Rate",
"stat_total_hint_seat_only": "API-equivalent — fully covered by subscriptions, nothing billed to a key",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 978d02736d..3a57292e20 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -568,6 +568,10 @@
"chat_empty_title": "¿En qué puedo ayudar?",
"composer_hint": "Enter envía · Shift+Enter para una nueva línea",
"model_hint": "Modelo en uso — haz clic para cambiarlo",
+ "prompt_mode_pill": "Prompt",
+ "prompt_mode_on": "El modo Prompt está activado: cada dictado llega como un prompt terminado para un agente de código, con un agradecimiento al final. Haz clic para desactivarlo.",
+ "prompt_mode_off": "El modo Prompt está desactivado: los dictados llegan tal como se dijeron. Haz clic para convertir cada dictado en un prompt terminado para un agente de código.",
+ "prompt_mode_failed": "No se pudo cambiar el modo Prompt.",
"theme_to_light": "Cambiar al modo claro",
"theme_to_dark": "Cambiar al modo oscuro",
"background_label": "Fondo",
@@ -4855,7 +4859,21 @@
"pick_cli_title": "Abrir un terminal — ¿con qué?",
"new_session": "Nueva sesión — un workspace sin carpeta de proyecto",
"new_workspace": "Nuevo workspace — elegir una carpeta de proyecto",
- "pick_cli_aria": "¿Qué debe ejecutarse en el nuevo terminal?"
+ "pick_cli_aria": "¿Qué debe ejecutarse en el nuevo terminal?",
+ "menu_aria": "Qué hacer con esta sesión de código",
+ "archive": "Archivar chat",
+ "archive_hint": "Ocultar este chat de la lista. El terminal sigue en marcha hasta que lo cierres.",
+ "restore": "Restaurar chat",
+ "restore_hint": "Volver a mostrar este chat en la lista.",
+ "close_terminal": "Cerrar terminal",
+ "close_hint": "Detener este agente y quitar su terminal. No se puede deshacer.",
+ "archived_section": "Chats archivados",
+ "archived_count": "Chats archivados ({n})",
+ "archived_search": "Buscar un chat archivado",
+ "close_title": "¿Cerrar {name}?",
+ "close_body": "El agente de código de este terminal se detiene y esta sesión desaparece. Lo que ya escribió en disco se queda.",
+ "close_keep": "Dejarlo abierto",
+ "close_confirm": "Cerrar {name}"
},
"agentic_grid": {
"view_switch": {
@@ -5505,7 +5523,11 @@
"col_calls": "Llamadas",
"billing_label": "Qué gasto mostrar",
"top_refs_subtitle_counted": "Las {shown} más caras de {total} conversaciones, chats y misiones — {share} del total. Haz clic en una para filtrar.",
- "billing": {"all": "Todo", "billed": "Facturado a claves", "subscription": "Con suscripciones"},
+ "billing": {
+ "all": "Todo",
+ "billed": "Facturado a claves",
+ "subscription": "Con suscripciones"
+ },
"speech_area_note": "Escuchar y hablar se facturan en segundos de audio y caracteres — nunca en tokens. Un modelo voz a voz no tiene oído ni boca propios; sus turnos están en {name} → Voz en tiempo real. Una fila a $0,00 es un motor local (gratis) o un proveedor sin tarifa publicada — la columna «Tarifa» lo indica.",
"col_rate": "Tarifa",
"stat_total_hint_seat_only": "Equivalente API — cubierto por completo por suscripciones, nada facturado a una clave",
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index cafe704671..05cdb8984e 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -7,7 +7,11 @@
import type { LayoutNode } from "../components/agentic/treeLayout";
// Type-only: a pane's transcript is served in the agent chat's event shape so
// the chat's own reducer can fold it (see `fetchTerminalTimeline`).
-import type { AgentChatEvent } from "./agentChatApi";
+import type {
+ AgentChatEvent,
+ CuratedModel,
+ PermissionModeOption,
+} from "./agentChatApi";
export interface AgentStatus {
name: string;
@@ -35,6 +39,35 @@ export interface AgentStatus {
* which falls back to a monogram.
*/
logo_url?: string;
+ /**
+ * Can Jarvis type into a pane of this entry at all? False for an entry whose
+ * own interface is somewhere else — DeepSeek Harness boots a server and puts
+ * its chat in the browser — which a surface that opens a CHAT has to know
+ * before it offers the entry. Absent on an older backend reads as true, the
+ * behaviour every entry had before the field existed.
+ */
+ accepts_prompts?: boolean;
+ /**
+ * What a NEW pane of this entry may be opened on — its models, its effort
+ * ladder and the permission stances it can be launched into
+ * (`jarvis/workspace/launch_picks.py`).
+ *
+ * Deliberately the agent chat's catalog shape (`AgentChatProvider`): the
+ * IDE's chat surface picks with the front page's composer, so an entry
+ * answering in the shape that composer already reads is what keeps ONE
+ * model picker in the app instead of two that drift. Absent on a backend
+ * older than this, which reads the same as "this CLI offers no picks".
+ */
+ models?: CuratedModel[];
+ /** "" = the CLI's own default, which is what every entry answers today. */
+ default_model?: string;
+ /** Ascending; empty when this CLI takes no effort pick. */
+ effort_levels?: string[];
+ default_effort?: string;
+ /** Only the stances this CLI can actually be LAUNCHED into. */
+ permission_modes?: PermissionModeOption[];
+ /** "" = the CLI's own stance; a pane opens in it until somebody picks. */
+ default_permission_mode?: string;
}
export interface AgentsResponse {
@@ -811,6 +844,11 @@ export interface WorkspacePaneRow {
readable: boolean;
account: string | null;
account_label: string | null;
+ /**
+ * Hidden from the chat-mode session list. The pane itself keeps running —
+ * archive is a list filter, not a close. The grid still draws it.
+ */
+ archived: boolean;
}
export interface WorkspacePanesResponse {
@@ -1205,6 +1243,15 @@ export async function addTerminal(payload: {
name?: string;
/** Subscription for the new pane; omitted inherits the anchor's. */
account?: string;
+ /**
+ * What the new pane RUNS ON — the picks a chat surface makes before the
+ * first message. Each is checked against what that CLI offers before it
+ * reaches a command line, so a stale one costs the CLI's own default rather
+ * than a pane that will not start. Never inherited from the anchor.
+ */
+ model?: string;
+ effort?: string;
+ permission_mode?: string;
}): Promise<SessionState> {
const res = await fetch("/api/agentic-ide/terminals", {
method: "POST",
@@ -1297,9 +1344,15 @@ export async function renameTerminal(
}
/** Stop one terminal's agent and remove its pane. Returns the updated workspace. */
-export async function closeTerminal(name: string): Promise<SessionState> {
+export async function closeTerminal(
+ name: string,
+ workspaceId?: string,
+): Promise<SessionState> {
+ const query = workspaceId
+ ? `?workspace_id=${encodeURIComponent(workspaceId)}`
+ : "";
const res = await fetch(
- `/api/agentic-ide/terminals/${encodeURIComponent(name)}`,
+ `/api/agentic-ide/terminals/${encodeURIComponent(name)}${query}`,
{ method: "DELETE" },
);
if (!res.ok) throw new Error(await detail(res));
@@ -1308,6 +1361,30 @@ export async function closeTerminal(name: string): Promise<SessionState> {
return body.state.session;
}
+/**
+ * Hide a pane from the chat-mode session list, or put it back.
+ *
+ * The pane keeps running. Closing it is a separate call.
+ */
+export async function archiveTerminal(
+ name: string,
+ archived: boolean,
+ workspaceId?: string,
+): Promise<void> {
+ const res = await fetch(
+ `/api/agentic-ide/terminals/${encodeURIComponent(name)}/archive`,
+ {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ archived,
+ ...(workspaceId ? { workspace_id: workspaceId } : {}),
+ }),
+ },
+ );
+ if (!res.ok) throw new Error(await detail(res));
+}
+
export interface CloseTerminalsResult {
closed: string[];
failed: Array<{ name: string; detail: string }>;
diff --git a/jarvis/ui/web/frontend/src/store/workspacePanes.ts b/jarvis/ui/web/frontend/src/store/workspacePanes.ts
index 3a8a311246..7bb2bc111e 100644
--- a/jarvis/ui/web/frontend/src/store/workspacePanes.ts
+++ b/jarvis/ui/web/frontend/src/store/workspacePanes.ts
@@ -3,6 +3,7 @@ import { create } from "zustand";
import {
fetchWorkspacePanes,
+ type PaneActivity,
type WorkspacePaneRow,
} from "@/lib/agenticIdeApi";
@@ -19,9 +20,57 @@ import {
*
* The poll is reference-counted: it starts when the first view subscribes and
* stops when the last one leaves, so nothing is polled while nobody is looking.
+ *
+ * ## The poll is the fallback; the socket is the feed
+ *
+ * A list that only polls is a list that is wrong for up to a poll interval
+ * after every change — a session that finished kept its spinner for as long
+ * as four seconds, and with twenty sessions in twenty states something was
+ * always lagging (maintainer report 2026-08-27). The backend sweep that
+ * decides each pane's word now says so on the app socket the moment it does
+ * (`AgenticIdePaneActivity`, carried here as `PANE_ACTIVITY_EVENT`), and the
+ * store patches the row in place. The poll stays for what the event does not
+ * carry — a pane appearing, a title changing — and as the answer for a socket
+ * that dropped.
*/
const REFRESH_MS = 4000;
+/**
+ * The window event `useWebSocket` raises for one pane's activity change.
+ *
+ * Its detail is the activity half of a `WorkspacePaneRow`, keyed by workspace
+ * and by the pane's stable call-sign — the same shape the backend event
+ * carries, so nothing is translated on the way.
+ */
+export const PANE_ACTIVITY_EVENT = "jarvis:agentic-ide-activity";
+
+/** What one `PANE_ACTIVITY_EVENT` carries: exactly the backend's payload. */
+export interface PaneActivityChange {
+ session_id: string;
+ key: string;
+ name: string;
+ status: string;
+ activity: PaneActivity;
+ activity_since: number;
+ worked: boolean;
+}
+
+/** The change, when the event carries one; null for a malformed detail. */
+export function readPaneActivityChange(detail: unknown): PaneActivityChange | null {
+ if (!detail || typeof detail !== "object") return null;
+ const p = detail as Partial<PaneActivityChange>;
+ if (typeof p.session_id !== "string" || typeof p.key !== "string") return null;
+ return {
+ session_id: p.session_id,
+ key: p.key,
+ name: typeof p.name === "string" ? p.name : "",
+ status: typeof p.status === "string" ? p.status : "",
+ activity: (typeof p.activity === "string" ? p.activity : "") as PaneActivity,
+ activity_since: typeof p.activity_since === "number" ? p.activity_since : 0,
+ worked: p.worked === true,
+ };
+}
+
interface WorkspacePanesStore {
panes: WorkspacePaneRow[];
/** The workspace tab at the front, as the backend sees it. */
@@ -29,8 +78,16 @@ interface WorkspacePanesStore {
/** Has a first answer arrived? An empty list before that means "not yet". */
loaded: boolean;
load: () => Promise<void>;
+ /**
+ * Patch one row with a change the socket delivered. A row this store does
+ * not hold — a pane the last poll had not listed yet — is left for the next
+ * poll rather than invented from a payload that carries no title or agent.
+ */
+ applyActivity: (change: PaneActivityChange) => void;
}
+const STATUSES: ReadonlySet<string> = new Set(["pending", "live", "exited", "error"]);
+
export const useWorkspacePanesStore = create<WorkspacePanesStore>((set) => ({
panes: [],
activeId: null,
@@ -46,10 +103,42 @@ export const useWorkspacePanesStore = create<WorkspacePanesStore>((set) => ({
// read as "your agents are gone".
}
},
+
+ applyActivity: (change) =>
+ set((state) => {
+ const index = state.panes.findIndex(
+ (pane) => pane.workspace_id === change.session_id && pane.key === change.key,
+ );
+ if (index < 0) return state;
+ const current = state.panes[index];
+ const status = STATUSES.has(change.status)
+ ? (change.status as WorkspacePaneRow["status"])
+ : current.status;
+ if (
+ current.status === status &&
+ current.activity === change.activity &&
+ current.activity_since === change.activity_since &&
+ current.worked === change.worked
+ ) {
+ // The poll already said so. Keep the array's identity, or every
+ // repeated event would redraw a list nothing changed in.
+ return state;
+ }
+ const panes = state.panes.slice();
+ panes[index] = {
+ ...current,
+ status,
+ activity: change.activity,
+ activity_since: change.activity_since,
+ worked: change.worked,
+ };
+ return { panes };
+ }),
}));
let watchers = 0;
let timer: number | null = null;
+let onActivity: ((event: Event) => void) | null = null;
/**
* Subscribe this component to the pane list, sharing one poll with the others.
@@ -66,20 +155,56 @@ export function useWorkspacePanes(): WorkspacePaneRow[] {
void useWorkspacePanesStore.getState().load();
}, REFRESH_MS);
}
+ if (onActivity === null) {
+ // One listener for the whole store, alive exactly as long as the poll:
+ // the socket feed and the poll are two sources for one list, and they
+ // start and stop together.
+ onActivity = (event: Event) => {
+ const change = readPaneActivityChange((event as CustomEvent).detail);
+ if (change) useWorkspacePanesStore.getState().applyActivity(change);
+ };
+ window.addEventListener(PANE_ACTIVITY_EVENT, onActivity);
+ }
return () => {
watchers -= 1;
- if (watchers <= 0 && timer !== null) {
- window.clearInterval(timer);
+ if (watchers <= 0) {
+ if (timer !== null) window.clearInterval(timer);
timer = null;
+ if (onActivity !== null) window.removeEventListener(PANE_ACTIVITY_EVENT, onActivity);
+ onActivity = null;
}
};
}, []);
return panes;
}
+/** Patch one row in place — archive, restore — without waiting for the poll. */
+export function patchWorkspacePane(
+ historyId: string,
+ patch: Partial<WorkspacePaneRow>,
+): void {
+ useWorkspacePanesStore.setState((state) => {
+ const index = state.panes.findIndex((pane) => pane.history_id === historyId);
+ if (index < 0) return state;
+ const panes = state.panes.slice();
+ panes[index] = { ...panes[index], ...patch };
+ return { panes };
+ });
+}
+
+/** Drop a row the moment its terminal is closed, so the list does not wait. */
+export function dropWorkspacePane(historyId: string): void {
+ useWorkspacePanesStore.setState((state) => {
+ const panes = state.panes.filter((pane) => pane.history_id !== historyId);
+ return panes.length === state.panes.length ? state : { panes };
+ });
+}
+
/** Test seam: forget the shared timer between cases. */
export function resetWorkspacePanesPoll(): void {
if (timer !== null) window.clearInterval(timer);
timer = null;
+ if (onActivity !== null) window.removeEventListener(PANE_ACTIVITY_EVENT, onActivity);
+ onActivity = null;
watchers = 0;
}
diff --git a/tests/unit/agentic_ide/test_archive_pane.py b/tests/unit/agentic_ide/test_archive_pane.py
new file mode 100644
index 0000000000..75789dd31c
--- /dev/null
+++ b/tests/unit/agentic_ide/test_archive_pane.py
@@ -0,0 +1,101 @@
+"""Archiving a pane hides it from the chat list without closing it."""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+
+from jarvis.agentic_ide import resume_store
+from jarvis.agentic_ide import session as session_mod
+from jarvis.agentic_ide.session import Registry, SessionError
+from tests.fakes.fake_pty_manager import FakePtyManager
+
+
+def fake_pty() -> FakePtyManager:
+ return FakePtyManager()
+
+
+def registry(fake_pty: FakePtyManager, monkeypatch: pytest.MonkeyPatch) -> Registry:
+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))
+ return Registry(pty_manager=fake_pty)
+
+
+async def test_archiving_hides_the_pane_from_the_list_but_keeps_it_running(
+ registry: Registry, tmp_path: Path
+) -> None:
+ await registry.start(str(tmp_path), [{"agent": "claude"}, {"agent": "claude"}])
+ session, term = await registry.set_terminal_archived("T1", True)
+
+ assert term.archived is True
+ assert session.find("T1") is term
+ rows = {row["name"]: row for row in registry.panes()}
+ assert rows["T1"]["archived"] is True
+ assert rows["T2"]["archived"] is False
+
+
+async def test_restoring_puts_the_pane_back_on_the_list(registry: Registry, tmp_path: Path) -> None:
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ await registry.set_terminal_archived("T1", True)
+ _, term = await registry.set_terminal_archived("T1", False)
+
+ assert term.archived is False
+ assert registry.panes()[0]["archived"] is False
+
+
+async def test_the_resume_snapshot_remembers_an_archived_pane(
+ registry: Registry, tmp_path: Path
+) -> None:
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ await registry.set_terminal_archived("T1", True)
+ snap = registry.session.terminals[0].to_snapshot()
+
+ assert snap.archived is True
+ restored = resume_store.SnapshotTerminal.from_dict(snap.to_dict())
+ assert restored is not None
+ assert restored.archived is True
+ # An older snapshot, written before archive existed, reads as live.
+ older = resume_store.SnapshotTerminal.from_dict({"name": "T1", "agent": "claude", "key": "t1"})
+ assert older is not None
+ assert older.archived is False
+
+
+async def test_closing_a_pane_in_a_background_workspace_leaves_the_front_one(
+ registry: Registry, tmp_path: Path
+) -> None:
+ first = tmp_path / "alpha"
+ second = tmp_path / "beta"
+ first.mkdir()
+ second.mkdir()
+ background = await registry.start(str(first), [{"agent": "claude"}])
+ front = await registry.start(str(second), [{"agent": "claude"}])
+
+ assert registry.active_id == front.id
+ await registry.close_terminal("T1", workspace_id=background.id)
+
+ assert front.find("T1") is not None
+ assert background.find("T1") is None
+
+
+async def test_archiving_pins_to_the_named_workspace(registry: Registry, tmp_path: Path) -> None:
+ first = tmp_path / "alpha"
+ second = tmp_path / "beta"
+ first.mkdir()
+ second.mkdir()
+ background = await registry.start(str(first), [{"agent": "claude"}])
+ front = await registry.start(str(second), [{"agent": "claude"}])
+
+ await registry.set_terminal_archived("T1", True, workspace_id=background.id)
+
+ assert background.find("T1").archived is True
+ assert front.find("T1").archived is False
+
+
+async def test_archiving_an_unknown_pane_names_the_real_ones(
+ registry: Registry, tmp_path: Path
+) -> None:
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ with pytest.raises(SessionError, match="T1"):
+ await registry.set_terminal_archived("Gandalf", True)
diff --git a/tests/unit/cli_ctl/test_commands_ide.py b/tests/unit/cli_ctl/test_commands_ide.py
index bcd8c3f2dd..8ed2036e58 100644
--- a/tests/unit/cli_ctl/test_commands_ide.py
+++ b/tests/unit/cli_ctl/test_commands_ide.py
@@ -1,4 +1,5 @@
"""Tests for curated Agentic IDE terminal commands."""
+
from __future__ import annotations
from typer.testing import CliRunner
@@ -20,6 +21,26 @@ def test_rename_terminal_sends_the_new_call_sign(capture_api) -> None:
assert call["body"] == {"name": "Frontend"}
+def test_archive_terminal_hides_the_chat(capture_api) -> None:
+ result = runner.invoke(app, ["ide", "archive-terminal", "T1"])
+
+ assert result.exit_code == 0
+ call = capture_api["calls"][-1]
+ assert call["method"] == "POST"
+ assert call["path"] == "/api/agentic-ide/terminals/T1/archive"
+ assert call["body"] == {"archived": True}
+
+
+def test_archive_terminal_restore_puts_it_back(capture_api) -> None:
+ result = runner.invoke(
+ app, ["ide", "archive-terminal", "T1", "--restore", "--workspace", "ide_w2"]
+ )
+
+ assert result.exit_code == 0
+ call = capture_api["calls"][-1]
+ assert call["body"] == {"archived": False, "workspace_id": "ide_w2"}
+
+
def test_close_terminals_requires_confirmation(capture_api) -> None:
result = runner.invoke(app, ["ide", "close-terminals", "Mika", "Nova"])
diff --git a/tests/unit/web/test_agentic_ide_archive_terminal_route.py b/tests/unit/web/test_agentic_ide_archive_terminal_route.py
new file mode 100644
index 0000000000..a3d403299a
--- /dev/null
+++ b/tests/unit/web/test_agentic_ide_archive_terminal_route.py
@@ -0,0 +1,61 @@
+"""The endpoint behind hiding a chat in the session list."""
+
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+from fastapi import HTTPException
+
+from jarvis.agentic_ide.session import SessionError
+from jarvis.ui.web import agentic_ide_routes as routes
+
+
+def _terminal(name: str, *, archived: bool = False) -> SimpleNamespace:
+ return SimpleNamespace(
+ name=name,
+ archived=archived,
+ to_dict=lambda: {"name": name, "archived": archived},
+ )
+
+
+class FakeRegistry:
+ def __init__(self, *, result=None, error: SessionError | None = None) -> None:
+ self._result = result
+ self._error = error
+ self.calls: list[tuple[str, bool, str | None]] = []
+
+ async def set_terminal_archived(
+ self, wanted: str, archived: bool, *, workspace_id: str | None = None
+ ):
+ self.calls.append((wanted, archived, workspace_id))
+ if self._error is not None:
+ raise self._error
+ return self._result
+
+
+async def test_archiving_answers_with_the_flag(monkeypatch: pytest.MonkeyPatch) -> None:
+ session = SimpleNamespace(id="ide_test")
+ registry = FakeRegistry(result=(session, _terminal("T1", archived=True)))
+ monkeypatch.setattr(routes, "get_registry", lambda: registry)
+
+ result = await routes.archive_terminal(
+ "T1", routes.ArchiveTerminalRequest(archived=True, workspace_id="ide_test")
+ )
+
+ assert registry.calls == [("T1", True, "ide_test")]
+ assert result["ok"] is True
+ assert result["archived"] is True
+ assert result["name"] == "T1"
+ assert result["workspace_id"] == "ide_test"
+
+
+async def test_an_unknown_pane_is_a_not_found(monkeypatch: pytest.MonkeyPatch) -> None:
+ registry = FakeRegistry(error=SessionError("No terminal called 'T7'. Running: T1."))
+ monkeypatch.setattr(routes, "get_registry", lambda: registry)
+
+ with pytest.raises(HTTPException) as caught:
+ await routes.archive_terminal("T7", routes.ArchiveTerminalRequest(archived=True))
+
+ assert caught.value.status_code == 404
+ assert "Running: T1" in caught.value.detail