zed.proto

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