/** * Update orchestration for oh-my-codex. * * The launch-time checker is intentionally passive, non-fatal, and throttled. * The explicit `omx update` command uses the same executor but bypasses the * launch-time cadence so a user request always checks npm immediately. */ import { spawn, spawnSync } from 'child_process'; export interface UpdateState { last_checked_at: string; last_seen_latest?: string; } export interface UserInstallStamp { installed_version: string; setup_completed_version?: string; updated_at: string; } export interface UpdateExecutionResult { status: 'updated' | 'scheduled' | 'up-to-date' | 'declined' | 'failed' | 'unavailable'; currentVersion: string | null; latestVersion: string | null; } type RunGlobalUpdateResult = { ok: boolean; stderr: string; }; type RunSetupRefreshResult = { ok: boolean; stderr: string; }; type RunDeferredUpdateResult = { ok: boolean; stderr: string; logPath?: string; }; type SpawnSyncLike = typeof spawnSync; type SpawnLike = typeof spawn; export type AutoUpdateMode = 'disabled' | 'prompt' | 'defer'; export declare function resolveAutoUpdateMode(value?: string | undefined): AutoUpdateMode; export declare function isNewerVersion(current: string, latest: string): boolean; export declare function shouldCheckForUpdates(nowMs: number, state: UpdateState | null, intervalMs?: number): boolean; declare function writeUpdateState(cwd: string, state: UpdateState): Promise; declare function fetchLatestVersion(timeoutMs?: number): Promise; declare function getCurrentVersion(): Promise; declare function runGlobalUpdate(): RunGlobalUpdateResult; export declare function runDeferredGlobalUpdate(cwd: string, spawnProcess?: SpawnLike, platform?: NodeJS.Platform, parentPid?: number): RunDeferredUpdateResult; declare function askYesNo(question: string): Promise; interface UpdateDependencies { askYesNo: typeof askYesNo; fetchLatestVersion: typeof fetchLatestVersion; getCurrentVersion: typeof getCurrentVersion; readUserInstallStamp: typeof readUserInstallStamp; runGlobalUpdate: typeof runGlobalUpdate; runDeferredGlobalUpdate: typeof runDeferredGlobalUpdate; runSetupRefresh: (cwd: string) => Promise; writeUpdateState: typeof writeUpdateState; } export declare function readUserInstallStamp(path?: string): Promise; export declare function writeUserInstallStamp(stamp: UserInstallStamp, path?: string): Promise; export declare function isInstallVersionBump(currentVersion: string | null | undefined, stamp: UserInstallStamp | null): boolean; export declare function resolveInstalledCliEntry(globalInstallRoot: string): Promise; export declare function spawnInstalledSetupRefresh(cliEntry: string, cwd: string, spawnProcess?: SpawnSyncLike): RunSetupRefreshResult; export declare function runImmediateUpdate(cwd?: string, dependencies?: Partial): Promise; export declare function maybeCheckAndPromptUpdate(cwd: string, dependencies?: Partial): Promise; export {}; //# sourceMappingURL=update.d.ts.map