zed.proto

   1syntax = "proto3";
   2package zed.messages;
   3
   4// Looking for a number? Search "// Current max"
   5
   6message PeerId {
   7    uint32 owner_id = 1;
   8    uint32 id = 2;
   9}
  10
  11message Envelope {
  12    uint32 id = 1;
  13    optional uint32 responding_to = 2;
  14    optional PeerId original_sender_id = 3;
  15    oneof payload {
  16        Hello hello = 4;
  17        Ack ack = 5;
  18        Error error = 6;
  19        Ping ping = 7;
  20        Test test = 8;
  21
  22        CreateRoom create_room = 9;
  23        CreateRoomResponse create_room_response = 10;
  24        JoinRoom join_room = 11;
  25        JoinRoomResponse join_room_response = 12;
  26        RejoinRoom rejoin_room = 13;
  27        RejoinRoomResponse rejoin_room_response = 14;
  28        LeaveRoom leave_room = 15;
  29        Call call = 16;
  30        IncomingCall incoming_call = 17;
  31        CallCanceled call_canceled = 18;
  32        CancelCall cancel_call = 19;
  33        DeclineCall decline_call = 20;
  34        UpdateParticipantLocation update_participant_location = 21;
  35        RoomUpdated room_updated = 22;
  36
  37        ShareProject share_project = 23;
  38        ShareProjectResponse share_project_response = 24;
  39        UnshareProject unshare_project = 25;
  40        JoinProject join_project = 26;
  41        JoinProjectResponse join_project_response = 27;
  42        LeaveProject leave_project = 28;
  43        AddProjectCollaborator add_project_collaborator = 29;
  44        UpdateProjectCollaborator update_project_collaborator = 30;
  45        RemoveProjectCollaborator remove_project_collaborator = 31;
  46
  47        GetDefinition get_definition = 32;
  48        GetDefinitionResponse get_definition_response = 33;
  49        GetTypeDefinition get_type_definition = 34;
  50        GetTypeDefinitionResponse get_type_definition_response = 35;
  51        GetReferences get_references = 36;
  52        GetReferencesResponse get_references_response = 37;
  53        GetDocumentHighlights get_document_highlights = 38;
  54        GetDocumentHighlightsResponse get_document_highlights_response = 39;
  55        GetProjectSymbols get_project_symbols = 40;
  56        GetProjectSymbolsResponse get_project_symbols_response = 41;
  57        OpenBufferForSymbol open_buffer_for_symbol = 42;
  58        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 43;
  59
  60        UpdateProject update_project = 44;
  61        UpdateWorktree update_worktree = 45;
  62
  63        CreateProjectEntry create_project_entry = 46;
  64        RenameProjectEntry rename_project_entry = 47;
  65        CopyProjectEntry copy_project_entry = 48;
  66        DeleteProjectEntry delete_project_entry = 49;
  67        ProjectEntryResponse project_entry_response = 50;
  68        ExpandProjectEntry expand_project_entry = 51;
  69        ExpandProjectEntryResponse expand_project_entry_response = 52;
  70
  71        UpdateDiagnosticSummary update_diagnostic_summary = 53;
  72        StartLanguageServer start_language_server = 54;
  73        UpdateLanguageServer update_language_server = 55;
  74
  75        OpenBufferById open_buffer_by_id = 56;
  76        OpenBufferByPath open_buffer_by_path = 57;
  77        OpenBufferResponse open_buffer_response = 58;
  78        CreateBufferForPeer create_buffer_for_peer = 59;
  79        UpdateBuffer update_buffer = 60;
  80        UpdateBufferFile update_buffer_file = 61;
  81        SaveBuffer save_buffer = 62;
  82        BufferSaved buffer_saved = 63;
  83        BufferReloaded buffer_reloaded = 64;
  84        ReloadBuffers reload_buffers = 65;
  85        ReloadBuffersResponse reload_buffers_response = 66;
  86        SynchronizeBuffers synchronize_buffers = 67;
  87        SynchronizeBuffersResponse synchronize_buffers_response = 68;
  88        FormatBuffers format_buffers = 69;
  89        FormatBuffersResponse format_buffers_response = 70;
  90        GetCompletions get_completions = 71;
  91        GetCompletionsResponse get_completions_response = 72;
  92        ResolveCompletionDocumentation resolve_completion_documentation = 73;
  93        ResolveCompletionDocumentationResponse resolve_completion_documentation_response = 74;
  94        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 75;
  95        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 76;
  96        GetCodeActions get_code_actions = 77;
  97        GetCodeActionsResponse get_code_actions_response = 78;
  98        GetHover get_hover = 79;
  99        GetHoverResponse get_hover_response = 80;
 100        ApplyCodeAction apply_code_action = 81;
 101        ApplyCodeActionResponse apply_code_action_response = 82;
 102        PrepareRename prepare_rename = 83;
 103        PrepareRenameResponse prepare_rename_response = 84;
 104        PerformRename perform_rename = 85;
 105        PerformRenameResponse perform_rename_response = 86;
 106        SearchProject search_project = 87;
 107        SearchProjectResponse search_project_response = 88;
 108
 109        UpdateContacts update_contacts = 89;
 110        UpdateInviteInfo update_invite_info = 90;
 111        ShowContacts show_contacts = 91;
 112
 113        GetUsers get_users = 92;
 114        FuzzySearchUsers fuzzy_search_users = 93;
 115        UsersResponse users_response = 94;
 116        RequestContact request_contact = 95;
 117        RespondToContactRequest respond_to_contact_request = 96;
 118        RemoveContact remove_contact = 97;
 119
 120        Follow follow = 98;
 121        FollowResponse follow_response = 99;
 122        UpdateFollowers update_followers = 100;
 123        Unfollow unfollow = 101;
 124        GetPrivateUserInfo get_private_user_info = 102;
 125        GetPrivateUserInfoResponse get_private_user_info_response = 103;
 126        UpdateDiffBase update_diff_base = 104;
 127
 128        OnTypeFormatting on_type_formatting = 105;
 129        OnTypeFormattingResponse on_type_formatting_response = 106;
 130
 131        UpdateWorktreeSettings update_worktree_settings = 107;
 132
 133        InlayHints inlay_hints = 108;
 134        InlayHintsResponse inlay_hints_response = 109;
 135        ResolveInlayHint resolve_inlay_hint = 110;
 136        ResolveInlayHintResponse resolve_inlay_hint_response = 111;
 137        RefreshInlayHints refresh_inlay_hints = 112;
 138
 139        CreateChannel create_channel = 113;
 140        CreateChannelResponse create_channel_response = 114;
 141        InviteChannelMember invite_channel_member = 115;
 142        RemoveChannelMember remove_channel_member = 116;
 143        RespondToChannelInvite respond_to_channel_invite = 117;
 144        UpdateChannels update_channels = 118;
 145        JoinChannel join_channel = 119;
 146        DeleteChannel delete_channel = 120;
 147        GetChannelMembers get_channel_members = 121;
 148        GetChannelMembersResponse get_channel_members_response = 122;
 149        SetChannelMemberRole set_channel_member_role = 123;
 150        RenameChannel rename_channel = 124;
 151        RenameChannelResponse rename_channel_response = 125;
 152
 153        JoinChannelBuffer join_channel_buffer = 126;
 154        JoinChannelBufferResponse join_channel_buffer_response = 127;
 155        UpdateChannelBuffer update_channel_buffer = 128;
 156        LeaveChannelBuffer leave_channel_buffer = 129;
 157        UpdateChannelBufferCollaborators update_channel_buffer_collaborators = 130;
 158        RejoinChannelBuffers rejoin_channel_buffers = 131;
 159        RejoinChannelBuffersResponse rejoin_channel_buffers_response = 132;
 160        AckBufferOperation ack_buffer_operation = 145;
 161
 162        JoinChannelChat join_channel_chat = 133;
 163        JoinChannelChatResponse join_channel_chat_response = 134;
 164        LeaveChannelChat leave_channel_chat = 135;
 165        SendChannelMessage send_channel_message = 136;
 166        SendChannelMessageResponse send_channel_message_response = 137;
 167        ChannelMessageSent channel_message_sent = 138;
 168        GetChannelMessages get_channel_messages = 139;
 169        GetChannelMessagesResponse get_channel_messages_response = 140;
 170        RemoveChannelMessage remove_channel_message = 141;
 171        AckChannelMessage ack_channel_message = 146;
 172
 173        LinkChannel link_channel = 142;
 174        UnlinkChannel unlink_channel = 143;
 175        MoveChannel move_channel = 144;
 176        SetChannelVisibility set_channel_visibility = 147; // current max: 147
 177    }
 178}
 179
 180// Messages
 181
 182message Hello {
 183    PeerId peer_id = 1;
 184}
 185
 186message Ping {}
 187
 188message Ack {}
 189
 190message Error {
 191    string message = 1;
 192}
 193
 194message Test {
 195    uint64 id = 1;
 196}
 197
 198message CreateRoom {}
 199
 200message CreateRoomResponse {
 201    Room room = 1;
 202    optional LiveKitConnectionInfo live_kit_connection_info = 2;
 203}
 204
 205message JoinRoom {
 206    uint64 id = 1;
 207}
 208
 209message JoinRoomResponse {
 210    Room room = 1;
 211    optional uint64 channel_id = 2;
 212    optional LiveKitConnectionInfo live_kit_connection_info = 3;
 213}
 214
 215message RejoinRoom {
 216    uint64 id = 1;
 217    repeated UpdateProject reshared_projects = 2;
 218    repeated RejoinProject rejoined_projects = 3;
 219}
 220
 221message RejoinProject {
 222    uint64 id = 1;
 223    repeated RejoinWorktree worktrees = 2;
 224}
 225
 226message RejoinWorktree {
 227    uint64 id = 1;
 228    uint64 scan_id = 2;
 229}
 230
 231message RejoinRoomResponse {
 232    Room room = 1;
 233    repeated ResharedProject reshared_projects = 2;
 234    repeated RejoinedProject rejoined_projects = 3;
 235}
 236
 237message ResharedProject {
 238    uint64 id = 1;
 239    repeated Collaborator collaborators = 2;
 240}
 241
 242message RejoinedProject {
 243    uint64 id = 1;
 244    repeated WorktreeMetadata worktrees = 2;
 245    repeated Collaborator collaborators = 3;
 246    repeated LanguageServer language_servers = 4;
 247}
 248
 249message LeaveRoom {}
 250
 251message Room {
 252    uint64 id = 1;
 253    repeated Participant participants = 2;
 254    repeated PendingParticipant pending_participants = 3;
 255    repeated Follower followers = 4;
 256    string live_kit_room = 5;
 257}
 258
 259message Participant {
 260    uint64 user_id = 1;
 261    PeerId peer_id = 2;
 262    repeated ParticipantProject projects = 3;
 263    ParticipantLocation location = 4;
 264    uint32 participant_index = 5;
 265}
 266
 267message PendingParticipant {
 268    uint64 user_id = 1;
 269    uint64 calling_user_id = 2;
 270    optional uint64 initial_project_id = 3;
 271}
 272
 273message ParticipantProject {
 274    uint64 id = 1;
 275    repeated string worktree_root_names = 2;
 276}
 277
 278message Follower {
 279    PeerId leader_id = 1;
 280    PeerId follower_id = 2;
 281    uint64 project_id = 3;
 282}
 283
 284message ParticipantLocation {
 285    oneof variant {
 286        SharedProject shared_project = 1;
 287        UnsharedProject unshared_project = 2;
 288        External external = 3;
 289    }
 290
 291    message SharedProject {
 292        uint64 id = 1;
 293    }
 294
 295    message UnsharedProject {}
 296
 297    message External {}
 298}
 299
 300message Call {
 301    uint64 room_id = 1;
 302    uint64 called_user_id = 2;
 303    optional uint64 initial_project_id = 3;
 304}
 305
 306message IncomingCall {
 307    uint64 room_id = 1;
 308    uint64 calling_user_id = 2;
 309    repeated uint64 participant_user_ids = 3;
 310    optional ParticipantProject initial_project = 4;
 311}
 312
 313message CallCanceled {
 314    uint64 room_id = 1;
 315}
 316
 317message CancelCall {
 318    uint64 room_id = 1;
 319    uint64 called_user_id = 2;
 320}
 321
 322message DeclineCall {
 323    uint64 room_id = 1;
 324}
 325
 326message UpdateParticipantLocation {
 327    uint64 room_id = 1;
 328    ParticipantLocation location = 2;
 329}
 330
 331message RoomUpdated {
 332    Room room = 1;
 333}
 334
 335message LiveKitConnectionInfo {
 336    string server_url = 1;
 337    string token = 2;
 338}
 339
 340message ShareProject {
 341    uint64 room_id = 1;
 342    repeated WorktreeMetadata worktrees = 2;
 343}
 344
 345message ShareProjectResponse {
 346    uint64 project_id = 1;
 347}
 348
 349message UnshareProject {
 350    uint64 project_id = 1;
 351}
 352
 353message UpdateProject {
 354    uint64 project_id = 1;
 355    repeated WorktreeMetadata worktrees = 2;
 356}
 357
 358message JoinProject {
 359    uint64 project_id = 1;
 360}
 361
 362message JoinProjectResponse {
 363    uint32 replica_id = 1;
 364    repeated WorktreeMetadata worktrees = 2;
 365    repeated Collaborator collaborators = 3;
 366    repeated LanguageServer language_servers = 4;
 367}
 368
 369message LeaveProject {
 370    uint64 project_id = 1;
 371}
 372
 373message UpdateWorktree {
 374    uint64 project_id = 1;
 375    uint64 worktree_id = 2;
 376    string root_name = 3;
 377    repeated Entry updated_entries = 4;
 378    repeated uint64 removed_entries = 5;
 379    repeated RepositoryEntry updated_repositories = 6;
 380    repeated uint64 removed_repositories = 7;
 381    uint64 scan_id = 8;
 382    bool is_last_update = 9;
 383    string abs_path = 10;
 384}
 385
 386message UpdateWorktreeSettings {
 387    uint64 project_id = 1;
 388    uint64 worktree_id = 2;
 389    string path = 3;
 390    optional string content = 4;
 391}
 392
 393message CreateProjectEntry {
 394    uint64 project_id = 1;
 395    uint64 worktree_id = 2;
 396    string path = 3;
 397    bool is_directory = 4;
 398}
 399
 400message RenameProjectEntry {
 401    uint64 project_id = 1;
 402    uint64 entry_id = 2;
 403    string new_path = 3;
 404}
 405
 406message CopyProjectEntry {
 407    uint64 project_id = 1;
 408    uint64 entry_id = 2;
 409    string new_path = 3;
 410}
 411
 412message DeleteProjectEntry {
 413    uint64 project_id = 1;
 414    uint64 entry_id = 2;
 415}
 416
 417message ExpandProjectEntry {
 418    uint64 project_id = 1;
 419    uint64 entry_id = 2;
 420}
 421
 422message ExpandProjectEntryResponse {
 423    uint64 worktree_scan_id = 1;
 424}
 425
 426message ProjectEntryResponse {
 427    Entry entry = 1;
 428    uint64 worktree_scan_id = 2;
 429}
 430
 431message AddProjectCollaborator {
 432    uint64 project_id = 1;
 433    Collaborator collaborator = 2;
 434}
 435
 436message UpdateProjectCollaborator {
 437    uint64 project_id = 1;
 438    PeerId old_peer_id = 2;
 439    PeerId new_peer_id = 3;
 440}
 441
 442message RemoveProjectCollaborator {
 443    uint64 project_id = 1;
 444    PeerId peer_id = 2;
 445}
 446
 447message UpdateChannelBufferCollaborators {
 448    uint64 channel_id = 1;
 449    repeated Collaborator collaborators = 2;
 450}
 451
 452message GetDefinition {
 453     uint64 project_id = 1;
 454     uint64 buffer_id = 2;
 455     Anchor position = 3;
 456     repeated VectorClockEntry version = 4;
 457 }
 458
 459message GetDefinitionResponse {
 460    repeated LocationLink links = 1;
 461}
 462
 463message GetTypeDefinition {
 464     uint64 project_id = 1;
 465     uint64 buffer_id = 2;
 466     Anchor position = 3;
 467     repeated VectorClockEntry version = 4;
 468 }
 469
 470message GetTypeDefinitionResponse {
 471    repeated LocationLink links = 1;
 472}
 473
 474message GetReferences {
 475     uint64 project_id = 1;
 476     uint64 buffer_id = 2;
 477     Anchor position = 3;
 478     repeated VectorClockEntry version = 4;
 479 }
 480
 481message GetReferencesResponse {
 482    repeated Location locations = 1;
 483}
 484
 485message GetDocumentHighlights {
 486     uint64 project_id = 1;
 487     uint64 buffer_id = 2;
 488     Anchor position = 3;
 489     repeated VectorClockEntry version = 4;
 490 }
 491
 492message GetDocumentHighlightsResponse {
 493    repeated DocumentHighlight highlights = 1;
 494}
 495
 496message Location {
 497    uint64 buffer_id = 1;
 498    Anchor start = 2;
 499    Anchor end = 3;
 500}
 501
 502message LocationLink {
 503    optional Location origin = 1;
 504    Location target = 2;
 505}
 506
 507message DocumentHighlight {
 508    Kind kind = 1;
 509    Anchor start = 2;
 510    Anchor end = 3;
 511
 512    enum Kind {
 513        Text = 0;
 514        Read = 1;
 515        Write = 2;
 516    }
 517}
 518
 519message GetProjectSymbols {
 520    uint64 project_id = 1;
 521    string query = 2;
 522}
 523
 524message GetProjectSymbolsResponse {
 525    repeated Symbol symbols = 4;
 526}
 527
 528message Symbol {
 529    uint64 source_worktree_id = 1;
 530    uint64 worktree_id = 2;
 531    string language_server_name = 3;
 532    string name = 4;
 533    int32 kind = 5;
 534    string path = 6;
 535    // Cannot use generate anchors for unopened files,
 536    // so we are forced to use point coords instead
 537    PointUtf16 start = 7;
 538    PointUtf16 end = 8;
 539    bytes signature = 9;
 540}
 541
 542message OpenBufferForSymbol {
 543    uint64 project_id = 1;
 544    Symbol symbol = 2;
 545}
 546
 547message OpenBufferForSymbolResponse {
 548    uint64 buffer_id = 1;
 549}
 550
 551message OpenBufferByPath {
 552    uint64 project_id = 1;
 553    uint64 worktree_id = 2;
 554    string path = 3;
 555}
 556
 557message OpenBufferById {
 558    uint64 project_id = 1;
 559    uint64 id = 2;
 560}
 561
 562message OpenBufferResponse {
 563    uint64 buffer_id = 1;
 564}
 565
 566message CreateBufferForPeer {
 567    uint64 project_id = 1;
 568    PeerId peer_id = 2;
 569    oneof variant {
 570        BufferState state = 3;
 571        BufferChunk chunk = 4;
 572    }
 573}
 574
 575message UpdateBuffer {
 576    uint64 project_id = 1;
 577    uint64 buffer_id = 2;
 578    repeated Operation operations = 3;
 579}
 580
 581message UpdateChannelBuffer {
 582    uint64 channel_id = 1;
 583    repeated Operation operations = 2;
 584}
 585
 586message UpdateBufferFile {
 587    uint64 project_id = 1;
 588    uint64 buffer_id = 2;
 589    File file = 3;
 590}
 591
 592message SaveBuffer {
 593    uint64 project_id = 1;
 594    uint64 buffer_id = 2;
 595    repeated VectorClockEntry version = 3;
 596}
 597
 598message BufferSaved {
 599    uint64 project_id = 1;
 600    uint64 buffer_id = 2;
 601    repeated VectorClockEntry version = 3;
 602    Timestamp mtime = 4;
 603    string fingerprint = 5;
 604}
 605
 606message BufferReloaded {
 607    uint64 project_id = 1;
 608    uint64 buffer_id = 2;
 609    repeated VectorClockEntry version = 3;
 610    Timestamp mtime = 4;
 611    string fingerprint = 5;
 612    LineEnding line_ending = 6;
 613}
 614
 615message ReloadBuffers {
 616    uint64 project_id = 1;
 617    repeated uint64 buffer_ids = 2;
 618}
 619
 620message ReloadBuffersResponse {
 621    ProjectTransaction transaction = 1;
 622}
 623
 624message SynchronizeBuffers {
 625    uint64 project_id = 1;
 626    repeated BufferVersion buffers = 2;
 627}
 628
 629message SynchronizeBuffersResponse {
 630    repeated BufferVersion buffers = 1;
 631}
 632
 633message BufferVersion {
 634    uint64 id = 1;
 635    repeated VectorClockEntry version = 2;
 636}
 637
 638message ChannelBufferVersion {
 639    uint64 channel_id = 1;
 640    repeated VectorClockEntry version = 2;
 641    uint64 epoch = 3;
 642}
 643
 644enum FormatTrigger {
 645    Save = 0;
 646    Manual = 1;
 647}
 648
 649message FormatBuffers {
 650    uint64 project_id = 1;
 651    FormatTrigger trigger = 2;
 652    repeated uint64 buffer_ids = 3;
 653}
 654
 655message FormatBuffersResponse {
 656    ProjectTransaction transaction = 1;
 657}
 658
 659message GetCompletions {
 660    uint64 project_id = 1;
 661    uint64 buffer_id = 2;
 662    Anchor position = 3;
 663    repeated VectorClockEntry version = 4;
 664}
 665
 666message GetCompletionsResponse {
 667    repeated Completion completions = 1;
 668    repeated VectorClockEntry version = 2;
 669}
 670
 671message ApplyCompletionAdditionalEdits {
 672    uint64 project_id = 1;
 673    uint64 buffer_id = 2;
 674    Completion completion = 3;
 675}
 676
 677message ApplyCompletionAdditionalEditsResponse {
 678    Transaction transaction = 1;
 679}
 680
 681message Completion {
 682    Anchor old_start = 1;
 683    Anchor old_end = 2;
 684    string new_text = 3;
 685    uint64 server_id = 4;
 686    bytes lsp_completion = 5;
 687}
 688
 689message GetCodeActions {
 690    uint64 project_id = 1;
 691    uint64 buffer_id = 2;
 692    Anchor start = 3;
 693    Anchor end = 4;
 694    repeated VectorClockEntry version = 5;
 695}
 696
 697message GetCodeActionsResponse {
 698    repeated CodeAction actions = 1;
 699    repeated VectorClockEntry version = 2;
 700}
 701
 702message GetHover {
 703    uint64 project_id = 1;
 704    uint64 buffer_id = 2;
 705    Anchor position = 3;
 706    repeated VectorClockEntry version = 5;
 707}
 708
 709message GetHoverResponse {
 710    optional Anchor start = 1;
 711    optional Anchor end = 2;
 712    repeated HoverBlock contents = 3;
 713}
 714
 715message HoverBlock {
 716    string text = 1;
 717    optional string language = 2;
 718    bool is_markdown = 3;
 719}
 720
 721message ApplyCodeAction {
 722    uint64 project_id = 1;
 723    uint64 buffer_id = 2;
 724    CodeAction action = 3;
 725}
 726
 727message ApplyCodeActionResponse {
 728    ProjectTransaction transaction = 1;
 729}
 730
 731message PrepareRename {
 732    uint64 project_id = 1;
 733    uint64 buffer_id = 2;
 734    Anchor position = 3;
 735    repeated VectorClockEntry version = 4;
 736}
 737
 738message PrepareRenameResponse {
 739    bool can_rename = 1;
 740    Anchor start = 2;
 741    Anchor end = 3;
 742    repeated VectorClockEntry version = 4;
 743}
 744
 745message PerformRename {
 746    uint64 project_id = 1;
 747    uint64 buffer_id = 2;
 748    Anchor position = 3;
 749    string new_name = 4;
 750    repeated VectorClockEntry version = 5;
 751}
 752
 753message OnTypeFormatting {
 754    uint64 project_id = 1;
 755    uint64 buffer_id = 2;
 756    Anchor position = 3;
 757    string trigger = 4;
 758    repeated VectorClockEntry version = 5;
 759}
 760
 761message OnTypeFormattingResponse {
 762    Transaction transaction = 1;
 763}
 764
 765message InlayHints {
 766    uint64 project_id = 1;
 767    uint64 buffer_id = 2;
 768    Anchor start = 3;
 769    Anchor end = 4;
 770    repeated VectorClockEntry version = 5;
 771}
 772
 773message InlayHintsResponse {
 774    repeated InlayHint hints = 1;
 775    repeated VectorClockEntry version = 2;
 776}
 777
 778message InlayHint {
 779    Anchor position = 1;
 780    InlayHintLabel label = 2;
 781    optional string kind = 3;
 782    bool padding_left = 4;
 783    bool padding_right = 5;
 784    InlayHintTooltip tooltip = 6;
 785    ResolveState resolve_state = 7;
 786}
 787
 788message InlayHintLabel {
 789    oneof label {
 790        string value = 1;
 791        InlayHintLabelParts label_parts = 2;
 792    }
 793}
 794
 795message InlayHintLabelParts {
 796    repeated InlayHintLabelPart parts = 1;
 797}
 798
 799message InlayHintLabelPart {
 800    string value = 1;
 801    InlayHintLabelPartTooltip tooltip = 2;
 802    optional string location_url = 3;
 803    PointUtf16 location_range_start = 4;
 804    PointUtf16 location_range_end = 5;
 805    optional uint64 language_server_id = 6;
 806}
 807
 808message InlayHintTooltip {
 809    oneof content {
 810        string value = 1;
 811        MarkupContent markup_content = 2;
 812    }
 813}
 814
 815message InlayHintLabelPartTooltip {
 816    oneof content {
 817        string value = 1;
 818        MarkupContent markup_content = 2;
 819    }
 820}
 821
 822message ResolveState {
 823    State state = 1;
 824    LspResolveState lsp_resolve_state = 2;
 825
 826    enum State {
 827        Resolved = 0;
 828        CanResolve = 1;
 829        Resolving = 2;
 830    }
 831
 832    message LspResolveState {
 833        string value = 1;
 834        uint64 server_id = 2;
 835    }
 836}
 837
 838message ResolveCompletionDocumentation {
 839    uint64 project_id = 1;
 840    uint64 language_server_id = 2;
 841    bytes lsp_completion = 3;
 842}
 843
 844message ResolveCompletionDocumentationResponse {
 845    string text = 1;
 846    bool is_markdown = 2;
 847}
 848
 849message ResolveInlayHint {
 850    uint64 project_id = 1;
 851    uint64 buffer_id = 2;
 852    uint64 language_server_id = 3;
 853    InlayHint hint = 4;
 854}
 855
 856message ResolveInlayHintResponse {
 857    InlayHint hint = 1;
 858}
 859
 860message RefreshInlayHints {
 861    uint64 project_id = 1;
 862}
 863
 864message MarkupContent {
 865    bool is_markdown = 1;
 866    string value = 2;
 867}
 868
 869message PerformRenameResponse {
 870    ProjectTransaction transaction = 2;
 871}
 872
 873message SearchProject {
 874    uint64 project_id = 1;
 875    string query = 2;
 876    bool regex = 3;
 877    bool whole_word = 4;
 878    bool case_sensitive = 5;
 879    string files_to_include = 6;
 880    string files_to_exclude = 7;
 881}
 882
 883message SearchProjectResponse {
 884    repeated Location locations = 1;
 885}
 886
 887message CodeAction {
 888    uint64 server_id = 1;
 889    Anchor start = 2;
 890    Anchor end = 3;
 891    bytes lsp_action = 4;
 892}
 893
 894message ProjectTransaction {
 895    repeated uint64 buffer_ids = 1;
 896    repeated Transaction transactions = 2;
 897}
 898
 899message Transaction {
 900    LamportTimestamp id = 1;
 901    repeated LamportTimestamp edit_ids = 2;
 902    repeated VectorClockEntry start = 3;
 903}
 904
 905message LamportTimestamp {
 906    uint32 replica_id = 1;
 907    uint32 value = 2;
 908}
 909
 910message LanguageServer {
 911    uint64 id = 1;
 912    string name = 2;
 913}
 914
 915message StartLanguageServer {
 916    uint64 project_id = 1;
 917    LanguageServer server = 2;
 918}
 919
 920message UpdateDiagnosticSummary {
 921    uint64 project_id = 1;
 922    uint64 worktree_id = 2;
 923    DiagnosticSummary summary = 3;
 924}
 925
 926message DiagnosticSummary {
 927    string path = 1;
 928    uint64 language_server_id = 2;
 929    uint32 error_count = 3;
 930    uint32 warning_count = 4;
 931}
 932
 933message UpdateLanguageServer {
 934    uint64 project_id = 1;
 935    uint64 language_server_id = 2;
 936    oneof variant {
 937        LspWorkStart work_start = 3;
 938        LspWorkProgress work_progress = 4;
 939        LspWorkEnd work_end = 5;
 940        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 941        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 942    }
 943}
 944
 945message LspWorkStart {
 946    string token = 1;
 947    optional string message = 2;
 948    optional uint32 percentage = 3;
 949}
 950
 951message LspWorkProgress {
 952    string token = 1;
 953    optional string message = 2;
 954    optional uint32 percentage = 3;
 955}
 956
 957message LspWorkEnd {
 958    string token = 1;
 959}
 960
 961message LspDiskBasedDiagnosticsUpdating {}
 962
 963message LspDiskBasedDiagnosticsUpdated {}
 964
 965message UpdateChannels {
 966    repeated Channel channels = 1;
 967    repeated ChannelEdge insert_edge = 2;
 968    repeated ChannelEdge delete_edge = 3;
 969    repeated uint64 delete_channels = 4;
 970    repeated Channel channel_invitations = 5;
 971    repeated uint64 remove_channel_invitations = 6;
 972    repeated ChannelParticipants channel_participants = 7;
 973    repeated ChannelPermission channel_permissions = 8;
 974    repeated UnseenChannelMessage unseen_channel_messages = 9;
 975    repeated UnseenChannelBufferChange unseen_channel_buffer_changes = 10;
 976}
 977
 978message UnseenChannelMessage {
 979    uint64 channel_id = 1;
 980    uint64 message_id = 2;
 981}
 982
 983message UnseenChannelBufferChange {
 984    uint64 channel_id = 1;
 985    uint64 epoch = 2;
 986    repeated VectorClockEntry version = 3;
 987}
 988
 989message ChannelEdge {
 990    uint64 channel_id = 1;
 991    uint64 parent_id = 2;
 992}
 993
 994message ChannelPermission {
 995    uint64 channel_id = 1;
 996    ChannelRole role = 3;
 997}
 998
 999message ChannelParticipants {
1000    uint64 channel_id = 1;
1001    repeated uint64 participant_user_ids = 2;
1002}
1003
1004message JoinChannel {
1005    uint64 channel_id = 1;
1006}
1007
1008message DeleteChannel {
1009    uint64 channel_id = 1;
1010}
1011
1012message GetChannelMembers {
1013    uint64 channel_id = 1;
1014}
1015
1016message GetChannelMembersResponse {
1017    repeated ChannelMember members = 1;
1018}
1019
1020message ChannelMember {
1021    uint64 user_id = 1;
1022    Kind kind = 3;
1023    ChannelRole role = 4;
1024
1025    enum Kind {
1026        Member = 0;
1027        Invitee = 1;
1028        AncestorMember = 2;
1029    }
1030}
1031
1032message CreateChannel {
1033    string name = 1;
1034    optional uint64 parent_id = 2;
1035}
1036
1037message CreateChannelResponse {
1038    Channel channel = 1;
1039    optional uint64 parent_id = 2;
1040}
1041
1042message InviteChannelMember {
1043    uint64 channel_id = 1;
1044    uint64 user_id = 2;
1045    ChannelRole role = 4;
1046}
1047
1048message RemoveChannelMember {
1049    uint64 channel_id = 1;
1050    uint64 user_id = 2;
1051}
1052
1053enum ChannelRole {
1054    Admin = 0;
1055    Member = 1;
1056    Guest = 2;
1057    Banned = 3;
1058}
1059
1060message SetChannelMemberRole {
1061    uint64 channel_id = 1;
1062    uint64 user_id = 2;
1063    ChannelRole role = 3;
1064}
1065
1066message SetChannelVisibility {
1067    uint64 channel_id = 1;
1068    ChannelVisibility visibility = 2;
1069}
1070
1071message RenameChannel {
1072    uint64 channel_id = 1;
1073    string name = 2;
1074}
1075
1076message RenameChannelResponse {
1077    Channel channel = 1;
1078}
1079
1080message JoinChannelChat {
1081    uint64 channel_id = 1;
1082}
1083
1084message JoinChannelChatResponse {
1085    repeated ChannelMessage messages = 1;
1086    bool done = 2;
1087}
1088
1089message LeaveChannelChat {
1090    uint64 channel_id = 1;
1091}
1092
1093message SendChannelMessage {
1094    uint64 channel_id = 1;
1095    string body = 2;
1096    Nonce nonce = 3;
1097}
1098
1099message RemoveChannelMessage {
1100    uint64 channel_id = 1;
1101    uint64 message_id = 2;
1102}
1103
1104message AckChannelMessage {
1105    uint64 channel_id = 1;
1106    uint64 message_id = 2;
1107}
1108
1109message SendChannelMessageResponse {
1110    ChannelMessage message = 1;
1111}
1112
1113message ChannelMessageSent {
1114    uint64 channel_id = 1;
1115    ChannelMessage message = 2;
1116}
1117
1118message GetChannelMessages {
1119    uint64 channel_id = 1;
1120    uint64 before_message_id = 2;
1121}
1122
1123message GetChannelMessagesResponse {
1124    repeated ChannelMessage messages = 1;
1125    bool done = 2;
1126}
1127
1128message LinkChannel {
1129    uint64 channel_id = 1;
1130    uint64 to = 2;
1131}
1132
1133message UnlinkChannel {
1134    uint64 channel_id = 1;
1135    uint64 from = 2;
1136}
1137
1138message MoveChannel {
1139    uint64 channel_id = 1;
1140    uint64 from = 2;
1141    uint64 to = 3;
1142}
1143
1144message JoinChannelBuffer {
1145    uint64 channel_id = 1;
1146}
1147
1148message ChannelMessage {
1149    uint64 id = 1;
1150    string body = 2;
1151    uint64 timestamp = 3;
1152    uint64 sender_id = 4;
1153    Nonce nonce = 5;
1154}
1155
1156message RejoinChannelBuffers {
1157    repeated ChannelBufferVersion buffers = 1;
1158}
1159
1160message RejoinChannelBuffersResponse {
1161    repeated RejoinedChannelBuffer buffers = 1;
1162}
1163
1164message AckBufferOperation {
1165    uint64 buffer_id = 1;
1166    uint64 epoch = 2;
1167    repeated VectorClockEntry version = 3;
1168}
1169
1170message JoinChannelBufferResponse {
1171    uint64 buffer_id = 1;
1172    uint32 replica_id = 2;
1173    string base_text = 3;
1174    repeated Operation operations = 4;
1175    repeated Collaborator collaborators = 5;
1176    uint64 epoch = 6;
1177}
1178
1179message RejoinedChannelBuffer {
1180    uint64 channel_id = 1;
1181    repeated VectorClockEntry version = 2;
1182    repeated Operation operations = 3;
1183    repeated Collaborator collaborators = 4;
1184}
1185
1186message LeaveChannelBuffer {
1187    uint64 channel_id = 1;
1188}
1189
1190message RespondToChannelInvite {
1191    uint64 channel_id = 1;
1192    bool accept = 2;
1193}
1194
1195message GetUsers {
1196    repeated uint64 user_ids = 1;
1197}
1198
1199message FuzzySearchUsers {
1200    string query = 1;
1201}
1202
1203message UsersResponse {
1204    repeated User users = 1;
1205}
1206
1207message RequestContact {
1208    uint64 responder_id = 1;
1209}
1210
1211message RemoveContact {
1212    uint64 user_id = 1;
1213}
1214
1215message RespondToContactRequest {
1216    uint64 requester_id = 1;
1217    ContactRequestResponse response = 2;
1218}
1219
1220enum ContactRequestResponse {
1221    Accept = 0;
1222    Decline = 1;
1223    Block = 2;
1224    Dismiss = 3;
1225}
1226
1227message UpdateContacts {
1228    repeated Contact contacts = 1;
1229    repeated uint64 remove_contacts = 2;
1230    repeated IncomingContactRequest incoming_requests = 3;
1231    repeated uint64 remove_incoming_requests = 4;
1232    repeated uint64 outgoing_requests = 5;
1233    repeated uint64 remove_outgoing_requests = 6;
1234}
1235
1236message UpdateInviteInfo {
1237    string url = 1;
1238    uint32 count = 2;
1239}
1240
1241message ShowContacts {}
1242
1243message IncomingContactRequest {
1244    uint64 requester_id = 1;
1245    bool should_notify = 2;
1246}
1247
1248message UpdateDiagnostics {
1249    uint32 replica_id = 1;
1250    uint32 lamport_timestamp = 2;
1251    uint64 server_id = 3;
1252    repeated Diagnostic diagnostics = 4;
1253}
1254
1255message Follow {
1256    uint64 room_id = 1;
1257    optional uint64 project_id = 2;
1258    PeerId leader_id = 3;
1259}
1260
1261message FollowResponse {
1262    optional ViewId active_view_id = 1;
1263    repeated View views = 2;
1264}
1265
1266message UpdateFollowers {
1267    uint64 room_id = 1;
1268    optional uint64 project_id = 2;
1269    repeated PeerId follower_ids = 3;
1270    oneof variant {
1271        UpdateActiveView update_active_view = 4;
1272        View create_view = 5;
1273        UpdateView update_view = 6;
1274    }
1275}
1276
1277message Unfollow {
1278    uint64 room_id = 1;
1279    optional uint64 project_id = 2;
1280    PeerId leader_id = 3;
1281}
1282
1283message GetPrivateUserInfo {}
1284
1285message GetPrivateUserInfoResponse {
1286    string metrics_id = 1;
1287    bool staff = 2;
1288    repeated string flags = 3;
1289}
1290
1291// Entities
1292
1293message ViewId {
1294    PeerId creator = 1;
1295    uint64 id = 2;
1296}
1297
1298message UpdateActiveView {
1299    optional ViewId id = 1;
1300    optional PeerId leader_id = 2;
1301}
1302
1303message UpdateView {
1304    ViewId id = 1;
1305    optional PeerId leader_id = 2;
1306
1307    oneof variant {
1308        Editor editor = 3;
1309    }
1310
1311    message Editor {
1312        repeated ExcerptInsertion inserted_excerpts = 1;
1313        repeated uint64 deleted_excerpts = 2;
1314        repeated Selection selections = 3;
1315        optional Selection pending_selection = 4;
1316        EditorAnchor scroll_top_anchor = 5;
1317        float scroll_x = 6;
1318        float scroll_y = 7;
1319    }
1320}
1321
1322message View {
1323    ViewId id = 1;
1324    optional PeerId leader_id = 2;
1325
1326    oneof variant {
1327        Editor editor = 3;
1328        ChannelView channel_view = 4;
1329    }
1330
1331    message Editor {
1332        bool singleton = 1;
1333        optional string title = 2;
1334        repeated Excerpt excerpts = 3;
1335        repeated Selection selections = 4;
1336        optional Selection pending_selection = 5;
1337        EditorAnchor scroll_top_anchor = 6;
1338        float scroll_x = 7;
1339        float scroll_y = 8;
1340    }
1341
1342    message ChannelView {
1343        uint64 channel_id = 1;
1344        Editor editor = 2;
1345    }
1346}
1347
1348message Collaborator {
1349    PeerId peer_id = 1;
1350    uint32 replica_id = 2;
1351    uint64 user_id = 3;
1352}
1353
1354message User {
1355    uint64 id = 1;
1356    string github_login = 2;
1357    string avatar_url = 3;
1358}
1359
1360message File {
1361    uint64 worktree_id = 1;
1362    uint64 entry_id = 2;
1363    string path = 3;
1364    Timestamp mtime = 4;
1365    bool is_deleted = 5;
1366}
1367
1368message Entry {
1369    uint64 id = 1;
1370    bool is_dir = 2;
1371    string path = 3;
1372    uint64 inode = 4;
1373    Timestamp mtime = 5;
1374    bool is_symlink = 6;
1375    bool is_ignored = 7;
1376    bool is_external = 8;
1377    optional GitStatus git_status = 9;
1378}
1379
1380message RepositoryEntry {
1381    uint64 work_directory_id = 1;
1382    optional string branch = 2;
1383}
1384
1385message StatusEntry {
1386    string repo_path = 1;
1387    GitStatus status = 2;
1388}
1389
1390enum GitStatus {
1391    Added = 0;
1392    Modified = 1;
1393    Conflict = 2;
1394}
1395
1396message BufferState {
1397    uint64 id = 1;
1398    optional File file = 2;
1399    string base_text = 3;
1400    optional string diff_base = 4;
1401    LineEnding line_ending = 5;
1402    repeated VectorClockEntry saved_version = 6;
1403    string saved_version_fingerprint = 7;
1404    Timestamp saved_mtime = 8;
1405}
1406
1407message BufferChunk {
1408    uint64 buffer_id = 1;
1409    repeated Operation operations = 2;
1410    bool is_last = 3;
1411}
1412
1413enum LineEnding {
1414    Unix = 0;
1415    Windows = 1;
1416}
1417
1418message Selection {
1419    uint64 id = 1;
1420    EditorAnchor start = 2;
1421    EditorAnchor end = 3;
1422    bool reversed = 4;
1423}
1424
1425message EditorAnchor {
1426    uint64 excerpt_id = 1;
1427    Anchor anchor = 2;
1428}
1429
1430enum CursorShape {
1431    CursorBar = 0;
1432    CursorBlock = 1;
1433    CursorUnderscore = 2;
1434    CursorHollow = 3;
1435}
1436
1437message ExcerptInsertion {
1438    Excerpt excerpt = 1;
1439    optional uint64 previous_excerpt_id = 2;
1440}
1441
1442message Excerpt {
1443    uint64 id = 1;
1444    uint64 buffer_id = 2;
1445    Anchor context_start = 3;
1446    Anchor context_end = 4;
1447    Anchor primary_start = 5;
1448    Anchor primary_end = 6;
1449}
1450
1451message Anchor {
1452    uint32 replica_id = 1;
1453    uint32 timestamp = 2;
1454    uint64 offset = 3;
1455    Bias bias = 4;
1456    optional uint64 buffer_id = 5;
1457}
1458
1459enum Bias {
1460    Left = 0;
1461    Right = 1;
1462}
1463
1464message Diagnostic {
1465    Anchor start = 1;
1466    Anchor end = 2;
1467    optional string source = 3;
1468    Severity severity = 4;
1469    string message = 5;
1470    optional string code = 6;
1471    uint64 group_id = 7;
1472    bool is_primary = 8;
1473    bool is_valid = 9;
1474    bool is_disk_based = 10;
1475    bool is_unnecessary = 11;
1476
1477    enum Severity {
1478        None = 0;
1479        Error = 1;
1480        Warning = 2;
1481        Information = 3;
1482        Hint = 4;
1483    }
1484}
1485
1486message Operation {
1487    oneof variant {
1488        Edit edit = 1;
1489        Undo undo = 2;
1490        UpdateSelections update_selections = 3;
1491        UpdateDiagnostics update_diagnostics = 4;
1492        UpdateCompletionTriggers update_completion_triggers = 5;
1493    }
1494
1495    message Edit {
1496        uint32 replica_id = 1;
1497        uint32 lamport_timestamp = 2;
1498        repeated VectorClockEntry version = 3;
1499        repeated Range ranges = 4;
1500        repeated string new_text = 5;
1501    }
1502
1503    message Undo {
1504        uint32 replica_id = 1;
1505        uint32 lamport_timestamp = 2;
1506        repeated VectorClockEntry version = 3;
1507        repeated UndoCount counts = 4;
1508    }
1509
1510    message UpdateSelections {
1511        uint32 replica_id = 1;
1512        uint32 lamport_timestamp = 2;
1513        repeated Selection selections = 3;
1514        bool line_mode = 4;
1515        CursorShape cursor_shape = 5;
1516    }
1517
1518    message UpdateCompletionTriggers {
1519        uint32 replica_id = 1;
1520        uint32 lamport_timestamp = 2;
1521        repeated string triggers = 3;
1522    }
1523}
1524
1525message UndoMapEntry {
1526    uint32 replica_id = 1;
1527    uint32 local_timestamp = 2;
1528    repeated UndoCount counts = 3;
1529}
1530
1531message UndoCount {
1532    uint32 replica_id = 1;
1533    uint32 lamport_timestamp = 2;
1534    uint32 count = 3;
1535}
1536
1537message VectorClockEntry {
1538    uint32 replica_id = 1;
1539    uint32 timestamp = 2;
1540}
1541
1542message Timestamp {
1543    uint64 seconds = 1;
1544    uint32 nanos = 2;
1545}
1546
1547message Range {
1548    uint64 start = 1;
1549    uint64 end = 2;
1550}
1551
1552message PointUtf16 {
1553    uint32 row = 1;
1554    uint32 column = 2;
1555}
1556
1557message Nonce {
1558    uint64 upper_half = 1;
1559    uint64 lower_half = 2;
1560}
1561
1562enum ChannelVisibility {
1563    Public = 0;
1564    Members = 1;
1565}
1566
1567message Channel {
1568    uint64 id = 1;
1569    string name = 2;
1570    ChannelVisibility visibility = 3;
1571}
1572
1573message Contact {
1574    uint64 user_id = 1;
1575    bool online = 2;
1576    bool busy = 3;
1577    bool should_notify = 4;
1578}
1579
1580message WorktreeMetadata {
1581    uint64 id = 1;
1582    string root_name = 2;
1583    bool visible = 3;
1584    string abs_path = 4;
1585}
1586
1587message UpdateDiffBase {
1588    uint64 project_id = 1;
1589    uint64 buffer_id = 2;
1590    optional string diff_base = 3;
1591}