import type { SessionMaintenanceMode } from "../types.base.js"; import type { SessionEntry } from "./types.js"; export type SessionMaintenanceWarning = { activeSessionKey: string; activeUpdatedAt?: number; totalEntries: number; pruneAfterMs: number; maxEntries: number; wouldPrune: boolean; wouldCap: boolean; }; export type ResolvedSessionMaintenanceConfig = { mode: SessionMaintenanceMode; pruneAfterMs: number; maxEntries: number; rotateBytes: number; resetArchiveRetentionMs: number | null; maxDiskBytes: number | null; highWaterBytes: number | null; }; /** * Resolve maintenance settings from bot.json (`session.maintenance`). * Falls back to built-in defaults when config is missing or unset. */ export declare function resolveMaintenanceConfig(): ResolvedSessionMaintenanceConfig; /** * Remove entries whose `updatedAt` is older than the configured threshold. * Entries without `updatedAt` are kept (cannot determine staleness). * Mutates `store` in-place. */ export declare function pruneStaleEntries(store: Record, overrideMaxAgeMs?: number, opts?: { log?: boolean; onPruned?: (params: { key: string; entry: SessionEntry; }) => void; }): number; export declare function getActiveSessionMaintenanceWarning(params: { store: Record; activeSessionKey: string; pruneAfterMs: number; maxEntries: number; nowMs?: number; }): SessionMaintenanceWarning | null; /** * Cap the store to the N most recently updated entries. * Entries without `updatedAt` are sorted last (removed first when over limit). * Mutates `store` in-place. */ export declare function capEntryCount(store: Record, overrideMax?: number, opts?: { log?: boolean; onCapped?: (params: { key: string; entry: SessionEntry; }) => void; }): number; /** * Rotate the sessions file if it exceeds the configured size threshold. * Renames the current file to `sessions.json.bak.{timestamp}` and cleans up * old rotation backups, keeping only the 3 most recent `.bak.*` files. */ export declare function rotateSessionFile(storePath: string, overrideBytes?: number): Promise;