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