Compare commits

...

2 Commits

Author SHA1 Message Date
Andrei Eternal b89b275915 whitespaces 2025-06-06 14:26:22 -07:00
Andrei Eternal ef3ede31a4 protobuf executeQuickWin 2025-06-06 14:18:36 -07:00
4 changed files with 44 additions and 10 deletions
+9
View File
@@ -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;
}
-7
View File
@@ -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
}
}
-3
View File
@@ -22,7 +22,6 @@ export interface WebviewMessage {
| "grpc_request"
| "grpc_request_cancel"
| "toggleWorkflow"
| "executeQuickWin"
text?: string
disabled?: boolean
@@ -73,8 +72,6 @@ export interface WebviewMessage {
enabled?: boolean
filename?: string
payload?: { command: string; title: string }
offset?: number
shellIntegrationTimeout?: number
terminalReuseEnabled?: boolean