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