checkpointDiff --> protobuf (#2980)

* Checkpoints diff protobuf

* Requested changes to checkpointDiff protobuf
This commit is contained in:
canvrno authored and GitHub committed 2025-04-19 14:21:10 -10:00
1 parent ba6dcb5bc9
commit 0d38381573
12 files changed
+112 -29

No files matched your search

@@ -0,0 +1,9 @@
import { Controller } from ".."
import { Empty, Int64Request } from "../../../shared/proto/common"
export async function checkpointDiff(controller: Controller, request: Int64Request): Promise<Empty> {
if (request.value) {
await controller.task?.presentMultifileDiff(request.value, false)
}
return Empty
}
+15
View File
@@ -0,0 +1,15 @@
import { createServiceRegistry, ServiceMethodHandler } from "../grpc-service"
import { registerAllMethods } from "./methods"
// Create checkpoints service registry
const checkpointsService = createServiceRegistry("checkpoints")
// Export the method handler type and registration function
export type CheckpointsMethodHandler = ServiceMethodHandler
export const registerMethod = checkpointsService.registerMethod
// Export the request handler
export const handleCheckpointsDiffServiceRequest = checkpointsService.handleRequest
// Register all checkpoints methods
registerAllMethods()
@@ -0,0 +1,12 @@
// AUTO-GENERATED FILE - DO NOT MODIFY DIRECTLY
// Generated by proto/build-proto.js
// Import all method implementations
import { registerMethod } from "./index"
import { checkpointDiff } from "./checkpointDiff"
// Register all checkpoints service methods
export function registerAllMethods(): void {
// Register each method with the registry
registerMethod("checkpointDiff", checkpointDiff)
}
+14 -8
View File
@@ -1,6 +1,7 @@
import { Controller } from "./index"
import { handleBrowserServiceRequest } from "./browser/index"
import { ExtensionMessage } from "../../shared/ExtensionMessage"
import { handleCheckpointsDiffServiceRequest } from "./checkpoints"
/**
* Handles gRPC requests from the webview
@@ -27,15 +28,20 @@ export class GrpcHandler {
request_id: string
}> {
try {
// Handle BrowserService requests
if (service === "cline.BrowserService") {
return {
message: await handleBrowserServiceRequest(this.controller, method, message),
request_id: requestId,
}
switch (service) {
case "cline.BrowserService":
return {
message: await handleBrowserServiceRequest(this.controller, method, message),
request_id: requestId,
}
case "cline.CheckpointsService":
return {
message: await handleCheckpointsDiffServiceRequest(this.controller, method, message),
request_id: requestId,
}
default:
throw new Error(`Unknown service: ${service}`)
}
throw new Error(`Unknown service: ${service}`)
} catch (error) {
return {
error: error instanceof Error ? error.message : String(error),
-6
View File
@@ -483,12 +483,6 @@ export class Controller {
case "openMention":
openMention(message.text)
break
case "checkpointDiff": {
if (message.number) {
await this.task?.presentMultifileDiff(message.number, false)
}
break
}
case "checkpointRestore": {
await this.cancelTask() // we cannot alter message history say if the task is active, as it could be in the middle of editing a file or running a command, which expect the ask to be responded to rather than being superseded by a new message eg add deleted_api_reqs
// cancel task waits for any open editor to be reverted and starts a new cline instance