Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export * from "./message.js"
export * from "./mode.js"
export * from "./model.js"
export * from "./provider-settings.js"
export * from "./single-file-read-models.js"
export * from "./task.js"
export * from "./todo.js"
export * from "./telemetry.js"
Expand Down
14 changes: 0 additions & 14 deletions packages/types/src/single-file-read-models.ts

This file was deleted.

50 changes: 14 additions & 36 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import { Task } from "../task/Task"
import { fetchInstructionsTool } from "../tools/FetchInstructionsTool"
import { listFilesTool } from "../tools/ListFilesTool"
import { readFileTool } from "../tools/ReadFileTool"
import { getSimpleReadFileToolDescription, simpleReadFileTool } from "../tools/simpleReadFileTool"
import { shouldUseSingleFileRead, TOOL_PROTOCOL } from "@roo-code/types"
import { TOOL_PROTOCOL } from "@roo-code/types"
import { writeToFileTool } from "../tools/WriteToFileTool"
import { applyDiffTool } from "../tools/MultiApplyDiffTool"
import { searchAndReplaceTool } from "../tools/SearchAndReplaceTool"
Expand Down Expand Up @@ -362,18 +361,12 @@ export async function presentAssistantMessage(cline: Task) {
case "execute_command":
return `[${block.name} for '${block.params.command}']`
case "read_file":
// Check if this model should use the simplified description
const modelId = cline.api.getModel().id
if (shouldUseSingleFileRead(modelId)) {
return getSimpleReadFileToolDescription(block.name, block.params)
} else {
// Prefer native typed args when available; fall back to legacy params
// Check if nativeArgs exists (native protocol)
if (block.nativeArgs) {
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
}
return readFileTool.getReadFileToolDescription(block.name, block.params)
// Prefer native typed args when available; fall back to legacy params
// Check if nativeArgs exists (native protocol)
if (block.nativeArgs) {
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
}
return readFileTool.getReadFileToolDescription(block.name, block.params)
case "fetch_instructions":
return `[${block.name} for '${block.params.task}']`
case "write_to_file":
Expand Down Expand Up @@ -908,29 +901,14 @@ export async function presentAssistantMessage(cline: Task) {
})
break
case "read_file":
// Check if this model should use the simplified single-file read tool
// Only use simplified tool for XML protocol - native protocol works with standard tool
const modelId = cline.api.getModel().id
if (shouldUseSingleFileRead(modelId) && toolProtocol !== TOOL_PROTOCOL.NATIVE) {
await simpleReadFileTool(
cline,
block,
askApproval,
handleError,
pushToolResult,
removeClosingTag,
toolProtocol,
)
} else {
// Type assertion is safe here because we're in the "read_file" case
await readFileTool.handle(cline, block as ToolUse<"read_file">, {
askApproval,
handleError,
pushToolResult,
removeClosingTag,
toolProtocol,
})
}
// Type assertion is safe here because we're in the "read_file" case
await readFileTool.handle(cline, block as ToolUse<"read_file">, {
askApproval,
handleError,
pushToolResult,
removeClosingTag,
toolProtocol,
})
break
case "fetch_instructions":
await fetchInstructionsTool.handle(cline, block as ToolUse<"fetch_instructions">, {
Expand Down
12 changes: 1 addition & 11 deletions src/core/prompts/tools/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ToolName, ModeConfig } from "@roo-code/types"
import { shouldUseSingleFileRead } from "@roo-code/types"

import { TOOL_GROUPS, ALWAYS_AVAILABLE_TOOLS, DiffStrategy } from "../../../shared/tools"
import { Mode, getModeConfig, getGroupName } from "../../../shared/modes"
Expand All @@ -12,7 +11,6 @@ import { CodeIndexManager } from "../../../services/code-index/manager"
import { ToolArgs } from "./types"
import { getExecuteCommandDescription } from "./execute-command"
import { getReadFileDescription } from "./read-file"
import { getSimpleReadFileDescription } from "./simple-read-file"
import { getFetchInstructionsDescription } from "./fetch-instructions"
import { getWriteToFileDescription } from "./write-to-file"
import { getSearchFilesDescription } from "./search-files"
Expand All @@ -32,14 +30,7 @@ import { getGenerateImageDescription } from "./generate-image"
// Map of tool names to their description functions
const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined> = {
execute_command: (args) => getExecuteCommandDescription(args),
read_file: (args) => {
// Check if the current model should use the simplified read_file tool
const modelId = args.settings?.modelId
if (modelId && shouldUseSingleFileRead(modelId)) {
return getSimpleReadFileDescription(args)
}
return getReadFileDescription(args)
},
read_file: (args) => getReadFileDescription(args),
fetch_instructions: (args) => getFetchInstructionsDescription(args.settings?.enableMcpServerCreation),
write_to_file: (args) => getWriteToFileDescription(args),
search_files: (args) => getSearchFilesDescription(args),
Expand Down Expand Up @@ -162,7 +153,6 @@ export function getToolDescriptionsForMode(
export {
getExecuteCommandDescription,
getReadFileDescription,
getSimpleReadFileDescription,
getFetchInstructionsDescription,
getWriteToFileDescription,
getSearchFilesDescription,
Expand Down
35 changes: 0 additions & 35 deletions src/core/prompts/tools/simple-read-file.ts

This file was deleted.

Loading
Loading