(content: ToolResultPart)
| 68 | _options: Record<string, unknown>, |
| 69 | ): ModelMessage[] { |
| 70 | const sanitizeToolResultOutput = (content: ToolResultPart) => { |
| 71 | if (content.output.type === "text" || content.output.type === "error-text") { |
| 72 | content.output.value = sanitizeSurrogates(content.output.value) |
| 73 | } |
| 74 | if (content.output.type === "content") { |
| 75 | content.output.value = content.output.value.map((item) => { |
| 76 | if (item.type === "text") { |
| 77 | item.text = sanitizeSurrogates(item.text) |
| 78 | } |
| 79 | return item |
| 80 | }) |
| 81 | } |
| 82 | return content |
| 83 | } |
| 84 | |
| 85 | msgs = msgs.map((msg) => { |
| 86 | switch (msg.role) { |
no test coverage detected