feat(RooCodeAPI): implement resumeTask and isTaskInHistory (#1672)

This commit is contained in:
Franciszek Piszcz 2025-04-07 17:19:47 +02:00 committed by GitHub
parent f5a4b425da
commit cf74568f66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View file

@ -132,6 +132,21 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
return taskId
}
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" })
}
public async isTaskInHistory(taskId: string): Promise<boolean> {
try {
await this.provider.getTaskWithId(taskId)
return true
} catch {
return false
}
}
public getCurrentTaskStack() {
return this.sidebarProvider.getCurrentTaskStack()
}

View file

@ -551,6 +551,20 @@ interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
images?: string[]
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.