/** * `/worktrees`: choose the place first, then the conversation. * * Two views, in that order, and the order is the product decision. A working * directory is not a session, so selecting one must not resume whichever * conversation happens to be newest in it — that is the mistake this shape * exists to prevent. The first view answers "where", the second answers * "which conversation there, or a new one", and `+ New session` is the second * view's first row rather than its last resort. * * Everything drawn here is bounded live-region chrome under the shared visual * root, exactly as `/sessions`, `/skills`, and `/plugins` are: the committed * transcript underneath is never rewritten, and the one thing this overlay can * do that outlives it — a session transition — is decided by the plans its * owner supplies at the moment `enter` is pressed. * @module dshline/worktrees/overlay */ import type { SessionId } from '@deepseek-ai/dsh-session'; import type { SessionEntry } from '../sessions/model.ts'; import type { NewPlan, ResumePlan } from '../sessions/plan.ts'; import type { TuiOverlay } from '../slots.ts'; import type { WorktreeListing, WorktreeRow, WorktreeSelection } from './model.ts'; /** What the picker needs from the attachment that opens it. */ export interface WorktreesOverlaySpec { /** The live worktree listing; re-read every frame. */ readonly listing: () => WorktreeListing; /** The open directory's sessions, or undefined while the first view is in front. */ readonly selection: () => WorktreeSelection | undefined; /** Open one directory's sessions. */ readonly open: (cwd: string) => void; /** Return to the directory list. */ readonly back: () => void; /** Prioritize exact titles for the visible/selected sessions in the second view. */ readonly prioritizeTitles?: (entries: readonly SessionEntry[]) => void; /** * Decide whether the chosen session may be reopened. * * A function rather than a value, and called at the moment `enter` is * pressed: the picker stays open across turns, and the answer that matters * is the one at the instant the reader chose. An accepted plan is also how * the owner learns WHICH session was chosen. */ readonly resume: (entry: SessionEntry) => ResumePlan; /** Decide whether a fresh session may be started in this directory. */ readonly create: (row: WorktreeRow) => NewPlan; /** The session this window is driving, for the `open` cue. */ readonly currentSessionId?: SessionId; /** The user's home directory, for shortening paths. */ readonly home: string; /** Current time, injected so relative ages are assertable. */ readonly now: () => number; /** Remove this temporary overlay. */ readonly close: () => void; /** Ask the runner to redraw. */ readonly invalidate: () => void; } /** * Create the `/worktrees` picker. * @param spec - the two listings, the two plans, and the navigation actions. * @returns a live-region overlay that never writes the transcript. */ export declare function createWorktreesOverlay(spec: WorktreesOverlaySpec): TuiOverlay; //# sourceMappingURL=overlay.d.ts.map