Skip to content

Commit a510223

Browse files
feat: remove simpleReadFileTool completely (#10254)
- Delete simpleReadFileTool.ts file - Delete simple-read-file.ts prompt description file - Delete single-file-read-models.ts types file - Remove imports and usage from presentAssistantMessage.ts - Remove imports and usage from prompts/tools/index.ts - Remove export from packages/types/src/index.ts This removes all traces of the legacy single-file read tool implementation that was used for specific models. All models now use the standard read_file tool. Co-authored-by: Roo Code <[email protected]>
1 parent a07d28c commit a510223

File tree

6 files changed

+15
-386
lines changed

6 files changed

+15
-386
lines changed

packages/types/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export * from "./message.js"
1717
export * from "./mode.js"
1818
export * from "./model.js"
1919
export * from "./provider-settings.js"
20-
export * from "./single-file-read-models.js"
2120
export * from "./task.js"
2221
export * from "./todo.js"
2322
export * from "./telemetry.js"

packages/types/src/single-file-read-models.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import { Task } from "../task/Task"
1919
import { fetchInstructionsTool } from "../tools/FetchInstructionsTool"
2020
import { listFilesTool } from "../tools/ListFilesTool"
2121
import { readFileTool } from "../tools/ReadFileTool"
22-
import { getSimpleReadFileToolDescription, simpleReadFileTool } from "../tools/simpleReadFileTool"
23-
import { shouldUseSingleFileRead, TOOL_PROTOCOL } from "@roo-code/types"
22+
import { TOOL_PROTOCOL } from "@roo-code/types"
2423
import { writeToFileTool } from "../tools/WriteToFileTool"
2524
import { applyDiffTool } from "../tools/MultiApplyDiffTool"
2625
import { searchAndReplaceTool } from "../tools/SearchAndReplaceTool"
@@ -363,18 +362,12 @@ export async function presentAssistantMessage(cline: Task) {
363362
case "execute_command":
364363
return `[${block.name} for '${block.params.command}']`
365364
case "read_file":
366-
// Check if this model should use the simplified description
367-
const modelId = cline.api.getModel().id
368-
if (shouldUseSingleFileRead(modelId)) {
369-
return getSimpleReadFileToolDescription(block.name, block.params)
370-
} else {
371-
// Prefer native typed args when available; fall back to legacy params
372-
// Check if nativeArgs exists (native protocol)
373-
if (block.nativeArgs) {
374-
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
375-
}
376-
return readFileTool.getReadFileToolDescription(block.name, block.params)
365+
// Prefer native typed args when available; fall back to legacy params
366+
// Check if nativeArgs exists (native protocol)
367+
if (block.nativeArgs) {
368+
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
377369
}
370+
return readFileTool.getReadFileToolDescription(block.name, block.params)
378371
case "fetch_instructions":
379372
return `[${block.name} for '${block.params.task}']`
380373
case "write_to_file":
@@ -909,29 +902,14 @@ export async function presentAssistantMessage(cline: Task) {
909902
})
910903
break
911904
case "read_file":
912-
// Check if this model should use the simplified single-file read tool
913-
// Only use simplified tool for XML protocol - native protocol works with standard tool
914-
const modelId = cline.api.getModel().id
915-
if (shouldUseSingleFileRead(modelId) && toolProtocol !== TOOL_PROTOCOL.NATIVE) {
916-
await simpleReadFileTool(
917-
cline,
918-
block,
919-
askApproval,
920-
handleError,
921-
pushToolResult,
922-
removeClosingTag,
923-
toolProtocol,
924-
)
925-
} else {
926-
// Type assertion is safe here because we're in the "read_file" case
927-
await readFileTool.handle(cline, block as ToolUse<"read_file">, {
928-
askApproval,
929-
handleError,
930-
pushToolResult,
931-
removeClosingTag,
932-
toolProtocol,
933-
})
934-
}
905+
// Type assertion is safe here because we're in the "read_file" case
906+
await readFileTool.handle(cline, block as ToolUse<"read_file">, {
907+
askApproval,
908+
handleError,
909+
pushToolResult,
910+
removeClosingTag,
911+
toolProtocol,
912+
})
935913
break
936914
case "fetch_instructions":
937915
await fetchInstructionsTool.handle(cline, block as ToolUse<"fetch_instructions">, {

src/core/prompts/tools/index.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { ToolName, ModeConfig } from "@roo-code/types"
2-
import { shouldUseSingleFileRead } from "@roo-code/types"
32

43
import { TOOL_GROUPS, ALWAYS_AVAILABLE_TOOLS, DiffStrategy } from "../../../shared/tools"
54
import { Mode, getModeConfig, getGroupName } from "../../../shared/modes"
@@ -12,7 +11,6 @@ import { CodeIndexManager } from "../../../services/code-index/manager"
1211
import { ToolArgs } from "./types"
1312
import { getExecuteCommandDescription } from "./execute-command"
1413
import { getReadFileDescription } from "./read-file"
15-
import { getSimpleReadFileDescription } from "./simple-read-file"
1614
import { getFetchInstructionsDescription } from "./fetch-instructions"
1715
import { getWriteToFileDescription } from "./write-to-file"
1816
import { getSearchFilesDescription } from "./search-files"
@@ -32,14 +30,7 @@ import { getGenerateImageDescription } from "./generate-image"
3230
// Map of tool names to their description functions
3331
const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined> = {
3432
execute_command: (args) => getExecuteCommandDescription(args),
35-
read_file: (args) => {
36-
// Check if the current model should use the simplified read_file tool
37-
const modelId = args.settings?.modelId
38-
if (modelId && shouldUseSingleFileRead(modelId)) {
39-
return getSimpleReadFileDescription(args)
40-
}
41-
return getReadFileDescription(args)
42-
},
33+
read_file: (args) => getReadFileDescription(args),
4334
fetch_instructions: (args) => getFetchInstructionsDescription(args.settings?.enableMcpServerCreation),
4435
write_to_file: (args) => getWriteToFileDescription(args),
4536
search_files: (args) => getSearchFilesDescription(args),
@@ -162,7 +153,6 @@ export function getToolDescriptionsForMode(
162153
export {
163154
getExecuteCommandDescription,
164155
getReadFileDescription,
165-
getSimpleReadFileDescription,
166156
getFetchInstructionsDescription,
167157
getWriteToFileDescription,
168158
getSearchFilesDescription,

src/core/prompts/tools/simple-read-file.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)