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