mirror of
https://github.com/cline/cline.git
synced 2025-06-03 03:59:07 +00:00
[PROTOBUS] Move exportTaskWithId to protobus (#3285)
* exportTaskWithId protobus migration * rebase fixes
This commit is contained in:
parent
7084e74372
commit
94fc619196
@ -15,6 +15,8 @@ service TaskService {
|
||||
rpc deleteTasksWithIds(StringArrayRequest) returns (Empty);
|
||||
// Creates a new task with the given text and optional images
|
||||
rpc newTask(NewTaskRequest) returns (Empty);
|
||||
// Exports a task with the given ID to markdown
|
||||
rpc exportTaskWithId(StringRequest) returns (Empty);
|
||||
}
|
||||
|
||||
// Request message for creating a new task
|
||||
|
@ -327,18 +327,9 @@ export class Controller {
|
||||
images,
|
||||
})
|
||||
break
|
||||
case "exportCurrentTask":
|
||||
const currentTaskId = this.task?.taskId
|
||||
if (currentTaskId) {
|
||||
this.exportTaskWithId(currentTaskId)
|
||||
}
|
||||
break
|
||||
case "showTaskWithId":
|
||||
this.showTaskWithId(message.text!)
|
||||
break
|
||||
case "exportTaskWithId":
|
||||
this.exportTaskWithId(message.text!)
|
||||
break
|
||||
case "resetState":
|
||||
await this.resetState()
|
||||
break
|
||||
|
22
src/core/controller/task/exportTaskWithId.ts
Normal file
22
src/core/controller/task/exportTaskWithId.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Controller } from ".."
|
||||
import { Empty, StringRequest } from "@shared/proto/common"
|
||||
import { TaskMethodHandler } from "./index"
|
||||
|
||||
/**
|
||||
* Exports a task with the given ID to markdown
|
||||
* @param controller The controller instance
|
||||
* @param request The request containing the task ID in the value field
|
||||
* @returns Empty response
|
||||
*/
|
||||
export const exportTaskWithId: TaskMethodHandler = async (controller: Controller, request: StringRequest): Promise<Empty> => {
|
||||
try {
|
||||
if (request.value) {
|
||||
await controller.exportTaskWithId(request.value)
|
||||
}
|
||||
return Empty.create()
|
||||
} catch (error) {
|
||||
// Log the error but allow it to propagate for proper gRPC error handling
|
||||
console.error(`Error exporting task with ID ${request.value}:`, error)
|
||||
throw error
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import { registerMethod } from "./index"
|
||||
import { cancelTask } from "./cancelTask"
|
||||
import { clearTask } from "./clearTask"
|
||||
import { deleteTasksWithIds } from "./deleteTasksWithIds"
|
||||
import { exportTaskWithId } from "./exportTaskWithId"
|
||||
import { newTask } from "./newTask"
|
||||
|
||||
// Register all task service methods
|
||||
@ -14,5 +15,6 @@ export function registerAllMethods(): void {
|
||||
registerMethod("cancelTask", cancelTask)
|
||||
registerMethod("clearTask", clearTask)
|
||||
registerMethod("deleteTasksWithIds", deleteTasksWithIds)
|
||||
registerMethod("exportTaskWithId", exportTaskWithId)
|
||||
registerMethod("newTask", newTask)
|
||||
}
|
||||
|
@ -16,9 +16,7 @@ export interface WebviewMessage {
|
||||
| "askResponse"
|
||||
| "didShowAnnouncement"
|
||||
| "selectImages"
|
||||
| "exportCurrentTask"
|
||||
| "showTaskWithId"
|
||||
| "exportTaskWithId"
|
||||
| "resetState"
|
||||
| "requestLmStudioModels"
|
||||
| "openInBrowser"
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"
|
||||
import { Empty, EmptyRequest, Metadata, StringArrayRequest } from "./common"
|
||||
import { Empty, EmptyRequest, Metadata, StringArrayRequest, StringRequest } from "./common"
|
||||
|
||||
export const protobufPackage = "cline"
|
||||
|
||||
@ -151,6 +151,15 @@ export const TaskServiceDefinition = {
|
||||
responseStream: false,
|
||||
options: {},
|
||||
},
|
||||
/** Exports a task with the given ID to markdown */
|
||||
exportTaskWithId: {
|
||||
name: "exportTaskWithId",
|
||||
requestType: StringRequest,
|
||||
requestStream: false,
|
||||
responseType: Empty,
|
||||
responseStream: false,
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
} as const
|
||||
|
||||
|
@ -563,7 +563,7 @@ const ExportButton = ({ itemId }: { itemId: string }) => (
|
||||
appearance="icon"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
vscode.postMessage({ type: "exportTaskWithId", text: itemId })
|
||||
TaskServiceClient.exportTaskWithId({ value: itemId }).catch((err) => console.error("Failed to export task:", err))
|
||||
}}>
|
||||
<div style={{ fontSize: "11px", fontWeight: 500, opacity: 1 }}>EXPORT</div>
|
||||
</VSCodeButton>
|
||||
|
Loading…
Reference in New Issue
Block a user