export function extractShellCommand(input) {
    if (!input || typeof input !== 'object' || Array.isArray(input)) {
        return undefined;
    }
    const command = input.command;
    return typeof command === 'string' && command.trim() ? command.trim() : undefined;
}
export function normalizeToolInput(tool, input) {
    if (!input || typeof input !== 'object' || Array.isArray(input)) {
        return input;
    }
    const normalized = { ...input };
    if ((tool === 'list_files' || tool === 'read_file' || tool === 'search_files') && typeof normalized.path === 'string') {
        normalized.path = normalizePathValue(normalized.path);
    }
    if (tool === 'edit_file' && typeof normalized.path === 'string') {
        normalized.path = normalizePathValue(normalized.path);
    }
    if ((tool === 'run_shell_inspect' || tool === 'run_shell_mutate') && typeof normalized.command === 'string') {
        normalized.command = normalized.command.trim().replace(/\s+/g, ' ');
    }
    return normalized;
}
function normalizePathValue(path) {
    const trimmed = path.trim();
    if (trimmed === './' || trimmed === '.') {
        return '.';
    }
    return trimmed.replace(/\/+$/, '') || '.';
}
//# sourceMappingURL=tool-input.js.map