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