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}
 235
 236message ParticipantLocation {
 237    oneof variant {
 238        SharedProject shared_project = 1;
 239        UnsharedProject unshared_project = 2;
 240        External external = 3;
 241    }
 242    
 243    message SharedProject {
 244        uint64 id = 1;
 245    }
 246    
 247    message UnsharedProject {}
 248    
 249    message External {}
 250}
 251
 252message Call {
 253    uint64 room_id = 1;
 254    uint64 called_user_id = 2;
 255    optional uint64 initial_project_id = 3;
 256}
 257
 258message IncomingCall {
 259    uint64 room_id = 1;
 260    uint64 calling_user_id = 2;
 261    repeated uint64 participant_user_ids = 3;
 262    optional ParticipantProject initial_project = 4;
 263}
 264
 265message CallCanceled {
 266    uint64 room_id = 1;
 267}
 268
 269message CancelCall {
 270    uint64 room_id = 1;
 271    uint64 called_user_id = 2;
 272}
 273
 274message DeclineCall {
 275    uint64 room_id = 1;
 276}
 277
 278message UpdateParticipantLocation {
 279    uint64 room_id = 1;
 280    ParticipantLocation location = 2;
 281}
 282
 283message RoomUpdated {
 284    Room room = 1;
 285}
 286
 287message LiveKitConnectionInfo {
 288    string server_url = 1;
 289    string token = 2;
 290}
 291
 292message ShareProject {
 293    uint64 room_id = 1;
 294    repeated WorktreeMetadata worktrees = 2;
 295}
 296
 297message ShareProjectResponse {
 298    uint64 project_id = 1;
 299}
 300
 301message UnshareProject {
 302    uint64 project_id = 1;
 303}
 304
 305message UpdateProject {
 306    uint64 project_id = 1;
 307    repeated WorktreeMetadata worktrees = 2;
 308}
 309
 310message JoinProject {
 311    uint64 project_id = 1;
 312}
 313
 314message JoinProjectResponse {
 315    uint32 replica_id = 1;
 316    repeated WorktreeMetadata worktrees = 2;
 317    repeated Collaborator collaborators = 3;
 318    repeated LanguageServer language_servers = 4;
 319}
 320
 321message LeaveProject {
 322    uint64 project_id = 1;
 323}
 324
 325message UpdateWorktree {
 326    uint64 project_id = 1;
 327    uint64 worktree_id = 2;
 328    string root_name = 3;
 329    repeated Entry updated_entries = 4;
 330    repeated uint64 removed_entries = 5;
 331    uint64 scan_id = 6;
 332    bool is_last_update = 7;
 333    string abs_path = 8;
 334}
 335
 336message CreateProjectEntry {
 337    uint64 project_id = 1;
 338    uint64 worktree_id = 2;
 339    string path = 3;
 340    bool is_directory = 4;
 341}
 342
 343message RenameProjectEntry {
 344    uint64 project_id = 1;
 345    uint64 entry_id = 2;
 346    string new_path = 3;
 347}
 348
 349message CopyProjectEntry {
 350    uint64 project_id = 1;
 351    uint64 entry_id = 2;
 352    string new_path = 3;
 353}
 354
 355message DeleteProjectEntry {
 356    uint64 project_id = 1;
 357    uint64 entry_id = 2;
 358}
 359
 360message ProjectEntryResponse {
 361    Entry entry = 1;
 362    uint64 worktree_scan_id = 2;
 363}
 364
 365message AddProjectCollaborator {
 366    uint64 project_id = 1;
 367    Collaborator collaborator = 2;
 368}
 369
 370message UpdateProjectCollaborator {
 371    uint64 project_id = 1;
 372    PeerId old_peer_id = 2;
 373    PeerId new_peer_id = 3;
 374}
 375
 376message RemoveProjectCollaborator {
 377    uint64 project_id = 1;
 378    PeerId peer_id = 2;
 379}
 380
 381message GetDefinition {
 382     uint64 project_id = 1;
 383     uint64 buffer_id = 2;
 384     Anchor position = 3;
 385     repeated VectorClockEntry version = 4;
 386 }
 387
 388message GetDefinitionResponse {
 389    repeated LocationLink links = 1;
 390}
 391
 392message GetTypeDefinition {
 393     uint64 project_id = 1;
 394     uint64 buffer_id = 2;
 395     Anchor position = 3;
 396     repeated VectorClockEntry version = 4;
 397 }
 398
 399message GetTypeDefinitionResponse {
 400    repeated LocationLink links = 1;
 401}
 402
 403message GetReferences {
 404     uint64 project_id = 1;
 405     uint64 buffer_id = 2;
 406     Anchor position = 3;
 407     repeated VectorClockEntry version = 4;
 408 }
 409
 410message GetReferencesResponse {
 411    repeated Location locations = 1;
 412}
 413
 414message GetDocumentHighlights {
 415     uint64 project_id = 1;
 416     uint64 buffer_id = 2;
 417     Anchor position = 3;
 418     repeated VectorClockEntry version = 4;
 419 }
 420
 421message GetDocumentHighlightsResponse {
 422    repeated DocumentHighlight highlights = 1;
 423}
 424
 425message Location {
 426    uint64 buffer_id = 1;
 427    Anchor start = 2;
 428    Anchor end = 3;
 429}
 430
 431message LocationLink {
 432    optional Location origin = 1;
 433    Location target = 2;
 434}
 435
 436message DocumentHighlight {
 437    Kind kind = 1;
 438    Anchor start = 2;
 439    Anchor end = 3;
 440
 441    enum Kind {
 442        Text = 0;
 443        Read = 1;
 444        Write = 2;
 445    }
 446}
 447
 448message GetProjectSymbols {
 449    uint64 project_id = 1;
 450    string query = 2;
 451}
 452
 453message GetProjectSymbolsResponse {
 454    repeated Symbol symbols = 4;
 455}
 456
 457message Symbol {
 458    uint64 source_worktree_id = 1;
 459    uint64 worktree_id = 2;
 460    string language_server_name = 3;
 461    string name = 4;
 462    int32 kind = 5;
 463    string path = 6;
 464    // Cannot use generate anchors for unopend files,
 465    // so we are forced to use point coords instead
 466    PointUtf16 start = 7;
 467    PointUtf16 end = 8;
 468    bytes signature = 9;
 469}
 470
 471message OpenBufferForSymbol {
 472    uint64 project_id = 1;
 473    Symbol symbol = 2;
 474}
 475
 476message OpenBufferForSymbolResponse {
 477    uint64 buffer_id = 1;
 478}
 479
 480message OpenBufferByPath {
 481    uint64 project_id = 1;
 482    uint64 worktree_id = 2;
 483    string path = 3;
 484}
 485
 486message OpenBufferById {
 487    uint64 project_id = 1;
 488    uint64 id = 2;
 489}
 490
 491message OpenBufferResponse {
 492    uint64 buffer_id = 1;
 493}
 494
 495message CreateBufferForPeer {
 496    uint64 project_id = 1;
 497    PeerId peer_id = 2;
 498    oneof variant {
 499        BufferState state = 3;
 500        BufferChunk chunk = 4;
 501    }
 502}
 503
 504message UpdateBuffer {
 505    uint64 project_id = 1;
 506    uint64 buffer_id = 2;
 507    repeated Operation operations = 3;
 508}
 509
 510message UpdateBufferFile {
 511    uint64 project_id = 1;
 512    uint64 buffer_id = 2;
 513    File file = 3;
 514}
 515
 516message SaveBuffer {
 517    uint64 project_id = 1;
 518    uint64 buffer_id = 2;
 519    repeated VectorClockEntry version = 3;
 520}
 521
 522message BufferSaved {
 523    uint64 project_id = 1;
 524    uint64 buffer_id = 2;
 525    repeated VectorClockEntry version = 3;
 526    Timestamp mtime = 4;
 527    string fingerprint = 5;
 528}
 529
 530message BufferReloaded {
 531    uint64 project_id = 1;
 532    uint64 buffer_id = 2;
 533    repeated VectorClockEntry version = 3;
 534    Timestamp mtime = 4;
 535    string fingerprint = 5;
 536    LineEnding line_ending = 6;
 537}
 538
 539message ReloadBuffers {
 540    uint64 project_id = 1;
 541    repeated uint64 buffer_ids = 2;
 542}
 543
 544message ReloadBuffersResponse {
 545    ProjectTransaction transaction = 1;
 546}
 547
 548message SynchronizeBuffers {
 549    uint64 project_id = 1;
 550    repeated BufferVersion buffers = 2;
 551}
 552
 553message SynchronizeBuffersResponse {
 554    repeated BufferVersion buffers = 1;
 555}
 556
 557message BufferVersion {
 558    uint64 id = 1;
 559    repeated VectorClockEntry version = 2;
 560}
 561
 562enum FormatTrigger {
 563    Save = 0;
 564    Manual = 1;
 565}
 566
 567message FormatBuffers {
 568    uint64 project_id = 1;
 569    FormatTrigger trigger = 2;
 570    repeated uint64 buffer_ids = 3;
 571}
 572
 573message FormatBuffersResponse {
 574    ProjectTransaction transaction = 1;
 575}
 576
 577message GetCompletions {
 578    uint64 project_id = 1;
 579    uint64 buffer_id = 2;
 580    Anchor position = 3;
 581    repeated VectorClockEntry version = 4;
 582}
 583
 584message GetCompletionsResponse {
 585    repeated Completion completions = 1;
 586    repeated VectorClockEntry version = 2;
 587}
 588
 589message ApplyCompletionAdditionalEdits {
 590    uint64 project_id = 1;
 591    uint64 buffer_id = 2;
 592    Completion completion = 3;
 593}
 594
 595message ApplyCompletionAdditionalEditsResponse {
 596    Transaction transaction = 1;
 597}
 598
 599message Completion {
 600    Anchor old_start = 1;
 601    Anchor old_end = 2;
 602    string new_text = 3;
 603    bytes lsp_completion = 4;
 604}
 605
 606message GetCodeActions {
 607    uint64 project_id = 1;
 608    uint64 buffer_id = 2;
 609    Anchor start = 3;
 610    Anchor end = 4;
 611    repeated VectorClockEntry version = 5;
 612}
 613
 614message GetCodeActionsResponse {
 615    repeated CodeAction actions = 1;
 616    repeated VectorClockEntry version = 2;
 617}
 618
 619message GetHover {
 620    uint64 project_id = 1;
 621    uint64 buffer_id = 2;
 622    Anchor position = 3;
 623    repeated VectorClockEntry version = 5;
 624}
 625
 626message GetHoverResponse {
 627    optional Anchor start = 1;
 628    optional Anchor end = 2;
 629    repeated HoverBlock contents = 3;
 630}
 631
 632message HoverBlock {
 633    string text = 1;
 634    optional string language = 2;
 635}
 636
 637message ApplyCodeAction {
 638    uint64 project_id = 1;
 639    uint64 buffer_id = 2;
 640    CodeAction action = 3;
 641}
 642
 643message ApplyCodeActionResponse {
 644    ProjectTransaction transaction = 1;
 645}
 646
 647message PrepareRename {
 648    uint64 project_id = 1;
 649    uint64 buffer_id = 2;
 650    Anchor position = 3;
 651    repeated VectorClockEntry version = 4;
 652}
 653
 654message PrepareRenameResponse {
 655    bool can_rename = 1;
 656    Anchor start = 2;
 657    Anchor end = 3;
 658    repeated VectorClockEntry version = 4;
 659}
 660
 661message PerformRename {
 662    uint64 project_id = 1;
 663    uint64 buffer_id = 2;
 664    Anchor position = 3;
 665    string new_name = 4;
 666    repeated VectorClockEntry version = 5;
 667}
 668
 669message PerformRenameResponse {
 670    ProjectTransaction transaction = 2;
 671}
 672
 673message SearchProject {
 674    uint64 project_id = 1;
 675    string query = 2;
 676    bool regex = 3;
 677    bool whole_word = 4;
 678    bool case_sensitive = 5;
 679}
 680
 681message SearchProjectResponse {
 682    repeated Location locations = 1;
 683}
 684
 685message CodeAction {
 686    Anchor start = 1;
 687    Anchor end = 2;
 688    bytes lsp_action = 3;
 689}
 690
 691message ProjectTransaction {
 692    repeated uint64 buffer_ids = 1;
 693    repeated Transaction transactions = 2;
 694}
 695
 696message Transaction {
 697    LocalTimestamp id = 1;
 698    repeated LocalTimestamp edit_ids = 2;
 699    repeated VectorClockEntry start = 3;
 700}
 701
 702message LocalTimestamp {
 703    uint32 replica_id = 1;
 704    uint32 value = 2;
 705}
 706
 707message LanguageServer {
 708    uint64 id = 1;
 709    string name = 2;
 710}
 711
 712message StartLanguageServer {
 713    uint64 project_id = 1;
 714    LanguageServer server = 2;
 715}
 716
 717message UpdateDiagnosticSummary {
 718    uint64 project_id = 1;
 719    uint64 worktree_id = 2;
 720    DiagnosticSummary summary = 3;
 721}
 722
 723message DiagnosticSummary {
 724    string path = 1;
 725    uint64 language_server_id = 2;
 726    uint32 error_count = 3;
 727    uint32 warning_count = 4;
 728}
 729
 730message UpdateLanguageServer {
 731    uint64 project_id = 1;
 732    uint64 language_server_id = 2;
 733    oneof variant {
 734        LspWorkStart work_start = 3;
 735        LspWorkProgress work_progress = 4;
 736        LspWorkEnd work_end = 5;
 737        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 738        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 739    }
 740}
 741
 742message LspWorkStart {
 743    string token = 1;
 744    optional string message = 2;
 745    optional uint32 percentage = 3;
 746}
 747
 748message LspWorkProgress {
 749    string token = 1;
 750    optional string message = 2;
 751    optional uint32 percentage = 3;
 752}
 753
 754message LspWorkEnd {
 755    string token = 1;
 756}
 757
 758message LspDiskBasedDiagnosticsUpdating {}
 759
 760message LspDiskBasedDiagnosticsUpdated {}
 761
 762message GetChannels {}
 763
 764message GetChannelsResponse {
 765    repeated Channel channels = 1;
 766}
 767
 768message JoinChannel {
 769    uint64 channel_id = 1;
 770}
 771
 772message JoinChannelResponse {
 773    repeated ChannelMessage messages = 1;
 774    bool done = 2;
 775}
 776
 777message LeaveChannel {
 778    uint64 channel_id = 1;
 779}
 780
 781message GetUsers {
 782    repeated uint64 user_ids = 1;
 783}
 784
 785message FuzzySearchUsers {
 786    string query = 1;
 787}
 788
 789message UsersResponse {
 790    repeated User users = 1;
 791}
 792
 793message RequestContact {
 794    uint64 responder_id = 1;
 795}
 796
 797message RemoveContact {
 798    uint64 user_id = 1;
 799}
 800
 801message RespondToContactRequest {
 802    uint64 requester_id = 1;
 803    ContactRequestResponse response = 2;
 804}
 805
 806enum ContactRequestResponse {
 807    Accept = 0;
 808    Decline = 1;
 809    Block = 2;
 810    Dismiss = 3;
 811}
 812
 813message SendChannelMessage {
 814    uint64 channel_id = 1;
 815    string body = 2;
 816    Nonce nonce = 3;
 817}
 818
 819message SendChannelMessageResponse {
 820    ChannelMessage message = 1;
 821}
 822
 823message ChannelMessageSent {
 824    uint64 channel_id = 1;
 825    ChannelMessage message = 2;
 826}
 827
 828message GetChannelMessages {
 829    uint64 channel_id = 1;
 830    uint64 before_message_id = 2;
 831}
 832
 833message GetChannelMessagesResponse {
 834    repeated ChannelMessage messages = 1;
 835    bool done = 2;
 836}
 837
 838message UpdateContacts {
 839    repeated Contact contacts = 1;
 840    repeated uint64 remove_contacts = 2;
 841    repeated IncomingContactRequest incoming_requests = 3;
 842    repeated uint64 remove_incoming_requests = 4;
 843    repeated uint64 outgoing_requests = 5;
 844    repeated uint64 remove_outgoing_requests = 6;
 845}
 846
 847message UpdateInviteInfo {
 848    string url = 1;
 849    uint32 count = 2;
 850}
 851
 852message ShowContacts {}
 853
 854message IncomingContactRequest {
 855    uint64 requester_id = 1;
 856    bool should_notify = 2;
 857}
 858
 859message UpdateDiagnostics {
 860    uint32 replica_id = 1;
 861    uint32 lamport_timestamp = 2;
 862    repeated Diagnostic diagnostics = 3;
 863}
 864
 865message Follow {
 866    uint64 project_id = 1;
 867    PeerId leader_id = 2;
 868}
 869
 870message FollowResponse {
 871    optional ViewId active_view_id = 1;
 872    repeated View views = 2;
 873}
 874
 875message UpdateFollowers {
 876    uint64 project_id = 1;
 877    repeated PeerId follower_ids = 2;
 878    oneof variant {
 879        UpdateActiveView update_active_view = 3;
 880        View create_view = 4;
 881        UpdateView update_view = 5;
 882    }
 883}
 884
 885message Unfollow {
 886    uint64 project_id = 1;
 887    PeerId leader_id = 2;
 888}
 889
 890message GetPrivateUserInfo {}
 891
 892message GetPrivateUserInfoResponse {
 893    string metrics_id = 1;
 894    bool staff = 2;
 895}
 896
 897// Entities
 898
 899message ViewId {
 900    PeerId creator = 1;
 901    uint64 id = 2;
 902}
 903
 904message UpdateActiveView {
 905    optional ViewId id = 1;
 906    optional PeerId leader_id = 2;
 907}
 908
 909message UpdateView {
 910    ViewId id = 1;
 911    optional PeerId leader_id = 2;
 912
 913    oneof variant {
 914        Editor editor = 3;
 915    }
 916
 917    message Editor {
 918        repeated ExcerptInsertion inserted_excerpts = 1;
 919        repeated uint64 deleted_excerpts = 2;
 920        repeated Selection selections = 3;
 921        optional Selection pending_selection = 4;
 922        EditorAnchor scroll_top_anchor = 5;
 923        float scroll_x = 6;
 924        float scroll_y = 7;
 925    }
 926}
 927
 928message View {
 929    ViewId id = 1;
 930    optional PeerId leader_id = 2;
 931
 932    oneof variant {
 933        Editor editor = 3;
 934    }
 935
 936    message Editor {
 937        bool singleton = 1;
 938        optional string title = 2;
 939        repeated Excerpt excerpts = 3;
 940        repeated Selection selections = 4;
 941        optional Selection pending_selection = 5;
 942        EditorAnchor scroll_top_anchor = 6;
 943        float scroll_x = 7;
 944        float scroll_y = 8;
 945    }
 946}
 947
 948message Collaborator {
 949    PeerId peer_id = 1;
 950    uint32 replica_id = 2;
 951    uint64 user_id = 3;
 952}
 953
 954message User {
 955    uint64 id = 1;
 956    string github_login = 2;
 957    string avatar_url = 3;
 958}
 959
 960message File {
 961    uint64 worktree_id = 1;
 962    uint64 entry_id = 2;
 963    string path = 3;
 964    Timestamp mtime = 4;
 965    bool is_deleted = 5;
 966}
 967
 968message Entry {
 969    uint64 id = 1;
 970    bool is_dir = 2;
 971    string path = 3;
 972    uint64 inode = 4;
 973    Timestamp mtime = 5;
 974    bool is_symlink = 6;
 975    bool is_ignored = 7;
 976}
 977
 978message BufferState {
 979    uint64 id = 1;
 980    optional File file = 2;
 981    string base_text = 3;
 982    optional string diff_base = 4;
 983    LineEnding line_ending = 5;
 984    repeated VectorClockEntry saved_version = 6;
 985    string saved_version_fingerprint = 7;
 986    Timestamp saved_mtime = 8;
 987}
 988
 989message BufferChunk {
 990    uint64 buffer_id = 1;
 991    repeated Operation operations = 2;
 992    bool is_last = 3;
 993}
 994
 995enum LineEnding {
 996    Unix = 0;
 997    Windows = 1;
 998}
 999
