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