export declare const CACHE_DIR: string; export declare const DEBUG_LOG: string; /** Providers are tried in this order unless overridden. */ export declare const DEFAULT_PROVIDER_ORDER: readonly ["claude", "codex", "kimi"]; export type ProviderId = (typeof DEFAULT_PROVIDER_ORDER)[number]; export type FailureKind = "missing" | "spawn" | "auth" | "limit" | "timeout" | "transient" | "empty" | "oversize" | "unknown"; /** * Linux caps a single argv string at MAX_ARG_STRLEN (128 KB) regardless of the * much larger ARG_MAX total. Stay under it with headroom for the instructions. */ export declare const MAX_PROMPT_ARG_BYTES: number; export interface RunContext { /** Per-run scratch directory; providers that need an output file write here. */ scratchDir: string; } interface RawRun { stdout: string; stderr: string; code: number | null; signal: NodeJS.Signals | null; spawnError?: string; timedOut: boolean; } export interface Attempt { provider: ProviderId; label: string; argv: string[]; ok: boolean; text: string; /** Human-readable failure reason; undefined when ok. */ error?: string; kind?: FailureKind; hint?: string; code: number | null; signal: NodeJS.Signals | null; timedOut: boolean; durationMs: number; stdout: string; stderr: string; } export interface ProviderStatus { id: ProviderId; label: string; installed: boolean; /** undefined when the CLI gives no reliable way to check. */ authed?: boolean; installHint: string; authHint: string; } export declare function stripAnsi(text: string): string; export declare function commandExists(cmd: string): boolean; /** Undo kimi's text layout: "• " on the first line, two-space indent after. */ export declare function undentTextFormat(text: string): string; /** * Resolve which providers to try, in order. * `only` (--provider) wins over CURL_REVIEW_PROVIDERS, which wins over the default. */ export declare function resolveProviderOrder(only?: string): ProviderId[]; /** Installed-and-authenticated snapshot, for the info table and menu gating. */ export declare function probeProviders(order: ProviderId[]): ProviderStatus[]; export declare const DEFAULT_TIMEOUT_MS = 180000; export declare function resolveTimeoutMs(): number; /** Run one provider, retrying once with reduced flags if the CLI rejected them. */ export declare function runProvider(id: ProviderId, prompt: string, script: string, timeoutMs: number): Promise; export declare function classifyFailure(raw: RawRun, message: string): FailureKind; export declare function describeFailureKind(kind: FailureKind | undefined): string; /** * Smallest possible real request, used by `doctor` to tell a working provider * from one that merely looks configured. Deliberately not a review prompt — * we're testing the transport and credentials, not the model's judgement. */ export declare const HEALTHCHECK_PROMPT = "Reply with the single word OK and nothing else. Do not use any tools."; export interface HealthResult { status: ProviderStatus; attempt?: Attempt; } /** * Round-trip every installed provider. `claude auth status` reports a live * session when the refresh token is already dead, so the only trustworthy * check is an actual request. */ export declare function checkProviderHealth(order: ProviderId[], timeoutMs: number): Promise; /** Persist full provider output so a failure is debuggable after the fact. */ export declare function writeDebugLog(url: string, attempts: Attempt[]): string | undefined; export {};