import type { Logger } from './types.js'; export interface ReseatMarker { sourceSessionId: string; forkSessionId: string; at: number; } export declare function reseatMarkerPath(sessionsDir: string, sourceSessionId: string): string; export declare function writeReseatMarker(sessionsDir: string, sourceSessionId: string, forkSessionId: string, at: number, logger: Logger): void; export declare function readReseatMarker(sessionsDir: string, sourceSessionId: string): ReseatMarker | null; export declare function readAllReseatMarkers(sessionsDir: string, logger: Logger): ReseatMarker[]; export declare function clearReseatMarker(sessionsDir: string, sourceSessionId: string, logger: Logger): void; export interface ReseatChainResult { /** The id a resume should land on: the deepest fork whose JSONL exists, or the original id. */ target: string; /** Forks visited from the source, in order (excludes the original id). */ hops: string[]; /** True when at least one marker was followed to an existing fork. */ redirected: boolean; /** True when a marker existed for the source but its immediate fork JSONL is gone. */ stale: boolean; } /** * Follow source -> fork -> fork2 ... while a marker exists and the next fork's * JSONL exists. Returns the deepest existing fork as the redirect target. * Cycle-guarded by a visited set and a hard depth cap. */ export declare function resolveReseatChain(sessionsDir: string, sourceSessionId: string, jsonlExists: (sessionId: string) => boolean, maxDepth?: number): ReseatChainResult; /** * The inverse of resolveReseatChain. Given a fork id whose own JSONL does not * exist yet (claude --fork-session flushes the copied history only at the * fork's first turn), walk the ledger back to the nearest ancestor whose JSONL * exists, so the resolver can serve that source transcript read-only until the * fork materialises. Returns the source id, or null when forkSessionId is not a * recorded fork or no ancestor has a JSONL. Cycle-guarded by a visited set and * depth-capped, mirroring resolveReseatChain. */ export declare function resolveBridgeSource(sessionsDir: string, forkSessionId: string, jsonlExists: (sessionId: string) => boolean, maxDepth?: number): string | null; export interface ReseatReconcileResult { scanned: number; stopped: number; } /** * Scan all markers; stop any source that is currently live and whose fork JSONL * still exists (the fork is the real continuation). If a marked source is live * but its fork JSONL is gone, the marker is stale — clear it and leave the * source running (it is the only surviving copy). */ export declare function reseatReconcileTick(sessionsDir: string, isLive: (sessionId: string) => boolean, stop: (sourceSessionId: string, forkSessionId: string) => void | Promise, jsonlExists: (sessionId: string) => boolean, logger: Logger): Promise; //# sourceMappingURL=reseat-ledger.d.ts.map