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