/** * reachability-notice.ts, the two ways a running build can be the wrong one, * stated in plain words at startup. * * The platform's guarantee is that clients auto-update at startup, the daemon * checks hourly, and nothing ever drifts. Two things break that guarantee * without breaking anything visible: * * 1. Another copy of this command sits EARLIER on PATH. The updater keeps * maintaining the copy it installed; the shell keeps running the other * one. Both installs "succeed", the version number reports itself * current, and an older build answers every question. * 2. This build is simply behind the latest release and, for whatever * reason, did not update itself, a package-managed install, a failed * swap, a check that could not reach the network. * * Either way the user finds out by being told a capability does not exist. A * build that knows it is not the current one must say so before anything else, * so this module turns those two facts into lines and reachability-check.ts * next door hands them to whatever a product prints with. * * Pure by construction: it is handed a completed scan and two version strings * and decides only what to say. */ import { type ShadowScanResult } from './path-shadow.js'; export type ReachabilityNoticeKind = 'shadowed' | 'not-on-path' | 'behind'; export interface ReachabilityNotice { readonly kind: ReachabilityNoticeKind; /** Plain lines, already in the order they should be read. */ readonly lines: readonly string[]; } export interface ReachabilityNoticeInput { /** The completed PATH scan for this command. */ readonly scan: ShadowScanResult; /** The version this process is running. */ readonly runningVersion: string; /** The newest released version, or undefined when it could not be determined. */ readonly latestVersion?: string | undefined; /** The exact command that brings this install up to date. */ readonly updateCommand: string; } /** * Builds the notices for this startup. Returns an empty list for the healthy * case, one reachable copy, running the latest release, so a normal start * says nothing at all. */ export declare function buildReachabilityNotices(input: ReachabilityNoticeInput): ReachabilityNotice[]; /** One flat list of lines, for a surface that prints rather than groups. */ export declare function reachabilityNoticeLines(notices: readonly ReachabilityNotice[]): string[]; //# sourceMappingURL=reachability-notice.d.ts.map