/** * Claude Executor Factory * * Provides automatic selection between SDK and CLI executors with fallback logic. * * @module agents/claude/executor-factory */ import type { ClaudeCodeConfig } from "./types/config.js"; import type { IAgentExecutor } from "../types/agent-executor.js"; /** * Executor preference for factory */ export type ExecutorPreference = "sdk" | "cli" | "auto"; /** * Combined config that works with both executors */ export interface ClaudeExecutorConfig extends ClaudeCodeConfig { /** * Model to use (SDK only, ignored for CLI) */ model?: string; } /** * Options for createClaudeExecutor factory */ export interface CreateClaudeExecutorOptions { /** * Executor preference: * - "sdk": Use SDK executor, throw if unavailable * - "cli": Use CLI executor, throw if unavailable * - "auto": Try SDK first, fall back to CLI (default) */ prefer?: ExecutorPreference; /** * Whether to log which executor was selected * @default false */ verbose?: boolean; } /** * Result from createClaudeExecutor */ export interface CreateClaudeExecutorResult { /** * The created executor instance */ executor: IAgentExecutor; /** * Which executor type was selected */ type: "sdk" | "cli"; /** * Whether this was a fallback selection */ isFallback: boolean; } /** * Create a Claude executor with automatic fallback * * By default, tries to use the SDK executor first (simpler, in-process), * then falls back to CLI executor if SDK is not installed. * * @example * ```typescript * // Auto-select best available executor * const { executor, type } = await createClaudeExecutor({ * workDir: '/path/to/project', * dangerouslySkipPermissions: true, * }); * console.log(`Using ${type} executor`); * * // Force SDK (throws if unavailable) * const { executor } = await createClaudeExecutor(config, { prefer: 'sdk' }); * * // Force CLI * const { executor } = await createClaudeExecutor(config, { prefer: 'cli' }); * ``` * * @param config - Executor configuration * @param options - Factory options * @returns Executor instance and metadata */ export declare function createClaudeExecutor(config: ClaudeExecutorConfig, options?: CreateClaudeExecutorOptions): Promise; /** * Synchronous version that returns executor directly (for simple cases) * * Note: This doesn't check availability - use createClaudeExecutor for that. * * @example * ```typescript * // Quick creation when you know SDK is available * const executor = getClaudeExecutor(config, 'sdk'); * ``` */ export declare function getClaudeExecutor(config: ClaudeExecutorConfig, type: "sdk" | "cli"): IAgentExecutor; //# sourceMappingURL=executor-factory.d.ts.map