Skip to main content

async_openai/types/responses/
websocket.rs

1use super::stream::{
2    ResponseAudioDeltaEvent, ResponseAudioDoneEvent, ResponseAudioTranscriptDeltaEvent,
3    ResponseAudioTranscriptDoneEvent, ResponseCodeInterpreterCallCodeDeltaEvent,
4    ResponseCodeInterpreterCallCodeDoneEvent, ResponseCodeInterpreterCallCompletedEvent,
5    ResponseCodeInterpreterCallInProgressEvent, ResponseCodeInterpreterCallInterpretingEvent,
6    ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseContentPartDoneEvent,
7    ResponseCreatedEvent, ResponseCustomToolCallInputDeltaEvent,
8    ResponseCustomToolCallInputDoneEvent, ResponseFailedEvent,
9    ResponseFileSearchCallCompletedEvent, ResponseFileSearchCallInProgressEvent,
10    ResponseFileSearchCallSearchingEvent, ResponseFunctionCallArgumentsDeltaEvent,
11    ResponseFunctionCallArgumentsDoneEvent, ResponseImageGenCallCompletedEvent,
12    ResponseImageGenCallGeneratingEvent, ResponseImageGenCallInProgressEvent,
13    ResponseImageGenCallPartialImageEvent, ResponseInProgressEvent, ResponseIncompleteEvent,
14    ResponseMCPCallArgumentsDeltaEvent, ResponseMCPCallArgumentsDoneEvent,
15    ResponseMCPCallCompletedEvent, ResponseMCPCallFailedEvent, ResponseMCPCallInProgressEvent,
16    ResponseMCPListToolsCompletedEvent, ResponseMCPListToolsFailedEvent,
17    ResponseMCPListToolsInProgressEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent,
18    ResponseOutputTextAnnotationAddedEvent, ResponseQueuedEvent,
19    ResponseReasoningSummaryPartAddedEvent, ResponseReasoningSummaryPartDoneEvent,
20    ResponseReasoningSummaryTextDeltaEvent, ResponseReasoningSummaryTextDoneEvent,
21    ResponseReasoningTextDeltaEvent, ResponseReasoningTextDoneEvent, ResponseRefusalDeltaEvent,
22    ResponseRefusalDoneEvent, ResponseShellCallCommandAddedStreamingEvent,
23    ResponseShellCallCommandDeltaStreamingEvent, ResponseShellCallCommandDoneStreamingEvent,
24    ResponseShellCallOutputContentDeltaStreamingEvent,
25    ResponseShellCallOutputContentDoneStreamingEvent, ResponseTextDeltaEvent,
26    ResponseTextDoneEvent, ResponseWebSearchCallCompletedEvent,
27    ResponseWebSearchCallInProgressEvent, ResponseWebSearchCallSearchingEvent,
28};
29use super::{CreateResponse, FunctionCallOutputItemParam, MisalignmentErrorDetailsResource};
30use serde::{Deserialize, Serialize};
31
32/// A Responses WebSocket client event.
33#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
34#[serde(tag = "type")]
35pub enum ResponsesClientEvent {
36    #[serde(rename = "response.create")]
37    Create(Box<ResponsesClientEventResponseCreate>),
38    #[serde(rename = "response.steer")]
39    Steer(ResponseSteerEvent),
40}
41
42/// Client event for creating a response over a persistent WebSocket connection.
43///
44/// This payload uses the same top-level fields as `POST /v1/responses`, plus WebSocket-only envelope metadata.
45/// Notes:
46/// - `stream` is implicit over WebSocket and should not be sent.
47/// - `background` is not supported over WebSocket.
48/// - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
49#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
50pub struct ResponsesClientEventResponseCreate {
51    /// The WebSocket lane for this response. Requests with the same
52    /// `stream_id` are processed FIFO, and events for the response echo the
53    /// same `stream_id`.
54    ///
55    /// `stream_id` controls routing; `previous_response_id` controls conversation lineage,
56    ///  so a new lane can fork from a response created on another lane.
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub stream_id: Option<String>,
59    #[serde(flatten)]
60    pub response: CreateResponse,
61}
62
63/// Server events received on a Responses WebSocket connection.
64#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
65#[serde(tag = "type")]
66pub enum ResponsesServerEvent {
67    /// Emitted when there is a partial audio response.
68    #[serde(rename = "response.audio.delta")]
69    ResponseAudioDelta(ResponseAudioWsDelta),
70    /// Emitted when the audio response is complete.
71    #[serde(rename = "response.audio.done")]
72    ResponseAudioDone(ResponseAudioWsDone),
73    /// Emitted when there is a partial transcript of audio.
74    #[serde(rename = "response.audio.transcript.delta")]
75    ResponseAudioTranscriptDelta(ResponseAudioTranscriptWsDelta),
76    /// Emitted when the full audio transcript is completed.
77    #[serde(rename = "response.audio.transcript.done")]
78    ResponseAudioTranscriptDone(ResponseAudioTranscriptWsDone),
79    /// Emitted when a partial code snippet is streamed by the code interpreter.
80    #[serde(rename = "response.code_interpreter_call_code.delta")]
81    ResponseCodeInterpreterCallCodeDelta(ResponseCodeInterpreterCallCodeWsDelta),
82    /// Emitted when the code snippet is finalized by the code interpreter.
83    #[serde(rename = "response.code_interpreter_call_code.done")]
84    ResponseCodeInterpreterCallCodeDone(ResponseCodeInterpreterCallCodeWsDone),
85    /// Emitted when the code interpreter call is completed.
86    #[serde(rename = "response.code_interpreter_call.completed")]
87    ResponseCodeInterpreterCallCompleted(ResponseCodeInterpreterCallWsCompleted),
88    /// Emitted when a code interpreter call is in progress.
89    #[serde(rename = "response.code_interpreter_call.in_progress")]
90    ResponseCodeInterpreterCallInProgress(ResponseCodeInterpreterCallInWsProgress),
91    /// Emitted when the code interpreter is actively interpreting the code snippet.
92    #[serde(rename = "response.code_interpreter_call.interpreting")]
93    ResponseCodeInterpreterCallInterpreting(ResponseCodeInterpreterCallWsInterpreting),
94    /// Emitted when the model response is complete.
95    #[serde(rename = "response.completed")]
96    ResponseCompleted(ResponseWsCompleted),
97    /// Emitted when a new content part is added.
98    #[serde(rename = "response.content_part.added")]
99    ResponseContentPartAdded(ResponseContentPartWsAdded),
100    /// Emitted when a content part is done.
101    #[serde(rename = "response.content_part.done")]
102    ResponseContentPartDone(ResponseContentPartWsDone),
103    /// An event that is emitted when a response is created.
104    #[serde(rename = "response.created")]
105    ResponseCreated(ResponseWsCreated),
106    /// Emitted when a file search call is completed (results found).
107    #[serde(rename = "response.file_search_call.completed")]
108    ResponseFileSearchCallCompleted(ResponseFileSearchCallWsCompleted),
109    /// Emitted when a file search call is initiated.
110    #[serde(rename = "response.file_search_call.in_progress")]
111    ResponseFileSearchCallInProgress(ResponseFileSearchCallInWsProgress),
112    /// Emitted when a file search is currently searching.
113    #[serde(rename = "response.file_search_call.searching")]
114    ResponseFileSearchCallSearching(ResponseFileSearchCallWsSearching),
115    /// Emitted when there is a partial function-call arguments delta.
116    #[serde(rename = "response.function_call_arguments.delta")]
117    ResponseFunctionCallArgumentsDelta(ResponseFunctionCallArgumentsWsDelta),
118    /// Emitted when function-call arguments are finalized.
119    #[serde(rename = "response.function_call_arguments.done")]
120    ResponseFunctionCallArgumentsDone(ResponseFunctionCallArgumentsWsDone),
121    /// A streaming event that indicated a shell command was added to a tool call.
122    #[serde(rename = "response.shell_call_command.added")]
123    ResponseShellCallCommandAdded(ResponseShellCallCommandWsAdded),
124    /// A streaming event that indicated a shell command was incrementally updated.
125    #[serde(rename = "response.shell_call_command.delta")]
126    ResponseShellCallCommandDelta(ResponseShellCallCommandWsDelta),
127    /// A streaming event that indicated a shell command was completed.
128    #[serde(rename = "response.shell_call_command.done")]
129    ResponseShellCallCommandDone(ResponseShellCallCommandWsDone),
130    /// A streaming event that indicated shell call output was incrementally added.
131    #[serde(rename = "response.shell_call_output_content.delta")]
132    ResponseShellCallOutputContentDelta(ResponseShellCallOutputContentWsDelta),
133    /// A streaming event that indicated shell call output was completed.
134    #[serde(rename = "response.shell_call_output_content.done")]
135    ResponseShellCallOutputContentDone(ResponseShellCallOutputContentWsDone),
136    /// Emitted when the response is in progress.
137    #[serde(rename = "response.in_progress")]
138    ResponseInProgress(ResponseInWsProgress),
139    /// An event that is emitted when a response fails.
140    #[serde(rename = "response.failed")]
141    ResponseFailed(ResponseWsFailed),
142    /// An event that is emitted when a response finishes as incomplete.
143    ///
144    /// Over WebSocket, steering can finish a response with `response.incomplete_details.reason` set to
145    /// `steered`, followed automatically by a successor `response.created` that commits the queued
146    /// steering input.
147    #[serde(rename = "response.incomplete")]
148    ResponseIncomplete(ResponseWsIncomplete),
149    /// Emitted when a new output item is added.
150    #[serde(rename = "response.output_item.added")]
151    ResponseOutputItemAdded(ResponseOutputItemWsAdded),
152    /// Emitted when an output item is marked done.
153    #[serde(rename = "response.output_item.done")]
154    ResponseOutputItemDone(ResponseOutputItemWsDone),
155    /// Emitted when a new reasoning summary part is added.
156    #[serde(rename = "response.reasoning_summary_part.added")]
157    ResponseReasoningSummaryPartAdded(ResponseReasoningSummaryPartWsAdded),
158    /// Emitted when a reasoning summary part is completed.
159    #[serde(rename = "response.reasoning_summary_part.done")]
160    ResponseReasoningSummaryPartDone(ResponseReasoningSummaryPartWsDone),
161    /// Emitted when a delta is added to a reasoning summary text.
162    #[serde(rename = "response.reasoning_summary_text.delta")]
163    ResponseReasoningSummaryTextDelta(ResponseReasoningSummaryTextWsDelta),
164    /// Emitted when a reasoning summary text is completed.
165    #[serde(rename = "response.reasoning_summary_text.done")]
166    ResponseReasoningSummaryTextDone(ResponseReasoningSummaryTextWsDone),
167    /// Emitted when a delta is added to a reasoning text.
168    #[serde(rename = "response.reasoning_text.delta")]
169    ResponseReasoningTextDelta(ResponseReasoningTextWsDelta),
170    /// Emitted when a reasoning text is completed.
171    #[serde(rename = "response.reasoning_text.done")]
172    ResponseReasoningTextDone(ResponseReasoningTextWsDone),
173    /// Emitted when there is a partial refusal text.
174    #[serde(rename = "response.refusal.delta")]
175    ResponseRefusalDelta(ResponseRefusalWsDelta),
176    /// Emitted when refusal text is finalized.
177    #[serde(rename = "response.refusal.done")]
178    ResponseRefusalDone(ResponseRefusalWsDone),
179    /// Emitted when there is an additional text delta.
180    #[serde(rename = "response.output_text.delta")]
181    ResponseOutputTextDelta(ResponseTextWsDelta),
182    /// Emitted when text content is finalized.
183    #[serde(rename = "response.output_text.done")]
184    ResponseOutputTextDone(ResponseTextWsDone),
185    /// Emitted when a web search call is completed.
186    #[serde(rename = "response.web_search_call.completed")]
187    ResponseWebSearchCallCompleted(ResponseWebSearchCallWsCompleted),
188    /// Emitted when a web search call is initiated.
189    #[serde(rename = "response.web_search_call.in_progress")]
190    ResponseWebSearchCallInProgress(ResponseWebSearchCallInWsProgress),
191    /// Emitted when a web search call is executing.
192    #[serde(rename = "response.web_search_call.searching")]
193    ResponseWebSearchCallSearching(ResponseWebSearchCallWsSearching),
194    /// Emitted when an image generation tool call has completed and the final image is available.
195    #[serde(rename = "response.image_generation_call.completed")]
196    ResponseImageGenerationCallCompleted(ResponseImageGenCallWsCompleted),
197    /// Emitted when an image generation tool call is actively generating an image (intermediate
198    /// state).
199    #[serde(rename = "response.image_generation_call.generating")]
200    ResponseImageGenerationCallGenerating(ResponseImageGenCallWsGenerating),
201    /// Emitted when an image generation tool call is in progress.
202    #[serde(rename = "response.image_generation_call.in_progress")]
203    ResponseImageGenerationCallInProgress(ResponseImageGenCallInWsProgress),
204    /// Emitted when a partial image is available during image generation streaming.
205    #[serde(rename = "response.image_generation_call.partial_image")]
206    ResponseImageGenerationCallPartialImage(ResponseImageGenCallPartialWsImage),
207    /// Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
208    #[serde(rename = "response.mcp_call_arguments.delta")]
209    ResponseMCPCallArgumentsDelta(ResponseMcpCallArgumentsWsDelta),
210    /// Emitted when the arguments for an MCP tool call are finalized.
211    #[serde(rename = "response.mcp_call_arguments.done")]
212    ResponseMCPCallArgumentsDone(ResponseMcpCallArgumentsWsDone),
213    /// Emitted when an MCP tool call has completed successfully.
214    #[serde(rename = "response.mcp_call.completed")]
215    ResponseMCPCallCompleted(ResponseMcpCallWsCompleted),
216    /// Emitted when an MCP tool call has failed.
217    #[serde(rename = "response.mcp_call.failed")]
218    ResponseMCPCallFailed(ResponseMcpCallWsFailed),
219    /// Emitted when an MCP tool call is in progress.
220    #[serde(rename = "response.mcp_call.in_progress")]
221    ResponseMCPCallInProgress(ResponseMcpCallInWsProgress),
222    /// Emitted when the list of available MCP tools has been successfully retrieved.
223    #[serde(rename = "response.mcp_list_tools.completed")]
224    ResponseMCPListToolsCompleted(ResponseMcpListToolsWsCompleted),
225    /// Emitted when the attempt to list available MCP tools has failed.
226    #[serde(rename = "response.mcp_list_tools.failed")]
227    ResponseMCPListToolsFailed(ResponseMcpListToolsWsFailed),
228    /// Emitted when the system is in the process of retrieving the list of available MCP tools.
229    #[serde(rename = "response.mcp_list_tools.in_progress")]
230    ResponseMCPListToolsInProgress(ResponseMcpListToolsInWsProgress),
231    /// Emitted when an annotation is added to output text content.
232    #[serde(rename = "response.output_text.annotation.added")]
233    ResponseOutputTextAnnotationAdded(ResponseOutputTextAnnotationWsAdded),
234    /// Emitted when a response is queued and waiting to be processed.
235    #[serde(rename = "response.queued")]
236    ResponseQueued(ResponseWsQueued),
237    /// Event representing a delta (partial update) to the input of a custom tool call.
238    #[serde(rename = "response.custom_tool_call_input.delta")]
239    ResponseCustomToolCallInputDelta(ResponseCustomToolCallInputWsDelta),
240    /// Event indicating that input for a custom tool call is complete.
241    #[serde(rename = "response.custom_tool_call_input.done")]
242    ResponseCustomToolCallInputDone(ResponseCustomToolCallInputWsDone),
243    #[serde(rename = "error")]
244    Error(ResponseWsError),
245    #[serde(rename = "response.steer.accepted")]
246    SteerAccepted(ResponseSteerAcceptedEvent),
247    #[serde(rename = "response.steer.pending")]
248    SteerPending(ResponseSteerPendingEvent),
249    #[serde(rename = "response.steer.failed")]
250    SteerFailed(ResponseSteerFailedEvent),
251}
252
253/// Emitted when there is a partial audio response.
254#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
255pub struct ResponseAudioWsDelta {
256    #[serde(flatten)]
257    pub event: ResponseAudioDeltaEvent,
258    /// The WebSocket lane that emitted this event. This field is present when the originating
259    /// `response.create` event supplied a `stream_id`.
260    #[serde(skip_serializing_if = "Option::is_none")]
261    pub stream_id: Option<String>,
262}
263
264/// Emitted when the audio response is complete.
265#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
266pub struct ResponseAudioWsDone {
267    #[serde(flatten)]
268    pub event: ResponseAudioDoneEvent,
269    /// The WebSocket lane that emitted this event. This field is present when the originating
270    /// `response.create` event supplied a `stream_id`.
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub stream_id: Option<String>,
273}
274
275/// Emitted when there is a partial transcript of audio.
276#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
277pub struct ResponseAudioTranscriptWsDelta {
278    #[serde(flatten)]
279    pub event: ResponseAudioTranscriptDeltaEvent,
280    /// The WebSocket lane that emitted this event. This field is present when the originating
281    /// `response.create` event supplied a `stream_id`.
282    #[serde(skip_serializing_if = "Option::is_none")]
283    pub stream_id: Option<String>,
284}
285
286/// Emitted when the full audio transcript is completed.
287#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
288pub struct ResponseAudioTranscriptWsDone {
289    #[serde(flatten)]
290    pub event: ResponseAudioTranscriptDoneEvent,
291    /// The WebSocket lane that emitted this event. This field is present when the originating
292    /// `response.create` event supplied a `stream_id`.
293    #[serde(skip_serializing_if = "Option::is_none")]
294    pub stream_id: Option<String>,
295}
296
297/// Emitted when a partial code snippet is streamed by the code interpreter.
298#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
299pub struct ResponseCodeInterpreterCallCodeWsDelta {
300    #[serde(flatten)]
301    pub event: ResponseCodeInterpreterCallCodeDeltaEvent,
302    /// The WebSocket lane that emitted this event. This field is present when the originating
303    /// `response.create` event supplied a `stream_id`.
304    #[serde(skip_serializing_if = "Option::is_none")]
305    pub stream_id: Option<String>,
306}
307
308/// Emitted when the code snippet is finalized by the code interpreter.
309#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
310pub struct ResponseCodeInterpreterCallCodeWsDone {
311    #[serde(flatten)]
312    pub event: ResponseCodeInterpreterCallCodeDoneEvent,
313    /// The WebSocket lane that emitted this event. This field is present when the originating
314    /// `response.create` event supplied a `stream_id`.
315    #[serde(skip_serializing_if = "Option::is_none")]
316    pub stream_id: Option<String>,
317}
318
319/// Emitted when the code interpreter call is completed.
320#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
321pub struct ResponseCodeInterpreterCallWsCompleted {
322    #[serde(flatten)]
323    pub event: ResponseCodeInterpreterCallCompletedEvent,
324    /// The WebSocket lane that emitted this event. This field is present when the originating
325    /// `response.create` event supplied a `stream_id`.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub stream_id: Option<String>,
328}
329
330/// Emitted when a code interpreter call is in progress.
331#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
332pub struct ResponseCodeInterpreterCallInWsProgress {
333    #[serde(flatten)]
334    pub event: ResponseCodeInterpreterCallInProgressEvent,
335    /// The WebSocket lane that emitted this event. This field is present when the originating
336    /// `response.create` event supplied a `stream_id`.
337    #[serde(skip_serializing_if = "Option::is_none")]
338    pub stream_id: Option<String>,
339}
340
341/// Emitted when the code interpreter is actively interpreting the code snippet.
342#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
343pub struct ResponseCodeInterpreterCallWsInterpreting {
344    #[serde(flatten)]
345    pub event: ResponseCodeInterpreterCallInterpretingEvent,
346    /// The WebSocket lane that emitted this event. This field is present when the originating
347    /// `response.create` event supplied a `stream_id`.
348    #[serde(skip_serializing_if = "Option::is_none")]
349    pub stream_id: Option<String>,
350}
351
352/// Emitted when the model response is complete.
353#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
354pub struct ResponseWsCompleted {
355    #[serde(flatten)]
356    pub event: ResponseCompletedEvent,
357    /// The WebSocket lane that emitted this event. This field is present when the originating
358    /// `response.create` event supplied a `stream_id`.
359    #[serde(skip_serializing_if = "Option::is_none")]
360    pub stream_id: Option<String>,
361}
362
363/// Emitted when a new content part is added.
364#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
365pub struct ResponseContentPartWsAdded {
366    #[serde(flatten)]
367    pub event: ResponseContentPartAddedEvent,
368    /// The WebSocket lane that emitted this event. This field is present when the originating
369    /// `response.create` event supplied a `stream_id`.
370    #[serde(skip_serializing_if = "Option::is_none")]
371    pub stream_id: Option<String>,
372}
373
374/// Emitted when a content part is done.
375#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
376pub struct ResponseContentPartWsDone {
377    #[serde(flatten)]
378    pub event: ResponseContentPartDoneEvent,
379    /// The WebSocket lane that emitted this event. This field is present when the originating
380    /// `response.create` event supplied a `stream_id`.
381    #[serde(skip_serializing_if = "Option::is_none")]
382    pub stream_id: Option<String>,
383}
384
385/// An event that is emitted when a response is created.
386#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
387pub struct ResponseWsCreated {
388    #[serde(flatten)]
389    pub event: ResponseCreatedEvent,
390    /// The WebSocket lane that emitted this event. This field is present when the originating
391    /// `response.create` event supplied a `stream_id`.
392    #[serde(skip_serializing_if = "Option::is_none")]
393    pub stream_id: Option<String>,
394}
395
396/// Emitted when a file search call is completed (results found).
397#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
398pub struct ResponseFileSearchCallWsCompleted {
399    #[serde(flatten)]
400    pub event: ResponseFileSearchCallCompletedEvent,
401    /// The WebSocket lane that emitted this event. This field is present when the originating
402    /// `response.create` event supplied a `stream_id`.
403    #[serde(skip_serializing_if = "Option::is_none")]
404    pub stream_id: Option<String>,
405}
406
407/// Emitted when a file search call is initiated.
408#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
409pub struct ResponseFileSearchCallInWsProgress {
410    #[serde(flatten)]
411    pub event: ResponseFileSearchCallInProgressEvent,
412    /// The WebSocket lane that emitted this event. This field is present when the originating
413    /// `response.create` event supplied a `stream_id`.
414    #[serde(skip_serializing_if = "Option::is_none")]
415    pub stream_id: Option<String>,
416}
417
418/// Emitted when a file search is currently searching.
419#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
420pub struct ResponseFileSearchCallWsSearching {
421    #[serde(flatten)]
422    pub event: ResponseFileSearchCallSearchingEvent,
423    /// The WebSocket lane that emitted this event. This field is present when the originating
424    /// `response.create` event supplied a `stream_id`.
425    #[serde(skip_serializing_if = "Option::is_none")]
426    pub stream_id: Option<String>,
427}
428
429/// Emitted when there is a partial function-call arguments delta.
430#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
431pub struct ResponseFunctionCallArgumentsWsDelta {
432    #[serde(flatten)]
433    pub event: ResponseFunctionCallArgumentsDeltaEvent,
434    /// The WebSocket lane that emitted this event. This field is present when the originating
435    /// `response.create` event supplied a `stream_id`.
436    #[serde(skip_serializing_if = "Option::is_none")]
437    pub stream_id: Option<String>,
438}
439
440/// Emitted when function-call arguments are finalized.
441#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
442pub struct ResponseFunctionCallArgumentsWsDone {
443    #[serde(flatten)]
444    pub event: ResponseFunctionCallArgumentsDoneEvent,
445    /// The WebSocket lane that emitted this event. This field is present when the originating
446    /// `response.create` event supplied a `stream_id`.
447    #[serde(skip_serializing_if = "Option::is_none")]
448    pub stream_id: Option<String>,
449}
450
451/// A streaming event that indicated a shell command was added to a tool call.
452#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
453pub struct ResponseShellCallCommandWsAdded {
454    #[serde(flatten)]
455    pub event: ResponseShellCallCommandAddedStreamingEvent,
456    /// The WebSocket lane that emitted this event. This field is present when the originating
457    /// `response.create` event supplied a `stream_id`.
458    #[serde(skip_serializing_if = "Option::is_none")]
459    pub stream_id: Option<String>,
460}
461
462/// A streaming event that indicated a shell command was incrementally updated.
463#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
464pub struct ResponseShellCallCommandWsDelta {
465    #[serde(flatten)]
466    pub event: ResponseShellCallCommandDeltaStreamingEvent,
467    /// The WebSocket lane that emitted this event. This field is present when the originating
468    /// `response.create` event supplied a `stream_id`.
469    #[serde(skip_serializing_if = "Option::is_none")]
470    pub stream_id: Option<String>,
471}
472
473/// A streaming event that indicated a shell command was completed.
474#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
475pub struct ResponseShellCallCommandWsDone {
476    #[serde(flatten)]
477    pub event: ResponseShellCallCommandDoneStreamingEvent,
478    /// The WebSocket lane that emitted this event. This field is present when the originating
479    /// `response.create` event supplied a `stream_id`.
480    #[serde(skip_serializing_if = "Option::is_none")]
481    pub stream_id: Option<String>,
482}
483
484/// A streaming event that indicated shell call output was incrementally added.
485#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
486pub struct ResponseShellCallOutputContentWsDelta {
487    #[serde(flatten)]
488    pub event: ResponseShellCallOutputContentDeltaStreamingEvent,
489    /// The WebSocket lane that emitted this event. This field is present when the originating
490    /// `response.create` event supplied a `stream_id`.
491    #[serde(skip_serializing_if = "Option::is_none")]
492    pub stream_id: Option<String>,
493}
494
495/// A streaming event that indicated shell call output was completed.
496#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
497pub struct ResponseShellCallOutputContentWsDone {
498    #[serde(flatten)]
499    pub event: ResponseShellCallOutputContentDoneStreamingEvent,
500    /// The WebSocket lane that emitted this event. This field is present when the originating
501    /// `response.create` event supplied a `stream_id`.
502    #[serde(skip_serializing_if = "Option::is_none")]
503    pub stream_id: Option<String>,
504}
505
506/// Emitted when the response is in progress.
507#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
508pub struct ResponseInWsProgress {
509    #[serde(flatten)]
510    pub event: ResponseInProgressEvent,
511    /// The WebSocket lane that emitted this event. This field is present when the originating
512    /// `response.create` event supplied a `stream_id`.
513    #[serde(skip_serializing_if = "Option::is_none")]
514    pub stream_id: Option<String>,
515}
516
517/// An event that is emitted when a response fails.
518#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
519pub struct ResponseWsFailed {
520    #[serde(flatten)]
521    pub event: ResponseFailedEvent,
522    /// The WebSocket lane that emitted this event. This field is present when the originating
523    /// `response.create` event supplied a `stream_id`.
524    #[serde(skip_serializing_if = "Option::is_none")]
525    pub stream_id: Option<String>,
526}
527
528/// An event that is emitted when a response finishes as incomplete.
529///
530/// Over WebSocket, steering can finish a response with `response.incomplete_details.reason` set to
531/// `steered`, followed automatically by a successor `response.created` that commits the queued
532/// steering input.
533#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
534pub struct ResponseWsIncomplete {
535    #[serde(flatten)]
536    pub event: ResponseIncompleteEvent,
537    /// The WebSocket lane that emitted this event. This field is present when the originating
538    /// `response.create` event supplied a `stream_id`.
539    #[serde(skip_serializing_if = "Option::is_none")]
540    pub stream_id: Option<String>,
541}
542
543/// Emitted when a new output item is added.
544#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
545pub struct ResponseOutputItemWsAdded {
546    #[serde(flatten)]
547    pub event: ResponseOutputItemAddedEvent,
548    /// The WebSocket lane that emitted this event. This field is present when the originating
549    /// `response.create` event supplied a `stream_id`.
550    #[serde(skip_serializing_if = "Option::is_none")]
551    pub stream_id: Option<String>,
552}
553
554/// Emitted when an output item is marked done.
555#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
556pub struct ResponseOutputItemWsDone {
557    #[serde(flatten)]
558    pub event: ResponseOutputItemDoneEvent,
559    /// The WebSocket lane that emitted this event. This field is present when the originating
560    /// `response.create` event supplied a `stream_id`.
561    #[serde(skip_serializing_if = "Option::is_none")]
562    pub stream_id: Option<String>,
563}
564
565/// Emitted when a new reasoning summary part is added.
566#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
567pub struct ResponseReasoningSummaryPartWsAdded {
568    #[serde(flatten)]
569    pub event: ResponseReasoningSummaryPartAddedEvent,
570    /// The WebSocket lane that emitted this event. This field is present when the originating
571    /// `response.create` event supplied a `stream_id`.
572    #[serde(skip_serializing_if = "Option::is_none")]
573    pub stream_id: Option<String>,
574}
575
576/// Emitted when a reasoning summary part is completed.
577#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
578pub struct ResponseReasoningSummaryPartWsDone {
579    #[serde(flatten)]
580    pub event: ResponseReasoningSummaryPartDoneEvent,
581    /// The WebSocket lane that emitted this event. This field is present when the originating
582    /// `response.create` event supplied a `stream_id`.
583    #[serde(skip_serializing_if = "Option::is_none")]
584    pub stream_id: Option<String>,
585}
586
587/// Emitted when a delta is added to a reasoning summary text.
588#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
589pub struct ResponseReasoningSummaryTextWsDelta {
590    #[serde(flatten)]
591    pub event: ResponseReasoningSummaryTextDeltaEvent,
592    /// The WebSocket lane that emitted this event. This field is present when the originating
593    /// `response.create` event supplied a `stream_id`.
594    #[serde(skip_serializing_if = "Option::is_none")]
595    pub stream_id: Option<String>,
596}
597
598/// Emitted when a reasoning summary text is completed.
599#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
600pub struct ResponseReasoningSummaryTextWsDone {
601    #[serde(flatten)]
602    pub event: ResponseReasoningSummaryTextDoneEvent,
603    /// The WebSocket lane that emitted this event. This field is present when the originating
604    /// `response.create` event supplied a `stream_id`.
605    #[serde(skip_serializing_if = "Option::is_none")]
606    pub stream_id: Option<String>,
607}
608
609/// Emitted when a delta is added to a reasoning text.
610#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
611pub struct ResponseReasoningTextWsDelta {
612    #[serde(flatten)]
613    pub event: ResponseReasoningTextDeltaEvent,
614    /// The WebSocket lane that emitted this event. This field is present when the originating
615    /// `response.create` event supplied a `stream_id`.
616    #[serde(skip_serializing_if = "Option::is_none")]
617    pub stream_id: Option<String>,
618}
619
620/// Emitted when a reasoning text is completed.
621#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
622pub struct ResponseReasoningTextWsDone {
623    #[serde(flatten)]
624    pub event: ResponseReasoningTextDoneEvent,
625    /// The WebSocket lane that emitted this event. This field is present when the originating
626    /// `response.create` event supplied a `stream_id`.
627    #[serde(skip_serializing_if = "Option::is_none")]
628    pub stream_id: Option<String>,
629}
630
631/// Emitted when there is a partial refusal text.
632#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
633pub struct ResponseRefusalWsDelta {
634    #[serde(flatten)]
635    pub event: ResponseRefusalDeltaEvent,
636    /// The WebSocket lane that emitted this event. This field is present when the originating
637    /// `response.create` event supplied a `stream_id`.
638    #[serde(skip_serializing_if = "Option::is_none")]
639    pub stream_id: Option<String>,
640}
641
642/// Emitted when refusal text is finalized.
643#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
644pub struct ResponseRefusalWsDone {
645    #[serde(flatten)]
646    pub event: ResponseRefusalDoneEvent,
647    /// The WebSocket lane that emitted this event. This field is present when the originating
648    /// `response.create` event supplied a `stream_id`.
649    #[serde(skip_serializing_if = "Option::is_none")]
650    pub stream_id: Option<String>,
651}
652
653/// Emitted when there is an additional text delta.
654#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
655pub struct ResponseTextWsDelta {
656    #[serde(flatten)]
657    pub event: ResponseTextDeltaEvent,
658    /// The WebSocket lane that emitted this event. This field is present when the originating
659    /// `response.create` event supplied a `stream_id`.
660    #[serde(skip_serializing_if = "Option::is_none")]
661    pub stream_id: Option<String>,
662}
663
664/// Emitted when text content is finalized.
665#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
666pub struct ResponseTextWsDone {
667    #[serde(flatten)]
668    pub event: ResponseTextDoneEvent,
669    /// The WebSocket lane that emitted this event. This field is present when the originating
670    /// `response.create` event supplied a `stream_id`.
671    #[serde(skip_serializing_if = "Option::is_none")]
672    pub stream_id: Option<String>,
673}
674
675/// Emitted when a web search call is completed.
676#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
677pub struct ResponseWebSearchCallWsCompleted {
678    #[serde(flatten)]
679    pub event: ResponseWebSearchCallCompletedEvent,
680    /// The WebSocket lane that emitted this event. This field is present when the originating
681    /// `response.create` event supplied a `stream_id`.
682    #[serde(skip_serializing_if = "Option::is_none")]
683    pub stream_id: Option<String>,
684}
685
686/// Emitted when a web search call is initiated.
687#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
688pub struct ResponseWebSearchCallInWsProgress {
689    #[serde(flatten)]
690    pub event: ResponseWebSearchCallInProgressEvent,
691    /// The WebSocket lane that emitted this event. This field is present when the originating
692    /// `response.create` event supplied a `stream_id`.
693    #[serde(skip_serializing_if = "Option::is_none")]
694    pub stream_id: Option<String>,
695}
696
697/// Emitted when a web search call is executing.
698#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
699pub struct ResponseWebSearchCallWsSearching {
700    #[serde(flatten)]
701    pub event: ResponseWebSearchCallSearchingEvent,
702    /// The WebSocket lane that emitted this event. This field is present when the originating
703    /// `response.create` event supplied a `stream_id`.
704    #[serde(skip_serializing_if = "Option::is_none")]
705    pub stream_id: Option<String>,
706}
707
708/// Emitted when an image generation tool call has completed and the final image is available.
709#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
710pub struct ResponseImageGenCallWsCompleted {
711    #[serde(flatten)]
712    pub event: ResponseImageGenCallCompletedEvent,
713    /// The WebSocket lane that emitted this event. This field is present when the originating
714    /// `response.create` event supplied a `stream_id`.
715    #[serde(skip_serializing_if = "Option::is_none")]
716    pub stream_id: Option<String>,
717}
718
719/// Emitted when an image generation tool call is actively generating an image (intermediate
720/// state).
721#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
722pub struct ResponseImageGenCallWsGenerating {
723    #[serde(flatten)]
724    pub event: ResponseImageGenCallGeneratingEvent,
725    /// The WebSocket lane that emitted this event. This field is present when the originating
726    /// `response.create` event supplied a `stream_id`.
727    #[serde(skip_serializing_if = "Option::is_none")]
728    pub stream_id: Option<String>,
729}
730
731/// Emitted when an image generation tool call is in progress.
732#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
733pub struct ResponseImageGenCallInWsProgress {
734    #[serde(flatten)]
735    pub event: ResponseImageGenCallInProgressEvent,
736    /// The WebSocket lane that emitted this event. This field is present when the originating
737    /// `response.create` event supplied a `stream_id`.
738    #[serde(skip_serializing_if = "Option::is_none")]
739    pub stream_id: Option<String>,
740}
741
742/// Emitted when a partial image is available during image generation streaming.
743#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
744pub struct ResponseImageGenCallPartialWsImage {
745    #[serde(flatten)]
746    pub event: ResponseImageGenCallPartialImageEvent,
747    /// The WebSocket lane that emitted this event. This field is present when the originating
748    /// `response.create` event supplied a `stream_id`.
749    #[serde(skip_serializing_if = "Option::is_none")]
750    pub stream_id: Option<String>,
751}
752
753/// Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
754#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
755pub struct ResponseMcpCallArgumentsWsDelta {
756    #[serde(flatten)]
757    pub event: ResponseMCPCallArgumentsDeltaEvent,
758    /// The WebSocket lane that emitted this event. This field is present when the originating
759    /// `response.create` event supplied a `stream_id`.
760    #[serde(skip_serializing_if = "Option::is_none")]
761    pub stream_id: Option<String>,
762}
763
764/// Emitted when the arguments for an MCP tool call are finalized.
765#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
766pub struct ResponseMcpCallArgumentsWsDone {
767    #[serde(flatten)]
768    pub event: ResponseMCPCallArgumentsDoneEvent,
769    /// The WebSocket lane that emitted this event. This field is present when the originating
770    /// `response.create` event supplied a `stream_id`.
771    #[serde(skip_serializing_if = "Option::is_none")]
772    pub stream_id: Option<String>,
773}
774
775/// Emitted when an MCP tool call has completed successfully.
776#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
777pub struct ResponseMcpCallWsCompleted {
778    #[serde(flatten)]
779    pub event: ResponseMCPCallCompletedEvent,
780    /// The WebSocket lane that emitted this event. This field is present when the originating
781    /// `response.create` event supplied a `stream_id`.
782    #[serde(skip_serializing_if = "Option::is_none")]
783    pub stream_id: Option<String>,
784}
785
786/// Emitted when an MCP tool call has failed.
787#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
788pub struct ResponseMcpCallWsFailed {
789    #[serde(flatten)]
790    pub event: ResponseMCPCallFailedEvent,
791    /// The WebSocket lane that emitted this event. This field is present when the originating
792    /// `response.create` event supplied a `stream_id`.
793    #[serde(skip_serializing_if = "Option::is_none")]
794    pub stream_id: Option<String>,
795}
796
797/// Emitted when an MCP tool call is in progress.
798#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
799pub struct ResponseMcpCallInWsProgress {
800    #[serde(flatten)]
801    pub event: ResponseMCPCallInProgressEvent,
802    /// The WebSocket lane that emitted this event. This field is present when the originating
803    /// `response.create` event supplied a `stream_id`.
804    #[serde(skip_serializing_if = "Option::is_none")]
805    pub stream_id: Option<String>,
806}
807
808/// Emitted when the list of available MCP tools has been successfully retrieved.
809#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
810pub struct ResponseMcpListToolsWsCompleted {
811    #[serde(flatten)]
812    pub event: ResponseMCPListToolsCompletedEvent,
813    /// The WebSocket lane that emitted this event. This field is present when the originating
814    /// `response.create` event supplied a `stream_id`.
815    #[serde(skip_serializing_if = "Option::is_none")]
816    pub stream_id: Option<String>,
817}
818
819/// Emitted when the attempt to list available MCP tools has failed.
820#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
821pub struct ResponseMcpListToolsWsFailed {
822    #[serde(flatten)]
823    pub event: ResponseMCPListToolsFailedEvent,
824    /// The WebSocket lane that emitted this event. This field is present when the originating
825    /// `response.create` event supplied a `stream_id`.
826    #[serde(skip_serializing_if = "Option::is_none")]
827    pub stream_id: Option<String>,
828}
829
830/// Emitted when the system is in the process of retrieving the list of available MCP tools.
831#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
832pub struct ResponseMcpListToolsInWsProgress {
833    #[serde(flatten)]
834    pub event: ResponseMCPListToolsInProgressEvent,
835    /// The WebSocket lane that emitted this event. This field is present when the originating
836    /// `response.create` event supplied a `stream_id`.
837    #[serde(skip_serializing_if = "Option::is_none")]
838    pub stream_id: Option<String>,
839}
840
841/// Emitted when an annotation is added to output text content.
842#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
843pub struct ResponseOutputTextAnnotationWsAdded {
844    #[serde(flatten)]
845    pub event: ResponseOutputTextAnnotationAddedEvent,
846    /// The WebSocket lane that emitted this event. This field is present when the originating
847    /// `response.create` event supplied a `stream_id`.
848    #[serde(skip_serializing_if = "Option::is_none")]
849    pub stream_id: Option<String>,
850}
851
852/// Emitted when a response is queued and waiting to be processed.
853#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
854pub struct ResponseWsQueued {
855    #[serde(flatten)]
856    pub event: ResponseQueuedEvent,
857    /// The WebSocket lane that emitted this event. This field is present when the originating
858    /// `response.create` event supplied a `stream_id`.
859    #[serde(skip_serializing_if = "Option::is_none")]
860    pub stream_id: Option<String>,
861}
862
863/// Event representing a delta (partial update) to the input of a custom tool call.
864#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
865pub struct ResponseCustomToolCallInputWsDelta {
866    #[serde(flatten)]
867    pub event: ResponseCustomToolCallInputDeltaEvent,
868    /// The WebSocket lane that emitted this event. This field is present when the originating
869    /// `response.create` event supplied a `stream_id`.
870    #[serde(skip_serializing_if = "Option::is_none")]
871    pub stream_id: Option<String>,
872}
873
874/// Event indicating that input for a custom tool call is complete.
875#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
876pub struct ResponseCustomToolCallInputWsDone {
877    #[serde(flatten)]
878    pub event: ResponseCustomToolCallInputDoneEvent,
879    /// The WebSocket lane that emitted this event. This field is present when the originating
880    /// `response.create` event supplied a `stream_id`.
881    #[serde(skip_serializing_if = "Option::is_none")]
882    pub stream_id: Option<String>,
883}
884
885/// An error payload that was emitted for a streaming error event.
886#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
887pub struct ErrorPayload {
888    /// The error type that was emitted.
889    pub r#type: String,
890    #[serde(skip_serializing_if = "Option::is_none")]
891    pub code: Option<String>,
892    /// The human-readable error message that was emitted.
893    pub message: String,
894    #[serde(skip_serializing_if = "Option::is_none")]
895    pub param: Option<String>,
896    /// The response headers that were emitted with the error, if any.
897    #[serde(skip_serializing_if = "Option::is_none")]
898    pub headers: Option<std::collections::HashMap<String, String>>,
899    #[serde(skip_serializing_if = "Option::is_none")]
900    pub misalignment: Option<MisalignmentErrorDetailsResource>,
901}
902
903/// Emitted when steering input has been validated and queued. Acceptance means
904/// the server owns the input, not that it has been applied. The successor's
905/// `response.created` event is the commit point. If accepted input cannot be
906/// committed, `response.steer.failed` returns it with the same steering ID.
907///
908/// When the response stops for client-owned tool output or approval, the input
909/// remains queued and `response.steer.pending` is emitted after
910/// `response.completed`. Fill the pending event's `required_input` stubs with
911/// saved results and send one matching explicit `response.create` per parent.
912/// Do not resend accepted input while it is still queued.
913#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
914pub struct ResponseSteerAcceptedEvent {
915    /// The sequence number for this event.
916    pub sequence_number: u64,
917    /// The accepted steering submission.
918    pub steer: ResponseSteerAcceptedEventSteer,
919    /// The WebSocket lane that emitted this event. This field is present when
920    /// the target response's `response.create` event supplied a `stream_id`.
921    #[serde(skip_serializing_if = "Option::is_none")]
922    pub stream_id: Option<String>,
923}
924
925/// The accepted steering submission.
926#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
927pub struct ResponseSteerAcceptedEventSteer {
928    /// The ID assigned to the steering submission.
929    pub id: String,
930    /// The ID of the response being steered.
931    pub previous_response_id: String,
932}
933
934/// A machine-readable steering error code. Clients should handle unknown
935/// values because additional codes may be introduced. Known values include:
936/// - `response_not_found`: The target response is not available on this connection.
937/// - `invalid_input`: The event or input failed validation.
938/// - `steering_not_supported`: The model or response execution mode does not support steering.
939/// - `too_many_pending_steers`: Too much steering input is pending for the response.
940/// - `response_already_completed`: The response completed and is no longer accepting steering input.
941/// - `response_not_active`: The response is no longer accepting steering input.
942/// - `successor_creation_failed`: The successor response could not be created.
943pub type ResponseSteerErrorCode = String;
944
945/// Queues user input to steer a response on this WebSocket connection. Input
946/// can contain text, images, and files. Steering is supported only for
947/// single-agent responses on models and execution modes that support steering.
948/// Responses bound to a conversation or using automatic compaction do not
949/// support steering.
950///
951/// A `response.steer.accepted` event acknowledges that the server owns the
952/// queued input, not that it has been applied. The successor's `response.created`
953/// event is the commit point. Input that cannot be committed is returned in
954/// `response.steer.failed`.
955///
956/// Steering may cause the active response to finish at a safe output boundary
957/// with `response.incomplete` and `incomplete_details.reason` set to `steered`,
958/// followed automatically by a successor `response.created`. Normal completion
959/// can also be followed by an automatic successor. Automatic successors inherit
960/// the previous response's settings and continue from it with the queued input.
961///
962/// If the response stops for client-owned tool output or approval, accepted
963/// steering input remains queued and `response.steer.pending` is emitted after
964/// `response.completed`. Fill the `required_input` stubs from that event with
965/// saved tool results or approval decisions, and send one explicit
966/// `response.create` per parent with the same `previous_response_id` and
967/// WebSocket lane. Do not rerun tools or resend accepted steering input. The
968/// queued input is prepended in submission order to that request's input, and
969/// the explicit request retains its own settings.
970///
971/// This event accepts only `type`, `previous_response_id`, and `input`. Do not
972/// send `stream_id`; the target response determines the WebSocket lane.
973#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
974pub struct ResponseSteerEvent {
975    /// The ID of the response to steer on this WebSocket connection.
976    pub previous_response_id: String,
977    pub input: ResponseSteerInput,
978}
979
980/// Emitted when steering input is rejected or cannot be committed to a
981/// successor response. Returns the original, uncommitted input so the client
982/// can carry it into `response.create` when appropriate. Invalid input must
983/// be corrected before retrying.
984///
985/// Failures after acceptance include the same steering ID. Failures before an
986/// ID is allocated omit `steer.id`. A lost connection or missing acknowledgement
987/// leaves the outcome unknown; it is not proof that the input was rejected.
988#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
989pub struct ResponseSteerFailedEvent {
990    /// The sequence number for this event.
991    pub sequence_number: i64,
992    /// The steering submission that could not be committed.
993    pub steer: ResponseSteerFailedEventSteer,
994    /// Information about why the input could not be committed.
995    pub error: ResponseSteerFailedEventError,
996    /// The WebSocket lane that emitted this event, when the target response is
997    /// available and its `response.create` event supplied a `stream_id`.
998    #[serde(skip_serializing_if = "Option::is_none")]
999    pub stream_id: Option<String>,
1000}
1001
1002/// Information about why the input could not be committed.
1003#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1004pub struct ResponseSteerFailedEventError {
1005    /// The error type. Always `invalid_request_error`.
1006    pub r#type: ResponseSteerFailedEventErrorType,
1007    pub code: ResponseSteerErrorCode,
1008    /// A human-readable description of the error.
1009    pub message: String,
1010}
1011
1012/// The error type. Always `invalid_request_error`.
1013#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1014pub enum ResponseSteerFailedEventErrorType {
1015    #[serde(rename = "invalid_request_error")]
1016    InvalidRequestError,
1017}
1018
1019/// The steering submission that could not be committed.
1020#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1021pub struct ResponseSteerFailedEventSteer {
1022    /// The ID assigned to the steering submission, if one was allocated.
1023    #[serde(skip_serializing_if = "Option::is_none")]
1024    pub id: Option<String>,
1025    /// The ID of the response that was targeted for steering.
1026    pub previous_response_id: String,
1027    pub input: ResponseSteerInput,
1028}
1029
1030/// Input to queue for a continuation of the response. Uses the same string or
1031/// input-item shape as `response.create.input`, with a non-empty array when
1032/// supplying input items.
1033///
1034/// Steering accepts only messages with the `user` role. Each message may
1035/// contain only `type`, `role`, and `content`, with `content` as a string or an
1036/// array of `input_text`, `input_image`, and `input_file` parts. The optional
1037/// `type` must be `message`. Other roles, tool outputs, and item types are not
1038/// supported for steering.
1039/// Input to queue for a continuation of the response. Uses the same string or
1040/// input-item shape as `response.create.input`, with a non-empty array when
1041/// supplying input items.
1042///
1043/// Steering accepts only messages with the `user` role. Each message may
1044/// contain only `type`, `role`, and `content`, with `content` as a string or an
1045/// array of `input_text`, `input_image`, and `input_file` parts. The optional
1046/// `type` must be `message`. Other roles, tool outputs, and item types are not
1047/// supported for steering.
1048#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1049#[serde(untagged)]
1050pub enum ResponseSteerInput {
1051    Text(String),
1052    List(Vec<ResponseSteerInputItem>),
1053}
1054
1055#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1056#[serde(tag = "type", rename_all = "snake_case")]
1057pub enum ResponseSteerInputItem {
1058    Message(UserMessageItemParam),
1059    FunctionCallOutput(FunctionCallOutputItemParam),
1060}
1061
1062/// Emitted when accepted steering input remains queued after the target
1063/// response completes. The server still owns the input. Do not resend it.
1064/// The successor's `response.created` event is the commit point.
1065///
1066/// When `reason` is `waiting_for_required_input`, this event follows
1067/// `response.completed` while the response waits for the tool results or
1068/// approval decisions identified by `required_input`. Copy those stubs, fill
1069/// their result fields using the ordinary `response.create` input schemas,
1070/// and submit one continuation per parent with the same `previous_response_id`
1071/// and WebSocket lane. Use saved results without rerunning tools. The queued
1072/// steering input is prepended in submission order to the continuation's
1073/// input. That explicit request retains its own settings.
1074///
1075/// This notification is emitted at most once per steering submission. Multiple
1076/// submissions for the same parent can report the same required inputs; they
1077/// do not each require a separate continuation.
1078#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1079pub struct ResponseSteerPendingEvent {
1080    /// The sequence number for this event.
1081    pub sequence_number: u64,
1082    /// The steering submission that remains queued.
1083    pub steer: ResponseSteerPendingEventSteer,
1084    pub reason: ResponseSteerPendingReason,
1085    /// Input stubs identifying outstanding client-owned tool results or
1086    /// approval decisions. Each stub contains identifying fields only; the
1087    /// client supplies the result before including it in `response.create`.
1088    pub required_input: Vec<ResponseSteerRequiredInput>,
1089    /// The WebSocket lane that emitted this event. This field is present when
1090    /// the target response's `response.create` event supplied a `stream_id`.
1091    #[serde(skip_serializing_if = "Option::is_none")]
1092    pub stream_id: Option<String>,
1093}
1094
1095/// The steering submission that remains queued.
1096#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1097pub struct ResponseSteerPendingEventSteer {
1098    /// The ID assigned to the steering submission.
1099    pub id: String,
1100    /// The ID of the response being steered.
1101    pub previous_response_id: String,
1102}
1103
1104/// An extensible enum describing why accepted steering input is still queued.
1105/// Clients should handle unknown values because additional reasons may be
1106/// introduced. Known values include:
1107/// - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions
1108///   identified by `required_input`.
1109#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1110#[serde(rename_all = "snake_case")]
1111pub enum ResponseSteerPendingReason {
1112    WaitingForRequiredInput,
1113    #[serde(untagged)]
1114    Other(String),
1115}
1116
1117/// An input stub identifying an outstanding client-owned tool result or
1118/// approval decision. Copy the stub and fill the result fields using the
1119/// corresponding `response.create` input schema. Use saved results without
1120/// rerunning the tool. The server does not supply results, approval decisions,
1121/// or safety acknowledgements in these stubs.
1122#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1123#[serde(tag = "type")]
1124pub enum ResponseSteerRequiredInput {
1125    /// Supply `output` using the function tool call output input schema.
1126    #[serde(rename = "function_call_output")]
1127    FunctionCallOutput(ResponseSteerRequiredInputFunctionCallOutput),
1128    /// Supply `output` using the custom tool call output input schema. The
1129    /// original custom tool call supplies the tool's name.
1130    #[serde(rename = "custom_tool_call_output")]
1131    CustomToolCallOutput(ResponseSteerRequiredInputCustomToolCallOutput),
1132    /// Supply `output` using the computer tool call output input schema,
1133    /// including any required `acknowledged_safety_checks`.
1134    #[serde(rename = "computer_call_output")]
1135    ComputerCallOutput(ResponseSteerRequiredInputComputerCallOutput),
1136    /// Supply `output` using the shell tool call output input schema. Each
1137    /// output entry includes `stdout`, `stderr`, and `outcome`.
1138    #[serde(rename = "shell_call_output")]
1139    ShellCallOutput(ResponseSteerRequiredInputShellCallOutput),
1140    /// Supply `status` and optional `output` using the apply patch tool call
1141    /// output input schema.
1142    #[serde(rename = "apply_patch_call_output")]
1143    ApplyPatchCallOutput(ResponseSteerRequiredInputApplyPatchCallOutput),
1144    /// Supply `tools` using the tool search output input schema, retaining
1145    /// `execution: "client"`.
1146    #[serde(rename = "tool_search_output")]
1147    ToolSearchOutput(ResponseSteerRequiredInputToolSearchOutput),
1148    /// Supply `approve` using the MCP approval response input schema. An
1149    /// optional `reason` can be supplied when denying the request. The original
1150    /// approval request identifies the tool and server.
1151    #[serde(rename = "mcp_approval_response")]
1152    McpApprovalResponse(ResponseSteerRequiredInputMcpApprovalResponse),
1153}
1154
1155/// Supply `output` using the function tool call output input schema.
1156#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1157pub struct ResponseSteerRequiredInputFunctionCallOutput {
1158    pub call_id: String,
1159    pub name: String,
1160}
1161
1162/// Supply `output` using the custom tool call output input schema. The
1163/// original custom tool call supplies the tool's name.
1164#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1165pub struct ResponseSteerRequiredInputCustomToolCallOutput {
1166    pub call_id: String,
1167}
1168
1169/// Supply `output` using the computer tool call output input schema,
1170/// including any required `acknowledged_safety_checks`.
1171#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1172pub struct ResponseSteerRequiredInputComputerCallOutput {
1173    pub call_id: String,
1174}
1175
1176/// Supply `output` using the shell tool call output input schema. Each
1177/// output entry includes `stdout`, `stderr`, and `outcome`.
1178#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1179pub struct ResponseSteerRequiredInputShellCallOutput {
1180    pub call_id: String,
1181}
1182
1183/// Supply `status` and optional `output` using the apply patch tool call
1184/// output input schema.
1185#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1186pub struct ResponseSteerRequiredInputApplyPatchCallOutput {
1187    pub call_id: String,
1188}
1189
1190/// Supply `tools` using the tool search output input schema, retaining
1191/// `execution: "client"`.
1192#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1193pub struct ResponseSteerRequiredInputToolSearchOutput {
1194    pub call_id: String,
1195    pub execution: ResponseSteerRequiredInputToolSearchOutputExecution,
1196}
1197
1198#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1199pub enum ResponseSteerRequiredInputToolSearchOutputExecution {
1200    #[serde(rename = "client")]
1201    Client,
1202}
1203
1204/// Supply `approve` using the MCP approval response input schema. An
1205/// optional `reason` can be supplied when denying the request. The original
1206/// approval request identifies the tool and server.
1207#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1208pub struct ResponseSteerRequiredInputMcpApprovalResponse {
1209    pub approval_request_id: String,
1210}
1211
1212/// Emitted when an error occurs while processing a Responses WebSocket request.
1213#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1214pub struct ResponseWsError {
1215    /// The HTTP status code associated with a WebSocket protocol error.
1216    #[serde(skip_serializing_if = "Option::is_none")]
1217    pub status: Option<u32>,
1218    /// The sequence number of an error emitted by the response stream.
1219    #[serde(skip_serializing_if = "Option::is_none")]
1220    pub sequence_number: Option<u64>,
1221    /// Details about the error.
1222    pub error: ErrorPayload,
1223    /// The WebSocket lane that emitted this event. This field is present when the
1224    /// originating `response.create` event supplied a `stream_id`.
1225    #[serde(skip_serializing_if = "Option::is_none")]
1226    pub stream_id: Option<String>,
1227}
1228
1229#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1230pub struct ResponsesWebSocketStreamEvent {
1231    /// The WebSocket lane that emitted this event. This field is present
1232    /// when the originating `response.create` event supplied a
1233    /// `stream_id`.
1234    #[serde(skip_serializing_if = "Option::is_none")]
1235    pub stream_id: Option<String>,
1236}
1237
1238#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1239pub struct UserMessageItemParam {
1240    #[serde(skip_serializing_if = "Option::is_none")]
1241    pub id: Option<String>,
1242    /// The message role. Always `user`.
1243    pub role: UserMessageItemParamRole,
1244    /// The message content, as an array of content parts.
1245    pub content: crate::types::responses::EasyInputContent,
1246    #[serde(skip_serializing_if = "Option::is_none")]
1247    pub status: Option<String>,
1248}
1249
1250/// The message role. Always `user`.
1251#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1252#[serde(rename_all = "lowercase")]
1253pub enum UserMessageItemParamRole {
1254    User,
1255}