1000message Selection {
1001    uint64 id = 1;
1002    EditorAnchor start = 2;
1003    EditorAnchor end = 3;
1004    bool reversed = 4;
1005}
1006
1007message EditorAnchor {
1008    uint64 excerpt_id = 1;
1009    Anchor anchor = 2;
1010}
1011
1012enum CursorShape {
1013    CursorBar = 0;
1014    CursorBlock = 1;
1015    CursorUnderscore = 2;
1016    CursorHollow = 3;
1017}
1018
1019message ExcerptInsertion {
1020    Excerpt excerpt = 1;
1021    optional uint64 previous_excerpt_id = 2;
1022}
1023
1024message Excerpt {
1025    uint64 id = 1;
1026    uint64 buffer_id = 2;
1027    Anchor context_start = 3;
1028    Anchor context_end = 4;
1029    Anchor primary_start = 5;
1030    Anchor primary_end = 6;
1031}
1032
1033message Anchor {
1034    uint32 replica_id = 1;
1035    uint32 local_timestamp = 2;
1036    uint64 offset = 3;
1037    Bias bias = 4;
1038    optional uint64 buffer_id = 5;
1039}
1040
1041enum Bias {
1042    Left = 0;
1043    Right = 1;
1044}
1045
1046message Diagnostic {
1047    Anchor start = 1;
1048    Anchor end = 2;
1049    Severity severity = 3;
1050    string message = 4;
1051    optional string code = 5;
1052    uint64 group_id = 6;
1053    bool is_primary = 7;
1054    bool is_valid = 8;
1055    bool is_disk_based = 9;
1056    bool is_unnecessary = 10;
1057
1058    enum Severity {
1059        None = 0;
1060        Error = 1;
1061        Warning = 2;
1062        Information = 3;
1063        Hint = 4;
1064    }
1065}
1066
1067message Operation {
1068    oneof variant {
1069        Edit edit = 1;
1070        Undo undo = 2;
1071        UpdateSelections update_selections = 3;
1072        UpdateDiagnostics update_diagnostics = 4;
1073        UpdateCompletionTriggers update_completion_triggers = 5;
1074    }
1075
1076    message Edit {
1077        uint32 replica_id = 1;
1078        uint32 local_timestamp = 2;
1079        uint32 lamport_timestamp = 3;
1080        repeated VectorClockEntry version = 4;
1081        repeated Range ranges = 5;
1082        repeated string new_text = 6;
1083    }
1084
1085    message Undo {
1086        uint32 replica_id = 1;
1087        uint32 local_timestamp = 2;
1088        uint32 lamport_timestamp = 3;
1089        repeated VectorClockEntry version = 4;
1090        repeated UndoCount counts = 5;
1091    }
1092
1093    message UpdateSelections {
1094        uint32 replica_id = 1;
1095        uint32 lamport_timestamp = 2;
1096        repeated Selection selections = 3;
1097        bool line_mode = 4;
1098        CursorShape cursor_shape = 5;
1099    }
1100
1101    message UpdateCompletionTriggers {
1102        uint32 replica_id = 1;
1103        uint32 lamport_timestamp = 2;
1104        repeated string triggers = 3;
1105    }
1106}
1107
1108message UndoMapEntry {
1109    uint32 replica_id = 1;
1110    uint32 local_timestamp = 2;
1111    repeated UndoCount counts = 3;
1112}
1113
1114message UndoCount {
1115    uint32 replica_id = 1;
1116    uint32 local_timestamp = 2;
1117    uint32 count = 3;
1118}
1119
1120message VectorClockEntry {
1121    uint32 replica_id = 1;
1122    uint32 timestamp = 2;
1123}
1124
1125message Timestamp {
1126    uint64 seconds = 1;
1127    uint32 nanos = 2;
1128}
1129
1130message Range {
1131    uint64 start = 1;
1132    uint64 end = 2;
1133}
1134
1135message PointUtf16 {
1136    uint32 row = 1;
1137    uint32 column = 2;
1138}
1139
1140message Nonce {
1141    uint64 upper_half = 1;
1142    uint64 lower_half = 2;
1143}
1144
1145message Channel {
1146    uint64 id = 1;
1147    string name = 2;
1148}
1149
1150message ChannelMessage {
1151    uint64 id = 1;
1152    string body = 2;
1153    uint64 timestamp = 3;
1154    uint64 sender_id = 4;
1155    Nonce nonce = 5;
1156}
1157
1158message Contact {
1159    uint64 user_id = 1;
1160    bool online = 2;
1161    bool busy = 3;
1162    bool should_notify = 4;
1163}
1164
1165message WorktreeMetadata {
1166    uint64 id = 1;
1167    string root_name = 2;
1168    bool visible = 3;
1169    string abs_path = 4;
1170}
1171
1172message UpdateDiffBase {
1173    uint64 project_id = 1;
1174    uint64 buffer_id = 2;
1175    optional string diff_base = 3;
1176}