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