You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// a flag that indicated if this Cline instance is a subtask (on finish return control to parent task)
99
+
privateisSubTask: boolean=false
100
+
// a flag that indicated if this Cline instance is paused (waiting for provider to resume it after subtask completion)
101
+
privateisPaused: boolean=false
102
+
// 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)
103
+
privatepausedModeSlug: string=defaultModeSlug
104
+
// if this is a subtask then this member holds a pointer to the parent task that launched it
105
+
privateparentTask: Cline|undefined=undefined
106
+
// if this is a subtask then this member holds a pointer to the top parent task that launched it
// a helper function to set the private member isSubTask to true
217
+
// and by that set this Cline instance to be a subtask (on finish return control to parent task)
218
+
setSubTask(){
219
+
this.isSubTask=true
220
+
}
221
+
222
+
// sets the task number (sequencial number of this task from all the subtask ran from this main task stack)
223
+
setTaskNumber(taskNumber: number){
224
+
this.taskNumber=taskNumber
225
+
}
226
+
227
+
// gets the task number, the sequencial number of this task from all the subtask ran from this main task stack
228
+
getTaskNumber(){
229
+
returnthis.taskNumber
230
+
}
231
+
232
+
// this method returns the cline instance that is the parent task that launched this subtask (assuming this cline is a subtask)
233
+
// if undefined is returned, then there is no parent task and this is not a subtask or connection has been severed
234
+
getParentTask(): Cline|undefined{
235
+
returnthis.parentTask
236
+
}
237
+
238
+
// this method sets a cline instance that is the parent task that called this task (assuming this cline is a subtask)
239
+
// if undefined is set, then the connection is broken and the parent is no longer saved in the subtask member
240
+
setParentTask(parentToSet: Cline|undefined){
241
+
this.parentTask=parentToSet
242
+
}
243
+
244
+
// 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)
245
+
// if undefined is returned, then there is no root task and this is not a subtask or connection has been severed
246
+
getRootTask(): Cline|undefined{
247
+
returnthis.rootTask
248
+
}
249
+
250
+
// this method sets a cline instance that is the root task (top most patrnt) that called this task (assuming this cline is a subtask)
251
+
// if undefined is set, then the connection is broken and the root is no longer saved in the subtask member
// If this Cline instance was aborted by the provider, then the only thing keeping us alive is a promise still running in the background, in which case we don't want to send its result to the webview as it is attached to a new instance of Cline now. So we can safely ignore the result of any active promises, and this class will be deallocated. (Although we set Cline = undefined in provider, that simply removes the reference to this instance, but the instance is still alive until this promise resolves or rejects.)
// wait for mode to actually switch in UI and in State
2986
+
awaitdelay(500)// delay to allow mode change to take effect before next tool is executed
2987
+
this.providerRef
2988
+
.deref()
2989
+
?.log(
2990
+
`[subtasks] Task: ${this.taskNumber} has switched back to mode: '${this.pausedModeSlug}' from mode: '${currentMode}'`,
2991
+
)
2992
+
}
2993
+
}
2994
+
2856
2995
// getting verbose details is an expensive operation, it uses globby to top-down build file structure of project which for large projects can take a few seconds
2857
2996
// for the best UX we show a placeholder api_req_started message with a loading spinner as this happens
2858
2997
awaitthis.say(
@@ -3042,7 +3181,7 @@ export class Cline {
3042
3181
3043
3182
// need to call here in case the stream was aborted
0 commit comments