import { type Database } from "./database.js"; /** * Rewrite rows stored before session content blobs existed into the * deduplicated form. Lossless by construction: the database replaces a row only * after proving, under a row lock, that the referenced blobs rebuild exactly * the original inline value. Safe to run repeatedly and concurrently with live * writers; a row that changed or no longer qualifies is skipped. */ export type SessionContentKind = "tool_catalog" | "model_context_snapshot"; export declare const SESSION_CONTENT_KINDS: readonly SessionContentKind[]; export type SessionContentCompactionCandidate = { kind: SessionContentKind; attemptId: string; accountId: string; workspaceId: string; sessionId: string; }; export declare function listSessionContentCompactionCandidates(db: Database, input: { kind: SessionContentKind; afterAttemptId: string | null; limit: number; }): Promise; /** Returns true when the row was rewritten, false when it was skipped. */ export declare function compactSessionContentRow(db: Database, candidate: SessionContentCompactionCandidate): Promise; export type SessionContentCompactionResult = { scanned: number; compacted: number; skipped: number; failed: number; }; /** * Compact up to `maxRows` legacy rows per kind, oldest attempt id first. One * failing row never aborts the pass; it stays legacy and is retried next pass. */ export declare function compactLegacySessionContent(db: Database, options?: { batchSize?: number; maxRows?: number; kinds?: readonly SessionContentKind[]; onRowError?: (candidate: SessionContentCompactionCandidate, error: unknown) => void; }): Promise; /** Command-line entry. Bundled release images call this explicitly; see * scripts/assemble-server-runtime.ts. */ export declare function runSessionContentCompactionCli(): Promise;