1syntax = "proto3";
2package zed.messages;
3
4message Envelope {
5 uint32 id = 1;
6 optional uint32 responding_to = 2;
7 optional uint32 original_sender_id = 3;
8 oneof payload {
9 Ack ack = 4;
10 Error error = 5;
11 Ping ping = 6;
12 Test test = 7;
13
14 RegisterProject register_project = 8;
15 RegisterProjectResponse register_project_response = 9;
16 UnregisterProject unregister_project = 10;
17 ShareProject share_project = 11;
18 UnshareProject unshare_project = 12;
19 JoinProject join_project = 13;
20 JoinProjectResponse join_project_response = 14;
21 LeaveProject leave_project = 15;
22 AddProjectCollaborator add_project_collaborator = 16;
23 RemoveProjectCollaborator remove_project_collaborator = 17;
24
25 GetDefinition get_definition = 18;
26 GetDefinitionResponse get_definition_response = 19;
27 GetReferences get_references = 20;
28 GetReferencesResponse get_references_response = 21;
29 GetDocumentHighlights get_document_highlights = 22;
30 GetDocumentHighlightsResponse get_document_highlights_response = 23;
31 GetProjectSymbols get_project_symbols = 24;
32 GetProjectSymbolsResponse get_project_symbols_response = 25;
33 OpenBufferForSymbol open_buffer_for_symbol = 26;
34 OpenBufferForSymbolResponse open_buffer_for_symbol_response = 27;
35
36 RegisterWorktree register_worktree = 28;
37 UnregisterWorktree unregister_worktree = 29;
38 UpdateWorktree update_worktree = 31;
39 UpdateDiagnosticSummary update_diagnostic_summary = 32;
40 DiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 33;
41 DiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 34;
42
43 OpenBuffer open_buffer = 35;
44 OpenBufferResponse open_buffer_response = 36;
45 CloseBuffer close_buffer = 37;
46 UpdateBuffer update_buffer = 38;
47 UpdateBufferFile update_buffer_file = 39;
48 SaveBuffer save_buffer = 40;
49 BufferSaved buffer_saved = 41;
50 BufferReloaded buffer_reloaded = 42;
51 FormatBuffers format_buffers = 43;
52 FormatBuffersResponse format_buffers_response = 44;
53 GetCompletions get_completions = 45;
54 GetCompletionsResponse get_completions_response = 46;
55 ApplyCompletionAdditionalEdits apply_completion_additional_edits = 47;
56 ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 48;
57 GetCodeActions get_code_actions = 49;
58 GetCodeActionsResponse get_code_actions_response = 50;
59 ApplyCodeAction apply_code_action = 51;
60 ApplyCodeActionResponse apply_code_action_response = 52;
61 PrepareRename prepare_rename = 53;
62 PrepareRenameResponse prepare_rename_response = 54;
63 PerformRename perform_rename = 55;
64 PerformRenameResponse perform_rename_response = 56;
65 SearchProject search_project = 57;
66 SearchProjectResponse search_project_response = 58;
67
68 GetChannels get_channels = 59;
69 GetChannelsResponse get_channels_response = 60;
70 JoinChannel join_channel = 61;
71 JoinChannelResponse join_channel_response = 62;
72 LeaveChannel leave_channel = 63;
73 SendChannelMessage send_channel_message = 64;
74 SendChannelMessageResponse send_channel_message_response = 65;
75 ChannelMessageSent channel_message_sent = 66;
76 GetChannelMessages get_channel_messages = 67;
77 GetChannelMessagesResponse get_channel_messages_response = 68;
78
79 UpdateContacts update_contacts = 69;
80
81 GetUsers get_users = 70;
82 GetUsersResponse get_users_response = 71;
83 }
84}
85
86// Messages
87
88message Ping {}
89
90message Ack {}
91
92message Error {
93 string message = 1;
94}
95
96message Test {
97 uint64 id = 1;
98}
99
100message RegisterProject {}
101
102message RegisterProjectResponse {
103 uint64 project_id = 1;
104}
105
106message UnregisterProject {
107 uint64 project_id = 1;
108}
109
110message ShareProject {
111 uint64 project_id = 1;
112}
113
114message UnshareProject {
115 uint64 project_id = 1;
116}
117
118message JoinProject {
119 uint64 project_id = 1;
120}
121
122message JoinProjectResponse {
123 uint32 replica_id = 1;
124 repeated Worktree worktrees = 2;
125 repeated Collaborator collaborators = 3;
126}
127
128message LeaveProject {
129 uint64 project_id = 1;
130}
131
132message RegisterWorktree {
133 uint64 project_id = 1;
134 uint64 worktree_id = 2;
135 string root_name = 3;
136 repeated string authorized_logins = 4;
137 bool weak = 5;
138}
139
140message UnregisterWorktree {
141 uint64 project_id = 1;
142 uint64 worktree_id = 2;
143}
144
145message UpdateWorktree {
146 uint64 project_id = 1;
147 uint64 worktree_id = 2;
148 string root_name = 3;
149 repeated Entry updated_entries = 4;
150 repeated uint64 removed_entries = 5;
151}
152
153message AddProjectCollaborator {
154 uint64 project_id = 1;
155 Collaborator collaborator = 2;
156}
157
158message RemoveProjectCollaborator {
159 uint64 project_id = 1;
160 uint32 peer_id = 2;
161}
162
163message GetDefinition {
164 uint64 project_id = 1;
165 uint64 buffer_id = 2;
166 Anchor position = 3;
167 }
168
169message GetDefinitionResponse {
170 repeated Location locations = 1;
171}
172
173message GetReferences {
174 uint64 project_id = 1;
175 uint64 buffer_id = 2;
176 Anchor position = 3;
177 }
178
179message GetReferencesResponse {
180 repeated Location locations = 1;
181}
182
183message GetDocumentHighlights {
184 uint64 project_id = 1;
185 uint64 buffer_id = 2;
186 Anchor position = 3;
187 }
188
189message GetDocumentHighlightsResponse {
190 repeated DocumentHighlight highlights = 1;
191}
192
193message Location {
194 Buffer buffer = 1;
195 Anchor start = 2;
196 Anchor end = 3;
197}
198
199message DocumentHighlight {
200 Kind kind = 1;
201 Anchor start = 2;
202 Anchor end = 3;
203
204 enum Kind {
205 Text = 0;
206 Read = 1;
207 Write = 2;
208 }
209}
210
211message GetProjectSymbols {
212 uint64 project_id = 1;
213 string query = 2;
214}
215
216message GetProjectSymbolsResponse {
217 repeated Symbol symbols = 4;
218}
219
220message Symbol {
221 uint64 source_worktree_id = 1;
222 uint64 worktree_id = 2;
223 string language_name = 3;
224 string name = 4;
225 int32 kind = 5;
226 string path = 6;
227 Point start = 7;
228 Point end = 8;
229 bytes signature = 9;
230}
231
232message OpenBufferForSymbol {
233 uint64 project_id = 1;
234 Symbol symbol = 2;
235}
236
237message OpenBufferForSymbolResponse {
238 Buffer buffer = 1;
239}
240
241message OpenBuffer {
242 uint64 project_id = 1;
243 uint64 worktree_id = 2;
244 string path = 3;
245}
246
247message OpenBufferResponse {
248 Buffer buffer = 1;
249}
250
251message CloseBuffer {
252 uint64 project_id = 1;
253 uint64 buffer_id = 2;
254}
255
256message UpdateBuffer {
257 uint64 project_id = 1;
258 uint64 buffer_id = 2;
259 repeated Operation operations = 3;
260}
261
262message UpdateBufferFile {
263 uint64 project_id = 1;
264 uint64 buffer_id = 2;
265 File file = 3;
266}
267
268message SaveBuffer {
269 uint64 project_id = 1;
270 uint64 buffer_id = 2;
271 repeated VectorClockEntry version = 3;
272}
273
274message BufferSaved {
275 uint64 project_id = 1;
276 uint64 buffer_id = 2;
277 repeated VectorClockEntry version = 3;
278 Timestamp mtime = 4;
279}
280
281message BufferReloaded {
282 uint64 project_id = 1;
283 uint64 buffer_id = 2;
284 repeated VectorClockEntry version = 3;
285 Timestamp mtime = 4;
286}
287
288message FormatBuffers {
289 uint64 project_id = 1;
290 repeated uint64 buffer_ids = 2;
291}
292
293message FormatBuffersResponse {
294 ProjectTransaction transaction = 1;
295}
296
297message GetCompletions {
298 uint64 project_id = 1;
299 uint64 buffer_id = 2;
300 Anchor position = 3;
301 repeated VectorClockEntry version = 4;
302}
303
304message GetCompletionsResponse {
305 repeated Completion completions = 1;
306 repeated VectorClockEntry version = 2;
307}
308
309message ApplyCompletionAdditionalEdits {
310 uint64 project_id = 1;
311 uint64 buffer_id = 2;
312 Completion completion = 3;
313}
314
315message ApplyCompletionAdditionalEditsResponse {
316 Transaction transaction = 1;
317}
318
319message Completion {
320 Anchor old_start = 1;
321 Anchor old_end = 2;
322 string new_text = 3;
323 bytes lsp_completion = 4;
324}
325
326message GetCodeActions {
327 uint64 project_id = 1;
328 uint64 buffer_id = 2;
329 Anchor start = 3;
330 Anchor end = 4;
331}
332
333message GetCodeActionsResponse {
334 repeated CodeAction actions = 1;
335 repeated VectorClockEntry version = 2;
336}
337
338message ApplyCodeAction {
339 uint64 project_id = 1;
340 uint64 buffer_id = 2;
341 CodeAction action = 3;
342}
343
344message ApplyCodeActionResponse {
345 ProjectTransaction transaction = 1;
346}
347
348message PrepareRename {
349 uint64 project_id = 1;
350 uint64 buffer_id = 2;
351 Anchor position = 3;
352}
353
354message PrepareRenameResponse {
355 bool can_rename = 1;
356 Anchor start = 2;
357 Anchor end = 3;
358 repeated VectorClockEntry version = 4;
359}
360
361message PerformRename {
362 uint64 project_id = 1;
363 uint64 buffer_id = 2;
364 Anchor position = 3;
365 string new_name = 4;
366}
367
368message PerformRenameResponse {
369 ProjectTransaction transaction = 2;
370}
371
372message SearchProject {
373 uint64 project_id = 1;
374 string query = 2;
375 bool regex = 3;
376 bool whole_word = 4;
377 bool case_sensitive = 5;
378}
379
380message SearchProjectResponse {
381 repeated Location locations = 1;
382}
383
384message CodeAction {
385 Anchor start = 1;
386 Anchor end = 2;
387 bytes lsp_action = 3;
388}
389
390message ProjectTransaction {
391 repeated Buffer buffers = 1;
392 repeated Transaction transactions = 2;
393}
394
395message Transaction {
396 LocalTimestamp id = 1;
397 repeated LocalTimestamp edit_ids = 2;
398 repeated VectorClockEntry start = 3;
399 repeated VectorClockEntry end = 4;
400 repeated Range ranges = 5;
401}
402
403message LocalTimestamp {
404 uint32 replica_id = 1;
405 uint32 value = 2;
406}
407
408message UpdateDiagnosticSummary {
409 uint64 project_id = 1;
410 uint64 worktree_id = 2;
411 DiagnosticSummary summary = 3;
412}
413
414message DiagnosticSummary {
415 string path = 1;
416 uint32 error_count = 2;
417 uint32 warning_count = 3;
418 uint32 info_count = 4;
419 uint32 hint_count = 5;
420}
421
422message DiskBasedDiagnosticsUpdating {
423 uint64 project_id = 1;
424}
425
426message DiskBasedDiagnosticsUpdated {
427 uint64 project_id = 1;
428}
429
430message GetChannels {}
431
432message GetChannelsResponse {
433 repeated Channel channels = 1;
434}
435
436message JoinChannel {
437 uint64 channel_id = 1;
438}
439
440message JoinChannelResponse {
441 repeated ChannelMessage messages = 1;
442 bool done = 2;
443}
444
445message LeaveChannel {
446 uint64 channel_id = 1;
447}
448
449message GetUsers {
450 repeated uint64 user_ids = 1;
451}
452
453message GetUsersResponse {
454 repeated User users = 1;
455}
456
457message SendChannelMessage {
458 uint64 channel_id = 1;
459 string body = 2;
460 Nonce nonce = 3;
461}
462
463message SendChannelMessageResponse {
464 ChannelMessage message = 1;
465}
466
467message ChannelMessageSent {
468 uint64 channel_id = 1;
469 ChannelMessage message = 2;
470}
471
472message GetChannelMessages {
473 uint64 channel_id = 1;
474 uint64 before_message_id = 2;
475}
476
477message GetChannelMessagesResponse {
478 repeated ChannelMessage messages = 1;
479 bool done = 2;
480}
481
482message UpdateContacts {
483 repeated Contact contacts = 1;
484}
485
486// Entities
487
488message Collaborator {
489 uint32 peer_id = 1;
490 uint32 replica_id = 2;
491 uint64 user_id = 3;
492}
493
494message User {
495 uint64 id = 1;
496 string github_login = 2;
497 string avatar_url = 3;
498}
499
500message Worktree {
501 uint64 id = 1;
502 string root_name = 2;
503 repeated Entry entries = 3;
504 repeated DiagnosticSummary diagnostic_summaries = 4;
505 bool weak = 5;
506}
507
508message File {
509 uint64 worktree_id = 1;
510 optional uint64 entry_id = 2;
511 string path = 3;
512 Timestamp mtime = 4;
513}
514
515message Entry {
516 uint64 id = 1;
517 bool is_dir = 2;
518 string path = 3;
519 uint64 inode = 4;
520 Timestamp mtime = 5;
521 bool is_symlink = 6;
522 bool is_ignored = 7;
523}
524
525message Buffer {
526 oneof variant {
527 uint64 id = 1;
528 BufferState state = 2;
529 }
530}
531
532message BufferState {
533 uint64 id = 1;
534 optional File file = 2;
535 string base_text = 3;
536 repeated Operation operations = 4;
537 repeated SelectionSet selections = 5;
538 repeated Diagnostic diagnostics = 6;
539 repeated string completion_triggers = 7;
540}
541
542message BufferFragment {
543 uint32 replica_id = 1;
544 uint32 local_timestamp = 2;
545 uint32 lamport_timestamp = 3;
546 uint32 insertion_offset = 4;
547 uint32 len = 5;
548 bool visible = 6;
549 repeated VectorClockEntry deletions = 7;
550 repeated VectorClockEntry max_undos = 8;
551}
552
553message SelectionSet {
554 uint32 replica_id = 1;
555 repeated Selection selections = 2;
556 uint32 lamport_timestamp = 3;
557}
558
559message Selection {
560 uint64 id = 1;
561 Anchor start = 2;
562 Anchor end = 3;
563 bool reversed = 4;
564}
565
566message Anchor {
567 uint32 replica_id = 1;
568 uint32 local_timestamp = 2;
569 uint64 offset = 3;
570 Bias bias = 4;
571}
572
573enum Bias {
574 Left = 0;
575 Right = 1;
576}
577
578message UpdateDiagnostics {
579 uint32 replica_id = 1;
580 uint32 lamport_timestamp = 2;
581 repeated Diagnostic diagnostics = 3;
582}
583
584message Diagnostic {
585 Anchor start = 1;
586 Anchor end = 2;
587 Severity severity = 3;
588 string message = 4;
589 optional string code = 5;
590 uint64 group_id = 6;
591 bool is_primary = 7;
592 bool is_valid = 8;
593 bool is_disk_based = 9;
594
595 enum Severity {
596 None = 0;
597 Error = 1;
598 Warning = 2;
599 Information = 3;
600 Hint = 4;
601 }
602}
603
604message Operation {
605 oneof variant {
606 Edit edit = 1;
607 Undo undo = 2;
608 UpdateSelections update_selections = 3;
609 UpdateDiagnostics update_diagnostics = 4;
610 UpdateCompletionTriggers update_completion_triggers = 5;
611 }
612
613 message Edit {
614 uint32 replica_id = 1;
615 uint32 local_timestamp = 2;
616 uint32 lamport_timestamp = 3;
617 repeated VectorClockEntry version = 4;
618 repeated Range ranges = 5;
619 optional string new_text = 6;
620 }
621
622 message Undo {
623 uint32 replica_id = 1;
624 uint32 local_timestamp = 2;
625 uint32 lamport_timestamp = 3;
626 repeated Range ranges = 4;
627 repeated VectorClockEntry version = 5;
628 repeated UndoCount counts = 6;
629 }
630
631 message UpdateSelections {
632 uint32 replica_id = 1;
633 uint32 lamport_timestamp = 2;
634 repeated Selection selections = 3;
635 }
636
637 message UpdateCompletionTriggers {
638 uint32 replica_id = 1;
639 uint32 lamport_timestamp = 2;
640 repeated string triggers = 3;
641 }
642}
643
644message UndoMapEntry {
645 uint32 replica_id = 1;
646 uint32 local_timestamp = 2;
647 repeated UndoCount counts = 3;
648}
649
650message UndoCount {
651 uint32 replica_id = 1;
652 uint32 local_timestamp = 2;
653 uint32 count = 3;
654}
655
656message VectorClockEntry {
657 uint32 replica_id = 1;
658 uint32 timestamp = 2;
659}
660
661message Timestamp {
662 uint64 seconds = 1;
663 uint32 nanos = 2;
664}
665
666message Range {
667 uint64 start = 1;
668 uint64 end = 2;
669}
670
671message Point {
672 uint32 row = 1;
673 uint32 column = 2;
674}
675
676message Nonce {
677 uint64 upper_half = 1;
678 uint64 lower_half = 2;
679}
680
681message Channel {
682 uint64 id = 1;
683 string name = 2;
684}
685
686message ChannelMessage {
687 uint64 id = 1;
688 string body = 2;
689 uint64 timestamp = 3;
690 uint64 sender_id = 4;
691 Nonce nonce = 5;
692}
693
694message Contact {
695 uint64 user_id = 1;
696 repeated ProjectMetadata projects = 2;
697}
698
699message ProjectMetadata {
700 uint64 id = 1;
701 bool is_shared = 2;
702 repeated string worktree_root_names = 3;
703 repeated uint64 guests = 4;
704}