import { callClaudeHeadless } from '../claude-headless/client.js';
import { resolveAnthropicApiKey, resolveClaudeCliPath } from '../config/index.js';
import { validateClaudeEffortCompatibility } from '../../core/workflow/claude-effort-compatibility.js';
function toHeadlessOptions(options) {
    const claudeOptions = options.providerOptions?.claude;
    validateClaudeEffortCompatibility(options.model, claudeOptions?.effort);
    return {
        cwd: options.cwd,
        abortSignal: options.abortSignal,
        sessionId: options.sessionId,
        model: options.model,
        anthropicApiKey: options.anthropicApiKey ?? resolveAnthropicApiKey(),
        effort: claudeOptions?.effort,
        allowedTools: options.allowedTools,
        mcpServers: options.mcpServers,
        permissionMode: options.permissionMode,
        bypassPermissions: options.bypassPermissions,
        sandbox: claudeOptions?.sandbox,
        onStream: options.onStream,
        claudeCliPath: resolveClaudeCliPath() ?? undefined,
        outputSchema: options.outputSchema,
    };
}
export class ClaudeHeadlessProvider {
    supportsStructuredOutput = true;
    setup(config) {
        const { name, systemPrompt } = config;
        return {
            call: (prompt, options) => callClaudeHeadless(name, prompt, {
                ...toHeadlessOptions(options),
                systemPrompt: systemPrompt ?? undefined,
            }),
        };
    }
}
//# sourceMappingURL=claude-headless.js.map