Skip to content

Commit fdd4bda

Browse files
committed
Remove experimental tools: insert_content and search_and_replace
- Deleted all references to the insert_content and search_and_replace experimental tools from the codebase, including tests, tool descriptions, and related logic. - Updated experiment configurations and schemas to reflect the removal of these tools. - Adjusted tests to ensure they no longer check for the presence of the removed tools. - Cleaned up related imports and tool groups to maintain code clarity and organization.
1 parent 0736379 commit fdd4bda

File tree

21 files changed

+15
-1018
lines changed

21 files changed

+15
-1018
lines changed

evals/packages/types/src/roo-code-defaults.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export const rooCodeDefaults: RooCodeSettings = {
5656
diffEnabled: true,
5757
fuzzyMatchThreshold: 1.0,
5858
experiments: {
59-
search_and_replace: false,
60-
insert_content: false,
6159
powerSteering: false,
6260
},
6361

evals/packages/types/src/roo-code.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export type CustomSupportPrompts = z.infer<typeof customSupportPromptsSchema>
271271
* ExperimentId
272272
*/
273273

274-
export const experimentIds = ["search_and_replace", "insert_content", "powerSteering"] as const
274+
export const experimentIds = ["powerSteering"] as const
275275

276276
export const experimentIdsSchema = z.enum(experimentIds)
277277

@@ -282,8 +282,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
282282
*/
283283

284284
const experimentsSchema = z.object({
285-
search_and_replace: z.boolean(),
286-
insert_content: z.boolean(),
287285
powerSteering: z.boolean(),
288286
})
289287

src/core/Cline.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ import { validateToolUse, isToolAllowedForMode, ToolName } from "./mode-validato
6464
import { getWorkspacePath } from "../utils/path"
6565
import { writeToFileTool } from "./tools/writeToFileTool"
6666
import { applyDiffTool } from "./tools/applyDiffTool"
67-
import { insertContentTool } from "./tools/insertContentTool"
68-
import { searchAndReplaceTool } from "./tools/searchAndReplaceTool"
6967
import { listCodeDefinitionNamesTool } from "./tools/listCodeDefinitionNamesTool"
7068
import { searchFilesTool } from "./tools/searchFilesTool"
7169
import { browserActionTool } from "./tools/browserActionTool"
@@ -1396,10 +1394,6 @@ export class Cline extends EventEmitter<ClineEvents> {
13961394
return `[${block.name} for '${block.params.regex}'${
13971395
block.params.file_pattern ? ` in '${block.params.file_pattern}'` : ""
13981396
}]`
1399-
case "insert_content":
1400-
return `[${block.name} for '${block.params.path}']`
1401-
case "search_and_replace":
1402-
return `[${block.name} for '${block.params.path}']`
14031397
case "list_files":
14041398
return `[${block.name} for '${block.params.path}']`
14051399
case "list_code_definition_names":
@@ -1576,19 +1570,6 @@ export class Cline extends EventEmitter<ClineEvents> {
15761570
case "apply_diff":
15771571
await applyDiffTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
15781572
break
1579-
case "insert_content":
1580-
await insertContentTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
1581-
break
1582-
case "search_and_replace":
1583-
await searchAndReplaceTool(
1584-
this,
1585-
block,
1586-
askApproval,
1587-
handleError,
1588-
pushToolResult,
1589-
removeClosingTag,
1590-
)
1591-
break
15921573
case "read_file":
15931574
await readFileTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
15941575

src/core/assistant-message/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export const toolUseNames = [
1313
"read_file",
1414
"write_to_file",
1515
"apply_diff",
16-
"insert_content",
17-
"search_and_replace",
1816
"search_files",
1917
"list_files",
2018
"list_code_definition_names",
@@ -94,11 +92,6 @@ export interface WriteToFileToolUse extends ToolUse {
9492
params: Partial<Pick<Record<ToolParamName, string>, "path" | "content" | "line_count">>
9593
}
9694

97-
export interface InsertCodeBlockToolUse extends ToolUse {
98-
name: "insert_content"
99-
params: Partial<Pick<Record<ToolParamName, string>, "path" | "operations">>
100-
}
101-
10295
export interface SearchFilesToolUse extends ToolUse {
10396
name: "search_files"
10497
params: Partial<Pick<Record<ToolParamName, string>, "path" | "regex" | "file_pattern">>

src/core/diff/insert-groups.ts

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

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 0 additions & 397 deletions
Large diffs are not rendered by default.

src/core/prompts/__tests__/system.test.ts

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ describe("SYSTEM_PROMPT", () => {
170170

171171
beforeEach(() => {
172172
// Reset experiments before each test to ensure they're disabled by default
173-
experiments = {
174-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
175-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
176-
}
173+
experiments = {}
177174
})
178175

179176
beforeEach(() => {
@@ -481,10 +478,7 @@ describe("SYSTEM_PROMPT", () => {
481478
describe("experimental tools", () => {
482479
it("should disable experimental tools by default", async () => {
483480
// Set experiments to explicitly disable experimental tools
484-
const experimentsConfig = {
485-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
486-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
487-
}
481+
const experimentsConfig = {}
488482

489483
// Reset experiments
490484
experiments = experimentsConfig
@@ -508,17 +502,12 @@ describe("SYSTEM_PROMPT", () => {
508502
// Check that experimental tool sections are not included
509503
const toolSections = prompt.split("\n## ").slice(1)
510504
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
511-
expect(toolNames).not.toContain("search_and_replace")
512-
expect(toolNames).not.toContain("insert_content")
513505
expect(prompt).toMatchSnapshot()
514506
})
515507

516508
it("should enable experimental tools when explicitly enabled", async () => {
517509
// Set experiments for testing experimental features
518-
const experimentsEnabled = {
519-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
520-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
521-
}
510+
const experimentsEnabled = {}
522511

523512
// Reset default experiments
524513
experiments = undefined
@@ -543,18 +532,12 @@ describe("SYSTEM_PROMPT", () => {
543532
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
544533
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
545534

546-
// Verify experimental tools are included in the prompt when enabled
547-
expect(toolNames).toContain("search_and_replace")
548-
expect(toolNames).toContain("insert_content")
549535
expect(prompt).toMatchSnapshot()
550536
})
551537

552538
it("should selectively enable experimental tools", async () => {
553539
// Set experiments for testing selective enabling
554-
const experimentsSelective = {
555-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
556-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
557-
}
540+
const experimentsSelective = {}
558541

559542
// Reset default experiments
560543
experiments = undefined
@@ -579,17 +562,11 @@ describe("SYSTEM_PROMPT", () => {
579562
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
580563
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
581564

582-
// Verify only enabled experimental tools are included
583-
expect(toolNames).toContain("search_and_replace")
584-
expect(toolNames).not.toContain("insert_content")
585565
expect(prompt).toMatchSnapshot()
586566
})
587567

588568
it("should list all available editing tools in base instruction", async () => {
589-
const experiments = {
590-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
591-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
592-
}
569+
const experiments = {}
593570

594571
const prompt = await SYSTEM_PROMPT(
595572
mockContext,
@@ -610,14 +587,9 @@ describe("SYSTEM_PROMPT", () => {
610587
// Verify base instruction lists all available tools
611588
expect(prompt).toContain("apply_diff (for replacing lines in existing files)")
612589
expect(prompt).toContain("write_to_file (for creating new files or complete file rewrites)")
613-
expect(prompt).toContain("insert_content (for adding lines to existing files)")
614-
expect(prompt).toContain("search_and_replace (for finding and replacing individual pieces of text)")
615590
})
616591
it("should provide detailed instructions for each enabled tool", async () => {
617-
const experiments = {
618-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
619-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
620-
}
592+
const experiments = {}
621593

622594
const prompt = await SYSTEM_PROMPT(
623595
mockContext,
@@ -639,8 +611,6 @@ describe("SYSTEM_PROMPT", () => {
639611
expect(prompt).toContain(
640612
"You should always prefer using other editing tools over write_to_file when making changes to existing files since write_to_file is much slower and cannot handle large files.",
641613
)
642-
expect(prompt).toContain("The insert_content tool adds lines of text to files")
643-
expect(prompt).toContain("The search_and_replace tool finds and replaces text or regex in files")
644614
})
645615
})
646616

src/core/prompts/sections/rules.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,12 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
1313
} else {
1414
availableTools.push("write_to_file (for creating new files or complete file rewrites)")
1515
}
16-
if (experiments?.["insert_content"]) {
17-
availableTools.push("insert_content (for adding lines to existing files)")
18-
}
19-
if (experiments?.["search_and_replace"]) {
20-
availableTools.push("search_and_replace (for finding and replacing individual pieces of text)")
21-
}
2216

2317
// Base editing instruction mentioning all available tools
2418
if (availableTools.length > 1) {
2519
instructions.push(`- For editing files, you have access to these tools: ${availableTools.join(", ")}.`)
2620
}
2721

28-
// Additional details for experimental features
29-
if (experiments?.["insert_content"]) {
30-
instructions.push(
31-
"- The insert_content tool adds lines of text to files, such as adding a new function to a JavaScript file or inserting a new route in a Python file. This tool will insert it at the specified line location. It can support multiple operations at once.",
32-
)
33-
}
34-
35-
if (experiments?.["search_and_replace"]) {
36-
instructions.push(
37-
"- The search_and_replace tool finds and replaces text or regex in files. This tool allows you to search for a specific regex pattern or text and replace it with another value. Be cautious when using this tool to ensure you are replacing the correct text. It can support multiple operations at once.",
38-
)
39-
}
40-
4122
if (availableTools.length > 1) {
4223
instructions.push(
4324
"- You should always prefer using other editing tools over write_to_file when making changes to existing files since write_to_file is much slower and cannot handle large files.",

src/core/prompts/tools/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { getFetchInstructionsDescription } from "./fetch-instructions"
44
import { getWriteToFileDescription } from "./write-to-file"
55
import { getSearchFilesDescription } from "./search-files"
66
import { getListFilesDescription } from "./list-files"
7-
import { getInsertContentDescription } from "./insert-content"
8-
import { getSearchAndReplaceDescription } from "./search-and-replace"
97
import { getListCodeDefinitionNamesDescription } from "./list-code-definition-names"
108
import { getBrowserActionDescription } from "./browser-action"
119
import { getAskFollowupQuestionDescription } from "./ask-followup-question"
@@ -36,8 +34,6 @@ const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined>
3634
access_mcp_resource: (args) => getAccessMcpResourceDescription(args),
3735
switch_mode: () => getSwitchModeDescription(),
3836
new_task: (args) => getNewTaskDescription(args),
39-
insert_content: (args) => getInsertContentDescription(args),
40-
search_and_replace: (args) => getSearchAndReplaceDescription(args),
4137
apply_diff: (args) =>
4238
args.diffStrategy ? args.diffStrategy.getToolDescription({ cwd: args.cwd, toolOptions: args.toolOptions }) : "",
4339
}
@@ -110,6 +106,4 @@ export {
110106
getUseMcpToolDescription,
111107
getAccessMcpResourceDescription,
112108
getSwitchModeDescription,
113-
getInsertContentDescription,
114-
getSearchAndReplaceDescription,
115109
}

src/core/prompts/tools/insert-content.ts

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

0 commit comments

Comments
 (0)