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