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
  16    /*
  17        When you are adding a new message type, instead of adding it in semantic order
  18        and bumping the message ID's of everything that follows, add it at the end of the
  19        file and bump the max number. See this
  20        https://github.com/zed-industries/zed/pull/7890#discussion_r1496621823
  21
  22    */
  23    oneof payload {
  24        Hello hello = 4;
  25        Ack ack = 5;
  26        Error error = 6;
  27        Ping ping = 7;
  28        Test test = 8;
  29        EndStream end_stream = 165;
  30
  31        CreateRoom create_room = 9;
  32        CreateRoomResponse create_room_response = 10;
  33        JoinRoom join_room = 11;
  34        JoinRoomResponse join_room_response = 12;
  35        RejoinRoom rejoin_room = 13;
  36        RejoinRoomResponse rejoin_room_response = 14;
  37        LeaveRoom leave_room = 15;
  38        Call call = 16;
  39        IncomingCall incoming_call = 17;
  40        CallCanceled call_canceled = 18;
  41        CancelCall cancel_call = 19;
  42        DeclineCall decline_call = 20;
  43        UpdateParticipantLocation update_participant_location = 21;
  44        RoomUpdated room_updated = 22;
  45
  46        ShareProject share_project = 23;
  47        ShareProjectResponse share_project_response = 24;
  48        UnshareProject unshare_project = 25;
  49        JoinProject join_project = 26;
  50        JoinProjectResponse join_project_response = 27;
  51        LeaveProject leave_project = 28;
  52        AddProjectCollaborator add_project_collaborator = 29;
  53        UpdateProjectCollaborator update_project_collaborator = 30;
  54        RemoveProjectCollaborator remove_project_collaborator = 31;
  55
  56        GetDefinition get_definition = 32;
  57        GetDefinitionResponse get_definition_response = 33;
  58        GetTypeDefinition get_type_definition = 34;
  59        GetTypeDefinitionResponse get_type_definition_response = 35;
  60
  61        GetReferences get_references = 36;
  62        GetReferencesResponse get_references_response = 37;
  63        GetDocumentHighlights get_document_highlights = 38;
  64        GetDocumentHighlightsResponse get_document_highlights_response = 39;
  65        GetProjectSymbols get_project_symbols = 40;
  66        GetProjectSymbolsResponse get_project_symbols_response = 41;
  67        OpenBufferForSymbol open_buffer_for_symbol = 42;
  68        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 43;
  69
  70        UpdateProject update_project = 44;
  71        UpdateWorktree update_worktree = 45;
  72
  73        CreateProjectEntry create_project_entry = 46;
  74        RenameProjectEntry rename_project_entry = 47;
  75        CopyProjectEntry copy_project_entry = 48;
  76        DeleteProjectEntry delete_project_entry = 49;
  77        ProjectEntryResponse project_entry_response = 50;
  78        ExpandProjectEntry expand_project_entry = 51;
  79        ExpandProjectEntryResponse expand_project_entry_response = 52;
  80
  81        UpdateDiagnosticSummary update_diagnostic_summary = 53;
  82        StartLanguageServer start_language_server = 54;
  83        UpdateLanguageServer update_language_server = 55;
  84
  85        OpenBufferById open_buffer_by_id = 56;
  86        OpenBufferByPath open_buffer_by_path = 57;
  87        OpenBufferResponse open_buffer_response = 58;
  88        CreateBufferForPeer create_buffer_for_peer = 59;
  89        UpdateBuffer update_buffer = 60;
  90        UpdateBufferFile update_buffer_file = 61;
  91        SaveBuffer save_buffer = 62;
  92        BufferSaved buffer_saved = 63;
  93        BufferReloaded buffer_reloaded = 64;
  94        ReloadBuffers reload_buffers = 65;
  95        ReloadBuffersResponse reload_buffers_response = 66;
  96        SynchronizeBuffers synchronize_buffers = 67;
  97        SynchronizeBuffersResponse synchronize_buffers_response = 68;
  98        FormatBuffers format_buffers = 69;
  99        FormatBuffersResponse format_buffers_response = 70;
 100        GetCompletions get_completions = 71;
 101        GetCompletionsResponse get_completions_response = 72;
 102        ResolveCompletionDocumentation resolve_completion_documentation = 73;
 103        ResolveCompletionDocumentationResponse resolve_completion_documentation_response = 74;
 104        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 75;
 105        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 76;
 106        GetCodeActions get_code_actions = 77;
 107        GetCodeActionsResponse get_code_actions_response = 78;
 108        GetHover get_hover = 79;
 109        GetHoverResponse get_hover_response = 80;
 110        ApplyCodeAction apply_code_action = 81;
 111        ApplyCodeActionResponse apply_code_action_response = 82;
 112        PrepareRename prepare_rename = 83;
 113        PrepareRenameResponse prepare_rename_response = 84;
 114        PerformRename perform_rename = 85;
 115        PerformRenameResponse perform_rename_response = 86;
 116        SearchProject search_project = 87;
 117        SearchProjectResponse search_project_response = 88;
 118
 119        UpdateContacts update_contacts = 89;
 120        UpdateInviteInfo update_invite_info = 90;
 121        ShowContacts show_contacts = 91;
 122
 123        GetUsers get_users = 92;
 124        FuzzySearchUsers fuzzy_search_users = 93;
 125        UsersResponse users_response = 94;
 126        RequestContact request_contact = 95;
 127        RespondToContactRequest respond_to_contact_request = 96;
 128        RemoveContact remove_contact = 97;
 129
 130        Follow follow = 98;
 131        FollowResponse follow_response = 99;
 132        UpdateFollowers update_followers = 100;
 133        Unfollow unfollow = 101;
 134        GetPrivateUserInfo get_private_user_info = 102;
 135        GetPrivateUserInfoResponse get_private_user_info_response = 103;
 136        UpdateDiffBase update_diff_base = 104;
 137
 138        OnTypeFormatting on_type_formatting = 105;
 139        OnTypeFormattingResponse on_type_formatting_response = 106;
 140
 141        UpdateWorktreeSettings update_worktree_settings = 107;
 142
 143        InlayHints inlay_hints = 108;
 144        InlayHintsResponse inlay_hints_response = 109;
 145        ResolveInlayHint resolve_inlay_hint = 110;
 146        ResolveInlayHintResponse resolve_inlay_hint_response = 111;
 147        RefreshInlayHints refresh_inlay_hints = 112;
 148
 149        CreateChannel create_channel = 113;
 150        CreateChannelResponse create_channel_response = 114;
 151        InviteChannelMember invite_channel_member = 115;
 152        RemoveChannelMember remove_channel_member = 116;
 153        RespondToChannelInvite respond_to_channel_invite = 117;
 154        UpdateChannels update_channels = 118;
 155        JoinChannel join_channel = 119;
 156        DeleteChannel delete_channel = 120;
 157        GetChannelMembers get_channel_members = 121;
 158        GetChannelMembersResponse get_channel_members_response = 122;
 159        SetChannelMemberRole set_channel_member_role = 123;
 160        RenameChannel rename_channel = 124;
 161        RenameChannelResponse rename_channel_response = 125;
 162
 163        JoinChannelBuffer join_channel_buffer = 126;
 164        JoinChannelBufferResponse join_channel_buffer_response = 127;
 165        UpdateChannelBuffer update_channel_buffer = 128;
 166        LeaveChannelBuffer leave_channel_buffer = 129;
 167        UpdateChannelBufferCollaborators update_channel_buffer_collaborators = 130;
 168        RejoinChannelBuffers rejoin_channel_buffers = 131;
 169        RejoinChannelBuffersResponse rejoin_channel_buffers_response = 132;
 170        AckBufferOperation ack_buffer_operation = 133;
 171
 172        JoinChannelChat join_channel_chat = 134;
 173        JoinChannelChatResponse join_channel_chat_response = 135;
 174        LeaveChannelChat leave_channel_chat = 136;
 175        SendChannelMessage send_channel_message = 137;
 176        SendChannelMessageResponse send_channel_message_response = 138;
 177        ChannelMessageSent channel_message_sent = 139;
 178        GetChannelMessages get_channel_messages = 140;
 179        GetChannelMessagesResponse get_channel_messages_response = 141;
 180        RemoveChannelMessage remove_channel_message = 142;
 181        AckChannelMessage ack_channel_message = 143;
 182        GetChannelMessagesById get_channel_messages_by_id = 144;
 183
 184        MoveChannel move_channel = 147;
 185        SetChannelVisibility set_channel_visibility = 148;
 186
 187        AddNotification add_notification = 149;
 188        GetNotifications get_notifications = 150;
 189        GetNotificationsResponse get_notifications_response = 151;
 190        DeleteNotification delete_notification = 152;
 191        MarkNotificationRead mark_notification_read = 153;
 192        LspExtExpandMacro lsp_ext_expand_macro = 154;
 193        LspExtExpandMacroResponse lsp_ext_expand_macro_response = 155;
 194        SetRoomParticipantRole set_room_participant_role = 156;
 195
 196        UpdateUserChannels update_user_channels = 157;
 197
 198        GetImplementation get_implementation = 162;
 199        GetImplementationResponse get_implementation_response = 163;
 200
 201        JoinHostedProject join_hosted_project = 164;
 202
 203        CompleteWithLanguageModel complete_with_language_model = 166;
 204        LanguageModelResponse language_model_response = 167;
 205        CountTokensWithLanguageModel count_tokens_with_language_model = 168;
 206        CountTokensResponse count_tokens_response = 169;
 207        GetCachedEmbeddings get_cached_embeddings = 189;
 208        GetCachedEmbeddingsResponse get_cached_embeddings_response = 190;
 209        ComputeEmbeddings compute_embeddings = 191;
 210        ComputeEmbeddingsResponse compute_embeddings_response = 192;
 211
 212        UpdateChannelMessage update_channel_message = 170;
 213        ChannelMessageUpdate channel_message_update = 171;
 214
 215        BlameBuffer blame_buffer = 172;
 216        BlameBufferResponse blame_buffer_response = 173;
 217
 218        UpdateNotification update_notification = 174;
 219
 220        MultiLspQuery multi_lsp_query = 175;
 221        MultiLspQueryResponse multi_lsp_query_response = 176;
 222
 223        CreateDevServerProject create_dev_server_project = 177;
 224        CreateDevServerProjectResponse create_dev_server_project_response = 188;
 225        CreateDevServer create_dev_server = 178;
 226        CreateDevServerResponse create_dev_server_response = 179;
 227        ShutdownDevServer shutdown_dev_server = 180;
 228        DevServerInstructions dev_server_instructions = 181;
 229        ReconnectDevServer reconnect_dev_server = 182;
 230        ReconnectDevServerResponse reconnect_dev_server_response = 183;
 231
 232        ShareDevServerProject share_dev_server_project = 184;
 233        JoinDevServerProject join_dev_server_project = 185;
 234        RejoinRemoteProjects rejoin_remote_projects = 186;
 235        RejoinRemoteProjectsResponse rejoin_remote_projects_response = 187;
 236
 237        DevServerProjectsUpdate dev_server_projects_update = 193;
 238        ValidateDevServerProjectRequest validate_dev_server_project_request = 194;
 239        DeleteDevServer delete_dev_server = 195;
 240        OpenNewBuffer open_new_buffer = 196;
 241        DeleteDevServerProject delete_dev_server_project = 197;
 242
 243        GetSupermavenApiKey get_supermaven_api_key = 198;
 244        GetSupermavenApiKeyResponse get_supermaven_api_key_response = 199;
 245
 246        RegenerateDevServerToken regenerate_dev_server_token = 200;
 247        RegenerateDevServerTokenResponse regenerate_dev_server_token_response = 201;
 248        RenameDevServer rename_dev_server = 202; // Current max
 249    }
 250
 251    reserved 158 to 161;
 252}
 253
 254// Messages
 255
 256message Hello {
 257    PeerId peer_id = 1;
 258}
 259
 260message Ping {}
 261
 262message Ack {}
 263
 264message Error {
 265    string message = 1;
 266    ErrorCode code = 2;
 267    repeated string tags = 3;
 268}
 269
 270enum ErrorCode {
 271    Internal = 0;
 272    NoSuchChannel = 1;
 273    Disconnected = 2;
 274    SignedOut = 3;
 275    UpgradeRequired = 4;
 276    Forbidden = 5;
 277    NeedsCla = 7;
 278    NotARootChannel = 8;
 279    BadPublicNesting = 9;
 280    CircularNesting = 10;
 281    WrongMoveTarget = 11;
 282    UnsharedItem = 12;
 283    NoSuchProject = 13;
 284    DevServerAlreadyOnline = 14;
 285    DevServerOffline = 15;
 286    DevServerProjectPathDoesNotExist = 16;
 287    RemoteUpgradeRequired = 17;
 288    reserved 6;
 289}
 290
 291message EndStream {}
 292
 293message Test {
 294    uint64 id = 1;
 295}
 296
 297message CreateRoom {}
 298
 299message CreateRoomResponse {
 300    Room room = 1;
 301    optional LiveKitConnectionInfo live_kit_connection_info = 2;
 302}
 303
 304message JoinRoom {
 305    uint64 id = 1;
 306}
 307
 308message JoinRoomResponse {
 309    Room room = 1;
 310    optional uint64 channel_id = 2;
 311    optional LiveKitConnectionInfo live_kit_connection_info = 3;
 312}
 313
 314message RejoinRoom {
 315    uint64 id = 1;
 316    repeated UpdateProject reshared_projects = 2;
 317    repeated RejoinProject rejoined_projects = 3;
 318}
 319message RejoinRemoteProjects {
 320    repeated RejoinProject rejoined_projects = 1;
 321}
 322
 323message RejoinRemoteProjectsResponse {
 324    repeated RejoinedProject rejoined_projects = 1;
 325}
 326
 327message RejoinProject {
 328    uint64 id = 1;
 329    repeated RejoinWorktree worktrees = 2;
 330}
 331
 332message RejoinWorktree {
 333    uint64 id = 1;
 334    uint64 scan_id = 2;
 335}
 336
 337message RejoinRoomResponse {
 338    Room room = 1;
 339    repeated ResharedProject reshared_projects = 2;
 340    repeated RejoinedProject rejoined_projects = 3;
 341}
 342
 343message ResharedProject {
 344    uint64 id = 1;
 345    repeated Collaborator collaborators = 2;
 346}
 347
 348message RejoinedProject {
 349    uint64 id = 1;
 350    repeated WorktreeMetadata worktrees = 2;
 351    repeated Collaborator collaborators = 3;
 352    repeated LanguageServer language_servers = 4;
 353}
 354
 355message LeaveRoom {}
 356
 357message Room {
 358    uint64 id = 1;
 359    repeated Participant participants = 2;
 360    repeated PendingParticipant pending_participants = 3;
 361    repeated Follower followers = 4;
 362    string live_kit_room = 5;
 363}
 364
 365message Participant {
 366    uint64 user_id = 1;
 367    PeerId peer_id = 2;
 368    repeated ParticipantProject projects = 3;
 369    ParticipantLocation location = 4;
 370    uint32 participant_index = 5;
 371    ChannelRole role = 6;
 372    reserved 7;
 373}
 374
 375message PendingParticipant {
 376    uint64 user_id = 1;
 377    uint64 calling_user_id = 2;
 378    optional uint64 initial_project_id = 3;
 379}
 380
 381message ParticipantProject {
 382    uint64 id = 1;
 383    repeated string worktree_root_names = 2;
 384}
 385
 386message Follower {
 387    PeerId leader_id = 1;
 388    PeerId follower_id = 2;
 389    uint64 project_id = 3;
 390}
 391
 392message ParticipantLocation {
 393    oneof variant {
 394        SharedProject shared_project = 1;
 395        UnsharedProject unshared_project = 2;
 396        External external = 3;
 397    }
 398
 399    message SharedProject {
 400        uint64 id = 1;
 401    }
 402
 403    message UnsharedProject {}
 404
 405    message External {}
 406}
 407
 408message Call {
 409    uint64 room_id = 1;
 410    uint64 called_user_id = 2;
 411    optional uint64 initial_project_id = 3;
 412}
 413
 414message IncomingCall {
 415    uint64 room_id = 1;
 416    uint64 calling_user_id = 2;
 417    repeated uint64 participant_user_ids = 3;
 418    optional ParticipantProject initial_project = 4;
 419}
 420
 421message CallCanceled {
 422    uint64 room_id = 1;
 423}
 424
 425message CancelCall {
 426    uint64 room_id = 1;
 427    uint64 called_user_id = 2;
 428}
 429
 430message DeclineCall {
 431    uint64 room_id = 1;
 432}
 433
 434message UpdateParticipantLocation {
 435    uint64 room_id = 1;
 436    ParticipantLocation location = 2;
 437}
 438
 439message RoomUpdated {
 440    Room room = 1;
 441}
 442
 443message LiveKitConnectionInfo {
 444    string server_url = 1;
 445    string token = 2;
 446    bool can_publish = 3;
 447}
 448
 449message ShareProject {
 450    uint64 room_id = 1;
 451    repeated WorktreeMetadata worktrees = 2;
 452    optional uint64 dev_server_project_id = 3;
 453}
 454
 455message ShareProjectResponse {
 456    uint64 project_id = 1;
 457}
 458
 459message UnshareProject {
 460    uint64 project_id = 1;
 461}
 462
 463message UpdateProject {
 464    uint64 project_id = 1;
 465    repeated WorktreeMetadata worktrees = 2;
 466}
 467
 468message JoinProject {
 469    uint64 project_id = 1;
 470}
 471
 472message JoinHostedProject {
 473    uint64 project_id = 1;
 474}
 475
 476message CreateDevServerProject {
 477    reserved 1;
 478    reserved 2;
 479    uint64 dev_server_id = 3;
 480    string path = 4;
 481}
 482message CreateDevServerProjectResponse {
 483    DevServerProject dev_server_project = 1;
 484}
 485
 486message ValidateDevServerProjectRequest {
 487    string path = 1;
 488}
 489
 490message CreateDevServer {
 491    reserved 1;
 492    string name = 2;
 493}
 494
 495message RegenerateDevServerToken {
 496    uint64 dev_server_id = 1;
 497}
 498
 499message RegenerateDevServerTokenResponse {
 500    uint64 dev_server_id = 1;
 501    string access_token = 2;
 502}
 503
 504message CreateDevServerResponse {
 505    uint64 dev_server_id = 1;
 506    reserved 2;
 507    string access_token = 3;
 508    string name = 4;
 509}
 510
 511message ShutdownDevServer {
 512}
 513
 514message RenameDevServer {
 515    uint64 dev_server_id = 1;
 516    string name = 2;
 517}
 518
 519message DeleteDevServer {
 520    uint64 dev_server_id = 1;
 521}
 522
 523message DeleteDevServerProject {
 524    uint64 dev_server_project_id = 1;
 525}
 526
 527message ReconnectDevServer {
 528    repeated UpdateProject reshared_projects = 1;
 529}
 530
 531message ReconnectDevServerResponse {
 532    repeated ResharedProject reshared_projects = 1;
 533}
 534
 535message DevServerInstructions {
 536    repeated DevServerProject projects = 1;
 537}
 538
 539message DevServerProjectsUpdate {
 540    repeated DevServer dev_servers = 1;
 541    repeated DevServerProject dev_server_projects = 2;
 542}
 543
 544message ShareDevServerProject {
 545    uint64 dev_server_project_id = 1;
 546    repeated WorktreeMetadata worktrees = 2;
 547}
 548
 549message JoinDevServerProject {
 550    uint64 dev_server_project_id = 1;
 551}
 552
 553message JoinProjectResponse {
 554    uint64 project_id = 5;
 555    uint32 replica_id = 1;
 556    repeated WorktreeMetadata worktrees = 2;
 557    repeated Collaborator collaborators = 3;
 558    repeated LanguageServer language_servers = 4;
 559    ChannelRole role = 6;
 560    optional uint64 dev_server_project_id = 7;
 561}
 562
 563message LeaveProject {
 564    uint64 project_id = 1;
 565}
 566
 567message UpdateWorktree {
 568    uint64 project_id = 1;
 569    uint64 worktree_id = 2;
 570    string root_name = 3;
 571    repeated Entry updated_entries = 4;
 572    repeated uint64 removed_entries = 5;
 573    repeated RepositoryEntry updated_repositories = 6;
 574    repeated uint64 removed_repositories = 7;
 575    uint64 scan_id = 8;
 576    bool is_last_update = 9;
 577    string abs_path = 10;
 578}
 579
 580message UpdateWorktreeSettings {
 581    uint64 project_id = 1;
 582    uint64 worktree_id = 2;
 583    string path = 3;
 584    optional string content = 4;
 585}
 586
 587message CreateProjectEntry {
 588    uint64 project_id = 1;
 589    uint64 worktree_id = 2;
 590    string path = 3;
 591    bool is_directory = 4;
 592}
 593
 594message RenameProjectEntry {
 595    uint64 project_id = 1;
 596    uint64 entry_id = 2;
 597    string new_path = 3;
 598}
 599
 600message CopyProjectEntry {
 601    uint64 project_id = 1;
 602    uint64 entry_id = 2;
 603    string new_path = 3;
 604}
 605
 606message DeleteProjectEntry {
 607    uint64 project_id = 1;
 608    uint64 entry_id = 2;
 609    bool use_trash = 3;
 610}
 611
 612message ExpandProjectEntry {
 613    uint64 project_id = 1;
 614    uint64 entry_id = 2;
 615}
 616
 617message ExpandProjectEntryResponse {
 618    uint64 worktree_scan_id = 1;
 619}
 620
 621message ProjectEntryResponse {
 622    optional Entry entry = 1;
 623    uint64 worktree_scan_id = 2;
 624}
 625
 626message AddProjectCollaborator {
 627    uint64 project_id = 1;
 628    Collaborator collaborator = 2;
 629}
 630
 631message UpdateProjectCollaborator {
 632    uint64 project_id = 1;
 633    PeerId old_peer_id = 2;
 634    PeerId new_peer_id = 3;
 635}
 636
 637message RemoveProjectCollaborator {
 638    uint64 project_id = 1;
 639    PeerId peer_id = 2;
 640}
 641
 642message UpdateChannelBufferCollaborators {
 643    uint64 channel_id = 1;
 644    repeated Collaborator collaborators = 2;
 645}
 646
 647message GetDefinition {
 648     uint64 project_id = 1;
 649     uint64 buffer_id = 2;
 650     Anchor position = 3;
 651     repeated VectorClockEntry version = 4;
 652 }
 653
 654message GetDefinitionResponse {
 655    repeated LocationLink links = 1;
 656}
 657
 658message GetTypeDefinition {
 659     uint64 project_id = 1;
 660     uint64 buffer_id = 2;
 661     Anchor position = 3;
 662     repeated VectorClockEntry version = 4;
 663 }
 664
 665message GetTypeDefinitionResponse {
 666    repeated LocationLink links = 1;
 667}
 668message GetImplementation {
 669     uint64 project_id = 1;
 670     uint64 buffer_id = 2;
 671     Anchor position = 3;
 672     repeated VectorClockEntry version = 4;
 673 }
 674
 675message GetImplementationResponse {
 676    repeated LocationLink links = 1;
 677}
 678
 679message GetReferences {
 680     uint64 project_id = 1;
 681     uint64 buffer_id = 2;
 682     Anchor position = 3;
 683     repeated VectorClockEntry version = 4;
 684 }
 685
 686message GetReferencesResponse {
 687    repeated Location locations = 1;
 688}
 689
 690message GetDocumentHighlights {
 691     uint64 project_id = 1;
 692     uint64 buffer_id = 2;
 693     Anchor position = 3;
 694     repeated VectorClockEntry version = 4;
 695 }
 696
 697message GetDocumentHighlightsResponse {
 698    repeated DocumentHighlight highlights = 1;
 699}
 700
 701message Location {
 702    uint64 buffer_id = 1;
 703    Anchor start = 2;
 704    Anchor end = 3;
 705}
 706
 707message LocationLink {
 708    optional Location origin = 1;
 709    Location target = 2;
 710}
 711
 712message DocumentHighlight {
 713    Kind kind = 1;
 714    Anchor start = 2;
 715    Anchor end = 3;
 716
 717    enum Kind {
 718        Text = 0;
 719        Read = 1;
 720        Write = 2;
 721    }
 722}
 723
 724message GetProjectSymbols {
 725    uint64 project_id = 1;
 726    string query = 2;
 727}
 728
 729message GetProjectSymbolsResponse {
 730    repeated Symbol symbols = 4;
 731}
 732
 733message Symbol {
 734    uint64 source_worktree_id = 1;
 735    uint64 worktree_id = 2;
 736    string language_server_name = 3;
 737    string name = 4;
 738    int32 kind = 5;
 739    string path = 6;
 740    // Cannot use generate anchors for unopened files,
 741    // so we are forced to use point coords instead
 742    PointUtf16 start = 7;
 743    PointUtf16 end = 8;
 744    bytes signature = 9;
 745}
 746
 747message OpenBufferForSymbol {
 748    uint64 project_id = 1;
 749    Symbol symbol = 2;
 750}
 751
 752message OpenBufferForSymbolResponse {
 753    uint64 buffer_id = 1;
 754}
 755
 756message OpenBufferByPath {
 757    uint64 project_id = 1;
 758    uint64 worktree_id = 2;
 759    string path = 3;
 760}
 761
 762message OpenBufferById {
 763    uint64 project_id = 1;
 764    uint64 id = 2;
 765}
 766
 767message OpenNewBuffer {
 768    uint64 project_id = 1;
 769}
 770
 771message OpenBufferResponse {
 772    uint64 buffer_id = 1;
 773}
 774
 775message CreateBufferForPeer {
 776    uint64 project_id = 1;
 777    PeerId peer_id = 2;
 778    oneof variant {
 779        BufferState state = 3;
 780        BufferChunk chunk = 4;
 781    }
 782}
 783
 784message UpdateBuffer {
 785    uint64 project_id = 1;
 786    uint64 buffer_id = 2;
 787    repeated Operation operations = 3;
 788}
 789
 790message UpdateChannelBuffer {
 791    uint64 channel_id = 1;
 792    repeated Operation operations = 2;
 793}
 794
 795message UpdateBufferFile {
 796    uint64 project_id = 1;
 797    uint64 buffer_id = 2;
 798    File file = 3;
 799}
 800
 801message SaveBuffer {
 802    uint64 project_id = 1;
 803    uint64 buffer_id = 2;
 804    repeated VectorClockEntry version = 3;
 805    optional ProjectPath new_path = 4;
 806}
 807
 808message ProjectPath {
 809    uint64 worktree_id = 1;
 810    string path = 2;
 811}
 812
 813message BufferSaved {
 814    uint64 project_id = 1;
 815    uint64 buffer_id = 2;
 816    repeated VectorClockEntry version = 3;
 817    Timestamp mtime = 4;
 818    reserved 5;
 819}
 820
 821message BufferReloaded {
 822    uint64 project_id = 1;
 823    uint64 buffer_id = 2;
 824    repeated VectorClockEntry version = 3;
 825    Timestamp mtime = 4;
 826    reserved 5;
 827    LineEnding line_ending = 6;
 828}
 829
 830message ReloadBuffers {
 831    uint64 project_id = 1;
 832    repeated uint64 buffer_ids = 2;
 833}
 834
 835message ReloadBuffersResponse {
 836    ProjectTransaction transaction = 1;
 837}
 838
 839message SynchronizeBuffers {
 840    uint64 project_id = 1;
 841    repeated BufferVersion buffers = 2;
 842}
 843
 844message SynchronizeBuffersResponse {
 845    repeated BufferVersion buffers = 1;
 846}
 847
 848message BufferVersion {
 849    uint64 id = 1;
 850    repeated VectorClockEntry version = 2;
 851}
 852
 853message ChannelBufferVersion {
 854    uint64 channel_id = 1;
 855    repeated VectorClockEntry version = 2;
 856    uint64 epoch = 3;
 857}
 858
 859enum FormatTrigger {
 860    Save = 0;
 861    Manual = 1;
 862}
 863
 864message FormatBuffers {
 865    uint64 project_id = 1;
 866    FormatTrigger trigger = 2;
 867    repeated uint64 buffer_ids = 3;
 868}
 869
 870message FormatBuffersResponse {
 871    ProjectTransaction transaction = 1;
 872}
 873
 874message GetCompletions {
 875    uint64 project_id = 1;
 876    uint64 buffer_id = 2;
 877    Anchor position = 3;
 878    repeated VectorClockEntry version = 4;
 879}
 880
 881message GetCompletionsResponse {
 882    repeated Completion completions = 1;
 883    repeated VectorClockEntry version = 2;
 884}
 885
 886message ApplyCompletionAdditionalEdits {
 887    uint64 project_id = 1;
 888    uint64 buffer_id = 2;
 889    Completion completion = 3;
 890}
 891
 892message ApplyCompletionAdditionalEditsResponse {
 893    Transaction transaction = 1;
 894}
 895
 896message Completion {
 897    Anchor old_start = 1;
 898    Anchor old_end = 2;
 899    string new_text = 3;
 900    uint64 server_id = 4;
 901    bytes lsp_completion = 5;
 902}
 903
 904message GetCodeActions {
 905    uint64 project_id = 1;
 906    uint64 buffer_id = 2;
 907    Anchor start = 3;
 908    Anchor end = 4;
 909    repeated VectorClockEntry version = 5;
 910}
 911
 912message GetCodeActionsResponse {
 913    repeated CodeAction actions = 1;
 914    repeated VectorClockEntry version = 2;
 915}
 916
 917message GetHover {
 918    uint64 project_id = 1;
 919    uint64 buffer_id = 2;
 920    Anchor position = 3;
 921    repeated VectorClockEntry version = 5;
 922}
 923
 924message GetHoverResponse {
 925    optional Anchor start = 1;
 926    optional Anchor end = 2;
 927    repeated HoverBlock contents = 3;
 928}
 929
 930message HoverBlock {
 931    string text = 1;
 932    optional string language = 2;
 933    bool is_markdown = 3;
 934}
 935
 936message ApplyCodeAction {
 937    uint64 project_id = 1;
 938    uint64 buffer_id = 2;
 939    CodeAction action = 3;
 940}
 941
 942message ApplyCodeActionResponse {
 943    ProjectTransaction transaction = 1;
 944}
 945
 946message PrepareRename {
 947    uint64 project_id = 1;
 948    uint64 buffer_id = 2;
 949    Anchor position = 3;
 950    repeated VectorClockEntry version = 4;
 951}
 952
 953message PrepareRenameResponse {
 954    bool can_rename = 1;
 955    Anchor start = 2;
 956    Anchor end = 3;
 957    repeated VectorClockEntry version = 4;
 958}
 959
 960message PerformRename {
 961    uint64 project_id = 1;
 962    uint64 buffer_id = 2;
 963    Anchor position = 3;
 964    string new_name = 4;
 965    repeated VectorClockEntry version = 5;
 966}
 967
 968message OnTypeFormatting {
 969    uint64 project_id = 1;
 970    uint64 buffer_id = 2;
 971    Anchor position = 3;
 972    string trigger = 4;
 973    repeated VectorClockEntry version = 5;
 974}
 975
 976message OnTypeFormattingResponse {
 977    Transaction transaction = 1;
 978}
 979
 980message InlayHints {
 981    uint64 project_id = 1;
 982    uint64 buffer_id = 2;
 983    Anchor start = 3;
 984    Anchor end = 4;
 985    repeated VectorClockEntry version = 5;
 986}
 987
 988message InlayHintsResponse {
 989    repeated InlayHint hints = 1;
 990    repeated VectorClockEntry version = 2;
 991}
 992
 993message InlayHint {
 994    Anchor position = 1;
 995    InlayHintLabel label = 2;
 996    optional string kind = 3;
 997    bool padding_left = 4;
 998    bool padding_right = 5;
 999    InlayHintTooltip tooltip = 6;
1000    ResolveState resolve_state = 7;
1001}
1002
1003message InlayHintLabel {
1004    oneof label {
1005        string value = 1;
1006        InlayHintLabelParts label_parts = 2;
1007    }
1008}
1009
1010message InlayHintLabelParts {
1011    repeated InlayHintLabelPart parts = 1;
1012}
1013
1014message InlayHintLabelPart {
1015    string value = 1;
1016    InlayHintLabelPartTooltip tooltip = 2;
1017    optional string location_url = 3;
1018    PointUtf16 location_range_start = 4;
1019    PointUtf16 location_range_end = 5;
1020    optional uint64 language_server_id = 6;
1021}
1022
1023message InlayHintTooltip {
1024    oneof content {
1025        string value = 1;
1026        MarkupContent markup_content = 2;
1027    }
1028}
1029
1030message InlayHintLabelPartTooltip {
1031    oneof content {
1032        string value = 1;
1033        MarkupContent markup_content = 2;
1034    }
1035}
1036
1037message ResolveState {
1038    State state = 1;
1039    LspResolveState lsp_resolve_state = 2;
1040
1041    enum State {
1042        Resolved = 0;
1043        CanResolve = 1;
1044        Resolving = 2;
1045    }
1046
1047    message LspResolveState {
1048        string value = 1;
1049        uint64 server_id = 2;
1050    }
1051}
1052
1053// This type is used to resolve more than just
1054// the documentation, but for backwards-compatibility
1055// reasons we can't rename the type.
1056message ResolveCompletionDocumentation {
1057    uint64 project_id = 1;
1058    uint64 language_server_id = 2;
1059    bytes lsp_completion = 3;
1060    uint64 buffer_id = 4;
1061}
1062
1063message ResolveCompletionDocumentationResponse {
1064    string documentation = 1;
1065    bool documentation_is_markdown = 2;
1066    Anchor old_start = 3;
1067    Anchor old_end = 4;
1068    string new_text = 5;
1069}
1070
1071message ResolveInlayHint {
1072    uint64 project_id = 1;
1073    uint64 buffer_id = 2;
1074    uint64 language_server_id = 3;
1075    InlayHint hint = 4;
1076}
1077
1078message ResolveInlayHintResponse {
1079    InlayHint hint = 1;
1080}
1081
1082message RefreshInlayHints {
1083    uint64 project_id = 1;
1084}
1085
1086message MarkupContent {
1087    bool is_markdown = 1;
1088    string value = 2;
1089}
1090
1091message PerformRenameResponse {
1092    ProjectTransaction transaction = 2;
1093}
1094
1095message SearchProject {
1096    uint64 project_id = 1;
1097    string query = 2;
1098    bool regex = 3;
1099    bool whole_word = 4;
1100    bool case_sensitive = 5;
1101    string files_to_include = 6;
1102    string files_to_exclude = 7;
1103    bool include_ignored = 8;
1104}
1105
1106message SearchProjectResponse {
1107    repeated Location locations = 1;
1108    bool limit_reached = 2;
1109}
1110
1111message CodeAction {
1112    uint64 server_id = 1;
1113    Anchor start = 2;
1114    Anchor end = 3;
1115    bytes lsp_action = 4;
1116}
1117
1118message ProjectTransaction {
1119    repeated uint64 buffer_ids = 1;
1120    repeated Transaction transactions = 2;
1121}
1122
1123message Transaction {
1124    LamportTimestamp id = 1;
1125    repeated LamportTimestamp edit_ids = 2;
1126    repeated VectorClockEntry start = 3;
1127}
1128
1129message LamportTimestamp {
1130    uint32 replica_id = 1;
1131    uint32 value = 2;
1132}
1133
1134message LanguageServer {
1135    uint64 id = 1;
1136    string name = 2;
1137}
1138
1139message StartLanguageServer {
1140    uint64 project_id = 1;
1141    LanguageServer server = 2;
1142}
1143
1144message UpdateDiagnosticSummary {
1145    uint64 project_id = 1;
1146    uint64 worktree_id = 2;
1147    DiagnosticSummary summary = 3;
1148}
1149
1150message DiagnosticSummary {
1151    string path = 1;
1152    uint64 language_server_id = 2;
1153    uint32 error_count = 3;
1154    uint32 warning_count = 4;
1155}
1156
1157message UpdateLanguageServer {
1158    uint64 project_id = 1;
1159    uint64 language_server_id = 2;
1160    oneof variant {
1161        LspWorkStart work_start = 3;
1162        LspWorkProgress work_progress = 4;
1163        LspWorkEnd work_end = 5;
1164        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
1165        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
1166    }
1167}
1168
1169message LspWorkStart {
1170    string token = 1;
1171    optional string message = 2;
1172    optional uint32 percentage = 3;
1173}
1174
1175message LspWorkProgress {
1176    string token = 1;
1177    optional string message = 2;
1178    optional uint32 percentage = 3;
1179}
1180
1181message LspWorkEnd {
1182    string token = 1;
1183}
1184
1185message LspDiskBasedDiagnosticsUpdating {}
1186
1187message LspDiskBasedDiagnosticsUpdated {}
1188
1189message UpdateChannels {
1190    repeated Channel channels = 1;
1191    repeated uint64 delete_channels = 4;
1192    repeated Channel channel_invitations = 5;
1193    repeated uint64 remove_channel_invitations = 6;
1194    repeated ChannelParticipants channel_participants = 7;
1195    repeated ChannelMessageId latest_channel_message_ids = 8;
1196    repeated ChannelBufferVersion latest_channel_buffer_versions = 9;
1197
1198    repeated HostedProject hosted_projects = 10;
1199    repeated uint64 deleted_hosted_projects = 11;
1200
1201    reserved 12;
1202    reserved 13;
1203    reserved 14;
1204    reserved 15;
1205}
1206
1207message UpdateUserChannels {
1208    repeated ChannelMessageId observed_channel_message_id = 1;
1209    repeated ChannelBufferVersion observed_channel_buffer_version = 2;
1210    repeated ChannelMembership channel_memberships = 3;
1211}
1212
1213message ChannelMembership {
1214    uint64 channel_id = 1;
1215    ChannelRole role = 2;
1216}
1217
1218message ChannelMessageId {
1219    uint64 channel_id = 1;
1220    uint64 message_id = 2;
1221}
1222
1223message ChannelPermission {
1224    uint64 channel_id = 1;
1225    ChannelRole role = 3;
1226}
1227
1228message ChannelParticipants {
1229    uint64 channel_id = 1;
1230    repeated uint64 participant_user_ids = 2;
1231}
1232
1233message HostedProject {
1234    uint64 project_id = 1;
1235    uint64 channel_id = 2;
1236    string name = 3;
1237    ChannelVisibility visibility = 4;
1238}
1239
1240message DevServerProject {
1241    uint64 id = 1;
1242    optional uint64 project_id = 2;
1243    reserved 3;
1244    reserved 4;
1245    uint64 dev_server_id = 5;
1246    string path = 6;
1247}
1248
1249message DevServer {
1250    reserved 1;
1251    uint64 dev_server_id = 2;
1252    string name = 3;
1253    DevServerStatus status = 4;
1254}
1255
1256enum DevServerStatus {
1257    Offline = 0;
1258    Online = 1;
1259}
1260
1261message JoinChannel {
1262    uint64 channel_id = 1;
1263}
1264
1265message DeleteChannel {
1266    uint64 channel_id = 1;
1267}
1268
1269message GetChannelMembers {
1270    uint64 channel_id = 1;
1271}
1272
1273message GetChannelMembersResponse {
1274    repeated ChannelMember members = 1;
1275}
1276
1277message ChannelMember {
1278    uint64 user_id = 1;
1279    Kind kind = 3;
1280    ChannelRole role = 4;
1281
1282    enum Kind {
1283        Member = 0;
1284        Invitee = 1;
1285    }
1286}
1287
1288message CreateChannel {
1289    string name = 1;
1290    optional uint64 parent_id = 2;
1291}
1292
1293message CreateChannelResponse {
1294    Channel channel = 1;
1295    optional uint64 parent_id = 2;
1296}
1297
1298message InviteChannelMember {
1299    uint64 channel_id = 1;
1300    uint64 user_id = 2;
1301    ChannelRole role = 4;
1302}
1303
1304message RemoveChannelMember {
1305    uint64 channel_id = 1;
1306    uint64 user_id = 2;
1307}
1308
1309enum ChannelRole {
1310    Admin = 0;
1311    Member = 1;
1312    Guest = 2;
1313    Banned = 3;
1314    Talker = 4;
1315}
1316
1317message SetChannelMemberRole {
1318    uint64 channel_id = 1;
1319    uint64 user_id = 2;
1320    ChannelRole role = 3;
1321}
1322
1323message SetChannelVisibility {
1324    uint64 channel_id = 1;
1325    ChannelVisibility visibility = 2;
1326}
1327
1328message RenameChannel {
1329    uint64 channel_id = 1;
1330    string name = 2;
1331}
1332
1333message RenameChannelResponse {
1334    Channel channel = 1;
1335}
1336
1337message JoinChannelChat {
1338    uint64 channel_id = 1;
1339}
1340
1341message JoinChannelChatResponse {
1342    repeated ChannelMessage messages = 1;
1343    bool done = 2;
1344}
1345
1346message LeaveChannelChat {
1347    uint64 channel_id = 1;
1348}
1349
1350message SendChannelMessage {
1351    uint64 channel_id = 1;
1352    string body = 2;
1353    Nonce nonce = 3;
1354    repeated ChatMention mentions = 4;
1355    optional uint64 reply_to_message_id = 5;
1356}
1357
1358message RemoveChannelMessage {
1359    uint64 channel_id = 1;
1360    uint64 message_id = 2;
1361}
1362
1363message UpdateChannelMessage {
1364    uint64 channel_id = 1;
1365    uint64 message_id = 2;
1366    Nonce nonce = 4;
1367    string body = 5;
1368    repeated ChatMention mentions = 6;
1369}
1370
1371message AckChannelMessage {
1372    uint64 channel_id = 1;
1373    uint64 message_id = 2;
1374}
1375
1376message SendChannelMessageResponse {
1377    ChannelMessage message = 1;
1378}
1379
1380message ChannelMessageSent {
1381    uint64 channel_id = 1;
1382    ChannelMessage message = 2;
1383}
1384
1385message ChannelMessageUpdate {
1386    uint64 channel_id = 1;
1387    ChannelMessage message = 2;
1388}
1389
1390message GetChannelMessages {
1391    uint64 channel_id = 1;
1392    uint64 before_message_id = 2;
1393}
1394
1395message GetChannelMessagesResponse {
1396    repeated ChannelMessage messages = 1;
1397    bool done = 2;
1398}
1399
1400message GetChannelMessagesById {
1401    repeated uint64 message_ids = 1;
1402}
1403
1404message MoveChannel {
1405    uint64 channel_id = 1;
1406    uint64 to = 2;
1407}
1408
1409message JoinChannelBuffer {
1410    uint64 channel_id = 1;
1411}
1412
1413message ChannelMessage {
1414    uint64 id = 1;
1415    string body = 2;
1416    uint64 timestamp = 3;
1417    uint64 sender_id = 4;
1418    Nonce nonce = 5;
1419    repeated ChatMention mentions = 6;
1420    optional uint64 reply_to_message_id = 7;
1421    optional uint64 edited_at = 8;
1422}
1423
1424message ChatMention {
1425    Range range = 1;
1426    uint64 user_id = 2;
1427}
1428
1429message RejoinChannelBuffers {
1430    repeated ChannelBufferVersion buffers = 1;
1431}
1432
1433message RejoinChannelBuffersResponse {
1434    repeated RejoinedChannelBuffer buffers = 1;
1435}
1436
1437message AckBufferOperation {
1438    uint64 buffer_id = 1;
1439    uint64 epoch = 2;
1440    repeated VectorClockEntry version = 3;
1441}
1442
1443message JoinChannelBufferResponse {
1444    uint64 buffer_id = 1;
1445    uint32 replica_id = 2;
1446    string base_text = 3;
1447    repeated Operation operations = 4;
1448    repeated Collaborator collaborators = 5;
1449    uint64 epoch = 6;
1450}
1451
1452message RejoinedChannelBuffer {
1453    uint64 channel_id = 1;
1454    repeated VectorClockEntry version = 2;
1455    repeated Operation operations = 3;
1456    repeated Collaborator collaborators = 4;
1457}
1458
1459message LeaveChannelBuffer {
1460    uint64 channel_id = 1;
1461}
1462
1463message RespondToChannelInvite {
1464    uint64 channel_id = 1;
1465    bool accept = 2;
1466}
1467
1468message GetUsers {
1469    repeated uint64 user_ids = 1;
1470}
1471
1472message FuzzySearchUsers {
1473    string query = 1;
1474}
1475
1476message UsersResponse {
1477    repeated User users = 1;
1478}
1479
1480message RequestContact {
1481    uint64 responder_id = 1;
1482}
1483
1484message RemoveContact {
1485    uint64 user_id = 1;
1486}
1487
1488message RespondToContactRequest {
1489    uint64 requester_id = 1;
1490    ContactRequestResponse response = 2;
1491}
1492
1493enum ContactRequestResponse {
1494    Accept = 0;
1495    Decline = 1;
1496    Block = 2;
1497    Dismiss = 3;
1498}
1499
1500message UpdateContacts {
1501    repeated Contact contacts = 1;
1502    repeated uint64 remove_contacts = 2;
1503    repeated IncomingContactRequest incoming_requests = 3;
1504    repeated uint64 remove_incoming_requests = 4;
1505    repeated uint64 outgoing_requests = 5;
1506    repeated uint64 remove_outgoing_requests = 6;
1507}
1508
1509message UpdateInviteInfo {
1510    string url = 1;
1511    uint32 count = 2;
1512}
1513
1514message ShowContacts {}
1515
1516message IncomingContactRequest {
1517    uint64 requester_id = 1;
1518}
1519
1520message UpdateDiagnostics {
1521    uint32 replica_id = 1;
1522    uint32 lamport_timestamp = 2;
1523    uint64 server_id = 3;
1524    repeated Diagnostic diagnostics = 4;
1525}
1526
1527message Follow {
1528    uint64 room_id = 1;
1529    optional uint64 project_id = 2;
1530    PeerId leader_id = 3;
1531}
1532
1533message FollowResponse {
1534    View active_view = 3;
1535    // TODO: after 0.124.0 is retired, remove these.
1536    optional ViewId active_view_id = 1;
1537    repeated View views = 2;
1538}
1539
1540message UpdateFollowers {
1541    uint64 room_id = 1;
1542    optional uint64 project_id = 2;
1543    reserved 3;
1544    oneof variant {
1545        View create_view = 5;
1546        // TODO: after 0.124.0 is retired, remove these.
1547        UpdateActiveView update_active_view = 4;
1548        UpdateView update_view = 6;
1549    }
1550}
1551
1552message Unfollow {
1553    uint64 room_id = 1;
1554    optional uint64 project_id = 2;
1555    PeerId leader_id = 3;
1556}
1557
1558message GetPrivateUserInfo {}
1559
1560message GetPrivateUserInfoResponse {
1561    string metrics_id = 1;
1562    bool staff = 2;
1563    repeated string flags = 3;
1564}
1565
1566// Entities
1567
1568message ViewId {
1569    PeerId creator = 1;
1570    uint64 id = 2;
1571}
1572
1573message UpdateActiveView {
1574    optional ViewId id = 1;
1575    optional PeerId leader_id = 2;
1576    View view = 3;
1577}
1578
1579message UpdateView {
1580    ViewId id = 1;
1581    optional PeerId leader_id = 2;
1582
1583    oneof variant {
1584        Editor editor = 3;
1585    }
1586
1587    message Editor {
1588        repeated ExcerptInsertion inserted_excerpts = 1;
1589        repeated uint64 deleted_excerpts = 2;
1590        repeated Selection selections = 3;
1591        optional Selection pending_selection = 4;
1592        EditorAnchor scroll_top_anchor = 5;
1593        float scroll_x = 6;
1594        float scroll_y = 7;
1595    }
1596}
1597
1598message View {
1599    ViewId id = 1;
1600    optional PeerId leader_id = 2;
1601
1602    oneof variant {
1603        Editor editor = 3;
1604        ChannelView channel_view = 4;
1605    }
1606
1607    message Editor {
1608        bool singleton = 1;
1609        optional string title = 2;
1610        repeated Excerpt excerpts = 3;
1611        repeated Selection selections = 4;
1612        optional Selection pending_selection = 5;
1613        EditorAnchor scroll_top_anchor = 6;
1614        float scroll_x = 7;
1615        float scroll_y = 8;
1616    }
1617
1618    message ChannelView {
1619        uint64 channel_id = 1;
1620        Editor editor = 2;
1621    }
1622}
1623
1624message Collaborator {
1625    PeerId peer_id = 1;
1626    uint32 replica_id = 2;
1627    uint64 user_id = 3;
1628}
1629
1630message User {
1631    uint64 id = 1;
1632    string github_login = 2;
1633    string avatar_url = 3;
1634}
1635
1636message File {
1637    uint64 worktree_id = 1;
1638    optional uint64 entry_id = 2;
1639    string path = 3;
1640    Timestamp mtime = 4;
1641    bool is_deleted = 5;
1642}
1643
1644message Entry {
1645    uint64 id = 1;
1646    bool is_dir = 2;
1647    string path = 3;
1648    uint64 inode = 4;
1649    Timestamp mtime = 5;
1650    bool is_symlink = 6;
1651    bool is_ignored = 7;
1652    bool is_external = 8;
1653    optional GitStatus git_status = 9;
1654}
1655
1656message RepositoryEntry {
1657    uint64 work_directory_id = 1;
1658    optional string branch = 2;
1659}
1660
1661message StatusEntry {
1662    string repo_path = 1;
1663    GitStatus status = 2;
1664}
1665
1666enum GitStatus {
1667    Added = 0;
1668    Modified = 1;
1669    Conflict = 2;
1670}
1671
1672message BufferState {
1673    uint64 id = 1;
1674    optional File file = 2;
1675    string base_text = 3;
1676    optional string diff_base = 4;
1677    LineEnding line_ending = 5;
1678    repeated VectorClockEntry saved_version = 6;
1679    reserved 7;
1680    Timestamp saved_mtime = 8;
1681}
1682
1683message BufferChunk {
1684    uint64 buffer_id = 1;
1685    repeated Operation operations = 2;
1686    bool is_last = 3;
1687}
1688
1689enum LineEnding {
1690    Unix = 0;
1691    Windows = 1;
1692}
1693
1694message Selection {
1695    uint64 id = 1;
1696    EditorAnchor start = 2;
1697    EditorAnchor end = 3;
1698    bool reversed = 4;
1699}
1700
1701message EditorAnchor {
1702    uint64 excerpt_id = 1;
1703    Anchor anchor = 2;
1704}
1705
1706enum CursorShape {
1707    CursorBar = 0;
1708    CursorBlock = 1;
1709    CursorUnderscore = 2;
1710    CursorHollow = 3;
1711}
1712
1713message ExcerptInsertion {
1714    Excerpt excerpt = 1;
1715    optional uint64 previous_excerpt_id = 2;
1716}
1717
1718message Excerpt {
1719    uint64 id = 1;
1720    uint64 buffer_id = 2;
1721    Anchor context_start = 3;
1722    Anchor context_end = 4;
1723    Anchor primary_start = 5;
1724    Anchor primary_end = 6;
1725}
1726
1727message Anchor {
1728    uint32 replica_id = 1;
1729    uint32 timestamp = 2;
1730    uint64 offset = 3;
1731    Bias bias = 4;
1732    optional uint64 buffer_id = 5;
1733}
1734
1735enum Bias {
1736    Left = 0;
1737    Right = 1;
1738}
1739
1740message Diagnostic {
1741    Anchor start = 1;
1742    Anchor end = 2;
1743    optional string source = 3;
1744    Severity severity = 4;
1745    string message = 5;
1746    optional string code = 6;
1747    uint64 group_id = 7;
1748    bool is_primary = 8;
1749
1750    // TODO: remove this field
1751    bool is_valid = 9;
1752
1753    bool is_disk_based = 10;
1754    bool is_unnecessary = 11;
1755
1756    enum Severity {
1757        None = 0;
1758        Error = 1;
1759        Warning = 2;
1760        Information = 3;
1761        Hint = 4;
1762    }
1763}
1764
1765message Operation {
1766    oneof variant {
1767        Edit edit = 1;
1768        Undo undo = 2;
1769        UpdateSelections update_selections = 3;
1770        UpdateDiagnostics update_diagnostics = 4;
1771        UpdateCompletionTriggers update_completion_triggers = 5;
1772    }
1773
1774    message Edit {
1775        uint32 replica_id = 1;
1776        uint32 lamport_timestamp = 2;
1777        repeated VectorClockEntry version = 3;
1778        repeated Range ranges = 4;
1779        repeated string new_text = 5;
1780    }
1781
1782    message Undo {
1783        uint32 replica_id = 1;
1784        uint32 lamport_timestamp = 2;
1785        repeated VectorClockEntry version = 3;
1786        repeated UndoCount counts = 4;
1787    }
1788
1789    message UpdateSelections {
1790        uint32 replica_id = 1;
1791        uint32 lamport_timestamp = 2;
1792        repeated Selection selections = 3;
1793        bool line_mode = 4;
1794        CursorShape cursor_shape = 5;
1795    }
1796
1797    message UpdateCompletionTriggers {
1798        uint32 replica_id = 1;
1799        uint32 lamport_timestamp = 2;
1800        repeated string triggers = 3;
1801    }
1802}
1803
1804message UndoMapEntry {
1805    uint32 replica_id = 1;
1806    uint32 local_timestamp = 2;
1807    repeated UndoCount counts = 3;
1808}
1809
1810message UndoCount {
1811    uint32 replica_id = 1;
1812    uint32 lamport_timestamp = 2;
1813    uint32 count = 3;
1814}
1815
1816message VectorClockEntry {
1817    uint32 replica_id = 1;
1818    uint32 timestamp = 2;
1819}
1820
1821message Timestamp {
1822    uint64 seconds = 1;
1823    uint32 nanos = 2;
1824}
1825
1826message Range {
1827    uint64 start = 1;
1828    uint64 end = 2;
1829}
1830
1831message PointUtf16 {
1832    uint32 row = 1;
1833    uint32 column = 2;
1834}
1835
1836message Nonce {
1837    uint64 upper_half = 1;
1838    uint64 lower_half = 2;
1839}
1840
1841enum ChannelVisibility {
1842    Public = 0;
1843    Members = 1;
1844}
1845
1846message Channel {
1847    uint64 id = 1;
1848    string name = 2;
1849    ChannelVisibility visibility = 3;
1850    repeated uint64 parent_path = 5;
1851}
1852
1853message Contact {
1854    uint64 user_id = 1;
1855    bool online = 2;
1856    bool busy = 3;
1857}
1858
1859message WorktreeMetadata {
1860    uint64 id = 1;
1861    string root_name = 2;
1862    bool visible = 3;
1863    string abs_path = 4;
1864}
1865
1866message UpdateDiffBase {
1867    uint64 project_id = 1;
1868    uint64 buffer_id = 2;
1869    optional string diff_base = 3;
1870}
1871
1872message GetNotifications {
1873    optional uint64 before_id = 1;
1874}
1875
1876message AddNotification {
1877    Notification notification = 1;
1878}
1879
1880message GetNotificationsResponse {
1881    repeated Notification notifications = 1;
1882    bool done = 2;
1883}
1884
1885message DeleteNotification {
1886    uint64 notification_id = 1;
1887}
1888
1889message UpdateNotification {
1890    Notification notification = 1;
1891}
1892
1893message MarkNotificationRead {
1894    uint64 notification_id = 1;
1895}
1896
1897message Notification {
1898    uint64 id = 1;
1899    uint64 timestamp = 2;
1900    string kind = 3;
1901    optional uint64 entity_id = 4;
1902    string content = 5;
1903    bool is_read = 6;
1904    optional bool response = 7;
1905}
1906
1907message LspExtExpandMacro {
1908    uint64 project_id = 1;
1909    uint64 buffer_id = 2;
1910    Anchor position = 3;
1911}
1912
1913message LspExtExpandMacroResponse {
1914    string name = 1;
1915    string expansion = 2;
1916}
1917
1918message SetRoomParticipantRole {
1919    uint64 room_id = 1;
1920    uint64 user_id = 2;
1921    ChannelRole role = 3;
1922}
1923
1924message CompleteWithLanguageModel {
1925    string model = 1;
1926    repeated LanguageModelRequestMessage messages = 2;
1927    repeated string stop = 3;
1928    float temperature = 4;
1929    repeated ChatCompletionTool tools = 5;
1930    optional string tool_choice = 6;
1931}
1932
1933// A tool presented to the language model for its use
1934message ChatCompletionTool {
1935    oneof variant {
1936        FunctionObject function = 1;
1937    }
1938
1939    message FunctionObject {
1940        string name = 1;
1941        optional string description = 2;
1942        optional string parameters = 3;
1943    }
1944}
1945
1946// A message to the language model
1947message LanguageModelRequestMessage {
1948    LanguageModelRole role = 1;
1949    string content = 2;
1950    optional string tool_call_id = 3;
1951    repeated ToolCall tool_calls = 4;
1952}
1953
1954enum LanguageModelRole {
1955    LanguageModelUser = 0;
1956    LanguageModelAssistant = 1;
1957    LanguageModelSystem = 2;
1958    LanguageModelTool = 3;
1959}
1960
1961message LanguageModelResponseMessage {
1962    optional LanguageModelRole role = 1;
1963    optional string content = 2;
1964    repeated ToolCallDelta tool_calls = 3;
1965}
1966
1967// A request to call a tool, by the language model
1968message ToolCall {
1969    string id = 1;
1970
1971    oneof variant {
1972        FunctionCall function = 2;
1973    }
1974
1975    message FunctionCall {
1976        string name = 1;
1977        string arguments = 2;
1978    }
1979}
1980
1981message ToolCallDelta {
1982    uint32 index = 1;
1983    optional string id = 2;
1984
1985    oneof variant {
1986        FunctionCallDelta function = 3;
1987    }
1988
1989    message FunctionCallDelta {
1990        optional string name = 1;
1991        optional string arguments = 2;
1992    }
1993}
1994
1995message LanguageModelResponse {
1996    repeated LanguageModelChoiceDelta choices = 1;
1997}
1998
1999message LanguageModelChoiceDelta {
2000    uint32 index = 1;
2001    LanguageModelResponseMessage delta = 2;
2002    optional string finish_reason = 3;
2003}
2004
2005message CountTokensWithLanguageModel {
2006    string model = 1;
2007    repeated LanguageModelRequestMessage messages = 2;
2008}
2009
2010message CountTokensResponse {
2011    uint32 token_count = 1;
2012}
2013
2014message GetCachedEmbeddings {
2015    string model = 1;
2016    repeated bytes digests = 2;
2017}
2018
2019message GetCachedEmbeddingsResponse {
2020    repeated Embedding embeddings = 1;
2021}
2022
2023message ComputeEmbeddings {
2024    string model = 1;
2025    repeated string texts = 2;
2026}
2027
2028message ComputeEmbeddingsResponse {
2029    repeated Embedding embeddings = 1;
2030}
2031
2032message Embedding {
2033    bytes digest = 1;
2034    repeated float dimensions = 2;
2035}
2036
2037message BlameBuffer {
2038    uint64 project_id = 1;
2039    uint64 buffer_id = 2;
2040    repeated VectorClockEntry version = 3;
2041}
2042
2043message BlameEntry {
2044    bytes sha = 1;
2045
2046    uint32 start_line = 2;
2047    uint32 end_line = 3;
2048    uint32 original_line_number = 4;
2049
2050    optional string author = 5;
2051    optional string author_mail = 6;
2052    optional int64 author_time = 7;
2053    optional string author_tz = 8;
2054
2055    optional string committer = 9;
2056    optional string committer_mail = 10;
2057    optional int64 committer_time = 11;
2058    optional string committer_tz = 12;
2059
2060    optional string summary = 13;
2061    optional string previous = 14;
2062
2063    string filename = 15;
2064}
2065
2066message CommitMessage {
2067    bytes oid = 1;
2068    string message = 2;
2069}
2070
2071message CommitPermalink {
2072    bytes oid = 1;
2073    string permalink = 2;
2074}
2075
2076message BlameBufferResponse {
2077    repeated BlameEntry entries = 1;
2078    repeated CommitMessage messages = 2;
2079    repeated CommitPermalink permalinks = 3;
2080    optional string remote_url = 4;
2081}
2082
2083message MultiLspQuery {
2084    uint64 project_id = 1;
2085    uint64 buffer_id = 2;
2086    repeated VectorClockEntry version = 3;
2087    oneof strategy {
2088        AllLanguageServers all = 4;
2089    }
2090    oneof request {
2091        GetHover get_hover = 5;
2092        GetCodeActions get_code_actions = 6;
2093    }
2094}
2095
2096message AllLanguageServers {}
2097
2098message MultiLspQueryResponse {
2099    repeated LspResponse responses = 1;
2100}
2101
2102message LspResponse {
2103    oneof response {
2104        GetHoverResponse get_hover_response = 1;
2105        GetCodeActionsResponse get_code_actions_response = 2;
2106    }
2107}
2108
2109message GetSupermavenApiKey {}
2110
2111message GetSupermavenApiKeyResponse {
2112    string api_key = 1;
2113}