Browse Source

Fixes to resumeTask and isTaskInHistory (#2380)

Matt Rubens 10 months ago
parent
commit
0e4be83c35
3 changed files with 18 additions and 6 deletions
  1. 4 4
      src/exports/api.ts
  2. 14 0
      src/exports/interface.ts
  3. 0 2
      src/exports/roo-code.d.ts

+ 4 - 4
src/exports/api.ts

@@ -133,14 +133,14 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
 	}
 
 	public async resumeTask(taskId: string): Promise<void> {
-		const { historyItem } = await this.provider.getTaskWithId(taskId)
-		await this.provider.initClineWithHistoryItem(historyItem)
-		await this.provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
+		const { historyItem } = await this.sidebarProvider.getTaskWithId(taskId)
+		await this.sidebarProvider.initClineWithHistoryItem(historyItem)
+		await this.sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
 	}
 
 	public async isTaskInHistory(taskId: string): Promise<boolean> {
 		try {
-			await this.provider.getTaskWithId(taskId)
+			await this.sidebarProvider.getTaskWithId(taskId)
 			return true
 		} catch {
 			return false

+ 14 - 0
src/exports/interface.ts

@@ -27,6 +27,20 @@ export interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
 		newTab?: boolean
 	}): Promise<string>
 
+	/**
+	 * Resumes a task with the given ID.
+	 * @param taskId The ID of the task to resume.
+	 * @throws Error if the task is not found in the task history.
+	 */
+	resumeTask(taskId: string): Promise<void>
+
+	/**
+	 * Checks if a task with the given ID is in the task history.
+	 * @param taskId The ID of the task to check.
+	 * @returns True if the task is in the task history, false otherwise.
+	 */
+	isTaskInHistory(taskId: string): Promise<boolean>
+
 	/**
 	 * Returns the current task stack.
 	 * @returns An array of task IDs.

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

@@ -557,14 +557,12 @@ interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
 	 * @throws Error if the task is not found in the task history.
 	 */
 	resumeTask(taskId: string): Promise<void>
-
 	/**
 	 * Checks if a task with the given ID is in the task history.
 	 * @param taskId The ID of the task to check.
 	 * @returns True if the task is in the task history, false otherwise.
 	 */
 	isTaskInHistory(taskId: string): Promise<boolean>
-
 	/**
 	 * Returns the current task stack.
 	 * @returns An array of task IDs.