export type RestartKind = 'manual' | 'update' | 'rollback'; export interface RestartIntentPayload { kind: RestartKind; /** Present for an update or rollback: the version delta to report. */ oldVersion?: string; newVersion?: string; /** ISO 8601 timestamp the breadcrumb was written. */ at: string; } export interface RestartIntent extends RestartIntentPayload { attemptId?: string; attemptState?: 'prepared' | 'committed' | 'aborted'; deferredIntent?: RestartIntentPayload; } export type RestartIntentReportClaim = { state: 'claimed'; intent: RestartIntent; } | { state: 'prepared'; } | { state: 'absent'; }; /** Breadcrumbs older than this are stale (an aborted/failed restart left it) * and never produce a report. */ export declare const RESTART_INTENT_FRESH_MS: number; export declare const RESTART_LEASE_CLAIM_MS = 60000; export declare const RESTART_LEASE_MAX_MS: number; export declare function restartIntentPathIn(dir: string): string; export declare function clearRestartIntentTo(dir: string): void; export declare function writeRestartIntentTo(dir: string, intent: RestartIntent): void; export declare function restartLeasePathIn(dir: string): string; /** Call while holding globalInstallUpdateLockTarget(). */ export declare function hasActiveRestartLeaseTo(dir: string, nowMs: number): boolean; /** Claim the restart handoff while holding globalInstallUpdateLockTarget(). */ export declare function claimRestartLeaseTo(dir: string, nowMs: number): string | null; /** Bind a provisional claim while holding globalInstallUpdateLockTarget(). */ export declare function bindRestartLeaseTo(dir: string, id: string, pid: number, nowMs: number): boolean; export declare function clearRestartLeaseTo(dir: string, id: string): void; /** Read + delete the breadcrumb. Always deletes (fresh, stale, or corrupt) so * it fires at most once and never lingers into a later restart. Returns the * intent only when it is fresh. */ export declare function consumeRestartIntentTo(dir: string, nowMs: number): RestartIntent | null; export declare function claimRestartIntentForReportTo(dir: string, nowMs: number): RestartIntentReportClaim; export declare function hasPreparedRestartIntentTo(dir: string, nowMs: number): boolean; /** Write a `manual` breadcrumb only when no *fresh* breadcrumb already exists — * so a maintenance-written `update` breadcrumb is not clobbered * by the `botmux restart` it spawns. */ export declare function writeManualIntentIfAbsentTo(dir: string, nowMs: number, atIso: string): void; export declare function writeRestartAttemptIntentTo(dir: string, preferred: RestartIntent, nowMs: number, attemptId: string): RestartIntent; export declare function commitRestartIntentAttemptTo(dir: string, attemptId: string): boolean; export declare function removeRestartIntentAttemptTo(dir: string, attemptId: string): boolean; export declare function writeRestartIntent(intent: RestartIntent): void; export declare function clearRestartIntent(): void; export declare function consumeRestartIntent(nowMs?: number): RestartIntent | null; export declare function hasActiveRestartLease(nowMs?: number): boolean; export declare function claimRestartLease(nowMs?: number): string | null; export declare function clearRestartLease(id: string): void; export declare function claimRestartIntentForReport(nowMs?: number): RestartIntentReportClaim; export declare function hasPreparedRestartIntent(nowMs?: number): boolean; export declare function writeManualIntentIfAbsent(nowMs?: number): void; //# sourceMappingURL=restart-intent-store.d.ts.map