/** * Per-mode auto-update polling runners. * * These extract the git and npm `runCheck` bodies out of `runDaemonInner` so the * end-to-end polling path — detect an update, hold off (jitter), RE-VALIDATE the * target after the wait, and apply only the still-current one — is a focused, * testable unit rather than a closure buried in the 3.5k-line lifecycle file. * * The mode differences (which check, which installer, log wording) live here. * Each check result is mapped onto the gate's mode-neutral * {@link UpdateCheckOutcome}; the cross-cutting rollout state machine * (hold-off, persisted deadline, shutdown abort, isUpdating) is * owned by the {@link UpdateHoldoffGate}; each runCheck binds its mode's rollout * step to the gate once. `auto-update-polling.ts` builds the * daemon's gate, these runChecks and their timers. */ import { type CommitCheckStatus, type NpmVersionStatus } from './auto-update.js'; import type { UpdateCheckOutcome, UpdateHoldoffGate } from './auto-update-holdoff-gate.js'; import type { LastUpdateCheck } from './state.js'; import type { ResolvedAutoUpdateConfig } from '../config.js'; /** An npm version check as a gate outcome. `no-target` is definitive: the * channel has nothing to install until a release is published to it. */ export declare function npmCheckOutcome(status: NpmVersionStatus): UpdateCheckOutcome; /** * The mode-neutral tail of the "update available" log line, so the git and npm * paths word the three hold-off cases identically. */ export declare function describeUpdateHold(holdMs: number, resumed: boolean): string; /** A git ref check as a gate outcome. */ export declare function gitCheckOutcome(status: CommitCheckStatus): UpdateCheckOutcome; /** * Re-check the npm channel target after the hold-off. Private to the runner — an * adapter over the already-public `checkForNpmVersionUpdate`, not part of the * daemon's API. */ export declare function resolveCurrentNpmTarget(log: (msg: string) => void, allowPrerelease: boolean, channel?: string): Promise; /** Git counterpart to {@link resolveCurrentNpmTarget}: re-check the ref tip. Runner-private. */ export declare function resolveCurrentGitTarget(au: ResolvedAutoUpdateConfig, log: (msg: string) => void): Promise; /** What npm mode needs to install an available version. */ export interface NpmAutoApply { gate: UpdateHoldoffGate; nodeRole: 'edge' | 'core'; /** Trigger the supervised restart after a successful install. */ onRestart: () => Promise; } export interface NpmUpdateRunCheckDeps { log: (msg: string) => void; lastUpdateCheck: LastUpdateCheck; allowPrerelease: boolean; channel?: string; /** null = version-check-only (auto-apply disabled): detect + record, never apply. */ autoApply: NpmAutoApply | null; } /** * Build the npm-mode polling `runCheck`. Always refreshes `lastUpdateCheck` (so * `/api/status` is current even when auto-apply is off); with auto-apply, hands * the check's outcome to the gate — including the post-hold-off re-check that * skips a version withdrawn during the wait. */ export declare function createNpmUpdateRunCheck(deps: NpmUpdateRunCheckDeps): () => Promise; export interface GitUpdateRunCheckDeps { gate: UpdateHoldoffGate; log: (msg: string) => void; lastUpdateCheck: LastUpdateCheck; au: ResolvedAutoUpdateConfig; onRestart: () => Promise; } /** * Build the git-mode polling `runCheck`. Detects the remote ref tip, refreshes * `lastUpdateCheck`, and hands the outcome to the gate — which re-resolves the * ref AFTER the hold-off so the CURRENT tip is applied, not the commit captured * before the (possibly long) wait. */ export declare function createGitUpdateRunCheck(deps: GitUpdateRunCheckDeps): () => Promise; //# sourceMappingURL=auto-update-runner.d.ts.map