/**
 * Proxy Chain Builder (Concern F — tool-sanitization + codex-reasoning layers)
 *
 * Orchestrates the two env-dependent proxy layers that sit between the
 * Claude CLI process and the upstream CLIProxy / remote endpoint:
 *
 *   1. ToolSanitizationProxy — wraps ANTHROPIC_BASE_URL to sanitize tool names/schemas
 *   2. CodexReasoningProxy   — only for single-provider codex, wraps tool-san URL
 *
 * Placement in the execution sequence
 * ─────────────────────────────────────
 * The HTTPS tunnel (HttpsTunnelProxy) is started BEFORE this function is called,
 * because its tunnelPort is needed by both imageAnalysisResolution and the
 * first-pass buildClaudeEnvironment.  This function receives the result of that
 * first-pass env as `initialEnvVars`, from which it extracts ANTHROPIC_BASE_URL
 * to wire up the tool-sanitization proxy.
 *
 * Lifecycle: proxies are started (spawned) but NOT stopped here.  The caller
 * is responsible for registering cleanup handlers (setupCleanupHandlers).
 */
import { ToolSanitizationProxy, type ToolSanitizationProxyConfig } from '../proxy/tool-sanitization-proxy';
import { CodexReasoningProxy, type CodexReasoningProxyConfig } from '../ai-providers/codex-reasoning-proxy';
import type { CLIProxyProvider, ExecutorConfig, ResolvedProxyConfig } from '../types';
import type { ThinkingConfig } from '../../config/unified-config-types';
type ToolSanitizationProxyCtor = new (config: ToolSanitizationProxyConfig) => ToolSanitizationProxy;
type CodexReasoningProxyCtor = new (config: CodexReasoningProxyConfig) => CodexReasoningProxy;
export interface ProxyChainContext {
    /** Provider being executed */
    provider: CLIProxyProvider;
    /** True when routing to a remote proxy host */
    useRemoteProxy: boolean;
    /** Resolved proxy configuration (host, port, protocol, auth, …) */
    proxyConfig: ResolvedProxyConfig;
    /** Executor configuration */
    cfg: ExecutorConfig;
    /**
     * Initial environment from first-pass buildClaudeEnvironment.
     * ANTHROPIC_BASE_URL and ANTHROPIC_MODEL* keys are consumed here.
     */
    initialEnvVars: Partial<Record<string, string>>;
    /** Thinking mode override (value or undefined for default) */
    thinkingOverride: string | number | undefined;
    /** Thinking configuration from unified config */
    thinkingCfg: ThinkingConfig;
    verbose: boolean;
    log: (msg: string) => void;
    /**
     * Optional constructor overrides for unit testing.
     * Production code omits these; tests inject stubs to avoid real HTTP servers.
     */
    _ToolSanitizationProxy?: ToolSanitizationProxyCtor;
    _CodexReasoningProxy?: CodexReasoningProxyCtor;
}
export interface ProxyChainResult {
    toolSanitizationProxy: ToolSanitizationProxy | null;
    toolSanitizationPort: number | null;
    codexReasoningProxy: CodexReasoningProxy | null;
    codexReasoningPort: number | null;
}
/**
 * Build and start the two env-dependent proxy layers (tool-sanitization and
 * codex-reasoning).  Each layer is started independently; a failed start is
 * swallowed with a verbose warning so the session can continue degraded.
 *
 * Note: HttpsTunnelProxy is started inline in the orchestrator (index.ts)
 * before this function is called, because tunnelPort is required for
 * imageAnalysisResolution and the first-pass buildClaudeEnvironment.
 */
export declare function buildProxyChain(context: ProxyChainContext): Promise<ProxyChainResult>;
export {};
//# sourceMappingURL=proxy-chain-builder.d.ts.map