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}
1126
1127message RemoveChannelMessage {
1128    uint64 channel_id = 1;
1129    uint64 message_id = 2;
1130}
1131
1132message AckChannelMessage {
1133    uint64 channel_id = 1;
1134    uint64 message_id = 2;
1135}
1136
1137message SendChannelMessageResponse {
1138    ChannelMessage message = 1;
1139}
1140
1141message ChannelMessageSent {
1142    uint64 channel_id = 1;
1143    ChannelMessage message = 2;
1144}
1145
1146message GetChannelMessages {
1147    uint64 channel_id = 1;
1148    uint64 before_message_id = 2;
1149}
1150
1151message GetChannelMessagesResponse {
1152    repeated ChannelMessage messages = 1;
1153    bool done = 2;
1154}
1155
1156message GetChannelMessagesById {
1157    repeated uint64 message_ids = 1;
1158}
1159
1160message MoveChannel {
1161    uint64 channel_id = 1;
1162    uint64 to = 2;
1163}
1164
1165message JoinChannelBuffer {
1166    uint64 channel_id = 1;
1167}
1168
1169message ChannelMessage {
1170    uint64 id = 1;
1171    string body = 2;
1172    uint64 timestamp = 3;
1173    uint64 sender_id = 4;
1174    Nonce nonce = 5;
1175    repeated ChatMention mentions = 6;
1176}
1177
1178message ChatMention {
1179    Range range = 1;
1180    uint64 user_id = 2;
1181}
1182
1183message RejoinChannelBuffers {
1184    repeated ChannelBufferVersion buffers = 1;
1185}
1186
1187message RejoinChannelBuffersResponse {
1188    repeated RejoinedChannelBuffer buffers = 1;
1189}
1190
1191message AckBufferOperation {
1192    uint64 buffer_id = 1;
1193    uint64 epoch = 2;
1194    repeated VectorClockEntry version = 3;
1195}
1196
1197message JoinChannelBufferResponse {
1198    uint64 buffer_id = 1;
1199    uint32 replica_id = 2;
1200    string base_text = 3;
1201    repeated Operation operations = 4;
1202    repeated Collaborator collaborators = 5;
1203    uint64 epoch = 6;
1204}
1205
1206message RejoinedChannelBuffer {
1207    uint64 channel_id = 1;
1208    repeated VectorClockEntry version = 2;
1209    repeated Operation operations = 3;
1210    repeated Collaborator collaborators = 4;
1211}
1212
1213message LeaveChannelBuffer {
1214    uint64 channel_id = 1;
1215}
1216
1217message RespondToChannelInvite {
1218    uint64 channel_id = 1;
1219    bool accept = 2;
1220}
1221
1222message GetUsers {
1223    repeated uint64 user_ids = 1;
1224}
1225
1226message FuzzySearchUsers {
1227    string query = 1;
1228}
1229
1230message UsersResponse {
1231    repeated User users = 1;
1232}
1233
1234message RequestContact {
1235    uint64 responder_id = 1;
1236}
1237
1238message RemoveContact {
1239    uint64 user_id = 1;
1240}
1241
1242message RespondToContactRequest {
1243    uint64 requester_id = 1;
1244    ContactRequestResponse response = 2;
1245}
1246
1247enum ContactRequestResponse {
1248    Accept = 0;
1249    Decline = 1;
1250    Block = 2;
1251    Dismiss = 3;
1252}
1253
1254message UpdateContacts {
1255    repeated Contact contacts = 1;
1256    repeated uint64 remove_contacts = 2;
1257    repeated IncomingContactRequest incoming_requests = 3;
1258    repeated uint64 remove_incoming_requests = 4;
1259    repeated uint64 outgoing_requests = 5;
1260    repeated uint64 remove_outgoing_requests = 6;
1261}
1262
1263message UpdateInviteInfo {
1264    string url = 1;
1265    uint32 count = 2;
1266}
1267
1268message ShowContacts {}
1269
1270message IncomingContactRequest {
1271    uint64 requester_id = 1;
1272}
1273
1274message UpdateDiagnostics {
1275    uint32 replica_id = 1;
1276    uint32 lamport_timestamp = 2;
1277    uint64 server_id = 3;
1278    repeated Diagnostic diagnostics = 4;
1279}
1280
1281message Follow {
1282    uint64 room_id = 1;
1283    optional uint64 project_id = 2;
1284    PeerId leader_id = 3;
1285}
1286
1287message FollowResponse {
1288    optional ViewId active_view_id = 1;
1289    repeated View views = 2;
1290}
1291
1292message UpdateFollowers {
1293    uint64 room_id = 1;
1294    optional uint64 project_id = 2;
1295    repeated PeerId follower_ids = 3;
1296    oneof variant {
1297        UpdateActiveView update_active_view = 4;
1298        View create_view = 5;
1299        UpdateView update_view = 6;
1300    }
1301}
1302
1303message Unfollow {
1304    uint64 room_id = 1;
1305    optional uint64 project_id = 2;
1306    PeerId leader_id = 3;
1307}
1308
1309message GetPrivateUserInfo {}
1310
1311message GetPrivateUserInfoResponse {
1312    string metrics_id = 1;
1313    bool staff = 2;
1314    repeated string flags = 3;
1315}
1316
1317// Entities
1318
1319message ViewId {
1320    PeerId creator = 1;
1321    uint64 id = 2;
1322}
1323
1324message UpdateActiveView {
1325    optional ViewId id = 1;
1326    optional PeerId leader_id = 2;
1327}
1328
1329message UpdateView {
1330    ViewId id = 1;
1331    optional PeerId leader_id = 2;
1332
1333    oneof variant {
1334        Editor editor = 3;
1335    }
1336
1337    message Editor {
1338        repeated ExcerptInsertion inserted_excerpts = 1;
1339        repeated uint64 deleted_excerpts = 2;
1340        repeated Selection selections = 3;
1341        optional Selection pending_selection = 4;
1342        EditorAnchor scroll_top_anchor = 5;
1343        float scroll_x = 6;
1344        float scroll_y = 7;
1345    }
1346}
1347
1348message View {
1349    ViewId id = 1;
1350    optional PeerId leader_id = 2;
1351
1352    oneof variant {
1353        Editor editor = 3;
1354        ChannelView channel_view = 4;
1355    }
1356
1357    message Editor {
1358        bool singleton = 1;
1359        optional string title = 2;
1360        repeated Excerpt excerpts = 3;
1361        repeated Selection selections = 4;
1362        optional Selection pending_selection = 5;
1363        EditorAnchor scroll_top_anchor = 6;
1364        float scroll_x = 7;
1365        float scroll_y = 8;
1366    }
1367
1368    message ChannelView {
1369        uint64 channel_id = 1;
1370        Editor editor = 2;
1371    }
1372}
1373
1374message Collaborator {
1375    PeerId peer_id = 1;
1376    uint32 replica_id = 2;
1377    uint64 user_id = 3;
1378}
1379
1380message User {
1381    uint64 id = 1;
1382    string github_login = 2;
1383    string avatar_url = 3;
1384}
1385
1386message File {
1387    uint64 worktree_id = 1;
1388    optional uint64 entry_id = 2;
1389    string path = 3;
1390    Timestamp mtime = 4;
1391    bool is_deleted = 5;
1392}
1393
1394message Entry {
1395    uint64 id = 1;
1396    bool is_dir = 2;
1397    string path = 3;
1398    uint64 inode = 4;
1399    Timestamp mtime = 5;
1400    bool is_symlink = 6;
1401    bool is_ignored = 7;
1402    bool is_external = 8;
1403    optional GitStatus git_status = 9;
1404}
1405
1406message RepositoryEntry {
1407    uint64 work_directory_id = 1;
1408    optional string branch = 2;
1409}
1410
1411message StatusEntry {
1412    string repo_path = 1;
1413    GitStatus status = 2;
1414}
1415
1416enum GitStatus {
1417    Added = 0;
1418    Modified = 1;
1419    Conflict = 2;
1420}
1421
1422message BufferState {
1423    uint64 id = 1;
1424    optional File file = 2;
1425    string base_text = 3;
1426    optional string diff_base = 4;
1427    LineEnding line_ending = 5;
1428    repeated VectorClockEntry saved_version = 6;
1429    string saved_version_fingerprint = 7;
1430    Timestamp saved_mtime = 8;
1431}
1432
1433message BufferChunk {
1434    uint64 buffer_id = 1;
1435    repeated Operation operations = 2;
1436    bool is_last = 3;
1437}
1438
1439enum LineEnding {
1440    Unix = 0;
1441    Windows = 1;
1442}
1443
1444message Selection {
1445    uint64 id = 1;
1446    EditorAnchor start = 2;
1447    EditorAnchor end = 3;
1448    bool reversed = 4;
1449}
1450
1451message EditorAnchor {
1452    uint64 excerpt_id = 1;
1453    Anchor anchor = 2;
1454}
1455
1456enum CursorShape {
1457    CursorBar = 0;
1458    CursorBlock = 1;
1459    CursorUnderscore = 2;
1460    CursorHollow = 3;
1461}
1462
1463message ExcerptInsertion {
1464    Excerpt excerpt = 1;
1465    optional uint64 previous_excerpt_id = 2;
1466}
1467
1468message Excerpt {
1469    uint64 id = 1;
1470    uint64 buffer_id = 2;
1471    Anchor context_start = 3;
1472    Anchor context_end = 4;
1473    Anchor primary_start = 5;
1474    Anchor primary_end = 6;
1475}
1476
1477message Anchor {
1478    uint32 replica_id = 1;
1479    uint32 timestamp = 2;
1480    uint64 offset = 3;
1481    Bias bias = 4;
1482    optional uint64 buffer_id = 5;
1483}
1484
1485enum Bias {
1486    Left = 0;
1487    Right = 1;
1488}
1489
1490message Diagnostic {
1491    Anchor start = 1;
1492    Anchor end = 2;
1493    optional string source = 3;
1494    Severity severity = 4;
1495    string message = 5;
1496    optional string code = 6;
1497    uint64 group_id = 7;
1498    bool is_primary = 8;
1499
1500    // TODO: remove this field
1501    bool is_valid = 9;
1502
1503    bool is_disk_based = 10;
1504    bool is_unnecessary = 11;
1505
1506    enum Severity {
1507        None = 0;
1508        Error = 1;
1509        Warning = 2;
1510        Information = 3;
1511        Hint = 4;
1512    }
1513}
1514
1515message Operation {
1516    oneof variant {
1517        Edit edit = 1;
1518        Undo undo = 2;
1519        UpdateSelections update_selections = 3;
1520        UpdateDiagnostics update_diagnostics = 4;
1521        UpdateCompletionTriggers update_completion_triggers = 5;
1522    }
1523
1524    message Edit {
1525        uint32 replica_id = 1;
1526        uint32 lamport_timestamp = 2;
1527        repeated VectorClockEntry version = 3;
1528        repeated Range ranges = 4;
1529        repeated string new_text = 5;
1530    }
1531
1532    message Undo {
1533        uint32 replica_id = 1;
1534        uint32 lamport_timestamp = 2;
1535        repeated VectorClockEntry version = 3;
1536        repeated UndoCount counts = 4;
1537    }
1538
1539    message UpdateSelections {
1540        uint32 replica_id = 1;
1541        uint32 lamport_timestamp = 2;
1542        repeated Selection selections = 3;
1543        bool line_mode = 4;
1544        CursorShape cursor_shape = 5;
1545    }
1546
1547    message UpdateCompletionTriggers {
1548        uint32 replica_id = 1;
1549        uint32 lamport_timestamp = 2;
1550        repeated string triggers = 3;
1551    }
1552}
1553
1554message UndoMapEntry {
1555    uint32 replica_id = 1;
1556    uint32 local_timestamp = 2;
1557    repeated UndoCount counts = 3;
1558}
1559
1560message UndoCount {
1561    uint32 replica_id = 1;
1562    uint32 lamport_timestamp = 2;
1563    uint32 count = 3;
1564}
1565
1566message VectorClockEntry {
1567    uint32 replica_id = 1;
1568    uint32 timestamp = 2;
1569}
1570
1571message Timestamp {
1572    uint64 seconds = 1;
1573    uint32 nanos = 2;
1574}
1575
1576message Range {
1577    uint64 start = 1;
1578    uint64 end = 2;
1579}
1580
1581message PointUtf16 {
1582    uint32 row = 1;
1583    uint32 column = 2;
1584}
1585
1586message Nonce {
1587    uint64 upper_half = 1;
1588    uint64 lower_half = 2;
1589}
1590
1591enum ChannelVisibility {
1592    Public = 0;
1593    Members = 1;
1594}
1595
1596message Channel {
1597    uint64 id = 1;
1598    string name = 2;
1599    ChannelVisibility visibility = 3;
1600    repeated uint64 parent_path = 5;
1601}
1602
1603message Contact {
1604    uint64 user_id = 1;
1605    bool online = 2;
1606    bool busy = 3;
1607}
1608
1609message WorktreeMetadata {
1610    uint64 id = 1;
1611    string root_name = 2;
1612    bool visible = 3;
1613    string abs_path = 4;
1614}
1615
1616message UpdateDiffBase {
1617    uint64 project_id = 1;
1618    uint64 buffer_id = 2;
1619    optional string diff_base = 3;
1620}
1621
1622message GetNotifications {
1623    optional uint64 before_id = 1;
1624}
1625
1626message AddNotification {
1627    Notification notification = 1;
1628}
1629
1630message GetNotificationsResponse {
1631    repeated Notification notifications = 1;
1632    bool done = 2;
1633}
1634
1635message DeleteNotification {
1636    uint64 notification_id = 1;
1637}
1638
1639message MarkNotificationRead {
1640    uint64 notification_id = 1;
1641}
1642
1643message Notification {
1644    uint64 id = 1;
1645    uint64 timestamp = 2;
1646    string kind = 3;
1647    optional uint64 entity_id = 4;
1648    string content = 5;
1649    bool is_read = 6;
1650    optional bool response = 7;
1651}
1652
1653message LspExtExpandMacro {
1654    uint64 project_id = 1;
1655    uint64 buffer_id = 2;
1656    Anchor position = 3;
1657}
1658
1659message LspExtExpandMacroResponse {
1660    string name = 1;
1661    string expansion = 2;
1662}
1663
1664message SetRoomParticipantRole {
1665    uint64 room_id = 1;
1666    uint64 user_id = 2;
1667    ChannelRole role = 3;
1668}