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