zed.proto

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