@@ -167,21 +167,23 @@ pub enum ConfigLayerName {
167167#[ serde( rename_all = "camelCase" ) ]
168168#[ ts( export_to = "v2/" ) ]
169169pub struct SandboxWorkspaceWrite {
170- #[ serde( default ) ]
170+ #[ serde( default , alias = "writable_roots" ) ]
171171 pub writable_roots : Vec < PathBuf > ,
172- #[ serde( default ) ]
172+ #[ serde( default , alias = "network_access" ) ]
173173 pub network_access : bool ,
174- #[ serde( default ) ]
174+ #[ serde( default , alias = "exclude_tmpdir_env_var" ) ]
175175 pub exclude_tmpdir_env_var : bool ,
176- #[ serde( default ) ]
176+ #[ serde( default , alias = "exclude_slash_tmp" ) ]
177177 pub exclude_slash_tmp : bool ,
178178}
179179
180180#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
181181#[ serde( rename_all = "camelCase" ) ]
182182#[ ts( export_to = "v2/" ) ]
183183pub struct ToolsV2 {
184+ #[ serde( alias = "web_search" ) ]
184185 pub web_search : Option < bool > ,
186+ #[ serde( alias = "view_image" ) ]
185187 pub view_image : Option < bool > ,
186188}
187189
@@ -190,16 +192,22 @@ pub struct ToolsV2 {
190192#[ ts( export_to = "v2/" ) ]
191193pub struct ProfileV2 {
192194 pub model : Option < String > ,
195+ #[ serde( alias = "model_provider" ) ]
193196 pub model_provider : Option < String > ,
194197 #[ serde(
195198 default ,
196199 deserialize_with = "deserialize_approval_policy" ,
197- serialize_with = "serialize_approval_policy"
200+ serialize_with = "serialize_approval_policy" ,
201+ alias = "approval_policy"
198202 ) ]
199203 pub approval_policy : Option < AskForApproval > ,
204+ #[ serde( alias = "model_reasoning_effort" ) ]
200205 pub model_reasoning_effort : Option < ReasoningEffort > ,
206+ #[ serde( alias = "model_reasoning_summary" ) ]
201207 pub model_reasoning_summary : Option < ReasoningSummary > ,
208+ #[ serde( alias = "model_verbosity" ) ]
202209 pub model_verbosity : Option < Verbosity > ,
210+ #[ serde( alias = "chatgpt_base_url" ) ]
203211 pub chatgpt_base_url : Option < String > ,
204212}
205213
@@ -208,36 +216,50 @@ pub struct ProfileV2 {
208216#[ ts( export_to = "v2/" ) ]
209217pub struct Config {
210218 pub model : Option < String > ,
219+ #[ serde( alias = "review_model" ) ]
211220 pub review_model : Option < String > ,
221+ #[ serde( alias = "model_context_window" ) ]
212222 pub model_context_window : Option < i64 > ,
223+ #[ serde( alias = "model_auto_compact_token_limit" ) ]
213224 pub model_auto_compact_token_limit : Option < i64 > ,
225+ #[ serde( alias = "model_provider" ) ]
214226 pub model_provider : Option < String > ,
215227 #[ serde(
216228 default ,
217229 deserialize_with = "deserialize_approval_policy" ,
218- serialize_with = "serialize_approval_policy"
230+ serialize_with = "serialize_approval_policy" ,
231+ alias = "approval_policy"
219232 ) ]
220233 pub approval_policy : Option < AskForApproval > ,
221234 #[ serde(
222235 default ,
223236 deserialize_with = "deserialize_sandbox_mode" ,
224- serialize_with = "serialize_sandbox_mode"
237+ serialize_with = "serialize_sandbox_mode" ,
238+ alias = "sandbox_mode"
225239 ) ]
226240 pub sandbox_mode : Option < SandboxMode > ,
241+ #[ serde( alias = "sandbox_workspace_write" ) ]
227242 pub sandbox_workspace_write : Option < SandboxWorkspaceWrite > ,
243+ #[ serde( alias = "forced_chatgpt_workspace_id" ) ]
228244 pub forced_chatgpt_workspace_id : Option < String > ,
245+ #[ serde( alias = "forced_login_method" ) ]
229246 pub forced_login_method : Option < ForcedLoginMethod > ,
230247 pub tools : Option < ToolsV2 > ,
231248 pub profile : Option < String > ,
232249 #[ serde( default ) ]
233250 pub profiles : HashMap < String , ProfileV2 > ,
234251 pub instructions : Option < String > ,
252+ #[ serde( alias = "developer_instructions" ) ]
235253 pub developer_instructions : Option < String > ,
254+ #[ serde( alias = "compact_prompt" ) ]
236255 pub compact_prompt : Option < String > ,
256+ #[ serde( alias = "model_reasoning_effort" ) ]
237257 pub model_reasoning_effort : Option < ReasoningEffort > ,
258+ #[ serde( alias = "model_reasoning_summary" ) ]
238259 pub model_reasoning_summary : Option < ReasoningSummary > ,
260+ #[ serde( alias = "model_verbosity" ) ]
239261 pub model_verbosity : Option < Verbosity > ,
240- #[ serde( default , flatten) ]
262+ #[ serde( default , flatten, deserialize_with = "deserialize_additional" ) ]
241263 pub additional : HashMap < String , JsonValue > ,
242264}
243265
@@ -280,6 +302,38 @@ where
280302 . serialize ( serializer)
281303}
282304
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+
283337#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
284338#[ serde( rename_all = "camelCase" ) ]
285339#[ ts( export_to = "v2/" ) ]
@@ -1835,7 +1889,7 @@ mod tests {
18351889
18361890 assert_eq ! (
18371891 config. tools,
1838- Some ( Tools {
1892+ Some ( ToolsV2 {
18391893 web_search: Some ( true ) ,
18401894 view_image: Some ( false ) ,
18411895 } )
0 commit comments