import type { SessionEntry } from "../../session-manager-types.ts"; import type { SqliteDatabase } from "../database.js"; import type { SessionCwdMatcher, SessionListQuery, SessionRecordHeader, SessionSnapshot, SessionStore, SessionSummary, SessionWriteOptions, StorageDescriptor } from "./types.js"; export declare const SESSION_SCHEMA_VERSION = 1; export declare const SESSION_TABLES: Readonly<{ meta: "meta"; sessions: "sessions"; entries: "entries"; searchTexts: "search_texts"; }>; /** Rows whose search text is read per query; well under SQLite's bound-parameter limit. */ export declare const LISTING_FETCH_BATCH = 500; export declare class SqlSessionStore implements SessionStore { private readonly database; private readonly tables; private readonly prefix; private closed; private readonly cwdMatcher?; /** Session ids of each recently listed scope, valid while the store's change token is unchanged. */ private readonly scopes; /** Listed summaries of sessions that still exist at the cached version; never more than the store holds. */ private readonly summaries; /** * Settles when the latest listing has read and updated the caches. Listings take turns, so one listing's * pruning never drops summaries that another has fetched but not yet recorded under its scope. */ private listing; private constructor(); static open(database: SqliteDatabase, options?: { readonly prefix?: string; readonly cwdMatcher?: SessionCwdMatcher; }): Promise; get descriptor(): StorageDescriptor; create(header: SessionRecordHeader, entries: readonly SessionEntry[]): Promise<{ readonly lastSeq: number; }>; append(sessionId: string, entries: readonly SessionEntry[], options: SessionWriteOptions): Promise<{ readonly lastSeq: number; }>; replace(sessionId: string, header: SessionRecordHeader, entries: readonly SessionEntry[], options: SessionWriteOptions): Promise<{ readonly lastSeq: number; }>; load(sessionId: string): Promise; readHeader(sessionId: string): Promise; delete(sessionId: string): Promise; /** * Lists from a per-scope cache revalidated on every call. A cheap change token, which moves on any commit * from this or another connection, decides whether the scope is re-read. A scope listed for the first time * is read exactly as an uncached listing; afterwards only its light columns are re-read and search text is * read only for sessions whose stored listing columns changed. Listings of the same store take turns * reading and updating the caches; the yielding below runs outside that turn. */ list(query: SessionListQuery): AsyncIterable; /** Revalidates one scope's cache and resolves its summaries; called for one listing at a time. */ private listScope; findMostRecent(query: { readonly cwd: string; readonly includeInternal?: boolean; }): Promise; close(): Promise; /** * `data_version` moves when another connection commits and `total_changes()` when this one writes, so * together they cover writers in every process; the table aggregates also catch a change to the sessions * table if the adapter does not serve every statement from one connection. */ private changeToken; /** The scope's session ids in store order, with a current summary cached for each. */ private readScope; /** Reads full listing rows, search text included, and caches their summaries. */ private readSummaries; /** * Keeps only summaries some cached scope still lists, so memory follows the live sessions. Runs in a * listing's turn after it records its scope, when no other listing holds summaries it has not recorded. */ private pruneSummaries; private assertOpen; private assertListing; private read; private forWrite; private saveSummary; private insertEntries; private encode; } //# sourceMappingURL=sql-session-store.d.ts.map