diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 87f33dc4180..67bb03d585e 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -169,6 +169,10 @@ export class ClineProvider implements vscode.WebviewViewProvider { return this.clineStack.length } + public getCurrentTaskStack(): string[] { + return this.clineStack.map((cline) => cline.taskId) + } + // remove the current task/cline instance (at the top of the stack), ao this task is finished // and resume the previous task/cline instance (if it exists) // this is used when a sub task is finished and the parent task needs to be resumed diff --git a/src/exports/api.ts b/src/exports/api.ts index 91817fcc58d..9590f9cbf81 100644 --- a/src/exports/api.ts +++ b/src/exports/api.ts @@ -79,4 +79,8 @@ export class API extends EventEmitter implements RooCodeAPI { public getMessages(taskId: string) { return this.history.getMessages(taskId) } + + public getCurrentTaskStack(): string[] { + return this.provider.getCurrentTaskStack() + } } diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index 1c45dec84bc..6128e4a7c4c 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -62,6 +62,12 @@ export interface RooCodeAPI extends EventEmitter { * @returns An array of ClineMessage objects. */ getMessages(taskId: string): ClineMessage[] + + /** + * Returns the current task stack. + * @returns An array of task IDs. + */ + getCurrentTaskStack(): string[] } export type ClineAsk =