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