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