ai.proto

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