The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(settings): restore search panel provider and role sections
Steven Enamakel4638baaf0a4a
diff --git a/app/src/components/settings/panels/SearchPanel.test.tsx b/app/src/components/settings/panels/SearchPanel.test.tsxindex d430caab3c..c00b108e59 100644--- a/app/src/components/settings/panels/SearchPanel.test.tsx+++ b/app/src/components/settings/panels/SearchPanel.test.tsx@@ -180,7 +180,9 @@ beforeEach(() => {describe('SearchPanel — page and on/off', () => {test('renders as a titled page with chip tabs when not embedded', async () => {renderWithProviders(<SearchPanel />);- expect(await screen.findByRole('heading', { name: 'settings.search.title' })).toBeInTheDocument();+ expect(+ await screen.findByRole('heading', { name: 'settings.search.title' })+ ).toBeInTheDocument();expect(screen.getByTestId('search-tab-providers')).toBeInTheDocument();expect(screen.getByTestId('search-tab-routing')).toBeInTheDocument();expect(screen.getByTestId('search-tab-websites')).toBeInTheDocument();@@ -260,9 +262,7 @@ describe('SearchPanel — connected providers', () => {test('with nothing connected the list says so', async () => {hoisted.getSearchSettings.mockResolvedValue({- result: settings({- providers: [provider('exa', { enabled: false }), provider('brave')],- }),+ result: settings({ providers: [provider('exa', { enabled: false }), provider('brave')] }),});await renderPanel();expect(screen.getByTestId('search-connected-empty')).toBeInTheDocument();@@ -308,9 +308,7 @@ describe('SearchPanel — connected providers', () => {test('a direct provider can go back via TinyHumans and drop its key', async () => {hoisted.getSearchSettings.mockResolvedValue({- result: settings({- providers: [provider('exa', { route: 'direct', key_configured: true })],- }),+ result: settings({ providers: [provider('exa', { route: 'direct', key_configured: true })] }),});await renderPanel();expect(screen.getByTestId('search-provider-exa-detail')).toHaveTextContent(@@ -389,7 +387,9 @@ describe('SearchPanel — add a provider', () => {expect(within(direct).getByTestId('search-catalog-searxng')).toBeInTheDocument();expect(screen.queryByTestId('search-catalog-exa')).toBeNull();// Tiles say what each provider can do.- expect(tile('tinyfish')).toHaveTextContent('settings.search.roleSearch · settings.search.roleContents');+ expect(tile('tinyfish')).toHaveTextContent(+ 'settings.search.roleSearch · settings.search.roleContents'+ );});test('a via-TinyHumans tile turns the provider on in one click', async () => {@@ -485,11 +485,7 @@ describe('SearchPanel — local session', () => {hoisted.localSession = true;hoisted.getSearchSettings.mockResolvedValue({result: settings({- providers: [- provider('exa', { enabled: false }),- provider('tinyfish'),- provider('brave'),- ],+ providers: [provider('exa', { enabled: false }), provider('tinyfish'), provider('brave')],}),});await renderPanel();@@ -563,7 +559,9 @@ describe('SearchPanel — routing', () => {test('moving a provider down saves the new order', async () => {await renderPanel('routing');const dialog = await openRole('search');- fireEvent.click(within(dialog).getAllByRole('button', { name: 'settings.search.roleMoveDown' })[0]);+ fireEvent.click(+ within(dialog).getAllByRole('button', { name: 'settings.search.roleMoveDown' })[0]+ );await waitFor(() =>expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({roles: { search: ['brave', 'exa', 'searxng'] },@@ -584,7 +582,9 @@ describe('SearchPanel — routing', () => {test('removing a fallback saves the shorter order; the last one cannot be removed', async () => {await renderPanel('routing');const dialog = await openRole('search');- fireEvent.click(within(dialog).getAllByRole('button', { name: 'settings.search.roleRemove' })[1]);+ fireEvent.click(+ within(dialog).getAllByRole('button', { name: 'settings.search.roleRemove' })[1]+ );await waitFor(() =>expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({roles: { search: ['exa', 'searxng'] },@@ -592,14 +592,25 @@ describe('SearchPanel — routing', () => {);fireEvent.click(screen.getByRole('button', { name: 'common.close' }));const contents = await openRole('contents');- expect(within(contents).getByRole('button', { name: 'settings.search.roleRemove' })).toBeDisabled();+ expect(+ within(contents).getByRole('button', { name: 'settings.search.roleRemove' })+ ).toBeDisabled();});test('a provider not in the order can be added back to the end', async () => {+ hoisted.getSearchSettings.mockResolvedValue({+ result: settings({+ roles: { search: ['exa', 'brave'], answer: ['gemini', 'exa'], contents: ['exa'] },+ }),+ });await renderPanel('routing');- const dialog = await openRole('answer');- fireEvent.click(within(dialog).getByTestId('search-role-answer-add-exa'));- // exa is already in answer; nothing to add there — check contents instead.+ const dialog = await openRole('search');+ fireEvent.click(within(dialog).getByTestId('search-role-search-add-searxng'));+ await waitFor(() =>+ expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({+ roles: { search: ['exa', 'brave', 'searxng'] },+ })+ );});test('reset sends an empty order to restore the default', async () => {@@ -622,7 +633,9 @@ describe('SearchPanel — advanced', () => {});test('turning it off restores role presentation', async () => {- hoisted.getSearchSettings.mockResolvedValue({ result: settings({ presentation: 'all_tools' }) });+ hoisted.getSearchSettings.mockResolvedValue({+ result: settings({ presentation: 'all_tools' }),+ });await renderPanel('routing');fireEvent.click(screen.getByTestId('search-presentation-toggle'));await waitFor(() =>diff --git a/app/src/components/settings/panels/SearchPanel.tsx b/app/src/components/settings/panels/SearchPanel.tsxindex b5ef91566f..67865b3bf1 100644--- a/app/src/components/settings/panels/SearchPanel.tsx+++ b/app/src/components/settings/panels/SearchPanel.tsx@@ -153,9 +153,7 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {saving={saving}savedNote={status.kind === 'saved' ? t('settings.search.statusSaved') : null}error={- status.kind === 'error'- ? `${t('settings.search.statusError')}: ${status.message}`- : null+ status.kind === 'error' ? `${t('settings.search.statusError')}: ${status.message}` : null}savingLabel={t('settings.search.statusSaving')}/>diff --git a/app/src/components/settings/panels/SearchPanelConnectDialog.tsx b/app/src/components/settings/panels/SearchPanelConnectDialog.tsxindex 592a7b3bf3..edeb6dd32e 100644--- a/app/src/components/settings/panels/SearchPanelConnectDialog.tsx+++ b/app/src/components/settings/panels/SearchPanelConnectDialog.tsx@@ -12,10 +12,7 @@ import { ExternalLink } from 'lucide-react';import { useId, useState } from 'react';import { openUrl } from '../../../utils/openUrl';-import type {- SearchProviderInfo,- SearchProviderUpdate,-} from '../../../utils/tauriCommands/config';+import type { SearchProviderInfo, SearchProviderUpdate } from '../../../utils/tauriCommands/config';import Button from '../../ui/Button';import Label from '../../ui/Label';import { ModalShell } from '../../ui/ModalShell';@@ -77,7 +74,11 @@ const SearchPanelConnectDialog = ({if (!canSubmit) return;const patch: SearchProviderUpdate = {};if (mode === 'enable') patch.enabled = true;- if ((mode === 'enable' || switchToDirect) && canUseDirect(provider) && provider.routes.length > 1)+ if (+ (mode === 'enable' || switchToDirect) &&+ canUseDirect(provider) &&+ provider.routes.length > 1+ )patch.route = 'direct';if (showKey && key.trim()) patch.api_key = key.trim();if (showUrl) patch.base_url = url.trim();diff --git a/app/src/components/settings/panels/SearchPanelProviders.tsx b/app/src/components/settings/panels/SearchPanelProviders.tsxindex baa4a38344..9a3d829bdf 100644--- a/app/src/components/settings/panels/SearchPanelProviders.tsx+++ b/app/src/components/settings/panels/SearchPanelProviders.tsx@@ -148,8 +148,7 @@ const SearchPanelProviders = ({const tile = (provider: SearchProviderInfo, detail: string) => {// A provider that only runs via TinyHumans cannot be added while signed out.- const blocked =- !canUseManaged(provider, managedUnavailable) && !canUseDirect(provider);+ const blocked = !canUseManaged(provider, managedUnavailable) && !canUseDirect(provider);return (<buttonkey={provider.id}@@ -195,14 +194,14 @@ const SearchPanelProviders = ({label={provider.label}tone=""swatch={<SearchProviderSwatch id={provider.id} label={provider.label} />}- detail={- <span data-testid={`${testId}-detail`}>{connectedDetail(provider, t)}</span>- }+ detail={<span data-testid={`${testId}-detail`}>{connectedDetail(provider, t)}</span>}detailMono={provider.route === 'direct' && hasBaseUrl(provider)}badge={<>{provider.status !== 'ready' && (- <Badge variant={STATUS_VARIANT[provider.status]} data-testid={`${testId}-status`}>+ <Badge+ variant={STATUS_VARIANT[provider.status]}+ data-testid={`${testId}-status`}>{statusLabel(provider.status, t)}</Badge>)}diff --git a/app/src/components/settings/panels/SearchPanelRoles.tsx b/app/src/components/settings/panels/SearchPanelRoles.tsxindex e307a971ac..afedc2c872 100644--- a/app/src/components/settings/panels/SearchPanelRoles.tsx+++ b/app/src/components/settings/panels/SearchPanelRoles.tsx@@ -22,14 +22,7 @@ import Button from '../../ui/Button';import Card from '../../ui/Card';import { ModalShell } from '../../ui/ModalShell';import Switch from '../../ui/Switch';-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow,-} from '../../ui/Table';+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../ui/Table';import {roleDescription,roleTitle,@@ -59,7 +52,11 @@ interface RoleProps {}/** The configured order for a role, limited to providers that can serve it. */-function roleOrder(role: SearchRole, settings: SearchSettings, byId: Map<string, SearchProviderInfo>) {+function roleOrder(+ role: SearchRole,+ settings: SearchSettings,+ byId: Map<string, SearchProviderInfo>+) {return (settings.roles[role] ?? []).filter(id => byId.get(id)?.roles.includes(role));}diff --git a/app/src/components/settings/panels/searchPanelShared.tsx b/app/src/components/settings/panels/searchPanelShared.tsxindex d8fb47f09a..82626f762b 100644--- a/app/src/components/settings/panels/searchPanelShared.tsx+++ b/app/src/components/settings/panels/searchPanelShared.tsx@@ -81,8 +81,7 @@ export const hasBaseUrl = (provider: SearchProviderInfo) => provider.base_url !=* a key it has not got, or an instance URL that is empty.*/export const directNeedsSetup = (provider: SearchProviderInfo) =>- (provider.takes_key && !provider.key_configured) ||- (hasBaseUrl(provider) && !provider.base_url);+ (provider.takes_key && !provider.key_configured) || (hasBaseUrl(provider) && !provider.base_url);const SWATCH_ICONS: Record<string, IconType> = {gemini: SiGooglegemini,