import { providerSupportsAllowedTools, providerSupportsClaudeAllowedTools, providerSupportsMcpServers, } from '../../../infra/providers/provider-capabilities.js';
// Silent-drop: workflows may carry options for providers they aren't currently
// running under. Keep the value only when capability is confirmed true.
function keepWhenProviderSupports(value, provider, probe) {
    return probe(provider) === true ? value : undefined;
}
export function resolveAllowedToolsForProvider(providerOptions, hasOutputContracts, edit, provider) {
    const allowedTools = keepWhenProviderSupports(providerOptions?.claude?.allowedTools, provider, providerSupportsClaudeAllowedTools);
    if (!allowedTools) {
        return undefined;
    }
    if (!hasOutputContracts || edit === true) {
        return allowedTools;
    }
    return allowedTools.filter((tool) => tool !== 'Write');
}
export function resolveMcpServersForProvider(mcpServers, provider) {
    return keepWhenProviderSupports(mcpServers, provider, providerSupportsMcpServers);
}
export function resolvePartAllowedToolsForProvider(partAllowedTools, provider) {
    return keepWhenProviderSupports(partAllowedTools, provider, providerSupportsAllowedTools);
}
export function assertProviderResolvedForCapabilitySensitiveOptions(provider, options) {
    if (provider !== undefined) {
        return;
    }
    if (!options.usesStructuredOutput) {
        return;
    }
    throw new Error(`Step "${options.stepName}" uses structured_output but provider is not resolved`);
}
//# sourceMappingURL=engine-provider-options.js.map