/** * use-history-archive — wires {@link HistoryArchive} into the scroll-back path. * * The reducer caps the in-memory window (`retainTuiHistory`), so entries that * age out are gone from `state.entries`. This hook mirrors every entry to a * disk-backed JSONL archive as it appears, and serves pages back when the user * scrolls past the oldest in-memory entry. Without it `onRequestOlderEntries` * resolves with zero entries and scroll-back silently dead-ends. * * Scope is one process run. The archive file is truncated at startup because * entry ids restart at 1 on resume (`replaySessionMessages(..., 1)`) — keeping * a previous run's lines would collide ids and duplicate rows in the view. * Cross-run history is `/resume`'s job, not the scroll window's. */ import type { Action } from '../app-reducer.js'; import type { HistoryEntry } from '../history-entry.js'; export interface UseHistoryArchiveOptions { entries: readonly HistoryEntry[]; dispatch: React.Dispatch; /** Root of the session store. Absent for ephemeral (`--no-session`) runs. */ sessionsDir?: string | undefined; /** Current session id; the archive lives beside the session's own files. */ sessionId?: string | undefined; } export interface HistoryArchiveResult { /** Passed to ; fires when the user reaches the oldest row. */ onRequestOlderEntries: () => void; } export declare function useHistoryArchive({ entries, dispatch, sessionsDir, sessionId, }: UseHistoryArchiveOptions): HistoryArchiveResult; //# sourceMappingURL=use-history-archive.d.ts.map