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