import { resolveProviderModelCandidates, resolveModelFromCandidates, } from '../provider-resolution.js';
/**
 * Resolve provider/model for assistant interactive mode.
 * Priority: CLI overrides > local assistant > global assistant > local top-level > global top-level
 */
export function resolveAssistantProviderModelFromConfig(config, cliOverrides) {
    const localAssistantProvider = config.local.taktProviders?.assistant?.provider;
    const globalAssistantProvider = config.global.taktProviders?.assistant?.provider;
    const provider = resolveProviderModelCandidates([
        { provider: cliOverrides?.provider },
        { provider: localAssistantProvider },
        { provider: globalAssistantProvider },
        { provider: config.local.provider },
        { provider: config.global.provider },
    ]).provider;
    const model = resolveModelFromCandidates([
        { model: cliOverrides?.model },
        {
            model: config.local.taktProviders?.assistant?.model,
            provider: localAssistantProvider,
        },
        {
            model: config.global.taktProviders?.assistant?.model,
            provider: globalAssistantProvider,
        },
        { model: config.local.model, provider: config.local.provider },
        { model: config.global.model, provider: config.global.provider },
    ], provider);
    return { provider, model };
}
//# sourceMappingURL=provider-resolution.js.map