Skip to main content

gproxy_protocol/wire/openai/responses/
input.rs

1//! Native OpenAI Responses input, output items, tool and configuration shapes.
2//!
3//! The request uses the same native input and tool shapes as Responses.  The
4//! types here deliberately remain OpenAI-shaped; they are not a shared IR.
5//!
6//! Shapes follow `Get input token counts.md`, including native history items.
7//! Known structures are typed; `rest` retains only unknown extension fields.
8use super::tools::*;
9use crate::Rest;
10use serde::{Deserialize, Serialize};
11
12/// Deserialize a present non-null optional field; a missing field uses serde default.
13pub(in crate::wire::openai) fn present_optional<'de, D, T>(
14    deserializer: D,
15) -> Result<Option<T>, D::Error>
16where
17    D: serde::Deserializer<'de>,
18    T: Deserialize<'de>,
19{
20    T::deserialize(deserializer).map(Some)
21}
22
23/// A field which is required on the wire but explicitly permits JSON null.
24/// `deserialize_with` preserves the distinction between a missing field
25/// (serde reports an error) and a present null (returns `None`).
26pub(in crate::wire::openai) fn required_nullable<'de, D, T>(
27    deserializer: D,
28) -> Result<Option<T>, D::Error>
29where
30    D: serde::Deserializer<'de>,
31    T: Deserialize<'de>,
32{
33    Option::<T>::deserialize(deserializer)
34}
35
36pub(in crate::wire::openai) fn present_nullable<'de, D, T>(
37    deserializer: D,
38) -> Result<Option<Option<T>>, D::Error>
39where
40    D: serde::Deserializer<'de>,
41    T: Deserialize<'de>,
42{
43    Option::<T>::deserialize(deserializer).map(Some)
44}
45
46#[derive(
47    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
48)]
49#[serde(rename_all = "snake_case")]
50#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
51#[derive(gproxy_protocol_macros::DeclaredFields)]
52#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
53pub struct ResponseConversationParam {
54    pub id: String,
55    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
56    pub rest: Rest,
57}
58
59#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
60#[serde(untagged)]
61#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
62#[derive(gproxy_protocol_macros::DeclaredFields)]
63#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
64pub enum ConversationParam {
65    Id(String),
66    Object(ResponseConversationParam),
67}
68
69#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
70#[serde(untagged)]
71#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
72#[derive(gproxy_protocol_macros::DeclaredFields)]
73#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
74pub enum Input {
75    Text(String),
76    Items(Vec<InputItem>),
77}
78
79#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
80#[serde(untagged)]
81#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
82#[derive(gproxy_protocol_macros::DeclaredFields)]
83#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
84pub enum MessageContent {
85    Text(String),
86    Parts(Vec<InputContent>),
87}
88
89#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
90#[serde(untagged)]
91#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
92#[derive(gproxy_protocol_macros::DeclaredFields)]
93#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
94pub enum InputContent {
95    #[serde(rename = "input_text")]
96    Text(ResponseInputText),
97    #[serde(rename = "input_image")]
98    Image(ResponseInputImage),
99    #[serde(rename = "input_file")]
100    File(ResponseInputFile),
101}
102
103#[derive(
104    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
105)]
106#[serde(rename_all = "snake_case")]
107#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
108#[derive(gproxy_protocol_macros::DeclaredFields)]
109#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
110pub struct ResponseInputText {
111    #[serde(rename = "type")]
112    pub type_: ResponseInputTextType,
113    pub text: String,
114    #[serde(
115        default,
116        deserialize_with = "present_optional",
117        skip_serializing_if = "Option::is_none"
118    )]
119    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
120    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
121    pub rest: Rest,
122}
123
124#[derive(
125    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
126)]
127#[serde(rename_all = "snake_case")]
128#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
129#[derive(gproxy_protocol_macros::DeclaredFields)]
130#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
131pub struct ResponseInputImage {
132    #[serde(rename = "type")]
133    pub type_: ResponseInputImageType,
134    pub detail: ImageDetail,
135    #[serde(
136        default,
137        deserialize_with = "present_nullable",
138        skip_serializing_if = "Option::is_none"
139    )]
140    pub file_id: Option<Option<String>>,
141    #[serde(
142        default,
143        deserialize_with = "present_nullable",
144        skip_serializing_if = "Option::is_none"
145    )]
146    pub image_url: Option<Option<String>>,
147    #[serde(
148        default,
149        deserialize_with = "present_optional",
150        skip_serializing_if = "Option::is_none"
151    )]
152    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
153    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
154    pub rest: Rest,
155}
156
157#[derive(
158    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
159)]
160#[serde(rename_all = "snake_case")]
161#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
162#[derive(gproxy_protocol_macros::DeclaredFields)]
163#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
164pub struct ResponseInputFile {
165    #[serde(rename = "type")]
166    pub type_: ResponseInputFileType,
167    #[serde(
168        default,
169        deserialize_with = "present_optional",
170        skip_serializing_if = "Option::is_none"
171    )]
172    pub detail: Option<FileDetail>,
173    #[serde(
174        default,
175        deserialize_with = "present_optional",
176        skip_serializing_if = "Option::is_none"
177    )]
178    pub file_data: Option<String>,
179    #[serde(
180        default,
181        deserialize_with = "present_nullable",
182        skip_serializing_if = "Option::is_none"
183    )]
184    pub file_id: Option<Option<String>>,
185    #[serde(
186        default,
187        deserialize_with = "present_optional",
188        skip_serializing_if = "Option::is_none"
189    )]
190    pub file_url: Option<String>,
191    #[serde(
192        default,
193        deserialize_with = "present_optional",
194        skip_serializing_if = "Option::is_none"
195    )]
196    pub filename: Option<String>,
197    #[serde(
198        default,
199        deserialize_with = "present_optional",
200        skip_serializing_if = "Option::is_none"
201    )]
202    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
203    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
204    pub rest: Rest,
205}
206
207#[derive(
208    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
209)]
210#[serde(rename_all = "snake_case")]
211#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
212#[derive(gproxy_protocol_macros::DeclaredFields)]
213#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
214pub struct PromptCacheBreakpoint {
215    pub mode: PromptCacheMode,
216    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
217    pub rest: Rest,
218}
219
220#[derive(
221    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
222)]
223#[serde(rename_all = "snake_case")]
224#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
225#[derive(gproxy_protocol_macros::DeclaredFields)]
226#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
227pub struct EasyInputMessage {
228    #[serde(
229        default,
230        deserialize_with = "present_nullable",
231        skip_serializing_if = "Option::is_none"
232    )]
233    pub agent: Option<Option<super::multi_agent::Agent>>,
234    pub content: MessageContent,
235    pub role: MessageRole,
236    #[serde(
237        default,
238        deserialize_with = "present_nullable",
239        skip_serializing_if = "Option::is_none"
240    )]
241    pub phase: Option<Option<MessagePhase>>,
242    #[serde(
243        rename = "type",
244        default,
245        deserialize_with = "present_optional",
246        skip_serializing_if = "Option::is_none"
247    )]
248    pub type_: Option<MessageType>,
249    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
250    pub rest: Rest,
251}
252
253#[derive(
254    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
255)]
256#[serde(rename_all = "snake_case")]
257#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
258#[derive(gproxy_protocol_macros::DeclaredFields)]
259#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
260pub struct InputMessage {
261    #[serde(
262        default,
263        deserialize_with = "present_nullable",
264        skip_serializing_if = "Option::is_none"
265    )]
266    pub agent: Option<Option<super::multi_agent::Agent>>,
267    pub content: Vec<InputContent>,
268    pub role: InputMessageRole,
269    #[serde(
270        default,
271        deserialize_with = "present_optional",
272        skip_serializing_if = "Option::is_none"
273    )]
274    pub status: Option<OutputMessageStatus>,
275    #[serde(
276        rename = "type",
277        default,
278        deserialize_with = "present_optional",
279        skip_serializing_if = "Option::is_none"
280    )]
281    pub type_: Option<MessageType>,
282    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
283    pub rest: Rest,
284}
285
286#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
287#[serde(untagged)]
288#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
289#[derive(gproxy_protocol_macros::DeclaredFields)]
290#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
291pub enum InputItem {
292    MultiAgentCall(super::multi_agent::MultiAgentCall),
293    MultiAgentCallOutput(super::multi_agent::MultiAgentCallOutput),
294    AgentMessage(super::multi_agent::AgentMessage),
295    ConfigurationUpdate(ConfigurationUpdate),
296    OutputMessage(
297        #[serde(
298            deserialize_with = "output_message_history",
299            serialize_with = "serialize_history_item"
300        )]
301        ResponseOutputMessage,
302    ),
303    Message(InputMessage),
304    Easy(EasyInputMessage),
305    FunctionCall(FunctionCall),
306    FunctionCallOutput(FunctionCallOutput),
307    Reasoning(
308        #[serde(
309            deserialize_with = "history_item",
310            serialize_with = "serialize_history_item"
311        )]
312        ReasoningItem,
313    ),
314    ItemReference(ItemReference),
315    Compaction(Compaction),
316    ComputerCall(ComputerCall),
317    ComputerCallOutput(ComputerCallOutput),
318    WebSearchCall(WebSearchCall),
319    FileSearchCall(FileSearchCall),
320    ImageGenerationCall(ImageGenerationCall),
321    CodeInterpreterCall(CodeInterpreterCall),
322    CustomToolCall(CustomToolCall),
323    CustomToolCallOutput(CustomToolCallOutput),
324    ToolSearchCall(ToolSearchCall),
325    ToolSearchOutput(ToolSearchOutput),
326    AdditionalTools(AdditionalTools),
327    LocalShellCall(
328        #[serde(
329            deserialize_with = "history_item",
330            serialize_with = "serialize_history_item"
331        )]
332        LocalShellCall,
333    ),
334    LocalShellCallOutput(LocalShellCallOutput),
335    ShellCall(ShellCall),
336    ShellCallOutput(ShellCallOutput),
337    ApplyPatchCall(ApplyPatchCall),
338    ApplyPatchCallOutput(ApplyPatchCallOutput),
339    McpListTools(McpListTools),
340    McpApprovalRequest(McpApprovalRequest),
341    McpApprovalResponse(McpApprovalResponse),
342    McpCall(McpCall),
343    CompactionTrigger(CompactionTrigger),
344    Program(Program),
345    ProgramOutput(ProgramOutput),
346}
347
348// Missing history IDs use an internal empty sentinel, omitted again on the wire.
349// Live output items still deserialize through their strict native types.
350fn history_item<'de, D, T>(deserializer: D) -> Result<T, D::Error>
351where
352    D: serde::Deserializer<'de>,
353    T: serde::de::DeserializeOwned,
354{
355    let mut value = serde_json::Value::deserialize(deserializer)?;
356    if let Some(object) = value.as_object_mut() {
357        object.entry("id").or_insert_with(|| "".into());
358    }
359    serde_json::from_value(value).map_err(serde::de::Error::custom)
360}
361
362fn serialize_history_item<S, T>(item: &T, serializer: S) -> Result<S::Ok, S::Error>
363where
364    S: serde::Serializer,
365    T: Serialize,
366{
367    let mut value = serde_json::to_value(item).map_err(serde::ser::Error::custom)?;
368    if value.get("id").and_then(serde_json::Value::as_str) == Some("") {
369        value.as_object_mut().expect("history object").remove("id");
370    }
371    value.serialize(serializer)
372}
373
374/// Codex replays assistant history without output-only ID/status/annotation
375/// bookkeeping. Accept that compact request form without relaxing live
376/// response parsing or dropping its output_text content.
377fn output_message_history<'de, D>(deserializer: D) -> Result<ResponseOutputMessage, D::Error>
378where
379    D: serde::Deserializer<'de>,
380{
381    let mut value = serde_json::Value::deserialize(deserializer)?;
382    if value.get("role").and_then(serde_json::Value::as_str) == Some("assistant")
383        && (value.get("type").is_none()
384            || value.get("type").and_then(serde_json::Value::as_str) == Some("message"))
385    {
386        let object = value.as_object_mut().expect("message object");
387        object.entry("type").or_insert_with(|| "message".into());
388        object.entry("id").or_insert_with(|| "".into());
389        object.entry("status").or_insert_with(|| "completed".into());
390        if let Some(parts) = object
391            .get_mut("content")
392            .and_then(serde_json::Value::as_array_mut)
393        {
394            for part in parts {
395                if part.get("type").and_then(serde_json::Value::as_str) == Some("output_text") {
396                    let part = part.as_object_mut().expect("text object");
397                    part.entry("annotations")
398                        .or_insert_with(|| serde_json::json!([]));
399                    part.entry("logprobs")
400                        .or_insert_with(|| serde_json::json!([]));
401                }
402            }
403        }
404    }
405    serde_json::from_value(value).map_err(serde::de::Error::custom)
406}
407
408#[derive(
409    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
410)]
411#[serde(rename_all = "snake_case")]
412#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
413#[derive(gproxy_protocol_macros::DeclaredFields)]
414#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
415pub struct ResponseOutputText {
416    #[serde(rename = "type")]
417    pub type_: ResponseOutputTextType,
418    pub text: String,
419    pub annotations: Vec<OutputAnnotation>,
420    pub logprobs: Vec<OutputLogprob>,
421    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
422    pub rest: Rest,
423}
424#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
425#[serde(untagged)]
426#[derive(gproxy_protocol_macros::DeclaredFields)]
427#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
428pub enum OutputAnnotation {
429    File(FileCitation),
430    Url(UrlCitation),
431    ContainerFile(ContainerFileCitation),
432    Path(FilePath),
433}
434macro_rules! citation { ($name:ident { $($field:tt)* }) => { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)] #[serde(rename_all = "snake_case")] #[derive(gproxy_protocol_macros::DeclaredFields)]
435#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
436pub struct $name { $($field)* #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")] pub rest: Rest } }; }
437citation!(FileCitation { pub file_id: String, pub filename: String, pub index: i64, #[serde(rename = "type")] pub type_: FileCitationType, });
438citation!(UrlCitation { pub end_index: i64, pub start_index: i64, pub title: String, pub url: String, #[serde(rename = "type")] pub type_: UrlCitationType, });
439citation!(ContainerFileCitation { pub container_id: String, pub end_index: i64, pub file_id: String, pub filename: String, pub start_index: i64, #[serde(rename = "type")] pub type_: ContainerFileCitationType, });
440citation!(FilePath { pub file_id: String, pub index: i64, #[serde(rename = "type")] pub type_: FilePathType, });
441#[derive(
442    Debug,
443    Clone,
444    Copy,
445    PartialEq,
446    Eq,
447    Serialize,
448    Deserialize,
449    gproxy_protocol_macros::DeclaredFields,
450)]
451#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
452pub enum FileCitationType {
453    #[serde(rename = "file_citation")]
454    FileCitation,
455}
456#[derive(
457    Debug,
458    Clone,
459    Copy,
460    PartialEq,
461    Eq,
462    Serialize,
463    Deserialize,
464    gproxy_protocol_macros::DeclaredFields,
465)]
466#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
467pub enum UrlCitationType {
468    #[serde(rename = "url_citation")]
469    UrlCitation,
470}
471#[derive(
472    Debug,
473    Clone,
474    Copy,
475    PartialEq,
476    Eq,
477    Serialize,
478    Deserialize,
479    gproxy_protocol_macros::DeclaredFields,
480)]
481#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
482pub enum ContainerFileCitationType {
483    #[serde(rename = "container_file_citation")]
484    ContainerFileCitation,
485}
486#[derive(
487    Debug,
488    Clone,
489    Copy,
490    PartialEq,
491    Eq,
492    Serialize,
493    Deserialize,
494    gproxy_protocol_macros::DeclaredFields,
495)]
496#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
497pub enum FilePathType {
498    #[serde(rename = "file_path")]
499    FilePath,
500}
501#[derive(
502    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
503)]
504#[serde(rename_all = "snake_case")]
505#[derive(gproxy_protocol_macros::DeclaredFields)]
506#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
507pub struct OutputLogprob {
508    pub token: String,
509    pub bytes: Vec<i64>,
510    pub logprob: serde_json::Number,
511    pub top_logprobs: Vec<TopLogprob>,
512    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
513    pub rest: Rest,
514}
515#[derive(
516    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
517)]
518#[serde(rename_all = "snake_case")]
519#[derive(gproxy_protocol_macros::DeclaredFields)]
520#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
521pub struct TopLogprob {
522    pub token: String,
523    pub bytes: Vec<i64>,
524    pub logprob: serde_json::Number,
525    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
526    pub rest: Rest,
527}
528#[derive(
529    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
530)]
531#[serde(rename_all = "snake_case")]
532#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
533#[derive(gproxy_protocol_macros::DeclaredFields)]
534#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
535pub struct ResponseOutputRefusal {
536    #[serde(rename = "type")]
537    pub type_: ResponseOutputRefusalType,
538    pub refusal: String,
539    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
540    pub rest: Rest,
541}
542#[derive(
543    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
544)]
545#[serde(rename_all = "snake_case")]
546#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
547#[derive(gproxy_protocol_macros::DeclaredFields)]
548#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
549pub struct FunctionCall {
550    #[serde(
551        default,
552        deserialize_with = "present_nullable",
553        skip_serializing_if = "Option::is_none"
554    )]
555    pub agent: Option<Option<super::multi_agent::Agent>>,
556    #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
557    pub async_: Option<bool>,
558
559    #[serde(rename = "type")]
560    pub type_: FunctionCallType,
561    pub arguments: String,
562    pub call_id: String,
563    pub name: String,
564    #[serde(
565        default,
566        deserialize_with = "present_optional",
567        skip_serializing_if = "Option::is_none"
568    )]
569    pub id: Option<String>,
570    #[serde(
571        default,
572        deserialize_with = "present_optional",
573        skip_serializing_if = "Option::is_none"
574    )]
575    pub namespace: Option<String>,
576    #[serde(
577        default,
578        deserialize_with = "present_nullable",
579        skip_serializing_if = "Option::is_none"
580    )]
581    pub caller: Option<Option<Caller>>,
582    #[serde(
583        default,
584        deserialize_with = "present_optional",
585        skip_serializing_if = "Option::is_none"
586    )]
587    pub status: Option<ItemStatus>,
588    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
589    pub rest: Rest,
590}
591#[derive(
592    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
593)]
594#[serde(rename_all = "snake_case")]
595#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
596#[derive(gproxy_protocol_macros::DeclaredFields)]
597#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
598pub struct FunctionCallOutput {
599    #[serde(
600        default,
601        deserialize_with = "present_nullable",
602        skip_serializing_if = "Option::is_none"
603    )]
604    pub agent: Option<Option<super::multi_agent::Agent>>,
605    #[serde(rename = "type")]
606    pub type_: FunctionCallOutputType,
607    pub call_id: String,
608    pub output: FunctionOutput,
609    #[serde(
610        default,
611        deserialize_with = "present_nullable",
612        skip_serializing_if = "Option::is_none"
613    )]
614    pub id: Option<Option<String>>,
615    #[serde(
616        default,
617        deserialize_with = "present_nullable",
618        skip_serializing_if = "Option::is_none"
619    )]
620    pub name: Option<Option<String>>,
621    #[serde(
622        default,
623        deserialize_with = "present_nullable",
624        skip_serializing_if = "Option::is_none"
625    )]
626    pub namespace: Option<Option<String>>,
627    #[serde(
628        default,
629        deserialize_with = "present_nullable",
630        skip_serializing_if = "Option::is_none"
631    )]
632    pub caller: Option<Option<Caller>>,
633    #[serde(
634        default,
635        deserialize_with = "present_nullable",
636        skip_serializing_if = "Option::is_none"
637    )]
638    pub status: Option<Option<ItemStatus>>,
639    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
640    pub rest: Rest,
641}
642#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
643#[serde(untagged)]
644#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
645#[derive(gproxy_protocol_macros::DeclaredFields)]
646#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
647pub enum FunctionOutput {
648    Text(String),
649    Content(Vec<FunctionOutputContent>),
650}
651#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
652#[serde(untagged)]
653#[derive(gproxy_protocol_macros::DeclaredFields)]
654#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
655pub enum FunctionOutputContent {
656    Text(FunctionOutputText),
657    Image(FunctionOutputImage),
658    File(FunctionOutputFile),
659}
660#[derive(
661    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
662)]
663#[serde(rename_all = "snake_case")]
664#[derive(gproxy_protocol_macros::DeclaredFields)]
665#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
666pub struct FunctionOutputImage {
667    #[serde(rename = "type")]
668    pub type_: ResponseInputImageType,
669    #[serde(
670        default,
671        deserialize_with = "present_nullable",
672        skip_serializing_if = "Option::is_none"
673    )]
674    pub detail: Option<Option<ImageDetail>>,
675    #[serde(
676        default,
677        deserialize_with = "present_nullable",
678        skip_serializing_if = "Option::is_none"
679    )]
680    pub file_id: Option<Option<String>>,
681    #[serde(
682        default,
683        deserialize_with = "present_nullable",
684        skip_serializing_if = "Option::is_none"
685    )]
686    pub image_url: Option<Option<String>>,
687    #[serde(
688        default,
689        deserialize_with = "present_nullable",
690        skip_serializing_if = "Option::is_none"
691    )]
692    pub prompt_cache_breakpoint: Option<Option<PromptCacheBreakpoint>>,
693    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
694    pub rest: Rest,
695}
696#[derive(
697    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
698)]
699#[serde(rename_all = "snake_case")]
700#[derive(gproxy_protocol_macros::DeclaredFields)]
701#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
702pub struct FunctionOutputFile {
703    #[serde(rename = "type")]
704    pub type_: ResponseInputFileType,
705    #[serde(
706        default,
707        deserialize_with = "present_nullable",
708        skip_serializing_if = "Option::is_none"
709    )]
710    pub file_data: Option<Option<String>>,
711    #[serde(
712        default,
713        deserialize_with = "present_nullable",
714        skip_serializing_if = "Option::is_none"
715    )]
716    pub file_id: Option<Option<String>>,
717    #[serde(
718        default,
719        deserialize_with = "present_nullable",
720        skip_serializing_if = "Option::is_none"
721    )]
722    pub file_url: Option<Option<String>>,
723    #[serde(
724        default,
725        deserialize_with = "present_nullable",
726        skip_serializing_if = "Option::is_none"
727    )]
728    pub prompt_cache_breakpoint: Option<Option<PromptCacheBreakpoint>>,
729    #[serde(
730        default,
731        deserialize_with = "present_optional",
732        skip_serializing_if = "Option::is_none"
733    )]
734    pub detail: Option<FileDetail>,
735    #[serde(
736        default,
737        deserialize_with = "present_nullable",
738        skip_serializing_if = "Option::is_none"
739    )]
740    pub filename: Option<Option<String>>,
741    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
742    pub rest: Rest,
743}
744
745#[derive(
746    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
747)]
748#[serde(rename_all = "snake_case")]
749#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
750#[derive(gproxy_protocol_macros::DeclaredFields)]
751#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
752pub struct ReasoningConfig {
753    #[serde(
754        default,
755        deserialize_with = "present_nullable",
756        skip_serializing_if = "Option::is_none"
757    )]
758    pub effort: Option<Option<ReasoningEffort>>,
759    #[serde(
760        default,
761        deserialize_with = "present_nullable",
762        skip_serializing_if = "Option::is_none"
763    )]
764    pub generate_summary: Option<Option<ReasoningSummary>>,
765    #[serde(
766        default,
767        deserialize_with = "present_optional",
768        skip_serializing_if = "Option::is_none"
769    )]
770    pub mode: Option<String>,
771    #[serde(
772        default,
773        deserialize_with = "present_nullable",
774        skip_serializing_if = "Option::is_none"
775    )]
776    pub summary: Option<Option<ReasoningSummary>>,
777    #[serde(
778        default,
779        deserialize_with = "present_nullable",
780        skip_serializing_if = "Option::is_none"
781    )]
782    pub context: Option<Option<ReasoningContext>>,
783    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
784    pub rest: Rest,
785}
786#[derive(
787    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
788)]
789#[serde(rename_all = "snake_case")]
790#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
791#[derive(gproxy_protocol_macros::DeclaredFields)]
792#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
793pub struct ReasoningItem {
794    #[serde(
795        default,
796        deserialize_with = "present_nullable",
797        skip_serializing_if = "Option::is_none"
798    )]
799    pub agent: Option<Option<super::multi_agent::Agent>>,
800    #[serde(rename = "type")]
801    pub type_: ReasoningItemType,
802    pub id: String,
803    pub summary: Vec<SummaryText>,
804    #[serde(
805        default,
806        deserialize_with = "present_optional",
807        skip_serializing_if = "Option::is_none"
808    )]
809    pub content: Option<Vec<ReasoningContent>>,
810    #[serde(
811        default,
812        deserialize_with = "present_optional",
813        skip_serializing_if = "Option::is_none"
814    )]
815    pub status: Option<ReasoningStatus>,
816    #[serde(
817        default,
818        deserialize_with = "present_nullable",
819        skip_serializing_if = "Option::is_none"
820    )]
821    pub encrypted_content: Option<Option<String>>,
822    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
823    pub rest: Rest,
824}
825#[derive(
826    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
827)]
828#[serde(rename_all = "snake_case")]
829#[derive(gproxy_protocol_macros::DeclaredFields)]
830#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
831pub struct ReasoningContent {
832    #[serde(rename = "type")]
833    pub type_: ReasoningTextType,
834    pub text: String,
835    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
836    pub rest: Rest,
837}
838#[derive(
839    Debug,
840    Clone,
841    Copy,
842    PartialEq,
843    Eq,
844    Serialize,
845    Deserialize,
846    gproxy_protocol_macros::DeclaredFields,
847)]
848#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
849pub enum ReasoningTextType {
850    #[serde(rename = "reasoning_text")]
851    ReasoningText,
852}
853#[derive(
854    Debug,
855    Clone,
856    Copy,
857    PartialEq,
858    Eq,
859    Serialize,
860    Deserialize,
861    gproxy_protocol_macros::DeclaredFields,
862)]
863#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
864pub enum ReasoningStatus {
865    #[serde(rename = "in_progress")]
866    InProgress,
867    #[serde(rename = "completed")]
868    Completed,
869    #[serde(rename = "incomplete")]
870    Incomplete,
871}
872#[derive(
873    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
874)]
875#[serde(rename_all = "snake_case")]
876#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
877#[derive(gproxy_protocol_macros::DeclaredFields)]
878#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
879pub struct SummaryText {
880    #[serde(rename = "type")]
881    pub type_: SummaryTextType,
882    pub text: String,
883    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
884    pub rest: Rest,
885}
886#[derive(
887    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
888)]
889#[serde(rename_all = "snake_case")]
890#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
891#[derive(gproxy_protocol_macros::DeclaredFields)]
892#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
893pub struct ItemReference {
894    #[serde(
895        default,
896        deserialize_with = "present_nullable",
897        skip_serializing_if = "Option::is_none"
898    )]
899    pub agent: Option<Option<super::multi_agent::Agent>>,
900    #[serde(
901        rename = "type",
902        default,
903        deserialize_with = "present_nullable",
904        skip_serializing_if = "Option::is_none"
905    )]
906    pub type_: Option<Option<ItemReferenceType>>,
907    pub id: String,
908    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
909    pub rest: Rest,
910}
911#[derive(
912    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
913)]
914#[serde(rename_all = "snake_case")]
915#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
916#[derive(gproxy_protocol_macros::DeclaredFields)]
917#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
918pub struct Compaction {
919    #[serde(
920        default,
921        deserialize_with = "present_nullable",
922        skip_serializing_if = "Option::is_none"
923    )]
924    pub agent: Option<Option<super::multi_agent::Agent>>,
925    #[serde(rename = "type")]
926    pub type_: CompactionType,
927    pub encrypted_content: String,
928    #[serde(
929        default,
930        deserialize_with = "present_nullable",
931        skip_serializing_if = "Option::is_none"
932    )]
933    pub id: Option<Option<String>>,
934    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
935    pub rest: Rest,
936}
937
938#[derive(
939    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
940)]
941#[serde(rename_all = "snake_case")]
942#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
943#[derive(gproxy_protocol_macros::DeclaredFields)]
944#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
945pub struct PendingSafetyCheck {
946    pub id: String,
947    #[serde(
948        default,
949        deserialize_with = "present_nullable",
950        skip_serializing_if = "Option::is_none"
951    )]
952    pub code: Option<Option<String>>,
953    #[serde(
954        default,
955        deserialize_with = "present_nullable",
956        skip_serializing_if = "Option::is_none"
957    )]
958    pub message: Option<Option<String>>,
959    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
960    pub rest: Rest,
961}
962
963#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
964#[serde(tag = "type")]
965#[derive(gproxy_protocol_macros::DeclaredFields)]
966#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
967pub enum Caller {
968    #[serde(rename = "direct")]
969    Direct(DirectCaller),
970    #[serde(rename = "program")]
971    Program(ProgramCaller),
972}
973#[derive(
974    Debug,
975    Clone,
976    PartialEq,
977    Eq,
978    Serialize,
979    Deserialize,
980    gproxy_protocol_macros::WireBuilder,
981    gproxy_protocol_macros::DeclaredFields,
982)]
983#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
984pub struct DirectCaller {
985    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
986    pub rest: Rest,
987}
988#[derive(
989    Debug,
990    Clone,
991    PartialEq,
992    Eq,
993    Serialize,
994    Deserialize,
995    gproxy_protocol_macros::WireBuilder,
996    gproxy_protocol_macros::DeclaredFields,
997)]
998#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
999pub struct ProgramCaller {
1000    pub caller_id: String,
1001    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1002    pub rest: Rest,
1003}
1004
1005#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1006#[serde(tag = "type")]
1007#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1008#[derive(gproxy_protocol_macros::DeclaredFields)]
1009#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1010pub enum ComputerAction {
1011    #[serde(rename = "click")]
1012    Click(ClickAction),
1013    #[serde(rename = "double_click")]
1014    DoubleClick(DoubleClickAction),
1015    #[serde(rename = "drag")]
1016    Drag(DragAction),
1017    #[serde(rename = "keypress")]
1018    Keypress(KeypressAction),
1019    #[serde(rename = "move")]
1020    Move(MoveAction),
1021    #[serde(rename = "screenshot")]
1022    Screenshot(ScreenshotAction),
1023    #[serde(rename = "scroll")]
1024    Scroll(ScrollAction),
1025    #[serde(rename = "type")]
1026    Type(TypeAction),
1027    #[serde(rename = "wait")]
1028    Wait(WaitAction),
1029}
1030#[derive(
1031    Debug,
1032    Clone,
1033    Copy,
1034    PartialEq,
1035    Eq,
1036    Serialize,
1037    Deserialize,
1038    gproxy_protocol_macros::DeclaredFields,
1039)]
1040#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1041pub enum ComputerScreenshotType {
1042    #[serde(rename = "computer_screenshot")]
1043    ComputerScreenshot,
1044}
1045macro_rules! action_struct { ($name:ident { $($field:tt)* }) => { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)] #[serde(rename_all = "snake_case")] #[cfg_attr(not(feature = "exhaustive"), non_exhaustive)] #[derive(gproxy_protocol_macros::DeclaredFields)]
1046#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1047pub struct $name { $($field)* #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")] pub rest: Rest } }; }
1048action_struct!(ClickAction { pub button: ClickButton, pub x: i64, pub y: i64, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub keys: Option<Option<Vec<String>>>, });
1049action_struct!(DoubleClickAction { pub x: i64, pub y: i64, #[wire(required)]
1050    #[cfg_attr(feature = "schema", schemars(extend("x-gproxy-required" = true)))] #[serde(deserialize_with = "required_nullable")] pub keys: Option<Vec<String>>, });
1051action_struct!(DragAction { pub path: Vec<Coordinate>, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub keys: Option<Option<Vec<String>>>, });
1052action_struct!(KeypressAction { pub keys: Vec<String>, });
1053action_struct!(MoveAction { pub x: i64, pub y: i64, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub keys: Option<Option<Vec<String>>>, });
1054action_struct!(ScreenshotAction {});
1055action_struct!(ScrollAction { pub scroll_x: i64, pub scroll_y: i64, pub x: i64, pub y: i64, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub keys: Option<Option<Vec<String>>>, });
1056action_struct!(TypeAction { pub text: String, });
1057action_struct!(WaitAction {});
1058action_struct!(Coordinate { pub x: i64, pub y: i64, });
1059
1060pub type ComputerToolCallOutput = ComputerScreenshot;
1061#[derive(
1062    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1063)]
1064#[serde(rename_all = "snake_case")]
1065#[derive(gproxy_protocol_macros::DeclaredFields)]
1066#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1067pub struct ComputerScreenshot {
1068    #[serde(rename = "type")]
1069    pub type_: ComputerScreenshotType,
1070    #[serde(
1071        default,
1072        deserialize_with = "present_optional",
1073        skip_serializing_if = "Option::is_none"
1074    )]
1075    pub file_id: Option<String>,
1076    #[serde(
1077        default,
1078        deserialize_with = "present_optional",
1079        skip_serializing_if = "Option::is_none"
1080    )]
1081    pub image_url: Option<String>,
1082    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1083    pub rest: Rest,
1084}
1085#[derive(
1086    Debug,
1087    Clone,
1088    Copy,
1089    PartialEq,
1090    Eq,
1091    Serialize,
1092    Deserialize,
1093    gproxy_protocol_macros::DeclaredFields,
1094)]
1095#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1096pub enum ClickButton {
1097    #[serde(rename = "left")]
1098    Left,
1099    #[serde(rename = "right")]
1100    Right,
1101    #[serde(rename = "wheel")]
1102    Wheel,
1103    #[serde(rename = "back")]
1104    Back,
1105    #[serde(rename = "forward")]
1106    Forward,
1107}
1108
1109#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1110#[serde(tag = "type")]
1111#[derive(gproxy_protocol_macros::DeclaredFields)]
1112#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1113pub enum WebSearchAction {
1114    #[serde(rename = "search")]
1115    Search(WebSearchQuery),
1116    #[serde(rename = "open_page")]
1117    OpenPage(WebSearchOpenPage),
1118    #[serde(rename = "find_in_page")]
1119    FindInPage(WebSearchFindInPage),
1120}
1121action_struct!(WebSearchQuery { #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub queries: Option<Vec<String>>, #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub query: Option<String>, #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub sources: Option<Vec<WebSearchSource>>, });
1122action_struct!(WebSearchSource { #[serde(rename = "type")] pub type_: WebSearchSourceType, pub url: String, });
1123#[derive(
1124    Debug,
1125    Clone,
1126    Copy,
1127    PartialEq,
1128    Eq,
1129    Serialize,
1130    Deserialize,
1131    gproxy_protocol_macros::DeclaredFields,
1132)]
1133#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1134pub enum WebSearchSourceType {
1135    #[serde(rename = "url")]
1136    Url,
1137}
1138action_struct!(WebSearchOpenPage { #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub url: Option<Option<String>>, });
1139action_struct!(WebSearchFindInPage { pub pattern: String, pub url: String, });
1140#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1141#[serde(tag = "type")]
1142#[derive(gproxy_protocol_macros::DeclaredFields)]
1143#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1144pub enum CodeInterpreterOutput {
1145    #[serde(rename = "logs")]
1146    Logs(CodeLogs),
1147    #[serde(rename = "image")]
1148    Image(CodeImage),
1149}
1150action_struct!(CodeLogs { pub logs: String, });
1151action_struct!(CodeImage { pub url: String, });
1152
1153#[derive(
1154    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1155)]
1156#[serde(rename_all = "snake_case")]
1157#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1158#[derive(gproxy_protocol_macros::DeclaredFields)]
1159#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1160pub struct ComputerCall {
1161    #[serde(
1162        default,
1163        deserialize_with = "present_nullable",
1164        skip_serializing_if = "Option::is_none"
1165    )]
1166    pub agent: Option<Option<super::multi_agent::Agent>>,
1167    #[serde(rename = "type")]
1168    pub type_: ComputerCallType,
1169    pub id: String,
1170    pub call_id: String,
1171    #[serde(
1172        default,
1173        deserialize_with = "present_optional",
1174        skip_serializing_if = "Option::is_none"
1175    )]
1176    pub action: Option<ComputerAction>,
1177    #[serde(
1178        default,
1179        deserialize_with = "present_optional",
1180        skip_serializing_if = "Option::is_none"
1181    )]
1182    pub actions: Option<Vec<ComputerAction>>,
1183    pub pending_safety_checks: Vec<PendingSafetyCheck>,
1184    pub status: ItemStatus,
1185    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1186    pub rest: Rest,
1187}
1188#[derive(
1189    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1190)]
1191#[serde(rename_all = "snake_case")]
1192#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1193#[derive(gproxy_protocol_macros::DeclaredFields)]
1194#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1195pub struct ComputerCallOutput {
1196    #[serde(
1197        default,
1198        deserialize_with = "present_nullable",
1199        skip_serializing_if = "Option::is_none"
1200    )]
1201    pub agent: Option<Option<super::multi_agent::Agent>>,
1202    #[serde(rename = "type")]
1203    pub type_: ComputerCallOutputType,
1204    pub call_id: String,
1205    pub output: ComputerToolCallOutput,
1206    #[serde(
1207        default,
1208        deserialize_with = "present_nullable",
1209        skip_serializing_if = "Option::is_none"
1210    )]
1211    pub id: Option<Option<String>>,
1212    #[serde(
1213        default,
1214        deserialize_with = "present_nullable",
1215        skip_serializing_if = "Option::is_none"
1216    )]
1217    pub acknowledged_safety_checks: Option<Option<Vec<PendingSafetyCheck>>>,
1218    #[serde(
1219        default,
1220        deserialize_with = "present_nullable",
1221        skip_serializing_if = "Option::is_none"
1222    )]
1223    pub status: Option<Option<ItemStatus>>,
1224    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1225    pub rest: Rest,
1226}
1227#[derive(
1228    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1229)]
1230#[serde(rename_all = "snake_case")]
1231#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1232#[derive(gproxy_protocol_macros::DeclaredFields)]
1233#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1234pub struct WebSearchCall {
1235    #[serde(
1236        default,
1237        deserialize_with = "present_nullable",
1238        skip_serializing_if = "Option::is_none"
1239    )]
1240    pub agent: Option<Option<super::multi_agent::Agent>>,
1241    #[serde(rename = "type")]
1242    pub type_: WebSearchCallType,
1243    pub id: String,
1244    /// The initial in-progress stream item precedes its search action.
1245    #[serde(
1246        default,
1247        deserialize_with = "present_optional",
1248        skip_serializing_if = "Option::is_none"
1249    )]
1250    pub action: Option<WebSearchAction>,
1251    pub status: WebSearchStatus,
1252    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1253    pub rest: Rest,
1254}
1255#[derive(
1256    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1257)]
1258#[serde(rename_all = "snake_case")]
1259#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1260#[derive(gproxy_protocol_macros::DeclaredFields)]
1261#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1262pub struct FileSearchCall {
1263    #[serde(
1264        default,
1265        deserialize_with = "present_nullable",
1266        skip_serializing_if = "Option::is_none"
1267    )]
1268    pub agent: Option<Option<super::multi_agent::Agent>>,
1269    #[serde(rename = "type")]
1270    pub type_: FileSearchCallType,
1271    pub id: String,
1272    pub queries: Vec<String>,
1273    pub status: FileSearchStatus,
1274    #[serde(
1275        default,
1276        deserialize_with = "present_nullable",
1277        skip_serializing_if = "Option::is_none"
1278    )]
1279    pub results: Option<Option<Vec<FileSearchResult>>>,
1280    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1281    pub rest: Rest,
1282}
1283#[derive(
1284    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1285)]
1286#[serde(rename_all = "snake_case")]
1287#[derive(gproxy_protocol_macros::DeclaredFields)]
1288#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1289pub struct FileSearchResult {
1290    #[serde(
1291        default,
1292        deserialize_with = "present_nullable",
1293        skip_serializing_if = "Option::is_none"
1294    )]
1295    pub attributes: Option<Option<std::collections::BTreeMap<String, FileAttributeValue>>>,
1296    #[serde(
1297        default,
1298        deserialize_with = "present_optional",
1299        skip_serializing_if = "Option::is_none"
1300    )]
1301    pub file_id: Option<String>,
1302    #[serde(
1303        default,
1304        deserialize_with = "present_optional",
1305        skip_serializing_if = "Option::is_none"
1306    )]
1307    pub filename: Option<String>,
1308    #[serde(
1309        default,
1310        deserialize_with = "present_optional",
1311        skip_serializing_if = "Option::is_none"
1312    )]
1313    pub score: Option<serde_json::Number>,
1314    #[serde(
1315        default,
1316        deserialize_with = "present_optional",
1317        skip_serializing_if = "Option::is_none"
1318    )]
1319    pub text: Option<String>,
1320    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1321    pub rest: Rest,
1322}
1323#[derive(
1324    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1325)]
1326#[serde(rename_all = "snake_case")]
1327#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1328#[derive(gproxy_protocol_macros::DeclaredFields)]
1329#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1330pub struct ImageGenerationCall {
1331    #[serde(
1332        default,
1333        deserialize_with = "present_nullable",
1334        skip_serializing_if = "Option::is_none"
1335    )]
1336    pub agent: Option<Option<super::multi_agent::Agent>>,
1337    #[serde(
1338        default,
1339        deserialize_with = "present_nullable",
1340        skip_serializing_if = "Option::is_none"
1341    )]
1342    pub action: Option<Option<ImageAction>>,
1343    #[serde(
1344        default,
1345        deserialize_with = "present_nullable",
1346        skip_serializing_if = "Option::is_none"
1347    )]
1348    pub background: Option<Option<ImageBackground>>,
1349    #[serde(
1350        default,
1351        deserialize_with = "present_nullable",
1352        skip_serializing_if = "Option::is_none"
1353    )]
1354    pub output_format: Option<Option<ImageOutputFormat>>,
1355    #[serde(
1356        default,
1357        deserialize_with = "present_nullable",
1358        skip_serializing_if = "Option::is_none"
1359    )]
1360    pub quality: Option<Option<ImageQuality>>,
1361    #[serde(
1362        default,
1363        deserialize_with = "present_nullable",
1364        skip_serializing_if = "Option::is_none"
1365    )]
1366    pub revised_prompt: Option<Option<String>>,
1367    #[serde(
1368        default,
1369        deserialize_with = "present_nullable",
1370        skip_serializing_if = "Option::is_none"
1371    )]
1372    pub size: Option<Option<String>>,
1373
1374    #[serde(rename = "type")]
1375    pub type_: ImageGenerationCallType,
1376    pub id: String,
1377    #[wire(required)]
1378    #[cfg_attr(feature = "schema", schemars(extend("x-gproxy-required" = true)))]
1379    #[serde(deserialize_with = "required_nullable")]
1380    pub result: Option<String>,
1381    pub status: ImageGenerationStatus,
1382    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1383    pub rest: Rest,
1384}
1385#[derive(
1386    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1387)]
1388#[serde(rename_all = "snake_case")]
1389#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1390#[derive(gproxy_protocol_macros::DeclaredFields)]
1391#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1392pub struct CodeInterpreterCall {
1393    #[serde(
1394        default,
1395        deserialize_with = "present_nullable",
1396        skip_serializing_if = "Option::is_none"
1397    )]
1398    pub agent: Option<Option<super::multi_agent::Agent>>,
1399    #[serde(rename = "type")]
1400    pub type_: CodeInterpreterCallType,
1401    pub id: String,
1402    #[wire(required)]
1403    #[cfg_attr(feature = "schema", schemars(extend("x-gproxy-required" = true)))]
1404    #[serde(deserialize_with = "required_nullable")]
1405    pub code: Option<String>,
1406    pub container_id: String,
1407    #[wire(required)]
1408    #[cfg_attr(feature = "schema", schemars(extend("x-gproxy-required" = true)))]
1409    #[serde(deserialize_with = "required_nullable")]
1410    pub outputs: Option<Vec<CodeInterpreterOutput>>,
1411    pub status: CodeInterpreterStatus,
1412    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1413    pub rest: Rest,
1414}
1415#[derive(
1416    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1417)]
1418#[serde(rename_all = "snake_case")]
1419#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1420#[derive(gproxy_protocol_macros::DeclaredFields)]
1421#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1422pub struct CustomToolCall {
1423    #[serde(
1424        default,
1425        deserialize_with = "present_nullable",
1426        skip_serializing_if = "Option::is_none"
1427    )]
1428    pub agent: Option<Option<super::multi_agent::Agent>>,
1429    #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
1430    pub async_: Option<bool>,
1431
1432    #[serde(rename = "type")]
1433    pub type_: CustomToolCallType,
1434    pub call_id: String,
1435    pub input: String,
1436    pub name: String,
1437    #[serde(
1438        default,
1439        deserialize_with = "present_optional",
1440        skip_serializing_if = "Option::is_none"
1441    )]
1442    pub id: Option<String>,
1443    #[serde(
1444        default,
1445        deserialize_with = "present_nullable",
1446        skip_serializing_if = "Option::is_none"
1447    )]
1448    pub caller: Option<Option<Caller>>,
1449    #[serde(
1450        default,
1451        deserialize_with = "present_optional",
1452        skip_serializing_if = "Option::is_none"
1453    )]
1454    pub namespace: Option<String>,
1455    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1456    pub rest: Rest,
1457}
1458#[derive(
1459    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1460)]
1461#[serde(rename_all = "snake_case")]
1462#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1463#[derive(gproxy_protocol_macros::DeclaredFields)]
1464#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1465pub struct CustomToolCallOutput {
1466    #[serde(
1467        default,
1468        deserialize_with = "present_nullable",
1469        skip_serializing_if = "Option::is_none"
1470    )]
1471    pub agent: Option<Option<super::multi_agent::Agent>>,
1472    #[serde(rename = "type")]
1473    pub type_: CustomToolCallOutputType,
1474    pub call_id: String,
1475    pub output: CustomOutput,
1476    #[serde(
1477        default,
1478        deserialize_with = "present_optional",
1479        skip_serializing_if = "Option::is_none"
1480    )]
1481    pub id: Option<String>,
1482    #[serde(
1483        default,
1484        deserialize_with = "present_nullable",
1485        skip_serializing_if = "Option::is_none"
1486    )]
1487    pub caller: Option<Option<Caller>>,
1488    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1489    pub rest: Rest,
1490}
1491
1492#[derive(
1493    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1494)]
1495#[serde(rename_all = "snake_case")]
1496#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1497#[derive(gproxy_protocol_macros::DeclaredFields)]
1498#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1499pub struct ResponseOutputMessage {
1500    #[serde(
1501        default,
1502        deserialize_with = "present_nullable",
1503        skip_serializing_if = "Option::is_none"
1504    )]
1505    pub agent: Option<Option<super::multi_agent::Agent>>,
1506    pub id: String,
1507    pub content: Vec<OutputContent>,
1508    pub role: OutputMessageRole,
1509    pub status: OutputMessageStatus,
1510    #[serde(
1511        default,
1512        deserialize_with = "present_nullable",
1513        skip_serializing_if = "Option::is_none"
1514    )]
1515    pub phase: Option<Option<MessagePhase>>,
1516    #[serde(rename = "type")]
1517    pub type_: MessageType,
1518    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1519    pub rest: Rest,
1520}
1521
1522#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1523#[serde(untagged)]
1524#[derive(gproxy_protocol_macros::DeclaredFields)]
1525#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1526pub enum OutputContent {
1527    Text(ResponseOutputText),
1528    Refusal(ResponseOutputRefusal),
1529}
1530
1531#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1532#[serde(rename_all = "snake_case")]
1533#[derive(gproxy_protocol_macros::DeclaredFields)]
1534#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1535pub enum OutputMessageRole {
1536    #[serde(rename = "assistant")]
1537    Assistant,
1538}
1539#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1540#[serde(rename_all = "snake_case")]
1541#[derive(gproxy_protocol_macros::DeclaredFields)]
1542#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1543pub enum OutputMessageStatus {
1544    #[serde(rename = "in_progress")]
1545    InProgress,
1546    #[serde(rename = "completed")]
1547    Completed,
1548    #[serde(rename = "incomplete")]
1549    Incomplete,
1550}
1551
1552macro_rules! simple_item {
1553    ($name:ident { $($field:tt)* }) => {
1554        #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
1555        #[serde(rename_all = "snake_case")]
1556        #[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1557        #[derive(gproxy_protocol_macros::DeclaredFields)]
1558#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1559pub struct $name { #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub agent: Option<Option<super::multi_agent::Agent>>, $($field)* #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")] pub rest: Rest }
1560    };
1561}
1562
1563simple_item!(ToolSearchCall {
1564    #[serde(rename = "type")] pub type_: ToolSearchCallType,
1565    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1566    // Get input token counts.md:1183 explicitly declares arbitrary unknown JSON.
1567    pub arguments: serde_json::Value,
1568    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub call_id: Option<Option<String>>,
1569    #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub execution: Option<ToolExecution>,
1570    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub status: Option<Option<ItemStatus>>,
1571});
1572simple_item!(ToolSearchOutput {
1573    #[serde(rename = "type")] pub type_: ToolSearchOutputType,
1574    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1575    pub tools: Vec<Tool>,
1576    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub call_id: Option<Option<String>>,
1577    #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub execution: Option<ToolExecution>,
1578    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub status: Option<Option<ItemStatus>>,
1579});
1580simple_item!(AdditionalTools {
1581    #[serde(rename = "type")] pub type_: AdditionalToolsType,
1582    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1583    pub role: AdditionalToolsRole, pub tools: Vec<Tool>,
1584});
1585simple_item!(LocalShellCall {
1586    #[serde(rename = "type")] pub type_: LocalShellCallType,
1587    pub id: String, pub call_id: String, pub action: LocalShellAction,
1588    pub status: ItemStatus,
1589});
1590simple_item!(LocalShellCallOutput {
1591    #[serde(rename = "type")] pub type_: LocalShellCallOutputType,
1592    pub id: String, pub output: String, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub status: Option<Option<ItemStatus>>,
1593});
1594simple_item!(ShellCall {
1595    #[serde(rename = "type")] pub type_: ShellCallType,
1596    pub call_id: String, pub action: ShellAction,
1597    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub caller: Option<Option<Caller>>,
1598    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub environment: Option<Option<ShellCallEnvironment>>,
1599    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1600    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub status: Option<Option<ItemStatus>>,
1601});
1602simple_item!(ShellCallOutput {
1603    #[serde(rename = "type")] pub type_: ShellCallOutputType,
1604    pub call_id: String, pub output: Vec<ShellOutputContent>,
1605    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub caller: Option<Option<Caller>>,
1606    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub max_output_length: Option<Option<i64>>,
1607    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1608    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub status: Option<Option<ItemStatus>>,
1609});
1610simple_item!(ApplyPatchCall {
1611    #[serde(rename = "type")] pub type_: ApplyPatchCallType,
1612    pub call_id: String, pub operation: ApplyPatchOperation, pub status: ApplyPatchStatus,
1613    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub caller: Option<Option<Caller>>,
1614    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1615});
1616simple_item!(ApplyPatchCallOutput {
1617    #[serde(rename = "type")] pub type_: ApplyPatchCallOutputType,
1618    pub call_id: String, pub status: ApplyPatchOutputStatus, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub output: Option<Option<String>>,
1619    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub caller: Option<Option<Caller>>,
1620    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1621});
1622simple_item!(McpListTools {
1623    #[serde(rename = "type")] pub type_: McpListToolsType,
1624    pub id: String, pub server_label: String, pub tools: Vec<McpToolDefinition>, #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub error: Option<Option<String>>,
1625});
1626simple_item!(McpApprovalRequest {
1627    #[serde(rename = "type")] pub type_: McpApprovalRequestType,
1628    pub id: String, pub arguments: String, pub name: String, pub server_label: String,
1629});
1630simple_item!(McpApprovalResponse {
1631    #[serde(rename = "type")] pub type_: McpApprovalResponseType,
1632    pub approval_request_id: String, pub approve: bool,
1633    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub id: Option<Option<String>>,
1634    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub reason: Option<Option<String>>,
1635});
1636simple_item!(McpCall {
1637    #[serde(rename = "type")] pub type_: McpCallType,
1638    pub id: String, pub arguments: String, pub name: String, pub server_label: String,
1639    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub approval_request_id: Option<Option<String>>,
1640    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub error: Option<Option<String>>,
1641    #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")] pub output: Option<Option<String>>,
1642    #[serde(default, deserialize_with = "present_optional", skip_serializing_if = "Option::is_none")] pub status: Option<McpCallStatus>,
1643});
1644simple_item!(CompactionTrigger { #[serde(rename = "type")] pub type_: CompactionTriggerType, });
1645simple_item!(Program {
1646    #[serde(rename = "type")] pub type_: ProgramType,
1647    pub id: String, pub call_id: String, pub code: String, pub fingerprint: String,
1648});
1649simple_item!(ProgramOutput {
1650    #[serde(rename = "type")] pub type_: ProgramOutputType,
1651    pub id: String, pub call_id: String, pub result: String, pub status: ProgramOutputStatus,
1652});
1653
1654#[derive(
1655    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1656)]
1657#[serde(rename_all = "snake_case")]
1658#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1659#[derive(gproxy_protocol_macros::DeclaredFields)]
1660#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1661pub struct McpToolDefinition {
1662    pub name: String,
1663    // Get input token counts.md:3757: unknown schema, not a fixed wire object.
1664    pub input_schema: serde_json::Value,
1665    #[serde(
1666        default,
1667        deserialize_with = "present_nullable",
1668        skip_serializing_if = "Option::is_none"
1669    )]
1670    // Get input token counts.md:3765 permits arbitrary annotations JSON or null.
1671    pub annotations: Option<Option<serde_json::Value>>,
1672    #[serde(
1673        default,
1674        deserialize_with = "present_nullable",
1675        skip_serializing_if = "Option::is_none"
1676    )]
1677    pub description: Option<Option<String>>,
1678    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1679    pub rest: Rest,
1680}
1681
1682#[derive(
1683    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1684)]
1685#[serde(rename_all = "snake_case")]
1686#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1687#[derive(gproxy_protocol_macros::DeclaredFields)]
1688#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1689pub struct LocalShellAction {
1690    pub command: Vec<String>,
1691    pub env: std::collections::BTreeMap<String, String>,
1692    #[serde(rename = "type")]
1693    pub type_: LocalShellActionType,
1694    #[serde(
1695        default,
1696        deserialize_with = "present_nullable",
1697        skip_serializing_if = "Option::is_none"
1698    )]
1699    pub timeout_ms: Option<Option<i64>>,
1700    #[serde(
1701        default,
1702        deserialize_with = "present_nullable",
1703        skip_serializing_if = "Option::is_none"
1704    )]
1705    pub user: Option<Option<String>>,
1706    #[serde(
1707        default,
1708        deserialize_with = "present_nullable",
1709        skip_serializing_if = "Option::is_none"
1710    )]
1711    pub working_directory: Option<Option<String>>,
1712    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1713    pub rest: Rest,
1714}
1715#[derive(
1716    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1717)]
1718#[serde(rename_all = "snake_case")]
1719#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1720#[derive(gproxy_protocol_macros::DeclaredFields)]
1721#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1722pub struct ShellAction {
1723    pub commands: Vec<String>,
1724    #[serde(
1725        default,
1726        deserialize_with = "present_nullable",
1727        skip_serializing_if = "Option::is_none"
1728    )]
1729    pub timeout_ms: Option<Option<i64>>,
1730    #[serde(
1731        default,
1732        deserialize_with = "present_nullable",
1733        skip_serializing_if = "Option::is_none"
1734    )]
1735    pub max_output_length: Option<Option<i64>>,
1736    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1737    pub rest: Rest,
1738}
1739#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1740#[serde(tag = "type")]
1741#[derive(gproxy_protocol_macros::DeclaredFields)]
1742#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1743pub enum ApplyPatchOperation {
1744    #[serde(rename = "create_file")]
1745    Create(ApplyPatchCreate),
1746    #[serde(rename = "delete_file")]
1747    Delete(ApplyPatchDelete),
1748    #[serde(rename = "update_file")]
1749    Update(ApplyPatchUpdate),
1750}
1751action_struct!(ApplyPatchCreate { pub path: String, pub diff: String, });
1752action_struct!(ApplyPatchDelete { pub path: String, });
1753action_struct!(ApplyPatchUpdate { pub path: String, pub diff: String, });
1754#[derive(
1755    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1756)]
1757#[serde(rename_all = "snake_case")]
1758#[derive(gproxy_protocol_macros::DeclaredFields)]
1759#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1760pub struct ShellOutputContent {
1761    pub stdout: String,
1762    pub stderr: String,
1763    pub outcome: ShellOutputOutcome,
1764    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1765    pub rest: Rest,
1766}
1767#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1768#[serde(tag = "type")]
1769#[derive(gproxy_protocol_macros::DeclaredFields)]
1770#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1771pub enum ShellOutputOutcome {
1772    #[serde(rename = "timeout")]
1773    Timeout(ShellTimeout),
1774    #[serde(rename = "exit")]
1775    Exit(ShellExit),
1776}
1777action_struct!(ShellTimeout {});
1778action_struct!(ShellExit { pub exit_code: i64, });
1779
1780#[derive(
1781    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1782)]
1783#[serde(rename_all = "snake_case")]
1784#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1785#[derive(gproxy_protocol_macros::DeclaredFields)]
1786#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1787pub struct TextConfig {
1788    #[serde(
1789        default,
1790        deserialize_with = "present_optional",
1791        skip_serializing_if = "Option::is_none"
1792    )]
1793    pub format: Option<TextFormat>,
1794    #[serde(
1795        default,
1796        deserialize_with = "present_nullable",
1797        skip_serializing_if = "Option::is_none"
1798    )]
1799    pub verbosity: Option<Option<TextVerbosity>>,
1800    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1801    pub rest: Rest,
1802}
1803#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1804#[serde(tag = "type")]
1805#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1806#[derive(gproxy_protocol_macros::DeclaredFields)]
1807#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1808pub enum TextFormat {
1809    #[serde(rename = "text")]
1810    Text(TextFormatText),
1811    #[serde(rename = "json_schema")]
1812    JsonSchema(TextFormatJsonSchema),
1813    #[serde(rename = "json_object")]
1814    JsonObject(TextFormatJsonObject),
1815}
1816#[derive(
1817    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1818)]
1819#[serde(rename_all = "snake_case")]
1820#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1821#[derive(gproxy_protocol_macros::DeclaredFields)]
1822#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1823pub struct TextFormatText {
1824    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1825    pub rest: Rest,
1826}
1827#[derive(
1828    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1829)]
1830#[serde(rename_all = "snake_case")]
1831#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1832#[derive(gproxy_protocol_macros::DeclaredFields)]
1833#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1834pub struct TextFormatJsonSchema {
1835    pub name: String,
1836    // Get input token counts.md:4246: user-provided map[unknown] JSON Schema.
1837    pub schema: Rest,
1838    #[serde(
1839        default,
1840        deserialize_with = "present_optional",
1841        skip_serializing_if = "Option::is_none"
1842    )]
1843    pub description: Option<String>,
1844    #[serde(
1845        default,
1846        deserialize_with = "present_nullable",
1847        skip_serializing_if = "Option::is_none"
1848    )]
1849    pub strict: Option<Option<bool>>,
1850    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1851    pub rest: Rest,
1852}
1853#[derive(
1854    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1855)]
1856#[serde(rename_all = "snake_case")]
1857#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1858#[derive(gproxy_protocol_macros::DeclaredFields)]
1859#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1860pub struct TextFormatJsonObject {
1861    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1862    pub rest: Rest,
1863}
1864
1865#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1866#[serde(untagged)]
1867#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1868#[derive(gproxy_protocol_macros::DeclaredFields)]
1869#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1870pub enum ToolChoice {
1871    Mode(ToolChoiceMode),
1872    Allowed(ToolChoiceAllowed),
1873    Hosted(ToolChoiceHosted),
1874    Function(ToolChoiceFunction),
1875    Mcp(ToolChoiceMcp),
1876    Custom(ToolChoiceCustom),
1877    Programmatic(ToolChoiceProgrammatic),
1878    ApplyPatch(ToolChoiceApplyPatch),
1879    Shell(ToolChoiceShell),
1880}
1881
1882#[derive(
1883    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1884)]
1885#[serde(rename_all = "snake_case")]
1886#[derive(gproxy_protocol_macros::DeclaredFields)]
1887#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1888pub struct ToolChoiceHosted {
1889    #[serde(rename = "type")]
1890    pub type_: ToolChoiceHostedType,
1891    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1892    pub rest: Rest,
1893}
1894
1895#[derive(
1896    Debug,
1897    Clone,
1898    Copy,
1899    PartialEq,
1900    Eq,
1901    Serialize,
1902    Deserialize,
1903    gproxy_protocol_macros::DeclaredFields,
1904)]
1905#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1906pub enum ToolChoiceHostedType {
1907    #[serde(rename = "file_search")]
1908    FileSearch,
1909    #[serde(rename = "web_search_preview")]
1910    WebSearchPreview,
1911    #[serde(rename = "computer")]
1912    Computer,
1913    #[serde(rename = "computer_use_preview")]
1914    ComputerUsePreview,
1915    #[serde(rename = "computer_use")]
1916    ComputerUse,
1917    #[serde(rename = "code_interpreter")]
1918    CodeInterpreter,
1919    #[serde(rename = "image_generation")]
1920    ImageGeneration,
1921    #[serde(rename = "web_search_preview_2025_03_11")]
1922    WebSearchPreview20250311,
1923}
1924#[derive(
1925    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1926)]
1927#[serde(rename_all = "snake_case")]
1928#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1929#[derive(gproxy_protocol_macros::DeclaredFields)]
1930#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1931pub struct ToolChoiceAllowed {
1932    #[serde(rename = "type")]
1933    pub type_: ToolChoiceAllowedType,
1934    pub mode: AllowedToolChoiceMode,
1935    // Get input token counts.md:4334 declares array of map[unknown].
1936    pub tools: Vec<Rest>,
1937    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1938    pub rest: Rest,
1939}
1940
1941#[derive(
1942    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1943)]
1944#[serde(rename_all = "snake_case")]
1945#[derive(gproxy_protocol_macros::DeclaredFields)]
1946#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1947pub struct ToolChoiceFunction {
1948    #[serde(rename = "type")]
1949    pub type_: ToolChoiceFunctionType,
1950    pub name: String,
1951    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1952    pub rest: Rest,
1953}
1954#[derive(
1955    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1956)]
1957#[serde(rename_all = "snake_case")]
1958#[derive(gproxy_protocol_macros::DeclaredFields)]
1959#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1960pub struct ToolChoiceMcp {
1961    #[serde(rename = "type")]
1962    pub type_: ToolChoiceMcpType,
1963    pub server_label: String,
1964    #[serde(
1965        default,
1966        deserialize_with = "present_nullable",
1967        skip_serializing_if = "Option::is_none"
1968    )]
1969    pub name: Option<Option<String>>,
1970    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1971    pub rest: Rest,
1972}
1973#[derive(
1974    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1975)]
1976#[serde(rename_all = "snake_case")]
1977#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1978#[derive(gproxy_protocol_macros::DeclaredFields)]
1979#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1980pub struct ToolChoiceCustom {
1981    #[serde(rename = "type")]
1982    pub type_: ToolChoiceCustomType,
1983    pub name: String,
1984    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1985    pub rest: Rest,
1986}
1987
1988#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1989#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1990#[derive(gproxy_protocol_macros::DeclaredFields)]
1991#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1992pub enum ResponseInputTextType {
1993    #[serde(rename = "input_text")]
1994    ResponseInputText,
1995}
1996
1997#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1998#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1999#[derive(gproxy_protocol_macros::DeclaredFields)]
2000#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2001pub enum ResponseInputImageType {
2002    #[serde(rename = "input_image")]
2003    ResponseInputImage,
2004}
2005
2006#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2007#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2008#[derive(gproxy_protocol_macros::DeclaredFields)]
2009#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2010pub enum ResponseInputFileType {
2011    #[serde(rename = "input_file")]
2012    ResponseInputFile,
2013}
2014
2015#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2016#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2017#[derive(gproxy_protocol_macros::DeclaredFields)]
2018#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2019pub enum FunctionCallType {
2020    #[serde(rename = "function_call")]
2021    FunctionCall,
2022}
2023
2024#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2025#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2026#[derive(gproxy_protocol_macros::DeclaredFields)]
2027#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2028pub enum FunctionCallOutputType {
2029    #[serde(rename = "function_call_output")]
2030    FunctionCallOutput,
2031}
2032
2033#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2034#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2035#[derive(gproxy_protocol_macros::DeclaredFields)]
2036#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2037pub enum ReasoningItemType {
2038    #[serde(rename = "reasoning")]
2039    ReasoningItem,
2040}
2041
2042#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2043#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2044#[derive(gproxy_protocol_macros::DeclaredFields)]
2045#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2046pub enum ItemReferenceType {
2047    #[serde(rename = "item_reference")]
2048    ItemReference,
2049}
2050
2051#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2052#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2053#[derive(gproxy_protocol_macros::DeclaredFields)]
2054#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2055pub enum CompactionType {
2056    #[serde(rename = "compaction")]
2057    Compaction,
2058}
2059
2060#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2061#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2062#[derive(gproxy_protocol_macros::DeclaredFields)]
2063#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2064pub enum ComputerCallType {
2065    #[serde(rename = "computer_call")]
2066    ComputerCall,
2067}
2068
2069#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2070#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2071#[derive(gproxy_protocol_macros::DeclaredFields)]
2072#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2073pub enum ComputerCallOutputType {
2074    #[serde(rename = "computer_call_output")]
2075    ComputerCallOutput,
2076}
2077
2078#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2079#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2080#[derive(gproxy_protocol_macros::DeclaredFields)]
2081#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2082pub enum WebSearchCallType {
2083    #[serde(rename = "web_search_call")]
2084    WebSearchCall,
2085}
2086
2087#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2088#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2089#[derive(gproxy_protocol_macros::DeclaredFields)]
2090#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2091pub enum FileSearchCallType {
2092    #[serde(rename = "file_search_call")]
2093    FileSearchCall,
2094}
2095
2096#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2097#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2098#[derive(gproxy_protocol_macros::DeclaredFields)]
2099#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2100pub enum ImageGenerationCallType {
2101    #[serde(rename = "image_generation_call")]
2102    ImageGenerationCall,
2103}
2104
2105#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2106#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2107#[derive(gproxy_protocol_macros::DeclaredFields)]
2108#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2109pub enum CodeInterpreterCallType {
2110    #[serde(rename = "code_interpreter_call")]
2111    CodeInterpreterCall,
2112}
2113
2114#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2115#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2116#[derive(gproxy_protocol_macros::DeclaredFields)]
2117#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2118pub enum CustomToolCallType {
2119    #[serde(rename = "custom_tool_call")]
2120    CustomToolCall,
2121}
2122
2123#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2124#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2125#[derive(gproxy_protocol_macros::DeclaredFields)]
2126#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2127pub enum CustomToolCallOutputType {
2128    #[serde(rename = "custom_tool_call_output")]
2129    CustomToolCallOutput,
2130}
2131
2132#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2133#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2134#[derive(gproxy_protocol_macros::DeclaredFields)]
2135#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2136pub enum SummaryTextType {
2137    #[serde(rename = "summary_text")]
2138    SummaryText,
2139}
2140
2141#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2142#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2143#[derive(gproxy_protocol_macros::DeclaredFields)]
2144#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2145pub enum ResponseOutputTextType {
2146    #[serde(rename = "output_text")]
2147    ResponseOutputText,
2148}
2149
2150#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2151#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2152#[derive(gproxy_protocol_macros::DeclaredFields)]
2153#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2154pub enum ResponseOutputRefusalType {
2155    #[serde(rename = "refusal")]
2156    ResponseOutputRefusal,
2157}
2158
2159#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2160#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2161#[derive(gproxy_protocol_macros::DeclaredFields)]
2162#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2163pub enum ToolChoiceAllowedType {
2164    #[serde(rename = "allowed_tools")]
2165    ToolChoiceAllowed,
2166}
2167
2168#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2169#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2170#[derive(gproxy_protocol_macros::DeclaredFields)]
2171#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2172pub enum ToolChoiceFunctionType {
2173    #[serde(rename = "function")]
2174    ToolChoiceFunction,
2175}
2176
2177#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2178#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2179#[derive(gproxy_protocol_macros::DeclaredFields)]
2180#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2181pub enum ToolChoiceMcpType {
2182    #[serde(rename = "mcp")]
2183    ToolChoiceMcp,
2184}
2185
2186#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2187#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2188#[derive(gproxy_protocol_macros::DeclaredFields)]
2189#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2190pub enum ToolChoiceCustomType {
2191    #[serde(rename = "custom")]
2192    ToolChoiceCustom,
2193}
2194
2195macro_rules! item_tag {
2196    ($name:ident, $variant:ident, $wire:literal) => {
2197        #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2198        #[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2199        #[derive(gproxy_protocol_macros::DeclaredFields)]
2200        #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2201        pub enum $name {
2202            #[serde(rename = $wire)]
2203            $variant,
2204        }
2205    };
2206}
2207item_tag!(ToolSearchCallType, ToolSearchCall, "tool_search_call");
2208item_tag!(ToolSearchOutputType, ToolSearchOutput, "tool_search_output");
2209item_tag!(AdditionalToolsType, AdditionalTools, "additional_tools");
2210item_tag!(LocalShellCallType, LocalShellCall, "local_shell_call");
2211item_tag!(
2212    LocalShellCallOutputType,
2213    LocalShellCallOutput,
2214    "local_shell_call_output"
2215);
2216item_tag!(ShellCallType, ShellCall, "shell_call");
2217item_tag!(ShellCallOutputType, ShellCallOutput, "shell_call_output");
2218item_tag!(ApplyPatchCallType, ApplyPatchCall, "apply_patch_call");
2219item_tag!(
2220    ApplyPatchCallOutputType,
2221    ApplyPatchCallOutput,
2222    "apply_patch_call_output"
2223);
2224item_tag!(McpListToolsType, McpListTools, "mcp_list_tools");
2225item_tag!(
2226    McpApprovalRequestType,
2227    McpApprovalRequest,
2228    "mcp_approval_request"
2229);
2230item_tag!(
2231    McpApprovalResponseType,
2232    McpApprovalResponse,
2233    "mcp_approval_response"
2234);
2235item_tag!(McpCallType, McpCall, "mcp_call");
2236item_tag!(
2237    CompactionTriggerType,
2238    CompactionTrigger,
2239    "compaction_trigger"
2240);
2241item_tag!(ProgramType, Program, "program");
2242item_tag!(ProgramOutputType, ProgramOutput, "program_output");
2243item_tag!(LocalShellActionType, Exec, "exec");
2244#[derive(
2245    Debug,
2246    Clone,
2247    Copy,
2248    PartialEq,
2249    Eq,
2250    Serialize,
2251    Deserialize,
2252    gproxy_protocol_macros::DeclaredFields,
2253)]
2254#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2255pub enum ProgramOutputStatus {
2256    #[serde(rename = "completed")]
2257    Completed,
2258    #[serde(rename = "incomplete")]
2259    Incomplete,
2260}
2261#[derive(
2262    Debug,
2263    Clone,
2264    Copy,
2265    PartialEq,
2266    Eq,
2267    Serialize,
2268    Deserialize,
2269    gproxy_protocol_macros::DeclaredFields,
2270)]
2271#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2272pub enum ItemStatus {
2273    #[serde(rename = "in_progress")]
2274    InProgress,
2275    #[serde(rename = "completed")]
2276    Completed,
2277    #[serde(rename = "incomplete")]
2278    Incomplete,
2279}
2280
2281#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2282#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2283#[derive(gproxy_protocol_macros::DeclaredFields)]
2284#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2285pub enum MessageType {
2286    #[serde(rename = "message")]
2287    Message,
2288}
2289
2290#[derive(
2291    Debug,
2292    Clone,
2293    Copy,
2294    PartialEq,
2295    Eq,
2296    Serialize,
2297    Deserialize,
2298    gproxy_protocol_macros::DeclaredFields,
2299)]
2300#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2301pub enum MessagePhase {
2302    #[serde(rename = "commentary")]
2303    Commentary,
2304    #[serde(rename = "final_answer")]
2305    FinalAnswer,
2306}
2307
2308#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2309#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2310#[derive(gproxy_protocol_macros::DeclaredFields)]
2311#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2312pub enum MessageRole {
2313    #[serde(rename = "user")]
2314    User,
2315    #[serde(rename = "system")]
2316    System,
2317    #[serde(rename = "developer")]
2318    Developer,
2319    #[serde(rename = "assistant")]
2320    Assistant,
2321}
2322
2323#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2324#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2325#[derive(gproxy_protocol_macros::DeclaredFields)]
2326#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2327pub enum InputMessageRole {
2328    #[serde(rename = "user")]
2329    User,
2330    #[serde(rename = "system")]
2331    System,
2332    #[serde(rename = "developer")]
2333    Developer,
2334}
2335#[derive(
2336    Debug,
2337    Clone,
2338    Copy,
2339    PartialEq,
2340    Eq,
2341    Serialize,
2342    Deserialize,
2343    gproxy_protocol_macros::DeclaredFields,
2344)]
2345#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2346pub enum AdditionalToolsRole {
2347    #[serde(rename = "developer")]
2348    Developer,
2349}
2350
2351#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2352#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2353#[derive(gproxy_protocol_macros::DeclaredFields)]
2354#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2355pub enum ToolChoiceMode {
2356    #[serde(rename = "none")]
2357    None,
2358    #[serde(rename = "auto")]
2359    Auto,
2360    #[serde(rename = "required")]
2361    Required,
2362}
2363
2364#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2365#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2366#[derive(gproxy_protocol_macros::DeclaredFields)]
2367#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2368pub enum AllowedToolChoiceMode {
2369    #[serde(rename = "auto")]
2370    Auto,
2371    #[serde(rename = "required")]
2372    Required,
2373}
2374
2375#[derive(
2376    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2377)]
2378#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2379#[derive(gproxy_protocol_macros::DeclaredFields)]
2380#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2381pub struct ToolChoiceProgrammatic {
2382    #[serde(rename = "type")]
2383    pub type_: ToolChoiceProgrammaticType,
2384    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2385    pub rest: Rest,
2386}
2387
2388#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2389#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2390#[derive(gproxy_protocol_macros::DeclaredFields)]
2391#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2392pub enum ToolChoiceProgrammaticType {
2393    #[serde(rename = "programmatic_tool_calling")]
2394    Tag,
2395}
2396
2397#[derive(
2398    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2399)]
2400#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2401#[derive(gproxy_protocol_macros::DeclaredFields)]
2402#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2403pub struct ToolChoiceApplyPatch {
2404    #[serde(rename = "type")]
2405    pub type_: ToolChoiceApplyPatchType,
2406    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2407    pub rest: Rest,
2408}
2409
2410#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2411#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2412#[derive(gproxy_protocol_macros::DeclaredFields)]
2413#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2414pub enum ToolChoiceApplyPatchType {
2415    #[serde(rename = "apply_patch")]
2416    Tag,
2417}
2418
2419#[derive(
2420    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2421)]
2422#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2423#[derive(gproxy_protocol_macros::DeclaredFields)]
2424#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2425pub struct ToolChoiceShell {
2426    #[serde(rename = "type")]
2427    pub type_: ToolChoiceShellType,
2428    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2429    pub rest: Rest,
2430}
2431
2432#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2433#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2434#[derive(gproxy_protocol_macros::DeclaredFields)]
2435#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2436pub enum ToolChoiceShellType {
2437    #[serde(rename = "shell")]
2438    Tag,
2439}
2440
2441// Get input token counts.md:1019-1037 differs from ordinary input text:
2442// the function-output cache breakpoint explicitly permits null.
2443#[derive(
2444    Debug,
2445    Clone,
2446    PartialEq,
2447    Eq,
2448    Serialize,
2449    Deserialize,
2450    gproxy_protocol_macros::WireBuilder,
2451    gproxy_protocol_macros::DeclaredFields,
2452)]
2453#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2454pub struct FunctionOutputText {
2455    #[serde(rename = "type")]
2456    pub type_: ResponseInputTextType,
2457    pub text: String,
2458    #[serde(
2459        default,
2460        deserialize_with = "present_nullable",
2461        skip_serializing_if = "Option::is_none"
2462    )]
2463    pub prompt_cache_breakpoint: Option<Option<PromptCacheBreakpoint>>,
2464    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2465    pub rest: Rest,
2466}
2467// D:3896-3917 uses ordinary input content rather than the function-output variants.
2468#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2469#[serde(untagged)]
2470#[derive(gproxy_protocol_macros::DeclaredFields)]
2471#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2472pub enum CustomOutput {
2473    Text(String),
2474    Content(Vec<InputContent>),
2475}
2476// D:3469-3475: input shell calls accept local/reference, never container_auto.
2477#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2478#[serde(untagged)]
2479#[derive(gproxy_protocol_macros::DeclaredFields)]
2480#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2481pub enum ShellCallEnvironment {
2482    Local(ShellLocalEnvironment),
2483    Reference(ShellContainerReference),
2484}
2485// D:466-478: file attributes are scalar values, not arbitrary JSON.
2486#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2487#[serde(untagged)]
2488#[derive(gproxy_protocol_macros::DeclaredFields)]
2489#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2490pub enum FileAttributeValue {
2491    Text(String),
2492    Number(serde_json::Number),
2493    Boolean(bool),
2494}
2495
2496#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2497#[serde(rename_all = "snake_case")]
2498#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2499#[derive(gproxy_protocol_macros::DeclaredFields)]
2500#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2501pub enum ImageDetail {
2502    Low,
2503    High,
2504    Auto,
2505    Original,
2506}
2507
2508#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2509#[serde(rename_all = "snake_case")]
2510#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2511#[derive(gproxy_protocol_macros::DeclaredFields)]
2512#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2513pub enum FileDetail {
2514    Auto,
2515    Low,
2516    High,
2517}
2518
2519#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2520#[serde(rename_all = "snake_case")]
2521#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2522#[derive(gproxy_protocol_macros::DeclaredFields)]
2523#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2524pub enum PromptCacheMode {
2525    Explicit,
2526}
2527
2528#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2529#[serde(rename_all = "snake_case")]
2530#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2531#[derive(gproxy_protocol_macros::DeclaredFields)]
2532#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2533pub enum WebSearchStatus {
2534    InProgress,
2535    Searching,
2536    Completed,
2537    Failed,
2538}
2539
2540#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2541#[serde(rename_all = "snake_case")]
2542#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2543#[derive(gproxy_protocol_macros::DeclaredFields)]
2544#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2545pub enum FileSearchStatus {
2546    InProgress,
2547    Searching,
2548    Completed,
2549    Incomplete,
2550    Failed,
2551}
2552
2553#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2554#[serde(rename_all = "snake_case")]
2555#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2556#[derive(gproxy_protocol_macros::DeclaredFields)]
2557#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2558pub enum ImageGenerationStatus {
2559    InProgress,
2560    Completed,
2561    Generating,
2562    Failed,
2563}
2564
2565#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2566#[serde(rename_all = "snake_case")]
2567#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2568#[derive(gproxy_protocol_macros::DeclaredFields)]
2569#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2570pub enum CodeInterpreterStatus {
2571    InProgress,
2572    Completed,
2573    Incomplete,
2574    Interpreting,
2575    Failed,
2576}
2577
2578#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2579#[serde(rename_all = "snake_case")]
2580#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2581#[derive(gproxy_protocol_macros::DeclaredFields)]
2582#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2583pub enum ApplyPatchStatus {
2584    InProgress,
2585    Completed,
2586}
2587
2588#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2589#[serde(rename_all = "snake_case")]
2590#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2591#[derive(gproxy_protocol_macros::DeclaredFields)]
2592#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2593pub enum ApplyPatchOutputStatus {
2594    Completed,
2595    Failed,
2596}
2597
2598#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2599#[serde(rename_all = "snake_case")]
2600#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2601#[derive(gproxy_protocol_macros::DeclaredFields)]
2602#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2603pub enum McpCallStatus {
2604    InProgress,
2605    Completed,
2606    Incomplete,
2607    Calling,
2608    Failed,
2609}
2610
2611#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2612#[serde(rename_all = "snake_case")]
2613#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2614#[derive(gproxy_protocol_macros::DeclaredFields)]
2615#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2616pub enum ReasoningEffort {
2617    None,
2618    Minimal,
2619    Low,
2620    Medium,
2621    High,
2622    Xhigh,
2623    Max,
2624    /// Codex custom effort is serialized as an unsigned JSON integer.
2625    #[serde(untagged)]
2626    Numeric(u64),
2627}
2628
2629#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2630#[serde(rename_all = "snake_case")]
2631#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2632#[derive(gproxy_protocol_macros::DeclaredFields)]
2633#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2634pub enum ReasoningSummary {
2635    Auto,
2636    Concise,
2637    Detailed,
2638}
2639
2640#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2641#[serde(rename_all = "snake_case")]
2642#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2643#[derive(gproxy_protocol_macros::DeclaredFields)]
2644#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2645pub enum ReasoningContext {
2646    Auto,
2647    CurrentTurn,
2648    AllTurns,
2649}
2650
2651#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2652#[serde(rename_all = "snake_case")]
2653#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2654#[derive(gproxy_protocol_macros::DeclaredFields)]
2655#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2656pub enum TextVerbosity {
2657    Low,
2658    Medium,
2659    High,
2660}
2661
2662#[derive(
2663    Debug,
2664    Clone,
2665    Copy,
2666    PartialEq,
2667    Eq,
2668    Serialize,
2669    Deserialize,
2670    gproxy_protocol_macros::DeclaredFields,
2671)]
2672#[serde(rename_all = "snake_case")]
2673#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2674#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2675pub enum ConfigurationUpdateType {
2676    ConfigurationUpdate,
2677}
2678
2679#[derive(
2680    Debug,
2681    Clone,
2682    PartialEq,
2683    Eq,
2684    Serialize,
2685    Deserialize,
2686    gproxy_protocol_macros::WireBuilder,
2687    gproxy_protocol_macros::DeclaredFields,
2688)]
2689#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2690#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2691pub struct ConfigurationUpdate {
2692    #[serde(
2693        default,
2694        deserialize_with = "present_nullable",
2695        skip_serializing_if = "Option::is_none"
2696    )]
2697    pub agent: Option<Option<super::multi_agent::Agent>>,
2698    #[serde(rename = "type")]
2699    pub type_: ConfigurationUpdateType,
2700    #[serde(
2701        default,
2702        deserialize_with = "present_nullable",
2703        skip_serializing_if = "Option::is_none"
2704    )]
2705    pub id: Option<Option<String>>,
2706    #[serde(skip_serializing_if = "Option::is_none")]
2707    pub reasoning: Option<ConfigurationReasoning>,
2708    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2709    pub rest: Rest,
2710}
2711
2712#[derive(
2713    Debug,
2714    Clone,
2715    PartialEq,
2716    Eq,
2717    Serialize,
2718    Deserialize,
2719    gproxy_protocol_macros::WireBuilder,
2720    gproxy_protocol_macros::DeclaredFields,
2721)]
2722#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2723#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2724pub struct ConfigurationReasoning {
2725    #[serde(
2726        default,
2727        deserialize_with = "present_nullable",
2728        skip_serializing_if = "Option::is_none"
2729    )]
2730    pub effort: Option<Option<ReasoningEffort>>,
2731    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2732    pub rest: Rest,
2733}
2734
2735impl InputItem {
2736    pub fn agent(&self) -> Option<&super::multi_agent::Agent> {
2737        match self {
2738            Self::ConfigurationUpdate(v) => v.agent.as_ref().and_then(Option::as_ref),
2739            Self::OutputMessage(v) => v.agent.as_ref().and_then(Option::as_ref),
2740            Self::Message(v) => v.agent.as_ref().and_then(Option::as_ref),
2741            Self::Easy(v) => v.agent.as_ref().and_then(Option::as_ref),
2742            Self::FunctionCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2743            Self::FunctionCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2744            Self::Reasoning(v) => v.agent.as_ref().and_then(Option::as_ref),
2745            Self::ItemReference(v) => v.agent.as_ref().and_then(Option::as_ref),
2746            Self::Compaction(v) => v.agent.as_ref().and_then(Option::as_ref),
2747            Self::ComputerCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2748            Self::ComputerCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2749            Self::WebSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2750            Self::FileSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2751            Self::ImageGenerationCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2752            Self::CodeInterpreterCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2753            Self::CustomToolCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2754            Self::CustomToolCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2755            Self::ToolSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2756            Self::ToolSearchOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2757            Self::AdditionalTools(v) => v.agent.as_ref().and_then(Option::as_ref),
2758            Self::LocalShellCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2759            Self::LocalShellCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2760            Self::ShellCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2761            Self::ShellCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2762            Self::ApplyPatchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2763            Self::ApplyPatchCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2764            Self::McpListTools(v) => v.agent.as_ref().and_then(Option::as_ref),
2765            Self::McpApprovalRequest(v) => v.agent.as_ref().and_then(Option::as_ref),
2766            Self::McpApprovalResponse(v) => v.agent.as_ref().and_then(Option::as_ref),
2767            Self::McpCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2768            Self::CompactionTrigger(v) => v.agent.as_ref().and_then(Option::as_ref),
2769            Self::Program(v) => v.agent.as_ref().and_then(Option::as_ref),
2770            Self::ProgramOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2771            Self::MultiAgentCall(v) => v.agent.as_ref().and_then(Option::as_ref),
2772            Self::MultiAgentCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
2773            Self::AgentMessage(v) => v.agent.as_ref().and_then(Option::as_ref),
2774        }
2775    }
2776}