* Sanitize a tool result string before adding it to model context: * 1. Strip ANSI / C1 controls * 2. Redact secrets * 3. Normalize line endings
(input)
| 232 | * 3. Normalize line endings |
| 233 | */ |
| 234 | function sanitizeToolOutput(input) { |
| 235 | if (typeof input !== 'string') return input; |
| 236 | let out = stripAnsi(input); |
| 237 | out = redactString(out); |
| 238 | out = out.replace(/\r\n/g, '\n'); |
| 239 | return out; |
| 240 | } |
| 241 | |
| 242 | // ─── Listener leak guard (for long-running stdio servers) ─────────────────── |
| 243 |
no test coverage detected