@laoyuehanni/dsh-git-worktree 0.4.1 → 0.4.2

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.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["error","useRef","useCallback","useState","useMemo","css","IconChevronDownOutline14","IconChevronRightOutline14","IconCheckOutline16","createPortal","IconPlusOutline16","IconGoalOutline16","IconChevronUpOutline14","useState","useCallback","useRef","createPortal","css","useMemo","IconBranchOutline16","Toast","useState","css","IconChevronDownOutline14","IconLoadingOutline16","cx","css","useState","IconEditOutline16","IconTrashOutline16","IconFolderOpen16","IconFolderClose16","IconTriangleRightFill14","Menu","IconEllipsisOutline16","IconPlusOutline16","HoverCard","abbreviateHomePath","StateDot","IconBranchOutline16","IconArchiveOutline20","useState","Menu","Tooltip","css","IconPersonalizationOutline16","useRef","Modal","Button","useMemo","useSyncExternalStore","IconSearchOutline16","IconCloseFill14","IconProjectAddOutline16"],"sources":["../src/normalize.ts","../src/wire.ts","../src/client/api.ts","../src/client/BranchMenu.tsx","../src/client/BranchChip.tsx","../src/client/card-form.ts","../src/client/GitWorktreeCard.tsx","../src/client/sidebar-groups.ts","../src/client/sidebar-search.ts","../src/client/sidebar-rows.tsx","../src/client/pick-flow.ts","../src/client/GroupedSidebar.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Pure branch/path name normalization for worktree directory placement.\n * Windows-forbidden characters are the governing constraint: a worktree\n * folder name must survive on every platform the host runs on.\n */\n\n/**\n * Turn a branch display name into a single safe directory segment.\n * `feat/auth-login` → `feat-auth-login`; every Windows-forbidden character\n * (`<>:\"|?*`, control chars) and `/` become `-`; runs of separators (`-`,\n * `.`, whitespace — so a `//` or a git-illegal `..` collapses too) merge to\n * one `-`; a single interior `.` survives (`v1.2.3` stays readable); trailing\n * dots and spaces (Windows-forbidden suffixes) are stripped; the result is\n * clamped to 64 characters and never empty or dash-only.\n * @param branch - branch display name (local or `remote/name` form).\n * @returns a safe single path segment.\n */\nexport function sanitizeBranchDir(branch: string): string {\n const replaced = branch.replace(/[<>:\"/\\\\|?*\\u0000-\\u001f\\s]/g, '-')\n const merged = replaced.replace(/[-.]{2,}/g, '-')\n const trimmed = merged.replace(/[.\\s-]+$/, '')\n const clamped = trimmed.slice(0, 64).replace(/[.\\s-]+$/, '')\n return clamped === '' || clamped.replaceAll('-', '') === '' ? 'branch' : clamped\n}\n\n/**\n * Local branch name for a display name: strip the leading `<remote>/` segment\n * when one is present (`origin/feat/x` → `feat/x`). A local branch whose own\n * name contains `/` (like `feat/x`) passes through unchanged — callers that\n * need certainty compare against the authoritative branch list instead.\n * @param branch - branch display name.\n * @returns the candidate local branch name.\n */\nexport function localBranchName(branch: string): string {\n const at = branch.indexOf('/')\n return at <= 0 ? branch : branch.slice(at + 1)\n}\n\n/**\n * Split a `<remote>/<name>` display name when it plausibly names a remote\n * branch: the first `/`-separated segment is treated as the remote.\n * @param branch - branch display name.\n * @returns the remote part and the local-twin name, or undefined when the\n * name has no `/` (a local branch or a bare word).\n */\nexport function splitRemoteBranch(branch: string): { remote: string; name: string } | undefined {\n const at = branch.indexOf('/')\n if (at <= 0) return undefined\n return { remote: branch.slice(0, at), name: branch.slice(at + 1) }\n}\n\n/**\n * Validate a user-configured worktree storage root: an absolute path on any\n * platform (POSIX `/…`, Windows drive `C:\\…`/`C:/…`, or UNC `\\\\…`).\n * @param value - raw settings string.\n * @returns true when the value names an absolute path.\n */\nexport function isAbsoluteConfigPath(value: string): boolean {\n if (value === '') return false\n if (value.startsWith('/') || value.startsWith('\\\\')) return true\n return /^[a-zA-Z]:[\\\\/]/.test(value)\n}\n\n/** Why a user-typed NEW branch name is not acceptable yet (null = fine). */\nexport type BranchNameIssue = 'empty' | 'leadingDash' | 'illegal'\n\n/**\n * Pre-flight check of a user-typed NEW branch name against git's ref-name\n * rules (git check-ref-format's reject list, the subset typing can hit):\n * non-empty; no leading `-` (git would parse it as a flag); no space, `~^:?*[\\`\n * or control character; no `..`, `@{`, `//`, leading/trailing `/`; no component\n * starting with `.` or ending with `.lock`; no trailing `.`; not the lone `@`.\n * `git switch -c` stays the authority — a miss here surfaces through the\n * error envelope — this only feeds immediate form feedback.\n * @param name - raw draft text (NOT trimmed: a space is a real issue).\n * @returns the issue kind, or null when the name is acceptable.\n */\nexport function branchNameIssue(name: string): BranchNameIssue | null {\n if (name.trim() === '') return 'empty'\n if (name.startsWith('-')) return 'leadingDash'\n if (name === '@') return 'illegal'\n if (/[\\s~^:?*[\\\\\\u0000-\\u001f]/.test(name)) return 'illegal'\n if (name.includes('..') || name.includes('@{') || name.includes('//')) return 'illegal'\n if (name.startsWith('/') || name.endsWith('/')) return 'illegal'\n if (name.endsWith('.')) return 'illegal'\n if (/(^|\\/)\\./.test(name)) return 'illegal'\n if (/(^|\\/)[^/]+\\.lock($|\\/)/.test(name)) return 'illegal'\n return null\n}\n","/**\n * Shared wire contract between the host half (HTTP routes under\n * `/plugin/git-worktree`) and the browser half (chip + plugin settings card).\n * Zero runtime dependencies: constants and types only, imported by both\n * builds.\n */\n\n/** Absolute pathname prefix every route of this plugin lives under. */\nexport const ROUTE_PREFIX = '/plugin/git-worktree'\n\n/** GET ROUTE_PREFIX/status?path=<absolute dir> */\nexport const ROUTE_STATUS = `${ROUTE_PREFIX}/status`\n\n/** POST ROUTE_PREFIX/worktree — create-or-reuse a worktree for a branch. */\nexport const ROUTE_WORKTREE = `${ROUTE_PREFIX}/worktree`\n\n/** POST ROUTE_PREFIX/switch — in-place branch switch of the main checkout. */\nexport const ROUTE_SWITCH = `${ROUTE_PREFIX}/switch`\n\n/** POST ROUTE_PREFIX/branch — create a NEW branch from the current checkout and switch to it. */\nexport const ROUTE_BRANCH = `${ROUTE_PREFIX}/branch`\n\n/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune). */\nexport const ROUTE_FETCH = `${ROUTE_PREFIX}/fetch`\n\n/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream. */\nexport const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`\n\n/** POST ROUTE_PREFIX/group — git belonging facts for a batch of workspace paths. */\nexport const ROUTE_GROUP = `${ROUTE_PREFIX}/group`\n\n/** One selectable branch row. */\nexport interface BranchEntry {\n /** Display name: a bare local name (`main`) or `<remote>/<name>`. */\n name: string\n kind: 'local' | 'remote'\n /** Commits the local branch is AHEAD of its upstream (local rows with an\n * upstream only; absent = no upstream or in sync). */\n ahead?: number\n /** Commits the local branch is BEHIND its upstream (same conditions). */\n behind?: number\n}\n\n/** One existing worktree of the repository. */\nexport interface WorktreeEntry {\n /** Absolute path of the worktree directory. */\n path: string\n /** Checked-out local branch name; absent for a detached or bare worktree. */\n branch: string | undefined\n /** True for the main worktree (the one holding `.git`). */\n main: boolean\n}\n\n/** Response of GET status — `repo: false` for a directory outside any git repository. */\nexport type RepoStatus =\n | { repo: false }\n | {\n repo: true\n /** Main repository directory basename — the root folder of `<rootDir>/<repoName>/`. */\n repoName: string\n /** Absolute path of the main worktree directory. */\n repoRoot: string\n /** Branch checked out by the directory the client asked about. */\n currentBranch: string\n /** Local branches plus every remote's remote-only branches (those\n * without a same-named local twin; `<remote>/HEAD` dropped). */\n branches: BranchEntry[]\n /** Every worktree of the repository, main first (git order). */\n worktrees: WorktreeEntry[]\n /** Resolved worktree storage root (absolute) — what the settings say today. */\n rootDir: string\n }\n\n/** POST worktree request body. */\nexport interface CreateWorktreeBody {\n /** Any directory inside the repository (workspace cwd). */\n repoPath: string\n /** Chosen branch display name: local (`feat-x`) or remote (`origin/feat-x`). */\n branch: string\n /** True: cut a NEW branch out of `branch` (the current checkout's\n * branch — occupied by the main worktree) and isolate it in a fresh\n * worktree. The storage folder is named after the new branch. */\n cutout?: boolean\n /** Cutout only: explicit name for the NEW branch. Default (absent):\n * derived `<branch>-wt`, suffixing past taken names. */\n name?: string\n}\n\n/** POST worktree response body. */\nexport interface CreateWorktreeResult {\n /** The worktree directory (created or reused). */\n path: string\n /** False when an existing worktree for the branch was reused. */\n created: boolean\n}\n\n/** POST switch request body. */\nexport interface SwitchBody {\n /** Any directory inside the main worktree. */\n repoPath: string\n /** Target branch display name (local, or remote whose local twin is created by dwim). */\n branch: string\n}\n\n/** POST switch response body. */\nexport interface SwitchResult {\n /** The branch actually checked out after the switch. */\n branch: string\n}\n\n/** POST branch request body. */\nexport interface CreateBranchBody {\n /** Any directory inside the repository (workspace cwd) — the new branch is\n * cut from whatever this directory's HEAD points at and checked out HERE. */\n repoPath: string\n /** User-typed name of the branch to create (a local name, verbatim). */\n name: string\n}\n\n/** POST branch response body. */\nexport interface CreateBranchResult {\n /** The branch created and now checked out. */\n branch: string\n}\n\n/** POST fetch request body. */\nexport interface FetchBody {\n /** Any directory inside the repository (workspace cwd). */\n repoPath: string\n}\n\n/** POST fetch response body — the fetch mutates refs server-side; the\n * client refetches /status for the fresh branch list. */\nexport interface FetchResult {\n /** What the fetch covered: \"all\" remotes (this plugin always fetches all). */\n remote: string\n}\n\n/** POST update request body. */\nexport interface UpdateBody {\n /** Any directory inside the repository (workspace cwd) — the branch\n * checked out by THIS directory is the one updated. */\n repoPath: string\n}\n\n/** POST update response body — fetch every remote, then fast-forward the\n * checked-out branch to its upstream. */\nexport interface UpdateResult {\n /** The branch that was updated (empty for a detached checkout, which\n * cannot be updated and always errors before this response). */\n branch: string\n /** False when the upstream already contained the branch (nothing moved). */\n updated: boolean\n}\n\n/** Error envelope every non-2xx response carries. */\nexport interface RouteError {\n error: string\n}\n\n/** Git belonging facts of one workspace directory; null = not a git repository. */\nexport interface WorkspaceGitFacts {\n /** Grouping key: the repository's main worktree directory (canonical). */\n repoRoot: string\n /** Group title: the main repository directory basename. */\n repoName: string\n /** Branch checked out by this directory; null = detached or unborn HEAD. */\n branch: string | null\n /** True when this directory IS the main worktree (holds the shared .git). */\n main: boolean\n}\n\n/** POST group request body. */\nexport interface GroupWorkspacesBody {\n /** Absolute workspace directories to probe (deduped server-side). */\n paths: string[]\n}\n\n/** POST group response body — one entry per DISTINCT requested path. */\nexport interface GroupWorkspacesResult {\n /** Git facts per path; null marks a path outside any git repository. */\n facts: Record<string, WorkspaceGitFacts | null>\n}\n","/**\n * Browser-side fetch client for the plugin's host routes. Plain fetch against\n * same-origin paths; every failure resolves to `{ error }` so callers can\n * branch without try/catch.\n */\n\nimport type {\n CreateBranchResult, CreateWorktreeResult, FetchResult, GroupWorkspacesResult, RepoStatus, RouteError, SwitchResult, UpdateResult,\n} from '../wire.ts'\nimport { ROUTE_BRANCH, ROUTE_FETCH, ROUTE_GROUP, ROUTE_STATUS, ROUTE_SWITCH, ROUTE_UPDATE, ROUTE_WORKTREE } from '../wire.ts'\n\n/** One route call outcome: the parsed body, or the error envelope text. */\ntype Call<T> = (T & { ok: true }) | { ok: false; error: string }\n\n/** POST one JSON body and parse the uniform envelope. */\nasync function post<T>(url: string, body: unknown): Promise<Call<T>> {\n return send<T>('POST', url, body)\n}\n\n/** Send one JSON body with any method and parse the uniform envelope. */\nasync function send<T>(method: string, url: string, body: unknown): Promise<Call<T>> {\n try {\n const response = await fetch(url, {\n method,\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n })\n const payload: unknown = await response.json()\n if (!response.ok) {\n const error = payload as RouteError\n return { ok: false, error: error.error ?? `HTTP ${String(response.status)}` }\n }\n return { ...(payload as T), ok: true }\n } catch (cause) {\n return { ok: false, error: cause instanceof Error ? cause.message : String(cause) }\n }\n}\n\n/**\n * Repository status for one directory.\n * @param path - absolute workspace directory.\n */\nexport async function fetchStatus(path: string): Promise<Call<RepoStatus>> {\n try {\n const response = await fetch(`${ROUTE_STATUS}?path=${encodeURIComponent(path)}`, { cache: 'no-store' })\n if (!response.ok) return { ok: false, error: `HTTP ${String(response.status)}` }\n return { ...(await response.json() as RepoStatus), ok: true }\n } catch (cause) {\n return { ok: false, error: cause instanceof Error ? cause.message : String(cause) }\n }\n}\n\n/**\n * Create or reuse the worktree for a branch.\n * @param repoPath - absolute directory inside the repository.\n * @param branch - branch display name.\n */\nexport function requestWorktree(repoPath: string, branch: string): Promise<Call<CreateWorktreeResult>> {\n return post<CreateWorktreeResult>(ROUTE_WORKTREE, { repoPath, branch })\n}\n\n/**\n * Cut a NEW branch out of the current checkout and isolate it in a fresh\n * worktree (the current branch itself is occupied by the main worktree).\n * @param repoPath - absolute directory inside the repository.\n * @param branch - the current checkout's branch (or `HEAD` when detached).\n * @param name - explicit name for the new branch; omitted, the host\n * derives `<branch>-wt`, suffixing past taken names.\n */\nexport function requestWorktreeCutout(repoPath: string, branch: string, name?: string): Promise<Call<CreateWorktreeResult>> {\n return post<CreateWorktreeResult>(ROUTE_WORKTREE, { repoPath, branch, cutout: true, ...(name === undefined ? {} : { name }) })\n}\n\n/**\n * Switch the main checkout in place.\n * @param repoPath - absolute directory inside the main worktree.\n * @param branch - branch display name.\n */\nexport function requestSwitch(repoPath: string, branch: string): Promise<Call<SwitchResult>> {\n return post<SwitchResult>(ROUTE_SWITCH, { repoPath, branch })\n}\n\n/**\n * Create a NEW branch from the directory's current checkout and switch to it\n * in place.\n * @param repoPath - absolute directory whose HEAD the branch is cut from.\n * @param name - user-typed new branch name (validated client-side already).\n */\nexport function requestCreateBranch(repoPath: string, name: string): Promise<Call<CreateBranchResult>> {\n return post<CreateBranchResult>(ROUTE_BRANCH, { repoPath, name })\n}\n\n/**\n * Sync remote-tracking refs (fetch every remote + prune) for the repository.\n * @param repoPath - absolute directory inside the repository.\n */\nexport function requestFetch(repoPath: string): Promise<Call<FetchResult>> {\n return post<FetchResult>(ROUTE_FETCH, { repoPath })\n}\n\n/**\n * Update the CURRENT checkout: fetch every remote, then fast-forward the\n * checked-out branch to its upstream.\n * @param repoPath - absolute directory whose checked-out branch is updated.\n */\nexport function requestUpdate(repoPath: string): Promise<Call<UpdateResult>> {\n return post<UpdateResult>(ROUTE_UPDATE, { repoPath })\n}\n\n/**\n * Git belonging facts for a batch of workspace directories; a path outside\n * any git repository answers null, a failed route call answers the error\n * envelope (the sidebar then renders flat, its degrade shape).\n * @param paths - absolute workspace directories to probe.\n */\nexport async function requestGroupWorktrees(paths: readonly string[]): Promise<Call<GroupWorkspacesResult>> {\n return post<GroupWorkspacesResult>(ROUTE_GROUP, { paths })\n}\n","/**\n * BranchMenu: the branch picker popup anchored to the composer branch chip.\n * The base Menu primitive exposes neither a height cap nor a search field,\n * so with many branches its portal list fills the viewport — this popup\n * replaces it with an owner-styled card: Menu's card chrome (r12, inverted\n * hairline, shadow-lv3, --dsw-specific-menu, see .menuCard) on a\n * portal-fixed posture, with owner requirements baked in:\n *\n * 1. the card is capped at min(420px, 60vh) and only the branch rows\n * scroll (heading, search, and the toolbar stay pinned);\n * 2. a search field is pinned at the card's bottom edge — the row list\n * scrolls above it — filtering rows by case-insensitive substring\n * while KEEPING the matching branches' ancestor folders (IDEA-style\n * prune) and highlighting the hit substring;\n * 3. the card opens entirely above the chip: the CSS `bottom` pins its\n * bottom edge ~6px above the chip's top, so it grows upward and can\n * never cover the composer, whatever the branch count.\n *\n * Layout (IDEA branch-panel posture at popup scale): a narrow tool strip\n * on the left (locate-current + expand/collapse-all + new-branch), then a\n * main column of heading / tree / search. The list renders in TWO\n * top-level collapsible groups — local branches first, then remote\n * branches (each a folder-header-style row with chevron + count): under a\n * SINGLE remote the remote rows drop their `<remote>/` prefix (the header\n * already says \"remote\"; a stripped display name can never collide with a\n * local row because the host hides remote branches that have a local\n * twin), with SEVERAL remotes the full names stay so `origin`/`upstream`\n * become the folder layer beneath the header. Picking a remote row hands\n * the owner the real `<remote>/name` (see pick) — the remote confirms are\n * the owner's wording (tracking-twin switch / twin-in-worktree).\n * Selection model borrowed from\n * IDEA: a single click SELECTS a row (blue); double-click or Enter then OPENS the\n * right-side confirm flyout for that row — the switch itself always goes\n * through the confirmation step, never straight away. While the confirm\n * flyout is open, clicking another row re-anchors it (the old one-click\n * pick flow).\n *\n * The new-branch tool (the toolbar's plus) opens the create flyout to the\n * RIGHT of the card (the confirm flyout's submenu posture): the flyout\n * holds the naming input — validated as you type (git ref-name rules plus\n * a duplicate check against the rows) with a live hint naming the issue\n * or, while the draft is acceptable, the branch the cut starts from — and\n * the Cancel/Create pair. Confirming fires the create in ONE stroke\n * (create AND in-place switch; no second confirm step — typing the name\n * into the flyout and pressing Create IS the intent). While the create\n * runs the flyout freezes (busy disables input and buttons); a failure\n * toasts and leaves the flyout open for a renamed retry.\n * The confirm flyout is a second-level portal opening to the RIGHT of the\n * branch card (the base Menu's submenu posture): the chip sits in the\n * bottom composer, so the old below-the-chip bubble landed off-viewport.\n * The flyout is a separate portal (not clipped by the card's\n * overflow:hidden), horizontally anchored to the card's right edge — it\n * can never overlap the branch list — and vertically centered on the\n * picked row. Its width is content-driven, capped in CSS, wrapping.\n *\n * Close semantics: outside pointerdown (card, flyouts, and chip excluded)\n * cancels the confirm and closes the menu; Escape unwinds tier by tier —\n * confirm, then the create flyout, then search text, then selection, then\n * the menu; Enter in the search field commits the first enabled visible row.\n *\n * Long names and many branches: a clipped label shows the full name on\n * hover via the native title (gated to actually-clipped rows only). The\n * list ALWAYS renders as a full-depth '/' prefix tree: folder-header rows\n * (chevron + count) toggle; under an expanded folder, child rows show only\n * their own segment (indentation carries the hierarchy — no repeated path,\n * no color distinction); linear chains compress into one row. TREE_MIN_ROWS\n * only sets the DEFAULT opening depth: past it, just the checked-out\n * branch's chain starts open (centering still lands it mid-viewport); at\n * or under it, every folder starts open — few branches have nothing to hide.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n IconCheckOutline16,\n IconChevronDownOutline14,\n IconChevronRightOutline14,\n IconChevronUpOutline14,\n IconGoalOutline16,\n IconPlusOutline16,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { branchNameIssue } from '../normalize.ts'\nimport css from './BranchChip.module.css'\n\n/** One selectable branch row. `name` is the ACTION name sent to the owner —\n * for a remote row the full `origin/feat-x`; the group model derives the\n * DISPLAY name (see groupRows). `ahead`/`behind` are local-row-only\n * upstream divergence counts (absent without an upstream or in sync).\n * `path` is worktree-row-only: the directory a pick hops the session into.\n * `locked` rows are DIMMED but clickable — a pick still reaches the owner,\n * which answers with the main-checkout hint inside a linked-worktree\n * session (deliberately NOT the HTML disabled attribute: a disabled button\n * swallows the click, and the hint would never fire). */\nexport interface BranchRow {\n name: string\n kind: 'local' | 'remote' | 'worktree'\n path?: string\n ahead?: number\n behind?: number\n locked?: boolean\n}\n\n/** The confirm flyout bundle, owned and localized by the caller. */\nexport interface BranchConfirmFly {\n /** Ask line (already localized). */\n ask: string\n /** The branch the ask refers to, on its own weight-500 line (remote\n * picks only — the ask line says \"该远程分支\" and this names it). */\n subject?: string\n /** Confirm-button label (progress text while busy). */\n confirmLabel: string\n /** Cancel-button label. */\n cancelLabel: string\n /** True while the action runs: both buttons disable. */\n busy: boolean\n /** Run the confirmed action. */\n onConfirm: () => void\n /** Dismiss the flyout without acting (stays on the open menu). */\n onCancel: () => void\n}\n\n/** Full props: anchor + data + confirm bundle + callbacks + locale seat. */\nexport interface BranchMenuProps {\n /** Whether the popup shows. */\n open: boolean\n /** The chip element — the popup's bottom edge pins just above its top. */\n anchorRef: React.RefObject<HTMLElement | null>\n /** Every branch as a row (local, remote, and one worktree row per live\n * linked worktree; remote rows carry their `<remote>/name` action name). */\n rows: readonly BranchRow[]\n /** Whether the worktree group is offered (a session hop only makes\n * sense while the session is blank — a started session's directory is\n * fixed). Blank sessions show the group, started ones never do. */\n canAdopt: boolean\n /** The branch currently checked out (trailing check, HEAD tint). */\n currentBranch: string\n /** Non-null while a picked branch awaits confirmation. */\n confirm: BranchConfirmFly | null\n /** Stage a pick (starts the confirm flyout beside that row). Current\n * branch re-select closes the menu unless the owner stages otherwise. */\n onSelect: (branch: string) => void\n /** Whether the new-branch tool is offered (worktree mode routes creation\n * through the cutout flow instead — the toolbar plus then disables). */\n canCreate: boolean\n /** Run the create NOW (create AND in-place switch): the flyout's Create\n * button fires this once for a valid draft — no second confirm step. */\n onCreate: (name: string) => void\n /** True while the create runs: the flyout freezes (input and buttons\n * disable, the Create button shows progress text). */\n busy: boolean\n /** Sync remote-tracking refs (fetch every remote + prune); the owner\n * refreshes the rows when it lands — the menu stays open. */\n onFetch: () => void\n /** True while the remote sync runs: the fetch tool spins and the update\n * tool disables (single-flight). */\n fetchBusy: boolean\n /** Update the CURRENT branch: fetch + fast-forward it to its upstream;\n * the owner refreshes the rows when it lands. */\n onUpdate: () => void\n /** True while the update runs: the update tool spins and the fetch tool\n * disables (single-flight). */\n updateBusy: boolean\n /** Dismiss the menu (outside click, Escape with nothing open). */\n onClose: () => void\n /** Bound locale translate (placeholder, empty state, heading, toolbar). */\n t: PropsLocale<'git-worktree'>['t']\n}\n\n/**\n * The fetch/update glyph in IDEA's posture: a diagonal running from the\n * top-right down to a bottom-left arrowhead. `dashed` marks the metadata\n * move (fetch touches remote-tracking refs only, never working-tree\n * content); the solid variant is the in-place branch update (fetch +\n * fast-forward) — the pairing is IDEA's dashed/solid synchronize/update\n * language. The base library has no such glyph, so both are drawn here,\n * local to the menu; the sync spin animation targets `svg` descendants of\n * the tool button and applies to them unchanged.\n */\nfunction FetchGlyph({ size = 16, dashed = true }: { size?: number; dashed?: boolean }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M13 3 L5.9 10.1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.3\"\n strokeLinecap=\"round\"\n strokeDasharray={dashed ? '2.4 1.6' : undefined}\n />\n <path\n d=\"M5 5.9 V11 H10.1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/** Viewport edge clearance, mirroring the base Menu portal margin. */\nconst MARGIN = 12\n/** Gap kept between the chip's top edge and the card's bottom edge. */\nconst GAP = 6\n/** Design card width — the CSS width's px arm; used for horizontal clamping. */\nconst CARD_WIDTH = 360\n/** Design flyout width cap — matches .popCard's max-width arm. */\nconst FLY_MAX_WIDTH = 400\n/** After a folder toggle, clicks arriving within this window are swallowed\n * (double-click misfire guard — see shiftGuardUntil in the component). */\nconst CLICK_GUARD_MS = 250\n/** Unplaced flyout: hidden but laid out at a fixed origin so offsetWidth/\n * offsetHeight are real for the measure-then-place pass (base Menu trick). */\nconst FLY_MEASURE: CSSProperties = { left: '-9999px', top: '0px', visibility: 'hidden' }\n\n/** Past this many rows the tree starts with ONLY the checked-out branch's\n * chain open; at or under it every folder starts open (few branches have\n * nothing to hide). The tree itself always renders — this threshold is\n * about the default opening depth, never about flat vs tree. */\nconst TREE_MIN_ROWS = 8\n\n/** Leaf rows indent one chevron slot PAST their tree depth. Folder headers\n * lead with a collapsing chevron (12px icon + 6px gap) that leaf rows lack\n * — without compensation a leaf's text starts LEFT of its own group header's\n * text and same-level leaves read shallower than folders. The extra 18px\n * aligns same-level leaf TEXT with folder TEXT (the VS Code file-tree\n * posture: a chevron column marks foldable rows, a text column carries\n * content), so leaf padding is 8 + 12×depth + 18. */\nconst LEAF_CHEVRON_SLOT = 18\n\n/** One node of the '/' prefix tree built from the row list: every segment\n * boundary is a folder level, so `feature/x/y` nests under `feature` and\n * `x`, and the leaves (rows) sit at the terminal nodes. */\ninterface TreeNode {\n /** This node's own segment (the label text). */\n segment: string\n /** Full path: segments joined by '/'. Empty only at the root list. */\n path: string\n /** Depth from the root (root children are depth 0). */\n depth: number\n /** The branch named exactly `path`, if any — may coexist with children\n * (`feature` plus `feature/x` are both legal git branch names). */\n leaf: BranchRow | null\n /** Children, sorted folders-first then by segment. */\n children: TreeNode[]\n /** Leaf branches under this node, including its own leaf. */\n total: number\n}\n\n/** Every folder path that renders a header, walking the tree depth-first. */\nfunction collectFolderPaths(nodes: TreeNode[], out: string[] = []): string[] {\n for (const node of nodes) {\n if (node.children.length > 0) {\n out.push(node.path)\n collectFolderPaths(node.children, out)\n }\n }\n return out\n}\n\nconst segCmp = (a: string, b: string): number =>\n a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })\n\n/**\n * The menu's group model derived from the flat row list: local rows as\n * they are, remote rows displayed under their group header, and worktree\n * rows collected as-is (one per linked worktree, direct hop targets). With\n * a SINGLE remote the `<remote>/` prefix is dropped from the display\n * (`origin/feat/x` reads as `feat/x` — the header already says \"remote\",\n * and a dropped display name can never collide with a local row because\n * the host hides remote branches that have a local twin); with SEVERAL\n * remotes the full name stays, so `origin`/`upstream` become the folder\n * layer that keeps same-named branches apart. `remoteNameMap` maps a\n * displayed remote name back to the action name (an identity map when\n * nothing was dropped).\n */\ninterface BranchGroups {\n localRows: BranchRow[]\n remoteDisplayRows: BranchRow[]\n worktreeRows: BranchRow[]\n remoteNameMap: ReadonlyMap<string, string>\n}\n\n/** Split rows into the three groups and derive the remote display names. */\nfunction groupRows(rows: readonly BranchRow[]): BranchGroups {\n const localRows: BranchRow[] = []\n const remoteRows: BranchRow[] = []\n const worktreeRows: BranchRow[] = []\n for (const row of rows) {\n if (row.kind === 'remote') remoteRows.push(row)\n else if (row.kind === 'worktree') worktreeRows.push(row)\n else localRows.push(row)\n }\n const first = remoteRows[0]?.name ?? ''\n const slash = first.indexOf('/')\n const soleRemote = slash > 0 && remoteRows.every(row => row.name.startsWith(first.slice(0, slash + 1)))\n ? first.slice(0, slash)\n : undefined\n const display = (name: string): string => soleRemote === undefined ? name : name.slice(soleRemote.length + 1)\n return {\n localRows,\n remoteDisplayRows: remoteRows.map(row => ({ ...row, name: display(row.name) })),\n worktreeRows,\n remoteNameMap: new Map(remoteRows.map(row => [display(row.name), row.name])),\n }\n}\n\n/** Expanded-key space: folder paths carry their group prefix so a local\n * folder can never share a toggle state with a same-named remote display\n * folder (`feat/x` on both sides). Group OPEN flags stay booleans beside\n * this set — they are not part of the path namespace at all. */\nconst groupKey = (group: 'local' | 'remote', path: string): string => `${group}:${path}`\n\n/** Build the prefix tree of the rows (see TreeNode). */\nfunction buildTree(rows: readonly BranchRow[]): TreeNode[] {\n /** Mutable builder node — same shape as TreeNode but built incrementally\n * (find-by-segment walks), sorted and totalled at the end. */\n interface M {\n segment: string\n path: string\n depth: number\n leaf: BranchRow | null\n children: M[]\n total: number\n }\n const root: M[] = []\n const find = (level: M[], segment: string): M | undefined =>\n level.find(n => n.segment === segment)\n for (const row of rows) {\n const segs = row.name.split('/').filter(s => s !== '')\n let level = root\n let path = ''\n for (let i = 0; i < segs.length; i += 1) {\n const seg = segs[i]\n if (seg === undefined) break\n path = path === '' ? seg : `${path}/${seg}`\n let node = find(level, seg)\n if (node === undefined) {\n node = { segment: seg, path, depth: i, leaf: null, children: [], total: 0 }\n level.push(node)\n }\n if (i === segs.length - 1) node.leaf = row\n level = node.children\n }\n }\n const finish = (nodes: M[]): void => {\n for (const node of nodes) finish(node.children)\n nodes.sort((a, b) => {\n const af = a.children.length > 0 ? 0 : 1\n const bf = b.children.length > 0 ? 0 : 1\n return af !== bf ? af - bf : segCmp(a.segment, b.segment)\n })\n }\n finish(root)\n const count = (nodes: M[]): void => {\n for (const node of nodes) {\n count(node.children)\n node.total = (node.leaf === null ? 0 : 1)\n + node.children.reduce((sum, c) => sum + c.total, 0)\n }\n }\n count(root)\n return root as unknown as TreeNode[]\n}\n\n/** The folders that must start expanded so the checked-out branch is\n * immediately visible in the tree: every proper ancestor of its path. */\nfunction chainExpanded(branch: string): Set<string> {\n const segs = branch.split('/').filter(s => s !== '')\n const set = new Set<string>()\n let path = ''\n for (let i = 0; i < segs.length - 1; i += 1) {\n const seg = segs[i]\n if (seg === undefined) break\n path = path === '' ? seg : `${path}/${seg}`\n set.add(path)\n }\n return set\n}\n\n/** Hover tooltip: set the native `title` ONLY when the label is actually\n * clipped (scrollWidth > clientWidth) — fitted names show no tooltip, and\n * long ones expose their full path without a custom bubble. The target is\n * the label span (first span child), the clipped element. */\nconst gateTooltip = (button: HTMLButtonElement, name: string): void => {\n const label = button.querySelector<HTMLElement>(':scope > span')\n if (label !== null) label.title = label.scrollWidth > label.clientWidth ? name : ''\n}\n\n/** Leaving a row drops its tooltip so a recycled DOM node (search refilter)\n * can never show a stale title for another branch. */\nconst clearTooltip = (button: HTMLButtonElement): void => {\n const label = button.querySelector<HTMLElement>(':scope > span')\n if (label !== null) label.title = ''\n}\n\n/**\n * Render the upward branch picker with its right-side confirm flyout.\n * @param props - anchor, rows, confirm bundle, callbacks, and the class sheet.\n * @returns null while closed or unplaced; otherwise the portaled card (+flyout).\n */\nexport function BranchMenu({\n open, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, onCreate, busy, onFetch, fetchBusy, onUpdate, updateBusy, onClose, t,\n}: BranchMenuProps) {\n const cardRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n /**\n * Search-field ref callback: focus the field the moment it mounts. The\n * card mounts in two stages (open flips, then pos resolves a render\n * later), so an [open]-keyed passive effect fires while the input is\n * still unmounted — its focus() no-ops against a null ref. Focusing at\n * mount time is immune to that race by construction.\n */\n /**\n * Search-field ref callback: focus the field the moment it mounts. The\n * card mounts in two stages (open flips, then pos resolves a render\n * later), so an [open]-keyed passive effect fires while the input is\n * still unmounted — its focus() no-ops against a null ref. Focusing at\n * mount time is immune to that race by construction. The callback MUST\n * be referentially stable: a fresh closure per render makes React\n * detach and re-attach it on every commit, and the re-attach runs\n * focus() again — each re-render (a click selection, a status refresh,\n * a sessions push) would yank focus back to the field, flickering its\n * focus tint. Stable identity = attach happens only at mount.\n */\n const holdSearchFocus = useCallback((el: HTMLInputElement | null): void => {\n inputRef.current = el\n if (el !== null) el.focus()\n }, [])\n /** Same mount-time focus trick for the new-branch input: the form mounts\n * when the toolbar plus flips `creating`, mid-card-lifecycle, so the ref\n * callback is the only reliable focus point. Stable for the same reason\n * as holdSearchFocus — typing would otherwise re-focus on every render. */\n const holdCreateFocus = useCallback((el: HTMLInputElement | null): void => {\n if (el !== null) el.focus()\n }, [])\n const flyRef = useRef<HTMLDivElement>(null)\n const flyConfirmRef = useRef<HTMLButtonElement | null>(null)\n /** The row whose pick is awaiting confirmation (anchoring element). */\n const pendingRef = useRef<{ name: string; el: HTMLElement } | null>(null)\n /** Pending row's name — the placement-effect trigger: picking another\n * row while the flyout is open must re-anchor it (confirmOpen alone\n * stays true, so a ref mutation re-renders nothing). */\n const [pendingName, setPendingName] = useState<string | null>(null)\n const [pos, setPos] = useState<{ left: number; bottom: number } | null>(null)\n const [flyPos, setFlyPos] = useState<{ left: number; top: number } | null>(null)\n const [query, setQuery] = useState('')\n /** Expanded folder set, keyed by group-prefixed node path (see groupKey).\n * Re-seeded on every open so the current branch's chain is visible\n * without re-expanding by hand. */\n const [expanded, setExpanded] = useState<ReadonlySet<string>>(new Set())\n /** Top-level group open flags, beside the expanded set (which owns\n * folder paths only — a group header is not a path node). Re-seeded on\n * every open: past TREE_MIN_ROWS the remote group starts closed so the\n * list leads with the local branches. The WORKTREE group starts open\n * unconditionally — it is the blank session's quick-hop entry, always\n * worth its few rows. */\n const [localGroupOpen, setLocalGroupOpen] = useState(true)\n const [remoteGroupOpen, setRemoteGroupOpen] = useState(true)\n const [worktreeGroupOpen, setWorktreeGroupOpen] = useState(true)\n /** IDEA-style selection: clicked row (blue). Zero or one at a time. */\n const [selected, setSelected] = useState<string | null>(null)\n /** The create flyout: open flag plus the live draft. Opening the menu\n * (or closing the flyout) resets both — see the open-reset effect. */\n const [creating, setCreating] = useState(false)\n const [draft, setDraft] = useState('')\n /** The create flyout element and its placed position (see its place\n * pass below; same measure-then-place posture as the confirm flyout). */\n const createFlyRef = useRef<HTMLDivElement | null>(null)\n const [createFlyPos, setCreateFlyPos] = useState<{ left: number; top: number } | null>(null)\n\n // Latest values for stable-effect listeners (the parent rebuilds the\n // confirm object each render; refs keep the document-level keydown and\n // outside-click handlers from going stale on the closure they captured).\n const confirmRef = useRef(confirm)\n confirmRef.current = confirm\n const queryRef = useRef(query)\n queryRef.current = query\n const selectedRef = useRef(selected)\n selectedRef.current = selected\n /** Fresh creating flag for the stale-safe document keydown listener. */\n const creatingRef = useRef(creating)\n creatingRef.current = creating\n /** Latest rows for the open-reset effect: the effect must NOT re-run when\n * a mid-open refresh swaps the rows (that would reset folders the user\n * has toggled), but the reset itself still needs the freshest list. */\n const latestRows = useRef(rows)\n latestRows.current = rows\n /** Always-fresh pick for the stale-safe document keydown listener. */\n const pickRef = useRef<(el: HTMLElement | null, name: string) => void>(() => {})\n const confirmOpen = confirm !== null\n\n /**\n * Double-click misfire guard: toggling a folder shifts the layout — the\n * second click of a double-click can land on a row that slid under the\n * cursor (a branch!), which would select it or pop the switch flyout.\n * After a folder toggle, every click swallowed for CLICK_GUARD_MS, so a\n * double-click on a folder expands it exactly once and never bleeds into\n * a branch click. Branch-row clicks do not arm the guard (selecting does\n * not move anything), so row double-clicks keep working instantly.\n */\n const shiftGuardUntil = useRef(0)\n const guardActive = (): boolean => Date.now() < shiftGuardUntil.current\n const armShiftGuard = (): void => { shiftGuardUntil.current = Date.now() + CLICK_GUARD_MS }\n\n /** Stage a pick: remember the row element (the flyout anchors beside\n * it), then hand the branch to the owner. All pick paths — search Enter,\n * keyboard Enter on a selected row — funnel through here. A remote row\n * carries its DISPLAY name through selection and anchors; the owner\n * always receives the real `<remote>/name` action name. */\n const pick = (el: HTMLElement | null, name: string): void => {\n if (el !== null) pendingRef.current = { name, el }\n setPendingName(name)\n onSelect(remoteNameMapRef.current.get(name) ?? name)\n }\n pickRef.current = pick\n\n /** The two-group model of the rows (see groupRows) and each group's '/'\n * prefix tree — always on; TREE_MIN_ROWS only sets the default opening\n * depth (see the open-reset effect). */\n const grouped = useMemo(() => groupRows(rows), [rows])\n const localTree = useMemo(() => buildTree(grouped.localRows), [grouped.localRows])\n const remoteTree = useMemo(() => buildTree(grouped.remoteDisplayRows), [grouped.remoteDisplayRows])\n /** Fresh display→action map for the stale-safe document keydown listener\n * (its Enter path funnels through pick, which reads the ref). */\n const remoteNameMapRef = useRef(grouped.remoteNameMap)\n remoteNameMapRef.current = grouped.remoteNameMap\n\n /** Every folder key that renders a header — the expand/collapse-all\n * button's scope (group-prefixed, see groupKey). */\n const folderPaths = useMemo(() => [\n ...collectFolderPaths(localTree).map(p => groupKey('local', p)),\n ...collectFolderPaths(remoteTree).map(p => groupKey('remote', p)),\n ], [localTree, remoteTree])\n /** Locked row names (dimmed, pick-answered-with-hint) — a Set for the\n * click gate. MUST sit before the `!open` early return: a hook after it\n * would change the hook count between a closed and an open menu\n * (React #310, seen live as the whole dock unmounting on first open). */\n const lockedRows = useMemo(\n () => new Set(rows.filter(r => r.locked === true).map(r => r.name)),\n [rows],\n )\n const allExpanded = folderPaths.every(p => expanded.has(p)) && localGroupOpen && remoteGroupOpen\n && (!canAdopt || worktreeGroupOpen)\n const toggleAll = (): void => {\n // The group headers join the toggle scope: one button opens (or\n // collapses) the whole tree, headers included.\n const next = !allExpanded\n setLocalGroupOpen(next)\n setRemoteGroupOpen(next)\n setWorktreeGroupOpen(next)\n setExpanded(next ? new Set(folderPaths) : new Set())\n }\n const locateCurrent = (): void => {\n // Locate, don't restructure: only ADD the current branch's ancestor\n // folders if they happen to be closed (the row must exist to scroll\n // to it) — folders the user expanded/collapsed stay untouched. The\n // LOCAL group opens too: the current branch usually lives there. In a\n // blank linked-worktree session, though, the branch is HELD by the\n // worktree this session sits in and its row was filed into the\n // WORKTREE group — that group must open as well, or the scroll target\n // never renders. Then center the row one frame later, once the\n // re-render has committed.\n setLocalGroupOpen(true)\n if (grouped.worktreeRows.some(row => row.name === currentBranch)) setWorktreeGroupOpen(true)\n setExpanded(prev => {\n const next = new Set(prev)\n for (const p of chainExpanded(currentBranch)) next.add(groupKey('local', p))\n return next\n })\n requestAnimationFrame(() => {\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n })\n }\n\n // Every open starts from a clean filter, selection, tree state, and\n // naming form. The tree's opening depth follows the list size: past\n // TREE_MIN_ROWS the local group (plus the checked-out branch's folder\n // chain) starts open while the remote group starts closed, at or under\n // it every group and folder does. Rows come through a ref — the effect\n // keys on [open, currentBranch] so a mid-open refresh never resets\n // folders the user has toggled by hand.\n useEffect(() => {\n if (!open) return\n setQuery('')\n setSelected(null)\n setCreating(false)\n setDraft('')\n const currentRows = latestRows.current\n const current = groupRows(currentRows)\n const localPaths = collectFolderPaths(buildTree(current.localRows)).map(p => groupKey('local', p))\n const remotePaths = collectFolderPaths(buildTree(current.remoteDisplayRows)).map(p => groupKey('remote', p))\n const many = currentRows.length > TREE_MIN_ROWS\n setLocalGroupOpen(true)\n setRemoteGroupOpen(!many)\n setWorktreeGroupOpen(true)\n setExpanded(\n many\n ? new Set([...chainExpanded(currentBranch)].map(p => groupKey('local', p)))\n : new Set([...localPaths, ...remotePaths]),\n )\n }, [open, currentBranch])\n\n // A selection that no longer exists in the rows (worktree toggle, refresh)\n // must not linger as a phantom Enter target.\n useEffect(() => {\n if (selected !== null && !rows.some(r => r.name === selected)) setSelected(null)\n }, [rows, selected])\n\n /** Toggle one folder header. */\n const toggle = (path: string): void => {\n setExpanded(prev => {\n const next = new Set(prev)\n if (next.has(path)) next.delete(path)\n else next.add(path)\n return next\n })\n }\n\n // Pin above the chip on open and on viewport movement while open. CSS\n // `bottom` pinning means the card grows upward from that edge without\n // measuring its own height; the width is fixed by CSS, so the horizontal\n // clamp is deterministic.\n useLayoutEffect(() => {\n if (!open) {\n setPos(null)\n return\n }\n const place = (): void => {\n const anchor = anchorRef.current\n if (anchor === null) return\n const rect = anchor.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = Math.min(Math.max(rect.left, MARGIN), Math.max(MARGIN, vw - CARD_WIDTH - MARGIN))\n setPos({ left, bottom: vh - rect.top + GAP })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [open, anchorRef])\n\n // Land the current-branch row mid-viewport when the list shows. With\n // dozens of branches the row otherwise drowns off-screen and \"where am\n // I?\" becomes a scroll hunt. Two trigger paths, both required:\n //\n // - rows MOUNT: the card mounts in two stages (open flips, pos\n // resolves a render later), so an [open]-keyed effect runs while\n // nothing is mounted and never re-fires once rows appear — the\n // stable mount-signal ref below fires exactly at mount instead;\n // - filter CLEARS back to the full list: the rows container is\n // long-mounted by then, so a plain [query] effect reaches it.\n //\n // Manual scrollTo on the rows container — scrollIntoView would also drag\n // scrollable ancestors. Re-renders must NOT re-center (it would yank the\n // user's scroll during picks), hence the stable useCallback identity.\n const rowsRef = useRef<HTMLElement | null>(null)\n const centerCurrentRow = useCallback((viewport: HTMLElement): void => {\n const row = [...viewport.querySelectorAll<HTMLButtonElement>('button[role=\"menuitem\"][data-branch]')]\n .find(b => (b.dataset.branch ?? '') === currentBranch)\n if (row === undefined) return\n const rowRect = row.getBoundingClientRect()\n const vpRect = viewport.getBoundingClientRect()\n const target = viewport.scrollTop + (rowRect.top - vpRect.top) - (viewport.clientHeight - rowRect.height) / 2\n viewport.scrollTo({ top: Math.max(0, target) })\n }, [currentBranch])\n const holdRowsCenter = useCallback((el: HTMLElement | null): void => {\n rowsRef.current = el\n if (el !== null) centerCurrentRow(el)\n }, [centerCurrentRow])\n useEffect(() => {\n if (!open || query.trim() !== '') return\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n }, [open, query, centerCurrentRow])\n\n // After an open re-seeds the folder chain (see the reset effect above),\n // its re-render commits one render AFTER the rows mount — centering in\n // that window would no-op because the current row's folder is still\n // closed. One frame later the chain is committed and the row exists, so\n // run the centering again then. User folder toggles never re-center:\n // this effect fires only on open / branch change.\n useEffect(() => {\n if (!open) return\n const raf = requestAnimationFrame(() => {\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n })\n return () => { cancelAnimationFrame(raf) }\n }, [open, centerCurrentRow])\n\n // Flyout lifecycle: horizontally anchored to the card's right edge (so\n // it never overlaps the branch list), vertically centered on the picked\n // row, clamped into the viewport. Width is content-driven: place()\n // clamps the flyout's inline max-width to the room right of the card\n // (CSS caps the design width), then measures the laid-out hidden flyout\n // and pins it. Re-runs when the pending ROW changes — confirmOpen alone\n // stays true across re-picks, which used to leave the flyout stranded\n // at the first row. Scroll/resize re-fit while open.\n useLayoutEffect(() => {\n if (!confirmOpen || pendingName === null) {\n setFlyPos(null)\n return\n }\n const place = (): void => {\n const pending = pendingRef.current\n const fly = flyRef.current\n const card = cardRef.current\n if (pending === null || fly === null || card === null) return\n const row = pending.el.getBoundingClientRect()\n const cr = card.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = cr.right + GAP\n // Fit the right side: content width first, clamped by the room left\n // of the viewport margin (floor keeps the buttons usable on very\n // narrow windows, at the cost of spilling past the margin).\n const room = Math.min(FLY_MAX_WIDTH, Math.max(200, vw - MARGIN - left))\n fly.style.maxWidth = `${room}px`\n const fw = fly.offsetWidth\n const fh = fly.offsetHeight\n // The picked row's center rides the flyout's vertical center.\n const top = Math.min(\n Math.max(row.top + row.height / 2 - fh / 2, MARGIN),\n Math.max(MARGIN, vh - fh - MARGIN),\n )\n setFlyPos({ left: Math.min(left, vw - MARGIN - fw), top })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [confirmOpen, pendingName])\n\n // Create flyout placement: anchored to the card's right edge (never\n // overlapping the branch list), vertically centered on the card, clamped\n // into the viewport. Content-driven width via the same measure-then-place\n // pass the confirm flyout uses (hidden layout, then real offsets).\n useLayoutEffect(() => {\n if (!creating) {\n setCreateFlyPos(null)\n return\n }\n const place = (): void => {\n const fly = createFlyRef.current\n const card = cardRef.current\n if (fly === null || card === null) return\n const cr = card.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = cr.right + GAP\n const room = Math.min(FLY_MAX_WIDTH, Math.max(200, vw - MARGIN - left))\n fly.style.maxWidth = `${room}px`\n const fw = fly.offsetWidth\n const fh = fly.offsetHeight\n const top = Math.min(\n Math.max(cr.top + cr.height / 2 - fh / 2, MARGIN),\n Math.max(MARGIN, vh - fh - MARGIN),\n )\n setCreateFlyPos({ left: Math.min(left, vw - MARGIN - fw), top })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [creating])\n\n // Confirm opens (or re-anchors to another row) → focus the confirm\n // button (Enter commits, Escape cancels); confirm closes → forget the\n // pending row anchor. The focus rides a rAF: the flyout mounts in the\n // hidden measure-then-place posture, and focus() on a visibility:hidden\n // element is a no-op — one frame later the placed card is visible and\n // the focus lands.\n useEffect(() => {\n if (confirmOpen && pendingName !== null) {\n const raf = requestAnimationFrame(() => { flyConfirmRef.current?.focus() })\n return () => { cancelAnimationFrame(raf) }\n }\n if (!confirmOpen) {\n pendingRef.current = null\n setPendingName(null)\n }\n }, [confirmOpen, pendingName])\n\n // Outside pointer / keyboard dismiss. Outside clicks cancel the confirm\n // and close the menu in one go. Escape unwinds tier by tier — confirm,\n // then search text, then selection, then the menu. Arrow keys move the\n // selection over the visible leaf rows and Enter stages the confirm,\n // but only while focus sits on a card button: the search input keeps\n // its own caret handling and Enter-commit.\n useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent): void => {\n if (cardRef.current?.contains(event.target as Node) === true) return\n if (flyRef.current?.contains(event.target as Node) === true) return\n if (createFlyRef.current?.contains(event.target as Node) === true) return\n if (anchorRef.current?.contains(event.target as Node) === true) return\n confirmRef.current?.onCancel()\n onClose()\n }\n const onKeyDown = (event: KeyboardEvent): void => {\n const key = event.key\n if (key === 'Escape') {\n if (confirmRef.current !== null) { confirmRef.current.onCancel(); return }\n if (creatingRef.current) { setCreating(false); setDraft(''); return }\n if (queryRef.current.trim() !== '') { setQuery(''); return }\n if (selectedRef.current !== null) { setSelected(null); return }\n onClose()\n return\n }\n const card = cardRef.current\n const active = document.activeElement\n if (card === null || active === null || !card.contains(active)) return\n const inputs = card.querySelectorAll('input')\n if (inputs.length > 0 && [...inputs].includes(active as HTMLInputElement)) return\n const leaves = [...card.querySelectorAll<HTMLButtonElement>('button[role=\"menuitem\"][data-branch]')]\n if (key === 'ArrowDown' || key === 'ArrowUp') {\n event.preventDefault()\n if (leaves.length === 0) return\n const idx = leaves.findIndex(b => (b.dataset.branch ?? '') === selectedRef.current)\n let next = idx\n if (key === 'ArrowDown') next = idx < 0 ? 0 : Math.min(leaves.length - 1, idx + 1)\n else next = idx <= 0 ? leaves.length - 1 : idx - 1\n const target = leaves[next]\n if (target === undefined) return\n const name = target.dataset.branch ?? null\n if (name !== null) setSelected(name)\n target.focus()\n target.scrollIntoView({ block: 'nearest' })\n } else if (key === 'Enter' && selectedRef.current !== null) {\n event.preventDefault()\n const el = leaves.find(b => (b.dataset.branch ?? '') === selectedRef.current) ?? null\n pickRef.current(el, selectedRef.current)\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [open, onClose, anchorRef])\n\n if (!open || pos === null) return null\n\n const needle = query.trim().toLowerCase()\n // Search matches the DISPLAY names — what the rows actually show. With a\n // single remote that is the prefix-stripped form (searching \"origin\" no\n // longer matches; the user searches what they see), with several remotes\n // the full name.\n const visible = needle === ''\n ? rows\n : [...grouped.localRows, ...grouped.worktreeRows, ...grouped.remoteDisplayRows]\n .filter(row => row.name.toLowerCase().includes(needle))\n\n /** Enter in the search field: commit the first visible row (its rendered\n * button is the anchor — found by its data-branch key; the label text\n * alone can't identify a row inside a tree). */\n const commitFirst = (): void => {\n const first = visible[0]\n if (first === undefined) return\n const card = cardRef.current\n if (card === null) return\n const el = card.querySelector<HTMLButtonElement>(`button[data-branch=\"${CSS.escape(first.name)}\"]`)\n pick(el, first.name)\n }\n\n /** New-branch draft validation: git ref-name rules first, then a duplicate\n * check against every EXISTING local branch — local rows and worktree\n * rows alike (a worktree row IS a checked-out branch, just filed under\n * its own group). A remote display name is not a claim on a new local\n * branch's name (its twin could not even coexist with one; the host\n * hides such remote rows). */\n const createIssue = branchNameIssue(draft)\n const existsLocally = (name: string): boolean =>\n grouped.localRows.some(row => row.name === name) || grouped.worktreeRows.some(row => row.name === name)\n const createDuplicate = createIssue === null && existsLocally(draft)\n const createValid = createIssue === null && !createDuplicate\n /** Error line under the input, ONLY while the draft is unacceptable with\n * a non-empty reason (the ask line above already names the cut point, and\n * an untouched input needs no error) — the Create button disables in\n * lockstep. */\n const createHint = createDuplicate ? t('menuNewBranchExists') : t('menuNewBranchBad')\n const showCreateHint = (createIssue !== null && createIssue !== 'empty') || createDuplicate\n\n /** Fire the create in one stroke — the flyout's whole point. Invalid\n * drafts and a running create are no-ops (the Create button disables in\n * lockstep); the owner closes the menu on success, toasts on failure and\n * leaves the flyout open for a renamed retry. */\n const commitCreate = (): void => {\n if (!createValid || busy) return\n onCreate(draft)\n }\n\n /** Row class composition: base + HEAD tint + selection (selection wins)\n * + the locked dim. (`css` is an index-signature record, so noUncheckedIndexedAccess\n * types every class as possibly absent — the base falls back to ''.) */\n const rowClass = (row: BranchRow | null, name: string): string => {\n let cls = css.menuRow ?? ''\n if (name === currentBranch) cls += ` ${css.menuRowSelected}`\n if (name === selected) cls += ` ${css.menuRowPicked}`\n if (row?.locked === true) cls += ` ${css.menuRowLocked}`\n return cls\n }\n\n /** Locked rows keep the click path ALIVE (the owner answers picks with\n * the main-checkout toast) but stay unselected — a dimmed row wearing\n * the blue selection would read as \"chosen yet unusable\". */\n const isLocked = (name: string): boolean => lockedRows.has(name)\n\n /** The upstream divergence arrows of a local row (IDEA's ↑N/↓N) ahead of\n * the trailing check: plain text marks in the secondary tone — no base\n * icon pairs a direction with a count. Absent without an upstream or\n * when in sync. */\n const renderArrows = (row: BranchRow | null): React.ReactNode => {\n if (row === null) return null\n const marks: React.ReactNode[] = []\n if ((row.ahead ?? 0) > 0) {\n marks.push(<span key=\"ahead\" className={css.menuRowArrow} title={t('aheadTitle', { n: row.ahead })}>↑{row.ahead}</span>)\n }\n if ((row.behind ?? 0) > 0) {\n marks.push(<span key=\"behind\" className={css.menuRowArrow} title={t('behindTitle', { n: row.behind })}>↓{row.behind}</span>)\n }\n return marks\n }\n\n /** A row's click behavior: with the confirm flyout open, clicking a row\n * re-picks it (the old one-click flow — the flyout re-anchors); without\n * one it just selects (IDEA model — double-click or Enter opens the\n * confirm flyout for the selected row). Locked rows do neither: dimmed\n * rows are not selectable, the double-click is the hint's stage. `el` is\n * nullable like {@link pick}'s anchor: a row whose button is already\n * unmounted still selects/picks, it just re-anchors nothing. */\n const rowClick = (el: HTMLButtonElement | null, name: string): void => {\n if (isLocked(name)) return\n if (confirmOpen) pick(el, name)\n else setSelected(name)\n }\n\n /** Wrap every case-insensitive occurrence of `needle` in `text` with the\n * search-mark span (IDEA-style hit highlight). */\n const renderLabel = (text: string): React.ReactNode => {\n if (needle === '') return text\n const out: React.ReactNode[] = []\n let rest = text\n let key = 0\n for (;;) {\n const idx = rest.toLowerCase().indexOf(needle)\n if (idx === -1) { out.push(rest); break }\n if (idx > 0) out.push(rest.slice(0, idx))\n out.push(<span key={key} className={css.menuSearchMark}>{rest.slice(idx, idx + needle.length)}</span>)\n key += 1\n rest = rest.slice(idx + needle.length)\n }\n return out\n }\n\n /** Does any leaf under these nodes match the needle? */\n const subtreeMatches = (nodes: TreeNode[]): boolean => {\n for (const node of nodes) {\n if (node.leaf !== null && node.leaf.name.toLowerCase().includes(needle)) return true\n if (subtreeMatches(node.children)) return true\n }\n return false\n }\n\n /** One top-level group header (local/remote branches): the folder-header\n * posture with its own open flag — toggling flips the flag, never a key\n * in the expanded path set. `menuGroupTop` lifts the tone above the\n * folder headers (see the CSS note). In the search view (onToggle\n * absent) it renders inert: the matched subtrees below are force-open\n * anyway. */\n const renderGroupHeader = (label: string, count: number, open: boolean, onToggle?: () => void): React.ReactNode => {\n const cls = `${css.menuGroup} ${css.menuGroupTop}`\n return (\n onToggle === undefined\n ? (\n <div className={cls} role=\"presentation\" style={{ paddingLeft: 8 }}>\n <IconChevronDownOutline14 size={12} className={css.menuGroupChevron} />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({count})</span>\n </div>\n )\n : (\n <button\n type=\"button\"\n className={cls}\n aria-expanded={open}\n onClick={() => {\n if (guardActive()) return\n onToggle()\n armShiftGuard()\n }}\n >\n <IconChevronRightOutline14\n size={12}\n className={open ? `${css.menuGroupChevron} ${css.menuGroupChevronOpen}` : css.menuGroupChevron}\n />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({count})</span>\n </button>\n )\n )\n }\n\n /**\n * One tree group-header row: its own segment (a compressed chain's\n * walked segments join the label), a count badge, and a chevron that\n * turns for expansion. Clicking toggles. One color throughout — the\n * folder path is not color-distinguished from the name. `prefix` scopes\n * the expanded-key space to the owning group (see groupKey) and keeps\n * React keys unique across the two trees.\n */\n const renderHeader = (node: TreeNode, label: string, depth: number, prefix: string): React.ReactNode => {\n const isOpen = expanded.has(`${prefix}${node.path}`)\n return (\n <button\n key={`${prefix}group:${node.path}`}\n type=\"button\"\n className={css.menuGroup}\n data-group={node.path}\n style={{ paddingLeft: 8 + depth * 12 }}\n aria-expanded={isOpen}\n onClick={() => {\n if (guardActive()) return\n toggle(`${prefix}${node.path}`)\n armShiftGuard()\n }}\n >\n <IconChevronRightOutline14\n size={12}\n className={isOpen ? `${css.menuGroupChevron} ${css.menuGroupChevronOpen}` : css.menuGroupChevron}\n />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({node.total})</span>\n </button>\n )\n }\n\n /** One tree leaf row: under an expanded folder it shows only its own\n * segment (indentation carries the hierarchy — no repeated full path);\n * a compressed linear chain keeps its walked segments in the label so\n * the context survives without a pointless one-entry folder. The\n * data-branch key stays the group-local DISPLAY name — unique across\n * all groups (a remote display name can never equal a local row; a\n * worktree row's branch has left the local group) — which is what the\n * buttonOf/commitFirst/center lookups rely on. */\n const renderLeaf = (node: TreeNode, label: string, depth: number, prefix: string): React.ReactNode => (\n <button\n key={`${prefix}${node.path}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={node.path}\n data-kind={node.leaf?.kind}\n className={rowClass(node.leaf ?? null, node.path)}\n title={node.leaf?.locked === true ? t('mainRepoOnly') : undefined}\n style={{ paddingLeft: 8 + depth * 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(node.path), node.path) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, node.path) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, node.path) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{label}</span>\n {renderArrows(node.leaf)}\n {node.path === currentBranch && <IconCheckOutline16 size={14} />}\n </button>\n )\n\n /** One flat worktree row: a direct hop target, one per linked worktree\n * — no tree (worktree names rarely fork, and the group is a launcher,\n * not a taxonomy), no confirm (the double-click IS the hop; the owner\n * picks it up through onSelect). The native title carries the worktree\n * DIRECTORY — the fact a branch row cannot show. The row the session\n * currently lives in keeps the trailing check + HEAD tint: it is the\n * \"you are here\" mark the local group no longer holds (its branch was\n * filed into THIS group). */\n const renderFlatLeaf = (row: BranchRow, prefix: string): React.ReactNode => (\n <button\n key={`${prefix}${row.name}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={row.name}\n data-kind={row.kind}\n className={rowClass(row, row.name)}\n title={row.locked === true ? t('mainRepoOnly') : row.path}\n style={{ paddingLeft: 8 + 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(row.name), row.name) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, row.name) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, row.name) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{row.name}</span>\n {row.name === currentBranch && <IconCheckOutline16 size={14} />}\n </button>\n )\n\n /** Recursive tree renderer. Linear chains — nodes that are neither a\n * branch nor a real fork — compress into the next row's label, so\n * `feature/优化` stays a single flat row instead of a pointless one-entry\n * folder, while a real fork (`a/deep/tree` holding leaf1+leaf2) gets a\n * header whose children show only their own segments. */\n const renderTree = (nodes: TreeNode[], depth: number, prefix: string): React.ReactNode[] => {\n const out: React.ReactNode[] = []\n for (const node of nodes) {\n let cur = node\n const parts: string[] = []\n while (cur.leaf === null && cur.children.length === 1) {\n const next = cur.children[0]\n if (next === undefined) break\n parts.push(cur.segment)\n cur = next\n }\n const label = parts.length === 0 ? cur.segment : `${parts.join('/')}/${cur.segment}`\n if (cur.leaf !== null) {\n out.push(renderLeaf(cur, label, depth, prefix))\n // A branch that is also a folder path (`feature` next to\n // `feature/x`): keep the pickable row and fold the children under\n // a second, toggle-only header of the same name (rare coexistence).\n if (cur.children.length > 0) {\n out.push(renderHeader(cur, label, depth, prefix))\n if (expanded.has(`${prefix}${cur.path}`)) out.push(...renderTree(cur.children, depth + 1, prefix))\n }\n } else {\n out.push(renderHeader(cur, label, depth, prefix))\n if (expanded.has(`${prefix}${cur.path}`)) out.push(...renderTree(cur.children, depth + 1, prefix))\n }\n }\n return out\n }\n\n /** Search view: keep matching leaves AND their ancestor folders (IDEA's\n * filter keeps the path), hide non-matching siblings, force every kept\n * folder open, and highlight the hit substring. No chain compression —\n * the full ancestor path is exactly the context the search is for. */\n /** Needle-matching leaf count of a tree: the search-view group header\n * must count the MATCHES under it, not the whole group — a full count\n * above two filtered rows reads as a lie. */\n const searchLeafCount = (nodes: TreeNode[]): number =>\n nodes.reduce((sum, node) => sum\n + (node.leaf !== null && node.leaf.name.toLowerCase().includes(needle) ? 1 : 0)\n + searchLeafCount(node.children), 0)\n\n const renderSearch = (nodes: TreeNode[], depth: number, prefix: string): React.ReactNode[] => {\n const out: React.ReactNode[] = []\n for (const node of nodes) {\n const leafHit = node.leaf !== null && node.leaf.name.toLowerCase().includes(needle)\n const childHit = subtreeMatches(node.children)\n if (leafHit) {\n out.push(\n <button\n key={`${prefix}${node.path}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={node.path}\n data-kind={node.leaf?.kind}\n className={rowClass(node.leaf ?? null, node.path)}\n title={node.leaf?.locked === true ? t('mainRepoOnly') : undefined}\n style={{ paddingLeft: 8 + depth * 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(node.path), node.path) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, node.path) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, node.path) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{renderLabel(node.segment)}</span>\n {renderArrows(node.leaf)}\n {node.path === currentBranch && <IconCheckOutline16 size={14} />}\n </button>,\n )\n }\n if (childHit) {\n out.push(\n <div\n key={`${prefix}search:${node.path}`}\n role=\"presentation\"\n className={css.menuGroup}\n data-group={node.path}\n style={{ paddingLeft: 8 + depth * 12 }}\n >\n <IconChevronDownOutline14 size={12} className={css.menuGroupChevron} />\n <span className={css.menuGroupLabel}>{renderLabel(node.segment)}</span>\n <span className={css.menuGroupCount}>({node.total})</span>\n </div>,\n )\n out.push(...renderSearch(node.children, depth + 1, prefix))\n }\n }\n return out\n }\n\n /** The rendered button for a branch name (flyout anchor on click-select\n * paths, where the handler only has the name at hand). */\n const buttonOf = (name: string): HTMLButtonElement | null =>\n cardRef.current?.querySelector<HTMLButtonElement>(`button[data-branch=\"${CSS.escape(name)}\"]`) ?? null\n\n return (\n <>\n {createPortal(\n <div\n ref={cardRef}\n className={css.menuCard}\n style={{ left: pos.left, bottom: pos.bottom }}\n role=\"menu\"\n aria-label={t('menuBranches')}\n >\n <div className={css.menuToolbar} role=\"toolbar\" aria-label={t('menuBranches')}>\n {/* The plus UNMOUNTS where branch creation has no business\n * (worktree mode armed, or a linked-worktree session) instead\n * of disabling: a disabled button swallows clicks with no\n * answer — the exact dead-gray shape this menu locked rows\n * out of (see the menu-scope DR). Escape (creatingRef branch)\n * and outside clicks already collapse the create flyout, so\n * losing the anchor button takes no dismiss path with it. */}\n {canCreate && (\n <button\n type=\"button\"\n className={creating ? `${css.menuToolButton} ${css.menuToolButtonOn}` : css.menuToolButton}\n title={t('menuNewBranch')}\n aria-label={t('menuNewBranch')}\n aria-pressed={creating}\n onClick={() => {\n // Opening the flyout cancels a staged confirm first: the\n // flyout would otherwise stay anchored to a stale row beside\n // the create panel. Closing drops the draft with it.\n confirmRef.current?.onCancel()\n const next = !creating\n setCreating(next)\n if (!next) setDraft('')\n }}\n >\n <IconPlusOutline16 size={16} />\n </button>\n )}\n <button\n type=\"button\"\n className={css.menuToolButton}\n title={t('menuLocate')}\n aria-label={t('menuLocate')}\n onClick={locateCurrent}\n >\n <IconGoalOutline16 size={16} />\n </button>\n <button\n type=\"button\"\n className={updateBusy ? `${css.menuToolButton} ${css.menuToolButtonRunning}` : css.menuToolButton}\n title={t('menuUpdate')}\n aria-label={t('menuUpdate')}\n disabled={busy || fetchBusy}\n onClick={() => {\n // A staged confirm must not ride out the update: while it\n // runs, busy would flip its labels into progress text for\n // an action nobody is running.\n confirmRef.current?.onCancel()\n onUpdate()\n }}\n >\n <FetchGlyph dashed={false} />\n </button>\n <button\n type=\"button\"\n className={fetchBusy ? `${css.menuToolButton} ${css.menuToolButtonRunning}` : css.menuToolButton}\n title={t('menuFetch')}\n aria-label={t('menuFetch')}\n disabled={busy || updateBusy}\n onClick={() => {\n // A staged confirm must not ride out the sync: while the\n // fetch runs, busy would flip its labels into progress text\n // for an action nobody is running.\n confirmRef.current?.onCancel()\n onFetch()\n }}\n >\n <FetchGlyph />\n </button>\n <button\n type=\"button\"\n className={css.menuToolButton}\n title={allExpanded ? t('menuCollapseAll') : t('menuExpandAll')}\n aria-label={allExpanded ? t('menuCollapseAll') : t('menuExpandAll')}\n // The group headers fold too, so the tool stays live whenever\n // any row exists — folders alone no longer gate it.\n disabled={rows.length === 0}\n onClick={toggleAll}\n >\n {allExpanded ? <IconChevronUpOutline14 size={14} /> : <IconChevronDownOutline14 size={14} />}\n </button>\n </div>\n <div className={css.menuMain}>\n <div className={css.menuHeading}>{t('menuBranches')}</div>\n <div className={css.menuRows} role=\"presentation\" ref={holdRowsCenter}>\n {needle === '' ? (\n <>\n {grouped.localRows.length > 0 && renderGroupHeader(t('menuLocalBranches'), grouped.localRows.length, localGroupOpen,\n () => setLocalGroupOpen(value => !value))}\n {localGroupOpen && renderTree(localTree, 1, 'local:')}\n {canAdopt && grouped.worktreeRows.length > 0 && (\n <>\n {renderGroupHeader(t('menuWorktrees'), grouped.worktreeRows.length, worktreeGroupOpen,\n () => setWorktreeGroupOpen(value => !value))}\n {worktreeGroupOpen && grouped.worktreeRows.map(row => renderFlatLeaf(row, 'worktree:'))}\n </>\n )}\n {grouped.remoteDisplayRows.length > 0 && (\n <>\n {renderGroupHeader(t('menuRemoteBranches'), grouped.remoteDisplayRows.length, remoteGroupOpen,\n () => setRemoteGroupOpen(value => !value))}\n {remoteGroupOpen && renderTree(remoteTree, 1, 'remote:')}\n </>\n )}\n </>\n ) : (\n <>\n {grouped.localRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuLocalBranches'), searchLeafCount(localTree), true)}\n {renderSearch(localTree, 1, 'local:')}\n </>\n )}\n {canAdopt && grouped.worktreeRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuWorktrees'), grouped.worktreeRows.filter(row => row.name.toLowerCase().includes(needle)).length, true)}\n {grouped.worktreeRows\n .filter(row => row.name.toLowerCase().includes(needle))\n .map(row => renderFlatLeaf(row, 'worktree:'))}\n </>\n )}\n {grouped.remoteDisplayRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuRemoteBranches'), searchLeafCount(remoteTree), true)}\n {renderSearch(remoteTree, 1, 'remote:')}\n </>\n )}\n </>\n )}\n {/* Two distinct empties: a filter that matched nothing\n * (\"no MATCHES\") versus a menu with no rows at all — a\n * detached HEAD's started worktree session, a fresh repo.\n * \"No matching branches\" under zero rows would blame the\n * search the user never typed. */}\n {visible.length === 0\n && <div className={css.menuEmpty}>{rows.length === 0 ? t('menuNoBranches') : t('menuNoMatches')}</div>}\n </div>\n <div className={css.menuSearchWrap}>\n <input\n ref={holdSearchFocus}\n className={css.menuSearch}\n type=\"text\"\n value={query}\n placeholder={t('menuSearchPlaceholder')}\n aria-label={t('menuSearchPlaceholder')}\n spellCheck={false}\n onChange={event => { setQuery(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commitFirst()\n }\n }}\n />\n </div>\n </div>\n </div>,\n document.body,\n )}\n {confirm !== null && createPortal(\n <div\n ref={flyRef}\n className={css.popCard}\n style={flyPos ?? FLY_MEASURE}\n role=\"dialog\"\n aria-label={confirm.ask}\n >\n <p className={css.popAsk}>{confirm.ask}</p>\n {confirm.subject !== undefined && <p className={css.popSubject}>{confirm.subject}</p>}\n <div className={css.popActions}>\n <button type=\"button\" disabled={confirm.busy} onClick={confirm.onCancel}>\n {confirm.cancelLabel}\n </button>\n <button ref={flyConfirmRef} type=\"button\" disabled={confirm.busy} onClick={confirm.onConfirm}>\n {confirm.confirmLabel}\n </button>\n </div>\n </div>,\n document.body,\n )}\n {creating && createPortal(\n <div\n ref={createFlyRef}\n className={css.popCard}\n style={createFlyPos ?? FLY_MEASURE}\n role=\"dialog\"\n aria-label={t('createBranchTitle', { branch: currentBranch })}\n >\n <p className={css.popAsk}>{t('createBranchTitle', { branch: currentBranch })}</p>\n <input\n ref={holdCreateFocus}\n className={css.menuCreate}\n type=\"text\"\n value={draft}\n placeholder={t('menuNewBranchPlaceholder')}\n aria-label={t('menuNewBranchPlaceholder')}\n aria-invalid={createIssue !== null && createIssue !== 'empty'}\n spellCheck={false}\n disabled={busy}\n onChange={event => { setDraft(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commitCreate()\n }\n }}\n />\n {showCreateHint && (\n <p className={css.menuCreateHintBad} role=\"status\">{createHint}</p>\n )}\n <div className={css.popActions}>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => { setCreating(false); setDraft('') }}\n >\n {t('actionCancel')}\n </button>\n <button type=\"button\" disabled={!createValid || busy} onClick={commitCreate}>\n {busy ? t('createBranchBusy') : t('actionConfirm')}\n </button>\n </div>\n </div>,\n document.body,\n )}\n </>\n )\n}","/**\n * BranchChipDock: the composer tool-row entry (conversation.input.left, right\n * of the mode chips) for sessions inside a git repository. Blank sessions\n * OF THE MAIN checkout get the full segmented control — branch picker plus\n * the worktree isolation toggle — because that is the moment to choose the\n * environment for the conversation, and starting a worktree is a main-repo\n * decision. Once the session starts, the worktree toggle is withdrawn (its\n * directory is fixed). A session inside a LINKED worktree scopes the whole\n * entry down: blank, the menu lists every branch for READING but every\n * pick but the current branch answers with the main-checkout hint (and\n * neither the toggle nor the in-place new-branch tool exists there);\n * started, the menu shows nothing but the session's own branch — fetch and\n * update-current stay, since neither moves the checkout (probeRepo still\n * roots at the session directory's toplevel, never the main checkout).\n * Non-git directories and load failures render nothing. The confirm\n * dialogs and the error toast live here too.\n *\n * Checking the worktree toggle pops the cutout confirm dialog right away:\n * confirming it cuts a NEW branch (`<current>-wt`, suffixes past taken\n * names) out of the current checkout into a fresh isolated worktree — the\n * current branch itself is occupied by the main worktree, so git refuses a\n * second worktree on it. The dialog stands alone above the chip (the\n * branch menu stays closed); the chip still opens the menu, where picking\n * another branch keeps the plain create-or-reuse flow and re-picking the\n * current branch stages the same cutout confirm. Dismissing the dialog and\n * sending the message anyway means the user knowingly stays in the current\n * directory — no separate notice fires on send.\n *\n * In-place branch creation (the menu toolbar's plus, worktree mode off)\n * opens the create flyout right of the branch card: type the name, press\n * Create — the new branch is cut from the session directory's current\n * checkout and checked out there in one stroke, the worktree-less sibling\n * of the cutout flow. A failure toasts and leaves the flyout open.\n *\n * Remote branches join the picker under their own menu group: picking one\n * stages the remote-twin confirm — the switch creates the local tracking\n * branch in place (git's dwim), the worktree pick creates the twin inside\n * its fresh worktree. Both rides go through the existing /switch and\n * /worktree routes, which already resolve `<remote>/name` display names.\n *\n * Branches held by linked worktrees get their own 「工作树」 group (blank\n * sessions only): they have left the local group — git refuses to check\n * them out twice, so a local-group row would be a dead end — and a\n * double-click hops the session straight into that worktree directory\n * (adoptWorktree; no git action, no confirm). A started session's\n * directory is fixed, so the group only exists while blank.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n Button, IconBranchOutline16, Toast,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { branchNameIssue, localBranchName } from '../normalize.ts'\nimport type { BranchEntry, RepoStatus, WorktreeEntry } from '../wire.ts'\nimport { fetchStatus, requestCreateBranch, requestFetch, requestSwitch, requestUpdate, requestWorktree, requestWorktreeCutout } from './api.ts'\nimport { BranchMenu, type BranchRow } from './BranchMenu.tsx'\nimport type { BranchChipInjected } from './slots.ts'\nimport css from './BranchChip.module.css'\n\n/**\n * Heavier check glyph for the worktree toggle. The base's IconCheckOutline16\n * is a fill path (fixed visual weight); we need a visibly bolder stroke to\n * read inside the 14×14 bluish fill — local to this module so the heavier\n * weight doesn't leak into the rest of the composer chrome.\n */\nfunction WorktreeCheck({ size = 12 }: { size?: number }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M3.2 8.4 L6.6 11.8 L12.8 4.4\"\n stroke=\"currentColor\"\n strokeWidth=\"3.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/** Full props: owner share + standard kit + injected adopt verb + locale seat. */\nexport type BranchChipDockProps =\n PropsRuntime<'conversation.input.left'>\n & BranchChipInjected\n & PropsLocale<'git-worktree'>\n\n/** Status fetch lifecycle: `null` facts until ready; failures park unloaded. */\ninterface StatusState {\n facts: (RepoStatus & { repo: true }) | null\n}\n\n/** One pending confirm dialog. */\ninterface ConfirmState {\n kind: 'switch' | 'worktree' | 'worktree-cutout'\n branch: string\n /** True when `branch` names a REMOTE branch (an `origin/feat-x` row):\n * the switch confirm creates the local tracking twin, the worktree\n * confirm creates the twin plus its worktree — the ask lines spell that\n * out instead of reading as a plain in-place switch. */\n remote?: boolean\n /** Editable cutout name (kind `worktree-cutout` only): pre-filled with\n * the first free `<branch>-wt` name, editable before confirming. */\n draft?: string\n}\n\n/** First free `<base>-wt` name against the local branch list — the prefilled\n * draft of the cutout dialog (same shape as the host's suffix walk, minus\n * the storage-folder probe the client cannot see). */\nfunction firstFreeCutoutName(base: string, taken: readonly string[]): string {\n const stem = `${base}-wt`\n if (!taken.includes(stem)) return stem\n for (let i = 2; ; i += 1) {\n const candidate = `${stem}${i}`\n if (!taken.includes(candidate)) return candidate\n }\n}\n\n/**\n * Read the repository status for a directory; refetch on demand.\n * @param cwd - absolute session directory.\n * @returns the state holder and a refetch verb.\n */\nfunction useRepoStatus(cwd: string | undefined): readonly [StatusState, () => Promise<void>] {\n const [state, setState] = useState<StatusState>({ facts: null })\n const load = useCallback(async (): Promise<void> => {\n if (cwd === undefined) {\n setState({ facts: null })\n return\n }\n const result = await fetchStatus(cwd)\n setState({ facts: result.ok && result.repo ? result : null })\n }, [cwd])\n useEffect(() => {\n let live = true\n setState({ facts: null })\n if (cwd !== undefined) {\n void fetchStatus(cwd).then(result => {\n if (live) setState({ facts: result.ok && result.repo ? result : null })\n })\n }\n return () => { live = false }\n }, [cwd])\n return [state, load]\n}\n\n/** Longest branch name shown on the chip before ellipsizing (chars, … included). */\nconst BRANCH_DISPLAY_MAX = 25\n\n/** Viewport edge clearance and chip gap, mirroring BranchMenu's posture. */\nconst POP_MARGIN = 12\nconst POP_GAP = 6\n/** Unplaced dialog: hidden but laid out at a fixed origin so offsetWidth is\n * real for the measure-then-place pass (BranchMenu's flyout trick). */\nconst POP_MEASURE: CSSProperties = { left: '-9999px', bottom: '0px', visibility: 'hidden' }\n\n/**\n * Clamp a branch name for chip display: names up to 25 chars pass through;\n * longer ones show the first 24 chars plus an ellipsis.\n * @param branch - full branch name.\n */\nfunction displayBranch(branch: string): string {\n return branch.length <= BRANCH_DISPLAY_MAX ? branch : `${branch.slice(0, BRANCH_DISPLAY_MAX - 1)}…`\n}\n\n/**\n * Build the branch rows for the picker in three kinds: LOCAL branches not\n * held by a linked worktree, REMOTE branches, and one WORKTREE row per\n * linked worktree. A branch held by a worktree LEAVES the local group —\n * git refuses to check it out twice, so the row would be a dead end; the\n * worktree group is the way INTO it instead (a direct session hop, see\n * the owner's onAdoptWorktree). The main worktree and detached worktrees\n * don't come along: the main checkout is home, not a hop target, and a\n * detached worktree has no branch name to offer.\n *\n * Inside a linked-worktree session every row but the current branch is\n * LOCKED (dimmed, still clickable): a pick reaches the owner, which\n * answers with the main-checkout hint — the dimming reads as \"not usable\n * here\" at a glance while the click keeps its explanation.\n */\nfunction buildBranchRows(\n branches: readonly BranchEntry[],\n worktrees: readonly WorktreeEntry[],\n currentBranch: string,\n inLinkedWorktree: boolean,\n): BranchRow[] {\n const held = new Set(worktrees.flatMap(w => w.main || w.branch === undefined ? [] : [w.branch]))\n const lock = (name: string): boolean => inLinkedWorktree && name !== currentBranch\n return [\n ...branches.filter(b => b.kind === 'local' && !held.has(b.name)).map(b => ({\n name: b.name,\n kind: 'local' as const,\n ...b.ahead === undefined ? {} : { ahead: b.ahead },\n ...b.behind === undefined ? {} : { behind: b.behind },\n locked: lock(b.name),\n })),\n ...branches.filter(b => b.kind === 'remote').map(b => ({\n name: b.name,\n kind: 'remote' as const,\n locked: lock(b.name),\n })),\n ...worktrees.flatMap(w => w.main || w.branch === undefined\n ? []\n : [{ name: w.branch, kind: 'worktree' as const, path: w.path, locked: lock(w.branch) }]),\n ]\n}\n\n/** The standalone confirm dialog shown while the branch menu is closed. */\ninterface ChipConfirmProps {\n /** The chip element — the dialog's bottom edge pins just above its top. */\n anchorRef: React.RefObject<HTMLElement | null>\n /** Ask line (already localized). */\n ask: string\n /** The branch the ask refers to, on its own weight-500 line (remote picks\n * only — the ask line says \"该远程分支\" and this names it). */\n subject?: string\n /** Confirm-button label (progress text while busy). */\n confirmLabel: string\n /** Cancel-button label. */\n cancelLabel: string\n /** True while the action runs: both buttons disable. */\n busy: boolean\n /** Editable new-branch name (cutout flow): present, the dialog renders a\n * naming input under the ask line and focuses IT instead of the confirm\n * button; Enter commits a valid draft. */\n draft?: string\n onDraftChange?: (value: string) => void\n draftPlaceholder?: string\n /** True while the draft is NOT an acceptable new branch name — the\n * confirm button disables in lockstep. */\n draftInvalid?: boolean\n /** Why the draft is invalid (rendered under the input; absent while the\n * draft is acceptable or merely empty). */\n draftHint?: string\n /** Run the confirmed action. */\n onConfirm: () => void\n /** Dismiss the dialog without acting. */\n onCancel: () => void\n}\n\n/**\n * The check-time confirm dialog, rendered while the branch menu is closed:\n * the same popCard chrome as BranchMenu's flyout, but bottom-pinned above\n * the chip in the menu card's posture — the flyout's right-of-card anchor\n * has no card to sit beside here. Outside pointerdown and Escape cancel;\n * the naming input (cutout flow) takes focus when present, else the\n * confirm button does so Enter commits.\n */\nfunction ChipConfirm({\n anchorRef, ask, subject, confirmLabel, cancelLabel, busy,\n draft, onDraftChange, draftPlaceholder, draftInvalid, draftHint,\n onConfirm, onCancel,\n}: ChipConfirmProps) {\n const popRef = useRef<HTMLDivElement>(null)\n const confirmRef = useRef<HTMLButtonElement | null>(null)\n const draftInputRef = useRef<HTMLInputElement | null>(null)\n const [pos, setPos] = useState<{ left: number; bottom: number } | null>(null)\n\n // Bottom-pin above the chip and clamp horizontally against the measured,\n // content-driven width (popCard is max-content under an 80vw cap).\n useLayoutEffect(() => {\n const place = (): void => {\n const anchor = anchorRef.current\n const pop = popRef.current\n if (anchor === null || pop === null) return\n const rect = anchor.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = Math.min(Math.max(rect.left, POP_MARGIN), Math.max(POP_MARGIN, vw - POP_MARGIN - pop.offsetWidth))\n setPos({ left, bottom: vh - rect.top + POP_GAP })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [anchorRef])\n\n // Focus rides a rAF: the first frame lays the dialog out in the hidden\n // measure-then-place posture, and focus() on a visibility:hidden node\n // no-ops — one frame later the placed dialog is visible and the focus\n // lands. The naming input wins when present (typing is the point).\n useEffect(() => {\n const raf = requestAnimationFrame(() => { (draftInputRef.current ?? confirmRef.current)?.focus() })\n return () => { cancelAnimationFrame(raf) }\n }, [])\n\n // Outside pointerdown cancels (the dialog and the chip excluded — the\n // chip click runs its own toggle); Escape unwinds the dialog.\n useEffect(() => {\n const onPointerDown = (event: PointerEvent): void => {\n if (popRef.current?.contains(event.target as Node) === true) return\n if (anchorRef.current?.contains(event.target as Node) === true) return\n onCancel()\n }\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onCancel()\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [onCancel, anchorRef])\n\n return createPortal(\n <div ref={popRef} className={css.popCard} style={pos ?? POP_MEASURE} role=\"dialog\" aria-label={ask}>\n <p className={css.popAsk}>{ask}</p>\n {subject !== undefined && <p className={css.popSubject}>{subject}</p>}\n {onDraftChange !== undefined && (\n <>\n <input\n ref={draftInputRef}\n className={css.menuCreate}\n type=\"text\"\n value={draft}\n placeholder={draftPlaceholder}\n aria-label={draftPlaceholder}\n aria-invalid={draftInvalid}\n spellCheck={false}\n disabled={busy}\n onChange={event => { onDraftChange(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter' && draftInvalid !== true && !busy) {\n event.preventDefault()\n onConfirm()\n }\n }}\n />\n {draftInvalid === true && draftHint !== undefined && (\n <p className={css.menuCreateHintBad} role=\"status\">{draftHint}</p>\n )}\n </>\n )}\n <div className={css.popActions}>\n <button type=\"button\" disabled={busy} onClick={onCancel}>\n {cancelLabel}\n </button>\n <button\n ref={confirmRef}\n type=\"button\"\n disabled={busy || draftInvalid === true}\n onClick={onConfirm}\n >\n {confirmLabel}\n </button>\n </div>\n </div>,\n document.body,\n )\n}\n\n/** The tool-row entry registered into conversation.input.left. */\nexport function BranchChipDock({ session, sessionId, useSessions, adoptWorktree, t }: BranchChipDockProps) {\n const summary = useSessions(state => state.byId[sessionId])\n const cwd = summary?.cwd\n const [repo, refresh] = useRepoStatus(cwd)\n const [menuOpen, setMenuOpen] = useState(false)\n const [worktreeMode, setWorktreeMode] = useState(false)\n const [confirm, setConfirm] = useState<ConfirmState | null>(null)\n const [busy, setBusy] = useState(false)\n /** Which arrow is spinning: fetch and update are single-flight against\n * the SAME busyRef (mutually exclusive), but the spinning state must be\n * per-tool — one shared flag made both arrows rotate at once. */\n const [fetchBusy, setFetchBusy] = useState(false)\n const [updateBusy, setUpdateBusy] = useState(false)\n const [toast, setToast] = useState<{ seq: number; text: string } | null>(null)\n const chipRef = useRef<HTMLButtonElement | null>(null)\n const busyRef = useRef(false)\n\n useEffect(() => {\n // A moved session directory means a new repository context: the staged\n // toggle and any half-open dialog belong to the old one.\n setWorktreeMode(false)\n setConfirm(null)\n setMenuOpen(false)\n }, [cwd])\n\n useEffect(() => {\n // The session started: the environment is fixed now, so a toggle staged\n // during the blank phase must not survive into branch switching — nor\n // its confirm: a keyboard-only send (no outside pointerdown to dismiss\n // it) can start the session while the cutout dialog still floats over a\n // withdrawn toggle. Switch confirms stay: in-place branch switching is\n // a started-session feature.\n if (!session.blank) {\n setWorktreeMode(false)\n setConfirm(current => current !== null && current.kind !== 'switch' ? null : current)\n }\n }, [session.blank])\n\n // External branch changes (terminal, other tools) never reach this chip\n // on their own — the status fetch runs on mount, on cwd change, and after\n // our own switches. Two cheap pull points cover the real workflow:\n // regaining window focus (the user returns from the terminal where the\n // branches moved; refreshes the chip label) and opening the menu (fresh\n // rows exactly at decision time, see the chip's onClick). A push channel\n // (host-side fs.watch on .git/refs + SSE) was considered and skipped:\n // these pulls hide all but the menu-open-while-branches-change race, at\n // none of that complexity.\n useEffect(() => {\n const refreshIfIdle = (): void => {\n if (busyRef.current) return\n void refresh()\n }\n const onVisibility = (): void => {\n if (document.visibilityState === 'visible') refreshIfIdle()\n }\n window.addEventListener('focus', refreshIfIdle)\n document.addEventListener('visibilitychange', onVisibility)\n return () => {\n window.removeEventListener('focus', refreshIfIdle)\n document.removeEventListener('visibilitychange', onVisibility)\n }\n }, [refresh])\n\n const showError = useCallback((message: string) => {\n setToast({ seq: Date.now(), text: t('errorGeneric', { message }) })\n }, [t])\n\n /** Run one guarded confirm action: single-flight, toast on failure, close on success. */\n const runGuarded = useCallback(async (action: () => Promise<string | undefined>): Promise<void> => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n const failure = await action()\n busyRef.current = false\n setBusy(false)\n if (failure !== undefined) {\n showError(failure)\n return\n }\n setConfirm(null)\n setMenuOpen(false)\n }, [showError])\n\n /** In-place switch flow: POST /switch, then refetch the status. */\n const doSwitch = useCallback((branch: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestSwitch(cwd, branch)\n if (!result.ok) return result.error\n await refresh()\n return undefined\n }), [cwd, refresh, runGuarded])\n\n /** Create-branch flow: POST /branch (create from the current checkout and\n * switch to it in place), then refetch the status — the menu closed by\n * then, and the chip label must name the new branch. Fired directly by\n * the menu's create flyout (no confirm kind): typing the name into the\n * flyout and pressing Create is the intent. */\n const doCreateBranch = useCallback((name: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestCreateBranch(cwd, name)\n if (!result.ok) return result.error\n await refresh()\n return undefined\n }), [cwd, refresh, runGuarded])\n\n /** Remote-sync flow: POST /fetch (fetch every remote + prune), then\n * refetch the status. Deliberately NOT runGuarded: its success closes the\n * menu, while the whole point of a sync is watching the refreshed branch\n * list in place. Single-flight shares busyRef with the other actions, so\n * a sync and a confirm action can never interleave. A network fetch has\n * NO visible side effect when the remote moved not — the spinning tool\n * (menu side) and the done toast here ARE the feedback. */\n const doFetch = useCallback(async () => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n setFetchBusy(true)\n const failure = await (async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestFetch(cwd)\n if (!result.ok) return result.error\n return undefined\n })()\n busyRef.current = false\n setBusy(false)\n setFetchBusy(false)\n if (failure !== undefined) {\n showError(failure)\n return\n }\n await refresh()\n setToast({ seq: Date.now(), text: t('fetchDone') })\n }, [cwd, refresh, showError, t])\n\n /** Update-current-branch flow: POST /update (fetch every remote, then\n * fast-forward the checked-out branch to its upstream), then refetch the\n * status in place — same keep-the-menu-open semantics as the fetch sync.\n * The toast tells the two apart: fast-forwarded vs already up to date. */\n const doUpdate = useCallback(async () => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n setUpdateBusy(true)\n const result = cwd === undefined ? undefined : await requestUpdate(cwd)\n busyRef.current = false\n setBusy(false)\n setUpdateBusy(false)\n if (result === undefined) {\n showError('no session directory')\n return\n }\n if (!result.ok) {\n showError(result.error)\n return\n }\n await refresh()\n setToast({\n seq: Date.now(),\n text: result.updated ? t('updateDone', { branch: result.branch }) : t('updateUpToDate'),\n })\n }, [cwd, refresh, showError, t])\n\n /** Worktree-group flow: hop the session into the EXISTING worktree\n * directory. No git action, no confirm — the double-click IS the hop\n * (a directory jump is reversible and touches nothing), and the owner's\n * adoptWorktree registers the folder and opens a blank session there. */\n const doAdoptWorktree = useCallback((path: string): void => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n adoptWorktree(path)\n .then(() => { setMenuOpen(false) })\n .catch((cause: unknown) => {\n showError(cause instanceof Error ? cause.message : String(cause))\n })\n .finally(() => {\n busyRef.current = false\n setBusy(false)\n })\n }, [adoptWorktree, showError])\n\n /** Worktree flow: POST /worktree (create-or-reuse, or cut out a new\n * branch under an explicit name), register the directory, hop sessions. */\n const doWorktree = useCallback((branch: string, cutout: boolean, name?: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = cutout\n ? await requestWorktreeCutout(cwd, branch, name)\n : await requestWorktree(cwd, branch)\n if (!result.ok) return result.error\n try {\n await adoptWorktree(result.path)\n } catch (cause) {\n return cause instanceof Error ? cause.message : String(cause)\n }\n return undefined\n }), [adoptWorktree, cwd, runGuarded])\n\n const facts = repo.facts\n // The session sits in a linked worktree when its directory's toplevel is\n // NOT the main worktree entry — the trigger for the scoped menu (see\n // below) and for hiding the worktree toggle.\n const inLinkedWorktree = facts !== null\n && facts.worktrees.find(w => w.main)?.path !== facts.repoRoot\n const rows = useMemo(() => {\n if (facts === null) return []\n // A STARTED linked-worktree session shows nothing but its own branch:\n // the menu there is a position marker plus the fetch/update tools, not\n // a picker — every other branch lives behind the main checkout. A BLANK\n // one shows the full list for reading; its picks are answered with the\n // main-checkout hint (see onSelect).\n if (inLinkedWorktree && !session.blank) {\n const current = facts.branches.find(b => b.kind === 'local' && b.name === facts.currentBranch)\n return current === undefined\n ? []\n : [{\n name: current.name,\n kind: 'local' as const,\n ...current.ahead === undefined ? {} : { ahead: current.ahead },\n ...current.behind === undefined ? {} : { behind: current.behind },\n }]\n }\n return buildBranchRows(facts.branches, facts.worktrees, facts.currentBranch, inLinkedWorktree)\n }, [facts, inLinkedWorktree, session.blank])\n // Every already-taken LOCAL name feeds the new-branch namespaces (cutout\n // prefill and the duplicate checks): local rows and worktree rows alike\n // (a worktree row IS a checked-out branch), while a remote row is no\n // claim at all — a remote branch with a same-named local twin never\n // reaches the client (the host hides those rows).\n const localNames = useMemo(\n () => rows.filter(row => row.kind !== 'remote').map(row => row.name),\n [rows],\n )\n\n // Non-repo and still-loading directories render nothing at all.\n if (facts === null) return null\n\n const confirmLocalName = confirm === null ? '' : localBranchName(confirm.branch)\n // The cutout dialog carries an EDITABLE new-branch name (pre-filled with\n // the first free `<branch>-wt`); validated exactly like the create\n // flyout — git ref-name rules plus a duplicate check against the rows.\n const isCutout = confirm?.kind === 'worktree-cutout'\n const cutoutDraft = isCutout ? confirm.draft ?? '' : ''\n const cutoutIssue = isCutout ? branchNameIssue(cutoutDraft) : null\n const cutoutDuplicate = isCutout && cutoutIssue === null && localNames.includes(cutoutDraft)\n const cutoutValid = cutoutIssue === null && !cutoutDuplicate\n const cutoutHint = cutoutDuplicate\n ? t('menuNewBranchExists')\n : cutoutIssue !== null && cutoutIssue !== 'empty'\n ? t('menuNewBranchBad')\n : undefined\n // Reuse applies only to the plain create flow: a cutout always cuts a\n // fresh branch, so the current-branch confirm can never reuse.\n const existingWorktree = confirm === null || confirm.kind !== 'worktree'\n ? undefined\n : facts.worktrees.find(w => w.branch === confirmLocalName)\n\n /** One confirm bundle shared by the menu flyout and the standalone\n * dialog (whichever is showing). Remote picks keep the ask line SHORT (a\n * wrapping sentence with long branch names breaks badly) and name the\n * branch on its own weight-500 line — the dwim/worktree consequences are\n * git's default behavior, not worth a third line. */\n const confirmBundle = confirm === null ? null : {\n ask: confirm.kind === 'worktree-cutout'\n ? t('worktreeAskCutOut', { branch: confirmLocalName })\n : confirm.kind === 'worktree'\n ? confirm.remote === true\n ? t('worktreeAskRemote')\n : t(existingWorktree !== undefined ? 'worktreeAskReuse' : 'worktreeAskNew', { branch: confirmLocalName })\n : confirm.remote === true\n ? t('switchAskRemote')\n : t('switchAsk', { branch: confirm.branch }),\n ...confirm.remote === true ? { subject: confirm.branch } : {},\n confirmLabel: busy\n ? (confirm.kind === 'worktree' || confirm.kind === 'worktree-cutout' ? t('worktreeBusy') : t('switchBusy'))\n : t('actionConfirm'),\n cancelLabel: t('actionCancel'),\n busy,\n onConfirm: () => {\n if (confirm.kind === 'worktree' || confirm.kind === 'worktree-cutout') {\n if (confirm.kind === 'worktree-cutout' && !cutoutValid) return\n void doWorktree(confirm.branch, confirm.kind === 'worktree-cutout', confirm.draft)\n } else {\n void doSwitch(confirm.branch)\n }\n },\n onCancel: () => { if (!busy) setConfirm(null) },\n }\n\n return (\n <>\n <span className={css.dock}>\n <button\n ref={chipRef}\n type=\"button\"\n className={css.chip}\n title={facts.currentBranch}\n onClick={() => {\n // Toggling always unwinds any half-open confirm first.\n setConfirm(null)\n const opening = !menuOpen\n setMenuOpen(opening)\n // Fresh rows at decision time: branches may have moved outside\n // (terminal, other tools) since the last fetch. Non-blocking —\n // the menu opens on current data and re-renders when it lands.\n if (opening && !busyRef.current) void refresh()\n }}\n >\n <IconBranchOutline16 size={12} />\n <span className={css.branch}>{displayBranch(facts.currentBranch)}</span>\n </button>\n {/* The worktree toggle exists only for blank sessions OF THE MAIN\n * checkout: starting a worktree is a main-repo decision — a session\n * already inside a linked worktree gets neither the toggle nor the\n * in-place new-branch tool (its directory identity is not ours to\n * move). */}\n {session.blank && !inLinkedWorktree && (\n <>\n <span className={css.divider} aria-hidden=\"true\" />\n <button\n type=\"button\"\n className={worktreeMode ? css.checkOn : css.check}\n onClick={() => {\n // Checking stages the cutout dialog for the current branch\n // right away — the guidance IS the dialog, not a branch\n // list to explore. The new branch's name is EDITABLE there\n // (pre-filled with the first free `<current>-wt`); checking\n // again (or unchecking) clears it (and any menu).\n const next = !worktreeMode\n setWorktreeMode(next)\n setMenuOpen(false)\n if (next) {\n setConfirm({\n kind: 'worktree-cutout',\n branch: facts.currentBranch,\n draft: firstFreeCutoutName(localBranchName(facts.currentBranch), localNames),\n })\n if (!busyRef.current) void refresh()\n } else {\n setConfirm(null)\n }\n }}\n title={t('worktreeToggle')}\n >\n <span className={css.box}>{worktreeMode ? <WorktreeCheck size={10} /> : null}</span>\n <span className={css.checkLabel}>{t('chipWorktree')}</span>\n </button>\n </>\n )}\n </span>\n <BranchMenu\n open={menuOpen}\n anchorRef={chipRef}\n rows={rows}\n currentBranch={facts.currentBranch}\n confirm={confirmBundle}\n canCreate={!worktreeMode && !inLinkedWorktree}\n canAdopt={session.blank}\n busy={busy}\n onCreate={(name) => { void doCreateBranch(name) }}\n onFetch={() => { void doFetch() }}\n fetchBusy={fetchBusy}\n onUpdate={() => { void doUpdate() }}\n updateBusy={updateBusy}\n onSelect={(branch) => {\n // In worktree mode re-selecting the CURRENT branch stages the\n // cut-out dialog (editable name); without the mode it is a plain\n // close. Any other pick stages the regular confirm flyout beside\n // that row (menu stays open) — except a WORKTREE row: the pick\n // hops the session straight into that worktree directory, no\n // confirm (the menu closes on success).\n if (branch === facts.currentBranch) {\n if (worktreeMode) {\n setConfirm({\n kind: 'worktree-cutout',\n branch,\n draft: firstFreeCutoutName(localBranchName(branch), localNames),\n })\n } else {\n setMenuOpen(false)\n }\n return\n }\n // A linked-worktree session stages NO branch action — not plain\n // switches, not remote checkouts, not worktree hops. One hint\n // sends every pick back to the main checkout, where the worktree\n // toggle (and the whole action surface) lives.\n if (inLinkedWorktree) {\n setToast({ seq: Date.now(), text: t('mainRepoOnly') })\n return\n }\n const row = rows.find(r => r.name === branch)\n if (row?.kind === 'worktree' && row.path !== undefined) {\n doAdoptWorktree(row.path)\n return\n }\n // Remote rows carry the remote-twin wording into whichever confirm\n // they stage (switch = tracking twin in place, worktree = twin in\n // its own directory); local rows keep the plain asks.\n const remote = row?.kind === 'remote'\n setConfirm({ kind: worktreeMode ? 'worktree' : 'switch', branch, remote })\n }}\n onClose={() => { setMenuOpen(false) }}\n t={t}\n />\n {confirmBundle !== null && !menuOpen && (\n <ChipConfirm\n anchorRef={chipRef}\n {...confirmBundle}\n {...isCutout ? { draft: cutoutDraft } : {}}\n {...isCutout\n ? { onDraftChange: (value: string) => { setConfirm(current => current?.kind === 'worktree-cutout' ? { ...current, draft: value } : current) } }\n : {}}\n draftPlaceholder={t('menuNewBranchPlaceholder')}\n {...isCutout && !cutoutValid ? { draftInvalid: true } : {}}\n {...cutoutHint === undefined ? {} : { draftHint: cutoutHint }}\n />\n )}\n {toast !== null && <Toast key={toast.seq} text={toast.text} onDone={() => { setToast(null) }} />}\n </>\n )\n}\n","/**\n * Form over the `git-worktree` settings namespace.\n *\n * `rootDir` is staged: a settings write is a durable, revision-fenced\n * document mutation, so the control stages what the user picks and commits\n * it only on save. The field shows its effective value (user layer over\n * composition layer over schema default) and whether the user layer carries\n * it — key presence, not a value comparison, marks an override.\n *\n * `groupSidebar` writes through immediately (the sidebar seat subscribes to\n * the same scope). The card snapshot flips the value and raises\n * `groupingPending` before the write crosses the wire, so the checkbox and\n * spinner can paint; pending stays up until `afterGroupSidebarWrite`\n * reports the seat has swapped (not merely until `scope.set` resolves).\n *\n * Self-contained on purpose: the client bundle-purity rule forbids value\n * imports across plugins, so this package stages and fences its own form\n * (and its own snapshot store) rather than importing another plugin's model.\n *\n * @module git-worktree/client/card-form\n */\n\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-runtime/client'\n\n/** The field this card edits. */\nexport const ROOT_FIELD = 'rootDir'\n\n/** The resolved user-facing section this card edits. */\nexport interface SectionValue {\n /** Worktree storage root; absent selects `$DSH_HOME/gitworktree`. */\n rootDir?: string\n /** Whether the sidebar groups same-repository workspaces; absent = on. */\n groupSidebar?: boolean\n}\n\n/**\n * Minimal observable snapshot source: the stable-reference discipline the\n * shell's stores follow (same snapshot object until the fact moves), with\n * nothing the single-field form does not use.\n */\nexport interface CardStore {\n /** @returns the current snapshot (stable reference until the next change). */\n getSnapshot(): CardState\n /** @param listener - invoked after each snapshot change. @returns the disposer. */\n subscribe(listener: () => void): () => void\n /** @param next - the new snapshot; replaces the reference only on a real change. */\n set(next: CardState): void\n}\n\n/** What the git-worktree settings card renders. */\nexport interface CardState {\n /** False while the namespace is not served to this client; the card renders nothing. */\n available: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Draft text ('' marks the inherited/default location). */\n rootDir: string\n /** Whether saving the field would leave a user-layer entry. */\n overridden: boolean\n /** Whether the form holds an edit that a save would write. */\n dirty: boolean\n /** Whether a save is crossing the wire. */\n saving: boolean\n /** Whether the last save did not land as staged; cleared by the next edit or save. */\n failed: boolean\n /** Resolved sidebar-grouping switch (user layer over the default on). */\n groupSidebar: boolean\n /** True while a grouping-switch write (and the seat swap it triggers) is in flight. */\n groupingPending: boolean\n}\n\n/** The form actions the card's slot entry injects. */\nexport interface CardActions {\n /** Stage draft text for the root field. */\n editRoot: (text: string) => void\n /** Stage a clear, so saving lets the field re-inherit the default location. */\n clearRoot: () => void\n /** Write the staged edit, then re-seed from what the Host accepted. */\n save: () => void\n /** Drop the staged edit. */\n discard: () => void\n /** Persist the sidebar-grouping switch (takes effect immediately). */\n setGroupSidebar: (value: boolean) => void\n}\n\n/**\n * Stages the settings edit over the `git-worktree` scope.\n *\n * The form publishes through a snapshot store because the slot component\n * reads through a snapshot selector while both the scope and the local draft\n * change underneath; every projection is rebuilt from the two together. The\n * root field is staged only when the user touched it, so a save writes a\n * sparse patch and never restates fields it did not see. The grouping switch\n * is not staged: a set optimistic-publishes, yields a frame so the spinner\n * can paint, then writes; pending holds until the seat callback settles.\n */\nexport class CardForm {\n private snapshotValue: CardState\n private readonly listeners = new Set<() => void>()\n private draft: string | undefined\n private saving = false\n private failed = false\n private groupingPending = false\n private groupingDraft: boolean | undefined\n\n /**\n * @param scope - the bound settings scope for the `git-worktree` namespace.\n * @param afterGroupSidebarWrite - awaited after the setting lands, until\n * the sidebar seat has actually swapped (facts in on enable, native\n * paint on disable). Absent in unit tests that only cover the write.\n */\n constructor(\n private readonly scope: SettingsScope<SectionValue>,\n private readonly afterGroupSidebarWrite?: (enabled: boolean) => Promise<void>,\n ) {\n this.snapshotValue = this.project()\n scope.subscribe(() => { this.publish() })\n }\n\n /** @returns the store the card's component reads through its bound selector. */\n bind(): CardStore {\n return {\n getSnapshot: () => this.snapshotValue,\n subscribe: (listener) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n },\n set: (next) => { this.store(next) },\n }\n }\n\n /** @returns the edit, clear, save, discard, and grouping-switch actions bound to this form. */\n actions(): CardActions {\n return {\n editRoot: (text) => {\n this.draft = text\n this.failed = false\n this.publish()\n },\n clearRoot: () => {\n this.draft = ''\n this.failed = false\n this.publish()\n },\n // Returns the save's promise (assignable to the void action slot) so\n // callers that care — tests — can await settlement.\n save: () => this.save(),\n discard: () => {\n if (this.draft === undefined && !this.failed) return\n this.draft = undefined\n this.failed = false\n this.publish()\n },\n setGroupSidebar: (value) => this.setGroupSidebar(value),\n }\n }\n\n /**\n * Flip the grouping switch immediately, then persist.\n *\n * `scope.set` only stores the document; the visible sidebar swap (inject\n * + `/group` facts, or dispose + native paint) happens after. Pending\n * stays up until that callback settles so the spinner matches what the\n * user sees, not the write round-trip.\n */\n private async setGroupSidebar(value: boolean): Promise<void> {\n if (this.groupingPending) return\n if (value === this.effectiveGroupSidebar()) return\n this.groupingPending = true\n this.groupingDraft = value\n this.publish()\n await yieldForPaint()\n try {\n await this.scope.set('groupSidebar', value)\n if (this.afterGroupSidebarWrite !== undefined) await this.afterGroupSidebarWrite(value)\n } finally {\n this.groupingPending = false\n this.groupingDraft = undefined\n this.publish()\n }\n }\n\n /** Resolved grouping switch, preferring an in-flight optimistic draft. */\n private effectiveGroupSidebar(): boolean {\n return this.groupingDraft ?? this.scope.getSnapshot().value?.groupSidebar ?? true\n }\n\n /**\n * Write the staged edit, then re-seed from what the Host accepted.\n *\n * The Host is the only authority on acceptance — an empty draft clears the\n * field, anything else stores the trimmed text (so blanking the control and\n * saving is the same gesture as clearing it). A save that did not land\n * keeps its draft so the user can correct it instead of retyping.\n */\n private async save(): Promise<void> {\n if (this.draft === undefined || this.saving) return\n // Snapshot the intended write: a keystroke mid-await must not change what\n // this save commits.\n const intended = this.draft.trim()\n this.saving = true\n this.failed = false\n this.publish()\n let landed = true\n try {\n if (intended === '') await this.scope.unset(ROOT_FIELD)\n else await this.scope.set(ROOT_FIELD, intended)\n // Read back: the Host's validator owns the constraints no schema\n // expresses, so acceptance is judged from the stored layers.\n if (intended === '' ? this.storedRoot() : this.storedRootValue() !== intended) {\n landed = false\n }\n } catch (_settingsWriteFailure) {\n landed = false\n }\n if (landed) this.draft = undefined\n this.saving = false\n this.failed = !landed\n this.publish()\n }\n\n /** The raw user layer narrowed to a record; the wire answer is `unknown`. */\n private userLayer(): Record<string, unknown> | undefined {\n const user = this.scope.getSnapshot().user\n return typeof user === 'object' && user !== null ? user as Record<string, unknown> : undefined\n }\n\n /** Whether the user layer carries the root field. */\n private storedRoot(): boolean {\n const user = this.userLayer()\n return user !== undefined && Object.hasOwn(user, ROOT_FIELD)\n }\n\n /** The raw user-layer value of the root field. */\n private storedRootValue(): unknown {\n return this.userLayer()?.[ROOT_FIELD]\n }\n\n /** The resolved (draft-free) text of the field; '' means inherited. */\n private effectiveRoot(): string {\n const value = this.scope.getSnapshot().value?.[ROOT_FIELD]\n return typeof value === 'string' ? value : ''\n }\n\n private project(): CardState {\n const snapshot = this.scope.getSnapshot()\n const draft = this.draft ?? this.effectiveRoot()\n return {\n available: snapshot.status === 'ready',\n writable: snapshot.writable,\n rootDir: draft,\n // A staged edit answers for itself, so the override badge previews the\n // save rather than reporting a state the pending edit contradicts.\n overridden: this.draft !== undefined ? this.draft.trim() !== '' : this.storedRoot(),\n dirty: this.draft !== undefined && this.draft !== this.effectiveRoot(),\n saving: this.saving,\n failed: this.failed,\n groupSidebar: this.effectiveGroupSidebar(),\n groupingPending: this.groupingPending,\n }\n }\n\n /** Replace the snapshot reference and notify, only when the fact moved. */\n private store(next: CardState): void {\n if (next === this.snapshotValue) return\n this.snapshotValue = next\n for (const listener of this.listeners) listener()\n }\n\n private publish(): void {\n this.store(this.project())\n }\n}\n\n/** Yield until after the next paint (rAF), or a macrotask when rAF is absent (tests). */\nfunction yieldForPaint(): Promise<void> {\n return new Promise((resolve) => {\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => { resolve() })\n return\n }\n setTimeout(resolve, 0)\n })\n}\n","/**\n * The git-worktree card on the Plugins configuration tab: a collapsible row\n * whose header names the plugin over a one-line description of what its\n * settings govern, disclosing the storage-root control when open. The card\n * owns everything inside it — chrome, controls, and copy — per the keyed-slot\n * contract; the tab only dispatches it under the `git-worktree` namespace\n * key.\n *\n * Renders nothing while the namespace is unavailable: a deployment that did\n * not compose the host half shows no trace of the card. A stored root edit\n * takes effect live (the Host routes read the section source per request);\n * no data moves — worktrees already created stay where they are, and git\n * itself still lists and reuses them.\n *\n * @module git-worktree/client/GitWorktreeCard\n */\n\nimport { useState } from 'react'\nimport { IconChevronDownOutline14, IconLoadingOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { CardActions, CardStore } from './card-form.ts'\nimport css from './GitWorktreeCard.module.css'\n\n/** Props the renderer binds for the git-worktree settings card. */\nexport type GitWorktreeCardProps =\n PropsRuntime<'settings.plugin.item'>\n & PropsLocale<'git-worktree'>\n & InjectFace<GitWorktreeCardFace>\n\n/** The registration-side face this card's slot entry injects. */\nexport interface GitWorktreeCardFace extends CardActions {\n hooks: {\n /** Card snapshot bound by the renderer as useGitWorktreeCard. */\n gitWorktreeCard: CardStore\n }\n /**\n * The shell's native directory picker (the workspace flows' chooser):\n * resolves the chosen absolute path, or null when the user dismisses the\n * dialog.\n */\n pickDirectory: () => Promise<string | null>\n}\n\n/**\n * Render the git-worktree settings card.\n * @param props - locale copy, the card snapshot, and its form actions.\n * @returns the card, or nothing when the namespace is unavailable.\n */\nexport function GitWorktreeCard(props: GitWorktreeCardProps) {\n const [open, setOpen] = useState(false)\n const [picking, setPicking] = useState(false)\n const { t } = props\n const state = props.useGitWorktreeCard(snapshot => snapshot)\n if (!state.available) return null\n const lockInput = !state.writable\n const lockActions = !state.dirty || state.saving\n\n /**\n * Open the shell's native folder dialog and stage the chosen path — the\n * same picker the workspace flows use, driven through the injected\n * workspace service. A dismissal leaves the staged draft exactly as it\n * was; the text input stays the fallback either way.\n */\n const browse = async (): Promise<void> => {\n if (picking || lockInput) return\n setPicking(true)\n try {\n const picked = await props.pickDirectory()\n if (picked !== null && picked !== '') props.editRoot(picked)\n } catch (_pickFailure) {\n // Leave the draft untouched; typing the path remains available.\n } finally {\n setPicking(false)\n }\n }\n\n return (\n <li className={open ? `${css.card} ${css.cardOpen}` : css.card}>\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n aria-label={`${t(open ? 'cardCollapse' : 'cardExpand')}: ${t('cardTitle')}`}\n onClick={() => { setOpen(!open) }}\n >\n <span className={css.headText}>\n <span className={css.name}>{t('cardTitle')}</span>\n <span className={css.description}>{t('cardDescription')}</span>\n </span>\n {state.dirty ? <span className={css.pending}>{t('cardUnsaved')}</span> : null}\n <IconChevronDownOutline14 className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron} />\n </button>\n {open\n ? (\n <div className={css.body}>\n {!state.writable ? <p className={css.note} role=\"status\">{t('cardReadOnly')}</p> : null}\n <label className={css.field} htmlFor=\"git-worktree-card-root-dir\">\n <span className={css.fieldLabel}>{t('cardRootDirLabel')}</span>\n <span className={css.inputRow}>\n <input\n id=\"git-worktree-card-root-dir\"\n className={css.input}\n type=\"text\"\n spellCheck={false}\n value={state.rootDir}\n disabled={lockInput}\n onChange={event => { props.editRoot(event.target.value) }}\n />\n <button\n type=\"button\"\n className={css.browse}\n disabled={lockInput || picking}\n onClick={() => { void browse() }}\n >\n {t(picking ? 'cardPicking' : 'cardBrowse')}\n </button>\n </span>\n </label>\n <p className={css.hint}>\n {t('cardRootDirHint')}\n {state.overridden ? ` ${t('cardOverridden')}` : ''}\n </p>\n <label className={`${css.field} ${css.toggleRow}`} aria-busy={state.groupingPending}>\n <span className={css.toggleText}>\n <span className={css.toggleLabel}>\n {t('cardGroupSidebarLabel')}\n <span className={css.toggleMark}>{t('cardGroupSidebarMark')}</span>\n </span>\n <span className={css.toggleHint}>{t('cardGroupSidebarHint')}</span>\n <span className={css.toggleNote}>{t('cardGroupSidebarNote')}</span>\n </span>\n <span className={css.toggleControl}>\n {state.groupingPending\n ? (\n <span className={css.spinner} role=\"status\" aria-label={t('cardGroupSidebarBusy')}>\n <IconLoadingOutline16 size={14} />\n </span>\n )\n : null}\n <input\n className={css.toggle}\n type=\"checkbox\"\n disabled={lockInput || state.groupingPending}\n checked={state.groupSidebar}\n onChange={event => { props.setGroupSidebar(event.target.checked) }}\n />\n </span>\n </label>\n <div className={css.footer}>\n {state.failed\n ? <p className={css.failed} role=\"status\">{t('cardSaveFailed')}</p>\n : null}\n <button\n type=\"button\"\n className={css.discard}\n disabled={lockActions}\n onClick={props.discard}\n >\n {t('cardDiscard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={lockActions}\n onClick={props.save}\n >\n {t(state.saving ? 'cardSaving' : 'cardSave')}\n </button>\n </div>\n </div>\n )\n : null}\n </li>\n )\n}\n","/**\n * Pure derivation of the grouped sidebar list: which workspaces form one\n * repository group, what each member row is called, and which sessions a row\n * shows. No React, no store, no network — the component layer feeds it\n * snapshots (workspace items, the /group facts, the session list) and renders\n * what comes out. Grouping is fully DERIVED from the workspace registry plus\n * on-disk git facts: no relationship is stored anywhere.\n *\n * Shapes are structural minimums (not the runtime service types) so the\n * derivation unit-tests without a client runtime.\n *\n * @module git-worktree/client/sidebar-groups\n */\n\nimport type { WorkspaceGitFacts } from '../wire.ts'\n\n/** User interaction currently blocking a session (sidebar amber-dot state). */\nexport type PendingInteraction = 'approval' | 'plan-review' | 'question'\n\n/** The workspace facts the derivation needs (a subset of WorkspaceView). */\nexport interface WorkspaceLike {\n readonly workspaceId: string\n /** Absolute registered directory — the /group probe key. */\n readonly path: string\n readonly title: string\n readonly sessionIds: readonly string[]\n /** ISO-8601 creation instant (HoverCard); absent while the snapshot omits it. */\n readonly createdAt?: string\n}\n\n/** The session facts the visible-row rule needs (a subset of SessionSummary). */\nexport interface SessionLike {\n readonly id: string\n readonly displayTitle: string\n readonly blank: boolean\n /** `'subagent'` rows never show in the browser (native rule). */\n readonly origin?: string\n /** Parent of a subagent row; feeds descendant running-count. */\n readonly parentId?: string\n /** Directory the session is bound to (search workspace-label fallback). */\n readonly cwd?: string\n /** Whether the session is running (the sidebar's active dot). */\n readonly running?: boolean\n /** Finished while unopened (the sidebar's completed dot); absent = false. */\n readonly completed?: boolean\n /** Epoch ms of last activity (relative time + recency sort). */\n readonly updatedAt?: number\n /** User interaction currently blocking this session. */\n readonly pendingInteraction?: PendingInteraction\n}\n\n/** Minimal session-list snapshot the visibility rule reads. */\nexport interface SessionListLike {\n readonly ids: readonly string[]\n readonly byId: Readonly<Record<string, SessionLike | undefined>>\n readonly current: string | undefined\n /** Arrival lifecycle; `ready` means an empty list is truly empty. */\n readonly phase?: string\n}\n\n/** One top-level session row in a group or the flat list (native SessionNode). */\nexport interface SessionNode {\n readonly id: string\n readonly title: string\n readonly blank: boolean\n readonly running: boolean\n readonly runningSubagentCount: number\n readonly completed: boolean\n readonly updatedAt: number\n readonly pendingInteraction?: PendingInteraction\n}\n\n/** Descendant totals keyed by possible parent id. */\nexport interface SubagentRunning {\n readonly count: number\n readonly runningCount: number\n}\n\n/** Grouping mode persisted in the local view prefs. */\nexport type SidebarGroupBy = 'workspace' | 'flat'\n/** Ordering mode persisted in the local view prefs. */\nexport type SidebarOrderBy = 'manual' | 'updated'\n\n/** Browser-local view prefs (not the native `dsh.workspace.view.v5` store). */\nexport interface SidebarViewPrefs {\n readonly groupBy: SidebarGroupBy\n readonly orderBy: SidebarOrderBy\n}\n\n/** How one member row is labelled. */\nexport type MemberLabel =\n /** Plain row: single-member (degraded) or non-git workspace — native look. */\n | { readonly type: 'plain' }\n /** Main-worktree member of a multi-member group. */\n | { readonly type: 'main'; readonly branch: string | null }\n /** Linked-worktree member of a multi-member group. */\n | { readonly type: 'linked'; readonly branch: string | null }\n\n/** One workspace row inside a group. */\nexport interface SidebarMember {\n readonly workspace: WorkspaceLike\n readonly label: MemberLabel\n}\n\n/** One rendered group: a repository cluster, or a single plain row. */\nexport interface SidebarGroup {\n /** Stable expansion-storage key: `repo:<repoRoot>` or `ws:<workspaceId>`. */\n readonly key: string\n readonly kind: 'repo' | 'single'\n /** Repository basename (repo groups only). */\n readonly repoName: string | undefined\n readonly members: readonly SidebarMember[]\n}\n\n/**\n * Derive the sidebar groups.\n *\n * Rules (the shipped design): git facts absent/null → plain single row;\n * same-`repoRoot` workspaces cluster into one repo group; inside a group the\n * main worktree leads and linked members keep registry order; a repo cluster\n * with exactly ONE member degrades to a plain row (zero visual intrusion for\n * repositories without worktrees); a group renders where its FIRST member\n * sits in the registry order (the main worktree's slot).\n * @param items - workspace list items in registry order.\n * @param facts - per-path git facts from the /group route (absent = unknown).\n * @returns groups in render order.\n */\nexport function deriveSidebarGroups(\n items: readonly WorkspaceLike[],\n facts: Readonly<Record<string, WorkspaceGitFacts | null>> | undefined,\n): readonly SidebarGroup[] {\n // Bucket git workspaces by repoRoot; keep first-seen registry index per\n // bucket for the group's render slot, and member order inside it.\n const bucketOrder: string[] = []\n const buckets = new Map<string, { index: number; mainSeen: boolean; members: SidebarMember[] }>()\n const singles: { index: number; group: SidebarGroup }[] = []\n\n items.forEach((workspace, index) => {\n const pathFacts = facts?.[workspace.path]\n if (pathFacts === undefined || pathFacts === null) {\n singles.push({ index, group: singleGroup(workspace) })\n return\n }\n const bucketKey = `repo:${pathFacts.repoRoot}`\n let bucket = buckets.get(bucketKey)\n if (bucket === undefined) {\n bucket = { index, mainSeen: false, members: [] }\n buckets.set(bucketKey, bucket)\n bucketOrder.push(bucketKey)\n }\n bucket.members.push({\n workspace,\n label: pathFacts.main\n ? { type: 'main', branch: pathFacts.branch }\n : { type: 'linked', branch: pathFacts.branch },\n })\n if (pathFacts.main) bucket.mainSeen = true\n })\n\n // Materialize repo groups: multi-member keep the cluster (main leads);\n // single-member degrade to plain. Re-derive per-bucket main ordering here\n // where every member is known.\n const repoGroups = new Map<string, SidebarGroup>()\n for (const key of bucketOrder) {\n const bucket = buckets.get(key)\n if (bucket === undefined) continue\n const ordered = bucket.mainSeen\n ? [...bucket.members].sort((a, b) => Number(b.label.type === 'main') - Number(a.label.type === 'main'))\n : bucket.members\n const first = ordered[0]\n // A bucket exists only because a member created it, so `first` always\n // resolves; the guard merely satisfies noUncheckedIndexedAccess.\n if (first === undefined) continue\n const repoName = facts?.[first.workspace.path]?.repoName ?? first.workspace.title\n if (ordered.length === 1) {\n singles.push({ index: bucket.index, group: singleGroup(first.workspace) })\n continue\n }\n repoGroups.set(key, { key, kind: 'repo', repoName, members: ordered })\n }\n\n // Render order: interleave by the slot each group claimed.\n const slots: { index: number; group: SidebarGroup }[] = [\n ...singles,\n ...[...repoGroups.values()].map(group => {\n const bucket = buckets.get(group.key)\n return { index: bucket?.index ?? Number.MAX_SAFE_INTEGER, group }\n }),\n ]\n slots.sort((a, b) => a.index - b.index)\n return slots.map(slot => slot.group)\n}\n\n/** A plain single-row group for one workspace. */\nfunction singleGroup(workspace: WorkspaceLike): SidebarGroup {\n return {\n key: `ws:${workspace.workspaceId}`,\n kind: 'single',\n repoName: undefined,\n members: [{ workspace, label: { type: 'plain' } }],\n }\n}\n\n/**\n * Session ids a member row shows, in the workspace's stored order — the\n * native browser's visibility rule: archived hidden everywhere, subagent\n * rows never listed, and a blank row visible only while it IS the current\n * selection (a blank is the provisional New Session row).\n * @param workspace - the member's workspace.\n * @param sessions - session list snapshot.\n * @param archivedSessionIds - registry-global archive set.\n * @returns visible session ids in stored order.\n */\nexport function visibleSessionIds(\n workspace: WorkspaceLike,\n sessions: SessionListLike,\n archivedSessionIds: readonly string[],\n): readonly string[] {\n const archived = new Set(archivedSessionIds)\n const visible: string[] = []\n for (const sessionId of workspace.sessionIds) {\n const summary = sessions.byId[sessionId]\n if (summary === undefined) continue\n if (summary.origin === 'subagent') continue\n if (archived.has(sessionId)) continue\n if (summary.blank && sessionId !== sessions.current) continue\n visible.push(sessionId)\n }\n return visible\n}\n\n/** localStorage key of the sidebar expansion map (browser-local only). */\nexport const EXPAND_STORAGE_KEY = 'dsh-git-worktree.sidebar.expand'\n\n/** Read the persisted expansion map; unreadable/absent answers {}. */\nexport function loadExpandState(): Record<string, boolean> {\n if (typeof localStorage === 'undefined') return {}\n try {\n const raw = localStorage.getItem(EXPAND_STORAGE_KEY)\n if (raw === null) return {}\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return {}\n const out: Record<string, boolean> = {}\n for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {\n if (typeof value === 'boolean') out[key] = value\n }\n return out\n } catch {\n return {}\n }\n}\n\n/** Persist the expansion map; write failures (quota, privacy mode) stay silent. */\nexport function saveExpandState(state: Record<string, boolean>): void {\n if (typeof localStorage === 'undefined') return\n try {\n localStorage.setItem(EXPAND_STORAGE_KEY, JSON.stringify(state))\n } catch {\n // A collapsed group is a fine failure mode.\n }\n}\n\n/** localStorage key of grouping/order prefs (browser-local; P3 may graduate to store v5). */\nexport const VIEW_STORAGE_KEY = 'dsh-git-worktree.sidebar.view'\n\nconst DEFAULT_VIEW_PREFS: SidebarViewPrefs = { groupBy: 'workspace', orderBy: 'updated' }\n\n/** Read persisted view prefs; unreadable/absent answers native defaults. */\nexport function loadViewPrefs(): SidebarViewPrefs {\n if (typeof localStorage === 'undefined') return DEFAULT_VIEW_PREFS\n try {\n const raw = localStorage.getItem(VIEW_STORAGE_KEY)\n if (raw === null) return DEFAULT_VIEW_PREFS\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return DEFAULT_VIEW_PREFS\n const record = parsed as Record<string, unknown>\n const groupBy = record.groupBy === 'flat' || record.groupBy === 'workspace' ? record.groupBy : DEFAULT_VIEW_PREFS.groupBy\n const orderBy = record.orderBy === 'manual' || record.orderBy === 'updated' ? record.orderBy : DEFAULT_VIEW_PREFS.orderBy\n return { groupBy, orderBy }\n } catch {\n return DEFAULT_VIEW_PREFS\n }\n}\n\n/** Persist view prefs; write failures stay silent. */\nexport function saveViewPrefs(prefs: SidebarViewPrefs): void {\n if (typeof localStorage === 'undefined') return\n try {\n localStorage.setItem(VIEW_STORAGE_KEY, JSON.stringify(prefs))\n } catch {\n // Default grouping is a fine failure mode.\n }\n}\n\n/** Recency comparator: newest first, id as the deterministic tiebreak. */\nexport function byRecency(a: { id: string; updatedAt: number }, b: { id: string; updatedAt: number }): number {\n if (b.updatedAt !== a.updatedAt) return b.updatedAt - a.updatedAt\n return a.id < b.id ? -1 : 1\n}\n\n/**\n * Index running/total subagent descendants under each ancestor reached through\n * an uninterrupted subagent-origin chain (ordinary forks terminate propagation).\n * Mirrors `indexSubagentDescendants` without importing the runtime bundle.\n */\nexport function indexSubagentRunning(\n byId: Readonly<Record<string, SessionLike | undefined>>,\n): ReadonlyMap<string, SubagentRunning> {\n const out = new Map<string, { count: number; runningCount: number }>()\n const bump = (id: string, running: boolean): void => {\n const cur = out.get(id) ?? { count: 0, runningCount: 0 }\n out.set(id, { count: cur.count + 1, runningCount: cur.runningCount + (running ? 1 : 0) })\n }\n for (const summary of Object.values(byId)) {\n if (summary === undefined || summary.origin !== 'subagent') continue\n const running = summary.running === true\n const seen = new Set<string>()\n let parentId = summary.parentId\n while (parentId !== undefined && parentId !== '' && !seen.has(parentId)) {\n seen.add(parentId)\n bump(parentId, running)\n const parent = byId[parentId]\n if (parent === undefined || parent.origin !== 'subagent') break\n parentId = parent.parentId\n }\n }\n return out\n}\n\n/** A blank session's canonical title never enters search; the renderer localizes the label. */\nexport function sessionTitle(session: SessionLike): string {\n return session.blank ? 'New Session' : session.displayTitle\n}\n\n/** Project a list-row summary into a renderable session node. */\nexport function sessionNode(\n session: SessionLike,\n descendants: ReadonlyMap<string, SubagentRunning>,\n): SessionNode {\n return {\n id: session.id,\n title: sessionTitle(session),\n blank: session.blank,\n running: session.running === true,\n runningSubagentCount: descendants.get(session.id)?.runningCount ?? 0,\n completed: session.completed === true,\n updatedAt: session.updatedAt ?? 0,\n ...session.pendingInteraction === undefined ? {} : { pendingInteraction: session.pendingInteraction },\n }\n}\n\n/** Visible session ids, optionally newest-first when `orderBy` is `updated`. */\nexport function orderedVisibleSessionIds(\n workspace: WorkspaceLike,\n sessions: SessionListLike,\n archivedSessionIds: readonly string[],\n orderBy: SidebarOrderBy,\n): readonly string[] {\n const ids = visibleSessionIds(workspace, sessions, archivedSessionIds)\n if (orderBy !== 'updated') return ids\n return [...ids].sort((a, b) => {\n const left = sessions.byId[a]\n const right = sessions.byId[b]\n return byRecency(\n { id: a, updatedAt: left?.updatedAt ?? Number.NEGATIVE_INFINITY },\n { id: b, updatedAt: right?.updatedAt ?? Number.NEGATIVE_INFINITY },\n )\n })\n}\n\n/**\n * Flat session list (\"In one list\"): every visible session as a top-level\n * row. `updated` is newest-first; `manual` keeps the session-list stored order.\n */\nexport function deriveFlat(\n list: SessionListLike,\n archivedSessionIds: readonly string[],\n orderBy: SidebarOrderBy = 'updated',\n): readonly SessionNode[] {\n const archived = new Set(archivedSessionIds)\n const descendants = indexSubagentRunning(list.byId)\n const rows: SessionLike[] = []\n for (const id of list.ids) {\n const summary = list.byId[id]\n if (summary === undefined) continue\n if (summary.origin === 'subagent') continue\n if (archived.has(id)) continue\n if (summary.blank && id !== list.current) continue\n rows.push(summary)\n }\n if (orderBy === 'updated') {\n rows.sort((a, b) => byRecency(\n { id: a.id, updatedAt: a.updatedAt ?? 0 },\n { id: b.id, updatedAt: b.updatedAt ?? 0 },\n ))\n }\n return rows.map(session => sessionNode(session, descendants))\n}\n","/**\n * Pure search / relative-time helpers transplanted from the native workspace\n * browser (`dsh-client-ui-workspace` lib/client.js). No React — the seat\n * component feeds snapshots and localizes the structured buckets.\n *\n * @module git-worktree/client/sidebar-search\n */\n\nimport {\n byRecency, indexSubagentRunning, sessionNode, sessionTitle,\n type SessionLike, type SessionListLike, type SessionNode, type WorkspaceLike,\n} from './sidebar-groups.ts'\n\n/** Pause between the latest keystroke and a Host content-search request. */\nexport const SEARCH_DEBOUNCE_MS = 250\n/** Session rows visible per Workspace before the local overflow control. */\nexport const COLLAPSED_SESSION_LIMIT = 5\n/** Column slide length: rail-search focus waits it out. */\nexport const EXPAND_SLIDE_MS = 300\n/** `session.search` wire bound, measured in JavaScript UTF-16 code units. */\nexport const SEARCH_QUERY_MAX_CODE_UNITS = 500\n/** Display label for the ungrouped bucket row. */\nexport const UNGROUPED_LABEL = 'Ungrouped'\n\n/** Relative-time bucket of a session row's trailing label. */\nexport type RelativeTimeUnit = 'now' | 'minutes' | 'hours' | 'days' | 'months' | 'years'\n/** Structured relative time: the bucket plus its magnitude (0 for 'now'). */\nexport interface RelativeTime {\n readonly unit: RelativeTimeUnit\n readonly n: number\n}\n\n/** One Host content-search hit (session id + excerpt). */\nexport interface ContentSearchHit {\n readonly sessionId: string\n readonly snippet: string\n}\n\n/** One flat search row combining list metadata with an optional content match. */\nexport interface SearchResultNode {\n readonly id: string\n readonly title: string\n readonly workspace: string\n readonly running: boolean\n readonly runningSubagentCount: number\n readonly completed: boolean\n readonly pendingInteraction?: SessionLike['pendingInteraction']\n readonly snippet?: string\n}\n\n/** Bounded merged search projection plus the refine-query hint bit. */\nexport interface SearchResultSet {\n readonly items: readonly SearchResultNode[]\n readonly hasMore: boolean\n}\n\n/**\n * Dictionary keys the time/hover labels consult. Declaring the vocabulary\n * (instead of a bare `string`) keeps the parameter CONTRAVARIANTLY\n * compatible with any bound namespace translate (`TranslateNS<N>` accepts a\n * superset — every key here must exist in the namespace's dictionary).\n */\nexport type SearchTranslateKey =\n | 'time.now'\n | 'time.minutes'\n | 'time.hours'\n | 'time.days'\n | 'time.months'\n | 'time.years'\n | 'time.ago'\n | 'hover.created'\n | 'date.ymd'\n\n/** Translate used by time/hover labels: accepts exactly the keys they consult. */\nexport type SearchTranslate = (key: SearchTranslateKey, params?: Record<string, unknown>) => string\n\n/**\n * Directory display label: basename of the path (both separators accepted).\n * Ungrouped-bucket fallback for surfaces without a workspace title.\n */\nexport function workspaceLabel(cwd: string | undefined): string {\n if (cwd === undefined || cwd === '') return UNGROUPED_LABEL\n const base = cwd.replace(/[/\\\\]+$/, '').split(/[/\\\\]/).pop()\n return base !== undefined && base !== '' ? base : cwd\n}\n\n/**\n * Keep controlled input and RPC payload inside the session.search wire\n * contract: strip NULs, cap at 500 UTF-16 code units, and never split a\n * surrogate pair at the cut.\n */\nexport function sanitizeSearchQuery(value: string): string {\n const withoutNul = value.replaceAll('\\0', '')\n if (withoutNul.length <= SEARCH_QUERY_MAX_CODE_UNITS) return withoutNul\n let end = SEARCH_QUERY_MAX_CODE_UNITS\n const last = withoutNul.charCodeAt(end - 1)\n const next = withoutNul.charCodeAt(end)\n if (last >= 0xD800 && last <= 0xDBFF && next >= 0xDC00 && next <= 0xDFFF) end -= 1\n return withoutNul.slice(0, end)\n}\n\n/**\n * Compact relative time for session rows, as a structured bucket the\n * renderer localizes (\"now\"/\"5min\"/\"3h\"/\"2d\"/\"4mo\"/\"1y\" in en).\n */\nexport function relativeTime(updatedAt: number, now: number): RelativeTime {\n const MIN = 60_000\n const HOUR = 3_600_000\n const DAY = 86_400_000\n const diff = Math.max(0, now - updatedAt)\n if (diff < MIN) return { unit: 'now', n: 0 }\n if (diff < HOUR) return { unit: 'minutes', n: Math.floor(diff / MIN) }\n if (diff < DAY) return { unit: 'hours', n: Math.floor(diff / HOUR) }\n if (diff < 30 * DAY) return { unit: 'days', n: Math.floor(diff / DAY) }\n if (diff < 365 * DAY) return { unit: 'months', n: Math.floor(diff / (30 * DAY)) }\n return { unit: 'years', n: Math.floor(diff / (365 * DAY)) }\n}\n\n/** Localized compact relative time (\"刚刚\"/\"5分钟\" in zh, \"now\"/\"5min\" in en). */\nexport function timeLabel(updatedAt: number, now: number, t: SearchTranslate): string {\n const { unit, n } = relativeTime(updatedAt, now)\n if (unit === 'now') return t('time.now')\n if (unit === 'minutes') return t('time.minutes', { n })\n if (unit === 'hours') return t('time.hours', { n })\n if (unit === 'days') return t('time.days', { n })\n if (unit === 'months') return t('time.months', { n })\n return t('time.years', { n })\n}\n\n/** Hover-card variant: distances wrap in the ago template; the now bucket stays bare. */\nexport function hoverTimeLabel(updatedAt: number, now: number, t: SearchTranslate): string {\n const { unit, n } = relativeTime(updatedAt, now)\n if (unit === 'now') return t('time.now')\n const compact = unit === 'minutes' ? t('time.minutes', { n })\n : unit === 'hours' ? t('time.hours', { n })\n : unit === 'days' ? t('time.days', { n })\n : unit === 'months' ? t('time.months', { n })\n : t('time.years', { n })\n return t('time.ago', { t: compact })\n}\n\n/**\n * Absolute creation time through the dictionary's date template (the message\n * clock pattern): `toLocaleString` would follow the browser language, not the\n * app locale.\n */\nexport function createdLabel(createdAt: number, t: SearchTranslate): string {\n const d = new Date(createdAt)\n const pad2 = (v: number): string => String(v).padStart(2, '0')\n return t('hover.created', {\n time: `${t('date.ymd', { y: d.getFullYear(), m: d.getMonth() + 1, d: d.getDate() })} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`,\n })\n}\n\n/** Ordinary sessions are visible; among blanks, only the current one. */\nfunction sessionVisible(session: SessionLike, current: string | undefined, archived: ReadonlySet<string>): boolean {\n return session.origin !== 'subagent' && !archived.has(session.id) && (!session.blank || session.id === current)\n}\n\n/**\n * Merge immediate title/Workspace substring matches with ranked Host content\n * matches. Local rows lead newest-first, content-only rows retain backend\n * order, and duplicate sessions receive the backend snippet in place.\n */\nexport function deriveSearchResults(\n list: SessionListLike,\n workspaces: readonly WorkspaceLike[],\n query: string,\n archivedSessionIds: readonly string[],\n content: { items: readonly ContentSearchHit[]; hasMore: boolean },\n limit: number,\n): SearchResultSet {\n const q = query.trim().toLowerCase()\n if (q === '') return { items: [], hasMore: false }\n const archived = new Set(archivedSessionIds)\n const descendants = indexSubagentRunning(list.byId)\n const workspaceBySession = new Map<string, string>()\n for (const workspace of workspaces) {\n for (const sessionId of workspace.sessionIds) {\n if (!workspaceBySession.has(sessionId)) workspaceBySession.set(sessionId, workspace.title)\n }\n }\n const labelOf = (summary: SessionLike): string => workspaceBySession.get(summary.id) ?? workspaceLabel(summary.cwd)\n const contentBySession = new Map<string, ContentSearchHit>()\n for (const item of content.items) {\n if (!contentBySession.has(item.sessionId)) contentBySession.set(item.sessionId, item)\n }\n const local: SessionLike[] = []\n for (const id of list.ids) {\n const summary = list.byId[id]\n if (summary === undefined || summary.blank || !sessionVisible(summary, list.current, archived)) continue\n if (sessionTitle(summary).toLowerCase().includes(q) || labelOf(summary).toLowerCase().includes(q)) local.push(summary)\n }\n local.sort((a, b) => byRecency(\n { id: a.id, updatedAt: a.updatedAt ?? 0 },\n { id: b.id, updatedAt: b.updatedAt ?? 0 },\n ))\n const ordered: SessionLike[] = []\n const included = new Set<string>()\n const include = (summary: SessionLike): void => {\n if (included.has(summary.id)) return\n included.add(summary.id)\n ordered.push(summary)\n }\n for (const summary of local) include(summary)\n for (const item of content.items) {\n const summary = list.byId[item.sessionId]\n if (summary !== undefined && !summary.blank && sessionVisible(summary, list.current, archived)) include(summary)\n }\n return {\n items: ordered.slice(0, limit).map((summary) => {\n const match = contentBySession.get(summary.id)\n const node = sessionNode(summary, descendants)\n return {\n id: node.id,\n title: node.title,\n workspace: labelOf(summary),\n running: node.running,\n runningSubagentCount: node.runningSubagentCount,\n completed: node.completed,\n ...summary.pendingInteraction === undefined ? {} : { pendingInteraction: summary.pendingInteraction },\n ...match === undefined ? {} : { snippet: match.snippet },\n }\n }),\n hasMore: content.hasMore || ordered.length > limit,\n }\n}\n\n/** Re-export SessionNode so search rows share the session status shape. */\nexport type { SessionNode }\n","/**\n * Workspace / session / search row components transplanted from the native\n * `Rows.js` (injected props, no ctx). Hover swaps (folder→chevron, time→⋯)\n * are CSS-only. Drag wiring is intentionally omitted — P3.\n *\n * @module git-worktree/client/sidebar-rows\n */\n\nimport { useState, type ReactNode } from 'react'\nimport {\n HoverCard, IconArchiveOutline20, IconBranchOutline16, IconEditOutline16,\n IconEllipsisOutline16, IconFolderClose16, IconFolderOpen16, IconPlusOutline16,\n IconTrashOutline16, IconTriangleRightFill14, Menu, StateDot,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { abbreviateHomePath } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionNode } from './sidebar-groups.ts'\nimport { createdLabel, hoverTimeLabel, timeLabel, type SearchResultNode } from './sidebar-search.ts'\nimport css from './sidebar-rows.module.css'\n\ntype Translate = PropsLocale<'git-worktree'>['t']\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter((part): part is string => typeof part === 'string' && part !== '').join(' ')\n}\n\n/** Row display title: blank rows show the localized New Session label. */\nfunction displayTitle(node: { blank: boolean; title: string }, t: Translate): string {\n return node.blank ? t('session.new') : node.title\n}\n\n/** Hover-card body: workspace title, display directory path, absolute creation time. */\nfunction WorkspaceHoverContent({ label, cwd, createdAt, t }: {\n label: string\n cwd: string | undefined\n createdAt: number\n t: Translate\n}): ReactNode {\n return (\n <div className={css.hoverContent}>\n <div className={css.hoverTitle}>{label}</div>\n <div className={css.hoverPath}>{cwd}</div>\n <div className={css.hoverTime}>{createdLabel(createdAt, t)}</div>\n </div>\n )\n}\n\n/** Facts a project (workspace / repo-head) row needs. */\nexport interface ProjectRowModel {\n readonly key: string\n readonly label: string\n readonly expanded: boolean\n readonly containsCurrent: boolean\n readonly cwd?: string\n readonly createdAt?: number\n}\n\n/**\n * Project (workspace) header row: folder + title; hover reveals the chevron\n * and create button. `containsCurrent` is a derivation fact (no renderer scan).\n * Drag wiring is not transplanted (P3 — `useNativeDragAcceptance` stays vacant).\n */\nexport function ProjectRowItem({ row, onToggle, onCreate, actions, home, t, badge }: {\n row: ProjectRowModel\n onToggle: () => void\n onCreate?: () => void\n actions?: { rename: () => void; delete: () => void }\n home?: string | undefined\n t: Translate\n /** Aggregation-only count badge (repo group heads). */\n badge?: string\n}): ReactNode {\n const active = row.expanded && row.containsCurrent\n const [menuOpen, setMenuOpen] = useState(false)\n const workspaceMenuItems = [\n { id: 'rename', label: t('rename'), icon: <IconEditOutline16 /> },\n { id: 'delete', label: t('delete.workspace'), icon: <IconTrashOutline16 />, danger: true },\n ]\n const ownRow = (\n <div\n className={cx(css.projectRow, menuOpen && css.menuOpen)}\n role=\"treeitem\"\n aria-expanded={row.expanded}\n onClick={onToggle}\n >\n <span className={cx(css.slot, css.folder, active && css.folderActive)}>\n {row.expanded ? <IconFolderOpen16 /> : <IconFolderClose16 />}\n </span>\n <span className={cx(css.slot, css.chevron)}>\n <IconTriangleRightFill14 className={cx(css.arrow, row.expanded && css.arrowOpen)} />\n </span>\n <span className={css.projectText}>\n <span className={css.title}>{row.label}</span>\n </span>\n {badge !== undefined ? <span className={css.repoCount}>{badge}</span> : null}\n <span className={css.rowActions}>\n {actions !== undefined && (\n <Menu\n open={menuOpen}\n onClose={() => { setMenuOpen(false) }}\n items={workspaceMenuItems}\n onSelect={(id) => {\n setMenuOpen(false)\n if (id !== 'rename' && id !== 'delete') return\n if (id === 'rename') actions.rename()\n else actions.delete()\n }}\n portal\n closeOnPointerLeave\n anchor={(\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.workspace.aria', { name: row.label })}\n onClick={(e) => {\n e.stopPropagation()\n setMenuOpen(v => !v)\n }}\n >\n <IconEllipsisOutline16 />\n </button>\n )}\n />\n )}\n {onCreate !== undefined && (\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.newSession.aria', { name: row.label })}\n onClick={(e) => {\n e.stopPropagation()\n onCreate()\n }}\n >\n <IconPlusOutline16 />\n </button>\n )}\n </span>\n </div>\n )\n if (row.createdAt === undefined) return ownRow\n return (\n <HoverCard\n anchor={ownRow}\n content={(\n <WorkspaceHoverContent\n label={row.label}\n cwd={row.cwd === undefined ? undefined : abbreviateHomePath(row.cwd, home)}\n createdAt={row.createdAt}\n t={t}\n />\n )}\n disabled={menuOpen}\n copyText={row.cwd}\n copyLabel={t('copy')}\n copiedLabel={t('hover.copied')}\n />\n )\n}\n\nfunction assertNever(value: never): never {\n throw new Error(`unknown pending interaction: ${String(value)}`)\n}\n\n/** Session status presentation; pending interaction is primary and live activity outranks completion. */\nexport function sessionStatuses(node: {\n pendingInteraction?: SessionNode['pendingInteraction']\n running: boolean\n runningSubagentCount: number\n completed: boolean\n}, t: Translate): ReadonlyArray<{ state: 'done' | 'warning' | 'ongoing'; label: string }> {\n const subagents = node.runningSubagentCount === 0 ? undefined : {\n state: 'ongoing' as const,\n label: t(node.runningSubagentCount === 1 ? 'status.subagentsRunning.one' : 'status.subagentsRunning.other', { n: node.runningSubagentCount }),\n }\n let pending: { state: 'warning'; label: string } | undefined\n switch (node.pendingInteraction) {\n case 'approval':\n pending = { state: 'warning', label: t('status.waitingApproval') }\n break\n case 'plan-review':\n pending = { state: 'warning', label: t('status.planReview') }\n break\n case 'question':\n pending = { state: 'warning', label: t('status.waitingAnswer') }\n break\n case undefined:\n break\n default:\n return assertNever(node.pendingInteraction)\n }\n if (pending !== undefined) return subagents === undefined ? [pending] : [pending, subagents]\n if (node.running) {\n const primary = { state: 'ongoing' as const, label: t('status.running') }\n return subagents === undefined ? [primary] : [primary, subagents]\n }\n if (subagents !== undefined) return [subagents]\n if (node.completed) return [{ state: 'done', label: t('status.completed') }]\n return [{ state: 'done', label: t('status.idle') }]\n}\n\n/** Primary status dot plus every status's screen-reader label. */\nfunction SessionStatusDots({ statuses }: { statuses: ReturnType<typeof sessionStatuses> }): ReactNode {\n const primary = statuses[0]\n if (primary === undefined) return null\n return (\n <>\n <StateDot state={primary.state} />\n {statuses.map(status => (\n <span key={status.label} className={css.visuallyHidden}>{status.label}</span>\n ))}\n </>\n )\n}\n\n/** Hover-card body: full title, relative time, and every relevant live status. */\nfunction SessionHoverContent({ node, now, t }: { node: SessionNode; now: number; t: Translate }): ReactNode {\n const statuses = sessionStatuses(node, t)\n return (\n <div className={css.hoverContent}>\n <div className={css.hoverTitle}>{displayTitle(node, t)}</div>\n {!node.blank && <div className={css.hoverTime}>{hoverTimeLabel(node.updatedAt, now, t)}</div>}\n {statuses.map(status => (\n <div key={status.label} className={css.hoverStatus}>\n <StateDot state={status.state} />\n <span>{status.label}</span>\n </div>\n ))}\n </div>\n )\n}\n\n/** One flat search result: title, Workspace context, and optional content excerpt. */\nexport function SearchResultItem({ result, currentId, onOpen, t }: {\n result: SearchResultNode\n currentId: string | undefined\n onOpen: (id: string) => void\n t: Translate\n}): ReactNode {\n const selected = result.id === currentId\n const statuses = sessionStatuses(result, t)\n const primaryStatus = statuses[0]\n return (\n <button\n type=\"button\"\n className={cx(css.searchResultRow, selected && css.selected)}\n role=\"treeitem\"\n aria-selected={selected}\n onClick={() => { onOpen(result.id) }}\n >\n <span className={css.searchResultHeading}>\n <span className={css.slot}>\n {primaryStatus !== undefined && (primaryStatus.state !== 'done' || result.completed) && (\n <SessionStatusDots statuses={statuses} />\n )}\n </span>\n <span className={css.searchResultTitle}>{result.title}</span>\n </span>\n <span className={css.searchResultMeta}>\n <span className={css.searchResultWorkspace}>{result.workspace}</span>\n {result.snippet !== undefined && (\n <span className={css.searchResultSnippet}>{result.snippet}</span>\n )}\n </span>\n </button>\n )\n}\n\n/**\n * One 32px session row: status dot, title, relative time, hover ⋯ menu.\n * Drag wiring is not transplanted (P3).\n */\nexport function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, flat = false, t }: {\n node: SessionNode\n currentId: string | undefined\n now: number\n onOpen: (id: string) => void\n onRename: (id: string, currentTitle: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n flat?: boolean\n t: Translate\n}): ReactNode {\n const title = displayTitle(node, t)\n const selected = node.id === currentId\n const statuses = sessionStatuses(node, t)\n const showStatus = (statuses[0]?.state !== 'done') || node.completed\n const [menuOpen, setMenuOpen] = useState(false)\n const sessionMenuItems = [\n { id: 'rename', label: t('rename'), icon: <IconEditOutline16 /> },\n { id: 'fork', label: t('menu.fork'), icon: <IconBranchOutline16 /> },\n { id: 'archive', label: t('menu.archiveSession'), icon: <IconArchiveOutline20 size={16} /> },\n ]\n return (\n <HoverCard\n anchor={(\n <div\n className={cx(\n css.sessionRow,\n selected && css.selected,\n menuOpen && css.menuOpen,\n flat && !showStatus && css.flatSessionRowWithoutStatus,\n )}\n role=\"treeitem\"\n aria-selected={selected}\n onClick={() => { onOpen(node.id) }}\n >\n {(!flat || showStatus) && (\n <span className={css.slot}>\n {showStatus && <SessionStatusDots statuses={statuses} />}\n </span>\n )}\n <span className={css.title}>{title}</span>\n {!node.blank && <span className={css.time}>{timeLabel(node.updatedAt, now, t)}</span>}\n {!node.blank && (\n <span className={css.rowActions}>\n <Menu\n open={menuOpen}\n onClose={() => { setMenuOpen(false) }}\n items={sessionMenuItems}\n onSelect={(id) => {\n setMenuOpen(false)\n if (id === 'rename') onRename(node.id, node.title)\n if (id === 'fork') onFork(node.id)\n if (id === 'archive') onArchive(node.id)\n }}\n portal\n closeOnPointerLeave\n anchor={(\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.session.aria', { name: title })}\n onClick={(e) => {\n e.stopPropagation()\n setMenuOpen(v => !v)\n }}\n >\n <IconEllipsisOutline16 />\n </button>\n )}\n />\n </span>\n )}\n </div>\n )}\n content={<SessionHoverContent node={node} now={now} t={t} />}\n disabled={menuOpen}\n copyText={node.blank ? undefined : node.title}\n copyLabel={t('copy')}\n copiedLabel={t('hover.copied')}\n />\n )\n}\n","/**\n * The add-workspace pick flow's orchestration core, isolated from React so\n * the dialog's EDGE-TRIGGERED start and its in-flight invalidation are\n * unit-testable without a DOM: the component syncs the open flag and\n * refreshes the hooks each render, and neither re-render nor unmount can\n * re-launch the OS directory chooser behind the user's back.\n *\n * @module git-worktree/client/pick-flow\n */\n\n/** What a run needs from its host; refreshed on every render via {@link PickFlowController.attach}. */\nexport interface PickFlowHooks {\n /** Opens the OS directory chooser; `null`/empty means the user cancelled. */\n readonly pickDirectory: () => Promise<string | null>\n /** Registers the chosen directory as a workspace. */\n readonly createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n /** The chosen directory became a workspace. */\n readonly onPicked: (workspaceId: string) => void\n /** The user dismissed the chooser; the dialog simply closes. */\n readonly onCancelled: () => void\n /** pick/create rejected; the caller surfaces the message (and closes). */\n readonly onFailed: (message: string) => void\n}\n\n/**\n * Edge-triggered controller for one add-workspace flow.\n *\n * `sync(open)` mirrors the dialog's open flag: only a RISING edge (closed →\n * open) starts a pick — re-syncing `true` while a run is live is a no-op, so\n * the parent's re-renders (fresh inline callbacks and all) can never\n * re-launch the chooser or drop a finished pick the way an effect keyed on\n * unstable function deps would. A falling edge invalidates any in-flight\n * run: its eventual result is discarded without a callback. `kill()` is the\n * permanent teardown — nothing fires after it.\n */\nexport class PickFlowController {\n private hooks: PickFlowHooks | undefined\n private started = false\n private epoch = 0\n\n /** Refresh the callbacks to the latest render's closures; never restarts a run. */\n attach(hooks: PickFlowHooks): void {\n this.hooks = hooks\n }\n\n /** Sync with the dialog's open flag (see the class doc for the edge semantics). */\n sync(open: boolean): void {\n if (open) {\n if (this.started) return\n this.started = true\n this.epoch += 1\n void this.run(this.epoch)\n return\n }\n // Closing (or staying closed) invalidates whatever is in flight.\n this.epoch += 1\n this.started = false\n }\n\n /** Permanent teardown (unmount): no callback fires afterwards. */\n kill(): void {\n this.epoch += 1\n this.started = false\n }\n\n private async run(token: number): Promise<void> {\n const hooks = this.hooks\n if (hooks === undefined) return\n let path: string | null\n try {\n path = await hooks.pickDirectory()\n } catch (reason) {\n if (token === this.epoch) hooks.onFailed(messageOf(reason))\n return\n }\n if (token !== this.epoch) return\n if (path === null || path === '') {\n hooks.onCancelled()\n return\n }\n let workspace: { workspaceId: string }\n try {\n workspace = await hooks.createWorkspace({ path })\n } catch (reason) {\n if (token === this.epoch) hooks.onFailed(messageOf(reason))\n return\n }\n if (token !== this.epoch) return\n hooks.onPicked(workspace.workspaceId)\n }\n}\n\n/** Error text for a rejection of any shape. */\nfunction messageOf(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason)\n}\n","/**\n * GroupedSidebar: the `sidebar.workspaces` seat occupant. P1 aggregation\n * (same-repository workspaces clustered from /group facts) plus a 1:1\n * transplant of the native workspace browser's search, menus, status dots,\n * relative time, view options, rail, and dialogs.\n *\n * Drag-reorder and the native `dsh.workspace.view.v5` store are P3. Adding a\n * workspace uses `workspaces.pickDirectory` rather than re-declaring the\n * `sidebar.workspaces.directoryFlow` child hole (native already declared it;\n * a second declarer throws).\n *\n * @module git-worktree/client/GroupedSidebar\n */\n\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { SessionListState, SnapshotStore, WorkspaceListState } from '@deepseek-ai/dsh-client-runtime/client'\nimport {\n Button, IconCloseFill14, IconPersonalizationOutline16, IconProjectAddOutline16,\n IconSearchOutline16, Menu, Modal, Tooltip,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { OwnerOf, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { WorkspaceGitFacts } from '../wire.ts'\nimport {\n deriveFlat, deriveSidebarGroups, indexSubagentRunning, loadExpandState, loadViewPrefs,\n orderedVisibleSessionIds, saveExpandState, saveViewPrefs, sessionNode,\n type SessionListLike, type SessionNode, type SidebarGroup, type SidebarGroupBy,\n type SidebarMember, type SidebarOrderBy, type WorkspaceLike,\n} from './sidebar-groups.ts'\nimport {\n COLLAPSED_SESSION_LIMIT, EXPAND_SLIDE_MS, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MAX_CODE_UNITS,\n deriveSearchResults, sanitizeSearchQuery, type ContentSearchHit,\n} from './sidebar-search.ts'\nimport { ProjectRowItem, SearchResultItem, SessionNodeItem } from './sidebar-rows.tsx'\nimport { PickFlowController } from './pick-flow.ts'\nimport css from './GroupedSidebar.module.css'\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter((part): part is string => typeof part === 'string' && part !== '').join(' ')\n}\n\n/** Observable snapshot (getSnapshot + subscribe) used for host description / flow occupancy. */\nexport interface SidebarObservable<T> {\n readonly getSnapshot: () => T\n readonly subscribe: (listener: () => void) => () => void\n}\n\n/** The business face this entry injects; the component never touches ctx. */\nexport interface GroupedSidebarInjected {\n readonly workspacesList: Pick<SnapshotStore<WorkspaceListState>, 'getSnapshot' | 'subscribe'>\n readonly sessionsList: Pick<SnapshotStore<SessionListState>, 'getSnapshot' | 'subscribe'>\n readonly openSession: (sessionId: string) => void\n readonly startSession: (workspaceId?: string) => void\n readonly loadFacts: (paths: readonly string[]) =>\n Promise<Readonly<Record<string, WorkspaceGitFacts | null>> | undefined>\n readonly searchSessions: (query: string, signal: AbortSignal) => Promise<{\n items: readonly ContentSearchHit[]\n hasMore: boolean\n }>\n readonly searchResultLimit: number\n readonly renameSession: (sessionId: string, title: string) => Promise<void>\n readonly forkSession: (sessionId: string) => void\n readonly renameWorkspace: (workspaceId: string, title: string) => Promise<void>\n readonly deleteWorkspace: (workspaceId: string) => Promise<void>\n readonly archiveSession: (sessionId: string) => Promise<void>\n readonly createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n readonly pickDirectory: () => Promise<string | null>\n readonly hostDescription: SidebarObservable<{ home?: string } | undefined>\n readonly directoryFlow: SidebarObservable<boolean>\n /**\n * First facts attempt of this mount has settled (ok or fail). The settings\n * card spinner waits on this so it does not hide while the tree still\n * looks like the native flat list.\n */\n readonly onReady?: () => void\n}\n\nexport type GroupedSidebarProps =\n PropsRuntime<'sidebar.workspaces'>\n & OwnerOf<'sidebar.workspaces'>\n & PropsLocale<'git-worktree'>\n & GroupedSidebarInjected\n\ntype FactsState = { signature: string; facts: Readonly<Record<string, WorkspaceGitFacts | null>> } | null\ntype Translate = PropsLocale<'git-worktree'>['t']\n\nfunction ViewOptionsMenu({ groupBy, orderBy, onGroupPick, onOrderPick, t }: {\n groupBy: SidebarGroupBy\n orderBy: SidebarOrderBy\n onGroupPick: (mode: SidebarGroupBy) => void\n onOrderPick: (mode: SidebarOrderBy) => void\n t: Translate\n}): ReactNode {\n const [open, setOpen] = useState(false)\n return (\n <Menu\n open={open}\n onClose={() => { setOpen(false) }}\n items={[\n { type: 'label', id: 'group-by', text: t('groupBy.label') },\n { id: 'workspace', label: t('groupBy.workspace') },\n { id: 'flat', label: t('groupBy.flat') },\n { type: 'separator', id: 'order-by-separator' },\n { type: 'label', id: 'order-by', text: t('orderBy.label') },\n { id: 'manual', label: t('orderBy.manual') },\n { id: 'updated', label: t('orderBy.updated') },\n ]}\n selectedIds={[groupBy, orderBy]}\n onSelect={(id) => {\n if (id === 'workspace' || id === 'flat') onGroupPick(id)\n else if (id === 'manual' || id === 'updated') onOrderPick(id)\n setOpen(false)\n }}\n align=\"end\"\n dense\n portal\n anchor={(\n <Tooltip label={t('viewOptions.label')} side=\"bottom\" delayMs={500}>\n <button\n type=\"button\"\n className={cx(css.iconButton, css.wide)}\n aria-label={t('viewOptions.label')}\n onClick={() => { setOpen(v => !v) }}\n >\n <IconPersonalizationOutline16 />\n </button>\n </Tooltip>\n )}\n />\n )\n}\n\n/** Add-workspace flow: OS directory picker (cannot redeclare native's directoryFlow hole). */\nfunction WorkspacePickFlow({ open, onClose, onRetry, pickDirectory, createWorkspace, onPick, t }: {\n open: boolean\n onClose: () => void\n onRetry: () => void\n pickDirectory: () => Promise<string | null>\n createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n onPick: (workspaceId: string) => void\n t: Translate\n}): ReactNode {\n const [errorOpen, setErrorOpen] = useState(false)\n const [modalError, setModalError] = useState<string | null>(null)\n // The controller is the flow's edge-triggered core: re-renders refresh the\n // hooks below but can never re-launch the chooser (only a closed→open edge\n // starts a run, and a falling edge/kill discards whatever is in flight).\n const controllerRef = useRef<PickFlowController | null>(null)\n const controller = controllerRef.current ?? (controllerRef.current = new PickFlowController())\n controller.attach({\n pickDirectory,\n createWorkspace,\n onPicked: onPick,\n onCancelled: onClose,\n onFailed: (message) => {\n setModalError(message)\n setErrorOpen(true)\n onClose()\n },\n })\n useEffect(() => { controller.sync(open) }, [open, controller])\n useEffect(() => () => { controller.kill() }, [controller])\n const closeModal = (): void => {\n setErrorOpen(false)\n setModalError(null)\n }\n return (\n <Modal\n open={errorOpen}\n onClose={closeModal}\n closeLabel={t('close')}\n title={t('folderError.title')}\n footer={(\n <>\n <Button variant=\"outline\" className={css.modalAction} onClick={closeModal}>{t('cancel')}</Button>\n <Button\n variant=\"primary\"\n className={css.modalAction}\n onClick={() => {\n closeModal()\n onRetry()\n }}\n >\n {t('folderError.retry')}\n </Button>\n </>\n )}\n >\n <div className={css.modalError} role=\"alert\">{modalError}</div>\n </Modal>\n )\n}\n\nfunction SearchResults({ list, workspaces, archivedSessionIds, query, remote, resultLimit, currentId, onOpen, t }: {\n list: SessionListLike\n workspaces: readonly WorkspaceLike[]\n archivedSessionIds: readonly string[]\n query: string\n remote: { query: string; status: 'idle' | 'loading' | 'ready' | 'error'; items: readonly ContentSearchHit[]; hasMore: boolean }\n resultLimit: number\n currentId: string | undefined\n onOpen: (id: string) => void\n t: Translate\n}): ReactNode {\n const currentRemote = remote.query === query ? remote : { query, status: 'loading' as const, items: [] as const, hasMore: false }\n const results = useMemo(\n () => deriveSearchResults(list, workspaces, query, archivedSessionIds, currentRemote, resultLimit),\n [list, workspaces, query, archivedSessionIds, currentRemote, resultLimit],\n )\n const pending = currentRemote.status === 'loading'\n const failed = currentRemote.status === 'error'\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={css.list}>\n <div className={css.searchTree} role=\"tree\" aria-label={t('search.results.aria')}>\n {results.items.map(result => (\n <SearchResultItem key={result.id} result={result} currentId={currentId} onOpen={onOpen} t={t} />\n ))}\n </div>\n {pending && <div className={css.searchStatus} role=\"status\">{t('search.pending')}</div>}\n {failed && <div className={css.searchWarning} role=\"status\">{t('search.unavailable')}</div>}\n {!pending && results.items.length === 0 && <div className={css.empty}>{t('search.noMatches')}</div>}\n {results.hasMore && <div className={css.searchStatus}>{t('search.hasMore', { n: resultLimit })}</div>}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction FlatListBody({ list, archivedSessionIds, orderBy, currentId, now, onOpen, onRename, onFork, onArchive, t }: {\n list: SessionListLike\n archivedSessionIds: readonly string[]\n orderBy: SidebarOrderBy\n currentId: string | undefined\n now: number\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n t: Translate\n}): ReactNode {\n const rows = useMemo(() => deriveFlat(list, archivedSessionIds, orderBy), [list, archivedSessionIds, orderBy])\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={cx(css.list, css.flatList)} role=\"tree\" aria-label={t('section.sessions')}>\n {rows.length === 0 && <div className={css.empty}>{t('empty.none')}</div>}\n {rows.map(node => (\n <SessionNodeItem\n key={node.id}\n node={node}\n currentId={currentId}\n now={now}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n flat\n t={t}\n />\n ))}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction memberLabel(member: SidebarMember, t: Translate): string {\n if (member.label.type === 'main') {\n return member.label.branch === null ? t('sidebarMain') : t('sidebarMainBranch', { branch: member.label.branch })\n }\n if (member.label.type === 'linked') {\n return member.label.branch ?? member.workspace.title\n }\n return member.workspace.title\n}\n\nfunction createdAtMs(createdAt: string | undefined): number | undefined {\n if (createdAt === undefined || createdAt === '') return undefined\n const parsed = Date.parse(createdAt)\n return Number.isNaN(parsed) ? undefined : parsed\n}\n\nfunction GroupedTree({ groups, sessions, archived, currentSessionId, expandMap, onToggle, expandTo, orderBy, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, startSession, t }: {\n groups: readonly SidebarGroup[]\n sessions: SessionListLike\n archived: readonly string[]\n currentSessionId: string | undefined\n expandMap: Record<string, boolean>\n onToggle: (key: string) => void\n expandTo: (key: string) => void\n orderBy: SidebarOrderBy\n now: number\n home: string | undefined\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n onWorkspaceRename: (workspaceId: string, title: string) => void\n onWorkspaceDelete: (workspaceId: string, title: string) => void\n startSession: (workspaceId?: string) => void\n t: Translate\n}): ReactNode {\n const descendants = useMemo(() => indexSubagentRunning(sessions.byId), [sessions.byId])\n const [expandedSessionGroups, setExpandedSessionGroups] = useState<string[]>([])\n const empty = groups.length === 0\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={css.list} role=\"tree\" aria-label={t('section.workspaces')}>\n {empty && <div className={css.empty}>{t('empty.none')}</div>}\n {groups.map((group) => {\n if (group.kind === 'repo') {\n const memberIds = group.members.map(member => orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy))\n const visibleCount = memberIds.reduce((sum, ids) => sum + ids.length, 0)\n const containsCurrent = group.members.some(member => member.workspace.sessionIds.includes(currentSessionId ?? '\\0'))\n const open = expandMap[group.key] ?? containsCurrent\n return (\n <div key={group.key} className={css.groupSection}>\n <ProjectRowItem\n row={{ key: group.key, label: group.repoName ?? group.key, expanded: open, containsCurrent }}\n onToggle={() => { onToggle(group.key) }}\n home={home}\n t={t}\n badge={String(visibleCount)}\n />\n {open && group.members.map((member, index) => (\n <MemberBlock\n key={member.workspace.workspaceId}\n member={member}\n indent\n sessionIds={memberIds[index] ?? []}\n sessions={sessions}\n currentSessionId={currentSessionId}\n expandMap={expandMap}\n onToggle={onToggle}\n expandTo={expandTo}\n descendants={descendants}\n expandedSessionGroups={expandedSessionGroups}\n setExpandedSessionGroups={setExpandedSessionGroups}\n now={now}\n home={home}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n onWorkspaceRename={onWorkspaceRename}\n onWorkspaceDelete={onWorkspaceDelete}\n startSession={startSession}\n t={t}\n />\n ))}\n </div>\n )\n }\n const member = group.members[0]\n if (member === undefined) return null\n return (\n <div key={group.key} className={css.groupSection}>\n <MemberBlock\n member={member}\n indent={false}\n sessionIds={orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy)}\n sessions={sessions}\n currentSessionId={currentSessionId}\n expandMap={expandMap}\n onToggle={onToggle}\n expandTo={expandTo}\n descendants={descendants}\n expandedSessionGroups={expandedSessionGroups}\n setExpandedSessionGroups={setExpandedSessionGroups}\n now={now}\n home={home}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n onWorkspaceRename={onWorkspaceRename}\n onWorkspaceDelete={onWorkspaceDelete}\n startSession={startSession}\n t={t}\n />\n </div>\n )\n })}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction MemberBlock({ member, indent, sessionIds, sessions, currentSessionId, expandMap, onToggle, expandTo, descendants, expandedSessionGroups, setExpandedSessionGroups, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, startSession, t }: {\n member: SidebarMember\n indent: boolean\n sessionIds: readonly string[]\n sessions: SessionListLike\n currentSessionId: string | undefined\n expandMap: Record<string, boolean>\n onToggle: (key: string) => void\n expandTo: (key: string) => void\n descendants: ReturnType<typeof indexSubagentRunning>\n expandedSessionGroups: readonly string[]\n setExpandedSessionGroups: (update: (keys: string[]) => string[]) => void\n now: number\n home: string | undefined\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n onWorkspaceRename: (workspaceId: string, title: string) => void\n onWorkspaceDelete: (workspaceId: string, title: string) => void\n startSession: (workspaceId?: string) => void\n t: Translate\n}): ReactNode {\n const key = `ws:${member.workspace.workspaceId}`\n const containsCurrent = member.workspace.sessionIds.includes(currentSessionId ?? '\\0')\n const open = expandMap[key] ?? containsCurrent\n const label = memberLabel(member, t)\n const overflowOpen = expandedSessionGroups.includes(key)\n const visibleIds = overflowOpen ? sessionIds : sessionIds.slice(0, COLLAPSED_SESSION_LIMIT)\n const nodes: SessionNode[] = []\n for (const sessionId of visibleIds) {\n const summary = sessions.byId[sessionId]\n if (summary !== undefined) nodes.push(sessionNode(summary, descendants))\n }\n const created = createdAtMs(member.workspace.createdAt)\n const body = (\n <>\n <ProjectRowItem\n row={{\n key,\n label,\n expanded: open,\n containsCurrent,\n cwd: member.workspace.path,\n ...created === undefined ? {} : { createdAt: created },\n }}\n onToggle={() => { onToggle(key) }}\n onCreate={() => {\n expandTo(key)\n startSession(member.workspace.workspaceId)\n }}\n actions={{\n rename: () => { onWorkspaceRename(member.workspace.workspaceId, member.workspace.title) },\n delete: () => { onWorkspaceDelete(member.workspace.workspaceId, member.workspace.title) },\n }}\n home={home}\n t={t}\n />\n {open && (\n <div className={indent ? css.sessionsIndent : undefined}>\n {nodes.map(node => (\n <SessionNodeItem\n key={node.id}\n node={node}\n currentId={currentSessionId}\n now={now}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n t={t}\n />\n ))}\n {sessionIds.length > COLLAPSED_SESSION_LIMIT && (\n <button\n type=\"button\"\n className={css.sessionOverflowButton}\n aria-expanded={overflowOpen}\n onClick={() => {\n setExpandedSessionGroups(keys => keys.includes(key) ? keys.filter(k => k !== key) : [...keys, key])\n }}\n >\n {overflowOpen ? t('sessions.collapse') : t('sessions.expand', { n: sessionIds.length - COLLAPSED_SESSION_LIMIT })}\n </button>\n )}\n </div>\n )}\n </>\n )\n return indent ? <div className={css.memberIndent}>{body}</div> : body\n}\n\nexport function GroupedSidebar(props: GroupedSidebarProps): ReactNode {\n const { t } = props\n const workspaces = useSyncExternalStore(props.workspacesList.subscribe, props.workspacesList.getSnapshot)\n const sessions = useSyncExternalStore(props.sessionsList.subscribe, props.sessionsList.getSnapshot)\n const host = useSyncExternalStore(props.hostDescription.subscribe, props.hostDescription.getSnapshot)\n const directoryFlowAvailable = useSyncExternalStore(props.directoryFlow.subscribe, props.directoryFlow.getSnapshot)\n const items = workspaces.items as readonly WorkspaceLike[]\n const home = host?.home\n\n const signature = useMemo(() => [...items].map(item => item.path).sort().join('\\n'), [items])\n const [factsState, setFactsState] = useState<FactsState>(null)\n const readyOnce = useRef(false)\n const signalReady = (): void => {\n if (readyOnce.current) return\n readyOnce.current = true\n props.onReady?.()\n }\n useEffect(() => {\n if (factsState?.signature === signature) {\n signalReady()\n return\n }\n let live = true\n void props.loadFacts(items.map(item => item.path)).then(\n (facts) => {\n if (!live) return\n if (facts !== undefined) setFactsState({ signature, facts })\n signalReady()\n },\n () => { if (live) signalReady() },\n )\n return () => { live = false }\n }, [signature, factsState?.signature, props.loadFacts, items])\n\n const facts = factsState?.signature === signature ? factsState.facts : undefined\n const groups = useMemo(() => deriveSidebarGroups(items, facts), [items, facts])\n const sessionList = sessions as unknown as SessionListLike\n const archived = workspaces.archivedSessionIds\n\n const [expandMap, setExpandMap] = useState<Record<string, boolean>>(() => loadExpandState())\n const toggle = (key: string): void => {\n const next = { ...expandMap, [key]: !(expandMap[key] ?? false) }\n setExpandMap(next)\n saveExpandState(next)\n }\n const expandTo = (key: string): void => {\n if (expandMap[key] === true) return\n const next = { ...expandMap, [key]: true }\n setExpandMap(next)\n saveExpandState(next)\n }\n\n const [viewPrefs, setViewPrefs] = useState(() => loadViewPrefs())\n const setGroupBy = (groupBy: SidebarGroupBy): void => {\n const next = { ...viewPrefs, groupBy }\n setViewPrefs(next)\n saveViewPrefs(next)\n }\n const setOrderBy = (orderBy: SidebarOrderBy): void => {\n const next = { ...viewPrefs, orderBy }\n setViewPrefs(next)\n saveViewPrefs(next)\n }\n\n const [query, setQuery] = useState('')\n const [searchExpanded, setSearchExpanded] = useState(false)\n const normalizedQuery = sanitizeSearchQuery(query).trim()\n const [remoteSearch, setRemoteSearch] = useState<{\n query: string\n status: 'idle' | 'loading' | 'ready' | 'error'\n items: readonly ContentSearchHit[]\n hasMore: boolean\n }>({ query: '', status: 'idle', items: [], hasMore: false })\n const searchRoot = useRef<HTMLDivElement>(null)\n const searchInput = useRef<HTMLInputElement>(null)\n const [wsPickerOpen, setWsPickerOpen] = useState(false)\n const composingRef = useRef(false)\n const [searchOnExpand, setSearchOnExpand] = useState(false)\n\n useEffect(() => {\n if (props.wide && searchOnExpand) {\n const timer = window.setTimeout(() => {\n searchInput.current?.focus({ preventScroll: true })\n setSearchOnExpand(false)\n }, EXPAND_SLIDE_MS)\n return () => { window.clearTimeout(timer) }\n }\n return undefined\n }, [props.wide, searchOnExpand])\n\n useEffect(() => {\n if (!props.wide || !searchExpanded || searchOnExpand) return\n searchInput.current?.focus({ preventScroll: true })\n }, [props.wide, searchExpanded, searchOnExpand])\n\n useEffect(() => {\n if (!props.wide || !searchExpanded || searchOnExpand) return\n const onClick = (event: MouseEvent): void => {\n if (!(event.target instanceof Node) || searchRoot.current?.contains(event.target) === true) return\n searchInput.current?.blur()\n if (normalizedQuery !== '') return\n setSearchExpanded(false)\n }\n document.addEventListener('click', onClick)\n return () => { document.removeEventListener('click', onClick) }\n }, [normalizedQuery, props.wide, searchExpanded, searchOnExpand])\n\n useEffect(() => {\n if (normalizedQuery === '') {\n setRemoteSearch({ query: '', status: 'idle', items: [], hasMore: false })\n return\n }\n const controller = new AbortController()\n setRemoteSearch({ query: normalizedQuery, status: 'loading', items: [], hasMore: false })\n const timer = window.setTimeout(() => {\n props.searchSessions(normalizedQuery, controller.signal).then((result) => {\n if (controller.signal.aborted) return\n setRemoteSearch({ query: normalizedQuery, status: 'ready', items: result.items, hasMore: result.hasMore })\n }).catch(() => {\n if (controller.signal.aborted) return\n setRemoteSearch({ query: normalizedQuery, status: 'error', items: [], hasMore: false })\n })\n }, SEARCH_DEBOUNCE_MS)\n return () => {\n window.clearTimeout(timer)\n controller.abort()\n }\n }, [normalizedQuery, props.searchSessions])\n\n const [renameTarget, setRenameTarget] = useState<{ workspaceId: string; currentTitle: string } | null>(null)\n const [renameDraft, setRenameDraft] = useState('')\n const [renaming, setRenaming] = useState(false)\n const [renameError, setRenameError] = useState<string | null>(null)\n const renameTrimmed = renameDraft.trim()\n const renameDuplicate = renameTarget !== null && renameTrimmed !== '' && renameTrimmed !== renameTarget.currentTitle && items.some(w => w.title === renameTrimmed)\n const renameBlocked = renaming || renameTrimmed === '' || renameTarget === null || renameTrimmed === renameTarget.currentTitle || renameDuplicate\n const closeRename = (): void => {\n if (renaming) return\n setRenameTarget(null)\n setRenameError(null)\n }\n const confirmRename = (): void => {\n if (renameBlocked || renameTarget === null) return\n setRenaming(true)\n setRenameError(null)\n props.renameWorkspace(renameTarget.workspaceId, renameTrimmed).then(() => {\n setRenaming(false)\n setRenameTarget(null)\n }).catch((reason: unknown) => {\n setRenaming(false)\n setRenameError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n\n const [sessionRenameTarget, setSessionRenameTarget] = useState<{ sessionId: string; currentTitle: string } | null>(null)\n const [sessionRenameDraft, setSessionRenameDraft] = useState('')\n const [sessionRenaming, setSessionRenaming] = useState(false)\n const [sessionRenameError, setSessionRenameError] = useState<string | null>(null)\n const sessionRenameTrimmed = sessionRenameDraft.trim()\n const sessionRenameBlocked = sessionRenaming || sessionRenameTrimmed === '' || sessionRenameTarget === null\n const closeSessionRename = (): void => {\n if (sessionRenaming) return\n setSessionRenameTarget(null)\n setSessionRenameError(null)\n }\n const confirmSessionRename = (): void => {\n if (sessionRenameBlocked || sessionRenameTarget === null) return\n setSessionRenaming(true)\n setSessionRenameError(null)\n props.renameSession(sessionRenameTarget.sessionId, sessionRenameTrimmed).then(() => {\n setSessionRenaming(false)\n setSessionRenameTarget(null)\n }).catch((reason: unknown) => {\n setSessionRenaming(false)\n setSessionRenameError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n const onSessionRename = (sessionId: string, currentTitle: string): void => {\n setSessionRenameTarget({ sessionId, currentTitle })\n setSessionRenameDraft(currentTitle)\n setSessionRenameError(null)\n }\n const onSessionArchive = (sessionId: string): void => {\n props.archiveSession(sessionId).catch((reason: unknown) => {\n console.warn('session archive rejected:', reason)\n })\n }\n\n const [deleteTarget, setDeleteTarget] = useState<{ workspaceId: string; title: string } | null>(null)\n const [deleting, setDeleting] = useState(false)\n const [deleteCommittedId, setDeleteCommittedId] = useState<string | null>(null)\n const [deleteError, setDeleteError] = useState<string | null>(null)\n useEffect(() => {\n if (deleteCommittedId === null || items.some(workspace => workspace.workspaceId === deleteCommittedId)) return\n setDeleting(false)\n setDeleteCommittedId(null)\n setDeleteTarget(null)\n }, [deleteCommittedId, items])\n const closeDelete = (): void => {\n if (deleting) return\n setDeleteTarget(null)\n setDeleteError(null)\n }\n const confirmDelete = (): void => {\n if (deleting || deleteTarget === null) return\n setDeleting(true)\n setDeleteCommittedId(null)\n setDeleteError(null)\n props.deleteWorkspace(deleteTarget.workspaceId).then(() => {\n setDeleteCommittedId(deleteTarget.workspaceId)\n }).catch((reason: unknown) => {\n setDeleting(false)\n setDeleteError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n\n const now = Date.now()\n const wide = props.wide\n\n return (\n <div className={cx(css.root, !wide && css.rail)}>\n <div className={css.sectionHeader}>\n {wide && (\n <span className={cx(css.sectionLabel, css.wide, searchExpanded && css.sectionLabelHidden)}>\n {viewPrefs.groupBy === 'flat' ? t('section.sessions') : t('section.workspaces')}\n </span>\n )}\n {wide && (\n <div className={cx(css.searchSlot, searchExpanded && css.searchSlotExpanded)}>\n <div\n ref={searchRoot}\n className={cx(css.search, searchExpanded && css.searchExpanded)}\n onClick={() => {\n setWsPickerOpen(false)\n setSearchExpanded(true)\n searchInput.current?.focus()\n }}\n >\n <Tooltip label={t('search')} side=\"bottom\" delayMs={500} disabled={searchExpanded}>\n <button\n type=\"button\"\n className={css.searchButton}\n aria-label={t('search.sessions.aria')}\n aria-expanded={searchExpanded}\n onClick={() => {\n setWsPickerOpen(false)\n setSearchExpanded(true)\n }}\n >\n <IconSearchOutline16 size={searchExpanded ? 11 : 14} />\n </button>\n </Tooltip>\n <input\n ref={searchInput}\n className={css.searchInput}\n type=\"text\"\n placeholder={t('search.placeholder')}\n maxLength={SEARCH_QUERY_MAX_CODE_UNITS}\n value={query}\n tabIndex={searchExpanded ? 0 : -1}\n onChange={(e) => { setQuery(sanitizeSearchQuery(e.target.value)) }}\n onKeyDown={(e) => {\n if (e.key !== 'Escape') return\n setQuery('')\n setSearchExpanded(false)\n }}\n />\n {searchExpanded && (\n <button\n type=\"button\"\n className={css.clearButton}\n aria-label={t('search.clear')}\n onClick={(e) => {\n e.stopPropagation()\n setQuery('')\n setSearchExpanded(false)\n }}\n >\n <IconCloseFill14 />\n </button>\n )}\n </div>\n </div>\n )}\n <div className={cx(css.headerActions, wide && searchExpanded && css.headerActionsHidden)}>\n {wide && (\n <ViewOptionsMenu\n groupBy={viewPrefs.groupBy}\n orderBy={viewPrefs.orderBy}\n onGroupPick={setGroupBy}\n onOrderPick={setOrderBy}\n t={t}\n />\n )}\n {directoryFlowAvailable && (\n <Tooltip label={t('workspace.add')} side=\"bottom\" delayMs={500}>\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('workspace.add')}\n onClick={() => { setWsPickerOpen(v => !v) }}\n >\n <IconProjectAddOutline16 size={wide ? 16 : 18} />\n </button>\n </Tooltip>\n )}\n </div>\n <WorkspacePickFlow\n t={t}\n open={wsPickerOpen}\n pickDirectory={props.pickDirectory}\n createWorkspace={props.createWorkspace}\n onPick={(workspaceId) => {\n setWsPickerOpen(false)\n props.startSession(workspaceId)\n }}\n onClose={() => { setWsPickerOpen(false) }}\n onRetry={() => { setWsPickerOpen(true) }}\n />\n </div>\n {!wide && (\n <div className={css.search}>\n <Tooltip label={t('search')}>\n <button\n type=\"button\"\n className={css.searchButton}\n aria-label={t('search.sessions.aria')}\n onClick={() => {\n setSearchExpanded(true)\n setSearchOnExpand(true)\n props.expandSidebar()\n }}\n >\n <IconSearchOutline16 size={18} />\n </button>\n </Tooltip>\n </div>\n )}\n <div className={css.listArea}>\n {wide && (normalizedQuery !== ''\n ? (\n <SearchResults\n list={sessionList}\n workspaces={items}\n archivedSessionIds={archived}\n query={normalizedQuery}\n remote={remoteSearch}\n resultLimit={props.searchResultLimit}\n currentId={sessions.current}\n onOpen={props.openSession}\n t={t}\n />\n )\n : viewPrefs.groupBy === 'flat'\n ? (\n <FlatListBody\n list={sessionList}\n archivedSessionIds={archived}\n orderBy={viewPrefs.orderBy}\n currentId={sessions.current}\n now={now}\n onOpen={props.openSession}\n onRename={onSessionRename}\n onFork={props.forkSession}\n onArchive={onSessionArchive}\n t={t}\n />\n )\n : (\n <GroupedTree\n groups={groups}\n sessions={sessionList}\n archived={archived}\n currentSessionId={sessions.current}\n expandMap={expandMap}\n onToggle={toggle}\n expandTo={expandTo}\n orderBy={viewPrefs.orderBy}\n now={now}\n home={home}\n onOpen={props.openSession}\n onRename={onSessionRename}\n onFork={props.forkSession}\n onArchive={onSessionArchive}\n onWorkspaceRename={(workspaceId, currentTitle) => {\n setRenameTarget({ workspaceId, currentTitle })\n setRenameDraft(currentTitle)\n setRenameError(null)\n }}\n onWorkspaceDelete={(workspaceId, title) => {\n setDeleteTarget({ workspaceId, title })\n setDeleteError(null)\n }}\n startSession={props.startSession}\n t={t}\n />\n ))}\n </div>\n <Modal\n open={renameTarget !== null}\n onClose={closeRename}\n closeLabel={t('close')}\n title={t('rename.workspace.title')}\n footer={(\n <>\n <Button variant=\"outline\" disabled={renaming} onClick={closeRename}>{t('cancel')}</Button>\n <Button variant=\"primary\" disabled={renameBlocked} onClick={confirmRename}>{t('rename')}</Button>\n </>\n )}\n >\n <input\n className={css.renameInput}\n value={renameDraft}\n aria-label={t('field.workspaceName')}\n autoFocus\n disabled={renaming}\n onFocus={(e) => { e.target.select() }}\n onChange={(e) => {\n setRenameDraft(e.target.value)\n setRenameError(null)\n }}\n onCompositionStart={() => { composingRef.current = true }}\n onCompositionEnd={() => { composingRef.current = false }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !composingRef.current) {\n e.preventDefault()\n confirmRename()\n }\n }}\n />\n {renameDuplicate && (\n <div className={css.renameError} role=\"alert\">{t('conflict.named', { name: renameTrimmed })}</div>\n )}\n {renameError !== null && <div className={css.renameError} role=\"alert\">{renameError}</div>}\n </Modal>\n <Modal\n open={sessionRenameTarget !== null}\n onClose={closeSessionRename}\n closeLabel={t('close')}\n title={t('rename.session.title')}\n footer={(\n <>\n <Button variant=\"outline\" disabled={sessionRenaming} onClick={closeSessionRename}>{t('cancel')}</Button>\n <Button variant=\"primary\" disabled={sessionRenameBlocked} onClick={confirmSessionRename}>{t('rename')}</Button>\n </>\n )}\n >\n <input\n className={css.renameInput}\n value={sessionRenameDraft}\n aria-label={t('field.sessionName')}\n autoFocus\n disabled={sessionRenaming}\n onFocus={(e) => { e.target.select() }}\n onChange={(e) => {\n setSessionRenameDraft(e.target.value)\n setSessionRenameError(null)\n }}\n onCompositionStart={() => { composingRef.current = true }}\n onCompositionEnd={() => { composingRef.current = false }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !composingRef.current) {\n e.preventDefault()\n confirmSessionRename()\n }\n }}\n />\n {sessionRenameError !== null && <div className={css.renameError} role=\"alert\">{sessionRenameError}</div>}\n </Modal>\n <Modal\n open={deleteTarget !== null}\n onClose={closeDelete}\n closeLabel={t('close')}\n title={t('delete.workspace')}\n {...deleteTarget === null ? {} : { description: t('delete.desc', { name: deleteTarget.title }) }}\n footer={(\n <>\n <Button variant=\"outline\" disabled={deleting} onClick={closeDelete}>{t('cancel')}</Button>\n <Button variant=\"outline\" className={css.deleteAction} disabled={deleting} onClick={confirmDelete}>\n {t('delete.workspace')}\n </Button>\n </>\n )}\n >\n {deleting && <div className={css.deleteStatus} role=\"status\">{t('delete.pending')}</div>}\n {deleteError !== null && <div className={css.renameError} role=\"alert\">{deleteError}</div>}\n </Modal>\n </div>\n )\n}\n","/**\n * Locale dictionaries for the git-worktree plugin. zh is the key source; en\n * is `Record<GitWorktreeKey, string>`, so a missing translation fails the\n * build instead of surfacing a raw key.\n */\n\n/** Every copy key the plugin surfaces (chip, dialogs, settings card). */\nexport type GitWorktreeKey =\n | 'chipWorktree'\n | 'worktreeToggle'\n | 'menuBranches'\n | 'menuLocalBranches'\n | 'menuWorktrees'\n | 'menuRemoteBranches'\n | 'mainRepoOnly'\n | 'menuSearchPlaceholder'\n | 'menuNoMatches'\n | 'menuNoBranches'\n | 'menuLocate'\n | 'menuExpandAll'\n | 'menuCollapseAll'\n | 'menuNewBranch'\n | 'menuNewBranchPlaceholder'\n | 'menuNewBranchBad'\n | 'menuNewBranchExists'\n | 'menuFetch'\n | 'menuUpdate'\n | 'fetchDone'\n | 'updateDone'\n | 'updateUpToDate'\n | 'aheadTitle'\n | 'behindTitle'\n | 'switchAsk'\n | 'switchAskRemote'\n | 'switchBusy'\n | 'worktreeAskNew'\n | 'worktreeAskRemote'\n | 'worktreeAskReuse'\n | 'worktreeAskCutOut'\n | 'worktreeBusy'\n | 'createBranchTitle'\n | 'createBranchBusy'\n | 'actionCancel'\n | 'actionConfirm'\n | 'errorGeneric'\n | 'cardTitle'\n | 'cardDescription'\n | 'cardUnsaved'\n | 'cardExpand'\n | 'cardCollapse'\n | 'cardReadOnly'\n | 'cardRootDirLabel'\n | 'cardBrowse'\n | 'cardPicking'\n | 'cardRootDirHint'\n | 'cardOverridden'\n | 'cardSaveFailed'\n | 'cardDiscard'\n | 'cardSave'\n | 'cardSaving'\n | 'sidebarSectionTitle'\n | 'sidebarAddSession'\n | 'sidebarNewSession'\n | 'sidebarMainBranch'\n | 'sidebarMain'\n | 'sidebarRailExpand'\n | 'cardGroupSidebarLabel'\n | 'cardGroupSidebarHint'\n | 'cardGroupSidebarMark'\n | 'cardGroupSidebarNote'\n | 'cardGroupSidebarBusy'\n | 'group.ungrouped'\n | 'session.new'\n | 'section.workspaces'\n | 'section.sessions'\n | 'viewOptions.label'\n | 'groupBy.label'\n | 'groupBy.workspace'\n | 'groupBy.flat'\n | 'orderBy.label'\n | 'orderBy.manual'\n | 'orderBy.updated'\n | 'sessions.expand'\n | 'sessions.collapse'\n | 'empty.none'\n | 'empty.noMatches'\n | 'workspace.add'\n | 'search'\n | 'search.sessions.aria'\n | 'search.placeholder'\n | 'search.clear'\n | 'search.results.aria'\n | 'search.pending'\n | 'search.unavailable'\n | 'search.noMatches'\n | 'search.hasMore'\n | 'menu.addWorkspace'\n | 'picker.loading'\n | 'conflict.named'\n | 'folderError.title'\n | 'folderError.retry'\n | 'rename'\n | 'rename.workspace.title'\n | 'rename.session.title'\n | 'field.workspaceName'\n | 'field.sessionName'\n | 'delete.workspace'\n | 'delete.desc'\n | 'delete.pending'\n | 'menu.fork'\n | 'menu.archiveSession'\n | 'sessions.count.one'\n | 'sessions.count.other'\n | 'actions.workspace.aria'\n | 'actions.session.aria'\n | 'actions.newSession.aria'\n | 'status.running'\n | 'status.subagentsRunning.one'\n | 'status.subagentsRunning.other'\n | 'status.idle'\n | 'status.waitingApproval'\n | 'status.planReview'\n | 'status.waitingAnswer'\n | 'status.completed'\n | 'hover.created'\n | 'hover.copied'\n | 'date.ymd'\n | 'time.now'\n | 'time.minutes'\n | 'time.hours'\n | 'time.days'\n | 'time.months'\n | 'time.years'\n | 'time.ago'\n | 'copy'\n | 'close'\n | 'cancel'\n\n/** English dictionary — complete by construction. */\nexport const en: Record<GitWorktreeKey, string> = {\n chipWorktree: 'Worktree',\n worktreeToggle: 'Create an isolated worktree',\n menuBranches: 'Branches',\n menuLocalBranches: 'Local branches',\n menuWorktrees: 'Worktrees',\n menuRemoteBranches: 'Remote branches',\n mainRepoOnly: 'Branch operations start from the main checkout',\n menuSearchPlaceholder: 'Search branches',\n menuNoMatches: 'No matching branches',\n menuNoBranches: 'No branches yet',\n menuLocate: 'Locate current branch',\n menuExpandAll: 'Expand all',\n menuCollapseAll: 'Collapse all',\n menuNewBranch: 'Create branch from current',\n menuNewBranchPlaceholder: 'New branch name',\n menuNewBranchBad: 'Git will not accept this name',\n menuNewBranchExists: 'A branch with this name already exists',\n menuFetch: 'Fetch',\n menuUpdate: 'Update current branch from upstream',\n fetchDone: 'Remote branches synced',\n updateDone: '{branch} fast-forwarded to its upstream',\n updateUpToDate: 'Already up to date',\n aheadTitle: '{n} commits ahead of upstream',\n behindTitle: '{n} commits behind upstream',\n switchAsk: 'Switch to {branch}?',\n switchAskRemote: 'Check out this remote branch?',\n switchBusy: 'Switching…',\n worktreeAskNew: 'Create a worktree from {branch}?',\n worktreeAskRemote: 'Create a worktree from this remote branch?',\n worktreeAskReuse: 'Switch to the {branch} worktree?',\n worktreeAskCutOut: 'Cut a new branch out of {branch} into an isolated worktree',\n worktreeBusy: 'Creating…',\n createBranchTitle: 'New branch from {branch}',\n createBranchBusy: 'Creating…',\n actionCancel: 'Cancel',\n actionConfirm: 'Confirm',\n errorGeneric: 'Git worktree: {message}',\n cardTitle: 'Git Worktree',\n cardDescription: 'Where isolated worktree folders for new sessions are stored.',\n cardUnsaved: 'Unsaved',\n cardExpand: 'Expand',\n cardCollapse: 'Collapse',\n cardReadOnly: 'The settings document is read-only; edits cannot be saved.',\n cardRootDirLabel: 'Worktree storage folder',\n cardBrowse: 'Browse…',\n cardPicking: 'Choosing…',\n cardRootDirHint: 'Absolute path. Empty uses the default $DSH_HOME/gitworktree (~/.dsh/gitworktree).',\n cardOverridden: '(custom location)',\n cardSaveFailed: 'The change did not save. Check the path is absolute and try again.',\n cardDiscard: 'Discard',\n cardSave: 'Save',\n cardSaving: 'Saving…',\n sidebarSectionTitle: 'Workspaces',\n sidebarAddSession: 'Start a new session',\n sidebarNewSession: 'New Session',\n sidebarMainBranch: 'Main ({branch})',\n sidebarMain: 'Main',\n sidebarRailExpand: 'Expand sidebar',\n cardGroupSidebarLabel: 'Group workspaces',\n cardGroupSidebarHint: 'DSH does not yet expose a multi-workspace grouping API, so this replaces the native sidebar 1:1 and adds same-repo worktree grouping.',\n cardGroupSidebarMark: '(experimental)',\n cardGroupSidebarNote: 'Turn it off to restore the native list if anything breaks; we will switch to the official API as soon as it ships.',\n cardGroupSidebarBusy: 'Switching sidebar…',\n 'group.ungrouped': 'Ungrouped',\n 'session.new': 'New Session',\n 'section.workspaces': 'Workspaces',\n 'section.sessions': 'Sessions',\n 'viewOptions.label': 'View options',\n 'groupBy.label': 'Group by',\n 'groupBy.workspace': 'WorkSpace',\n 'groupBy.flat': 'In one list',\n 'orderBy.label': 'Order by',\n 'orderBy.manual': 'Manual',\n 'orderBy.updated': 'Last updated',\n 'sessions.expand': 'Show {n} more sessions',\n 'sessions.collapse': 'Show less',\n 'empty.none': 'No sessions yet',\n 'empty.noMatches': 'No matches',\n 'workspace.add': 'Add workspace',\n search: 'Search',\n 'search.sessions.aria': 'Search sessions',\n 'search.placeholder': 'Search sessions...',\n 'search.clear': 'Clear search',\n 'search.results.aria': 'Search results',\n 'search.pending': 'Searching session history…',\n 'search.unavailable': 'Content search is temporarily unavailable. Showing name matches.',\n 'search.noMatches': 'No matching sessions',\n 'search.hasMore': 'Showing the first {n} results. Narrow your search.',\n 'menu.addWorkspace': 'Add workspace…',\n 'picker.loading': 'Loading workspaces…',\n 'conflict.named': 'A workspace named “{name}” already exists.',\n 'folderError.title': 'Couldn’t open folder',\n 'folderError.retry': 'Choose again',\n rename: 'Rename',\n 'rename.workspace.title': 'Rename workspace',\n 'rename.session.title': 'Rename session',\n 'field.workspaceName': 'Workspace name',\n 'field.sessionName': 'Session name',\n 'delete.workspace': 'Delete workspace',\n 'delete.desc': 'This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.',\n 'delete.pending': 'Deleting workspace…',\n 'menu.fork': 'Fork session',\n 'menu.archiveSession': 'Archive session',\n 'sessions.count.one': '{n} session',\n 'sessions.count.other': '{n} sessions',\n 'actions.workspace.aria': 'Workspace actions for {name}',\n 'actions.session.aria': 'Session actions for {name}',\n 'actions.newSession.aria': 'New session in {name}',\n 'status.running': 'Running',\n 'status.subagentsRunning.one': '{n} subagent running',\n 'status.subagentsRunning.other': '{n} subagents running',\n 'status.idle': 'Idle',\n 'status.waitingApproval': 'Waiting for approval',\n 'status.planReview': 'Plan awaiting review',\n 'status.waitingAnswer': 'Waiting for answer',\n 'status.completed': 'Completed',\n 'hover.created': 'Created {time}',\n 'hover.copied': 'Copied',\n 'date.ymd': '{y}-{m}-{d}',\n 'time.now': 'now',\n 'time.minutes': '{n}min',\n 'time.hours': '{n}h',\n 'time.days': '{n}d',\n 'time.months': '{n}mo',\n 'time.years': '{n}y',\n 'time.ago': '{t} ago',\n copy: 'Copy',\n close: 'Close',\n cancel: 'Cancel',\n}\n\n/** 中文词典。 */\nexport const zh: Record<GitWorktreeKey, string> = {\n chipWorktree: '工作树',\n worktreeToggle: '创建隔离工作树',\n menuBranches: '分支',\n menuLocalBranches: '本地分支',\n menuWorktrees: '工作树',\n menuRemoteBranches: '远程分支',\n mainRepoOnly: '分支操作请在主仓库发起',\n menuSearchPlaceholder: '搜索分支',\n menuNoMatches: '没有匹配的分支',\n menuNoBranches: '暂无分支',\n menuLocate: '定位当前分支',\n menuExpandAll: '全部展开',\n menuCollapseAll: '全部折叠',\n menuNewBranch: '从当前分支新建分支',\n menuNewBranchPlaceholder: '新分支名称',\n menuNewBranchBad: 'Git 不接受该名称',\n menuNewBranchExists: '同名分支已存在',\n menuFetch: '提取',\n menuUpdate: '更新当前分支',\n fetchDone: '远程分支已同步',\n updateDone: '{branch} 已快进到远程最新',\n updateUpToDate: '已是最新',\n aheadTitle: '领先上游 {n} 个提交',\n behindTitle: '落后上游 {n} 个提交',\n switchAsk: '是否切到 {branch}?',\n switchAskRemote: '是否检出该远程分支?',\n switchBusy: '切换中…',\n worktreeAskNew: '是否从 {branch} 新建工作树?',\n worktreeAskRemote: '从该远程分支新建工作树?',\n worktreeAskReuse: '是否切到 {branch} 工作树?',\n worktreeAskCutOut: '从当前分支 {branch} 切出新分支到隔离工作树',\n worktreeBusy: '创建中…',\n createBranchTitle: '从 {branch} 新建分支',\n createBranchBusy: '创建中…',\n actionCancel: '取消',\n actionConfirm: '确认',\n errorGeneric: 'Git 工作树:{message}',\n cardTitle: 'Git 工作树',\n cardDescription: '新会话的隔离工作树文件夹存放位置。',\n cardUnsaved: '未保存',\n cardExpand: '展开',\n cardCollapse: '折叠',\n cardReadOnly: '设置文档为只读,修改无法保存。',\n cardRootDirLabel: '工作树存放目录',\n cardBrowse: '浏览…',\n cardPicking: '选择中…',\n cardRootDirHint: '绝对路径。留空使用默认 $DSH_HOME/gitworktree(~/.dsh/gitworktree)。',\n cardOverridden: '(已自定义位置)',\n cardSaveFailed: '保存未生效,请检查路径是否为绝对路径后重试。',\n cardDiscard: '放弃',\n cardSave: '保存',\n cardSaving: '保存中…',\n sidebarSectionTitle: '工作区',\n sidebarAddSession: '发起新会话',\n sidebarNewSession: '新会话',\n sidebarMainBranch: '主仓库({branch})',\n sidebarMain: '主仓库',\n sidebarRailExpand: '展开侧栏',\n cardGroupSidebarLabel: '聚合工作区',\n cardGroupSidebarHint: 'DSH 尚未开放多工作区聚合接口,因此按原生侧边栏 1:1 替换左侧列表,并加上同仓库工作树分组。',\n cardGroupSidebarMark: '(测试功能)',\n cardGroupSidebarNote: '使用中若遇问题,关掉即可回到原生;官方接口一旦开放,会第一时间改用原生实现。',\n cardGroupSidebarBusy: '正在切换侧栏…',\n 'group.ungrouped': '未分组',\n 'session.new': '新会话',\n 'section.workspaces': '工作区',\n 'section.sessions': '会话',\n 'viewOptions.label': '视图选项',\n 'groupBy.label': '分组方式',\n 'groupBy.workspace': '按工作区',\n 'groupBy.flat': '单列表',\n 'orderBy.label': '排序方式',\n 'orderBy.manual': '手动排序',\n 'orderBy.updated': '最近更新',\n 'sessions.expand': '展开其余 {n} 个会话',\n 'sessions.collapse': '收起',\n 'empty.none': '暂无会话',\n 'empty.noMatches': '无匹配结果',\n 'workspace.add': '添加工作区',\n search: '搜索',\n 'search.sessions.aria': '搜索会话',\n 'search.placeholder': '搜索会话…',\n 'search.clear': '清除搜索',\n 'search.results.aria': '搜索结果',\n 'search.pending': '正在搜索会话历史…',\n 'search.unavailable': '内容搜索暂不可用,仅显示名称匹配。',\n 'search.noMatches': '无匹配会话',\n 'search.hasMore': '仅显示前 {n} 条结果,请缩小搜索范围。',\n 'menu.addWorkspace': '添加工作区…',\n 'picker.loading': '正在加载工作区…',\n 'conflict.named': '已存在名为“{name}”的工作区。',\n 'folderError.title': '无法打开文件夹',\n 'folderError.retry': '重新选择',\n rename: '重命名',\n 'rename.workspace.title': '重命名工作区',\n 'rename.session.title': '重命名会话',\n 'field.workspaceName': '工作区名称',\n 'field.sessionName': '会话名称',\n 'delete.workspace': '删除工作区',\n 'delete.desc': '将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。',\n 'delete.pending': '正在删除工作区…',\n 'menu.fork': '分叉会话',\n 'menu.archiveSession': '归档会话',\n 'sessions.count.one': '{n} 个会话',\n 'sessions.count.other': '{n} 个会话',\n 'actions.workspace.aria': '工作区“{name}”的操作',\n 'actions.session.aria': '会话“{name}”的操作',\n 'actions.newSession.aria': '在“{name}”中新建会话',\n 'status.running': '进行中',\n 'status.subagentsRunning.one': '{n} 个子代理运行中',\n 'status.subagentsRunning.other': '{n} 个子代理运行中',\n 'status.idle': '空闲',\n 'status.waitingApproval': '等待审批',\n 'status.planReview': '计划待审',\n 'status.waitingAnswer': '等待回答',\n 'status.completed': '已完成',\n 'hover.created': '创建于 {time}',\n 'hover.copied': '已复制',\n 'date.ymd': '{y}年{m}月{d}日',\n 'time.now': '刚刚',\n 'time.minutes': '{n}分钟',\n 'time.hours': '{n}小时',\n 'time.days': '{n}天',\n 'time.months': '{n}个月',\n 'time.years': '{n}年',\n 'time.ago': '{t}前',\n copy: '复制',\n close: '关闭',\n cancel: '取消',\n}\n","/**\n * dsh-git-worktree browser half: the composer branch chip + worktree toggle\n * (conversation.input.left) for blank sessions, the plugin configuration\n * card on the Plugins tab (the `git-worktree` settings namespace — the\n * worktree storage root — edited through the settings scope), and — while\n * the sidebar-grouping switch is on — the `sidebar.workspaces` occupant\n * that clusters same-repository workspaces into one tree. Repo facts and\n * worktree creation flow through the host half's own routes; session hopping\n * uses the framework's workspaces service; the card's browse button rides the\n * same service's native directory picker (`ctx.workspaces.pickDirectory`).\n *\n * The grouping seat registers DYNAMICALLY: the settings scope drives a\n * register/dispose cycle, so flipping the card's switch swaps the sidebar\n * browser without a page reload (the native browser owns the default cell,\n * this entry shadows it at a lower priority while enabled).\n */\n\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { SessionId, WorkspaceId } from '@deepseek-ai/dsh-client-runtime/client'\n// Type-only: pulls the ui-conversation SlotMap merge (input region entries).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\n// Type-only: pulls the ui-sidebar SlotMap merge ('sidebar.workspaces' and its\n// SidebarSectionOwnerProps owner share) into this program.\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\n// Type-only: pulls the ui-settings SlotMap merge ('settings.section') and the\n// settingsScope service declaration into this program.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the ui-settings-plugins keyed-slot declaration\n// ('settings.plugin.item') into this program. The value face stays\n// uncompromised: cross-plugin collaboration goes through the slot system.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport { BranchChipDock } from './BranchChip.tsx'\nimport { CardForm, type SectionValue } from './card-form.ts'\nimport { GitWorktreeCard } from './GitWorktreeCard.tsx'\nimport { GroupedSidebar, type GroupedSidebarInjected } from './GroupedSidebar.tsx'\nimport { requestGroupWorktrees } from './api.ts'\nimport { en, zh, type GitWorktreeKey } from './locales.ts'\nimport type { BranchChipInjected } from './slots.ts'\n\nexport type { BranchChipInjected } from './slots.ts'\nexport type { GitWorktreeKey } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The git-worktree chip, dialogs, and settings card copy. */\n 'git-worktree': GitWorktreeKey\n }\n interface SlotMap {\n /**\n * Directory-flow hole under the sidebar browsing region. Declared at\n * runtime by native ui-workspace; this merge only names the key so\n * occupancy probes type-check. This plugin must NOT re-declare the hole\n * (SlotCore throws on a second declarer).\n */\n 'sidebar.workspaces.directoryFlow': {\n kind: 'single'\n scope: 'root'\n owner: {\n open: boolean\n busy: boolean\n onPicked: (path: string) => void\n onCancel: () => void\n onError: (message: string) => void\n }\n }\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'git-worktree'\n\n/**\n * Namespace of the git-worktree settings section. Spelled here rather than\n * imported: a client package must not depend on a Host package.\n */\nconst GIT_WORKTREE_NS = 'git-worktree'\n\n/** Required services: the slot ledger, session/workspace runtime, copy, and\n * the settings scope backing the plugin configuration card. */\nexport const inject = ['slots', 'sessions', 'workspaces', 'locale', 'connection', 'remote', 'settingsScope']\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'git-worktree: dictionaries')\n\n const chipInjected = (): BranchChipInjected => ({\n adoptWorktree: async (path) => {\n const workspace = await ctx.workspaces.create({ path })\n ctx.workspaces.startSession(workspace.workspaceId)\n },\n })\n\n ctx.slots.inject('conversation.input.left', () => ctx.slots.register({\n name: 'conversation.input.left',\n id: 'git-worktree',\n order: 5,\n locale: NS,\n inject: chipInjected,\n }, BranchChipDock))\n\n const groupingScope = ctx.settingsScope.bind<SectionValue>({ namespace: GIT_WORKTREE_NS })\n\n // Seat apply is a Promise the settings card awaits: `scope.set` only\n // stores the document. Enable waits until GroupedSidebar's first /group\n // probe settles (until then the tree is visually the native flat list);\n // disable waits until the occupant is disposed and a frame has painted\n // so the native browser can commit. Subscribe still drives apply for\n // startup and out-of-band writes.\n const SEAT_READY_TIMEOUT_MS = 20_000\n const SNAPSHOT_WAIT_MS = 8_000\n let groupingDisposer: (() => void) | undefined\n let groupingEnabled: boolean | undefined\n let seatEpoch = 0\n let seatReady = Promise.resolve()\n let seatReadyResolve: (() => void) | undefined\n let seatTimer: ReturnType<typeof setTimeout> | undefined\n\n const finishSeat = (): void => {\n if (seatTimer !== undefined) {\n window.clearTimeout(seatTimer)\n seatTimer = undefined\n }\n const resolve = seatReadyResolve\n seatReadyResolve = undefined\n resolve?.()\n }\n\n const afterPaint = (): Promise<void> => new Promise((resolve) => {\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => { requestAnimationFrame(() => { resolve() }) })\n return\n }\n setTimeout(resolve, 0)\n })\n\n const groupingMatches = (enabled: boolean): boolean => {\n const snapshot = groupingScope.getSnapshot()\n return snapshot.status === 'ready' && (snapshot.value?.groupSidebar ?? true) === enabled\n }\n\n const waitSnapshotMatches = async (enabled: boolean): Promise<void> => {\n if (groupingMatches(enabled)) return\n await new Promise<void>((resolve) => {\n const stop = groupingScope.subscribe(() => {\n if (!groupingMatches(enabled)) return\n stop()\n window.clearTimeout(timer)\n resolve()\n })\n const timer = window.setTimeout(() => {\n stop()\n resolve()\n }, SNAPSHOT_WAIT_MS)\n if (groupingMatches(enabled)) {\n window.clearTimeout(timer)\n stop()\n resolve()\n }\n })\n }\n\n const syncGroupingSeat = (): Promise<void> => {\n const snapshot = groupingScope.getSnapshot()\n if (snapshot.status !== 'ready') return seatReady\n const enabled = snapshot.value?.groupSidebar ?? true\n if (enabled === groupingEnabled) return seatReady\n groupingEnabled = enabled\n if (groupingDisposer !== undefined) {\n groupingDisposer()\n groupingDisposer = undefined\n }\n const epoch = ++seatEpoch\n seatReady = new Promise<void>((resolve) => { seatReadyResolve = resolve })\n if (!enabled) {\n void afterPaint().then(() => { if (epoch === seatEpoch) finishSeat() })\n return seatReady\n }\n const injectFace = (): GroupedSidebarInjected => ({\n workspacesList: ctx.workspaces.list,\n sessionsList: ctx.sessions.list,\n openSession: (sessionId: string) => {\n ctx.sessions.open(sessionId as SessionId)\n },\n startSession: (workspaceId?: string) => {\n ctx.workspaces.startSession(workspaceId as WorkspaceId | undefined)\n },\n loadFacts: async (paths: readonly string[]) => {\n const result = await requestGroupWorktrees(paths)\n return result.ok ? result.facts : undefined\n },\n searchSessions: async (query, signal) => {\n const result = await ctx.sessions.search(query, signal)\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n },\n searchResultLimit: ctx.sessions.searchResultLimit,\n renameSession: async (sessionId, title) => {\n const session = ctx.sessions.binding(sessionId as SessionId)?.session\n if (session === undefined) throw new Error(`unknown session \"${sessionId}\"`)\n const result = await session.rename(title)\n if (!result.ok) throw new Error(result.error.message)\n },\n forkSession: (sessionId) => {\n ctx.sessions.fork({ sessionId: sessionId as SessionId, increaseTitle: true }).then((childId) => {\n ctx.sessions.open(childId)\n }).catch(() => { /* fork failure is silent, matching native */ })\n },\n renameWorkspace: async (workspaceId, title) => {\n await ctx.workspaces.rename(workspaceId as WorkspaceId, title)\n },\n deleteWorkspace: async (workspaceId) => {\n await ctx.workspaces.delete(workspaceId as WorkspaceId)\n },\n archiveSession: async (sessionId) => {\n await ctx.workspaces.archiveSession(sessionId as SessionId)\n },\n createWorkspace: (input) => ctx.workspaces.create(input),\n pickDirectory: () => ctx.workspaces.pickDirectory(),\n hostDescription: (ctx.get('connection') as { hostDescription: GroupedSidebarInjected['hostDescription'] }).hostDescription,\n directoryFlow: {\n getSnapshot: () => ctx.slots.entries('sidebar.workspaces.directoryFlow').length > 0,\n subscribe: (listener) => ctx.slots.subscribe('sidebar.workspaces.directoryFlow', listener),\n },\n onReady: () => { if (epoch === seatEpoch) finishSeat() },\n })\n groupingDisposer = ctx.slots.inject('sidebar.workspaces', () => ctx.slots.register({\n name: 'sidebar.workspaces',\n priority: -1,\n locale: NS,\n inject: injectFace,\n }, GroupedSidebar))\n seatTimer = window.setTimeout(() => { if (epoch === seatEpoch) finishSeat() }, SEAT_READY_TIMEOUT_MS)\n return seatReady\n }\n\n const waitForGroupingSeat = async (enabled: boolean): Promise<void> => {\n await waitSnapshotMatches(enabled)\n await syncGroupingSeat()\n }\n\n // The Plugins configuration tab dispatches keyed cards for the namespaces\n // the Host serves; the git-worktree host half registers this key, so the\n // storage-root card pairs with it without any upstream change. One bind\n // backs both the card form (checkbox reads the snapshot) and the sidebar\n // seat (subscribe drives register/dispose).\n const form = new CardForm(groupingScope, waitForGroupingSeat)\n const store = form.bind()\n ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({\n name: 'settings.plugin.item',\n key: GIT_WORKTREE_NS,\n priority: -1,\n locale: NS,\n inject: () => ({\n hooks: { gitWorktreeCard: store },\n ...form.actions(),\n // The shell's own directory picker (the workspace flows' chooser):\n // resolves the chosen absolute path, or null when the user dismisses.\n pickDirectory: () => ctx.workspaces.pickDirectory(),\n }),\n }, GitWorktreeCard))\n\n // Native ui-workspace occupies the slot's default cell (priority 0). While\n // the switch is on, this entry shadows it at priority -1 (single cells\n // render their LOWEST live entry), and the disposer restores the native\n // browser the moment the switch flips or the fiber unloads.\n void syncGroupingSeat()\n const unsubscribeGrouping = groupingScope.subscribe(() => { void syncGroupingSeat() })\n ctx.effect(() => () => {\n unsubscribeGrouping()\n if (groupingDisposer !== undefined) groupingDisposer()\n }, 'git-worktree: sidebar grouping lifecycle')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAiCA,SAAgB,gBAAgB,QAAwB;GACtD,MAAM,KAAK,OAAO,QAAQ,GAAG;GAC7B,OAAO,MAAM,IAAI,SAAS,OAAO,MAAM,KAAK,CAAC;EAC/C;;;;;;;;;;;;EAyCA,SAAgB,gBAAgB,MAAsC;GACpE,IAAI,KAAK,KAAK,MAAM,IAAI,OAAO;GAC/B,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO;GACjC,IAAI,SAAS,KAAK,OAAO;GACzB,IAAI,4BAA4B,KAAK,IAAI,GAAG,OAAO;GACnD,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,OAAO;GAC9E,IAAI,KAAK,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG,OAAO;GACvD,IAAI,KAAK,SAAS,GAAG,GAAG,OAAO;GAC/B,IAAI,WAAW,KAAK,IAAI,GAAG,OAAO;GAClC,IAAI,0BAA0B,KAAK,IAAI,GAAG,OAAO;GACjD,OAAO;EACT;;;;;;;;;;EChFA,MAAa,eAAe;;EAG5B,MAAa,eAAe,GAAG,aAAa;;EAG5C,MAAa,iBAAiB,GAAG,aAAa;;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W;IAAE,GAAG,qBAAqB;IACpG,OAAO;GACT;GAEA,MAAM,sBAAsB,OAAO,YAAoC;IACrE,MAAM,oBAAoB,OAAO;IACjC,MAAM,iBAAiB;GACzB;GAOA,MAAM,OAAO,IAAI,SAAS,eAAe,mBAAmB;GAC5D,MAAM,QAAQ,KAAK,KAAK;GACxB,IAAI,MAAM,OAAO,8BAA8B,IAAI,MAAM,SAAS;IAChE,MAAM;IACN,KAAK;IACL,UAAU;IACV,QAAQ;IACR,eAAe;KACb,OAAO,EAAE,iBAAiB,MAAM;KAChC,GAAG,KAAK,QAAQ;KAGhB,qBAAqB,IAAI,WAAW,cAAc;IACpD;GACF,GAAG,eAAe,CAAC;GAMnB,iBAAsB;GACtB,MAAM,sBAAsB,cAAc,gBAAgB;IAAE,iBAAsB;GAAE,CAAC;GACrF,IAAI,mBAAmB;IACrB,oBAAoB;IACpB,IAAI,qBAAqB,KAAA,GAAW,iBAAiB;GACvD,GAAG,0CAA0C;EAC/C"}
1
+ {"version":3,"file":"client.js","names":["error","useRef","useCallback","useState","useMemo","css","IconChevronDownOutline14","IconChevronRightOutline14","IconCheckOutline16","createPortal","IconPlusOutline16","IconGoalOutline16","IconChevronUpOutline14","useState","useCallback","useRef","createPortal","css","useMemo","IconBranchOutline16","Toast","useState","css","IconChevronDownOutline14","IconLoadingOutline16","cx","css","useState","IconEditOutline16","IconTrashOutline16","IconFolderOpen16","IconFolderClose16","IconTriangleRightFill14","Menu","IconEllipsisOutline16","IconPlusOutline16","HoverCard","abbreviateHomePath","StateDot","IconBranchOutline16","IconArchiveOutline20","useState","Menu","Tooltip","css","IconPersonalizationOutline16","useRef","Modal","Button","useMemo","useSyncExternalStore","IconSearchOutline16","IconCloseFill14","IconProjectAddOutline16","Toast"],"sources":["../src/normalize.ts","../src/wire.ts","../src/client/api.ts","../src/client/BranchMenu.tsx","../src/client/BranchChip.tsx","../src/client/card-form.ts","../src/client/GitWorktreeCard.tsx","../src/client/sidebar-groups.ts","../src/client/sidebar-search.ts","../src/client/sidebar-rows.tsx","../src/client/pick-flow.ts","../src/client/GroupedSidebar.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Pure branch/path name normalization for worktree directory placement.\n * Windows-forbidden characters are the governing constraint: a worktree\n * folder name must survive on every platform the host runs on.\n */\n\n/**\n * Turn a branch display name into a single safe directory segment.\n * `feat/auth-login` → `feat-auth-login`; every Windows-forbidden character\n * (`<>:\"|?*`, control chars) and `/` become `-`; runs of separators (`-`,\n * `.`, whitespace — so a `//` or a git-illegal `..` collapses too) merge to\n * one `-`; a single interior `.` survives (`v1.2.3` stays readable); trailing\n * dots and spaces (Windows-forbidden suffixes) are stripped; the result is\n * clamped to 64 characters and never empty or dash-only.\n * @param branch - branch display name (local or `remote/name` form).\n * @returns a safe single path segment.\n */\nexport function sanitizeBranchDir(branch: string): string {\n const replaced = branch.replace(/[<>:\"/\\\\|?*\\u0000-\\u001f\\s]/g, '-')\n const merged = replaced.replace(/[-.]{2,}/g, '-')\n const trimmed = merged.replace(/[.\\s-]+$/, '')\n const clamped = trimmed.slice(0, 64).replace(/[.\\s-]+$/, '')\n return clamped === '' || clamped.replaceAll('-', '') === '' ? 'branch' : clamped\n}\n\n/**\n * Local branch name for a display name: strip the leading `<remote>/` segment\n * when one is present (`origin/feat/x` → `feat/x`). A local branch whose own\n * name contains `/` (like `feat/x`) passes through unchanged — callers that\n * need certainty compare against the authoritative branch list instead.\n * @param branch - branch display name.\n * @returns the candidate local branch name.\n */\nexport function localBranchName(branch: string): string {\n const at = branch.indexOf('/')\n return at <= 0 ? branch : branch.slice(at + 1)\n}\n\n/**\n * Split a `<remote>/<name>` display name when it plausibly names a remote\n * branch: the first `/`-separated segment is treated as the remote.\n * @param branch - branch display name.\n * @returns the remote part and the local-twin name, or undefined when the\n * name has no `/` (a local branch or a bare word).\n */\nexport function splitRemoteBranch(branch: string): { remote: string; name: string } | undefined {\n const at = branch.indexOf('/')\n if (at <= 0) return undefined\n return { remote: branch.slice(0, at), name: branch.slice(at + 1) }\n}\n\n/**\n * Validate a user-configured worktree storage root: an absolute path on any\n * platform (POSIX `/…`, Windows drive `C:\\…`/`C:/…`, or UNC `\\\\…`).\n * @param value - raw settings string.\n * @returns true when the value names an absolute path.\n */\nexport function isAbsoluteConfigPath(value: string): boolean {\n if (value === '') return false\n if (value.startsWith('/') || value.startsWith('\\\\')) return true\n return /^[a-zA-Z]:[\\\\/]/.test(value)\n}\n\n/** Why a user-typed NEW branch name is not acceptable yet (null = fine). */\nexport type BranchNameIssue = 'empty' | 'leadingDash' | 'illegal'\n\n/**\n * Pre-flight check of a user-typed NEW branch name against git's ref-name\n * rules (git check-ref-format's reject list, the subset typing can hit):\n * non-empty; no leading `-` (git would parse it as a flag); no space, `~^:?*[\\`\n * or control character; no `..`, `@{`, `//`, leading/trailing `/`; no component\n * starting with `.` or ending with `.lock`; no trailing `.`; not the lone `@`.\n * `git switch -c` stays the authority — a miss here surfaces through the\n * error envelope — this only feeds immediate form feedback.\n * @param name - raw draft text (NOT trimmed: a space is a real issue).\n * @returns the issue kind, or null when the name is acceptable.\n */\nexport function branchNameIssue(name: string): BranchNameIssue | null {\n if (name.trim() === '') return 'empty'\n if (name.startsWith('-')) return 'leadingDash'\n if (name === '@') return 'illegal'\n if (/[\\s~^:?*[\\\\\\u0000-\\u001f]/.test(name)) return 'illegal'\n if (name.includes('..') || name.includes('@{') || name.includes('//')) return 'illegal'\n if (name.startsWith('/') || name.endsWith('/')) return 'illegal'\n if (name.endsWith('.')) return 'illegal'\n if (/(^|\\/)\\./.test(name)) return 'illegal'\n if (/(^|\\/)[^/]+\\.lock($|\\/)/.test(name)) return 'illegal'\n return null\n}\n","/**\n * Shared wire contract between the host half (HTTP routes under\n * `/plugin/git-worktree`) and the browser half (chip + plugin settings card).\n * Zero runtime dependencies: constants and types only, imported by both\n * builds.\n */\n\n/** Absolute pathname prefix every route of this plugin lives under. */\nexport const ROUTE_PREFIX = '/plugin/git-worktree'\n\n/** GET ROUTE_PREFIX/status?path=<absolute dir> */\nexport const ROUTE_STATUS = `${ROUTE_PREFIX}/status`\n\n/** POST ROUTE_PREFIX/worktree — create-or-reuse a worktree for a branch. */\nexport const ROUTE_WORKTREE = `${ROUTE_PREFIX}/worktree`\n\n/** POST ROUTE_PREFIX/switch — in-place branch switch of the main checkout. */\nexport const ROUTE_SWITCH = `${ROUTE_PREFIX}/switch`\n\n/** POST ROUTE_PREFIX/branch — create a NEW branch from the current checkout and switch to it. */\nexport const ROUTE_BRANCH = `${ROUTE_PREFIX}/branch`\n\n/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune). */\nexport const ROUTE_FETCH = `${ROUTE_PREFIX}/fetch`\n\n/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream. */\nexport const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`\n\n/** POST ROUTE_PREFIX/group — git belonging facts for a batch of workspace paths. */\nexport const ROUTE_GROUP = `${ROUTE_PREFIX}/group`\n\n/** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */\nexport const ROUTE_INSPECT = `${ROUTE_PREFIX}/inspect`\n\n/** POST ROUTE_PREFIX/remove — delete one linked worktree (git registration + folder). */\nexport const ROUTE_REMOVE = `${ROUTE_PREFIX}/remove`\n\n/** POST ROUTE_PREFIX/exists — batch directory-existence probe (fs, no git). */\nexport const ROUTE_EXISTS = `${ROUTE_PREFIX}/exists`\n\n/** POST ROUTE_PREFIX/ensure-directory — mkdir -p a missing worktree storage slot. */\nexport const ROUTE_ENSURE_DIRECTORY = `${ROUTE_PREFIX}/ensure-directory`\n\n/** One selectable branch row. */\nexport interface BranchEntry {\n /** Display name: a bare local name (`main`) or `<remote>/<name>`. */\n name: string\n kind: 'local' | 'remote'\n /** Commits the local branch is AHEAD of its upstream (local rows with an\n * upstream only; absent = no upstream or in sync). */\n ahead?: number\n /** Commits the local branch is BEHIND its upstream (same conditions). */\n behind?: number\n}\n\n/** One existing worktree of the repository. */\nexport interface WorktreeEntry {\n /** Absolute path of the worktree directory. */\n path: string\n /** Checked-out local branch name; absent for a detached or bare worktree. */\n branch: string | undefined\n /** True for the main worktree (the one holding `.git`). */\n main: boolean\n}\n\n/** Response of GET status — `repo: false` for a directory outside any git repository. */\nexport type RepoStatus =\n | { repo: false }\n | {\n repo: true\n /** Main repository directory basename — the root folder of `<rootDir>/<repoName>/`. */\n repoName: string\n /** Absolute path of the main worktree directory. */\n repoRoot: string\n /** Branch checked out by the directory the client asked about. */\n currentBranch: string\n /** Local branches plus every remote's remote-only branches (those\n * without a same-named local twin; `<remote>/HEAD` dropped). */\n branches: BranchEntry[]\n /** Every worktree of the repository, main first (git order). */\n worktrees: WorktreeEntry[]\n /** Resolved worktree storage root (absolute) — what the settings say today. */\n rootDir: string\n }\n\n/** POST worktree request body. */\nexport interface CreateWorktreeBody {\n /** Any directory inside the repository (workspace cwd). */\n repoPath: string\n /** Chosen branch display name: local (`feat-x`) or remote (`origin/feat-x`). */\n branch: string\n /** True: cut a NEW branch out of `branch` (the current checkout's\n * branch — occupied by the main worktree) and isolate it in a fresh\n * worktree. The storage folder is named after the new branch. */\n cutout?: boolean\n /** Cutout only: explicit name for the NEW branch. Default (absent):\n * derived `<branch>-wt`, suffixing past taken names. */\n name?: string\n}\n\n/** POST worktree response body. */\nexport interface CreateWorktreeResult {\n /** The worktree directory (created or reused). */\n path: string\n /** False when an existing worktree for the branch was reused. */\n created: boolean\n}\n\n/** POST switch request body. */\nexport interface SwitchBody {\n /** Any directory inside the main worktree. */\n repoPath: string\n /** Target branch display name (local, or remote whose local twin is created by dwim). */\n branch: string\n}\n\n/** POST switch response body. */\nexport interface SwitchResult {\n /** The branch actually checked out after the switch. */\n branch: string\n}\n\n/** POST branch request body. */\nexport interface CreateBranchBody {\n /** Any directory inside the repository (workspace cwd) — the new branch is\n * cut from whatever this directory's HEAD points at and checked out HERE. */\n repoPath: string\n /** User-typed name of the branch to create (a local name, verbatim). */\n name: string\n}\n\n/** POST branch response body. */\nexport interface CreateBranchResult {\n /** The branch created and now checked out. */\n branch: string\n}\n\n/** POST fetch request body. */\nexport interface FetchBody {\n /** Any directory inside the repository (workspace cwd). */\n repoPath: string\n}\n\n/** POST fetch response body — the fetch mutates refs server-side; the\n * client refetches /status for the fresh branch list. */\nexport interface FetchResult {\n /** What the fetch covered: \"all\" remotes (this plugin always fetches all). */\n remote: string\n}\n\n/** POST update request body. */\nexport interface UpdateBody {\n /** Any directory inside the repository (workspace cwd) — the branch\n * checked out by THIS directory is the one updated. */\n repoPath: string\n}\n\n/** POST update response body — fetch every remote, then fast-forward the\n * checked-out branch to its upstream. */\nexport interface UpdateResult {\n /** The branch that was updated (empty for a detached checkout, which\n * cannot be updated and always errors before this response). */\n branch: string\n /** False when the upstream already contained the branch (nothing moved). */\n updated: boolean\n}\n\n/** Error envelope every non-2xx response carries. */\nexport interface RouteError {\n error: string\n}\n\n/** Git belonging facts of one workspace directory; null = not a git repository. */\nexport interface WorkspaceGitFacts {\n /** Grouping key: the repository's main worktree directory (canonical). */\n repoRoot: string\n /** Group title: the main repository directory basename. */\n repoName: string\n /** Branch checked out by this directory; null = detached or unborn HEAD. */\n branch: string | null\n /** True when this directory IS the main worktree (holds the shared .git). */\n main: boolean\n}\n\n/** POST group request body. */\nexport interface GroupWorkspacesBody {\n /** Absolute workspace directories to probe (deduped server-side). */\n paths: string[]\n}\n\n/** POST group response body — one entry per DISTINCT requested path. */\nexport interface GroupWorkspacesResult {\n /** Git facts per path; null marks a path outside any git repository. */\n facts: Record<string, WorkspaceGitFacts | null>\n}\n\n/** POST inspect request body. */\nexport interface InspectWorktreeBody {\n /** The worktree directory to inspect (absolute). */\n path: string\n}\n\n/** POST inspect response body — the facts the remove-confirm dialog shows. */\nexport interface InspectWorktreeResult {\n /** Uncommitted changes in the directory (staged + unstaged + untracked\n * file rows of `git status --porcelain`). */\n dirty: number\n /** Commits the checked-out branch is ahead of its upstream; absent = no\n * upstream. Purely informational: the branch ref survives the removal, so\n * these commits are NOT lost. */\n ahead?: number\n}\n\n/** POST remove request body. */\nexport interface RemoveWorktreeBody {\n /** The linked worktree directory to delete (absolute). */\n path: string\n /** True: force past uncommitted changes (the confirm dialog already\n * showed the dirty count). */\n force?: boolean\n}\n\n/** POST remove response body. */\nexport interface RemoveWorktreeResult {\n /** The removed worktree directory. */\n path: string\n /** True when only a stale registration was pruned (the directory was\n * already gone); false when `git worktree remove` deleted a live folder. */\n pruned: boolean\n}\n\n/** POST exists request body. */\nexport interface PathExistsBody {\n /** Absolute directories to probe (deduped server-side). */\n paths: string[]\n}\n\n/** POST exists response body — one entry per DISTINCT requested path; true =\n * the path exists AND is a directory. The client gates the register action on\n * this, so a missing folder never reaches the DSH workspace API. */\nexport interface PathExistsResult {\n exists: Record<string, boolean>\n /** Per MISSING path: true when it sits DIRECTLY inside the plugin's\n * worktree storage root — a slot this plugin planned, so rebuilding the\n * empty directory is safe (historical sessions reattach automatically once\n * realpath matches again). Absent paths and directories outside the root\n * never appear here. */\n rebuildable?: Record<string, boolean>\n}\n\n/** POST ensure-directory request body. */\nexport interface EnsureDirectoryBody {\n /** The missing directory to create (absolute; must sit directly inside the\n * worktree storage root). */\n path: string\n}\n\n/** POST ensure-directory response body. */\nexport interface EnsureDirectoryResult {\n /** Always true on 200 — the directory now exists (created, or already\n * present as a directory). */\n created: boolean\n}\n","/**\n * Browser-side fetch client for the plugin's host routes. Plain fetch against\n * same-origin paths; every failure resolves to `{ error }` so callers can\n * branch without try/catch.\n */\n\nimport type {\n CreateBranchResult, CreateWorktreeResult, EnsureDirectoryResult, FetchResult, GroupWorkspacesResult, InspectWorktreeResult, PathExistsResult, RemoveWorktreeResult, RepoStatus, RouteError, SwitchResult, UpdateResult,\n} from '../wire.ts'\nimport { ROUTE_BRANCH, ROUTE_ENSURE_DIRECTORY, ROUTE_EXISTS, ROUTE_FETCH, ROUTE_GROUP, ROUTE_INSPECT, ROUTE_REMOVE, ROUTE_STATUS, ROUTE_SWITCH, ROUTE_UPDATE, ROUTE_WORKTREE } from '../wire.ts'\n\n/** One route call outcome: the parsed body, or the error envelope text. */\ntype Call<T> = (T & { ok: true }) | { ok: false; error: string }\n\n/** POST one JSON body and parse the uniform envelope. */\nasync function post<T>(url: string, body: unknown): Promise<Call<T>> {\n return send<T>('POST', url, body)\n}\n\n/** Send one JSON body with any method and parse the uniform envelope. */\nasync function send<T>(method: string, url: string, body: unknown): Promise<Call<T>> {\n try {\n const response = await fetch(url, {\n method,\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n })\n const payload: unknown = await response.json()\n if (!response.ok) {\n const error = payload as RouteError\n return { ok: false, error: error.error ?? `HTTP ${String(response.status)}` }\n }\n return { ...(payload as T), ok: true }\n } catch (cause) {\n return { ok: false, error: cause instanceof Error ? cause.message : String(cause) }\n }\n}\n\n/**\n * Repository status for one directory.\n * @param path - absolute workspace directory.\n */\nexport async function fetchStatus(path: string): Promise<Call<RepoStatus>> {\n try {\n const response = await fetch(`${ROUTE_STATUS}?path=${encodeURIComponent(path)}`, { cache: 'no-store' })\n if (!response.ok) return { ok: false, error: `HTTP ${String(response.status)}` }\n return { ...(await response.json() as RepoStatus), ok: true }\n } catch (cause) {\n return { ok: false, error: cause instanceof Error ? cause.message : String(cause) }\n }\n}\n\n/**\n * Create or reuse the worktree for a branch.\n * @param repoPath - absolute directory inside the repository.\n * @param branch - branch display name.\n */\nexport function requestWorktree(repoPath: string, branch: string): Promise<Call<CreateWorktreeResult>> {\n return post<CreateWorktreeResult>(ROUTE_WORKTREE, { repoPath, branch })\n}\n\n/**\n * Cut a NEW branch out of the current checkout and isolate it in a fresh\n * worktree (the current branch itself is occupied by the main worktree).\n * @param repoPath - absolute directory inside the repository.\n * @param branch - the current checkout's branch (or `HEAD` when detached).\n * @param name - explicit name for the new branch; omitted, the host\n * derives `<branch>-wt`, suffixing past taken names.\n */\nexport function requestWorktreeCutout(repoPath: string, branch: string, name?: string): Promise<Call<CreateWorktreeResult>> {\n return post<CreateWorktreeResult>(ROUTE_WORKTREE, { repoPath, branch, cutout: true, ...(name === undefined ? {} : { name }) })\n}\n\n/**\n * Switch the main checkout in place.\n * @param repoPath - absolute directory inside the main worktree.\n * @param branch - branch display name.\n */\nexport function requestSwitch(repoPath: string, branch: string): Promise<Call<SwitchResult>> {\n return post<SwitchResult>(ROUTE_SWITCH, { repoPath, branch })\n}\n\n/**\n * Create a NEW branch from the directory's current checkout and switch to it\n * in place.\n * @param repoPath - absolute directory whose HEAD the branch is cut from.\n * @param name - user-typed new branch name (validated client-side already).\n */\nexport function requestCreateBranch(repoPath: string, name: string): Promise<Call<CreateBranchResult>> {\n return post<CreateBranchResult>(ROUTE_BRANCH, { repoPath, name })\n}\n\n/**\n * Sync remote-tracking refs (fetch every remote + prune) for the repository.\n * @param repoPath - absolute directory inside the repository.\n */\nexport function requestFetch(repoPath: string): Promise<Call<FetchResult>> {\n return post<FetchResult>(ROUTE_FETCH, { repoPath })\n}\n\n/**\n * Update the CURRENT checkout: fetch every remote, then fast-forward the\n * checked-out branch to its upstream.\n * @param repoPath - absolute directory whose checked-out branch is updated.\n */\nexport function requestUpdate(repoPath: string): Promise<Call<UpdateResult>> {\n return post<UpdateResult>(ROUTE_UPDATE, { repoPath })\n}\n\n/**\n * Git belonging facts for a batch of workspace directories; a path outside\n * any git repository answers null, a failed route call answers the error\n * envelope (the sidebar then renders flat, its degrade shape).\n * @param paths - absolute workspace directories to probe.\n */\nexport async function requestGroupWorktrees(paths: readonly string[]): Promise<Call<GroupWorkspacesResult>> {\n return post<GroupWorkspacesResult>(ROUTE_GROUP, { paths })\n}\n\n/**\n * Pre-delete facts for one worktree directory: the uncommitted-file count\n * (lost with the folder) and the branch's ahead count (kept).\n * @param path - absolute worktree directory.\n */\nexport function requestInspectWorktree(path: string): Promise<Call<InspectWorktreeResult>> {\n return post<InspectWorktreeResult>(ROUTE_INSPECT, { path })\n}\n\n/**\n * Remove one linked worktree (git registration + folder). `force` rides\n * `--force` past uncommitted changes the confirm dialog already showed.\n * @param path - absolute worktree directory to delete.\n * @param force - delete past uncommitted changes.\n */\nexport function requestRemoveWorktree(path: string, force: boolean): Promise<Call<RemoveWorktreeResult>> {\n return post<RemoveWorktreeResult>(ROUTE_REMOVE, { path, force })\n}\n\n/**\n * Batch directory-existence probe (true = exists AND is a directory). The\n * sidebar gates register-as-workspace on this so a missing folder never\n * reaches the DSH workspace API.\n * @param paths - absolute directories to probe.\n */\nexport function requestPathExists(paths: readonly string[]): Promise<Call<PathExistsResult>> {\n return post<PathExistsResult>(ROUTE_EXISTS, { paths })\n}\n\n/**\n * Recreate a missing worktree storage slot (`mkdir -p`). The host gates this\n * to paths directly inside the storage root; historical sessions reattach\n * automatically once the directory is back.\n * @param path - the missing slot directory (absolute).\n */\nexport function requestEnsureDirectory(path: string): Promise<Call<EnsureDirectoryResult>> {\n return post<EnsureDirectoryResult>(ROUTE_ENSURE_DIRECTORY, { path })\n}\n","/**\n * BranchMenu: the branch picker popup anchored to the composer branch chip.\n * The base Menu primitive exposes neither a height cap nor a search field,\n * so with many branches its portal list fills the viewport — this popup\n * replaces it with an owner-styled card: Menu's card chrome (r12, inverted\n * hairline, shadow-lv3, --dsw-specific-menu, see .menuCard) on a\n * portal-fixed posture, with owner requirements baked in:\n *\n * 1. the card is capped at min(420px, 60vh) and only the branch rows\n * scroll (heading, search, and the toolbar stay pinned);\n * 2. a search field is pinned at the card's bottom edge — the row list\n * scrolls above it — filtering rows by case-insensitive substring\n * while KEEPING the matching branches' ancestor folders (IDEA-style\n * prune) and highlighting the hit substring;\n * 3. the card opens entirely above the chip: the CSS `bottom` pins its\n * bottom edge ~6px above the chip's top, so it grows upward and can\n * never cover the composer, whatever the branch count.\n *\n * Layout (IDEA branch-panel posture at popup scale): a narrow tool strip\n * on the left (locate-current + expand/collapse-all + new-branch), then a\n * main column of heading / tree / search. The list renders in TWO\n * top-level collapsible groups — local branches first, then remote\n * branches (each a folder-header-style row with chevron + count): under a\n * SINGLE remote the remote rows drop their `<remote>/` prefix (the header\n * already says \"remote\"; a stripped display name can never collide with a\n * local row because the host hides remote branches that have a local\n * twin), with SEVERAL remotes the full names stay so `origin`/`upstream`\n * become the folder layer beneath the header. Picking a remote row hands\n * the owner the real `<remote>/name` (see pick) — the remote confirms are\n * the owner's wording (tracking-twin switch / twin-in-worktree).\n * Selection model borrowed from\n * IDEA: a single click SELECTS a row (blue); double-click or Enter then OPENS the\n * right-side confirm flyout for that row — the switch itself always goes\n * through the confirmation step, never straight away. While the confirm\n * flyout is open, clicking another row re-anchors it (the old one-click\n * pick flow).\n *\n * The new-branch tool (the toolbar's plus) opens the create flyout to the\n * RIGHT of the card (the confirm flyout's submenu posture): the flyout\n * holds the naming input — validated as you type (git ref-name rules plus\n * a duplicate check against the rows) with a live hint naming the issue\n * or, while the draft is acceptable, the branch the cut starts from — and\n * the Cancel/Create pair. Confirming fires the create in ONE stroke\n * (create AND in-place switch; no second confirm step — typing the name\n * into the flyout and pressing Create IS the intent). While the create\n * runs the flyout freezes (busy disables input and buttons); a failure\n * toasts and leaves the flyout open for a renamed retry.\n * The confirm flyout is a second-level portal opening to the RIGHT of the\n * branch card (the base Menu's submenu posture): the chip sits in the\n * bottom composer, so the old below-the-chip bubble landed off-viewport.\n * The flyout is a separate portal (not clipped by the card's\n * overflow:hidden), horizontally anchored to the card's right edge — it\n * can never overlap the branch list — and vertically centered on the\n * picked row. Its width is content-driven, capped in CSS, wrapping.\n *\n * Close semantics: outside pointerdown (card, flyouts, and chip excluded)\n * cancels the confirm and closes the menu; Escape unwinds tier by tier —\n * confirm, then the create flyout, then search text, then selection, then\n * the menu; Enter in the search field commits the first enabled visible row.\n *\n * Long names and many branches: a clipped label shows the full name on\n * hover via the native title (gated to actually-clipped rows only). The\n * list ALWAYS renders as a full-depth '/' prefix tree: folder-header rows\n * (chevron + count) toggle; under an expanded folder, child rows show only\n * their own segment (indentation carries the hierarchy — no repeated path,\n * no color distinction); linear chains compress into one row. TREE_MIN_ROWS\n * only sets the DEFAULT opening depth: past it, just the checked-out\n * branch's chain starts open (centering still lands it mid-viewport); at\n * or under it, every folder starts open — few branches have nothing to hide.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n IconCheckOutline16,\n IconChevronDownOutline14,\n IconChevronRightOutline14,\n IconChevronUpOutline14,\n IconGoalOutline16,\n IconPlusOutline16,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { branchNameIssue } from '../normalize.ts'\nimport css from './BranchChip.module.css'\n\n/** One selectable branch row. `name` is the ACTION name sent to the owner —\n * for a remote row the full `origin/feat-x`; the group model derives the\n * DISPLAY name (see groupRows). `ahead`/`behind` are local-row-only\n * upstream divergence counts (absent without an upstream or in sync).\n * `path` is worktree-row-only: the directory a pick hops the session into.\n * `locked` rows are DIMMED but clickable — a pick still reaches the owner,\n * which answers with the main-checkout hint inside a linked-worktree\n * session (deliberately NOT the HTML disabled attribute: a disabled button\n * swallows the click, and the hint would never fire). */\nexport interface BranchRow {\n name: string\n kind: 'local' | 'remote' | 'worktree'\n path?: string\n ahead?: number\n behind?: number\n locked?: boolean\n}\n\n/** The confirm flyout bundle, owned and localized by the caller. */\nexport interface BranchConfirmFly {\n /** Ask line (already localized). */\n ask: string\n /** The branch the ask refers to, on its own weight-500 line (remote\n * picks only — the ask line says \"该远程分支\" and this names it). */\n subject?: string\n /** Confirm-button label (progress text while busy). */\n confirmLabel: string\n /** Cancel-button label. */\n cancelLabel: string\n /** True while the action runs: both buttons disable. */\n busy: boolean\n /** Run the confirmed action. */\n onConfirm: () => void\n /** Dismiss the flyout without acting (stays on the open menu). */\n onCancel: () => void\n}\n\n/** Full props: anchor + data + confirm bundle + callbacks + locale seat. */\nexport interface BranchMenuProps {\n /** Whether the popup shows. */\n open: boolean\n /** The chip element — the popup's bottom edge pins just above its top. */\n anchorRef: React.RefObject<HTMLElement | null>\n /** Every branch as a row (local, remote, and one worktree row per live\n * linked worktree; remote rows carry their `<remote>/name` action name). */\n rows: readonly BranchRow[]\n /** Whether the worktree group is offered (a session hop only makes\n * sense while the session is blank — a started session's directory is\n * fixed). Blank sessions show the group, started ones never do. */\n canAdopt: boolean\n /** The branch currently checked out (trailing check, HEAD tint). */\n currentBranch: string\n /** Non-null while a picked branch awaits confirmation. */\n confirm: BranchConfirmFly | null\n /** Stage a pick (starts the confirm flyout beside that row). Current\n * branch re-select closes the menu unless the owner stages otherwise. */\n onSelect: (branch: string) => void\n /** Whether the new-branch tool is offered (worktree mode routes creation\n * through the cutout flow instead — the toolbar plus then disables). */\n canCreate: boolean\n /** Run the create NOW (create AND in-place switch): the flyout's Create\n * button fires this once for a valid draft — no second confirm step. */\n onCreate: (name: string) => void\n /** True while the create runs: the flyout freezes (input and buttons\n * disable, the Create button shows progress text). */\n busy: boolean\n /** Sync remote-tracking refs (fetch every remote + prune); the owner\n * refreshes the rows when it lands — the menu stays open. */\n onFetch: () => void\n /** True while the remote sync runs: the fetch tool spins and the update\n * tool disables (single-flight). */\n fetchBusy: boolean\n /** Update the CURRENT branch: fetch + fast-forward it to its upstream;\n * the owner refreshes the rows when it lands. */\n onUpdate: () => void\n /** True while the update runs: the update tool spins and the fetch tool\n * disables (single-flight). */\n updateBusy: boolean\n /** Dismiss the menu (outside click, Escape with nothing open). */\n onClose: () => void\n /** Bound locale translate (placeholder, empty state, heading, toolbar). */\n t: PropsLocale<'git-worktree'>['t']\n}\n\n/**\n * The fetch/update glyph in IDEA's posture: a diagonal running from the\n * top-right down to a bottom-left arrowhead. `dashed` marks the metadata\n * move (fetch touches remote-tracking refs only, never working-tree\n * content); the solid variant is the in-place branch update (fetch +\n * fast-forward) — the pairing is IDEA's dashed/solid synchronize/update\n * language. The base library has no such glyph, so both are drawn here,\n * local to the menu; the sync spin animation targets `svg` descendants of\n * the tool button and applies to them unchanged.\n */\nfunction FetchGlyph({ size = 16, dashed = true }: { size?: number; dashed?: boolean }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M13 3 L5.9 10.1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.3\"\n strokeLinecap=\"round\"\n strokeDasharray={dashed ? '2.4 1.6' : undefined}\n />\n <path\n d=\"M5 5.9 V11 H10.1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/** Viewport edge clearance, mirroring the base Menu portal margin. */\nconst MARGIN = 12\n/** Gap kept between the chip's top edge and the card's bottom edge. */\nconst GAP = 6\n/** Design card width — the CSS width's px arm; used for horizontal clamping. */\nconst CARD_WIDTH = 360\n/** Design flyout width cap — matches .popCard's max-width arm. */\nconst FLY_MAX_WIDTH = 400\n/** After a folder toggle, clicks arriving within this window are swallowed\n * (double-click misfire guard — see shiftGuardUntil in the component). */\nconst CLICK_GUARD_MS = 250\n/** Unplaced flyout: hidden but laid out at a fixed origin so offsetWidth/\n * offsetHeight are real for the measure-then-place pass (base Menu trick). */\nconst FLY_MEASURE: CSSProperties = { left: '-9999px', top: '0px', visibility: 'hidden' }\n\n/** Past this many rows the tree starts with ONLY the checked-out branch's\n * chain open; at or under it every folder starts open (few branches have\n * nothing to hide). The tree itself always renders — this threshold is\n * about the default opening depth, never about flat vs tree. */\nconst TREE_MIN_ROWS = 8\n\n/** Leaf rows indent one chevron slot PAST their tree depth. Folder headers\n * lead with a collapsing chevron (12px icon + 6px gap) that leaf rows lack\n * — without compensation a leaf's text starts LEFT of its own group header's\n * text and same-level leaves read shallower than folders. The extra 18px\n * aligns same-level leaf TEXT with folder TEXT (the VS Code file-tree\n * posture: a chevron column marks foldable rows, a text column carries\n * content), so leaf padding is 8 + 12×depth + 18. */\nconst LEAF_CHEVRON_SLOT = 18\n\n/** One node of the '/' prefix tree built from the row list: every segment\n * boundary is a folder level, so `feature/x/y` nests under `feature` and\n * `x`, and the leaves (rows) sit at the terminal nodes. */\ninterface TreeNode {\n /** This node's own segment (the label text). */\n segment: string\n /** Full path: segments joined by '/'. Empty only at the root list. */\n path: string\n /** Depth from the root (root children are depth 0). */\n depth: number\n /** The branch named exactly `path`, if any — may coexist with children\n * (`feature` plus `feature/x` are both legal git branch names). */\n leaf: BranchRow | null\n /** Children, sorted folders-first then by segment. */\n children: TreeNode[]\n /** Leaf branches under this node, including its own leaf. */\n total: number\n}\n\n/** Every folder path that renders a header, walking the tree depth-first. */\nfunction collectFolderPaths(nodes: TreeNode[], out: string[] = []): string[] {\n for (const node of nodes) {\n if (node.children.length > 0) {\n out.push(node.path)\n collectFolderPaths(node.children, out)\n }\n }\n return out\n}\n\nconst segCmp = (a: string, b: string): number =>\n a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })\n\n/**\n * The menu's group model derived from the flat row list: local rows as\n * they are, remote rows displayed under their group header, and worktree\n * rows collected as-is (one per linked worktree, direct hop targets). With\n * a SINGLE remote the `<remote>/` prefix is dropped from the display\n * (`origin/feat/x` reads as `feat/x` — the header already says \"remote\",\n * and a dropped display name can never collide with a local row because\n * the host hides remote branches that have a local twin); with SEVERAL\n * remotes the full name stays, so `origin`/`upstream` become the folder\n * layer that keeps same-named branches apart. `remoteNameMap` maps a\n * displayed remote name back to the action name (an identity map when\n * nothing was dropped).\n */\ninterface BranchGroups {\n localRows: BranchRow[]\n remoteDisplayRows: BranchRow[]\n worktreeRows: BranchRow[]\n remoteNameMap: ReadonlyMap<string, string>\n}\n\n/** Split rows into the three groups and derive the remote display names. */\nfunction groupRows(rows: readonly BranchRow[]): BranchGroups {\n const localRows: BranchRow[] = []\n const remoteRows: BranchRow[] = []\n const worktreeRows: BranchRow[] = []\n for (const row of rows) {\n if (row.kind === 'remote') remoteRows.push(row)\n else if (row.kind === 'worktree') worktreeRows.push(row)\n else localRows.push(row)\n }\n const first = remoteRows[0]?.name ?? ''\n const slash = first.indexOf('/')\n const soleRemote = slash > 0 && remoteRows.every(row => row.name.startsWith(first.slice(0, slash + 1)))\n ? first.slice(0, slash)\n : undefined\n const display = (name: string): string => soleRemote === undefined ? name : name.slice(soleRemote.length + 1)\n return {\n localRows,\n remoteDisplayRows: remoteRows.map(row => ({ ...row, name: display(row.name) })),\n worktreeRows,\n remoteNameMap: new Map(remoteRows.map(row => [display(row.name), row.name])),\n }\n}\n\n/** Expanded-key space: folder paths carry their group prefix so a local\n * folder can never share a toggle state with a same-named remote display\n * folder (`feat/x` on both sides). Group OPEN flags stay booleans beside\n * this set — they are not part of the path namespace at all. */\nconst groupKey = (group: 'local' | 'remote', path: string): string => `${group}:${path}`\n\n/** Build the prefix tree of the rows (see TreeNode). */\nfunction buildTree(rows: readonly BranchRow[]): TreeNode[] {\n /** Mutable builder node — same shape as TreeNode but built incrementally\n * (find-by-segment walks), sorted and totalled at the end. */\n interface M {\n segment: string\n path: string\n depth: number\n leaf: BranchRow | null\n children: M[]\n total: number\n }\n const root: M[] = []\n const find = (level: M[], segment: string): M | undefined =>\n level.find(n => n.segment === segment)\n for (const row of rows) {\n const segs = row.name.split('/').filter(s => s !== '')\n let level = root\n let path = ''\n for (let i = 0; i < segs.length; i += 1) {\n const seg = segs[i]\n if (seg === undefined) break\n path = path === '' ? seg : `${path}/${seg}`\n let node = find(level, seg)\n if (node === undefined) {\n node = { segment: seg, path, depth: i, leaf: null, children: [], total: 0 }\n level.push(node)\n }\n if (i === segs.length - 1) node.leaf = row\n level = node.children\n }\n }\n const finish = (nodes: M[]): void => {\n for (const node of nodes) finish(node.children)\n nodes.sort((a, b) => {\n const af = a.children.length > 0 ? 0 : 1\n const bf = b.children.length > 0 ? 0 : 1\n return af !== bf ? af - bf : segCmp(a.segment, b.segment)\n })\n }\n finish(root)\n const count = (nodes: M[]): void => {\n for (const node of nodes) {\n count(node.children)\n node.total = (node.leaf === null ? 0 : 1)\n + node.children.reduce((sum, c) => sum + c.total, 0)\n }\n }\n count(root)\n return root as unknown as TreeNode[]\n}\n\n/** The folders that must start expanded so the checked-out branch is\n * immediately visible in the tree: every proper ancestor of its path. */\nfunction chainExpanded(branch: string): Set<string> {\n const segs = branch.split('/').filter(s => s !== '')\n const set = new Set<string>()\n let path = ''\n for (let i = 0; i < segs.length - 1; i += 1) {\n const seg = segs[i]\n if (seg === undefined) break\n path = path === '' ? seg : `${path}/${seg}`\n set.add(path)\n }\n return set\n}\n\n/** Hover tooltip: set the native `title` ONLY when the label is actually\n * clipped (scrollWidth > clientWidth) — fitted names show no tooltip, and\n * long ones expose their full path without a custom bubble. The target is\n * the label span (first span child), the clipped element. */\nconst gateTooltip = (button: HTMLButtonElement, name: string): void => {\n const label = button.querySelector<HTMLElement>(':scope > span')\n if (label !== null) label.title = label.scrollWidth > label.clientWidth ? name : ''\n}\n\n/** Leaving a row drops its tooltip so a recycled DOM node (search refilter)\n * can never show a stale title for another branch. */\nconst clearTooltip = (button: HTMLButtonElement): void => {\n const label = button.querySelector<HTMLElement>(':scope > span')\n if (label !== null) label.title = ''\n}\n\n/**\n * Render the upward branch picker with its right-side confirm flyout.\n * @param props - anchor, rows, confirm bundle, callbacks, and the class sheet.\n * @returns null while closed or unplaced; otherwise the portaled card (+flyout).\n */\nexport function BranchMenu({\n open, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, onCreate, busy, onFetch, fetchBusy, onUpdate, updateBusy, onClose, t,\n}: BranchMenuProps) {\n const cardRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n /**\n * Search-field ref callback: focus the field the moment it mounts. The\n * card mounts in two stages (open flips, then pos resolves a render\n * later), so an [open]-keyed passive effect fires while the input is\n * still unmounted — its focus() no-ops against a null ref. Focusing at\n * mount time is immune to that race by construction.\n */\n /**\n * Search-field ref callback: focus the field the moment it mounts. The\n * card mounts in two stages (open flips, then pos resolves a render\n * later), so an [open]-keyed passive effect fires while the input is\n * still unmounted — its focus() no-ops against a null ref. Focusing at\n * mount time is immune to that race by construction. The callback MUST\n * be referentially stable: a fresh closure per render makes React\n * detach and re-attach it on every commit, and the re-attach runs\n * focus() again — each re-render (a click selection, a status refresh,\n * a sessions push) would yank focus back to the field, flickering its\n * focus tint. Stable identity = attach happens only at mount.\n */\n const holdSearchFocus = useCallback((el: HTMLInputElement | null): void => {\n inputRef.current = el\n if (el !== null) el.focus()\n }, [])\n /** Same mount-time focus trick for the new-branch input: the form mounts\n * when the toolbar plus flips `creating`, mid-card-lifecycle, so the ref\n * callback is the only reliable focus point. Stable for the same reason\n * as holdSearchFocus — typing would otherwise re-focus on every render. */\n const holdCreateFocus = useCallback((el: HTMLInputElement | null): void => {\n if (el !== null) el.focus()\n }, [])\n const flyRef = useRef<HTMLDivElement>(null)\n const flyConfirmRef = useRef<HTMLButtonElement | null>(null)\n /** The row whose pick is awaiting confirmation (anchoring element). */\n const pendingRef = useRef<{ name: string; el: HTMLElement } | null>(null)\n /** Pending row's name — the placement-effect trigger: picking another\n * row while the flyout is open must re-anchor it (confirmOpen alone\n * stays true, so a ref mutation re-renders nothing). */\n const [pendingName, setPendingName] = useState<string | null>(null)\n const [pos, setPos] = useState<{ left: number; bottom: number } | null>(null)\n const [flyPos, setFlyPos] = useState<{ left: number; top: number } | null>(null)\n const [query, setQuery] = useState('')\n /** Expanded folder set, keyed by group-prefixed node path (see groupKey).\n * Re-seeded on every open so the current branch's chain is visible\n * without re-expanding by hand. */\n const [expanded, setExpanded] = useState<ReadonlySet<string>>(new Set())\n /** Top-level group open flags, beside the expanded set (which owns\n * folder paths only — a group header is not a path node). Re-seeded on\n * every open: past TREE_MIN_ROWS the remote group starts closed so the\n * list leads with the local branches. The WORKTREE group starts open\n * unconditionally — it is the blank session's quick-hop entry, always\n * worth its few rows. */\n const [localGroupOpen, setLocalGroupOpen] = useState(true)\n const [remoteGroupOpen, setRemoteGroupOpen] = useState(true)\n const [worktreeGroupOpen, setWorktreeGroupOpen] = useState(true)\n /** IDEA-style selection: clicked row (blue). Zero or one at a time. */\n const [selected, setSelected] = useState<string | null>(null)\n /** The create flyout: open flag plus the live draft. Opening the menu\n * (or closing the flyout) resets both — see the open-reset effect. */\n const [creating, setCreating] = useState(false)\n const [draft, setDraft] = useState('')\n /** The create flyout element and its placed position (see its place\n * pass below; same measure-then-place posture as the confirm flyout). */\n const createFlyRef = useRef<HTMLDivElement | null>(null)\n const [createFlyPos, setCreateFlyPos] = useState<{ left: number; top: number } | null>(null)\n\n // Latest values for stable-effect listeners (the parent rebuilds the\n // confirm object each render; refs keep the document-level keydown and\n // outside-click handlers from going stale on the closure they captured).\n const confirmRef = useRef(confirm)\n confirmRef.current = confirm\n const queryRef = useRef(query)\n queryRef.current = query\n const selectedRef = useRef(selected)\n selectedRef.current = selected\n /** Fresh creating flag for the stale-safe document keydown listener. */\n const creatingRef = useRef(creating)\n creatingRef.current = creating\n /** Latest rows for the open-reset effect: the effect must NOT re-run when\n * a mid-open refresh swaps the rows (that would reset folders the user\n * has toggled), but the reset itself still needs the freshest list. */\n const latestRows = useRef(rows)\n latestRows.current = rows\n /** Always-fresh pick for the stale-safe document keydown listener. */\n const pickRef = useRef<(el: HTMLElement | null, name: string) => void>(() => {})\n const confirmOpen = confirm !== null\n\n /**\n * Double-click misfire guard: toggling a folder shifts the layout — the\n * second click of a double-click can land on a row that slid under the\n * cursor (a branch!), which would select it or pop the switch flyout.\n * After a folder toggle, every click swallowed for CLICK_GUARD_MS, so a\n * double-click on a folder expands it exactly once and never bleeds into\n * a branch click. Branch-row clicks do not arm the guard (selecting does\n * not move anything), so row double-clicks keep working instantly.\n */\n const shiftGuardUntil = useRef(0)\n const guardActive = (): boolean => Date.now() < shiftGuardUntil.current\n const armShiftGuard = (): void => { shiftGuardUntil.current = Date.now() + CLICK_GUARD_MS }\n\n /** Stage a pick: remember the row element (the flyout anchors beside\n * it), then hand the branch to the owner. All pick paths — search Enter,\n * keyboard Enter on a selected row — funnel through here. A remote row\n * carries its DISPLAY name through selection and anchors; the owner\n * always receives the real `<remote>/name` action name. */\n const pick = (el: HTMLElement | null, name: string): void => {\n if (el !== null) pendingRef.current = { name, el }\n setPendingName(name)\n onSelect(remoteNameMapRef.current.get(name) ?? name)\n }\n pickRef.current = pick\n\n /** The two-group model of the rows (see groupRows) and each group's '/'\n * prefix tree — always on; TREE_MIN_ROWS only sets the default opening\n * depth (see the open-reset effect). */\n const grouped = useMemo(() => groupRows(rows), [rows])\n const localTree = useMemo(() => buildTree(grouped.localRows), [grouped.localRows])\n const remoteTree = useMemo(() => buildTree(grouped.remoteDisplayRows), [grouped.remoteDisplayRows])\n /** Fresh display→action map for the stale-safe document keydown listener\n * (its Enter path funnels through pick, which reads the ref). */\n const remoteNameMapRef = useRef(grouped.remoteNameMap)\n remoteNameMapRef.current = grouped.remoteNameMap\n\n /** Every folder key that renders a header — the expand/collapse-all\n * button's scope (group-prefixed, see groupKey). */\n const folderPaths = useMemo(() => [\n ...collectFolderPaths(localTree).map(p => groupKey('local', p)),\n ...collectFolderPaths(remoteTree).map(p => groupKey('remote', p)),\n ], [localTree, remoteTree])\n /** Locked row names (dimmed, pick-answered-with-hint) — a Set for the\n * click gate. MUST sit before the `!open` early return: a hook after it\n * would change the hook count between a closed and an open menu\n * (React #310, seen live as the whole dock unmounting on first open). */\n const lockedRows = useMemo(\n () => new Set(rows.filter(r => r.locked === true).map(r => r.name)),\n [rows],\n )\n const allExpanded = folderPaths.every(p => expanded.has(p)) && localGroupOpen && remoteGroupOpen\n && (!canAdopt || worktreeGroupOpen)\n const toggleAll = (): void => {\n // The group headers join the toggle scope: one button opens (or\n // collapses) the whole tree, headers included.\n const next = !allExpanded\n setLocalGroupOpen(next)\n setRemoteGroupOpen(next)\n setWorktreeGroupOpen(next)\n setExpanded(next ? new Set(folderPaths) : new Set())\n }\n const locateCurrent = (): void => {\n // Locate, don't restructure: only ADD the current branch's ancestor\n // folders if they happen to be closed (the row must exist to scroll\n // to it) — folders the user expanded/collapsed stay untouched. The\n // LOCAL group opens too: the current branch usually lives there. In a\n // blank linked-worktree session, though, the branch is HELD by the\n // worktree this session sits in and its row was filed into the\n // WORKTREE group — that group must open as well, or the scroll target\n // never renders. Then center the row one frame later, once the\n // re-render has committed.\n setLocalGroupOpen(true)\n if (grouped.worktreeRows.some(row => row.name === currentBranch)) setWorktreeGroupOpen(true)\n setExpanded(prev => {\n const next = new Set(prev)\n for (const p of chainExpanded(currentBranch)) next.add(groupKey('local', p))\n return next\n })\n requestAnimationFrame(() => {\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n })\n }\n\n // Every open starts from a clean filter, selection, tree state, and\n // naming form. The tree's opening depth follows the list size: past\n // TREE_MIN_ROWS the local group (plus the checked-out branch's folder\n // chain) starts open while the remote group starts closed, at or under\n // it every group and folder does. Rows come through a ref — the effect\n // keys on [open, currentBranch] so a mid-open refresh never resets\n // folders the user has toggled by hand.\n useEffect(() => {\n if (!open) return\n setQuery('')\n setSelected(null)\n setCreating(false)\n setDraft('')\n const currentRows = latestRows.current\n const current = groupRows(currentRows)\n const localPaths = collectFolderPaths(buildTree(current.localRows)).map(p => groupKey('local', p))\n const remotePaths = collectFolderPaths(buildTree(current.remoteDisplayRows)).map(p => groupKey('remote', p))\n const many = currentRows.length > TREE_MIN_ROWS\n setLocalGroupOpen(true)\n setRemoteGroupOpen(!many)\n setWorktreeGroupOpen(true)\n setExpanded(\n many\n ? new Set([...chainExpanded(currentBranch)].map(p => groupKey('local', p)))\n : new Set([...localPaths, ...remotePaths]),\n )\n }, [open, currentBranch])\n\n // A selection that no longer exists in the rows (worktree toggle, refresh)\n // must not linger as a phantom Enter target.\n useEffect(() => {\n if (selected !== null && !rows.some(r => r.name === selected)) setSelected(null)\n }, [rows, selected])\n\n /** Toggle one folder header. */\n const toggle = (path: string): void => {\n setExpanded(prev => {\n const next = new Set(prev)\n if (next.has(path)) next.delete(path)\n else next.add(path)\n return next\n })\n }\n\n // Pin above the chip on open and on viewport movement while open. CSS\n // `bottom` pinning means the card grows upward from that edge without\n // measuring its own height; the width is fixed by CSS, so the horizontal\n // clamp is deterministic.\n useLayoutEffect(() => {\n if (!open) {\n setPos(null)\n return\n }\n const place = (): void => {\n const anchor = anchorRef.current\n if (anchor === null) return\n const rect = anchor.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = Math.min(Math.max(rect.left, MARGIN), Math.max(MARGIN, vw - CARD_WIDTH - MARGIN))\n setPos({ left, bottom: vh - rect.top + GAP })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [open, anchorRef])\n\n // Land the current-branch row mid-viewport when the list shows. With\n // dozens of branches the row otherwise drowns off-screen and \"where am\n // I?\" becomes a scroll hunt. Two trigger paths, both required:\n //\n // - rows MOUNT: the card mounts in two stages (open flips, pos\n // resolves a render later), so an [open]-keyed effect runs while\n // nothing is mounted and never re-fires once rows appear — the\n // stable mount-signal ref below fires exactly at mount instead;\n // - filter CLEARS back to the full list: the rows container is\n // long-mounted by then, so a plain [query] effect reaches it.\n //\n // Manual scrollTo on the rows container — scrollIntoView would also drag\n // scrollable ancestors. Re-renders must NOT re-center (it would yank the\n // user's scroll during picks), hence the stable useCallback identity.\n const rowsRef = useRef<HTMLElement | null>(null)\n const centerCurrentRow = useCallback((viewport: HTMLElement): void => {\n const row = [...viewport.querySelectorAll<HTMLButtonElement>('button[role=\"menuitem\"][data-branch]')]\n .find(b => (b.dataset.branch ?? '') === currentBranch)\n if (row === undefined) return\n const rowRect = row.getBoundingClientRect()\n const vpRect = viewport.getBoundingClientRect()\n const target = viewport.scrollTop + (rowRect.top - vpRect.top) - (viewport.clientHeight - rowRect.height) / 2\n viewport.scrollTo({ top: Math.max(0, target) })\n }, [currentBranch])\n const holdRowsCenter = useCallback((el: HTMLElement | null): void => {\n rowsRef.current = el\n if (el !== null) centerCurrentRow(el)\n }, [centerCurrentRow])\n useEffect(() => {\n if (!open || query.trim() !== '') return\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n }, [open, query, centerCurrentRow])\n\n // After an open re-seeds the folder chain (see the reset effect above),\n // its re-render commits one render AFTER the rows mount — centering in\n // that window would no-op because the current row's folder is still\n // closed. One frame later the chain is committed and the row exists, so\n // run the centering again then. User folder toggles never re-center:\n // this effect fires only on open / branch change.\n useEffect(() => {\n if (!open) return\n const raf = requestAnimationFrame(() => {\n if (rowsRef.current !== null) centerCurrentRow(rowsRef.current)\n })\n return () => { cancelAnimationFrame(raf) }\n }, [open, centerCurrentRow])\n\n // Flyout lifecycle: horizontally anchored to the card's right edge (so\n // it never overlaps the branch list), vertically centered on the picked\n // row, clamped into the viewport. Width is content-driven: place()\n // clamps the flyout's inline max-width to the room right of the card\n // (CSS caps the design width), then measures the laid-out hidden flyout\n // and pins it. Re-runs when the pending ROW changes — confirmOpen alone\n // stays true across re-picks, which used to leave the flyout stranded\n // at the first row. Scroll/resize re-fit while open.\n useLayoutEffect(() => {\n if (!confirmOpen || pendingName === null) {\n setFlyPos(null)\n return\n }\n const place = (): void => {\n const pending = pendingRef.current\n const fly = flyRef.current\n const card = cardRef.current\n if (pending === null || fly === null || card === null) return\n const row = pending.el.getBoundingClientRect()\n const cr = card.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = cr.right + GAP\n // Fit the right side: content width first, clamped by the room left\n // of the viewport margin (floor keeps the buttons usable on very\n // narrow windows, at the cost of spilling past the margin).\n const room = Math.min(FLY_MAX_WIDTH, Math.max(200, vw - MARGIN - left))\n fly.style.maxWidth = `${room}px`\n const fw = fly.offsetWidth\n const fh = fly.offsetHeight\n // The picked row's center rides the flyout's vertical center.\n const top = Math.min(\n Math.max(row.top + row.height / 2 - fh / 2, MARGIN),\n Math.max(MARGIN, vh - fh - MARGIN),\n )\n setFlyPos({ left: Math.min(left, vw - MARGIN - fw), top })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [confirmOpen, pendingName])\n\n // Create flyout placement: anchored to the card's right edge (never\n // overlapping the branch list), vertically centered on the card, clamped\n // into the viewport. Content-driven width via the same measure-then-place\n // pass the confirm flyout uses (hidden layout, then real offsets).\n useLayoutEffect(() => {\n if (!creating) {\n setCreateFlyPos(null)\n return\n }\n const place = (): void => {\n const fly = createFlyRef.current\n const card = cardRef.current\n if (fly === null || card === null) return\n const cr = card.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = cr.right + GAP\n const room = Math.min(FLY_MAX_WIDTH, Math.max(200, vw - MARGIN - left))\n fly.style.maxWidth = `${room}px`\n const fw = fly.offsetWidth\n const fh = fly.offsetHeight\n const top = Math.min(\n Math.max(cr.top + cr.height / 2 - fh / 2, MARGIN),\n Math.max(MARGIN, vh - fh - MARGIN),\n )\n setCreateFlyPos({ left: Math.min(left, vw - MARGIN - fw), top })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [creating])\n\n // Confirm opens (or re-anchors to another row) → focus the confirm\n // button (Enter commits, Escape cancels); confirm closes → forget the\n // pending row anchor. The focus rides a rAF: the flyout mounts in the\n // hidden measure-then-place posture, and focus() on a visibility:hidden\n // element is a no-op — one frame later the placed card is visible and\n // the focus lands.\n useEffect(() => {\n if (confirmOpen && pendingName !== null) {\n const raf = requestAnimationFrame(() => { flyConfirmRef.current?.focus() })\n return () => { cancelAnimationFrame(raf) }\n }\n if (!confirmOpen) {\n pendingRef.current = null\n setPendingName(null)\n }\n }, [confirmOpen, pendingName])\n\n // Outside pointer / keyboard dismiss. Outside clicks cancel the confirm\n // and close the menu in one go. Escape unwinds tier by tier — confirm,\n // then search text, then selection, then the menu. Arrow keys move the\n // selection over the visible leaf rows and Enter stages the confirm,\n // but only while focus sits on a card button: the search input keeps\n // its own caret handling and Enter-commit.\n useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent): void => {\n if (cardRef.current?.contains(event.target as Node) === true) return\n if (flyRef.current?.contains(event.target as Node) === true) return\n if (createFlyRef.current?.contains(event.target as Node) === true) return\n if (anchorRef.current?.contains(event.target as Node) === true) return\n confirmRef.current?.onCancel()\n onClose()\n }\n const onKeyDown = (event: KeyboardEvent): void => {\n const key = event.key\n if (key === 'Escape') {\n if (confirmRef.current !== null) { confirmRef.current.onCancel(); return }\n if (creatingRef.current) { setCreating(false); setDraft(''); return }\n if (queryRef.current.trim() !== '') { setQuery(''); return }\n if (selectedRef.current !== null) { setSelected(null); return }\n onClose()\n return\n }\n const card = cardRef.current\n const active = document.activeElement\n if (card === null || active === null || !card.contains(active)) return\n const inputs = card.querySelectorAll('input')\n if (inputs.length > 0 && [...inputs].includes(active as HTMLInputElement)) return\n const leaves = [...card.querySelectorAll<HTMLButtonElement>('button[role=\"menuitem\"][data-branch]')]\n if (key === 'ArrowDown' || key === 'ArrowUp') {\n event.preventDefault()\n if (leaves.length === 0) return\n const idx = leaves.findIndex(b => (b.dataset.branch ?? '') === selectedRef.current)\n let next = idx\n if (key === 'ArrowDown') next = idx < 0 ? 0 : Math.min(leaves.length - 1, idx + 1)\n else next = idx <= 0 ? leaves.length - 1 : idx - 1\n const target = leaves[next]\n if (target === undefined) return\n const name = target.dataset.branch ?? null\n if (name !== null) setSelected(name)\n target.focus()\n target.scrollIntoView({ block: 'nearest' })\n } else if (key === 'Enter' && selectedRef.current !== null) {\n event.preventDefault()\n const el = leaves.find(b => (b.dataset.branch ?? '') === selectedRef.current) ?? null\n pickRef.current(el, selectedRef.current)\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [open, onClose, anchorRef])\n\n if (!open || pos === null) return null\n\n const needle = query.trim().toLowerCase()\n // Search matches the DISPLAY names — what the rows actually show. With a\n // single remote that is the prefix-stripped form (searching \"origin\" no\n // longer matches; the user searches what they see), with several remotes\n // the full name.\n const visible = needle === ''\n ? rows\n : [...grouped.localRows, ...grouped.worktreeRows, ...grouped.remoteDisplayRows]\n .filter(row => row.name.toLowerCase().includes(needle))\n\n /** Enter in the search field: commit the first visible row (its rendered\n * button is the anchor — found by its data-branch key; the label text\n * alone can't identify a row inside a tree). */\n const commitFirst = (): void => {\n const first = visible[0]\n if (first === undefined) return\n const card = cardRef.current\n if (card === null) return\n const el = card.querySelector<HTMLButtonElement>(`button[data-branch=\"${CSS.escape(first.name)}\"]`)\n pick(el, first.name)\n }\n\n /** New-branch draft validation: git ref-name rules first, then a duplicate\n * check against every EXISTING local branch — local rows and worktree\n * rows alike (a worktree row IS a checked-out branch, just filed under\n * its own group). A remote display name is not a claim on a new local\n * branch's name (its twin could not even coexist with one; the host\n * hides such remote rows). */\n const createIssue = branchNameIssue(draft)\n const existsLocally = (name: string): boolean =>\n grouped.localRows.some(row => row.name === name) || grouped.worktreeRows.some(row => row.name === name)\n const createDuplicate = createIssue === null && existsLocally(draft)\n const createValid = createIssue === null && !createDuplicate\n /** Error line under the input, ONLY while the draft is unacceptable with\n * a non-empty reason (the ask line above already names the cut point, and\n * an untouched input needs no error) — the Create button disables in\n * lockstep. */\n const createHint = createDuplicate ? t('menuNewBranchExists') : t('menuNewBranchBad')\n const showCreateHint = (createIssue !== null && createIssue !== 'empty') || createDuplicate\n\n /** Fire the create in one stroke — the flyout's whole point. Invalid\n * drafts and a running create are no-ops (the Create button disables in\n * lockstep); the owner closes the menu on success, toasts on failure and\n * leaves the flyout open for a renamed retry. */\n const commitCreate = (): void => {\n if (!createValid || busy) return\n onCreate(draft)\n }\n\n /** Row class composition: base + HEAD tint + selection (selection wins)\n * + the locked dim. (`css` is an index-signature record, so noUncheckedIndexedAccess\n * types every class as possibly absent — the base falls back to ''.) */\n const rowClass = (row: BranchRow | null, name: string): string => {\n let cls = css.menuRow ?? ''\n if (name === currentBranch) cls += ` ${css.menuRowSelected}`\n if (name === selected) cls += ` ${css.menuRowPicked}`\n if (row?.locked === true) cls += ` ${css.menuRowLocked}`\n return cls\n }\n\n /** Locked rows keep the click path ALIVE (the owner answers picks with\n * the main-checkout toast) but stay unselected — a dimmed row wearing\n * the blue selection would read as \"chosen yet unusable\". */\n const isLocked = (name: string): boolean => lockedRows.has(name)\n\n /** The upstream divergence arrows of a local row (IDEA's ↑N/↓N) ahead of\n * the trailing check: plain text marks in the secondary tone — no base\n * icon pairs a direction with a count. Absent without an upstream or\n * when in sync. */\n const renderArrows = (row: BranchRow | null): React.ReactNode => {\n if (row === null) return null\n const marks: React.ReactNode[] = []\n if ((row.ahead ?? 0) > 0) {\n marks.push(<span key=\"ahead\" className={css.menuRowArrow} title={t('aheadTitle', { n: row.ahead })}>↑{row.ahead}</span>)\n }\n if ((row.behind ?? 0) > 0) {\n marks.push(<span key=\"behind\" className={css.menuRowArrow} title={t('behindTitle', { n: row.behind })}>↓{row.behind}</span>)\n }\n return marks\n }\n\n /** A row's click behavior: with the confirm flyout open, clicking a row\n * re-picks it (the old one-click flow — the flyout re-anchors); without\n * one it just selects (IDEA model — double-click or Enter opens the\n * confirm flyout for the selected row). Locked rows do neither: dimmed\n * rows are not selectable, the double-click is the hint's stage. `el` is\n * nullable like {@link pick}'s anchor: a row whose button is already\n * unmounted still selects/picks, it just re-anchors nothing. */\n const rowClick = (el: HTMLButtonElement | null, name: string): void => {\n if (isLocked(name)) return\n if (confirmOpen) pick(el, name)\n else setSelected(name)\n }\n\n /** Wrap every case-insensitive occurrence of `needle` in `text` with the\n * search-mark span (IDEA-style hit highlight). */\n const renderLabel = (text: string): React.ReactNode => {\n if (needle === '') return text\n const out: React.ReactNode[] = []\n let rest = text\n let key = 0\n for (;;) {\n const idx = rest.toLowerCase().indexOf(needle)\n if (idx === -1) { out.push(rest); break }\n if (idx > 0) out.push(rest.slice(0, idx))\n out.push(<span key={key} className={css.menuSearchMark}>{rest.slice(idx, idx + needle.length)}</span>)\n key += 1\n rest = rest.slice(idx + needle.length)\n }\n return out\n }\n\n /** Does any leaf under these nodes match the needle? */\n const subtreeMatches = (nodes: TreeNode[]): boolean => {\n for (const node of nodes) {\n if (node.leaf !== null && node.leaf.name.toLowerCase().includes(needle)) return true\n if (subtreeMatches(node.children)) return true\n }\n return false\n }\n\n /** One top-level group header (local/remote branches): the folder-header\n * posture with its own open flag — toggling flips the flag, never a key\n * in the expanded path set. `menuGroupTop` lifts the tone above the\n * folder headers (see the CSS note). In the search view (onToggle\n * absent) it renders inert: the matched subtrees below are force-open\n * anyway. */\n const renderGroupHeader = (label: string, count: number, open: boolean, onToggle?: () => void): React.ReactNode => {\n const cls = `${css.menuGroup} ${css.menuGroupTop}`\n return (\n onToggle === undefined\n ? (\n <div className={cls} role=\"presentation\" style={{ paddingLeft: 8 }}>\n <IconChevronDownOutline14 size={12} className={css.menuGroupChevron} />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({count})</span>\n </div>\n )\n : (\n <button\n type=\"button\"\n className={cls}\n aria-expanded={open}\n onClick={() => {\n if (guardActive()) return\n onToggle()\n armShiftGuard()\n }}\n >\n <IconChevronRightOutline14\n size={12}\n className={open ? `${css.menuGroupChevron} ${css.menuGroupChevronOpen}` : css.menuGroupChevron}\n />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({count})</span>\n </button>\n )\n )\n }\n\n /**\n * One tree group-header row: its own segment (a compressed chain's\n * walked segments join the label), a count badge, and a chevron that\n * turns for expansion. Clicking toggles. One color throughout — the\n * folder path is not color-distinguished from the name. `prefix` scopes\n * the expanded-key space to the owning group (see groupKey) and keeps\n * React keys unique across the two trees.\n */\n const renderHeader = (node: TreeNode, label: string, depth: number, prefix: string): React.ReactNode => {\n const isOpen = expanded.has(`${prefix}${node.path}`)\n return (\n <button\n key={`${prefix}group:${node.path}`}\n type=\"button\"\n className={css.menuGroup}\n data-group={node.path}\n style={{ paddingLeft: 8 + depth * 12 }}\n aria-expanded={isOpen}\n onClick={() => {\n if (guardActive()) return\n toggle(`${prefix}${node.path}`)\n armShiftGuard()\n }}\n >\n <IconChevronRightOutline14\n size={12}\n className={isOpen ? `${css.menuGroupChevron} ${css.menuGroupChevronOpen}` : css.menuGroupChevron}\n />\n <span className={css.menuGroupLabel}>{label}</span>\n <span className={css.menuGroupCount}>({node.total})</span>\n </button>\n )\n }\n\n /** One tree leaf row: under an expanded folder it shows only its own\n * segment (indentation carries the hierarchy — no repeated full path);\n * a compressed linear chain keeps its walked segments in the label so\n * the context survives without a pointless one-entry folder. The\n * data-branch key stays the group-local DISPLAY name — unique across\n * all groups (a remote display name can never equal a local row; a\n * worktree row's branch has left the local group) — which is what the\n * buttonOf/commitFirst/center lookups rely on. */\n const renderLeaf = (node: TreeNode, label: string, depth: number, prefix: string): React.ReactNode => (\n <button\n key={`${prefix}${node.path}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={node.path}\n data-kind={node.leaf?.kind}\n className={rowClass(node.leaf ?? null, node.path)}\n title={node.leaf?.locked === true ? t('mainRepoOnly') : undefined}\n style={{ paddingLeft: 8 + depth * 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(node.path), node.path) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, node.path) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, node.path) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{label}</span>\n {renderArrows(node.leaf)}\n {node.path === currentBranch && <IconCheckOutline16 size={14} />}\n </button>\n )\n\n /** One flat worktree row: a direct hop target, one per linked worktree\n * — no tree (worktree names rarely fork, and the group is a launcher,\n * not a taxonomy), no confirm (the double-click IS the hop; the owner\n * picks it up through onSelect). The native title carries the worktree\n * DIRECTORY — the fact a branch row cannot show. The row the session\n * currently lives in keeps the trailing check + HEAD tint: it is the\n * \"you are here\" mark the local group no longer holds (its branch was\n * filed into THIS group). */\n const renderFlatLeaf = (row: BranchRow, prefix: string): React.ReactNode => (\n <button\n key={`${prefix}${row.name}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={row.name}\n data-kind={row.kind}\n className={rowClass(row, row.name)}\n title={row.locked === true ? t('mainRepoOnly') : row.path}\n style={{ paddingLeft: 8 + 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(row.name), row.name) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, row.name) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, row.name) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{row.name}</span>\n {row.name === currentBranch && <IconCheckOutline16 size={14} />}\n </button>\n )\n\n /** Recursive tree renderer. Linear chains — nodes that are neither a\n * branch nor a real fork — compress into the next row's label, so\n * `feature/优化` stays a single flat row instead of a pointless one-entry\n * folder, while a real fork (`a/deep/tree` holding leaf1+leaf2) gets a\n * header whose children show only their own segments. */\n const renderTree = (nodes: TreeNode[], depth: number, prefix: string): React.ReactNode[] => {\n const out: React.ReactNode[] = []\n for (const node of nodes) {\n let cur = node\n const parts: string[] = []\n while (cur.leaf === null && cur.children.length === 1) {\n const next = cur.children[0]\n if (next === undefined) break\n parts.push(cur.segment)\n cur = next\n }\n const label = parts.length === 0 ? cur.segment : `${parts.join('/')}/${cur.segment}`\n if (cur.leaf !== null) {\n out.push(renderLeaf(cur, label, depth, prefix))\n // A branch that is also a folder path (`feature` next to\n // `feature/x`): keep the pickable row and fold the children under\n // a second, toggle-only header of the same name (rare coexistence).\n if (cur.children.length > 0) {\n out.push(renderHeader(cur, label, depth, prefix))\n if (expanded.has(`${prefix}${cur.path}`)) out.push(...renderTree(cur.children, depth + 1, prefix))\n }\n } else {\n out.push(renderHeader(cur, label, depth, prefix))\n if (expanded.has(`${prefix}${cur.path}`)) out.push(...renderTree(cur.children, depth + 1, prefix))\n }\n }\n return out\n }\n\n /** Search view: keep matching leaves AND their ancestor folders (IDEA's\n * filter keeps the path), hide non-matching siblings, force every kept\n * folder open, and highlight the hit substring. No chain compression —\n * the full ancestor path is exactly the context the search is for. */\n /** Needle-matching leaf count of a tree: the search-view group header\n * must count the MATCHES under it, not the whole group — a full count\n * above two filtered rows reads as a lie. */\n const searchLeafCount = (nodes: TreeNode[]): number =>\n nodes.reduce((sum, node) => sum\n + (node.leaf !== null && node.leaf.name.toLowerCase().includes(needle) ? 1 : 0)\n + searchLeafCount(node.children), 0)\n\n const renderSearch = (nodes: TreeNode[], depth: number, prefix: string): React.ReactNode[] => {\n const out: React.ReactNode[] = []\n for (const node of nodes) {\n const leafHit = node.leaf !== null && node.leaf.name.toLowerCase().includes(needle)\n const childHit = subtreeMatches(node.children)\n if (leafHit) {\n out.push(\n <button\n key={`${prefix}${node.path}`}\n type=\"button\"\n role=\"menuitem\"\n data-branch={node.path}\n data-kind={node.leaf?.kind}\n className={rowClass(node.leaf ?? null, node.path)}\n title={node.leaf?.locked === true ? t('mainRepoOnly') : undefined}\n style={{ paddingLeft: 8 + depth * 12 + LEAF_CHEVRON_SLOT }}\n onClick={() => { if (guardActive()) return; rowClick(buttonOf(node.path), node.path) }}\n onDoubleClick={(event) => { if (guardActive()) return; pick(event.currentTarget, node.path) }}\n onMouseEnter={(event) => { gateTooltip(event.currentTarget, node.path) }}\n onMouseLeave={(event) => { clearTooltip(event.currentTarget) }}\n >\n <span className={css.menuRowLabel}>{renderLabel(node.segment)}</span>\n {renderArrows(node.leaf)}\n {node.path === currentBranch && <IconCheckOutline16 size={14} />}\n </button>,\n )\n }\n if (childHit) {\n out.push(\n <div\n key={`${prefix}search:${node.path}`}\n role=\"presentation\"\n className={css.menuGroup}\n data-group={node.path}\n style={{ paddingLeft: 8 + depth * 12 }}\n >\n <IconChevronDownOutline14 size={12} className={css.menuGroupChevron} />\n <span className={css.menuGroupLabel}>{renderLabel(node.segment)}</span>\n <span className={css.menuGroupCount}>({node.total})</span>\n </div>,\n )\n out.push(...renderSearch(node.children, depth + 1, prefix))\n }\n }\n return out\n }\n\n /** The rendered button for a branch name (flyout anchor on click-select\n * paths, where the handler only has the name at hand). */\n const buttonOf = (name: string): HTMLButtonElement | null =>\n cardRef.current?.querySelector<HTMLButtonElement>(`button[data-branch=\"${CSS.escape(name)}\"]`) ?? null\n\n return (\n <>\n {createPortal(\n <div\n ref={cardRef}\n className={css.menuCard}\n style={{ left: pos.left, bottom: pos.bottom }}\n role=\"menu\"\n aria-label={t('menuBranches')}\n >\n <div className={css.menuToolbar} role=\"toolbar\" aria-label={t('menuBranches')}>\n {/* The plus UNMOUNTS where branch creation has no business\n * (worktree mode armed, or a linked-worktree session) instead\n * of disabling: a disabled button swallows clicks with no\n * answer — the exact dead-gray shape this menu locked rows\n * out of (see the menu-scope DR). Escape (creatingRef branch)\n * and outside clicks already collapse the create flyout, so\n * losing the anchor button takes no dismiss path with it. */}\n {canCreate && (\n <button\n type=\"button\"\n className={creating ? `${css.menuToolButton} ${css.menuToolButtonOn}` : css.menuToolButton}\n title={t('menuNewBranch')}\n aria-label={t('menuNewBranch')}\n aria-pressed={creating}\n onClick={() => {\n // Opening the flyout cancels a staged confirm first: the\n // flyout would otherwise stay anchored to a stale row beside\n // the create panel. Closing drops the draft with it.\n confirmRef.current?.onCancel()\n const next = !creating\n setCreating(next)\n if (!next) setDraft('')\n }}\n >\n <IconPlusOutline16 size={16} />\n </button>\n )}\n <button\n type=\"button\"\n className={css.menuToolButton}\n title={t('menuLocate')}\n aria-label={t('menuLocate')}\n onClick={locateCurrent}\n >\n <IconGoalOutline16 size={16} />\n </button>\n <button\n type=\"button\"\n className={updateBusy ? `${css.menuToolButton} ${css.menuToolButtonRunning}` : css.menuToolButton}\n title={t('menuUpdate')}\n aria-label={t('menuUpdate')}\n disabled={busy || fetchBusy}\n onClick={() => {\n // A staged confirm must not ride out the update: while it\n // runs, busy would flip its labels into progress text for\n // an action nobody is running.\n confirmRef.current?.onCancel()\n onUpdate()\n }}\n >\n <FetchGlyph dashed={false} />\n </button>\n <button\n type=\"button\"\n className={fetchBusy ? `${css.menuToolButton} ${css.menuToolButtonRunning}` : css.menuToolButton}\n title={t('menuFetch')}\n aria-label={t('menuFetch')}\n disabled={busy || updateBusy}\n onClick={() => {\n // A staged confirm must not ride out the sync: while the\n // fetch runs, busy would flip its labels into progress text\n // for an action nobody is running.\n confirmRef.current?.onCancel()\n onFetch()\n }}\n >\n <FetchGlyph />\n </button>\n <button\n type=\"button\"\n className={css.menuToolButton}\n title={allExpanded ? t('menuCollapseAll') : t('menuExpandAll')}\n aria-label={allExpanded ? t('menuCollapseAll') : t('menuExpandAll')}\n // The group headers fold too, so the tool stays live whenever\n // any row exists — folders alone no longer gate it.\n disabled={rows.length === 0}\n onClick={toggleAll}\n >\n {allExpanded ? <IconChevronUpOutline14 size={14} /> : <IconChevronDownOutline14 size={14} />}\n </button>\n </div>\n <div className={css.menuMain}>\n <div className={css.menuHeading}>{t('menuBranches')}</div>\n <div className={css.menuRows} role=\"presentation\" ref={holdRowsCenter}>\n {needle === '' ? (\n <>\n {grouped.localRows.length > 0 && renderGroupHeader(t('menuLocalBranches'), grouped.localRows.length, localGroupOpen,\n () => setLocalGroupOpen(value => !value))}\n {localGroupOpen && renderTree(localTree, 1, 'local:')}\n {canAdopt && grouped.worktreeRows.length > 0 && (\n <>\n {renderGroupHeader(t('menuWorktrees'), grouped.worktreeRows.length, worktreeGroupOpen,\n () => setWorktreeGroupOpen(value => !value))}\n {worktreeGroupOpen && grouped.worktreeRows.map(row => renderFlatLeaf(row, 'worktree:'))}\n </>\n )}\n {grouped.remoteDisplayRows.length > 0 && (\n <>\n {renderGroupHeader(t('menuRemoteBranches'), grouped.remoteDisplayRows.length, remoteGroupOpen,\n () => setRemoteGroupOpen(value => !value))}\n {remoteGroupOpen && renderTree(remoteTree, 1, 'remote:')}\n </>\n )}\n </>\n ) : (\n <>\n {grouped.localRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuLocalBranches'), searchLeafCount(localTree), true)}\n {renderSearch(localTree, 1, 'local:')}\n </>\n )}\n {canAdopt && grouped.worktreeRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuWorktrees'), grouped.worktreeRows.filter(row => row.name.toLowerCase().includes(needle)).length, true)}\n {grouped.worktreeRows\n .filter(row => row.name.toLowerCase().includes(needle))\n .map(row => renderFlatLeaf(row, 'worktree:'))}\n </>\n )}\n {grouped.remoteDisplayRows.some(row => row.name.toLowerCase().includes(needle)) && (\n <>\n {renderGroupHeader(t('menuRemoteBranches'), searchLeafCount(remoteTree), true)}\n {renderSearch(remoteTree, 1, 'remote:')}\n </>\n )}\n </>\n )}\n {/* Two distinct empties: a filter that matched nothing\n * (\"no MATCHES\") versus a menu with no rows at all — a\n * detached HEAD's started worktree session, a fresh repo.\n * \"No matching branches\" under zero rows would blame the\n * search the user never typed. */}\n {visible.length === 0\n && <div className={css.menuEmpty}>{rows.length === 0 ? t('menuNoBranches') : t('menuNoMatches')}</div>}\n </div>\n <div className={css.menuSearchWrap}>\n <input\n ref={holdSearchFocus}\n className={css.menuSearch}\n type=\"text\"\n value={query}\n placeholder={t('menuSearchPlaceholder')}\n aria-label={t('menuSearchPlaceholder')}\n spellCheck={false}\n onChange={event => { setQuery(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commitFirst()\n }\n }}\n />\n </div>\n </div>\n </div>,\n document.body,\n )}\n {confirm !== null && createPortal(\n <div\n ref={flyRef}\n className={css.popCard}\n style={flyPos ?? FLY_MEASURE}\n role=\"dialog\"\n aria-label={confirm.ask}\n >\n <p className={css.popAsk}>{confirm.ask}</p>\n {confirm.subject !== undefined && <p className={css.popSubject}>{confirm.subject}</p>}\n <div className={css.popActions}>\n <button type=\"button\" disabled={confirm.busy} onClick={confirm.onCancel}>\n {confirm.cancelLabel}\n </button>\n <button ref={flyConfirmRef} type=\"button\" disabled={confirm.busy} onClick={confirm.onConfirm}>\n {confirm.confirmLabel}\n </button>\n </div>\n </div>,\n document.body,\n )}\n {creating && createPortal(\n <div\n ref={createFlyRef}\n className={css.popCard}\n style={createFlyPos ?? FLY_MEASURE}\n role=\"dialog\"\n aria-label={t('createBranchTitle', { branch: currentBranch })}\n >\n <p className={css.popAsk}>{t('createBranchTitle', { branch: currentBranch })}</p>\n <input\n ref={holdCreateFocus}\n className={css.menuCreate}\n type=\"text\"\n value={draft}\n placeholder={t('menuNewBranchPlaceholder')}\n aria-label={t('menuNewBranchPlaceholder')}\n aria-invalid={createIssue !== null && createIssue !== 'empty'}\n spellCheck={false}\n disabled={busy}\n onChange={event => { setDraft(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commitCreate()\n }\n }}\n />\n {showCreateHint && (\n <p className={css.menuCreateHintBad} role=\"status\">{createHint}</p>\n )}\n <div className={css.popActions}>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => { setCreating(false); setDraft('') }}\n >\n {t('actionCancel')}\n </button>\n <button type=\"button\" disabled={!createValid || busy} onClick={commitCreate}>\n {busy ? t('createBranchBusy') : t('actionConfirm')}\n </button>\n </div>\n </div>,\n document.body,\n )}\n </>\n )\n}","/**\n * BranchChipDock: the composer tool-row entry (conversation.input.left, right\n * of the mode chips) for sessions inside a git repository. Blank sessions\n * OF THE MAIN checkout get the full segmented control — branch picker plus\n * the worktree isolation toggle — because that is the moment to choose the\n * environment for the conversation, and starting a worktree is a main-repo\n * decision. Once the session starts, the worktree toggle is withdrawn (its\n * directory is fixed). A session inside a LINKED worktree scopes the whole\n * entry down: blank, the menu lists every branch for READING but every\n * pick but the current branch answers with the main-checkout hint (and\n * neither the toggle nor the in-place new-branch tool exists there);\n * started, the menu shows nothing but the session's own branch — fetch and\n * update-current stay, since neither moves the checkout (probeRepo still\n * roots at the session directory's toplevel, never the main checkout).\n * Non-git directories and load failures render nothing. The confirm\n * dialogs and the error toast live here too.\n *\n * Checking the worktree toggle pops the cutout confirm dialog right away:\n * confirming it cuts a NEW branch (`<current>-wt`, suffixes past taken\n * names) out of the current checkout into a fresh isolated worktree — the\n * current branch itself is occupied by the main worktree, so git refuses a\n * second worktree on it. The dialog stands alone above the chip (the\n * branch menu stays closed); the chip still opens the menu, where picking\n * another branch keeps the plain create-or-reuse flow and re-picking the\n * current branch stages the same cutout confirm. Dismissing the dialog and\n * sending the message anyway means the user knowingly stays in the current\n * directory — no separate notice fires on send.\n *\n * In-place branch creation (the menu toolbar's plus, worktree mode off)\n * opens the create flyout right of the branch card: type the name, press\n * Create — the new branch is cut from the session directory's current\n * checkout and checked out there in one stroke, the worktree-less sibling\n * of the cutout flow. A failure toasts and leaves the flyout open.\n *\n * Remote branches join the picker under their own menu group: picking one\n * stages the remote-twin confirm — the switch creates the local tracking\n * branch in place (git's dwim), the worktree pick creates the twin inside\n * its fresh worktree. Both rides go through the existing /switch and\n * /worktree routes, which already resolve `<remote>/name` display names.\n *\n * Branches held by linked worktrees get their own 「工作树」 group (blank\n * sessions only): they have left the local group — git refuses to check\n * them out twice, so a local-group row would be a dead end — and a\n * double-click hops the session straight into that worktree directory\n * (adoptWorktree; no git action, no confirm). A started session's\n * directory is fixed, so the group only exists while blank.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n Button, IconBranchOutline16, Toast,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { branchNameIssue, localBranchName } from '../normalize.ts'\nimport type { BranchEntry, RepoStatus, WorktreeEntry } from '../wire.ts'\nimport { fetchStatus, requestCreateBranch, requestFetch, requestSwitch, requestUpdate, requestWorktree, requestWorktreeCutout } from './api.ts'\nimport { BranchMenu, type BranchRow } from './BranchMenu.tsx'\nimport type { BranchChipInjected } from './slots.ts'\nimport css from './BranchChip.module.css'\n\n/**\n * Heavier check glyph for the worktree toggle. The base's IconCheckOutline16\n * is a fill path (fixed visual weight); we need a visibly bolder stroke to\n * read inside the 14×14 bluish fill — local to this module so the heavier\n * weight doesn't leak into the rest of the composer chrome.\n */\nfunction WorktreeCheck({ size = 12 }: { size?: number }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M3.2 8.4 L6.6 11.8 L12.8 4.4\"\n stroke=\"currentColor\"\n strokeWidth=\"3.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\n/** Full props: owner share + standard kit + injected adopt verb + locale seat. */\nexport type BranchChipDockProps =\n PropsRuntime<'conversation.input.left'>\n & BranchChipInjected\n & PropsLocale<'git-worktree'>\n\n/** Status fetch lifecycle: `null` facts until ready; failures park unloaded. */\ninterface StatusState {\n facts: (RepoStatus & { repo: true }) | null\n}\n\n/** One pending confirm dialog. */\ninterface ConfirmState {\n kind: 'switch' | 'worktree' | 'worktree-cutout'\n branch: string\n /** True when `branch` names a REMOTE branch (an `origin/feat-x` row):\n * the switch confirm creates the local tracking twin, the worktree\n * confirm creates the twin plus its worktree — the ask lines spell that\n * out instead of reading as a plain in-place switch. */\n remote?: boolean\n /** Editable cutout name (kind `worktree-cutout` only): pre-filled with\n * the first free `<branch>-wt` name, editable before confirming. */\n draft?: string\n}\n\n/** First free `<base>-wt` name against the local branch list — the prefilled\n * draft of the cutout dialog (same shape as the host's suffix walk, minus\n * the storage-folder probe the client cannot see). */\nfunction firstFreeCutoutName(base: string, taken: readonly string[]): string {\n const stem = `${base}-wt`\n if (!taken.includes(stem)) return stem\n for (let i = 2; ; i += 1) {\n const candidate = `${stem}${i}`\n if (!taken.includes(candidate)) return candidate\n }\n}\n\n/**\n * Read the repository status for a directory; refetch on demand.\n * @param cwd - absolute session directory.\n * @returns the state holder and a refetch verb.\n */\nfunction useRepoStatus(cwd: string | undefined): readonly [StatusState, () => Promise<void>] {\n const [state, setState] = useState<StatusState>({ facts: null })\n const load = useCallback(async (): Promise<void> => {\n if (cwd === undefined) {\n setState({ facts: null })\n return\n }\n const result = await fetchStatus(cwd)\n setState({ facts: result.ok && result.repo ? result : null })\n }, [cwd])\n useEffect(() => {\n let live = true\n setState({ facts: null })\n if (cwd !== undefined) {\n void fetchStatus(cwd).then(result => {\n if (live) setState({ facts: result.ok && result.repo ? result : null })\n })\n }\n return () => { live = false }\n }, [cwd])\n return [state, load]\n}\n\n/** Longest branch name shown on the chip before ellipsizing (chars, … included). */\nconst BRANCH_DISPLAY_MAX = 25\n\n/** Viewport edge clearance and chip gap, mirroring BranchMenu's posture. */\nconst POP_MARGIN = 12\nconst POP_GAP = 6\n/** Unplaced dialog: hidden but laid out at a fixed origin so offsetWidth is\n * real for the measure-then-place pass (BranchMenu's flyout trick). */\nconst POP_MEASURE: CSSProperties = { left: '-9999px', bottom: '0px', visibility: 'hidden' }\n\n/**\n * Clamp a branch name for chip display: names up to 25 chars pass through;\n * longer ones show the first 24 chars plus an ellipsis.\n * @param branch - full branch name.\n */\nfunction displayBranch(branch: string): string {\n return branch.length <= BRANCH_DISPLAY_MAX ? branch : `${branch.slice(0, BRANCH_DISPLAY_MAX - 1)}…`\n}\n\n/**\n * Build the branch rows for the picker in three kinds: LOCAL branches not\n * held by a linked worktree, REMOTE branches, and one WORKTREE row per\n * linked worktree. A branch held by a worktree LEAVES the local group —\n * git refuses to check it out twice, so the row would be a dead end; the\n * worktree group is the way INTO it instead (a direct session hop, see\n * the owner's onAdoptWorktree). The main worktree and detached worktrees\n * don't come along: the main checkout is home, not a hop target, and a\n * detached worktree has no branch name to offer.\n *\n * Inside a linked-worktree session every row but the current branch is\n * LOCKED (dimmed, still clickable): a pick reaches the owner, which\n * answers with the main-checkout hint — the dimming reads as \"not usable\n * here\" at a glance while the click keeps its explanation.\n */\nfunction buildBranchRows(\n branches: readonly BranchEntry[],\n worktrees: readonly WorktreeEntry[],\n currentBranch: string,\n inLinkedWorktree: boolean,\n): BranchRow[] {\n const held = new Set(worktrees.flatMap(w => w.main || w.branch === undefined ? [] : [w.branch]))\n const lock = (name: string): boolean => inLinkedWorktree && name !== currentBranch\n return [\n ...branches.filter(b => b.kind === 'local' && !held.has(b.name)).map(b => ({\n name: b.name,\n kind: 'local' as const,\n ...b.ahead === undefined ? {} : { ahead: b.ahead },\n ...b.behind === undefined ? {} : { behind: b.behind },\n locked: lock(b.name),\n })),\n ...branches.filter(b => b.kind === 'remote').map(b => ({\n name: b.name,\n kind: 'remote' as const,\n locked: lock(b.name),\n })),\n ...worktrees.flatMap(w => w.main || w.branch === undefined\n ? []\n : [{ name: w.branch, kind: 'worktree' as const, path: w.path, locked: lock(w.branch) }]),\n ]\n}\n\n/** The standalone confirm dialog shown while the branch menu is closed. */\ninterface ChipConfirmProps {\n /** The chip element — the dialog's bottom edge pins just above its top. */\n anchorRef: React.RefObject<HTMLElement | null>\n /** Ask line (already localized). */\n ask: string\n /** The branch the ask refers to, on its own weight-500 line (remote picks\n * only — the ask line says \"该远程分支\" and this names it). */\n subject?: string\n /** Confirm-button label (progress text while busy). */\n confirmLabel: string\n /** Cancel-button label. */\n cancelLabel: string\n /** True while the action runs: both buttons disable. */\n busy: boolean\n /** Editable new-branch name (cutout flow): present, the dialog renders a\n * naming input under the ask line and focuses IT instead of the confirm\n * button; Enter commits a valid draft. */\n draft?: string\n onDraftChange?: (value: string) => void\n draftPlaceholder?: string\n /** True while the draft is NOT an acceptable new branch name — the\n * confirm button disables in lockstep. */\n draftInvalid?: boolean\n /** Why the draft is invalid (rendered under the input; absent while the\n * draft is acceptable or merely empty). */\n draftHint?: string\n /** Run the confirmed action. */\n onConfirm: () => void\n /** Dismiss the dialog without acting. */\n onCancel: () => void\n}\n\n/**\n * The check-time confirm dialog, rendered while the branch menu is closed:\n * the same popCard chrome as BranchMenu's flyout, but bottom-pinned above\n * the chip in the menu card's posture — the flyout's right-of-card anchor\n * has no card to sit beside here. Outside pointerdown and Escape cancel;\n * the naming input (cutout flow) takes focus when present, else the\n * confirm button does so Enter commits.\n */\nfunction ChipConfirm({\n anchorRef, ask, subject, confirmLabel, cancelLabel, busy,\n draft, onDraftChange, draftPlaceholder, draftInvalid, draftHint,\n onConfirm, onCancel,\n}: ChipConfirmProps) {\n const popRef = useRef<HTMLDivElement>(null)\n const confirmRef = useRef<HTMLButtonElement | null>(null)\n const draftInputRef = useRef<HTMLInputElement | null>(null)\n const [pos, setPos] = useState<{ left: number; bottom: number } | null>(null)\n\n // Bottom-pin above the chip and clamp horizontally against the measured,\n // content-driven width (popCard is max-content under an 80vw cap).\n useLayoutEffect(() => {\n const place = (): void => {\n const anchor = anchorRef.current\n const pop = popRef.current\n if (anchor === null || pop === null) return\n const rect = anchor.getBoundingClientRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const left = Math.min(Math.max(rect.left, POP_MARGIN), Math.max(POP_MARGIN, vw - POP_MARGIN - pop.offsetWidth))\n setPos({ left, bottom: vh - rect.top + POP_GAP })\n }\n place()\n window.addEventListener('resize', place)\n window.addEventListener('scroll', place, true)\n return () => {\n window.removeEventListener('resize', place)\n window.removeEventListener('scroll', place, true)\n }\n }, [anchorRef])\n\n // Focus rides a rAF: the first frame lays the dialog out in the hidden\n // measure-then-place posture, and focus() on a visibility:hidden node\n // no-ops — one frame later the placed dialog is visible and the focus\n // lands. The naming input wins when present (typing is the point).\n useEffect(() => {\n const raf = requestAnimationFrame(() => { (draftInputRef.current ?? confirmRef.current)?.focus() })\n return () => { cancelAnimationFrame(raf) }\n }, [])\n\n // Outside pointerdown cancels (the dialog and the chip excluded — the\n // chip click runs its own toggle); Escape unwinds the dialog.\n useEffect(() => {\n const onPointerDown = (event: PointerEvent): void => {\n if (popRef.current?.contains(event.target as Node) === true) return\n if (anchorRef.current?.contains(event.target as Node) === true) return\n onCancel()\n }\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onCancel()\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [onCancel, anchorRef])\n\n return createPortal(\n <div ref={popRef} className={css.popCard} style={pos ?? POP_MEASURE} role=\"dialog\" aria-label={ask}>\n <p className={css.popAsk}>{ask}</p>\n {subject !== undefined && <p className={css.popSubject}>{subject}</p>}\n {onDraftChange !== undefined && (\n <>\n <input\n ref={draftInputRef}\n className={css.menuCreate}\n type=\"text\"\n value={draft}\n placeholder={draftPlaceholder}\n aria-label={draftPlaceholder}\n aria-invalid={draftInvalid}\n spellCheck={false}\n disabled={busy}\n onChange={event => { onDraftChange(event.target.value) }}\n onKeyDown={event => {\n if (event.key === 'Enter' && draftInvalid !== true && !busy) {\n event.preventDefault()\n onConfirm()\n }\n }}\n />\n {draftInvalid === true && draftHint !== undefined && (\n <p className={css.menuCreateHintBad} role=\"status\">{draftHint}</p>\n )}\n </>\n )}\n <div className={css.popActions}>\n <button type=\"button\" disabled={busy} onClick={onCancel}>\n {cancelLabel}\n </button>\n <button\n ref={confirmRef}\n type=\"button\"\n disabled={busy || draftInvalid === true}\n onClick={onConfirm}\n >\n {confirmLabel}\n </button>\n </div>\n </div>,\n document.body,\n )\n}\n\n/** The tool-row entry registered into conversation.input.left. */\nexport function BranchChipDock({ session, sessionId, useSessions, adoptWorktree, t }: BranchChipDockProps) {\n const summary = useSessions(state => state.byId[sessionId])\n const cwd = summary?.cwd\n const [repo, refresh] = useRepoStatus(cwd)\n const [menuOpen, setMenuOpen] = useState(false)\n const [worktreeMode, setWorktreeMode] = useState(false)\n const [confirm, setConfirm] = useState<ConfirmState | null>(null)\n const [busy, setBusy] = useState(false)\n /** Which arrow is spinning: fetch and update are single-flight against\n * the SAME busyRef (mutually exclusive), but the spinning state must be\n * per-tool — one shared flag made both arrows rotate at once. */\n const [fetchBusy, setFetchBusy] = useState(false)\n const [updateBusy, setUpdateBusy] = useState(false)\n const [toast, setToast] = useState<{ seq: number; text: string } | null>(null)\n const chipRef = useRef<HTMLButtonElement | null>(null)\n const busyRef = useRef(false)\n\n useEffect(() => {\n // A moved session directory means a new repository context: the staged\n // toggle and any half-open dialog belong to the old one.\n setWorktreeMode(false)\n setConfirm(null)\n setMenuOpen(false)\n }, [cwd])\n\n useEffect(() => {\n // The session started: the environment is fixed now, so a toggle staged\n // during the blank phase must not survive into branch switching — nor\n // its confirm: a keyboard-only send (no outside pointerdown to dismiss\n // it) can start the session while the cutout dialog still floats over a\n // withdrawn toggle. Switch confirms stay: in-place branch switching is\n // a started-session feature.\n if (!session.blank) {\n setWorktreeMode(false)\n setConfirm(current => current !== null && current.kind !== 'switch' ? null : current)\n }\n }, [session.blank])\n\n // External branch changes (terminal, other tools) never reach this chip\n // on their own — the status fetch runs on mount, on cwd change, and after\n // our own switches. Two cheap pull points cover the real workflow:\n // regaining window focus (the user returns from the terminal where the\n // branches moved; refreshes the chip label) and opening the menu (fresh\n // rows exactly at decision time, see the chip's onClick). A push channel\n // (host-side fs.watch on .git/refs + SSE) was considered and skipped:\n // these pulls hide all but the menu-open-while-branches-change race, at\n // none of that complexity.\n useEffect(() => {\n const refreshIfIdle = (): void => {\n if (busyRef.current) return\n void refresh()\n }\n const onVisibility = (): void => {\n if (document.visibilityState === 'visible') refreshIfIdle()\n }\n window.addEventListener('focus', refreshIfIdle)\n document.addEventListener('visibilitychange', onVisibility)\n return () => {\n window.removeEventListener('focus', refreshIfIdle)\n document.removeEventListener('visibilitychange', onVisibility)\n }\n }, [refresh])\n\n const showError = useCallback((message: string) => {\n setToast({ seq: Date.now(), text: t('errorGeneric', { message }) })\n }, [t])\n\n /** Run one guarded confirm action: single-flight, toast on failure, close on success. */\n const runGuarded = useCallback(async (action: () => Promise<string | undefined>): Promise<void> => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n const failure = await action()\n busyRef.current = false\n setBusy(false)\n if (failure !== undefined) {\n showError(failure)\n return\n }\n setConfirm(null)\n setMenuOpen(false)\n }, [showError])\n\n /** In-place switch flow: POST /switch, then refetch the status. */\n const doSwitch = useCallback((branch: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestSwitch(cwd, branch)\n if (!result.ok) return result.error\n await refresh()\n return undefined\n }), [cwd, refresh, runGuarded])\n\n /** Create-branch flow: POST /branch (create from the current checkout and\n * switch to it in place), then refetch the status — the menu closed by\n * then, and the chip label must name the new branch. Fired directly by\n * the menu's create flyout (no confirm kind): typing the name into the\n * flyout and pressing Create is the intent. */\n const doCreateBranch = useCallback((name: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestCreateBranch(cwd, name)\n if (!result.ok) return result.error\n await refresh()\n return undefined\n }), [cwd, refresh, runGuarded])\n\n /** Remote-sync flow: POST /fetch (fetch every remote + prune), then\n * refetch the status. Deliberately NOT runGuarded: its success closes the\n * menu, while the whole point of a sync is watching the refreshed branch\n * list in place. Single-flight shares busyRef with the other actions, so\n * a sync and a confirm action can never interleave. A network fetch has\n * NO visible side effect when the remote moved not — the spinning tool\n * (menu side) and the done toast here ARE the feedback. */\n const doFetch = useCallback(async () => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n setFetchBusy(true)\n const failure = await (async () => {\n if (cwd === undefined) return 'no session directory'\n const result = await requestFetch(cwd)\n if (!result.ok) return result.error\n return undefined\n })()\n busyRef.current = false\n setBusy(false)\n setFetchBusy(false)\n if (failure !== undefined) {\n showError(failure)\n return\n }\n await refresh()\n setToast({ seq: Date.now(), text: t('fetchDone') })\n }, [cwd, refresh, showError, t])\n\n /** Update-current-branch flow: POST /update (fetch every remote, then\n * fast-forward the checked-out branch to its upstream), then refetch the\n * status in place — same keep-the-menu-open semantics as the fetch sync.\n * The toast tells the two apart: fast-forwarded vs already up to date. */\n const doUpdate = useCallback(async () => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n setUpdateBusy(true)\n const result = cwd === undefined ? undefined : await requestUpdate(cwd)\n busyRef.current = false\n setBusy(false)\n setUpdateBusy(false)\n if (result === undefined) {\n showError('no session directory')\n return\n }\n if (!result.ok) {\n showError(result.error)\n return\n }\n await refresh()\n setToast({\n seq: Date.now(),\n text: result.updated ? t('updateDone', { branch: result.branch }) : t('updateUpToDate'),\n })\n }, [cwd, refresh, showError, t])\n\n /** Worktree-group flow: hop the session into the EXISTING worktree\n * directory. No git action, no confirm — the double-click IS the hop\n * (a directory jump is reversible and touches nothing), and the owner's\n * adoptWorktree registers the folder and opens a blank session there. */\n const doAdoptWorktree = useCallback((path: string): void => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(true)\n adoptWorktree(path)\n .then(() => { setMenuOpen(false) })\n .catch((cause: unknown) => {\n showError(cause instanceof Error ? cause.message : String(cause))\n })\n .finally(() => {\n busyRef.current = false\n setBusy(false)\n })\n }, [adoptWorktree, showError])\n\n /** Worktree flow: POST /worktree (create-or-reuse, or cut out a new\n * branch under an explicit name), register the directory, hop sessions. */\n const doWorktree = useCallback((branch: string, cutout: boolean, name?: string) => runGuarded(async () => {\n if (cwd === undefined) return 'no session directory'\n const result = cutout\n ? await requestWorktreeCutout(cwd, branch, name)\n : await requestWorktree(cwd, branch)\n if (!result.ok) return result.error\n try {\n await adoptWorktree(result.path)\n } catch (cause) {\n return cause instanceof Error ? cause.message : String(cause)\n }\n return undefined\n }), [adoptWorktree, cwd, runGuarded])\n\n const facts = repo.facts\n // The session sits in a linked worktree when its directory's toplevel is\n // NOT the main worktree entry — the trigger for the scoped menu (see\n // below) and for hiding the worktree toggle.\n const inLinkedWorktree = facts !== null\n && facts.worktrees.find(w => w.main)?.path !== facts.repoRoot\n const rows = useMemo(() => {\n if (facts === null) return []\n // A STARTED linked-worktree session shows nothing but its own branch:\n // the menu there is a position marker plus the fetch/update tools, not\n // a picker — every other branch lives behind the main checkout. A BLANK\n // one shows the full list for reading; its picks are answered with the\n // main-checkout hint (see onSelect).\n if (inLinkedWorktree && !session.blank) {\n const current = facts.branches.find(b => b.kind === 'local' && b.name === facts.currentBranch)\n return current === undefined\n ? []\n : [{\n name: current.name,\n kind: 'local' as const,\n ...current.ahead === undefined ? {} : { ahead: current.ahead },\n ...current.behind === undefined ? {} : { behind: current.behind },\n }]\n }\n return buildBranchRows(facts.branches, facts.worktrees, facts.currentBranch, inLinkedWorktree)\n }, [facts, inLinkedWorktree, session.blank])\n // Every already-taken LOCAL name feeds the new-branch namespaces (cutout\n // prefill and the duplicate checks): local rows and worktree rows alike\n // (a worktree row IS a checked-out branch), while a remote row is no\n // claim at all — a remote branch with a same-named local twin never\n // reaches the client (the host hides those rows).\n const localNames = useMemo(\n () => rows.filter(row => row.kind !== 'remote').map(row => row.name),\n [rows],\n )\n\n // Non-repo and still-loading directories render nothing at all.\n if (facts === null) return null\n\n const confirmLocalName = confirm === null ? '' : localBranchName(confirm.branch)\n // The cutout dialog carries an EDITABLE new-branch name (pre-filled with\n // the first free `<branch>-wt`); validated exactly like the create\n // flyout — git ref-name rules plus a duplicate check against the rows.\n const isCutout = confirm?.kind === 'worktree-cutout'\n const cutoutDraft = isCutout ? confirm.draft ?? '' : ''\n const cutoutIssue = isCutout ? branchNameIssue(cutoutDraft) : null\n const cutoutDuplicate = isCutout && cutoutIssue === null && localNames.includes(cutoutDraft)\n const cutoutValid = cutoutIssue === null && !cutoutDuplicate\n const cutoutHint = cutoutDuplicate\n ? t('menuNewBranchExists')\n : cutoutIssue !== null && cutoutIssue !== 'empty'\n ? t('menuNewBranchBad')\n : undefined\n // Reuse applies only to the plain create flow: a cutout always cuts a\n // fresh branch, so the current-branch confirm can never reuse.\n const existingWorktree = confirm === null || confirm.kind !== 'worktree'\n ? undefined\n : facts.worktrees.find(w => w.branch === confirmLocalName)\n\n /** One confirm bundle shared by the menu flyout and the standalone\n * dialog (whichever is showing). Remote picks keep the ask line SHORT (a\n * wrapping sentence with long branch names breaks badly) and name the\n * branch on its own weight-500 line — the dwim/worktree consequences are\n * git's default behavior, not worth a third line. */\n const confirmBundle = confirm === null ? null : {\n ask: confirm.kind === 'worktree-cutout'\n ? t('worktreeAskCutOut', { branch: confirmLocalName })\n : confirm.kind === 'worktree'\n ? confirm.remote === true\n ? t('worktreeAskRemote')\n : t(existingWorktree !== undefined ? 'worktreeAskReuse' : 'worktreeAskNew', { branch: confirmLocalName })\n : confirm.remote === true\n ? t('switchAskRemote')\n : t('switchAsk', { branch: confirm.branch }),\n ...confirm.remote === true ? { subject: confirm.branch } : {},\n confirmLabel: busy\n ? (confirm.kind === 'worktree' || confirm.kind === 'worktree-cutout' ? t('worktreeBusy') : t('switchBusy'))\n : t('actionConfirm'),\n cancelLabel: t('actionCancel'),\n busy,\n onConfirm: () => {\n if (confirm.kind === 'worktree' || confirm.kind === 'worktree-cutout') {\n if (confirm.kind === 'worktree-cutout' && !cutoutValid) return\n void doWorktree(confirm.branch, confirm.kind === 'worktree-cutout', confirm.draft)\n } else {\n void doSwitch(confirm.branch)\n }\n },\n onCancel: () => { if (!busy) setConfirm(null) },\n }\n\n return (\n <>\n <span className={css.dock}>\n <button\n ref={chipRef}\n type=\"button\"\n className={css.chip}\n title={facts.currentBranch}\n onClick={() => {\n // Toggling always unwinds any half-open confirm first.\n setConfirm(null)\n const opening = !menuOpen\n setMenuOpen(opening)\n // Fresh rows at decision time: branches may have moved outside\n // (terminal, other tools) since the last fetch. Non-blocking —\n // the menu opens on current data and re-renders when it lands.\n if (opening && !busyRef.current) void refresh()\n }}\n >\n <IconBranchOutline16 size={12} />\n <span className={css.branch}>{displayBranch(facts.currentBranch)}</span>\n </button>\n {/* The worktree toggle exists only for blank sessions OF THE MAIN\n * checkout: starting a worktree is a main-repo decision — a session\n * already inside a linked worktree gets neither the toggle nor the\n * in-place new-branch tool (its directory identity is not ours to\n * move). */}\n {session.blank && !inLinkedWorktree && (\n <>\n <span className={css.divider} aria-hidden=\"true\" />\n <button\n type=\"button\"\n className={worktreeMode ? css.checkOn : css.check}\n onClick={() => {\n // Checking stages the cutout dialog for the current branch\n // right away — the guidance IS the dialog, not a branch\n // list to explore. The new branch's name is EDITABLE there\n // (pre-filled with the first free `<current>-wt`); checking\n // again (or unchecking) clears it (and any menu).\n const next = !worktreeMode\n setWorktreeMode(next)\n setMenuOpen(false)\n if (next) {\n setConfirm({\n kind: 'worktree-cutout',\n branch: facts.currentBranch,\n draft: firstFreeCutoutName(localBranchName(facts.currentBranch), localNames),\n })\n if (!busyRef.current) void refresh()\n } else {\n setConfirm(null)\n }\n }}\n title={t('worktreeToggle')}\n >\n <span className={css.box}>{worktreeMode ? <WorktreeCheck size={10} /> : null}</span>\n <span className={css.checkLabel}>{t('chipWorktree')}</span>\n </button>\n </>\n )}\n </span>\n <BranchMenu\n open={menuOpen}\n anchorRef={chipRef}\n rows={rows}\n currentBranch={facts.currentBranch}\n confirm={confirmBundle}\n canCreate={!worktreeMode && !inLinkedWorktree}\n canAdopt={session.blank}\n busy={busy}\n onCreate={(name) => { void doCreateBranch(name) }}\n onFetch={() => { void doFetch() }}\n fetchBusy={fetchBusy}\n onUpdate={() => { void doUpdate() }}\n updateBusy={updateBusy}\n onSelect={(branch) => {\n // In worktree mode re-selecting the CURRENT branch stages the\n // cut-out dialog (editable name); without the mode it is a plain\n // close. Any other pick stages the regular confirm flyout beside\n // that row (menu stays open) — except a WORKTREE row: the pick\n // hops the session straight into that worktree directory, no\n // confirm (the menu closes on success).\n if (branch === facts.currentBranch) {\n if (worktreeMode) {\n setConfirm({\n kind: 'worktree-cutout',\n branch,\n draft: firstFreeCutoutName(localBranchName(branch), localNames),\n })\n } else {\n setMenuOpen(false)\n }\n return\n }\n // A linked-worktree session stages NO branch action — not plain\n // switches, not remote checkouts, not worktree hops. One hint\n // sends every pick back to the main checkout, where the worktree\n // toggle (and the whole action surface) lives.\n if (inLinkedWorktree) {\n setToast({ seq: Date.now(), text: t('mainRepoOnly') })\n return\n }\n const row = rows.find(r => r.name === branch)\n if (row?.kind === 'worktree' && row.path !== undefined) {\n doAdoptWorktree(row.path)\n return\n }\n // Remote rows carry the remote-twin wording into whichever confirm\n // they stage (switch = tracking twin in place, worktree = twin in\n // its own directory); local rows keep the plain asks.\n const remote = row?.kind === 'remote'\n setConfirm({ kind: worktreeMode ? 'worktree' : 'switch', branch, remote })\n }}\n onClose={() => { setMenuOpen(false) }}\n t={t}\n />\n {confirmBundle !== null && !menuOpen && (\n <ChipConfirm\n anchorRef={chipRef}\n {...confirmBundle}\n {...isCutout ? { draft: cutoutDraft } : {}}\n {...isCutout\n ? { onDraftChange: (value: string) => { setConfirm(current => current?.kind === 'worktree-cutout' ? { ...current, draft: value } : current) } }\n : {}}\n draftPlaceholder={t('menuNewBranchPlaceholder')}\n {...isCutout && !cutoutValid ? { draftInvalid: true } : {}}\n {...cutoutHint === undefined ? {} : { draftHint: cutoutHint }}\n />\n )}\n {toast !== null && <Toast key={toast.seq} text={toast.text} onDone={() => { setToast(null) }} />}\n </>\n )\n}\n","/**\n * Form over the `git-worktree` settings namespace.\n *\n * `rootDir` is staged: a settings write is a durable, revision-fenced\n * document mutation, so the control stages what the user picks and commits\n * it only on save. The field shows its effective value (user layer over\n * composition layer over schema default) and whether the user layer carries\n * it — key presence, not a value comparison, marks an override.\n *\n * `groupSidebar` writes through immediately (the sidebar seat subscribes to\n * the same scope). The card snapshot flips the value and raises\n * `groupingPending` before the write crosses the wire, so the checkbox and\n * spinner can paint; pending stays up until `afterGroupSidebarWrite`\n * reports the seat has swapped (not merely until `scope.set` resolves).\n *\n * Self-contained on purpose: the client bundle-purity rule forbids value\n * imports across plugins, so this package stages and fences its own form\n * (and its own snapshot store) rather than importing another plugin's model.\n *\n * @module git-worktree/client/card-form\n */\n\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-runtime/client'\n\n/** The field this card edits. */\nexport const ROOT_FIELD = 'rootDir'\n\n/** The resolved user-facing section this card edits. */\nexport interface SectionValue {\n /** Worktree storage root; absent selects `$DSH_HOME/gitworktree`. */\n rootDir?: string\n /** Whether the sidebar groups same-repository workspaces; absent = on. */\n groupSidebar?: boolean\n}\n\n/**\n * Minimal observable snapshot source: the stable-reference discipline the\n * shell's stores follow (same snapshot object until the fact moves), with\n * nothing the single-field form does not use.\n */\nexport interface CardStore {\n /** @returns the current snapshot (stable reference until the next change). */\n getSnapshot(): CardState\n /** @param listener - invoked after each snapshot change. @returns the disposer. */\n subscribe(listener: () => void): () => void\n /** @param next - the new snapshot; replaces the reference only on a real change. */\n set(next: CardState): void\n}\n\n/** What the git-worktree settings card renders. */\nexport interface CardState {\n /** False while the namespace is not served to this client; the card renders nothing. */\n available: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Draft text ('' marks the inherited/default location). */\n rootDir: string\n /** Whether saving the field would leave a user-layer entry. */\n overridden: boolean\n /** Whether the form holds an edit that a save would write. */\n dirty: boolean\n /** Whether a save is crossing the wire. */\n saving: boolean\n /** Whether the last save did not land as staged; cleared by the next edit or save. */\n failed: boolean\n /** Resolved sidebar-grouping switch (user layer over the default on). */\n groupSidebar: boolean\n /** True while a grouping-switch write (and the seat swap it triggers) is in flight. */\n groupingPending: boolean\n}\n\n/** The form actions the card's slot entry injects. */\nexport interface CardActions {\n /** Stage draft text for the root field. */\n editRoot: (text: string) => void\n /** Stage a clear, so saving lets the field re-inherit the default location. */\n clearRoot: () => void\n /** Write the staged edit, then re-seed from what the Host accepted. */\n save: () => void\n /** Drop the staged edit. */\n discard: () => void\n /** Persist the sidebar-grouping switch (takes effect immediately). */\n setGroupSidebar: (value: boolean) => void\n}\n\n/**\n * Stages the settings edit over the `git-worktree` scope.\n *\n * The form publishes through a snapshot store because the slot component\n * reads through a snapshot selector while both the scope and the local draft\n * change underneath; every projection is rebuilt from the two together. The\n * root field is staged only when the user touched it, so a save writes a\n * sparse patch and never restates fields it did not see. The grouping switch\n * is not staged: a set optimistic-publishes, yields a frame so the spinner\n * can paint, then writes; pending holds until the seat callback settles.\n */\nexport class CardForm {\n private snapshotValue: CardState\n private readonly listeners = new Set<() => void>()\n private draft: string | undefined\n private saving = false\n private failed = false\n private groupingPending = false\n private groupingDraft: boolean | undefined\n\n /**\n * @param scope - the bound settings scope for the `git-worktree` namespace.\n * @param afterGroupSidebarWrite - awaited after the setting lands, until\n * the sidebar seat has actually swapped (facts in on enable, native\n * paint on disable). Absent in unit tests that only cover the write.\n */\n constructor(\n private readonly scope: SettingsScope<SectionValue>,\n private readonly afterGroupSidebarWrite?: (enabled: boolean) => Promise<void>,\n ) {\n this.snapshotValue = this.project()\n scope.subscribe(() => { this.publish() })\n }\n\n /** @returns the store the card's component reads through its bound selector. */\n bind(): CardStore {\n return {\n getSnapshot: () => this.snapshotValue,\n subscribe: (listener) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n },\n set: (next) => { this.store(next) },\n }\n }\n\n /** @returns the edit, clear, save, discard, and grouping-switch actions bound to this form. */\n actions(): CardActions {\n return {\n editRoot: (text) => {\n this.draft = text\n this.failed = false\n this.publish()\n },\n clearRoot: () => {\n this.draft = ''\n this.failed = false\n this.publish()\n },\n // Returns the save's promise (assignable to the void action slot) so\n // callers that care — tests — can await settlement.\n save: () => this.save(),\n discard: () => {\n if (this.draft === undefined && !this.failed) return\n this.draft = undefined\n this.failed = false\n this.publish()\n },\n setGroupSidebar: (value) => this.setGroupSidebar(value),\n }\n }\n\n /**\n * Flip the grouping switch immediately, then persist.\n *\n * `scope.set` only stores the document; the visible sidebar swap (inject\n * + `/group` facts, or dispose + native paint) happens after. Pending\n * stays up until that callback settles so the spinner matches what the\n * user sees, not the write round-trip.\n */\n private async setGroupSidebar(value: boolean): Promise<void> {\n if (this.groupingPending) return\n if (value === this.effectiveGroupSidebar()) return\n this.groupingPending = true\n this.groupingDraft = value\n this.publish()\n await yieldForPaint()\n try {\n await this.scope.set('groupSidebar', value)\n if (this.afterGroupSidebarWrite !== undefined) await this.afterGroupSidebarWrite(value)\n } finally {\n this.groupingPending = false\n this.groupingDraft = undefined\n this.publish()\n }\n }\n\n /** Resolved grouping switch, preferring an in-flight optimistic draft. */\n private effectiveGroupSidebar(): boolean {\n return this.groupingDraft ?? this.scope.getSnapshot().value?.groupSidebar ?? true\n }\n\n /**\n * Write the staged edit, then re-seed from what the Host accepted.\n *\n * The Host is the only authority on acceptance — an empty draft clears the\n * field, anything else stores the trimmed text (so blanking the control and\n * saving is the same gesture as clearing it). A save that did not land\n * keeps its draft so the user can correct it instead of retyping.\n */\n private async save(): Promise<void> {\n if (this.draft === undefined || this.saving) return\n // Snapshot the intended write: a keystroke mid-await must not change what\n // this save commits.\n const intended = this.draft.trim()\n this.saving = true\n this.failed = false\n this.publish()\n let landed = true\n try {\n if (intended === '') await this.scope.unset(ROOT_FIELD)\n else await this.scope.set(ROOT_FIELD, intended)\n // Read back: the Host's validator owns the constraints no schema\n // expresses, so acceptance is judged from the stored layers.\n if (intended === '' ? this.storedRoot() : this.storedRootValue() !== intended) {\n landed = false\n }\n } catch (_settingsWriteFailure) {\n landed = false\n }\n if (landed) this.draft = undefined\n this.saving = false\n this.failed = !landed\n this.publish()\n }\n\n /** The raw user layer narrowed to a record; the wire answer is `unknown`. */\n private userLayer(): Record<string, unknown> | undefined {\n const user = this.scope.getSnapshot().user\n return typeof user === 'object' && user !== null ? user as Record<string, unknown> : undefined\n }\n\n /** Whether the user layer carries the root field. */\n private storedRoot(): boolean {\n const user = this.userLayer()\n return user !== undefined && Object.hasOwn(user, ROOT_FIELD)\n }\n\n /** The raw user-layer value of the root field. */\n private storedRootValue(): unknown {\n return this.userLayer()?.[ROOT_FIELD]\n }\n\n /** The resolved (draft-free) text of the field; '' means inherited. */\n private effectiveRoot(): string {\n const value = this.scope.getSnapshot().value?.[ROOT_FIELD]\n return typeof value === 'string' ? value : ''\n }\n\n private project(): CardState {\n const snapshot = this.scope.getSnapshot()\n const draft = this.draft ?? this.effectiveRoot()\n return {\n available: snapshot.status === 'ready',\n writable: snapshot.writable,\n rootDir: draft,\n // A staged edit answers for itself, so the override badge previews the\n // save rather than reporting a state the pending edit contradicts.\n overridden: this.draft !== undefined ? this.draft.trim() !== '' : this.storedRoot(),\n dirty: this.draft !== undefined && this.draft !== this.effectiveRoot(),\n saving: this.saving,\n failed: this.failed,\n groupSidebar: this.effectiveGroupSidebar(),\n groupingPending: this.groupingPending,\n }\n }\n\n /** Replace the snapshot reference and notify, only when the fact moved. */\n private store(next: CardState): void {\n if (next === this.snapshotValue) return\n this.snapshotValue = next\n for (const listener of this.listeners) listener()\n }\n\n private publish(): void {\n this.store(this.project())\n }\n}\n\n/** Yield until after the next paint (rAF), or a macrotask when rAF is absent (tests). */\nfunction yieldForPaint(): Promise<void> {\n return new Promise((resolve) => {\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => { resolve() })\n return\n }\n setTimeout(resolve, 0)\n })\n}\n","/**\n * The git-worktree card on the Plugins configuration tab: a collapsible row\n * whose header names the plugin over a one-line description of what its\n * settings govern, disclosing the storage-root control when open. The card\n * owns everything inside it — chrome, controls, and copy — per the keyed-slot\n * contract; the tab only dispatches it under the `git-worktree` namespace\n * key.\n *\n * Renders nothing while the namespace is unavailable: a deployment that did\n * not compose the host half shows no trace of the card. A stored root edit\n * takes effect live (the Host routes read the section source per request);\n * no data moves — worktrees already created stay where they are, and git\n * itself still lists and reuses them.\n *\n * @module git-worktree/client/GitWorktreeCard\n */\n\nimport { useState } from 'react'\nimport { IconChevronDownOutline14, IconLoadingOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { CardActions, CardStore } from './card-form.ts'\nimport css from './GitWorktreeCard.module.css'\n\n/** Props the renderer binds for the git-worktree settings card. */\nexport type GitWorktreeCardProps =\n PropsRuntime<'settings.plugin.item'>\n & PropsLocale<'git-worktree'>\n & InjectFace<GitWorktreeCardFace>\n\n/** The registration-side face this card's slot entry injects. */\nexport interface GitWorktreeCardFace extends CardActions {\n hooks: {\n /** Card snapshot bound by the renderer as useGitWorktreeCard. */\n gitWorktreeCard: CardStore\n }\n /**\n * The shell's native directory picker (the workspace flows' chooser):\n * resolves the chosen absolute path, or null when the user dismisses the\n * dialog.\n */\n pickDirectory: () => Promise<string | null>\n}\n\n/**\n * Render the git-worktree settings card.\n * @param props - locale copy, the card snapshot, and its form actions.\n * @returns the card, or nothing when the namespace is unavailable.\n */\nexport function GitWorktreeCard(props: GitWorktreeCardProps) {\n const [open, setOpen] = useState(false)\n const [picking, setPicking] = useState(false)\n const { t } = props\n const state = props.useGitWorktreeCard(snapshot => snapshot)\n if (!state.available) return null\n const lockInput = !state.writable\n const lockActions = !state.dirty || state.saving\n\n /**\n * Open the shell's native folder dialog and stage the chosen path — the\n * same picker the workspace flows use, driven through the injected\n * workspace service. A dismissal leaves the staged draft exactly as it\n * was; the text input stays the fallback either way.\n */\n const browse = async (): Promise<void> => {\n if (picking || lockInput) return\n setPicking(true)\n try {\n const picked = await props.pickDirectory()\n if (picked !== null && picked !== '') props.editRoot(picked)\n } catch (_pickFailure) {\n // Leave the draft untouched; typing the path remains available.\n } finally {\n setPicking(false)\n }\n }\n\n return (\n <li className={open ? `${css.card} ${css.cardOpen}` : css.card}>\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n aria-label={`${t(open ? 'cardCollapse' : 'cardExpand')}: ${t('cardTitle')}`}\n onClick={() => { setOpen(!open) }}\n >\n <span className={css.headText}>\n <span className={css.name}>{t('cardTitle')}</span>\n <span className={css.description}>{t('cardDescription')}</span>\n </span>\n {state.dirty ? <span className={css.pending}>{t('cardUnsaved')}</span> : null}\n <IconChevronDownOutline14 className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron} />\n </button>\n {open\n ? (\n <div className={css.body}>\n {!state.writable ? <p className={css.note} role=\"status\">{t('cardReadOnly')}</p> : null}\n <label className={css.field} htmlFor=\"git-worktree-card-root-dir\">\n <span className={css.fieldLabel}>{t('cardRootDirLabel')}</span>\n <span className={css.inputRow}>\n <input\n id=\"git-worktree-card-root-dir\"\n className={css.input}\n type=\"text\"\n spellCheck={false}\n value={state.rootDir}\n disabled={lockInput}\n onChange={event => { props.editRoot(event.target.value) }}\n />\n <button\n type=\"button\"\n className={css.browse}\n disabled={lockInput || picking}\n onClick={() => { void browse() }}\n >\n {t(picking ? 'cardPicking' : 'cardBrowse')}\n </button>\n </span>\n </label>\n <p className={css.hint}>\n {t('cardRootDirHint')}\n {state.overridden ? ` ${t('cardOverridden')}` : ''}\n </p>\n <label className={`${css.field} ${css.toggleRow}`} aria-busy={state.groupingPending}>\n <span className={css.toggleText}>\n <span className={css.toggleLabel}>\n {t('cardGroupSidebarLabel')}\n <span className={css.toggleMark}>{t('cardGroupSidebarMark')}</span>\n </span>\n <span className={css.toggleHint}>{t('cardGroupSidebarHint')}</span>\n <span className={css.toggleNote}>{t('cardGroupSidebarNote')}</span>\n </span>\n <span className={css.toggleControl}>\n {state.groupingPending\n ? (\n <span className={css.spinner} role=\"status\" aria-label={t('cardGroupSidebarBusy')}>\n <IconLoadingOutline16 size={14} />\n </span>\n )\n : null}\n <input\n className={css.toggle}\n type=\"checkbox\"\n disabled={lockInput || state.groupingPending}\n checked={state.groupSidebar}\n onChange={event => { props.setGroupSidebar(event.target.checked) }}\n />\n </span>\n </label>\n <div className={css.footer}>\n {state.failed\n ? <p className={css.failed} role=\"status\">{t('cardSaveFailed')}</p>\n : null}\n <button\n type=\"button\"\n className={css.discard}\n disabled={lockActions}\n onClick={props.discard}\n >\n {t('cardDiscard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={lockActions}\n onClick={props.save}\n >\n {t(state.saving ? 'cardSaving' : 'cardSave')}\n </button>\n </div>\n </div>\n )\n : null}\n </li>\n )\n}\n","/**\n * Pure derivation of the grouped sidebar list: which workspaces form one\n * repository group, what each member row is called, and which sessions a row\n * shows. No React, no store, no network — the component layer feeds it\n * snapshots (workspace items, the /group facts, the session list) and renders\n * what comes out. Grouping is fully DERIVED from the workspace registry plus\n * on-disk git facts: no relationship is stored anywhere.\n *\n * Shapes are structural minimums (not the runtime service types) so the\n * derivation unit-tests without a client runtime.\n *\n * @module git-worktree/client/sidebar-groups\n */\n\nimport type { WorkspaceGitFacts } from '../wire.ts'\n\n/** User interaction currently blocking a session (sidebar amber-dot state). */\nexport type PendingInteraction = 'approval' | 'plan-review' | 'question'\n\n/** The workspace facts the derivation needs (a subset of WorkspaceView). */\nexport interface WorkspaceLike {\n readonly workspaceId: string\n /** Absolute registered directory — the /group probe key. */\n readonly path: string\n readonly title: string\n readonly sessionIds: readonly string[]\n /** ISO-8601 creation instant (HoverCard); absent while the snapshot omits it. */\n readonly createdAt?: string\n}\n\n/** The session facts the visible-row rule needs (a subset of SessionSummary). */\nexport interface SessionLike {\n readonly id: string\n readonly displayTitle: string\n readonly blank: boolean\n /** `'subagent'` rows never show in the browser (native rule). */\n readonly origin?: string\n /** Parent of a subagent row; feeds descendant running-count. */\n readonly parentId?: string\n /** Directory the session is bound to (search workspace-label fallback). */\n readonly cwd?: string\n /** Whether the session is running (the sidebar's active dot). */\n readonly running?: boolean\n /** Finished while unopened (the sidebar's completed dot); absent = false. */\n readonly completed?: boolean\n /** Epoch ms of last activity (relative time + recency sort). */\n readonly updatedAt?: number\n /** User interaction currently blocking this session. */\n readonly pendingInteraction?: PendingInteraction\n}\n\n/** Minimal session-list snapshot the visibility rule reads. */\nexport interface SessionListLike {\n readonly ids: readonly string[]\n readonly byId: Readonly<Record<string, SessionLike | undefined>>\n readonly current: string | undefined\n /** Arrival lifecycle; `ready` means an empty list is truly empty. */\n readonly phase?: string\n}\n\n/** One top-level session row in a group or the flat list (native SessionNode). */\nexport interface SessionNode {\n readonly id: string\n readonly title: string\n readonly blank: boolean\n readonly running: boolean\n readonly runningSubagentCount: number\n readonly completed: boolean\n readonly updatedAt: number\n readonly pendingInteraction?: PendingInteraction\n}\n\n/** Descendant totals keyed by possible parent id. */\nexport interface SubagentRunning {\n readonly count: number\n readonly runningCount: number\n}\n\n/** Grouping mode persisted in the local view prefs. */\nexport type SidebarGroupBy = 'workspace' | 'flat'\n/** Ordering mode persisted in the local view prefs. */\nexport type SidebarOrderBy = 'manual' | 'updated'\n\n/** Browser-local view prefs (not the native `dsh.workspace.view.v5` store). */\nexport interface SidebarViewPrefs {\n readonly groupBy: SidebarGroupBy\n readonly orderBy: SidebarOrderBy\n}\n\n/** How one member row is labelled. */\nexport type MemberLabel =\n /** Plain row: single-member (degraded) or non-git workspace — native look. */\n | { readonly type: 'plain' }\n /** Main-worktree member of a multi-member group. */\n | { readonly type: 'main'; readonly branch: string | null }\n /** Linked-worktree member of a multi-member group. */\n | { readonly type: 'linked'; readonly branch: string | null }\n\n/** One workspace row inside a group. */\nexport interface SidebarMember {\n readonly workspace: WorkspaceLike\n readonly label: MemberLabel\n}\n\n/** One rendered group: a repository cluster, or a single plain row. */\nexport interface SidebarGroup {\n /** Stable expansion-storage key: `repo:<repoRoot>` or `ws:<workspaceId>`. */\n readonly key: string\n readonly kind: 'repo' | 'single'\n /** Repository basename (repo groups only). */\n readonly repoName: string | undefined\n readonly members: readonly SidebarMember[]\n}\n\n/**\n * Derive the sidebar groups.\n *\n * Rules (the shipped design): git facts absent/null → plain single row;\n * same-`repoRoot` workspaces cluster into one repo group; inside a group the\n * main worktree leads and linked members keep registry order; a repo cluster\n * with exactly ONE member degrades to a plain row (zero visual intrusion for\n * repositories without worktrees); a group renders where its FIRST member\n * sits in the registry order (the main worktree's slot).\n * @param items - workspace list items in registry order.\n * @param facts - per-path git facts from the /group route (absent = unknown).\n * @returns groups in render order.\n */\nexport function deriveSidebarGroups(\n items: readonly WorkspaceLike[],\n facts: Readonly<Record<string, WorkspaceGitFacts | null>> | undefined,\n): readonly SidebarGroup[] {\n // Bucket git workspaces by repoRoot; keep first-seen registry index per\n // bucket for the group's render slot, and member order inside it.\n const bucketOrder: string[] = []\n const buckets = new Map<string, { index: number; mainSeen: boolean; members: SidebarMember[] }>()\n const singles: { index: number; group: SidebarGroup }[] = []\n\n items.forEach((workspace, index) => {\n const pathFacts = facts?.[workspace.path]\n if (pathFacts === undefined || pathFacts === null) {\n singles.push({ index, group: singleGroup(workspace) })\n return\n }\n const bucketKey = `repo:${pathFacts.repoRoot}`\n let bucket = buckets.get(bucketKey)\n if (bucket === undefined) {\n bucket = { index, mainSeen: false, members: [] }\n buckets.set(bucketKey, bucket)\n bucketOrder.push(bucketKey)\n }\n bucket.members.push({\n workspace,\n label: pathFacts.main\n ? { type: 'main', branch: pathFacts.branch }\n : { type: 'linked', branch: pathFacts.branch },\n })\n if (pathFacts.main) bucket.mainSeen = true\n })\n\n // Materialize repo groups: multi-member keep the cluster (main leads);\n // single-member degrade to plain. Re-derive per-bucket main ordering here\n // where every member is known.\n const repoGroups = new Map<string, SidebarGroup>()\n for (const key of bucketOrder) {\n const bucket = buckets.get(key)\n if (bucket === undefined) continue\n const ordered = bucket.mainSeen\n ? [...bucket.members].sort((a, b) => Number(b.label.type === 'main') - Number(a.label.type === 'main'))\n : bucket.members\n const first = ordered[0]\n // A bucket exists only because a member created it, so `first` always\n // resolves; the guard merely satisfies noUncheckedIndexedAccess.\n if (first === undefined) continue\n const repoName = facts?.[first.workspace.path]?.repoName ?? first.workspace.title\n if (ordered.length === 1) {\n singles.push({ index: bucket.index, group: singleGroup(first.workspace) })\n continue\n }\n repoGroups.set(key, { key, kind: 'repo', repoName, members: ordered })\n }\n\n // Render order: interleave by the slot each group claimed.\n const slots: { index: number; group: SidebarGroup }[] = [\n ...singles,\n ...[...repoGroups.values()].map(group => {\n const bucket = buckets.get(group.key)\n return { index: bucket?.index ?? Number.MAX_SAFE_INTEGER, group }\n }),\n ]\n slots.sort((a, b) => a.index - b.index)\n return slots.map(slot => slot.group)\n}\n\n/** A plain single-row group for one workspace. */\nfunction singleGroup(workspace: WorkspaceLike): SidebarGroup {\n return {\n key: `ws:${workspace.workspaceId}`,\n kind: 'single',\n repoName: undefined,\n members: [{ workspace, label: { type: 'plain' } }],\n }\n}\n\n/**\n * Session ids a member row shows, in the workspace's stored order — the\n * native browser's visibility rule: archived hidden everywhere, subagent\n * rows never listed, and a blank row visible only while it IS the current\n * selection (a blank is the provisional New Session row).\n * @param workspace - the member's workspace.\n * @param sessions - session list snapshot.\n * @param archivedSessionIds - registry-global archive set.\n * @returns visible session ids in stored order.\n */\nexport function visibleSessionIds(\n workspace: WorkspaceLike,\n sessions: SessionListLike,\n archivedSessionIds: readonly string[],\n): readonly string[] {\n const archived = new Set(archivedSessionIds)\n const visible: string[] = []\n for (const sessionId of workspace.sessionIds) {\n const summary = sessions.byId[sessionId]\n if (summary === undefined) continue\n if (summary.origin === 'subagent') continue\n if (archived.has(sessionId)) continue\n if (summary.blank && sessionId !== sessions.current) continue\n visible.push(sessionId)\n }\n return visible\n}\n\n/** localStorage key of the sidebar expansion map (browser-local only). */\nexport const EXPAND_STORAGE_KEY = 'dsh-git-worktree.sidebar.expand'\n\n/** Read the persisted expansion map; unreadable/absent answers {}. */\nexport function loadExpandState(): Record<string, boolean> {\n if (typeof localStorage === 'undefined') return {}\n try {\n const raw = localStorage.getItem(EXPAND_STORAGE_KEY)\n if (raw === null) return {}\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return {}\n const out: Record<string, boolean> = {}\n for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {\n if (typeof value === 'boolean') out[key] = value\n }\n return out\n } catch {\n return {}\n }\n}\n\n/** Persist the expansion map; write failures (quota, privacy mode) stay silent. */\nexport function saveExpandState(state: Record<string, boolean>): void {\n if (typeof localStorage === 'undefined') return\n try {\n localStorage.setItem(EXPAND_STORAGE_KEY, JSON.stringify(state))\n } catch {\n // A collapsed group is a fine failure mode.\n }\n}\n\n/** localStorage key of grouping/order prefs (browser-local; P3 may graduate to store v5). */\nexport const VIEW_STORAGE_KEY = 'dsh-git-worktree.sidebar.view'\n\nconst DEFAULT_VIEW_PREFS: SidebarViewPrefs = { groupBy: 'workspace', orderBy: 'updated' }\n\n/** Read persisted view prefs; unreadable/absent answers native defaults. */\nexport function loadViewPrefs(): SidebarViewPrefs {\n if (typeof localStorage === 'undefined') return DEFAULT_VIEW_PREFS\n try {\n const raw = localStorage.getItem(VIEW_STORAGE_KEY)\n if (raw === null) return DEFAULT_VIEW_PREFS\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return DEFAULT_VIEW_PREFS\n const record = parsed as Record<string, unknown>\n const groupBy = record.groupBy === 'flat' || record.groupBy === 'workspace' ? record.groupBy : DEFAULT_VIEW_PREFS.groupBy\n const orderBy = record.orderBy === 'manual' || record.orderBy === 'updated' ? record.orderBy : DEFAULT_VIEW_PREFS.orderBy\n return { groupBy, orderBy }\n } catch {\n return DEFAULT_VIEW_PREFS\n }\n}\n\n/** Persist view prefs; write failures stay silent. */\nexport function saveViewPrefs(prefs: SidebarViewPrefs): void {\n if (typeof localStorage === 'undefined') return\n try {\n localStorage.setItem(VIEW_STORAGE_KEY, JSON.stringify(prefs))\n } catch {\n // Default grouping is a fine failure mode.\n }\n}\n\n/** Recency comparator: newest first, id as the deterministic tiebreak. */\nexport function byRecency(a: { id: string; updatedAt: number }, b: { id: string; updatedAt: number }): number {\n if (b.updatedAt !== a.updatedAt) return b.updatedAt - a.updatedAt\n return a.id < b.id ? -1 : 1\n}\n\n/**\n * Index running/total subagent descendants under each ancestor reached through\n * an uninterrupted subagent-origin chain (ordinary forks terminate propagation).\n * Mirrors `indexSubagentDescendants` without importing the runtime bundle.\n */\nexport function indexSubagentRunning(\n byId: Readonly<Record<string, SessionLike | undefined>>,\n): ReadonlyMap<string, SubagentRunning> {\n const out = new Map<string, { count: number; runningCount: number }>()\n const bump = (id: string, running: boolean): void => {\n const cur = out.get(id) ?? { count: 0, runningCount: 0 }\n out.set(id, { count: cur.count + 1, runningCount: cur.runningCount + (running ? 1 : 0) })\n }\n for (const summary of Object.values(byId)) {\n if (summary === undefined || summary.origin !== 'subagent') continue\n const running = summary.running === true\n const seen = new Set<string>()\n let parentId = summary.parentId\n while (parentId !== undefined && parentId !== '' && !seen.has(parentId)) {\n seen.add(parentId)\n bump(parentId, running)\n const parent = byId[parentId]\n if (parent === undefined || parent.origin !== 'subagent') break\n parentId = parent.parentId\n }\n }\n return out\n}\n\n/** A blank session's canonical title never enters search; the renderer localizes the label. */\nexport function sessionTitle(session: SessionLike): string {\n return session.blank ? 'New Session' : session.displayTitle\n}\n\n/** Project a list-row summary into a renderable session node. */\nexport function sessionNode(\n session: SessionLike,\n descendants: ReadonlyMap<string, SubagentRunning>,\n): SessionNode {\n return {\n id: session.id,\n title: sessionTitle(session),\n blank: session.blank,\n running: session.running === true,\n runningSubagentCount: descendants.get(session.id)?.runningCount ?? 0,\n completed: session.completed === true,\n updatedAt: session.updatedAt ?? 0,\n ...session.pendingInteraction === undefined ? {} : { pendingInteraction: session.pendingInteraction },\n }\n}\n\n/** Visible session ids, optionally newest-first when `orderBy` is `updated`. */\nexport function orderedVisibleSessionIds(\n workspace: WorkspaceLike,\n sessions: SessionListLike,\n archivedSessionIds: readonly string[],\n orderBy: SidebarOrderBy,\n): readonly string[] {\n const ids = visibleSessionIds(workspace, sessions, archivedSessionIds)\n if (orderBy !== 'updated') return ids\n return [...ids].sort((a, b) => {\n const left = sessions.byId[a]\n const right = sessions.byId[b]\n return byRecency(\n { id: a, updatedAt: left?.updatedAt ?? Number.NEGATIVE_INFINITY },\n { id: b, updatedAt: right?.updatedAt ?? Number.NEGATIVE_INFINITY },\n )\n })\n}\n\n/**\n * Flat session list (\"In one list\"): every visible session as a top-level\n * row. `updated` is newest-first; `manual` keeps the session-list stored order.\n */\nexport function deriveFlat(\n list: SessionListLike,\n archivedSessionIds: readonly string[],\n orderBy: SidebarOrderBy = 'updated',\n): readonly SessionNode[] {\n const archived = new Set(archivedSessionIds)\n const descendants = indexSubagentRunning(list.byId)\n const rows: SessionLike[] = []\n for (const id of list.ids) {\n const summary = list.byId[id]\n if (summary === undefined) continue\n if (summary.origin === 'subagent') continue\n if (archived.has(id)) continue\n if (summary.blank && id !== list.current) continue\n rows.push(summary)\n }\n if (orderBy === 'updated') {\n rows.sort((a, b) => byRecency(\n { id: a.id, updatedAt: a.updatedAt ?? 0 },\n { id: b.id, updatedAt: b.updatedAt ?? 0 },\n ))\n }\n return rows.map(session => sessionNode(session, descendants))\n}\n\n/** One virtual directory cluster of stray (unaccounted) sessions. */\nexport interface StrayGroup {\n readonly kind: 'stray'\n /** Stable expansion key: `stray:<lowercased cwd>` (`stray:?` when unknown). */\n readonly key: string\n /** The sessions' cwd verbatim (first-seen casing); '' when a header has none. */\n readonly path: string\n /** Title of the registered workspace whose path matches (case-insensitive);\n * undefined = no registered workspace holds this directory. */\n readonly belongsTo: string | undefined\n /** Visible stray sessions of the directory, in session-list order. */\n readonly sessions: readonly SessionLike[]\n}\n\n/**\n * Derive the stray-session clusters: sessions no workspace account holds\n * (a deleted-then-recreated registration's leftovers, or history that\n * appeared after first-boot grouping), clustered by their header cwd into\n * VIRTUAL directory groups. The same visibility rule as everywhere else\n * applies (archived hidden, subagent rows never listed, a blank visible\n * only while it IS the current selection — deleting the current session's\n * workspace registration must not make it vanish).\n *\n * Matching against registered workspace paths is case-insensitive\n * (NTFS): one directory must never split into two clusters because of\n * casing drift between a session header and the registry's realpath.\n * @param items - workspace list items (their `sessionIds` projection IS the\n * accounting; the registry guarantees one record per canonical path).\n * @param sessions - session list snapshot.\n * @param archivedSessionIds - registry-global archive set.\n * @returns stray groups in first-appearance order; empty when nothing is loose.\n */\nexport function deriveStrayGroups(\n items: readonly WorkspaceLike[],\n sessions: SessionListLike,\n archivedSessionIds: readonly string[],\n): readonly StrayGroup[] {\n const accounted = new Set(items.flatMap(workspace => workspace.sessionIds))\n const registered = new Map<string, string>()\n for (const workspace of items) {\n const key = workspace.path.toLowerCase()\n if (!registered.has(key)) registered.set(key, workspace.title)\n }\n const archived = new Set(archivedSessionIds)\n const clusters = new Map<string, StrayGroup>()\n for (const id of sessions.ids) {\n if (accounted.has(id)) continue\n const summary = sessions.byId[id]\n if (summary === undefined) continue\n if (summary.origin === 'subagent') continue\n if (archived.has(id)) continue\n if (summary.blank && id !== sessions.current) continue\n const path = summary.cwd ?? ''\n const key = `stray:${path === '' ? '?' : path.toLowerCase()}`\n const existing = clusters.get(key)\n if (existing === undefined) {\n clusters.set(key, {\n kind: 'stray',\n key,\n path,\n belongsTo: path === '' ? undefined : registered.get(path.toLowerCase()),\n sessions: [summary],\n })\n } else {\n clusters.set(key, { ...existing, sessions: [...existing.sessions, summary] })\n }\n }\n return [...clusters.values()]\n}\n","/**\n * Pure search / relative-time helpers transplanted from the native workspace\n * browser (`dsh-client-ui-workspace` lib/client.js). No React — the seat\n * component feeds snapshots and localizes the structured buckets.\n *\n * @module git-worktree/client/sidebar-search\n */\n\nimport {\n byRecency, indexSubagentRunning, sessionNode, sessionTitle,\n type SessionLike, type SessionListLike, type SessionNode, type WorkspaceLike,\n} from './sidebar-groups.ts'\n\n/** Pause between the latest keystroke and a Host content-search request. */\nexport const SEARCH_DEBOUNCE_MS = 250\n/** Session rows visible per Workspace before the local overflow control. */\nexport const COLLAPSED_SESSION_LIMIT = 5\n/** Column slide length: rail-search focus waits it out. */\nexport const EXPAND_SLIDE_MS = 300\n/** `session.search` wire bound, measured in JavaScript UTF-16 code units. */\nexport const SEARCH_QUERY_MAX_CODE_UNITS = 500\n/** Display label for the ungrouped bucket row. */\nexport const UNGROUPED_LABEL = 'Ungrouped'\n\n/** Relative-time bucket of a session row's trailing label. */\nexport type RelativeTimeUnit = 'now' | 'minutes' | 'hours' | 'days' | 'months' | 'years'\n/** Structured relative time: the bucket plus its magnitude (0 for 'now'). */\nexport interface RelativeTime {\n readonly unit: RelativeTimeUnit\n readonly n: number\n}\n\n/** One Host content-search hit (session id + excerpt). */\nexport interface ContentSearchHit {\n readonly sessionId: string\n readonly snippet: string\n}\n\n/** One flat search row combining list metadata with an optional content match. */\nexport interface SearchResultNode {\n readonly id: string\n readonly title: string\n readonly workspace: string\n readonly running: boolean\n readonly runningSubagentCount: number\n readonly completed: boolean\n readonly pendingInteraction?: SessionLike['pendingInteraction']\n readonly snippet?: string\n}\n\n/** Bounded merged search projection plus the refine-query hint bit. */\nexport interface SearchResultSet {\n readonly items: readonly SearchResultNode[]\n readonly hasMore: boolean\n}\n\n/**\n * Dictionary keys the time/hover labels consult. Declaring the vocabulary\n * (instead of a bare `string`) keeps the parameter CONTRAVARIANTLY\n * compatible with any bound namespace translate (`TranslateNS<N>` accepts a\n * superset — every key here must exist in the namespace's dictionary).\n */\nexport type SearchTranslateKey =\n | 'time.now'\n | 'time.minutes'\n | 'time.hours'\n | 'time.days'\n | 'time.months'\n | 'time.years'\n | 'time.ago'\n | 'hover.created'\n | 'date.ymd'\n\n/** Translate used by time/hover labels: accepts exactly the keys they consult. */\nexport type SearchTranslate = (key: SearchTranslateKey, params?: Record<string, unknown>) => string\n\n/**\n * Directory display label: basename of the path (both separators accepted).\n * Ungrouped-bucket fallback for surfaces without a workspace title.\n */\nexport function workspaceLabel(cwd: string | undefined): string {\n if (cwd === undefined || cwd === '') return UNGROUPED_LABEL\n const base = cwd.replace(/[/\\\\]+$/, '').split(/[/\\\\]/).pop()\n return base !== undefined && base !== '' ? base : cwd\n}\n\n/**\n * Keep controlled input and RPC payload inside the session.search wire\n * contract: strip NULs, cap at 500 UTF-16 code units, and never split a\n * surrogate pair at the cut.\n */\nexport function sanitizeSearchQuery(value: string): string {\n const withoutNul = value.replaceAll('\\0', '')\n if (withoutNul.length <= SEARCH_QUERY_MAX_CODE_UNITS) return withoutNul\n let end = SEARCH_QUERY_MAX_CODE_UNITS\n const last = withoutNul.charCodeAt(end - 1)\n const next = withoutNul.charCodeAt(end)\n if (last >= 0xD800 && last <= 0xDBFF && next >= 0xDC00 && next <= 0xDFFF) end -= 1\n return withoutNul.slice(0, end)\n}\n\n/**\n * Compact relative time for session rows, as a structured bucket the\n * renderer localizes (\"now\"/\"5min\"/\"3h\"/\"2d\"/\"4mo\"/\"1y\" in en).\n */\nexport function relativeTime(updatedAt: number, now: number): RelativeTime {\n const MIN = 60_000\n const HOUR = 3_600_000\n const DAY = 86_400_000\n const diff = Math.max(0, now - updatedAt)\n if (diff < MIN) return { unit: 'now', n: 0 }\n if (diff < HOUR) return { unit: 'minutes', n: Math.floor(diff / MIN) }\n if (diff < DAY) return { unit: 'hours', n: Math.floor(diff / HOUR) }\n if (diff < 30 * DAY) return { unit: 'days', n: Math.floor(diff / DAY) }\n if (diff < 365 * DAY) return { unit: 'months', n: Math.floor(diff / (30 * DAY)) }\n return { unit: 'years', n: Math.floor(diff / (365 * DAY)) }\n}\n\n/** Localized compact relative time (\"刚刚\"/\"5分钟\" in zh, \"now\"/\"5min\" in en). */\nexport function timeLabel(updatedAt: number, now: number, t: SearchTranslate): string {\n const { unit, n } = relativeTime(updatedAt, now)\n if (unit === 'now') return t('time.now')\n if (unit === 'minutes') return t('time.minutes', { n })\n if (unit === 'hours') return t('time.hours', { n })\n if (unit === 'days') return t('time.days', { n })\n if (unit === 'months') return t('time.months', { n })\n return t('time.years', { n })\n}\n\n/** Hover-card variant: distances wrap in the ago template; the now bucket stays bare. */\nexport function hoverTimeLabel(updatedAt: number, now: number, t: SearchTranslate): string {\n const { unit, n } = relativeTime(updatedAt, now)\n if (unit === 'now') return t('time.now')\n const compact = unit === 'minutes' ? t('time.minutes', { n })\n : unit === 'hours' ? t('time.hours', { n })\n : unit === 'days' ? t('time.days', { n })\n : unit === 'months' ? t('time.months', { n })\n : t('time.years', { n })\n return t('time.ago', { t: compact })\n}\n\n/**\n * Absolute creation time through the dictionary's date template (the message\n * clock pattern): `toLocaleString` would follow the browser language, not the\n * app locale.\n */\nexport function createdLabel(createdAt: number, t: SearchTranslate): string {\n const d = new Date(createdAt)\n const pad2 = (v: number): string => String(v).padStart(2, '0')\n return t('hover.created', {\n time: `${t('date.ymd', { y: d.getFullYear(), m: d.getMonth() + 1, d: d.getDate() })} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`,\n })\n}\n\n/** Ordinary sessions are visible; among blanks, only the current one. */\nfunction sessionVisible(session: SessionLike, current: string | undefined, archived: ReadonlySet<string>): boolean {\n return session.origin !== 'subagent' && !archived.has(session.id) && (!session.blank || session.id === current)\n}\n\n/**\n * Merge immediate title/Workspace substring matches with ranked Host content\n * matches. Local rows lead newest-first, content-only rows retain backend\n * order, and duplicate sessions receive the backend snippet in place.\n */\nexport function deriveSearchResults(\n list: SessionListLike,\n workspaces: readonly WorkspaceLike[],\n query: string,\n archivedSessionIds: readonly string[],\n content: { items: readonly ContentSearchHit[]; hasMore: boolean },\n limit: number,\n): SearchResultSet {\n const q = query.trim().toLowerCase()\n if (q === '') return { items: [], hasMore: false }\n const archived = new Set(archivedSessionIds)\n const descendants = indexSubagentRunning(list.byId)\n const workspaceBySession = new Map<string, string>()\n for (const workspace of workspaces) {\n for (const sessionId of workspace.sessionIds) {\n if (!workspaceBySession.has(sessionId)) workspaceBySession.set(sessionId, workspace.title)\n }\n }\n const labelOf = (summary: SessionLike): string => workspaceBySession.get(summary.id) ?? workspaceLabel(summary.cwd)\n const contentBySession = new Map<string, ContentSearchHit>()\n for (const item of content.items) {\n if (!contentBySession.has(item.sessionId)) contentBySession.set(item.sessionId, item)\n }\n const local: SessionLike[] = []\n for (const id of list.ids) {\n const summary = list.byId[id]\n if (summary === undefined || summary.blank || !sessionVisible(summary, list.current, archived)) continue\n if (sessionTitle(summary).toLowerCase().includes(q) || labelOf(summary).toLowerCase().includes(q)) local.push(summary)\n }\n local.sort((a, b) => byRecency(\n { id: a.id, updatedAt: a.updatedAt ?? 0 },\n { id: b.id, updatedAt: b.updatedAt ?? 0 },\n ))\n const ordered: SessionLike[] = []\n const included = new Set<string>()\n const include = (summary: SessionLike): void => {\n if (included.has(summary.id)) return\n included.add(summary.id)\n ordered.push(summary)\n }\n for (const summary of local) include(summary)\n for (const item of content.items) {\n const summary = list.byId[item.sessionId]\n if (summary !== undefined && !summary.blank && sessionVisible(summary, list.current, archived)) include(summary)\n }\n return {\n items: ordered.slice(0, limit).map((summary) => {\n const match = contentBySession.get(summary.id)\n const node = sessionNode(summary, descendants)\n return {\n id: node.id,\n title: node.title,\n workspace: labelOf(summary),\n running: node.running,\n runningSubagentCount: node.runningSubagentCount,\n completed: node.completed,\n ...summary.pendingInteraction === undefined ? {} : { pendingInteraction: summary.pendingInteraction },\n ...match === undefined ? {} : { snippet: match.snippet },\n }\n }),\n hasMore: content.hasMore || ordered.length > limit,\n }\n}\n\n/** Re-export SessionNode so search rows share the session status shape. */\nexport type { SessionNode }\n","/**\n * Workspace / session / search row components transplanted from the native\n * `Rows.js` (injected props, no ctx). Hover swaps (folder→chevron, time→⋯)\n * are CSS-only. Drag wiring is intentionally omitted — P3.\n *\n * @module git-worktree/client/sidebar-rows\n */\n\nimport { useState, type ReactNode } from 'react'\nimport {\n HoverCard, IconArchiveOutline20, IconBranchOutline16, IconEditOutline16,\n IconEllipsisOutline16, IconFolderClose16, IconFolderOpen16,\n IconPlusOutline16, IconTrashOutline16, IconTriangleRightFill14, Menu, StateDot,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { abbreviateHomePath } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionNode } from './sidebar-groups.ts'\nimport { createdLabel, hoverTimeLabel, timeLabel, type SearchResultNode } from './sidebar-search.ts'\nimport css from './sidebar-rows.module.css'\n\ntype Translate = PropsLocale<'git-worktree'>['t']\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter((part): part is string => typeof part === 'string' && part !== '').join(' ')\n}\n\n/** Row display title: blank rows show the localized New Session label. */\nfunction displayTitle(node: { blank: boolean; title: string }, t: Translate): string {\n return node.blank ? t('session.new') : node.title\n}\n\n/** Hover-card body: workspace title, display directory path, absolute creation time. */\nfunction WorkspaceHoverContent({ label, cwd, createdAt, t }: {\n label: string\n cwd: string | undefined\n createdAt: number\n t: Translate\n}): ReactNode {\n return (\n <div className={css.hoverContent}>\n <div className={css.hoverTitle}>{label}</div>\n <div className={css.hoverPath}>{cwd}</div>\n <div className={css.hoverTime}>{createdLabel(createdAt, t)}</div>\n </div>\n )\n}\n\n/** Facts a project (workspace / repo-head) row needs. */\nexport interface ProjectRowModel {\n readonly key: string\n readonly label: string\n readonly expanded: boolean\n readonly containsCurrent: boolean\n readonly cwd?: string\n readonly createdAt?: number\n}\n\n/**\n * Project (workspace) header row: folder + title; hover reveals the chevron\n * and create button. `containsCurrent` is a derivation fact (no renderer scan).\n * Drag wiring is not transplanted (P3 — `useNativeDragAcceptance` stays vacant).\n */\nexport function ProjectRowItem({ row, onToggle, onCreate, actions, home, t, badge }: {\n row: ProjectRowModel\n onToggle: () => void\n onCreate?: () => void\n actions?: { rename: () => void; delete: () => void; removeWorktree?: () => void }\n home?: string | undefined\n t: Translate\n /** Aggregation-only count badge (repo group heads). */\n badge?: string\n}): ReactNode {\n const active = row.expanded && row.containsCurrent\n const [menuOpen, setMenuOpen] = useState(false)\n // The worktree entry stays absent on non-linked rows and on linked rows the\n // sidebar holds occupied (a running or currently-browsed session) — the\n // affordance appears exactly where removal is safe to offer.\n const workspaceMenuItems = [\n { id: 'rename', label: t('rename'), icon: <IconEditOutline16 /> },\n ...(actions?.removeWorktree !== undefined\n ? [{ id: 'removeWorktree', label: t('worktreeRemove.menu'), icon: <IconTrashOutline16 />, danger: true }]\n : []),\n { id: 'delete', label: t('delete.workspace'), icon: <IconTrashOutline16 />, danger: true },\n ]\n const ownRow = (\n <div\n className={cx(css.projectRow, menuOpen && css.menuOpen)}\n role=\"treeitem\"\n aria-expanded={row.expanded}\n onClick={onToggle}\n >\n <span className={cx(css.slot, css.folder, active && css.folderActive)}>\n {row.expanded ? <IconFolderOpen16 /> : <IconFolderClose16 />}\n </span>\n <span className={cx(css.slot, css.chevron)}>\n <IconTriangleRightFill14 className={cx(css.arrow, row.expanded && css.arrowOpen)} />\n </span>\n <span className={css.projectText}>\n <span className={css.title}>{row.label}</span>\n </span>\n {badge !== undefined ? <span className={css.repoCount}>{badge}</span> : null}\n <span className={css.rowActions}>\n {actions !== undefined && (\n <Menu\n open={menuOpen}\n onClose={() => { setMenuOpen(false) }}\n items={workspaceMenuItems}\n onSelect={(id) => {\n setMenuOpen(false)\n if (id === 'rename') actions.rename()\n else if (id === 'removeWorktree') actions.removeWorktree?.()\n else if (id === 'delete') actions.delete()\n }}\n portal\n closeOnPointerLeave\n anchor={(\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.workspace.aria', { name: row.label })}\n onClick={(e) => {\n e.stopPropagation()\n setMenuOpen(v => !v)\n }}\n >\n <IconEllipsisOutline16 />\n </button>\n )}\n />\n )}\n {onCreate !== undefined && (\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.newSession.aria', { name: row.label })}\n onClick={(e) => {\n e.stopPropagation()\n onCreate()\n }}\n >\n <IconPlusOutline16 />\n </button>\n )}\n </span>\n </div>\n )\n if (row.createdAt === undefined) return ownRow\n return (\n <HoverCard\n anchor={ownRow}\n content={(\n <WorkspaceHoverContent\n label={row.label}\n cwd={row.cwd === undefined ? undefined : abbreviateHomePath(row.cwd, home)}\n createdAt={row.createdAt}\n t={t}\n />\n )}\n disabled={menuOpen}\n copyText={row.cwd}\n copyLabel={t('copy')}\n copiedLabel={t('hover.copied')}\n />\n )\n}\n\nfunction assertNever(value: never): never {\n throw new Error(`unknown pending interaction: ${String(value)}`)\n}\n\n/** Final path segment of an absolute directory ('' for the unknown-cwd cluster). */\nfunction pathBasename(path: string): string {\n if (path === '') return ''\n const parts = path.split(/[\\\\/]/)\n return parts[parts.length - 1] ?? ''\n}\n\n/**\n * Dashed folder glyph for virtual (unregistered) directory rows. The icon set\n * ships no dashed variant, so this follows the WorktreeCheck precedent of a\n * module-local SVG: at 16px a dash pattern is a far stronger \"directory-shaped\n * but not a registered workspace\" mark than the outline/solid stroke contrast\n * it replaces.\n */\nfunction StrayFolderGlyph({ size = 16 }: { size?: number }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n 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\"\n stroke=\"currentColor\"\n strokeWidth=\"1.15\"\n strokeDasharray=\"2 1.6\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\n/**\n * One virtual directory row of the stray (Ungrouped) section: DASHED folder\n * (the real workspace rows' folder is solid — the dash pattern is the\n * at-a-glance \"this directory is not a registered workspace\" mark) +\n * directory basename + session-count badge; hover reveals the full path plus\n * one guidance line — ownership when a registered workspace holds the\n * directory, or the rebuild hint when it is a missing worktree storage slot.\n * The ⋯ menu carries exactly one action: register (directory probed real and\n * unregistered) or rebuild (missing but host-confirmed as a storage slot).\n */\nexport function StrayGroupRow({ path, belongsTo, count, expanded, onToggle, onRegister, registering, onRebuild, rebuilding, missingDir, worktreeSlot, home, t }: {\n path: string\n /** Registered workspace title holding this directory; undefined = unregistered. */\n belongsTo: string | undefined\n count: number\n expanded: boolean\n onToggle: () => void\n /** Present only while the directory is unregistered AND probed to exist. */\n onRegister?: () => void\n registering?: boolean\n /** Present only for a missing path the host confirmed as a storage slot. */\n onRebuild?: () => void\n rebuilding?: boolean\n /** True when the host probed the directory GONE: hover explains the state. */\n missingDir?: boolean\n /** True when the gone path sits directly in the worktree storage root. */\n worktreeSlot?: boolean\n home?: string | undefined\n t: Translate\n}): ReactNode {\n const [menuOpen, setMenuOpen] = useState(false)\n const label = path === '' ? t('stray.unknown') : pathBasename(path)\n const items = onRegister !== undefined\n ? [{ id: 'register', label: t('stray.register'), icon: <IconFolderOpen16 /> }]\n : onRebuild !== undefined\n ? [{ id: 'rebuild', label: t('stray.rebuild'), icon: <IconFolderOpen16 /> }]\n : []\n const row = (\n <div\n className={cx(css.projectRow, css.strayRow, menuOpen && css.menuOpen)}\n role=\"treeitem\"\n aria-expanded={expanded}\n onClick={onToggle}\n >\n {/* One steady dashed glyph for both states: the chevron carries\n * expand/collapse, the dash pattern stays the virtual-row mark. */}\n <span className={cx(css.slot, css.folder)}>\n <StrayFolderGlyph />\n </span>\n <span className={cx(css.slot, css.chevron)}>\n <IconTriangleRightFill14 className={cx(css.arrow, expanded && css.arrowOpen)} />\n </span>\n <span className={css.projectText}>\n <span className={css.title}>{label}</span>\n </span>\n <span className={css.repoCount}>{String(count)}</span>\n {items.length > 0 && (\n <span className={css.rowActions}>\n <Menu\n open={menuOpen}\n onClose={() => { setMenuOpen(false) }}\n items={items}\n onSelect={(id) => {\n setMenuOpen(false)\n if (id === 'register') onRegister?.()\n if (id === 'rebuild') onRebuild?.()\n }}\n portal\n closeOnPointerLeave\n anchor={(\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={onRegister !== undefined ? t('stray.register.aria', { name: label }) : t('stray.rebuild.aria', { name: label })}\n disabled={registering === true || rebuilding === true}\n onClick={(e) => {\n e.stopPropagation()\n setMenuOpen(v => !v)\n }}\n >\n <IconEllipsisOutline16 />\n </button>\n )}\n />\n </span>\n )}\n </div>\n )\n return (\n <HoverCard\n anchor={row}\n content={(\n <div className={css.hoverContent}>\n <div className={css.hoverTitle}>{label}</div>\n {path !== '' && <div className={css.hoverPath}>{abbreviateHomePath(path, home)}</div>}\n {belongsTo !== undefined && <div className={css.hoverStatus}>{t('stray.belongsTo', { name: belongsTo })}</div>}\n {missingDir === true && worktreeSlot === true && <div className={css.hoverStatus}>{t('stray.worktreeSlot')}</div>}\n {missingDir === true && worktreeSlot !== true && <div className={css.hoverStatus}>{t('stray.missingDir')}</div>}\n </div>\n )}\n disabled={menuOpen}\n copyText={path === '' ? undefined : path}\n copyLabel={t('copy')}\n copiedLabel={t('hover.copied')}\n />\n )\n}\n\n/** Session status presentation; pending interaction is primary and live activity outranks completion. */\nexport function sessionStatuses(node: {\n pendingInteraction?: SessionNode['pendingInteraction']\n running: boolean\n runningSubagentCount: number\n completed: boolean\n}, t: Translate): ReadonlyArray<{ state: 'done' | 'warning' | 'ongoing'; label: string }> {\n const subagents = node.runningSubagentCount === 0 ? undefined : {\n state: 'ongoing' as const,\n label: t(node.runningSubagentCount === 1 ? 'status.subagentsRunning.one' : 'status.subagentsRunning.other', { n: node.runningSubagentCount }),\n }\n let pending: { state: 'warning'; label: string } | undefined\n switch (node.pendingInteraction) {\n case 'approval':\n pending = { state: 'warning', label: t('status.waitingApproval') }\n break\n case 'plan-review':\n pending = { state: 'warning', label: t('status.planReview') }\n break\n case 'question':\n pending = { state: 'warning', label: t('status.waitingAnswer') }\n break\n case undefined:\n break\n default:\n return assertNever(node.pendingInteraction)\n }\n if (pending !== undefined) return subagents === undefined ? [pending] : [pending, subagents]\n if (node.running) {\n const primary = { state: 'ongoing' as const, label: t('status.running') }\n return subagents === undefined ? [primary] : [primary, subagents]\n }\n if (subagents !== undefined) return [subagents]\n if (node.completed) return [{ state: 'done', label: t('status.completed') }]\n return [{ state: 'done', label: t('status.idle') }]\n}\n\n/** Primary status dot plus every status's screen-reader label. */\nfunction SessionStatusDots({ statuses }: { statuses: ReturnType<typeof sessionStatuses> }): ReactNode {\n const primary = statuses[0]\n if (primary === undefined) return null\n return (\n <>\n <StateDot state={primary.state} />\n {statuses.map(status => (\n <span key={status.label} className={css.visuallyHidden}>{status.label}</span>\n ))}\n </>\n )\n}\n\n/** Hover-card body: full title, relative time, and every relevant live status. */\nfunction SessionHoverContent({ node, now, t }: { node: SessionNode; now: number; t: Translate }): ReactNode {\n const statuses = sessionStatuses(node, t)\n return (\n <div className={css.hoverContent}>\n <div className={css.hoverTitle}>{displayTitle(node, t)}</div>\n {!node.blank && <div className={css.hoverTime}>{hoverTimeLabel(node.updatedAt, now, t)}</div>}\n {statuses.map(status => (\n <div key={status.label} className={css.hoverStatus}>\n <StateDot state={status.state} />\n <span>{status.label}</span>\n </div>\n ))}\n </div>\n )\n}\n\n/** One flat search result: title, Workspace context, and optional content excerpt. */\nexport function SearchResultItem({ result, currentId, onOpen, t }: {\n result: SearchResultNode\n currentId: string | undefined\n onOpen: (id: string) => void\n t: Translate\n}): ReactNode {\n const selected = result.id === currentId\n const statuses = sessionStatuses(result, t)\n const primaryStatus = statuses[0]\n return (\n <button\n type=\"button\"\n className={cx(css.searchResultRow, selected && css.selected)}\n role=\"treeitem\"\n aria-selected={selected}\n onClick={() => { onOpen(result.id) }}\n >\n <span className={css.searchResultHeading}>\n <span className={css.slot}>\n {primaryStatus !== undefined && (primaryStatus.state !== 'done' || result.completed) && (\n <SessionStatusDots statuses={statuses} />\n )}\n </span>\n <span className={css.searchResultTitle}>{result.title}</span>\n </span>\n <span className={css.searchResultMeta}>\n <span className={css.searchResultWorkspace}>{result.workspace}</span>\n {result.snippet !== undefined && (\n <span className={css.searchResultSnippet}>{result.snippet}</span>\n )}\n </span>\n </button>\n )\n}\n\n/**\n * One 32px session row: status dot, title, relative time, hover ⋯ menu.\n * Drag wiring is not transplanted (P3).\n */\nexport function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, flat = false, t }: {\n node: SessionNode\n currentId: string | undefined\n now: number\n onOpen: (id: string) => void\n onRename: (id: string, currentTitle: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n flat?: boolean\n t: Translate\n}): ReactNode {\n const title = displayTitle(node, t)\n const selected = node.id === currentId\n const statuses = sessionStatuses(node, t)\n const showStatus = (statuses[0]?.state !== 'done') || node.completed\n const [menuOpen, setMenuOpen] = useState(false)\n const sessionMenuItems = [\n { id: 'rename', label: t('rename'), icon: <IconEditOutline16 /> },\n { id: 'fork', label: t('menu.fork'), icon: <IconBranchOutline16 /> },\n { id: 'archive', label: t('menu.archiveSession'), icon: <IconArchiveOutline20 size={16} /> },\n ]\n return (\n <HoverCard\n anchor={(\n <div\n className={cx(\n css.sessionRow,\n selected && css.selected,\n menuOpen && css.menuOpen,\n flat && !showStatus && css.flatSessionRowWithoutStatus,\n )}\n role=\"treeitem\"\n aria-selected={selected}\n onClick={() => { onOpen(node.id) }}\n >\n {(!flat || showStatus) && (\n <span className={css.slot}>\n {showStatus && <SessionStatusDots statuses={statuses} />}\n </span>\n )}\n <span className={css.title}>{title}</span>\n {!node.blank && <span className={css.time}>{timeLabel(node.updatedAt, now, t)}</span>}\n {!node.blank && (\n <span className={css.rowActions}>\n <Menu\n open={menuOpen}\n onClose={() => { setMenuOpen(false) }}\n items={sessionMenuItems}\n onSelect={(id) => {\n setMenuOpen(false)\n if (id === 'rename') onRename(node.id, node.title)\n if (id === 'fork') onFork(node.id)\n if (id === 'archive') onArchive(node.id)\n }}\n portal\n closeOnPointerLeave\n anchor={(\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('actions.session.aria', { name: title })}\n onClick={(e) => {\n e.stopPropagation()\n setMenuOpen(v => !v)\n }}\n >\n <IconEllipsisOutline16 />\n </button>\n )}\n />\n </span>\n )}\n </div>\n )}\n content={<SessionHoverContent node={node} now={now} t={t} />}\n disabled={menuOpen}\n copyText={node.blank ? undefined : node.title}\n copyLabel={t('copy')}\n copiedLabel={t('hover.copied')}\n />\n )\n}\n","/**\n * The add-workspace pick flow's orchestration core, isolated from React so\n * the dialog's EDGE-TRIGGERED start and its in-flight invalidation are\n * unit-testable without a DOM: the component syncs the open flag and\n * refreshes the hooks each render, and neither re-render nor unmount can\n * re-launch the OS directory chooser behind the user's back.\n *\n * @module git-worktree/client/pick-flow\n */\n\n/** What a run needs from its host; refreshed on every render via {@link PickFlowController.attach}. */\nexport interface PickFlowHooks {\n /** Opens the OS directory chooser; `null`/empty means the user cancelled. */\n readonly pickDirectory: () => Promise<string | null>\n /** Registers the chosen directory as a workspace. */\n readonly createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n /** The chosen directory became a workspace. */\n readonly onPicked: (workspaceId: string) => void\n /** The user dismissed the chooser; the dialog simply closes. */\n readonly onCancelled: () => void\n /** pick/create rejected; the caller surfaces the message (and closes). */\n readonly onFailed: (message: string) => void\n}\n\n/**\n * Edge-triggered controller for one add-workspace flow.\n *\n * `sync(open)` mirrors the dialog's open flag: only a RISING edge (closed →\n * open) starts a pick — re-syncing `true` while a run is live is a no-op, so\n * the parent's re-renders (fresh inline callbacks and all) can never\n * re-launch the chooser or drop a finished pick the way an effect keyed on\n * unstable function deps would. A falling edge invalidates any in-flight\n * run: its eventual result is discarded without a callback. `kill()` is the\n * permanent teardown — nothing fires after it.\n */\nexport class PickFlowController {\n private hooks: PickFlowHooks | undefined\n private started = false\n private epoch = 0\n\n /** Refresh the callbacks to the latest render's closures; never restarts a run. */\n attach(hooks: PickFlowHooks): void {\n this.hooks = hooks\n }\n\n /** Sync with the dialog's open flag (see the class doc for the edge semantics). */\n sync(open: boolean): void {\n if (open) {\n if (this.started) return\n this.started = true\n this.epoch += 1\n void this.run(this.epoch)\n return\n }\n // Closing (or staying closed) invalidates whatever is in flight.\n this.epoch += 1\n this.started = false\n }\n\n /** Permanent teardown (unmount): no callback fires afterwards. */\n kill(): void {\n this.epoch += 1\n this.started = false\n }\n\n private async run(token: number): Promise<void> {\n const hooks = this.hooks\n if (hooks === undefined) return\n let path: string | null\n try {\n path = await hooks.pickDirectory()\n } catch (reason) {\n if (token === this.epoch) hooks.onFailed(messageOf(reason))\n return\n }\n if (token !== this.epoch) return\n if (path === null || path === '') {\n hooks.onCancelled()\n return\n }\n let workspace: { workspaceId: string }\n try {\n workspace = await hooks.createWorkspace({ path })\n } catch (reason) {\n if (token === this.epoch) hooks.onFailed(messageOf(reason))\n return\n }\n if (token !== this.epoch) return\n hooks.onPicked(workspace.workspaceId)\n }\n}\n\n/** Error text for a rejection of any shape. */\nfunction messageOf(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason)\n}\n","/**\n * GroupedSidebar: the `sidebar.workspaces` seat occupant. P1 aggregation\n * (same-repository workspaces clustered from /group facts) plus a 1:1\n * transplant of the native workspace browser's search, menus, status dots,\n * relative time, view options, rail, and dialogs.\n *\n * Drag-reorder and the native `dsh.workspace.view.v5` store are P3. Adding a\n * workspace uses `workspaces.pickDirectory` rather than re-declaring the\n * `sidebar.workspaces.directoryFlow` child hole (native already declared it;\n * a second declarer throws).\n *\n * @module git-worktree/client/GroupedSidebar\n */\n\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'\nimport type { SessionListState, SnapshotStore, WorkspaceListState } from '@deepseek-ai/dsh-client-runtime/client'\nimport {\n Button, IconCloseFill14, IconPersonalizationOutline16, IconProjectAddOutline16,\n IconSearchOutline16, Menu, Modal, Toast, Tooltip,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { OwnerOf, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { WorkspaceGitFacts } from '../wire.ts'\nimport {\n deriveFlat, deriveSidebarGroups, deriveStrayGroups, indexSubagentRunning, loadExpandState, loadViewPrefs,\n orderedVisibleSessionIds, saveExpandState, saveViewPrefs, sessionNode,\n type SessionListLike, type SessionNode, type SidebarGroup, type SidebarGroupBy,\n type SidebarMember, type SidebarOrderBy, type StrayGroup, type WorkspaceLike,\n} from './sidebar-groups.ts'\nimport {\n COLLAPSED_SESSION_LIMIT, EXPAND_SLIDE_MS, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MAX_CODE_UNITS,\n deriveSearchResults, sanitizeSearchQuery, type ContentSearchHit,\n} from './sidebar-search.ts'\nimport { ProjectRowItem, SearchResultItem, SessionNodeItem, StrayGroupRow } from './sidebar-rows.tsx'\nimport { PickFlowController } from './pick-flow.ts'\nimport css from './GroupedSidebar.module.css'\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter((part): part is string => typeof part === 'string' && part !== '').join(' ')\n}\n\n/** Observable snapshot (getSnapshot + subscribe) used for host description / flow occupancy. */\nexport interface SidebarObservable<T> {\n readonly getSnapshot: () => T\n readonly subscribe: (listener: () => void) => () => void\n}\n\n/** The business face this entry injects; the component never touches ctx. */\nexport interface GroupedSidebarInjected {\n readonly workspacesList: Pick<SnapshotStore<WorkspaceListState>, 'getSnapshot' | 'subscribe'>\n readonly sessionsList: Pick<SnapshotStore<SessionListState>, 'getSnapshot' | 'subscribe'>\n readonly openSession: (sessionId: string) => void\n readonly startSession: (workspaceId?: string) => void\n readonly loadFacts: (paths: readonly string[]) =>\n Promise<Readonly<Record<string, WorkspaceGitFacts | null>> | undefined>\n readonly searchSessions: (query: string, signal: AbortSignal) => Promise<{\n items: readonly ContentSearchHit[]\n hasMore: boolean\n }>\n readonly searchResultLimit: number\n readonly renameSession: (sessionId: string, title: string) => Promise<void>\n readonly forkSession: (sessionId: string) => void\n readonly renameWorkspace: (workspaceId: string, title: string) => Promise<void>\n readonly deleteWorkspace: (workspaceId: string) => Promise<void>\n readonly archiveSession: (sessionId: string) => Promise<void>\n /** Pre-delete facts of one linked worktree folder (dirty + ahead counts). */\n readonly inspectWorktree: (path: string) => Promise<{ dirty: number; ahead: number | undefined }>\n /** Remove one linked worktree (git registration + folder); rejects with the host error text. */\n readonly removeWorktree: (path: string, force: boolean) => Promise<void>\n /** Batch directory-existence probe; `rebuildable` marks missing paths the\n * host confirmed as worktree storage slots. undefined = the probe itself\n * failed (every action withheld — the client must not guess). */\n readonly probeDirectories: (paths: readonly string[]) => Promise<{\n exists: Readonly<Record<string, boolean>>\n rebuildable?: Readonly<Record<string, boolean>>\n } | undefined>\n /** Rebuild a missing worktree storage slot (`mkdir -p`, host-gated to the\n * storage root); rejects with the host error text. */\n readonly ensureDirectory: (path: string) => Promise<void>\n readonly createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n readonly pickDirectory: () => Promise<string | null>\n readonly hostDescription: SidebarObservable<{ home?: string } | undefined>\n readonly directoryFlow: SidebarObservable<boolean>\n /**\n * First facts attempt of this mount has settled (ok or fail). The settings\n * card spinner waits on this so it does not hide while the tree still\n * looks like the native flat list.\n */\n readonly onReady?: () => void\n}\n\nexport type GroupedSidebarProps =\n PropsRuntime<'sidebar.workspaces'>\n & OwnerOf<'sidebar.workspaces'>\n & PropsLocale<'git-worktree'>\n & GroupedSidebarInjected\n\ntype FactsState = { signature: string; facts: Readonly<Record<string, WorkspaceGitFacts | null>> } | null\ntype Translate = PropsLocale<'git-worktree'>['t']\n\nfunction ViewOptionsMenu({ groupBy, orderBy, onGroupPick, onOrderPick, t }: {\n groupBy: SidebarGroupBy\n orderBy: SidebarOrderBy\n onGroupPick: (mode: SidebarGroupBy) => void\n onOrderPick: (mode: SidebarOrderBy) => void\n t: Translate\n}): ReactNode {\n const [open, setOpen] = useState(false)\n return (\n <Menu\n open={open}\n onClose={() => { setOpen(false) }}\n items={[\n { type: 'label', id: 'group-by', text: t('groupBy.label') },\n { id: 'workspace', label: t('groupBy.workspace') },\n { id: 'flat', label: t('groupBy.flat') },\n { type: 'separator', id: 'order-by-separator' },\n { type: 'label', id: 'order-by', text: t('orderBy.label') },\n { id: 'manual', label: t('orderBy.manual') },\n { id: 'updated', label: t('orderBy.updated') },\n ]}\n selectedIds={[groupBy, orderBy]}\n onSelect={(id) => {\n if (id === 'workspace' || id === 'flat') onGroupPick(id)\n else if (id === 'manual' || id === 'updated') onOrderPick(id)\n setOpen(false)\n }}\n align=\"end\"\n dense\n portal\n anchor={(\n <Tooltip label={t('viewOptions.label')} side=\"bottom\" delayMs={500}>\n <button\n type=\"button\"\n className={cx(css.iconButton, css.wide)}\n aria-label={t('viewOptions.label')}\n onClick={() => { setOpen(v => !v) }}\n >\n <IconPersonalizationOutline16 />\n </button>\n </Tooltip>\n )}\n />\n )\n}\n\n/** Add-workspace flow: OS directory picker (cannot redeclare native's directoryFlow hole). */\nfunction WorkspacePickFlow({ open, onClose, onRetry, pickDirectory, createWorkspace, onPick, t }: {\n open: boolean\n onClose: () => void\n onRetry: () => void\n pickDirectory: () => Promise<string | null>\n createWorkspace: (input: { path: string }) => Promise<{ workspaceId: string }>\n onPick: (workspaceId: string) => void\n t: Translate\n}): ReactNode {\n const [errorOpen, setErrorOpen] = useState(false)\n const [modalError, setModalError] = useState<string | null>(null)\n // The controller is the flow's edge-triggered core: re-renders refresh the\n // hooks below but can never re-launch the chooser (only a closed→open edge\n // starts a run, and a falling edge/kill discards whatever is in flight).\n const controllerRef = useRef<PickFlowController | null>(null)\n const controller = controllerRef.current ?? (controllerRef.current = new PickFlowController())\n controller.attach({\n pickDirectory,\n createWorkspace,\n onPicked: onPick,\n onCancelled: onClose,\n onFailed: (message) => {\n setModalError(message)\n setErrorOpen(true)\n onClose()\n },\n })\n useEffect(() => { controller.sync(open) }, [open, controller])\n useEffect(() => () => { controller.kill() }, [controller])\n const closeModal = (): void => {\n setErrorOpen(false)\n setModalError(null)\n }\n return (\n <Modal\n open={errorOpen}\n onClose={closeModal}\n closeLabel={t('close')}\n title={t('folderError.title')}\n footer={(\n <>\n <Button variant=\"outline\" className={css.modalAction} onClick={closeModal}>{t('cancel')}</Button>\n <Button\n variant=\"primary\"\n className={css.modalAction}\n onClick={() => {\n closeModal()\n onRetry()\n }}\n >\n {t('folderError.retry')}\n </Button>\n </>\n )}\n >\n <div className={css.modalError} role=\"alert\">{modalError}</div>\n </Modal>\n )\n}\n\nfunction SearchResults({ list, workspaces, archivedSessionIds, query, remote, resultLimit, currentId, onOpen, t }: {\n list: SessionListLike\n workspaces: readonly WorkspaceLike[]\n archivedSessionIds: readonly string[]\n query: string\n remote: { query: string; status: 'idle' | 'loading' | 'ready' | 'error'; items: readonly ContentSearchHit[]; hasMore: boolean }\n resultLimit: number\n currentId: string | undefined\n onOpen: (id: string) => void\n t: Translate\n}): ReactNode {\n const currentRemote = remote.query === query ? remote : { query, status: 'loading' as const, items: [] as const, hasMore: false }\n const results = useMemo(\n () => deriveSearchResults(list, workspaces, query, archivedSessionIds, currentRemote, resultLimit),\n [list, workspaces, query, archivedSessionIds, currentRemote, resultLimit],\n )\n const pending = currentRemote.status === 'loading'\n const failed = currentRemote.status === 'error'\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={css.list}>\n <div className={css.searchTree} role=\"tree\" aria-label={t('search.results.aria')}>\n {results.items.map(result => (\n <SearchResultItem key={result.id} result={result} currentId={currentId} onOpen={onOpen} t={t} />\n ))}\n </div>\n {pending && <div className={css.searchStatus} role=\"status\">{t('search.pending')}</div>}\n {failed && <div className={css.searchWarning} role=\"status\">{t('search.unavailable')}</div>}\n {!pending && results.items.length === 0 && <div className={css.empty}>{t('search.noMatches')}</div>}\n {results.hasMore && <div className={css.searchStatus}>{t('search.hasMore', { n: resultLimit })}</div>}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction FlatListBody({ list, archivedSessionIds, orderBy, currentId, now, onOpen, onRename, onFork, onArchive, t }: {\n list: SessionListLike\n archivedSessionIds: readonly string[]\n orderBy: SidebarOrderBy\n currentId: string | undefined\n now: number\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n t: Translate\n}): ReactNode {\n const rows = useMemo(() => deriveFlat(list, archivedSessionIds, orderBy), [list, archivedSessionIds, orderBy])\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={cx(css.list, css.flatList)} role=\"tree\" aria-label={t('section.sessions')}>\n {rows.length === 0 && <div className={css.empty}>{t('empty.none')}</div>}\n {rows.map(node => (\n <SessionNodeItem\n key={node.id}\n node={node}\n currentId={currentId}\n now={now}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n flat\n t={t}\n />\n ))}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction memberLabel(member: SidebarMember, t: Translate): string {\n if (member.label.type === 'main') {\n return member.label.branch === null ? t('sidebarMain') : t('sidebarMainBranch', { branch: member.label.branch })\n }\n if (member.label.type === 'linked') {\n return member.label.branch ?? member.workspace.title\n }\n return member.workspace.title\n}\n\nfunction createdAtMs(createdAt: string | undefined): number | undefined {\n if (createdAt === undefined || createdAt === '') return undefined\n const parsed = Date.parse(createdAt)\n return Number.isNaN(parsed) ? undefined : parsed\n}\n\nfunction GroupedTree({ groups, footer, sessions, archived, currentSessionId, expandMap, onToggle, expandTo, orderBy, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, onWorktreeRemove, startSession, t }: {\n groups: readonly SidebarGroup[]\n /** Tail section rendered inside the same scroll container (the stray cluster). */\n footer?: ReactNode\n sessions: SessionListLike\n archived: readonly string[]\n currentSessionId: string | undefined\n expandMap: Record<string, boolean>\n onToggle: (key: string) => void\n expandTo: (key: string) => void\n orderBy: SidebarOrderBy\n now: number\n home: string | undefined\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n onWorkspaceRename: (workspaceId: string, title: string) => void\n onWorkspaceDelete: (workspaceId: string, title: string) => void\n onWorktreeRemove: (member: SidebarMember) => void\n startSession: (workspaceId?: string) => void\n t: Translate\n}): ReactNode {\n const descendants = useMemo(() => indexSubagentRunning(sessions.byId), [sessions.byId])\n const [expandedSessionGroups, setExpandedSessionGroups] = useState<string[]>([])\n const empty = groups.length === 0\n return (\n <div className={cx(css.treeBody, css.wide)}>\n <div className={css.list} role=\"tree\" aria-label={t('section.workspaces')}>\n {empty && <div className={css.empty}>{t('empty.none')}</div>}\n {groups.map((group) => {\n if (group.kind === 'repo') {\n const memberIds = group.members.map(member => orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy))\n const visibleCount = memberIds.reduce((sum, ids) => sum + ids.length, 0)\n const containsCurrent = group.members.some(member => member.workspace.sessionIds.includes(currentSessionId ?? '\\0'))\n const open = expandMap[group.key] ?? containsCurrent\n return (\n <div key={group.key} className={css.groupSection}>\n <ProjectRowItem\n row={{ key: group.key, label: group.repoName ?? group.key, expanded: open, containsCurrent }}\n onToggle={() => { onToggle(group.key) }}\n home={home}\n t={t}\n badge={String(visibleCount)}\n />\n {open && group.members.map((member, index) => (\n <MemberBlock\n key={member.workspace.workspaceId}\n member={member}\n indent\n sessionIds={memberIds[index] ?? []}\n sessions={sessions}\n currentSessionId={currentSessionId}\n expandMap={expandMap}\n onToggle={onToggle}\n expandTo={expandTo}\n descendants={descendants}\n expandedSessionGroups={expandedSessionGroups}\n setExpandedSessionGroups={setExpandedSessionGroups}\n now={now}\n home={home}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n onWorkspaceRename={onWorkspaceRename}\n onWorkspaceDelete={onWorkspaceDelete}\n onWorktreeRemove={onWorktreeRemove}\n startSession={startSession}\n t={t}\n />\n ))}\n </div>\n )\n }\n const member = group.members[0]\n if (member === undefined) return null\n return (\n <div key={group.key} className={css.groupSection}>\n <MemberBlock\n member={member}\n indent={false}\n sessionIds={orderedVisibleSessionIds(member.workspace, sessions, archived, orderBy)}\n sessions={sessions}\n currentSessionId={currentSessionId}\n expandMap={expandMap}\n onToggle={onToggle}\n expandTo={expandTo}\n descendants={descendants}\n expandedSessionGroups={expandedSessionGroups}\n setExpandedSessionGroups={setExpandedSessionGroups}\n now={now}\n home={home}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n onWorkspaceRename={onWorkspaceRename}\n onWorkspaceDelete={onWorkspaceDelete}\n onWorktreeRemove={onWorktreeRemove}\n startSession={startSession}\n t={t}\n />\n </div>\n )\n })}\n {footer}\n </div>\n <span className={css.fade} />\n </div>\n )\n}\n\nfunction MemberBlock({ member, indent, sessionIds, sessions, currentSessionId, expandMap, onToggle, expandTo, descendants, expandedSessionGroups, setExpandedSessionGroups, now, home, onOpen, onRename, onFork, onArchive, onWorkspaceRename, onWorkspaceDelete, onWorktreeRemove, startSession, t }: {\n member: SidebarMember\n indent: boolean\n sessionIds: readonly string[]\n sessions: SessionListLike\n currentSessionId: string | undefined\n expandMap: Record<string, boolean>\n onToggle: (key: string) => void\n expandTo: (key: string) => void\n descendants: ReturnType<typeof indexSubagentRunning>\n expandedSessionGroups: readonly string[]\n setExpandedSessionGroups: (update: (keys: string[]) => string[]) => void\n now: number\n home: string | undefined\n onOpen: (id: string) => void\n onRename: (id: string, title: string) => void\n onFork: (id: string) => void\n onArchive: (id: string) => void\n onWorkspaceRename: (workspaceId: string, title: string) => void\n onWorkspaceDelete: (workspaceId: string, title: string) => void\n onWorktreeRemove: (member: SidebarMember) => void\n startSession: (workspaceId?: string) => void\n t: Translate\n}): ReactNode {\n const key = `ws:${member.workspace.workspaceId}`\n const containsCurrent = member.workspace.sessionIds.includes(currentSessionId ?? '\\0')\n const open = expandMap[key] ?? containsCurrent\n const label = memberLabel(member, t)\n const overflowOpen = expandedSessionGroups.includes(key)\n const visibleIds = overflowOpen ? sessionIds : sessionIds.slice(0, COLLAPSED_SESSION_LIMIT)\n const nodes: SessionNode[] = []\n for (const sessionId of visibleIds) {\n const summary = sessions.byId[sessionId]\n if (summary !== undefined) nodes.push(sessionNode(summary, descendants))\n }\n const created = createdAtMs(member.workspace.createdAt)\n // Removal is offered only on linked worktrees the sidebar holds FREE: a\n // running session's cwd is about to vanish (its failure would surface\n // mid-task), and the currently-browsed session's directory disappearing\n // under it is the same hole. Occupied rows simply don't show the action —\n // archive or switch away first, then remove.\n const hasRunning = member.workspace.sessionIds.some(id => sessions.byId[id]?.running === true)\n const occupied = containsCurrent || hasRunning\n const canRemoveWorktree = member.label.type === 'linked' && !occupied\n const body = (\n <>\n <ProjectRowItem\n row={{\n key,\n label,\n expanded: open,\n containsCurrent,\n cwd: member.workspace.path,\n ...created === undefined ? {} : { createdAt: created },\n }}\n onToggle={() => { onToggle(key) }}\n onCreate={() => {\n expandTo(key)\n startSession(member.workspace.workspaceId)\n }}\n actions={{\n rename: () => { onWorkspaceRename(member.workspace.workspaceId, member.workspace.title) },\n delete: () => { onWorkspaceDelete(member.workspace.workspaceId, member.workspace.title) },\n ...canRemoveWorktree ? { removeWorktree: () => { onWorktreeRemove(member) } } : {},\n }}\n home={home}\n t={t}\n />\n {open && (\n <div className={indent ? css.sessionsIndent : undefined}>\n {nodes.map(node => (\n <SessionNodeItem\n key={node.id}\n node={node}\n currentId={currentSessionId}\n now={now}\n onOpen={onOpen}\n onRename={onRename}\n onFork={onFork}\n onArchive={onArchive}\n t={t}\n />\n ))}\n {sessionIds.length > COLLAPSED_SESSION_LIMIT && (\n <button\n type=\"button\"\n className={css.sessionOverflowButton}\n aria-expanded={overflowOpen}\n onClick={() => {\n setExpandedSessionGroups(keys => keys.includes(key) ? keys.filter(k => k !== key) : [...keys, key])\n }}\n >\n {overflowOpen ? t('sessions.collapse') : t('sessions.expand', { n: sessionIds.length - COLLAPSED_SESSION_LIMIT })}\n </button>\n )}\n </div>\n )}\n </>\n )\n return indent ? <div className={css.memberIndent}>{body}</div> : body\n}\n\nexport function GroupedSidebar(props: GroupedSidebarProps): ReactNode {\n const { t } = props\n const workspaces = useSyncExternalStore(props.workspacesList.subscribe, props.workspacesList.getSnapshot)\n const sessions = useSyncExternalStore(props.sessionsList.subscribe, props.sessionsList.getSnapshot)\n const host = useSyncExternalStore(props.hostDescription.subscribe, props.hostDescription.getSnapshot)\n const directoryFlowAvailable = useSyncExternalStore(props.directoryFlow.subscribe, props.directoryFlow.getSnapshot)\n const items = workspaces.items as readonly WorkspaceLike[]\n const home = host?.home\n\n const signature = useMemo(() => [...items].map(item => item.path).sort().join('\\n'), [items])\n const [factsState, setFactsState] = useState<FactsState>(null)\n const readyOnce = useRef(false)\n const signalReady = (): void => {\n if (readyOnce.current) return\n readyOnce.current = true\n props.onReady?.()\n }\n useEffect(() => {\n if (factsState?.signature === signature) {\n signalReady()\n return\n }\n let live = true\n void props.loadFacts(items.map(item => item.path)).then(\n (facts) => {\n if (!live) return\n if (facts !== undefined) setFactsState({ signature, facts })\n signalReady()\n },\n () => { if (live) signalReady() },\n )\n return () => { live = false }\n }, [signature, factsState?.signature, props.loadFacts, items])\n\n const facts = factsState?.signature === signature ? factsState.facts : undefined\n const groups = useMemo(() => deriveSidebarGroups(items, facts), [items, facts])\n const sessionList = sessions as unknown as SessionListLike\n const archived = workspaces.archivedSessionIds\n\n const [expandMap, setExpandMap] = useState<Record<string, boolean>>(() => loadExpandState())\n const toggle = (key: string): void => {\n const next = { ...expandMap, [key]: !(expandMap[key] ?? false) }\n setExpandMap(next)\n saveExpandState(next)\n }\n const expandTo = (key: string): void => {\n if (expandMap[key] === true) return\n const next = { ...expandMap, [key]: true }\n setExpandMap(next)\n saveExpandState(next)\n }\n\n const [viewPrefs, setViewPrefs] = useState(() => loadViewPrefs())\n const setGroupBy = (groupBy: SidebarGroupBy): void => {\n const next = { ...viewPrefs, groupBy }\n setViewPrefs(next)\n saveViewPrefs(next)\n }\n const setOrderBy = (orderBy: SidebarOrderBy): void => {\n const next = { ...viewPrefs, orderBy }\n setViewPrefs(next)\n saveViewPrefs(next)\n }\n\n const [query, setQuery] = useState('')\n const [searchExpanded, setSearchExpanded] = useState(false)\n const normalizedQuery = sanitizeSearchQuery(query).trim()\n const [remoteSearch, setRemoteSearch] = useState<{\n query: string\n status: 'idle' | 'loading' | 'ready' | 'error'\n items: readonly ContentSearchHit[]\n hasMore: boolean\n }>({ query: '', status: 'idle', items: [], hasMore: false })\n const searchRoot = useRef<HTMLDivElement>(null)\n const searchInput = useRef<HTMLInputElement>(null)\n const [wsPickerOpen, setWsPickerOpen] = useState(false)\n const composingRef = useRef(false)\n const [searchOnExpand, setSearchOnExpand] = useState(false)\n\n useEffect(() => {\n if (props.wide && searchOnExpand) {\n const timer = window.setTimeout(() => {\n searchInput.current?.focus({ preventScroll: true })\n setSearchOnExpand(false)\n }, EXPAND_SLIDE_MS)\n return () => { window.clearTimeout(timer) }\n }\n return undefined\n }, [props.wide, searchOnExpand])\n\n useEffect(() => {\n if (!props.wide || !searchExpanded || searchOnExpand) return\n searchInput.current?.focus({ preventScroll: true })\n }, [props.wide, searchExpanded, searchOnExpand])\n\n useEffect(() => {\n if (!props.wide || !searchExpanded || searchOnExpand) return\n const onClick = (event: MouseEvent): void => {\n if (!(event.target instanceof Node) || searchRoot.current?.contains(event.target) === true) return\n searchInput.current?.blur()\n if (normalizedQuery !== '') return\n setSearchExpanded(false)\n }\n document.addEventListener('click', onClick)\n return () => { document.removeEventListener('click', onClick) }\n }, [normalizedQuery, props.wide, searchExpanded, searchOnExpand])\n\n useEffect(() => {\n if (normalizedQuery === '') {\n setRemoteSearch({ query: '', status: 'idle', items: [], hasMore: false })\n return\n }\n const controller = new AbortController()\n setRemoteSearch({ query: normalizedQuery, status: 'loading', items: [], hasMore: false })\n const timer = window.setTimeout(() => {\n props.searchSessions(normalizedQuery, controller.signal).then((result) => {\n if (controller.signal.aborted) return\n setRemoteSearch({ query: normalizedQuery, status: 'ready', items: result.items, hasMore: result.hasMore })\n }).catch(() => {\n if (controller.signal.aborted) return\n setRemoteSearch({ query: normalizedQuery, status: 'error', items: [], hasMore: false })\n })\n }, SEARCH_DEBOUNCE_MS)\n return () => {\n window.clearTimeout(timer)\n controller.abort()\n }\n }, [normalizedQuery, props.searchSessions])\n\n const [renameTarget, setRenameTarget] = useState<{ workspaceId: string; currentTitle: string } | null>(null)\n const [renameDraft, setRenameDraft] = useState('')\n const [renaming, setRenaming] = useState(false)\n const [renameError, setRenameError] = useState<string | null>(null)\n const renameTrimmed = renameDraft.trim()\n const renameDuplicate = renameTarget !== null && renameTrimmed !== '' && renameTrimmed !== renameTarget.currentTitle && items.some(w => w.title === renameTrimmed)\n const renameBlocked = renaming || renameTrimmed === '' || renameTarget === null || renameTrimmed === renameTarget.currentTitle || renameDuplicate\n const closeRename = (): void => {\n if (renaming) return\n setRenameTarget(null)\n setRenameError(null)\n }\n const confirmRename = (): void => {\n if (renameBlocked || renameTarget === null) return\n setRenaming(true)\n setRenameError(null)\n props.renameWorkspace(renameTarget.workspaceId, renameTrimmed).then(() => {\n setRenaming(false)\n setRenameTarget(null)\n }).catch((reason: unknown) => {\n setRenaming(false)\n setRenameError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n\n const [sessionRenameTarget, setSessionRenameTarget] = useState<{ sessionId: string; currentTitle: string } | null>(null)\n const [sessionRenameDraft, setSessionRenameDraft] = useState('')\n const [sessionRenaming, setSessionRenaming] = useState(false)\n const [sessionRenameError, setSessionRenameError] = useState<string | null>(null)\n const sessionRenameTrimmed = sessionRenameDraft.trim()\n const sessionRenameBlocked = sessionRenaming || sessionRenameTrimmed === '' || sessionRenameTarget === null\n const closeSessionRename = (): void => {\n if (sessionRenaming) return\n setSessionRenameTarget(null)\n setSessionRenameError(null)\n }\n const confirmSessionRename = (): void => {\n if (sessionRenameBlocked || sessionRenameTarget === null) return\n setSessionRenaming(true)\n setSessionRenameError(null)\n props.renameSession(sessionRenameTarget.sessionId, sessionRenameTrimmed).then(() => {\n setSessionRenaming(false)\n setSessionRenameTarget(null)\n }).catch((reason: unknown) => {\n setSessionRenaming(false)\n setSessionRenameError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n const onSessionRename = (sessionId: string, currentTitle: string): void => {\n setSessionRenameTarget({ sessionId, currentTitle })\n setSessionRenameDraft(currentTitle)\n setSessionRenameError(null)\n }\n const onSessionArchive = (sessionId: string): void => {\n props.archiveSession(sessionId).catch((reason: unknown) => {\n console.warn('session archive rejected:', reason)\n })\n }\n\n const [deleteTarget, setDeleteTarget] = useState<{ workspaceId: string; title: string } | null>(null)\n const [deleting, setDeleting] = useState(false)\n const [deleteCommittedId, setDeleteCommittedId] = useState<string | null>(null)\n const [deleteError, setDeleteError] = useState<string | null>(null)\n useEffect(() => {\n if (deleteCommittedId === null || items.some(workspace => workspace.workspaceId === deleteCommittedId)) return\n setDeleting(false)\n setDeleteCommittedId(null)\n setDeleteTarget(null)\n }, [deleteCommittedId, items])\n const closeDelete = (): void => {\n if (deleting) return\n setDeleteTarget(null)\n setDeleteError(null)\n }\n const confirmDelete = (): void => {\n if (deleting || deleteTarget === null) return\n setDeleting(true)\n setDeleteCommittedId(null)\n setDeleteError(null)\n props.deleteWorkspace(deleteTarget.workspaceId).then(() => {\n setDeleteCommittedId(deleteTarget.workspaceId)\n }).catch((reason: unknown) => {\n setDeleting(false)\n setDeleteError(reason instanceof Error ? reason.message : String(reason))\n })\n }\n\n // Worktree removal state. `archivedSet` decides which of the workspace's\n // sessions the flow will archive (everything visible: not archived, not\n // blank, not a subagent row); blank rows hold nothing worth archiving and\n // an Ungrouped blank stays hidden anyway, while subagent rows are never\n // the user's to manage here.\n const [wtRemoveTarget, setWtRemoveTarget] = useState<SidebarMember | null>(null)\n const [wtInspect, setWtInspect] = useState<\n | { status: 'loading' }\n | { status: 'ready'; dirty: number; ahead: number | undefined }\n | { status: 'error'; error: string }\n >({ status: 'loading' })\n const [wtRemoving, setWtRemoving] = useState(false)\n const [wtRemoveError, setWtRemoveError] = useState<string | null>(null)\n useEffect(() => {\n if (wtRemoveTarget === null) return\n setWtInspect({ status: 'loading' })\n let live = true\n void props.inspectWorktree(wtRemoveTarget.workspace.path).then(\n (facts) => { if (live) setWtInspect({ status: 'ready', dirty: facts.dirty, ahead: facts.ahead }) },\n (reason: unknown) => { if (live) setWtInspect({ status: 'error', error: reason instanceof Error ? reason.message : String(reason) }) },\n )\n return () => { live = false }\n }, [wtRemoveTarget])\n const archivedSet = useMemo(() => new Set<string>(archived), [archived])\n const wtArchiveIds = wtRemoveTarget === null ? [] : wtRemoveTarget.workspace.sessionIds.filter((id) => {\n const summary = sessionList.byId[id]\n return summary !== undefined && !archivedSet.has(id) && !summary.blank && summary.origin !== 'subagent'\n })\n const closeWtRemove = (): void => {\n if (wtRemoving) return\n setWtRemoveTarget(null)\n setWtRemoveError(null)\n }\n const confirmWtRemove = (): void => {\n if (wtRemoving || wtRemoveTarget === null || wtInspect.status !== 'ready') return\n const target = wtRemoveTarget\n setWtRemoving(true)\n setWtRemoveError(null)\n // Git first: a refused removal (locked files on Windows, a git error)\n // leaves the workspace world untouched and the dialog retries cleanly.\n // Only after the folder is really gone does the DSH side follow —\n // archive the workspace's sessions (they'd otherwise surface under\n // Ungrouped), then drop the registration itself.\n void (async () => {\n try {\n await props.removeWorktree(target.workspace.path, wtInspect.dirty > 0)\n for (const sessionId of wtArchiveIds) {\n await props.archiveSession(sessionId).catch((reason: unknown) => {\n console.warn('session archive rejected during worktree removal:', reason)\n })\n }\n await props.deleteWorkspace(target.workspace.workspaceId)\n setWtRemoving(false)\n setWtRemoveTarget(null)\n } catch (reason: unknown) {\n setWtRemoving(false)\n setWtRemoveError(reason instanceof Error ? reason.message : String(reason))\n }\n })()\n }\n\n // Stray (Ungrouped) section: sessions no workspace account holds, clustered\n // by their header cwd into virtual directory groups. Registration is the\n // one action available without any host-side help — workspaces.create is a\n // plain client call; afterwards NEW sessions land in the workspace, while\n // the old strays stay loose (now marked as that workspace's strays) until\n // re-adoption exists.\n // `now` must be declared BEFORE straySection: that JSX evaluates eagerly at\n // render (the .map callbacks run inline), so a forward reference to a later\n // const throws a TDZ ReferenceError and takes the whole sidebar down.\n const now = Date.now()\n const strayGroups = useMemo(() => deriveStrayGroups(items, sessionList, archived), [items, sessionList, archived])\n const strayDescendants = useMemo(() => indexSubagentRunning(sessionList.byId), [sessionList.byId])\n // Directory pre-flight for register-as-workspace: the browser cannot stat,\n // so the host's /exists route answers per unregistered cluster path. Only a\n // probed-true directory offers the action — a missing folder (deleted,\n // moved, or a corrupted session-header cwd) never reaches the DSH workspace\n // API; the row explains itself in hover instead.\n const strayProbePaths = useMemo(\n () => [...new Set(strayGroups.filter(group => group.belongsTo === undefined && group.path !== '').map(group => group.path))],\n [strayGroups],\n )\n const strayProbeSignature = strayProbePaths.join('\\n')\n const [strayDirExists, setStrayDirExists] = useState<Readonly<Record<string, boolean>> | undefined>(undefined)\n const [straySlotRebuildable, setStraySlotRebuildable] = useState<Readonly<Record<string, boolean>> | undefined>(undefined)\n useEffect(() => {\n if (strayProbePaths.length === 0) return\n let live = true\n void props.probeDirectories(strayProbePaths).then(\n (result) => {\n if (!live) return\n // A failed probe (undefined) withholds every action: without the\n // host's fs answer the client must not guess.\n setStrayDirExists(result?.exists)\n setStraySlotRebuildable(result?.rebuildable)\n },\n () => { if (live) { setStrayDirExists(undefined); setStraySlotRebuildable(undefined) } },\n )\n return () => { live = false }\n }, [strayProbeSignature])\n const straySectionKey = 'stray:section'\n const strayContainsCurrent = strayGroups.some(group => group.sessions.some(session => session.id === sessions.current))\n const straySectionOpen = expandMap[straySectionKey] ?? strayContainsCurrent\n const strayTotal = strayGroups.reduce((sum, group) => sum + group.sessions.length, 0)\n const [strayRegPath, setStrayRegPath] = useState<string | null>(null)\n const [toast, setToast] = useState<{ seq: number; text: string } | null>(null)\n const registerStrayWorkspace = (path: string): void => {\n if (strayRegPath !== null) return\n setStrayRegPath(path)\n props.createWorkspace({ path }).then(\n () => { setStrayRegPath(null) },\n (reason: unknown) => {\n setStrayRegPath(null)\n setToast({ seq: Date.now(), text: t('stray.registerFailed', { message: reason instanceof Error ? reason.message : String(reason) }) })\n },\n )\n }\n const [strayRebuildPath, setStrayRebuildPath] = useState<string | null>(null)\n const rebuildStrayDirectory = (path: string): void => {\n if (strayRebuildPath !== null) return\n setStrayRebuildPath(path)\n // mkdir -p on a missing slot is pure self-healing: the workspace keeps its\n // accounting, and DSH's membership projection reattaches the sessions by\n // realpath as soon as the folder answers again.\n void props.ensureDirectory(path).then(\n () => {\n setStrayRebuildPath(null)\n setToast({ seq: Date.now(), text: t('stray.rebuildDone') })\n void props.probeDirectories([path]).then((result) => {\n if (result === undefined) return\n setStrayDirExists(current => ({ ...current, ...result.exists }))\n setStraySlotRebuildable(current => ({ ...current, ...result.rebuildable }))\n })\n },\n (reason: unknown) => {\n setStrayRebuildPath(null)\n setToast({ seq: Date.now(), text: t('stray.rebuildFailed', { message: reason instanceof Error ? reason.message : String(reason) }) })\n },\n )\n }\n const straySection: ReactNode = strayGroups.length === 0 ? undefined : (\n <div className={css.groupSection}>\n <ProjectRowItem\n row={{ key: straySectionKey, label: t('group.ungrouped'), expanded: straySectionOpen, containsCurrent: strayContainsCurrent }}\n onToggle={() => { toggle(straySectionKey) }}\n home={home}\n t={t}\n badge={String(strayTotal)}\n />\n {straySectionOpen && strayGroups.map((group) => {\n const groupOpen = expandMap[group.key] ?? group.sessions.some(session => session.id === sessions.current)\n // Registerable only after the host probed the directory real: absent\n // probe data or an explicit false withholds the action entirely (the\n // DSH create API must never receive an unregistrable path). A missing\n // path that IS a storage slot offers the rebuild instead — pure\n // mkdir self-healing; everything else stays action-free.\n const registrable = group.belongsTo === undefined && group.path !== '' && strayDirExists?.[group.path] === true\n const missingDir = group.belongsTo === undefined && group.path !== '' && strayDirExists?.[group.path] === false\n const rebuildable = missingDir && straySlotRebuildable?.[group.path] === true\n return (\n <div key={group.key} className={cx(css.groupSection, css.memberIndent)}>\n <StrayGroupRow\n path={group.path}\n belongsTo={group.belongsTo}\n count={group.sessions.length}\n expanded={groupOpen}\n onToggle={() => { toggle(group.key) }}\n missingDir={missingDir}\n worktreeSlot={rebuildable}\n {...registrable\n ? { onRegister: () => { registerStrayWorkspace(group.path) }, registering: strayRegPath === group.path }\n : rebuildable\n ? { onRebuild: () => { rebuildStrayDirectory(group.path) }, rebuilding: strayRebuildPath === group.path }\n : {}}\n home={home}\n t={t}\n />\n {groupOpen && (\n <div className={css.sessionsIndent}>\n {group.sessions.map(session => (\n <SessionNodeItem\n key={session.id}\n node={sessionNode(session, strayDescendants)}\n currentId={sessions.current}\n now={now}\n onOpen={props.openSession}\n onRename={onSessionRename}\n onFork={props.forkSession}\n onArchive={onSessionArchive}\n t={t}\n />\n ))}\n </div>\n )}\n </div>\n )\n })}\n </div>\n )\n\n const wide = props.wide\n\n return (\n <div className={cx(css.root, !wide && css.rail)}>\n <div className={css.sectionHeader}>\n {wide && (\n <span className={cx(css.sectionLabel, css.wide, searchExpanded && css.sectionLabelHidden)}>\n {viewPrefs.groupBy === 'flat' ? t('section.sessions') : t('section.workspaces')}\n </span>\n )}\n {wide && (\n <div className={cx(css.searchSlot, searchExpanded && css.searchSlotExpanded)}>\n <div\n ref={searchRoot}\n className={cx(css.search, searchExpanded && css.searchExpanded)}\n onClick={() => {\n setWsPickerOpen(false)\n setSearchExpanded(true)\n searchInput.current?.focus()\n }}\n >\n <Tooltip label={t('search')} side=\"bottom\" delayMs={500} disabled={searchExpanded}>\n <button\n type=\"button\"\n className={css.searchButton}\n aria-label={t('search.sessions.aria')}\n aria-expanded={searchExpanded}\n onClick={() => {\n setWsPickerOpen(false)\n setSearchExpanded(true)\n }}\n >\n <IconSearchOutline16 size={searchExpanded ? 11 : 14} />\n </button>\n </Tooltip>\n <input\n ref={searchInput}\n className={css.searchInput}\n type=\"text\"\n placeholder={t('search.placeholder')}\n maxLength={SEARCH_QUERY_MAX_CODE_UNITS}\n value={query}\n tabIndex={searchExpanded ? 0 : -1}\n onChange={(e) => { setQuery(sanitizeSearchQuery(e.target.value)) }}\n onKeyDown={(e) => {\n if (e.key !== 'Escape') return\n setQuery('')\n setSearchExpanded(false)\n }}\n />\n {searchExpanded && (\n <button\n type=\"button\"\n className={css.clearButton}\n aria-label={t('search.clear')}\n onClick={(e) => {\n e.stopPropagation()\n setQuery('')\n setSearchExpanded(false)\n }}\n >\n <IconCloseFill14 />\n </button>\n )}\n </div>\n </div>\n )}\n <div className={cx(css.headerActions, wide && searchExpanded && css.headerActionsHidden)}>\n {wide && (\n <ViewOptionsMenu\n groupBy={viewPrefs.groupBy}\n orderBy={viewPrefs.orderBy}\n onGroupPick={setGroupBy}\n onOrderPick={setOrderBy}\n t={t}\n />\n )}\n {directoryFlowAvailable && (\n <Tooltip label={t('workspace.add')} side=\"bottom\" delayMs={500}>\n <button\n type=\"button\"\n className={css.iconButton}\n aria-label={t('workspace.add')}\n onClick={() => { setWsPickerOpen(v => !v) }}\n >\n <IconProjectAddOutline16 size={wide ? 16 : 18} />\n </button>\n </Tooltip>\n )}\n </div>\n <WorkspacePickFlow\n t={t}\n open={wsPickerOpen}\n pickDirectory={props.pickDirectory}\n createWorkspace={props.createWorkspace}\n onPick={(workspaceId) => {\n setWsPickerOpen(false)\n props.startSession(workspaceId)\n }}\n onClose={() => { setWsPickerOpen(false) }}\n onRetry={() => { setWsPickerOpen(true) }}\n />\n </div>\n {!wide && (\n <div className={css.search}>\n <Tooltip label={t('search')}>\n <button\n type=\"button\"\n className={css.searchButton}\n aria-label={t('search.sessions.aria')}\n onClick={() => {\n setSearchExpanded(true)\n setSearchOnExpand(true)\n props.expandSidebar()\n }}\n >\n <IconSearchOutline16 size={18} />\n </button>\n </Tooltip>\n </div>\n )}\n <div className={css.listArea}>\n {wide && (normalizedQuery !== ''\n ? (\n <SearchResults\n list={sessionList}\n workspaces={items}\n archivedSessionIds={archived}\n query={normalizedQuery}\n remote={remoteSearch}\n resultLimit={props.searchResultLimit}\n currentId={sessions.current}\n onOpen={props.openSession}\n t={t}\n />\n )\n : viewPrefs.groupBy === 'flat'\n ? (\n <FlatListBody\n list={sessionList}\n archivedSessionIds={archived}\n orderBy={viewPrefs.orderBy}\n currentId={sessions.current}\n now={now}\n onOpen={props.openSession}\n onRename={onSessionRename}\n onFork={props.forkSession}\n onArchive={onSessionArchive}\n t={t}\n />\n )\n : (\n <GroupedTree\n groups={groups}\n footer={straySection}\n sessions={sessionList}\n archived={archived}\n currentSessionId={sessions.current}\n expandMap={expandMap}\n onToggle={toggle}\n expandTo={expandTo}\n orderBy={viewPrefs.orderBy}\n now={now}\n home={home}\n onOpen={props.openSession}\n onRename={onSessionRename}\n onFork={props.forkSession}\n onArchive={onSessionArchive}\n onWorkspaceRename={(workspaceId, currentTitle) => {\n setRenameTarget({ workspaceId, currentTitle })\n setRenameDraft(currentTitle)\n setRenameError(null)\n }}\n onWorkspaceDelete={(workspaceId, title) => {\n setDeleteTarget({ workspaceId, title })\n setDeleteError(null)\n }}\n onWorktreeRemove={(member) => {\n setWtRemoveTarget(member)\n setWtRemoveError(null)\n }}\n startSession={props.startSession}\n t={t}\n />\n ))}\n </div>\n <Modal\n open={renameTarget !== null}\n onClose={closeRename}\n closeLabel={t('close')}\n title={t('rename.workspace.title')}\n footer={(\n <>\n <Button variant=\"outline\" disabled={renaming} onClick={closeRename}>{t('cancel')}</Button>\n <Button variant=\"primary\" disabled={renameBlocked} onClick={confirmRename}>{t('rename')}</Button>\n </>\n )}\n >\n <input\n className={css.renameInput}\n value={renameDraft}\n aria-label={t('field.workspaceName')}\n autoFocus\n disabled={renaming}\n onFocus={(e) => { e.target.select() }}\n onChange={(e) => {\n setRenameDraft(e.target.value)\n setRenameError(null)\n }}\n onCompositionStart={() => { composingRef.current = true }}\n onCompositionEnd={() => { composingRef.current = false }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !composingRef.current) {\n e.preventDefault()\n confirmRename()\n }\n }}\n />\n {renameDuplicate && (\n <div className={css.renameError} role=\"alert\">{t('conflict.named', { name: renameTrimmed })}</div>\n )}\n {renameError !== null && <div className={css.renameError} role=\"alert\">{renameError}</div>}\n </Modal>\n <Modal\n open={sessionRenameTarget !== null}\n onClose={closeSessionRename}\n closeLabel={t('close')}\n title={t('rename.session.title')}\n footer={(\n <>\n <Button variant=\"outline\" disabled={sessionRenaming} onClick={closeSessionRename}>{t('cancel')}</Button>\n <Button variant=\"primary\" disabled={sessionRenameBlocked} onClick={confirmSessionRename}>{t('rename')}</Button>\n </>\n )}\n >\n <input\n className={css.renameInput}\n value={sessionRenameDraft}\n aria-label={t('field.sessionName')}\n autoFocus\n disabled={sessionRenaming}\n onFocus={(e) => { e.target.select() }}\n onChange={(e) => {\n setSessionRenameDraft(e.target.value)\n setSessionRenameError(null)\n }}\n onCompositionStart={() => { composingRef.current = true }}\n onCompositionEnd={() => { composingRef.current = false }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !composingRef.current) {\n e.preventDefault()\n confirmSessionRename()\n }\n }}\n />\n {sessionRenameError !== null && <div className={css.renameError} role=\"alert\">{sessionRenameError}</div>}\n </Modal>\n <Modal\n open={deleteTarget !== null}\n onClose={closeDelete}\n closeLabel={t('close')}\n title={t('delete.workspace')}\n {...deleteTarget === null ? {} : { description: t('delete.desc', { name: deleteTarget.title }) }}\n footer={(\n <>\n <Button variant=\"outline\" disabled={deleting} onClick={closeDelete}>{t('cancel')}</Button>\n <Button variant=\"outline\" className={css.deleteAction} disabled={deleting} onClick={confirmDelete}>\n {t('delete.workspace')}\n </Button>\n </>\n )}\n >\n {deleting && <div className={css.deleteStatus} role=\"status\">{t('delete.pending')}</div>}\n {deleteError !== null && <div className={css.renameError} role=\"alert\">{deleteError}</div>}\n </Modal>\n <Modal\n open={wtRemoveTarget !== null}\n onClose={closeWtRemove}\n closeLabel={t('close')}\n title={t('worktreeRemove.title')}\n {...wtRemoveTarget === null ? {} : { description: t('worktreeRemove.desc', { path: wtRemoveTarget.workspace.path }) }}\n footer={(\n <>\n <Button variant=\"outline\" disabled={wtRemoving} onClick={closeWtRemove}>{t('cancel')}</Button>\n <Button\n variant=\"outline\"\n className={css.deleteAction}\n disabled={wtRemoving || wtInspect.status !== 'ready'}\n onClick={confirmWtRemove}\n >\n {t('worktreeRemove.menu')}\n </Button>\n </>\n )}\n >\n {wtRemoveTarget?.label.type === 'linked' && wtRemoveTarget.label.branch !== null && (\n <div className={css.removeFact}>{t('worktreeRemove.descBranch', { branch: wtRemoveTarget.label.branch })}</div>\n )}\n {wtInspect.status === 'loading' && <div className={css.deleteStatus} role=\"status\">{t('worktreeRemove.inspecting')}</div>}\n {wtInspect.status === 'error' && <div className={css.renameError} role=\"alert\">{wtInspect.error}</div>}\n {wtInspect.status === 'ready' && (\n <div className={css.removeFacts}>\n <div className={cx(css.removeFact, wtInspect.dirty > 0 && css.removeFactWarn)}>\n {wtInspect.dirty > 0\n ? t(wtInspect.dirty === 1 ? 'worktreeRemove.dirty.one' : 'worktreeRemove.dirty.other', { n: wtInspect.dirty })\n : t('worktreeRemove.clean')}\n </div>\n {wtInspect.ahead !== undefined && wtInspect.ahead > 0 && (\n <div className={css.removeFact}>{t('worktreeRemove.ahead', { n: wtInspect.ahead })}</div>\n )}\n {wtArchiveIds.length > 0 && (\n <div className={css.removeFact}>\n {t(wtArchiveIds.length === 1 ? 'worktreeRemove.sessions.one' : 'worktreeRemove.sessions.other', { n: wtArchiveIds.length })}\n </div>\n )}\n </div>\n )}\n {wtRemoving && <div className={css.deleteStatus} role=\"status\">{t('worktreeRemove.busy')}</div>}\n {wtRemoveError !== null && <div className={css.renameError} role=\"alert\">{wtRemoveError}</div>}\n </Modal>\n {toast !== null && <Toast key={toast.seq} text={toast.text} onDone={() => { setToast(null) }} />}\n </div>\n )\n}\n","/**\n * Locale dictionaries for the git-worktree plugin. zh is the key source; en\n * is `Record<GitWorktreeKey, string>`, so a missing translation fails the\n * build instead of surfacing a raw key.\n */\n\n/** Every copy key the plugin surfaces (chip, dialogs, settings card). */\nexport type GitWorktreeKey =\n | 'chipWorktree'\n | 'worktreeToggle'\n | 'menuBranches'\n | 'menuLocalBranches'\n | 'menuWorktrees'\n | 'menuRemoteBranches'\n | 'mainRepoOnly'\n | 'menuSearchPlaceholder'\n | 'menuNoMatches'\n | 'menuNoBranches'\n | 'menuLocate'\n | 'menuExpandAll'\n | 'menuCollapseAll'\n | 'menuNewBranch'\n | 'menuNewBranchPlaceholder'\n | 'menuNewBranchBad'\n | 'menuNewBranchExists'\n | 'menuFetch'\n | 'menuUpdate'\n | 'fetchDone'\n | 'updateDone'\n | 'updateUpToDate'\n | 'aheadTitle'\n | 'behindTitle'\n | 'switchAsk'\n | 'switchAskRemote'\n | 'switchBusy'\n | 'worktreeAskNew'\n | 'worktreeAskRemote'\n | 'worktreeAskReuse'\n | 'worktreeAskCutOut'\n | 'worktreeBusy'\n | 'createBranchTitle'\n | 'createBranchBusy'\n | 'actionCancel'\n | 'actionConfirm'\n | 'errorGeneric'\n | 'cardTitle'\n | 'cardDescription'\n | 'cardUnsaved'\n | 'cardExpand'\n | 'cardCollapse'\n | 'cardReadOnly'\n | 'cardRootDirLabel'\n | 'cardBrowse'\n | 'cardPicking'\n | 'cardRootDirHint'\n | 'cardOverridden'\n | 'cardSaveFailed'\n | 'cardDiscard'\n | 'cardSave'\n | 'cardSaving'\n | 'sidebarSectionTitle'\n | 'sidebarAddSession'\n | 'sidebarNewSession'\n | 'sidebarMainBranch'\n | 'sidebarMain'\n | 'sidebarRailExpand'\n | 'cardGroupSidebarLabel'\n | 'cardGroupSidebarHint'\n | 'cardGroupSidebarMark'\n | 'cardGroupSidebarNote'\n | 'cardGroupSidebarBusy'\n | 'group.ungrouped'\n | 'session.new'\n | 'section.workspaces'\n | 'section.sessions'\n | 'viewOptions.label'\n | 'groupBy.label'\n | 'groupBy.workspace'\n | 'groupBy.flat'\n | 'orderBy.label'\n | 'orderBy.manual'\n | 'orderBy.updated'\n | 'sessions.expand'\n | 'sessions.collapse'\n | 'empty.none'\n | 'empty.noMatches'\n | 'workspace.add'\n | 'search'\n | 'search.sessions.aria'\n | 'search.placeholder'\n | 'search.clear'\n | 'search.results.aria'\n | 'search.pending'\n | 'search.unavailable'\n | 'search.noMatches'\n | 'search.hasMore'\n | 'menu.addWorkspace'\n | 'picker.loading'\n | 'conflict.named'\n | 'folderError.title'\n | 'folderError.retry'\n | 'rename'\n | 'rename.workspace.title'\n | 'rename.session.title'\n | 'field.workspaceName'\n | 'field.sessionName'\n | 'delete.workspace'\n | 'delete.desc'\n | 'delete.pending'\n | 'worktreeRemove.menu'\n | 'worktreeRemove.title'\n | 'worktreeRemove.desc'\n | 'worktreeRemove.descBranch'\n | 'worktreeRemove.inspecting'\n | 'worktreeRemove.dirty.one'\n | 'worktreeRemove.dirty.other'\n | 'worktreeRemove.clean'\n | 'worktreeRemove.ahead'\n | 'worktreeRemove.sessions.one'\n | 'worktreeRemove.sessions.other'\n | 'worktreeRemove.busy'\n | 'stray.unknown'\n | 'stray.belongsTo'\n | 'stray.missingDir'\n | 'stray.worktreeSlot'\n | 'stray.rebuild'\n | 'stray.rebuild.aria'\n | 'stray.rebuildDone'\n | 'stray.rebuildFailed'\n | 'stray.register'\n | 'stray.register.aria'\n | 'stray.registerFailed'\n | 'menu.fork'\n | 'menu.archiveSession'\n | 'sessions.count.one'\n | 'sessions.count.other'\n | 'actions.workspace.aria'\n | 'actions.session.aria'\n | 'actions.newSession.aria'\n | 'status.running'\n | 'status.subagentsRunning.one'\n | 'status.subagentsRunning.other'\n | 'status.idle'\n | 'status.waitingApproval'\n | 'status.planReview'\n | 'status.waitingAnswer'\n | 'status.completed'\n | 'hover.created'\n | 'hover.copied'\n | 'date.ymd'\n | 'time.now'\n | 'time.minutes'\n | 'time.hours'\n | 'time.days'\n | 'time.months'\n | 'time.years'\n | 'time.ago'\n | 'copy'\n | 'close'\n | 'cancel'\n\n/** English dictionary — complete by construction. */\nexport const en: Record<GitWorktreeKey, string> = {\n chipWorktree: 'Worktree',\n worktreeToggle: 'Create an isolated worktree',\n menuBranches: 'Branches',\n menuLocalBranches: 'Local branches',\n menuWorktrees: 'Worktrees',\n menuRemoteBranches: 'Remote branches',\n mainRepoOnly: 'Branch operations start from the main checkout',\n menuSearchPlaceholder: 'Search branches',\n menuNoMatches: 'No matching branches',\n menuNoBranches: 'No branches yet',\n menuLocate: 'Locate current branch',\n menuExpandAll: 'Expand all',\n menuCollapseAll: 'Collapse all',\n menuNewBranch: 'Create branch from current',\n menuNewBranchPlaceholder: 'New branch name',\n menuNewBranchBad: 'Git will not accept this name',\n menuNewBranchExists: 'A branch with this name already exists',\n menuFetch: 'Fetch',\n menuUpdate: 'Update current branch from upstream',\n fetchDone: 'Remote branches synced',\n updateDone: '{branch} fast-forwarded to its upstream',\n updateUpToDate: 'Already up to date',\n aheadTitle: '{n} commits ahead of upstream',\n behindTitle: '{n} commits behind upstream',\n switchAsk: 'Switch to {branch}?',\n switchAskRemote: 'Check out this remote branch?',\n switchBusy: 'Switching…',\n worktreeAskNew: 'Create a worktree from {branch}?',\n worktreeAskRemote: 'Create a worktree from this remote branch?',\n worktreeAskReuse: 'Switch to the {branch} worktree?',\n worktreeAskCutOut: 'Cut a new branch out of {branch} into an isolated worktree',\n worktreeBusy: 'Creating…',\n createBranchTitle: 'New branch from {branch}',\n createBranchBusy: 'Creating…',\n actionCancel: 'Cancel',\n actionConfirm: 'Confirm',\n errorGeneric: 'Git worktree: {message}',\n cardTitle: 'Git Worktree',\n cardDescription: 'Where isolated worktree folders for new sessions are stored.',\n cardUnsaved: 'Unsaved',\n cardExpand: 'Expand',\n cardCollapse: 'Collapse',\n cardReadOnly: 'The settings document is read-only; edits cannot be saved.',\n cardRootDirLabel: 'Worktree storage folder',\n cardBrowse: 'Browse…',\n cardPicking: 'Choosing…',\n cardRootDirHint: 'Absolute path. Empty uses the default $DSH_HOME/gitworktree (~/.dsh/gitworktree).',\n cardOverridden: '(custom location)',\n cardSaveFailed: 'The change did not save. Check the path is absolute and try again.',\n cardDiscard: 'Discard',\n cardSave: 'Save',\n cardSaving: 'Saving…',\n sidebarSectionTitle: 'Workspaces',\n sidebarAddSession: 'Start a new session',\n sidebarNewSession: 'New Session',\n sidebarMainBranch: 'Main ({branch})',\n sidebarMain: 'Main',\n sidebarRailExpand: 'Expand sidebar',\n cardGroupSidebarLabel: 'Group workspaces',\n cardGroupSidebarHint: 'DSH does not yet expose a multi-workspace grouping API, so this replaces the native sidebar 1:1 and adds same-repo worktree grouping.',\n cardGroupSidebarMark: '(experimental)',\n cardGroupSidebarNote: 'Turn it off to restore the native list if anything breaks; we will switch to the official API as soon as it ships.',\n cardGroupSidebarBusy: 'Switching sidebar…',\n 'group.ungrouped': 'Ungrouped',\n 'session.new': 'New Session',\n 'section.workspaces': 'Workspaces',\n 'section.sessions': 'Sessions',\n 'viewOptions.label': 'View options',\n 'groupBy.label': 'Group by',\n 'groupBy.workspace': 'WorkSpace',\n 'groupBy.flat': 'In one list',\n 'orderBy.label': 'Order by',\n 'orderBy.manual': 'Manual',\n 'orderBy.updated': 'Last updated',\n 'sessions.expand': 'Show {n} more sessions',\n 'sessions.collapse': 'Show less',\n 'empty.none': 'No sessions yet',\n 'empty.noMatches': 'No matches',\n 'workspace.add': 'Add workspace',\n search: 'Search',\n 'search.sessions.aria': 'Search sessions',\n 'search.placeholder': 'Search sessions...',\n 'search.clear': 'Clear search',\n 'search.results.aria': 'Search results',\n 'search.pending': 'Searching session history…',\n 'search.unavailable': 'Content search is temporarily unavailable. Showing name matches.',\n 'search.noMatches': 'No matching sessions',\n 'search.hasMore': 'Showing the first {n} results. Narrow your search.',\n 'menu.addWorkspace': 'Add workspace…',\n 'picker.loading': 'Loading workspaces…',\n 'conflict.named': 'A workspace named “{name}” already exists.',\n 'folderError.title': 'Couldn’t open folder',\n 'folderError.retry': 'Choose again',\n rename: 'Rename',\n 'rename.workspace.title': 'Rename workspace',\n 'rename.session.title': 'Rename session',\n 'field.workspaceName': 'Workspace name',\n 'field.sessionName': 'Session name',\n 'delete.workspace': 'Delete workspace',\n 'delete.desc': 'This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.',\n 'delete.pending': 'Deleting workspace…',\n 'worktreeRemove.menu': 'Remove worktree',\n 'worktreeRemove.title': 'Remove worktree',\n 'worktreeRemove.desc': 'This removes the worktree from git and deletes the folder “{path}”.',\n 'worktreeRemove.descBranch': 'The branch {branch} is kept.',\n 'worktreeRemove.inspecting': 'Inspecting worktree…',\n 'worktreeRemove.dirty.one': '{n} uncommitted file will be deleted with the folder.',\n 'worktreeRemove.dirty.other': '{n} uncommitted files will be deleted with the folder.',\n 'worktreeRemove.clean': 'No uncommitted changes.',\n 'worktreeRemove.ahead': '{n} commits ahead of upstream, kept on the branch.',\n 'worktreeRemove.sessions.one': '{n} session in this workspace will be archived too.',\n 'worktreeRemove.sessions.other': '{n} sessions in this workspace will be archived too.',\n 'worktreeRemove.busy': 'Removing…',\n 'stray.unknown': '(unknown directory)',\n 'stray.belongsTo': 'Stray sessions of “{name}”',\n 'stray.missingDir': 'Directory no longer exists — registering is unavailable',\n 'stray.worktreeSlot': 'A worktree storage slot: rebuild this directory (e.g. git worktree add) and its historical sessions reattach automatically',\n 'stray.rebuild': 'Rebuild empty directory',\n 'stray.rebuild.aria': 'Rebuild the directory “{name}”',\n 'stray.rebuildDone': 'Directory rebuilt; its historical sessions will reattach automatically',\n 'stray.rebuildFailed': 'Rebuild failed: {message}',\n 'stray.register': 'Register as workspace',\n 'stray.register.aria': 'Register “{name}” as a workspace',\n 'stray.registerFailed': 'Registration failed: {message}',\n 'menu.fork': 'Fork session',\n 'menu.archiveSession': 'Archive session',\n 'sessions.count.one': '{n} session',\n 'sessions.count.other': '{n} sessions',\n 'actions.workspace.aria': 'Workspace actions for {name}',\n 'actions.session.aria': 'Session actions for {name}',\n 'actions.newSession.aria': 'New session in {name}',\n 'status.running': 'Running',\n 'status.subagentsRunning.one': '{n} subagent running',\n 'status.subagentsRunning.other': '{n} subagents running',\n 'status.idle': 'Idle',\n 'status.waitingApproval': 'Waiting for approval',\n 'status.planReview': 'Plan awaiting review',\n 'status.waitingAnswer': 'Waiting for answer',\n 'status.completed': 'Completed',\n 'hover.created': 'Created {time}',\n 'hover.copied': 'Copied',\n 'date.ymd': '{y}-{m}-{d}',\n 'time.now': 'now',\n 'time.minutes': '{n}min',\n 'time.hours': '{n}h',\n 'time.days': '{n}d',\n 'time.months': '{n}mo',\n 'time.years': '{n}y',\n 'time.ago': '{t} ago',\n copy: 'Copy',\n close: 'Close',\n cancel: 'Cancel',\n}\n\n/** 中文词典。 */\nexport const zh: Record<GitWorktreeKey, string> = {\n chipWorktree: '工作树',\n worktreeToggle: '创建隔离工作树',\n menuBranches: '分支',\n menuLocalBranches: '本地分支',\n menuWorktrees: '工作树',\n menuRemoteBranches: '远程分支',\n mainRepoOnly: '分支操作请在主仓库发起',\n menuSearchPlaceholder: '搜索分支',\n menuNoMatches: '没有匹配的分支',\n menuNoBranches: '暂无分支',\n menuLocate: '定位当前分支',\n menuExpandAll: '全部展开',\n menuCollapseAll: '全部折叠',\n menuNewBranch: '从当前分支新建分支',\n menuNewBranchPlaceholder: '新分支名称',\n menuNewBranchBad: 'Git 不接受该名称',\n menuNewBranchExists: '同名分支已存在',\n menuFetch: '提取',\n menuUpdate: '更新当前分支',\n fetchDone: '远程分支已同步',\n updateDone: '{branch} 已快进到远程最新',\n updateUpToDate: '已是最新',\n aheadTitle: '领先上游 {n} 个提交',\n behindTitle: '落后上游 {n} 个提交',\n switchAsk: '是否切到 {branch}?',\n switchAskRemote: '是否检出该远程分支?',\n switchBusy: '切换中…',\n worktreeAskNew: '是否从 {branch} 新建工作树?',\n worktreeAskRemote: '从该远程分支新建工作树?',\n worktreeAskReuse: '是否切到 {branch} 工作树?',\n worktreeAskCutOut: '从当前分支 {branch} 切出新分支到隔离工作树',\n worktreeBusy: '创建中…',\n createBranchTitle: '从 {branch} 新建分支',\n createBranchBusy: '创建中…',\n actionCancel: '取消',\n actionConfirm: '确认',\n errorGeneric: 'Git 工作树:{message}',\n cardTitle: 'Git 工作树',\n cardDescription: '新会话的隔离工作树文件夹存放位置。',\n cardUnsaved: '未保存',\n cardExpand: '展开',\n cardCollapse: '折叠',\n cardReadOnly: '设置文档为只读,修改无法保存。',\n cardRootDirLabel: '工作树存放目录',\n cardBrowse: '浏览…',\n cardPicking: '选择中…',\n cardRootDirHint: '绝对路径。留空使用默认 $DSH_HOME/gitworktree(~/.dsh/gitworktree)。',\n cardOverridden: '(已自定义位置)',\n cardSaveFailed: '保存未生效,请检查路径是否为绝对路径后重试。',\n cardDiscard: '放弃',\n cardSave: '保存',\n cardSaving: '保存中…',\n sidebarSectionTitle: '工作区',\n sidebarAddSession: '发起新会话',\n sidebarNewSession: '新会话',\n sidebarMainBranch: '主仓库({branch})',\n sidebarMain: '主仓库',\n sidebarRailExpand: '展开侧栏',\n cardGroupSidebarLabel: '聚合工作区',\n cardGroupSidebarHint: 'DSH 尚未开放多工作区聚合接口,因此按原生侧边栏 1:1 替换左侧列表,并加上同仓库工作树分组。',\n cardGroupSidebarMark: '(测试功能)',\n cardGroupSidebarNote: '使用中若遇问题,关掉即可回到原生;官方接口一旦开放,会第一时间改用原生实现。',\n cardGroupSidebarBusy: '正在切换侧栏…',\n 'group.ungrouped': '未分组',\n 'session.new': '新会话',\n 'section.workspaces': '工作区',\n 'section.sessions': '会话',\n 'viewOptions.label': '视图选项',\n 'groupBy.label': '分组方式',\n 'groupBy.workspace': '按工作区',\n 'groupBy.flat': '单列表',\n 'orderBy.label': '排序方式',\n 'orderBy.manual': '手动排序',\n 'orderBy.updated': '最近更新',\n 'sessions.expand': '展开其余 {n} 个会话',\n 'sessions.collapse': '收起',\n 'empty.none': '暂无会话',\n 'empty.noMatches': '无匹配结果',\n 'workspace.add': '添加工作区',\n search: '搜索',\n 'search.sessions.aria': '搜索会话',\n 'search.placeholder': '搜索会话…',\n 'search.clear': '清除搜索',\n 'search.results.aria': '搜索结果',\n 'search.pending': '正在搜索会话历史…',\n 'search.unavailable': '内容搜索暂不可用,仅显示名称匹配。',\n 'search.noMatches': '无匹配会话',\n 'search.hasMore': '仅显示前 {n} 条结果,请缩小搜索范围。',\n 'menu.addWorkspace': '添加工作区…',\n 'picker.loading': '正在加载工作区…',\n 'conflict.named': '已存在名为“{name}”的工作区。',\n 'folderError.title': '无法打开文件夹',\n 'folderError.retry': '重新选择',\n rename: '重命名',\n 'rename.workspace.title': '重命名工作区',\n 'rename.session.title': '重命名会话',\n 'field.workspaceName': '工作区名称',\n 'field.sessionName': '会话名称',\n 'delete.workspace': '删除工作区',\n 'delete.desc': '将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。',\n 'delete.pending': '正在删除工作区…',\n 'worktreeRemove.menu': '删除工作树',\n 'worktreeRemove.title': '删除工作树',\n 'worktreeRemove.desc': '将从 git 移除该工作树并删除目录“{path}”。',\n 'worktreeRemove.descBranch': '分支 {branch} 将保留。',\n 'worktreeRemove.inspecting': '正在检查工作树…',\n 'worktreeRemove.dirty.one': '{n} 个未提交文件将随目录一并删除。',\n 'worktreeRemove.dirty.other': '{n} 个未提交文件将随目录一并删除。',\n 'worktreeRemove.clean': '无未提交改动。',\n 'worktreeRemove.ahead': '分支领先上游 {n} 个提交,提交将保留在分支上。',\n 'worktreeRemove.sessions.one': '该工作区下的 {n} 个会话将一并归档。',\n 'worktreeRemove.sessions.other': '该工作区下的 {n} 个会话将一并归档。',\n 'worktreeRemove.busy': '删除中…',\n 'stray.unknown': '(目录未知)',\n 'stray.belongsTo': '属于“{name}”的失联会话',\n 'stray.missingDir': '目录已不存在,无法注册',\n 'stray.worktreeSlot': '工作树存放位:重建此目录(如 git worktree add)后,其历史会话将自动归位',\n 'stray.rebuild': '重建空目录',\n 'stray.rebuild.aria': '重建目录“{name}”',\n 'stray.rebuildDone': '目录已重建,其历史会话将自动归位',\n 'stray.rebuildFailed': '重建失败:{message}',\n 'stray.register': '注册为工作区',\n 'stray.register.aria': '将“{name}”注册为工作区',\n 'stray.registerFailed': '注册失败:{message}',\n 'menu.fork': '分叉会话',\n 'menu.archiveSession': '归档会话',\n 'sessions.count.one': '{n} 个会话',\n 'sessions.count.other': '{n} 个会话',\n 'actions.workspace.aria': '工作区“{name}”的操作',\n 'actions.session.aria': '会话“{name}”的操作',\n 'actions.newSession.aria': '在“{name}”中新建会话',\n 'status.running': '进行中',\n 'status.subagentsRunning.one': '{n} 个子代理运行中',\n 'status.subagentsRunning.other': '{n} 个子代理运行中',\n 'status.idle': '空闲',\n 'status.waitingApproval': '等待审批',\n 'status.planReview': '计划待审',\n 'status.waitingAnswer': '等待回答',\n 'status.completed': '已完成',\n 'hover.created': '创建于 {time}',\n 'hover.copied': '已复制',\n 'date.ymd': '{y}年{m}月{d}日',\n 'time.now': '刚刚',\n 'time.minutes': '{n}分钟',\n 'time.hours': '{n}小时',\n 'time.days': '{n}天',\n 'time.months': '{n}个月',\n 'time.years': '{n}年',\n 'time.ago': '{t}前',\n copy: '复制',\n close: '关闭',\n cancel: '取消',\n}\n","/**\n * dsh-git-worktree browser half: the composer branch chip + worktree toggle\n * (conversation.input.left) for blank sessions, the plugin configuration\n * card on the Plugins tab (the `git-worktree` settings namespace — the\n * worktree storage root — edited through the settings scope), and — while\n * the sidebar-grouping switch is on — the `sidebar.workspaces` occupant\n * that clusters same-repository workspaces into one tree. Repo facts and\n * worktree creation flow through the host half's own routes; session hopping\n * uses the framework's workspaces service; the card's browse button rides the\n * same service's native directory picker (`ctx.workspaces.pickDirectory`).\n *\n * The grouping seat registers DYNAMICALLY: the settings scope drives a\n * register/dispose cycle, so flipping the card's switch swaps the sidebar\n * browser without a page reload (the native browser owns the default cell,\n * this entry shadows it at a lower priority while enabled).\n */\n\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { SessionId, WorkspaceId } from '@deepseek-ai/dsh-client-runtime/client'\n// Type-only: pulls the ui-conversation SlotMap merge (input region entries).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\n// Type-only: pulls the ui-sidebar SlotMap merge ('sidebar.workspaces' and its\n// SidebarSectionOwnerProps owner share) into this program.\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\n// Type-only: pulls the ui-settings SlotMap merge ('settings.section') and the\n// settingsScope service declaration into this program.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the ui-settings-plugins keyed-slot declaration\n// ('settings.plugin.item') into this program. The value face stays\n// uncompromised: cross-plugin collaboration goes through the slot system.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport { BranchChipDock } from './BranchChip.tsx'\nimport { CardForm, type SectionValue } from './card-form.ts'\nimport { GitWorktreeCard } from './GitWorktreeCard.tsx'\nimport { GroupedSidebar, type GroupedSidebarInjected } from './GroupedSidebar.tsx'\nimport { requestEnsureDirectory, requestGroupWorktrees, requestInspectWorktree, requestPathExists, requestRemoveWorktree } from './api.ts'\nimport { en, zh, type GitWorktreeKey } from './locales.ts'\nimport type { BranchChipInjected } from './slots.ts'\n\nexport type { BranchChipInjected } from './slots.ts'\nexport type { GitWorktreeKey } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The git-worktree chip, dialogs, and settings card copy. */\n 'git-worktree': GitWorktreeKey\n }\n interface SlotMap {\n /**\n * Directory-flow hole under the sidebar browsing region. Declared at\n * runtime by native ui-workspace; this merge only names the key so\n * occupancy probes type-check. This plugin must NOT re-declare the hole\n * (SlotCore throws on a second declarer).\n */\n 'sidebar.workspaces.directoryFlow': {\n kind: 'single'\n scope: 'root'\n owner: {\n open: boolean\n busy: boolean\n onPicked: (path: string) => void\n onCancel: () => void\n onError: (message: string) => void\n }\n }\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'git-worktree'\n\n/**\n * Namespace of the git-worktree settings section. Spelled here rather than\n * imported: a client package must not depend on a Host package.\n */\nconst GIT_WORKTREE_NS = 'git-worktree'\n\n/** Required services: the slot ledger, session/workspace runtime, copy, and\n * the settings scope backing the plugin configuration card. */\nexport const inject = ['slots', 'sessions', 'workspaces', 'locale', 'connection', 'remote', 'settingsScope']\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'git-worktree: dictionaries')\n\n const chipInjected = (): BranchChipInjected => ({\n adoptWorktree: async (path) => {\n const workspace = await ctx.workspaces.create({ path })\n ctx.workspaces.startSession(workspace.workspaceId)\n },\n })\n\n ctx.slots.inject('conversation.input.left', () => ctx.slots.register({\n name: 'conversation.input.left',\n id: 'git-worktree',\n order: 5,\n locale: NS,\n inject: chipInjected,\n }, BranchChipDock))\n\n const groupingScope = ctx.settingsScope.bind<SectionValue>({ namespace: GIT_WORKTREE_NS })\n\n // Seat apply is a Promise the settings card awaits: `scope.set` only\n // stores the document. Enable waits until GroupedSidebar's first /group\n // probe settles (until then the tree is visually the native flat list);\n // disable waits until the occupant is disposed and a frame has painted\n // so the native browser can commit. Subscribe still drives apply for\n // startup and out-of-band writes.\n const SEAT_READY_TIMEOUT_MS = 20_000\n const SNAPSHOT_WAIT_MS = 8_000\n let groupingDisposer: (() => void) | undefined\n let groupingEnabled: boolean | undefined\n let seatEpoch = 0\n let seatReady = Promise.resolve()\n let seatReadyResolve: (() => void) | undefined\n let seatTimer: ReturnType<typeof setTimeout> | undefined\n\n const finishSeat = (): void => {\n if (seatTimer !== undefined) {\n window.clearTimeout(seatTimer)\n seatTimer = undefined\n }\n const resolve = seatReadyResolve\n seatReadyResolve = undefined\n resolve?.()\n }\n\n const afterPaint = (): Promise<void> => new Promise((resolve) => {\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => { requestAnimationFrame(() => { resolve() }) })\n return\n }\n setTimeout(resolve, 0)\n })\n\n const groupingMatches = (enabled: boolean): boolean => {\n const snapshot = groupingScope.getSnapshot()\n return snapshot.status === 'ready' && (snapshot.value?.groupSidebar ?? true) === enabled\n }\n\n const waitSnapshotMatches = async (enabled: boolean): Promise<void> => {\n if (groupingMatches(enabled)) return\n await new Promise<void>((resolve) => {\n const stop = groupingScope.subscribe(() => {\n if (!groupingMatches(enabled)) return\n stop()\n window.clearTimeout(timer)\n resolve()\n })\n const timer = window.setTimeout(() => {\n stop()\n resolve()\n }, SNAPSHOT_WAIT_MS)\n if (groupingMatches(enabled)) {\n window.clearTimeout(timer)\n stop()\n resolve()\n }\n })\n }\n\n const syncGroupingSeat = (): Promise<void> => {\n const snapshot = groupingScope.getSnapshot()\n if (snapshot.status !== 'ready') return seatReady\n const enabled = snapshot.value?.groupSidebar ?? true\n if (enabled === groupingEnabled) return seatReady\n groupingEnabled = enabled\n if (groupingDisposer !== undefined) {\n groupingDisposer()\n groupingDisposer = undefined\n }\n const epoch = ++seatEpoch\n seatReady = new Promise<void>((resolve) => { seatReadyResolve = resolve })\n if (!enabled) {\n void afterPaint().then(() => { if (epoch === seatEpoch) finishSeat() })\n return seatReady\n }\n const injectFace = (): GroupedSidebarInjected => ({\n workspacesList: ctx.workspaces.list,\n sessionsList: ctx.sessions.list,\n openSession: (sessionId: string) => {\n ctx.sessions.open(sessionId as SessionId)\n },\n startSession: (workspaceId?: string) => {\n ctx.workspaces.startSession(workspaceId as WorkspaceId | undefined)\n },\n loadFacts: async (paths: readonly string[]) => {\n const result = await requestGroupWorktrees(paths)\n return result.ok ? result.facts : undefined\n },\n searchSessions: async (query, signal) => {\n const result = await ctx.sessions.search(query, signal)\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n },\n searchResultLimit: ctx.sessions.searchResultLimit,\n renameSession: async (sessionId, title) => {\n const session = ctx.sessions.binding(sessionId as SessionId)?.session\n if (session === undefined) throw new Error(`unknown session \"${sessionId}\"`)\n const result = await session.rename(title)\n if (!result.ok) throw new Error(result.error.message)\n },\n forkSession: (sessionId) => {\n ctx.sessions.fork({ sessionId: sessionId as SessionId, increaseTitle: true }).then((childId) => {\n ctx.sessions.open(childId)\n }).catch(() => { /* fork failure is silent, matching native */ })\n },\n renameWorkspace: async (workspaceId, title) => {\n await ctx.workspaces.rename(workspaceId as WorkspaceId, title)\n },\n deleteWorkspace: async (workspaceId) => {\n await ctx.workspaces.delete(workspaceId as WorkspaceId)\n },\n archiveSession: async (sessionId) => {\n await ctx.workspaces.archiveSession(sessionId as SessionId)\n },\n inspectWorktree: async (path) => {\n const result = await requestInspectWorktree(path)\n if (!result.ok) throw new Error(result.error)\n return { dirty: result.dirty, ahead: result.ahead }\n },\n removeWorktree: async (path, force) => {\n const result = await requestRemoveWorktree(path, force)\n if (!result.ok) throw new Error(result.error)\n },\n probeDirectories: async (paths) => {\n const result = await requestPathExists(paths)\n return result.ok ? { exists: result.exists, ...result.rebuildable === undefined ? {} : { rebuildable: result.rebuildable } } : undefined\n },\n ensureDirectory: async (path) => {\n const result = await requestEnsureDirectory(path)\n if (!result.ok) throw new Error(result.error)\n },\n createWorkspace: (input) => ctx.workspaces.create(input),\n pickDirectory: () => ctx.workspaces.pickDirectory(),\n hostDescription: (ctx.get('connection') as { hostDescription: GroupedSidebarInjected['hostDescription'] }).hostDescription,\n directoryFlow: {\n getSnapshot: () => ctx.slots.entries('sidebar.workspaces.directoryFlow').length > 0,\n subscribe: (listener) => ctx.slots.subscribe('sidebar.workspaces.directoryFlow', listener),\n },\n onReady: () => { if (epoch === seatEpoch) finishSeat() },\n })\n groupingDisposer = ctx.slots.inject('sidebar.workspaces', () => ctx.slots.register({\n name: 'sidebar.workspaces',\n priority: -1,\n locale: NS,\n inject: injectFace,\n }, GroupedSidebar))\n seatTimer = window.setTimeout(() => { if (epoch === seatEpoch) finishSeat() }, SEAT_READY_TIMEOUT_MS)\n return seatReady\n }\n\n const waitForGroupingSeat = async (enabled: boolean): Promise<void> => {\n await waitSnapshotMatches(enabled)\n await syncGroupingSeat()\n }\n\n // The Plugins configuration tab dispatches keyed cards for the namespaces\n // the Host serves; the git-worktree host half registers this key, so the\n // storage-root card pairs with it without any upstream change. One bind\n // backs both the card form (checkbox reads the snapshot) and the sidebar\n // seat (subscribe drives register/dispose).\n const form = new CardForm(groupingScope, waitForGroupingSeat)\n const store = form.bind()\n ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({\n name: 'settings.plugin.item',\n key: GIT_WORKTREE_NS,\n priority: -1,\n locale: NS,\n inject: () => ({\n hooks: { gitWorktreeCard: store },\n ...form.actions(),\n // The shell's own directory picker (the workspace flows' chooser):\n // resolves the chosen absolute path, or null when the user dismisses.\n pickDirectory: () => ctx.workspaces.pickDirectory(),\n }),\n }, GitWorktreeCard))\n\n // Native ui-workspace occupies the slot's default cell (priority 0). While\n // the switch is on, this entry shadows it at priority -1 (single cells\n // render their LOWEST live entry), and the disposer restores the native\n // browser the moment the switch flips or the fiber unloads.\n void syncGroupingSeat()\n const unsubscribeGrouping = groupingScope.subscribe(() => { void syncGroupingSeat() })\n ctx.effect(() => () => {\n unsubscribeGrouping()\n if (groupingDisposer !== undefined) groupingDisposer()\n }, 'git-worktree: sidebar grouping lifecycle')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAiCA,SAAgB,gBAAgB,QAAwB;GACtD,MAAM,KAAK,OAAO,QAAQ,GAAG;GAC7B,OAAO,MAAM,IAAI,SAAS,OAAO,MAAM,KAAK,CAAC;EAC/C;;;;;;;;;;;;EAyCA,SAAgB,gBAAgB,MAAsC;GACpE,IAAI,KAAK,KAAK,MAAM,IAAI,OAAO;G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