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