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