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