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