Просмотр исходного кода

Merge pull request #1669 from franekp/public-api-current-task-ids

feat(RooCodeAPI): add getCurrentTaskStack() returning stack of task IDs
Chris Estreich 9 месяцев назад
Родитель
Сommit
5cd084de6f
3 измененных файлов с 14 добавлено и 0 удалено
  1. 4 0
      src/core/webview/ClineProvider.ts
  2. 4 0
      src/exports/api.ts
  3. 6 0
      src/exports/roo-code.d.ts

+ 4 - 0
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

+ 4 - 0
src/exports/api.ts

@@ -80,4 +80,8 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
 	public getMessages(taskId: string) {
 		return this.history.getMessages(taskId)
 	}
+
+	public getCurrentTaskStack(): string[] {
+		return this.provider.getCurrentTaskStack()
+	}
 }

+ 6 - 0
src/exports/roo-code.d.ts

@@ -62,6 +62,12 @@ export interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
 	 * @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 =