/** Read-only reverse pagination over rotated runtime-log JSONL files. */ import { type LogRecord } from './log-protocol.ts'; /** One record position in a specific file, used as a paging boundary. */ export interface LogHistoryCursor { /** Matching JSONL filename, never a path. */ fileName: string; /** Zero-based line index of the record, exclusive for the next older page. */ line: number; } /** First-page boundary: the browser's earliest live record identity. */ export interface LogHistoryAnchor { ts: number; sn: number; } /** Boundary that selects records strictly older than it. */ export type LogHistoryBoundary = { kind: 'anchor'; anchor: LogHistoryAnchor; } | { kind: 'cursor'; cursor: LogHistoryCursor; }; /** One page of records plus the cursor that continues the next older page. */ export interface LogHistoryPage { records: LogRecord[]; nextCursor?: LogHistoryCursor; } /** History reader configuration. */ export interface LogHistoryOptions { /** Private directory containing rotated files. */ root: string; } /** Serialize a cursor to its opaque wire form. */ export declare function encodeCursor(cursor: LogHistoryCursor): string; /** Parse the opaque wire form; rejects any non-matching or non-numeric input. */ export declare function decodeCursor(value: string): LogHistoryCursor | undefined; /** Read-only pager over the rotated JSONL files, newest page first. */ export declare class JsonlLogHistory { private readonly options; constructor(options: LogHistoryOptions); /** * Return up to `limit` records strictly older than the boundary, ascending. * Without a boundary the newest `limit` records on disk are returned. * @param limit - maximum records to return. * @param before - first-page anchor or an earlier page's cursor. */ page(limit: number, before?: LogHistoryBoundary): Promise; private listFiles; private readFileRecords; }