ai.proto

  1syntax = "proto3";
  2package zed.messages;
  3
  4import "buffer.proto";
  5
  6message Context {
  7    repeated ContextOperation operations = 1;
  8}
  9
 10message ContextMetadata {
 11    string context_id = 1;
 12    optional string summary = 2;
 13}
 14
 15message ContextMessageStatus {
 16    oneof variant {
 17        Done done = 1;
 18        Pending pending = 2;
 19        Error error = 3;
 20        Canceled canceled = 4;
 21    }
 22
 23    message Done {}
 24
 25    message Pending {}
 26
 27    message Error {
 28        string message = 1;
 29    }
 30
 31    message Canceled {}
 32}
 33
 34message ContextMessage {
 35    LamportTimestamp id = 1;
 36    Anchor start = 2;
 37    LanguageModelRole role = 3;
 38    ContextMessageStatus status = 4;
 39}
 40
 41message SlashCommandOutputSection {
 42    AnchorRange range = 1;
 43    string icon_name = 2;
 44    string label = 3;
 45    optional string metadata = 4;
 46}
 47
 48message ThoughtProcessOutputSection {
 49    AnchorRange range = 1;
 50}
 51
 52message ContextOperation {
 53    oneof variant {
 54        InsertMessage insert_message = 1;
 55        UpdateMessage update_message = 2;
 56        UpdateSummary update_summary = 3;
 57        BufferOperation buffer_operation = 5;
 58        SlashCommandStarted slash_command_started = 6;
 59        SlashCommandOutputSectionAdded slash_command_output_section_added = 7;
 60        SlashCommandCompleted slash_command_completed = 8;
 61        ThoughtProcessOutputSectionAdded thought_process_output_section_added = 9;
 62    }
 63
 64    reserved 4;
 65
 66    message InsertMessage {
 67        ContextMessage message = 1;
 68        repeated VectorClockEntry version = 2;
 69    }
 70
 71    message UpdateMessage {
 72        LamportTimestamp message_id = 1;
 73        LanguageModelRole role = 2;
 74        ContextMessageStatus status = 3;
 75        LamportTimestamp timestamp = 4;
 76        repeated VectorClockEntry version = 5;
 77    }
 78
 79    message UpdateSummary {
 80        string summary = 1;
 81        bool done = 2;
 82        LamportTimestamp timestamp = 3;
 83        repeated VectorClockEntry version = 4;
 84    }
 85
 86    message SlashCommandStarted {
 87        LamportTimestamp id = 1;
 88        AnchorRange output_range = 2;
 89        string name = 3;
 90        repeated VectorClockEntry version = 4;
 91    }
 92
 93    message SlashCommandOutputSectionAdded {
 94        LamportTimestamp timestamp = 1;
 95        SlashCommandOutputSection section = 2;
 96        repeated VectorClockEntry version = 3;
 97    }
 98
 99    message SlashCommandCompleted {
100        LamportTimestamp id = 1;
101        LamportTimestamp timestamp = 3;
102        optional string error_message = 4;
103        repeated VectorClockEntry version = 5;
104    }
105
106    message ThoughtProcessOutputSectionAdded {
107        LamportTimestamp timestamp = 1;
108        ThoughtProcessOutputSection section = 2;
109        repeated VectorClockEntry version = 3;
110    }
111
112    message BufferOperation {
113        Operation operation = 1;
114    }
115}
116
117message AdvertiseContexts {
118    uint64 project_id = 1;
119    repeated ContextMetadata contexts = 2;
120}
121
122message OpenContext {
123    uint64 project_id = 1;
124    string context_id = 2;
125}
126
127message OpenContextResponse {
128    Context context = 1;
129}
130
131message CreateContext {
132    uint64 project_id = 1;
133}
134
135message CreateContextResponse {
136    string context_id = 1;
137    Context context = 2;
138}
139
140message UpdateContext {
141    uint64 project_id = 1;
142    string context_id = 2;
143    ContextOperation operation = 3;
144}
145
146message ContextVersion {
147    string context_id = 1;
148    repeated VectorClockEntry context_version = 2;
149    repeated VectorClockEntry buffer_version = 3;
150}
151
152message SynchronizeContexts {
153    uint64 project_id = 1;
154    repeated ContextVersion contexts = 2;
155}
156
157message SynchronizeContextsResponse {
158    repeated ContextVersion contexts = 1;
159}
160
161enum LanguageModelRole {
162    LanguageModelUser = 0;
163    LanguageModelAssistant = 1;
164    LanguageModelSystem = 2;
165    reserved 3;
166}