* Formats file content to look like a read_file tool result. * Includes Gemini-style truncation warning when content is truncated.
(filePath: string, result: ExtractTextResult)
| 77 | * Includes Gemini-style truncation warning when content is truncated. |
| 78 | */ |
| 79 | function formatFileReadResult(filePath: string, result: ExtractTextResult): string { |
| 80 | const header = `[read_file for '${filePath}']` |
| 81 | |
| 82 | if (result.wasTruncated && result.linesShown) { |
| 83 | const [start, end] = result.linesShown |
| 84 | const nextOffset = end + 1 |
| 85 | return `${header} |
| 86 | IMPORTANT: File content truncated. |
| 87 | Status: Showing lines ${start}-${end} of ${result.totalLines} total lines. |
| 88 | To read more: Use the read_file tool with offset=${nextOffset} and limit=${DEFAULT_LINE_LIMIT}. |
| 89 | |
| 90 | File: ${filePath} |
| 91 | ${result.content}` |
| 92 | } |
| 93 | |
| 94 | return `${header} |
| 95 | File: ${filePath} |
| 96 | ${result.content}` |
| 97 | } |
| 98 | |
| 99 | export async function parseMentions( |
| 100 | text: string, |
no outgoing calls
no test coverage detected