fix: resolve conflicts and address review comments regarding FileEntry.limit and truncatedByLimit

This commit is contained in:
Hannes Rudolph 2026-01-14 09:49:41 -07:00
parent 06e5cff342
commit e184ca6216
3 changed files with 6 additions and 2 deletions

View file

@ -27,6 +27,8 @@ export interface FileEntry {
path: string
/** 1-indexed line number to start reading from (default: 1) */
offset?: number
/** Maximum lines to return (default: value of maxReadFileLine setting) */
limit?: number
/** Reading mode: "slice" for simple reading, "indentation" for smart block extraction */
mode?: ReadMode
/** Configuration for indentation mode */

View file

@ -37,6 +37,7 @@ interface FileResult {
notice?: string
// Slice/indentation mode parameters
offset?: number
limit?: number
mode?: ReadMode
indentation?: IndentationConfig
xmlContent?: string
@ -106,6 +107,7 @@ export class ReadFileTool extends BaseTool<"read_file"> {
status: "pending",
// Map slice/indentation mode parameters
offset: entry.offset,
limit: entry.limit,
mode: entry.mode,
indentation: entry.indentation,
}))
@ -395,7 +397,7 @@ export class ReadFileTool extends BaseTool<"read_file"> {
const result = await readFileContent({
filePath: fullPath,
offset: fileResult.offset,
// limit is controlled by maxReadFileLine setting, not model input
limit: fileResult.limit,
mode: fileResult.mode,
indentation: fileResult.indentation,
defaultLimit: maxReadFileLine > 0 ? maxReadFileLine : undefined,

View file

@ -452,7 +452,7 @@ export async function readIndentationBlock(
hasMoreAfter: r.number < records.length,
linesBeforeStart: r.number - 1,
linesAfterEnd: records.length - r.number,
truncatedByLimit: true,
truncatedByLimit: records.length > finalLimit,
lineLengthTruncations,
},
}