Skip to content
Merged
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 @@ -56,7 +56,6 @@ export const rooCodeDefaults: RooCodeSettings = {
diffEnabled: true,
fuzzyMatchThreshold: 1.0,
experiments: {
insert_content: false,
powerSteering: 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 = ["insert_content", "powerSteering"] as const
export const experimentIds = ["powerSteering"] as const

export const experimentIdsSchema = z.enum(experimentIds)

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

const experimentsSchema = z.object({
insert_content: z.boolean(),
powerSteering: z.boolean(),
})

Expand Down
6 changes: 0 additions & 6 deletions src/core/Cline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import { askFollowupQuestionTool } from "./tools/askFollowupQuestionTool"
import { switchModeTool } from "./tools/switchModeTool"
import { attemptCompletionTool } from "./tools/attemptCompletionTool"
import { newTaskTool } from "./tools/newTaskTool"
import { appendToFileTool } from "./tools/appendToFileTool"

// prompts
import { formatResponse } from "./prompts/responses"
Expand Down Expand Up @@ -1242,8 +1241,6 @@ export class Cline extends EventEmitter<ClineEvents> {
return `[${block.name} for '${block.params.task}']`
case "write_to_file":
return `[${block.name} for '${block.params.path}']`
case "append_to_file":
return `[${block.name} for '${block.params.path}']`
case "apply_diff":
return `[${block.name} for '${block.params.path}']`
case "search_files":
Expand Down Expand Up @@ -1428,9 +1425,6 @@ export class Cline extends EventEmitter<ClineEvents> {
case "write_to_file":
await writeToFileTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "append_to_file":
await appendToFileTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "apply_diff":
await applyDiffTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
Expand Down
15 changes: 11 additions & 4 deletions src/core/diff/insert-groups.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* Inserts multiple groups of elements at specified indices in an array
* @param original Array to insert into, split by lines
* @param insertGroups Array of groups to insert, each with an index and elements to insert
* @param insertGroups Array of groups to insert, each with an index and elements to insert.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need this file?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I guess we're still using it. It's only one group though now right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah 💪🏻

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this simpler if it's only one group?

* If index is -1, the elements will be appended to the end of the array.
* @returns New array with all insertions applied
*/
export interface InsertGroup {
Expand All @@ -10,13 +11,14 @@ export interface InsertGroup {
}

export function insertGroups(original: string[], insertGroups: InsertGroup[]): string[] {
// Sort groups by index to maintain order
insertGroups.sort((a, b) => a.index - b.index)
// Handle groups with index -1 separately and sort remaining groups by index
const appendGroups = insertGroups.filter((group) => group.index === -1)
const normalGroups = insertGroups.filter((group) => group.index !== -1).sort((a, b) => a.index - b.index)

let result: string[] = []
let lastIndex = 0

insertGroups.forEach(({ index, elements }) => {
normalGroups.forEach(({ index, elements }) => {
// Add elements from original array up to insertion point
result.push(...original.slice(lastIndex, index))
// Add the group of elements
Expand All @@ -27,5 +29,10 @@ export function insertGroups(original: string[], insertGroups: InsertGroup[]): s
// Add remaining elements from original array
result.push(...original.slice(lastIndex))

// Append elements from groups with index -1 at the end
appendGroups.forEach(({ elements }) => {
result.push(...elements)
})

return result
}
Loading