zed.proto

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