mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 05:46:34 +02:00
The read tool used to prefix every line with '%6d\t' (6-digit line number + tab), which added ~7 bytes / ~2 tokens per line to every read. On typical source files that's 15-20% of the read's token budget, repeated on every subsequent turn as the tool result stays in context. The line numbers weren't earning their keep: the model edits via exact-match text replacement, never line ranges, and the tui has always been capable of drawing its own gutter. Now it does: - Tool output is raw file bytes, no prefix. - A 'start_line' detail is attached to the ToolResult so the tui knows where to start counting. - The tui renders a synthetic gutter over the raw content using the existing renderNumberedFile path (new: renderRawFile), so on-screen it still looks exactly like cat -n. The old numbered format is still recognised for legacy transcripts saved before this commit (looksLikeNumberedFile guard stays). Measured: sample.ts (388 lines) used to cost 14957 bytes to send, now costs 12291 bytes (raw file). Saves ~670 tokens per read of a medium file; the same fraction applies to larger files too. Tests: TestReadOffsetLimit rewritten to assert raw output + start_line detail. TUI renderToolText signature grew one int (startLine) plumbed through renderToolResultContent. |
||
|---|---|---|
| .. | ||
| editor.go | ||
| highlight.go | ||
| image.go | ||
| input.go | ||
| markdown.go | ||
| quote_paste_test.go | ||
| render.go | ||
| resize_unix.go | ||
| resize_windows.go | ||
| statusbar_test.go | ||
| terminal.go | ||
| theme.go | ||
| view.go | ||