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