syntax = "proto3"; package host; import "cline/common.proto"; option go_package = "github.com/cline/grpc-go/host"; option java_multiple_files = true; option java_package = "bot.cline.host.proto"; // Provides methods for working with workspaces/projects. service WorkspaceService { // Returns a list of the top level directories of the workspace. rpc getWorkspacePaths(GetWorkspacePathsRequest) returns (GetWorkspacePathsResponse); // Saves an open document if it's open in the editor and has unsaved changes. // Returns true if the document was saved, returns false if the document was not found, or did not // need to be saved. rpc saveOpenDocumentIfDirty(SaveOpenDocumentIfDirtyRequest) returns (SaveOpenDocumentIfDirtyResponse); // Get diagnostics from the workspace. rpc getDiagnostics(GetDiagnosticsRequest) returns (GetDiagnosticsResponse); // Makes the problems panel/pane visible in the IDE and focuses it. rpc openProblemsPanel(OpenProblemsPanelRequest) returns (OpenProblemsPanelResponse); // Opens the IDE file explorer panel and selects a file or directory. rpc openInFileExplorerPanel(OpenInFileExplorerPanelRequest) returns (OpenInFileExplorerPanelResponse); // Opens and focuses the Cline sidebar panel in the host IDE. rpc openClineSidebarPanel(OpenClineSidebarPanelRequest) returns (OpenClineSidebarPanelResponse); // Opens and focuses the terminal panel. rpc openTerminalPanel(OpenTerminalRequest) returns (OpenTerminalResponse); // Executes a command in a new terminal rpc executeCommandInTerminal(ExecuteCommandInTerminalRequest) returns (ExecuteCommandInTerminalResponse); // Opens a folder/workspace in the IDE rpc openFolder(OpenFolderRequest) returns (OpenFolderResponse); // Searches workspace files/folders by name using the host's native index // (e.g. IntelliJ FilenameIndex). Hosts that lack a fast index should leave // this UNIMPLEMENTED so the caller can fall back to ripgrep. rpc searchWorkspaceItems(SearchWorkspaceItemsRequest) returns (SearchWorkspaceItemsResponse); } message GetWorkspacePathsRequest { // The unique ID for the workspace/project. // This is currently optional in vscode. It is required in other environments where cline is running at // the application level, and the user can open multiple projects. optional string id = 1; } message GetWorkspacePathsResponse { // The unique ID for the workspace/project. optional string id = 1; repeated string paths = 2; } message SaveOpenDocumentIfDirtyRequest { optional string file_path = 2; } message SaveOpenDocumentIfDirtyResponse { // Returns true if the document was saved. optional bool was_saved = 1; } message GetDiagnosticsRequest { optional cline.Metadata metadata = 1; } message GetDiagnosticsResponse { repeated cline.FileDiagnostics file_diagnostics = 1; } // Request for host-side workspace search (files/folders) used by mentions autocomplete message SearchWorkspaceItemsRequest { string query = 1; // Search query string optional int32 limit = 2; // Optional limit for results (default decided by host) // Optional selected type filter enum SearchItemType { FILE = 0; FOLDER = 1; } optional SearchItemType selected_type = 3; // Absolute path of the workspace/content root to scope the search to. In // multi-root projects the caller invokes the RPC once per root and sets // this so the host returns only files under that root and relativizes // paths against it. Hosts that can't honor it should ignore it. optional string workspace_path = 4; } // Response for host-side workspace search message SearchWorkspaceItemsResponse { message SearchItem { string path = 1; // Workspace-relative path using platform separators SearchWorkspaceItemsRequest.SearchItemType type = 2; optional string label = 3; // Optional display label (e.g., basename) } repeated SearchItem items = 1; } message OpenProblemsPanelRequest {} message OpenProblemsPanelResponse {} message OpenInFileExplorerPanelRequest { string path = 1; } message OpenInFileExplorerPanelResponse {} message OpenClineSidebarPanelRequest {} message OpenClineSidebarPanelResponse {} message OpenTerminalRequest {} message OpenTerminalResponse {} // Execute a command in the terminal message ExecuteCommandInTerminalRequest { string command = 1; // The command to execute } message ExecuteCommandInTerminalResponse { bool success = 1; // Whether the command was successfully sent to the terminal } // Request to open a folder/workspace message OpenFolderRequest { string path = 1; // The path to the folder to open bool new_window = 2; // Whether to open in a new window } message OpenFolderResponse { bool success = 1; }