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