(content: string)
| 136 | */ |
| 137 | /** Classify a tool error result into a coarse code for loop detection. */ |
| 138 | export function errorCodeOf(content: string): string { |
| 139 | if (typeof content !== 'string') return 'ERROR'; |
| 140 | const m = content.match(/^\s*\[([A-Z_]+)\]/); |
| 141 | if (m) return m[1]!; |
| 142 | if (/does not exist|not found|no such file/i.test(content)) return 'FILE_NOT_FOUND'; |
| 143 | return 'ERROR'; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * A result can be a "soft failure": the tool itself returned success (exit 0, isError=false) but the |
no outgoing calls
no test coverage detected