/** * The Sessions browser: a bounded, keyboard-first list over the Harness corpus. * * A PICKER first and an inspector second. The list answers one question — which * session — so a row carries the two facts that answer it, a title and an age, * and nothing else competes with them. Every other fact Harness can tell us * about one session, and every action that only makes sense for one session, * lives one keystroke away behind `→`. * * That split is not only visual. The event count and last-activity time cost a * whole log read, so a list that shows them has to take that read every time the * cursor moves. Moving them behind the disclosure means ordinary browsing reads * the corpus listing and nothing else. * @module dshline/sessions/overlay */ import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session'; import type { TuiOverlay } from '../slots.ts'; import { type SessionFiltersValue } from './filters.ts'; import type { CatalogState, ContentState, EventContextState, EventSearchState, LineageState, SessionDetail, SessionEntry, SessionTarget } from './model.ts'; /** The answer a resume request gets back from the owner. */ export type ResumeRequest = /** Accepted; the overlay closes and the owner performs the switch. */ { readonly kind: 'resume'; } /** Declined, with a sentence the reader can act on. */ | { readonly kind: 'refused'; readonly message: string; }; /** Result of collecting and submitting one rename draft. */ export type RenameDraftOutcome = /** Harness accepted the rename and returned its normalized title. */ { readonly kind: 'renamed'; readonly title: string; } /** The reader dismissed the child prompt without submitting a title. */ | { readonly kind: 'cancelled'; } /** Harness or the caller rejected the attempted rename. */ | { readonly kind: 'failed'; readonly message: string; }; /** What the browser needs from its owner. */ export interface SessionsOverlaySpec { /** The corpus listing. */ readonly listing: () => CatalogState; /** * Prioritize exact title reads for the rows currently useful to the reader. * * Optional so small embedders and pure presentation tests can mount the * overlay without a catalog; the real Sessions owner always supplies it. */ readonly prioritizeTitles?: (entries: readonly SessionEntry[], exhaustive?: boolean) => void; /** Tell the catalog when local query text changes, so queued work can be abandoned. */ readonly titleQueryChanged?: (query: string) => void; /** The optional full-text pass. */ readonly content: () => ContentState; /** The active catalog filters. */ readonly filters: () => SessionFiltersValue; /** Replace the active catalog filters. */ readonly applyFilters: (filters: SessionFiltersValue) => void; /** Append the next content-search page. */ readonly loadMoreContent: () => void; /** Restart the current content search without its stale cursor. */ readonly restartContentSearch: () => void; /** Read lineage state for one session. */ readonly lineage: (sessionId: SessionId) => LineageState; /** Request lineage for one session. */ readonly requestLineage: (sessionId: SessionId) => void; /** Read the within-session event-search state. */ readonly events: () => EventSearchState; /** Search events inside one session. */ readonly searchEvents: (sessionId: SessionId, query: string) => void; /** Append the next within-session event page. */ readonly loadMoreEvents: () => void; /** Read bounded context for one disclosed search hit. */ readonly requestEventContext: (sessionId: SessionId, seq: SessionSeq) => void; /** The catalog's context state for one exact search hit. */ readonly eventContext: (sessionId: SessionId, seq: SessionSeq) => EventContextState; /** Bounded detail already read for one session. */ readonly detail: (sessionId: SessionId) => SessionDetail | undefined; /** Ask for one session's bounded detail; called when its detail is disclosed. */ readonly requestDetail: (sessionId: SessionId) => void; /** Hand a query to Harness's corpus full-text surface. */ readonly search: (query: string) => void; /** The session this window is driving, when there is one. */ readonly currentSessionId: SessionId | undefined; /** Effective workspace used by the `current` filter. */ readonly workspace: string | undefined; /** The user's home directory, for shortening workspace paths. */ readonly home: string | undefined; /** Current time, injected so ages and notices are assertable. */ readonly now: () => number; /** * Ask the owner to reopen one session. * * Takes the narrow {@link SessionTarget} rather than a whole entry, because * the decision reads three facts and must not depend on which surface proposed * the session. A list row satisfies it; so does a lineage row the trace * returned. */ readonly resume: (target: SessionTarget) => ResumeRequest; /** Collect and submit a title for the current live session, when supported. */ readonly renameDraft?: (focusedTitle: string | undefined) => Promise; /** Push a child overlay onto the slot stack; the parent stays mounted beneath. */ readonly push: (overlay: TuiOverlay) => void; /** Remove this overlay from the live region. */ readonly close: () => void; /** Redraw after a move, an edit, or a landed read. */ readonly invalidate: () => void; } /** * Create the Sessions browser overlay. * @param spec - corpus reads, child panels, resume authority, and overlay controls. * @returns a temporary live-region overlay that never writes the transcript. */ export declare function createSessionsOverlay(spec: SessionsOverlaySpec): TuiOverlay; //# sourceMappingURL=overlay.d.ts.map