Extensions loading indicator on desktop launch (#4412)

This commit is contained in:
Amed Rodriguez
2025-08-29 10:39:11 -07:00
committed by GitHub
parent f57fdd1591
commit 5331a71344
3 changed files with 21 additions and 2 deletions
@@ -96,6 +96,19 @@ describe('Extension Manager', () => {
expect(mockAddToConfig).not.toHaveBeenCalled(); 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 () => { it('should retry on 428 errors', async () => {
const error428 = new Error('428 Precondition Required'); const error428 = new Error('428 Precondition Required');
mockAddToAgent mockAddToAgent
@@ -86,6 +86,7 @@ export async function activateExtension({
interface AddToAgentOnStartupProps { interface AddToAgentOnStartupProps {
addToConfig: (name: string, extensionConfig: ExtensionConfig, enabled: boolean) => Promise<void>; addToConfig: (name: string, extensionConfig: ExtensionConfig, enabled: boolean) => Promise<void>;
extensionConfig: ExtensionConfig; extensionConfig: ExtensionConfig;
toastOptions?: ToastServiceOptions;
} }
/** /**
@@ -94,9 +95,10 @@ interface AddToAgentOnStartupProps {
export async function addToAgentOnStartup({ export async function addToAgentOnStartup({
addToConfig, addToConfig,
extensionConfig, extensionConfig,
toastOptions = { silent: true },
}: AddToAgentOnStartupProps): Promise<void> { }: AddToAgentOnStartupProps): Promise<void> {
try { try {
await retryWithBackoff(() => addToAgent(extensionConfig, { silent: true }), { await retryWithBackoff(() => addToAgent(extensionConfig, toastOptions), {
retries: 3, retries: 3,
delayMs: 1000, delayMs: 1000,
shouldRetry: (error: ExtensionError) => shouldRetry: (error: ExtensionError) =>
+5 -1
View File
@@ -187,7 +187,11 @@ export const initializeSystem = async (
const extensionName = extensionConfig.name; const extensionName = extensionConfig.name;
try { try {
await addToAgentOnStartup({ addToConfig: options.addExtension!, extensionConfig }); await addToAgentOnStartup({
addToConfig: options.addExtension!,
extensionConfig,
toastOptions: { silent: false },
});
} catch (error) { } catch (error) {
console.error(`Failed to load extension ${extensionName}:`, error); console.error(`Failed to load extension ${extensionName}:`, error);
} }