Fixes to resumeTask and isTaskInHistory (#2380)

This commit is contained in:
Matt Rubens 2025-04-07 11:41:08 -04:00 committed by GitHub
parent cf74568f66
commit 0e4be83c35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 6 deletions

View file

@ -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

View file

@ -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.

View file

@ -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.