feat(app): archive a workspace from its sidebar row and undo it

Hovering a workspace row on desktop shows an archive button next to the
row menu. Archiving shows a toast with Undo and a Cmd/Ctrl+Z shortcut so a
mis-click costs one keystroke instead of a trip through History.

The daemon serializes archive and undo per workspace across every
connection. An undo that lands while an archive is still tearing down
aborts it at the next checkpoint and restores only the agents that archive
took down; deleting the worktree directory is the point of no return, after
which undo recreates the worktree.
This commit is contained in:
Mohamed Boudra
2026-11-06 05:37:41 +01:00
parent 5abfdf7107
commit 5d8a78112c
50 changed files with 2314 additions and 161 deletions
+17
View File
@@ -3628,6 +3628,23 @@ export class DaemonClient {
}
}
/** Rejects when the host could not put the workspace back; an old host has no such RPC. */
async undoWorkspaceArchive(workspaceId: string, requestId?: string): Promise<void> {
const payload =
await this.sendNamespacedCorrelatedSessionRequest<"workspace.archive.undo.response">({
requestId,
message: {
type: "workspace.archive.undo.request",
workspaceId,
},
// Undoing a finished worktree archive recreates the worktree, like recovery does.
timeout: 150_000,
});
if (!payload.accepted) {
throw new Error(payload.error ?? "The host could not undo the workspace archive");
}
}
async resumeAgent(
handle: AgentPersistenceHandle,
overrides?: Partial<AgentSessionConfig>,