[Protobus] migrate executeQuickWin (#4088)
* protobuf executeQuickWin * whitespaces --------- Co-authored-by: Andrei Eternal <eternal@cline.bot>
This commit is contained in:
1 parent
d7e1fff011
commit
4d7ced7e15
4 files changed
+44
-10
No files matched your search
@@ -33,6 +33,8 @@ service TaskService {
|
||||
rpc taskFeedback(StringRequest) returns (Empty);
|
||||
// Shows task completion changes diff in a view
|
||||
rpc taskCompletionViewChanges(Int64Request) returns (Empty);
|
||||
// Executes a quick win task with command and title
|
||||
rpc executeQuickWin(ExecuteQuickWinRequest) returns (Empty);
|
||||
}
|
||||
|
||||
// Request message for creating a new task
|
||||
@@ -107,3 +109,10 @@ message AskResponseRequest {
|
||||
repeated string images = 4;
|
||||
repeated string files = 5;
|
||||
}
|
||||
|
||||
// Request for executing a quick win task
|
||||
message ExecuteQuickWinRequest {
|
||||
Metadata metadata = 1;
|
||||
string command = 2;
|
||||
string title = 3;
|
||||
}
|
||||
@@ -316,13 +316,6 @@ export class Controller {
|
||||
}
|
||||
break
|
||||
}
|
||||
case "executeQuickWin":
|
||||
if (message.payload) {
|
||||
const { command, title } = message.payload
|
||||
this.outputChannel.appendLine(`Received executeQuickWin: command='${command}', title='${title}'`)
|
||||
await this.initTask(title)
|
||||
}
|
||||
break
|
||||
|
||||
// Add more switch case statements here as more webview message commands
|
||||
// are created within the webview context (i.e. inside media/main.js)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { ExecuteQuickWinRequest } from "@shared/proto/task"
|
||||
import { Empty } from "@shared/proto/common"
|
||||
import type { Controller } from "../index"
|
||||
|
||||
/**
|
||||
* Executes a quick win task with command and title
|
||||
* @param controller The controller instance
|
||||
* @param request The execute quick win request
|
||||
* @returns Empty response
|
||||
*
|
||||
* @example
|
||||
* // Usage from webview:
|
||||
* import { TaskServiceClient } from "@/services/grpc-client"
|
||||
* import { ExecuteQuickWinRequest } from "@shared/proto/task"
|
||||
*
|
||||
* const request: ExecuteQuickWinRequest = {
|
||||
* command: "npm install",
|
||||
* title: "Install dependencies"
|
||||
* }
|
||||
*
|
||||
* TaskServiceClient.executeQuickWin(request)
|
||||
* .then(() => console.log("Quick win executed successfully"))
|
||||
* .catch(error => console.error("Failed to execute quick win:", error))
|
||||
*/
|
||||
export async function executeQuickWin(controller: Controller, request: ExecuteQuickWinRequest): Promise<Empty> {
|
||||
try {
|
||||
const { command, title } = request
|
||||
console.log(`Received executeQuickWin: command='${command}', title='${title}'`)
|
||||
await controller.initTask(title)
|
||||
return Empty.create({})
|
||||
} catch (error) {
|
||||
console.error("Failed to execute quick win:", error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ export interface WebviewMessage {
|
||||
| "grpc_request"
|
||||
| "grpc_request_cancel"
|
||||
| "toggleWorkflow"
|
||||
| "executeQuickWin"
|
||||
|
||||
text?: string
|
||||
disabled?: boolean
|
||||
@@ -71,8 +70,6 @@ export interface WebviewMessage {
|
||||
enabled?: boolean
|
||||
filename?: string
|
||||
|
||||
payload?: { command: string; title: string }
|
||||
|
||||
offset?: number
|
||||
shellIntegrationTimeout?: number
|
||||
terminalReuseEnabled?: boolean
|
||||
|
||||
Reference in new issue
Block a user