mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-08 22:21:23 +00:00
feat(RooCodeAPI): implement resumeTask and isTaskInHistory (#1672)
This commit is contained in:
parent
f5a4b425da
commit
cf74568f66
2 changed files with 29 additions and 0 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
14
src/exports/roo-code.d.ts
vendored
14
src/exports/roo-code.d.ts
vendored
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue