/** * Persisted-history pruning after compaction: derive the kept branch * message signatures, match them against SQLite history, and delete the * pruned remainder after a successful compaction_end. Bodies moved * verbatim from `session-stream.ts`. */ import type { BridgeLike } from "../session-stream.js"; import type { SessionStore } from "../storage.js"; import type { ServerEvent, WireMessage } from "../wire.js"; export type CompactionEndPruneSkipReason = "aborted" | "skipped" | "failed" | "missing_token_reduction"; export declare function getCompactionEndPruneSkipReason(event: Extract): CompactionEndPruneSkipReason | null; export type BranchEntryLike = NonNullable>>[number]; export type PersistedConversationRole = "user" | "assistant"; export interface KeptBranchMessageSignature { role: PersistedConversationRole; content: string; timestampMs: number | null; entryId: string; } export interface ExistingConversationMessage { message: WireMessage; conversationIndex: number; } export declare function isRecord(value: unknown): value is Record; export declare function contentAsPersistedText(content: unknown): string | null; export declare function branchMessageTimestampMs(entry: BranchEntryLike, message: Record): number | null; export declare function branchMessageSignature(entry: BranchEntryLike): KeptBranchMessageSignature | null; export declare function branchMessageRole(entry: BranchEntryLike): unknown; export declare function getKeptBranchMessageSignatures(entries: BranchEntryLike[], keptEntryIndex: number): KeptBranchMessageSignature[] | null; export declare function selectUniqueCandidate(candidates: ExistingConversationMessage[], kept: KeptBranchMessageSignature): ExistingConversationMessage | null; export declare function matchKeptPersistedMessageIds(existing: WireMessage[], keptBranchMessages: KeptBranchMessageSignature[]): Set | null; export declare function prunePersistedHistoryAfterCompaction(store: SessionStore, sessionId: string, bridge: BridgeLike): void; //# sourceMappingURL=history-prune.d.ts.map