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