@@ -164,102 +164,80 @@ pub enum ConfigLayerName {
164164}
165165
166166#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , Default , JsonSchema , TS ) ]
167- #[ serde( rename_all = "camelCase " ) ]
167+ #[ serde( rename_all = "snake_case " ) ]
168168#[ ts( export_to = "v2/" ) ]
169169pub struct SandboxWorkspaceWrite {
170- #[ serde( default , alias = "writable_roots" ) ]
170+ #[ serde( default ) ]
171171 pub writable_roots : Vec < PathBuf > ,
172- #[ serde( default , alias = "network_access" ) ]
172+ #[ serde( default ) ]
173173 pub network_access : bool ,
174- #[ serde( default , alias = "exclude_tmpdir_env_var" ) ]
174+ #[ serde( default ) ]
175175 pub exclude_tmpdir_env_var : bool ,
176- #[ serde( default , alias = "exclude_slash_tmp" ) ]
176+ #[ serde( default ) ]
177177 pub exclude_slash_tmp : bool ,
178178}
179179
180180#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
181- #[ serde( rename_all = "camelCase " ) ]
181+ #[ serde( rename_all = "snake_case " ) ]
182182#[ ts( export_to = "v2/" ) ]
183183pub struct ToolsV2 {
184- #[ serde( alias = "web_search" ) ]
185184 pub web_search : Option < bool > ,
186- #[ serde( alias = "view_image" ) ]
187185 pub view_image : Option < bool > ,
188186}
189187
190188#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
191- #[ serde( rename_all = "camelCase " ) ]
189+ #[ serde( rename_all = "snake_case " ) ]
192190#[ ts( export_to = "v2/" ) ]
193191pub struct ProfileV2 {
194192 pub model : Option < String > ,
195- #[ serde( alias = "model_provider" ) ]
196193 pub model_provider : Option < String > ,
197194 #[ serde(
198195 default ,
199196 deserialize_with = "deserialize_approval_policy" ,
200- serialize_with = "serialize_approval_policy" ,
201- alias = "approval_policy"
197+ serialize_with = "serialize_approval_policy"
202198 ) ]
203199 pub approval_policy : Option < AskForApproval > ,
204- #[ serde( alias = "model_reasoning_effort" ) ]
205200 pub model_reasoning_effort : Option < ReasoningEffort > ,
206- #[ serde( alias = "model_reasoning_summary" ) ]
207201 pub model_reasoning_summary : Option < ReasoningSummary > ,
208- #[ serde( alias = "model_verbosity" ) ]
209202 pub model_verbosity : Option < Verbosity > ,
210- #[ serde( alias = "chatgpt_base_url" ) ]
211203 pub chatgpt_base_url : Option < String > ,
212204}
213205
214206#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
215- #[ serde( rename_all = "camelCase " ) ]
207+ #[ serde( rename_all = "snake_case " ) ]
216208#[ ts( export_to = "v2/" ) ]
217209pub struct Config {
218210 pub model : Option < String > ,
219- #[ serde( alias = "review_model" ) ]
220211 pub review_model : Option < String > ,
221- #[ serde( alias = "model_context_window" ) ]
222212 pub model_context_window : Option < i64 > ,
223- #[ serde( alias = "model_auto_compact_token_limit" ) ]
224213 pub model_auto_compact_token_limit : Option < i64 > ,
225- #[ serde( alias = "model_provider" ) ]
226214 pub model_provider : Option < String > ,
227215 #[ serde(
228216 default ,
229217 deserialize_with = "deserialize_approval_policy" ,
230- serialize_with = "serialize_approval_policy" ,
231- alias = "approval_policy"
218+ serialize_with = "serialize_approval_policy"
232219 ) ]
233220 pub approval_policy : Option < AskForApproval > ,
234221 #[ serde(
235222 default ,
236223 deserialize_with = "deserialize_sandbox_mode" ,
237- serialize_with = "serialize_sandbox_mode" ,
238- alias = "sandbox_mode"
224+ serialize_with = "serialize_sandbox_mode"
239225 ) ]
240226 pub sandbox_mode : Option < SandboxMode > ,
241- #[ serde( alias = "sandbox_workspace_write" ) ]
242227 pub sandbox_workspace_write : Option < SandboxWorkspaceWrite > ,
243- #[ serde( alias = "forced_chatgpt_workspace_id" ) ]
244228 pub forced_chatgpt_workspace_id : Option < String > ,
245- #[ serde( alias = "forced_login_method" ) ]
246229 pub forced_login_method : Option < ForcedLoginMethod > ,
247230 pub tools : Option < ToolsV2 > ,
248231 pub profile : Option < String > ,
249232 #[ serde( default ) ]
250233 pub profiles : HashMap < String , ProfileV2 > ,
251234 pub instructions : Option < String > ,
252- #[ serde( alias = "developer_instructions" ) ]
253235 pub developer_instructions : Option < String > ,
254- #[ serde( alias = "compact_prompt" ) ]
255236 pub compact_prompt : Option < String > ,
256- #[ serde( alias = "model_reasoning_effort" ) ]
257237 pub model_reasoning_effort : Option < ReasoningEffort > ,
258- #[ serde( alias = "model_reasoning_summary" ) ]
259238 pub model_reasoning_summary : Option < ReasoningSummary > ,
260- #[ serde( alias = "model_verbosity" ) ]
261239 pub model_verbosity : Option < Verbosity > ,
262- #[ serde( default , flatten, deserialize_with = "deserialize_additional" ) ]
240+ #[ serde( default , flatten) ]
263241 pub additional : HashMap < String , JsonValue > ,
264242}
265243
@@ -302,38 +280,6 @@ where
302280 . serialize ( serializer)
303281}
304282
305- fn deserialize_additional < ' de , D > ( deserializer : D ) -> Result < HashMap < String , JsonValue > , D :: Error >
306- where
307- D : serde:: Deserializer < ' de > ,
308- {
309- let raw = HashMap :: < String , JsonValue > :: deserialize ( deserializer) ?;
310- Ok ( raw
311- . into_iter ( )
312- . map ( |( key, value) | ( snake_to_camel ( & key) , value) )
313- . collect ( ) )
314- }
315-
316- fn snake_to_camel ( input : & str ) -> String {
317- let mut output = String :: with_capacity ( input. len ( ) ) ;
318- let mut upper_next = false ;
319-
320- for ch in input. chars ( ) {
321- if ch == '_' {
322- upper_next = true ;
323- continue ;
324- }
325-
326- if upper_next {
327- output. push ( ch. to_ascii_uppercase ( ) ) ;
328- upper_next = false ;
329- } else {
330- output. push ( ch) ;
331- }
332- }
333-
334- output
335- }
336-
337283#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
338284#[ serde( rename_all = "camelCase" ) ]
339285#[ ts( export_to = "v2/" ) ]
0 commit comments