export interface CodexConfig {
    apiKey?: string;
    baseUrl?: string;
    model?: string;
    fallbackModel?: string;
    fallbackModels?: string[];
    maxRetries?: number;
    retryDelayMs?: number;
}
type StreamEventHandler = (event: any) => void | Promise<void>;
type StreamTextHandler = (delta: string, fullText: string) => void | Promise<void>;
type UsageHandler = (usage: CodexUsageSummary | null) => void | Promise<void>;
export interface CodexRunOptions {
    timeoutMs?: number;
    streamIdleTimeoutMs?: number;
    maxRetries?: number;
    processWorkingDirectory?: string;
    threadOptions?: CodexThreadOptions;
    threadKey?: string;
    reuseThread?: boolean;
    fallbackModels?: string[];
    failOnStreamHandlerError?: boolean;
    onStreamEvent?: StreamEventHandler;
    onStreamText?: StreamTextHandler;
    onUsage?: UsageHandler;
}
export interface CodexUsageSummary {
    inputTokens: number;
    cachedInputTokens: number;
    outputTokens: number;
}
export type CodexThreadOptions = {
    model?: string;
    sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access';
    workingDirectory?: string;
    skipGitRepoCheck?: boolean;
    modelReasoningEffort?: 'minimal' | 'none' | 'low' | 'medium' | 'high' | 'xhigh';
    networkAccessEnabled?: boolean;
    webSearchMode?: 'disabled' | 'cached' | 'live';
    webSearchEnabled?: boolean;
    approvalPolicy?: 'never' | 'on-request' | 'on-failure' | 'untrusted';
    additionalDirectories?: string[];
};
export declare class CodexClient {
    private static readonly PING_PROMPT;
    private static readonly MODEL_UNAVAILABLE_FALLBACK_FILE;
    private static readonly DEFAULT_MODEL_UNAVAILABLE_TTL_MS;
    private static readonly MIN_MODEL_UNAVAILABLE_TTL_MS;
    private static readonly modelFallbackPreferences;
    private static modelFallbackPreferencesLoaded;
    private static modelFallbackPreferencesLoadPromise;
    private static cwdFallbackRunning;
    private codex;
    private codexInit;
    private readonly threadCache;
    private readonly debugEnabled;
    private readonly streamEnabled;
    private readonly cleanZdotdirEnabled;
    private zDotDir;
    private readonly defaultTimeoutMs;
    private readonly pingEnabled;
    private readonly pingTimeoutMs;
    private readonly modelUnavailableTtlMs;
    private readonly config;
    private readonly defaultThreadOptions;
    constructor(config: CodexConfig);
    run(prompt: string, options?: CodexRunOptions): Promise<string>;
    private runStreamedOnce;
    private normalizeStreamIdleTimeoutMs;
    private runOnce;
    private startThread;
    private extractContent;
    private handleStreamEvent;
    private normalizeUsageSummary;
    private normalizeUsageToken;
    private emitUsageSummary;
    private handleStreamItem;
    private logStreamText;
    private extractPartText;
    private withTimeout;
    private normalizeRetryCount;
    private normalizeRetryDelay;
    private resolveModelSequence;
    private collectFallbackModels;
    private normalizeModelList;
    private applyModelOverride;
    private isModelAvailabilityError;
    private isRetryableError;
    private isCodexEnvironmentError;
    private recoverCodexEnvironment;
    private shouldApplyProcessCwdFallback;
    private resolveProcessWorkingDirectory;
    private applyProcessCwdFallback;
    private withProcessWorkingDirectoryFallback;
    private normalizeOptionalString;
    private resolveModelUnavailableTtlMs;
    private ensureModelFallbackPreferencesLoaded;
    private pruneModelFallbackPreferences;
    private getModelFallbackPreference;
    private rememberModelFallbackPreference;
    private clearModelFallbackPreference;
    private persistModelFallbackPreferences;
    private sleep;
    private ensureCodex;
    private log;
    private resolveDefaultTimeoutMs;
    private resolveStreamEnabled;
    private resolveCleanZdotdirEnabled;
    private buildCodexEnv;
    private ensureCodexHome;
    private ensureZdotdir;
    private resolvePingEnabled;
    private resolvePingTimeoutMs;
    private resolveDefaultThreadOptions;
    private mergeThreadOptions;
    private normalizeApprovalPolicy;
    private normalizeSandboxMode;
    private normalizeWebSearchMode;
    private normalizeModelReasoningEffort;
    private normalizeModelReasoningEffortForModel;
    private normalizeBoolean;
    private formatThreadOptions;
    private buildThreadOptionsKey;
    private buildThreadCacheKey;
    private isPingPrompt;
    private runPing;
}
export {};
