/**
 * Copilot provider implementation
 */
import { callCopilot, callCopilotCustom } from '../copilot/index.js';
import { resolveCopilotGithubToken, resolveCopilotCliPath } from '../config/index.js';
import { createLogger } from '../../shared/utils/index.js';
const log = createLogger('copilot-provider');
function toCopilotOptions(options) {
    if (options.allowedTools && options.allowedTools.length > 0) {
        log.info('Copilot provider does not support allowedTools; ignoring');
    }
    if (options.mcpServers && Object.keys(options.mcpServers).length > 0) {
        log.info('Copilot provider does not support mcpServers in non-interactive mode; ignoring');
    }
    if (options.outputSchema) {
        log.info('Copilot provider does not support outputSchema; ignoring');
    }
    return {
        cwd: options.cwd,
        abortSignal: options.abortSignal,
        sessionId: options.sessionId,
        model: options.model,
        effort: options.providerOptions?.copilot?.effort,
        permissionMode: options.permissionMode,
        onStream: options.onStream,
        copilotGithubToken: options.copilotGithubToken ?? resolveCopilotGithubToken(),
        copilotCliPath: resolveCopilotCliPath(),
    };
}
/** Copilot provider — delegates to GitHub Copilot CLI */
export class CopilotProvider {
    supportsStructuredOutput = false;
    setup(config) {
        const { name, systemPrompt } = config;
        if (systemPrompt) {
            return {
                call: async (prompt, options) => {
                    return callCopilotCustom(name, prompt, systemPrompt, toCopilotOptions(options));
                },
            };
        }
        return {
            call: async (prompt, options) => {
                return callCopilot(name, prompt, toCopilotOptions(options));
            },
        };
    }
}
//# sourceMappingURL=copilot.js.map