diff --git a/ui/desktop/src/components/settings/extensions/extension-manager.test.ts b/ui/desktop/src/components/settings/extensions/extension-manager.test.ts index 2c187ed37856..7310eb038e5c 100644 --- a/ui/desktop/src/components/settings/extensions/extension-manager.test.ts +++ b/ui/desktop/src/components/settings/extensions/extension-manager.test.ts @@ -96,6 +96,19 @@ describe('Extension Manager', () => { expect(mockAddToConfig).not.toHaveBeenCalled(); }); + it('should successfully add extension on startup with custom toast options', async () => { + mockAddToAgent.mockResolvedValue({} as Response); + + await addToAgentOnStartup({ + addToConfig: mockAddToConfig, + extensionConfig: mockExtensionConfig, + toastOptions: { silent: false }, + }); + + expect(mockAddToAgent).toHaveBeenCalledWith(mockExtensionConfig, { silent: false }); + expect(mockAddToConfig).not.toHaveBeenCalled(); + }); + it('should retry on 428 errors', async () => { const error428 = new Error('428 Precondition Required'); mockAddToAgent diff --git a/ui/desktop/src/components/settings/extensions/extension-manager.ts b/ui/desktop/src/components/settings/extensions/extension-manager.ts index 3f97af174f4e..3a1cdb538dcf 100644 --- a/ui/desktop/src/components/settings/extensions/extension-manager.ts +++ b/ui/desktop/src/components/settings/extensions/extension-manager.ts @@ -86,6 +86,7 @@ export async function activateExtension({ interface AddToAgentOnStartupProps { addToConfig: (name: string, extensionConfig: ExtensionConfig, enabled: boolean) => Promise; extensionConfig: ExtensionConfig; + toastOptions?: ToastServiceOptions; } /** @@ -94,9 +95,10 @@ interface AddToAgentOnStartupProps { export async function addToAgentOnStartup({ addToConfig, extensionConfig, + toastOptions = { silent: true }, }: AddToAgentOnStartupProps): Promise { try { - await retryWithBackoff(() => addToAgent(extensionConfig, { silent: true }), { + await retryWithBackoff(() => addToAgent(extensionConfig, toastOptions), { retries: 3, delayMs: 1000, shouldRetry: (error: ExtensionError) => diff --git a/ui/desktop/src/utils/providerUtils.ts b/ui/desktop/src/utils/providerUtils.ts index 53ea383579d1..cdcbac182c28 100644 --- a/ui/desktop/src/utils/providerUtils.ts +++ b/ui/desktop/src/utils/providerUtils.ts @@ -187,7 +187,11 @@ export const initializeSystem = async ( const extensionName = extensionConfig.name; try { - await addToAgentOnStartup({ addToConfig: options.addExtension!, extensionConfig }); + await addToAgentOnStartup({ + addToConfig: options.addExtension!, + extensionConfig, + toastOptions: { silent: false }, + }); } catch (error) { console.error(`Failed to load extension ${extensionName}:`, error); }