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.

fix(agentic-ide): commit the layout + API surface the restored view needs

Ruben Lütkea35b1b91b13d
diff --git a/jarvis/ui/web/frontend/src/components/agentic/ResumeCard.tsx b/jarvis/ui/web/frontend/src/components/agentic/ResumeCard.tsx
index 40b6b1264d..0dd105a55d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/ResumeCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/ResumeCard.tsx
@@ -1,8 +1,9 @@
/**
- * "Resume all sessions" — the offer to reopen the workspace that was last open.
+ * "Resume all sessions" — the offer to reopen everything that was open before.
*
- * Shown at the top of the wizard whenever a previous workspace can be brought
- * back: after the browser was closed, after the app restarted, after a reboot.
+ * Shown at the top of the wizard whenever previous workspaces can be brought
+ * back: after the browser was closed, after the workspaces were closed for the
+ * day, after the app restarted, after a reboot.
*
* ## Why a card and not a dialog
*
@@ -12,18 +13,21 @@
* something worth reading. A card is just as visible, stays out of the way, and
* costs nothing to ignore.
*
- * ## Why every pane is listed individually
+ * ## Why every workspace and every pane is listed
*
* Because "resumed" is not one answer. A pane can come back with its whole
* conversation, or with nothing but its call-sign — and the two look identical
* on screen until you ask the agent a follow-up question and get a blank stare.
- * So each pane says which of the two it will be BEFORE the click, and a pane
- * whose coding CLI is no longer installed says that too, instead of failing
- * quietly a second after the workspace opens.
+ * A whole workspace can be unreachable because its folder was moved. So each
+ * one says which of those it is BEFORE the click, rather than after.
+ *
+ * With many panes the list is summarised instead of printed in full: a hundred
+ * chips is not information, it is wallpaper. The call-signs of the first few are
+ * what someone recognises their workspace by; the rest are a count.
*/
-import { AlertCircle, RotateCcw, Terminal } from "lucide-react";
+import { AlertCircle, FolderGit2, RotateCcw, Terminal } from "lucide-react";
import { cn } from "@/lib/utils";
-import type { ResumeOffer } from "@/lib/agenticIdeApi";
+import type { ResumeOffer, ResumeWorkspaceOffer } from "@/lib/agenticIdeApi";
interface ResumeCardProps {
offer: ResumeOffer;
@@ -32,6 +36,9 @@ interface ResumeCardProps {
onDismiss: () => void;
}
+/** Call-signs printed in full before the rest becomes "+N more". */
+const NAMES_SHOWN = 8;
+
/**
* "2 hours ago" for a POSIX timestamp.
*
@@ -51,20 +58,90 @@ export function savedAgo(seconds: number, now: number = Date.now()): string {
/** One line of plain language for what the button will actually do. */
export function resumeSummary(offer: ResumeOffer): string {
- const total = offer.terminals.length;
- const panes = `${total} terminal${total === 1 ? "" : "s"}`;
- if (!offer.folder_exists) return "That folder is no longer on this machine.";
+ const spaces = offer.workspace_count;
+ const panes = offer.terminal_count;
+ const where = spaces === 1 ? "1 folder" : `${spaces} folders`;
+ const what = `${panes} terminal${panes === 1 ? "" : "s"}`;
if (!offer.available) {
- return "None of these terminals can run here — their coding CLIs are not installed.";
+ const anyFolder = offer.workspaces.some((w) => w.folder_exists);
+ return anyFolder
+ ? "None of these terminals can run here — their coding CLIs are not installed."
+ : "Those folders are no longer on this machine.";
}
const kept = offer.resumable_count;
if (kept === 0) {
- return `${panes} come back with their names and places; none of their conversations could be kept.`;
+ return `${where}, ${what} — names and places come back; none of their conversations could be kept.`;
}
- if (kept === total) {
- return `${panes}, each continuing the conversation it was having.`;
+ if (kept === panes) {
+ return `${where}, ${what}, each continuing the conversation it was having.`;
}
- return `${panes} — ${kept} continue their conversation, the rest start fresh.`;
+ return `${where}, ${what} — ${kept} continue their conversation, the rest start fresh.`;
+}
+
+function WorkspaceRow({ space }: { space: ResumeWorkspaceOffer }) {
+ const shown = space.terminals.slice(0, NAMES_SHOWN);
+ const hidden = space.terminals.length - shown.length;
+ const fresh = space.terminals.length - space.resumable_count;
+ return (
+ <li
+ data-testid={`resume-workspace-${space.folder_name}`}
+ className={cn(
+ "rounded-lg border p-3",
+ space.available
+ ? "border-border bg-card/60"
+ : "border-amber-500/40 bg-amber-500/10",
+ )}
+ >
+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
+ <FolderGit2 className="h-3.5 w-3.5 shrink-0 translate-y-0.5 text-primary" />
+ <span className="font-medium text-foreground">{space.folder_name}</span>
+ <span className="text-xs text-muted-foreground">
+ {space.terminals.length} terminal{space.terminals.length === 1 ? "" : "s"}
+ {space.resumable_count > 0 && ` · ${space.resumable_count} continuing`}
+ {fresh > 0 && ` · ${fresh} starting fresh`}
+ </span>
+ </div>
+ <code className="mt-0.5 block truncate font-mono text-[11px] text-muted-foreground">
+ {space.folder}
+ </code>
+ {!space.folder_exists && (
+ <p className="mt-1.5 flex items-start gap-1.5 text-xs text-amber-200">
+ <AlertCircle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ That folder was moved or deleted, so this one cannot come back.
+ </p>
+ )}
+ <ul className="mt-2 flex flex-wrap gap-1.5">
+ {shown.map((pane) => (
+ <li
+ key={pane.key}
+ data-testid={`resume-pane-${pane.key}`}
+ className={cn(
+ "flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px]",
+ pane.available
+ ? "border-border/70 text-muted-foreground"
+ : "border-amber-500/40 text-amber-200",
+ )}
+ >
+ <Terminal className="h-3 w-3 shrink-0 text-primary" />
+ <span className="font-medium text-foreground">{pane.name}</span>
+ {!pane.available ? (
+ <span>not installed here</span>
+ ) : (
+ !pane.resumable && <span>· starts fresh</span>
+ )}
+ </li>
+ ))}
+ {hidden > 0 && (
+ <li
+ data-testid={`resume-more-${space.folder_name}`}
+ className="flex items-center rounded-md px-2 py-1 text-[11px] text-muted-foreground"
+ >
+ +{hidden} more
+ </li>
+ )}
+ </ul>
+ </li>
+ );
}
export function ResumeCard({ offer, busy, onResume, onDismiss }: ResumeCardProps) {
@@ -84,50 +161,19 @@ export function ResumeCard({ offer, busy, onResume, onDismiss }: ResumeCardProps
Resume all sessions
</h3>
<p className="text-sm text-muted-foreground">
- <span className="font-medium text-foreground">{offer.folder_name}</span>
- {when && <span> · last open {when}</span>}
+ Pick up where you left off{when && <span> · last open {when}</span>}
</p>
- <code className="mt-0.5 block truncate font-mono text-[11px] text-muted-foreground">
- {offer.folder}
- </code>
</div>
</div>
- <ul className="mt-4 flex flex-wrap gap-2">
- {offer.terminals.map((pane) => (
- <li
- key={pane.key}
- data-testid={`resume-pane-${pane.key}`}
- className={cn(
- "flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-xs",
- pane.available
- ? "border-border bg-card/60"
- : "border-amber-500/40 bg-amber-500/10",
- )}
- >
- <Terminal className="h-3.5 w-3.5 shrink-0 text-primary" />
- <span className="font-medium text-foreground">{pane.name}</span>
- <span className="text-muted-foreground">{pane.display_name}</span>
- {!pane.available ? (
- <span className="text-amber-200">not installed here</span>
- ) : (
- !pane.resumable && (
- <span className="text-muted-foreground">· starts fresh</span>
- )
- )}
- </li>
+ <ul className="mt-4 space-y-2">
+ {offer.workspaces.map((space) => (
+ <WorkspaceRow key={space.folder} space={space} />
))}
</ul>
<p className="mt-3 text-xs text-muted-foreground">{resumeSummary(offer)}</p>
- {!offer.folder_exists && (
- <p className="mt-2 flex items-start gap-2 text-xs text-amber-200">
- <AlertCircle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
- The folder was moved or deleted, so there is nothing left to reopen.
- </p>
- )}
-
<div className="mt-4 flex flex-wrap items-center justify-end gap-2">
<button
type="button"
@@ -135,7 +181,7 @@ export function ResumeCard({ offer, busy, onResume, onDismiss }: ResumeCardProps
className="btn-ghost"
disabled={busy}
onClick={onDismiss}
- title="Forget this workspace and start from the wizard"
+ title="Forget these workspaces and start from the wizard"
>
Start fresh
</button>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
index 085b55cd0f..7dab6197e6 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
@@ -21,7 +21,7 @@
* one control in this bar that stops work — every other one is reversible.
*/
import { useState } from "react";
-import { FolderGit2, Plus, X } from "lucide-react";
+import { Check, FolderGit2, Pencil, Plus, X } from "lucide-react";
import { cn } from "@/lib/utils";
import type { WorkspaceCard } from "@/lib/agenticIdeApi";
@@ -34,6 +34,7 @@ interface WorkspaceBarProps {
maxWorkspaces: number;
onSelect: (id: string) => void;
onAdd: () => void;
+ onRename: (id: string, name: string) => Promise<boolean>;
onClose: (id: string) => void;
/** Disable every control while a switch or a close is in flight. */
busy?: boolean;
@@ -46,14 +47,31 @@ export function WorkspaceBar({
maxWorkspaces,
onSelect,
onAdd,
+ onRename,
onClose,
busy = false,
}: WorkspaceBarProps) {
// Which tab has its close button armed. One at a time, and cleared on every
// other interaction, so an armed X can never be clicked by accident later.
const [confirming, setConfirming] = useState<string | null>(null);
+ const [editing, setEditing] = useState<string | null>(null);
+ const [draft, setDraft] = useState("");
const full = workspaces.length >= maxWorkspaces;
+ const beginRename = (workspace: WorkspaceCard) => {
+ setConfirming(null);
+ setEditing(workspace.id);
+ setDraft(workspace.name);
+ };
+
+ const commitRename = async (workspace: WorkspaceCard) => {
+ const name = draft.trim();
+ if (!name) return;
+ if (name === workspace.name || (await onRename(workspace.id, name))) {
+ setEditing(null);
+ }
+ };
+
// Nothing open and nothing to add to: the wizard IS the screen, and an empty
// bar above it would be furniture.
if (workspaces.length === 0) return null;
@@ -68,6 +86,7 @@ export function WorkspaceBar({
{workspaces.map((workspace) => {
const selected = !addingNew && workspace.id === activeId;
const armed = confirming === workspace.id;
+ const renaming = editing === workspace.id;
return (
<div
key={workspace.id}
@@ -78,41 +97,99 @@ export function WorkspaceBar({
: "border-transparent hover:border-border hover:bg-muted/40",
)}
>
- <button
- type="button"
- role="tab"
- aria-selected={selected}
- disabled={busy}
- data-testid={`workspace-tab-${workspace.id}`}
- title={workspace.folder}
- onClick={() => {
- setConfirming(null);
- if (!selected) onSelect(workspace.id);
- }}
- className="flex min-w-0 items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-60"
- >
- <FolderGit2
- className={cn(
- "h-3.5 w-3.5 shrink-0",
- selected ? "text-primary" : "text-muted-foreground",
- )}
- />
- <span
- className={cn(
- "max-w-[14rem] truncate text-sm font-medium",
- selected ? "text-primary" : "text-foreground",
- )}
+ {renaming ? (
+ <form
+ className="flex items-center gap-1"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void commitRename(workspace);
+ }}
>
- {workspace.name}
- </span>
- <PaneCount workspace={workspace} selected={selected} />
- </button>
+ <input
+ autoFocus
+ value={draft}
+ maxLength={80}
+ disabled={busy}
+ aria-label={`Rename ${workspace.name}`}
+ data-testid={`workspace-rename-input-${workspace.id}`}
+ onFocus={(event) => event.currentTarget.select()}
+ onChange={(event) => setDraft(event.target.value)}
+ onKeyDown={(event) => {
+ if (event.key === "Escape") setEditing(null);
+ }}
+ className="w-40 rounded border border-primary/40 bg-background px-2 py-0.5 text-sm outline-none focus:border-primary disabled:opacity-60"
+ />
+ <button
+ type="submit"
+ disabled={busy || !draft.trim()}
+ aria-label={`Save name for ${workspace.name}`}
+ data-testid={`workspace-rename-save-${workspace.id}`}
+ className="flex h-6 w-6 items-center justify-center rounded text-primary hover:bg-primary/15 disabled:opacity-40"
+ >
+ <Check className="h-3.5 w-3.5" />
+ </button>
+ <button
+ type="button"
+ disabled={busy}
+ aria-label="Cancel rename"
+ onClick={() => setEditing(null)}
+ className="flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-muted"
+ >
+ <X className="h-3.5 w-3.5" />
+ </button>
+ </form>
+ ) : (
+ <>
+ <button
+ type="button"
+ role="tab"
+ aria-selected={selected}
+ disabled={busy}
+ data-testid={`workspace-tab-${workspace.id}`}
+ title={workspace.folder}
+ onClick={() => {
+ setConfirming(null);
+ if (!selected) onSelect(workspace.id);
+ }}
+ className="flex min-w-0 items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-60"
+ >
+ <FolderGit2
+ className={cn(
+ "h-3.5 w-3.5 shrink-0",
+ selected ? "text-primary" : "text-muted-foreground",
+ )}
+ />
+ <span
+ className={cn(
+ "max-w-[14rem] truncate text-sm font-medium",
+ selected ? "text-primary" : "text-foreground",
+ )}
+ >
+ {workspace.name}
+ </span>
+ <PaneCount workspace={workspace} selected={selected} />
+ </button>
- {armed ? (
+ <button
+ type="button"
+ aria-label={`Rename ${workspace.name}`}
+ title={`Rename ${workspace.name}`}
+ disabled={busy}
+ data-testid={`workspace-rename-${workspace.id}`}
+ onClick={() => beginRename(workspace)}
+ className="flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover/tab:opacity-100 disabled:opacity-40"
+ >
+ <Pencil className="h-3 w-3" />
+ </button>
+ </>
+ )}
+
+ {!renaming && armed ? (
<span className="flex items-center gap-1">
<button
type="button"
disabled={busy}
+ aria-label={`Confirm closing ${workspace.name}`}
data-testid={`workspace-close-confirm-${workspace.id}`}
onClick={() => {
setConfirming(null);
@@ -120,7 +197,7 @@ export function WorkspaceBar({
}}
className="rounded bg-destructive/20 px-2 py-0.5 text-[11px] font-medium text-destructive transition-colors hover:bg-destructive/30 disabled:opacity-50"
>
- Stop {workspace.live_terminals || workspace.terminals}
+ Close &amp; stop {workspace.live_terminals || workspace.terminals}
</button>
<button
type="button"
@@ -131,7 +208,7 @@ export function WorkspaceBar({
Keep
</button>
</span>
- ) : (
+ ) : !renaming ? (
<button
type="button"
aria-label={`Close ${workspace.name}`}
@@ -148,7 +225,7 @@ export function WorkspaceBar({
>
<X className="h-3 w-3" />
</button>
- )}
+ ) : null}
</div>
);
})}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
index 0f4737a4c1..c773b79f1d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
@@ -1,5 +1,23 @@
import { describe, expect, it } from "vitest";
-import { MAX_PANES_PER_BAND, paneColumns, paneGrid, paneLines } from "./layout";
+import {
+ MAX_PANES_PER_BAND,
+ paneColumns,
+ paneGrid,
+ paneLines,
+ workspaceBandCapacityFor,
+} from "./layout";
+
+describe("workspaceBandCapacityFor", () => {
+ it("uses the grid content width on both sides of the four-column threshold", () => {
+ expect(workspaceBandCapacityFor(1543)).toBe(3);
+ expect(workspaceBandCapacityFor(1544)).toBe(4);
+ });
+
+ it("uses the grid content width on both sides of the six-column threshold", () => {
+ expect(workspaceBandCapacityFor(2303)).toBe(5);
+ expect(workspaceBandCapacityFor(2304)).toBe(6);
+ });
+});
describe("paneColumns", () => {
it("keeps a small workspace on one line", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
index 98b9f8fce4..0c6a551866 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
@@ -60,6 +60,9 @@ export const MAX_PANES_PER_BAND = 10;
*/
export const MIN_PANE_WIDTH_PX = 380;
+/** Horizontal padding of the rendered grid (`p-3`: 12 px on each side). */
+export const GRID_HORIZONTAL_PADDING_PX = 24;
+
/**
* How many columns fit in ``widthPx`` without starving them.
*
@@ -75,6 +78,19 @@ export function bandCapacityFor(
return Math.max(1, Math.min(MAX_PANES_PER_BAND, fits));
}
+/**
+ * Columns that fit inside the grid's content box.
+ *
+ * `clientWidth` includes padding while CSS grid tracks occupy the content box.
+ * Keeping this subtraction here gives the running grid and wizard preview the
+ * exact same answer at width thresholds.
+ */
+export function workspaceBandCapacityFor(containerWidthPx: number): number {
+ return bandCapacityFor(
+ Math.max(0, containerWidthPx - GRID_HORIZONTAL_PADDING_PX),
+ );
+}
+
/**
* Ceiling on the grid's row unit (see `paneGrid`).
*
@@ -93,6 +109,45 @@ export interface Positioned {
slot: number;
}
+/**
+ * The panes a wizard-opened workspace of ``count`` terminals starts with.
+ *
+ * One row of columns — `column = index`, `slot = 0` — which is literally what
+ * the backend writes when it opens a session from the wizard
+ * (`agentic_ide/session.py`: "A wizard-opened workspace is one row of columns").
+ *
+ * It exists so the preview cannot describe a workspace the backend would never
+ * build. The old preview took a shortcut and fed the raw terminal COUNT into
+ * `paneColumns`, which happens to agree here only because every terminal gets
+ * its own column at the start. Feed `paneGrid` the same panes the grid will
+ * receive and the preview stops being a second opinion.
+ */
+export function wizardPanes(count: number): Positioned[] {
+ return Array.from({ length: Math.max(0, Math.trunc(count)) }, (_, index) => ({
+ column: index,
+ slot: 0,
+ }));
+}
+
+/**
+ * Width at which ``count`` wizard-opened terminals would fit on ONE line.
+ *
+ * The preview promises an arrangement that depends on a number the user is not
+ * thinking about — how wide the window happens to be right now. Pick 8 in a
+ * 1050 px window and the honest answer is "2 across, 4 down"; maximise the same
+ * window and it becomes "4 across, 2 down". Reporting only the first reads as a
+ * broken promise the moment the second one happens, which is exactly what was
+ * reported on 2026-07-26.
+ *
+ * So the preview also says what a wider window would buy. Returns null when the
+ * count is already on one line, or when it never can be (past
+ * `MAX_PANES_PER_BAND` no width is enough — the wrap is the point).
+ */
+export function widthForOneBand(count: number): number | null {
+ if (count <= 1 || count > MAX_PANES_PER_BAND) return null;
+ return count * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
+}
+
/** Where one pane sits in the CSS grid. All values are 1-based, as CSS wants. */
export interface PanePlacement {
column: number;
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 0ea7966d70..6ac091077e 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -164,23 +164,38 @@ export interface ResumeTerminalOffer {
prompts_sent: number;
}
-export interface ResumeOffer {
- available: boolean;
+export interface ResumeWorkspaceOffer {
+ session_id: string;
folder: string;
folder_name: string;
folder_exists: boolean;
- saved_at: number;
- session_id: string;
+ /** False when the folder is gone or none of its coding CLIs are installed. */
+ available: boolean;
+ /** How many of its panes bring their conversation back. */
resumable_count: number;
terminals: ResumeTerminalOffer[];
}
+export interface ResumeOffer {
+ available: boolean;
+ saved_at: number;
+ workspace_count: number;
+ terminal_count: number;
+ resumable_count: number;
+ workspaces: ResumeWorkspaceOffer[];
+}
+
export interface ResumeResult {
- session: SessionState;
+ /** The whole workspace state after reopening — bar included. */
+ state: IdeState;
+ workspace_count: number;
+ terminal_count: number;
/** Panes that continued their conversation. */
resumable_count: number;
/** Panes that came back with the right name and an empty history. */
started_fresh: number;
+ /** Workspaces that could not come back, with a reason each. */
+ skipped: { folder: string; detail: string }[];
}
export interface TerminalPlan {
@@ -219,9 +234,14 @@ export function fetchFolders(path?: string | null): Promise<FoldersResponse> {
return getJson<FoldersResponse>(`/api/agentic-ide/folders${query}`);
}
-export function searchFolders(query: string, limit = 40): Promise<SearchResponse> {
+export function searchFolders(
+ query: string,
+ limit = 40,
+): Promise<SearchResponse> {
const qs = new URLSearchParams({ q: query, limit: String(limit) });
- return getJson<SearchResponse>(`/api/agentic-ide/folders/search?${qs.toString()}`);
+ return getJson<SearchResponse>(
+ `/api/agentic-ide/folders/search?${qs.toString()}`,
+ );
}
export function fetchRecents(): Promise<RecentsResponse> {
@@ -266,7 +286,9 @@ export function fetchNativePickerSupport(): Promise<NativePickerSupport> {
* The request stays open for as long as the window does — that is the point,
* not a hang. Cancelling comes back as `cancelled`, never as an error.
*/
-export async function openNativePicker(start?: string | null): Promise<NativePickResult> {
+export async function openNativePicker(
+ start?: string | null,
+): Promise<NativePickResult> {
const res = await fetch("/api/agentic-ide/folders/native", {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -319,7 +341,9 @@ export async function startIdeSession(
const body = (await res.json()) as { session: SessionState; state: IdeState };
// `state` is authoritative; `session` alone is kept as the fallback for a
// backend that predates the workspace bar.
- return body.state ?? { ...EMPTY_IDE_STATE, active: true, session: body.session };
+ return (
+ body.state ?? { ...EMPTY_IDE_STATE, active: true, session: body.session }
+ );
}
/** Shape a pre-workspace-bar backend does not send. */
@@ -370,6 +394,24 @@ export async function activateWorkspace(id: string | null): Promise<IdeState> {
return body.state;
}
+/** Rename one workspace tab without touching its folder or running agents. */
+export async function renameWorkspace(
+ id: string,
+ name: string,
+): Promise<IdeState> {
+ const res = await fetch(
+ `/api/agentic-ide/workspaces/${encodeURIComponent(id)}`,
+ {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ name }),
+ },
+ );
+ if (!res.ok) throw new Error(await detail(res));
+ const body = (await res.json()) as { state: IdeState };
+ return body.state;
+}
+
/** Close ONE workspace and stop every agent in it. Returns the state that is left. */
export async function closeWorkspace(id: string): Promise<IdeState> {
const res = await fetch(
@@ -427,7 +469,8 @@ export async function addTerminal(payload: {
});
if (!res.ok) throw new Error(await detail(res));
const body = (await res.json()) as { state: IdeState };
- if (!body.state.session) throw new Error("The workspace closed while adding a terminal.");
+ if (!body.state.session)
+ throw new Error("The workspace closed while adding a terminal.");
return body.state.session;
}
@@ -475,7 +518,12 @@ export interface AttachResult {
*/
export async function attachToTerminal(
name: string,
- payload: { files?: File[]; paths?: string[]; note?: string; submit?: boolean },
+ payload: {
+ files?: File[];
+ paths?: string[];
+ note?: string;
+ submit?: boolean;
+ },
): Promise<AttachResult> {
const form = new FormData();
for (const file of payload.files ?? []) form.append("files", file, file.name);