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