/** * Update check: query the published "latest" botmux version and the GitHub * release notes accumulated since the running version. Powers the Settings * "version & update" card (manual update flow) — see dashboard.ts /api/update/*. * * Every network call is best-effort: timeout-bounded and returns null / [] on * failure (offline, rate-limited, registry hiccup) so the card degrades to * "couldn't check" rather than erroring. The version math is pure (unit tested). */ import { type GithubAuthResolveOptions } from './github-auth.js'; export interface ReleaseNote { /** Semver without leading 'v' (e.g. "2.85.1"). */ version: string; /** Release display name / title (GitHub `name`), falls back to the tag. */ name: string; /** Markdown release body (the CI-published changelog). */ body: string; /** Canonical release URL. */ url: string; /** ISO publish timestamp, or null. */ publishedAt: string | null; } export interface ParsedVersion { major: number; minor: number; patch: number; /** Pre-release identifiers ([] for a stable release). */ pre: string[]; } /** Parse "X.Y.Z" / "vX.Y.Z" / "X.Y.Z-canary.1". null on anything else. */ export declare function parseVersion(raw: string): ParsedVersion | null; /** A stable (non-prerelease) semver string. */ export declare function isStableVersion(raw: string): boolean; /** Canonical stable package version accepted from a privileged API body. */ export declare function isCanonicalStableVersion(raw: string): boolean; /** * Semver precedence: -1 if ab. An unparseable version * sorts smallest (so garbage never masquerades as "newer"). A stable release * outranks a pre-release of the same X.Y.Z, and pre-release identifiers compare * per semver §11 (numeric < numeric numerically, alphanumeric lexically, * numeric < alphanumeric, a longer set of identifiers > a shorter prefix). */ export declare function compareVersions(a: string, b: string): number; /** Is `latest` strictly newer than `current`? */ export declare function isNewerVersion(latest: string, current: string): boolean; export interface FetchOpts { timeoutMs?: number; fetchImpl?: typeof fetch; auth?: GithubAuthResolveOptions; } /** * The npm registry's `latest` dist-tag version — the authoritative target for * both npm and pnpm updates. null on any failure (offline, non-200, * malformed body, or a version string we can't parse). */ export declare function fetchLatestVersion(opts?: FetchOpts): Promise; export interface RollbackVersion { version: string; publishedAt: string | null; } export interface RollbackVersionsResult { ok: boolean; versions: RollbackVersion[]; } /** Stable published versions older than `current`, newest first. */ export declare function selectRollbackVersions(raw: unknown, current: string, max?: number): RollbackVersion[]; /** Fetch the npm packument used to offer an allow-listed rollback target. */ export declare function fetchRollbackVersions(current: string, opts?: FetchOpts & { max?: number; }): Promise; export interface ChangelogResult { /** false when the GitHub fetch failed (offline / rate-limited / malformed) — * the caller shows a "view on GitHub" fallback instead of "no releases". */ ok: boolean; /** true on HTTP 403 — GitHub's unauthenticated API is 60 req/h per IP, easily * exhausted behind shared NAT. Lets the UI explain the failure precisely. */ rateLimited?: boolean; releases: ReleaseNote[]; } /** * Stable GitHub releases strictly newer than `current`, newest first, capped at * `max`. Pre-releases (canary/beta/rc) are excluded — the card mirrors exactly * what `@latest` would install. Returns `{ ok:false }` on any failure so the UI * distinguishes "couldn't load" from a genuinely empty (already-latest) list. */ export declare function fetchReleasesSince(current: string, opts?: FetchOpts & { max?: number; }): Promise; /** * Pure: filter the raw GitHub releases array to published, stable notes strictly * newer than `current`, newest first, capped at `max`. Exported for tests. */ export declare function selectReleasesSince(raw: unknown[], current: string, max?: number): ReleaseNote[]; //# sourceMappingURL=update-check.d.ts.map