Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(agent): preload web browsing tool and move tools picker to working sidebar (#23623)

AmAzing-ab21e0df0ded
diff --git a/apps/server/src/services/aiAgent/pipeline/__tests__/toolDiscovery.installedPlugins.test.ts b/apps/server/src/services/aiAgent/pipeline/__tests__/toolDiscovery.installedPlugins.test.ts
index 1a1adeb52bc..72ee0f88fac 100644
--- a/apps/server/src/services/aiAgent/pipeline/__tests__/toolDiscovery.installedPlugins.test.ts
+++ b/apps/server/src/services/aiAgent/pipeline/__tests__/toolDiscovery.installedPlugins.test.ts
@@ -150,26 +150,53 @@ const MANUAL = { chatConfig: { skillActivateMode: 'manual' } };
describe('Agent first-turn tool payload', () => {
it.each([
- { expected: ['lobe-user-memory', 'lobe-web-browsing'], memory: true, search: true },
- { expected: ['lobe-user-memory'], memory: true, search: false },
- { expected: ['lobe-web-browsing'], memory: false, search: true },
- { expected: [], memory: false, search: false },
+ {
+ discoverable: ['lobe-user-memory'],
+ enabled: ['lobe-activator', 'lobe-skills', 'lobe-web-browsing'],
+ explicitlyActivatable: ['lobe-user-memory', 'lobe-web-browsing'],
+ memory: true,
+ offeredCount: 9,
+ search: true,
+ },
+ {
+ discoverable: ['lobe-user-memory'],
+ enabled: ['lobe-activator', 'lobe-skills'],
+ explicitlyActivatable: ['lobe-user-memory'],
+ memory: true,
+ offeredCount: 6,
+ search: false,
+ },
+ {
+ discoverable: [],
+ enabled: ['lobe-activator', 'lobe-skills', 'lobe-web-browsing'],
+ explicitlyActivatable: ['lobe-web-browsing'],
+ memory: false,
+ offeredCount: 9,
+ search: true,
+ },
+ {
+ discoverable: [],
+ enabled: ['lobe-activator', 'lobe-skills'],
+ explicitlyActivatable: [],
+ memory: false,
+ offeredCount: 6,
+ search: false,
+ },
])(
- 'only lists available capabilities (memory=$memory, search=$search)',
- async ({ expected, memory, search }) => {
+ 'preloads web browsing when enabled and defers other available capabilities (memory=$memory, search=$search)',
+ async ({ discoverable, enabled, explicitlyActivatable, memory, offeredCount, search }) => {
const result = await run({
chatConfig: { searchMode: search ? 'auto' : 'off' },
memoryEnabled: memory,
});
- const loaders = ['lobe-activator', 'lobe-skills'];
const capabilities = ['lobe-user-memory', 'lobe-web-browsing'];
- expect(result.toolsResult.enabledToolIds.toSorted()).toEqual(loaders);
- expect(offeredToolNames(result)).toHaveLength(6);
+ expect(result.toolsResult.enabledToolIds.toSorted()).toEqual(enabled);
+ expect(offeredToolNames(result)).toHaveLength(offeredCount);
expect(
- availableToolIds(result.toolManifestMap, loaders)
+ availableToolIds(result.toolManifestMap, result.toolsResult.enabledToolIds)
.filter((id) => capabilities.includes(id))
.toSorted(),
- ).toEqual(expected);
+ ).toEqual(discoverable);
const activated = result.toolsEngine!.generateToolsDetailed({
context: { isExplicitActivation: true },
model: 'test-model',
@@ -184,7 +211,7 @@ describe('Agent first-turn tool payload', () => {
'lobe-mcp-events',
],
});
- expect(activated.enabledToolIds.toSorted()).toEqual(expected);
+ expect(activated.enabledToolIds.toSorted()).toEqual(explicitlyActivatable);
},
);
});
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 5913e7eeed5..af7a8392c9c 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -2703,8 +2703,6 @@
"tools.connectorPolicy.updateFailed": "Couldn't update who can manage connectors. Please try again.",
"tools.legacyConnector.configure": "Configure",
"tools.legacyConnector.upgradeDesc": "This connector still uses the legacy plugin format. Configure it to finish upgrading, then manage its tool permissions here.",
- "tools.loading.never": "Never load",
- "tools.loading.onDemand": "Load on demand",
"tools.lobehubSkill.authorize": "Authorize",
"tools.lobehubSkill.connect": "Connect",
"tools.lobehubSkill.connected": "Connected",
@@ -2735,6 +2733,8 @@
"tools.picker.management": "Manage tools",
"tools.picker.noMatches": "No matching tools",
"tools.picker.search": "Search tools…",
+ "tools.picker.section.builtin": "Built-in",
+ "tools.picker.section.connected": "Connected apps",
"tools.picker.title": "Tools",
"tools.plugins.enabled": "Enabled: {{num}}",
"tools.plugins.groupName": "Skills",
@@ -2745,6 +2745,8 @@
"tools.privateConnector.tooltip": "Your private connector: only you can see it, and only your private agents load it.",
"tools.search": "Search skills...",
"tools.skillActivateMode.title": "Activate Mode",
+ "tools.status.disabled": "Disabled",
+ "tools.status.enabled": "Enabled",
"tools.tabs.all": "All",
"tools.tabs.installed": "Enabled",
"tools.title": "Skills",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 832b47b68da..bb4c5b4c68f 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -2703,8 +2703,6 @@
"tools.connectorPolicy.updateFailed": "没能更新连接器管理权限,请重试",
"tools.legacyConnector.configure": "配置",
"tools.legacyConnector.upgradeDesc": "此连接器仍在使用旧的插件格式。点击「配置」完成升级后,即可在此管理它的工具权限。",
- "tools.loading.never": "不加载",
- "tools.loading.onDemand": "按需加载",
"tools.lobehubSkill.authorize": "授权",
"tools.lobehubSkill.connect": "连接",
"tools.lobehubSkill.connected": "已连接",
@@ -2735,6 +2733,8 @@
"tools.picker.management": "工具管理",
"tools.picker.noMatches": "未找到匹配的工具",
"tools.picker.search": "搜索工具…",
+ "tools.picker.section.builtin": "内置工具",
+ "tools.picker.section.connected": "已连接的应用",
"tools.picker.title": "工具",
"tools.plugins.enabled": "已启用 {{num}}",
"tools.plugins.groupName": "三方技能",
@@ -2745,6 +2745,8 @@
"tools.privateConnector.tooltip": "你的私人连接器:只有你能看到,也只有你的私人助理会加载它。",
"tools.search": "搜索技能...",
"tools.skillActivateMode.title": "激活方式",
+ "tools.status.disabled": "已禁用",
+ "tools.status.enabled": "已启用",
"tools.tabs.all": "全部",
"tools.tabs.installed": "已启用",
"tools.title": "技能",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index b5cc3b6b865..2e6fb6633e5 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -4769,6 +4769,8 @@ When I am ___, I need ___
'tools.picker.emptyGroup': 'No tools in this group',
'tools.picker.noMatches': 'No matching tools',
'tools.picker.search': 'Search tools…',
+ 'tools.picker.section.builtin': 'Built-in',
+ 'tools.picker.section.connected': 'Connected apps',
'tools.picker.title': 'Tools',
'tools.plugins.enabled': 'Enabled: {{num}}',
'tools.plugins.groupName': 'Skills',
@@ -4779,8 +4781,8 @@ When I am ___, I need ___
'tools.privateConnector.tooltip':
'Your private connector: only you can see it, and only your private agents load it.',
'tools.search': 'Search skills...',
- 'tools.loading.onDemand': 'Load on demand',
- 'tools.loading.never': 'Never load',
+ 'tools.status.disabled': 'Disabled',
+ 'tools.status.enabled': 'Enabled',
'tools.skillActivateMode.title': 'Activate Mode',
'tools.tabs.all': 'All',
'tools.tabs.installed': 'Enabled',
diff --git a/packages/mecha/src/toolSet/discoveryPool.test.ts b/packages/mecha/src/toolSet/discoveryPool.test.ts
index 135dce9f06c..2416bf948ea 100644
--- a/packages/mecha/src/toolSet/discoveryPool.test.ts
+++ b/packages/mecha/src/toolSet/discoveryPool.test.ts
@@ -12,6 +12,7 @@ import { describe, expect, it } from 'vitest';
import {
type DiscoveryPoolRequest,
+ initialToolSelection,
resolveClientExecutors,
resolveDiscoveryPool,
resolveInvocationToolIds,
@@ -67,6 +68,37 @@ describe('resolveInvocationToolIds', () => {
});
});
+describe('initialToolSelection', () => {
+ it('keeps lobe-web-browsing preloaded while deferring other runtime capabilities in agent mode', () => {
+ const selection = initialToolSelection(
+ ['lobe-web-browsing', 'lobe-user-memory', CloudSandboxManifest.identifier, 'my-plugin'],
+ { enableAgentMode: true },
+ );
+
+ expect(selection.excludeDefaultToolIds).not.toContain('lobe-web-browsing');
+ expect(selection.excludeDefaultToolIds).toContain('lobe-user-memory');
+ expect(selection.excludeDefaultToolIds).toContain(CloudSandboxManifest.identifier);
+ expect(selection.toolIds).toEqual(['lobe-web-browsing', 'my-plugin']);
+ });
+
+ it('does not defer capabilities in chat mode or when skipDefaultTools is true', () => {
+ const chatSelection = initialToolSelection(['lobe-web-browsing', 'lobe-user-memory'], {
+ enableAgentMode: false,
+ });
+ expect(chatSelection.excludeDefaultToolIds).toBeUndefined();
+ expect(chatSelection.toolIds).toEqual(['lobe-web-browsing', 'lobe-user-memory']);
+
+ const exclusiveSelection = initialToolSelection(
+ ['lobe-web-browsing', 'lobe-user-memory'],
+ { enableAgentMode: true },
+ true,
+ );
+ expect(exclusiveSelection.excludeDefaultToolIds).toBeUndefined();
+ expect(exclusiveSelection.skipDefaultTools).toBe(true);
+ expect(exclusiveSelection.toolIds).toEqual(['lobe-web-browsing', 'lobe-user-memory']);
+ });
+});
+
describe('resolveDiscoveryPool', () => {
it.each([
['lobe-agent', 'createTodos'],
diff --git a/packages/mecha/src/toolSet/discoveryPool.ts b/packages/mecha/src/toolSet/discoveryPool.ts
index 8cecbea9c3f..1198aa27828 100644
--- a/packages/mecha/src/toolSet/discoveryPool.ts
+++ b/packages/mecha/src/toolSet/discoveryPool.ts
@@ -2,6 +2,7 @@ import { AuvManifest } from '@lobechat/builtin-tool-auv';
import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
import { RemoteDeviceManifest } from '@lobechat/builtin-tool-remote-device';
+import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';
import { runtimeManagedToolIds } from '@lobechat/builtin-tools';
import type { GenerateToolsParams, LobeToolManifest } from '@lobechat/context-engine';
import {
@@ -52,19 +53,35 @@ export const resolveInvocationToolIds = (request: InvocationToolIdsRequest): str
];
};
-/** Build the initial invocation set. Subsequent explicit activations use the full eligible pool. */
+/**
+ * Build the initial invocation set. Subsequent explicit activations use the full eligible pool.
+ *
+ * `lobe-web-browsing` stays preloaded whenever search is enabled: it is the
+ * highest-frequency tool in general conversations, its slimmed footprint is small,
+ * and deferring it forces an extra activation round-trip plus a prompt-cache wipe
+ * on providers that lack mid-conversation tool additions. Turning search off still
+ * removes it completely via `resolveToolRules` (`runtimeManagedToolIds`).
+ */
export const initialToolSelection = (
toolIds: string[] | undefined,
chatConfig?: Pick<LobeAgentChatConfig, 'enableAgentMode' | 'toolMode'> | null,
skipDefaultTools?: boolean,
): Pick<GenerateToolsParams, 'toolIds' | 'excludeDefaultToolIds' | 'skipDefaultTools'> => {
const deferCapabilities = !skipDefaultTools && resolveToolMode(chatConfig) === 'agent';
+ if (!deferCapabilities) {
+ return {
+ excludeDefaultToolIds: undefined,
+ skipDefaultTools: skipDefaultTools || undefined,
+ toolIds,
+ };
+ }
+ const deferredRuntimeToolIds = runtimeManagedToolIds.filter(
+ (id) => id !== WebBrowsingManifest.identifier,
+ );
return {
- excludeDefaultToolIds: deferCapabilities ? runtimeManagedToolIds : undefined,
- skipDefaultTools: skipDefaultTools || undefined,
- toolIds: deferCapabilities
- ? toolIds?.filter((id) => !runtimeManagedToolIds.includes(id))
- : toolIds,
+ excludeDefaultToolIds: deferredRuntimeToolIds,
+ skipDefaultTools: undefined,
+ toolIds: toolIds?.filter((id) => !deferredRuntimeToolIds.includes(id)),
};
};
diff --git a/src/features/ChatInput/ActionBar/Memory/Controls.tsx b/src/features/ChatInput/ActionBar/Memory/Controls.tsx
index b7728ed8d89..10aa401dd3a 100644
--- a/src/features/ChatInput/ActionBar/Memory/Controls.tsx
+++ b/src/features/ChatInput/ActionBar/Memory/Controls.tsx
@@ -96,7 +96,7 @@ const ToggleItem = memo<ToggleOption>(({ value, description, icon, label }) => {
* separator above itself and disappears entirely while memory is off, so a host
* panel never ends up with a divider that separates nothing.
*/
-export const MemoryEffortControl = memo(() => {
+export const MemoryEffortControl = memo<{ showDivider?: boolean }>(({ showDivider = true }) => {
const { t } = useTranslation('chat');
const agentId = useAgentId();
const { updateAgentChatConfig } = useUpdateAgentConfig();
@@ -108,7 +108,7 @@ export const MemoryEffortControl = memo(() => {
return (
<>
- <Divider style={{ margin: 0 }} />
+ {showDivider && <Divider style={{ margin: 0 }} />}
<Flexbox horizontal align={'center'} gap={16} padding={8}>
<Flexbox flex={1} gap={4} style={{ minWidth: 100 }}>
<div {...stylex.props(styles.title)}>{t('memory.effort.title')}</div>
diff --git a/src/features/ChatInput/ActionBar/Plus/index.tsx b/src/features/ChatInput/ActionBar/Plus/index.tsx
index 15043c81af0..e84acae16d2 100644
--- a/src/features/ChatInput/ActionBar/Plus/index.tsx
+++ b/src/features/ChatInput/ActionBar/Plus/index.tsx
@@ -1,7 +1,7 @@
'use client';
import { validateVideoFileSize } from '@lobechat/utils/client';
-import { Icon, Popover, toast, Upload } from '@lobehub/ui';
+import { Icon, toast, Upload } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import {
@@ -12,11 +12,10 @@ import {
Settings2Icon,
TargetIcon,
TypeIcon,
- WrenchIcon,
} from 'lucide-react';
-import type { ReactNode } from 'react';
-import { memo, Suspense, useCallback, useMemo, useRef } from 'react';
+import { memo, Suspense, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { useInRouterContext, useLocation } from 'react-router';
import { openAttachKnowledgeModal } from '@/features/LibraryModal';
import { useMediaUploadAbility } from '@/hooks/useMediaUploadAbility';
@@ -39,10 +38,10 @@ import { useChatInputStore } from '../../store';
import { type ActionDropdownMenuItems } from '../components/ActionDropdown';
import { ChatInputAction } from '../components/ChatInputAction';
import SubmenuChevron from '../components/SubmenuChevron';
-import { useDetailPopoverState } from '../components/useDetailPopoverState';
import { useControls as useKnowledgeControls } from '../Knowledge/useControls';
-import { useControls as useToolsControls } from '../Tools/useControls';
+import { usePopupToolsMenuItem } from './usePopupToolsMenuItem';
import { useSkillsMenuItem } from './useSkillsMenuItem';
+import { useToolsMenuItem } from './useToolsMenuItem';
const styles = stylex.create({
activeLabel: {
@@ -85,100 +84,13 @@ const styles = stylex.create({
labelWithChip: { display: 'inline-flex', gap: '8px', alignItems: 'center' },
});
-type DropdownItemWithPopover = NonNullable<ActionDropdownMenuItems>[number] & {
- label?: ReactNode;
- popoverContent?: unknown;
-};
-
-interface PopoverLabelProps {
- disabled?: boolean;
- label: ReactNode;
- popoverContent: ReactNode;
-}
-
-/**
- * The detail card must anchor past the whole menu row, not the label cell:
- * anchored to the label, it opens exactly over the item's trailing `extra`
- * slot ("..." menu, re-authorize link, switches), and a press landing on the
- * portal'd card is read by base-ui as an outside press that dismisses the
- * whole submenu. The card is also rendered inert (pointer-events: none) — it
- * is a hover information surface, so it must never swallow a press meant for
- * the controls beneath it.
- */
-const PopoverLabel = memo<PopoverLabelProps>(({ disabled, label, popoverContent }) => {
- const { close, onOpenChange, open } = useDetailPopoverState(disabled);
- const wrapperRef = useRef<HTMLSpanElement>(null);
- const rowAnchorRef = useMemo(
- () => ({
- get current() {
- const wrapper = wrapperRef.current;
- return (wrapper?.closest('[role="menuitem"]') as HTMLElement | null) ?? wrapper;
- },
- }),
- [],
- );
-
- return (
- <Popover
- arrow={false}
- content={popoverContent}
- disabled={disabled}
- mouseEnterDelay={0.25}
- open={open}
- placement={'rightTop'}
- positionerProps={{ anchor: rowAnchorRef, sideOffset: 8 }}
- styles={{ content: { padding: 0 }, root: { pointerEvents: 'none' } }}
- onOpenChange={onOpenChange}
- >
- <span
- ref={wrapperRef}
- style={{ display: 'block', width: '100%' }}
- onClickCapture={close}
- onContextMenuCapture={close}
- >
- {label}
- </span>
- </Popover>
- );
-});
-
-PopoverLabel.displayName = 'PopoverLabel';
-
-const wrapPopoverLabel = (label: ReactNode, popoverContent?: unknown, disabled?: boolean) => {
- if (!popoverContent) return label;
-
- return (
- <PopoverLabel disabled={disabled} label={label} popoverContent={popoverContent as ReactNode} />
- );
-};
-
-const stripPopoverContent = (
- items?: ActionDropdownMenuItems,
- detailPopoverDisabled?: boolean,
-): ActionDropdownMenuItems =>
- items?.map((item) => {
- if (!item) return item;
- if ('type' in item && item.type === 'divider') return item;
-
- const nextItem = { ...(item as DropdownItemWithPopover) };
- const popoverContent = nextItem.popoverContent;
- delete nextItem.popoverContent;
-
- if ('children' in nextItem && nextItem.children) {
- return {
- ...nextItem,
- children: stripPopoverContent(nextItem.children, detailPopoverDisabled),
- } as ActionDropdownMenuItems[number];
- }
-
- if ('label' in nextItem) {
- nextItem.label = wrapPopoverLabel(nextItem.label, popoverContent, detailPopoverDisabled);
- }
-
- return nextItem;
- }) ?? [];
-
-const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuItems => {
+const usePlusMenuItemsBase = ({
+ close,
+ toolsMenuItem,
+}: {
+ close: () => void;
+ toolsMenuItem: ActionDropdownMenuItems[number];
+}): ActionDropdownMenuItems => {
const { t } = useTranslation('chat');
const { t: tEditor } = useTranslation('editor');
const { t: tSetting } = useTranslation('setting');
@@ -220,12 +132,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
} = useKnowledgeControls({ openAttachKnowledgeModal: handleOpenKnowledge });
const closeDropdown = useCallback(() => close(), [close]);
const skillsMenuItem = useSkillsMenuItem(closeDropdown);
- const {
- isPolicyMenuOpen: isSkillPolicyMenuOpen,
- marketFooter: skillMarketFooter,
- marketHeader: skillMarketHeader,
- marketItems: skillItems,
- } = useToolsControls({ closeDropdown });
const handleToggleParams = useCallback(() => {
close();
@@ -257,14 +163,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
label
);
- // The row detail card and the "..." policy menu anchor to the same right edge,
- // so leaving hover live lets a neighbouring row's card open on top of the menu
- // and swallow the click meant for it.
- const skillMenuItems = stripPopoverContent(
- skillItems as ActionDropdownMenuItems,
- isSkillPolicyMenuOpen,
- );
-
const uploadItems: ActionDropdownMenuItems = [
{
closeOnClick: false,
@@ -304,21 +202,7 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
];
const toolsItems: ActionDropdownMenuItems =
- isAgentModeEnabled && enableFC
- ? [
- {
- children: skillMenuItems,
- // Trailing chevron (replaces base-ui's default triangle submenu arrow,
- // which is hidden via the .lobe-submenu-chevron rule in ActionDropdown).
- extra: <SubmenuChevron />,
- footer: skillMarketFooter,
- header: skillMarketHeader,
- icon: WrenchIcon,
- key: 'tools',
- label: tSetting('tools.picker.title'),
- } as ActionDropdownMenuItems[number],
- ]
- : [];
+ isAgentModeEnabled && enableFC ? [toolsMenuItem] : [];
// Memory and web search are activation entries of the Tools popover now: they
// live in its "Auto" group, can be disabled there, and carry their own settings,
@@ -427,7 +311,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
handleToggleParams,
isAgentModeEnabled,
isParamsPanelActive,
- isSkillPolicyMenuOpen,
knowledgeEnabledCount,
setShowTypoBar,
showTypoBar,
@@ -436,10 +319,8 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
t,
tEditor,
tSetting,
- skillItems,
- skillMarketFooter,
- skillMarketHeader,
skillsMenuItem,
+ toolsMenuItem,
upload,
routeLargeFilesToLocalPaths,
close,
@@ -448,12 +329,27 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
return items;
};
+const useMainPlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuItems => {
+ const closeDropdown = useCallback(() => close(), [close]);
+ const toolsMenuItem = useToolsMenuItem(closeDropdown);
+
+ return usePlusMenuItemsBase({ close, toolsMenuItem });
+};
+
+const usePopupPlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuItems => {
+ const closeDropdown = useCallback(() => close(), [close]);
+ const toolsMenuItem = usePopupToolsMenuItem(closeDropdown);
+
+ return usePlusMenuItemsBase({ close, toolsMenuItem });
+};
+
/**
* The trigger stays hook-free: every store subscription and the whole item tree
- * live in `usePlusMenuItems`, which ActionDropdown only invokes from inside the
- * popup — so opening a conversation no longer pays for a menu nobody opened.
+ * live in `useMainPlusMenuItems` / `usePopupPlusMenuItems`, which ActionDropdown
+ * only invokes from inside the popup — so opening a conversation no longer pays
+ * for a menu nobody opened.
*/
-const PlusAction = memo(() => {
+const PlusActionBase = memo<{ isPopup: boolean }>(({ isPopup }) => {
const { t } = useTranslation('chat');
const { controlHeight, iconSize } = useDensityTokens();
@@ -464,7 +360,7 @@ const PlusAction = memo(() => {
title={t('plus.contextTooltip')}
tooltipProps={{ placement: 'top' }}
dropdown={{
- menu: { useItems: usePlusMenuItems },
+ menu: { useItems: isPopup ? usePopupPlusMenuItems : useMainPlusMenuItems },
minWidth: 196,
placement: 'topLeft',
}}
@@ -472,6 +368,22 @@ const PlusAction = memo(() => {
);
});
+PlusActionBase.displayName = 'PlusActionBase';
+
+const PlusActionInRouter = memo(() => {
+ const { pathname } = useLocation();
+
+ return <PlusActionBase isPopup={pathname.startsWith('/popup')} />;
+});
+
+PlusActionInRouter.displayName = 'PlusActionInRouter';
+
+const PlusAction = memo(() => {
+ const inRouter = useInRouterContext();
+
+ return inRouter ? <PlusActionInRouter /> : <PlusActionBase isPopup={false} />;
+});
+
PlusAction.displayName = 'PlusAction';
const Plus = () => {
diff --git a/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.test.ts b/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.test.ts
new file mode 100644
index 00000000000..a6afa6c8162
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.test.ts
@@ -0,0 +1,48 @@
+import { renderHook } from '@testing-library/react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { usePopupToolsMenuItem } from './usePopupToolsMenuItem';
+
+const mocks = vi.hoisted(() => ({
+ useToolsControls: vi.fn(),
+}));
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock('../Tools/useControls', () => ({
+ useControls: mocks.useToolsControls,
+}));
+
+describe('usePopupToolsMenuItem', () => {
+ beforeEach(() => {
+ mocks.useToolsControls.mockReset();
+ mocks.useToolsControls.mockReturnValue({
+ isPolicyMenuOpen: false,
+ marketFooter: 'footer',
+ marketHeader: 'header',
+ marketItems: [
+ {
+ key: 'lobe-web-browsing',
+ label: 'Web Browsing',
+ popoverContent: 'detail',
+ },
+ ],
+ });
+ });
+
+ it('builds an inline Tools submenu for popup chats without unmounted WorkingSidebar', () => {
+ const closeDropdown = vi.fn();
+ const { result } = renderHook(() => usePopupToolsMenuItem(closeDropdown));
+
+ expect(mocks.useToolsControls).toHaveBeenCalledWith({ closeDropdown });
+ expect(result.current.key).toBe('tools');
+ expect((result.current as { header?: unknown }).header).toBe('header');
+ expect((result.current as { footer?: unknown }).footer).toBe('footer');
+ const children = (result.current as { children?: Array<Record<string, unknown>> }).children;
+ expect(children).toHaveLength(1);
+ expect(children?.[0]?.key).toBe('lobe-web-browsing');
+ expect(children?.[0]).not.toHaveProperty('popoverContent');
+ });
+});
diff --git a/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.tsx b/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.tsx
new file mode 100644
index 00000000000..efaac10c51d
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Plus/usePopupToolsMenuItem.tsx
@@ -0,0 +1,116 @@
+import { Popover } from '@lobehub/ui';
+import { WrenchIcon } from 'lucide-react';
+import { memo, type ReactNode, useMemo, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { type ActionDropdownMenuItems } from '../components/ActionDropdown';
+import SubmenuChevron from '../components/SubmenuChevron';
+import { useDetailPopoverState } from '../components/useDetailPopoverState';
+import { useControls as useToolsControls } from '../Tools/useControls';
+
+type DropdownItemWithPopover = NonNullable<ActionDropdownMenuItems>[number] & {
+ label?: ReactNode;
+ popoverContent?: unknown;
+};
+
+interface PopoverLabelProps {
+ disabled?: boolean;
+ label: ReactNode;
+ popoverContent: ReactNode;
+}
+
+const PopoverLabel = memo<PopoverLabelProps>(({ disabled, label, popoverContent }) => {
+ const { close, onOpenChange, open } = useDetailPopoverState(disabled);
+ const wrapperRef = useRef<HTMLSpanElement>(null);
+ const rowAnchorRef = useMemo(
+ () => ({
+ get current() {
+ const wrapper = wrapperRef.current;
+ return (wrapper?.closest('[role="menuitem"]') as HTMLElement | null) ?? wrapper;
+ },
+ }),
+ [],
+ );
+
+ return (
+ <Popover
+ arrow={false}
+ content={popoverContent}
+ disabled={disabled}
+ mouseEnterDelay={0.25}
+ open={open}
+ placement={'rightTop'}
+ positionerProps={{ anchor: rowAnchorRef, sideOffset: 8 }}
+ styles={{ content: { padding: 0 }, root: { pointerEvents: 'none' } }}
+ onOpenChange={onOpenChange}
+ >
+ <span
+ ref={wrapperRef}
+ style={{ display: 'block', width: '100%' }}
+ onClickCapture={close}
+ onContextMenuCapture={close}
+ >
+ {label}
+ </span>
+ </Popover>
+ );
+});
+
+PopoverLabel.displayName = 'PopoverLabel';
+
+const stripPopoverContent = (
+ items?: ActionDropdownMenuItems,
+ detailPopoverDisabled?: boolean,
+): ActionDropdownMenuItems =>
+ items?.map((item) => {
+ if (!item) return item;
+ if ('type' in item && item.type === 'divider') return item;
+
+ const nextItem = { ...(item as DropdownItemWithPopover) };
+ const popoverContent = nextItem.popoverContent;
+ delete nextItem.popoverContent;
+
+ if ('children' in nextItem && nextItem.children) {
+ return {
+ ...nextItem,
+ children: stripPopoverContent(nextItem.children, detailPopoverDisabled),
+ } as ActionDropdownMenuItems[number];
+ }
+
+ if ('label' in nextItem && popoverContent) {
+ nextItem.label = (
+ <PopoverLabel
+ disabled={detailPopoverDisabled}
+ label={nextItem.label}
+ popoverContent={popoverContent as ReactNode}
+ />
+ );
+ }
+
+ return nextItem;
+ }) ?? [];
+
+/**
+ * Inline Tools submenu fallback for desktop popup chats (`/popup/*`), where
+ * `WorkingSidebar` is not mounted.
+ */
+export const usePopupToolsMenuItem = (closeDropdown: () => void) => {
+ const { t } = useTranslation('setting');
+ const { isPolicyMenuOpen, marketFooter, marketHeader, marketItems } = useToolsControls({
+ closeDropdown,
+ });
+
+ return useMemo(
+ () =>
+ ({
+ children: stripPopoverContent(marketItems as ActionDropdownMenuItems, isPolicyMenuOpen),
+ extra: <SubmenuChevron />,
+ footer: marketFooter,
+ header: marketHeader,
+ icon: WrenchIcon,
+ key: 'tools',
+ label: t('tools.picker.title'),
+ }) as ActionDropdownMenuItems[number],
+ [isPolicyMenuOpen, marketFooter, marketHeader, marketItems, t],
+ );
+};
diff --git a/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.test.ts b/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.test.ts
new file mode 100644
index 00000000000..c9fcb80f909
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.test.ts
@@ -0,0 +1,80 @@
+import { act, renderHook } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useGlobalStore } from '@/store/global';
+import { initialState } from '@/store/global/initialState';
+
+import { useToolsMenuItem } from './useToolsMenuItem';
+
+vi.mock('@/utils/client/switchLang', () => ({ switchLang: vi.fn() }));
+
+vi.mock('react-i18next', async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+const initialStore = useGlobalStore.getState();
+let persistedStatus: string | null;
+
+beforeEach(() => {
+ persistedStatus = localStorage.getItem('LOBE_SYSTEM_STATUS');
+ useGlobalStore.setState({
+ isStatusInit: true,
+ status: {
+ ...initialState.status,
+ showRightPanel: false,
+ showWorkingOverview: true,
+ workingSidebarTab: 'files',
+ },
+ });
+});
+
+afterEach(() => {
+ useGlobalStore.setState(initialStore, true);
+ if (persistedStatus === null) localStorage.removeItem('LOBE_SYSTEM_STATUS');
+ else localStorage.setItem('LOBE_SYSTEM_STATUS', persistedStatus);
+ vi.restoreAllMocks();
+});
+
+describe('useToolsMenuItem', () => {
+ it('closes the composer menu before opening the tools sidebar', () => {
+ const close = vi.fn(() => {
+ expect(useGlobalStore.getState().status.showRightPanel).toBe(false);
+ });
+ const { result } = renderHook(() => useToolsMenuItem(close));
+
+ act(() => result.current.onClick());
+
+ expect(close).toHaveBeenCalledOnce();
+ expect(useGlobalStore.getState().status).toMatchObject({
+ showRightPanel: true,
+ showWorkingOverview: false,
+ workingSidebarTab: 'tools',
+ workingSidebarTabRequest: { tab: 'tools' },
+ });
+ });
+
+ it('switches an already open sidebar from another tab to tools', () => {
+ useGlobalStore.setState({
+ status: { ...useGlobalStore.getState().status, showRightPanel: true },
+ });
+ const { result } = renderHook(() => useToolsMenuItem(vi.fn()));
+
+ act(() => result.current.onClick());
+
+ expect(useGlobalStore.getState().status.showRightPanel).toBe(true);
+ expect(useGlobalStore.getState().status.workingSidebarTab).toBe('tools');
+ });
+
+ it('keeps tools open on repeated clicks rather than toggling the panel closed', () => {
+ const close = vi.fn();
+ const { result } = renderHook(() => useToolsMenuItem(close));
+
+ act(() => result.current.onClick());
+ act(() => result.current.onClick());
+
+ expect(close).toHaveBeenCalledTimes(2);
+ expect(useGlobalStore.getState().status.showRightPanel).toBe(true);
+ expect(useGlobalStore.getState().status.workingSidebarTab).toBe('tools');
+ });
+});
diff --git a/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.ts b/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.ts
new file mode 100644
index 00000000000..484097090db
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Plus/useToolsMenuItem.ts
@@ -0,0 +1,21 @@
+import { type MenuItemType } from '@lobehub/ui';
+import { WrenchIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+
+import { useGlobalStore } from '@/store/global';
+
+/** Hand off from the composer menu to the right-side tools sidebar. */
+export const useToolsMenuItem = (close: () => void) => {
+ const { t } = useTranslation('setting');
+ const openWorkingSidebar = useGlobalStore((s) => s.openWorkingSidebar);
+
+ return {
+ icon: WrenchIcon,
+ key: 'tools',
+ label: t('tools.picker.title'),
+ onClick: () => {
+ close();
+ openWorkingSidebar('tools');
+ },
+ } satisfies MenuItemType;
+};
diff --git a/src/features/ChatInput/ActionBar/Search/Controls.tsx b/src/features/ChatInput/ActionBar/Search/Controls.tsx
index a22c39b420c..275789627de 100644
--- a/src/features/ChatInput/ActionBar/Search/Controls.tsx
+++ b/src/features/ChatInput/ActionBar/Search/Controls.tsx
@@ -89,16 +89,8 @@ const Item = memo<NetworkOption>(({ value, description, icon, label }) => {
);
});
-/**
- * Search settings that are only meaningful once web search is on: which engine
- * answers (app tool vs the model's built-in search) and which model runs the
- * function-calling search. Extracted so the search capability row in the
- * chat-input Tools popover can host it beside the Auto/Disable policy.
- */
-export const SearchAdvancedControls = memo(() => {
+export const useSearchAdvancedVisibility = () => {
const agentId = useAgentId();
- const { allowed: canCreate } = usePermission('create_content');
-
const { model, provider } = useEffectiveModel(agentId);
const [useModelBuiltinSearch, searchMode] = useAgentStore((s) => [
chatConfigByIdSelectors.getUseModelBuiltinSearchById(agentId)(s),
@@ -128,11 +120,28 @@ export const SearchAdvancedControls = memo(() => {
!supportFC &&
(!modelBuiltinSearchImpl || (!isModelBuiltinSearchInternal && !useModelBuiltinSearch));
- if (!showModelBuiltinSearch && !showFCSearchModel) return null;
+ return {
+ hasControls: showModelBuiltinSearch || showFCSearchModel,
+ showFCSearchModel,
+ showModelBuiltinSearch,
+ };
+};
+
+/**
+ * Search settings that are only meaningful once web search is on: which engine
+ * answers (app tool vs the model's built-in search) and which model runs the
+ * function-calling search. Extracted so both the Tools popover and the agent
+ * Tools settings page can host it cleanly.
+ */
+export const SearchAdvancedControls = memo<{ showDivider?: boolean }>(({ showDivider = true }) => {
+ const { allowed: canCreate } = usePermission('create_content');
+ const { hasControls, showFCSearchModel, showModelBuiltinSearch } = useSearchAdvancedVisibility();
+
+ if (!hasControls) return null;
return (
<>
- <Divider style={{ margin: 0 }} />
+ {showDivider && <Divider style={{ margin: 0 }} />}
{showModelBuiltinSearch && <ModelBuiltinSearch disabled={!canCreate} />}
{showFCSearchModel && <FCSearchModel disabled={!canCreate} />}
</>
diff --git a/src/features/ChatInput/ActionBar/Tools/SkillRow.tsx b/src/features/ChatInput/ActionBar/Tools/SkillRow.tsx
index 7dfa5d157da..d2257946848 100644
--- a/src/features/ChatInput/ActionBar/Tools/SkillRow.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/SkillRow.tsx
@@ -9,10 +9,11 @@ interface SkillRowProps {
/** Rich detail card shown while hovering the label cell. */
detailContent?: ReactNode;
detailDisabled?: boolean;
+ detailPlacement?: 'leftTop' | 'rightTop';
label: ReactNode;
labelClassName?: string;
onContextMenu?: () => void;
- trailing: ReactNode;
+ trailing?: ReactNode;
trailingClassName?: string;
}
@@ -29,6 +30,7 @@ const SkillRow = memo<SkillRowProps>(
className,
detailContent,
detailDisabled,
+ detailPlacement = 'rightTop',
label,
labelClassName,
onContextMenu,
@@ -60,7 +62,7 @@ const SkillRow = memo<SkillRowProps>(
disabled={detailDisabled}
mouseEnterDelay={0.3}
open={open}
- placement={'rightTop'}
+ placement={detailPlacement}
positionerProps={{ anchor: rowRef, sideOffset: 8 }}
styles={{ content: { padding: 0 }, root: { pointerEvents: 'none' } }}
onOpenChange={onOpenChange}
@@ -70,9 +72,11 @@ const SkillRow = memo<SkillRowProps>(
) : (
labelCell
)}
- <span data-tool-trailing className={trailingClassName}>
- {trailing}
- </span>
+ {trailing && (
+ <span data-tool-trailing className={trailingClassName}>
+ {trailing}
+ </span>
+ )}
</span>
);
},
diff --git a/src/features/ChatInput/ActionBar/Tools/ToolPickerHeader.tsx b/src/features/ChatInput/ActionBar/Tools/ToolPickerHeader.tsx
index 692ed8fee48..620ce59dc02 100644
--- a/src/features/ChatInput/ActionBar/Tools/ToolPickerHeader.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/ToolPickerHeader.tsx
@@ -1,44 +1,58 @@
import { Flexbox, SearchBar, Segmented, Text } from '@lobehub/ui';
-import { memo } from 'react';
+import { memo, type ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
type Filter = 'auto' | 'disabled';
interface ToolPickerHeaderProps {
+ action?: ReactNode;
empty: boolean;
filter: Filter;
onFilterChange: (filter: Filter) => void;
onSearchChange: (query: string) => void;
query: string;
+ showFilter?: boolean;
}
export const ToolPickerHeader = memo<ToolPickerHeaderProps>(
- ({ empty, filter, query, onFilterChange, onSearchChange }) => {
+ ({ action, empty, filter, query, showFilter = true, onFilterChange, onSearchChange }) => {
const { t } = useTranslation('setting');
const searching = Boolean(query.trim());
+ const searchInput = (
+ <SearchBar
+ allowClear
+ aria-label={t('tools.picker.search')}
+ placeholder={t('tools.picker.search')}
+ size="small"
+ style={action ? { flex: 1, minWidth: 0 } : undefined}
+ value={query}
+ variant="borderless"
+ onChange={(event) => onSearchChange(event.target.value)}
+ onKeyDown={(event) => {
+ if (!['Escape', 'Tab', 'ArrowDown'].includes(event.key)) event.stopPropagation();
+ }}
+ />
+ );
+
return (
<Flexbox className="lobe-tool-picker-header" gap={6}>
- <SearchBar
- allowClear
- aria-label={t('tools.picker.search')}
- placeholder={t('tools.picker.search')}
- size="small"
- value={query}
- variant="borderless"
- onChange={(event) => onSearchChange(event.target.value)}
- onKeyDown={(event) => {
- if (!['Escape', 'Tab', 'ArrowDown'].includes(event.key)) event.stopPropagation();
- }}
- />
- {!searching && (
+ {action ? (
+ <Flexbox horizontal align="center" gap={4}>
+ {searchInput}
+ {action}
+ </Flexbox>
+ ) : (
+ searchInput
+ )}
+ {showFilter && !searching && (
<Segmented
block
size="small"
value={filter}
options={[
- { label: t('tools.loading.onDemand'), value: 'auto' },
- { label: t('tools.loading.never'), value: 'disabled' },
+ { label: t('tools.status.enabled'), value: 'auto' },
+ { label: t('tools.status.disabled'), value: 'disabled' },
]}
onChange={(value) => onFilterChange(value === 'disabled' ? 'disabled' : 'auto')}
/>
diff --git a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
index 58a7a67116f..65a207e3f43 100644
--- a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
@@ -64,6 +64,7 @@ interface ToolItemData {
}
interface ToolsListProps {
+ detailPlacement?: 'leftTop' | 'rightTop';
detailPopoverDisabled?: boolean;
items: ItemType[];
}
@@ -73,10 +74,11 @@ const DividerItem = memo<{ index: number }>(({ index }) => (
));
const RegularItem = memo<{
+ detailPlacement?: 'leftTop' | 'rightTop';
detailPopoverDisabled?: boolean;
index: number;
item: ToolItemData;
-}>(({ detailPopoverDisabled, item, index }) => {
+}>(({ detailPlacement = 'rightTop', detailPopoverDisabled, item, index }) => {
const { close, onOpenChange, open } = useDetailPopoverState(detailPopoverDisabled);
const { iconSize } = useDensityTokens();
@@ -118,7 +120,7 @@ const RegularItem = memo<{
disabled={detailPopoverDisabled}
mouseEnterDelay={0.3}
open={open}
- placement={'rightTop'}
+ placement={detailPlacement}
positionerProps={{ sideOffset: 8 }}
styles={{ content: { padding: 0 }, root: { pointerEvents: 'none' } }}
onOpenChange={onOpenChange}
@@ -129,16 +131,18 @@ const RegularItem = memo<{
});
const GroupItem = memo<{
+ detailPlacement?: 'leftTop' | 'rightTop';
detailPopoverDisabled?: boolean;
index: number;
item: ToolItemData;
-}>(({ detailPopoverDisabled, item, index }) => (
+}>(({ detailPlacement, detailPopoverDisabled, item, index }) => (
<Fragment key={item.key || `group-${index}`}>
<Text className={stylex.props(styles.groupLabel).className} fontSize={12} type="secondary">
{item.label}
</Text>
{item.children?.map((child, childIndex) => (
<ToolListItem
+ detailPlacement={detailPlacement}
detailPopoverDisabled={detailPopoverDisabled}
index={childIndex}
item={child}
@@ -149,22 +153,38 @@ const GroupItem = memo<{
));
const ToolListItem = memo<{
+ detailPlacement?: 'leftTop' | 'rightTop';
detailPopoverDisabled?: boolean;
index: number;
item: ToolItemData | null;
-}>(({ detailPopoverDisabled, item, index }) => {
+}>(({ detailPlacement, detailPopoverDisabled, item, index }) => {
if (!item) return null;
if (item.type === 'divider') return <DividerItem index={index} />;
if (item.type === 'group')
- return <GroupItem detailPopoverDisabled={detailPopoverDisabled} index={index} item={item} />;
- return <RegularItem detailPopoverDisabled={detailPopoverDisabled} index={index} item={item} />;
+ return (
+ <GroupItem
+ detailPlacement={detailPlacement}
+ detailPopoverDisabled={detailPopoverDisabled}
+ index={index}
+ item={item}
+ />
+ );
+ return (
+ <RegularItem
+ detailPlacement={detailPlacement}
+ detailPopoverDisabled={detailPopoverDisabled}
+ index={index}
+ item={item}
+ />
+ );
});
-const ToolsList = memo<ToolsListProps>(({ detailPopoverDisabled, items }) => {
+const ToolsList = memo<ToolsListProps>(({ detailPlacement, detailPopoverDisabled, items }) => {
return (
<Flexbox gap={0} padding={4}>
{items.map((item, index) => (
<ToolListItem
+ detailPlacement={detailPlacement}
detailPopoverDisabled={detailPopoverDisabled}
index={index}
item={item as ToolItemData | null}
diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.test.ts b/src/features/ChatInput/ActionBar/Tools/useControls.test.ts
index 659c4b8de90..4b18534f02e 100644
--- a/src/features/ChatInput/ActionBar/Tools/useControls.test.ts
+++ b/src/features/ChatInput/ActionBar/Tools/useControls.test.ts
@@ -186,8 +186,8 @@ describe('chat input tool picker', () => {
render(createElement(Row));
fireEvent.contextMenu(screen.getByRole('button', { name: 'tools.skillActivateMode.title' }));
- expect(await screen.findByRole('button', { name: 'tools.loading.onDemand' })).toBeTruthy();
- expect(screen.getByRole('button', { name: 'tools.loading.never' })).toBeTruthy();
+ expect(await screen.findByRole('button', { name: 'tools.status.enabled' })).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'tools.status.disabled' })).toBeTruthy();
expect(!!screen.queryByRole('button', { name: 'tools.activation.action.pin' })).toBe(pin);
});
@@ -434,4 +434,27 @@ describe('chat input tool picker', () => {
expect(leafKeys(result.current.marketItems)).toEqual([]);
},
);
+
+ it('hides the status filter, row controls, and extra tags and groups enabled tools by category when enabledOnly is true', () => {
+ mocks.plugins = [{ identifier: 'alpha', mode: 'disabled' }];
+ const { result } = renderHook(() => useControls({ enabledOnly: true }));
+
+ expect(result.current.marketHeader.props.showFilter).toBe(false);
+ expect(leafKeys(result.current.marketItems)).not.toContain('alpha');
+ expect(leafKeys(result.current.marketItems)).not.toContain('lobe-web-browsing');
+ expect(result.current.enabledSections.map((section) => section.key)).toEqual([
+ 'builtin',
+ 'community',
+ 'custom',
+ ]);
+ const firstRow = result.current.enabledSections[0].items[0] as {
+ label?: { props?: Record<string, unknown> };
+ };
+ expect(firstRow.label?.props?.trailing).toBeUndefined();
+ expect(firstRow.label?.props?.onContextMenu).toBeUndefined();
+
+ act(() => result.current.marketHeader.props.onSearchChange('alpha'));
+ expect(result.current.marketItems).toEqual([]);
+ expect(result.current.enabledSections).toEqual([]);
+ });
});
diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.tsx b/src/features/ChatInput/ActionBar/Tools/useControls.tsx
index 936bc2c5f06..5605954a7df 100644
--- a/src/features/ChatInput/ActionBar/Tools/useControls.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/useControls.tsx
@@ -139,7 +139,17 @@ type SkillMenuItem = NonNullable<ItemType> & {
detailContent?: ReactNode;
};
-export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } = {}) => {
+export const useControls = ({
+ closeDropdown,
+ detailPlacement,
+ enabledOnly = false,
+ headerAction,
+}: {
+ closeDropdown?: () => void;
+ detailPlacement?: 'leftTop' | 'rightTop';
+ enabledOnly?: boolean;
+ headerAction?: ReactNode;
+} = {}) => {
const { t } = useTranslation('setting');
const agentId = useAgentId();
const navigate = useWorkspaceAwareNavigate();
@@ -260,8 +270,8 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
// status readout — group headers still use the state labels below.
// `as const` keeps literal keys so `t()` stays typed against setting resources.
const policyActionKey = {
- auto: 'tools.loading.onDemand',
- disabled: 'tools.loading.never',
+ auto: 'tools.status.enabled',
+ disabled: 'tools.status.disabled',
} as const satisfies Record<SkillPolicyMode, string>;
const renderPolicyItem = (value: SkillPolicyMode, icon: ReactNode) => (
@@ -376,7 +386,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
arrow={false}
content={content}
open={policyOpenId === id}
- placement="rightTop"
+ placement={detailPlacement ?? 'rightTop'}
positionerProps={{ sideOffset: 8 }}
styles={{ content: { padding: 0 } }}
trigger="click"
@@ -407,7 +417,15 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
</Popover>
);
},
- [canEdit, disabledIdSet, openSkillPolicyMenu, policyOpenId, t, updateSkillPolicy],
+ [
+ canEdit,
+ detailPlacement,
+ disabledIdSet,
+ openSkillPolicyMenu,
+ policyOpenId,
+ t,
+ updateSkillPolicy,
+ ],
);
const renderToolLabel = useCallback(
@@ -424,6 +442,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
className={stylex.props(styles.toolRow, stylex.defaultMarker()).className}
detailContent={detailContent}
detailDisabled={policyOpenId !== null}
+ detailPlacement={detailPlacement}
labelClassName={stylex.props(styles.toolLabel).className}
label={
<>
@@ -435,19 +454,21 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
</>
}
trailing={
- <>
- {badge && <span {...stylex.props(styles.typeTag)}>{badge}</span>}
- {action}
- </>
+ enabledOnly || (!badge && !action) ? undefined : (
+ <>
+ {badge && <span {...stylex.props(styles.typeTag)}>{badge}</span>}
+ {action}
+ </>
+ )
}
trailingClassName={
stylex.props(styles.toolTrailing, policyOpenId === id && styles.toolTrailingVisible)
.className
}
- onContextMenu={() => openSkillPolicyMenu(id)}
+ onContextMenu={enabledOnly ? undefined : () => openSkillPolicyMenu(id)}
/>
),
- [openSkillPolicyMenu, policyOpenId],
+ [detailPlacement, enabledOnly, openSkillPolicyMenu, policyOpenId],
);
const createManagedSkillItem = useCallback(
@@ -490,22 +511,24 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
label: renderToolLabel(
id,
title,
- renderPolicyMenu(id, {
- configureConfig,
- defaultMode,
- deleteConfig,
- modeOverride,
- panelExtra,
- supportedModes,
- }),
- badge,
+ enabledOnly
+ ? undefined
+ : renderPolicyMenu(id, {
+ configureConfig,
+ defaultMode,
+ deleteConfig,
+ modeOverride,
+ panelExtra,
+ supportedModes,
+ }),
+ enabledOnly ? undefined : badge,
icon,
- extraTag,
+ enabledOnly ? undefined : extraTag,
popoverContent,
),
searchText: searchText || String(title || id),
}) as SkillMenuItem,
- [renderPolicyMenu, renderToolLabel],
+ [enabledOnly, renderPolicyMenu, renderToolLabel],
);
// Composio-related state
@@ -1033,27 +1056,31 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
{
children: autoItems,
key: 'auto',
- label: t('tools.loading.onDemand'),
+ label: t('tools.status.enabled'),
type: 'group' as const,
},
{
children: disabledItems,
key: 'disabled',
- label: t('tools.loading.never'),
+ label: t('tools.status.disabled'),
type: 'group' as const,
},
];
- const marketItems: ItemType[] = normalizedSearchKeyword
- ? groups.filter((group) => group.children.length > 0)
- : filter === 'auto'
- ? autoItems
- : disabledItems;
+ const marketItems: ItemType[] = enabledOnly
+ ? autoItems
+ : normalizedSearchKeyword
+ ? groups.filter((group) => group.children.length > 0)
+ : filter === 'auto'
+ ? autoItems
+ : disabledItems;
const marketHeader = (
<ToolPickerHeader
+ action={headerAction}
empty={!marketItems.length}
filter={filter}
query={searchKeyword}
+ showFilter={!enabledOnly}
onFilterChange={setFilter}
onSearchChange={setSearchKeyword}
/>
@@ -1078,8 +1105,48 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
</button>
) : undefined;
+ const activeSkillSet = new Set(activeSkillItems);
+ const enabledSections = [
+ {
+ items: filterBySearch([
+ ...capabilityAutoItems,
+ ...builtinItems.filter((item) => activeSkillSet.has(item)),
+ ]),
+ key: 'builtin' as const,
+ title: t('tools.picker.section.builtin'),
+ },
+ {
+ items: filterBySearch(
+ [...lobehubSkillItems, ...composioServerItems].filter((item): item is SkillMenuItem =>
+ activeSkillSet.has(item as SkillMenuItem),
+ ),
+ ),
+ key: 'connected' as const,
+ title: t('tools.picker.section.connected'),
+ },
+ {
+ items: filterBySearch(
+ communityGroupChildren.filter((item): item is SkillMenuItem =>
+ activeSkillSet.has(item as SkillMenuItem),
+ ),
+ ),
+ key: 'community' as const,
+ title: t('skillStore.tabs.community'),
+ },
+ {
+ items: filterBySearch(
+ customGroupChildren.filter((item): item is SkillMenuItem =>
+ activeSkillSet.has(item as SkillMenuItem),
+ ),
+ ),
+ key: 'custom' as const,
+ title: t('skillStore.tabs.custom'),
+ },
+ ].filter((section) => section.items.length > 0);
+
return {
autoCount: allAutoItems.length,
+ enabledSections,
// Stable inventory order: toggling a checkbox must not move its row.
toolOptions: [...capabilityItems, ...allSkillItems].map((item) => ({
canDisable: !!item.canDisable,
diff --git a/src/features/Conversation/WorkingSidebar/ToolsSection/index.tsx b/src/features/Conversation/WorkingSidebar/ToolsSection/index.tsx
new file mode 100644
index 00000000000..f0f6eee51cd
--- /dev/null
+++ b/src/features/Conversation/WorkingSidebar/ToolsSection/index.tsx
@@ -0,0 +1,109 @@
+import { ActionIcon, Center, Empty, Flexbox } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { SettingsIcon, WrenchIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+
+import { buildAgentProfileTabPath } from '@/features/AgentProfileTabs/tabOptions';
+import { ScrollSignalProvider } from '@/features/ChatInput/ActionBar/Tools/ScrollSignalContext';
+import ToolsList from '@/features/ChatInput/ActionBar/Tools/ToolsList';
+import { useControls } from '@/features/ChatInput/ActionBar/Tools/useControls';
+import { useEffectiveModel } from '@/features/ChatInput/hooks/useEffectiveModel';
+import { createStore, Provider } from '@/features/ChatInput/store';
+import { SkillSection } from '@/features/SkillsList';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { useModelSupportToolUse } from '@/hooks/useModelSupportToolUse';
+import { useAgentStore } from '@/store/agent';
+import { sidebarRow } from '@/styles/density.stylex';
+
+const styles = stylex.create({
+ body: {
+ overflowY: 'auto',
+ flex: '1',
+ minHeight: '0',
+ paddingBlock: '8px',
+ paddingInline: '4px',
+ },
+ header: {
+ flexShrink: 0,
+ paddingBlockStart: sidebarRow.paneBlockStart,
+ paddingBlockEnd: '8px',
+ paddingInline: sidebarRow.paneInline,
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorFill,
+ },
+ root: {
+ display: 'flex',
+ flexDirection: 'column',
+ width: '100%',
+ height: '100%',
+ minHeight: '0',
+ },
+});
+
+const ToolsSidebarContent = ({ agentId }: { agentId: string }) => {
+ const { t } = useTranslation('setting');
+ const navigate = useWorkspaceAwareNavigate();
+ const { model, provider } = useEffectiveModel(agentId);
+ const enableFC = useModelSupportToolUse(model, provider);
+
+ const manageAction = agentId ? (
+ <ActionIcon
+ aria-label={t('tools.picker.management')}
+ icon={SettingsIcon}
+ size="small"
+ title={t('tools.picker.management')}
+ onClick={() => navigate(buildAgentProfileTabPath(agentId, 'tools'))}
+ />
+ ) : undefined;
+
+ const { enabledSections, isPolicyMenuOpen, marketHeader } = useControls({
+ detailPlacement: 'leftTop',
+ enabledOnly: true,
+ headerAction: manageAction,
+ });
+
+ if (!enableFC) {
+ return (
+ <Center flex={1} padding={24}>
+ <Empty description={t('tools.picker.disabled')} icon={WrenchIcon} />
+ </Center>
+ );
+ }
+
+ return (
+ <Flexbox className={stylex.props(styles.root).className} gap={0}>
+ <div {...stylex.props(styles.header)}>{marketHeader}</div>
+ <ScrollSignalProvider className={stylex.props(styles.body).className}>
+ <Flexbox gap={12}>
+ {enabledSections.map((section) => (
+ <SkillSection
+ compact
+ key={section.key}
+ sectionHeader={{ count: section.items.length, title: section.title }}
+ >
+ <ToolsList
+ detailPlacement="leftTop"
+ detailPopoverDisabled={isPolicyMenuOpen}
+ items={section.items}
+ />
+ </SkillSection>
+ ))}
+ </Flexbox>
+ </ScrollSignalProvider>
+ </Flexbox>
+ );
+};
+
+const ToolsSection = () => {
+ const agentId = useAgentStore((s) => s.activeAgentId) || '';
+
+ return (
+ <Provider createStore={() => createStore({ agentId })} key={agentId}>
+ <ToolsSidebarContent agentId={agentId} />
+ </Provider>
+ );
+};
+
+export default ToolsSection;
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/harness.tsx b/src/features/Conversation/WorkingSidebar/__tests__/harness.tsx
index 4380ab438df..6c50ac2cc9b 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/harness.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/harness.tsx
@@ -29,6 +29,7 @@ const rightPanel = vi.hoisted(() => ({
const agentStore = vi.hoisted(() => ({
activeAgentId: undefined as string | undefined,
heterogeneousType: undefined as string | undefined,
+ isChatMode: false,
isHeterogeneous: false,
rawAgencyConfig: undefined as
{ boundDeviceId?: string; executionTarget?: 'device' | 'local' } | undefined,
@@ -214,6 +215,7 @@ vi.mock('../ParamsSection', () => ({
return <div data-testid="params-section" />;
},
}));
+vi.mock('../ToolsSection', () => ({ default: () => <div data-testid="tools-section" /> }));
vi.mock('../WorksSection', () => ({ default: () => <div /> }));
vi.mock('../Search', () => ({
TopicSearchPane: ({ topicId }: { topicId: string }) => (
@@ -271,7 +273,7 @@ vi.mock('@/store/agent/selectors', () => ({
isCurrentAgentHeterogeneous: () => agentStore.isHeterogeneous,
},
chatConfigByIdSelectors: {
- isChatModeById: () => () => false,
+ isChatModeById: () => () => agentStore.isChatMode,
},
}));
vi.mock('@/store/global', () => ({
@@ -488,6 +490,7 @@ beforeEach(() => {
chatStore.openTopicComments.mockReset();
agentStore.activeAgentId = undefined;
agentStore.heterogeneousType = undefined;
+ agentStore.isChatMode = false;
agentStore.isHeterogeneous = false;
agentStore.rawAgencyConfig = undefined;
effectiveConfig.agencyConfig = undefined;
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index 8d216163250..1961a5a0fd0 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -1175,4 +1175,22 @@ describe('AgentWorkingSidebar — tab strip', () => {
expect(screen.queryByRole('button', { name: 'topicComment.title' })).not.toBeInTheDocument();
});
+
+ it('renders Tools tab for standard agents and hides it in chat or heterogeneous mode', async () => {
+ agentStore.activeAgentId = 'agent';
+ localStorageState.openTabsByContext = { 'draft:agent:none': ['tools', 'params'] };
+ globalStore.status.workingSidebarTab = 'tools';
+
+ const { rerender } = render(<AgentWorkingSidebar availableWidth={1000} />);
+ await waitFor(() => expect(screen.getByTestId('tools-section')).toBeInTheDocument());
+
+ agentStore.isChatMode = true;
+ rerender(<AgentWorkingSidebar availableWidth={1001} />);
+ expect(screen.queryByTestId('tools-section')).not.toBeInTheDocument();
+
+ agentStore.isChatMode = false;
+ agentStore.isHeterogeneous = true;
+ rerender(<AgentWorkingSidebar availableWidth={1002} />);
+ expect(screen.queryByTestId('tools-section')).not.toBeInTheDocument();
+ });
});
diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsx
index b345445cd65..b725a197a51 100644
--- a/src/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/index.tsx
@@ -16,6 +16,7 @@ import {
PlusIcon,
SearchIcon,
Settings2Icon,
+ WrenchIcon,
} from 'lucide-react';
import { AnimatePresence } from 'motion/react';
import * as m from 'motion/react-m';
@@ -106,6 +107,7 @@ import WorkspaceTab from './WorkspaceTab';
import WorksSection from './WorksSection';
const ParamsSection = lazy(() => import('./ParamsSection'));
+const ToolsSection = lazy(() => import('./ToolsSection'));
const styles = stylex.create({
body: { overflowY: 'auto', flex: '1', minHeight: '0' },
@@ -393,6 +395,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
workingDirectory: sourceWorkingDirectory ?? workingDirectory,
});
const paramsAvailable = !isHetero;
+ const toolsAvailable = !isHetero && !isChatMode;
// The in-app browser pages are renderer-retained Electron webviews — desktop only.
const browserAvailable = isDesktop;
const terminalAvailable = isDesktop;
@@ -426,6 +429,9 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
const tabDescriptors = useMemo<SidebarTabDescriptor[]>(
() => [
{ icon: SkillsIcon, key: 'skills', label: t('workingPanel.resources.filter.skills') },
+ ...(toolsAvailable
+ ? [{ icon: WrenchIcon, key: 'tools', label: t('tools.picker.title', { ns: 'setting' }) }]
+ : []),
// Documents / web resources are agent-document features — heterogeneous
// agents only carry filesystem skills, so hide both tabs there.
...(isHetero
@@ -485,6 +491,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
reviewAvailable,
searchAvailable,
t,
+ toolsAvailable,
],
);
const { enabled: mcpAppsEnabled } = useMcpAppSidebar(composerTarget);
@@ -1036,6 +1043,23 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
</Suspense>
</Flexbox>
)}
+ {toolsAvailable && activeTab === 'tools' && (
+ <Flexbox
+ className={stylex.props(styles.pane).className}
+ style={{ overflow: 'hidden' }}
+ >
+ <Suspense
+ fallback={
+ <Skeleton.Text
+ className={stylex.props(styles.paramsLoading).className}
+ rows={6}
+ />
+ }
+ >
+ <ToolsSection />
+ </Suspense>
+ </Flexbox>
+ )}
{/* Switching tabs unmounts Review to release its diff DOM (#18984).
Collapsing the panel hides it for REVIEW_RETAIN_MS first: remounting
all diffs and the tree on a quick reopen stalls the open animation
diff --git a/src/features/Conversation/WorkingSidebar/useOpenMenuItems.tsx b/src/features/Conversation/WorkingSidebar/useOpenMenuItems.tsx
index b242eca5805..5d700cd1d03 100644
--- a/src/features/Conversation/WorkingSidebar/useOpenMenuItems.tsx
+++ b/src/features/Conversation/WorkingSidebar/useOpenMenuItems.tsx
@@ -84,6 +84,7 @@ export const useOpenMenuItems = ({
'works',
'comments',
'skills',
+ 'tools',
'documents',
'web',
...extraTabs.map((tab) => tab.key),
diff --git a/src/features/ProfileEditor/AgentUserTools/AgentToolList.tsx b/src/features/ProfileEditor/AgentUserTools/AgentToolList.tsx
index a18d314841d..1a0ad3ab952 100644
--- a/src/features/ProfileEditor/AgentUserTools/AgentToolList.tsx
+++ b/src/features/ProfileEditor/AgentUserTools/AgentToolList.tsx
@@ -30,6 +30,7 @@ import PluginTag from '../PluginTag';
import ProfilePopoverContent from '../PopoverContent';
import ToolListGroup, { type ToolGroupMeta } from '../ToolListGroup';
import { buildAgentToolRows, countAvailableTools } from './agentToolRows';
+import CapabilitySettingsButton, { isConfigurableCapability } from './CapabilitySettingsButton';
import ConnectionMenu from './ConnectionMenu';
import { isAvailableLibraryConnection, isComposioConnection } from './useOwnConnection';
@@ -205,23 +206,27 @@ const Tools = ({ agentId, group, onOpenDetail }: Props) => {
ownConnection ? ownConnectionNote : libraryConnection && libraryConnectionNote
}
extra={
- <ConnectionMenu
- agentId={agentId}
- fallbackConnectionId={inLibrary ? libraryConnection?.id : undefined}
- libraryConnection={
- !ownConnection &&
- libraryConnection &&
- !libraryConnection.metadata?.mountedByAgentId &&
- canManage(libraryConnection)
- ? libraryConnection
- : undefined
- }
- ownConnection={
- libraryLoaded && ownConnection && canManage(ownConnection)
- ? ownConnection
- : undefined
- }
- />
+ isConfigurableCapability(id) ? (
+ <CapabilitySettingsButton enabled={enabled} pluginId={id} />
+ ) : (
+ <ConnectionMenu
+ agentId={agentId}
+ fallbackConnectionId={inLibrary ? libraryConnection?.id : undefined}
+ libraryConnection={
+ !ownConnection &&
+ libraryConnection &&
+ !libraryConnection.metadata?.mountedByAgentId &&
+ canManage(libraryConnection)
+ ? libraryConnection
+ : undefined
+ }
+ ownConnection={
+ libraryLoaded && ownConnection && canManage(ownConnection)
+ ? ownConnection
+ : undefined
+ }
+ />
+ )
}
onOpen={onOpenDetail}
onToggle={(on) => setEnabled(id, ownConnection, on)}
diff --git a/src/features/ProfileEditor/AgentUserTools/CapabilitySettingsButton.tsx b/src/features/ProfileEditor/AgentUserTools/CapabilitySettingsButton.tsx
new file mode 100644
index 00000000000..f2d6650850a
--- /dev/null
+++ b/src/features/ProfileEditor/AgentUserTools/CapabilitySettingsButton.tsx
@@ -0,0 +1,89 @@
+'use client';
+
+import { MemoryManifest } from '@lobechat/builtin-tool-memory';
+import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';
+import { ActionIcon, Center, Popover } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { Settings2Icon } from 'lucide-react';
+import { memo, type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { MemoryEffortControl } from '@/features/ChatInput/ActionBar/Memory/Controls';
+import {
+ SearchAdvancedControls,
+ useSearchAdvancedVisibility,
+} from '@/features/ChatInput/ActionBar/Search/Controls';
+
+const styles = stylex.create({
+ panel: {
+ display: 'flex',
+ flexDirection: 'column',
+ width: '280px',
+ padding: '4px',
+ },
+});
+
+const SettingsSlot = ({ content, title }: { content: ReactNode; title: string }) => (
+ <Center flex={'none'} width={24} onClick={(event) => event.stopPropagation()}>
+ <Popover
+ arrow={false}
+ content={<div {...stylex.props(styles.panel)}>{content}</div>}
+ placement={'bottomRight'}
+ styles={{ content: { padding: 0 } }}
+ trigger={'click'}
+ >
+ <ActionIcon aria-label={title} icon={Settings2Icon} size={'small'} title={title} />
+ </Popover>
+ </Center>
+);
+
+const SearchSettingsSlot = ({ enabled }: { enabled: boolean }) => {
+ const { t } = useTranslation('setting');
+ const { hasControls } = useSearchAdvancedVisibility();
+
+ if (!enabled || !hasControls) return <Center flex={'none'} width={24} />;
+
+ return (
+ <SettingsSlot
+ content={<SearchAdvancedControls showDivider={false} />}
+ title={t('tools.builtins.configure')}
+ />
+ );
+};
+
+const MemorySettingsSlot = ({ enabled }: { enabled: boolean }) => {
+ const { t } = useTranslation('setting');
+
+ if (!enabled) return <Center flex={'none'} width={24} />;
+
+ return (
+ <SettingsSlot
+ content={<MemoryEffortControl showDivider={false} />}
+ title={t('tools.builtins.configure')}
+ />
+ );
+};
+
+export const isConfigurableCapability = (pluginId: string) =>
+ pluginId === WebBrowsingManifest.identifier || pluginId === MemoryManifest.identifier;
+
+/**
+ * Advanced capability settings button for the agent Tools profile page:
+ * keeps model-native search / FC search model and memory effort reachable
+ * now that the right-side WorkingSidebar Tools tab is display-only.
+ */
+const CapabilitySettingsButton = memo<{ enabled: boolean; pluginId: string }>(
+ ({ enabled, pluginId }) => {
+ if (pluginId === WebBrowsingManifest.identifier) {
+ return <SearchSettingsSlot enabled={enabled} />;
+ }
+ if (pluginId === MemoryManifest.identifier) {
+ return <MemorySettingsSlot enabled={enabled} />;
+ }
+ return <Center flex={'none'} width={24} />;
+ },
+);
+
+CapabilitySettingsButton.displayName = 'CapabilitySettingsButton';
+
+export default CapabilitySettingsButton;
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 9c205120ef0..efbfceb5a48 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -49,6 +49,7 @@ export type WorkingSidebarTab =
| 'review'
| 'search'
| 'skills'
+ | 'tools'
| 'web'
| (string & {});