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    optional uint32 ack_id = 266;
  16
  17    oneof payload {
  18        Hello hello = 4;
  19        Ack ack = 5;
  20        Error error = 6;
  21        Ping ping = 7;
  22        Test test = 8;
  23        EndStream end_stream = 165;
  24
  25        CreateRoom create_room = 9;
  26        CreateRoomResponse create_room_response = 10;
  27        JoinRoom join_room = 11;
  28        JoinRoomResponse join_room_response = 12;
  29        RejoinRoom rejoin_room = 13;
  30        RejoinRoomResponse rejoin_room_response = 14;
  31        LeaveRoom leave_room = 15;
  32        Call call = 16;
  33        IncomingCall incoming_call = 17;
  34        CallCanceled call_canceled = 18;
  35        CancelCall cancel_call = 19;
  36        DeclineCall decline_call = 20;
  37        UpdateParticipantLocation update_participant_location = 21;
  38        RoomUpdated room_updated = 22;
  39
  40        ShareProject share_project = 23;
  41        ShareProjectResponse share_project_response = 24;
  42        UnshareProject unshare_project = 25;
  43        JoinProject join_project = 26;
  44        JoinProjectResponse join_project_response = 27;
  45        LeaveProject leave_project = 28;
  46        AddProjectCollaborator add_project_collaborator = 29;
  47        UpdateProjectCollaborator update_project_collaborator = 30;
  48        RemoveProjectCollaborator remove_project_collaborator = 31;
  49
  50        GetDefinition get_definition = 32;
  51        GetDefinitionResponse get_definition_response = 33;
  52        GetDeclaration get_declaration = 237;
  53        GetDeclarationResponse get_declaration_response = 238;
  54        GetTypeDefinition get_type_definition = 34;
  55        GetTypeDefinitionResponse get_type_definition_response = 35;
  56
  57        GetReferences get_references = 36;
  58        GetReferencesResponse get_references_response = 37;
  59        GetDocumentHighlights get_document_highlights = 38;
  60        GetDocumentHighlightsResponse get_document_highlights_response = 39;
  61        GetProjectSymbols get_project_symbols = 40;
  62        GetProjectSymbolsResponse get_project_symbols_response = 41;
  63        OpenBufferForSymbol open_buffer_for_symbol = 42;
  64        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 43;
  65
  66        UpdateProject update_project = 44;
  67        UpdateWorktree update_worktree = 45;
  68
  69        CreateProjectEntry create_project_entry = 46;
  70        RenameProjectEntry rename_project_entry = 47;
  71        CopyProjectEntry copy_project_entry = 48;
  72        DeleteProjectEntry delete_project_entry = 49;
  73        ProjectEntryResponse project_entry_response = 50;
  74        ExpandProjectEntry expand_project_entry = 51;
  75        ExpandProjectEntryResponse expand_project_entry_response = 52;
  76        ExpandAllForProjectEntry expand_all_for_project_entry = 291;
  77        ExpandAllForProjectEntryResponse expand_all_for_project_entry_response = 292;
  78        UpdateDiagnosticSummary update_diagnostic_summary = 53;
  79        StartLanguageServer start_language_server = 54;
  80        UpdateLanguageServer update_language_server = 55;
  81
  82        OpenBufferById open_buffer_by_id = 56;
  83        OpenBufferByPath open_buffer_by_path = 57;
  84        OpenBufferResponse open_buffer_response = 58;
  85        CreateBufferForPeer create_buffer_for_peer = 59;
  86        UpdateBuffer update_buffer = 60;
  87        UpdateBufferFile update_buffer_file = 61;
  88        SaveBuffer save_buffer = 62;
  89        BufferSaved buffer_saved = 63;
  90        BufferReloaded buffer_reloaded = 64;
  91        ReloadBuffers reload_buffers = 65;
  92        ReloadBuffersResponse reload_buffers_response = 66;
  93        SynchronizeBuffers synchronize_buffers = 67;
  94        SynchronizeBuffersResponse synchronize_buffers_response = 68;
  95        FormatBuffers format_buffers = 69;
  96        FormatBuffersResponse format_buffers_response = 70;
  97        GetCompletions get_completions = 71;
  98        GetCompletionsResponse get_completions_response = 72;
  99        ResolveCompletionDocumentation resolve_completion_documentation = 73;
 100        ResolveCompletionDocumentationResponse resolve_completion_documentation_response = 74;
 101        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 75;
 102        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 76;
 103        GetCodeActions get_code_actions = 77;
 104        GetCodeActionsResponse get_code_actions_response = 78;
 105        GetHover get_hover = 79;
 106        GetHoverResponse get_hover_response = 80;
 107        ApplyCodeAction apply_code_action = 81;
 108        ApplyCodeActionResponse apply_code_action_response = 82;
 109        PrepareRename prepare_rename = 83;
 110        PrepareRenameResponse prepare_rename_response = 84;
 111        PerformRename perform_rename = 85;
 112        PerformRenameResponse perform_rename_response = 86;
 113
 114        UpdateContacts update_contacts = 89;
 115        UpdateInviteInfo update_invite_info = 90;
 116        ShowContacts show_contacts = 91;
 117
 118        GetUsers get_users = 92;
 119        FuzzySearchUsers fuzzy_search_users = 93;
 120        UsersResponse users_response = 94;
 121        RequestContact request_contact = 95;
 122        RespondToContactRequest respond_to_contact_request = 96;
 123        RemoveContact remove_contact = 97;
 124
 125        Follow follow = 98;
 126        FollowResponse follow_response = 99;
 127        UpdateFollowers update_followers = 100;
 128        Unfollow unfollow = 101;
 129        GetPrivateUserInfo get_private_user_info = 102;
 130        GetPrivateUserInfoResponse get_private_user_info_response = 103;
 131        UpdateUserPlan update_user_plan = 234;
 132        UpdateDiffBases update_diff_bases = 104;
 133        AcceptTermsOfService accept_terms_of_service = 239;
 134        AcceptTermsOfServiceResponse accept_terms_of_service_response = 240;
 135
 136        OnTypeFormatting on_type_formatting = 105;
 137        OnTypeFormattingResponse on_type_formatting_response = 106;
 138
 139        UpdateWorktreeSettings update_worktree_settings = 107;
 140
 141        InlayHints inlay_hints = 108;
 142        InlayHintsResponse inlay_hints_response = 109;
 143        ResolveInlayHint resolve_inlay_hint = 110;
 144        ResolveInlayHintResponse resolve_inlay_hint_response = 111;
 145        RefreshInlayHints refresh_inlay_hints = 112;
 146
 147        CreateChannel create_channel = 113;
 148        CreateChannelResponse create_channel_response = 114;
 149        InviteChannelMember invite_channel_member = 115;
 150        RemoveChannelMember remove_channel_member = 116;
 151        RespondToChannelInvite respond_to_channel_invite = 117;
 152        UpdateChannels update_channels = 118;
 153        JoinChannel join_channel = 119;
 154        DeleteChannel delete_channel = 120;
 155        GetChannelMembers get_channel_members = 121;
 156        GetChannelMembersResponse get_channel_members_response = 122;
 157        SetChannelMemberRole set_channel_member_role = 123;
 158        RenameChannel rename_channel = 124;
 159        RenameChannelResponse rename_channel_response = 125;
 160        SubscribeToChannels subscribe_to_channels = 207;
 161
 162        JoinChannelBuffer join_channel_buffer = 126;
 163        JoinChannelBufferResponse join_channel_buffer_response = 127;
 164        UpdateChannelBuffer update_channel_buffer = 128;
 165        LeaveChannelBuffer leave_channel_buffer = 129;
 166        UpdateChannelBufferCollaborators update_channel_buffer_collaborators = 130;
 167        RejoinChannelBuffers rejoin_channel_buffers = 131;
 168        RejoinChannelBuffersResponse rejoin_channel_buffers_response = 132;
 169        AckBufferOperation ack_buffer_operation = 133;
 170
 171        JoinChannelChat join_channel_chat = 134;
 172        JoinChannelChatResponse join_channel_chat_response = 135;
 173        LeaveChannelChat leave_channel_chat = 136;
 174        SendChannelMessage send_channel_message = 137;
 175        SendChannelMessageResponse send_channel_message_response = 138;
 176        ChannelMessageSent channel_message_sent = 139;
 177        GetChannelMessages get_channel_messages = 140;
 178        GetChannelMessagesResponse get_channel_messages_response = 141;
 179        RemoveChannelMessage remove_channel_message = 142;
 180        AckChannelMessage ack_channel_message = 143;
 181        GetChannelMessagesById get_channel_messages_by_id = 144;
 182
 183        MoveChannel move_channel = 147;
 184        SetChannelVisibility set_channel_visibility = 148;
 185
 186        AddNotification add_notification = 149;
 187        GetNotifications get_notifications = 150;
 188        GetNotificationsResponse get_notifications_response = 151;
 189        DeleteNotification delete_notification = 152;
 190        MarkNotificationRead mark_notification_read = 153;
 191        LspExtExpandMacro lsp_ext_expand_macro = 154;
 192        LspExtExpandMacroResponse lsp_ext_expand_macro_response = 155;
 193        SetRoomParticipantRole set_room_participant_role = 156;
 194
 195        UpdateUserChannels update_user_channels = 157;
 196
 197        GetImplementation get_implementation = 162;
 198        GetImplementationResponse get_implementation_response = 163;
 199
 200        CountLanguageModelTokens count_language_model_tokens = 230;
 201        CountLanguageModelTokensResponse count_language_model_tokens_response = 231;
 202        GetCachedEmbeddings get_cached_embeddings = 189;
 203        GetCachedEmbeddingsResponse get_cached_embeddings_response = 190;
 204        ComputeEmbeddings compute_embeddings = 191;
 205        ComputeEmbeddingsResponse compute_embeddings_response = 192;
 206
 207        UpdateChannelMessage update_channel_message = 170;
 208        ChannelMessageUpdate channel_message_update = 171;
 209
 210        BlameBuffer blame_buffer = 172;
 211        BlameBufferResponse blame_buffer_response = 173;
 212
 213        UpdateNotification update_notification = 174;
 214
 215        MultiLspQuery multi_lsp_query = 175;
 216        MultiLspQueryResponse multi_lsp_query_response = 176;
 217        RestartLanguageServers restart_language_servers = 208;
 218
 219        RejoinRemoteProjects rejoin_remote_projects = 186;
 220        RejoinRemoteProjectsResponse rejoin_remote_projects_response = 187;
 221
 222        OpenNewBuffer open_new_buffer = 196;
 223
 224        GetSupermavenApiKey get_supermaven_api_key = 198;
 225        GetSupermavenApiKeyResponse get_supermaven_api_key_response = 199;
 226
 227        TaskContextForLocation task_context_for_location = 203;
 228        TaskContext task_context = 204;
 229
 230        LinkedEditingRange linked_editing_range = 209;
 231        LinkedEditingRangeResponse linked_editing_range_response = 210;
 232
 233        AdvertiseContexts advertise_contexts = 211;
 234        OpenContext open_context = 212;
 235        OpenContextResponse open_context_response = 213;
 236        CreateContext create_context = 232;
 237        CreateContextResponse create_context_response = 233;
 238        UpdateContext update_context = 214;
 239        SynchronizeContexts synchronize_contexts = 215;
 240        SynchronizeContextsResponse synchronize_contexts_response = 216;
 241
 242        GetSignatureHelp get_signature_help = 217;
 243        GetSignatureHelpResponse get_signature_help_response = 218;
 244
 245        ListRemoteDirectory list_remote_directory = 219;
 246        ListRemoteDirectoryResponse list_remote_directory_response = 220;
 247        AddWorktree add_worktree = 222;
 248        AddWorktreeResponse add_worktree_response = 223;
 249
 250        GetLlmToken get_llm_token = 235;
 251        GetLlmTokenResponse get_llm_token_response = 236;
 252        RefreshLlmToken refresh_llm_token = 259;
 253
 254        LspExtSwitchSourceHeader lsp_ext_switch_source_header = 241;
 255        LspExtSwitchSourceHeaderResponse lsp_ext_switch_source_header_response = 242;
 256
 257        FindSearchCandidates find_search_candidates = 243;
 258        FindSearchCandidatesResponse find_search_candidates_response = 244;
 259
 260        CloseBuffer close_buffer = 245;
 261
 262        ShutdownRemoteServer shutdown_remote_server = 257;
 263
 264        RemoveWorktree remove_worktree = 258;
 265
 266        LanguageServerLog language_server_log = 260;
 267
 268        Toast toast = 261;
 269        HideToast hide_toast = 262;
 270
 271        OpenServerSettings open_server_settings = 263;
 272
 273        GetPermalinkToLine get_permalink_to_line = 264;
 274        GetPermalinkToLineResponse get_permalink_to_line_response = 265;
 275
 276        FlushBufferedMessages flush_buffered_messages = 267;
 277
 278        LanguageServerPromptRequest language_server_prompt_request = 268;
 279        LanguageServerPromptResponse language_server_prompt_response = 269;
 280
 281        GitBranches git_branches = 270;
 282        GitBranchesResponse git_branches_response = 271;
 283
 284        UpdateGitBranch update_git_branch = 272;
 285
 286        ListToolchains list_toolchains = 273;
 287        ListToolchainsResponse list_toolchains_response = 274;
 288        ActivateToolchain activate_toolchain = 275;
 289        ActiveToolchain active_toolchain = 276;
 290        ActiveToolchainResponse active_toolchain_response = 277;
 291
 292        GetPathMetadata get_path_metadata = 278;
 293        GetPathMetadataResponse get_path_metadata_response = 279;
 294
 295        GetPanicFiles get_panic_files = 280;
 296        GetPanicFilesResponse get_panic_files_response = 281;
 297
 298        CancelLanguageServerWork cancel_language_server_work = 282;
 299
 300        LspExtOpenDocs lsp_ext_open_docs = 283;
 301        LspExtOpenDocsResponse lsp_ext_open_docs_response = 284;
 302
 303        SyncExtensions sync_extensions = 285;
 304        SyncExtensionsResponse sync_extensions_response = 286;
 305        InstallExtension install_extension = 287;
 306
 307        OpenUnstagedDiff open_unstaged_diff = 288;
 308        OpenUnstagedDiffResponse open_unstaged_diff_response = 289;
 309
 310        RegisterBufferWithLanguageServers register_buffer_with_language_servers = 290;
 311
 312        Stage stage = 293;
 313        Unstage unstage = 294;
 314        Commit commit = 295;
 315        OpenCommitMessageBuffer open_commit_message_buffer = 296;
 316
 317        OpenUncommittedDiff open_uncommitted_diff = 297;
 318        OpenUncommittedDiffResponse open_uncommitted_diff_response = 298;
 319        GitShow git_show = 300;
 320        GitReset git_reset = 301;
 321        GitCommitDetails git_commit_details = 302;
 322
 323        SetIndexText set_index_text = 299;
 324        GitCheckoutFiles git_checkout_files = 303;
 325
 326        Push push = 304;
 327        Fetch fetch = 305;
 328        GetRemotes get_remotes = 306;
 329        GetRemotesResponse get_remotes_response = 307;
 330        Pull pull = 308;
 331
 332        ApplyCodeActionKind apply_code_action_kind = 309;
 333        ApplyCodeActionKindResponse apply_code_action_kind_response = 310;
 334
 335        RemoteMessageResponse remote_message_response = 311; // current max
 336    }
 337
 338    reserved 87 to 88;
 339    reserved 158 to 161;
 340    reserved 164;
 341    reserved 166 to 169;
 342    reserved 177 to 185;
 343    reserved 188;
 344    reserved 193 to 195;
 345    reserved 197;
 346    reserved 200 to 202;
 347    reserved 205 to 206;
 348    reserved 221;
 349    reserved 224 to 229;
 350    reserved 246;
 351    reserved 247 to 254;
 352    reserved 255 to 256;
 353}
 354
 355// Messages
 356
 357message Hello {
 358    PeerId peer_id = 1;
 359}
 360
 361message Ping {}
 362
 363message Ack {}
 364
 365message Error {
 366    string message = 1;
 367    ErrorCode code = 2;
 368    repeated string tags = 3;
 369}
 370
 371enum ErrorCode {
 372    Internal = 0;
 373    NoSuchChannel = 1;
 374    Disconnected = 2;
 375    SignedOut = 3;
 376    UpgradeRequired = 4;
 377    Forbidden = 5;
 378    NeedsCla = 7;
 379    NotARootChannel = 8;
 380    BadPublicNesting = 9;
 381    CircularNesting = 10;
 382    WrongMoveTarget = 11;
 383    UnsharedItem = 12;
 384    NoSuchProject = 13;
 385    DevServerProjectPathDoesNotExist = 16;
 386    RemoteUpgradeRequired = 17;
 387    RateLimitExceeded = 18;
 388    CommitFailed = 19;
 389    reserved 6;
 390    reserved 14 to 15;
 391}
 392
 393message EndStream {}
 394
 395message Test {
 396    uint64 id = 1;
 397}
 398
 399message CreateRoom {}
 400
 401message CreateRoomResponse {
 402    Room room = 1;
 403    optional LiveKitConnectionInfo live_kit_connection_info = 2;
 404}
 405
 406message JoinRoom {
 407    uint64 id = 1;
 408}
 409
 410message JoinRoomResponse {
 411    Room room = 1;
 412    optional uint64 channel_id = 2;
 413    optional LiveKitConnectionInfo live_kit_connection_info = 3;
 414}
 415
 416message RejoinRoom {
 417    uint64 id = 1;
 418    repeated UpdateProject reshared_projects = 2;
 419    repeated RejoinProject rejoined_projects = 3;
 420}
 421message RejoinRemoteProjects {
 422    repeated RejoinProject rejoined_projects = 1;
 423}
 424
 425message RejoinRemoteProjectsResponse {
 426    repeated RejoinedProject rejoined_projects = 1;
 427}
 428
 429message RejoinProject {
 430    uint64 id = 1;
 431    repeated RejoinWorktree worktrees = 2;
 432}
 433
 434message RejoinWorktree {
 435    uint64 id = 1;
 436    uint64 scan_id = 2;
 437}
 438
 439message RejoinRoomResponse {
 440    Room room = 1;
 441    repeated ResharedProject reshared_projects = 2;
 442    repeated RejoinedProject rejoined_projects = 3;
 443}
 444
 445message ResharedProject {
 446    uint64 id = 1;
 447    repeated Collaborator collaborators = 2;
 448}
 449
 450message RejoinedProject {
 451    uint64 id = 1;
 452    repeated WorktreeMetadata worktrees = 2;
 453    repeated Collaborator collaborators = 3;
 454    repeated LanguageServer language_servers = 4;
 455}
 456
 457message LeaveRoom {}
 458
 459message Room {
 460    uint64 id = 1;
 461    repeated Participant participants = 2;
 462    repeated PendingParticipant pending_participants = 3;
 463    repeated Follower followers = 4;
 464    string livekit_room = 5;
 465}
 466
 467message Participant {
 468    uint64 user_id = 1;
 469    PeerId peer_id = 2;
 470    repeated ParticipantProject projects = 3;
 471    ParticipantLocation location = 4;
 472    uint32 participant_index = 5;
 473    ChannelRole role = 6;
 474    reserved 7;
 475}
 476
 477message PendingParticipant {
 478    uint64 user_id = 1;
 479    uint64 calling_user_id = 2;
 480    optional uint64 initial_project_id = 3;
 481}
 482
 483message ParticipantProject {
 484    uint64 id = 1;
 485    repeated string worktree_root_names = 2;
 486}
 487
 488message Follower {
 489    PeerId leader_id = 1;
 490    PeerId follower_id = 2;
 491    uint64 project_id = 3;
 492}
 493
 494message ParticipantLocation {
 495    oneof variant {
 496        SharedProject shared_project = 1;
 497        UnsharedProject unshared_project = 2;
 498        External external = 3;
 499    }
 500
 501    message SharedProject {
 502        uint64 id = 1;
 503    }
 504
 505    message UnsharedProject {}
 506
 507    message External {}
 508}
 509
 510message Call {
 511    uint64 room_id = 1;
 512    uint64 called_user_id = 2;
 513    optional uint64 initial_project_id = 3;
 514}
 515
 516message IncomingCall {
 517    uint64 room_id = 1;
 518    uint64 calling_user_id = 2;
 519    repeated uint64 participant_user_ids = 3;
 520    optional ParticipantProject initial_project = 4;
 521}
 522
 523message CallCanceled {
 524    uint64 room_id = 1;
 525}
 526
 527message CancelCall {
 528    uint64 room_id = 1;
 529    uint64 called_user_id = 2;
 530}
 531
 532message DeclineCall {
 533    uint64 room_id = 1;
 534}
 535
 536message UpdateParticipantLocation {
 537    uint64 room_id = 1;
 538    ParticipantLocation location = 2;
 539}
 540
 541message RoomUpdated {
 542    Room room = 1;
 543}
 544
 545message LiveKitConnectionInfo {
 546    string server_url = 1;
 547    string token = 2;
 548    bool can_publish = 3;
 549}
 550
 551message ShareProject {
 552    uint64 room_id = 1;
 553    repeated WorktreeMetadata worktrees = 2;
 554    reserved 3;
 555    bool is_ssh_project = 4;
 556}
 557
 558message ShareProjectResponse {
 559    uint64 project_id = 1;
 560}
 561
 562message UnshareProject {
 563    uint64 project_id = 1;
 564}
 565
 566message UpdateProject {
 567    uint64 project_id = 1;
 568    repeated WorktreeMetadata worktrees = 2;
 569}
 570
 571message JoinProject {
 572    uint64 project_id = 1;
 573}
 574
 575message ListRemoteDirectory {
 576    uint64 dev_server_id = 1;
 577    string path = 2;
 578}
 579
 580message ListRemoteDirectoryResponse {
 581    repeated string entries = 1;
 582}
 583
 584message JoinProjectResponse {
 585    uint64 project_id = 5;
 586    uint32 replica_id = 1;
 587    repeated WorktreeMetadata worktrees = 2;
 588    repeated Collaborator collaborators = 3;
 589    repeated LanguageServer language_servers = 4;
 590    ChannelRole role = 6;
 591    reserved 7;
 592}
 593
 594message LeaveProject {
 595    uint64 project_id = 1;
 596}
 597
 598message UpdateWorktree {
 599    uint64 project_id = 1;
 600    uint64 worktree_id = 2;
 601    string root_name = 3;
 602    repeated Entry updated_entries = 4;
 603    repeated uint64 removed_entries = 5;
 604    repeated RepositoryEntry updated_repositories = 6;
 605    repeated uint64 removed_repositories = 7;
 606    uint64 scan_id = 8;
 607    bool is_last_update = 9;
 608    string abs_path = 10;
 609}
 610
 611message UpdateWorktreeSettings {
 612    uint64 project_id = 1;
 613    uint64 worktree_id = 2;
 614    string path = 3;
 615    optional string content = 4;
 616    optional LocalSettingsKind kind = 5;
 617}
 618
 619enum LocalSettingsKind {
 620    Settings = 0;
 621    Tasks = 1;
 622    Editorconfig = 2;
 623}
 624
 625message CreateProjectEntry {
 626    uint64 project_id = 1;
 627    uint64 worktree_id = 2;
 628    string path = 3;
 629    bool is_directory = 4;
 630}
 631
 632message RenameProjectEntry {
 633    uint64 project_id = 1;
 634    uint64 entry_id = 2;
 635    string new_path = 3;
 636}
 637
 638message CopyProjectEntry {
 639    uint64 project_id = 1;
 640    uint64 entry_id = 2;
 641    string new_path = 3;
 642    optional string relative_worktree_source_path = 4;
 643}
 644
 645message DeleteProjectEntry {
 646    uint64 project_id = 1;
 647    uint64 entry_id = 2;
 648    bool use_trash = 3;
 649}
 650
 651message ExpandProjectEntry {
 652    uint64 project_id = 1;
 653    uint64 entry_id = 2;
 654}
 655
 656message ExpandProjectEntryResponse {
 657    uint64 worktree_scan_id = 1;
 658}
 659
 660message ExpandAllForProjectEntry {
 661    uint64 project_id = 1;
 662    uint64 entry_id = 2;
 663}
 664
 665message ExpandAllForProjectEntryResponse {
 666    uint64 worktree_scan_id = 1;
 667}
 668
 669message ProjectEntryResponse {
 670    optional Entry entry = 1;
 671    uint64 worktree_scan_id = 2;
 672}
 673
 674message AddProjectCollaborator {
 675    uint64 project_id = 1;
 676    Collaborator collaborator = 2;
 677}
 678
 679message UpdateProjectCollaborator {
 680    uint64 project_id = 1;
 681    PeerId old_peer_id = 2;
 682    PeerId new_peer_id = 3;
 683}
 684
 685message RemoveProjectCollaborator {
 686    uint64 project_id = 1;
 687    PeerId peer_id = 2;
 688}
 689
 690message UpdateChannelBufferCollaborators {
 691    uint64 channel_id = 1;
 692    repeated Collaborator collaborators = 2;
 693}
 694
 695message GetDefinition {
 696     uint64 project_id = 1;
 697     uint64 buffer_id = 2;
 698     Anchor position = 3;
 699     repeated VectorClockEntry version = 4;
 700}
 701
 702message GetDefinitionResponse {
 703    repeated LocationLink links = 1;
 704}
 705
 706message GetDeclaration {
 707     uint64 project_id = 1;
 708     uint64 buffer_id = 2;
 709     Anchor position = 3;
 710     repeated VectorClockEntry version = 4;
 711}
 712
 713message GetDeclarationResponse {
 714    repeated LocationLink links = 1;
 715}
 716
 717message GetTypeDefinition {
 718     uint64 project_id = 1;
 719     uint64 buffer_id = 2;
 720     Anchor position = 3;
 721     repeated VectorClockEntry version = 4;
 722 }
 723
 724message GetTypeDefinitionResponse {
 725    repeated LocationLink links = 1;
 726}
 727message GetImplementation {
 728     uint64 project_id = 1;
 729     uint64 buffer_id = 2;
 730     Anchor position = 3;
 731     repeated VectorClockEntry version = 4;
 732 }
 733
 734message GetImplementationResponse {
 735    repeated LocationLink links = 1;
 736}
 737
 738message GetReferences {
 739     uint64 project_id = 1;
 740     uint64 buffer_id = 2;
 741     Anchor position = 3;
 742     repeated VectorClockEntry version = 4;
 743 }
 744
 745message GetReferencesResponse {
 746    repeated Location locations = 1;
 747}
 748
 749message GetDocumentHighlights {
 750     uint64 project_id = 1;
 751     uint64 buffer_id = 2;
 752     Anchor position = 3;
 753     repeated VectorClockEntry version = 4;
 754 }
 755
 756message GetDocumentHighlightsResponse {
 757    repeated DocumentHighlight highlights = 1;
 758}
 759
 760message Location {
 761    uint64 buffer_id = 1;
 762    Anchor start = 2;
 763    Anchor end = 3;
 764}
 765
 766message LocationLink {
 767    optional Location origin = 1;
 768    Location target = 2;
 769}
 770
 771message DocumentHighlight {
 772    Kind kind = 1;
 773    Anchor start = 2;
 774    Anchor end = 3;
 775
 776    enum Kind {
 777        Text = 0;
 778        Read = 1;
 779        Write = 2;
 780    }
 781}
 782
 783message GetProjectSymbols {
 784    uint64 project_id = 1;
 785    string query = 2;
 786}
 787
 788message GetProjectSymbolsResponse {
 789    repeated Symbol symbols = 4;
 790}
 791
 792message Symbol {
 793    uint64 source_worktree_id = 1;
 794    uint64 worktree_id = 2;
 795    string language_server_name = 3;
 796    string name = 4;
 797    int32 kind = 5;
 798    string path = 6;
 799    // Cannot use generate anchors for unopened files,
 800    // so we are forced to use point coords instead
 801    PointUtf16 start = 7;
 802    PointUtf16 end = 8;
 803    bytes signature = 9;
 804    uint64 language_server_id = 10;
 805}
 806
 807message OpenBufferForSymbol {
 808    uint64 project_id = 1;
 809    Symbol symbol = 2;
 810}
 811
 812message OpenBufferForSymbolResponse {
 813    uint64 buffer_id = 1;
 814}
 815
 816message OpenBufferByPath {
 817    uint64 project_id = 1;
 818    uint64 worktree_id = 2;
 819    string path = 3;
 820}
 821
 822message OpenBufferById {
 823    uint64 project_id = 1;
 824    uint64 id = 2;
 825}
 826
 827message OpenNewBuffer {
 828    uint64 project_id = 1;
 829}
 830
 831message OpenBufferResponse {
 832    uint64 buffer_id = 1;
 833}
 834
 835message CreateBufferForPeer {
 836    uint64 project_id = 1;
 837    PeerId peer_id = 2;
 838    oneof variant {
 839        BufferState state = 3;
 840        BufferChunk chunk = 4;
 841    }
 842}
 843
 844message UpdateBuffer {
 845    uint64 project_id = 1;
 846    uint64 buffer_id = 2;
 847    repeated Operation operations = 3;
 848}
 849
 850message UpdateChannelBuffer {
 851    uint64 channel_id = 1;
 852    repeated Operation operations = 2;
 853}
 854
 855message UpdateBufferFile {
 856    uint64 project_id = 1;
 857    uint64 buffer_id = 2;
 858    File file = 3;
 859}
 860
 861message SaveBuffer {
 862    uint64 project_id = 1;
 863    uint64 buffer_id = 2;
 864    repeated VectorClockEntry version = 3;
 865    optional ProjectPath new_path = 4;
 866}
 867
 868message CloseBuffer {
 869    uint64 project_id = 1;
 870    uint64 buffer_id = 2;
 871}
 872
 873message ProjectPath {
 874    uint64 worktree_id = 1;
 875    string path = 2;
 876}
 877
 878message BufferSaved {
 879    uint64 project_id = 1;
 880    uint64 buffer_id = 2;
 881    repeated VectorClockEntry version = 3;
 882    Timestamp mtime = 4;
 883    reserved 5;
 884}
 885
 886message BufferReloaded {
 887    uint64 project_id = 1;
 888    uint64 buffer_id = 2;
 889    repeated VectorClockEntry version = 3;
 890    Timestamp mtime = 4;
 891    reserved 5;
 892    LineEnding line_ending = 6;
 893}
 894
 895message ReloadBuffers {
 896    uint64 project_id = 1;
 897    repeated uint64 buffer_ids = 2;
 898}
 899
 900message ReloadBuffersResponse {
 901    ProjectTransaction transaction = 1;
 902}
 903
 904message SynchronizeBuffers {
 905    uint64 project_id = 1;
 906    repeated BufferVersion buffers = 2;
 907}
 908
 909message SynchronizeBuffersResponse {
 910    repeated BufferVersion buffers = 1;
 911}
 912
 913message BufferVersion {
 914    uint64 id = 1;
 915    repeated VectorClockEntry version = 2;
 916}
 917
 918message ChannelBufferVersion {
 919    uint64 channel_id = 1;
 920    repeated VectorClockEntry version = 2;
 921    uint64 epoch = 3;
 922}
 923
 924message ApplyCodeActionKind {
 925    uint64 project_id = 1;
 926    string kind = 2;
 927    repeated uint64 buffer_ids = 3;
 928}
 929
 930message ApplyCodeActionKindResponse {
 931    ProjectTransaction transaction = 1;
 932}
 933
 934enum FormatTrigger {
 935    Save = 0;
 936    Manual = 1;
 937}
 938
 939message FormatBuffers {
 940    uint64 project_id = 1;
 941    FormatTrigger trigger = 2;
 942    repeated uint64 buffer_ids = 3;
 943}
 944
 945message FormatBuffersResponse {
 946    ProjectTransaction transaction = 1;
 947}
 948
 949message GetCompletions {
 950    uint64 project_id = 1;
 951    uint64 buffer_id = 2;
 952    Anchor position = 3;
 953    repeated VectorClockEntry version = 4;
 954}
 955
 956message GetCompletionsResponse {
 957    repeated Completion completions = 1;
 958    repeated VectorClockEntry version = 2;
 959}
 960
 961message ApplyCompletionAdditionalEdits {
 962    uint64 project_id = 1;
 963    uint64 buffer_id = 2;
 964    Completion completion = 3;
 965}
 966
 967message ApplyCompletionAdditionalEditsResponse {
 968    Transaction transaction = 1;
 969}
 970
 971message Completion {
 972    Anchor old_start = 1;
 973    Anchor old_end = 2;
 974    string new_text = 3;
 975    uint64 server_id = 4;
 976    bytes lsp_completion = 5;
 977    bool resolved = 6;
 978}
 979
 980message GetCodeActions {
 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 GetCodeActionsResponse {
 989    repeated CodeAction actions = 1;
 990    repeated VectorClockEntry version = 2;
 991}
 992
 993message GetSignatureHelp {
 994    uint64 project_id = 1;
 995    uint64 buffer_id = 2;
 996    Anchor position = 3;
 997    repeated VectorClockEntry version = 4;
 998}
 999
1000message GetSignatureHelpResponse {
1001    optional SignatureHelp signature_help = 1;
1002}
1003
1004message SignatureHelp {
1005    repeated SignatureInformation signatures = 1;
1006    optional uint32 active_signature = 2;
1007    optional uint32 active_parameter = 3;
1008}
1009
1010message SignatureInformation {
1011    string label = 1;
1012    optional Documentation documentation = 2;
1013    repeated ParameterInformation parameters = 3;
1014    optional uint32 active_parameter = 4;
1015}
1016
1017message Documentation {
1018    oneof content {
1019        string value = 1;
1020        MarkupContent markup_content = 2;
1021    }
1022}
1023
1024enum MarkupKind {
1025    PlainText = 0;
1026    Markdown = 1;
1027}
1028
1029message ParameterInformation {
1030    oneof label {
1031        string simple = 1;
1032        LabelOffsets label_offsets = 2;
1033    }
1034    optional Documentation documentation = 3;
1035}
1036
1037message LabelOffsets {
1038    uint32 start = 1;
1039    uint32 end = 2;
1040}
1041
1042message GetHover {
1043    uint64 project_id = 1;
1044    uint64 buffer_id = 2;
1045    Anchor position = 3;
1046    repeated VectorClockEntry version = 5;
1047}
1048
1049message GetHoverResponse {
1050    optional Anchor start = 1;
1051    optional Anchor end = 2;
1052    repeated HoverBlock contents = 3;
1053}
1054
1055message HoverBlock {
1056    string text = 1;
1057    optional string language = 2;
1058    bool is_markdown = 3;
1059}
1060
1061message ApplyCodeAction {
1062    uint64 project_id = 1;
1063    uint64 buffer_id = 2;
1064    CodeAction action = 3;
1065}
1066
1067message ApplyCodeActionResponse {
1068    ProjectTransaction transaction = 1;
1069}
1070
1071message PrepareRename {
1072    uint64 project_id = 1;
1073    uint64 buffer_id = 2;
1074    Anchor position = 3;
1075    repeated VectorClockEntry version = 4;
1076}
1077
1078message PrepareRenameResponse {
1079    bool can_rename = 1;
1080    Anchor start = 2;
1081    Anchor end = 3;
1082    repeated VectorClockEntry version = 4;
1083    bool only_unprepared_rename_supported = 5;
1084}
1085
1086message PerformRename {
1087    uint64 project_id = 1;
1088    uint64 buffer_id = 2;
1089    Anchor position = 3;
1090    string new_name = 4;
1091    repeated VectorClockEntry version = 5;
1092}
1093
1094message OnTypeFormatting {
1095    uint64 project_id = 1;
1096    uint64 buffer_id = 2;
1097    Anchor position = 3;
1098    string trigger = 4;
1099    repeated VectorClockEntry version = 5;
1100}
1101
1102message OnTypeFormattingResponse {
1103    Transaction transaction = 1;
1104}
1105
1106
1107message LinkedEditingRange {
1108    uint64 project_id = 1;
1109    uint64 buffer_id = 2;
1110    Anchor position = 3;
1111    repeated VectorClockEntry version = 4;
1112}
1113
1114message AnchorRange {
1115    Anchor start = 1;
1116    Anchor end = 2;
1117}
1118
1119message LinkedEditingRangeResponse {
1120    repeated AnchorRange items = 1;
1121    repeated VectorClockEntry version = 4;
1122}
1123
1124message InlayHints {
1125    uint64 project_id = 1;
1126    uint64 buffer_id = 2;
1127    Anchor start = 3;
1128    Anchor end = 4;
1129    repeated VectorClockEntry version = 5;
1130}
1131
1132message InlayHintsResponse {
1133    repeated InlayHint hints = 1;
1134    repeated VectorClockEntry version = 2;
1135}
1136
1137message InlayHint {
1138    Anchor position = 1;
1139    InlayHintLabel label = 2;
1140    optional string kind = 3;
1141    bool padding_left = 4;
1142    bool padding_right = 5;
1143    InlayHintTooltip tooltip = 6;
1144    ResolveState resolve_state = 7;
1145}
1146
1147message InlayHintLabel {
1148    oneof label {
1149        string value = 1;
1150        InlayHintLabelParts label_parts = 2;
1151    }
1152}
1153
1154message InlayHintLabelParts {
1155    repeated InlayHintLabelPart parts = 1;
1156}
1157
1158message InlayHintLabelPart {
1159    string value = 1;
1160    InlayHintLabelPartTooltip tooltip = 2;
1161    optional string location_url = 3;
1162    PointUtf16 location_range_start = 4;
1163    PointUtf16 location_range_end = 5;
1164    optional uint64 language_server_id = 6;
1165}
1166
1167message InlayHintTooltip {
1168    oneof content {
1169        string value = 1;
1170        MarkupContent markup_content = 2;
1171    }
1172}
1173
1174message InlayHintLabelPartTooltip {
1175    oneof content {
1176        string value = 1;
1177        MarkupContent markup_content = 2;
1178    }
1179}
1180
1181message ResolveState {
1182    State state = 1;
1183    LspResolveState lsp_resolve_state = 2;
1184
1185    enum State {
1186        Resolved = 0;
1187        CanResolve = 1;
1188        Resolving = 2;
1189    }
1190
1191    message LspResolveState {
1192        optional string value = 1;
1193        uint64 server_id = 2;
1194    }
1195}
1196
1197// This type is used to resolve more than just
1198// the documentation, but for backwards-compatibility
1199// reasons we can't rename the type.
1200message ResolveCompletionDocumentation {
1201    uint64 project_id = 1;
1202    uint64 language_server_id = 2;
1203    bytes lsp_completion = 3;
1204    uint64 buffer_id = 4;
1205}
1206
1207message ResolveCompletionDocumentationResponse {
1208    string documentation = 1;
1209    bool documentation_is_markdown = 2;
1210    Anchor old_start = 3;
1211    Anchor old_end = 4;
1212    string new_text = 5;
1213    bytes lsp_completion = 6;
1214}
1215
1216message ResolveInlayHint {
1217    uint64 project_id = 1;
1218    uint64 buffer_id = 2;
1219    uint64 language_server_id = 3;
1220    InlayHint hint = 4;
1221}
1222
1223message ResolveInlayHintResponse {
1224    InlayHint hint = 1;
1225}
1226
1227message RefreshInlayHints {
1228    uint64 project_id = 1;
1229}
1230
1231message MarkupContent {
1232    bool is_markdown = 1;
1233    string value = 2;
1234}
1235
1236message PerformRenameResponse {
1237    ProjectTransaction transaction = 2;
1238}
1239
1240message SearchQuery {
1241    string query = 2;
1242    bool regex = 3;
1243    bool whole_word = 4;
1244    bool case_sensitive = 5;
1245    string files_to_include = 6;
1246    string files_to_exclude = 7;
1247    bool include_ignored = 8;
1248}
1249
1250message FindSearchCandidates {
1251    uint64 project_id = 1;
1252    SearchQuery query = 2;
1253    uint64 limit = 3;
1254}
1255
1256message FindSearchCandidatesResponse {
1257    repeated uint64 buffer_ids = 1;
1258}
1259
1260message CodeAction {
1261    uint64 server_id = 1;
1262    Anchor start = 2;
1263    Anchor end = 3;
1264    bytes lsp_action = 4;
1265}
1266
1267message ProjectTransaction {
1268    repeated uint64 buffer_ids = 1;
1269    repeated Transaction transactions = 2;
1270}
1271
1272message Transaction {
1273    LamportTimestamp id = 1;
1274    repeated LamportTimestamp edit_ids = 2;
1275    repeated VectorClockEntry start = 3;
1276}
1277
1278message LamportTimestamp {
1279    uint32 replica_id = 1;
1280    uint32 value = 2;
1281}
1282
1283message LanguageServer {
1284    uint64 id = 1;
1285    string name = 2;
1286    optional uint64 worktree_id = 3;
1287}
1288
1289message StartLanguageServer {
1290    uint64 project_id = 1;
1291    LanguageServer server = 2;
1292}
1293
1294message UpdateDiagnosticSummary {
1295    uint64 project_id = 1;
1296    uint64 worktree_id = 2;
1297    DiagnosticSummary summary = 3;
1298}
1299
1300message DiagnosticSummary {
1301    string path = 1;
1302    uint64 language_server_id = 2;
1303    uint32 error_count = 3;
1304    uint32 warning_count = 4;
1305}
1306
1307message UpdateLanguageServer {
1308    uint64 project_id = 1;
1309    uint64 language_server_id = 2;
1310    oneof variant {
1311        LspWorkStart work_start = 3;
1312        LspWorkProgress work_progress = 4;
1313        LspWorkEnd work_end = 5;
1314        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
1315        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
1316    }
1317}
1318
1319message LspWorkStart {
1320    string token = 1;
1321    optional string title = 4;
1322    optional string message = 2;
1323    optional uint32 percentage = 3;
1324    optional bool is_cancellable = 5;
1325}
1326
1327message LspWorkProgress {
1328    string token = 1;
1329    optional string message = 2;
1330    optional uint32 percentage = 3;
1331    optional bool is_cancellable = 4;
1332}
1333
1334message LspWorkEnd {
1335    string token = 1;
1336}
1337
1338message LspDiskBasedDiagnosticsUpdating {}
1339
1340message LspDiskBasedDiagnosticsUpdated {}
1341
1342message LanguageServerLog {
1343    uint64 project_id = 1;
1344    uint64 language_server_id = 2;
1345    oneof log_type {
1346        uint32 log_message_type = 3;
1347        LspLogTrace log_trace = 4;
1348    }
1349    string message = 5;
1350}
1351
1352message LspLogTrace {
1353    optional string message = 1;
1354}
1355
1356message UpdateChannels {
1357    repeated Channel channels = 1;
1358    repeated uint64 delete_channels = 4;
1359    repeated Channel channel_invitations = 5;
1360    repeated uint64 remove_channel_invitations = 6;
1361    repeated ChannelParticipants channel_participants = 7;
1362    repeated ChannelMessageId latest_channel_message_ids = 8;
1363    repeated ChannelBufferVersion latest_channel_buffer_versions = 9;
1364
1365    reserved 10 to 15;
1366}
1367
1368message UpdateUserChannels {
1369    repeated ChannelMessageId observed_channel_message_id = 1;
1370    repeated ChannelBufferVersion observed_channel_buffer_version = 2;
1371    repeated ChannelMembership channel_memberships = 3;
1372}
1373
1374message ChannelMembership {
1375    uint64 channel_id = 1;
1376    ChannelRole role = 2;
1377}
1378
1379message ChannelMessageId {
1380    uint64 channel_id = 1;
1381    uint64 message_id = 2;
1382}
1383
1384message ChannelPermission {
1385    uint64 channel_id = 1;
1386    ChannelRole role = 3;
1387}
1388
1389message ChannelParticipants {
1390    uint64 channel_id = 1;
1391    repeated uint64 participant_user_ids = 2;
1392}
1393
1394message JoinChannel {
1395    uint64 channel_id = 1;
1396}
1397
1398message DeleteChannel {
1399    uint64 channel_id = 1;
1400}
1401
1402message GetChannelMembers {
1403    uint64 channel_id = 1;
1404    string query = 2;
1405    uint64 limit = 3;
1406}
1407
1408message GetChannelMembersResponse {
1409    repeated ChannelMember members = 1;
1410    repeated User users = 2;
1411}
1412
1413message ChannelMember {
1414    uint64 user_id = 1;
1415    Kind kind = 3;
1416    ChannelRole role = 4;
1417
1418    enum Kind {
1419        Member = 0;
1420        Invitee = 1;
1421    }
1422}
1423
1424message SubscribeToChannels {}
1425
1426message CreateChannel {
1427    string name = 1;
1428    optional uint64 parent_id = 2;
1429}
1430
1431message CreateChannelResponse {
1432    Channel channel = 1;
1433    optional uint64 parent_id = 2;
1434}
1435
1436message InviteChannelMember {
1437    uint64 channel_id = 1;
1438    uint64 user_id = 2;
1439    ChannelRole role = 4;
1440}
1441
1442message RemoveChannelMember {
1443    uint64 channel_id = 1;
1444    uint64 user_id = 2;
1445}
1446
1447enum ChannelRole {
1448    Admin = 0;
1449    Member = 1;
1450    Guest = 2;
1451    Banned = 3;
1452    Talker = 4;
1453}
1454
1455message SetChannelMemberRole {
1456    uint64 channel_id = 1;
1457    uint64 user_id = 2;
1458    ChannelRole role = 3;
1459}
1460
1461message SetChannelVisibility {
1462    uint64 channel_id = 1;
1463    ChannelVisibility visibility = 2;
1464}
1465
1466message RenameChannel {
1467    uint64 channel_id = 1;
1468    string name = 2;
1469}
1470
1471message RenameChannelResponse {
1472    Channel channel = 1;
1473}
1474
1475message JoinChannelChat {
1476    uint64 channel_id = 1;
1477}
1478
1479message JoinChannelChatResponse {
1480    repeated ChannelMessage messages = 1;
1481    bool done = 2;
1482}
1483
1484message LeaveChannelChat {
1485    uint64 channel_id = 1;
1486}
1487
1488message SendChannelMessage {
1489    uint64 channel_id = 1;
1490    string body = 2;
1491    Nonce nonce = 3;
1492    repeated ChatMention mentions = 4;
1493    optional uint64 reply_to_message_id = 5;
1494}
1495
1496message RemoveChannelMessage {
1497    uint64 channel_id = 1;
1498    uint64 message_id = 2;
1499}
1500
1501message UpdateChannelMessage {
1502    uint64 channel_id = 1;
1503    uint64 message_id = 2;
1504    Nonce nonce = 4;
1505    string body = 5;
1506    repeated ChatMention mentions = 6;
1507}
1508
1509message AckChannelMessage {
1510    uint64 channel_id = 1;
1511    uint64 message_id = 2;
1512}
1513
1514message SendChannelMessageResponse {
1515    ChannelMessage message = 1;
1516}
1517
1518message ChannelMessageSent {
1519    uint64 channel_id = 1;
1520    ChannelMessage message = 2;
1521}
1522
1523message ChannelMessageUpdate {
1524    uint64 channel_id = 1;
1525    ChannelMessage message = 2;
1526}
1527
1528message GetChannelMessages {
1529    uint64 channel_id = 1;
1530    uint64 before_message_id = 2;
1531}
1532
1533message GetChannelMessagesResponse {
1534    repeated ChannelMessage messages = 1;
1535    bool done = 2;
1536}
1537
1538message GetChannelMessagesById {
1539    repeated uint64 message_ids = 1;
1540}
1541
1542message MoveChannel {
1543    uint64 channel_id = 1;
1544    uint64 to = 2;
1545}
1546
1547message JoinChannelBuffer {
1548    uint64 channel_id = 1;
1549}
1550
1551message ChannelMessage {
1552    uint64 id = 1;
1553    string body = 2;
1554    uint64 timestamp = 3;
1555    uint64 sender_id = 4;
1556    Nonce nonce = 5;
1557    repeated ChatMention mentions = 6;
1558    optional uint64 reply_to_message_id = 7;
1559    optional uint64 edited_at = 8;
1560}
1561
1562message ChatMention {
1563    Range range = 1;
1564    uint64 user_id = 2;
1565}
1566
1567message RejoinChannelBuffers {
1568    repeated ChannelBufferVersion buffers = 1;
1569}
1570
1571message RejoinChannelBuffersResponse {
1572    repeated RejoinedChannelBuffer buffers = 1;
1573}
1574
1575message AckBufferOperation {
1576    uint64 buffer_id = 1;
1577    uint64 epoch = 2;
1578    repeated VectorClockEntry version = 3;
1579}
1580
1581message JoinChannelBufferResponse {
1582    uint64 buffer_id = 1;
1583    uint32 replica_id = 2;
1584    string base_text = 3;
1585    repeated Operation operations = 4;
1586    repeated Collaborator collaborators = 5;
1587    uint64 epoch = 6;
1588}
1589
1590message RejoinedChannelBuffer {
1591    uint64 channel_id = 1;
1592    repeated VectorClockEntry version = 2;
1593    repeated Operation operations = 3;
1594    repeated Collaborator collaborators = 4;
1595}
1596
1597message LeaveChannelBuffer {
1598    uint64 channel_id = 1;
1599}
1600
1601message RespondToChannelInvite {
1602    uint64 channel_id = 1;
1603    bool accept = 2;
1604}
1605
1606message GetUsers {
1607    repeated uint64 user_ids = 1;
1608}
1609
1610message FuzzySearchUsers {
1611    string query = 1;
1612}
1613
1614message UsersResponse {
1615    repeated User users = 1;
1616}
1617
1618message RequestContact {
1619    uint64 responder_id = 1;
1620}
1621
1622message RemoveContact {
1623    uint64 user_id = 1;
1624}
1625
1626message RespondToContactRequest {
1627    uint64 requester_id = 1;
1628    ContactRequestResponse response = 2;
1629}
1630
1631enum ContactRequestResponse {
1632    Accept = 0;
1633    Decline = 1;
1634    Block = 2;
1635    Dismiss = 3;
1636}
1637
1638message UpdateContacts {
1639    repeated Contact contacts = 1;
1640    repeated uint64 remove_contacts = 2;
1641    repeated IncomingContactRequest incoming_requests = 3;
1642    repeated uint64 remove_incoming_requests = 4;
1643    repeated uint64 outgoing_requests = 5;
1644    repeated uint64 remove_outgoing_requests = 6;
1645}
1646
1647message UpdateInviteInfo {
1648    string url = 1;
1649    uint32 count = 2;
1650}
1651
1652message ShowContacts {}
1653
1654message IncomingContactRequest {
1655    uint64 requester_id = 1;
1656}
1657
1658message UpdateDiagnostics {
1659    uint32 replica_id = 1;
1660    uint32 lamport_timestamp = 2;
1661    uint64 server_id = 3;
1662    repeated Diagnostic diagnostics = 4;
1663}
1664
1665message Follow {
1666    uint64 room_id = 1;
1667    optional uint64 project_id = 2;
1668    PeerId leader_id = 3;
1669}
1670
1671message FollowResponse {
1672    View active_view = 3;
1673    // TODO: Remove after version 0.145.x stabilizes.
1674    optional ViewId active_view_id = 1;
1675    repeated View views = 2;
1676}
1677
1678message UpdateFollowers {
1679    uint64 room_id = 1;
1680    optional uint64 project_id = 2;
1681    reserved 3;
1682    oneof variant {
1683        View create_view = 5;
1684        // TODO: Remove after version 0.145.x stabilizes.
1685        UpdateActiveView update_active_view = 4;
1686        UpdateView update_view = 6;
1687    }
1688}
1689
1690message Unfollow {
1691    uint64 room_id = 1;
1692    optional uint64 project_id = 2;
1693    PeerId leader_id = 3;
1694}
1695
1696message GetPrivateUserInfo {}
1697
1698message GetPrivateUserInfoResponse {
1699    string metrics_id = 1;
1700    bool staff = 2;
1701    repeated string flags = 3;
1702    optional uint64 accepted_tos_at = 4;
1703}
1704
1705enum Plan {
1706    Free = 0;
1707    ZedPro = 1;
1708}
1709
1710message UpdateUserPlan {
1711    Plan plan = 1;
1712}
1713
1714message AcceptTermsOfService {}
1715
1716message AcceptTermsOfServiceResponse {
1717    uint64 accepted_tos_at = 1;
1718}
1719
1720// Entities
1721
1722message ViewId {
1723    PeerId creator = 1;
1724    uint64 id = 2;
1725}
1726
1727message UpdateActiveView {
1728    optional ViewId id = 1;
1729    optional PeerId leader_id = 2;
1730    View view = 3;
1731}
1732
1733enum PanelId {
1734    AssistantPanel = 0;
1735}
1736
1737message UpdateView {
1738    ViewId id = 1;
1739    optional PeerId leader_id = 2;
1740
1741    oneof variant {
1742        Editor editor = 3;
1743    }
1744
1745    message Editor {
1746        repeated ExcerptInsertion inserted_excerpts = 1;
1747        repeated uint64 deleted_excerpts = 2;
1748        repeated Selection selections = 3;
1749        optional Selection pending_selection = 4;
1750        EditorAnchor scroll_top_anchor = 5;
1751        float scroll_x = 6;
1752        float scroll_y = 7;
1753    }
1754}
1755
1756message View {
1757    ViewId id = 1;
1758    optional PeerId leader_id = 2;
1759    optional PanelId panel_id = 6;
1760
1761    oneof variant {
1762        Editor editor = 3;
1763        ChannelView channel_view = 4;
1764        ContextEditor context_editor = 5;
1765    }
1766
1767    message Editor {
1768        bool singleton = 1;
1769        optional string title = 2;
1770        repeated Excerpt excerpts = 3;
1771        repeated Selection selections = 4;
1772        optional Selection pending_selection = 5;
1773        EditorAnchor scroll_top_anchor = 6;
1774        float scroll_x = 7;
1775        float scroll_y = 8;
1776    }
1777
1778    message ChannelView {
1779        uint64 channel_id = 1;
1780        Editor editor = 2;
1781    }
1782
1783    message ContextEditor {
1784        string context_id = 1;
1785        Editor editor = 2;
1786    }
1787}
1788
1789message Collaborator {
1790    PeerId peer_id = 1;
1791    uint32 replica_id = 2;
1792    uint64 user_id = 3;
1793    bool is_host = 4;
1794}
1795
1796message User {
1797    uint64 id = 1;
1798    string github_login = 2;
1799    string avatar_url = 3;
1800    optional string email = 4;
1801    optional string name = 5;
1802}
1803
1804message File {
1805    uint64 worktree_id = 1;
1806    optional uint64 entry_id = 2;
1807    string path = 3;
1808    Timestamp mtime = 4;
1809    bool is_deleted = 5;
1810}
1811
1812message Entry {
1813    uint64 id = 1;
1814    bool is_dir = 2;
1815    string path = 3;
1816    uint64 inode = 4;
1817    Timestamp mtime = 5;
1818    bool is_ignored = 7;
1819    bool is_external = 8;
1820    reserved 6;
1821    reserved 9;
1822    bool is_fifo = 10;
1823    optional uint64 size = 11;
1824    optional string canonical_path = 12;
1825}
1826
1827message RepositoryEntry {
1828    uint64 work_directory_id = 1;
1829    optional string branch = 2; // deprecated
1830    optional Branch branch_summary = 6;
1831    repeated StatusEntry updated_statuses = 3;
1832    repeated string removed_statuses = 4;
1833    repeated string current_merge_conflicts = 5;
1834}
1835
1836
1837message StatusEntry {
1838    string repo_path = 1;
1839    // Can be removed once collab's min version is >=0.171.0.
1840    GitStatus simple_status = 2;
1841    GitFileStatus status = 3;
1842}
1843
1844enum GitStatus {
1845    Added = 0;
1846    Modified = 1;
1847    Conflict = 2;
1848    Deleted = 3;
1849    Updated = 4;
1850    TypeChanged = 5;
1851    Renamed = 6;
1852    Copied = 7;
1853    Unmodified = 8;
1854}
1855
1856message GitFileStatus {
1857    oneof variant {
1858        Untracked untracked = 1;
1859        Ignored ignored = 2;
1860        Unmerged unmerged = 3;
1861        Tracked tracked = 4;
1862    }
1863
1864    message Untracked {}
1865    message Ignored {}
1866    message Unmerged {
1867        GitStatus first_head = 1;
1868        GitStatus second_head = 2;
1869    }
1870    message Tracked {
1871        GitStatus index_status = 1;
1872        GitStatus worktree_status = 2;
1873    }
1874}
1875
1876message BufferState {
1877    uint64 id = 1;
1878    optional File file = 2;
1879    string base_text = 3;
1880    LineEnding line_ending = 5;
1881    repeated VectorClockEntry saved_version = 6;
1882    Timestamp saved_mtime = 8;
1883
1884    reserved 7;
1885    reserved 4;
1886}
1887
1888message BufferChunk {
1889    uint64 buffer_id = 1;
1890    repeated Operation operations = 2;
1891    bool is_last = 3;
1892}
1893
1894enum LineEnding {
1895    Unix = 0;
1896    Windows = 1;
1897}
1898
1899message Selection {
1900    uint64 id = 1;
1901    EditorAnchor start = 2;
1902    EditorAnchor end = 3;
1903    bool reversed = 4;
1904}
1905
1906message EditorAnchor {
1907    uint64 excerpt_id = 1;
1908    Anchor anchor = 2;
1909}
1910
1911enum CursorShape {
1912    CursorBar = 0;
1913    CursorBlock = 1;
1914    CursorUnderscore = 2;
1915    CursorHollow = 3;
1916}
1917
1918message ExcerptInsertion {
1919    Excerpt excerpt = 1;
1920    optional uint64 previous_excerpt_id = 2;
1921}
1922
1923message Excerpt {
1924    uint64 id = 1;
1925    uint64 buffer_id = 2;
1926    Anchor context_start = 3;
1927    Anchor context_end = 4;
1928    Anchor primary_start = 5;
1929    Anchor primary_end = 6;
1930}
1931
1932message Anchor {
1933    uint32 replica_id = 1;
1934    uint32 timestamp = 2;
1935    uint64 offset = 3;
1936    Bias bias = 4;
1937    optional uint64 buffer_id = 5;
1938}
1939
1940enum Bias {
1941    Left = 0;
1942    Right = 1;
1943}
1944
1945message Diagnostic {
1946    Anchor start = 1;
1947    Anchor end = 2;
1948    optional string source = 3;
1949    Severity severity = 4;
1950    string message = 5;
1951    optional string code = 6;
1952    uint64 group_id = 7;
1953    bool is_primary = 8;
1954
1955    // TODO: remove this field
1956    bool is_valid = 9;
1957
1958    bool is_disk_based = 10;
1959    bool is_unnecessary = 11;
1960
1961    enum Severity {
1962        None = 0;
1963        Error = 1;
1964        Warning = 2;
1965        Information = 3;
1966        Hint = 4;
1967    }
1968    optional string data = 12;
1969}
1970
1971message Operation {
1972    oneof variant {
1973        Edit edit = 1;
1974        Undo undo = 2;
1975        UpdateSelections update_selections = 3;
1976        UpdateDiagnostics update_diagnostics = 4;
1977        UpdateCompletionTriggers update_completion_triggers = 5;
1978    }
1979
1980    message Edit {
1981        uint32 replica_id = 1;
1982        uint32 lamport_timestamp = 2;
1983        repeated VectorClockEntry version = 3;
1984        repeated Range ranges = 4;
1985        repeated string new_text = 5;
1986    }
1987
1988    message Undo {
1989        uint32 replica_id = 1;
1990        uint32 lamport_timestamp = 2;
1991        repeated VectorClockEntry version = 3;
1992        repeated UndoCount counts = 4;
1993    }
1994
1995    message UpdateSelections {
1996        uint32 replica_id = 1;
1997        uint32 lamport_timestamp = 2;
1998        repeated Selection selections = 3;
1999        bool line_mode = 4;
2000        CursorShape cursor_shape = 5;
2001    }
2002
2003    message UpdateCompletionTriggers {
2004        uint32 replica_id = 1;
2005        uint32 lamport_timestamp = 2;
2006        repeated string triggers = 3;
2007        uint64 language_server_id = 4;
2008    }
2009}
2010
2011message UndoMapEntry {
2012    uint32 replica_id = 1;
2013    uint32 local_timestamp = 2;
2014    repeated UndoCount counts = 3;
2015}
2016
2017message UndoCount {
2018    uint32 replica_id = 1;
2019    uint32 lamport_timestamp = 2;
2020    uint32 count = 3;
2021}
2022
2023message VectorClockEntry {
2024    uint32 replica_id = 1;
2025    uint32 timestamp = 2;
2026}
2027
2028message Timestamp {
2029    uint64 seconds = 1;
2030    uint32 nanos = 2;
2031}
2032
2033message Range {
2034    uint64 start = 1;
2035    uint64 end = 2;
2036}
2037
2038message PointUtf16 {
2039    uint32 row = 1;
2040    uint32 column = 2;
2041}
2042
2043message Nonce {
2044    uint64 upper_half = 1;
2045    uint64 lower_half = 2;
2046}
2047
2048enum ChannelVisibility {
2049    Public = 0;
2050    Members = 1;
2051}
2052
2053message Channel {
2054    uint64 id = 1;
2055    string name = 2;
2056    ChannelVisibility visibility = 3;
2057    repeated uint64 parent_path = 5;
2058}
2059
2060message Contact {
2061    uint64 user_id = 1;
2062    bool online = 2;
2063    bool busy = 3;
2064}
2065
2066message WorktreeMetadata {
2067    uint64 id = 1;
2068    string root_name = 2;
2069    bool visible = 3;
2070    string abs_path = 4;
2071}
2072
2073message UpdateDiffBases {
2074    uint64 project_id = 1;
2075    uint64 buffer_id = 2;
2076
2077    enum Mode {
2078        // No collaborator is using the unstaged diff.
2079        HEAD_ONLY = 0;
2080        // No collaborator is using the diff from HEAD.
2081        INDEX_ONLY = 1;
2082        // Both the unstaged and uncommitted diffs are demanded,
2083        // and the contents of the index and HEAD are the same for this path.
2084        INDEX_MATCHES_HEAD = 2;
2085        // Both the unstaged and uncommitted diffs are demanded,
2086        // and the contents of the index and HEAD differ for this path,
2087        // where None means the path doesn't exist in that state of the repo.
2088        INDEX_AND_HEAD = 3;
2089    }
2090
2091    optional string staged_text = 3;
2092    optional string committed_text = 4;
2093    Mode mode = 5;
2094}
2095
2096message OpenUnstagedDiff {
2097    uint64 project_id = 1;
2098    uint64 buffer_id = 2;
2099}
2100
2101message OpenUnstagedDiffResponse {
2102    optional string staged_text = 1;
2103}
2104
2105message OpenUncommittedDiff {
2106    uint64 project_id = 1;
2107    uint64 buffer_id = 2;
2108}
2109
2110message OpenUncommittedDiffResponse {
2111    enum Mode {
2112        INDEX_MATCHES_HEAD = 0;
2113        INDEX_AND_HEAD = 1;
2114    }
2115    optional string staged_text = 1;
2116    optional string committed_text = 2;
2117    Mode mode = 3;
2118}
2119
2120message SetIndexText {
2121    uint64 project_id = 1;
2122    uint64 worktree_id = 2;
2123    uint64 work_directory_id = 3;
2124    string path = 4;
2125    optional string text = 5;
2126}
2127
2128message GetNotifications {
2129    optional uint64 before_id = 1;
2130}
2131
2132message AddNotification {
2133    Notification notification = 1;
2134}
2135
2136message GetNotificationsResponse {
2137    repeated Notification notifications = 1;
2138    bool done = 2;
2139}
2140
2141message DeleteNotification {
2142    uint64 notification_id = 1;
2143}
2144
2145message UpdateNotification {
2146    Notification notification = 1;
2147}
2148
2149message MarkNotificationRead {
2150    uint64 notification_id = 1;
2151}
2152
2153message Notification {
2154    uint64 id = 1;
2155    uint64 timestamp = 2;
2156    string kind = 3;
2157    optional uint64 entity_id = 4;
2158    string content = 5;
2159    bool is_read = 6;
2160    optional bool response = 7;
2161}
2162
2163message LspExtExpandMacro {
2164    uint64 project_id = 1;
2165    uint64 buffer_id = 2;
2166    Anchor position = 3;
2167}
2168
2169message LspExtExpandMacroResponse {
2170    string name = 1;
2171    string expansion = 2;
2172}
2173
2174message LspExtOpenDocs {
2175    uint64 project_id = 1;
2176    uint64 buffer_id = 2;
2177    Anchor position = 3;
2178}
2179
2180message LspExtOpenDocsResponse {
2181    optional string web = 1;
2182    optional string local = 2;
2183}
2184
2185message LspExtSwitchSourceHeader {
2186    uint64 project_id = 1;
2187    uint64 buffer_id = 2;
2188}
2189
2190message LspExtSwitchSourceHeaderResponse {
2191    string target_file = 1;
2192}
2193
2194message SetRoomParticipantRole {
2195    uint64 room_id = 1;
2196    uint64 user_id = 2;
2197    ChannelRole role = 3;
2198}
2199
2200enum LanguageModelRole {
2201    LanguageModelUser = 0;
2202    LanguageModelAssistant = 1;
2203    LanguageModelSystem = 2;
2204    reserved 3;
2205}
2206
2207message CountLanguageModelTokens {
2208    LanguageModelProvider provider = 1;
2209    string request = 2;
2210}
2211
2212message CountLanguageModelTokensResponse {
2213    uint32 token_count = 1;
2214}
2215
2216enum LanguageModelProvider {
2217    Anthropic = 0;
2218    OpenAI = 1;
2219    Google = 2;
2220    Zed = 3;
2221}
2222
2223message GetCachedEmbeddings {
2224    string model = 1;
2225    repeated bytes digests = 2;
2226}
2227
2228message GetCachedEmbeddingsResponse {
2229    repeated Embedding embeddings = 1;
2230}
2231
2232message ComputeEmbeddings {
2233    string model = 1;
2234    repeated string texts = 2;
2235}
2236
2237message ComputeEmbeddingsResponse {
2238    repeated Embedding embeddings = 1;
2239}
2240
2241message Embedding {
2242    bytes digest = 1;
2243    repeated float dimensions = 2;
2244}
2245
2246message BlameBuffer {
2247    uint64 project_id = 1;
2248    uint64 buffer_id = 2;
2249    repeated VectorClockEntry version = 3;
2250}
2251
2252message BlameEntry {
2253    bytes sha = 1;
2254
2255    uint32 start_line = 2;
2256    uint32 end_line = 3;
2257    uint32 original_line_number = 4;
2258
2259    optional string author = 5;
2260    optional string author_mail = 6;
2261    optional int64 author_time = 7;
2262    optional string author_tz = 8;
2263
2264    optional string committer = 9;
2265    optional string committer_mail = 10;
2266    optional int64 committer_time = 11;
2267    optional string committer_tz = 12;
2268
2269    optional string summary = 13;
2270    optional string previous = 14;
2271
2272    string filename = 15;
2273}
2274
2275message CommitMessage {
2276    bytes oid = 1;
2277    string message = 2;
2278}
2279
2280message CommitPermalink {
2281    bytes oid = 1;
2282    string permalink = 2;
2283}
2284
2285message BlameBufferResponse {
2286    message BlameResponse {
2287        repeated BlameEntry entries = 1;
2288        repeated CommitMessage messages = 2;
2289        repeated CommitPermalink permalinks = 3;
2290        optional string remote_url = 4;
2291    }
2292
2293    optional BlameResponse blame_response = 5;
2294
2295    reserved 1 to 4;
2296}
2297
2298message MultiLspQuery {
2299    uint64 project_id = 1;
2300    uint64 buffer_id = 2;
2301    repeated VectorClockEntry version = 3;
2302    oneof strategy {
2303        AllLanguageServers all = 4;
2304    }
2305    oneof request {
2306        GetHover get_hover = 5;
2307        GetCodeActions get_code_actions = 6;
2308        GetSignatureHelp get_signature_help = 7;
2309    }
2310}
2311
2312message AllLanguageServers {}
2313
2314message RestartLanguageServers {
2315    uint64 project_id = 1;
2316    repeated uint64 buffer_ids = 2;
2317}
2318
2319message MultiLspQueryResponse {
2320    repeated LspResponse responses = 1;
2321}
2322
2323message LspResponse {
2324    oneof response {
2325        GetHoverResponse get_hover_response = 1;
2326        GetCodeActionsResponse get_code_actions_response = 2;
2327        GetSignatureHelpResponse get_signature_help_response = 3;
2328    }
2329}
2330
2331message GetSupermavenApiKey {}
2332
2333message GetSupermavenApiKeyResponse {
2334    string api_key = 1;
2335}
2336
2337message TaskContextForLocation {
2338    uint64 project_id = 1;
2339    Location location = 2;
2340    map<string, string> task_variables = 3;
2341}
2342
2343message TaskContext {
2344    optional string cwd = 1;
2345    map<string, string> task_variables = 2;
2346    map<string, string> project_env = 3;
2347}
2348
2349message Shell {
2350    message WithArguments {
2351        string program = 1;
2352        repeated string args = 2;
2353    }
2354
2355    oneof shell_type {
2356        System system = 1;
2357        string program = 2;
2358        WithArguments with_arguments = 3;
2359    }
2360}
2361
2362message System {}
2363
2364enum RevealStrategy {
2365    RevealAlways = 0;
2366    RevealNever = 1;
2367}
2368
2369enum HideStrategy {
2370    HideAlways = 0;
2371    HideNever = 1;
2372    HideOnSuccess = 2;
2373}
2374
2375message ContextMessageStatus {
2376    oneof variant {
2377        Done done = 1;
2378        Pending pending = 2;
2379        Error error = 3;
2380        Canceled canceled = 4;
2381    }
2382
2383    message Done {}
2384
2385    message Pending {}
2386
2387    message Error {
2388        string message = 1;
2389    }
2390
2391    message Canceled {}
2392}
2393
2394message ContextMessage {
2395    LamportTimestamp id = 1;
2396    Anchor start = 2;
2397    LanguageModelRole role = 3;
2398    ContextMessageStatus status = 4;
2399}
2400
2401message SlashCommandOutputSection {
2402    AnchorRange range = 1;
2403    string icon_name = 2;
2404    string label = 3;
2405    optional string metadata = 4;
2406}
2407
2408message ContextOperation {
2409    oneof variant {
2410        InsertMessage insert_message = 1;
2411        UpdateMessage update_message = 2;
2412        UpdateSummary update_summary = 3;
2413        BufferOperation buffer_operation = 5;
2414        SlashCommandStarted slash_command_started = 6;
2415        SlashCommandOutputSectionAdded slash_command_output_section_added = 7;
2416        SlashCommandCompleted slash_command_completed = 8;
2417    }
2418
2419    reserved 4;
2420
2421    message InsertMessage {
2422        ContextMessage message = 1;
2423        repeated VectorClockEntry version = 2;
2424    }
2425
2426    message UpdateMessage {
2427        LamportTimestamp message_id = 1;
2428        LanguageModelRole role = 2;
2429        ContextMessageStatus status = 3;
2430        LamportTimestamp timestamp = 4;
2431        repeated VectorClockEntry version = 5;
2432    }
2433
2434    message UpdateSummary {
2435        string summary = 1;
2436        bool done = 2;
2437        LamportTimestamp timestamp = 3;
2438        repeated VectorClockEntry version = 4;
2439    }
2440
2441    message SlashCommandStarted {
2442        LamportTimestamp id = 1;
2443        AnchorRange output_range = 2;
2444        string name = 3;
2445        repeated VectorClockEntry version = 4;
2446    }
2447
2448    message SlashCommandOutputSectionAdded {
2449        LamportTimestamp timestamp = 1;
2450        SlashCommandOutputSection section = 2;
2451        repeated VectorClockEntry version = 3;
2452    }
2453
2454    message SlashCommandCompleted {
2455        LamportTimestamp id = 1;
2456        LamportTimestamp timestamp = 3;
2457        optional string error_message = 4;
2458        repeated VectorClockEntry version = 5;
2459    }
2460
2461    message BufferOperation {
2462        Operation operation = 1;
2463    }
2464}
2465
2466message Context {
2467    repeated ContextOperation operations = 1;
2468}
2469
2470message ContextMetadata {
2471    string context_id = 1;
2472    optional string summary = 2;
2473}
2474
2475message AdvertiseContexts {
2476    uint64 project_id = 1;
2477    repeated ContextMetadata contexts = 2;
2478}
2479
2480message OpenContext {
2481    uint64 project_id = 1;
2482    string context_id = 2;
2483}
2484
2485message OpenContextResponse {
2486    Context context = 1;
2487}
2488
2489message CreateContext {
2490    uint64 project_id = 1;
2491}
2492
2493message CreateContextResponse {
2494    string context_id = 1;
2495    Context context = 2;
2496}
2497
2498message UpdateContext {
2499    uint64 project_id = 1;
2500    string context_id = 2;
2501    ContextOperation operation = 3;
2502}
2503
2504message ContextVersion {
2505    string context_id = 1;
2506    repeated VectorClockEntry context_version = 2;
2507    repeated VectorClockEntry buffer_version = 3;
2508}
2509
2510message SynchronizeContexts {
2511    uint64 project_id = 1;
2512    repeated ContextVersion contexts = 2;
2513}
2514
2515message SynchronizeContextsResponse {
2516    repeated ContextVersion contexts = 1;
2517}
2518
2519message GetLlmToken {}
2520
2521message GetLlmTokenResponse {
2522    string token = 1;
2523}
2524
2525message RefreshLlmToken {}
2526
2527// Remote FS
2528
2529message AddWorktree {
2530    string path = 1;
2531    uint64 project_id = 2;
2532    bool visible = 3;
2533}
2534
2535message AddWorktreeResponse {
2536    uint64 worktree_id = 1;
2537    string canonicalized_path = 2;
2538}
2539
2540message GetPathMetadata {
2541    uint64 project_id = 1;
2542    string path = 2;
2543}
2544
2545message GetPathMetadataResponse {
2546    bool exists = 1;
2547    string path = 2;
2548    bool is_dir = 3;
2549}
2550
2551message ShutdownRemoteServer {}
2552
2553message RemoveWorktree {
2554    uint64 worktree_id = 1;
2555}
2556
2557message Toast {
2558    uint64 project_id = 1;
2559    string notification_id = 2;
2560    string message = 3;
2561}
2562
2563message HideToast {
2564    uint64 project_id = 1;
2565    string notification_id = 2;
2566}
2567
2568message OpenServerSettings {
2569    uint64 project_id = 1;
2570}
2571
2572message GetPermalinkToLine {
2573    uint64 project_id = 1;
2574    uint64 buffer_id = 2;
2575    Range selection = 3;
2576}
2577
2578message GetPermalinkToLineResponse {
2579    string permalink = 1;
2580}
2581message FlushBufferedMessages {}
2582message FlushBufferedMessagesResponse {}
2583
2584message LanguageServerPromptRequest {
2585    uint64 project_id = 1;
2586
2587    oneof level {
2588        Info info = 2;
2589        Warning warning = 3;
2590        Critical critical = 4;
2591    }
2592
2593    message Info {}
2594    message Warning {}
2595    message Critical {}
2596
2597    string message = 5;
2598    repeated string actions = 6;
2599    string lsp_name = 7;
2600}
2601
2602message LanguageServerPromptResponse {
2603    optional uint64 action_response = 1;
2604}
2605
2606message ListToolchains {
2607    uint64 project_id = 1;
2608    uint64 worktree_id = 2;
2609    string language_name = 3;
2610}
2611
2612message Toolchain {
2613    string name = 1;
2614    string path = 2;
2615    string raw_json = 3;
2616}
2617
2618message ToolchainGroup {
2619    uint64 start_index = 1;
2620    string name = 2;
2621}
2622
2623message ListToolchainsResponse {
2624    repeated Toolchain toolchains = 1;
2625    bool has_values = 2;
2626    repeated ToolchainGroup groups = 3;
2627}
2628
2629message ActivateToolchain {
2630    uint64 project_id = 1;
2631    uint64 worktree_id = 2;
2632    Toolchain toolchain = 3;
2633    string language_name = 4;
2634}
2635
2636message ActiveToolchain {
2637    uint64 project_id = 1;
2638    uint64 worktree_id = 2;
2639    string language_name = 3;
2640}
2641
2642message ActiveToolchainResponse {
2643    optional Toolchain toolchain = 1;
2644}
2645
2646message CommitSummary {
2647    string sha = 1;
2648    string subject = 2;
2649    int64 commit_timestamp = 3;
2650}
2651
2652message Branch {
2653    bool is_head = 1;
2654    string name = 2;
2655    optional uint64 unix_timestamp = 3;
2656    optional GitUpstream upstream = 4;
2657    optional CommitSummary most_recent_commit = 5;
2658}
2659message GitUpstream {
2660    string ref_name = 1;
2661    optional UpstreamTracking tracking = 2;
2662}
2663message UpstreamTracking {
2664    uint64 ahead = 1;
2665    uint64 behind = 2;
2666}
2667
2668message GitBranches {
2669    uint64 project_id = 1;
2670    ProjectPath repository = 2;
2671}
2672
2673message GitBranchesResponse {
2674    repeated Branch branches = 1;
2675}
2676
2677message UpdateGitBranch {
2678    uint64 project_id = 1;
2679    string branch_name = 2;
2680    ProjectPath repository = 3;
2681}
2682
2683message GetPanicFiles {
2684}
2685
2686message GitShow {
2687    uint64 project_id = 1;
2688    uint64 worktree_id = 2;
2689    uint64 work_directory_id = 3;
2690    string commit = 4;
2691}
2692
2693message GitCommitDetails {
2694    string sha = 1;
2695    string message = 2;
2696    int64 commit_timestamp = 3;
2697    string committer_email = 4;
2698    string committer_name = 5;
2699}
2700
2701message GitReset {
2702    uint64 project_id = 1;
2703    uint64 worktree_id = 2;
2704    uint64 work_directory_id = 3;
2705    string commit = 4;
2706    ResetMode mode = 5;
2707    enum ResetMode {
2708        SOFT = 0;
2709        MIXED = 1;
2710    }
2711}
2712
2713message GitCheckoutFiles {
2714    uint64 project_id = 1;
2715    uint64 worktree_id = 2;
2716    uint64 work_directory_id = 3;
2717    string commit = 4;
2718    repeated string paths = 5;
2719}
2720
2721message GetPanicFilesResponse {
2722    repeated string file_contents = 2;
2723}
2724
2725message CancelLanguageServerWork {
2726    uint64 project_id = 1;
2727
2728    oneof work {
2729        Buffers buffers = 2;
2730        LanguageServerWork language_server_work = 3;
2731    }
2732
2733    message Buffers {
2734        repeated uint64 buffer_ids = 2;
2735    }
2736
2737    message LanguageServerWork {
2738        uint64 language_server_id = 1;
2739        optional string token = 2;
2740    }
2741}
2742
2743message Extension {
2744    string id = 1;
2745    string version = 2;
2746    bool dev = 3;
2747}
2748
2749message SyncExtensions {
2750    repeated Extension extensions = 1;
2751}
2752
2753message SyncExtensionsResponse {
2754    string tmp_dir = 1;
2755    repeated Extension missing_extensions = 2;
2756}
2757
2758message InstallExtension {
2759    Extension extension = 1;
2760    string tmp_dir = 2;
2761}
2762
2763message RegisterBufferWithLanguageServers{
2764    uint64 project_id = 1;
2765    uint64 buffer_id = 2;
2766}
2767
2768message Stage {
2769    uint64 project_id = 1;
2770    uint64 worktree_id = 2;
2771    uint64 work_directory_id = 3;
2772    repeated string paths = 4;
2773}
2774
2775message Unstage {
2776    uint64 project_id = 1;
2777    uint64 worktree_id = 2;
2778    uint64 work_directory_id = 3;
2779    repeated string paths = 4;
2780}
2781
2782message Commit {
2783    uint64 project_id = 1;
2784    uint64 worktree_id = 2;
2785    uint64 work_directory_id = 3;
2786    optional string name = 4;
2787    optional string email = 5;
2788    string message = 6;
2789}
2790
2791message OpenCommitMessageBuffer {
2792    uint64 project_id = 1;
2793    uint64 worktree_id = 2;
2794    uint64 work_directory_id = 3;
2795}
2796
2797message Push {
2798    uint64 project_id = 1;
2799    uint64 worktree_id = 2;
2800    uint64 work_directory_id = 3;
2801    string remote_name = 4;
2802    string branch_name = 5;
2803    optional PushOptions options = 6;
2804
2805    enum PushOptions {
2806        SET_UPSTREAM = 0;
2807        FORCE = 1;
2808    }
2809}
2810
2811message Fetch {
2812    uint64 project_id = 1;
2813    uint64 worktree_id = 2;
2814    uint64 work_directory_id = 3;
2815}
2816
2817message GetRemotes {
2818    uint64 project_id = 1;
2819    uint64 worktree_id = 2;
2820    uint64 work_directory_id = 3;
2821    optional string branch_name = 4;
2822}
2823
2824message GetRemotesResponse {
2825    repeated Remote remotes = 1;
2826
2827    message Remote {
2828        string name = 1;
2829    }
2830}
2831
2832message Pull {
2833    uint64 project_id = 1;
2834    uint64 worktree_id = 2;
2835    uint64 work_directory_id = 3;
2836    string remote_name = 4;
2837    string branch_name = 5;
2838}
2839
2840message RemoteMessageResponse {
2841    string stdout = 1;
2842    string stderr = 2;
2843}