Skip to content
Closed
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 evals/packages/types/src/roo-code-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const rooCodeDefaults: RooCodeSettings = {
fuzzyMatchThreshold: 1.0,
experiments: {
search_and_replace: false,
insert_content: false,
powerSteering: false,
append_to_file: false,
},
Expand Down
3 changes: 1 addition & 2 deletions evals/packages/types/src/roo-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export type CustomSupportPrompts = z.infer<typeof customSupportPromptsSchema>
* ExperimentId
*/

export const experimentIds = ["search_and_replace", "insert_content", "powerSteering", "append_to_file"] as const
export const experimentIds = ["search_and_replace", "powerSteering", "append_to_file"] as const

export const experimentIdsSchema = z.enum(experimentIds)

Expand All @@ -283,7 +283,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>

const experimentsSchema = z.object({
search_and_replace: z.boolean(),
insert_content: z.boolean(),
powerSteering: z.boolean(),
append_to_file: z.boolean(),
})
Expand Down
8 changes: 2 additions & 6 deletions src/core/Cline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import { listFilesTool } from "./tools/listFilesTool"
import { readFileTool } from "./tools/readFileTool"
import { writeToFileTool } from "./tools/writeToFileTool"
import { applyDiffTool } from "./tools/applyDiffTool"
import { insertContentTool } from "./tools/insertContentTool"
import { searchAndReplaceTool } from "./tools/searchAndReplaceTool"
import { listCodeDefinitionNamesTool } from "./tools/listCodeDefinitionNamesTool"
import { searchFilesTool } from "./tools/searchFilesTool"
Expand Down Expand Up @@ -1414,8 +1413,6 @@ export class Cline extends EventEmitter<ClineEvents> {
return `[${block.name} for '${block.params.regex}'${
block.params.file_pattern ? ` in '${block.params.file_pattern}'` : ""
}]`
case "insert_content":
return `[${block.name} for '${block.params.path}']`
case "search_and_replace":
return `[${block.name} for '${block.params.path}']`
case "list_files":
Expand All @@ -1440,6 +1437,8 @@ export class Cline extends EventEmitter<ClineEvents> {
const modeName = getModeBySlug(mode, customModes)?.name ?? mode
return `[${block.name} in ${modeName} mode: '${message}']`
}
default:
return `[${block.name}]`
Comment on lines +1440 to +1441
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got this error when pushing

src/core/Cline.ts:1398:33 - error TS2366: Function lacks ending return statement and return type does not include 'undefined'.

1398 const toolDescription = (): string => {
~~~~~~

Found 1 error in src/core/Cline.ts:1398

}
}

Expand Down Expand Up @@ -1597,9 +1596,6 @@ export class Cline extends EventEmitter<ClineEvents> {
case "apply_diff":
await applyDiffTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "insert_content":
await insertContentTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "search_and_replace":
await searchAndReplaceTool(
this,
Expand Down
31 changes: 0 additions & 31 deletions src/core/diff/insert-groups.ts

This file was deleted.

509 changes: 0 additions & 509 deletions src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions src/core/prompts/__tests__/system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ describe("SYSTEM_PROMPT", () => {
// Reset experiments before each test to ensure they're disabled by default
experiments = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
}
})

Expand Down Expand Up @@ -483,7 +482,6 @@ describe("SYSTEM_PROMPT", () => {
// Set experiments to explicitly disable experimental tools
const experimentsConfig = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
}

// Reset experiments
Expand All @@ -509,15 +507,13 @@ describe("SYSTEM_PROMPT", () => {
const toolSections = prompt.split("\n## ").slice(1)
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
expect(toolNames).not.toContain("search_and_replace")
expect(toolNames).not.toContain("insert_content")
expect(prompt).toMatchSnapshot()
})

it("should enable experimental tools when explicitly enabled", async () => {
// Set experiments for testing experimental features
const experimentsEnabled = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
}

// Reset default experiments
Expand All @@ -542,53 +538,14 @@ describe("SYSTEM_PROMPT", () => {
// Get all tool sections
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())

// Verify experimental tools are included in the prompt when enabled
expect(toolNames).toContain("search_and_replace")
expect(toolNames).toContain("insert_content")
expect(prompt).toMatchSnapshot()
})

it("should selectively enable experimental tools", async () => {
// Set experiments for testing selective enabling
const experimentsSelective = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
}

// Reset default experiments
experiments = undefined

const prompt = await SYSTEM_PROMPT(
mockContext,
"/test/path",
false, // supportsComputerUse
undefined, // mcpHub
undefined, // diffStrategy
undefined, // browserViewportSize
defaultModeSlug, // mode
undefined, // customModePrompts
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // diffEnabled
experimentsSelective, // Use the selective experiments
true, // enableMcpServerCreation
)

// Get all tool sections
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())

// Verify only enabled experimental tools are included
expect(toolNames).toContain("search_and_replace")
expect(toolNames).not.toContain("insert_content")
expect(prompt).toMatchSnapshot()
})

it("should list all available editing tools in base instruction", async () => {
const experiments = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
}

const prompt = await SYSTEM_PROMPT(
Expand All @@ -610,13 +567,11 @@ describe("SYSTEM_PROMPT", () => {
// Verify base instruction lists all available tools
expect(prompt).toContain("apply_diff (for replacing lines in existing files)")
expect(prompt).toContain("write_to_file (for creating new files or complete file rewrites)")
expect(prompt).toContain("insert_content (for adding lines to existing files)")
expect(prompt).toContain("search_and_replace (for finding and replacing individual pieces of text)")
})
it("should provide detailed instructions for each enabled tool", async () => {
const experiments = {
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
}

const prompt = await SYSTEM_PROMPT(
Expand All @@ -639,7 +594,6 @@ describe("SYSTEM_PROMPT", () => {
expect(prompt).toContain(
"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.",
)
expect(prompt).toContain("The insert_content tool adds lines of text to files")
expect(prompt).toContain("The search_and_replace tool finds and replaces text or regex in files")
})
})
Expand Down
11 changes: 0 additions & 11 deletions src/core/prompts/sections/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor

availableTools.push("append_to_file (for appending content to the end of files)")

if (experiments?.["insert_content"]) {
availableTools.push("insert_content (for adding lines to existing files)")
}
if (experiments?.["search_and_replace"]) {
availableTools.push("search_and_replace (for finding and replacing individual pieces of text)")
}
Expand All @@ -30,14 +27,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
"- The append_to_file tool adds content to the end of files, such as appending new log entries or adding new data records. This tool will always add the content at the end of the file.",
)
}

// Additional details for experimental features
if (experiments?.["insert_content"]) {
instructions.push(
"- 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.",
)
}

if (experiments?.["search_and_replace"]) {
instructions.push(
"- 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.",
Expand Down
3 changes: 0 additions & 3 deletions src/core/prompts/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { getWriteToFileDescription } from "./write-to-file"
import { getAppendToFileDescription } from "./append-to-file"
import { getSearchFilesDescription } from "./search-files"
import { getListFilesDescription } from "./list-files"
import { getInsertContentDescription } from "./insert-content"
import { getSearchAndReplaceDescription } from "./search-and-replace"
import { getListCodeDefinitionNamesDescription } from "./list-code-definition-names"
import { getBrowserActionDescription } from "./browser-action"
Expand Down Expand Up @@ -40,7 +39,6 @@ const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined>
access_mcp_resource: (args) => getAccessMcpResourceDescription(args),
switch_mode: () => getSwitchModeDescription(),
new_task: (args) => getNewTaskDescription(args),
insert_content: (args) => getInsertContentDescription(args),
search_and_replace: (args) => getSearchAndReplaceDescription(args),
apply_diff: (args) =>
args.diffStrategy ? args.diffStrategy.getToolDescription({ cwd: args.cwd, toolOptions: args.toolOptions }) : "",
Expand Down Expand Up @@ -124,6 +122,5 @@ export {
getUseMcpToolDescription,
getAccessMcpResourceDescription,
getSwitchModeDescription,
getInsertContentDescription,
getSearchAndReplaceDescription,
}
35 changes: 0 additions & 35 deletions src/core/prompts/tools/insert-content.ts

This file was deleted.

Loading