/** * The `/turns` capability presenter. * * `/turns` is a Dshline-local command, not a Harness-wide one: it opens a * temporary bounded terminal surface over the authoritative `turnOutline` * projection, and the projection stays the state authority. `attachSession` * supplies only the projection cut, the slot registry, a redraw request, and the * optional workspace-change adapter, and learns nothing about filtering, * selection, or how a turn is inspected. * * Four surfaces are opened through the shared kernel — the outline, the turn * inspection, the changed-file list, and a per-file comparison — and navigation * between them is the kernel's own overlay stack, so Escape pops one level * without any special "sometimes back" state in `surface.ts`. * * The presenter also owns the LIFETIME of those surfaces, which the overlay * stack does not: overlays belong to the process-wide `TuiSlots` service, so * without {@link TurnsPresenter.dispose} an open `/turns` would survive the * session that opened it and keep taking keystrokes — and keep a comparison read * in flight — after the reader has already moved to a different session. The * attachment owns the presenter through its `SessionScope`, so teardown closes * every level and aborts every read it started. * @module dshline/turns/presenter */ import type { ProjectionSnapshot } from '@deepseek-ai/dsh-session-projection'; import type { LocalCommand } from '../local-commands.ts'; import type { TuiSlots } from '../slots.ts'; import type { WorkspaceChangesAdapter } from './changes.ts'; /** Narrow dependencies the Turns presenter needs from the session runner. */ export interface TurnsPresenterDeps { /** Live-region registry that owns the overlay stack. */ readonly slots: TuiSlots; /** * The authoritative projection cut, or undefined when the profile mounts no * registry. Read fresh on every paint; no turn list is copied here. * @returns the current cut. */ readonly snapshot: () => ProjectionSnapshot | undefined; /** * The attachment's workspace-change adapter, or undefined when this * composition mounts no `workspaceChanges` row. * * Owned by the attachment, not created here: the adapter holds a live event * fold and a pending historical read, both of which belong to the session * rather than to whichever `/turns` surface happens to be open. */ readonly changes?: WorkspaceChangesAdapter; /** Redraw after a keystroke that changed presentation state. */ readonly invalidate: () => void; } /** The Turns capability's internal entry point and local command. */ export interface TurnsPresenter { /** * Open the session outline directly, optionally pre-filtered. * @param initialQuery - an optional initial filter query. */ readonly open: (initialQuery?: string) => void; /** `/turns` — browse the session's turns and inspect one read-only. */ readonly command: LocalCommand; /** Close every surface this presenter opened and release their resources. */ readonly dispose: () => void; } /** * Build the Turns presenter. * @param deps - the slot registry, the projection cut reader, the optional * workspace-change adapter, and the redraw request. * @returns the presenter entry point, local command, and teardown. */ export declare function createTurnsPresenter(deps: TurnsPresenterDeps): TurnsPresenter; //# sourceMappingURL=presenter.d.ts.map