mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
added connection between task to its parent and root parent + adjusted cline mock in the provider test
This commit is contained in:
parent
b1dae213c5
commit
2c813663f2
3 changed files with 38 additions and 0 deletions
|
|
@ -92,7 +92,12 @@ export class Cline {
|
|||
private isSubTask: boolean = false
|
||||
// a flag that indicated if this Cline instance is paused (waiting for provider to resume it after subtask completion)
|
||||
private isPaused: boolean = false
|
||||
// this is the parent task work mode when it launched the subtask to be used when it is restored (so the last used mode by parent task will also be restored)
|
||||
private pausedModeSlug: string = defaultModeSlug
|
||||
// if this is a subtask then this member holds a pointer to the parent task that launched it
|
||||
private parentTask: Cline | undefined = undefined
|
||||
// if this is a subtask then this member holds a pointer to the top parent task that launched it
|
||||
private rootTask: Cline | undefined = undefined
|
||||
readonly apiConfiguration: ApiConfiguration
|
||||
api: ApiHandler
|
||||
private terminalManager: TerminalManager
|
||||
|
|
@ -218,6 +223,30 @@ export class Cline {
|
|||
return this.taskNumber
|
||||
}
|
||||
|
||||
// this method returns the cline instance that is the parent task that launched this subtask (assuming this cline is a subtask)
|
||||
// if undefined is returned, then there is no parent task and this is not a subtask or connection has been severed
|
||||
getParentTask(): Cline | undefined {
|
||||
return this.parentTask
|
||||
}
|
||||
|
||||
// this method sets a cline instance that is the parent task that called this task (assuming this cline is a subtask)
|
||||
// if undefined is set, then the connection is broken and the parent is no longer saved in the subtask member
|
||||
setParentTask(parentToSet: Cline | undefined) {
|
||||
this.parentTask = parentToSet
|
||||
}
|
||||
|
||||
// this method returns the cline instance that is the root task (top most parent) that eventually launched this subtask (assuming this cline is a subtask)
|
||||
// if undefined is returned, then there is no root task and this is not a subtask or connection has been severed
|
||||
getRootTask(): Cline | undefined {
|
||||
return this.rootTask
|
||||
}
|
||||
|
||||
// this method sets a cline instance that is the root task (top most patrnt) that called this task (assuming this cline is a subtask)
|
||||
// if undefined is set, then the connection is broken and the root is no longer saved in the subtask member
|
||||
setRootTask(rootToSet: Cline | undefined) {
|
||||
this.rootTask = rootToSet
|
||||
}
|
||||
|
||||
// Add method to update diffStrategy
|
||||
async updateDiffStrategy(experimentalDiffStrategy?: boolean) {
|
||||
// If not provided, get from current state
|
||||
|
|
|
|||
|
|
@ -114,6 +114,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
this.lastTaskNumber = taskNumber
|
||||
}
|
||||
|
||||
// set this cline task parent cline (the task that launched it), and the root cline (the top most task that eventually launched it)
|
||||
if (this.clineStack.length >= 1) {
|
||||
cline.setParentTask(this.getCurrentCline())
|
||||
cline.setRootTask(this.clineStack[0])
|
||||
}
|
||||
|
||||
// add this cline instance into the stack that represents the order of all the called tasks
|
||||
this.clineStack.push(cline)
|
||||
|
||||
// Ensure getState() resolves correctly
|
||||
|
|
|
|||
|
|
@ -209,6 +209,8 @@ jest.mock("../../Cline", () => ({
|
|||
overwriteApiConversationHistory: jest.fn(),
|
||||
getTaskNumber: jest.fn().mockReturnValue(0),
|
||||
setTaskNumber: jest.fn(),
|
||||
setParentTask: jest.fn(),
|
||||
setRootTask: jest.fn(),
|
||||
taskId: taskId || "test-task-id",
|
||||
}),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue