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    bool include_ignored = 8;
 888}
 889
 890message SearchProjectResponse {
 891    repeated Location locations = 1;
 892}
 893
 894message CodeAction {
 895    uint64 server_id = 1;
 896    Anchor start = 2;
 897    Anchor end = 3;
 898    bytes lsp_action = 4;
 899}
 900
 901message ProjectTransaction {
 902    repeated uint64 buffer_ids = 1;
 903    repeated Transaction transactions = 2;
 904}
 905
 906message Transaction {
 907    LamportTimestamp id = 1;
 908    repeated LamportTimestamp edit_ids = 2;
 909    repeated VectorClockEntry start = 3;
 910}
 911
 912message LamportTimestamp {
 913    uint32 replica_id = 1;
 914    uint32 value = 2;
 915}
 916
 917message LanguageServer {
 918    uint64 id = 1;
 919    string name = 2;
 920}
 921
 922message StartLanguageServer {
 923    uint64 project_id = 1;
 924    LanguageServer server = 2;
 925}
 926
 927message UpdateDiagnosticSummary {
 928    uint64 project_id = 1;
 929    uint64 worktree_id = 2;
 930    DiagnosticSummary summary = 3;
 931}
 932
 933message DiagnosticSummary {
 934    string path = 1;
 935    uint64 language_server_id = 2;
 936    uint32 error_count = 3;
 937    uint32 warning_count = 4;
 938}
 939
 940message UpdateLanguageServer {
 941    uint64 project_id = 1;
 942    uint64 language_server_id = 2;
 943    oneof variant {
 944        LspWorkStart work_start = 3;
 945        LspWorkProgress work_progress = 4;
 946        LspWorkEnd work_end = 5;
 947        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 948        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 949    }
 950}
 951
 952message LspWorkStart {
 953    string token = 1;
 954    optional string message = 2;
 955    optional uint32 percentage = 3;
 956}
 957
 958message LspWorkProgress {
 959    string token = 1;
 960    optional string message = 2;
 961    optional uint32 percentage = 3;
 962}
 963
 964message LspWorkEnd {
 965    string token = 1;
 966}
 967
 968message LspDiskBasedDiagnosticsUpdating {}
 969
 970message LspDiskBasedDiagnosticsUpdated {}
 971
 972message UpdateChannels {
 973    repeated Channel channels = 1;
 974    repeated uint64 delete_channels = 4;
 975    repeated Channel channel_invitations = 5;
 976    repeated uint64 remove_channel_invitations = 6;
 977    repeated ChannelParticipants channel_participants = 7;
 978    repeated UnseenChannelMessage unseen_channel_messages = 9;
 979    repeated UnseenChannelBufferChange unseen_channel_buffer_changes = 10;
 980}
 981
 982message UnseenChannelMessage {
 983    uint64 channel_id = 1;
 984    uint64 message_id = 2;
 985}
 986
 987message UnseenChannelBufferChange {
 988    uint64 channel_id = 1;
 989    uint64 epoch = 2;
 990    repeated VectorClockEntry version = 3;
 991}
 992
 993message ChannelPermission {
 994    uint64 channel_id = 1;
 995    ChannelRole role = 3;
 996}
 997
 998message ChannelParticipants {
 999    uint64 channel_id = 1;
1000    repeated uint64 participant_user_ids = 2;
1001}
1002
1003message JoinChannel {
1004    uint64 channel_id = 1;
1005}
1006
1007message DeleteChannel {
1008    uint64 channel_id = 1;
1009}
1010
1011message GetChannelMembers {
1012    uint64 channel_id = 1;
1013}
1014
1015message GetChannelMembersResponse {
1016    repeated ChannelMember members = 1;
1017}
1018
1019message ChannelMember {
1020    uint64 user_id = 1;
1021    Kind kind = 3;
1022    ChannelRole role = 4;
1023
1024    enum Kind {
1025        Member = 0;
1026        Invitee = 1;
1027        AncestorMember = 2;
1028    }
1029}
1030
1031message CreateChannel {
1032    string name = 1;
1033    optional uint64 parent_id = 2;
1034}
1035
1036message CreateChannelResponse {
1037    Channel channel = 1;
1038    optional uint64 parent_id = 2;
1039}
1040
1041message InviteChannelMember {
1042    uint64 channel_id = 1;
1043    uint64 user_id = 2;
1044    ChannelRole role = 4;
1045}
1046
1047message RemoveChannelMember {
1048    uint64 channel_id = 1;
1049    uint64 user_id = 2;
1050}
1051
1052enum ChannelRole {
1053    Admin = 0;
1054    Member = 1;
1055    Guest = 2;
1056    Banned = 3;
1057}
1058
1059message SetChannelMemberRole {
1060    uint64 channel_id = 1;
1061    uint64 user_id = 2;
1062    ChannelRole role = 3;
1063}
1064
1065message SetChannelVisibility {
1066    uint64 channel_id = 1;
1067    ChannelVisibility visibility = 2;
1068}
1069
1070message RenameChannel {
1071    uint64 channel_id = 1;
1072    string name = 2;
1073}
1074
1075message RenameChannelResponse {
1076    Channel channel = 1;
1077}
1078
1079message JoinChannelChat {
1080    uint64 channel_id = 1;
1081}
1082
1083message JoinChannelChatResponse {
1084    repeated ChannelMessage messages = 1;
1085    bool done = 2;
1086}
1087
1088message LeaveChannelChat {
1089    uint64 channel_id = 1;
1090}
1091
1092message SendChannelMessage {
1093    uint64 channel_id = 1;
1094    string body = 2;
1095    Nonce nonce = 3;
1096    repeated ChatMention mentions = 4;
1097}
1098
1099message RemoveChannelMessage {
1100    uint64 channel_id = 1;
1101    uint64 message_id = 2;
1102}
1103
1104message AckChannelMessage {
1105    uint64 channel_id = 1;
1106    uint64 message_id = 2;
1107}
1108
1109message SendChannelMessageResponse {
1110    ChannelMessage message = 1;
1111}
1112
1113message ChannelMessageSent {
1114    uint64 channel_id = 1;
1115    ChannelMessage message = 2;
1116}
1117
1118message GetChannelMessages {
1119    uint64 channel_id = 1;
1120    uint64 before_message_id = 2;
1121}
1122
1123message GetChannelMessagesResponse {
1124    repeated ChannelMessage messages = 1;
1125    bool done = 2;
1126}
1127
1128message GetChannelMessagesById {
1129    repeated uint64 message_ids = 1;
1130}
1131
1132message MoveChannel {
1133    uint64 channel_id = 1;
1134    optional uint64 to = 2;
1135}
1136
1137message JoinChannelBuffer {
1138    uint64 channel_id = 1;
1139}
1140
1141message ChannelMessage {
1142    uint64 id = 1;
1143    string body = 2;
1144    uint64 timestamp = 3;
1145    uint64 sender_id = 4;
1146    Nonce nonce = 5;
1147    repeated ChatMention mentions = 6;
1148}
1149
1150message ChatMention {
1151    Range range = 1;
1152    uint64 user_id = 2;
1153}
1154
1155message RejoinChannelBuffers {
1156    repeated ChannelBufferVersion buffers = 1;
1157}
1158
1159message RejoinChannelBuffersResponse {
1160    repeated RejoinedChannelBuffer buffers = 1;
1161}
1162
1163message AckBufferOperation {
1164    uint64 buffer_id = 1;
1165    uint64 epoch = 2;
1166    repeated VectorClockEntry version = 3;
1167}
1168
1169message JoinChannelBufferResponse {
1170    uint64 buffer_id = 1;
1171    uint32 replica_id = 2;
1172    string base_text = 3;
1173    repeated Operation operations = 4;
1174    repeated Collaborator collaborators = 5;
1175    uint64 epoch = 6;
1176}
1177
1178message RejoinedChannelBuffer {
1179    uint64 channel_id = 1;
1180    repeated VectorClockEntry version = 2;
1181    repeated Operation operations = 3;
1182    repeated Collaborator collaborators = 4;
1183}
1184
1185message LeaveChannelBuffer {
1186    uint64 channel_id = 1;
1187}
1188
1189message RespondToChannelInvite {
1190    uint64 channel_id = 1;
1191    bool accept = 2;
1192}
1193
1194message GetUsers {
1195    repeated uint64 user_ids = 1;
1196}
1197
1198message FuzzySearchUsers {
1199    string query = 1;
1200}
1201
1202message UsersResponse {
1203    repeated User users = 1;
1204}
1205
1206message RequestContact {
1207    uint64 responder_id = 1;
1208}
1209
1210message RemoveContact {
1211    uint64 user_id = 1;
1212}
1213
1214message RespondToContactRequest {
1215    uint64 requester_id = 1;
1216    ContactRequestResponse response = 2;
1217}
1218
1219enum ContactRequestResponse {
1220    Accept = 0;
1221    Decline = 1;
1222    Block = 2;
1223    Dismiss = 3;
1224}
1225
1226message UpdateContacts {
1227    repeated Contact contacts = 1;
1228    repeated uint64 remove_contacts = 2;
1229    repeated IncomingContactRequest incoming_requests = 3;
1230    repeated uint64 remove_incoming_requests = 4;
1231    repeated uint64 outgoing_requests = 5;
1232    repeated uint64 remove_outgoing_requests = 6;
1233}
1234
1235message UpdateInviteInfo {
1236    string url = 1;
1237    uint32 count = 2;
1238}
1239
1240message ShowContacts {}
1241
1242message IncomingContactRequest {
1243    uint64 requester_id = 1;
1244}
1245
1246message UpdateDiagnostics {
1247    uint32 replica_id = 1;
1248    uint32 lamport_timestamp = 2;
1249    uint64 server_id = 3;
1250    repeated Diagnostic diagnostics = 4;
1251}
1252
1253message Follow {
1254    uint64 room_id = 1;
1255    optional uint64 project_id = 2;
1256    PeerId leader_id = 3;
1257}
1258
1259message FollowResponse {
1260    optional ViewId active_view_id = 1;
1261    repeated View views = 2;
1262}
1263
1264message UpdateFollowers {
1265    uint64 room_id = 1;
1266    optional uint64 project_id = 2;
1267    repeated PeerId follower_ids = 3;
1268    oneof variant {
1269        UpdateActiveView update_active_view = 4;
1270        View create_view = 5;
1271        UpdateView update_view = 6;
1272    }
1273}
1274
1275message Unfollow {
1276    uint64 room_id = 1;
1277    optional uint64 project_id = 2;
1278    PeerId leader_id = 3;
1279}
1280
1281message GetPrivateUserInfo {}
1282
1283message GetPrivateUserInfoResponse {
1284    string metrics_id = 1;
1285    bool staff = 2;
1286    repeated string flags = 3;
1287}
1288
1289// Entities
1290
1291message ViewId {
1292    PeerId creator = 1;
1293    uint64 id = 2;
1294}
1295
1296message UpdateActiveView {
1297    optional ViewId id = 1;
1298    optional PeerId leader_id = 2;
1299}
1300
1301message UpdateView {
1302    ViewId id = 1;
1303    optional PeerId leader_id = 2;
1304
1305    oneof variant {
1306        Editor editor = 3;
1307    }
1308
1309    message Editor {
1310        repeated ExcerptInsertion inserted_excerpts = 1;
1311        repeated uint64 deleted_excerpts = 2;
1312        repeated Selection selections = 3;
1313        optional Selection pending_selection = 4;
1314        EditorAnchor scroll_top_anchor = 5;
1315        float scroll_x = 6;
1316        float scroll_y = 7;
1317    }
1318}
1319
1320message View {
1321    ViewId id = 1;
1322    optional PeerId leader_id = 2;
1323
1324    oneof variant {
1325        Editor editor = 3;
1326        ChannelView channel_view = 4;
1327    }
1328
1329    message Editor {
1330        bool singleton = 1;
1331        optional string title = 2;
1332        repeated Excerpt excerpts = 3;
1333        repeated Selection selections = 4;
1334        optional Selection pending_selection = 5;
1335        EditorAnchor scroll_top_anchor = 6;
1336        float scroll_x = 7;
1337        float scroll_y = 8;
1338    }
1339
1340    message ChannelView {
1341        uint64 channel_id = 1;
1342        Editor editor = 2;
1343    }
1344}
1345
1346message Collaborator {
1347    PeerId peer_id = 1;
1348    uint32 replica_id = 2;
1349    uint64 user_id = 3;
1350}
1351
1352message User {
1353    uint64 id = 1;
1354    string github_login = 2;
1355    string avatar_url = 3;
1356}
1357
1358message File {
1359    uint64 worktree_id = 1;
1360    uint64 entry_id = 2;
1361    string path = 3;
1362    Timestamp mtime = 4;
1363    bool is_deleted = 5;
1364}
1365
1366message Entry {
1367    uint64 id = 1;
1368    bool is_dir = 2;
1369    string path = 3;
1370    uint64 inode = 4;
1371    Timestamp mtime = 5;
1372    bool is_symlink = 6;
1373    bool is_ignored = 7;
1374    bool is_external = 8;
1375    optional GitStatus git_status = 9;
1376}
1377
1378message RepositoryEntry {
1379    uint64 work_directory_id = 1;
1380    optional string branch = 2;
1381}
1382
1383message StatusEntry {
1384    string repo_path = 1;
1385    GitStatus status = 2;
1386}
1387
1388enum GitStatus {
1389    Added = 0;
1390    Modified = 1;
1391    Conflict = 2;
1392}
1393
1394message BufferState {
1395    uint64 id = 1;
1396    optional File file = 2;
1397    string base_text = 3;
1398    optional string diff_base = 4;
1399    LineEnding line_ending = 5;
1400    repeated VectorClockEntry saved_version = 6;
1401    string saved_version_fingerprint = 7;
1402    Timestamp saved_mtime = 8;
1403}
1404
1405message BufferChunk {
1406    uint64 buffer_id = 1;
1407    repeated Operation operations = 2;
1408    bool is_last = 3;
1409}
1410
1411enum LineEnding {
1412    Unix = 0;
1413    Windows = 1;
1414}
1415
1416message Selection {
1417    uint64 id = 1;
1418    EditorAnchor start = 2;
1419    EditorAnchor end = 3;
1420    bool reversed = 4;
1421}
1422
1423message EditorAnchor {
1424    uint64 excerpt_id = 1;
1425    Anchor anchor = 2;
1426}
1427
1428enum CursorShape {
1429    CursorBar = 0;
1430    CursorBlock = 1;
1431    CursorUnderscore = 2;
1432    CursorHollow = 3;
1433}
1434
1435message ExcerptInsertion {
1436    Excerpt excerpt = 1;
1437    optional uint64 previous_excerpt_id = 2;
1438}
1439
1440message Excerpt {
1441    uint64 id = 1;
1442    uint64 buffer_id = 2;
1443    Anchor context_start = 3;
1444    Anchor context_end = 4;
1445    Anchor primary_start = 5;
1446    Anchor primary_end = 6;
1447}
1448
1449message Anchor {
1450    uint32 replica_id = 1;
1451    uint32 timestamp = 2;
1452    uint64 offset = 3;
1453    Bias bias = 4;
1454    optional uint64 buffer_id = 5;
1455}
1456
1457enum Bias {
1458    Left = 0;
1459    Right = 1;
1460}
1461
1462message Diagnostic {
1463    Anchor start = 1;
1464    Anchor end = 2;
1465    optional string source = 3;
1466    Severity severity = 4;
1467    string message = 5;
1468    optional string code = 6;
1469    uint64 group_id = 7;
1470    bool is_primary = 8;
1471    bool is_valid = 9;
1472    bool is_disk_based = 10;
1473    bool is_unnecessary = 11;
1474
1475    enum Severity {
1476        None = 0;
1477        Error = 1;
1478        Warning = 2;
1479        Information = 3;
1480        Hint = 4;
1481    }
1482}
1483
1484message Operation {
1485    oneof variant {
1486        Edit edit = 1;
1487        Undo undo = 2;
1488        UpdateSelections update_selections = 3;
1489        UpdateDiagnostics update_diagnostics = 4;
1490        UpdateCompletionTriggers update_completion_triggers = 5;
1491    }
1492
1493    message Edit {
1494        uint32 replica_id = 1;
1495        uint32 lamport_timestamp = 2;
1496        repeated VectorClockEntry version = 3;
1497        repeated Range ranges = 4;
1498        repeated string new_text = 5;
1499    }
1500
1501    message Undo {
1502        uint32 replica_id = 1;
1503        uint32 lamport_timestamp = 2;
1504        repeated VectorClockEntry version = 3;
1505        repeated UndoCount counts = 4;
1506    }
1507
1508    message UpdateSelections {
1509        uint32 replica_id = 1;
1510        uint32 lamport_timestamp = 2;
1511        repeated Selection selections = 3;
1512        bool line_mode = 4;
1513        CursorShape cursor_shape = 5;
1514    }
1515
1516    message UpdateCompletionTriggers {
1517        uint32 replica_id = 1;
1518        uint32 lamport_timestamp = 2;
1519        repeated string triggers = 3;
1520    }
1521}
1522
1523message UndoMapEntry {
1524    uint32 replica_id = 1;
1525    uint32 local_timestamp = 2;
1526    repeated UndoCount counts = 3;
1527}
1528
1529message UndoCount {
1530    uint32 replica_id = 1;
1531    uint32 lamport_timestamp = 2;
1532    uint32 count = 3;
1533}
1534
1535message VectorClockEntry {
1536    uint32 replica_id = 1;
1537    uint32 timestamp = 2;
1538}
1539
1540message Timestamp {
1541    uint64 seconds = 1;
1542    uint32 nanos = 2;
1543}
1544
1545message Range {
1546    uint64 start = 1;
1547    uint64 end = 2;
1548}
1549
1550message PointUtf16 {
1551    uint32 row = 1;
1552    uint32 column = 2;
1553}
1554
1555message Nonce {
1556    uint64 upper_half = 1;
1557    uint64 lower_half = 2;
1558}
1559
1560enum ChannelVisibility {
1561    Public = 0;
1562    Members = 1;
1563}
1564
1565message Channel {
1566    uint64 id = 1;
1567    string name = 2;
1568    ChannelVisibility visibility = 3;
1569    ChannelRole role = 4;
1570    repeated uint64 parent_path = 5;
1571}
1572
1573message Contact {
1574    uint64 user_id = 1;
1575    bool online = 2;
1576    bool busy = 3;
1577}
1578
1579message WorktreeMetadata {
1580    uint64 id = 1;
1581    string root_name = 2;
1582    bool visible = 3;
1583    string abs_path = 4;
1584}
1585
1586message UpdateDiffBase {
1587    uint64 project_id = 1;
1588    uint64 buffer_id = 2;
1589    optional string diff_base = 3;
1590}
1591
1592message GetNotifications {
1593    optional uint64 before_id = 1;
1594}
1595
1596message AddNotification {
1597    Notification notification = 1;
1598}
1599
1600message GetNotificationsResponse {
1601    repeated Notification notifications = 1;
1602    bool done = 2;
1603}
1604
1605message DeleteNotification {
1606    uint64 notification_id = 1;
1607}
1608
1609message MarkNotificationRead {
1610    uint64 notification_id = 1;
1611}
1612
1613message Notification {
1614    uint64 id = 1;
1615    uint64 timestamp = 2;
1616    string kind = 3;
1617    optional uint64 entity_id = 4;
1618    string content = 5;
1619    bool is_read = 6;
1620    optional bool response = 7;
1621}