(file: ToolFileValue)
| 367 | }; |
| 368 | |
| 369 | const decodeTextFile = (file: ToolFileValue): string => { |
| 370 | const text = new TextDecoder("utf-8", { fatal: false }).decode(bytesFromBase64(file.data)); |
| 371 | if (text.length <= TEXT_FILE_CONTENT_MAX_CHARS) return text; |
| 372 | return `${text.slice(0, TEXT_FILE_CONTENT_MAX_CHARS)}\n\n[truncated ${ |
| 373 | text.length - TEXT_FILE_CONTENT_MAX_CHARS |
| 374 | } characters]`; |
| 375 | }; |
| 376 | |
| 377 | const toolFileContent = (file: ToolFileValue): ContentBlock[] => { |
| 378 | const kind = toolFileKind(file); |
no test coverage detected