(file: ToolFileValue)
| 328 | }; |
| 329 | |
| 330 | const decodeTextFile = (file: ToolFileValue): string => { |
| 331 | const text = new TextDecoder("utf-8", { fatal: false }).decode(bytesFromBase64(file.data)); |
| 332 | if (text.length <= TEXT_FILE_CONTENT_MAX_CHARS) return text; |
| 333 | return `${text.slice(0, TEXT_FILE_CONTENT_MAX_CHARS)}\n\n[truncated ${ |
| 334 | text.length - TEXT_FILE_CONTENT_MAX_CHARS |
| 335 | } characters]`; |
| 336 | }; |
| 337 | |
| 338 | const toolFileContent = (file: ToolFileValue): ContentBlock[] => { |
| 339 | const kind = toolFileKind(file); |
no test coverage detected