import { type SudoAuthOutcome } from "../tools/sudo-session.js"; export declare const REPO = "pentoshi007/clai"; export declare const PACKAGE_NAME = "@pentoshi/clai"; export declare const DEFAULT_MIRROR_BASE = "https://downloads.clai.aniketpandey.website"; export declare function mirrorBaseUrl(): string; export type InstallMethodType = "npm" | "bun" | "brew" | "scoop" | "binary" | "dev" | "unknown"; export interface InstallMethod { readonly type: InstallMethodType; readonly detail: string; } export interface PlatformTarget { readonly platform: "darwin" | "linux" | "windows"; readonly arch: "arm64" | "x64"; /** Release asset name without extension, e.g. clai-bun-darwin-arm64. */ readonly asset: string; /** Filename as published, with .exe appended on Windows. */ readonly file: string; } export interface DetectEnv { readonly argv1: string; readonly execPath: string; readonly platform: NodeJS.Platform; readonly home: string; npmRoot?: string; bunRoot?: string; brewPrefix?: string; scoopShimsDir?: string; } export declare function currentPlatformTarget(platform?: NodeJS.Platform, arch?: NodeJS.Architecture): PlatformTarget; export declare function detectInstallMethod(env: DetectEnv): InstallMethod; export declare function resolveInstallEnv(): Promise; export interface DownloadProgress { readonly receivedBytes: number; readonly totalBytes?: number | undefined; } export declare function downloadBinary(url: string, timeoutMs?: number, onProgress?: (progress: DownloadProgress) => void, signal?: AbortSignal): Promise; export interface UpdateInstallResult { readonly ok: boolean; readonly method: InstallMethodType; readonly message: string; /** True when the new build only takes effect after the process restarts. */ readonly needsRestart: boolean; } export interface PerformUpdateOptions { readonly version: string; readonly method: InstallMethod; readonly target?: PlatformTarget; readonly repo?: string; readonly execPath?: string; readonly log?: (line: string) => void; /** inherit: let the child write to the terminal (CLI). pipe: capture + log (TUI). */ readonly stdio?: "inherit" | "pipe"; readonly onProgress?: ((progress: UpdateProgress) => void) | undefined; readonly signal?: AbortSignal | undefined; readonly requestSecret?: SecretRequester | undefined; readonly elevation?: UpdateElevation | undefined; } export type UpdateProgress = { readonly phase: "downloading"; readonly receivedBytes: number; readonly totalBytes?: number | undefined; } | { readonly phase: "verifying"; } | { readonly phase: "installing"; readonly detail?: string | undefined; }; export declare const ELEVATION_TIMEOUT_MS = 20000; export interface UpdateElevation { readonly auth: SudoAuthOutcome; } export type SecretRequester = (request: { title: string; prompt: string; }) => Promise; export declare function installDirectBinary(options: Required> & PerformUpdateOptions): Promise; export declare function installViaPackageManager(options: Required> & PerformUpdateOptions): Promise; export declare function performUpdate(options: PerformUpdateOptions): Promise;