Skip to content

Commit cf74568

Browse files
authored
feat(RooCodeAPI): implement resumeTask and isTaskInHistory (RooCodeInc#1672)
1 parent f5a4b42 commit cf74568

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/exports/api.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
132132
return taskId
133133
}
134134

135+
public async resumeTask(taskId: string): Promise<void> {
136+
const { historyItem } = await this.provider.getTaskWithId(taskId)
137+
await this.provider.initClineWithHistoryItem(historyItem)
138+
await this.provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
139+
}
140+
141+
public async isTaskInHistory(taskId: string): Promise<boolean> {
142+
try {
143+
await this.provider.getTaskWithId(taskId)
144+
return true
145+
} catch {
146+
return false
147+
}
148+
}
149+
135150
public getCurrentTaskStack() {
136151
return this.sidebarProvider.getCurrentTaskStack()
137152
}

src/exports/roo-code.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,20 @@ interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
551551
images?: string[]
552552
newTab?: boolean
553553
}): Promise<string>
554+
/**
555+
* Resumes a task with the given ID.
556+
* @param taskId The ID of the task to resume.
557+
* @throws Error if the task is not found in the task history.
558+
*/
559+
resumeTask(taskId: string): Promise<void>
560+
561+
/**
562+
* Checks if a task with the given ID is in the task history.
563+
* @param taskId The ID of the task to check.
564+
* @returns True if the task is in the task history, false otherwise.
565+
*/
566+
isTaskInHistory(taskId: string): Promise<boolean>
567+
554568
/**
555569
* Returns the current task stack.
556570
* @returns An array of task IDs.

0 commit comments

Comments
 (0)