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