feat: persist workspacePath to each task for improved task management (#2999)

This commit is contained in:
Duong M. CUONG 2025-04-29 22:57:59 +07:00 committed by GitHub
parent 8df1ee0252
commit 97f0dd4cfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,6 +134,7 @@ export class Cline extends EventEmitter<ClineEvents> {
readonly rootTask: Cline | undefined = undefined
readonly parentTask: Cline | undefined = undefined
readonly taskNumber: number
readonly workspacePath: string
isPaused: boolean = false
pausedModeSlug: string = defaultModeSlug
@ -225,6 +226,10 @@ export class Cline extends EventEmitter<ClineEvents> {
}
this.taskId = historyItem ? historyItem.id : crypto.randomUUID()
// normal use-case is usually retry similar history task with new workspace
this.workspacePath = parentTask
? parentTask.workspacePath
: getWorkspacePath(path.join(os.homedir(), "Desktop"))
this.instanceId = crypto.randomUUID().slice(0, 8)
this.taskNumber = -1
@ -292,7 +297,7 @@ export class Cline extends EventEmitter<ClineEvents> {
}
get cwd() {
return getWorkspacePath(path.join(os.homedir(), "Desktop"))
return this.workspacePath
}
// Storing task to disk for history