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