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