export declare const UPGRADE_MARKER_PATH: string; /** * Persistent failure history. The helper runs in its OWN process, so an * install failure has to be recorded on disk - otherwise the freshly * restarted daemon would retry the same broken upgrade every check and loop. */ export declare const UPGRADE_STATE_PATH: string; /** Full transcript of every upgrade attempt (helper stdout+stderr). */ export declare const UPGRADE_LOG_PATH: string; /** Appended summaries land in the daemon log so `doctor` can see them. */ export declare const DAEMON_LOG_PATH: string; export interface UpgradeMarker { /** Version the machine is upgrading FROM. */ from: string; /** Version it is upgrading TO (null when the target is unknown). */ to: string | null; startedAt: string; /** Helper pid once it is running; absent during dispatch. */ pid?: number; /** Set by the helper: 'running' while installing, 'failed' after a rollback. */ state?: 'running' | 'failed'; } export declare function writeUpgradeMarker(marker: UpgradeMarker, path?: string): void; export declare function readUpgradeMarker(path?: string): UpgradeMarker | null; export declare function clearUpgradeMarker(path?: string): void; /** * True while an upgrade helper owns this machine: a young marker whose * holder is alive (or, before the helper stamps its pid, one younger than * 90s). Stale markers return false so a crashed helper can never wedge the * supervisor forever. `path`/`now` exist for the unit tests. */ export declare function upgradeInProgress(path?: string, now?: number): boolean; /** Append a line to the daemon log (the upgrade helper has no logger). */ export declare function appendDaemonLog(line: string): void; export interface UpgradeState { failures: number; lastFailureAt?: number; lastError?: string; /** * Version the recorded failures happened ON. Read with the installed version * so history against a tree we no longer run cannot count toward MAX_FAILURES. */ from?: string; } /** * Failure history, IGNORED when it was recorded against a different installed * version. * * A failure is a property of a tree, not of the machine: if `npm i -g` left the * old version half-written and the daemon came back up on 0.22.6, then a * counter written while 0.21.85 was installed says nothing about whether the * next attempt against 0.22.6 will work. Counting it anyway let one old EBUSY * incident permanently wedge self-updating until a human ran * `auto-upgrade on` by hand - the exact "it silently stopped working" symptom. */ export declare function readUpgradeStateFor(installedVersion: string, path?: string): UpgradeState | null; export declare function readUpgradeState(path?: string): UpgradeState | null; /** * Called by the helper after a failed install (before it rolls back). * * `fromVersion` is stamped so `readUpgradeStateFor` can tell whether the * failures still describe the tree we are running. */ export declare function recordUpgradeFailure(error?: string, fromVersion?: string, path?: string): void; /** Called on a successful upgrade and by `auto-upgrade on`. */ export declare function resetUpgradeState(path?: string): void;