Skip to content

Commit 9ba0cd5

Browse files
samhvw8daniel-lxs
andauthored
feat(read_file): enhance file reading capabilities with multi-file support and improved parameter handling (#2886)
* feat(read_file): enhance file reading capabilities with multi-file support and improved parameter handling fix(read_file): change return to continue on approval rejection in readFileTool Enhance readFileTool with improved error handling and validation - Introduced a FileEntry interface for better type management. - Added validation for start_line and end_line to ensure proper ranges. - Implemented RooIgnore validation before processing files. - Enhanced error handling with dedicated functions for file and global errors. - Streamlined file reading logic to handle binary files, definitions-only mode, and line thresholds more effectively. - Improved user feedback for empty files and read limits. chore: update Jest snapshot for system prompt tool usage Refactor read-file tool to support XML input format and multiple line ranges - Updated the `getReadFileDescription` function to reflect new XML structure for file reading requests. - Modified `readFileTool` to parse XML input, allowing multiple line ranges for each file. - Removed old parsing logic that handled line ranges as separate parameters. - Implemented validation for line ranges and ensured proper error handling for file access. - Adjusted approval messaging to accommodate new line range format. - Enhanced error handling to provide consistent feedback for file read errors. update from KJ7LNW comment feat: add maxConcurrentFileReads setting to enhance read_file tool performance feat: enhance readFileTool with XML parsing and file processing state tracking feat: enhance readFileTool to include user feedback handling and processing state tracking chore: clean up read_file tool documentation by removing extra newlines feat: update read_file tool tests to handle user feedback and approval states feat: add tests for feedback message formatting and XML special character handling in read_file tool Implement code changes to enhance functionality and improve performance feat: increase max concurrent file reads and adjust slider range in settings feat: increase default max concurrent file reads from 5 to 15 across settings and context management fix(read_file): enhance legacy path handling and remove duplicate parameters feat(read_file): enhance file description handling and add support for multiple files in messages done poc for new ux idea 1 * fix the test * fix: normalize locale file formatting to use tabs - Applied prettier formatting to all locale JSON files - Fixed mixed indentation (spaces/tabs) to use consistent tabs - Aligns with project's prettier configuration * fix(settings): improve checkbox handling and slider configuration in ConcurrentFileReadsExperiment * fix(read_file): enhance description to include partial reads support * fix(read_file): update description for partial reads and improve example clarity * fix: suggestions * fix: translations * test: update system prompt snapshots for multi-file read tool * fix: remove batch permission question from readFile tool translations --------- Co-authored-by: Daniel Riccio <[email protected]>
1 parent 177e7a8 commit 9ba0cd5

File tree

85 files changed

+2735
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2735
-744
lines changed

packages/types/src/experiment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = ["powerSteering"] as const
9+
export const experimentIds = ["powerSteering", "concurrentFileReads"] as const
1010

1111
export const experimentIdsSchema = z.enum(experimentIds)
1212

@@ -18,6 +18,7 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
1818

1919
export const experimentsSchema = z.object({
2020
powerSteering: z.boolean(),
21+
concurrentFileReads: z.boolean(),
2122
})
2223

2324
export type Experiments = z.infer<typeof experimentsSchema>

packages/types/src/global-settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const globalSettingsSchema = z.object({
4848
allowedMaxRequests: z.number().nullish(),
4949
autoCondenseContext: z.boolean().optional(),
5050
autoCondenseContextPercent: z.number().optional(),
51+
maxConcurrentFileReads: z.number().optional(),
5152

5253
browserToolEnabled: z.boolean().optional(),
5354
browserViewportSize: z.string().optional(),
@@ -134,6 +135,7 @@ export const GLOBAL_SETTINGS_KEYS = keysOf<GlobalSettings>()([
134135
"allowedMaxRequests",
135136
"autoCondenseContext",
136137
"autoCondenseContextPercent",
138+
"maxConcurrentFileReads",
137139

138140
"browserToolEnabled",
139141
"browserViewportSize",

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { ToolParamName, ToolResponse } from "../../shared/tools"
99

1010
import { fetchInstructionsTool } from "../tools/fetchInstructionsTool"
1111
import { listFilesTool } from "../tools/listFilesTool"
12-
import { readFileTool } from "../tools/readFileTool"
12+
import { getReadFileToolDescription, readFileTool } from "../tools/readFileTool"
1313
import { writeToFileTool } from "../tools/writeToFileTool"
1414
import { applyDiffTool } from "../tools/applyDiffTool"
1515
import { insertContentTool } from "../tools/insertContentTool"
@@ -153,7 +153,7 @@ export async function presentAssistantMessage(cline: Task) {
153153
case "execute_command":
154154
return `[${block.name} for '${block.params.command}']`
155155
case "read_file":
156-
return `[${block.name} for '${block.params.path}']`
156+
return getReadFileToolDescription(block.name, block.params)
157157
case "fetch_instructions":
158158
return `[${block.name} for '${block.params.task}']`
159159
case "write_to_file":

0 commit comments

Comments
 (0)