| 1506 | } |
| 1507 | |
| 1508 | export const stripHTMLFromToolInput = (input: string) => { |
| 1509 | const turndownService = new TurndownService() |
| 1510 | let cleanedInput = turndownService.turndown(input) |
| 1511 | // After conversion, replace any escaped underscores and square brackets with regular unescaped ones |
| 1512 | cleanedInput = cleanedInput.replace(/\\([_[\]])/g, '$1') |
| 1513 | return cleanedInput |
| 1514 | } |
| 1515 | |
| 1516 | // Regex constants exported for testability |
| 1517 | export const COMMONJS_REQUIRE_REGEX = /^(const|let|var)\s+\S[^=]*=\s*require\s*\(/ |