/** * The cadence half of the platform's one update mechanism: WHEN a * long-running process looks for a newer release. (self-update.ts owns WHAT * happens when one is found, download, verify, swap, keep previous.) * * One shared loop, three rules, so every long-running surface behaves the * same way: * * - the FIRST check runs shortly after start (a boot-settle delay, ~30s by * default), not one full cadence out. A process that was down while three * releases shipped must not stay stale for another hour just because it * restarted; a machine that has only just booted still gets a moment to * bring up its network first. * - after that, checks run on the configured cadence (hourly by default). * - a check that found an update but could not apply it yet, the process is * mid-work and a swap only ever happens at an idle moment, re-tries on a * short retry cadence instead of waiting a full interval. * * Timers are injectable, so the schedule is provable under test without real * time passing, and the timer never keeps the host process alive. */ /** What one iteration decided: keep the steady cadence, or come back soon. */ export type PeriodicCheckOutcome = 'settled' | 'deferred'; export declare const BOOT_SETTLE_CHECK_DELAY_MS = 30000; export declare const DEFAULT_UPDATE_CHECK_INTERVAL_MS: number; export declare const DEFAULT_UPDATE_BUSY_RETRY_MS: number; export interface PeriodicUpdateLoopOptions { /** Delay before the first check. Default 30s; never longer than one cadence. */ readonly firstCheckDelayMs?: number | undefined; /** Steady-state cadence between checks. Default 1h. */ readonly checkIntervalMs?: number | undefined; /** Cadence used while an update waits for an idle moment. Default 60s. */ readonly busyRetryMs?: number | undefined; /** One iteration: check, and apply if the moment allows. */ readonly runCheck: () => Promise; /** Called when an iteration throws; the loop keeps its cadence either way. */ readonly onError?: ((error: unknown) => void) | undefined; readonly setTimer?: ((fn: () => void, ms: number) => ReturnType) | undefined; readonly clearTimer?: ((timer: ReturnType) => void) | undefined; } export declare class PeriodicUpdateLoop { private readonly options; private timer; private stopped; private running; private deferred; constructor(options: PeriodicUpdateLoopOptions); get checkIntervalMs(): number; get busyRetryMs(): number; /** * The boot-settle delay, capped at one full cadence: a surface configured to * check every 30 seconds must not wait longer for its first check than for * every check after it. */ get firstCheckDelayMs(): number; /** Begin the loop. The first check runs after the boot-settle delay. */ start(): void; stop(): void; /** One iteration; exposed so tests drive the loop without waiting on real time. */ tick(): Promise; private scheduleNext; } //# sourceMappingURL=update-schedule.d.ts.map