Split protobufs into separate files (#28130)
The one big protobuf file was getting a bit difficult to navigate. I split it into separate topic-specific files that import each other. Release Notes: - N/A
This commit is contained in:
parent
e74af03065
commit
8ab252c42d
19 changed files with 3454 additions and 3387 deletions
213
crates/proto/proto/ai.proto
Normal file
213
crates/proto/proto/ai.proto
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
message Context {
|
||||||
|
repeated ContextOperation operations = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextMetadata {
|
||||||
|
string context_id = 1;
|
||||||
|
optional string summary = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextMessageStatus {
|
||||||
|
oneof variant {
|
||||||
|
Done done = 1;
|
||||||
|
Pending pending = 2;
|
||||||
|
Error error = 3;
|
||||||
|
Canceled canceled = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Done {}
|
||||||
|
|
||||||
|
message Pending {}
|
||||||
|
|
||||||
|
message Error {
|
||||||
|
string message = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Canceled {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextMessage {
|
||||||
|
LamportTimestamp id = 1;
|
||||||
|
Anchor start = 2;
|
||||||
|
LanguageModelRole role = 3;
|
||||||
|
ContextMessageStatus status = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlashCommandOutputSection {
|
||||||
|
AnchorRange range = 1;
|
||||||
|
string icon_name = 2;
|
||||||
|
string label = 3;
|
||||||
|
optional string metadata = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ThoughtProcessOutputSection {
|
||||||
|
AnchorRange range = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextOperation {
|
||||||
|
oneof variant {
|
||||||
|
InsertMessage insert_message = 1;
|
||||||
|
UpdateMessage update_message = 2;
|
||||||
|
UpdateSummary update_summary = 3;
|
||||||
|
BufferOperation buffer_operation = 5;
|
||||||
|
SlashCommandStarted slash_command_started = 6;
|
||||||
|
SlashCommandOutputSectionAdded slash_command_output_section_added = 7;
|
||||||
|
SlashCommandCompleted slash_command_completed = 8;
|
||||||
|
ThoughtProcessOutputSectionAdded thought_process_output_section_added = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
reserved 4;
|
||||||
|
|
||||||
|
message InsertMessage {
|
||||||
|
ContextMessage message = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateMessage {
|
||||||
|
LamportTimestamp message_id = 1;
|
||||||
|
LanguageModelRole role = 2;
|
||||||
|
ContextMessageStatus status = 3;
|
||||||
|
LamportTimestamp timestamp = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateSummary {
|
||||||
|
string summary = 1;
|
||||||
|
bool done = 2;
|
||||||
|
LamportTimestamp timestamp = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlashCommandStarted {
|
||||||
|
LamportTimestamp id = 1;
|
||||||
|
AnchorRange output_range = 2;
|
||||||
|
string name = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlashCommandOutputSectionAdded {
|
||||||
|
LamportTimestamp timestamp = 1;
|
||||||
|
SlashCommandOutputSection section = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlashCommandCompleted {
|
||||||
|
LamportTimestamp id = 1;
|
||||||
|
LamportTimestamp timestamp = 3;
|
||||||
|
optional string error_message = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ThoughtProcessOutputSectionAdded {
|
||||||
|
LamportTimestamp timestamp = 1;
|
||||||
|
ThoughtProcessOutputSection section = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferOperation {
|
||||||
|
Operation operation = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdvertiseContexts {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated ContextMetadata contexts = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenContext {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string context_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenContextResponse {
|
||||||
|
Context context = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateContext {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateContextResponse {
|
||||||
|
string context_id = 1;
|
||||||
|
Context context = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateContext {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string context_id = 2;
|
||||||
|
ContextOperation operation = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextVersion {
|
||||||
|
string context_id = 1;
|
||||||
|
repeated VectorClockEntry context_version = 2;
|
||||||
|
repeated VectorClockEntry buffer_version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SynchronizeContexts {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated ContextVersion contexts = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SynchronizeContextsResponse {
|
||||||
|
repeated ContextVersion contexts = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetLlmToken {}
|
||||||
|
|
||||||
|
message GetLlmTokenResponse {
|
||||||
|
string token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RefreshLlmToken {}
|
||||||
|
|
||||||
|
enum LanguageModelRole {
|
||||||
|
LanguageModelUser = 0;
|
||||||
|
LanguageModelAssistant = 1;
|
||||||
|
LanguageModelSystem = 2;
|
||||||
|
reserved 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CountLanguageModelTokens {
|
||||||
|
LanguageModelProvider provider = 1;
|
||||||
|
string request = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CountLanguageModelTokensResponse {
|
||||||
|
uint32 token_count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum LanguageModelProvider {
|
||||||
|
Anthropic = 0;
|
||||||
|
OpenAI = 1;
|
||||||
|
Google = 2;
|
||||||
|
Zed = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCachedEmbeddings {
|
||||||
|
string model = 1;
|
||||||
|
repeated bytes digests = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCachedEmbeddingsResponse {
|
||||||
|
repeated Embedding embeddings = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ComputeEmbeddings {
|
||||||
|
string model = 1;
|
||||||
|
repeated string texts = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ComputeEmbeddingsResponse {
|
||||||
|
repeated Embedding embeddings = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Embedding {
|
||||||
|
bytes digest = 1;
|
||||||
|
repeated float dimensions = 2;
|
||||||
|
}
|
93
crates/proto/proto/app.proto
Normal file
93
crates/proto/proto/app.proto
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
message UpdateInviteInfo {
|
||||||
|
string url = 1;
|
||||||
|
uint32 count = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPrivateUserInfo {}
|
||||||
|
|
||||||
|
message GetPrivateUserInfoResponse {
|
||||||
|
string metrics_id = 1;
|
||||||
|
bool staff = 2;
|
||||||
|
repeated string flags = 3;
|
||||||
|
optional uint64 accepted_tos_at = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Plan {
|
||||||
|
Free = 0;
|
||||||
|
ZedPro = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateUserPlan {
|
||||||
|
Plan plan = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AcceptTermsOfService {}
|
||||||
|
|
||||||
|
message AcceptTermsOfServiceResponse {
|
||||||
|
uint64 accepted_tos_at = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ShutdownRemoteServer {}
|
||||||
|
|
||||||
|
message Toast {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string notification_id = 2;
|
||||||
|
string message = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HideToast {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string notification_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenServerSettings {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPanicFiles {
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPanicFilesResponse {
|
||||||
|
repeated string file_contents = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Extension {
|
||||||
|
string id = 1;
|
||||||
|
string version = 2;
|
||||||
|
bool dev = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SyncExtensions {
|
||||||
|
repeated Extension extensions = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SyncExtensionsResponse {
|
||||||
|
string tmp_dir = 1;
|
||||||
|
repeated Extension missing_extensions = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InstallExtension {
|
||||||
|
Extension extension = 1;
|
||||||
|
string tmp_dir = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AskPassRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
uint64 askpass_id = 4;
|
||||||
|
string prompt = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AskPassResponse {
|
||||||
|
string response = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetSupermavenApiKey {}
|
||||||
|
|
||||||
|
message GetSupermavenApiKeyResponse {
|
||||||
|
string api_key = 1;
|
||||||
|
}
|
293
crates/proto/proto/buffer.proto
Normal file
293
crates/proto/proto/buffer.proto
Normal file
|
@ -0,0 +1,293 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "core.proto";
|
||||||
|
import "worktree.proto";
|
||||||
|
|
||||||
|
message OpenNewBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenBufferResponse {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateBufferForPeer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
PeerId peer_id = 2;
|
||||||
|
oneof variant {
|
||||||
|
BufferState state = 3;
|
||||||
|
BufferChunk chunk = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated Operation operations = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenBufferByPath {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string path = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenBufferById {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateBufferFile {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
File file = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SaveBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
optional ProjectPath new_path = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CloseBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferSaved {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
Timestamp mtime = 4;
|
||||||
|
reserved 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferReloaded {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
Timestamp mtime = 4;
|
||||||
|
reserved 5;
|
||||||
|
LineEnding line_ending = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ReloadBuffers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated uint64 buffer_ids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ReloadBuffersResponse {
|
||||||
|
ProjectTransaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SynchronizeBuffers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated BufferVersion buffers = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SynchronizeBuffersResponse {
|
||||||
|
repeated BufferVersion buffers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferVersion {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferState {
|
||||||
|
uint64 id = 1;
|
||||||
|
optional File file = 2;
|
||||||
|
string base_text = 3;
|
||||||
|
LineEnding line_ending = 5;
|
||||||
|
repeated VectorClockEntry saved_version = 6;
|
||||||
|
Timestamp saved_mtime = 8;
|
||||||
|
|
||||||
|
reserved 7;
|
||||||
|
reserved 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BufferChunk {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
repeated Operation operations = 2;
|
||||||
|
bool is_last = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum LineEnding {
|
||||||
|
Unix = 0;
|
||||||
|
Windows = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VectorClockEntry {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 timestamp = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UndoMapEntry {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 local_timestamp = 2;
|
||||||
|
repeated UndoCount counts = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UndoCount {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
uint32 count = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Operation {
|
||||||
|
oneof variant {
|
||||||
|
Edit edit = 1;
|
||||||
|
Undo undo = 2;
|
||||||
|
UpdateSelections update_selections = 3;
|
||||||
|
UpdateDiagnostics update_diagnostics = 4;
|
||||||
|
UpdateCompletionTriggers update_completion_triggers = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Edit {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
repeated Range ranges = 4;
|
||||||
|
repeated string new_text = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Undo {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
repeated UndoCount counts = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateSelections {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
repeated Selection selections = 3;
|
||||||
|
bool line_mode = 4;
|
||||||
|
CursorShape cursor_shape = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateCompletionTriggers {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
repeated string triggers = 3;
|
||||||
|
uint64 language_server_id = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProjectTransaction {
|
||||||
|
repeated uint64 buffer_ids = 1;
|
||||||
|
repeated Transaction transactions = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Transaction {
|
||||||
|
LamportTimestamp id = 1;
|
||||||
|
repeated LamportTimestamp edit_ids = 2;
|
||||||
|
repeated VectorClockEntry start = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LamportTimestamp {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Range {
|
||||||
|
uint64 start = 1;
|
||||||
|
uint64 end = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Selection {
|
||||||
|
uint64 id = 1;
|
||||||
|
EditorAnchor start = 2;
|
||||||
|
EditorAnchor end = 3;
|
||||||
|
bool reversed = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EditorAnchor {
|
||||||
|
uint64 excerpt_id = 1;
|
||||||
|
Anchor anchor = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CursorShape {
|
||||||
|
CursorBar = 0;
|
||||||
|
CursorBlock = 1;
|
||||||
|
CursorUnderscore = 2;
|
||||||
|
CursorHollow = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateDiagnostics {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 lamport_timestamp = 2;
|
||||||
|
uint64 server_id = 3;
|
||||||
|
repeated Diagnostic diagnostics = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Anchor {
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
uint32 timestamp = 2;
|
||||||
|
uint64 offset = 3;
|
||||||
|
Bias bias = 4;
|
||||||
|
optional uint64 buffer_id = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AnchorRange {
|
||||||
|
Anchor start = 1;
|
||||||
|
Anchor end = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Location {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
Anchor start = 2;
|
||||||
|
Anchor end = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Bias {
|
||||||
|
Left = 0;
|
||||||
|
Right = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Diagnostic {
|
||||||
|
Anchor start = 1;
|
||||||
|
Anchor end = 2;
|
||||||
|
optional string source = 3;
|
||||||
|
Severity severity = 4;
|
||||||
|
string message = 5;
|
||||||
|
optional string code = 6;
|
||||||
|
uint64 group_id = 7;
|
||||||
|
bool is_primary = 8;
|
||||||
|
|
||||||
|
reserved 9;
|
||||||
|
|
||||||
|
bool is_disk_based = 10;
|
||||||
|
bool is_unnecessary = 11;
|
||||||
|
|
||||||
|
enum Severity {
|
||||||
|
None = 0;
|
||||||
|
Error = 1;
|
||||||
|
Warning = 2;
|
||||||
|
Information = 3;
|
||||||
|
Hint = 4;
|
||||||
|
}
|
||||||
|
optional string data = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SearchQuery {
|
||||||
|
string query = 2;
|
||||||
|
bool regex = 3;
|
||||||
|
bool whole_word = 4;
|
||||||
|
bool case_sensitive = 5;
|
||||||
|
string files_to_include = 6;
|
||||||
|
string files_to_exclude = 7;
|
||||||
|
bool include_ignored = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindSearchCandidates {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
SearchQuery query = 2;
|
||||||
|
uint64 limit = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindSearchCandidatesResponse {
|
||||||
|
repeated uint64 buffer_ids = 1;
|
||||||
|
}
|
417
crates/proto/proto/call.proto
Normal file
417
crates/proto/proto/call.proto
Normal file
|
@ -0,0 +1,417 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "core.proto";
|
||||||
|
import "worktree.proto";
|
||||||
|
import "buffer.proto";
|
||||||
|
import "lsp.proto";
|
||||||
|
import "channel.proto";
|
||||||
|
import "git.proto";
|
||||||
|
|
||||||
|
message CreateRoom {}
|
||||||
|
|
||||||
|
message CreateRoomResponse {
|
||||||
|
Room room = 1;
|
||||||
|
optional LiveKitConnectionInfo live_kit_connection_info = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinRoom {
|
||||||
|
uint64 id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinRoomResponse {
|
||||||
|
Room room = 1;
|
||||||
|
optional uint64 channel_id = 2;
|
||||||
|
optional LiveKitConnectionInfo live_kit_connection_info = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinRoom {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated UpdateProject reshared_projects = 2;
|
||||||
|
repeated RejoinProject rejoined_projects = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinRemoteProjects {
|
||||||
|
repeated RejoinProject rejoined_projects = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinRemoteProjectsResponse {
|
||||||
|
repeated RejoinedProject rejoined_projects = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinProject {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated RejoinWorktree worktrees = 2;
|
||||||
|
repeated RejoinRepository repositories = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinWorktree {
|
||||||
|
uint64 id = 1;
|
||||||
|
uint64 scan_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinRepository {
|
||||||
|
uint64 id = 1;
|
||||||
|
uint64 scan_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinRoomResponse {
|
||||||
|
Room room = 1;
|
||||||
|
repeated ResharedProject reshared_projects = 2;
|
||||||
|
repeated RejoinedProject rejoined_projects = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResharedProject {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated Collaborator collaborators = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinedProject {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated WorktreeMetadata worktrees = 2;
|
||||||
|
repeated Collaborator collaborators = 3;
|
||||||
|
repeated LanguageServer language_servers = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LeaveRoom {}
|
||||||
|
|
||||||
|
message Room {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated Participant participants = 2;
|
||||||
|
repeated PendingParticipant pending_participants = 3;
|
||||||
|
repeated Follower followers = 4;
|
||||||
|
string livekit_room = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Participant {
|
||||||
|
uint64 user_id = 1;
|
||||||
|
PeerId peer_id = 2;
|
||||||
|
repeated ParticipantProject projects = 3;
|
||||||
|
ParticipantLocation location = 4;
|
||||||
|
uint32 participant_index = 5;
|
||||||
|
ChannelRole role = 6;
|
||||||
|
reserved 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PendingParticipant {
|
||||||
|
uint64 user_id = 1;
|
||||||
|
uint64 calling_user_id = 2;
|
||||||
|
optional uint64 initial_project_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ParticipantProject {
|
||||||
|
uint64 id = 1;
|
||||||
|
repeated string worktree_root_names = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Follower {
|
||||||
|
PeerId leader_id = 1;
|
||||||
|
PeerId follower_id = 2;
|
||||||
|
uint64 project_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ParticipantLocation {
|
||||||
|
oneof variant {
|
||||||
|
SharedProject shared_project = 1;
|
||||||
|
UnsharedProject unshared_project = 2;
|
||||||
|
External external = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SharedProject {
|
||||||
|
uint64 id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnsharedProject {}
|
||||||
|
|
||||||
|
message External {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Call {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
uint64 called_user_id = 2;
|
||||||
|
optional uint64 initial_project_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message IncomingCall {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
uint64 calling_user_id = 2;
|
||||||
|
repeated uint64 participant_user_ids = 3;
|
||||||
|
optional ParticipantProject initial_project = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CallCanceled {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CancelCall {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
uint64 called_user_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeclineCall {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateParticipantLocation {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
ParticipantLocation location = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RoomUpdated {
|
||||||
|
Room room = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LiveKitConnectionInfo {
|
||||||
|
string server_url = 1;
|
||||||
|
string token = 2;
|
||||||
|
bool can_publish = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ShareProject {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
repeated WorktreeMetadata worktrees = 2;
|
||||||
|
reserved 3;
|
||||||
|
bool is_ssh_project = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ShareProjectResponse {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnshareProject {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateProject {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated WorktreeMetadata worktrees = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinProject {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinProjectResponse {
|
||||||
|
uint64 project_id = 5;
|
||||||
|
uint32 replica_id = 1;
|
||||||
|
repeated WorktreeMetadata worktrees = 2;
|
||||||
|
repeated Collaborator collaborators = 3;
|
||||||
|
repeated LanguageServer language_servers = 4;
|
||||||
|
ChannelRole role = 6;
|
||||||
|
reserved 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LeaveProject {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateWorktree {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string root_name = 3;
|
||||||
|
repeated Entry updated_entries = 4;
|
||||||
|
repeated uint64 removed_entries = 5;
|
||||||
|
repeated RepositoryEntry updated_repositories = 6; // deprecated
|
||||||
|
repeated uint64 removed_repositories = 7; // deprecated
|
||||||
|
uint64 scan_id = 8;
|
||||||
|
bool is_last_update = 9;
|
||||||
|
string abs_path = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// deprecated
|
||||||
|
message RepositoryEntry {
|
||||||
|
uint64 repository_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
repeated StatusEntry updated_statuses = 3;
|
||||||
|
repeated string removed_statuses = 4;
|
||||||
|
repeated string current_merge_conflicts = 5;
|
||||||
|
optional Branch branch_summary = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddProjectCollaborator {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
Collaborator collaborator = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateProjectCollaborator {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
PeerId old_peer_id = 2;
|
||||||
|
PeerId new_peer_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveProjectCollaborator {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
PeerId peer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetUsers {
|
||||||
|
repeated uint64 user_ids = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FuzzySearchUsers {
|
||||||
|
string query = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UsersResponse {
|
||||||
|
repeated User users = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RequestContact {
|
||||||
|
uint64 responder_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveContact {
|
||||||
|
uint64 user_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RespondToContactRequest {
|
||||||
|
uint64 requester_id = 1;
|
||||||
|
ContactRequestResponse response = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ContactRequestResponse {
|
||||||
|
Accept = 0;
|
||||||
|
Decline = 1;
|
||||||
|
Block = 2;
|
||||||
|
Dismiss = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateContacts {
|
||||||
|
repeated Contact contacts = 1;
|
||||||
|
repeated uint64 remove_contacts = 2;
|
||||||
|
repeated IncomingContactRequest incoming_requests = 3;
|
||||||
|
repeated uint64 remove_incoming_requests = 4;
|
||||||
|
repeated uint64 outgoing_requests = 5;
|
||||||
|
repeated uint64 remove_outgoing_requests = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ShowContacts {}
|
||||||
|
|
||||||
|
message IncomingContactRequest {
|
||||||
|
uint64 requester_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Follow {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
optional uint64 project_id = 2;
|
||||||
|
PeerId leader_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FollowResponse {
|
||||||
|
View active_view = 3;
|
||||||
|
// TODO: Remove after version 0.145.x stabilizes.
|
||||||
|
optional ViewId active_view_id = 1;
|
||||||
|
repeated View views = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateFollowers {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
optional uint64 project_id = 2;
|
||||||
|
reserved 3;
|
||||||
|
oneof variant {
|
||||||
|
View create_view = 5;
|
||||||
|
// TODO: Remove after version 0.145.x stabilizes.
|
||||||
|
UpdateActiveView update_active_view = 4;
|
||||||
|
UpdateView update_view = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Unfollow {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
optional uint64 project_id = 2;
|
||||||
|
PeerId leader_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ViewId {
|
||||||
|
PeerId creator = 1;
|
||||||
|
uint64 id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateActiveView {
|
||||||
|
optional ViewId id = 1;
|
||||||
|
optional PeerId leader_id = 2;
|
||||||
|
View view = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PanelId {
|
||||||
|
AssistantPanel = 0;
|
||||||
|
DebugPanel = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateView {
|
||||||
|
ViewId id = 1;
|
||||||
|
optional PeerId leader_id = 2;
|
||||||
|
|
||||||
|
oneof variant {
|
||||||
|
Editor editor = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Editor {
|
||||||
|
repeated ExcerptInsertion inserted_excerpts = 1;
|
||||||
|
repeated uint64 deleted_excerpts = 2;
|
||||||
|
repeated Selection selections = 3;
|
||||||
|
optional Selection pending_selection = 4;
|
||||||
|
EditorAnchor scroll_top_anchor = 5;
|
||||||
|
float scroll_x = 6;
|
||||||
|
float scroll_y = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message View {
|
||||||
|
ViewId id = 1;
|
||||||
|
optional PeerId leader_id = 2;
|
||||||
|
optional PanelId panel_id = 6;
|
||||||
|
|
||||||
|
oneof variant {
|
||||||
|
Editor editor = 3;
|
||||||
|
ChannelView channel_view = 4;
|
||||||
|
ContextEditor context_editor = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Editor {
|
||||||
|
bool singleton = 1;
|
||||||
|
optional string title = 2;
|
||||||
|
repeated Excerpt excerpts = 3;
|
||||||
|
repeated Selection selections = 4;
|
||||||
|
optional Selection pending_selection = 5;
|
||||||
|
EditorAnchor scroll_top_anchor = 6;
|
||||||
|
float scroll_x = 7;
|
||||||
|
float scroll_y = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelView {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
Editor editor = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ContextEditor {
|
||||||
|
string context_id = 1;
|
||||||
|
Editor editor = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExcerptInsertion {
|
||||||
|
Excerpt excerpt = 1;
|
||||||
|
optional uint64 previous_excerpt_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Excerpt {
|
||||||
|
uint64 id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor context_start = 3;
|
||||||
|
Anchor context_end = 4;
|
||||||
|
Anchor primary_start = 5;
|
||||||
|
Anchor primary_end = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Contact {
|
||||||
|
uint64 user_id = 1;
|
||||||
|
bool online = 2;
|
||||||
|
bool busy = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetRoomParticipantRole {
|
||||||
|
uint64 room_id = 1;
|
||||||
|
uint64 user_id = 2;
|
||||||
|
ChannelRole role = 3;
|
||||||
|
}
|
283
crates/proto/proto/channel.proto
Normal file
283
crates/proto/proto/channel.proto
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "core.proto";
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
message Channel {
|
||||||
|
uint64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
ChannelVisibility visibility = 3;
|
||||||
|
repeated uint64 parent_path = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ChannelVisibility {
|
||||||
|
Public = 0;
|
||||||
|
Members = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateChannels {
|
||||||
|
repeated Channel channels = 1;
|
||||||
|
repeated uint64 delete_channels = 4;
|
||||||
|
repeated Channel channel_invitations = 5;
|
||||||
|
repeated uint64 remove_channel_invitations = 6;
|
||||||
|
repeated ChannelParticipants channel_participants = 7;
|
||||||
|
repeated ChannelMessageId latest_channel_message_ids = 8;
|
||||||
|
repeated ChannelBufferVersion latest_channel_buffer_versions = 9;
|
||||||
|
|
||||||
|
reserved 10 to 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateUserChannels {
|
||||||
|
repeated ChannelMessageId observed_channel_message_id = 1;
|
||||||
|
repeated ChannelBufferVersion observed_channel_buffer_version = 2;
|
||||||
|
repeated ChannelMembership channel_memberships = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMembership {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
ChannelRole role = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMessageId {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 message_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelPermission {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
ChannelRole role = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelParticipants {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
repeated uint64 participant_user_ids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinChannel {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteChannel {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetChannelMembers {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
string query = 2;
|
||||||
|
uint64 limit = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetChannelMembersResponse {
|
||||||
|
repeated ChannelMember members = 1;
|
||||||
|
repeated User users = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMember {
|
||||||
|
uint64 user_id = 1;
|
||||||
|
Kind kind = 3;
|
||||||
|
ChannelRole role = 4;
|
||||||
|
|
||||||
|
enum Kind {
|
||||||
|
Member = 0;
|
||||||
|
Invitee = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SubscribeToChannels {}
|
||||||
|
|
||||||
|
message CreateChannel {
|
||||||
|
string name = 1;
|
||||||
|
optional uint64 parent_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateChannelResponse {
|
||||||
|
Channel channel = 1;
|
||||||
|
optional uint64 parent_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InviteChannelMember {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 user_id = 2;
|
||||||
|
ChannelRole role = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveChannelMember {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 user_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ChannelRole {
|
||||||
|
Admin = 0;
|
||||||
|
Member = 1;
|
||||||
|
Guest = 2;
|
||||||
|
Banned = 3;
|
||||||
|
Talker = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetChannelMemberRole {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 user_id = 2;
|
||||||
|
ChannelRole role = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetChannelVisibility {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
ChannelVisibility visibility = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RenameChannel {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
string name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RenameChannelResponse {
|
||||||
|
Channel channel = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinChannelChat {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinChannelChatResponse {
|
||||||
|
repeated ChannelMessage messages = 1;
|
||||||
|
bool done = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LeaveChannelChat {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SendChannelMessage {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
string body = 2;
|
||||||
|
Nonce nonce = 3;
|
||||||
|
repeated ChatMention mentions = 4;
|
||||||
|
optional uint64 reply_to_message_id = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveChannelMessage {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 message_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateChannelMessage {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 message_id = 2;
|
||||||
|
Nonce nonce = 4;
|
||||||
|
string body = 5;
|
||||||
|
repeated ChatMention mentions = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AckChannelMessage {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 message_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SendChannelMessageResponse {
|
||||||
|
ChannelMessage message = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMessageSent {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
ChannelMessage message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMessageUpdate {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
ChannelMessage message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetChannelMessages {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 before_message_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetChannelMessagesResponse {
|
||||||
|
repeated ChannelMessage messages = 1;
|
||||||
|
bool done = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetChannelMessagesById {
|
||||||
|
repeated uint64 message_ids = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MoveChannel {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
uint64 to = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinChannelBuffer {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelBufferVersion {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
uint64 epoch = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateChannelBufferCollaborators {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
repeated Collaborator collaborators = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateChannelBuffer {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
repeated Operation operations = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelMessage {
|
||||||
|
uint64 id = 1;
|
||||||
|
string body = 2;
|
||||||
|
uint64 timestamp = 3;
|
||||||
|
uint64 sender_id = 4;
|
||||||
|
Nonce nonce = 5;
|
||||||
|
repeated ChatMention mentions = 6;
|
||||||
|
optional uint64 reply_to_message_id = 7;
|
||||||
|
optional uint64 edited_at = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChatMention {
|
||||||
|
Range range = 1;
|
||||||
|
uint64 user_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinChannelBuffers {
|
||||||
|
repeated ChannelBufferVersion buffers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinChannelBuffersResponse {
|
||||||
|
repeated RejoinedChannelBuffer buffers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AckBufferOperation {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
uint64 epoch = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message JoinChannelBufferResponse {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
uint32 replica_id = 2;
|
||||||
|
string base_text = 3;
|
||||||
|
repeated Operation operations = 4;
|
||||||
|
repeated Collaborator collaborators = 5;
|
||||||
|
uint64 epoch = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RejoinedChannelBuffer {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
repeated Operation operations = 3;
|
||||||
|
repeated Collaborator collaborators = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LeaveChannelBuffer {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RespondToChannelInvite {
|
||||||
|
uint64 channel_id = 1;
|
||||||
|
bool accept = 2;
|
||||||
|
}
|
27
crates/proto/proto/core.proto
Normal file
27
crates/proto/proto/core.proto
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
message PeerId {
|
||||||
|
uint32 owner_id = 1;
|
||||||
|
uint32 id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message User {
|
||||||
|
uint64 id = 1;
|
||||||
|
string github_login = 2;
|
||||||
|
string avatar_url = 3;
|
||||||
|
optional string email = 4;
|
||||||
|
optional string name = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Nonce {
|
||||||
|
uint64 upper_half = 1;
|
||||||
|
uint64 lower_half = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Collaborator {
|
||||||
|
PeerId peer_id = 1;
|
||||||
|
uint32 replica_id = 2;
|
||||||
|
uint64 user_id = 3;
|
||||||
|
bool is_host = 4;
|
||||||
|
}
|
530
crates/proto/proto/debugger.proto
Normal file
530
crates/proto/proto/debugger.proto
Normal file
|
@ -0,0 +1,530 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "core.proto";
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
enum BreakpointState {
|
||||||
|
Enabled = 0;
|
||||||
|
Disabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Breakpoint {
|
||||||
|
Anchor position = 1;
|
||||||
|
BreakpointState state = 2;
|
||||||
|
reserved 3;
|
||||||
|
optional string message = 4;
|
||||||
|
optional string condition = 5;
|
||||||
|
optional string hit_condition = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BreakpointsForFile {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string path = 2;
|
||||||
|
repeated Breakpoint breakpoints = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ToggleBreakpoint {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string path = 2;
|
||||||
|
Breakpoint breakpoint = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DebuggerThreadItem {
|
||||||
|
Console = 0;
|
||||||
|
LoadedSource = 1;
|
||||||
|
Modules = 2;
|
||||||
|
Variables = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerSetVariableState {
|
||||||
|
string name = 1;
|
||||||
|
DapScope scope = 2;
|
||||||
|
string value = 3;
|
||||||
|
uint64 stack_frame_id = 4;
|
||||||
|
optional string evaluate_name = 5;
|
||||||
|
uint64 parent_variables_reference = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariableListOpenEntry {
|
||||||
|
oneof entry {
|
||||||
|
DebuggerOpenEntryScope scope = 1;
|
||||||
|
DebuggerOpenEntryVariable variable = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerOpenEntryScope {
|
||||||
|
string name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerOpenEntryVariable {
|
||||||
|
string scope_name = 1;
|
||||||
|
string name = 2;
|
||||||
|
uint64 depth = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariableListEntrySetState {
|
||||||
|
uint64 depth = 1;
|
||||||
|
DebuggerSetVariableState state = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariableListEntryVariable {
|
||||||
|
uint64 depth = 1;
|
||||||
|
DapScope scope = 2;
|
||||||
|
DapVariable variable = 3;
|
||||||
|
bool has_children = 4;
|
||||||
|
uint64 container_reference = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerScopeVariableIndex {
|
||||||
|
repeated uint64 fetched_ids = 1;
|
||||||
|
repeated DebuggerVariableContainer variables = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerVariableContainer {
|
||||||
|
uint64 container_reference = 1;
|
||||||
|
DapVariable variable = 2;
|
||||||
|
uint64 depth = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapThreadStatus {
|
||||||
|
Running = 0;
|
||||||
|
Stopped = 1;
|
||||||
|
Exited = 2;
|
||||||
|
Ended = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariableListScopes {
|
||||||
|
uint64 stack_frame_id = 1;
|
||||||
|
repeated DapScope scopes = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariableListVariables {
|
||||||
|
uint64 stack_frame_id = 1;
|
||||||
|
uint64 scope_id = 2;
|
||||||
|
DebuggerScopeVariableIndex variables = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum VariablesArgumentsFilter {
|
||||||
|
Indexed = 0;
|
||||||
|
Named = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ValueFormat {
|
||||||
|
optional bool hex = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VariablesRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 variables_reference = 3;
|
||||||
|
optional VariablesArgumentsFilter filter = 4;
|
||||||
|
optional uint64 start = 5;
|
||||||
|
optional uint64 count = 6;
|
||||||
|
optional ValueFormat format = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SteppingGranularity {
|
||||||
|
Statement = 0;
|
||||||
|
Line = 1;
|
||||||
|
Instruction = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapLocationsRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 session_id = 2;
|
||||||
|
uint64 location_reference = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapLocationsResponse {
|
||||||
|
DapSource source = 1;
|
||||||
|
uint64 line = 2;
|
||||||
|
optional uint64 column = 3;
|
||||||
|
optional uint64 end_line = 4;
|
||||||
|
optional uint64 end_column = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapEvaluateContext {
|
||||||
|
Repl = 0;
|
||||||
|
Watch = 1;
|
||||||
|
Hover = 2;
|
||||||
|
Clipboard = 3;
|
||||||
|
EvaluateVariables = 4;
|
||||||
|
EvaluateUnknown = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapEvaluateRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
string expression = 3;
|
||||||
|
optional uint64 frame_id = 4;
|
||||||
|
optional DapEvaluateContext context = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapEvaluateResponse {
|
||||||
|
string result = 1;
|
||||||
|
optional string evaluate_type = 2;
|
||||||
|
uint64 variable_reference = 3;
|
||||||
|
optional uint64 named_variables = 4;
|
||||||
|
optional uint64 indexed_variables = 5;
|
||||||
|
optional string memory_reference = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message DapCompletionRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
string query = 3;
|
||||||
|
optional uint64 frame_id = 4;
|
||||||
|
optional uint64 line = 5;
|
||||||
|
uint64 column = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapCompletionItemType {
|
||||||
|
Method = 0;
|
||||||
|
Function = 1;
|
||||||
|
Constructor = 2;
|
||||||
|
Field = 3;
|
||||||
|
Variable = 4;
|
||||||
|
Class = 5;
|
||||||
|
Interface = 6;
|
||||||
|
Module = 7;
|
||||||
|
Property = 8;
|
||||||
|
Unit = 9;
|
||||||
|
Value = 10;
|
||||||
|
Enum = 11;
|
||||||
|
Keyword = 12;
|
||||||
|
Snippet = 13;
|
||||||
|
Text = 14;
|
||||||
|
Color = 15;
|
||||||
|
CompletionItemFile = 16;
|
||||||
|
Reference = 17;
|
||||||
|
Customcolor = 19;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapCompletionItem {
|
||||||
|
string label = 1;
|
||||||
|
optional string text = 2;
|
||||||
|
optional string sort_text = 3;
|
||||||
|
optional string detail = 4;
|
||||||
|
optional DapCompletionItemType typ = 5;
|
||||||
|
optional uint64 start = 6;
|
||||||
|
optional uint64 length = 7;
|
||||||
|
optional uint64 selection_start = 8;
|
||||||
|
optional uint64 selection_length = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapCompletionResponse {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
repeated DapCompletionItem completions = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapScopesRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 stack_frame_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapScopesResponse {
|
||||||
|
repeated DapScope scopes = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapSetVariableValueRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
string name = 3;
|
||||||
|
string value = 4;
|
||||||
|
uint64 variables_reference = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapSetVariableValueResponse {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
string value = 2;
|
||||||
|
optional string variable_type = 3;
|
||||||
|
optional uint64 variables_reference = 4;
|
||||||
|
optional uint64 named_variables = 5;
|
||||||
|
optional uint64 indexed_variables = 6;
|
||||||
|
optional string memory_reference = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapPauseRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapDisconnectRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
optional bool restart = 3;
|
||||||
|
optional bool terminate_debuggee = 4;
|
||||||
|
optional bool suspend_debuggee = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapTerminateThreadsRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
repeated uint64 thread_ids = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapThreadsRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapThreadsResponse {
|
||||||
|
repeated DapThread threads = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapTerminateRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
optional bool restart = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapRestartRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
bytes raw_args = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapRestartStackFrameRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 stack_frame_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ToggleIgnoreBreakpoints {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint32 session_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message IgnoreBreakpointState {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 session_id = 2;
|
||||||
|
bool ignore = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapNextRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional bool single_thread = 4;
|
||||||
|
optional SteppingGranularity granularity = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStepInRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional uint64 target_id = 4;
|
||||||
|
optional bool single_thread = 5;
|
||||||
|
optional SteppingGranularity granularity = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStepOutRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional bool single_thread = 4;
|
||||||
|
optional SteppingGranularity granularity = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStepBackRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional bool single_thread = 4;
|
||||||
|
optional SteppingGranularity granularity = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapContinueRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional bool single_thread = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapContinueResponse {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
optional bool all_threads_continued = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapModulesRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapModulesResponse {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
repeated DapModule modules = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapLoadedSourcesRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapLoadedSourcesResponse {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
repeated DapSource sources = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStackTraceRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 client_id = 2;
|
||||||
|
uint64 thread_id = 3;
|
||||||
|
optional uint64 start_frame = 4;
|
||||||
|
optional uint64 stack_trace_levels = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStackTraceResponse {
|
||||||
|
repeated DapStackFrame frames = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapStackFrame {
|
||||||
|
uint64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
optional DapSource source = 3;
|
||||||
|
uint64 line = 4;
|
||||||
|
uint64 column = 5;
|
||||||
|
optional uint64 end_line = 6;
|
||||||
|
optional uint64 end_column = 7;
|
||||||
|
optional bool can_restart = 8;
|
||||||
|
optional string instruction_pointer_reference = 9;
|
||||||
|
optional DapModuleId module_id = 10;
|
||||||
|
optional DapStackPresentationHint presentation_hint = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DebuggerLoadedSourceList {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
repeated DapSource sources = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapVariables {
|
||||||
|
uint64 client_id = 1;
|
||||||
|
repeated DapVariable variables = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remote Debugging: Dap Types
|
||||||
|
message DapVariable {
|
||||||
|
string name = 1;
|
||||||
|
string value = 2;
|
||||||
|
optional string type = 3;
|
||||||
|
// optional DapVariablePresentationHint presentation_hint = 4;
|
||||||
|
optional string evaluate_name = 5;
|
||||||
|
uint64 variables_reference = 6;
|
||||||
|
optional uint64 named_variables = 7;
|
||||||
|
optional uint64 indexed_variables = 8;
|
||||||
|
optional string memory_reference = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapThread {
|
||||||
|
uint64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapScope {
|
||||||
|
string name = 1;
|
||||||
|
optional DapScopePresentationHint presentation_hint = 2;
|
||||||
|
uint64 variables_reference = 3;
|
||||||
|
optional uint64 named_variables = 4;
|
||||||
|
optional uint64 indexed_variables = 5;
|
||||||
|
bool expensive = 6;
|
||||||
|
optional DapSource source = 7;
|
||||||
|
optional uint64 line = 8;
|
||||||
|
optional uint64 column = 9;
|
||||||
|
optional uint64 end_line = 10;
|
||||||
|
optional uint64 end_column = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapSource {
|
||||||
|
optional string name = 1;
|
||||||
|
optional string path = 2;
|
||||||
|
optional uint64 source_reference = 3;
|
||||||
|
optional DapSourcePresentationHint presentation_hint = 4;
|
||||||
|
optional string origin = 5;
|
||||||
|
repeated DapSource sources = 6;
|
||||||
|
optional bytes adapter_data = 7;
|
||||||
|
repeated DapChecksum checksums = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapOutputCategory {
|
||||||
|
ConsoleOutput = 0;
|
||||||
|
Important = 1;
|
||||||
|
Stdout = 2;
|
||||||
|
Stderr = 3;
|
||||||
|
Unknown = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapOutputEventGroup {
|
||||||
|
Start = 0;
|
||||||
|
StartCollapsed = 1;
|
||||||
|
End = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapOutputEvent {
|
||||||
|
string output = 1;
|
||||||
|
optional DapOutputCategory category = 2;
|
||||||
|
optional uint64 variables_reference = 3;
|
||||||
|
optional DapOutputEventGroup group = 4;
|
||||||
|
optional DapSource source = 5;
|
||||||
|
optional uint32 line = 6;
|
||||||
|
optional uint32 column = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapChecksumAlgorithm {
|
||||||
|
CHECKSUM_ALGORITHM_UNSPECIFIED = 0;
|
||||||
|
MD5 = 1;
|
||||||
|
SHA1 = 2;
|
||||||
|
SHA256 = 3;
|
||||||
|
TIMESTAMP = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapChecksum {
|
||||||
|
DapChecksumAlgorithm algorithm = 1;
|
||||||
|
string checksum = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapScopePresentationHint {
|
||||||
|
Arguments = 0;
|
||||||
|
Locals = 1;
|
||||||
|
Registers = 2;
|
||||||
|
ReturnValue = 3;
|
||||||
|
ScopeUnknown = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapSourcePresentationHint {
|
||||||
|
SourceNormal = 0;
|
||||||
|
Emphasize = 1;
|
||||||
|
Deemphasize = 2;
|
||||||
|
SourceUnknown = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DapStackPresentationHint {
|
||||||
|
StackNormal = 0;
|
||||||
|
Label = 1;
|
||||||
|
Subtle = 2;
|
||||||
|
StackUnknown = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapModule {
|
||||||
|
DapModuleId id = 1;
|
||||||
|
string name = 2;
|
||||||
|
optional string path = 3;
|
||||||
|
optional bool is_optimized = 4;
|
||||||
|
optional bool is_user_code = 5;
|
||||||
|
optional string version = 6;
|
||||||
|
optional string symbol_status = 7;
|
||||||
|
optional string symbol_file_path = 8;
|
||||||
|
optional string date_time_stamp = 9;
|
||||||
|
optional string address_range = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DapModuleId {
|
||||||
|
oneof id {
|
||||||
|
uint32 number = 1;
|
||||||
|
string string = 2;
|
||||||
|
}
|
||||||
|
}
|
404
crates/proto/proto/git.proto
Normal file
404
crates/proto/proto/git.proto
Normal file
|
@ -0,0 +1,404 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "worktree.proto";
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
message GitBranchesResponse {
|
||||||
|
repeated Branch branches = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateDiffBases {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
// No collaborator is using the unstaged diff.
|
||||||
|
HEAD_ONLY = 0;
|
||||||
|
// No collaborator is using the diff from HEAD.
|
||||||
|
INDEX_ONLY = 1;
|
||||||
|
// Both the unstaged and uncommitted diffs are demanded,
|
||||||
|
// and the contents of the index and HEAD are the same for this path.
|
||||||
|
INDEX_MATCHES_HEAD = 2;
|
||||||
|
// Both the unstaged and uncommitted diffs are demanded,
|
||||||
|
// and the contents of the index and HEAD differ for this path,
|
||||||
|
// where None means the path doesn't exist in that state of the repo.
|
||||||
|
INDEX_AND_HEAD = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional string staged_text = 3;
|
||||||
|
optional string committed_text = 4;
|
||||||
|
Mode mode = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenUnstagedDiff {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenUnstagedDiffResponse {
|
||||||
|
optional string staged_text = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenUncommittedDiff {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenUncommittedDiffResponse {
|
||||||
|
enum Mode {
|
||||||
|
INDEX_MATCHES_HEAD = 0;
|
||||||
|
INDEX_AND_HEAD = 1;
|
||||||
|
}
|
||||||
|
optional string staged_text = 1;
|
||||||
|
optional string committed_text = 2;
|
||||||
|
Mode mode = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetIndexText {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string path = 4;
|
||||||
|
optional string text = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPermalinkToLine {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Range selection = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPermalinkToLineResponse {
|
||||||
|
string permalink = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Branch {
|
||||||
|
bool is_head = 1;
|
||||||
|
string name = 2;
|
||||||
|
optional uint64 unix_timestamp = 3;
|
||||||
|
optional GitUpstream upstream = 4;
|
||||||
|
optional CommitSummary most_recent_commit = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitUpstream {
|
||||||
|
string ref_name = 1;
|
||||||
|
optional UpstreamTracking tracking = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpstreamTracking {
|
||||||
|
uint64 ahead = 1;
|
||||||
|
uint64 behind = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommitSummary {
|
||||||
|
string sha = 1;
|
||||||
|
string subject = 2;
|
||||||
|
int64 commit_timestamp = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitBranches {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
ProjectPath repository = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message UpdateGitBranch {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string branch_name = 2;
|
||||||
|
ProjectPath repository = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateRepository {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 id = 2;
|
||||||
|
string abs_path = 3;
|
||||||
|
repeated uint64 entry_ids = 4;
|
||||||
|
optional Branch branch_summary = 5;
|
||||||
|
repeated StatusEntry updated_statuses = 6;
|
||||||
|
repeated string removed_statuses = 7;
|
||||||
|
repeated string current_merge_conflicts = 8;
|
||||||
|
uint64 scan_id = 9;
|
||||||
|
bool is_last_update = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveRepository {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GitStatus {
|
||||||
|
Added = 0;
|
||||||
|
Modified = 1;
|
||||||
|
Conflict = 2;
|
||||||
|
Deleted = 3;
|
||||||
|
Updated = 4;
|
||||||
|
TypeChanged = 5;
|
||||||
|
Renamed = 6;
|
||||||
|
Copied = 7;
|
||||||
|
Unmodified = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitFileStatus {
|
||||||
|
oneof variant {
|
||||||
|
Untracked untracked = 1;
|
||||||
|
Ignored ignored = 2;
|
||||||
|
Unmerged unmerged = 3;
|
||||||
|
Tracked tracked = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Untracked {}
|
||||||
|
message Ignored {}
|
||||||
|
message Unmerged {
|
||||||
|
GitStatus first_head = 1;
|
||||||
|
GitStatus second_head = 2;
|
||||||
|
}
|
||||||
|
message Tracked {
|
||||||
|
GitStatus index_status = 1;
|
||||||
|
GitStatus worktree_status = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitGetBranches {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitCreateBranch {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string branch_name = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitChangeBranch {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string branch_name = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitDiff {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
DiffType diff_type = 4;
|
||||||
|
|
||||||
|
enum DiffType {
|
||||||
|
HEAD_TO_WORKTREE = 0;
|
||||||
|
HEAD_TO_INDEX = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitDiffResponse {
|
||||||
|
string diff = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitInit {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string abs_path = 2;
|
||||||
|
string fallback_branch_name = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckForPushedCommits {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckForPushedCommitsResponse {
|
||||||
|
repeated string pushed_to = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitShow {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string commit = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitCommitDetails {
|
||||||
|
string sha = 1;
|
||||||
|
string message = 2;
|
||||||
|
int64 commit_timestamp = 3;
|
||||||
|
string author_email = 4;
|
||||||
|
string author_name = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LoadCommitDiff {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string commit = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LoadCommitDiffResponse {
|
||||||
|
repeated CommitFile files = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommitFile {
|
||||||
|
string path = 1;
|
||||||
|
optional string old_text = 2;
|
||||||
|
optional string new_text = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitReset {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string commit = 4;
|
||||||
|
ResetMode mode = 5;
|
||||||
|
enum ResetMode {
|
||||||
|
SOFT = 0;
|
||||||
|
MIXED = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GitCheckoutFiles {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string commit = 4;
|
||||||
|
repeated string paths = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move to `git.proto` once collab's min version is >=0.171.0.
|
||||||
|
message StatusEntry {
|
||||||
|
string repo_path = 1;
|
||||||
|
// Can be removed once collab's min version is >=0.171.0.
|
||||||
|
GitStatus simple_status = 2;
|
||||||
|
GitFileStatus status = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Stage {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
repeated string paths = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Unstage {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
repeated string paths = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Commit {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
optional string name = 4;
|
||||||
|
optional string email = 5;
|
||||||
|
string message = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenCommitMessageBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Push {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string remote_name = 4;
|
||||||
|
string branch_name = 5;
|
||||||
|
optional PushOptions options = 6;
|
||||||
|
uint64 askpass_id = 7;
|
||||||
|
|
||||||
|
enum PushOptions {
|
||||||
|
SET_UPSTREAM = 0;
|
||||||
|
FORCE = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Fetch {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
uint64 askpass_id = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetRemotes {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
optional string branch_name = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetRemotesResponse {
|
||||||
|
repeated Remote remotes = 1;
|
||||||
|
|
||||||
|
message Remote {
|
||||||
|
string name = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Pull {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
reserved 2;
|
||||||
|
uint64 repository_id = 3;
|
||||||
|
string remote_name = 4;
|
||||||
|
string branch_name = 5;
|
||||||
|
uint64 askpass_id = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoteMessageResponse {
|
||||||
|
string stdout = 1;
|
||||||
|
string stderr = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BlameBuffer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BlameEntry {
|
||||||
|
bytes sha = 1;
|
||||||
|
|
||||||
|
uint32 start_line = 2;
|
||||||
|
uint32 end_line = 3;
|
||||||
|
uint32 original_line_number = 4;
|
||||||
|
|
||||||
|
optional string author = 5;
|
||||||
|
optional string author_mail = 6;
|
||||||
|
optional int64 author_time = 7;
|
||||||
|
optional string author_tz = 8;
|
||||||
|
|
||||||
|
optional string committer = 9;
|
||||||
|
optional string committer_mail = 10;
|
||||||
|
optional int64 committer_time = 11;
|
||||||
|
optional string committer_tz = 12;
|
||||||
|
|
||||||
|
optional string summary = 13;
|
||||||
|
optional string previous = 14;
|
||||||
|
|
||||||
|
string filename = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommitMessage {
|
||||||
|
bytes oid = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommitPermalink {
|
||||||
|
bytes oid = 1;
|
||||||
|
string permalink = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BlameBufferResponse {
|
||||||
|
message BlameResponse {
|
||||||
|
repeated BlameEntry entries = 1;
|
||||||
|
repeated CommitMessage messages = 2;
|
||||||
|
optional string remote_url = 4;
|
||||||
|
reserved 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional BlameResponse blame_response = 5;
|
||||||
|
|
||||||
|
reserved 1 to 4;
|
||||||
|
}
|
701
crates/proto/proto/lsp.proto
Normal file
701
crates/proto/proto/lsp.proto
Normal file
|
@ -0,0 +1,701 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "core.proto";
|
||||||
|
import "worktree.proto";
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
message GetDefinition {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDefinitionResponse {
|
||||||
|
repeated LocationLink links = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDeclaration {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDeclarationResponse {
|
||||||
|
repeated LocationLink links = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTypeDefinition {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTypeDefinitionResponse {
|
||||||
|
repeated LocationLink links = 1;
|
||||||
|
}
|
||||||
|
message GetImplementation {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetImplementationResponse {
|
||||||
|
repeated LocationLink links = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetReferences {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetReferencesResponse {
|
||||||
|
repeated Location locations = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDocumentHighlights {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDocumentHighlightsResponse {
|
||||||
|
repeated DocumentHighlight highlights = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LocationLink {
|
||||||
|
optional Location origin = 1;
|
||||||
|
Location target = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DocumentHighlight {
|
||||||
|
Kind kind = 1;
|
||||||
|
Anchor start = 2;
|
||||||
|
Anchor end = 3;
|
||||||
|
|
||||||
|
enum Kind {
|
||||||
|
Text = 0;
|
||||||
|
Read = 1;
|
||||||
|
Write = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetProjectSymbols {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string query = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetProjectSymbolsResponse {
|
||||||
|
repeated Symbol symbols = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Symbol {
|
||||||
|
uint64 source_worktree_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string language_server_name = 3;
|
||||||
|
string name = 4;
|
||||||
|
int32 kind = 5;
|
||||||
|
string path = 6;
|
||||||
|
// Cannot use generate anchors for unopened files,
|
||||||
|
// so we are forced to use point coords instead
|
||||||
|
PointUtf16 start = 7;
|
||||||
|
PointUtf16 end = 8;
|
||||||
|
bytes signature = 9;
|
||||||
|
uint64 language_server_id = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDocumentSymbols {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDocumentSymbolsResponse {
|
||||||
|
repeated DocumentSymbol symbols = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DocumentSymbol {
|
||||||
|
string name = 1;
|
||||||
|
int32 kind = 2;
|
||||||
|
// Cannot use generate anchors for unopened files,
|
||||||
|
// so we are forced to use point coords instead
|
||||||
|
PointUtf16 start = 3;
|
||||||
|
PointUtf16 end = 4;
|
||||||
|
PointUtf16 selection_start = 5;
|
||||||
|
PointUtf16 selection_end = 6;
|
||||||
|
repeated DocumentSymbol children = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHints {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor start = 3;
|
||||||
|
Anchor end = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintsResponse {
|
||||||
|
repeated InlayHint hints = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PointUtf16 {
|
||||||
|
uint32 row = 1;
|
||||||
|
uint32 column = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtExpandMacro {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtExpandMacroResponse {
|
||||||
|
string name = 1;
|
||||||
|
string expansion = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtOpenDocs {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtOpenDocsResponse {
|
||||||
|
optional string web = 1;
|
||||||
|
optional string local = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtSwitchSourceHeader {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspExtSwitchSourceHeaderResponse {
|
||||||
|
string target_file = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCompletionsResponse {
|
||||||
|
repeated Completion completions = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCompletionAdditionalEdits {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Completion completion = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCompletionAdditionalEditsResponse {
|
||||||
|
Transaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Completion {
|
||||||
|
Anchor old_start = 1;
|
||||||
|
Anchor old_end = 2;
|
||||||
|
string new_text = 3;
|
||||||
|
uint64 server_id = 4;
|
||||||
|
bytes lsp_completion = 5;
|
||||||
|
bool resolved = 6;
|
||||||
|
Source source = 7;
|
||||||
|
optional bytes lsp_defaults = 8;
|
||||||
|
optional Anchor buffer_word_start = 9;
|
||||||
|
optional Anchor buffer_word_end = 10;
|
||||||
|
|
||||||
|
enum Source {
|
||||||
|
Lsp = 0;
|
||||||
|
Custom = 1;
|
||||||
|
BufferWord = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCodeActions {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor start = 3;
|
||||||
|
Anchor end = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCodeActionsResponse {
|
||||||
|
repeated CodeAction actions = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetSignatureHelp {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetSignatureHelpResponse {
|
||||||
|
optional SignatureHelp signature_help = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SignatureHelp {
|
||||||
|
repeated SignatureInformation signatures = 1;
|
||||||
|
optional uint32 active_signature = 2;
|
||||||
|
optional uint32 active_parameter = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SignatureInformation {
|
||||||
|
string label = 1;
|
||||||
|
optional Documentation documentation = 2;
|
||||||
|
repeated ParameterInformation parameters = 3;
|
||||||
|
optional uint32 active_parameter = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Documentation {
|
||||||
|
oneof content {
|
||||||
|
string value = 1;
|
||||||
|
MarkupContent markup_content = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MarkupKind {
|
||||||
|
PlainText = 0;
|
||||||
|
Markdown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ParameterInformation {
|
||||||
|
oneof label {
|
||||||
|
string simple = 1;
|
||||||
|
LabelOffsets label_offsets = 2;
|
||||||
|
}
|
||||||
|
optional Documentation documentation = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LabelOffsets {
|
||||||
|
uint32 start = 1;
|
||||||
|
uint32 end = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetHover {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetHoverResponse {
|
||||||
|
optional Anchor start = 1;
|
||||||
|
optional Anchor end = 2;
|
||||||
|
repeated HoverBlock contents = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HoverBlock {
|
||||||
|
string text = 1;
|
||||||
|
optional string language = 2;
|
||||||
|
bool is_markdown = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCodeAction {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
CodeAction action = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCodeActionResponse {
|
||||||
|
ProjectTransaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PrepareRename {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PrepareRenameResponse {
|
||||||
|
bool can_rename = 1;
|
||||||
|
Anchor start = 2;
|
||||||
|
Anchor end = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
bool only_unprepared_rename_supported = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PerformRename {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
string new_name = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OnTypeFormatting {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
string trigger = 4;
|
||||||
|
repeated VectorClockEntry version = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OnTypeFormattingResponse {
|
||||||
|
Transaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message LinkedEditingRange {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LinkedEditingRangeResponse {
|
||||||
|
repeated AnchorRange items = 1;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHint {
|
||||||
|
Anchor position = 1;
|
||||||
|
InlayHintLabel label = 2;
|
||||||
|
optional string kind = 3;
|
||||||
|
bool padding_left = 4;
|
||||||
|
bool padding_right = 5;
|
||||||
|
InlayHintTooltip tooltip = 6;
|
||||||
|
ResolveState resolve_state = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintLabel {
|
||||||
|
oneof label {
|
||||||
|
string value = 1;
|
||||||
|
InlayHintLabelParts label_parts = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintLabelParts {
|
||||||
|
repeated InlayHintLabelPart parts = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintLabelPart {
|
||||||
|
string value = 1;
|
||||||
|
InlayHintLabelPartTooltip tooltip = 2;
|
||||||
|
optional string location_url = 3;
|
||||||
|
PointUtf16 location_range_start = 4;
|
||||||
|
PointUtf16 location_range_end = 5;
|
||||||
|
optional uint64 language_server_id = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintTooltip {
|
||||||
|
oneof content {
|
||||||
|
string value = 1;
|
||||||
|
MarkupContent markup_content = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message InlayHintLabelPartTooltip {
|
||||||
|
oneof content {
|
||||||
|
string value = 1;
|
||||||
|
MarkupContent markup_content = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResolveState {
|
||||||
|
State state = 1;
|
||||||
|
LspResolveState lsp_resolve_state = 2;
|
||||||
|
|
||||||
|
enum State {
|
||||||
|
Resolved = 0;
|
||||||
|
CanResolve = 1;
|
||||||
|
Resolving = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspResolveState {
|
||||||
|
optional string value = 1;
|
||||||
|
uint64 server_id = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This type is used to resolve more than just
|
||||||
|
// the documentation, but for backwards-compatibility
|
||||||
|
// reasons we can't rename the type.
|
||||||
|
message ResolveCompletionDocumentation {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 language_server_id = 2;
|
||||||
|
bytes lsp_completion = 3;
|
||||||
|
uint64 buffer_id = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResolveCompletionDocumentationResponse {
|
||||||
|
string documentation = 1;
|
||||||
|
bool documentation_is_markdown = 2;
|
||||||
|
Anchor old_start = 3;
|
||||||
|
Anchor old_end = 4;
|
||||||
|
string new_text = 5;
|
||||||
|
bytes lsp_completion = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResolveInlayHint {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
uint64 language_server_id = 3;
|
||||||
|
InlayHint hint = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResolveInlayHintResponse {
|
||||||
|
InlayHint hint = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RefreshInlayHints {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CodeLens {
|
||||||
|
bytes lsp_lens = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCodeLens {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCodeLensResponse {
|
||||||
|
repeated CodeAction lens_actions = 1;
|
||||||
|
repeated VectorClockEntry version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RefreshCodeLens {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MarkupContent {
|
||||||
|
bool is_markdown = 1;
|
||||||
|
string value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PerformRenameResponse {
|
||||||
|
ProjectTransaction transaction = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CodeAction {
|
||||||
|
uint64 server_id = 1;
|
||||||
|
Anchor start = 2;
|
||||||
|
Anchor end = 3;
|
||||||
|
bytes lsp_action = 4;
|
||||||
|
Kind kind = 5;
|
||||||
|
bool resolved = 6;
|
||||||
|
enum Kind {
|
||||||
|
Action = 0;
|
||||||
|
Command = 1;
|
||||||
|
CodeLens = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServer {
|
||||||
|
uint64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
optional uint64 worktree_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StartLanguageServer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
LanguageServer server = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateDiagnosticSummary {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
DiagnosticSummary summary = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DiagnosticSummary {
|
||||||
|
string path = 1;
|
||||||
|
uint64 language_server_id = 2;
|
||||||
|
uint32 error_count = 3;
|
||||||
|
uint32 warning_count = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateLanguageServer {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 language_server_id = 2;
|
||||||
|
oneof variant {
|
||||||
|
LspWorkStart work_start = 3;
|
||||||
|
LspWorkProgress work_progress = 4;
|
||||||
|
LspWorkEnd work_end = 5;
|
||||||
|
LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
|
||||||
|
LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspWorkStart {
|
||||||
|
string token = 1;
|
||||||
|
optional string title = 4;
|
||||||
|
optional string message = 2;
|
||||||
|
optional uint32 percentage = 3;
|
||||||
|
optional bool is_cancellable = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspWorkProgress {
|
||||||
|
string token = 1;
|
||||||
|
optional string message = 2;
|
||||||
|
optional uint32 percentage = 3;
|
||||||
|
optional bool is_cancellable = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspWorkEnd {
|
||||||
|
string token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspDiskBasedDiagnosticsUpdating {}
|
||||||
|
|
||||||
|
message LspDiskBasedDiagnosticsUpdated {}
|
||||||
|
|
||||||
|
message LanguageServerLog {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 language_server_id = 2;
|
||||||
|
oneof log_type {
|
||||||
|
uint32 log_message_type = 3;
|
||||||
|
LspLogTrace log_trace = 4;
|
||||||
|
}
|
||||||
|
string message = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspLogTrace {
|
||||||
|
optional string message = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCodeActionKind {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string kind = 2;
|
||||||
|
repeated uint64 buffer_ids = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ApplyCodeActionKindResponse {
|
||||||
|
ProjectTransaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RegisterBufferWithLanguageServers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FormatTrigger {
|
||||||
|
Save = 0;
|
||||||
|
Manual = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenBufferForSymbol {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
Symbol symbol = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OpenBufferForSymbolResponse {
|
||||||
|
uint64 buffer_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FormatBuffers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
FormatTrigger trigger = 2;
|
||||||
|
repeated uint64 buffer_ids = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FormatBuffersResponse {
|
||||||
|
ProjectTransaction transaction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCompletions {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
Anchor position = 3;
|
||||||
|
repeated VectorClockEntry version = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CancelLanguageServerWork {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
|
||||||
|
oneof work {
|
||||||
|
Buffers buffers = 2;
|
||||||
|
LanguageServerWork language_server_work = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Buffers {
|
||||||
|
repeated uint64 buffer_ids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServerWork {
|
||||||
|
uint64 language_server_id = 1;
|
||||||
|
optional string token = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServerPromptRequest {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
|
||||||
|
oneof level {
|
||||||
|
Info info = 2;
|
||||||
|
Warning warning = 3;
|
||||||
|
Critical critical = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Info {}
|
||||||
|
message Warning {}
|
||||||
|
message Critical {}
|
||||||
|
|
||||||
|
string message = 5;
|
||||||
|
repeated string actions = 6;
|
||||||
|
string lsp_name = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServerPromptResponse {
|
||||||
|
optional uint64 action_response = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MultiLspQuery {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
repeated VectorClockEntry version = 3;
|
||||||
|
oneof strategy {
|
||||||
|
AllLanguageServers all = 4;
|
||||||
|
}
|
||||||
|
oneof request {
|
||||||
|
GetHover get_hover = 5;
|
||||||
|
GetCodeActions get_code_actions = 6;
|
||||||
|
GetSignatureHelp get_signature_help = 7;
|
||||||
|
GetCodeLens get_code_lens = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message AllLanguageServers {}
|
||||||
|
|
||||||
|
message RestartLanguageServers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated uint64 buffer_ids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StopLanguageServers {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
repeated uint64 buffer_ids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MultiLspQueryResponse {
|
||||||
|
repeated LspResponse responses = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LspResponse {
|
||||||
|
oneof response {
|
||||||
|
GetHoverResponse get_hover_response = 1;
|
||||||
|
GetCodeActionsResponse get_code_actions_response = 2;
|
||||||
|
GetSignatureHelpResponse get_signature_help_response = 3;
|
||||||
|
GetCodeLensResponse get_code_lens_response = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServerIdForName {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 buffer_id = 2;
|
||||||
|
string name = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LanguageServerIdForNameResponse {
|
||||||
|
optional uint64 server_id = 1;
|
||||||
|
}
|
37
crates/proto/proto/notification.proto
Normal file
37
crates/proto/proto/notification.proto
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
message GetNotifications {
|
||||||
|
optional uint64 before_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddNotification {
|
||||||
|
Notification notification = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetNotificationsResponse {
|
||||||
|
repeated Notification notifications = 1;
|
||||||
|
bool done = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteNotification {
|
||||||
|
uint64 notification_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateNotification {
|
||||||
|
Notification notification = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MarkNotificationRead {
|
||||||
|
uint64 notification_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Notification {
|
||||||
|
uint64 id = 1;
|
||||||
|
uint64 timestamp = 2;
|
||||||
|
string kind = 3;
|
||||||
|
optional uint64 entity_id = 4;
|
||||||
|
string content = 5;
|
||||||
|
bool is_read = 6;
|
||||||
|
optional bool response = 7;
|
||||||
|
}
|
42
crates/proto/proto/task.proto
Normal file
42
crates/proto/proto/task.proto
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
import "buffer.proto";
|
||||||
|
|
||||||
|
message TaskContextForLocation {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
Location location = 2;
|
||||||
|
map<string, string> task_variables = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message TaskContext {
|
||||||
|
optional string cwd = 1;
|
||||||
|
map<string, string> task_variables = 2;
|
||||||
|
map<string, string> project_env = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Shell {
|
||||||
|
message WithArguments {
|
||||||
|
string program = 1;
|
||||||
|
repeated string args = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
oneof shell_type {
|
||||||
|
System system = 1;
|
||||||
|
string program = 2;
|
||||||
|
WithArguments with_arguments = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message System {}
|
||||||
|
|
||||||
|
enum RevealStrategy {
|
||||||
|
RevealAlways = 0;
|
||||||
|
RevealNever = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HideStrategy {
|
||||||
|
HideAlways = 0;
|
||||||
|
HideNever = 1;
|
||||||
|
HideOnSuccess = 2;
|
||||||
|
}
|
45
crates/proto/proto/toolchain.proto
Normal file
45
crates/proto/proto/toolchain.proto
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
message ListToolchains {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string language_name = 3;
|
||||||
|
optional string path = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Toolchain {
|
||||||
|
string name = 1;
|
||||||
|
string path = 2;
|
||||||
|
string raw_json = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ToolchainGroup {
|
||||||
|
uint64 start_index = 1;
|
||||||
|
string name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListToolchainsResponse {
|
||||||
|
repeated Toolchain toolchains = 1;
|
||||||
|
bool has_values = 2;
|
||||||
|
repeated ToolchainGroup groups = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ActivateToolchain {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
Toolchain toolchain = 3;
|
||||||
|
string language_name = 4;
|
||||||
|
optional string path = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ActiveToolchain {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string language_name = 3;
|
||||||
|
optional string path = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ActiveToolchainResponse {
|
||||||
|
optional Toolchain toolchain = 1;
|
||||||
|
}
|
150
crates/proto/proto/worktree.proto
Normal file
150
crates/proto/proto/worktree.proto
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package zed.messages;
|
||||||
|
|
||||||
|
message Timestamp {
|
||||||
|
uint64 seconds = 1;
|
||||||
|
uint32 nanos = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message File {
|
||||||
|
uint64 worktree_id = 1;
|
||||||
|
optional uint64 entry_id = 2;
|
||||||
|
string path = 3;
|
||||||
|
Timestamp mtime = 4;
|
||||||
|
bool is_deleted = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Entry {
|
||||||
|
uint64 id = 1;
|
||||||
|
bool is_dir = 2;
|
||||||
|
string path = 3;
|
||||||
|
uint64 inode = 4;
|
||||||
|
Timestamp mtime = 5;
|
||||||
|
bool is_ignored = 7;
|
||||||
|
bool is_external = 8;
|
||||||
|
reserved 6;
|
||||||
|
reserved 9;
|
||||||
|
bool is_fifo = 10;
|
||||||
|
optional uint64 size = 11;
|
||||||
|
optional string canonical_path = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddWorktree {
|
||||||
|
string path = 1;
|
||||||
|
uint64 project_id = 2;
|
||||||
|
bool visible = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddWorktreeResponse {
|
||||||
|
uint64 worktree_id = 1;
|
||||||
|
string canonicalized_path = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveWorktree {
|
||||||
|
uint64 worktree_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPathMetadata {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
string path = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPathMetadataResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
string path = 2;
|
||||||
|
bool is_dir = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message WorktreeMetadata {
|
||||||
|
uint64 id = 1;
|
||||||
|
string root_name = 2;
|
||||||
|
bool visible = 3;
|
||||||
|
string abs_path = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProjectPath {
|
||||||
|
uint64 worktree_id = 1;
|
||||||
|
string path = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListRemoteDirectoryConfig {
|
||||||
|
bool is_dir = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListRemoteDirectory {
|
||||||
|
uint64 dev_server_id = 1;
|
||||||
|
string path = 2;
|
||||||
|
ListRemoteDirectoryConfig config = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EntryInfo {
|
||||||
|
bool is_dir = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListRemoteDirectoryResponse {
|
||||||
|
repeated string entries = 1;
|
||||||
|
repeated EntryInfo entry_info = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string path = 3;
|
||||||
|
bool is_directory = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RenameProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 entry_id = 2;
|
||||||
|
string new_path = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CopyProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 entry_id = 2;
|
||||||
|
string new_path = 3;
|
||||||
|
optional string relative_worktree_source_path = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 entry_id = 2;
|
||||||
|
bool use_trash = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExpandProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 entry_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExpandProjectEntryResponse {
|
||||||
|
uint64 worktree_scan_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExpandAllForProjectEntry {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 entry_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExpandAllForProjectEntryResponse {
|
||||||
|
uint64 worktree_scan_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProjectEntryResponse {
|
||||||
|
optional Entry entry = 1;
|
||||||
|
uint64 worktree_scan_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateWorktreeSettings {
|
||||||
|
uint64 project_id = 1;
|
||||||
|
uint64 worktree_id = 2;
|
||||||
|
string path = 3;
|
||||||
|
optional string content = 4;
|
||||||
|
optional LocalSettingsKind kind = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum LocalSettingsKind {
|
||||||
|
Settings = 0;
|
||||||
|
Tasks = 1;
|
||||||
|
Editorconfig = 2;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -5,195 +5,20 @@ mod macros;
|
||||||
mod typed_envelope;
|
mod typed_envelope;
|
||||||
|
|
||||||
pub use error::*;
|
pub use error::*;
|
||||||
pub use typed_envelope::*;
|
|
||||||
|
|
||||||
pub use prost::{DecodeError, Message};
|
pub use prost::{DecodeError, Message};
|
||||||
use serde::Serialize;
|
|
||||||
use std::{
|
use std::{
|
||||||
any::{Any, TypeId},
|
|
||||||
cmp,
|
cmp,
|
||||||
fmt::{self, Debug},
|
fmt::Debug,
|
||||||
iter, mem,
|
iter, mem,
|
||||||
path::{Path, PathBuf},
|
|
||||||
sync::Arc,
|
|
||||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
pub use typed_envelope::*;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/zed.messages.rs"));
|
include!(concat!(env!("OUT_DIR"), "/zed.messages.rs"));
|
||||||
|
|
||||||
pub const SSH_PEER_ID: PeerId = PeerId { owner_id: 0, id: 0 };
|
pub const SSH_PEER_ID: PeerId = PeerId { owner_id: 0, id: 0 };
|
||||||
pub const SSH_PROJECT_ID: u64 = 0;
|
pub const SSH_PROJECT_ID: u64 = 0;
|
||||||
|
|
||||||
pub trait EnvelopedMessage: Clone + Debug + Serialize + Sized + Send + Sync + 'static {
|
|
||||||
const NAME: &'static str;
|
|
||||||
const PRIORITY: MessagePriority;
|
|
||||||
fn into_envelope(
|
|
||||||
self,
|
|
||||||
id: u32,
|
|
||||||
responding_to: Option<u32>,
|
|
||||||
original_sender_id: Option<PeerId>,
|
|
||||||
) -> Envelope;
|
|
||||||
fn from_envelope(envelope: Envelope) -> Option<Self>;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait EntityMessage: EnvelopedMessage {
|
|
||||||
type Entity;
|
|
||||||
fn remote_entity_id(&self) -> u64;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait RequestMessage: EnvelopedMessage {
|
|
||||||
type Response: EnvelopedMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait AnyTypedEnvelope: 'static + Send + Sync {
|
|
||||||
fn payload_type_id(&self) -> TypeId;
|
|
||||||
fn payload_type_name(&self) -> &'static str;
|
|
||||||
fn as_any(&self) -> &dyn Any;
|
|
||||||
fn into_any(self: Box<Self>) -> Box<dyn Any + Send + Sync>;
|
|
||||||
fn is_background(&self) -> bool;
|
|
||||||
fn original_sender_id(&self) -> Option<PeerId>;
|
|
||||||
fn sender_id(&self) -> PeerId;
|
|
||||||
fn message_id(&self) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum MessagePriority {
|
|
||||||
Foreground,
|
|
||||||
Background,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: EnvelopedMessage> AnyTypedEnvelope for TypedEnvelope<T> {
|
|
||||||
fn payload_type_id(&self) -> TypeId {
|
|
||||||
TypeId::of::<T>()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn payload_type_name(&self) -> &'static str {
|
|
||||||
T::NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_any(&self) -> &dyn Any {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn into_any(self: Box<Self>) -> Box<dyn Any + Send + Sync> {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_background(&self) -> bool {
|
|
||||||
matches!(T::PRIORITY, MessagePriority::Background)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn original_sender_id(&self) -> Option<PeerId> {
|
|
||||||
self.original_sender_id
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sender_id(&self) -> PeerId {
|
|
||||||
self.sender_id
|
|
||||||
}
|
|
||||||
|
|
||||||
fn message_id(&self) -> u32 {
|
|
||||||
self.message_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PeerId {
|
|
||||||
pub fn from_u64(peer_id: u64) -> Self {
|
|
||||||
let owner_id = (peer_id >> 32) as u32;
|
|
||||||
let id = peer_id as u32;
|
|
||||||
Self { owner_id, id }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn as_u64(self) -> u64 {
|
|
||||||
((self.owner_id as u64) << 32) | (self.id as u64)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Copy for PeerId {}
|
|
||||||
|
|
||||||
impl Eq for PeerId {}
|
|
||||||
|
|
||||||
impl Ord for PeerId {
|
|
||||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
|
||||||
self.owner_id
|
|
||||||
.cmp(&other.owner_id)
|
|
||||||
.then_with(|| self.id.cmp(&other.id))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialOrd for PeerId {
|
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
|
||||||
Some(self.cmp(other))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::hash::Hash for PeerId {
|
|
||||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
|
||||||
self.owner_id.hash(state);
|
|
||||||
self.id.hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for PeerId {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "{}/{}", self.owner_id, self.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait FromProto {
|
|
||||||
fn from_proto(proto: String) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToProto {
|
|
||||||
fn to_proto(self) -> String;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromProto for PathBuf {
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
fn from_proto(proto: String) -> Self {
|
|
||||||
proto.split("/").collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
|
||||||
fn from_proto(proto: String) -> Self {
|
|
||||||
PathBuf::from(proto)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromProto for Arc<Path> {
|
|
||||||
fn from_proto(proto: String) -> Self {
|
|
||||||
PathBuf::from_proto(proto).into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToProto for PathBuf {
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
fn to_proto(self) -> String {
|
|
||||||
self.components()
|
|
||||||
.map(|comp| comp.as_os_str().to_string_lossy().to_string())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("/")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
|
||||||
fn to_proto(self) -> String {
|
|
||||||
self.to_string_lossy().to_string()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToProto for &Path {
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
fn to_proto(self) -> String {
|
|
||||||
self.components()
|
|
||||||
.map(|comp| comp.as_os_str().to_string_lossy().to_string())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("/")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
|
||||||
fn to_proto(self) -> String {
|
|
||||||
self.to_string_lossy().to_string()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
messages!(
|
messages!(
|
||||||
(AcceptTermsOfService, Foreground),
|
(AcceptTermsOfService, Foreground),
|
||||||
(AcceptTermsOfServiceResponse, Foreground),
|
(AcceptTermsOfServiceResponse, Foreground),
|
||||||
|
@ -949,6 +774,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn test_proto() {
|
fn test_proto() {
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn generate_proto_path(path: PathBuf) -> PathBuf {
|
fn generate_proto_path(path: PathBuf) -> PathBuf {
|
||||||
let proto = path.to_proto();
|
let proto = path.to_proto();
|
||||||
PathBuf::from_proto(proto)
|
PathBuf::from_proto(proto)
|
||||||
|
|
|
@ -1,7 +1,185 @@
|
||||||
use crate::{PeerId, RequestMessage};
|
use crate::{Envelope, PeerId};
|
||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
|
use serde::Serialize;
|
||||||
|
use std::{
|
||||||
|
any::{Any, TypeId},
|
||||||
|
cmp,
|
||||||
|
fmt::{self, Debug},
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
use std::{marker::PhantomData, time::Instant};
|
use std::{marker::PhantomData, time::Instant};
|
||||||
|
|
||||||
|
pub trait EnvelopedMessage: Clone + Debug + Serialize + Sized + Send + Sync + 'static {
|
||||||
|
const NAME: &'static str;
|
||||||
|
const PRIORITY: MessagePriority;
|
||||||
|
fn into_envelope(
|
||||||
|
self,
|
||||||
|
id: u32,
|
||||||
|
responding_to: Option<u32>,
|
||||||
|
original_sender_id: Option<PeerId>,
|
||||||
|
) -> Envelope;
|
||||||
|
fn from_envelope(envelope: Envelope) -> Option<Self>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait EntityMessage: EnvelopedMessage {
|
||||||
|
type Entity;
|
||||||
|
fn remote_entity_id(&self) -> u64;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait RequestMessage: EnvelopedMessage {
|
||||||
|
type Response: EnvelopedMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait AnyTypedEnvelope: 'static + Send + Sync {
|
||||||
|
fn payload_type_id(&self) -> TypeId;
|
||||||
|
fn payload_type_name(&self) -> &'static str;
|
||||||
|
fn as_any(&self) -> &dyn Any;
|
||||||
|
fn into_any(self: Box<Self>) -> Box<dyn Any + Send + Sync>;
|
||||||
|
fn is_background(&self) -> bool;
|
||||||
|
fn original_sender_id(&self) -> Option<PeerId>;
|
||||||
|
fn sender_id(&self) -> PeerId;
|
||||||
|
fn message_id(&self) -> u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum MessagePriority {
|
||||||
|
Foreground,
|
||||||
|
Background,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: EnvelopedMessage> AnyTypedEnvelope for TypedEnvelope<T> {
|
||||||
|
fn payload_type_id(&self) -> TypeId {
|
||||||
|
TypeId::of::<T>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn payload_type_name(&self) -> &'static str {
|
||||||
|
T::NAME
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn Any {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn into_any(self: Box<Self>) -> Box<dyn Any + Send + Sync> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_background(&self) -> bool {
|
||||||
|
matches!(T::PRIORITY, MessagePriority::Background)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn original_sender_id(&self) -> Option<PeerId> {
|
||||||
|
self.original_sender_id
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sender_id(&self) -> PeerId {
|
||||||
|
self.sender_id
|
||||||
|
}
|
||||||
|
|
||||||
|
fn message_id(&self) -> u32 {
|
||||||
|
self.message_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PeerId {
|
||||||
|
pub fn from_u64(peer_id: u64) -> Self {
|
||||||
|
let owner_id = (peer_id >> 32) as u32;
|
||||||
|
let id = peer_id as u32;
|
||||||
|
Self { owner_id, id }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_u64(self) -> u64 {
|
||||||
|
((self.owner_id as u64) << 32) | (self.id as u64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Copy for PeerId {}
|
||||||
|
|
||||||
|
impl Eq for PeerId {}
|
||||||
|
|
||||||
|
impl Ord for PeerId {
|
||||||
|
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||||
|
self.owner_id
|
||||||
|
.cmp(&other.owner_id)
|
||||||
|
.then_with(|| self.id.cmp(&other.id))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for PeerId {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::hash::Hash for PeerId {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.owner_id.hash(state);
|
||||||
|
self.id.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for PeerId {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}/{}", self.owner_id, self.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait FromProto {
|
||||||
|
fn from_proto(proto: String) -> Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait ToProto {
|
||||||
|
fn to_proto(self) -> String;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromProto for PathBuf {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn from_proto(proto: String) -> Self {
|
||||||
|
proto.split("/").collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn from_proto(proto: String) -> Self {
|
||||||
|
PathBuf::from(proto)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromProto for Arc<Path> {
|
||||||
|
fn from_proto(proto: String) -> Self {
|
||||||
|
PathBuf::from_proto(proto).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToProto for PathBuf {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn to_proto(self) -> String {
|
||||||
|
self.components()
|
||||||
|
.map(|comp| comp.as_os_str().to_string_lossy().to_string())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("/")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn to_proto(self) -> String {
|
||||||
|
self.to_string_lossy().to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToProto for &Path {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn to_proto(self) -> String {
|
||||||
|
self.components()
|
||||||
|
.map(|comp| comp.as_os_str().to_string_lossy().to_string())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("/")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn to_proto(self) -> String {
|
||||||
|
self.to_string_lossy().to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Receipt<T> {
|
pub struct Receipt<T> {
|
||||||
pub sender_id: PeerId,
|
pub sender_id: PeerId,
|
||||||
pub message_id: u32,
|
pub message_id: u32,
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
|
pub use ::proto::*;
|
||||||
|
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use async_tungstenite::tungstenite::Message as WebSocketMessage;
|
use async_tungstenite::tungstenite::Message as WebSocketMessage;
|
||||||
use futures::{SinkExt as _, StreamExt as _};
|
use futures::{SinkExt as _, StreamExt as _};
|
||||||
pub use proto::{Message as _, *};
|
use proto::Message as _;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::{fmt::Debug, io};
|
use std::{fmt::Debug, io};
|
||||||
|
|
||||||
|
@ -32,10 +34,6 @@ impl<S> MessageStream<S> {
|
||||||
encoding_buffer: Vec::new(),
|
encoding_buffer: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn inner_mut(&mut self) -> &mut S {
|
|
||||||
&mut self.stream
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> MessageStream<S>
|
impl<S> MessageStream<S>
|
|
@ -1,8 +1,8 @@
|
||||||
use super::{
|
use super::{
|
||||||
Connection,
|
Connection,
|
||||||
|
message_stream::{Message, MessageStream},
|
||||||
proto::{
|
proto::{
|
||||||
self, AnyTypedEnvelope, EnvelopedMessage, MessageStream, PeerId, Receipt, RequestMessage,
|
self, AnyTypedEnvelope, EnvelopedMessage, PeerId, Receipt, RequestMessage, TypedEnvelope,
|
||||||
TypedEnvelope,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use anyhow::{Context as _, Result, anyhow};
|
use anyhow::{Context as _, Result, anyhow};
|
||||||
|
@ -67,7 +67,7 @@ pub struct Peer {
|
||||||
#[derive(Clone, Serialize)]
|
#[derive(Clone, Serialize)]
|
||||||
pub struct ConnectionState {
|
pub struct ConnectionState {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
outgoing_tx: mpsc::UnboundedSender<proto::Message>,
|
outgoing_tx: mpsc::UnboundedSender<Message>,
|
||||||
next_message_id: Arc<AtomicU32>,
|
next_message_id: Arc<AtomicU32>,
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
|
@ -209,7 +209,7 @@ impl Peer {
|
||||||
_ = keepalive_timer => {
|
_ = keepalive_timer => {
|
||||||
tracing::trace!(%connection_id, "keepalive interval: pinging");
|
tracing::trace!(%connection_id, "keepalive interval: pinging");
|
||||||
futures::select_biased! {
|
futures::select_biased! {
|
||||||
result = writer.write(proto::Message::Ping).fuse() => {
|
result = writer.write(Message::Ping).fuse() => {
|
||||||
tracing::trace!(%connection_id, "keepalive interval: done pinging");
|
tracing::trace!(%connection_id, "keepalive interval: done pinging");
|
||||||
result.context("failed to send keepalive")?;
|
result.context("failed to send keepalive")?;
|
||||||
tracing::trace!(%connection_id, "keepalive interval: resetting after pinging");
|
tracing::trace!(%connection_id, "keepalive interval: resetting after pinging");
|
||||||
|
@ -226,7 +226,7 @@ impl Peer {
|
||||||
tracing::trace!(%connection_id, "incoming rpc message: received");
|
tracing::trace!(%connection_id, "incoming rpc message: received");
|
||||||
tracing::trace!(%connection_id, "receive timeout: resetting");
|
tracing::trace!(%connection_id, "receive timeout: resetting");
|
||||||
receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse());
|
receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse());
|
||||||
if let (proto::Message::Envelope(incoming), received_at) = incoming {
|
if let (Message::Envelope(incoming), received_at) = incoming {
|
||||||
tracing::trace!(%connection_id, "incoming rpc message: processing");
|
tracing::trace!(%connection_id, "incoming rpc message: processing");
|
||||||
futures::select_biased! {
|
futures::select_biased! {
|
||||||
result = incoming_tx.send((incoming, received_at)).fuse() => match result {
|
result = incoming_tx.send((incoming, received_at)).fuse() => match result {
|
||||||
|
@ -469,7 +469,7 @@ impl Peer {
|
||||||
.insert(envelope.id, tx);
|
.insert(envelope.id, tx);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(envelope))
|
.unbounded_send(Message::Envelope(envelope))
|
||||||
.map_err(|_| anyhow!("connection was closed"))?;
|
.map_err(|_| anyhow!("connection was closed"))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
@ -500,7 +500,7 @@ impl Peer {
|
||||||
.insert(message_id, tx);
|
.insert(message_id, tx);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(
|
.unbounded_send(Message::Envelope(
|
||||||
request.into_envelope(message_id, None, None),
|
request.into_envelope(message_id, None, None),
|
||||||
))
|
))
|
||||||
.map_err(|_| anyhow!("connection was closed"))?;
|
.map_err(|_| anyhow!("connection was closed"))?;
|
||||||
|
@ -545,11 +545,9 @@ impl Peer {
|
||||||
let message_id = connection
|
let message_id = connection
|
||||||
.next_message_id
|
.next_message_id
|
||||||
.fetch_add(1, atomic::Ordering::SeqCst);
|
.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
connection
|
connection.outgoing_tx.unbounded_send(Message::Envelope(
|
||||||
.outgoing_tx
|
message.into_envelope(message_id, None, None),
|
||||||
.unbounded_send(proto::Message::Envelope(
|
))?;
|
||||||
message.into_envelope(message_id, None, None),
|
|
||||||
))?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +555,7 @@ impl Peer {
|
||||||
let connection = self.connection_state(receiver_id)?;
|
let connection = self.connection_state(receiver_id)?;
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(message))?;
|
.unbounded_send(Message::Envelope(message))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +571,7 @@ impl Peer {
|
||||||
.fetch_add(1, atomic::Ordering::SeqCst);
|
.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(message.into_envelope(
|
.unbounded_send(Message::Envelope(message.into_envelope(
|
||||||
message_id,
|
message_id,
|
||||||
None,
|
None,
|
||||||
Some(sender_id.into()),
|
Some(sender_id.into()),
|
||||||
|
@ -592,7 +590,7 @@ impl Peer {
|
||||||
.fetch_add(1, atomic::Ordering::SeqCst);
|
.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(response.into_envelope(
|
.unbounded_send(Message::Envelope(response.into_envelope(
|
||||||
message_id,
|
message_id,
|
||||||
Some(receipt.message_id),
|
Some(receipt.message_id),
|
||||||
None,
|
None,
|
||||||
|
@ -610,7 +608,7 @@ impl Peer {
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(message.into_envelope(
|
.unbounded_send(Message::Envelope(message.into_envelope(
|
||||||
message_id,
|
message_id,
|
||||||
Some(receipt.message_id),
|
Some(receipt.message_id),
|
||||||
None,
|
None,
|
||||||
|
@ -629,7 +627,7 @@ impl Peer {
|
||||||
.fetch_add(1, atomic::Ordering::SeqCst);
|
.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(response.into_envelope(
|
.unbounded_send(Message::Envelope(response.into_envelope(
|
||||||
message_id,
|
message_id,
|
||||||
Some(receipt.message_id),
|
Some(receipt.message_id),
|
||||||
None,
|
None,
|
||||||
|
@ -652,7 +650,7 @@ impl Peer {
|
||||||
.fetch_add(1, atomic::Ordering::SeqCst);
|
.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
connection
|
connection
|
||||||
.outgoing_tx
|
.outgoing_tx
|
||||||
.unbounded_send(proto::Message::Envelope(response.into_envelope(
|
.unbounded_send(Message::Envelope(response.into_envelope(
|
||||||
message_id,
|
message_id,
|
||||||
Some(request_message_id),
|
Some(request_message_id),
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -2,15 +2,16 @@ pub mod auth;
|
||||||
mod conn;
|
mod conn;
|
||||||
mod extension;
|
mod extension;
|
||||||
mod llm;
|
mod llm;
|
||||||
|
mod message_stream;
|
||||||
mod notification;
|
mod notification;
|
||||||
mod peer;
|
mod peer;
|
||||||
pub mod proto;
|
|
||||||
|
|
||||||
pub use conn::Connection;
|
pub use conn::Connection;
|
||||||
pub use extension::*;
|
pub use extension::*;
|
||||||
pub use llm::*;
|
pub use llm::*;
|
||||||
pub use notification::*;
|
pub use notification::*;
|
||||||
pub use peer::*;
|
pub use peer::*;
|
||||||
|
pub use proto;
|
||||||
pub use proto::{Receipt, TypedEnvelope, error::*};
|
pub use proto::{Receipt, TypedEnvelope, error::*};
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue