(message: string, toolName: string)
| 149 | const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 150 | |
| 151 | export const isUnknownToolMessage = (message: string, toolName: string): boolean => { |
| 152 | const name = escapeRegExp(toolName); |
| 153 | return new RegExp( |
| 154 | `(?:unknown tool:?\\s*"?${name}"?|tool\\s+"?${name}"?\\s+(?:not found|is not available|does not exist))`, |
| 155 | "i", |
| 156 | ).test(message); |
| 157 | }; |
| 158 | |
| 159 | /** The class name and stable code of an SDK rejection, for the defect log. |
| 160 | * Structural only: the message is deliberately not read here. */ |
no test coverage detected