import { execFile, type ChildProcess } from 'node:child_process';
import type { ExecResult } from '../types/index.js';
export declare const execFileAsync: typeof execFile.__promisify__;
export declare const DEFAULT_MODEL = "sonnet";
export declare const JUDGE_MODEL = "haiku";
export declare const DEFAULT_TIMEOUT_MS = 600000;
export declare const MAX_BUFFER: number;
export interface TokenUsage {
    input_tokens?: number;
    output_tokens?: number;
    cache_read_input_tokens?: number;
    cache_creation_input_tokens?: number;
}
export interface ClaudeCliResponse {
    is_error?: boolean;
    duration_ms?: number;
    duration_api_ms?: number;
    usage?: TokenUsage;
    total_cost_usd?: number;
    result?: string;
    stop_reason?: string;
    num_turns?: number;
}
export interface OpenAiUsage {
    prompt_tokens?: number;
    completion_tokens?: number;
    prompt_tokens_details?: {
        cached_tokens?: number;
    };
}
export interface OpenAiResponse {
    usage?: OpenAiUsage;
    choices?: Array<{
        message?: {
            content?: string;
        };
        finish_reason?: string;
    }>;
    error?: {
        message?: string;
    };
}
export interface GeminiResponse {
    response?: string;
    stats?: {
        inputTokens?: number;
        outputTokens?: number;
    };
}
export interface AnthropicResponse {
    usage?: TokenUsage;
    content?: Array<{
        text?: string;
    }>;
    stop_reason?: string;
    error?: {
        message?: string;
    };
}
export interface ClaudeSdkQueryOptions {
    model?: string;
    systemPrompt?: string;
    cwd: string;
    permissionMode: 'bypassPermissions';
    allowDangerouslySkipPermissions: true;
    abortController: AbortController;
    env: NodeJS.ProcessEnv;
}
export interface ClaudeSdkQueryInput {
    prompt: string;
    options: ClaudeSdkQueryOptions;
}
export interface ClaudeSdkBaseMessage {
    type: string;
    message?: {
        role?: string;
        content?: Array<{
            type: string;
            text?: string;
            id?: string;
            name?: string;
            input?: unknown;
        }>;
    };
    tool_use_id?: string;
    content?: string | Array<{
        type: string;
        text?: string;
    }>;
    is_error?: boolean;
}
export interface ClaudeSdkResultMessage extends ClaudeSdkBaseMessage {
    type: 'result';
    result?: string;
    usage?: TokenUsage;
    total_cost_usd?: number;
    duration_api_ms?: number;
    duration_ms?: number;
    num_turns?: number;
    subtype?: string;
    errors?: string[];
}
export interface ClaudeSdkModule {
    query: (opts: ClaudeSdkQueryInput) => AsyncIterable<ClaudeSdkBaseMessage>;
}
export interface CodexEvent {
    type?: string;
    turn_id?: string;
    usage?: {
        input_tokens?: number;
        cached_input_tokens?: number;
        output_tokens?: number;
        reasoning_output_tokens?: number;
    };
    elapsed_ms?: number;
    stop_reason?: string;
    item?: {
        id?: string;
        type?: string;
        text?: string;
        command?: string;
        aggregated_output?: string;
        exit_code?: number | null;
        status?: string;
        path?: string;
        content?: string;
        query?: string;
        results?: unknown[];
        changes?: Array<{
            path?: string;
            kind?: string;
        }>;
        server?: string;
        tool?: string;
        arguments?: unknown;
        result?: unknown;
        message?: string;
    };
    error?: {
        message?: string;
    };
    ts?: number;
}
export interface ExecutorErrorLike {
    message?: string;
    name?: string;
    killed?: boolean;
    stdout?: string;
}
export declare function asErrorLike(err: unknown): ExecutorErrorLike;
export declare function errorMessage(err: unknown, fallback?: string): string;
export declare function parseJson<T>(content: string): T;
export declare function buildExecEnv(skillDir?: string | null): NodeJS.ProcessEnv;
export declare function timeoutExecResult(timeoutMs: number, durationMs: number): ExecResult;
export declare function interruptedExecResult(durationMs: number): ExecResult;
export declare function __resetSigintRegistryForTest(): void;
export interface SpawnHelperResult {
    stdout: string;
    stderr: string;
    code: number | null;
    signal: NodeJS.Signals | null;
    killedByTimeout: boolean;
    killedBySignal: NodeJS.Signals | null;
}
export interface SpawnHelperError extends Error {
    stdout?: string;
    stderr?: string;
    code?: number | null;
    signal?: NodeJS.Signals | null;
    killedByTimeout?: boolean;
    killedBySignal?: NodeJS.Signals | null;
}
export interface SpawnHelperOptions {
    cwd?: string;
    env?: NodeJS.ProcessEnv;
    /** kill child after this many ms; reject with killedByTimeout=true */
    timeoutMs?: number;
    /** stdout overflow threshold; reject when累计超限 */
    maxBuffer?: number;
    /** external abort signal; abort() 走跟 SIGINT 同一 grace 路径 */
    abortSignal?: AbortSignal;
}
/**
 * spawn child + 注册到全局 SIGINT registry。返回 { child, done } 让 caller 自己
 * 操作 stdin(写入 / 关闭),通过 done 等结果。
 *
 * 适用:claude / codex / gemini / script CLI 子进程。HTTP executor(*-api)用 fetch +
 * AbortSignal.timeout,自带 abort,不走这个。claude-sdk in-process 也不走。
 */
export declare function spawnWithSigintPropagation(command: string, args: string[], options?: SpawnHelperOptions): {
    child: ChildProcess;
    done: Promise<SpawnHelperResult>;
};
//# sourceMappingURL=shared.d.ts.map