- Fix MAX_LINE_BYTES to 500 (was 2000), rename from MAX_LINE_LENGTH for clarity
- Implement byte-based UTF-8 line truncation at safe boundaries (safeUtf8Truncate)
- Rename FALLBACK_LIMIT to DEFAULT_LINE_LIMIT for clarity
- Add maxLines property to indentation schema in tool definition
- Add test for UTF-8 boundary truncation with emoji
The ReadFileTool's execute method requires additional Task methods that were
not mocked:
- sayAndCreateMissingParamError: called when files array is empty/undefined
- cwd: used for path resolution
- apiConfiguration: used for protocol resolution
- taskToolProtocol: used for protocol resolution
- rooIgnoreController: used for access validation
- fileContextTracker: used for tracking file context
This fix ensures the test properly mocks all dependencies required by the
ReadFileTool when invoked through presentAssistantMessage.
Updates tests to match the new API that replaces line_ranges with:
- offset: 1-indexed starting line number
- mode: 'slice' or 'indentation' reading mode
- indentation: configuration for indentation mode
Also updates strict mode expectations since partialReadsEnabled (default true)
now sets strict to false to allow optional parameters.
Addresses review comment about FileEntry.limit being defined but ignored.
The limit parameter was intentionally not exposed to models - it's controlled
by the maxReadFileLine user setting instead. Updated the comment in
NativeToolCallParser.ts to clarify this design decision.
The limit parameter was defined in FileEntry but intentionally ignored by
ReadFileTool since the line limit is controlled by the maxReadFileLine
setting. This removes the unused type field and parsing code to align
the types with actual behavior.
- Remove limit from FileEntry interface in tool-params.ts
- Remove limit parsing from NativeToolCallParser.convertFileEntries()
- Remove limit from FileResult interface in ReadFileTool.ts
- Update comment to remove obsolete limit mention
- Use consistent camelCase in error messages (anchorLine, maxLines instead of snake_case)
- Accept both camelCase and snake_case for indentation config in NativeToolCallParser
- Continue counting total lines after hitting limit in readSlice() for accurate metadata
- Return empty content instead of throwing when offset exceeds file length
- Disable strict mode in tool schema when partial reads enabled to allow truly optional params
- Update tests to match new behavior
Replace line_ranges with new offset/limit/mode API for improved file reading:
- Slice mode: simple line-by-line reading with offset pagination
- Indentation mode: smart code block extraction based on indentation
- Add rich metadata for pagination awareness (hasMoreBefore/After, etc.)
- Remove deprecated truncateDefinitions helper
- Update tool definition with new parameters and examples
- Default maxReadFileLine from 500 to 2000 lines