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