zed.proto

   1syntax = "proto3";
   2package zed.messages;
   3
   4// Looking for a number? Search "// current max"
   5
   6message PeerId {
   7    uint32 owner_id = 1;
   8    uint32 id = 2;
   9}
  10
  11message Envelope {
  12    uint32 id = 1;
  13    optional uint32 responding_to = 2;
  14    optional PeerId original_sender_id = 3;
  15
  16    /*
  17        When you are adding a new message type, instead of adding it in semantic order
  18        and bumping the message ID's of everything that follows, add it at the end of the
  19        file and bump the max number. See this
  20        https://github.com/zed-industries/zed/pull/7890#discussion_r1496621823
  21
  22    */
  23    oneof payload {
  24        Hello hello = 4;
  25        Ack ack = 5;
  26        Error error = 6;
  27        Ping ping = 7;
  28        Test test = 8;
  29        EndStream end_stream = 165;
  30
  31        CreateRoom create_room = 9;
  32        CreateRoomResponse create_room_response = 10;
  33        JoinRoom join_room = 11;
  34        JoinRoomResponse join_room_response = 12;
  35        RejoinRoom rejoin_room = 13;
  36        RejoinRoomResponse rejoin_room_response = 14;
  37        LeaveRoom leave_room = 15;
  38        Call call = 16;
  39        IncomingCall incoming_call = 17;
  40        CallCanceled call_canceled = 18;
  41        CancelCall cancel_call = 19;
  42        DeclineCall decline_call = 20;
  43        UpdateParticipantLocation update_participant_location = 21;
  44        RoomUpdated room_updated = 22;
  45
  46        ShareProject share_project = 23;
  47        ShareProjectResponse share_project_response = 24;
  48        UnshareProject unshare_project = 25;
  49        JoinProject join_project = 26;
  50        JoinProjectResponse join_project_response = 27;
  51        LeaveProject leave_project = 28;
  52        AddProjectCollaborator add_project_collaborator = 29;
  53        UpdateProjectCollaborator update_project_collaborator = 30;
  54        RemoveProjectCollaborator remove_project_collaborator = 31;
  55
  56        GetDefinition get_definition = 32;
  57        GetDefinitionResponse get_definition_response = 33;
  58        GetTypeDefinition get_type_definition = 34;
  59        GetTypeDefinitionResponse get_type_definition_response = 35;
  60
  61        GetReferences get_references = 36;
  62        GetReferencesResponse get_references_response = 37;
  63        GetDocumentHighlights get_document_highlights = 38;
  64        GetDocumentHighlightsResponse get_document_highlights_response = 39;
  65        GetProjectSymbols get_project_symbols = 40;
  66        GetProjectSymbolsResponse get_project_symbols_response = 41;
  67        OpenBufferForSymbol open_buffer_for_symbol = 42;
  68        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 43;
  69
  70        UpdateProject update_project = 44;
  71        UpdateWorktree update_worktree = 45;
  72
  73        CreateProjectEntry create_project_entry = 46;
  74        RenameProjectEntry rename_project_entry = 47;
  75        CopyProjectEntry copy_project_entry = 48;
  76        DeleteProjectEntry delete_project_entry = 49;
  77        ProjectEntryResponse project_entry_response = 50;
  78        ExpandProjectEntry expand_project_entry = 51;
  79        ExpandProjectEntryResponse expand_project_entry_response = 52;
  80
  81        UpdateDiagnosticSummary update_diagnostic_summary = 53;
  82        StartLanguageServer start_language_server = 54;
  83        UpdateLanguageServer update_language_server = 55;
  84
  85        OpenBufferById open_buffer_by_id = 56;
  86        OpenBufferByPath open_buffer_by_path = 57;
  87        OpenBufferResponse open_buffer_response = 58;
  88        CreateBufferForPeer create_buffer_for_peer = 59;
  89        UpdateBuffer update_buffer = 60;
  90        UpdateBufferFile update_buffer_file = 61;
  91        SaveBuffer save_buffer = 62;
  92        BufferSaved buffer_saved = 63;
  93        BufferReloaded buffer_reloaded = 64;
  94        ReloadBuffers reload_buffers = 65;
  95        ReloadBuffersResponse reload_buffers_response = 66;
  96        SynchronizeBuffers synchronize_buffers = 67;
  97        SynchronizeBuffersResponse synchronize_buffers_response = 68;
  98        FormatBuffers format_buffers = 69;
  99        FormatBuffersResponse format_buffers_response = 70;
 100        GetCompletions get_completions = 71;
 101        GetCompletionsResponse get_completions_response = 72;
 102        ResolveCompletionDocumentation resolve_completion_documentation = 73;
 103        ResolveCompletionDocumentationResponse resolve_completion_documentation_response = 74;
 104        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 75;
 105        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 76;
 106        GetCodeActions get_code_actions = 77;
 107        GetCodeActionsResponse get_code_actions_response = 78;
 108        GetHover get_hover = 79;
 109        GetHoverResponse get_hover_response = 80;
 110        ApplyCodeAction apply_code_action = 81;
 111        ApplyCodeActionResponse apply_code_action_response = 82;
 112        PrepareRename prepare_rename = 83;
 113        PrepareRenameResponse prepare_rename_response = 84;
 114        PerformRename perform_rename = 85;
 115        PerformRenameResponse perform_rename_response = 86;
 116        SearchProject search_project = 87;
 117        SearchProjectResponse search_project_response = 88;
 118
 119        UpdateContacts update_contacts = 89;
 120        UpdateInviteInfo update_invite_info = 90;
 121        ShowContacts show_contacts = 91;
 122
 123        GetUsers get_users = 92;
 124        FuzzySearchUsers fuzzy_search_users = 93;
 125        UsersResponse users_response = 94;
 126        RequestContact request_contact = 95;
 127        RespondToContactRequest respond_to_contact_request = 96;
 128        RemoveContact remove_contact = 97;
 129
 130        Follow follow = 98;
 131        FollowResponse follow_response = 99;
 132        UpdateFollowers update_followers = 100;
 133        Unfollow unfollow = 101;
 134        GetPrivateUserInfo get_private_user_info = 102;
 135        GetPrivateUserInfoResponse get_private_user_info_response = 103;
 136        UpdateDiffBase update_diff_base = 104;
 137
 138        OnTypeFormatting on_type_formatting = 105;
 139        OnTypeFormattingResponse on_type_formatting_response = 106;
 140
 141        UpdateWorktreeSettings update_worktree_settings = 107;
 142
 143        InlayHints inlay_hints = 108;
 144        InlayHintsResponse inlay_hints_response = 109;
 145        ResolveInlayHint resolve_inlay_hint = 110;
 146        ResolveInlayHintResponse resolve_inlay_hint_response = 111;
 147        RefreshInlayHints refresh_inlay_hints = 112;
 148
 149        CreateChannel create_channel = 113;
 150        CreateChannelResponse create_channel_response = 114;
 151        InviteChannelMember invite_channel_member = 115;
 152        RemoveChannelMember remove_channel_member = 116;
 153        RespondToChannelInvite respond_to_channel_invite = 117;
 154        UpdateChannels update_channels = 118;
 155        JoinChannel join_channel = 119;
 156        DeleteChannel delete_channel = 120;
 157        GetChannelMembers get_channel_members = 121;
 158        GetChannelMembersResponse get_channel_members_response = 122;
 159        SetChannelMemberRole set_channel_member_role = 123;
 160        RenameChannel rename_channel = 124;
 161        RenameChannelResponse rename_channel_response = 125;
 162
 163        JoinChannelBuffer join_channel_buffer = 126;
 164        JoinChannelBufferResponse join_channel_buffer_response = 127;
 165        UpdateChannelBuffer update_channel_buffer = 128;
 166        LeaveChannelBuffer leave_channel_buffer = 129;
 167        UpdateChannelBufferCollaborators update_channel_buffer_collaborators = 130;
 168        RejoinChannelBuffers rejoin_channel_buffers = 131;
 169        RejoinChannelBuffersResponse rejoin_channel_buffers_response = 132;
 170        AckBufferOperation ack_buffer_operation = 133;
 171
 172        JoinChannelChat join_channel_chat = 134;
 173        JoinChannelChatResponse join_channel_chat_response = 135;
 174        LeaveChannelChat leave_channel_chat = 136;
 175        SendChannelMessage send_channel_message = 137;
 176        SendChannelMessageResponse send_channel_message_response = 138;
 177        ChannelMessageSent channel_message_sent = 139;
 178        GetChannelMessages get_channel_messages = 140;
 179        GetChannelMessagesResponse get_channel_messages_response = 141;
 180        RemoveChannelMessage remove_channel_message = 142;
 181        AckChannelMessage ack_channel_message = 143;
 182        GetChannelMessagesById get_channel_messages_by_id = 144;
 183
 184        MoveChannel move_channel = 147;
 185        SetChannelVisibility set_channel_visibility = 148;
 186
 187        AddNotification add_notification = 149;
 188        GetNotifications get_notifications = 150;
 189        GetNotificationsResponse get_notifications_response = 151;
 190        DeleteNotification delete_notification = 152;
 191        MarkNotificationRead mark_notification_read = 153;
 192        LspExtExpandMacro lsp_ext_expand_macro = 154;
 193        LspExtExpandMacroResponse lsp_ext_expand_macro_response = 155;
 194        SetRoomParticipantRole set_room_participant_role = 156;
 195
 196        UpdateUserChannels update_user_channels = 157;
 197
 198        GetImplementation get_implementation = 162;
 199        GetImplementationResponse get_implementation_response = 163;
 200
 201        JoinHostedProject join_hosted_project = 164;
 202
 203        CompleteWithLanguageModel complete_with_language_model = 166;
 204        LanguageModelResponse language_model_response = 167;
 205        CountTokensWithLanguageModel count_tokens_with_language_model = 168;
 206        CountTokensResponse count_tokens_response = 169;
 207        UpdateChannelMessage update_channel_message = 170;
 208        ChannelMessageUpdate channel_message_update = 171;
 209
 210        BlameBuffer blame_buffer = 172;
 211        BlameBufferResponse blame_buffer_response = 173;
 212
 213        UpdateNotification update_notification = 174;
 214
 215        MultiLspQuery multi_lsp_query = 175;
 216        MultiLspQueryResponse multi_lsp_query_response = 176; // current max
 217    }
 218
 219    reserved 158 to 161;
 220}
 221
 222// Messages
 223
 224message Hello {
 225    PeerId peer_id = 1;
 226}
 227
 228message Ping {}
 229
 230message Ack {}
 231
 232message Error {
 233    string message = 1;
 234    ErrorCode code = 2;
 235    repeated string tags = 3;
 236}
 237
 238enum ErrorCode {
 239    Internal = 0;
 240    NoSuchChannel = 1;
 241    Disconnected = 2;
 242    SignedOut = 3;
 243    UpgradeRequired = 4;
 244    Forbidden = 5;
 245    NeedsCla = 7;
 246    NotARootChannel = 8;
 247    BadPublicNesting = 9;
 248    CircularNesting = 10;
 249    WrongMoveTarget = 11;
 250    UnsharedItem = 12;
 251    NoSuchProject = 13;
 252    reserved 6;
 253}
 254
 255message EndStream {}
 256
 257message Test {
 258    uint64 id = 1;
 259}
 260
 261message CreateRoom {}
 262
 263message CreateRoomResponse {
 264    Room room = 1;
 265    optional LiveKitConnectionInfo live_kit_connection_info = 2;
 266}
 267
 268message JoinRoom {
 269    uint64 id = 1;
 270}
 271
 272message JoinRoomResponse {
 273    Room room = 1;
 274    optional uint64 channel_id = 2;
 275    optional LiveKitConnectionInfo live_kit_connection_info = 3;
 276}
 277
 278message RejoinRoom {
 279    uint64 id = 1;
 280    repeated UpdateProject reshared_projects = 2;
 281    repeated RejoinProject rejoined_projects = 3;
 282}
 283
 284message RejoinProject {
 285    uint64 id = 1;
 286    repeated RejoinWorktree worktrees = 2;
 287}
 288
 289message RejoinWorktree {
 290    uint64 id = 1;
 291    uint64 scan_id = 2;
 292}
 293
 294message RejoinRoomResponse {
 295    Room room = 1;
 296    repeated ResharedProject reshared_projects = 2;
 297    repeated RejoinedProject rejoined_projects = 3;
 298}
 299
 300message ResharedProject {
 301    uint64 id = 1;
 302    repeated Collaborator collaborators = 2;
 303}
 304
 305message RejoinedProject {
 306    uint64 id = 1;
 307    repeated WorktreeMetadata worktrees = 2;
 308    repeated Collaborator collaborators = 3;
 309    repeated LanguageServer language_servers = 4;
 310}
 311
 312message LeaveRoom {}
 313
 314message Room {
 315    uint64 id = 1;
 316    repeated Participant participants = 2;
 317    repeated PendingParticipant pending_participants = 3;
 318    repeated Follower followers = 4;
 319    string live_kit_room = 5;
 320}
 321
 322message Participant {
 323    uint64 user_id = 1;
 324    PeerId peer_id = 2;
 325    repeated ParticipantProject projects = 3;
 326    ParticipantLocation location = 4;
 327    uint32 participant_index = 5;
 328    ChannelRole role = 6;
 329    reserved 7;
 330}
 331
 332message PendingParticipant {
 333    uint64 user_id = 1;
 334    uint64 calling_user_id = 2;
 335    optional uint64 initial_project_id = 3;
 336}
 337
 338message ParticipantProject {
 339    uint64 id = 1;
 340    repeated string worktree_root_names = 2;
 341}
 342
 343message Follower {
 344    PeerId leader_id = 1;
 345    PeerId follower_id = 2;
 346    uint64 project_id = 3;
 347}
 348
 349message ParticipantLocation {
 350    oneof variant {
 351        SharedProject shared_project = 1;
 352        UnsharedProject unshared_project = 2;
 353        External external = 3;
 354    }
 355
 356    message SharedProject {
 357        uint64 id = 1;
 358    }
 359
 360    message UnsharedProject {}
 361
 362    message External {}
 363}
 364
 365message Call {
 366    uint64 room_id = 1;
 367    uint64 called_user_id = 2;
 368    optional uint64 initial_project_id = 3;
 369}
 370
 371message IncomingCall {
 372    uint64 room_id = 1;
 373    uint64 calling_user_id = 2;
 374    repeated uint64 participant_user_ids = 3;
 375    optional ParticipantProject initial_project = 4;
 376}
 377
 378message CallCanceled {
 379    uint64 room_id = 1;
 380}
 381
 382message CancelCall {
 383    uint64 room_id = 1;
 384    uint64 called_user_id = 2;
 385}
 386
 387message DeclineCall {
 388    uint64 room_id = 1;
 389}
 390
 391message UpdateParticipantLocation {
 392    uint64 room_id = 1;
 393    ParticipantLocation location = 2;
 394}
 395
 396message RoomUpdated {
 397    Room room = 1;
 398}
 399
 400message LiveKitConnectionInfo {
 401    string server_url = 1;
 402    string token = 2;
 403    bool can_publish = 3;
 404}
 405
 406message ShareProject {
 407    uint64 room_id = 1;
 408    repeated WorktreeMetadata worktrees = 2;
 409}
 410
 411message ShareProjectResponse {
 412    uint64 project_id = 1;
 413}
 414
 415message UnshareProject {
 416    uint64 project_id = 1;
 417}
 418
 419message UpdateProject {
 420    uint64 project_id = 1;
 421    repeated WorktreeMetadata worktrees = 2;
 422}
 423
 424message JoinProject {
 425    uint64 project_id = 1;
 426}
 427
 428message JoinHostedProject {
 429    uint64 project_id = 1;
 430}
 431
 432message JoinProjectResponse {
 433    uint64 project_id = 5;
 434    uint32 replica_id = 1;
 435    repeated WorktreeMetadata worktrees = 2;
 436    repeated Collaborator collaborators = 3;
 437    repeated LanguageServer language_servers = 4;
 438    ChannelRole role = 6;
 439}
 440
 441message LeaveProject {
 442    uint64 project_id = 1;
 443}
 444
 445message UpdateWorktree {
 446    uint64 project_id = 1;
 447    uint64 worktree_id = 2;
 448    string root_name = 3;
 449    repeated Entry updated_entries = 4;
 450    repeated uint64 removed_entries = 5;
 451    repeated RepositoryEntry updated_repositories = 6;
 452    repeated uint64 removed_repositories = 7;
 453    uint64 scan_id = 8;
 454    bool is_last_update = 9;
 455    string abs_path = 10;
 456}
 457
 458message UpdateWorktreeSettings {
 459    uint64 project_id = 1;
 460    uint64 worktree_id = 2;
 461    string path = 3;
 462    optional string content = 4;
 463}
 464
 465message CreateProjectEntry {
 466    uint64 project_id = 1;
 467    uint64 worktree_id = 2;
 468    string path = 3;
 469    bool is_directory = 4;
 470}
 471
 472message RenameProjectEntry {
 473    uint64 project_id = 1;
 474    uint64 entry_id = 2;
 475    string new_path = 3;
 476}
 477
 478message CopyProjectEntry {
 479    uint64 project_id = 1;
 480    uint64 entry_id = 2;
 481    string new_path = 3;
 482}
 483
 484message DeleteProjectEntry {
 485    uint64 project_id = 1;
 486    uint64 entry_id = 2;
 487}
 488
 489message ExpandProjectEntry {
 490    uint64 project_id = 1;
 491    uint64 entry_id = 2;
 492}
 493
 494message ExpandProjectEntryResponse {
 495    uint64 worktree_scan_id = 1;
 496}
 497
 498message ProjectEntryResponse {
 499    optional Entry entry = 1;
 500    uint64 worktree_scan_id = 2;
 501}
 502
 503message AddProjectCollaborator {
 504    uint64 project_id = 1;
 505    Collaborator collaborator = 2;
 506}
 507
 508message UpdateProjectCollaborator {
 509    uint64 project_id = 1;
 510    PeerId old_peer_id = 2;
 511    PeerId new_peer_id = 3;
 512}
 513
 514message RemoveProjectCollaborator {
 515    uint64 project_id = 1;
 516    PeerId peer_id = 2;
 517}
 518
 519message UpdateChannelBufferCollaborators {
 520    uint64 channel_id = 1;
 521    repeated Collaborator collaborators = 2;
 522}
 523
 524message GetDefinition {
 525     uint64 project_id = 1;
 526     uint64 buffer_id = 2;
 527     Anchor position = 3;
 528     repeated VectorClockEntry version = 4;
 529 }
 530
 531message GetDefinitionResponse {
 532    repeated LocationLink links = 1;
 533}
 534
 535message GetTypeDefinition {
 536     uint64 project_id = 1;
 537     uint64 buffer_id = 2;
 538     Anchor position = 3;
 539     repeated VectorClockEntry version = 4;
 540 }
 541
 542message GetTypeDefinitionResponse {
 543    repeated LocationLink links = 1;
 544}
 545message GetImplementation {
 546     uint64 project_id = 1;
 547     uint64 buffer_id = 2;
 548     Anchor position = 3;
 549     repeated VectorClockEntry version = 4;
 550 }
 551
 552message GetImplementationResponse {
 553    repeated LocationLink links = 1;
 554}
 555
 556message GetReferences {
 557     uint64 project_id = 1;
 558     uint64 buffer_id = 2;
 559     Anchor position = 3;
 560     repeated VectorClockEntry version = 4;
 561 }
 562
 563message GetReferencesResponse {
 564    repeated Location locations = 1;
 565}
 566
 567message GetDocumentHighlights {
 568     uint64 project_id = 1;
 569     uint64 buffer_id = 2;
 570     Anchor position = 3;
 571     repeated VectorClockEntry version = 4;
 572 }
 573
 574message GetDocumentHighlightsResponse {
 575    repeated DocumentHighlight highlights = 1;
 576}
 577
 578message Location {
 579    uint64 buffer_id = 1;
 580    Anchor start = 2;
 581    Anchor end = 3;
 582}
 583
 584message LocationLink {
 585    optional Location origin = 1;
 586    Location target = 2;
 587}
 588
 589message DocumentHighlight {
 590    Kind kind = 1;
 591    Anchor start = 2;
 592    Anchor end = 3;
 593
 594    enum Kind {
 595        Text = 0;
 596        Read = 1;
 597        Write = 2;
 598    }
 599}
 600
 601message GetProjectSymbols {
 602    uint64 project_id = 1;
 603    string query = 2;
 604}
 605
 606message GetProjectSymbolsResponse {
 607    repeated Symbol symbols = 4;
 608}
 609
 610message Symbol {
 611    uint64 source_worktree_id = 1;
 612    uint64 worktree_id = 2;
 613    string language_server_name = 3;
 614    string name = 4;
 615    int32 kind = 5;
 616    string path = 6;
 617    // Cannot use generate anchors for unopened files,
 618    // so we are forced to use point coords instead
 619    PointUtf16 start = 7;
 620    PointUtf16 end = 8;
 621    bytes signature = 9;
 622}
 623
 624message OpenBufferForSymbol {
 625    uint64 project_id = 1;
 626    Symbol symbol = 2;
 627}
 628
 629message OpenBufferForSymbolResponse {
 630    uint64 buffer_id = 1;
 631}
 632
 633message OpenBufferByPath {
 634    uint64 project_id = 1;
 635    uint64 worktree_id = 2;
 636    string path = 3;
 637}
 638
 639message OpenBufferById {
 640    uint64 project_id = 1;
 641    uint64 id = 2;
 642}
 643
 644message OpenBufferResponse {
 645    uint64 buffer_id = 1;
 646}
 647
 648message CreateBufferForPeer {
 649    uint64 project_id = 1;
 650    PeerId peer_id = 2;
 651    oneof variant {
 652        BufferState state = 3;
 653        BufferChunk chunk = 4;
 654    }
 655}
 656
 657message UpdateBuffer {
 658    uint64 project_id = 1;
 659    uint64 buffer_id = 2;
 660    repeated Operation operations = 3;
 661}
 662
 663message UpdateChannelBuffer {
 664    uint64 channel_id = 1;
 665    repeated Operation operations = 2;
 666}
 667
 668message UpdateBufferFile {
 669    uint64 project_id = 1;
 670    uint64 buffer_id = 2;
 671    File file = 3;
 672}
 673
 674message SaveBuffer {
 675    uint64 project_id = 1;
 676    uint64 buffer_id = 2;
 677    repeated VectorClockEntry version = 3;
 678}
 679
 680message BufferSaved {
 681    uint64 project_id = 1;
 682    uint64 buffer_id = 2;
 683    repeated VectorClockEntry version = 3;
 684    Timestamp mtime = 4;
 685    string fingerprint = 5;
 686}
 687
 688message BufferReloaded {
 689    uint64 project_id = 1;
 690    uint64 buffer_id = 2;
 691    repeated VectorClockEntry version = 3;
 692    Timestamp mtime = 4;
 693    string fingerprint = 5;
 694    LineEnding line_ending = 6;
 695}
 696
 697message ReloadBuffers {
 698    uint64 project_id = 1;
 699    repeated uint64 buffer_ids = 2;
 700}
 701
 702message ReloadBuffersResponse {
 703    ProjectTransaction transaction = 1;
 704}
 705
 706message SynchronizeBuffers {
 707    uint64 project_id = 1;
 708    repeated BufferVersion buffers = 2;
 709}
 710
 711message SynchronizeBuffersResponse {
 712    repeated BufferVersion buffers = 1;
 713}
 714
 715message BufferVersion {
 716    uint64 id = 1;
 717    repeated VectorClockEntry version = 2;
 718}
 719
 720message ChannelBufferVersion {
 721    uint64 channel_id = 1;
 722    repeated VectorClockEntry version = 2;
 723    uint64 epoch = 3;
 724}
 725
 726enum FormatTrigger {
 727    Save = 0;
 728    Manual = 1;
 729}
 730
 731message FormatBuffers {
 732    uint64 project_id = 1;
 733    FormatTrigger trigger = 2;
 734    repeated uint64 buffer_ids = 3;
 735}
 736
 737message FormatBuffersResponse {
 738    ProjectTransaction transaction = 1;
 739}
 740
 741message GetCompletions {
 742    uint64 project_id = 1;
 743    uint64 buffer_id = 2;
 744    Anchor position = 3;
 745    repeated VectorClockEntry version = 4;
 746}
 747
 748message GetCompletionsResponse {
 749    repeated Completion completions = 1;
 750    repeated VectorClockEntry version = 2;
 751}
 752
 753message ApplyCompletionAdditionalEdits {
 754    uint64 project_id = 1;
 755    uint64 buffer_id = 2;
 756    Completion completion = 3;
 757}
 758
 759message ApplyCompletionAdditionalEditsResponse {
 760    Transaction transaction = 1;
 761}
 762
 763message Completion {
 764    Anchor old_start = 1;
 765    Anchor old_end = 2;
 766    string new_text = 3;
 767    uint64 server_id = 4;
 768    bytes lsp_completion = 5;
 769}
 770
 771message GetCodeActions {
 772    uint64 project_id = 1;
 773    uint64 buffer_id = 2;
 774    Anchor start = 3;
 775    Anchor end = 4;
 776    repeated VectorClockEntry version = 5;
 777}
 778
 779message GetCodeActionsResponse {
 780    repeated CodeAction actions = 1;
 781    repeated VectorClockEntry version = 2;
 782}
 783
 784message GetHover {
 785    uint64 project_id = 1;
 786    uint64 buffer_id = 2;
 787    Anchor position = 3;
 788    repeated VectorClockEntry version = 5;
 789}
 790
 791message GetHoverResponse {
 792    optional Anchor start = 1;
 793    optional Anchor end = 2;
 794    repeated HoverBlock contents = 3;
 795}
 796
 797message HoverBlock {
 798    string text = 1;
 799    optional string language = 2;
 800    bool is_markdown = 3;
 801}
 802
 803message ApplyCodeAction {
 804    uint64 project_id = 1;
 805    uint64 buffer_id = 2;
 806    CodeAction action = 3;
 807}
 808
 809message ApplyCodeActionResponse {
 810    ProjectTransaction transaction = 1;
 811}
 812
 813message PrepareRename {
 814    uint64 project_id = 1;
 815    uint64 buffer_id = 2;
 816    Anchor position = 3;
 817    repeated VectorClockEntry version = 4;
 818}
 819
 820message PrepareRenameResponse {
 821    bool can_rename = 1;
 822    Anchor start = 2;
 823    Anchor end = 3;
 824    repeated VectorClockEntry version = 4;
 825}
 826
 827message PerformRename {
 828    uint64 project_id = 1;
 829    uint64 buffer_id = 2;
 830    Anchor position = 3;
 831    string new_name = 4;
 832    repeated VectorClockEntry version = 5;
 833}
 834
 835message OnTypeFormatting {
 836    uint64 project_id = 1;
 837    uint64 buffer_id = 2;
 838    Anchor position = 3;
 839    string trigger = 4;
 840    repeated VectorClockEntry version = 5;
 841}
 842
 843message OnTypeFormattingResponse {
 844    Transaction transaction = 1;
 845}
 846
 847message InlayHints {
 848    uint64 project_id = 1;
 849    uint64 buffer_id = 2;
 850    Anchor start = 3;
 851    Anchor end = 4;
 852    repeated VectorClockEntry version = 5;
 853}
 854
 855message InlayHintsResponse {
 856    repeated InlayHint hints = 1;
 857    repeated VectorClockEntry version = 2;
 858}
 859
 860message InlayHint {
 861    Anchor position = 1;
 862    InlayHintLabel label = 2;
 863    optional string kind = 3;
 864    bool padding_left = 4;
 865    bool padding_right = 5;
 866    InlayHintTooltip tooltip = 6;
 867    ResolveState resolve_state = 7;
 868}
 869
 870message InlayHintLabel {
 871    oneof label {
 872        string value = 1;
 873        InlayHintLabelParts label_parts = 2;
 874    }
 875}
 876
 877message InlayHintLabelParts {
 878    repeated InlayHintLabelPart parts = 1;
 879}
 880
 881message InlayHintLabelPart {
 882    string value = 1;
 883    InlayHintLabelPartTooltip tooltip = 2;
 884    optional string location_url = 3;
 885    PointUtf16 location_range_start = 4;
 886    PointUtf16 location_range_end = 5;
 887    optional uint64 language_server_id = 6;
 888}
 889
 890message InlayHintTooltip {
 891    oneof content {
 892        string value = 1;
 893        MarkupContent markup_content = 2;
 894    }
 895}
 896
 897message InlayHintLabelPartTooltip {
 898    oneof content {
 899        string value = 1;
 900        MarkupContent markup_content = 2;
 901    }
 902}
 903
 904message ResolveState {
 905    State state = 1;
 906    LspResolveState lsp_resolve_state = 2;
 907
 908    enum State {
 909        Resolved = 0;
 910        CanResolve = 1;
 911        Resolving = 2;
 912    }
 913
 914    message LspResolveState {
 915        string value = 1;
 916        uint64 server_id = 2;
 917    }
 918}
 919
 920message ResolveCompletionDocumentation {
 921    uint64 project_id = 1;
 922    uint64 language_server_id = 2;
 923    bytes lsp_completion = 3;
 924}
 925
 926message ResolveCompletionDocumentationResponse {
 927    string text = 1;
 928    bool is_markdown = 2;
 929}
 930
 931message ResolveInlayHint {
 932    uint64 project_id = 1;
 933    uint64 buffer_id = 2;
 934    uint64 language_server_id = 3;
 935    InlayHint hint = 4;
 936}
 937
 938message ResolveInlayHintResponse {
 939    InlayHint hint = 1;
 940}
 941
 942message RefreshInlayHints {
 943    uint64 project_id = 1;
 944}
 945
 946message MarkupContent {
 947    bool is_markdown = 1;
 948    string value = 2;
 949}
 950
 951message PerformRenameResponse {
 952    ProjectTransaction transaction = 2;
 953}
 954
 955message SearchProject {
 956    uint64 project_id = 1;
 957    string query = 2;
 958    bool regex = 3;
 959    bool whole_word = 4;
 960    bool case_sensitive = 5;
 961    string files_to_include = 6;
 962    string files_to_exclude = 7;
 963    bool include_ignored = 8;
 964}
 965
 966message SearchProjectResponse {
 967    repeated Location locations = 1;
 968    bool limit_reached = 2;
 969}
 970
 971message CodeAction {
 972    uint64 server_id = 1;
 973    Anchor start = 2;
 974    Anchor end = 3;
 975    bytes lsp_action = 4;
 976}
 977
 978message ProjectTransaction {
 979    repeated uint64 buffer_ids = 1;
 980    repeated Transaction transactions = 2;
 981}
 982
 983message Transaction {
 984    LamportTimestamp id = 1;
 985    repeated LamportTimestamp edit_ids = 2;
 986    repeated VectorClockEntry start = 3;
 987}
 988
 989message LamportTimestamp {
 990    uint32 replica_id = 1;
 991    uint32 value = 2;
 992}
 993
 994message LanguageServer {
 995    uint64 id = 1;
 996    string name = 2;
 997}
 998
 999message StartLanguageServer {
1000    uint64 project_id = 1;
1001    LanguageServer server = 2;
1002}
1003
1004message UpdateDiagnosticSummary {
1005    uint64 project_id = 1;
1006    uint64 worktree_id = 2;
1007    DiagnosticSummary summary = 3;
1008}
1009
1010message DiagnosticSummary {
1011    string path = 1;
1012    uint64 language_server_id = 2;
1013    uint32 error_count = 3;
1014    uint32 warning_count = 4;
1015}
1016
1017message UpdateLanguageServer {
1018    uint64 project_id = 1;
1019    uint64 language_server_id = 2;
1020    oneof variant {
1021        LspWorkStart work_start = 3;
1022        LspWorkProgress work_progress = 4;
1023        LspWorkEnd work_end = 5;
1024        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
1025        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
1026    }
1027}
1028
1029message LspWorkStart {
1030    string token = 1;
1031    optional string message = 2;
1032    optional uint32 percentage = 3;
1033}
1034
1035message LspWorkProgress {
1036    string token = 1;
1037    optional string message = 2;
1038    optional uint32 percentage = 3;
1039}
1040
1041message LspWorkEnd {
1042    string token = 1;
1043}
1044
1045message LspDiskBasedDiagnosticsUpdating {}
1046
1047message LspDiskBasedDiagnosticsUpdated {}
1048
1049message UpdateChannels {
1050    repeated Channel channels = 1;
1051    repeated uint64 delete_channels = 4;
1052    repeated Channel channel_invitations = 5;
1053    repeated uint64 remove_channel_invitations = 6;
1054    repeated ChannelParticipants channel_participants = 7;
1055    repeated ChannelMessageId latest_channel_message_ids = 8;
1056    repeated ChannelBufferVersion latest_channel_buffer_versions = 9;
1057
1058    repeated HostedProject hosted_projects = 10;
1059    repeated uint64 deleted_hosted_projects = 11;
1060}
1061
1062message UpdateUserChannels {
1063    repeated ChannelMessageId observed_channel_message_id = 1;
1064    repeated ChannelBufferVersion observed_channel_buffer_version = 2;
1065    repeated ChannelMembership channel_memberships = 3;
1066}
1067
1068message ChannelMembership {
1069    uint64 channel_id = 1;
1070    ChannelRole role = 2;
1071}
1072
1073message ChannelMessageId {
1074    uint64 channel_id = 1;
1075    uint64 message_id = 2;
1076}
1077
1078message ChannelPermission {
1079    uint64 channel_id = 1;
1080    ChannelRole role = 3;
1081}
1082
1083message ChannelParticipants {
1084    uint64 channel_id = 1;
1085    repeated uint64 participant_user_ids = 2;
1086}
1087
1088message HostedProject {
1089    uint64 project_id = 1;
1090    uint64 channel_id = 2;
1091    string name = 3;
1092    ChannelVisibility visibility = 4;
1093}
1094
1095message JoinChannel {
1096    uint64 channel_id = 1;
1097}
1098
1099message DeleteChannel {
1100    uint64 channel_id = 1;
1101}
1102
1103message GetChannelMembers {
1104    uint64 channel_id = 1;
1105}
1106
1107message GetChannelMembersResponse {
1108    repeated ChannelMember members = 1;
1109}
1110
1111message ChannelMember {
1112    uint64 user_id = 1;
1113    Kind kind = 3;
1114    ChannelRole role = 4;
1115
1116    enum Kind {
1117        Member = 0;
1118        Invitee = 1;
1119    }
1120}
1121
1122message CreateChannel {
1123    string name = 1;
1124    optional uint64 parent_id = 2;
1125}
1126
1127message CreateChannelResponse {
1128    Channel channel = 1;
1129    optional uint64 parent_id = 2;
1130}
1131
1132message InviteChannelMember {
1133    uint64 channel_id = 1;
1134    uint64 user_id = 2;
1135    ChannelRole role = 4;
1136}
1137
1138message RemoveChannelMember {
1139    uint64 channel_id = 1;
1140    uint64 user_id = 2;
1141}
1142
1143enum ChannelRole {
1144    Admin = 0;
1145    Member = 1;
1146    Guest = 2;
1147    Banned = 3;
1148    Talker = 4;
1149}
1150
1151message SetChannelMemberRole {
1152    uint64 channel_id = 1;
1153    uint64 user_id = 2;
1154    ChannelRole role = 3;
1155}
1156
1157message SetChannelVisibility {
1158    uint64 channel_id = 1;
1159    ChannelVisibility visibility = 2;
1160}
1161
1162message RenameChannel {
1163    uint64 channel_id = 1;
1164    string name = 2;
1165}
1166
1167message RenameChannelResponse {
1168    Channel channel = 1;
1169}
1170
1171message JoinChannelChat {
1172    uint64 channel_id = 1;
1173}
1174
1175message JoinChannelChatResponse {
1176    repeated ChannelMessage messages = 1;
1177    bool done = 2;
1178}
1179
1180message LeaveChannelChat {
1181    uint64 channel_id = 1;
1182}
1183
1184message SendChannelMessage {
1185    uint64 channel_id = 1;
1186    string body = 2;
1187    Nonce nonce = 3;
1188    repeated ChatMention mentions = 4;
1189    optional uint64 reply_to_message_id = 5;
1190}
1191
1192message RemoveChannelMessage {
1193    uint64 channel_id = 1;
1194    uint64 message_id = 2;
1195}
1196
1197message UpdateChannelMessage {
1198    uint64 channel_id = 1;
1199    uint64 message_id = 2;
1200    Nonce nonce = 4;
1201    string body = 5;
1202    repeated ChatMention mentions = 6;
1203}
1204
1205message AckChannelMessage {
1206    uint64 channel_id = 1;
1207    uint64 message_id = 2;
1208}
1209
1210message SendChannelMessageResponse {
1211    ChannelMessage message = 1;
1212}
1213
1214message ChannelMessageSent {
1215    uint64 channel_id = 1;
1216    ChannelMessage message = 2;
1217}
1218
1219message ChannelMessageUpdate {
1220    uint64 channel_id = 1;
1221    ChannelMessage message = 2;
1222}
1223
1224message GetChannelMessages {
1225    uint64 channel_id = 1;
1226    uint64 before_message_id = 2;
1227}
1228
1229message GetChannelMessagesResponse {
1230    repeated ChannelMessage messages = 1;
1231    bool done = 2;
1232}
1233
1234message GetChannelMessagesById {
1235    repeated uint64 message_ids = 1;
1236}
1237
1238message MoveChannel {
1239    uint64 channel_id = 1;
1240    uint64 to = 2;
1241}
1242
1243message JoinChannelBuffer {
1244    uint64 channel_id = 1;
1245}
1246
1247message ChannelMessage {
1248    uint64 id = 1;
1249    string body = 2;
1250    uint64 timestamp = 3;
1251    uint64 sender_id = 4;
1252    Nonce nonce = 5;
1253    repeated ChatMention mentions = 6;
1254    optional uint64 reply_to_message_id = 7;
1255    optional uint64 edited_at = 8;
1256}
1257
1258message ChatMention {
1259    Range range = 1;
1260    uint64 user_id = 2;
1261}
1262
1263message RejoinChannelBuffers {
1264    repeated ChannelBufferVersion buffers = 1;
1265}
1266
1267message RejoinChannelBuffersResponse {
1268    repeated RejoinedChannelBuffer buffers = 1;
1269}
1270
1271message AckBufferOperation {
1272    uint64 buffer_id = 1;
1273    uint64 epoch = 2;
1274    repeated VectorClockEntry version = 3;
1275}
1276
1277message JoinChannelBufferResponse {
1278    uint64 buffer_id = 1;
1279    uint32 replica_id = 2;
1280    string base_text = 3;
1281    repeated Operation operations = 4;
1282    repeated Collaborator collaborators = 5;
1283    uint64 epoch = 6;
1284}
1285
1286message RejoinedChannelBuffer {
1287    uint64 channel_id = 1;
1288    repeated VectorClockEntry version = 2;
1289    repeated Operation operations = 3;
1290    repeated Collaborator collaborators = 4;
1291}
1292
1293message LeaveChannelBuffer {
1294    uint64 channel_id = 1;
1295}
1296
1297message RespondToChannelInvite {
1298    uint64 channel_id = 1;
1299    bool accept = 2;
1300}
1301
1302message GetUsers {
1303    repeated uint64 user_ids = 1;
1304}
1305
1306message FuzzySearchUsers {
1307    string query = 1;
1308}
1309
1310message UsersResponse {
1311    repeated User users = 1;
1312}
1313
1314message RequestContact {
1315    uint64 responder_id = 1;
1316}
1317
1318message RemoveContact {
1319    uint64 user_id = 1;
1320}
1321
1322message RespondToContactRequest {
1323    uint64 requester_id = 1;
1324    ContactRequestResponse response = 2;
1325}
1326
1327enum ContactRequestResponse {
1328    Accept = 0;
1329    Decline = 1;
1330    Block = 2;
1331    Dismiss = 3;
1332}
1333
1334message UpdateContacts {
1335    repeated Contact contacts = 1;
1336    repeated uint64 remove_contacts = 2;
1337    repeated IncomingContactRequest incoming_requests = 3;
1338    repeated uint64 remove_incoming_requests = 4;
1339    repeated uint64 outgoing_requests = 5;
1340    repeated uint64 remove_outgoing_requests = 6;
1341}
1342
1343message UpdateInviteInfo {
1344    string url = 1;
1345    uint32 count = 2;
1346}
1347
1348message ShowContacts {}
1349
1350message IncomingContactRequest {
1351    uint64 requester_id = 1;
1352}
1353
1354message UpdateDiagnostics {
1355    uint32 replica_id = 1;
1356    uint32 lamport_timestamp = 2;
1357    uint64 server_id = 3;
1358    repeated Diagnostic diagnostics = 4;
1359}
1360
1361message Follow {
1362    uint64 room_id = 1;
1363    optional uint64 project_id = 2;
1364    PeerId leader_id = 3;
1365}
1366
1367message FollowResponse {
1368    View active_view = 3;
1369    // TODO: after 0.124.0 is retired, remove these.
1370    optional ViewId active_view_id = 1;
1371    repeated View views = 2;
1372}
1373
1374message UpdateFollowers {
1375    uint64 room_id = 1;
1376    optional uint64 project_id = 2;
1377    reserved 3;
1378    oneof variant {
1379        View create_view = 5;
1380        // TODO: after 0.124.0 is retired, remove these.
1381        UpdateActiveView update_active_view = 4;
1382        UpdateView update_view = 6;
1383    }
1384}
1385
1386message Unfollow {
1387    uint64 room_id = 1;
1388    optional uint64 project_id = 2;
1389    PeerId leader_id = 3;
1390}
1391
1392message GetPrivateUserInfo {}
1393
1394message GetPrivateUserInfoResponse {
1395    string metrics_id = 1;
1396    bool staff = 2;
1397    repeated string flags = 3;
1398}
1399
1400// Entities
1401
1402message ViewId {
1403    PeerId creator = 1;
1404    uint64 id = 2;
1405}
1406
1407message UpdateActiveView {
1408    optional ViewId id = 1;
1409    optional PeerId leader_id = 2;
1410    View view = 3;
1411}
1412
1413message UpdateView {
1414    ViewId id = 1;
1415    optional PeerId leader_id = 2;
1416
1417    oneof variant {
1418        Editor editor = 3;
1419    }
1420
1421    message Editor {
1422        repeated ExcerptInsertion inserted_excerpts = 1;
1423        repeated uint64 deleted_excerpts = 2;
1424        repeated Selection selections = 3;
1425        optional Selection pending_selection = 4;
1426        EditorAnchor scroll_top_anchor = 5;
1427        float scroll_x = 6;
1428        float scroll_y = 7;
1429    }
1430}
1431
1432message View {
1433    ViewId id = 1;
1434    optional PeerId leader_id = 2;
1435
1436    oneof variant {
1437        Editor editor = 3;
1438        ChannelView channel_view = 4;
1439    }
1440
1441    message Editor {
1442        bool singleton = 1;
1443        optional string title = 2;
1444        repeated Excerpt excerpts = 3;
1445        repeated Selection selections = 4;
1446        optional Selection pending_selection = 5;
1447        EditorAnchor scroll_top_anchor = 6;
1448        float scroll_x = 7;
1449        float scroll_y = 8;
1450    }
1451
1452    message ChannelView {
1453        uint64 channel_id = 1;
1454        Editor editor = 2;
1455    }
1456}
1457
1458message Collaborator {
1459    PeerId peer_id = 1;
1460    uint32 replica_id = 2;
1461    uint64 user_id = 3;
1462}
1463
1464message User {
1465    uint64 id = 1;
1466    string github_login = 2;
1467    string avatar_url = 3;
1468}
1469
1470message File {
1471    uint64 worktree_id = 1;
1472    optional uint64 entry_id = 2;
1473    string path = 3;
1474    Timestamp mtime = 4;
1475    bool is_deleted = 5;
1476}
1477
1478message Entry {
1479    uint64 id = 1;
1480    bool is_dir = 2;
1481    string path = 3;
1482    uint64 inode = 4;
1483    Timestamp mtime = 5;
1484    bool is_symlink = 6;
1485    bool is_ignored = 7;
1486    bool is_external = 8;
1487    optional GitStatus git_status = 9;
1488}
1489
1490message RepositoryEntry {
1491    uint64 work_directory_id = 1;
1492    optional string branch = 2;
1493}
1494
1495message StatusEntry {
1496    string repo_path = 1;
1497    GitStatus status = 2;
1498}
1499
1500enum GitStatus {
1501    Added = 0;
1502    Modified = 1;
1503    Conflict = 2;
1504}
1505
1506message BufferState {
1507    uint64 id = 1;
1508    optional File file = 2;
1509    string base_text = 3;
1510    optional string diff_base = 4;
1511    LineEnding line_ending = 5;
1512    repeated VectorClockEntry saved_version = 6;
1513    string saved_version_fingerprint = 7;
1514    Timestamp saved_mtime = 8;
1515}
1516
1517message BufferChunk {
1518    uint64 buffer_id = 1;
1519    repeated Operation operations = 2;
1520    bool is_last = 3;
1521}
1522
1523enum LineEnding {
1524    Unix = 0;
1525    Windows = 1;
1526}
1527
1528message Selection {
1529    uint64 id = 1;
1530    EditorAnchor start = 2;
1531    EditorAnchor end = 3;
1532    bool reversed = 4;
1533}
1534
1535message EditorAnchor {
1536    uint64 excerpt_id = 1;
1537    Anchor anchor = 2;
1538}
1539
1540enum CursorShape {
1541    CursorBar = 0;
1542    CursorBlock = 1;
1543    CursorUnderscore = 2;
1544    CursorHollow = 3;
1545}
1546
1547message ExcerptInsertion {
1548    Excerpt excerpt = 1;
1549    optional uint64 previous_excerpt_id = 2;
1550}
1551
1552message Excerpt {
1553    uint64 id = 1;
1554    uint64 buffer_id = 2;
1555    Anchor context_start = 3;
1556    Anchor context_end = 4;
1557    Anchor primary_start = 5;
1558    Anchor primary_end = 6;
1559}
1560
1561message Anchor {
1562    uint32 replica_id = 1;
1563    uint32 timestamp = 2;
1564    uint64 offset = 3;
1565    Bias bias = 4;
1566    optional uint64 buffer_id = 5;
1567}
1568
1569enum Bias {
1570    Left = 0;
1571    Right = 1;
1572}
1573
1574message Diagnostic {
1575    Anchor start = 1;
1576    Anchor end = 2;
1577    optional string source = 3;
1578    Severity severity = 4;
1579    string message = 5;
1580    optional string code = 6;
1581    uint64 group_id = 7;
1582    bool is_primary = 8;
1583
1584    // TODO: remove this field
1585    bool is_valid = 9;
1586
1587    bool is_disk_based = 10;
1588    bool is_unnecessary = 11;
1589
1590    enum Severity {
1591        None = 0;
1592        Error = 1;
1593        Warning = 2;
1594        Information = 3;
1595        Hint = 4;
1596    }
1597}
1598
1599message Operation {
1600    oneof variant {
1601        Edit edit = 1;
1602        Undo undo = 2;
1603        UpdateSelections update_selections = 3;
1604        UpdateDiagnostics update_diagnostics = 4;
1605        UpdateCompletionTriggers update_completion_triggers = 5;
1606    }
1607
1608    message Edit {
1609        uint32 replica_id = 1;
1610        uint32 lamport_timestamp = 2;
1611        repeated VectorClockEntry version = 3;
1612        repeated Range ranges = 4;
1613        repeated string new_text = 5;
1614    }
1615
1616    message Undo {
1617        uint32 replica_id = 1;
1618        uint32 lamport_timestamp = 2;
1619        repeated VectorClockEntry version = 3;
1620        repeated UndoCount counts = 4;
1621    }
1622
1623    message UpdateSelections {
1624        uint32 replica_id = 1;
1625        uint32 lamport_timestamp = 2;
1626        repeated Selection selections = 3;
1627        bool line_mode = 4;
1628        CursorShape cursor_shape = 5;
1629    }
1630
1631    message UpdateCompletionTriggers {
1632        uint32 replica_id = 1;
1633        uint32 lamport_timestamp = 2;
1634        repeated string triggers = 3;
1635    }
1636}
1637
1638message UndoMapEntry {
1639    uint32 replica_id = 1;
1640    uint32 local_timestamp = 2;
1641    repeated UndoCount counts = 3;
1642}
1643
1644message UndoCount {
1645    uint32 replica_id = 1;
1646    uint32 lamport_timestamp = 2;
1647    uint32 count = 3;
1648}
1649
1650message VectorClockEntry {
1651    uint32 replica_id = 1;
1652    uint32 timestamp = 2;
1653}
1654
1655message Timestamp {
1656    uint64 seconds = 1;
1657    uint32 nanos = 2;
1658}
1659
1660message Range {
1661    uint64 start = 1;
1662    uint64 end = 2;
1663}
1664
1665message PointUtf16 {
1666    uint32 row = 1;
1667    uint32 column = 2;
1668}
1669
1670message Nonce {
1671    uint64 upper_half = 1;
1672    uint64 lower_half = 2;
1673}
1674
1675enum ChannelVisibility {
1676    Public = 0;
1677    Members = 1;
1678}
1679
1680message Channel {
1681    uint64 id = 1;
1682    string name = 2;
1683    ChannelVisibility visibility = 3;
1684    repeated uint64 parent_path = 5;
1685}
1686
1687message Contact {
1688    uint64 user_id = 1;
1689    bool online = 2;
1690    bool busy = 3;
1691}
1692
1693message WorktreeMetadata {
1694    uint64 id = 1;
1695    string root_name = 2;
1696    bool visible = 3;
1697    string abs_path = 4;
1698}
1699
1700message UpdateDiffBase {
1701    uint64 project_id = 1;
1702    uint64 buffer_id = 2;
1703    optional string diff_base = 3;
1704}
1705
1706message GetNotifications {
1707    optional uint64 before_id = 1;
1708}
1709
1710message AddNotification {
1711    Notification notification = 1;
1712}
1713
1714message GetNotificationsResponse {
1715    repeated Notification notifications = 1;
1716    bool done = 2;
1717}
1718
1719message DeleteNotification {
1720    uint64 notification_id = 1;
1721}
1722
1723message UpdateNotification {
1724    Notification notification = 1;
1725}
1726
1727message MarkNotificationRead {
1728    uint64 notification_id = 1;
1729}
1730
1731message Notification {
1732    uint64 id = 1;
1733    uint64 timestamp = 2;
1734    string kind = 3;
1735    optional uint64 entity_id = 4;
1736    string content = 5;
1737    bool is_read = 6;
1738    optional bool response = 7;
1739}
1740
1741message LspExtExpandMacro {
1742    uint64 project_id = 1;
1743    uint64 buffer_id = 2;
1744    Anchor position = 3;
1745}
1746
1747message LspExtExpandMacroResponse {
1748    string name = 1;
1749    string expansion = 2;
1750}
1751
1752message SetRoomParticipantRole {
1753    uint64 room_id = 1;
1754    uint64 user_id = 2;
1755    ChannelRole role = 3;
1756}
1757
1758message CompleteWithLanguageModel {
1759    string model = 1;
1760    repeated LanguageModelRequestMessage messages = 2;
1761    repeated string stop = 3;
1762    float temperature = 4;
1763}
1764
1765message LanguageModelRequestMessage {
1766    LanguageModelRole role = 1;
1767    string content = 2;
1768}
1769
1770enum LanguageModelRole {
1771    LanguageModelUser = 0;
1772    LanguageModelAssistant = 1;
1773    LanguageModelSystem = 2;
1774}
1775
1776message LanguageModelResponseMessage {
1777    optional LanguageModelRole role = 1;
1778    optional string content = 2;
1779}
1780
1781message LanguageModelResponse {
1782    repeated LanguageModelChoiceDelta choices = 1;
1783}
1784
1785message LanguageModelChoiceDelta {
1786    uint32 index = 1;
1787    LanguageModelResponseMessage delta = 2;
1788    optional string finish_reason = 3;
1789}
1790
1791message CountTokensWithLanguageModel {
1792    string model = 1;
1793    repeated LanguageModelRequestMessage messages = 2;
1794}
1795
1796message CountTokensResponse {
1797    uint32 token_count = 1;
1798}
1799
1800message BlameBuffer {
1801    uint64 project_id = 1;
1802    uint64 buffer_id = 2;
1803    repeated VectorClockEntry version = 3;
1804}
1805
1806message BlameEntry {
1807    bytes sha = 1;
1808
1809    uint32 start_line = 2;
1810    uint32 end_line = 3;
1811    uint32 original_line_number = 4;
1812
1813    optional string author = 5;
1814    optional string author_mail = 6;
1815    optional int64 author_time = 7;
1816    optional string author_tz = 8;
1817
1818    optional string committer = 9;
1819    optional string committer_mail = 10;
1820    optional int64 committer_time = 11;
1821    optional string committer_tz = 12;
1822
1823    optional string summary = 13;
1824    optional string previous = 14;
1825
1826    string filename = 15;
1827}
1828
1829message CommitMessage {
1830    bytes oid = 1;
1831    string message = 2;
1832}
1833
1834message CommitPermalink {
1835    bytes oid = 1;
1836    string permalink = 2;
1837}
1838
1839message BlameBufferResponse {
1840    repeated BlameEntry entries = 1;
1841    repeated CommitMessage messages = 2;
1842    repeated CommitPermalink permalinks = 3;
1843}
1844
1845message MultiLspQuery {
1846    uint64 project_id = 1;
1847    uint64 buffer_id = 2;
1848    repeated VectorClockEntry version = 3;
1849    oneof strategy {
1850        AllLanguageServers all = 4;
1851    }
1852    oneof request {
1853        GetHover get_hover = 5;
1854        GetCodeActions get_code_actions = 6;
1855    }
1856}
1857
1858message AllLanguageServers {}
1859
1860message MultiLspQueryResponse {
1861    repeated LspResponse responses = 1;
1862}
1863
1864message LspResponse {
1865    oneof response {
1866        GetHoverResponse get_hover_response = 1;
1867        GetCodeActionsResponse get_code_actions_response = 2;
1868    }
1869}