/** * `chat-recall repair` — rebuild sessions whose history an upstream tool * truncated in place (Claude Code 2.1.20x resume rewrite) before the shadow * archive existed to catch it. * * SOURCES OF TRUTH, in order of fullness (we take whichever has the MOST * messages, then union them): * 1. the local shadow archive (if this machine already recovered it) * 2. each configured server's shrink-protected raw archive * (`GET /api/conversations/:id/raw-archive`) — the SaaS keeps the * pre-truncation original because putRawSession never overwrites with a * smaller capture; a frozen self-host server is an equally good backstop. * * FLOW per session: fetch every candidate → pick/​union the fullest → seed the * local shadow with it → rebuild the conversation from that shadow (the normal * sync builder now reads the shadow) → push the recovered FULL conversation to * every server whose current copy is smaller. The server-side shrink guard * accepts it because it GROWS the stored conversation. * * This is the deliberate, audited inverse of the silent truncation: it only * ever makes a conversation FULLER, never smaller. */ export interface RepairResult { sessionId: string; status: 'repaired' | 'would-repair' | 'already-full' | 'no-archive' | 'error'; fullestMessages: number; fullestSource: string; pushed: Array<{ server: string; before: number; after: number; }>; note?: string; } /** * Repair one session: gather the fullest archive across the local shadow and * every configured server, seed the shadow, rebuild, and push where smaller. */ export declare function repairSession(id: string, opts?: { dryRun?: boolean; force?: boolean; verbose?: boolean; server?: string; }): Promise; export declare function repairSessions(ids: string[], opts?: { dryRun?: boolean; force?: boolean; verbose?: boolean; server?: string; }): Promise; export interface RepairAllReport { scanned: number; candidates: RepairResult[]; discoveryServer: string; } /** * Discover every damaged session in a recency window and repair it — the * automated sweep behind `repair --all`. A session is DAMAGED when its * shrink-protected raw archive parses to MORE messages than the server's * current item count (the exact fingerprint of the resume-truncation * incident). Discovery reads the primary server only (the one we hold a token * for); repairSession then fixes every configured target that's behind. * * Read-only unless opts.apply — the default is a dry run that mutates nothing. */ export declare function repairAll(opts?: { sinceHours?: number; apply?: boolean; verbose?: boolean; minMessages?: number; server?: string; }): Promise; //# sourceMappingURL=repair.d.ts.map