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