@laoyuehanni/dsh-git-worktree 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -69,6 +69,14 @@ window.__ModuleLoader__.load({
69
69
  const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`;
70
70
  /** POST ROUTE_PREFIX/group — git belonging facts for a batch of workspace paths. */
71
71
  const ROUTE_GROUP = `${ROUTE_PREFIX}/group`;
72
+ /** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */
73
+ const ROUTE_INSPECT = `${ROUTE_PREFIX}/inspect`;
74
+ /** POST ROUTE_PREFIX/remove — delete one linked worktree (git registration + folder). */
75
+ const ROUTE_REMOVE = `${ROUTE_PREFIX}/remove`;
76
+ /** POST ROUTE_PREFIX/exists — batch directory-existence probe (fs, no git). */
77
+ const ROUTE_EXISTS = `${ROUTE_PREFIX}/exists`;
78
+ /** POST ROUTE_PREFIX/ensure-directory — mkdir -p a missing worktree storage slot. */
79
+ const ROUTE_ENSURE_DIRECTORY = `${ROUTE_PREFIX}/ensure-directory`;
72
80
  //#endregion
73
81
  //#region src/client/api.ts
74
82
  /** POST one JSON body and parse the uniform envelope. */
@@ -195,6 +203,44 @@ window.__ModuleLoader__.load({
195
203
  async function requestGroupWorktrees(paths) {
196
204
  return post(ROUTE_GROUP, { paths });
197
205
  }
206
+ /**
207
+ * Pre-delete facts for one worktree directory: the uncommitted-file count
208
+ * (lost with the folder) and the branch's ahead count (kept).
209
+ * @param path - absolute worktree directory.
210
+ */
211
+ function requestInspectWorktree(path) {
212
+ return post(ROUTE_INSPECT, { path });
213
+ }
214
+ /**
215
+ * Remove one linked worktree (git registration + folder). `force` rides
216
+ * `--force` past uncommitted changes the confirm dialog already showed.
217
+ * @param path - absolute worktree directory to delete.
218
+ * @param force - delete past uncommitted changes.
219
+ */
220
+ function requestRemoveWorktree(path, force) {
221
+ return post(ROUTE_REMOVE, {
222
+ path,
223
+ force
224
+ });
225
+ }
226
+ /**
227
+ * Batch directory-existence probe (true = exists AND is a directory). The
228
+ * sidebar gates register-as-workspace on this so a missing folder never
229
+ * reaches the DSH workspace API.
230
+ * @param paths - absolute directories to probe.
231
+ */
232
+ function requestPathExists(paths) {
233
+ return post(ROUTE_EXISTS, { paths });
234
+ }
235
+ /**
236
+ * Recreate a missing worktree storage slot (`mkdir -p`). The host gates this
237
+ * to paths directly inside the storage root; historical sessions reattach
238
+ * automatically once the directory is back.
239
+ * @param path - the missing slot directory (absolute).
240
+ */
241
+ function requestEnsureDirectory(path) {
242
+ return post(ROUTE_ENSURE_DIRECTORY, { path });
243
+ }
198
244
  //#endregion
199
245
  //#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\BranchChip.module.css?inline
200
246
  const css$3 = "/* Branch chip row inside the composer tool row (conversation.input_2006230319.left_2006230319,\n * right of the mode chips). Modeled as a single rounded-rectangle\n * segmented control: the branch picker and the worktree toggle share one\n * container with a thin divider between them, so they read as one\n * affordance instead of two loose buttons.\n *\n * Geometry mirrors the composer trigger chips in the DSH base (see\n * PermissionSelect / ModelSelect): 28px height, 13/20 medium-secondary\n * label, transparent fill, no outline 鈥?the dock stays at the same\n * visual weight as the surrounding chips (dsh-worktree select, standard\n * mode select, Workspace Write, MiniMax-M3 High). The corners stop short\n * of the base's full pill (24px) so the silhouette stays a chip rather\n * than a capsule, per the design brief. */\n\n/* Shared trigger geometry 鈥?copied 1:1 from the base composer triggers\n * (PermissionSelect .trigger_2006230319 / ModelSelect .trigger_2006230319). Centralizing here\n * keeps the two segments visually fused so the divider reads as part of\n * one component, not two loose buttons. */\n.dock_2006230319 {\n display: inline-flex;\n align-items: stretch;\n height: 28px;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n min-height: 28px;\n overflow: hidden;\n}\n\n/* Vertical separator between the two segments. Uses the secondary label\n * color so it stays in the same tonal family as the surrounding trigger\n * outlines and chevrons. */\n.divider_2006230319 {\n width: 1px;\n margin: 6px 0;\n background: color-mix(in srgb, currentColor 22%, transparent);\n flex-shrink: 0;\n}\n\n.chip_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 8px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.chip_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The leftmost segment rounds only its left corners so it tucks into the dock. */\n.chip_2006230319:first-child {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n}\n\n/* Started sessions drop the worktree segment: the lone chip rounds all\n * corners and reads as a plain button, not a broken-off half control. */\n.chip_2006230319:only-child {\n border-radius: 6px;\n}\n\n.branch_2006230319 {\n max-width: 16em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.check_2006230319,\n.checkOn_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 4px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.check_2006230319:hover,\n.checkOn_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The rightmost segment rounds only its right corners. */\n.check_2006230319:last-child,\n.checkOn_2006230319:last-child {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n}\n\n.box_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n border: 1px solid color-mix(in srgb, currentColor 45%, transparent);\n border-radius: 4px;\n}\n\n/* Selected worktree: only the checkbox itself turns bluish and fills 鈥?the\n * surrounding button stays transparent so the label keeps the same\n * secondary tone. Mirrors the Claude Code toggle treatment. The inner\n * check rides the bluish fill with an inverted foreground token so the\n * glyph stays legible. */\n.checkOn_2006230319 .box_2006230319 {\n border-color: var(--dsw-alias-label-primary-bluish, #4186f0);\n background: var(--dsw-alias-label-primary-bluish, #4186f0);\n color: var(--dsw-alias-label-primary-foreground, #ffffff);\n}\n\n.checkLabel_2006230319 {\n white-space: nowrap;\n}\n\n/* Confirm flyout: the second-level panel opening right of the branch\n * card (the base Menu's submenu posture: r12, inverted hairline,\n * shadow-lv3, --dsw-specific-menu). Width is content-driven — it follows\n * the longest line (for remote picks that is the subject line's branch\n * name) — floored at 168px (the Cancel/Confirm pair plus padding: short\n * branch names must not squeeze the buttons into wrapping \"切换中…\"\n * mid-word) and capped at 400px; BranchMenu also clamps it inline to the\n * room right of the card. Beyond the cap the lines wrap. border-box so\n * every width arm includes the card chrome. */\n.popCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n width: max-content;\n min-width: 168px;\n max-width: min(400px, 80vw);\n padding: 4px;\n border: 1px solid var(--dsw-alias-border-inverted);\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n box-shadow: var(--dsw-shadow-lv3);\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.popAsk_2006230319 {\n margin: 0;\n padding: 6px 8px;\n font-size: 13px;\n line-height: 20px;\n color: inherit;\n /* Branch names are long unbroken tokens — plain wrapping would let them\n * overflow the capped card instead of breaking. */\n overflow-wrap: anywhere;\n}\n\n/* Remote confirm's name line: the branch itself, weight 500 like the leaf\n * rows — the subject the ask line refers to (\"该远程分支\"). A dedicated\n * line keeps the long unbroken token away from the sentence, so wraps\n * happen inside the name instead of shredding the Chinese around it. */\n.popSubject_2006230319 {\n margin: 0;\n padding: 0 8px 2px;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: inherit;\n overflow-wrap: anywhere;\n}\n\n.popActions_2006230319 {\n display: flex;\n gap: 2px;\n padding: 2px;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * nowrap keeps labels like 切换中… from splitting mid-word when the flyout\n * is pinned to its minimum width by a short branch name. */\n.popActions_2006230319 button {\n flex: 1 1 0;\n height: 28px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.popActions_2006230319 button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.popActions_2006230319 button:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.popActions_2006230319 button:last-child {\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n font-weight: 500;\n}\n\n/* ── Branch picker popup (BranchMenu) ──────────────────────────────\n * Upward-opening card pinned above the chip, in the Menu's card chrome\n * (r12, inverted hairline, shadow-lv3, --dsw-specific-menu — same family\n * as .popCard_2006230319). Three owner requirements shape the geometry:\n *\n * 1. height cap: min(420px, 60vh) on the card, only the rows area\n * scrolls (.menuRows_2006230319) — heading and search stay pinned;\n * 2. the search field sits pinned at the card's bottom edge, directly\n * above the chip, with the scrolling rows above it;\n * 3. the card is CSS-`bottom`-pinned ~6px above the chip's top and so\n * grows entirely upward — it can never cover the composer or fill\n * the viewport, whatever the branch count.\n *\n * The inline `left`/`bottom` come from BranchMenu's placement pass; the\n * width is fixed here (design 360px — 320 tree + 40 tool strip — and\n * viewport-capped) so horizontal clamping stays deterministic without\n * measuring the card. */\n\n/* The portal lands directly under document.body_2006230319, outside the shell's\n * box-sizing reset — content-box default would add padding/border on top\n * of the declared width (360 became 370, and the width:100% children\n * padded 16px past the card's right clip, shearing off their rounded\n * corners). Every width-declared box in this popup opts back into\n * border-box: the card, the toolbar, the rows, and the search input. */\n.menuCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n display: flex;\n flex-direction: row;\n width: min(360px, calc(100vw - 24px));\n max-height: min(420px, 60vh);\n overflow: hidden;\n padding: 4px;\n border: 1px solid var(--dsw-alias-border-inverted);\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n box-shadow: var(--dsw-shadow-lv3);\n}\n\n/* Left tool strip (IDEA branch-panel posture at popup scale): a narrow\n * column of icon-only buttons for actions that do not belong in the tree\n * — locate the checked-out branch, expand/collapse the whole tree.\n * Buttons stack from the BOTTOM up: the card's height shrinks when the\n * repo has few branches, so a top-anchored strip would drift around and\n * the buttons would sit far from the search bar; anchoring to the bottom\n * pins them at a stable spot (beside the search row) whatever the height. */\n.menuToolbar_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n gap: 2px;\n flex-shrink: 0;\n width: 32px;\n padding: 0 2px;\n margin-right: 4px;\n border-right: 1px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuToolButton_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n margin: 0 auto;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n\n.menuToolButton_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuToolButton_2006230319:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* The sync tools while their action runs: a soft opacity pulse. The glyph\n * is a directional arrow, so the circular-refresh spin read as garbled\n * rotation — pulsing keeps the arrow legible while clearly \"live\", and the\n * button keeps full opacity (the usual disabled dim would read as broken\n * for an in-flight network operation). */\n.menuToolButtonRunning_2006230319 svg {\n animation: menuToolPulse 700ms ease-in-out infinite alternate;\n}\n\n.menuToolButtonRunning_2006230319:disabled {\n opacity: 1;\n cursor: progress;\n}\n\n@keyframes menuToolPulse {\n from { opacity: 1; }\n to { opacity: 0.25; }\n}\n\n/* The main column: heading + scrollable rows + pinned search. */\n.menuMain_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Non-interactive group heading — the Menu label row's posture. */\n.menuHeading_2006230319 {\n padding: 6px 8px 4px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n\n/* The only scrollable region: shrinks within the capped card so the\n * heading above and the search below stay visible while rows scroll. */\n.menuRows_2006230319 {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * Weight 500 mirrors the chip's branch label (the portal escapes the\n * composer's font context, so the match must be explicit — the inherited\n * body weight is 400 and reads visibly lighter than the chip beside it). */\n.menuRow_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside .menuRows_2006230319 */\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuRow_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* Locked rows (a linked-worktree session answers every non-current pick\n * with the main-checkout toast): dimmed with a default cursor, but KEEP\n * the click path alive — no disabled attribute, the double-click is the\n * toast's stage. Hover stays quiet: nothing is on offer here. */\n.menuRowLocked_2006230319 {\n opacity: 0.45;\n cursor: default;\n}\n\n.menuRowLocked_2006230319:hover {\n background: transparent;\n}\n\n/* The checked-out branch: a persistent tint a step above the resting rows\n * so it reads as \"you are here\" the moment the list scrolls it into view\n * (BranchMenu centers it on open) — the trailing check alone is easy to\n * miss from a distance. */\n.menuRowSelected_2006230319,\n.menuRowSelected_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, currentColor 10%, transparent);\n}\n\n/* IDEA-style selection: the clicked row gets a bluish fill, layering over\n * the HEAD tint when the same row is both — selection communicates intent,\n * the HEAD tint communicates position, and they coexist (IDEA 4.4). */\n.menuRowPicked_2006230319,\n.menuRowPicked_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n}\n\n.menuRowLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Upstream divergence arrows (↑N/↓N) trailing a local branch row, before\n * the HEAD check: the count badge tone at a smaller size so a busy list\n * still reads the name first. Plain text arrows — no base-set icon pairs\n * a direction with a count. tabular-nums keeps ↑10 from nudging neighbors\n * as the digits tick. */\n.menuRowArrow_2006230319 {\n flex-shrink: 0;\n font-size: 11px;\n line-height: 20px;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Search hit highlight (IDEA): the matched substring gets a warm tint\n * behind it — theme-agnostic, legible in both light and dark cards. */\n.menuSearchMark_2006230319 {\n background: color-mix(in srgb, #b58900 38%, transparent);\n border-radius: 2px;\n}\n\n/* Tree group rows (folder headers) — BranchMenu's '/' prefix tree: the\n * same row geometry as .menuRow_2006230319, but labeled in the secondary tone so the\n * leaf rows pop, with a count badge and a chevron that turns on expand. */\n.menuGroup_2006230319 {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuGroup_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The two top-level section headers (local/remote branches) step ABOVE the\n * folder headers they contain: primary label tone like the leaf rows plus\n * a heavier weight, so the nav hierarchy reads group > row > folder — the\n * folder headers keep the secondary tone that alone would leave the\n * sections as the faintest (and most important) rows on the list. */\n.menuGroupTop_2006230319 {\n color: inherit;\n font-weight: 600;\n}\n\n.menuGroupLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.menuGroupChevron_2006230319 {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n transition: transform 120ms ease;\n}\n\n.menuGroupChevronOpen_2006230319 {\n transform: rotate(90deg);\n}\n\n.menuGroupCount_2006230319 {\n flex-shrink: 0;\n font-size: 12px;\n line-height: 20px;\n font-weight: 400;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Zero-search-hit state: centered secondary line inside the rows area. */\n.menuEmpty_2006230319 {\n padding: 10px 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n text-align: center;\n}\n\n/* Bottom-pinned search field, separated from the rows by a hairline.\n * Borderless so it reads as part of the card, focus shown as the\n * standard hover tint rather than an outline. */\n.menuSearchWrap_2006230319 {\n flex-shrink: 0;\n margin-top: 2px;\n padding-top: 4px;\n border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuSearch_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside the wrap */\n width: 100%;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuRow_2006230319) — the portal\n * escapes the composer's font context and would inherit body's 400. */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuSearch_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuSearch_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* ── New-branch create flyout (BranchMenu toolbar plus) ─────────────\n * Opens to the RIGHT of the card (the confirm flyout's posture) and holds\n * the whole flow in one panel: ask line, naming input, live hint, and the\n * Cancel/Create pair — typing the name and pressing Create fires the\n * create in one stroke, no second confirm step. */\n\n/* The toolbar plus in its active (flyout open) state: a bluish tint\n * layering the same way the picked row does, so the toggled state reads at\n * a glance. */\n.menuToolButtonOn_2006230319,\n.menuToolButtonOn_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n}\n\n/* The naming input inside the flyout: borderless, part of the card, focus\n * shown as the standard hover tint. Fixed width — the popCard is\n * max-content, so a percentage width would chase the input's own default\n * size instead of the design width. */\n.menuCreate_2006230319 {\n box-sizing: border-box;\n width: 248px;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuSearch_2006230319). */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuCreate_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuCreate_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuCreate_2006230319:disabled {\n opacity: 0.5;\n}\n\n/* The error line under the input — only rendered while the draft is\n * unacceptable with a non-empty reason; the input itself stays neutral,\n * the line carries the state. */\n.menuCreateHintBad_2006230319 {\n margin: 0;\n padding: 0 8px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-error);\n}\n";
@@ -2722,6 +2768,110 @@ window.__ModuleLoader__.load({
2722
2768
  localStorage.setItem(VIEW_STORAGE_KEY, JSON.stringify(prefs));
2723
2769
  } catch {}
2724
2770
  }
2771
+ /** localStorage key of the grouping switch's last-known value (browser-local). */
2772
+ const GROUP_BOOT_STORAGE_KEY = "dsh-git-worktree.sidebar.groupSidebar";
2773
+ /**
2774
+ * Read the grouping switch's last-known value. The seat mounts from this on
2775
+ * startup so the sidebar renders grouped IMMEDIATELY, without waiting for the
2776
+ * settings document to cross from the Host — the settings scope is the
2777
+ * authority and corrects a stale value once it lands. undefined = no record
2778
+ * (first visit; the composition default "on" is used).
2779
+ */
2780
+ function loadGroupSidebarBoot() {
2781
+ if (typeof localStorage === "undefined") return void 0;
2782
+ try {
2783
+ const raw = localStorage.getItem(GROUP_BOOT_STORAGE_KEY);
2784
+ if (raw === "1") return true;
2785
+ if (raw === "0") return false;
2786
+ return;
2787
+ } catch {
2788
+ return;
2789
+ }
2790
+ }
2791
+ /** Persist the grouping switch's last-known value; write failures stay silent. */
2792
+ function saveGroupSidebarBoot(enabled) {
2793
+ if (typeof localStorage === "undefined") return;
2794
+ try {
2795
+ localStorage.setItem(GROUP_BOOT_STORAGE_KEY, enabled ? "1" : "0");
2796
+ } catch {}
2797
+ }
2798
+ /** localStorage key of the last successful /group facts batch (browser-local). */
2799
+ const FACTS_STORAGE_KEY = "dsh-git-worktree.sidebar.facts.v1";
2800
+ /** Parse one WorkspaceGitFacts value; undefined = malformed. */
2801
+ function parseWorkspaceGitFacts(value) {
2802
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
2803
+ const record = value;
2804
+ if (typeof record.repoRoot !== "string" || record.repoRoot === "") return void 0;
2805
+ if (typeof record.repoName !== "string") return void 0;
2806
+ if (record.branch !== null && typeof record.branch !== "string") return void 0;
2807
+ if (typeof record.main !== "boolean") return void 0;
2808
+ return {
2809
+ repoRoot: record.repoRoot,
2810
+ repoName: record.repoName,
2811
+ branch: record.branch,
2812
+ main: record.main
2813
+ };
2814
+ }
2815
+ /** Parse a facts map; any malformed entry discards the whole batch. */
2816
+ function parseFactsRecord(value) {
2817
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
2818
+ const out = {};
2819
+ for (const [key, entry] of Object.entries(value)) {
2820
+ if (entry === null) {
2821
+ out[key] = null;
2822
+ continue;
2823
+ }
2824
+ const parsed = parseWorkspaceGitFacts(entry);
2825
+ if (parsed === void 0) return null;
2826
+ out[key] = parsed;
2827
+ }
2828
+ return out;
2829
+ }
2830
+ /**
2831
+ * Read the last successful /group facts batch. The sidebar consults this
2832
+ * whenever the workspace path signature is known (including the frame the
2833
+ * pending-empty baseline becomes the real list), so a page refresh never
2834
+ * flashes the degraded flat list while git probes run; the fresh probe
2835
+ * overwrites both the view and this cache. A poisoned entry (wrong value
2836
+ * shape) discards the whole batch rather than grouping under `repo:undefined`.
2837
+ */
2838
+ function loadFactsCache() {
2839
+ if (typeof localStorage === "undefined") return null;
2840
+ try {
2841
+ const raw = localStorage.getItem(FACTS_STORAGE_KEY);
2842
+ if (raw === null) return null;
2843
+ const parsed = JSON.parse(raw);
2844
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
2845
+ const record = parsed;
2846
+ if (typeof record.signature !== "string") return null;
2847
+ const facts = parseFactsRecord(record.facts);
2848
+ if (facts === null) return null;
2849
+ return {
2850
+ signature: record.signature,
2851
+ facts
2852
+ };
2853
+ } catch {
2854
+ return null;
2855
+ }
2856
+ }
2857
+ /**
2858
+ * Pick the facts batch that belongs to `signature`. Live (in-memory) hits
2859
+ * win; otherwise a matching cache batch. The grouped tree must paint the
2860
+ * moment the workspace path set is known — not only at `useState` init,
2861
+ * when the list is still the pending empty snapshot (signature `""`).
2862
+ */
2863
+ function factsForSignature(signature, live, cached) {
2864
+ if (live !== null && live.signature === signature) return live;
2865
+ if (cached !== null && cached.signature === signature) return cached;
2866
+ return null;
2867
+ }
2868
+ /** Persist one /group facts batch; write failures (quota, privacy mode) stay silent. */
2869
+ function saveFactsCache(entry) {
2870
+ if (typeof localStorage === "undefined") return;
2871
+ try {
2872
+ localStorage.setItem(FACTS_STORAGE_KEY, JSON.stringify(entry));
2873
+ } catch {}
2874
+ }
2725
2875
  /** Recency comparator: newest first, id as the deterministic tiebreak. */
2726
2876
  function byRecency(a, b) {
2727
2877
  if (b.updatedAt !== a.updatedAt) return b.updatedAt - a.updatedAt;
@@ -2817,6 +2967,57 @@ window.__ModuleLoader__.load({
2817
2967
  }));
2818
2968
  return rows.map((session) => sessionNode(session, descendants));
2819
2969
  }
2970
+ /**
2971
+ * Derive the stray-session clusters: sessions no workspace account holds
2972
+ * (a deleted-then-recreated registration's leftovers, or history that
2973
+ * appeared after first-boot grouping), clustered by their header cwd into
2974
+ * VIRTUAL directory groups. The same visibility rule as everywhere else
2975
+ * applies (archived hidden, subagent rows never listed, a blank visible
2976
+ * only while it IS the current selection — deleting the current session's
2977
+ * workspace registration must not make it vanish).
2978
+ *
2979
+ * Matching against registered workspace paths is case-insensitive
2980
+ * (NTFS): one directory must never split into two clusters because of
2981
+ * casing drift between a session header and the registry's realpath.
2982
+ * @param items - workspace list items (their `sessionIds` projection IS the
2983
+ * accounting; the registry guarantees one record per canonical path).
2984
+ * @param sessions - session list snapshot.
2985
+ * @param archivedSessionIds - registry-global archive set.
2986
+ * @returns stray groups in first-appearance order; empty when nothing is loose.
2987
+ */
2988
+ function deriveStrayGroups(items, sessions, archivedSessionIds) {
2989
+ const accounted = new Set(items.flatMap((workspace) => workspace.sessionIds));
2990
+ const registered = /* @__PURE__ */ new Map();
2991
+ for (const workspace of items) {
2992
+ const key = workspace.path.toLowerCase();
2993
+ if (!registered.has(key)) registered.set(key, workspace.title);
2994
+ }
2995
+ const archived = new Set(archivedSessionIds);
2996
+ const clusters = /* @__PURE__ */ new Map();
2997
+ for (const id of sessions.ids) {
2998
+ if (accounted.has(id)) continue;
2999
+ const summary = sessions.byId[id];
3000
+ if (summary === void 0) continue;
3001
+ if (summary.origin === "subagent") continue;
3002
+ if (archived.has(id)) continue;
3003
+ if (summary.blank && id !== sessions.current) continue;
3004
+ const path = summary.cwd ?? "";
3005
+ const key = `stray:${path === "" ? "?" : path.toLowerCase()}`;
3006
+ const existing = clusters.get(key);
3007
+ if (existing === void 0) clusters.set(key, {
3008
+ kind: "stray",
3009
+ key,
3010
+ path,
3011
+ belongsTo: path === "" ? void 0 : registered.get(path.toLowerCase()),
3012
+ sessions: [summary]
3013
+ });
3014
+ else clusters.set(key, {
3015
+ ...existing,
3016
+ sessions: [...existing.sessions, summary]
3017
+ });
3018
+ }
3019
+ return [...clusters.values()];
3020
+ }
2820
3021
  /** Display label for the ungrouped bucket row. */
2821
3022
  const UNGROUPED_LABEL = "Ungrouped";
2822
3023
  /**
@@ -2973,7 +3174,7 @@ window.__ModuleLoader__.load({
2973
3174
  }
2974
3175
  //#endregion
2975
3176
  //#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\sidebar-rows.module.css?inline
2976
- const css$1 = "/* Native Rows.module_2050697429.css_2050697429 transplanted 1:1 (DSW tokens, row-in, reduced-motion).\n * Drag marker classes (dropBefore/dropAfter) are kept for P3; unused in P2. */\n\n.projectRow_2050697429,\n.sessionRow_2050697429 {\n cursor: pointer;\n user-select: none;\n color: var(--dsw-alias-label-primary);\n border-radius: 8px;\n align-items: center;\n gap: 6px;\n padding: 0 8px;\n display: flex;\n}\n\n.projectRow_2050697429:hover,\n.sessionRow_2050697429:hover,\n.sessionRow_2050697429.selected_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchResultRow_2050697429 {\n box-sizing: border-box;\n cursor: pointer;\n text-align: left;\n width: 100%;\n min-height: 48px;\n color: var(--dsw-alias-label-primary);\n background: 0 0;\n border: none;\n border-radius: 8px;\n flex-direction: column;\n align-items: stretch;\n padding: 4px 8px;\n display: flex;\n}\n\n.searchResultRow_2050697429:hover,\n.searchResultRow_2050697429.selected_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchResultHeading_2050697429 {\n align-items: center;\n min-width: 0;\n display: flex;\n}\n\n.searchResultTitle_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n margin-left: 4px;\n font-size: 14px;\n line-height: 20px;\n overflow: hidden;\n}\n\n.searchResultMeta_2050697429 {\n align-items: center;\n gap: 6px;\n min-width: 0;\n margin-left: 20px;\n display: flex;\n}\n\n.searchResultWorkspace_2050697429,\n.searchResultSnippet_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n line-height: 17px;\n overflow: hidden;\n}\n\n.searchResultWorkspace_2050697429 {\n max-width: 40%;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n}\n\n.searchResultSnippet_2050697429 {\n min-width: 0;\n color: var(--dsw-alias-label-secondary);\n flex: 1;\n}\n\n.projectRow_2050697429 {\n box-sizing: border-box;\n align-items: center;\n height: 34px;\n}\n\n.projectRow_2050697429 .rowActions_2050697429 {\n height: 20px;\n}\n\n.sessionRow_2050697429 {\n height: 32px;\n animation: row-in 0.15s var(--ds-ease-in-out);\n gap: 0;\n}\n\n.sessionRow_2050697429 .title_2050697429 {\n margin: 0 6px 0 4px;\n}\n\n.flatSessionRowWithoutStatus_2050697429 .title_2050697429 {\n margin-left: 0;\n}\n\n@keyframes row-in {\n 0% { opacity: 0; }\n}\n\n.slot_2050697429 {\n width: 16px;\n height: 20px;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.visuallyHidden_2050697429 {\n clip: rect(0 0 0 0);\n white-space: nowrap;\n width: 1px;\n height: 1px;\n position: absolute;\n overflow: hidden;\n}\n\n.folderActive_2050697429 {\n color: var(--dsw-alias-state-business-primary);\n}\n\n.projectRow_2050697429 .chevron_2050697429 {\n display: none;\n}\n\n.projectRow_2050697429:hover .chevron_2050697429 {\n display: inline-flex;\n}\n\n.projectRow_2050697429:hover .folder_2050697429 {\n display: none;\n}\n\n.arrow_2050697429 {\n transition: transform 0.15s var(--ds-ease-in-out);\n}\n\n.arrowOpen_2050697429 {\n transform: rotate(90deg);\n}\n\n.projectText_2050697429 {\n flex-direction: column;\n flex: 1;\n gap: 2px;\n min-width: 0;\n display: flex;\n}\n\n.title_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n font-size: 14px;\n line-height: 20px;\n overflow: hidden;\n}\n\n.renameInput_2050697429 {\n border: 1px solid var(--dsw-alias-border-l2);\n background: var(--dsw-alias-button-elevated-fill);\n min-width: 0;\n color: inherit;\n border-radius: 4px;\n outline: none;\n padding: 0 2px;\n font-size: 14px;\n line-height: 20px;\n}\n\n.sessionRow_2050697429 .title_2050697429 {\n flex: 1;\n}\n\n.meta_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n overflow: hidden;\n}\n\n.time_2050697429 {\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n font-size: 12px;\n line-height: 20px;\n}\n\n.dot_2050697429 {\n flex: none;\n}\n\n.rowActions_2050697429 {\n flex: none;\n align-items: center;\n gap: 12px;\n display: none;\n}\n\n.projectRow_2050697429:hover .rowActions_2050697429,\n.sessionRow_2050697429:hover .rowActions_2050697429,\n.projectRow_2050697429.menuOpen_2050697429 .rowActions_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 .rowActions_2050697429 {\n display: inline-flex;\n}\n\n.sessionRow_2050697429:hover .time_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 .time_2050697429 {\n display: none;\n}\n\n.projectRow_2050697429.menuOpen_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n/* P3: session drag insertion markers (unused in P2). */\n.sessionRow_2050697429.dropBefore_2050697429,\n.sessionRow_2050697429.dropAfter_2050697429 {\n position: relative;\n}\n\n.sessionRow_2050697429.dropBefore_2050697429:before,\n.sessionRow_2050697429.dropAfter_2050697429:after {\n content: \"\";\n z-index: 1;\n background:\n linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat,\n linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat,\n linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;\n pointer-events: none;\n height: 12px;\n position: absolute;\n left: 0;\n right: 4px;\n}\n\n.sessionRow_2050697429.dropBefore_2050697429:before {\n top: -7px;\n}\n\n.sessionRow_2050697429.dropAfter_2050697429:after {\n bottom: -7px;\n}\n\n.hoverContent_2050697429 {\n flex-direction: column;\n gap: 8px;\n display: flex;\n}\n\n.hoverTitle_2050697429 {\n color: #fff;\n overflow-wrap: break-word;\n font-size: 14px;\n line-height: 20px;\n}\n\n.hoverPath_2050697429 {\n color: #cfd3d6;\n word-break: break-all;\n font-size: 12px;\n line-height: 16px;\n}\n\n.hoverTime_2050697429 {\n color: #cfd3d6;\n font-size: 12px;\n line-height: 16px;\n}\n\n.hoverStatus_2050697429 {\n color: #adb2b8;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n line-height: 20px;\n display: flex;\n}\n\n.iconButton_2050697429 {\n cursor: pointer;\n width: 16px;\n height: 16px;\n color: var(--dsw-alias-label-tertiary);\n background: 0 0;\n border: none;\n border-radius: 4px;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.iconButton_2050697429:hover {\n color: var(--dsw-alias-label-primary);\n}\n\n.chevron_2050697429 {\n color: var(--dsw-alias-label-caption);\n}\n\n.repoCount_2050697429 {\n flex: none;\n margin-left: 8px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .sessionRow_2050697429,\n .arrow_2050697429 {\n transition: none;\n animation: none;\n }\n}\n";
3177
+ const css$1 = "/* Native Rows.module_2050697429.css_2050697429 transplanted 1:1 (DSW tokens, row-in, reduced-motion).\n * Drag marker classes (dropBefore/dropAfter) are kept for P3; unused in P2. */\n\n.projectRow_2050697429,\n.sessionRow_2050697429 {\n cursor: pointer;\n user-select: none;\n color: var(--dsw-alias-label-primary);\n border-radius: 8px;\n align-items: center;\n gap: 6px;\n padding: 0 8px;\n display: flex;\n}\n\n.projectRow_2050697429:hover,\n.sessionRow_2050697429:hover,\n.sessionRow_2050697429.selected_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchResultRow_2050697429 {\n box-sizing: border-box;\n cursor: pointer;\n text-align: left;\n width: 100%;\n min-height: 48px;\n color: var(--dsw-alias-label-primary);\n background: 0 0;\n border: none;\n border-radius: 8px;\n flex-direction: column;\n align-items: stretch;\n padding: 4px 8px;\n display: flex;\n}\n\n.searchResultRow_2050697429:hover,\n.searchResultRow_2050697429.selected_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchResultHeading_2050697429 {\n align-items: center;\n min-width: 0;\n display: flex;\n}\n\n.searchResultTitle_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n margin-left: 4px;\n font-size: 14px;\n line-height: 20px;\n overflow: hidden;\n}\n\n.searchResultMeta_2050697429 {\n align-items: center;\n gap: 6px;\n min-width: 0;\n margin-left: 20px;\n display: flex;\n}\n\n.searchResultWorkspace_2050697429,\n.searchResultSnippet_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n line-height: 17px;\n overflow: hidden;\n}\n\n.searchResultWorkspace_2050697429 {\n max-width: 40%;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n}\n\n.searchResultSnippet_2050697429 {\n min-width: 0;\n color: var(--dsw-alias-label-secondary);\n flex: 1;\n}\n\n.projectRow_2050697429 {\n box-sizing: border-box;\n align-items: center;\n height: 34px;\n}\n\n.projectRow_2050697429 .rowActions_2050697429 {\n height: 20px;\n}\n\n.sessionRow_2050697429 {\n height: 32px;\n animation: row-in 0.15s var(--ds-ease-in-out);\n gap: 0;\n}\n\n.sessionRow_2050697429 .title_2050697429 {\n margin: 0 6px 0 4px;\n}\n\n.flatSessionRowWithoutStatus_2050697429 .title_2050697429 {\n margin-left: 0;\n}\n\n@keyframes row-in {\n 0% { opacity: 0; }\n}\n\n.slot_2050697429 {\n width: 16px;\n height: 20px;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.visuallyHidden_2050697429 {\n clip: rect(0 0 0 0);\n white-space: nowrap;\n width: 1px;\n height: 1px;\n position: absolute;\n overflow: hidden;\n}\n\n.folderActive_2050697429 {\n color: var(--dsw-alias-state-business-primary);\n}\n\n.projectRow_2050697429 .chevron_2050697429 {\n display: none;\n}\n\n.projectRow_2050697429:hover .chevron_2050697429 {\n display: inline-flex;\n}\n\n.projectRow_2050697429:hover .folder_2050697429 {\n display: none;\n}\n\n.arrow_2050697429 {\n transition: transform 0.15s var(--ds-ease-in-out);\n}\n\n.arrowOpen_2050697429 {\n transform: rotate(90deg);\n}\n\n.projectText_2050697429 {\n flex-direction: column;\n flex: 1;\n gap: 2px;\n min-width: 0;\n display: flex;\n}\n\n.title_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n font-size: 14px;\n line-height: 20px;\n overflow: hidden;\n}\n\n/* Virtual (unregistered) directory rows read one weight lighter than real\n * workspace rows — together with the dashed folder glyph, the whole row is\n * distinguishable at a glance. */\n.strayRow_2050697429 .title_2050697429 {\n color: var(--dsw-alias-label-secondary);\n}\n\n.renameInput_2050697429 {\n border: 1px solid var(--dsw-alias-border-l2);\n background: var(--dsw-alias-button-elevated-fill);\n min-width: 0;\n color: inherit;\n border-radius: 4px;\n outline: none;\n padding: 0 2px;\n font-size: 14px;\n line-height: 20px;\n}\n\n.sessionRow_2050697429 .title_2050697429 {\n flex: 1;\n}\n\n.meta_2050697429 {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n overflow: hidden;\n}\n\n.time_2050697429 {\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n font-size: 12px;\n line-height: 20px;\n}\n\n.dot_2050697429 {\n flex: none;\n}\n\n.rowActions_2050697429 {\n flex: none;\n align-items: center;\n gap: 12px;\n display: none;\n}\n\n.projectRow_2050697429:hover .rowActions_2050697429,\n.sessionRow_2050697429:hover .rowActions_2050697429,\n.projectRow_2050697429.menuOpen_2050697429 .rowActions_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 .rowActions_2050697429 {\n display: inline-flex;\n}\n\n.sessionRow_2050697429:hover .time_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 .time_2050697429 {\n display: none;\n}\n\n.projectRow_2050697429.menuOpen_2050697429,\n.sessionRow_2050697429.menuOpen_2050697429 {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n/* P3: session drag insertion markers (unused in P2). */\n.sessionRow_2050697429.dropBefore_2050697429,\n.sessionRow_2050697429.dropAfter_2050697429 {\n position: relative;\n}\n\n.sessionRow_2050697429.dropBefore_2050697429:before,\n.sessionRow_2050697429.dropAfter_2050697429:after {\n content: \"\";\n z-index: 1;\n background:\n linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat,\n linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat,\n linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;\n pointer-events: none;\n height: 12px;\n position: absolute;\n left: 0;\n right: 4px;\n}\n\n.sessionRow_2050697429.dropBefore_2050697429:before {\n top: -7px;\n}\n\n.sessionRow_2050697429.dropAfter_2050697429:after {\n bottom: -7px;\n}\n\n.hoverContent_2050697429 {\n flex-direction: column;\n gap: 8px;\n display: flex;\n}\n\n.hoverTitle_2050697429 {\n color: #fff;\n overflow-wrap: break-word;\n font-size: 14px;\n line-height: 20px;\n}\n\n.hoverPath_2050697429 {\n color: #cfd3d6;\n word-break: break-all;\n font-size: 12px;\n line-height: 16px;\n}\n\n.hoverTime_2050697429 {\n color: #cfd3d6;\n font-size: 12px;\n line-height: 16px;\n}\n\n.hoverStatus_2050697429 {\n color: #adb2b8;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n line-height: 20px;\n display: flex;\n}\n\n.iconButton_2050697429 {\n cursor: pointer;\n width: 16px;\n height: 16px;\n color: var(--dsw-alias-label-tertiary);\n background: 0 0;\n border: none;\n border-radius: 4px;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.iconButton_2050697429:hover {\n color: var(--dsw-alias-label-primary);\n}\n\n.chevron_2050697429 {\n color: var(--dsw-alias-label-caption);\n}\n\n.repoCount_2050697429 {\n flex: none;\n margin-left: 8px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .sessionRow_2050697429,\n .arrow_2050697429 {\n transition: none;\n animation: none;\n }\n}\n";
2977
3178
  const tagId$1 = "@laoyuehanni/dsh-git-worktree/sidebar-rows.module.css";
2978
3179
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$1 + "\"]") === null) {
2979
3180
  const tag = document.createElement("style");
@@ -3005,6 +3206,7 @@ window.__ModuleLoader__.load({
3005
3206
  "arrow": "arrow_2050697429",
3006
3207
  "arrowOpen": "arrowOpen_2050697429",
3007
3208
  "projectText": "projectText_2050697429",
3209
+ "strayRow": "strayRow_2050697429",
3008
3210
  "renameInput": "renameInput_2050697429",
3009
3211
  "meta": "meta_2050697429",
3010
3212
  "time": "time_2050697429",
@@ -3064,16 +3266,25 @@ window.__ModuleLoader__.load({
3064
3266
  function ProjectRowItem({ row, onToggle, onCreate, actions, home, t, badge }) {
3065
3267
  const active = row.expanded && row.containsCurrent;
3066
3268
  const [menuOpen, setMenuOpen] = (0, react.useState)(false);
3067
- const workspaceMenuItems = [{
3068
- id: "rename",
3069
- label: t("rename"),
3070
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {})
3071
- }, {
3072
- id: "delete",
3073
- label: t("delete.workspace"),
3074
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, {}),
3075
- danger: true
3076
- }];
3269
+ const workspaceMenuItems = [
3270
+ {
3271
+ id: "rename",
3272
+ label: t("rename"),
3273
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {})
3274
+ },
3275
+ ...actions?.removeWorktree !== void 0 ? [{
3276
+ id: "removeWorktree",
3277
+ label: t("worktreeRemove.menu"),
3278
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, {}),
3279
+ danger: true
3280
+ }] : [],
3281
+ {
3282
+ id: "delete",
3283
+ label: t("delete.workspace"),
3284
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, {}),
3285
+ danger: true
3286
+ }
3287
+ ];
3077
3288
  const ownRow = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3078
3289
  className: cx$1(sidebar_rows_module_default.projectRow, menuOpen && sidebar_rows_module_default.menuOpen),
3079
3290
  role: "treeitem",
@@ -3109,9 +3320,9 @@ window.__ModuleLoader__.load({
3109
3320
  items: workspaceMenuItems,
3110
3321
  onSelect: (id) => {
3111
3322
  setMenuOpen(false);
3112
- if (id !== "rename" && id !== "delete") return;
3113
3323
  if (id === "rename") actions.rename();
3114
- else actions.delete();
3324
+ else if (id === "removeWorktree") actions.removeWorktree?.();
3325
+ else if (id === "delete") actions.delete();
3115
3326
  },
3116
3327
  portal: true,
3117
3328
  closeOnPointerLeave: true,
@@ -3156,6 +3367,146 @@ window.__ModuleLoader__.load({
3156
3367
  function assertNever(value) {
3157
3368
  throw new Error(`unknown pending interaction: ${String(value)}`);
3158
3369
  }
3370
+ /** Final path segment of an absolute directory ('' for the unknown-cwd cluster). */
3371
+ function pathBasename(path) {
3372
+ if (path === "") return "";
3373
+ const parts = path.split(/[\\/]/);
3374
+ return parts[parts.length - 1] ?? "";
3375
+ }
3376
+ /**
3377
+ * Dashed folder glyph for virtual (unregistered) directory rows. The icon set
3378
+ * ships no dashed variant, so this follows the WorktreeCheck precedent of a
3379
+ * module-local SVG: at 16px a dash pattern is a far stronger "directory-shaped
3380
+ * but not a registered workspace" mark than the outline/solid stroke contrast
3381
+ * it replaces.
3382
+ */
3383
+ function StrayFolderGlyph({ size = 16 }) {
3384
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
3385
+ width: size,
3386
+ height: size,
3387
+ viewBox: "0 0 16 16",
3388
+ fill: "none",
3389
+ "aria-hidden": "true",
3390
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
3391
+ d: "M1.75 4.4c0-.91.71-1.65 1.6-1.65h2.47c.45 0 .88.19 1.19.52l.79.86h4.85c.89 0 1.6.74 1.6 1.65v6.05c0 .91-.71 1.65-1.6 1.65H3.35c-.89 0-1.6-.74-1.6-1.65Z",
3392
+ stroke: "currentColor",
3393
+ strokeWidth: "1.15",
3394
+ strokeDasharray: "2 1.6",
3395
+ strokeLinejoin: "round",
3396
+ strokeLinecap: "round"
3397
+ })
3398
+ });
3399
+ }
3400
+ /**
3401
+ * One virtual directory row of the stray (Ungrouped) section: DASHED folder
3402
+ * (the real workspace rows' folder is solid — the dash pattern is the
3403
+ * at-a-glance "this directory is not a registered workspace" mark) +
3404
+ * directory basename + session-count badge; hover reveals the full path plus
3405
+ * one guidance line — ownership when a registered workspace holds the
3406
+ * directory, or the rebuild hint when it is a missing worktree storage slot.
3407
+ * The ⋯ menu carries exactly one action: register (directory probed real and
3408
+ * unregistered) or rebuild (missing but host-confirmed as a storage slot).
3409
+ */
3410
+ function StrayGroupRow({ path, belongsTo, count, expanded, onToggle, onRegister, registering, onRebuild, rebuilding, missingDir, worktreeSlot, home, t }) {
3411
+ const [menuOpen, setMenuOpen] = (0, react.useState)(false);
3412
+ const label = path === "" ? t("stray.unknown") : pathBasename(path);
3413
+ const items = onRegister !== void 0 ? [{
3414
+ id: "register",
3415
+ label: t("stray.register"),
3416
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpen16, {})
3417
+ }] : onRebuild !== void 0 ? [{
3418
+ id: "rebuild",
3419
+ label: t("stray.rebuild"),
3420
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpen16, {})
3421
+ }] : [];
3422
+ const row = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3423
+ className: cx$1(sidebar_rows_module_default.projectRow, sidebar_rows_module_default.strayRow, menuOpen && sidebar_rows_module_default.menuOpen),
3424
+ role: "treeitem",
3425
+ "aria-expanded": expanded,
3426
+ onClick: onToggle,
3427
+ children: [
3428
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3429
+ className: cx$1(sidebar_rows_module_default.slot, sidebar_rows_module_default.folder),
3430
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StrayFolderGlyph, {})
3431
+ }),
3432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3433
+ className: cx$1(sidebar_rows_module_default.slot, sidebar_rows_module_default.chevron),
3434
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTriangleRightFill14, { className: cx$1(sidebar_rows_module_default.arrow, expanded && sidebar_rows_module_default.arrowOpen) })
3435
+ }),
3436
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3437
+ className: sidebar_rows_module_default.projectText,
3438
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3439
+ className: sidebar_rows_module_default.title,
3440
+ children: label
3441
+ })
3442
+ }),
3443
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3444
+ className: sidebar_rows_module_default.repoCount,
3445
+ children: String(count)
3446
+ }),
3447
+ items.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3448
+ className: sidebar_rows_module_default.rowActions,
3449
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
3450
+ open: menuOpen,
3451
+ onClose: () => {
3452
+ setMenuOpen(false);
3453
+ },
3454
+ items,
3455
+ onSelect: (id) => {
3456
+ setMenuOpen(false);
3457
+ if (id === "register") onRegister?.();
3458
+ if (id === "rebuild") onRebuild?.();
3459
+ },
3460
+ portal: true,
3461
+ closeOnPointerLeave: true,
3462
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3463
+ type: "button",
3464
+ className: sidebar_rows_module_default.iconButton,
3465
+ "aria-label": onRegister !== void 0 ? t("stray.register.aria", { name: label }) : t("stray.rebuild.aria", { name: label }),
3466
+ disabled: registering === true || rebuilding === true,
3467
+ onClick: (e) => {
3468
+ e.stopPropagation();
3469
+ setMenuOpen((v) => !v);
3470
+ },
3471
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutline16, {})
3472
+ })
3473
+ })
3474
+ })
3475
+ ]
3476
+ });
3477
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.HoverCard, {
3478
+ anchor: row,
3479
+ content: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3480
+ className: sidebar_rows_module_default.hoverContent,
3481
+ children: [
3482
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3483
+ className: sidebar_rows_module_default.hoverTitle,
3484
+ children: label
3485
+ }),
3486
+ path !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3487
+ className: sidebar_rows_module_default.hoverPath,
3488
+ children: (0, _deepseek_ai_dsh_client_runtime_client.abbreviateHomePath)(path, home)
3489
+ }),
3490
+ belongsTo !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3491
+ className: sidebar_rows_module_default.hoverStatus,
3492
+ children: t("stray.belongsTo", { name: belongsTo })
3493
+ }),
3494
+ missingDir === true && worktreeSlot === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3495
+ className: sidebar_rows_module_default.hoverStatus,
3496
+ children: t("stray.worktreeSlot")
3497
+ }),
3498
+ missingDir === true && worktreeSlot !== true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3499
+ className: sidebar_rows_module_default.hoverStatus,
3500
+ children: t("stray.missingDir")
3501
+ })
3502
+ ]
3503
+ }),
3504
+ disabled: menuOpen,
3505
+ copyText: path === "" ? void 0 : path,
3506
+ copyLabel: t("copy"),
3507
+ copiedLabel: t("hover.copied")
3508
+ });
3509
+ }
3159
3510
  /** Session status presentation; pending interaction is primary and live activity outranks completion. */
3160
3511
  function sessionStatuses(node, t) {
3161
3512
  const subagents = node.runningSubagentCount === 0 ? void 0 : {
@@ -3426,7 +3777,7 @@ window.__ModuleLoader__.load({
3426
3777
  }
3427
3778
  //#endregion
3428
3779
  //#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\GroupedSidebar.module.css?inline
3429
- const css = "/* Native WorkspaceBrowser.module_1808205761.css_1808205761 + WorkspacePicker.module_1808205761.css_1808205761 transplanted\n * 1:1 (DSW tokens, search expand, reduced-motion). Drag classes\n * (workspaceDrop*, listTopDrop*) are kept for P3; unused in P2.\n * Overlay: memberIndent / sessionsIndent for the repo-grouped tree. */\n\n.root_1808205761 {\n --dsh-session-list-edge-inset: var(--dsh-sidebar-inline-padding);\n --dsh-session-list-scrollbar-width: 8px;\n --dsh-session-list-scrollbar-offset: 2px;\n box-sizing: border-box;\n min-height: 0;\n padding-right: var(--dsh-session-list-edge-inset);\n flex-direction: column;\n flex: 1;\n display: flex;\n}\n\n.root_1808205761.rail_1808205761 {\n padding-right: 0;\n}\n\n.iconButton_1808205761 {\n cursor: pointer;\n width: 28px;\n height: 28px;\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.iconButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.sectionHeader_1808205761 {\n box-sizing: border-box;\n height: 36px;\n color: var(--dsw-alias-label-tertiary);\n border-radius: 12px;\n flex: none;\n justify-content: flex-end;\n align-items: center;\n gap: 4px;\n margin-bottom: 4px;\n padding-left: 4px;\n display: flex;\n overflow: hidden;\n}\n\n.root_1808205761:not(.rail_1808205761) .sectionHeader_1808205761 {\n margin-top: 2px;\n margin-right: -4px;\n}\n\n.sectionLabel_1808205761 {\n white-space: nowrap;\n opacity: 1;\n visibility: visible;\n min-width: 0;\n max-width: 45%;\n transition: max-width 0.18s var(--ds-ease-in-out), margin-right 0.18s var(--ds-ease-in-out), opacity 0.12s var(--ds-ease-in-out), transform 0.18s var(--ds-ease-in-out), visibility 0s linear;\n flex: none;\n line-height: 20px;\n overflow: hidden;\n}\n\n.sectionLabelHidden_1808205761 {\n opacity: 0;\n visibility: hidden;\n max-width: 0;\n margin-right: -4px;\n transition-delay: 0s, 0s, 0s, 0s, 0.18s;\n transform: translate(-4px);\n}\n\n.searchSlot_1808205761 {\n box-sizing: border-box;\n min-width: 0;\n max-width: 28px;\n transition: max-width 0.18s var(--ds-ease-in-out), padding-left 0.18s var(--ds-ease-in-out);\n flex: 1;\n align-items: center;\n margin-left: auto;\n padding-left: 0;\n display: flex;\n}\n\n.searchSlotExpanded_1808205761 {\n max-width: 100%;\n padding-left: 0;\n}\n\n.headerActions_1808205761 {\n opacity: 1;\n visibility: visible;\n max-width: 60px;\n transition: max-width 0.18s var(--ds-ease-in-out), opacity 0.12s var(--ds-ease-in-out), transform 0.18s var(--ds-ease-in-out), visibility 0s linear;\n flex: none;\n align-items: center;\n gap: 4px;\n display: flex;\n overflow: hidden;\n}\n\n.headerActionsHidden_1808205761 {\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n max-width: 0;\n transition-delay: 0s, 0s, 0s, 0.18s;\n transform: translate(4px);\n}\n\n.search_1808205761 {\n box-sizing: border-box;\n cursor: text;\n width: 100%;\n height: 28px;\n color: var(--dsw-alias-label-secondary);\n transition: width 0.18s var(--ds-ease-in-out), padding 0.18s var(--ds-ease-in-out), border-color 0.18s var(--ds-ease-in-out), background-color 0.18s var(--ds-ease-in-out);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n align-items: center;\n gap: 0;\n margin: 0;\n padding: 0;\n display: flex;\n overflow: hidden;\n}\n\n.searchExpanded_1808205761 {\n border: 1px solid var(--dsw-alias-border-l2);\n width: calc(100% + 4px);\n height: 30px;\n color: var(--dsw-alias-label-caption);\n background: 0 0;\n border-radius: 10px;\n margin-inline: -2px;\n padding: 0 4px 0 0;\n}\n\n.searchButton_1808205761 {\n cursor: pointer;\n width: 28px;\n height: 28px;\n color: inherit;\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.searchExpanded_1808205761 .searchButton_1808205761 {\n width: 28px;\n height: 30px;\n}\n\n.searchButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchExpanded_1808205761 .searchButton_1808205761:hover {\n background: 0 0;\n}\n\n.searchInput_1808205761 {\n opacity: 0;\n pointer-events: none;\n width: 0;\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n transition: opacity 0.12s var(--ds-ease-in-out);\n background: 0 0;\n border: none;\n outline: none;\n flex: 1;\n font-size: 13px;\n line-height: 18px;\n}\n\n.searchExpanded_1808205761 .searchInput_1808205761 {\n opacity: 1;\n pointer-events: auto;\n margin-left: -2px;\n}\n\n.searchInput_1808205761::placeholder {\n color: var(--dsw-alias-label-tertiary);\n}\n\n.clearButton_1808205761 {\n cursor: pointer;\n width: 24px;\n height: 24px;\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.clearButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.rail_1808205761 .sectionHeader_1808205761 {\n justify-content: flex-start;\n gap: 0;\n margin-bottom: 12px;\n padding-left: 0;\n}\n\n.rail_1808205761 .headerActions_1808205761 {\n max-width: none;\n}\n\n.rail_1808205761 .iconButton_1808205761 {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n\n.rail_1808205761 .search_1808205761 {\n background: 0 0;\n border-color: #0000;\n gap: 0;\n width: 36px;\n height: 36px;\n margin: 0 0 12px;\n padding: 0;\n}\n\n.rail_1808205761 .searchButton_1808205761 {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n\n.rail_1808205761 .searchButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.listArea_1808205761 {\n min-height: 0;\n margin-left: -4px;\n margin-right: calc(-1 * var(--dsh-session-list-edge-inset));\n flex-direction: column;\n flex: 1;\n padding-left: 4px;\n display: flex;\n overflow: visible;\n}\n\n.rail_1808205761 .listArea_1808205761 {\n margin-left: 0;\n margin-right: 0;\n padding-left: 0;\n}\n\n.treeBody_1808205761 {\n flex-direction: column;\n flex: 1;\n min-height: 0;\n display: flex;\n position: relative;\n}\n\n.fade_1808205761 {\n left: 0;\n right: var(--dsh-session-list-edge-inset);\n background: linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));\n pointer-events: none;\n height: 24px;\n position: absolute;\n bottom: 0;\n}\n\n.wide_1808205761 {\n animation: wide-in 0.2s var(--ds-ease-in-out);\n}\n\n@keyframes wide-in {\n 0% { opacity: 0; }\n}\n\n.list_1808205761 {\n min-height: 0;\n margin-left: -4px;\n margin-right: var(--dsh-session-list-scrollbar-offset);\n padding-left: 4px;\n padding-right: calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));\n scrollbar-gutter: stable;\n flex: 1;\n padding-bottom: 16px;\n overflow-y: auto;\n}\n\n.flatList_1808205761 > * + *,\n.searchTree_1808205761 > [role=treeitem] + [role=treeitem],\n.groupSection_1808205761 > * + * {\n margin-top: 2px;\n}\n\n.searchStatus_1808205761,\n.searchWarning_1808205761 {\n color: var(--dsw-alias-label-tertiary);\n padding: 10px 12px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.searchWarning_1808205761 {\n color: var(--dsw-alias-label-secondary);\n}\n\n.groupSection_1808205761 {\n position: relative;\n}\n\n.groupSection_1808205761 + .groupSection_1808205761 {\n margin-top: 4px;\n}\n\n/* P3: workspace drag insertion markers (unused in P2). */\n.listTopDropIndicator_1808205761,\n.workspaceDropBefore_1808205761:before,\n.workspaceDropAfter_1808205761:after {\n content: \"\";\n z-index: 1;\n background:\n linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat,\n linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat,\n linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;\n pointer-events: none;\n height: 12px;\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.listTopDropIndicator_1808205761 {\n top: -8px;\n left: 0;\n right: var(--dsh-session-list-edge-inset);\n}\n\n.listTopDropActive_1808205761 > .workspaceDropBefore_1808205761:first-child:before {\n display: none;\n}\n\n.workspaceDropBefore_1808205761:before {\n top: -8px;\n}\n\n.workspaceDropAfter_1808205761:after {\n bottom: -8px;\n}\n\n.sessionOverflowButton_1808205761 {\n cursor: pointer;\n text-align: left;\n width: 100%;\n height: 28px;\n color: var(--dsw-alias-label-tertiary);\n background: 0 0;\n border: none;\n border-radius: 8px;\n padding: 0 12px 0 28px;\n font-size: 12px;\n}\n\n.groupSection_1808205761 > .sessionOverflowButton_1808205761 {\n margin-top: 0;\n}\n\n.sessionOverflowButton_1808205761:hover {\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n}\n\n.empty_1808205761 {\n color: var(--dsw-alias-label-tertiary);\n padding: 16px 12px;\n font-size: 13px;\n}\n\n.renameInput_1808205761 {\n box-sizing: border-box;\n border: 1px solid var(--dsw-alias-border-l2);\n width: 100%;\n height: 44px;\n color: var(--dsw-alias-label-primary);\n background: 0 0;\n border-radius: 22px;\n outline: none;\n padding: 7px 14px;\n font-size: 14px;\n font-weight: 400;\n line-height: 22px;\n}\n\n.renameInput_1808205761:disabled {\n color: var(--dsw-alias-label-dimmed);\n}\n\n.renameError_1808205761 {\n color: var(--dsw-alias-state-error-primary);\n margin-top: 8px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.deleteAction_1808205761:not(:disabled) {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.deleteStatus_1808205761 {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.modalAction_1808205761 {\n min-width: 72px;\n}\n\n.modalError_1808205761,\n.menuStatus_1808205761 {\n margin-top: 8px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.modalError_1808205761 {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.menuStatus_1808205761 {\n color: var(--dsw-alias-label-secondary);\n}\n\n/* Aggregation overlay: indent member workspaces and their sessions. */\n.memberIndent_1808205761 {\n margin-left: 16px;\n}\n\n.sessionsIndent_1808205761 {\n margin-left: 8px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .wide_1808205761 {\n animation: none;\n }\n\n .search_1808205761,\n .sectionLabel_1808205761,\n .searchSlot_1808205761,\n .searchInput_1808205761,\n .headerActions_1808205761 {\n transition: none;\n }\n}\n";
3780
+ const css = "/* Native WorkspaceBrowser.module_1808205761.css_1808205761 + WorkspacePicker.module_1808205761.css_1808205761 transplanted\n * 1:1 (DSW tokens, search expand, reduced-motion). Drag classes\n * (workspaceDrop*, listTopDrop*) are kept for P3; unused in P2.\n * Overlay: memberIndent / sessionsIndent for the repo-grouped tree. */\n\n.root_1808205761 {\n --dsh-session-list-edge-inset: var(--dsh-sidebar-inline-padding);\n --dsh-session-list-scrollbar-width: 8px;\n --dsh-session-list-scrollbar-offset: 2px;\n box-sizing: border-box;\n min-height: 0;\n padding-right: var(--dsh-session-list-edge-inset);\n flex-direction: column;\n flex: 1;\n display: flex;\n}\n\n.root_1808205761.rail_1808205761 {\n padding-right: 0;\n}\n\n.iconButton_1808205761 {\n cursor: pointer;\n width: 28px;\n height: 28px;\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.iconButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.sectionHeader_1808205761 {\n box-sizing: border-box;\n height: 36px;\n color: var(--dsw-alias-label-tertiary);\n border-radius: 12px;\n flex: none;\n justify-content: flex-end;\n align-items: center;\n gap: 4px;\n margin-bottom: 4px;\n padding-left: 4px;\n display: flex;\n overflow: hidden;\n}\n\n.root_1808205761:not(.rail_1808205761) .sectionHeader_1808205761 {\n margin-top: 2px;\n margin-right: -4px;\n}\n\n.sectionLabel_1808205761 {\n white-space: nowrap;\n opacity: 1;\n visibility: visible;\n min-width: 0;\n max-width: 45%;\n transition: max-width 0.18s var(--ds-ease-in-out), margin-right 0.18s var(--ds-ease-in-out), opacity 0.12s var(--ds-ease-in-out), transform 0.18s var(--ds-ease-in-out), visibility 0s linear;\n flex: none;\n line-height: 20px;\n overflow: hidden;\n}\n\n.sectionLabelHidden_1808205761 {\n opacity: 0;\n visibility: hidden;\n max-width: 0;\n margin-right: -4px;\n transition-delay: 0s, 0s, 0s, 0s, 0.18s;\n transform: translate(-4px);\n}\n\n.searchSlot_1808205761 {\n box-sizing: border-box;\n min-width: 0;\n max-width: 28px;\n transition: max-width 0.18s var(--ds-ease-in-out), padding-left 0.18s var(--ds-ease-in-out);\n flex: 1;\n align-items: center;\n margin-left: auto;\n padding-left: 0;\n display: flex;\n}\n\n.searchSlotExpanded_1808205761 {\n max-width: 100%;\n padding-left: 0;\n}\n\n.headerActions_1808205761 {\n opacity: 1;\n visibility: visible;\n max-width: 60px;\n transition: max-width 0.18s var(--ds-ease-in-out), opacity 0.12s var(--ds-ease-in-out), transform 0.18s var(--ds-ease-in-out), visibility 0s linear;\n flex: none;\n align-items: center;\n gap: 4px;\n display: flex;\n overflow: hidden;\n}\n\n.headerActionsHidden_1808205761 {\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n max-width: 0;\n transition-delay: 0s, 0s, 0s, 0.18s;\n transform: translate(4px);\n}\n\n.search_1808205761 {\n box-sizing: border-box;\n cursor: text;\n width: 100%;\n height: 28px;\n color: var(--dsw-alias-label-secondary);\n transition: width 0.18s var(--ds-ease-in-out), padding 0.18s var(--ds-ease-in-out), border-color 0.18s var(--ds-ease-in-out), background-color 0.18s var(--ds-ease-in-out);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n align-items: center;\n gap: 0;\n margin: 0;\n padding: 0;\n display: flex;\n overflow: hidden;\n}\n\n.searchExpanded_1808205761 {\n border: 1px solid var(--dsw-alias-border-l2);\n width: calc(100% + 4px);\n height: 30px;\n color: var(--dsw-alias-label-caption);\n background: 0 0;\n border-radius: 10px;\n margin-inline: -2px;\n padding: 0 4px 0 0;\n}\n\n.searchButton_1808205761 {\n cursor: pointer;\n width: 28px;\n height: 28px;\n color: inherit;\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.searchExpanded_1808205761 .searchButton_1808205761 {\n width: 28px;\n height: 30px;\n}\n\n.searchButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.searchExpanded_1808205761 .searchButton_1808205761:hover {\n background: 0 0;\n}\n\n.searchInput_1808205761 {\n opacity: 0;\n pointer-events: none;\n width: 0;\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n transition: opacity 0.12s var(--ds-ease-in-out);\n background: 0 0;\n border: none;\n outline: none;\n flex: 1;\n font-size: 13px;\n line-height: 18px;\n}\n\n.searchExpanded_1808205761 .searchInput_1808205761 {\n opacity: 1;\n pointer-events: auto;\n margin-left: -2px;\n}\n\n.searchInput_1808205761::placeholder {\n color: var(--dsw-alias-label-tertiary);\n}\n\n.clearButton_1808205761 {\n cursor: pointer;\n width: 24px;\n height: 24px;\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n border: none;\n border-radius: 50%;\n flex: none;\n justify-content: center;\n align-items: center;\n padding: 0;\n display: inline-flex;\n}\n\n.clearButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.rail_1808205761 .sectionHeader_1808205761 {\n justify-content: flex-start;\n gap: 0;\n margin-bottom: 12px;\n padding-left: 0;\n}\n\n.rail_1808205761 .headerActions_1808205761 {\n max-width: none;\n}\n\n.rail_1808205761 .iconButton_1808205761 {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n\n.rail_1808205761 .search_1808205761 {\n background: 0 0;\n border-color: #0000;\n gap: 0;\n width: 36px;\n height: 36px;\n margin: 0 0 12px;\n padding: 0;\n}\n\n.rail_1808205761 .searchButton_1808205761 {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n\n.rail_1808205761 .searchButton_1808205761:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.listArea_1808205761 {\n min-height: 0;\n margin-left: -4px;\n margin-right: calc(-1 * var(--dsh-session-list-edge-inset));\n flex-direction: column;\n flex: 1;\n padding-left: 4px;\n display: flex;\n overflow: visible;\n}\n\n.rail_1808205761 .listArea_1808205761 {\n margin-left: 0;\n margin-right: 0;\n padding-left: 0;\n}\n\n.treeBody_1808205761 {\n flex-direction: column;\n flex: 1;\n min-height: 0;\n display: flex;\n position: relative;\n}\n\n.fade_1808205761 {\n left: 0;\n right: var(--dsh-session-list-edge-inset);\n background: linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));\n pointer-events: none;\n height: 24px;\n position: absolute;\n bottom: 0;\n}\n\n.wide_1808205761 {\n animation: wide-in 0.2s var(--ds-ease-in-out);\n}\n\n@keyframes wide-in {\n 0% { opacity: 0; }\n}\n\n.list_1808205761 {\n min-height: 0;\n margin-left: -4px;\n margin-right: var(--dsh-session-list-scrollbar-offset);\n padding-left: 4px;\n padding-right: calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));\n scrollbar-gutter: stable;\n flex: 1;\n padding-bottom: 16px;\n overflow-y: auto;\n}\n\n.flatList_1808205761 > * + *,\n.searchTree_1808205761 > [role=treeitem] + [role=treeitem],\n.groupSection_1808205761 > * + * {\n margin-top: 2px;\n}\n\n.searchStatus_1808205761,\n.searchWarning_1808205761 {\n color: var(--dsw-alias-label-tertiary);\n padding: 10px 12px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.searchWarning_1808205761 {\n color: var(--dsw-alias-label-secondary);\n}\n\n.groupSection_1808205761 {\n position: relative;\n}\n\n.groupSection_1808205761 + .groupSection_1808205761 {\n margin-top: 4px;\n}\n\n/* P3: workspace drag insertion markers (unused in P2). */\n.listTopDropIndicator_1808205761,\n.workspaceDropBefore_1808205761:before,\n.workspaceDropAfter_1808205761:after {\n content: \"\";\n z-index: 1;\n background:\n linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat,\n linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat,\n linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;\n pointer-events: none;\n height: 12px;\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.listTopDropIndicator_1808205761 {\n top: -8px;\n left: 0;\n right: var(--dsh-session-list-edge-inset);\n}\n\n.listTopDropActive_1808205761 > .workspaceDropBefore_1808205761:first-child:before {\n display: none;\n}\n\n.workspaceDropBefore_1808205761:before {\n top: -8px;\n}\n\n.workspaceDropAfter_1808205761:after {\n bottom: -8px;\n}\n\n.sessionOverflowButton_1808205761 {\n cursor: pointer;\n text-align: left;\n width: 100%;\n height: 28px;\n color: var(--dsw-alias-label-tertiary);\n background: 0 0;\n border: none;\n border-radius: 8px;\n padding: 0 12px 0 28px;\n font-size: 12px;\n}\n\n.groupSection_1808205761 > .sessionOverflowButton_1808205761 {\n margin-top: 0;\n}\n\n.sessionOverflowButton_1808205761:hover {\n color: var(--dsw-alias-label-secondary);\n background: 0 0;\n}\n\n.empty_1808205761 {\n color: var(--dsw-alias-label-tertiary);\n padding: 16px 12px;\n font-size: 13px;\n}\n\n.renameInput_1808205761 {\n box-sizing: border-box;\n border: 1px solid var(--dsw-alias-border-l2);\n width: 100%;\n height: 44px;\n color: var(--dsw-alias-label-primary);\n background: 0 0;\n border-radius: 22px;\n outline: none;\n padding: 7px 14px;\n font-size: 14px;\n font-weight: 400;\n line-height: 22px;\n}\n\n.renameInput_1808205761:disabled {\n color: var(--dsw-alias-label-dimmed);\n}\n\n.renameError_1808205761 {\n color: var(--dsw-alias-state-error-primary);\n margin-top: 8px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.deleteAction_1808205761:not(:disabled) {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.deleteStatus_1808205761 {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n\n/* Pre-delete facts of the worktree-removal dialog: one line per fact, the\n * destructive one (uncommitted files die with the folder) in error tone. */\n.removeFacts_1808205761 {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin-top: 8px;\n}\n\n.removeFact_1808205761 {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary);\n}\n\n.removeFactWarn_1808205761 {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.modalAction_1808205761 {\n min-width: 72px;\n}\n\n.modalError_1808205761,\n.menuStatus_1808205761 {\n margin-top: 8px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.modalError_1808205761 {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.menuStatus_1808205761 {\n color: var(--dsw-alias-label-secondary);\n}\n\n/* Aggregation overlay: indent member workspaces and their sessions. */\n.memberIndent_1808205761 {\n margin-left: 16px;\n}\n\n.sessionsIndent_1808205761 {\n margin-left: 8px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .wide_1808205761 {\n animation: none;\n }\n\n .search_1808205761,\n .sectionLabel_1808205761,\n .searchSlot_1808205761,\n .searchInput_1808205761,\n .headerActions_1808205761 {\n transition: none;\n }\n}\n";
3430
3781
  const tagId = "@laoyuehanni/dsh-git-worktree/GroupedSidebar.module.css";
3431
3782
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId + "\"]") === null) {
3432
3783
  const tag = document.createElement("style");
@@ -3473,6 +3824,9 @@ window.__ModuleLoader__.load({
3473
3824
  "renameError": "renameError_1808205761",
3474
3825
  "deleteAction": "deleteAction_1808205761",
3475
3826
  "deleteStatus": "deleteStatus_1808205761",
3827
+ "removeFacts": "removeFacts_1808205761",
3828
+ "removeFact": "removeFact_1808205761",
3829
+ "removeFactWarn": "removeFactWarn_1808205761",
3476
3830
  "modalAction": "modalAction_1808205761",
3477
3831
  "modalError": "modalError_1808205761",
3478
3832
  "menuStatus": "menuStatus_1808205761",
@@ -3708,7 +4062,7 @@ window.__ModuleLoader__.load({
3708
4062
  const parsed = Date.parse(createdAt);
3709
4063
  return Number.isNaN(parsed) ? void 0 : parsed;
3710
4064
  }
3711
- function GroupedTree({ groups, sessions, archived, currentSessionId, expandMap, onToggle, expandTo, orderBy, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, startSession, t }) {
4065
+ function GroupedTree({ groups, footer, sessions, archived, currentSessionId, expandMap, onToggle, expandTo, orderBy, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, onWorktreeRemove, startSession, t }) {
3712
4066
  const descendants = (0, react.useMemo)(() => indexSubagentRunning(sessions.byId), [sessions.byId]);
3713
4067
  const [expandedSessionGroups, setExpandedSessionGroups] = (0, react.useState)([]);
3714
4068
  const empty = groups.length === 0;
@@ -3718,34 +4072,66 @@ window.__ModuleLoader__.load({
3718
4072
  className: GroupedSidebar_module_default.list,
3719
4073
  role: "tree",
3720
4074
  "aria-label": t("section.workspaces"),
3721
- children: [empty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3722
- className: GroupedSidebar_module_default.empty,
3723
- children: t("empty.none")
3724
- }), groups.map((group) => {
3725
- if (group.kind === "repo") {
3726
- const memberIds = group.members.map((member) => orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy));
3727
- const visibleCount = memberIds.reduce((sum, ids) => sum + ids.length, 0);
3728
- const containsCurrent = group.members.some((member) => member.workspace.sessionIds.includes(currentSessionId ?? "\0"));
3729
- const open = expandMap[group.key] ?? containsCurrent;
3730
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4075
+ children: [
4076
+ empty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4077
+ className: GroupedSidebar_module_default.empty,
4078
+ children: t("empty.none")
4079
+ }),
4080
+ groups.map((group) => {
4081
+ if (group.kind === "repo") {
4082
+ const memberIds = group.members.map((member) => orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy));
4083
+ const visibleCount = memberIds.reduce((sum, ids) => sum + ids.length, 0);
4084
+ const containsCurrent = group.members.some((member) => member.workspace.sessionIds.includes(currentSessionId ?? "\0"));
4085
+ const open = expandMap[group.key] ?? containsCurrent;
4086
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4087
+ className: GroupedSidebar_module_default.groupSection,
4088
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectRowItem, {
4089
+ row: {
4090
+ key: group.key,
4091
+ label: group.repoName ?? group.key,
4092
+ expanded: open,
4093
+ containsCurrent
4094
+ },
4095
+ onToggle: () => {
4096
+ onToggle(group.key);
4097
+ },
4098
+ home,
4099
+ t,
4100
+ badge: String(visibleCount)
4101
+ }), open && group.members.map((member, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberBlock, {
4102
+ member,
4103
+ indent: true,
4104
+ sessionIds: memberIds[index] ?? [],
4105
+ sessions,
4106
+ currentSessionId,
4107
+ expandMap,
4108
+ onToggle,
4109
+ expandTo,
4110
+ descendants,
4111
+ expandedSessionGroups,
4112
+ setExpandedSessionGroups,
4113
+ now,
4114
+ home,
4115
+ onOpen,
4116
+ onRename,
4117
+ onFork,
4118
+ onArchive,
4119
+ onWorkspaceRename,
4120
+ onWorkspaceDelete,
4121
+ onWorktreeRemove,
4122
+ startSession,
4123
+ t
4124
+ }, member.workspace.workspaceId))]
4125
+ }, group.key);
4126
+ }
4127
+ const member = group.members[0];
4128
+ if (member === void 0) return null;
4129
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3731
4130
  className: GroupedSidebar_module_default.groupSection,
3732
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectRowItem, {
3733
- row: {
3734
- key: group.key,
3735
- label: group.repoName ?? group.key,
3736
- expanded: open,
3737
- containsCurrent
3738
- },
3739
- onToggle: () => {
3740
- onToggle(group.key);
3741
- },
3742
- home,
3743
- t,
3744
- badge: String(visibleCount)
3745
- }), open && group.members.map((member, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberBlock, {
4131
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberBlock, {
3746
4132
  member,
3747
- indent: true,
3748
- sessionIds: memberIds[index] ?? [],
4133
+ indent: false,
4134
+ sessionIds: orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy),
3749
4135
  sessions,
3750
4136
  currentSessionId,
3751
4137
  expandMap,
@@ -3762,44 +4148,18 @@ window.__ModuleLoader__.load({
3762
4148
  onArchive,
3763
4149
  onWorkspaceRename,
3764
4150
  onWorkspaceDelete,
4151
+ onWorktreeRemove,
3765
4152
  startSession,
3766
4153
  t
3767
- }, member.workspace.workspaceId))]
4154
+ })
3768
4155
  }, group.key);
3769
- }
3770
- const member = group.members[0];
3771
- if (member === void 0) return null;
3772
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3773
- className: GroupedSidebar_module_default.groupSection,
3774
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberBlock, {
3775
- member,
3776
- indent: false,
3777
- sessionIds: orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy),
3778
- sessions,
3779
- currentSessionId,
3780
- expandMap,
3781
- onToggle,
3782
- expandTo,
3783
- descendants,
3784
- expandedSessionGroups,
3785
- setExpandedSessionGroups,
3786
- now,
3787
- home,
3788
- onOpen,
3789
- onRename,
3790
- onFork,
3791
- onArchive,
3792
- onWorkspaceRename,
3793
- onWorkspaceDelete,
3794
- startSession,
3795
- t
3796
- })
3797
- }, group.key);
3798
- })]
4156
+ }),
4157
+ footer
4158
+ ]
3799
4159
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: GroupedSidebar_module_default.fade })]
3800
4160
  });
3801
4161
  }
3802
- function MemberBlock({ member, indent, sessionIds, sessions, currentSessionId, expandMap, onToggle, expandTo, descendants, expandedSessionGroups, setExpandedSessionGroups, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, startSession, t }) {
4162
+ function MemberBlock({ member, indent, sessionIds, sessions, currentSessionId, expandMap, onToggle, expandTo, descendants, expandedSessionGroups, setExpandedSessionGroups, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, onWorktreeRemove, startSession, t }) {
3803
4163
  const key = `ws:${member.workspace.workspaceId}`;
3804
4164
  const containsCurrent = member.workspace.sessionIds.includes(currentSessionId ?? "\0");
3805
4165
  const open = expandMap[key] ?? containsCurrent;
@@ -3812,6 +4172,9 @@ window.__ModuleLoader__.load({
3812
4172
  if (summary !== void 0) nodes.push(sessionNode(summary, descendants));
3813
4173
  }
3814
4174
  const created = createdAtMs(member.workspace.createdAt);
4175
+ const hasRunning = member.workspace.sessionIds.some((id) => sessions.byId[id]?.running === true);
4176
+ const occupied = containsCurrent || hasRunning;
4177
+ const canRemoveWorktree = member.label.type === "linked" && !occupied;
3815
4178
  const body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectRowItem, {
3816
4179
  row: {
3817
4180
  key,
@@ -3834,7 +4197,10 @@ window.__ModuleLoader__.load({
3834
4197
  },
3835
4198
  delete: () => {
3836
4199
  onWorkspaceDelete(member.workspace.workspaceId, member.workspace.title);
3837
- }
4200
+ },
4201
+ ...canRemoveWorktree ? { removeWorktree: () => {
4202
+ onWorktreeRemove(member);
4203
+ } } : {}
3838
4204
  },
3839
4205
  home,
3840
4206
  t
@@ -3873,39 +4239,62 @@ window.__ModuleLoader__.load({
3873
4239
  const items = workspaces.items;
3874
4240
  const home = host?.home;
3875
4241
  const signature = (0, react.useMemo)(() => [...items].map((item) => item.path).sort().join("\n"), [items]);
4242
+ const cachedBatch = (0, react.useMemo)(() => loadFactsCache(), [signature]);
3876
4243
  const [factsState, setFactsState] = (0, react.useState)(null);
4244
+ const factsEntry = factsForSignature(signature, factsState, cachedBatch);
4245
+ const facts = factsEntry?.facts;
4246
+ const hasFactsForSignature = factsEntry !== null;
3877
4247
  const readyOnce = (0, react.useRef)(false);
3878
4248
  const signalReady = () => {
3879
4249
  if (readyOnce.current) return;
3880
4250
  readyOnce.current = true;
3881
4251
  props.onReady?.();
3882
4252
  };
4253
+ /** Signatures this mount already sent a probe for (once per signature). */
4254
+ const probedSignature = (0, react.useRef)(void 0);
3883
4255
  (0, react.useEffect)(() => {
3884
- if (factsState?.signature === signature) {
4256
+ if (probedSignature.current === signature) {
3885
4257
  signalReady();
3886
4258
  return;
3887
4259
  }
4260
+ if (items.length === 0) {
4261
+ if (workspaces.phase === "ready") {
4262
+ probedSignature.current = signature;
4263
+ signalReady();
4264
+ }
4265
+ return;
4266
+ }
4267
+ if (hasFactsForSignature) signalReady();
3888
4268
  let live = true;
3889
4269
  props.loadFacts(items.map((item) => item.path)).then((facts) => {
3890
4270
  if (!live) return;
3891
- if (facts !== void 0) setFactsState({
3892
- signature,
3893
- facts
3894
- });
4271
+ probedSignature.current = signature;
4272
+ if (facts !== void 0) {
4273
+ setFactsState({
4274
+ signature,
4275
+ facts
4276
+ });
4277
+ saveFactsCache({
4278
+ signature,
4279
+ facts
4280
+ });
4281
+ }
3895
4282
  signalReady();
3896
4283
  }, () => {
3897
- if (live) signalReady();
4284
+ if (!live) return;
4285
+ probedSignature.current = signature;
4286
+ signalReady();
3898
4287
  });
3899
4288
  return () => {
3900
4289
  live = false;
3901
4290
  };
3902
4291
  }, [
3903
4292
  signature,
3904
- factsState?.signature,
4293
+ items,
3905
4294
  props.loadFacts,
3906
- items
4295
+ workspaces.phase,
4296
+ hasFactsForSignature
3907
4297
  ]);
3908
- const facts = factsState?.signature === signature ? factsState.facts : void 0;
3909
4298
  const groups = (0, react.useMemo)(() => deriveSidebarGroups(items, facts), [items, facts]);
3910
4299
  const sessionList = sessions;
3911
4300
  const archived = workspaces.archivedSessionIds;
@@ -4123,7 +4512,197 @@ window.__ModuleLoader__.load({
4123
4512
  setDeleteError(reason instanceof Error ? reason.message : String(reason));
4124
4513
  });
4125
4514
  };
4515
+ const [wtRemoveTarget, setWtRemoveTarget] = (0, react.useState)(null);
4516
+ const [wtInspect, setWtInspect] = (0, react.useState)({ status: "loading" });
4517
+ const [wtRemoving, setWtRemoving] = (0, react.useState)(false);
4518
+ const [wtRemoveError, setWtRemoveError] = (0, react.useState)(null);
4519
+ (0, react.useEffect)(() => {
4520
+ if (wtRemoveTarget === null) return;
4521
+ setWtInspect({ status: "loading" });
4522
+ let live = true;
4523
+ props.inspectWorktree(wtRemoveTarget.workspace.path).then((facts) => {
4524
+ if (live) setWtInspect({
4525
+ status: "ready",
4526
+ dirty: facts.dirty,
4527
+ ahead: facts.ahead
4528
+ });
4529
+ }, (reason) => {
4530
+ if (live) setWtInspect({
4531
+ status: "error",
4532
+ error: reason instanceof Error ? reason.message : String(reason)
4533
+ });
4534
+ });
4535
+ return () => {
4536
+ live = false;
4537
+ };
4538
+ }, [wtRemoveTarget]);
4539
+ const archivedSet = (0, react.useMemo)(() => new Set(archived), [archived]);
4540
+ const wtArchiveIds = wtRemoveTarget === null ? [] : wtRemoveTarget.workspace.sessionIds.filter((id) => {
4541
+ const summary = sessionList.byId[id];
4542
+ return summary !== void 0 && !archivedSet.has(id) && !summary.blank && summary.origin !== "subagent";
4543
+ });
4544
+ const closeWtRemove = () => {
4545
+ if (wtRemoving) return;
4546
+ setWtRemoveTarget(null);
4547
+ setWtRemoveError(null);
4548
+ };
4549
+ const confirmWtRemove = () => {
4550
+ if (wtRemoving || wtRemoveTarget === null || wtInspect.status !== "ready") return;
4551
+ const target = wtRemoveTarget;
4552
+ setWtRemoving(true);
4553
+ setWtRemoveError(null);
4554
+ (async () => {
4555
+ try {
4556
+ await props.removeWorktree(target.workspace.path, wtInspect.dirty > 0);
4557
+ for (const sessionId of wtArchiveIds) await props.archiveSession(sessionId).catch((reason) => {
4558
+ console.warn("session archive rejected during worktree removal:", reason);
4559
+ });
4560
+ await props.deleteWorkspace(target.workspace.workspaceId);
4561
+ setWtRemoving(false);
4562
+ setWtRemoveTarget(null);
4563
+ } catch (reason) {
4564
+ setWtRemoving(false);
4565
+ setWtRemoveError(reason instanceof Error ? reason.message : String(reason));
4566
+ }
4567
+ })();
4568
+ };
4126
4569
  const now = Date.now();
4570
+ const strayGroups = (0, react.useMemo)(() => deriveStrayGroups(items, sessionList, archived), [
4571
+ items,
4572
+ sessionList,
4573
+ archived
4574
+ ]);
4575
+ const strayDescendants = (0, react.useMemo)(() => indexSubagentRunning(sessionList.byId), [sessionList.byId]);
4576
+ const strayProbePaths = (0, react.useMemo)(() => [...new Set(strayGroups.filter((group) => group.belongsTo === void 0 && group.path !== "").map((group) => group.path))], [strayGroups]);
4577
+ const strayProbeSignature = strayProbePaths.join("\n");
4578
+ const [strayDirExists, setStrayDirExists] = (0, react.useState)(void 0);
4579
+ const [straySlotRebuildable, setStraySlotRebuildable] = (0, react.useState)(void 0);
4580
+ (0, react.useEffect)(() => {
4581
+ if (strayProbePaths.length === 0) return;
4582
+ let live = true;
4583
+ props.probeDirectories(strayProbePaths).then((result) => {
4584
+ if (!live) return;
4585
+ setStrayDirExists(result?.exists);
4586
+ setStraySlotRebuildable(result?.rebuildable);
4587
+ }, () => {
4588
+ if (live) {
4589
+ setStrayDirExists(void 0);
4590
+ setStraySlotRebuildable(void 0);
4591
+ }
4592
+ });
4593
+ return () => {
4594
+ live = false;
4595
+ };
4596
+ }, [strayProbeSignature]);
4597
+ const straySectionKey = "stray:section";
4598
+ const strayContainsCurrent = strayGroups.some((group) => group.sessions.some((session) => session.id === sessions.current));
4599
+ const straySectionOpen = expandMap[straySectionKey] ?? strayContainsCurrent;
4600
+ const strayTotal = strayGroups.reduce((sum, group) => sum + group.sessions.length, 0);
4601
+ const [strayRegPath, setStrayRegPath] = (0, react.useState)(null);
4602
+ const [toast, setToast] = (0, react.useState)(null);
4603
+ const registerStrayWorkspace = (path) => {
4604
+ if (strayRegPath !== null) return;
4605
+ setStrayRegPath(path);
4606
+ props.createWorkspace({ path }).then(() => {
4607
+ setStrayRegPath(null);
4608
+ }, (reason) => {
4609
+ setStrayRegPath(null);
4610
+ setToast({
4611
+ seq: Date.now(),
4612
+ text: t("stray.registerFailed", { message: reason instanceof Error ? reason.message : String(reason) })
4613
+ });
4614
+ });
4615
+ };
4616
+ const [strayRebuildPath, setStrayRebuildPath] = (0, react.useState)(null);
4617
+ const rebuildStrayDirectory = (path) => {
4618
+ if (strayRebuildPath !== null) return;
4619
+ setStrayRebuildPath(path);
4620
+ props.ensureDirectory(path).then(() => {
4621
+ setStrayRebuildPath(null);
4622
+ setToast({
4623
+ seq: Date.now(),
4624
+ text: t("stray.rebuildDone")
4625
+ });
4626
+ props.probeDirectories([path]).then((result) => {
4627
+ if (result === void 0) return;
4628
+ setStrayDirExists((current) => ({
4629
+ ...current,
4630
+ ...result.exists
4631
+ }));
4632
+ setStraySlotRebuildable((current) => ({
4633
+ ...current,
4634
+ ...result.rebuildable
4635
+ }));
4636
+ });
4637
+ }, (reason) => {
4638
+ setStrayRebuildPath(null);
4639
+ setToast({
4640
+ seq: Date.now(),
4641
+ text: t("stray.rebuildFailed", { message: reason instanceof Error ? reason.message : String(reason) })
4642
+ });
4643
+ });
4644
+ };
4645
+ const straySection = strayGroups.length === 0 ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4646
+ className: GroupedSidebar_module_default.groupSection,
4647
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectRowItem, {
4648
+ row: {
4649
+ key: straySectionKey,
4650
+ label: t("group.ungrouped"),
4651
+ expanded: straySectionOpen,
4652
+ containsCurrent: strayContainsCurrent
4653
+ },
4654
+ onToggle: () => {
4655
+ toggle(straySectionKey);
4656
+ },
4657
+ home,
4658
+ t,
4659
+ badge: String(strayTotal)
4660
+ }), straySectionOpen && strayGroups.map((group) => {
4661
+ const groupOpen = expandMap[group.key] ?? group.sessions.some((session) => session.id === sessions.current);
4662
+ const registrable = group.belongsTo === void 0 && group.path !== "" && strayDirExists?.[group.path] === true;
4663
+ const missingDir = group.belongsTo === void 0 && group.path !== "" && strayDirExists?.[group.path] === false;
4664
+ const rebuildable = missingDir && straySlotRebuildable?.[group.path] === true;
4665
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4666
+ className: cx(GroupedSidebar_module_default.groupSection, GroupedSidebar_module_default.memberIndent),
4667
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StrayGroupRow, {
4668
+ path: group.path,
4669
+ belongsTo: group.belongsTo,
4670
+ count: group.sessions.length,
4671
+ expanded: groupOpen,
4672
+ onToggle: () => {
4673
+ toggle(group.key);
4674
+ },
4675
+ missingDir,
4676
+ worktreeSlot: rebuildable,
4677
+ ...registrable ? {
4678
+ onRegister: () => {
4679
+ registerStrayWorkspace(group.path);
4680
+ },
4681
+ registering: strayRegPath === group.path
4682
+ } : rebuildable ? {
4683
+ onRebuild: () => {
4684
+ rebuildStrayDirectory(group.path);
4685
+ },
4686
+ rebuilding: strayRebuildPath === group.path
4687
+ } : {},
4688
+ home,
4689
+ t
4690
+ }), groupOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4691
+ className: GroupedSidebar_module_default.sessionsIndent,
4692
+ children: group.sessions.map((session) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionNodeItem, {
4693
+ node: sessionNode(session, strayDescendants),
4694
+ currentId: sessions.current,
4695
+ now,
4696
+ onOpen: props.openSession,
4697
+ onRename: onSessionRename,
4698
+ onFork: props.forkSession,
4699
+ onArchive: onSessionArchive,
4700
+ t
4701
+ }, session.id))
4702
+ })]
4703
+ }, group.key);
4704
+ })]
4705
+ });
4127
4706
  const wide = props.wide;
4128
4707
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4129
4708
  className: cx(GroupedSidebar_module_default.root, !wide && GroupedSidebar_module_default.rail),
@@ -4277,6 +4856,7 @@ window.__ModuleLoader__.load({
4277
4856
  t
4278
4857
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupedTree, {
4279
4858
  groups,
4859
+ footer: straySection,
4280
4860
  sessions: sessionList,
4281
4861
  archived,
4282
4862
  currentSessionId: sessions.current,
@@ -4305,6 +4885,10 @@ window.__ModuleLoader__.load({
4305
4885
  });
4306
4886
  setDeleteError(null);
4307
4887
  },
4888
+ onWorktreeRemove: (member) => {
4889
+ setWtRemoveTarget(member);
4890
+ setWtRemoveError(null);
4891
+ },
4308
4892
  startSession: props.startSession,
4309
4893
  t
4310
4894
  }))
@@ -4438,7 +5022,75 @@ window.__ModuleLoader__.load({
4438
5022
  role: "alert",
4439
5023
  children: deleteError
4440
5024
  })]
4441
- })
5025
+ }),
5026
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
5027
+ open: wtRemoveTarget !== null,
5028
+ onClose: closeWtRemove,
5029
+ closeLabel: t("close"),
5030
+ title: t("worktreeRemove.title"),
5031
+ ...wtRemoveTarget === null ? {} : { description: t("worktreeRemove.desc", { path: wtRemoveTarget.workspace.path }) },
5032
+ footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5033
+ variant: "outline",
5034
+ disabled: wtRemoving,
5035
+ onClick: closeWtRemove,
5036
+ children: t("cancel")
5037
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5038
+ variant: "outline",
5039
+ className: GroupedSidebar_module_default.deleteAction,
5040
+ disabled: wtRemoving || wtInspect.status !== "ready",
5041
+ onClick: confirmWtRemove,
5042
+ children: t("worktreeRemove.menu")
5043
+ })] }),
5044
+ children: [
5045
+ wtRemoveTarget?.label.type === "linked" && wtRemoveTarget.label.branch !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5046
+ className: GroupedSidebar_module_default.removeFact,
5047
+ children: t("worktreeRemove.descBranch", { branch: wtRemoveTarget.label.branch })
5048
+ }),
5049
+ wtInspect.status === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5050
+ className: GroupedSidebar_module_default.deleteStatus,
5051
+ role: "status",
5052
+ children: t("worktreeRemove.inspecting")
5053
+ }),
5054
+ wtInspect.status === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5055
+ className: GroupedSidebar_module_default.renameError,
5056
+ role: "alert",
5057
+ children: wtInspect.error
5058
+ }),
5059
+ wtInspect.status === "ready" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5060
+ className: GroupedSidebar_module_default.removeFacts,
5061
+ children: [
5062
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5063
+ className: cx(GroupedSidebar_module_default.removeFact, wtInspect.dirty > 0 && GroupedSidebar_module_default.removeFactWarn),
5064
+ children: wtInspect.dirty > 0 ? t(wtInspect.dirty === 1 ? "worktreeRemove.dirty.one" : "worktreeRemove.dirty.other", { n: wtInspect.dirty }) : t("worktreeRemove.clean")
5065
+ }),
5066
+ wtInspect.ahead !== void 0 && wtInspect.ahead > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5067
+ className: GroupedSidebar_module_default.removeFact,
5068
+ children: t("worktreeRemove.ahead", { n: wtInspect.ahead })
5069
+ }),
5070
+ wtArchiveIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5071
+ className: GroupedSidebar_module_default.removeFact,
5072
+ children: t(wtArchiveIds.length === 1 ? "worktreeRemove.sessions.one" : "worktreeRemove.sessions.other", { n: wtArchiveIds.length })
5073
+ })
5074
+ ]
5075
+ }),
5076
+ wtRemoving && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5077
+ className: GroupedSidebar_module_default.deleteStatus,
5078
+ role: "status",
5079
+ children: t("worktreeRemove.busy")
5080
+ }),
5081
+ wtRemoveError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5082
+ className: GroupedSidebar_module_default.renameError,
5083
+ role: "alert",
5084
+ children: wtRemoveError
5085
+ })
5086
+ ]
5087
+ }),
5088
+ toast !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
5089
+ text: toast.text,
5090
+ onDone: () => {
5091
+ setToast(null);
5092
+ }
5093
+ }, toast.seq)
4442
5094
  ]
4443
5095
  });
4444
5096
  }
@@ -4547,6 +5199,29 @@ window.__ModuleLoader__.load({
4547
5199
  "delete.workspace": "Delete workspace",
4548
5200
  "delete.desc": "This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.",
4549
5201
  "delete.pending": "Deleting workspace…",
5202
+ "worktreeRemove.menu": "Remove worktree",
5203
+ "worktreeRemove.title": "Remove worktree",
5204
+ "worktreeRemove.desc": "This removes the worktree from git and deletes the folder “{path}”.",
5205
+ "worktreeRemove.descBranch": "The branch {branch} is kept.",
5206
+ "worktreeRemove.inspecting": "Inspecting worktree…",
5207
+ "worktreeRemove.dirty.one": "{n} uncommitted file will be deleted with the folder.",
5208
+ "worktreeRemove.dirty.other": "{n} uncommitted files will be deleted with the folder.",
5209
+ "worktreeRemove.clean": "No uncommitted changes.",
5210
+ "worktreeRemove.ahead": "{n} commits ahead of upstream, kept on the branch.",
5211
+ "worktreeRemove.sessions.one": "{n} session in this workspace will be archived too.",
5212
+ "worktreeRemove.sessions.other": "{n} sessions in this workspace will be archived too.",
5213
+ "worktreeRemove.busy": "Removing…",
5214
+ "stray.unknown": "(unknown directory)",
5215
+ "stray.belongsTo": "Stray sessions of “{name}”",
5216
+ "stray.missingDir": "Directory no longer exists — registering is unavailable",
5217
+ "stray.worktreeSlot": "A worktree storage slot: rebuild this directory (e.g. git worktree add) and its historical sessions reattach automatically",
5218
+ "stray.rebuild": "Rebuild empty directory",
5219
+ "stray.rebuild.aria": "Rebuild the directory “{name}”",
5220
+ "stray.rebuildDone": "Directory rebuilt; its historical sessions will reattach automatically",
5221
+ "stray.rebuildFailed": "Rebuild failed: {message}",
5222
+ "stray.register": "Register as workspace",
5223
+ "stray.register.aria": "Register “{name}” as a workspace",
5224
+ "stray.registerFailed": "Registration failed: {message}",
4550
5225
  "menu.fork": "Fork session",
4551
5226
  "menu.archiveSession": "Archive session",
4552
5227
  "sessions.count.one": "{n} session",
@@ -4679,6 +5354,29 @@ window.__ModuleLoader__.load({
4679
5354
  "delete.workspace": "删除工作区",
4680
5355
  "delete.desc": "将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。",
4681
5356
  "delete.pending": "正在删除工作区…",
5357
+ "worktreeRemove.menu": "删除工作树",
5358
+ "worktreeRemove.title": "删除工作树",
5359
+ "worktreeRemove.desc": "将从 git 移除该工作树并删除目录“{path}”。",
5360
+ "worktreeRemove.descBranch": "分支 {branch} 将保留。",
5361
+ "worktreeRemove.inspecting": "正在检查工作树…",
5362
+ "worktreeRemove.dirty.one": "{n} 个未提交文件将随目录一并删除。",
5363
+ "worktreeRemove.dirty.other": "{n} 个未提交文件将随目录一并删除。",
5364
+ "worktreeRemove.clean": "无未提交改动。",
5365
+ "worktreeRemove.ahead": "分支领先上游 {n} 个提交,提交将保留在分支上。",
5366
+ "worktreeRemove.sessions.one": "该工作区下的 {n} 个会话将一并归档。",
5367
+ "worktreeRemove.sessions.other": "该工作区下的 {n} 个会话将一并归档。",
5368
+ "worktreeRemove.busy": "删除中…",
5369
+ "stray.unknown": "(目录未知)",
5370
+ "stray.belongsTo": "属于“{name}”的失联会话",
5371
+ "stray.missingDir": "目录已不存在,无法注册",
5372
+ "stray.worktreeSlot": "工作树存放位:重建此目录(如 git worktree add)后,其历史会话将自动归位",
5373
+ "stray.rebuild": "重建空目录",
5374
+ "stray.rebuild.aria": "重建目录“{name}”",
5375
+ "stray.rebuildDone": "目录已重建,其历史会话将自动归位",
5376
+ "stray.rebuildFailed": "重建失败:{message}",
5377
+ "stray.register": "注册为工作区",
5378
+ "stray.register.aria": "将“{name}”注册为工作区",
5379
+ "stray.registerFailed": "注册失败:{message}",
4682
5380
  "menu.fork": "分叉会话",
4683
5381
  "menu.archiveSession": "归档会话",
4684
5382
  "sessions.count.one": "{n} 个会话",
@@ -4797,26 +5495,13 @@ window.__ModuleLoader__.load({
4797
5495
  }
4798
5496
  });
4799
5497
  };
4800
- const syncGroupingSeat = () => {
4801
- const snapshot = groupingScope.getSnapshot();
4802
- if (snapshot.status !== "ready") return seatReady;
4803
- const enabled = snapshot.value?.groupSidebar ?? true;
4804
- if (enabled === groupingEnabled) return seatReady;
4805
- groupingEnabled = enabled;
4806
- if (groupingDisposer !== void 0) {
4807
- groupingDisposer();
4808
- groupingDisposer = void 0;
4809
- }
5498
+ /** Inject the `sidebar.workspaces` occupant (priority -1 shadows the native
5499
+ * browser at priority 0) and arm its readiness epoch. */
5500
+ const registerGroupingSeat = () => {
4810
5501
  const epoch = ++seatEpoch;
4811
5502
  seatReady = new Promise((resolve) => {
4812
5503
  seatReadyResolve = resolve;
4813
5504
  });
4814
- if (!enabled) {
4815
- afterPaint().then(() => {
4816
- if (epoch === seatEpoch) finishSeat();
4817
- });
4818
- return seatReady;
4819
- }
4820
5505
  const injectFace = () => ({
4821
5506
  workspacesList: ctx.workspaces.list,
4822
5507
  sessionsList: ctx.sessions.list,
@@ -4859,6 +5544,29 @@ window.__ModuleLoader__.load({
4859
5544
  archiveSession: async (sessionId) => {
4860
5545
  await ctx.workspaces.archiveSession(sessionId);
4861
5546
  },
5547
+ inspectWorktree: async (path) => {
5548
+ const result = await requestInspectWorktree(path);
5549
+ if (!result.ok) throw new Error(result.error);
5550
+ return {
5551
+ dirty: result.dirty,
5552
+ ahead: result.ahead
5553
+ };
5554
+ },
5555
+ removeWorktree: async (path, force) => {
5556
+ const result = await requestRemoveWorktree(path, force);
5557
+ if (!result.ok) throw new Error(result.error);
5558
+ },
5559
+ probeDirectories: async (paths) => {
5560
+ const result = await requestPathExists(paths);
5561
+ return result.ok ? {
5562
+ exists: result.exists,
5563
+ ...result.rebuildable === void 0 ? {} : { rebuildable: result.rebuildable }
5564
+ } : void 0;
5565
+ },
5566
+ ensureDirectory: async (path) => {
5567
+ const result = await requestEnsureDirectory(path);
5568
+ if (!result.ok) throw new Error(result.error);
5569
+ },
4862
5570
  createWorkspace: (input) => ctx.workspaces.create(input),
4863
5571
  pickDirectory: () => ctx.workspaces.pickDirectory(),
4864
5572
  hostDescription: ctx.get("connection").hostDescription,
@@ -4879,6 +5587,38 @@ window.__ModuleLoader__.load({
4879
5587
  seatTimer = window.setTimeout(() => {
4880
5588
  if (epoch === seatEpoch) finishSeat();
4881
5589
  }, SEAT_READY_TIMEOUT_MS);
5590
+ };
5591
+ const syncGroupingSeat = () => {
5592
+ const snapshot = groupingScope.getSnapshot();
5593
+ if (snapshot.status !== "ready") {
5594
+ if (groupingEnabled === void 0) {
5595
+ groupingEnabled = loadGroupSidebarBoot() ?? true;
5596
+ if (groupingEnabled) registerGroupingSeat();
5597
+ }
5598
+ return seatReady;
5599
+ }
5600
+ const enabled = snapshot.value?.groupSidebar ?? true;
5601
+ if (enabled === groupingEnabled) {
5602
+ saveGroupSidebarBoot(enabled);
5603
+ return seatReady;
5604
+ }
5605
+ groupingEnabled = enabled;
5606
+ saveGroupSidebarBoot(enabled);
5607
+ if (groupingDisposer !== void 0) {
5608
+ groupingDisposer();
5609
+ groupingDisposer = void 0;
5610
+ }
5611
+ const epoch = ++seatEpoch;
5612
+ seatReady = new Promise((resolve) => {
5613
+ seatReadyResolve = resolve;
5614
+ });
5615
+ if (!enabled) {
5616
+ afterPaint().then(() => {
5617
+ if (epoch === seatEpoch) finishSeat();
5618
+ });
5619
+ return seatReady;
5620
+ }
5621
+ registerGroupingSeat();
4882
5622
  return seatReady;
4883
5623
  };
4884
5624
  const waitForGroupingSeat = async (enabled) => {