/** * reachability-check.ts, the boot-time answer to "is this the build you are * actually reaching, and is it the current one". * * It wires the real host inputs (a process's executable, the real PATH, * existsSync/realpathSync, and a bounded ` --version` spawn) into the pure * scan in path-shadow.ts and the pure wording in reachability-notice.ts, and * hands back lines. WHERE those lines go, a system-message router, stdout * before the alternate screen, a log, is the product's, because only the * product knows what it has to print with at that moment. * * Cost discipline, because this runs on every start: * - the first scan is existence-only: no process is spawned while there is * nothing to report, which is the overwhelmingly common case; * - versions are probed only after a shadow has already been found, and only * with `--version`, bounded by a short timeout; * - the latest-release lookup only happens when it can actually change what * the user should do: a package-managed or source install (which will never * swap itself), or an install that has just been found unreachable. A * healthy binary install has already been brought to the latest release by * the launch auto-updater, so asking again would be a network round trip * that can only confirm what just happened. * * Every failure is swallowed. A reachability check must never block or crash * boot. */ import { type ShadowScanResult } from './path-shadow.js'; import { type ReachabilityNotice } from './reachability-notice.js'; /** The commands one install of this platform places side by side in a directory. */ export declare const INSTALLED_COMMANDS: readonly ["goodvibes", "goodvibes-daemon", "goodvibes-agent"]; /** How long the latest-release lookup may take before startup moves on without it. */ export declare const LATEST_LOOKUP_TIMEOUT_MS = 2500; /** * Runs ` --version` and returns its first line. Never inherits stdio, so * a binary that tries to draw a terminal cannot disturb this one. */ export declare function probeVersionLine(path: string): string | undefined; /** * The PATH directory that provides THIS running executable, which is the * position everything else is measured against. * * Preferred answer: the first PATH entry whose `/` resolves, * through symlinks, to this same file. That is exactly "where the shell would * find me", and it is right for a linked package install as well as a * standalone binary. * * Fallback, for a standalone binary only: the directory the executable sits in. * That directory being absent from PATH is itself worth reporting, an * installed binary nobody can reach by name. For a package-managed install the * executable lives inside node_modules, which is never on PATH and never meant * to be, so there is nothing honest to say and the check stays silent. */ export declare function resolveSelfDirectory(input: { readonly execPath: string; readonly command: string; readonly pathEntries: readonly string[]; readonly realPath: (path: string) => string; readonly isExecutableFile: (path: string) => boolean; }): string | undefined; export interface ReachabilityCheckResult { readonly notices: readonly ReachabilityNotice[]; readonly scan?: ShadowScanResult | undefined; } export interface ReachabilityCheckInput { readonly execPath: string; readonly pathValue: string | undefined; readonly homeDir: string; readonly runningVersion: string; readonly commandName?: string | undefined; /** * The calling product's package name, used only to name the upgrade command * for a package-managed install. A binary install is placed by the platform * installer; a package-managed one is the user's package manager to move. */ readonly packageName: string; /** Resolves the newest released version, or undefined when it cannot be determined. */ readonly resolveLatest: () => Promise; readonly isExecutableFile?: ((path: string) => boolean) | undefined; readonly realPath?: ((path: string) => string) | undefined; readonly probeVersion?: ((path: string) => string | undefined) | undefined; } /** * The whole check, with the network lookup injected so tests never reach it. * Returns the notices to print; an empty list is the healthy case. */ export declare function runReachabilityCheck(input: ReachabilityCheckInput): Promise; /** * Bound a latest-release lookup so a slow network cannot hold up boot: whatever * the lookup has not answered within `timeoutMs` is treated as unknown, which * reachability-notice.ts renders as silence rather than a guess. */ export declare function boundedLatestRelease(lookup: () => Promise, timeoutMs?: number): Promise; /** * Run the check and hand every line to `emit`, in the order it should be read. * Returns the lines emitted so a caller that printed them before its alternate * screen took over can re-surface them afterwards. Swallows everything, a * reachability check must never block or crash boot. */ export declare function announceReachability(input: ReachabilityCheckInput, emit: (line: string) => void): Promise; //# sourceMappingURL=reachability-check.d.ts.map