@@ -508,6 +508,14 @@ export class ConfigPresenter implements IConfigPresenter {
508508 setModelStatus : this . modelStatusHelper . setModelStatus . bind ( this . modelStatusHelper ) ,
509509 deleteModelStatus : this . modelStatusHelper . deleteModelStatus . bind ( this . modelStatusHelper )
510510 } )
511+ this . providerHelper . setCleanupHooks ( {
512+ deleteProviderModelStatuses : this . modelStatusHelper . deleteProviderModelStatuses . bind (
513+ this . modelStatusHelper
514+ ) ,
515+ clearProviderModelStore : this . providerModelHelper . clearProviderModelStore . bind (
516+ this . providerModelHelper
517+ )
518+ } )
511519
512520 // Initialize built-in ACP agents on first run or version upgrade
513521 // Initialize provider models directory
@@ -1989,15 +1997,15 @@ export class ConfigPresenter implements IConfigPresenter {
19891997 error : null
19901998 }
19911999 this . getAgentRepositoryOrThrow ( ) . setAgentInstallState ( registryAgent . id , installingState )
1992- this . notifyAcpAgentsChanged ( )
2000+ this . notifyAcpAgentsChanged ( [ registryAgent . id ] )
19932001
19942002 try {
19952003 const installedState = await this . acpLaunchSpecService . ensureRegistryAgentInstalled (
19962004 registryAgent ,
19972005 currentState
19982006 )
19992007 this . getAgentRepositoryOrThrow ( ) . setAgentInstallState ( registryAgent . id , installedState )
2000- this . notifyAcpAgentsChanged ( )
2008+ this . handleAcpAgentsMutated ( [ registryAgent . id ] )
20012009 return installedState
20022010 } catch ( error ) {
20032011 const failedState : AcpAgentInstallState = {
@@ -2011,7 +2019,7 @@ export class ConfigPresenter implements IConfigPresenter {
20112019 error : error instanceof Error ? error . message : String ( error )
20122020 }
20132021 this . getAgentRepositoryOrThrow ( ) . setAgentInstallState ( registryAgent . id , failedState )
2014- this . notifyAcpAgentsChanged ( )
2022+ this . notifyAcpAgentsChanged ( [ registryAgent . id ] )
20152023 throw error
20162024 }
20172025 }
@@ -2030,7 +2038,7 @@ export class ConfigPresenter implements IConfigPresenter {
20302038 error : null
20312039 }
20322040 this . getAgentRepositoryOrThrow ( ) . setAgentInstallState ( registryAgent . id , repairingState )
2033- this . notifyAcpAgentsChanged ( )
2041+ this . notifyAcpAgentsChanged ( [ registryAgent . id ] )
20342042
20352043 try {
20362044 const installedState = await this . acpLaunchSpecService . ensureRegistryAgentInstalled (
@@ -2053,7 +2061,7 @@ export class ConfigPresenter implements IConfigPresenter {
20532061 error : error instanceof Error ? error . message : String ( error )
20542062 }
20552063 this . getAgentRepositoryOrThrow ( ) . setAgentInstallState ( registryAgent . id , failedState )
2056- this . notifyAcpAgentsChanged ( )
2064+ this . notifyAcpAgentsChanged ( [ registryAgent . id ] )
20572065 throw error
20582066 }
20592067 }
@@ -2301,7 +2309,7 @@ export class ConfigPresenter implements IConfigPresenter {
23012309
23022310 private handleAcpAgentsMutated ( agentIds ?: string [ ] ) {
23032311 this . clearProviderModelStatusCache ( 'acp' )
2304- this . notifyAcpAgentsChanged ( )
2312+ this . notifyAcpAgentsChanged ( agentIds )
23052313 this . refreshAcpProviderAgents ( agentIds )
23062314 }
23072315
@@ -2323,10 +2331,10 @@ export class ConfigPresenter implements IConfigPresenter {
23232331 }
23242332 }
23252333
2326- private notifyAcpAgentsChanged ( ) {
2334+ private notifyAcpAgentsChanged ( agentIds ?: string [ ] ) {
23272335 console . log ( '[ACP] notifyAcpAgentsChanged: sending MODEL_LIST_CHANGED event for provider "acp"' )
23282336 eventBus . send ( CONFIG_EVENTS . MODEL_LIST_CHANGED , SendTarget . ALL_WINDOWS , 'acp' )
2329- eventBus . send ( CONFIG_EVENTS . AGENTS_CHANGED , SendTarget . ALL_WINDOWS )
2337+ eventBus . send ( CONFIG_EVENTS . AGENTS_CHANGED , SendTarget . ALL_WINDOWS , { agentIds } )
23302338 eventBus . sendToRenderer ( SESSION_EVENTS . LIST_UPDATED , SendTarget . ALL_WINDOWS )
23312339 }
23322340
0 commit comments