Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function activateExtension({
interface AddToAgentOnStartupProps {
addToConfig: (name: string, extensionConfig: ExtensionConfig, enabled: boolean) => Promise<void>;
extensionConfig: ExtensionConfig;
toastOptions?: ToastServiceOptions;
}

/**
Expand All @@ -94,9 +95,10 @@ interface AddToAgentOnStartupProps {
export async function addToAgentOnStartup({
addToConfig,
extensionConfig,
toastOptions = { silent: true },
}: AddToAgentOnStartupProps): Promise<void> {
try {
await retryWithBackoff(() => addToAgent(extensionConfig, { silent: true }), {
await retryWithBackoff(() => addToAgent(extensionConfig, toastOptions), {
retries: 3,
delayMs: 1000,
shouldRetry: (error: ExtensionError) =>
Expand Down
6 changes: 5 additions & 1 deletion ui/desktop/src/utils/providerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down