zed.proto

   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        RequestJoinProject request_join_project = 11;
  18        RespondToJoinProjectRequest respond_to_join_project_request = 12;
  19        JoinProjectRequestCancelled join_project_request_cancelled = 13;
  20        JoinProject join_project = 14;
  21        JoinProjectResponse join_project_response = 15;
  22        LeaveProject leave_project = 16;
  23        AddProjectCollaborator add_project_collaborator = 17;
  24        RemoveProjectCollaborator remove_project_collaborator = 18;
  25        ProjectUnshared project_unshared = 19;
  26
  27        GetDefinition get_definition = 20;
  28        GetDefinitionResponse get_definition_response = 21;
  29        GetTypeDefinition get_type_definition = 22;
  30        GetTypeDefinitionResponse get_type_definition_response = 23;
  31        GetReferences get_references = 24;
  32        GetReferencesResponse get_references_response = 25;
  33        GetDocumentHighlights get_document_highlights = 26;
  34        GetDocumentHighlightsResponse get_document_highlights_response = 27;
  35        GetProjectSymbols get_project_symbols = 28;
  36        GetProjectSymbolsResponse get_project_symbols_response = 29;
  37        OpenBufferForSymbol open_buffer_for_symbol = 30;
  38        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 31;
  39
  40        UpdateProject update_project = 32;
  41        RegisterProjectActivity register_project_activity = 33;
  42        UpdateWorktree update_worktree = 34;
  43        UpdateWorktreeExtensions update_worktree_extensions = 35;
  44
  45        CreateProjectEntry create_project_entry = 36;
  46        RenameProjectEntry rename_project_entry = 37;
  47        CopyProjectEntry copy_project_entry = 38;
  48        DeleteProjectEntry delete_project_entry = 39;
  49        ProjectEntryResponse project_entry_response = 40;
  50
  51        UpdateDiagnosticSummary update_diagnostic_summary = 41;
  52        StartLanguageServer start_language_server = 42;
  53        UpdateLanguageServer update_language_server = 43;
  54
  55        OpenBufferById open_buffer_by_id = 44;
  56        OpenBufferByPath open_buffer_by_path = 45;
  57        OpenBufferResponse open_buffer_response = 46;
  58        CreateBufferForPeer create_buffer_for_peer = 47;
  59        UpdateBuffer update_buffer = 48;
  60        UpdateBufferFile update_buffer_file = 49;
  61        SaveBuffer save_buffer = 50;
  62        BufferSaved buffer_saved = 51;
  63        BufferReloaded buffer_reloaded = 52;
  64        ReloadBuffers reload_buffers = 53;
  65        ReloadBuffersResponse reload_buffers_response = 54;
  66        FormatBuffers format_buffers = 55;
  67        FormatBuffersResponse format_buffers_response = 56;
  68        GetCompletions get_completions = 57;
  69        GetCompletionsResponse get_completions_response = 58;
  70        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 59;
  71        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 60;
  72        GetCodeActions get_code_actions = 61;
  73        GetCodeActionsResponse get_code_actions_response = 62;
  74        GetHover get_hover = 63;
  75        GetHoverResponse get_hover_response = 64;
  76        ApplyCodeAction apply_code_action = 65;
  77        ApplyCodeActionResponse apply_code_action_response = 66;
  78        PrepareRename prepare_rename = 67;
  79        PrepareRenameResponse prepare_rename_response = 68;
  80        PerformRename perform_rename = 69;
  81        PerformRenameResponse perform_rename_response = 70;
  82        SearchProject search_project = 71;
  83        SearchProjectResponse search_project_response = 72;
  84
  85        GetChannels get_channels = 73;
  86        GetChannelsResponse get_channels_response = 74;
  87        JoinChannel join_channel = 75;
  88        JoinChannelResponse join_channel_response = 76;
  89        LeaveChannel leave_channel = 77;
  90        SendChannelMessage send_channel_message = 78;
  91        SendChannelMessageResponse send_channel_message_response = 79;
  92        ChannelMessageSent channel_message_sent = 80;
  93        GetChannelMessages get_channel_messages = 81;
  94        GetChannelMessagesResponse get_channel_messages_response = 82;
  95
  96        UpdateContacts update_contacts = 83;
  97        UpdateInviteInfo update_invite_info = 84;
  98        ShowContacts show_contacts = 85;
  99
 100        GetUsers get_users = 86;
 101        FuzzySearchUsers fuzzy_search_users = 87;
 102        UsersResponse users_response = 88;
 103        RequestContact request_contact = 89;
 104        RespondToContactRequest respond_to_contact_request = 90;
 105        RemoveContact remove_contact = 91;
 106
 107        Follow follow = 92;
 108        FollowResponse follow_response = 93;
 109        UpdateFollowers update_followers = 94;
 110        Unfollow unfollow = 95;
 111        GetPrivateUserInfo get_private_user_info = 96;
 112        GetPrivateUserInfoResponse get_private_user_info_response = 97;
 113        UpdateDiffBase update_diff_base = 98;
 114    }
 115}
 116
 117// Messages
 118
 119message Ping {}
 120
 121message Ack {}
 122
 123message Error {
 124    string message = 1;
 125}
 126
 127message Test {
 128    uint64 id = 1;
 129}
 130
 131message RegisterProject {
 132    bool online = 1;
 133}
 134
 135message RegisterProjectResponse {
 136    uint64 project_id = 1;
 137}
 138
 139message UnregisterProject {
 140    uint64 project_id = 1;
 141}
 142
 143message UpdateProject {
 144    uint64 project_id = 1;
 145    repeated WorktreeMetadata worktrees = 2;
 146    bool online = 3;
 147}
 148
 149message RegisterProjectActivity {
 150    uint64 project_id = 1;
 151}
 152
 153message RequestJoinProject {
 154    uint64 requester_id = 1;
 155    uint64 project_id = 2;
 156}
 157
 158message RespondToJoinProjectRequest {
 159    uint64 requester_id = 1;
 160    uint64 project_id = 2;
 161    bool allow = 3;
 162}
 163
 164message JoinProjectRequestCancelled {
 165    uint64 requester_id = 1;
 166    uint64 project_id = 2;
 167}
 168
 169message JoinProject {
 170    uint64 project_id = 1;
 171}
 172
 173message JoinProjectResponse {
 174    oneof variant {
 175        Accept accept = 1;
 176        Decline decline = 2;
 177    }
 178
 179    message Accept {
 180        uint32 replica_id = 1;
 181        repeated WorktreeMetadata worktrees = 2;
 182        repeated Collaborator collaborators = 3;
 183        repeated LanguageServer language_servers = 4;        
 184    }
 185    
 186    message Decline {
 187        Reason reason = 1;
 188
 189        enum Reason {
 190            Declined = 0;
 191            Closed = 1;
 192            WentOffline = 2;
 193        }
 194    }
 195}
 196
 197message LeaveProject {
 198    uint64 project_id = 1;
 199}
 200
 201message UpdateWorktree {
 202    uint64 project_id = 1;
 203    uint64 worktree_id = 2;
 204    string root_name = 3;
 205    repeated Entry updated_entries = 4;
 206    repeated uint64 removed_entries = 5;
 207    uint64 scan_id = 6;
 208    bool is_last_update = 7;
 209}
 210
 211message UpdateWorktreeExtensions {
 212    uint64 project_id = 1;
 213    uint64 worktree_id = 2;
 214    repeated string extensions = 3;
 215    repeated uint32 counts = 4;
 216}
 217
 218message CreateProjectEntry {
 219    uint64 project_id = 1;
 220    uint64 worktree_id = 2;
 221    bytes path = 3;
 222    bool is_directory = 4;
 223}
 224
 225message RenameProjectEntry {
 226    uint64 project_id = 1;
 227    uint64 entry_id = 2;
 228    bytes new_path = 3;
 229}
 230
 231message CopyProjectEntry {
 232    uint64 project_id = 1;
 233    uint64 entry_id = 2;
 234    bytes new_path = 3;
 235}
 236
 237message DeleteProjectEntry {
 238    uint64 project_id = 1;
 239    uint64 entry_id = 2;
 240}
 241
 242message ProjectEntryResponse {
 243    Entry entry = 1;
 244    uint64 worktree_scan_id = 2;
 245}
 246
 247message AddProjectCollaborator {
 248    uint64 project_id = 1;
 249    Collaborator collaborator = 2;
 250}
 251
 252message RemoveProjectCollaborator {
 253    uint64 project_id = 1;
 254    uint32 peer_id = 2;
 255}
 256
 257message ProjectUnshared {
 258    uint64 project_id = 1;
 259}
 260
 261message GetDefinition {
 262     uint64 project_id = 1;
 263     uint64 buffer_id = 2;
 264     Anchor position = 3;
 265     repeated VectorClockEntry version = 4;
 266 }
 267
 268message GetDefinitionResponse {
 269    repeated LocationLink links = 1;
 270}
 271
 272message GetTypeDefinition {
 273     uint64 project_id = 1;
 274     uint64 buffer_id = 2;
 275     Anchor position = 3;
 276     repeated VectorClockEntry version = 4;
 277 }
 278
 279message GetTypeDefinitionResponse {
 280    repeated LocationLink links = 1;
 281}
 282
 283message GetReferences {
 284     uint64 project_id = 1;
 285     uint64 buffer_id = 2;
 286     Anchor position = 3;
 287     repeated VectorClockEntry version = 4;
 288 }
 289
 290message GetReferencesResponse {
 291    repeated Location locations = 1;
 292}
 293
 294message GetDocumentHighlights {
 295     uint64 project_id = 1;
 296     uint64 buffer_id = 2;
 297     Anchor position = 3;
 298     repeated VectorClockEntry version = 4;
 299 }
 300
 301message GetDocumentHighlightsResponse {
 302    repeated DocumentHighlight highlights = 1;
 303}
 304
 305message Location {
 306    uint64 buffer_id = 1;
 307    Anchor start = 2;
 308    Anchor end = 3;
 309}
 310
 311message LocationLink {
 312    optional Location origin = 1;
 313    Location target = 2;
 314}
 315
 316message DocumentHighlight {
 317    Kind kind = 1;
 318    Anchor start = 2;
 319    Anchor end = 3;
 320
 321    enum Kind {
 322        Text = 0;
 323        Read = 1;
 324        Write = 2;
 325    }
 326}
 327
 328message GetProjectSymbols {
 329    uint64 project_id = 1;
 330    string query = 2;
 331}
 332
 333message GetProjectSymbolsResponse {
 334    repeated Symbol symbols = 4;
 335}
 336
 337message Symbol {
 338    uint64 source_worktree_id = 1;
 339    uint64 worktree_id = 2;
 340    string language_server_name = 3;
 341    string name = 4;
 342    int32 kind = 5;
 343    string path = 6;
 344    Point start = 7;
 345    Point end = 8;
 346    bytes signature = 9;
 347}
 348
 349message OpenBufferForSymbol {
 350    uint64 project_id = 1;
 351    Symbol symbol = 2;
 352}
 353
 354message OpenBufferForSymbolResponse {
 355    uint64 buffer_id = 1;
 356}
 357
 358message OpenBufferByPath {
 359    uint64 project_id = 1;
 360    uint64 worktree_id = 2;
 361    string path = 3;
 362}
 363
 364message OpenBufferById {
 365    uint64 project_id = 1;
 366    uint64 id = 2;
 367}
 368
 369message OpenBufferResponse {
 370    uint64 buffer_id = 1;
 371}
 372
 373message CreateBufferForPeer {
 374    uint64 project_id = 1;
 375    uint32 peer_id = 2;
 376    oneof variant {
 377        BufferState state = 3;
 378        BufferChunk chunk = 4;
 379    }
 380}
 381
 382message UpdateBuffer {
 383    uint64 project_id = 1;
 384    uint64 buffer_id = 2;
 385    repeated Operation operations = 3;
 386}
 387
 388message UpdateBufferFile {
 389    uint64 project_id = 1;
 390    uint64 buffer_id = 2;
 391    File file = 3;
 392}
 393
 394message SaveBuffer {
 395    uint64 project_id = 1;
 396    uint64 buffer_id = 2;
 397    repeated VectorClockEntry version = 3;
 398}
 399
 400message BufferSaved {
 401    uint64 project_id = 1;
 402    uint64 buffer_id = 2;
 403    repeated VectorClockEntry version = 3;
 404    Timestamp mtime = 4;
 405    string fingerprint = 5;
 406}
 407
 408message BufferReloaded {
 409    uint64 project_id = 1;
 410    uint64 buffer_id = 2;
 411    repeated VectorClockEntry version = 3;
 412    Timestamp mtime = 4;
 413    string fingerprint = 5;
 414    LineEnding line_ending = 6;
 415}
 416
 417message ReloadBuffers {
 418    uint64 project_id = 1;
 419    repeated uint64 buffer_ids = 2;
 420}
 421
 422message ReloadBuffersResponse {
 423    ProjectTransaction transaction = 1;
 424}
 425
 426enum FormatTrigger {
 427    Save = 0;
 428    Manual = 1;
 429}
 430
 431message FormatBuffers {
 432    uint64 project_id = 1;
 433    FormatTrigger trigger = 2;
 434    repeated uint64 buffer_ids = 3;
 435}
 436
 437message FormatBuffersResponse {
 438    ProjectTransaction transaction = 1;
 439}
 440
 441message GetCompletions {
 442    uint64 project_id = 1;
 443    uint64 buffer_id = 2;
 444    Anchor position = 3;
 445    repeated VectorClockEntry version = 4;
 446}
 447
 448message GetCompletionsResponse {
 449    repeated Completion completions = 1;
 450    repeated VectorClockEntry version = 2;
 451}
 452
 453message ApplyCompletionAdditionalEdits {
 454    uint64 project_id = 1;
 455    uint64 buffer_id = 2;
 456    Completion completion = 3;
 457}
 458
 459message ApplyCompletionAdditionalEditsResponse {
 460    Transaction transaction = 1;
 461}
 462
 463message Completion {
 464    Anchor old_start = 1;
 465    Anchor old_end = 2;
 466    string new_text = 3;
 467    bytes lsp_completion = 4;
 468}
 469
 470message GetCodeActions {
 471    uint64 project_id = 1;
 472    uint64 buffer_id = 2;
 473    Anchor start = 3;
 474    Anchor end = 4;
 475    repeated VectorClockEntry version = 5;
 476}
 477
 478message GetCodeActionsResponse {
 479    repeated CodeAction actions = 1;
 480    repeated VectorClockEntry version = 2;
 481}
 482
 483message GetHover {
 484    uint64 project_id = 1;
 485    uint64 buffer_id = 2;
 486    Anchor position = 3;
 487    repeated VectorClockEntry version = 5;
 488}
 489
 490message GetHoverResponse {
 491    optional Anchor start = 1;
 492    optional Anchor end = 2;
 493    repeated HoverBlock contents = 3;
 494}
 495
 496message HoverBlock {
 497    string text = 1;
 498    optional string language = 2;
 499}
 500
 501message ApplyCodeAction {
 502    uint64 project_id = 1;
 503    uint64 buffer_id = 2;
 504    CodeAction action = 3;
 505}
 506
 507message ApplyCodeActionResponse {
 508    ProjectTransaction transaction = 1;
 509}
 510
 511message PrepareRename {
 512    uint64 project_id = 1;
 513    uint64 buffer_id = 2;
 514    Anchor position = 3;
 515    repeated VectorClockEntry version = 4;
 516}
 517
 518message PrepareRenameResponse {
 519    bool can_rename = 1;
 520    Anchor start = 2;
 521    Anchor end = 3;
 522    repeated VectorClockEntry version = 4;
 523}
 524
 525message PerformRename {
 526    uint64 project_id = 1;
 527    uint64 buffer_id = 2;
 528    Anchor position = 3;
 529    string new_name = 4;
 530    repeated VectorClockEntry version = 5;
 531}
 532
 533message PerformRenameResponse {
 534    ProjectTransaction transaction = 2;
 535}
 536
 537message SearchProject {
 538    uint64 project_id = 1;
 539    string query = 2;
 540    bool regex = 3;
 541    bool whole_word = 4;
 542    bool case_sensitive = 5;
 543}
 544
 545message SearchProjectResponse {
 546    repeated Location locations = 1;
 547}
 548
 549message CodeAction {
 550    Anchor start = 1;
 551    Anchor end = 2;
 552    bytes lsp_action = 3;
 553}
 554
 555message ProjectTransaction {
 556    repeated uint64 buffer_ids = 1;
 557    repeated Transaction transactions = 2;
 558}
 559
 560message Transaction {
 561    LocalTimestamp id = 1;
 562    repeated LocalTimestamp edit_ids = 2;
 563    repeated VectorClockEntry start = 3;
 564}
 565
 566message LocalTimestamp {
 567    uint32 replica_id = 1;
 568    uint32 value = 2;
 569}
 570
 571message LanguageServer {
 572    uint64 id = 1;
 573    string name = 2;
 574}
 575
 576message StartLanguageServer {
 577    uint64 project_id = 1;
 578    LanguageServer server = 2;
 579}
 580
 581message UpdateDiagnosticSummary {
 582    uint64 project_id = 1;
 583    uint64 worktree_id = 2;
 584    DiagnosticSummary summary = 3;
 585}
 586
 587message DiagnosticSummary {
 588    string path = 1;
 589    uint64 language_server_id = 2;
 590    uint32 error_count = 3;
 591    uint32 warning_count = 4;
 592}
 593
 594message UpdateLanguageServer {
 595    uint64 project_id = 1;
 596    uint64 language_server_id = 2;
 597    oneof variant {
 598        LspWorkStart work_start = 3;
 599        LspWorkProgress work_progress = 4;
 600        LspWorkEnd work_end = 5;
 601        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 602        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 603    }
 604}
 605
 606message LspWorkStart {
 607    string token = 1;
 608    optional string message = 2;
 609    optional uint32 percentage = 3;
 610}
 611
 612message LspWorkProgress {
 613    string token = 1;
 614    optional string message = 2;
 615    optional uint32 percentage = 3;
 616}
 617
 618message LspWorkEnd {
 619    string token = 1;
 620}
 621
 622message LspDiskBasedDiagnosticsUpdating {}
 623
 624message LspDiskBasedDiagnosticsUpdated {}
 625
 626message GetChannels {}
 627
 628message GetChannelsResponse {
 629    repeated Channel channels = 1;
 630}
 631
 632message JoinChannel {
 633    uint64 channel_id = 1;
 634}
 635
 636message JoinChannelResponse {
 637    repeated ChannelMessage messages = 1;
 638    bool done = 2;
 639}
 640
 641message LeaveChannel {
 642    uint64 channel_id = 1;
 643}
 644
 645message GetUsers {
 646    repeated uint64 user_ids = 1;
 647}
 648
 649message FuzzySearchUsers {
 650    string query = 1;
 651}
 652
 653message UsersResponse {
 654    repeated User users = 1;
 655}
 656
 657message RequestContact {
 658    uint64 responder_id = 1;
 659}
 660
 661message RemoveContact {
 662    uint64 user_id = 1;
 663}
 664
 665message RespondToContactRequest {
 666    uint64 requester_id = 1;
 667    ContactRequestResponse response = 2;
 668}
 669
 670enum ContactRequestResponse {
 671    Accept = 0;
 672    Decline = 1;
 673    Block = 2;
 674    Dismiss = 3;
 675}
 676
 677message SendChannelMessage {
 678    uint64 channel_id = 1;
 679    string body = 2;
 680    Nonce nonce = 3;
 681}
 682
 683message SendChannelMessageResponse {
 684    ChannelMessage message = 1;
 685}
 686
 687message ChannelMessageSent {
 688    uint64 channel_id = 1;
 689    ChannelMessage message = 2;
 690}
 691
 692message GetChannelMessages {
 693    uint64 channel_id = 1;
 694    uint64 before_message_id = 2;
 695}
 696
 697message GetChannelMessagesResponse {
 698    repeated ChannelMessage messages = 1;
 699    bool done = 2;
 700}
 701
 702message UpdateContacts {
 703    repeated Contact contacts = 1;
 704    repeated uint64 remove_contacts = 2;
 705    repeated IncomingContactRequest incoming_requests = 3;
 706    repeated uint64 remove_incoming_requests = 4;
 707    repeated uint64 outgoing_requests = 5;
 708    repeated uint64 remove_outgoing_requests = 6;
 709}
 710
 711message UpdateInviteInfo {
 712    string url = 1;
 713    uint32 count = 2;
 714}
 715
 716message ShowContacts {}
 717
 718message IncomingContactRequest {
 719    uint64 requester_id = 1;
 720    bool should_notify = 2;
 721}
 722
 723message UpdateDiagnostics {
 724    uint32 replica_id = 1;
 725    uint32 lamport_timestamp = 2;
 726    repeated Diagnostic diagnostics = 3;
 727}
 728
 729message Follow {
 730    uint64 project_id = 1;
 731    uint32 leader_id = 2;
 732}
 733
 734message FollowResponse {
 735    optional uint64 active_view_id = 1;
 736    repeated View views = 2;
 737}
 738
 739message UpdateFollowers {
 740    uint64 project_id = 1;
 741    repeated uint32 follower_ids = 2;
 742    oneof variant {
 743        UpdateActiveView update_active_view = 3;
 744        View create_view = 4;
 745        UpdateView update_view = 5;
 746    }
 747}
 748
 749message Unfollow {
 750    uint64 project_id = 1;
 751    uint32 leader_id = 2;
 752}
 753
 754message GetPrivateUserInfo {}
 755
 756message GetPrivateUserInfoResponse {
 757    string metrics_id = 1;
 758    bool staff = 2;
 759}
 760
 761// Entities
 762
 763message UpdateActiveView {
 764    optional uint64 id = 1;
 765    optional uint32 leader_id = 2;
 766}
 767
 768message UpdateView {
 769    uint64 id = 1;
 770    optional uint32 leader_id = 2;
 771
 772    oneof variant {
 773        Editor editor = 3;
 774    }
 775
 776    message Editor {
 777        repeated Selection selections = 1;
 778        Anchor scroll_top_anchor = 2;
 779        float scroll_x = 3;
 780        float scroll_y = 4;
 781    }
 782}
 783
 784message View {
 785    uint64 id = 1;
 786    optional uint32 leader_id = 2;
 787
 788    oneof variant {
 789        Editor editor = 3;
 790    }
 791
 792    message Editor {
 793        uint64 buffer_id = 1;
 794        repeated Selection selections = 2;
 795        Anchor scroll_top_anchor = 3;
 796        float scroll_x = 4;
 797        float scroll_y = 5;
 798    }
 799}
 800
 801message Collaborator {
 802    uint32 peer_id = 1;
 803    uint32 replica_id = 2;
 804    uint64 user_id = 3;
 805}
 806
 807message User {
 808    uint64 id = 1;
 809    string github_login = 2;
 810    string avatar_url = 3;
 811}
 812
 813message File {
 814    uint64 worktree_id = 1;
 815    optional uint64 entry_id = 2;
 816    string path = 3;
 817    Timestamp mtime = 4;
 818}
 819
 820message Entry {
 821    uint64 id = 1;
 822    bool is_dir = 2;
 823    bytes path = 3;
 824    uint64 inode = 4;
 825    Timestamp mtime = 5;
 826    bool is_symlink = 6;
 827    bool is_ignored = 7;
 828}
 829
 830message BufferState {
 831    uint64 id = 1;
 832    optional File file = 2;
 833    string base_text = 3;
 834    optional string diff_base = 4;
 835    LineEnding line_ending = 5;
 836}
 837
 838message BufferChunk {
 839    uint64 buffer_id = 1;
 840    repeated Operation operations = 2;
 841    bool is_last = 3;
 842}
 843
 844enum LineEnding {
 845    Unix = 0;
 846    Windows = 1;
 847}
 848
 849message SelectionSet {
 850    uint32 replica_id = 1;
 851    repeated Selection selections = 2;
 852    uint32 lamport_timestamp = 3;
 853    bool line_mode = 4;
 854}
 855
 856message Selection {
 857    uint64 id = 1;
 858    Anchor start = 2;
 859    Anchor end = 3;
 860    bool reversed = 4;
 861}
 862
 863message Anchor {
 864    uint32 replica_id = 1;
 865    uint32 local_timestamp = 2;
 866    uint64 offset = 3;
 867    Bias bias = 4;
 868    optional uint64 buffer_id = 5;
 869}
 870
 871enum Bias {
 872    Left = 0;
 873    Right = 1;
 874}
 875
 876message Diagnostic {
 877    Anchor start = 1;
 878    Anchor end = 2;
 879    Severity severity = 3;
 880    string message = 4;
 881    optional string code = 5;
 882    uint64 group_id = 6;
 883    bool is_primary = 7;
 884    bool is_valid = 8;
 885    bool is_disk_based = 9;
 886    bool is_unnecessary = 10;
 887
 888    enum Severity {
 889        None = 0;
 890        Error = 1;
 891        Warning = 2;
 892        Information = 3;
 893        Hint = 4;
 894    }
 895}
 896
 897message Operation {
 898    oneof variant {
 899        Edit edit = 1;
 900        Undo undo = 2;
 901        UpdateSelections update_selections = 3;
 902        UpdateDiagnostics update_diagnostics = 4;
 903        UpdateCompletionTriggers update_completion_triggers = 5;
 904    }
 905
 906    message Edit {
 907        uint32 replica_id = 1;
 908        uint32 local_timestamp = 2;
 909        uint32 lamport_timestamp = 3;
 910        repeated VectorClockEntry version = 4;
 911        repeated Range ranges = 5;
 912        repeated string new_text = 6;
 913    }
 914
 915    message Undo {
 916        uint32 replica_id = 1;
 917        uint32 local_timestamp = 2;
 918        uint32 lamport_timestamp = 3;
 919        repeated VectorClockEntry version = 4;
 920        repeated UndoCount counts = 5;
 921    }
 922
 923    message UpdateSelections {
 924        uint32 replica_id = 1;
 925        uint32 lamport_timestamp = 2;
 926        repeated Selection selections = 3;
 927        bool line_mode = 4;
 928    }
 929
 930    message UpdateCompletionTriggers {
 931        uint32 replica_id = 1;
 932        uint32 lamport_timestamp = 2;
 933        repeated string triggers = 3;
 934    }
 935}
 936
 937message UndoMapEntry {
 938    uint32 replica_id = 1;
 939    uint32 local_timestamp = 2;
 940    repeated UndoCount counts = 3;
 941}
 942
 943message UndoCount {
 944    uint32 replica_id = 1;
 945    uint32 local_timestamp = 2;
 946    uint32 count = 3;
 947}
 948
 949message VectorClockEntry {
 950    uint32 replica_id = 1;
 951    uint32 timestamp = 2;
 952}
 953
 954message Timestamp {
 955    uint64 seconds = 1;
 956    uint32 nanos = 2;
 957}
 958
 959message Range {
 960    uint64 start = 1;
 961    uint64 end = 2;
 962}
 963
 964message Point {
 965    uint32 row = 1;
 966    uint32 column = 2;
 967}
 968
 969message Nonce {
 970    uint64 upper_half = 1;
 971    uint64 lower_half = 2;
 972}
 973
 974message Channel {
 975    uint64 id = 1;
 976    string name = 2;
 977}
 978
 979message ChannelMessage {
 980    uint64 id = 1;
 981    string body = 2;
 982    uint64 timestamp = 3;
 983    uint64 sender_id = 4;
 984    Nonce nonce = 5;
 985}
 986
 987message Contact {
 988    uint64 user_id = 1;
 989    repeated ProjectMetadata projects = 2;
 990    bool online = 3;
 991    bool should_notify = 4;
 992}
 993
 994message ProjectMetadata {
 995    uint64 id = 1;
 996    repeated string visible_worktree_root_names = 3;
 997    repeated uint64 guests = 4;
 998}
 999
1000message WorktreeMetadata {
1001    uint64 id = 1;
1002    string root_name = 2;
1003    bool visible = 3;
1004}
1005
1006message UpdateDiffBase {
1007    uint64 project_id = 1;
1008    uint64 buffer_id = 2;
1009    optional string diff_base = 3;
1010}