Skip to content

Commit 4d7ced7

Browse files
GarothAndrei Eternal
andauthored
[Protobus] migrate executeQuickWin (RooCodeInc#4088)
* protobuf executeQuickWin * whitespaces --------- Co-authored-by: Andrei Eternal <[email protected]>
1 parent d7e1fff commit 4d7ced7

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

proto/task.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ service TaskService {
3333
rpc taskFeedback(StringRequest) returns (Empty);
3434
// Shows task completion changes diff in a view
3535
rpc taskCompletionViewChanges(Int64Request) returns (Empty);
36+
// Executes a quick win task with command and title
37+
rpc executeQuickWin(ExecuteQuickWinRequest) returns (Empty);
3638
}
3739

3840
// Request message for creating a new task
@@ -107,3 +109,10 @@ message AskResponseRequest {
107109
repeated string images = 4;
108110
repeated string files = 5;
109111
}
112+
113+
// Request for executing a quick win task
114+
message ExecuteQuickWinRequest {
115+
Metadata metadata = 1;
116+
string command = 2;
117+
string title = 3;
118+
}

src/core/controller/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,6 @@ export class Controller {
316316
}
317317
break
318318
}
319-
case "executeQuickWin":
320-
if (message.payload) {
321-
const { command, title } = message.payload
322-
this.outputChannel.appendLine(`Received executeQuickWin: command='${command}', title='${title}'`)
323-
await this.initTask(title)
324-
}
325-
break
326319

327320
// Add more switch case statements here as more webview message commands
328321
// are created within the webview context (i.e. inside media/main.js)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { ExecuteQuickWinRequest } from "@shared/proto/task"
2+
import { Empty } from "@shared/proto/common"
3+
import type { Controller } from "../index"
4+
5+
/**
6+
* Executes a quick win task with command and title
7+
* @param controller The controller instance
8+
* @param request The execute quick win request
9+
* @returns Empty response
10+
*
11+
* @example
12+
* // Usage from webview:
13+
* import { TaskServiceClient } from "@/services/grpc-client"
14+
* import { ExecuteQuickWinRequest } from "@shared/proto/task"
15+
*
16+
* const request: ExecuteQuickWinRequest = {
17+
* command: "npm install",
18+
* title: "Install dependencies"
19+
* }
20+
*
21+
* TaskServiceClient.executeQuickWin(request)
22+
* .then(() => console.log("Quick win executed successfully"))
23+
* .catch(error => console.error("Failed to execute quick win:", error))
24+
*/
25+
export async function executeQuickWin(controller: Controller, request: ExecuteQuickWinRequest): Promise<Empty> {
26+
try {
27+
const { command, title } = request
28+
console.log(`Received executeQuickWin: command='${command}', title='${title}'`)
29+
await controller.initTask(title)
30+
return Empty.create({})
31+
} catch (error) {
32+
console.error("Failed to execute quick win:", error)
33+
throw error
34+
}
35+
}

src/shared/WebviewMessage.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export interface WebviewMessage {
2020
| "grpc_request"
2121
| "grpc_request_cancel"
2222
| "toggleWorkflow"
23-
| "executeQuickWin"
2423

2524
text?: string
2625
disabled?: boolean
@@ -71,8 +70,6 @@ export interface WebviewMessage {
7170
enabled?: boolean
7271
filename?: string
7372

74-
payload?: { command: string; title: string }
75-
7673
offset?: number
7774
shellIntegrationTimeout?: number
7875
terminalReuseEnabled?: boolean

0 commit comments

Comments
 (0)