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