zed.proto

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