/** * Non-blocking update checker. * * Pattern: register exit-hook + kick-off-background-fetch * - On startup: kick off background fetch (non-blocking) * - On process exit: read cache, print notice if newer version exists * - Check interval: 24 hours * - Notice appears AFTER command output, not before (same as npm/gh/yarn) * - Never delays or blocks the CLI command * * Cache is shared between the CLI process (writes latestVersion / latestExtensionVersion * via background fetch) and the daemon process (writes currentExtensionVersion / * extensionLastSeenAt via `recordExtensionVersion` on each hello). Writes use a * read-merge-write pattern so neither side clobbers the other. */ declare const EXTENSION_STALE_MS: number; interface UpdateCache { lastCheck?: number; latestVersion?: string; latestExtensionVersion?: string; currentExtensionVersion?: string; extensionLastSeenAt?: number; } interface GitHubReleaseAsset { name: string; } interface GitHubRelease { tag_name: string; assets?: GitHubReleaseAsset[]; } interface NoticeInputs { cliVersion: string; cache: UpdateCache | null; now: number; } interface NoticeLines { cli?: string; extension?: string; } /** Pure function: derive notice text from cache state. Exported for tests. */ declare function buildUpdateNotices({ cliVersion, cache, now }: NoticeInputs): NoticeLines; /** * Register a process exit hook that prints an update notice if a newer * version was found on the last background check. * Notice appears after command output — same pattern as npm/gh/yarn. * Skipped during --get-completions to avoid polluting shell completion output. */ export declare function registerUpdateNoticeOnExit(): void; declare function extractLatestExtensionVersionFromReleases(releases: GitHubRelease[]): string | undefined; /** * Kick off a background fetch to npm registry. Writes to cache for next run. * Fully non-blocking — never awaited. */ export declare function checkForUpdateBackground(): void; /** * Stash the current extension version into the shared cache. Called by the * daemon on each hello handshake. Lets the next CLI process compare against * the latest known release and print an exit notice without any extra I/O. */ export declare function recordExtensionVersion(version: string): void; /** * Get the cached latest extension version (if available). * Used by `opencli doctor` to report extension updates. */ export declare function getCachedLatestExtensionVersion(): string | undefined; export { extractLatestExtensionVersionFromReleases as _extractLatestExtensionVersionFromReleases, buildUpdateNotices as _buildUpdateNotices, EXTENSION_STALE_MS as _EXTENSION_STALE_MS, };