mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
0e62ddbb65
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
368 lines
7.4 KiB
Protocol Buffer
368 lines
7.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
package zed.messages;
|
|
|
|
message Envelope {
|
|
uint32 id = 1;
|
|
optional uint32 responding_to = 2;
|
|
optional uint32 original_sender_id = 3;
|
|
oneof payload {
|
|
Ack ack = 4;
|
|
Error error = 5;
|
|
Ping ping = 6;
|
|
ShareWorktree share_worktree = 7;
|
|
ShareWorktreeResponse share_worktree_response = 8;
|
|
JoinWorktree join_worktree = 9;
|
|
JoinWorktreeResponse join_worktree_response = 10;
|
|
UpdateWorktree update_worktree = 11;
|
|
CloseWorktree close_worktree = 12;
|
|
OpenBuffer open_buffer = 13;
|
|
OpenBufferResponse open_buffer_response = 14;
|
|
CloseBuffer close_buffer = 15;
|
|
UpdateBuffer update_buffer = 16;
|
|
SaveBuffer save_buffer = 17;
|
|
BufferSaved buffer_saved = 18;
|
|
AddPeer add_peer = 19;
|
|
RemovePeer remove_peer = 20;
|
|
GetChannels get_channels = 21;
|
|
GetChannelsResponse get_channels_response = 22;
|
|
GetUsers get_users = 23;
|
|
GetUsersResponse get_users_response = 24;
|
|
JoinChannel join_channel = 25;
|
|
JoinChannelResponse join_channel_response = 26;
|
|
LeaveChannel leave_channel = 27;
|
|
SendChannelMessage send_channel_message = 28;
|
|
SendChannelMessageResponse send_channel_message_response = 29;
|
|
ChannelMessageSent channel_message_sent = 30;
|
|
GetChannelMessages get_channel_messages = 31;
|
|
GetChannelMessagesResponse get_channel_messages_response = 32;
|
|
OpenWorktree open_worktree = 33;
|
|
OpenWorktreeResponse open_worktree_response = 34;
|
|
UnshareWorktree unshare_worktree = 35;
|
|
UpdateCollaborators update_collaborators = 36;
|
|
LeaveWorktree leave_worktree = 37;
|
|
}
|
|
}
|
|
|
|
// Messages
|
|
|
|
message Ping {}
|
|
|
|
message Ack {}
|
|
|
|
message Error {
|
|
string message = 1;
|
|
}
|
|
|
|
message OpenWorktree {
|
|
string root_name = 1;
|
|
repeated string collaborator_logins = 2;
|
|
}
|
|
|
|
message OpenWorktreeResponse {
|
|
uint64 worktree_id = 1;
|
|
}
|
|
|
|
message ShareWorktree {
|
|
Worktree worktree = 1;
|
|
}
|
|
|
|
message ShareWorktreeResponse {}
|
|
|
|
message UnshareWorktree {
|
|
uint64 worktree_id = 1;
|
|
}
|
|
|
|
message JoinWorktree {
|
|
uint64 worktree_id = 1;
|
|
}
|
|
|
|
message LeaveWorktree {
|
|
uint64 worktree_id = 1;
|
|
}
|
|
|
|
message JoinWorktreeResponse {
|
|
Worktree worktree = 2;
|
|
uint32 replica_id = 3;
|
|
repeated Peer peers = 4;
|
|
}
|
|
|
|
message UpdateWorktree {
|
|
uint64 worktree_id = 1;
|
|
repeated Entry updated_entries = 2;
|
|
repeated uint64 removed_entries = 3;
|
|
}
|
|
|
|
message CloseWorktree {
|
|
uint64 worktree_id = 1;
|
|
}
|
|
|
|
message AddPeer {
|
|
uint64 worktree_id = 1;
|
|
Peer peer = 2;
|
|
}
|
|
|
|
message RemovePeer {
|
|
uint64 worktree_id = 1;
|
|
uint32 peer_id = 2;
|
|
}
|
|
|
|
message OpenBuffer {
|
|
uint64 worktree_id = 1;
|
|
string path = 2;
|
|
}
|
|
|
|
message OpenBufferResponse {
|
|
Buffer buffer = 1;
|
|
}
|
|
|
|
message CloseBuffer {
|
|
uint64 worktree_id = 1;
|
|
uint64 buffer_id = 2;
|
|
}
|
|
|
|
message UpdateBuffer {
|
|
uint64 worktree_id = 1;
|
|
uint64 buffer_id = 2;
|
|
repeated Operation operations = 3;
|
|
}
|
|
|
|
message SaveBuffer {
|
|
uint64 worktree_id = 1;
|
|
uint64 buffer_id = 2;
|
|
}
|
|
|
|
message BufferSaved {
|
|
uint64 worktree_id = 1;
|
|
uint64 buffer_id = 2;
|
|
repeated VectorClockEntry version = 3;
|
|
Timestamp mtime = 4;
|
|
}
|
|
|
|
message GetChannels {}
|
|
|
|
message GetChannelsResponse {
|
|
repeated Channel channels = 1;
|
|
}
|
|
|
|
message JoinChannel {
|
|
uint64 channel_id = 1;
|
|
}
|
|
|
|
message JoinChannelResponse {
|
|
repeated ChannelMessage messages = 1;
|
|
bool done = 2;
|
|
}
|
|
|
|
message LeaveChannel {
|
|
uint64 channel_id = 1;
|
|
}
|
|
|
|
message GetUsers {
|
|
repeated uint64 user_ids = 1;
|
|
}
|
|
|
|
message GetUsersResponse {
|
|
repeated User users = 1;
|
|
}
|
|
|
|
message SendChannelMessage {
|
|
uint64 channel_id = 1;
|
|
string body = 2;
|
|
Nonce nonce = 3;
|
|
}
|
|
|
|
message SendChannelMessageResponse {
|
|
ChannelMessage message = 1;
|
|
}
|
|
|
|
message ChannelMessageSent {
|
|
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 UpdateCollaborators {
|
|
repeated Collaborator collaborators = 1;
|
|
}
|
|
|
|
// Entities
|
|
|
|
message Peer {
|
|
uint32 peer_id = 1;
|
|
uint32 replica_id = 2;
|
|
}
|
|
|
|
message User {
|
|
uint64 id = 1;
|
|
string github_login = 2;
|
|
string avatar_url = 3;
|
|
}
|
|
|
|
message Worktree {
|
|
uint64 id = 1;
|
|
string root_name = 2;
|
|
repeated Entry entries = 3;
|
|
}
|
|
|
|
message Entry {
|
|
uint64 id = 1;
|
|
bool is_dir = 2;
|
|
string path = 3;
|
|
uint64 inode = 4;
|
|
Timestamp mtime = 5;
|
|
bool is_symlink = 6;
|
|
bool is_ignored = 7;
|
|
}
|
|
|
|
message Buffer {
|
|
uint64 id = 1;
|
|
string content = 2;
|
|
repeated Operation.Edit history = 3;
|
|
repeated SelectionSet selections = 4;
|
|
DiagnosticSet diagnostics = 5;
|
|
}
|
|
|
|
message SelectionSet {
|
|
uint32 replica_id = 1;
|
|
uint32 lamport_timestamp = 2;
|
|
bool is_active = 3;
|
|
repeated VectorClockEntry version = 4;
|
|
repeated Selection selections = 5;
|
|
}
|
|
|
|
message Selection {
|
|
uint64 id = 1;
|
|
uint64 start = 2;
|
|
uint64 end = 3;
|
|
bool reversed = 4;
|
|
}
|
|
|
|
message DiagnosticSet {
|
|
repeated VectorClockEntry version = 1;
|
|
repeated Diagnostic diagnostics = 2;
|
|
}
|
|
|
|
message Diagnostic {
|
|
uint64 start = 1;
|
|
uint64 end = 2;
|
|
Severity severity = 3;
|
|
string message = 4;
|
|
enum Severity {
|
|
None = 0;
|
|
Error = 1;
|
|
Warning = 2;
|
|
Information = 3;
|
|
Hint = 4;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
message Operation {
|
|
oneof variant {
|
|
Edit edit = 1;
|
|
Undo undo = 2;
|
|
UpdateSelections update_selections = 3;
|
|
RemoveSelections remove_selections = 4;
|
|
SetActiveSelections set_active_selections = 5;
|
|
DiagnosticSet update_diagnostics = 6;
|
|
}
|
|
|
|
message Edit {
|
|
uint32 replica_id = 1;
|
|
uint32 local_timestamp = 2;
|
|
uint32 lamport_timestamp = 3;
|
|
repeated VectorClockEntry version = 4;
|
|
repeated Range ranges = 5;
|
|
optional string new_text = 6;
|
|
}
|
|
|
|
message Undo {
|
|
uint32 replica_id = 1;
|
|
uint32 local_timestamp = 2;
|
|
uint32 lamport_timestamp = 3;
|
|
repeated Range ranges = 4;
|
|
repeated VectorClockEntry version = 5;
|
|
repeated UndoCount counts = 6;
|
|
}
|
|
|
|
message UndoCount {
|
|
uint32 replica_id = 1;
|
|
uint32 local_timestamp = 2;
|
|
uint32 count = 3;
|
|
}
|
|
|
|
message UpdateSelections {
|
|
uint32 replica_id = 1;
|
|
uint32 local_timestamp = 2;
|
|
uint32 lamport_timestamp = 3;
|
|
repeated VectorClockEntry version = 4;
|
|
repeated Selection selections = 5;
|
|
}
|
|
|
|
message RemoveSelections {
|
|
uint32 replica_id = 1;
|
|
uint32 local_timestamp = 2;
|
|
uint32 lamport_timestamp = 3;
|
|
}
|
|
|
|
message SetActiveSelections {
|
|
uint32 replica_id = 1;
|
|
optional uint32 local_timestamp = 2;
|
|
uint32 lamport_timestamp = 3;
|
|
}
|
|
}
|
|
|
|
message VectorClockEntry {
|
|
uint32 replica_id = 1;
|
|
uint32 timestamp = 2;
|
|
}
|
|
|
|
message Timestamp {
|
|
uint64 seconds = 1;
|
|
uint32 nanos = 2;
|
|
}
|
|
|
|
message Range {
|
|
uint64 start = 1;
|
|
uint64 end = 2;
|
|
}
|
|
|
|
message Nonce {
|
|
uint64 upper_half = 1;
|
|
uint64 lower_half = 2;
|
|
}
|
|
|
|
message Channel {
|
|
uint64 id = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message ChannelMessage {
|
|
uint64 id = 1;
|
|
string body = 2;
|
|
uint64 timestamp = 3;
|
|
uint64 sender_id = 4;
|
|
Nonce nonce = 5;
|
|
}
|
|
|
|
message Collaborator {
|
|
uint64 user_id = 1;
|
|
repeated WorktreeMetadata worktrees = 2;
|
|
}
|
|
|
|
message WorktreeMetadata {
|
|
uint64 id = 1;
|
|
string root_name = 2;
|
|
bool is_shared = 3;
|
|
repeated uint64 guests = 4;
|
|
}
|