/** * Bounded live-region presentation of the authoritative Harness `turnOutline`. * * FOUR surfaces, and the count is the navigation model. The outline is one * bounded surface; Enter pushes a read-only inspection surface over it, that * surface's Enter pushes a changed-file list over itself, and the list's Enter * pushes a per-file comparison. Every level is its own surface in the shared * overlay stack, so Escape pops exactly the top one and lands back on the level * beneath without a special "escape sometimes means back" state anywhere. None * of them writes the transcript: the native scrollback stays the transcript, * and `/turns` draws only the bounded index it can bound. * * Nothing here folds the log or owns turn state. Every paint re-reads the * current authoritative reading and resolves the selected turn by its stable * `turn/start` seq, so a projection update that inserts or removes a turn can * never silently move an action onto another one. The changed-file column is * read the same way — Harness publishes it, this module decides only how many * columns of it fit. * @module dshline/turns/overlay */ import type { SessionSeq } from '@deepseek-ai/dsh-session'; import type { TuiOverlay } from '../slots.ts'; import type { ChangedFileRow, TurnChangesReading } from './changes.ts'; import type { TurnReading } from './model.ts'; /** Inputs the read-only outline surface needs from the presenter. */ export interface TurnsOverlaySpec { /** The authoritative cut, read fresh on every paint. */ readonly reading: () => TurnReading; /** * The changed-file reading of one turn, or undefined when this composition * mounts no workspace-change capability. * * Asked only for the rows the terminal actually draws: the list is windowed to * the frame's capacity before its rows are built, so a 500-turn session costs * one in-memory summary lookup per VISIBLE row per paint and never one for a * turn the reader cannot see. */ readonly changes?: (turn: number) => TurnChangesReading; /** Optional initial filter, from `/turns `. */ readonly initialQuery?: string; /** * Open the read-only inspection surface for one selected turn. * * The stable `turn/start` seq is handed over, not a row index, so the * inspection surface tracks the turn the reader chose even if the outline * changes underneath it. * @param seq - the selected entry's `turn/start` seq. */ readonly inspect: (seq: SessionSeq) => void; /** Redraw after a keystroke that changed presentation state. */ readonly invalidate: () => void; /** Remove this temporary surface. */ readonly close: () => void; } /** * Create the bounded outline surface. * @param spec - authoritative reading, inspection opener, and surface controls. * @returns a live-region overlay that never writes the transcript. */ export declare function createTurnsOverlay(spec: TurnsOverlaySpec): TuiOverlay; /** Inputs the read-only inspection surface needs from the presenter. */ export interface TurnInspectionSpec { /** The authoritative cut, read fresh on every paint. */ readonly reading: () => TurnReading; /** The `turn/start` seq this surface opened on, captured when it opened. */ readonly initialSeq: SessionSeq; /** * The changed-file reading of one turn, or undefined without the capability. * @param turn - the addressed turn's Harness-assigned number. * @returns what may truthfully be presented for it. */ readonly changes?: (turn: number) => TurnChangesReading; /** * Open the changed-file list for the addressed turn. * * The reader's Enter is the DISCLOSURE: it is the first moment anyone asks for * this turn's changed files, and it is what may start the one historical log * read. No other path from this surface reaches the file list. * @param turn - the addressed turn's Harness-assigned number. */ readonly openChanges: (turn: number) => void; /** Redraw after a keystroke that moved to another turn or scrolled. */ readonly invalidate: () => void; /** Remove this temporary surface. */ readonly close: () => void; } /** * Create the bounded read-only inspection surface. * @param spec - authoritative reading, the captured seq, and surface controls. * @returns a live-region overlay that never writes the transcript. */ export declare function createTurnInspectionOverlay(spec: TurnInspectionSpec): TuiOverlay; /** Inputs the changed-file list needs from the presenter. */ export interface TurnFilesSpec { /** * The turn's changed-file reading, read fresh on every paint. * * Re-read rather than captured, because the historical read settles after this * surface may already be open: a list that froze its first answer would keep * saying "checking" over an answer that has since arrived. */ readonly reading: () => TurnChangesReading; /** * Disclose one listed file: ask Harness for that ONE comparison and open the * inspector over this list. * * The only caller of `workspaceChanges.diff` in dshline, and the only path to * it: moving the cursor cannot reach here, so a 500-file list costs one * comparison in total and only the one the reader opened. * @param file - the disclosed file row. * @param seq - the announcing event's sequence number. */ readonly open: (file: ChangedFileRow, seq: number) => void; /** Redraw after a keystroke or a settling read. */ readonly invalidate: () => void; /** Remove this temporary surface. */ readonly close: () => void; } /** * Create the bounded changed-file list. * * A third bounded level rather than a section of the turn inspection surface: * the inspection surface already spends the vertical arrows on scrolling and * `←`/`→` on turn navigation, so a file cursor there would make one key mean two * things depending on what the reader last believed. Push it instead, and let * Escape pop exactly one level — the kernel's own contract. * @param spec - the reading, the disclosure action, and the surface controls. * @returns a live-region overlay that never writes the transcript. */ export declare function createTurnFilesOverlay(spec: TurnFilesSpec): TuiOverlay; //# sourceMappingURL=overlay.d.ts.map