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