1use super::input;
3use crate::Rest;
4use serde::{Deserialize, Serialize};
5
6#[derive(
7 Debug,
8 Clone,
9 PartialEq,
10 Eq,
11 Serialize,
12 Deserialize,
13 gproxy_protocol_macros::WireBuilder,
14 gproxy_protocol_macros::DeclaredFields,
15)]
16#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
17pub struct SteerRequest {
18 pub previous_response_id: String,
19 pub input: SteerInput,
20 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
21 pub rest: Rest,
22}
23
24#[derive(
25 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
26)]
27#[serde(untagged)]
28#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
29pub enum SteerInput {
30 Text(String),
31 Messages(Vec<SteerMessage>),
32}
33
34#[derive(
35 Debug,
36 Clone,
37 PartialEq,
38 Eq,
39 Serialize,
40 Deserialize,
41 gproxy_protocol_macros::WireBuilder,
42 gproxy_protocol_macros::DeclaredFields,
43)]
44#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
45pub struct SteerMessage {
46 pub role: SteerRole,
47 pub content: input::MessageContent,
48 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
49 pub type_: Option<input::MessageType>,
50 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
51 pub rest: Rest,
52}
53
54#[derive(
55 Debug,
56 Clone,
57 Copy,
58 PartialEq,
59 Eq,
60 Serialize,
61 Deserialize,
62 gproxy_protocol_macros::DeclaredFields,
63)]
64#[serde(rename_all = "snake_case")]
65#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
66pub enum SteerRole {
67 User,
68}
69
70#[derive(
71 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
72)]
73#[serde(tag = "type")]
74#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
75pub enum SteeringEvent {
76 #[serde(rename = "response.steer.accepted")]
77 Accepted(SteerAccepted),
78 #[serde(rename = "response.steer.pending")]
79 Pending(SteerPending),
80 #[serde(rename = "response.steer.failed")]
81 Failed(SteerFailed),
82}
83
84#[derive(
85 Debug,
86 Clone,
87 PartialEq,
88 Eq,
89 Serialize,
90 Deserialize,
91 gproxy_protocol_macros::WireBuilder,
92 gproxy_protocol_macros::DeclaredFields,
93)]
94#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
95pub struct SteeringReference {
96 pub id: String,
97 pub previous_response_id: String,
98 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
99 pub rest: Rest,
100}
101
102#[derive(
103 Debug,
104 Clone,
105 PartialEq,
106 Eq,
107 Serialize,
108 Deserialize,
109 gproxy_protocol_macros::WireBuilder,
110 gproxy_protocol_macros::DeclaredFields,
111)]
112#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
113pub struct SteerAccepted {
114 pub sequence_number: i64,
115 pub steer: SteeringReference,
116 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
117 pub rest: Rest,
118}
119
120#[derive(
121 Debug,
122 Clone,
123 PartialEq,
124 Eq,
125 Serialize,
126 Deserialize,
127 gproxy_protocol_macros::WireBuilder,
128 gproxy_protocol_macros::DeclaredFields,
129)]
130#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
131pub struct SteerPending {
132 pub sequence_number: i64,
133 pub steer: SteeringReference,
134 pub reason: String,
135 pub required_input: Vec<RequiredSteeringInput>,
136 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
137 pub rest: Rest,
138}
139
140#[derive(
141 Debug,
142 Clone,
143 PartialEq,
144 Eq,
145 Serialize,
146 Deserialize,
147 gproxy_protocol_macros::WireBuilder,
148 gproxy_protocol_macros::DeclaredFields,
149)]
150#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
151pub struct SteerFailed {
152 pub sequence_number: i64,
153 pub steer: FailedSteeringSubmission,
154 pub error: SteerError,
155 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
156 pub rest: Rest,
157}
158
159#[derive(
160 Debug,
161 Clone,
162 PartialEq,
163 Eq,
164 Serialize,
165 Deserialize,
166 gproxy_protocol_macros::WireBuilder,
167 gproxy_protocol_macros::DeclaredFields,
168)]
169#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
170pub struct FailedSteeringSubmission {
171 pub previous_response_id: String,
172 pub input: SteerInput,
173 #[serde(skip_serializing_if = "Option::is_none")]
174 pub id: Option<String>,
175 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
176 pub rest: Rest,
177}
178
179#[derive(
180 Debug,
181 Clone,
182 PartialEq,
183 Eq,
184 Serialize,
185 Deserialize,
186 gproxy_protocol_macros::WireBuilder,
187 gproxy_protocol_macros::DeclaredFields,
188)]
189#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
190pub struct SteerError {
191 pub code: String,
192 pub message: String,
193 #[serde(rename = "type")]
194 pub type_: SteerErrorType,
195 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
196 pub rest: Rest,
197}
198
199#[derive(
200 Debug,
201 Clone,
202 Copy,
203 PartialEq,
204 Eq,
205 Serialize,
206 Deserialize,
207 gproxy_protocol_macros::DeclaredFields,
208)]
209#[serde(rename_all = "snake_case")]
210#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
211pub enum SteerErrorType {
212 InvalidRequestError,
213}
214
215#[derive(
216 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
217)]
218#[serde(tag = "type", rename_all = "snake_case")]
219#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
220pub enum RequiredSteeringInput {
221 FunctionCallOutput {
222 call_id: String,
223 name: String,
224 },
225 CustomToolCallOutput {
226 call_id: String,
227 },
228 ComputerCallOutput {
229 call_id: String,
230 },
231 ShellCallOutput {
232 call_id: String,
233 },
234 ApplyPatchCallOutput {
235 call_id: String,
236 },
237 ToolSearchOutput {
238 call_id: String,
239 execution: SteeringToolSearchExecution,
240 },
241 McpApprovalResponse {
242 approval_request_id: String,
243 },
244}
245
246#[derive(
247 Debug,
248 Clone,
249 Copy,
250 PartialEq,
251 Eq,
252 Serialize,
253 Deserialize,
254 gproxy_protocol_macros::DeclaredFields,
255)]
256#[serde(rename_all = "snake_case")]
257#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
258pub enum SteeringToolSearchExecution {
259 Client,
260}