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}
 637
 638message ApplyCodeAction {
 639    uint64 project_id = 1;
 640    uint64 buffer_id = 2;
 641    CodeAction action = 3;
 642}
 643
 644message ApplyCodeActionResponse {
 645    ProjectTransaction transaction = 1;
 646}
 647
 648message PrepareRename {
 649    uint64 project_id = 1;
 650    uint64 buffer_id = 2;
 651    Anchor position = 3;
 652    repeated VectorClockEntry version = 4;
 653}
 654
 655message PrepareRenameResponse {
 656    bool can_rename = 1;
 657    Anchor start = 2;
 658    Anchor end = 3;
 659    repeated VectorClockEntry version = 4;
 660}
 661
 662message PerformRename {
 663    uint64 project_id = 1;
 664    uint64 buffer_id = 2;
 665    Anchor position = 3;
 666    string new_name = 4;
 667    repeated VectorClockEntry version = 5;
 668}
 669
 670message PerformRenameResponse {
 671    ProjectTransaction transaction = 2;
 672}
 673
 674message SearchProject {
 675    uint64 project_id = 1;
 676    string query = 2;
 677    bool regex = 3;
 678    bool whole_word = 4;
 679    bool case_sensitive = 5;
 680}
 681
 682message SearchProjectResponse {
 683    repeated Location locations = 1;
 684}
 685
 686message CodeAction {
 687    uint64 server_id = 1;
 688    Anchor start = 2;
 689    Anchor end = 3;
 690    bytes lsp_action = 4;
 691}
 692
 693message ProjectTransaction {
 694    repeated uint64 buffer_ids = 1;
 695    repeated Transaction transactions = 2;
 696}
 697
 698message Transaction {
 699    LocalTimestamp id = 1;
 700    repeated LocalTimestamp edit_ids = 2;
 701    repeated VectorClockEntry start = 3;
 702}
 703
 704message LocalTimestamp {
 705    uint32 replica_id = 1;
 706    uint32 value = 2;
 707}
 708
 709message LanguageServer {
 710    uint64 id = 1;
 711    string name = 2;
 712}
 713
 714message StartLanguageServer {
 715    uint64 project_id = 1;
 716    LanguageServer server = 2;
 717}
 718
 719message UpdateDiagnosticSummary {
 720    uint64 project_id = 1;
 721    uint64 worktree_id = 2;
 722    DiagnosticSummary summary = 3;
 723}
 724
 725message DiagnosticSummary {
 726    string path = 1;
 727    uint64 language_server_id = 2;
 728    uint32 error_count = 3;
 729    uint32 warning_count = 4;
 730}
 731
 732message UpdateLanguageServer {
 733    uint64 project_id = 1;
 734    uint64 language_server_id = 2;
 735    oneof variant {
 736        LspWorkStart work_start = 3;
 737        LspWorkProgress work_progress = 4;
 738        LspWorkEnd work_end = 5;
 739        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 740        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 741    }
 742}
 743
 744message LspWorkStart {
 745    string token = 1;
 746    optional string message = 2;
 747    optional uint32 percentage = 3;
 748}
 749
 750message LspWorkProgress {
 751    string token = 1;
 752    optional string message = 2;
 753    optional uint32 percentage = 3;
 754}
 755
 756message LspWorkEnd {
 757    string token = 1;
 758}
 759
 760message LspDiskBasedDiagnosticsUpdating {}
 761
 762message LspDiskBasedDiagnosticsUpdated {}
 763
 764message GetChannels {}
 765
 766message GetChannelsResponse {
 767    repeated Channel channels = 1;
 768}
 769
 770message JoinChannel {
 771    uint64 channel_id = 1;
 772}
 773
 774message JoinChannelResponse {
 775    repeated ChannelMessage messages = 1;
 776    bool done = 2;
 777}
 778
 779message LeaveChannel {
 780    uint64 channel_id = 1;
 781}
 782
 783message GetUsers {
 784    repeated uint64 user_ids = 1;
 785}
 786
 787message FuzzySearchUsers {
 788    string query = 1;
 789}
 790
 791message UsersResponse {
 792    repeated User users = 1;
 793}
 794
 795message RequestContact {
 796    uint64 responder_id = 1;
 797}
 798
 799message RemoveContact {
 800    uint64 user_id = 1;
 801}
 802
 803message RespondToContactRequest {
 804    uint64 requester_id = 1;
 805    ContactRequestResponse response = 2;
 806}
 807
 808enum ContactRequestResponse {
 809    Accept = 0;
 810    Decline = 1;
 811    Block = 2;
 812    Dismiss = 3;
 813}
 814
 815message SendChannelMessage {
 816    uint64 channel_id = 1;
 817    string body = 2;
 818    Nonce nonce = 3;
 819}
 820
 821message SendChannelMessageResponse {
 822    ChannelMessage message = 1;
 823}
 824
 825message ChannelMessageSent {
 826    uint64 channel_id = 1;
 827    ChannelMessage message = 2;
 828}
 829
 830message GetChannelMessages {
 831    uint64 channel_id = 1;
 832    uint64 before_message_id = 2;
 833}
 834
 835message GetChannelMessagesResponse {
 836    repeated ChannelMessage messages = 1;
 837    bool done = 2;
 838}
 839
 840message UpdateContacts {
 841    repeated Contact contacts = 1;
 842    repeated uint64 remove_contacts = 2;
 843    repeated IncomingContactRequest incoming_requests = 3;
 844    repeated uint64 remove_incoming_requests = 4;
 845    repeated uint64 outgoing_requests = 5;
 846    repeated uint64 remove_outgoing_requests = 6;
 847}
 848
 849message UpdateInviteInfo {
 850    string url = 1;
 851    uint32 count = 2;
 852}
 853
 854message ShowContacts {}
 855
 856message IncomingContactRequest {
 857    uint64 requester_id = 1;
 858    bool should_notify = 2;
 859}
 860
 861message UpdateDiagnostics {
 862    uint32 replica_id = 1;
 863    uint32 lamport_timestamp = 2;
 864    uint64 server_id = 3;
 865    repeated Diagnostic diagnostics = 4;
 866}
 867
 868message Follow {
 869    uint64 project_id = 1;
 870    PeerId leader_id = 2;
 871}
 872
 873message FollowResponse {
 874    optional ViewId active_view_id = 1;
 875    repeated View views = 2;
 876}
 877
 878message UpdateFollowers {
 879    uint64 project_id = 1;
 880    repeated PeerId follower_ids = 2;
 881    oneof variant {
 882        UpdateActiveView update_active_view = 3;
 883        View create_view = 4;
 884        UpdateView update_view = 5;
 885    }
 886}
 887
 888message Unfollow {
 889    uint64 project_id = 1;
 890    PeerId leader_id = 2;
 891}
 892
 893message GetPrivateUserInfo {}
 894
 895message GetPrivateUserInfoResponse {
 896    string metrics_id = 1;
 897    bool staff = 2;
 898}
 899
 900// Entities
 901
 902message ViewId {
 903    PeerId creator = 1;
 904    uint64 id = 2;
 905}
 906
 907message UpdateActiveView {
 908    optional ViewId id = 1;
 909    optional PeerId leader_id = 2;
 910}
 911
 912message UpdateView {
 913    ViewId id = 1;
 914    optional PeerId leader_id = 2;
 915
 916    oneof variant {
 917        Editor editor = 3;
 918    }
 919
 920    message Editor {
 921        repeated ExcerptInsertion inserted_excerpts = 1;
 922        repeated uint64 deleted_excerpts = 2;
 923        repeated Selection selections = 3;
 924        optional Selection pending_selection = 4;
 925        EditorAnchor scroll_top_anchor = 5;
 926        float scroll_x = 6;
 927        float scroll_y = 7;
 928    }
 929}
 930
 931message View {
 932    ViewId id = 1;
 933    optional PeerId leader_id = 2;
 934
 935    oneof variant {
 936        Editor editor = 3;
 937    }
 938
 939    message Editor {
 940        bool singleton = 1;
 941        optional string title = 2;
 942        repeated Excerpt excerpts = 3;
 943        repeated Selection selections = 4;
 944        optional Selection pending_selection = 5;
 945        EditorAnchor scroll_top_anchor = 6;
 946        float scroll_x = 7;
 947        float scroll_y = 8;
 948    }
 949}
 950
 951message Collaborator {
 952    PeerId peer_id = 1;
 953    uint32 replica_id = 2;
 954    uint64 user_id = 3;
 955}
 956
 957message User {
 958    uint64 id = 1;
 959    string github_login = 2;
 960    string avatar_url = 3;
 961}
 962
 963message File {
 964    uint64 worktree_id = 1;
 965    uint64 entry_id = 2;
 966    string path = 3;
 967    Timestamp mtime = 4;
 968    bool is_deleted = 5;
 969}
 970
 971message Entry {
 972    uint64 id = 1;
 973    bool is_dir = 2;
 974    string path = 3;
 975    uint64 inode = 4;
 976    Timestamp mtime = 5;
 977    bool is_symlink = 6;
 978    bool is_ignored = 7;
 979}
 980
 981message BufferState {
 982    uint64 id = 1;
 983    optional File file = 2;
 984    string base_text = 3;
 985    optional string diff_base = 4;
 986    LineEnding line_ending = 5;
 987    repeated VectorClockEntry saved_version = 6;
 988    string saved_version_fingerprint = 7;
 989    Timestamp saved_mtime = 8;
 990}
 991
 992message BufferChunk {
 993    uint64 buffer_id = 1;
 994    repeated Operation operations = 2;
 995    bool is_last = 3;
 996}
 997
 998enum LineEnding {
 999    Unix = 0;
1000    Windows = 1;
1001}
1002
1003message Selection {
1004    uint64 id = 1;
1005    EditorAnchor start = 2;
1006    EditorAnchor end = 3;
1007    bool reversed = 4;
1008}
1009
1010message EditorAnchor {
1011    uint64 excerpt_id = 1;
1012    Anchor anchor = 2;
1013}
1014
1015enum CursorShape {
1016    CursorBar = 0;
1017    CursorBlock = 1;
1018    CursorUnderscore = 2;
1019    CursorHollow = 3;
1020}
1021
1022message ExcerptInsertion {
1023    Excerpt excerpt = 1;
1024    optional uint64 previous_excerpt_id = 2;
1025}
1026
1027message Excerpt {
1028    uint64 id = 1;
1029    uint64 buffer_id = 2;
1030    Anchor context_start = 3;
1031    Anchor context_end = 4;
1032    Anchor primary_start = 5;
1033    Anchor primary_end = 6;
1034}
1035
1036message Anchor {
1037    uint32 replica_id = 1;
1038    uint32 local_timestamp = 2;
1039    uint64 offset = 3;
1040    Bias bias = 4;
1041    optional uint64 buffer_id = 5;
1042}
1043
1044enum Bias {
1045    Left = 0;
1046    Right = 1;
1047}
1048
1049message Diagnostic {
1050    Anchor start = 1;
1051    Anchor end = 2;
1052    Severity severity = 3;
1053    string message = 4;
1054    optional string code = 5;
1055    uint64 group_id = 6;
1056    bool is_primary = 7;
1057    bool is_valid = 8;
1058    bool is_disk_based = 9;
1059    bool is_unnecessary = 10;
1060
1061    enum Severity {
1062        None = 0;
1063        Error = 1;
1064        Warning = 2;
1065        Information = 3;
1066        Hint = 4;
1067    }
1068}
1069
1070message Operation {
1071    oneof variant {
1072        Edit edit = 1;
1073        Undo undo = 2;
1074        UpdateSelections update_selections = 3;
1075        UpdateDiagnostics update_diagnostics = 4;
1076        UpdateCompletionTriggers update_completion_triggers = 5;
1077    }
1078
1079    message Edit {
1080        uint32 replica_id = 1;
1081        uint32 local_timestamp = 2;
1082        uint32 lamport_timestamp = 3;
1083        repeated VectorClockEntry version = 4;
1084        repeated Range ranges = 5;
1085        repeated string new_text = 6;
1086    }
1087
1088    message Undo {
1089        uint32 replica_id = 1;
1090        uint32 local_timestamp = 2;
1091        uint32 lamport_timestamp = 3;
1092        repeated VectorClockEntry version = 4;
1093        repeated UndoCount counts = 5;
1094    }
1095
1096    message UpdateSelections {
1097        uint32 replica_id = 1;
1098        uint32 lamport_timestamp = 2;
1099        repeated Selection selections = 3;
1100        bool line_mode = 4;
1101        CursorShape cursor_shape = 5;
1102    }
1103
1104    message UpdateCompletionTriggers {
1105        uint32 replica_id = 1;
1106        uint32 lamport_timestamp = 2;
1107        repeated string triggers = 3;
1108    }
1109}
1110
1111message UndoMapEntry {
1112    uint32 replica_id = 1;
1113    uint32 local_timestamp = 2;
1114    repeated UndoCount counts = 3;
1115}
1116
1117message UndoCount {
1118    uint32 replica_id = 1;
1119    uint32 local_timestamp = 2;
1120    uint32 count = 3;
1121}
1122
1123message VectorClockEntry {
1124    uint32 replica_id = 1;
1125    uint32 timestamp = 2;
1126}
1127
1128message Timestamp {
1129    uint64 seconds = 1;
1130    uint32 nanos = 2;
1131}
1132
1133message Range {
1134    uint64 start = 1;
1135    uint64 end = 2;
1136}
1137
1138message PointUtf16 {
1139    uint32 row = 1;
1140    uint32 column = 2;
1141}
1142
1143message Nonce {
1144    uint64 upper_half = 1;
1145    uint64 lower_half = 2;
1146}
1147
1148message Channel {
1149    uint64 id = 1;
1150    string name = 2;
1151}
1152
1153message ChannelMessage {
1154    uint64 id = 1;
1155    string body = 2;
1156    uint64 timestamp = 3;
1157    uint64 sender_id = 4;
1158    Nonce nonce = 5;
1159}
1160
1161message Contact {
1162    uint64 user_id = 1;
1163    bool online = 2;
1164    bool busy = 3;
1165    bool should_notify = 4;
1166}
1167
1168message WorktreeMetadata {
1169    uint64 id = 1;
1170    string root_name = 2;
1171    bool visible = 3;
1172    string abs_path = 4;
1173}
1174
1175message UpdateDiffBase {
1176    uint64 project_id = 1;
1177    uint64 buffer_id = 2;
1178    optional string diff_base = 3;
1179}