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