(file: ToolFileValue)
| 605 | }; |
| 606 | |
| 607 | const decodeTextFile = (file: ToolFileValue): string => { |
| 608 | const text = new TextDecoder("utf-8", { fatal: false }).decode(bytesFromBase64(file.data)); |
| 609 | if (text.length <= TEXT_FILE_CONTENT_MAX_CHARS) return text; |
| 610 | return `${text.slice(0, TEXT_FILE_CONTENT_MAX_CHARS)}\n\n[truncated ${ |
| 611 | text.length - TEXT_FILE_CONTENT_MAX_CHARS |
| 612 | } characters]`; |
| 613 | }; |
| 614 | |
| 615 | const toolFileContent = (file: ToolFileValue): ContentBlock[] => { |
| 616 | const kind = toolFileKind(file); |
no test coverage detected