zed.proto

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