import { resolveCliModel } from '../providers/model-resolver.js';
export async function resolvePendingRefreshOverride(input, modelRegistry) {
    const explicitThinkingLevel = input.thinkingLevel;
    const modelPattern = input.model?.trim();
    if (!modelPattern) {
        return {
            thinkingLevel: explicitThinkingLevel
        };
    }
    const resolved = resolveCliModel({
        cliModel: modelPattern,
        modelRegistry
    });
    if (!resolved.model) {
        return {
            error: resolved.error ?? `Model "${modelPattern}" not found.`
        };
    }
    const apiKey = await modelRegistry.getApiKey(resolved.model);
    if (!apiKey) {
        return {
            error: `No API key for ${resolved.model.provider}/${resolved.model.id}`
        };
    }
    return {
        model: resolved.model,
        thinkingLevel: explicitThinkingLevel ?? resolved.thinkingLevel
    };
}
//# sourceMappingURL=pending-refresh-overrides.js.map