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