@@ -33,15 +33,27 @@ export const upsert_configuration = async (params: {
3333
3434 let get_configs : ( ) => Promise < ToolConfig [ ] >
3535 let save_configs : ( configs : ToolConfig [ ] ) => Promise < void >
36+ let get_default_config : ( ( ) => Promise < ToolConfig | undefined > ) | undefined
37+ let set_default_config :
38+ | ( ( config : ToolConfig | null ) => Promise < void > )
39+ | undefined
3640
3741 if ( params . tool_type == 'code-at-cursor' ) {
3842 get_configs = ( ) => providers_manager . get_code_completions_tool_configs ( )
3943 save_configs = ( configs ) =>
4044 providers_manager . save_code_completions_tool_configs ( configs )
45+ get_default_config = ( ) =>
46+ providers_manager . get_default_code_completions_config ( )
47+ set_default_config = ( c ) =>
48+ providers_manager . set_default_code_completions_config ( c )
4149 } else if ( params . tool_type == 'commit-messages' ) {
4250 get_configs = ( ) => providers_manager . get_commit_messages_tool_configs ( )
4351 save_configs = ( configs ) =>
4452 providers_manager . save_commit_messages_tool_configs ( configs )
53+ get_default_config = ( ) =>
54+ providers_manager . get_default_commit_messages_config ( )
55+ set_default_config = ( c ) =>
56+ providers_manager . set_default_commit_messages_config ( c )
4557 } else if ( params . tool_type == 'edit-context' ) {
4658 get_configs = ( ) => providers_manager . get_edit_context_tool_configs ( )
4759 save_configs = ( configs ) =>
@@ -50,14 +62,26 @@ export const upsert_configuration = async (params: {
5062 get_configs = ( ) => providers_manager . get_intelligent_update_tool_configs ( )
5163 save_configs = ( configs ) =>
5264 providers_manager . save_intelligent_update_tool_configs ( configs )
65+ get_default_config = ( ) =>
66+ providers_manager . get_default_intelligent_update_config ( )
67+ set_default_config = ( c ) =>
68+ providers_manager . set_default_intelligent_update_config ( c )
5369 } else if ( params . tool_type == 'find-relevant-files' ) {
5470 get_configs = ( ) => providers_manager . get_find_relevant_files_tool_configs ( )
5571 save_configs = ( configs ) =>
5672 providers_manager . save_find_relevant_files_tool_configs ( configs )
73+ get_default_config = ( ) =>
74+ providers_manager . get_default_find_relevant_files_config ( )
75+ set_default_config = ( c ) =>
76+ providers_manager . set_default_find_relevant_files_config ( c )
5777 } else if ( params . tool_type == 'voice-input' ) {
5878 get_configs = ( ) => providers_manager . get_voice_input_tool_configs ( )
5979 save_configs = ( configs ) =>
6080 providers_manager . save_voice_input_tool_configs ( configs )
81+ get_default_config = ( ) =>
82+ providers_manager . get_default_voice_input_config ( )
83+ set_default_config = ( c ) =>
84+ providers_manager . set_default_voice_input_config ( c )
6185 } else {
6286 throw new Error ( `Unknown tool type: ${ params . tool_type } ` )
6387 }
@@ -115,6 +139,7 @@ export const upsert_configuration = async (params: {
115139
116140 let config_to_edit : ToolConfig
117141 let original_id : string | undefined
142+ let was_default = false
118143
119144 if ( params . configuration_id || params . duplicate_from_id ) {
120145 const target_id = params . configuration_id || params . duplicate_from_id
@@ -132,6 +157,12 @@ export const upsert_configuration = async (params: {
132157 config_to_edit = { ...configs [ config_index ] }
133158 if ( params . configuration_id ) {
134159 original_id = params . configuration_id
160+ if ( get_default_config ) {
161+ const def_config = await get_default_config ( )
162+ if ( def_config && get_tool_config_id ( def_config ) === original_id ) {
163+ was_default = true
164+ }
165+ }
135166 } else if ( params . duplicate_from_id ) {
136167 actual_insertion_index = config_index + 1
137168 }
@@ -521,6 +552,10 @@ export const upsert_configuration = async (params: {
521552 }
522553
523554 await save_configs ( configs )
555+
556+ if ( was_default && set_default_config ) {
557+ await set_default_config ( updated_config )
558+ }
524559}
525560
526561const verify_reasoning_effort = async ( params : {
0 commit comments