(args: any)
| 33 | const BROAD_TOOLS = new Set(['multi_file_edit', 'safe_rename', 'safe_delete_file']); |
| 34 | |
| 35 | function extractPaths(args: any): string[] | null { |
| 36 | if (!args || typeof args !== 'object') return null; |
| 37 | const out: string[] = []; |
| 38 | for (const key of ['path', 'file', 'file_path', 'filepath', 'target']) { |
| 39 | if (typeof args[key] === 'string') out.push(args[key]); |
| 40 | } |
| 41 | for (const key of ['paths', 'files', 'targets']) { |
| 42 | if (Array.isArray(args[key])) { |
| 43 | for (const v of args[key]) if (typeof v === 'string') out.push(v); |
| 44 | } |
| 45 | } |
| 46 | // multi_edit-style: edits[].path |
| 47 | if (Array.isArray(args.edits)) { |
| 48 | for (const e of args.edits) if (e && typeof e.path === 'string') out.push(e.path); |
| 49 | } |
| 50 | return out.length > 0 ? out : null; |
| 51 | } |
| 52 | |
| 53 | function pathsConflict(a: string[], b: string[]): boolean { |
| 54 | const sa = new Set(a); |
no test coverage detected