zed.proto

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