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