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