import type { SessionSummary } from "./session-manager.js"; /** * Per-directory cache of session summaries, persisted next to the sessions. * * Resolving which checkpoint of a conversation is newest needs the header of * every session in the directory. Reading 14,600 headers took ~1.7 s and * ~1.5 GB peak RSS on every resume (bench/baseline/31-session-list-latency.mjs), * and the desktop app pays that on each project switch because it respawns the * sidecar. The index keeps each summary with the file's size+mtime fingerprint, * so a scan is one `readdir` plus a `stat` per file, and only files that changed * since the last scan are re-read (after vercel-labs/fx#1021). * * The index is only a cache: a missing, corrupt or foreign index is ignored and * rebuilt, and every entry is re-validated against the live filesystem. */ export type IndexedSessionSummary = SessionSummary & { conversationId: string; generation: number; }; export declare const SESSION_SUMMARY_INDEX_FILE = ".session-index.json"; export declare class SessionSummaryIndex { private readonly directory; private readonly indexPath; private entries; private loading; private saving; constructor(directory: string); /** * Summaries for `candidates` (the directory's full candidate list, in the * same order). Unchanged files come from the index; changed or new ones are * read with `read` and the index is rewritten. */ summaries(candidates: readonly string[], read: (candidate: string) => Promise): Promise>; private load; /** Atomic replace; serialized so concurrent scans never interleave writes. */ private save; }