const READ_ONLY_TOOL_NAMES = ['read', 'grep', 'find', 'ls'];
const CODING_TOOL_NAMES = ['read', 'bash', 'edit', 'write'];
function normalizeToolName(name) {
    return name.trim().toLowerCase();
}
export function selectSubAgentToolNames(agentConfig) {
    const declared = new Set((agentConfig.tools ?? [])
        .filter((name) => typeof name === 'string' && name.trim().length > 0)
        .map(normalizeToolName));
    const needsBash = declared.has('bash');
    const baseToolNames = agentConfig.readOnly && !needsBash ? READ_ONLY_TOOL_NAMES : CODING_TOOL_NAMES;
    const allowLegacyFallback = agentConfig.strictToolSelection !== true && agentConfig.source === 'builtin';
    if (declared.size === 0) {
        return allowLegacyFallback ? [...baseToolNames] : [];
    }
    const filtered = baseToolNames.filter((toolName) => declared.has(toolName));
    if (filtered.length > 0) {
        return filtered;
    }
    return allowLegacyFallback ? [...baseToolNames] : [];
}
//# sourceMappingURL=subagent-tool-selection.js.map