feat(workspace): a session in its own worktree, Claude's way

Desktop-parity phase 6, following Claude Desktop:
- the workspace home's Worktree checkbox starts the pane with
  `claude --worktree=<name>`, so Claude Code makes, populates
  (.worktreeinclude, WorktreeCreate hook) and cleans up
  <repo>/.claude/worktrees/<name>; AgentHub only excludes
  /.claude/worktrees/ at the repo root (Claude does not)
- server/lib/session-worktree.js resolves a session's worktree from the
  session row only (owned by the workspace, registered by git worktree
  list); every lane git route takes ?session= and answers ENOWORKTREE
  instead of falling back to the main folder
- the session view's Changes panel works in the opened run's worktree
  (dashboard_runs.worktree, GitTarget in the client api)
- Resume/Fork start in the session's worktree; a gone one is ENOWORKTREE
- Archive of a worktree session removes the worktree after asking:
  git worktree remove without --force, git branch -d (unmerged work keeps
  its branch), a lock held by a live pid refused, a stale one cleared
- listWorktrees reads `locked <reason>` locks
- tests scrub GIT_* env so the pre-commit suite cannot act on this repo
This commit is contained in:
2026-10-02 13:22:29 +07:00
parent a6bd33bcff
commit 5084334d81
35 changed files with 1041 additions and 119 deletions
+4
View File
@@ -78,6 +78,8 @@ export interface CheckboxProps {
* (bypass permissions, purge data, force). */
tone?: "accent" | "danger" | "warning";
disabled?: boolean;
/** Tooltip (the app turns every `title` into its themed bubble). */
title?: string;
}
const TONE = {
@@ -99,6 +101,7 @@ export function Checkbox({
labelClassName,
tone = "accent",
disabled = false,
title,
}: CheckboxProps) {
return (
<button
@@ -106,6 +109,7 @@ export function Checkbox({
role="checkbox"
aria-checked={checked}
disabled={disabled}
title={title}
onClick={() => onChange(!checked)}
className={`group inline-flex items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none ${className ?? ""}`}
>