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.

💄 style(connector): Codex-style connector and skills catalogs (#23187)

AmAzing-c53b8b4065fb
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 5db04a01c52..42d00e18d17 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -353,6 +353,28 @@
"completionSound.sound": "Sound",
"completionSound.title": "In-app completion sound",
"completionSound.volume": "Volume",
+ "connectorMarket.action.connect": "Connect",
+ "connectorMarket.action.details": "View details",
+ "connectorMarket.action.install": "Install",
+ "connectorMarket.action.manage": "Manage",
+ "connectorMarket.add": "Add",
+ "connectorMarket.add.browseStore": "Browse Skill Store",
+ "connectorMarket.add.browseStoreDesc": "Built-in tools, skills and MCP servers",
+ "connectorMarket.add.custom": "Add custom connector",
+ "connectorMarket.add.customDesc": "Connect your own MCP server",
+ "connectorMarket.detail.byAuthor": "By {{author}}",
+ "connectorMarket.detail.information": "Information",
+ "connectorMarket.detail.tools": "Tools",
+ "connectorMarket.detail.type": "Type",
+ "connectorMarket.empty.clear": "Clear search",
+ "connectorMarket.empty.search": "No connectors match “{{keyword}}”",
+ "connectorMarket.empty.searchDesc": "Try another name, or find more in the Skill Store.",
+ "connectorMarket.refresh": "Refresh",
+ "connectorMarket.search.placeholder": "Search connectors",
+ "connectorMarket.section.installed": "Installed",
+ "connectorMarket.section.showAll": "Show all",
+ "connectorMarket.section.showLess": "Show less",
+ "connectorMarket.source": "Source",
"creds.actions.delete": "Delete",
"creds.actions.deleteConfirm.cancel": "Cancel",
"creds.actions.deleteConfirm.content": "This credential will be permanently deleted. This action cannot be undone.",
@@ -2068,7 +2090,12 @@
"skillStore.wantMore.reachedEnd": "You've reached the end. Can't find what you need?",
"skillView.connectors": "Connectors",
"skillView.connectorsDesc": "Connect the apps and tools your agents can use. Open one to see its account and tools.",
+ "skillView.empty.description": "Browse the Skill Store or import a skill from the Add menu.",
+ "skillView.empty.search": "No skills match “{{keyword}}”",
+ "skillView.empty.title": "No skills yet",
+ "skillView.search.placeholder": "Search skills",
"skillView.skills": "Skills",
+ "skillView.skillsDesc": "Give your agents task-specific skills. Open a skill to see its instructions and resources.",
"startConversation": "Start Conversation",
"storage.actions.copyAgentGroups.button": "Copy to…",
"storage.actions.copyAgentGroups.desc": "Copy agent groups and their member agents into another workspace or personal account.",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 90eb9ecaad9..09d09f00705 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -353,6 +353,28 @@
"completionSound.sound": "声音",
"completionSound.title": "应用内完成提示音",
"completionSound.volume": "音量",
+ "connectorMarket.action.connect": "连接",
+ "connectorMarket.action.details": "查看详情",
+ "connectorMarket.action.install": "安装",
+ "connectorMarket.action.manage": "管理",
+ "connectorMarket.add": "添加",
+ "connectorMarket.add.browseStore": "浏览技能商店",
+ "connectorMarket.add.browseStoreDesc": "内置工具、技能和 MCP 服务器",
+ "connectorMarket.add.custom": "添加自定义连接器",
+ "connectorMarket.add.customDesc": "接入你自己的 MCP 服务器",
+ "connectorMarket.detail.byAuthor": "由 {{author}} 提供",
+ "connectorMarket.detail.information": "信息",
+ "connectorMarket.detail.tools": "工具",
+ "connectorMarket.detail.type": "类型",
+ "connectorMarket.empty.clear": "清除搜索",
+ "connectorMarket.empty.search": "没有与“{{keyword}}”匹配的连接器",
+ "connectorMarket.empty.searchDesc": "换个名称试试,或去技能商店查找更多。",
+ "connectorMarket.refresh": "刷新",
+ "connectorMarket.search.placeholder": "搜索连接器",
+ "connectorMarket.section.installed": "已安装",
+ "connectorMarket.section.showAll": "查看全部",
+ "connectorMarket.section.showLess": "收起",
+ "connectorMarket.source": "来源",
"creds.actions.delete": "删除",
"creds.actions.deleteConfirm.cancel": "取消",
"creds.actions.deleteConfirm.content": "此凭证将被永久删除,此操作无法撤销。",
@@ -2068,7 +2090,12 @@
"skillStore.wantMore.reachedEnd": "已经到底了,未找到所需技能?",
"skillView.connectors": "连接器",
"skillView.connectorsDesc": "连接助理可以调用的应用和工具。点开一项,查看授权账号和工具清单。",
+ "skillView.empty.description": "通过「添加」菜单浏览技能商店或导入技能。",
+ "skillView.empty.search": "没有找到与「{{keyword}}」匹配的技能",
+ "skillView.empty.title": "暂无技能",
+ "skillView.search.placeholder": "搜索技能",
"skillView.skills": "技能",
+ "skillView.skillsDesc": "为助理添加完成特定任务的技能。点开一项,查看使用说明和资源。",
"startConversation": "开始对话",
"storage.actions.copyAgentGroups.button": "复制到…",
"storage.actions.copyAgentGroups.desc": "将代理组及其成员代理复制到另一个工作区或个人账户。",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 7c6be341d42..1d8471a9c45 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -1,4 +1,26 @@
export default {
+ 'connectorMarket.action.connect': 'Connect',
+ 'connectorMarket.action.details': 'View details',
+ 'connectorMarket.action.install': 'Install',
+ 'connectorMarket.action.manage': 'Manage',
+ 'connectorMarket.add': 'Add',
+ 'connectorMarket.add.browseStore': 'Browse Skill Store',
+ 'connectorMarket.add.browseStoreDesc': 'Built-in tools, skills and MCP servers',
+ 'connectorMarket.add.custom': 'Add custom connector',
+ 'connectorMarket.add.customDesc': 'Connect your own MCP server',
+ 'connectorMarket.detail.byAuthor': 'By {{author}}',
+ 'connectorMarket.detail.information': 'Information',
+ 'connectorMarket.detail.tools': 'Tools',
+ 'connectorMarket.detail.type': 'Type',
+ 'connectorMarket.empty.clear': 'Clear search',
+ 'connectorMarket.empty.search': 'No connectors match “{{keyword}}”',
+ 'connectorMarket.empty.searchDesc': 'Try another name, or find more in the Skill Store.',
+ 'connectorMarket.refresh': 'Refresh',
+ 'connectorMarket.search.placeholder': 'Search connectors',
+ 'connectorMarket.section.installed': 'Installed',
+ 'connectorMarket.section.showAll': 'Show all',
+ 'connectorMarket.section.showLess': 'Show less',
+ 'connectorMarket.source': 'Source',
'systemAgent.channelRouting.title': 'Channel decision model',
'systemAgent.channelRouting.modelDesc':
'Choose which Agents reply to messages without @mentions. When off, all eligible Agents reply.',
@@ -1957,7 +1979,13 @@ When I am ___, I need ___
'skillView.connectors': 'Connectors',
'skillView.connectorsDesc':
'Connect the apps and tools your agents can use. Open one to see its account and tools.',
+ 'skillView.empty.description': 'Browse the Skill Store or import a skill from the Add menu.',
+ 'skillView.empty.search': 'No skills match “{{keyword}}”',
+ 'skillView.empty.title': 'No skills yet',
+ 'skillView.search.placeholder': 'Search skills',
'skillView.skills': 'Skills',
+ 'skillView.skillsDesc':
+ 'Give your agents task-specific skills. Open a skill to see its instructions and resources.',
'startConversation': 'Start Conversation',
'storage.actions.transfer.button': 'Move to…',
'storage.actions.transfer.desc':
diff --git a/plugins/vite/platformResolve.test.ts b/plugins/vite/platformResolve.test.ts
new file mode 100644
index 00000000000..c5f6557c5cf
--- /dev/null
+++ b/plugins/vite/platformResolve.test.ts
@@ -0,0 +1,47 @@
+import { mkdtemp, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { runInNewContext } from 'node:vm';
+
+import { build } from 'vite';
+import { expect, it } from 'vitest';
+
+import { vitePlatformResolve } from './platformResolve';
+
+it.each(['desktop', 'mobile', 'vite'] as const)(
+ 'lets a %s override reuse base exports without resolving back to itself',
+ async (suffix) => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'vite-platform-resolve-'));
+ try {
+ await Promise.all([
+ writeFile(path.join(directory, 'entry.ts'), 'export { owner, platform } from "./owner";'),
+ writeFile(path.join(directory, 'owner.ts'), 'export const owner = "main";'),
+ writeFile(
+ path.join(directory, `owner.${suffix}.ts`),
+ `export { owner } from "./owner"; export const platform = "${suffix}";`,
+ ),
+ ]);
+ const result = await build({
+ build: {
+ lib: { entry: path.join(directory, 'entry.ts'), formats: ['cjs'] },
+ minify: false,
+ write: false,
+ },
+ configFile: false,
+ logLevel: 'silent',
+ plugins: [vitePlatformResolve(suffix === 'vite' ? undefined : suffix)],
+ root: directory,
+ });
+ const outputs = Array.isArray(result) ? result : [result];
+ const entry = outputs
+ .flatMap(({ output }) => output)
+ .find((output) => output.type === 'chunk' && output.isEntry);
+ if (!entry || entry.type !== 'chunk') throw new Error('Missing fixture entry bundle');
+ const exports = {};
+ runInNewContext(entry.code, { exports });
+ expect(exports).toMatchObject({ owner: 'main', platform: suffix });
+ } finally {
+ await rm(directory, { force: true, recursive: true });
+ }
+ },
+);
diff --git a/plugins/vite/platformResolve.ts b/plugins/vite/platformResolve.ts
index 882f87473ad..8144eb39847 100644
--- a/plugins/vite/platformResolve.ts
+++ b/plugins/vite/platformResolve.ts
@@ -42,6 +42,10 @@ export function vitePlatformResolve(platform?: Platform): Plugin {
for (const suffix of suffixes) {
const candidate = `${basePath}${suffix}${ext}`;
+ // An override may reuse its base module; do not redirect it to itself.
+ if (importer.split('?')[0].replaceAll('\\', '/') === candidate.replaceAll('\\', '/')) {
+ return null;
+ }
try {
await access(candidate);
return candidate;
diff --git a/plugins/vite/sharedRendererConfig.markdown.test.ts b/plugins/vite/sharedRendererConfig.markdown.test.ts
new file mode 100644
index 00000000000..6832e0f3bfc
--- /dev/null
+++ b/plugins/vite/sharedRendererConfig.markdown.test.ts
@@ -0,0 +1,62 @@
+// @vitest-environment node
+import { mkdir, mkdtemp, rm, symlink, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+
+import { optimizeDeps, resolveConfig } from 'vite';
+import { expect, it } from 'vitest';
+
+import { sharedOptimizeDeps } from './sharedRendererConfig';
+
+it('initializes CJK markdown after pre-bundling with its own mdast version', async () => {
+ const root = await mkdtemp(path.join(tmpdir(), 'markdown-prebundle-'));
+ try {
+ const modules = path.join(root, 'node_modules');
+ const fixture = path.join(modules, 'markdown-fixture');
+ await mkdir(fixture, { recursive: true });
+ for (const name of ['unified', 'remark-cjk-friendly', 'mdast-util-to-markdown']) {
+ await symlink(
+ path.resolve(import.meta.dirname, '../../node_modules', name),
+ path.join(modules, name),
+ );
+ }
+ await writeFile(
+ path.join(fixture, 'package.json'),
+ JSON.stringify({ name: 'markdown-fixture', type: 'module', exports: './index.js' }),
+ );
+ await writeFile(
+ path.join(fixture, 'index.js'),
+ `import { unified } from 'unified';
+import remarkCjkFriendly from 'remark-cjk-friendly';
+export const createProcessor = () => unified().use(remarkCjkFriendly).freeze();`,
+ );
+ const config = await resolveConfig(
+ {
+ cacheDir: path.join(root, '.vite'),
+ configFile: false,
+ logLevel: 'silent',
+ optimizeDeps: {
+ exclude: sharedOptimizeDeps.exclude,
+ include: ['markdown-fixture'],
+ noDiscovery: true,
+ },
+ root,
+ },
+ 'serve',
+ );
+ const metadata = await optimizeDeps(config, true);
+ const { createProcessor } = await import(
+ /* @vite-ignore */ pathToFileURL(metadata.optimized['markdown-fixture'].file).href
+ );
+ expect(createProcessor().data()).toMatchObject({
+ toMarkdownExtensions: [
+ {
+ handlers: { emphasis: expect.any(Function), strong: expect.any(Function) },
+ },
+ ],
+ });
+ } finally {
+ await rm(root, { force: true, recursive: true });
+ }
+});
diff --git a/plugins/vite/sharedRendererConfig.test.ts b/plugins/vite/sharedRendererConfig.test.ts
index dec134f4c3a..a1e07353e6e 100644
--- a/plugins/vite/sharedRendererConfig.test.ts
+++ b/plugins/vite/sharedRendererConfig.test.ts
@@ -71,6 +71,7 @@ describe('sharedOptimizeDeps', () => {
'@lobehub/ui/stylex/cssVar.stylex',
'@lobehub/ui/stylex/media.stylex',
'mdast-util-to-markdown',
+ 'remark-cjk-friendly',
]);
});
});
diff --git a/plugins/vite/sharedRendererConfig.ts b/plugins/vite/sharedRendererConfig.ts
index faf3bfd3495..e725e769126 100644
--- a/plugins/vite/sharedRendererConfig.ts
+++ b/plugins/vite/sharedRendererConfig.ts
@@ -581,7 +581,9 @@ export const sharedOptimizeDeps = {
// Vite resolves an optimized dep by bare name for every importer. Pre-bundling
// the workspace-pinned 2.1.x would hand it to mdast-util-to-markdown-cjk-friendly,
// which needs the 2.2 attention API, and <Markdown> throws in dev.
- exclude: [...stylexTokenModules, 'mdast-util-to-markdown'],
+ // Keep its remark importer unbundled too: otherwise the external mdast import
+ // moves into the optimizer's output and resolves from the root, not the CJK package.
+ exclude: [...stylexTokenModules, 'mdast-util-to-markdown', 'remark-cjk-friendly'],
include: [
'react',
'react-dom',
diff --git a/src/components/Skeleton/Settings/tabs/Connector.tsx b/src/components/Skeleton/Settings/tabs/Connector.tsx
index 18fb5678d4c..77f45d27f38 100644
--- a/src/components/Skeleton/Settings/tabs/Connector.tsx
+++ b/src/components/Skeleton/Settings/tabs/Connector.tsx
@@ -1,116 +1,23 @@
'use client';
-import { cssVar, Flexbox, Text } from '@lobehub/ui';
-import { useTranslation } from 'react-i18next';
-
-import SkeletonBar from '../../Bar';
-import { SettingsSkeletonHeader } from '../Frame';
import { SkillNavListSkeleton } from './Skill';
+import { SkillCatalogPageSkeleton } from './SkillCatalog';
import type { SettingsTabSkeleton } from './types';
-const SECTIONS = [
- { key: 'skillGroup.builtinTools', rows: 5 },
- { key: 'skillGroup.communityConnectors', rows: 4 },
-] as const;
-
-const Line = ({ bar, height, width }: { bar: number; height: number; width: number | string }) => (
- <Flexbox height={height} justify={'center'} style={{ minWidth: 0 }}>
- <SkeletonBar height={bar} width={width} />
- </Flexbox>
-);
-
-/** The Store icon button and "Add Custom Connector" button on the intro row. */
-const PageActions = () => (
- <Flexbox horizontal flex={'none'} gap={8}>
- <SkeletonBar height={32} width={32} />
- <SkeletonBar height={32} width={176} />
- </Flexbox>
-);
-
-/**
- * The connector page list (`LeftPanel` in page mode): the intro line with the
- * page actions, then
- * per group a 13px heading with its count and `SkillListRow` page rows — a 36px
- * icon tile, title + summary, status and chevron in a 60px row. Headings and
- * the intro are static copy.
- */
-const PageList = () => {
- const { t } = useTranslation('setting');
-
- return (
- <Flexbox aria-busy data-testid={'settings-connector-skeleton'}>
- <Flexbox
- horizontal
- align={'center'}
- gap={16}
- justify={'space-between'}
- paddingInline={12}
- style={{ flexShrink: 0, paddingBlock: '24px 4px' }}
- >
- <Text type={'secondary'}>{t('skillView.connectorsDesc')}</Text>
- <PageActions />
- </Flexbox>
- <Flexbox gap={2} style={{ paddingBlockEnd: 24 }}>
- {SECTIONS.map(({ key, rows }) => (
- <Flexbox gap={2} key={key}>
- <Flexbox
- horizontal
- align={'center'}
- gap={8}
- paddingInline={12}
- style={{ paddingBlock: '24px 8px' }}
- >
- <Text fontSize={13} weight={600}>
- {t(key)}
- </Text>
- <SkeletonBar height={12} width={16} />
- </Flexbox>
- {Array.from({ length: rows }, (_, index) => (
- <Flexbox
- horizontal
- align={'center'}
- gap={12}
- key={index}
- paddingBlock={10}
- paddingInline={12}
- style={{ minHeight: 60 }}
- >
- <SkeletonBar height={36} radius={cssVar.borderRadius} width={36} />
- <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
- <Line bar={14} height={22} width={96 + (index % 3) * 32} />
- <Line bar={12} height={18} width={`${48 + (index % 2) * 16}%`} />
- </Flexbox>
- <Line bar={12} height={20} width={56} />
- <SkeletonBar height={16} width={16} />
- </Flexbox>
- ))}
- </Flexbox>
- ))}
- </Flexbox>
- </Flexbox>
- );
-};
-
-/**
- * `ToolSettings` in connector mode draws its own header over a centred 960px
- * column, so the skeleton draws that frame itself.
- */
-const Page = () => (
- <Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
- <SettingsSkeletonHeader tab={'connector'} />
- <Flexbox horizontal flex={1} justify={'center'} style={{ overflow: 'hidden' }}>
- <Flexbox style={{ maxWidth: 960, width: '100%' }}>
- <PageList />
- </Flexbox>
- </Flexbox>
- </Flexbox>
-);
-
-/** Mobile renders the nav-style list (title + add + store buttons) under the mobile header. */
+/** Mobile keeps the nav list, whose groups are the connector types. */
const Body = () => (
- <SkillNavListSkeleton fullWidth sections={[...SECTIONS]} titleKey={'skillView.connectors'} />
+ <SkillNavListSkeleton
+ fullWidth
+ titleKey={'skillView.connectors'}
+ sections={[
+ { key: 'skillGroup.builtinTools', rows: 5 },
+ { key: 'skillGroup.communityConnectors', rows: 4 },
+ ]}
+ />
);
+const Page = () => <SkillCatalogPageSkeleton viewMode={'connector'} />;
+
const ConnectorSkeleton: SettingsTabSkeleton = { Body, Page };
export default ConnectorSkeleton;
diff --git a/src/components/Skeleton/Settings/tabs/Skill.tsx b/src/components/Skeleton/Settings/tabs/Skill.tsx
index 56278b7420f..e35f68d1437 100644
--- a/src/components/Skeleton/Settings/tabs/Skill.tsx
+++ b/src/components/Skeleton/Settings/tabs/Skill.tsx
@@ -4,10 +4,9 @@ import { cssVar, Flexbox, Text } from '@lobehub/ui';
import { ChevronDownIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import NavHeader from '@/features/NavHeader';
-
import SkeletonBar from '../../Bar';
import { SkeletonItem } from '../../NavPanel/List';
+import { SkillCatalogListSkeleton, SkillCatalogPageSkeleton } from './SkillCatalog';
import type { SettingsTabSkeleton } from './types';
interface NavSection {
@@ -93,37 +92,9 @@ export const SkillNavListSkeleton = ({
);
};
-/** The detail pane opened on the first built-in skill: icon + title head over its text. */
-const DetailPane = () => (
- <Flexbox flex={1} gap={24} padding={24} style={{ minWidth: 0 }}>
- <Flexbox horizontal align={'center'} gap={12}>
- <SkeletonBar height={40} radius={cssVar.borderRadius} width={40} />
- <Flexbox flex={1} gap={6}>
- <SkeletonBar height={18} width={160} />
- <SkeletonBar height={12} width={'48%'} />
- </Flexbox>
- </Flexbox>
- <Flexbox gap={12}>
- {[100, 92, 96, 64, 88, 72].map((width, index) => (
- <SkeletonBar height={14} key={index} width={`${width}%`} />
- ))}
- </Flexbox>
- </Flexbox>
-);
-
-/** Mobile shows the list full width under the mobile header. */
-const Body = () => <SkillNavListSkeleton fullWidth />;
+const Body = () => <SkillCatalogListSkeleton viewMode={'skill'} />;
-/** Desktop is a split pane under an empty navigation header, like `ToolSettings`. */
-const Page = () => (
- <Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
- <NavHeader />
- <Flexbox horizontal flex={1} style={{ overflow: 'hidden' }}>
- <SkillNavListSkeleton />
- <DetailPane />
- </Flexbox>
- </Flexbox>
-);
+const Page = () => <SkillCatalogPageSkeleton viewMode={'skill'} />;
const SkillSkeleton: SettingsTabSkeleton = { Body, Page };
diff --git a/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx
new file mode 100644
index 00000000000..7044cf91668
--- /dev/null
+++ b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx
@@ -0,0 +1,111 @@
+'use client';
+
+import { cssVar, Flexbox, Text } from '@lobehub/ui';
+import { media } from '@lobehub/ui/stylex/media.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { useTranslation } from 'react-i18next';
+
+import NavHeader from '@/features/NavHeader';
+
+import SkeletonBar from '../../Bar';
+
+const styles = stylex.create({
+ grid: {
+ columnGap: 32,
+ display: 'grid',
+ gridTemplateColumns: { default: 'repeat(2, minmax(0, 1fr))', [media.lg]: 'minmax(0, 1fr)' },
+ rowGap: 4,
+ },
+});
+
+interface SkillCatalogProps {
+ viewMode: 'connector' | 'skill';
+}
+
+/** The shared catalog header and two-column rows used by skills and connectors. */
+export const SkillCatalogListSkeleton = ({ viewMode }: SkillCatalogProps) => {
+ const { t } = useTranslation('setting');
+ const skills = viewMode === 'skill';
+ const sections = skills
+ ? (['skillGroup.builtinSkills', 'skillGroup.communitySkills'] as const)
+ : (['connectorMarket.section.installed', 'skillGroup.communityConnectors'] as const);
+
+ return (
+ <Flexbox aria-busy data-testid={`settings-${viewMode}-skeleton`}>
+ <Flexbox
+ horizontal
+ align={'flex-start'}
+ gap={16}
+ justify={'space-between'}
+ paddingInline={12}
+ style={{ flexShrink: 0, flexWrap: 'wrap', paddingBlock: '32px 8px' }}
+ >
+ <Flexbox gap={4}>
+ <Text fontSize={cssVar.fontSizeHeading3} weight={600}>
+ {t(skills ? 'skillView.skills' : 'skillView.connectors')}
+ </Text>
+ <Text type={'secondary'}>
+ {t(skills ? 'skillView.skillsDesc' : 'skillView.connectorsDesc')}
+ </Text>
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <SkeletonBar height={32} width={240} />
+ <SkeletonBar height={32} width={80} />
+ </Flexbox>
+ </Flexbox>
+ <Flexbox gap={40} paddingBlock={24}>
+ {sections.map((key, section) => (
+ <Flexbox gap={8} key={key}>
+ <Flexbox horizontal align={'center'} gap={8} paddingInline={12}>
+ <Text fontSize={cssVar.fontSizeHeading5} weight={600}>
+ {t(key)}
+ </Text>
+ <SkeletonBar height={14} width={16} />
+ </Flexbox>
+ <div {...stylex.props(styles.grid)}>
+ {Array.from({ length: section === 0 ? 6 : 4 }, (_, index) => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={12}
+ key={index}
+ paddingBlock={12}
+ paddingInline={12}
+ style={{ minHeight: 64, minWidth: 0 }}
+ >
+ <SkeletonBar height={40} radius={cssVar.borderRadiusLG} width={40} />
+ <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
+ <Flexbox height={22} justify={'center'}>
+ <SkeletonBar height={14} width={96 + (index % 3) * 32} />
+ </Flexbox>
+ <Flexbox height={20} justify={'center'}>
+ <SkeletonBar height={12} width={`${64 + (index % 2) * 16}%`} />
+ </Flexbox>
+ </Flexbox>
+ <SkeletonBar height={20} width={20} />
+ </Flexbox>
+ ))}
+ </div>
+ </Flexbox>
+ ))}
+ </Flexbox>
+ </Flexbox>
+ );
+};
+
+export const SkillCatalogPageSkeleton = (props: SkillCatalogProps) => (
+ <Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
+ <NavHeader />
+ <Flexbox
+ horizontal
+ flex={1}
+ justify={'center'}
+ paddingInline={12}
+ style={{ overflow: 'hidden' }}
+ >
+ <Flexbox style={{ maxWidth: 1048, width: '100%' }}>
+ <SkillCatalogListSkeleton {...props} />
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+);
diff --git a/src/features/Connectors/ConnectorDetail/ConnectorDetailIcon.tsx b/src/features/Connectors/ConnectorDetail/ConnectorDetailIcon.tsx
index 1e10b83c406..1b50e7cb622 100644
--- a/src/features/Connectors/ConnectorDetail/ConnectorDetailIcon.tsx
+++ b/src/features/Connectors/ConnectorDetail/ConnectorDetailIcon.tsx
@@ -7,7 +7,7 @@ import type { ConnectorWithTools } from '@/store/tool/slices/connector/types';
import ConnectorBrandIcon from '../ConnectorBrandIcon';
-const ICON_SIZE = 28;
+const ICON_SIZE = { large: 40, middle: 28 } as const;
const styles = stylex.create({
tile: {
@@ -21,22 +21,29 @@ const styles = stylex.create({
overflow: 'hidden',
width: 48,
},
+ tileLarge: {
+ borderRadius: cssVar.borderRadiusLG,
+ height: 64,
+ width: 64,
+ },
});
interface ConnectorDetailIconProps {
connector: Pick<ConnectorWithTools, 'identifier' | 'name' | 'sourceType'>;
+ /** `large` heads the detail page; `middle` sits in denser layouts. */
+ size?: keyof typeof ICON_SIZE;
}
/**
* The same brand mark the list row shows, so the detail page reads as the
* row it was opened from.
*/
-const ConnectorDetailIcon = memo<ConnectorDetailIconProps>(({ connector }) => (
- <Center {...stylex.props(styles.tile)}>
+const ConnectorDetailIcon = memo<ConnectorDetailIconProps>(({ connector, size = 'middle' }) => (
+ <Center {...stylex.props(styles.tile, size === 'large' && styles.tileLarge)}>
<ConnectorBrandIcon
identifier={connector.identifier}
name={connector.name}
- size={ICON_SIZE}
+ size={ICON_SIZE[size]}
sourceType={connector.sourceType}
/>
</Center>
diff --git a/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx b/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx
index 1396c35d08a..27d936b3bad 100644
--- a/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx
+++ b/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx
@@ -11,28 +11,19 @@ import { useToolStore } from '@/store/tool';
import { builtinToolSelectors } from '@/store/tool/selectors';
import type { ConnectorWithTools } from '@/store/tool/slices/connector/types';
+// A quiet key–value list: labels in a fixed column, no boxes or row rules.
const styles = stylex.create({
label: {
color: cssVar.colorTextTertiary,
flexShrink: 0,
- fontSize: 13,
- width: 96,
+ fontSize: 14,
+ width: 160,
},
list: {
- borderColor: cssVar.colorBorderSecondary,
- borderRadius: 8,
- borderStyle: 'solid',
- borderWidth: 1,
- paddingBlock: 4,
- paddingInline: 12,
+ display: 'flex',
+ flexDirection: 'column',
},
row: {
- borderBlockEndColor: {
- ':last-child': 'transparent',
- 'default': cssVar.colorBorderSecondary,
- },
- borderBlockEndStyle: 'solid',
- borderBlockEndWidth: 1,
minHeight: 40,
},
});
@@ -98,8 +89,12 @@ const ConnectorOverviewInfo = memo<ConnectorOverviewInfoProps>(({ connector }) =
// An OAuth connector is authorized per account, and each account names its
// own authorizer under Accounts. A connector-wide "Authorized by" would name
// only the creator — even before anyone has authorized an account.
+ // An uninstalled built-in is not in use, so nobody has authorized it.
const showAuthorizer =
- !!connector.authorizedByName && connector.authKind !== 'oauth2' && !connector.links?.length;
+ !!connector.authorizedByName &&
+ connector.authKind !== 'oauth2' &&
+ !connector.links?.length &&
+ !(isBuiltin && !isBuiltinInstalled);
return (
<div {...stylex.props(styles.list)}>
diff --git a/src/features/Connectors/ConnectorDetail/Section.tsx b/src/features/Connectors/ConnectorDetail/Section.tsx
index 924a78fe698..3adfe3ec85f 100644
--- a/src/features/Connectors/ConnectorDetail/Section.tsx
+++ b/src/features/Connectors/ConnectorDetail/Section.tsx
@@ -4,10 +4,16 @@ import * as stylex from '@stylexjs/stylex';
import type { ReactNode } from 'react';
const styles = stylex.create({
+ // A page heading over a thin rule, so the detail reads as one scrolling page.
label: {
- color: cssVar.colorTextTertiary,
- fontSize: 12,
- fontWeight: 500,
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ borderBlockEndStyle: 'solid',
+ borderBlockEndWidth: 1,
+ color: cssVar.colorText,
+ flex: '1',
+ fontSize: cssVar.fontSizeHeading5,
+ fontWeight: 600,
+ paddingBlockEnd: 8,
},
});
@@ -15,12 +21,12 @@ interface SectionProps {
children: ReactNode;
/** The section's own action (e.g. "Connect another account"), aligned with its label. */
extra?: ReactNode;
- label: string;
+ label: ReactNode;
}
-/** One labelled block of the connector Overview tab. */
+/** One labelled block of the connector detail page. */
const Section = ({ children, extra, label }: SectionProps) => (
- <Flexbox gap={8}>
+ <Flexbox gap={12}>
{extra ? (
<Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
<span {...stylex.props(styles.label)}>{label}</span>
diff --git a/src/features/Connectors/ConnectorDetail/index.test.tsx b/src/features/Connectors/ConnectorDetail/index.test.tsx
index 456139c7cd1..ff3bb4be9cc 100644
--- a/src/features/Connectors/ConnectorDetail/index.test.tsx
+++ b/src/features/Connectors/ConnectorDetail/index.test.tsx
@@ -34,6 +34,7 @@ const mocks = vi.hoisted(() => ({
deleteConnector: vi.fn(),
disconnectConnector: vi.fn(),
fetchConnectors: vi.fn(),
+ installBuiltinTool: vi.fn(),
resetConnectorPermissions: vi.fn(),
syncBuiltinTool: vi.fn(),
syncConnectorTools: vi.fn(),
@@ -42,6 +43,7 @@ const mocks = vi.hoisted(() => ({
uninstallBuiltinTool: vi.fn(),
uninstalledBuiltinTools: [] as string[],
uninstallMCPPlugin: vi.fn(),
+ useFetchUninstalledBuiltinTools: vi.fn(),
updateToolPermission: vi.fn(),
},
manageable: {
@@ -232,7 +234,7 @@ describe('ConnectorDetail', () => {
expect(screen.getByRole('button', { name: 'Uninstall' })).toBeInTheDocument();
});
- it('keeps authorization and identity in Overview and moves permissions to Tools', () => {
+ it('shows authorization, identity and tool permissions on one page', () => {
mocks.toolState.connectors[0] = {
...mocks.toolState.connectors[0],
authorizedByName: 'Avery',
@@ -245,18 +247,15 @@ describe('ConnectorDetail', () => {
render(<ConnectorDetail connectorId="connector-1" />);
- // Overview: connection status, identity and lifecycle actions; no permission matrix.
+ // One page: status and identity, the lifecycle actions in the header, then
+ // the Tools section with its permission groups and reset.
expect(screen.getByText('connector.connected')).toBeInTheDocument();
expect(screen.getByText('Avery')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Uninstall' })).toBeInTheDocument();
- expect(screen.queryByTestId('permission-group')).not.toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('tab', { name: /connector\.tab\.tools/ }));
-
- // Tools: the permission groups and reset, without the lifecycle actions.
+ expect(screen.queryByRole('tab')).not.toBeInTheDocument();
+ expect(screen.getByText('connectorMarket.detail.tools')).toBeInTheDocument();
expect(screen.getAllByTestId('permission-group')).toHaveLength(4);
expect(screen.getByRole('button', { name: 'Reset permissions' })).toBeInTheDocument();
- expect(screen.queryByRole('button', { name: 'Uninstall' })).not.toBeInTheDocument();
});
it('reports an authorization error instead of "not connected"', () => {
@@ -322,6 +321,57 @@ describe('ConnectorDetail', () => {
expect(screen.getByText('connector.enabled')).toBeInTheDocument();
});
+ it('offers Install instead of Uninstall for an uninstalled built-in tool', () => {
+ mocks.toolState.connectors[0] = {
+ id: 'connector-1',
+ identifier: 'lobe-web-browsing',
+ name: 'Web Browsing',
+ sourceType: ConnectorSourceType.builtin,
+ };
+ mocks.toolState.uninstalledBuiltinTools = ['lobe-web-browsing'];
+
+ render(<ConnectorDetail connectorId="connector-1" />);
+
+ expect(screen.queryByRole('button', { name: 'Uninstall' })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: 'connectorMarket.action.install' }));
+ expect(mocks.toolState.installBuiltinTool).toHaveBeenCalledWith('lobe-web-browsing');
+ });
+
+ it('does not name an authorizer for an uninstalled built-in', () => {
+ mocks.toolState.connectors[0] = {
+ authorizedByName: 'Avery',
+ id: 'connector-1',
+ identifier: 'lobe-web-browsing',
+ name: 'Web Browsing',
+ sourceType: ConnectorSourceType.builtin,
+ };
+ mocks.toolState.uninstalledBuiltinTools = ['lobe-web-browsing'];
+
+ const { unmount } = render(<ConnectorDetail connectorId="connector-1" />);
+ expect(screen.queryByText('connector.overview.authorizedBy')).not.toBeInTheDocument();
+ expect(screen.queryByText('Avery')).not.toBeInTheDocument();
+ unmount();
+
+ // Once installed, the built-in keeps its authorizer.
+ mocks.toolState.uninstalledBuiltinTools = [];
+ render(<ConnectorDetail connectorId="connector-1" />);
+ expect(screen.getByText('connector.overview.authorizedBy')).toBeInTheDocument();
+ expect(screen.getByText('Avery')).toBeInTheDocument();
+ });
+
+ it('loads the built-in install state when the detail is opened without the list', () => {
+ mocks.toolState.connectors[0] = {
+ id: 'connector-1',
+ identifier: 'lobe-web-browsing',
+ name: 'Web Browsing',
+ sourceType: ConnectorSourceType.builtin,
+ };
+
+ render(<ConnectorDetail connectorId="connector-1" />);
+
+ expect(mocks.toolState.useFetchUninstalledBuiltinTools).toHaveBeenCalledWith(true);
+ });
+
it('shows accounts only for an OAuth connector, each naming its own authorizer', () => {
mocks.toolState.connectors[0] = {
...mocks.toolState.connectors[0],
diff --git a/src/features/Connectors/ConnectorDetail/index.tsx b/src/features/Connectors/ConnectorDetail/index.tsx
index a61c7b9519d..79be8180405 100644
--- a/src/features/Connectors/ConnectorDetail/index.tsx
+++ b/src/features/Connectors/ConnectorDetail/index.tsx
@@ -3,10 +3,10 @@ import {
getLobehubSkillProviderById,
hasCallableMcpEndpoint,
} from '@lobechat/const';
-import { Button, confirmModal, Flexbox, Tabs, Text, toast } from '@lobehub/ui';
+import { Button, confirmModal, Flexbox, Text, toast } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { PencilIcon, RefreshCwIcon, Trash2 } from 'lucide-react';
+import { PencilIcon, Plus, RefreshCwIcon, Trash2 } from 'lucide-react';
import type { ReactNode } from 'react';
import { memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -16,6 +16,7 @@ import { ConnectorSourceType } from '@/database/schemas';
import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';
import { refreshConnectorManagePolicy } from '@/services/connectorManagePolicy';
import { useToolStore } from '@/store/tool';
+import { builtinToolSelectors } from '@/store/tool/selectors';
import { connectorSelectors } from '@/store/tool/slices/connector';
import { type ConnectorActionError, toConnectorActionError } from '@/utils/connectorActionError';
@@ -48,14 +49,13 @@ interface ConnectorDetailProps {
onDelete?: () => void;
}
-type ConnectorDetailTab = 'overview' | 'tools';
-
const styles = stylex.create({
body: {
flex: '1',
minHeight: 0,
overflowY: 'auto',
- paddingBlock: 24,
+ paddingBlockStart: 8,
+ paddingBlockEnd: 24,
paddingInline: 16,
},
description: {
@@ -63,32 +63,29 @@ const styles = stylex.create({
fontSize: 14,
lineHeight: 1.6,
},
+ // Identity on the left (icon, name, who made it and what it is), the
+ // connector's own actions on the right; one scrolling page below.
header: {
flexShrink: 0,
+ flexWrap: 'wrap',
paddingBlockStart: '8px',
- paddingBlockEnd: '16px',
+ paddingBlockEnd: '24px',
paddingInline: 16,
},
meta: {
color: cssVar.colorTextSecondary,
- fontSize: 13,
+ fontSize: 14,
},
root: {
display: 'flex',
flexDirection: 'column',
height: '100%',
},
- tabs: {
- borderBlockEndColor: cssVar.colorBorderSecondary,
- borderBlockEndStyle: 'solid',
- borderBlockEndWidth: 1,
- flexShrink: 0,
- paddingInline: 8,
- },
title: {
- fontSize: 20,
+ color: cssVar.colorText,
+ fontSize: cssVar.fontSizeHeading3,
fontWeight: 600,
- lineHeight: 1.4,
+ lineHeight: 1.3,
marginBlock: 0,
},
});
@@ -99,7 +96,6 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
const { t: ts } = useTranslation('setting');
const [customModalOpen, setCustomModalOpen] = useState(false);
- const [tab, setTab] = useState<ConnectorDetailTab>('overview');
const connector = useToolStore(connectorSelectors.connectorById(connectorId));
const { readTools, createTools, updateTools, deleteTools } = useToolStore(
@@ -115,6 +111,8 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
const deleteConnector = useToolStore((s) => s.deleteConnector);
const forgetComposioConnection = useToolStore((s) => s.forgetComposioConnection);
const uninstallBuiltinTool = useToolStore((s) => s.uninstallBuiltinTool);
+ const installBuiltinTool = useToolStore((s) => s.installBuiltinTool);
+ const useFetchUninstalledBuiltinTools = useToolStore((s) => s.useFetchUninstalledBuiltinTools);
const uninstallMCPPlugin = useToolStore((s) => s.uninstallMCPPlugin);
const fetchConnectors = useToolStore((s) => s.fetchConnectors);
const updateToolPermission = useToolStore((s) => s.updateToolPermission);
@@ -125,6 +123,13 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
isMcpConnector &&
(connector?.mcpConnectionType === 'http' || connector?.mcpConnectionType === 'stdio');
const isBuiltin = connector?.sourceType === ConnectorSourceType.builtin;
+ // A detail opened by link mounts without the list, which is what loads the
+ // built-in install state; load it here so Status and the actions match the list.
+ useFetchUninstalledBuiltinTools(isBuiltin);
+ const isBuiltinInstalled = useToolStore(
+ builtinToolSelectors.isBuiltinToolInstalled(connector?.identifier ?? ''),
+ );
+ const isUninstalledBuiltin = isBuiltin && !isBuiltinInstalled;
const isMarketplace = connector?.sourceType === ConnectorSourceType.marketplace;
// Members co-maintain shared connectors unless the workspace restricted it;
@@ -379,7 +384,27 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</>
)}
{/* Uninstall for builtin and marketplace tools */}
- {(isBuiltin || isMarketplace) && (
+ {/* An uninstalled built-in offers the way back in, not another Uninstall. */}
+ {isUninstalledBuiltin && (
+ <ManageTooltip title={credentialsTooltip}>
+ <Button
+ disabled={!canManageCredentials}
+ icon={<Plus size={14} />}
+ size="small"
+ type="primary"
+ onClick={async () => {
+ try {
+ await installBuiltinTool(connector.identifier);
+ } catch (error) {
+ notifyActionError(error);
+ }
+ }}
+ >
+ {ts('connectorMarket.action.install')}
+ </Button>
+ </ManageTooltip>
+ )}
+ {((isBuiltin && !isUninstalledBuiltin) || isMarketplace) && (
<ManageTooltip title={credentialsTooltip}>
<Button
danger
@@ -409,11 +434,8 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</Section>
)}
- <Section label={t('connector.overview.connection')}>
+ <Section label={ts('connectorMarket.detail.information')}>
<ConnectorOverviewInfo connector={connector} />
- <Flexbox horizontal gap={8} paddingBlock={'4px 0'} wrap={'wrap'}>
- {actions}
- </Flexbox>
</Section>
{/* Accounts are their own section: removing one account is not the
@@ -432,7 +454,7 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
);
const tools = hasTools ? (
- <Flexbox gap={16}>
+ <Flexbox gap={12}>
<Flexbox horizontal align={'center'} gap={16} justify={'space-between'}>
{/* The count already sits under the title; say what the controls decide instead. */}
<Text fontSize={13} type={'secondary'}>
@@ -492,53 +514,63 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</div>
);
+ // Built-in tools ship with LobeHub; other sources name no single author.
+ const author = isBuiltin ? 'LobeHub' : undefined;
+
return (
<div {...stylex.props(styles.root)}>
- <Flexbox horizontal align={'center'} gap={16} {...stylex.props(styles.header)}>
- <ConnectorDetailIcon connector={connector} />
- <Flexbox gap={2} style={{ minWidth: 0 }}>
- <h2 {...stylex.props(styles.title)}>{connectorName}</h2>
- <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.meta)}>
- <span>{t(`connector.kind.${getConnectorKind(connector)}`)}</span>
- {hasTools && (
- <>
- <span aria-hidden>·</span>
- <span>{t('connector.toolCount', { count: toolCount })}</span>
- </>
- )}
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={16}
+ justify={'space-between'}
+ {...stylex.props(styles.header)}
+ >
+ <Flexbox horizontal align={'center'} gap={16} style={{ minWidth: 0 }}>
+ <ConnectorDetailIcon connector={connector} size={'large'} />
+ <Flexbox gap={4} style={{ minWidth: 0 }}>
+ <h2 {...stylex.props(styles.title)}>{connectorName}</h2>
+ <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.meta)}>
+ {author && (
+ <>
+ <span>{ts('connectorMarket.detail.byAuthor', { author })}</span>
+ <span aria-hidden>·</span>
+ </>
+ )}
+ <span>{t(`connector.kind.${getConnectorKind(connector)}`)}</span>
+ {hasTools && (
+ <>
+ <span aria-hidden>·</span>
+ <span>{t('connector.toolCount', { count: toolCount })}</span>
+ </>
+ )}
+ </Flexbox>
</Flexbox>
</Flexbox>
+ <Flexbox horizontal align={'center'} flex={'none'} gap={8} wrap={'wrap'}>
+ {actions}
+ </Flexbox>
</Flexbox>
- {/* Overview (authorization / lifecycle) and Tools (permissions) are two separate jobs */}
- <div {...stylex.props(styles.tabs)}>
- <Tabs
- activeKey={tab}
- size={'middle'}
- variant={'point'}
- items={[
- { key: 'overview', label: t('connector.tab.overview') },
- {
- key: 'tools',
- label: (
- <Flexbox horizontal align={'center'} gap={6}>
- {t('connector.tab.tools')}
- {toolCount > 0 && (
- <Text fontSize={12} type={'secondary'}>
- {toolCount}
- </Text>
- )}
- </Flexbox>
- ),
- },
- ]}
- onChange={(key) => setTab(key as ConnectorDetailTab)}
- />
- </div>
-
- {/* Body */}
+ {/* One page: what it is and who authorized it, then what its tools may do. */}
<div {...stylex.props(styles.body)}>
- {tab === 'tools' ? tools : overview}
+ <Flexbox gap={32}>
+ {overview}
+ <Section
+ label={
+ <Flexbox horizontal align={'baseline'} as={'span'} gap={8}>
+ {ts('connectorMarket.detail.tools')}
+ {toolCount > 0 && (
+ <Text as={'span'} fontSize={14} type={'secondary'} weight={400}>
+ {toolCount}
+ </Text>
+ )}
+ </Flexbox>
+ }
+ >
+ {tools}
+ </Section>
+ </Flexbox>
{/* Edit modal for an http or stdio custom connector */}
{isEditable && (
diff --git a/src/features/Settings/skill/features/AgentConnectorItem.tsx b/src/features/Settings/skill/features/AgentConnectorItem.tsx
index f61713c208c..f96899c72ce 100644
--- a/src/features/Settings/skill/features/AgentConnectorItem.tsx
+++ b/src/features/Settings/skill/features/AgentConnectorItem.tsx
@@ -7,6 +7,7 @@ import { memo } from 'react';
import type { AgentBoundConnector } from '@/store/tool/slices/connector/types';
+import { RowMoreMenu } from './RowActions';
import SkillListRow, { useSkillListVariant } from './SkillListRow';
/**
@@ -25,7 +26,8 @@ const AgentConnectorItem = memo<{
}>(({ connector, isSelected, onSelect }) => {
// Resolve the same brand icon a base connector of this identifier would use;
// fall back to the generic MCP icon for custom/unknown connectors.
- const iconSize = useSkillListVariant() === 'page' ? 20 : 18;
+ const isPage = useSkillListVariant() === 'page';
+ const iconSize = isPage ? 20 : 18;
const brand =
getComposioAppByIdentifier(connector.identifier) ??
getLobehubSkillProviderById(connector.identifier);
@@ -39,6 +41,18 @@ const AgentConnectorItem = memo<{
return <Icon icon={McpIcon} size={iconSize} />;
};
+ if (isPage)
+ return (
+ <SkillListRow
+ extra={<RowMoreMenu onOpenDetail={onSelect} />}
+ icon={renderIcon}
+ // The owning agent is what sets this row apart from a base connector.
+ summary={connector.agentTitle || undefined}
+ title={brand?.label || connector.name || connector.identifier}
+ onClick={onSelect}
+ />
+ );
+
return (
<SkillListRow
active={isSelected}
diff --git a/src/features/Settings/skill/features/AgentSkillItem.tsx b/src/features/Settings/skill/features/AgentSkillItem.tsx
index 7d1a56a6201..cf18c316e3b 100644
--- a/src/features/Settings/skill/features/AgentSkillItem.tsx
+++ b/src/features/Settings/skill/features/AgentSkillItem.tsx
@@ -14,18 +14,21 @@ import {
} from '@lobehub/ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import * as stylex from '@stylexjs/stylex';
-import { DownloadIcon, MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';
+import { DownloadIcon, MoreHorizontalIcon, Plus, Settings2, Trash2 } from 'lucide-react';
import { lazy, memo, Suspense, useState } from 'react';
import { useTranslation } from 'react-i18next';
import NavItem from '@/features/NavPanel/components/NavItem';
import { createBuiltinAgentSkillDetailModal } from '@/features/SkillStore/SkillDetail';
import { usePermission } from '@/hooks/usePermission';
+import { useResourceManageable } from '@/hooks/useResourceManageable';
import { agentSkillService } from '@/services/skill';
import { useToolStore } from '@/store/tool';
import { builtinToolSelectors } from '@/store/tool/selectors';
import { downloadFile } from '@/utils/client/downloadFile';
+import { RowAddAction, RowMoreMenu } from './RowActions';
+import SkillListRow, { useSkillListVariant } from './SkillListRow';
import { styles } from './style';
const AgentSkillDetail = lazy(() => import('@/features/AgentSkillDetail'));
@@ -51,6 +54,8 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect
const { allowed: canEdit } = usePermission('edit_own_content');
const isBuiltin = isBuiltinSkill(skill);
+ const isPage = useSkillListVariant() === 'page';
+ const canManage = useResourceManageable(isBuiltin ? undefined : skill.userId);
const deleteAgentSkill = useToolStore((s) => s.deleteAgentSkill);
const [installBuiltinTool, uninstallBuiltinTool, isBuiltinInstalled] = useToolStore((s) => [
@@ -81,7 +86,7 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect
};
const handleUninstall = () => {
- if (!canEdit) return;
+ if (!canEdit || !canManage) return;
confirmModal({
okButtonProps: { danger: true },
onOk: async () => {
@@ -213,6 +218,83 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect
const showDisconnected = isBuiltin && !isBuiltinInstalled;
+ if (isPage) {
+ return (
+ <>
+ <SkillListRow
+ active={isSelected}
+ title={title}
+ extra={
+ showDisconnected ? (
+ <RowAddAction
+ disabled={!canCreate}
+ label={tp('store.actions.install')}
+ loading={loading}
+ onClick={async () => {
+ if (!canCreate || loading) return;
+ setLoading(true);
+ try {
+ await installBuiltinTool(skill.identifier);
+ } finally {
+ setLoading(false);
+ }
+ }}
+ />
+ ) : (
+ <RowMoreMenu
+ items={[
+ ...(!isBuiltin
+ ? [
+ {
+ disabled: !canEdit || !canManage,
+ icon: <Icon icon={Settings2} />,
+ key: 'configure',
+ label: tp('store.actions.configure'),
+ onClick: () => setEditOpen(true),
+ },
+ ]
+ : []),
+ ...(!isBuiltin && skill.zipFileHash
+ ? [
+ {
+ disabled: loading,
+ icon: <Icon icon={DownloadIcon} />,
+ key: 'download',
+ label: tc('download'),
+ onClick: handleDownload,
+ },
+ ]
+ : []),
+ {
+ danger: true,
+ disabled: !canEdit || !canManage || loading,
+ icon: <Icon icon={Trash2} />,
+ key: 'uninstall',
+ label: tp('store.actions.uninstall'),
+ onClick: handleUninstall,
+ },
+ ]}
+ onOpenDetail={onSelect ?? handleOpenDetail}
+ />
+ )
+ }
+ icon={() =>
+ avatar ? <Avatar avatar={avatar} size={20} /> : <Icon icon={SkillsIcon} size={20} />
+ }
+ summary={
+ isBuiltin
+ ? t(`tools.builtins.${skill.identifier}.description`, {
+ defaultValue: skill.description,
+ })
+ : skill.description
+ }
+ onClick={onSelect ?? handleOpenDetail}
+ />
+ {editOpen && renderDetailModal()}
+ </>
+ );
+ }
+
if (onSelect) {
return (
<NavItem
diff --git a/src/features/Settings/skill/features/BuiltinSkillItem.tsx b/src/features/Settings/skill/features/BuiltinSkillItem.tsx
index 0f49db3246e..0ed094d912b 100644
--- a/src/features/Settings/skill/features/BuiltinSkillItem.tsx
+++ b/src/features/Settings/skill/features/BuiltinSkillItem.tsx
@@ -20,6 +20,7 @@ import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
import { builtinToolSelectors } from '@/store/tool/selectors';
+import { RowAddAction, RowMoreMenu } from './RowActions';
import SkillListRow, { useSkillListVariant } from './SkillListRow';
import { styles } from './style';
@@ -96,7 +97,11 @@ const BuiltinSkillItem = memo<BuiltinSkillItemProps>(
},
]}
>
- <Button disabled={!canEdit} icon={MoreHorizontalIcon} />
+ <Button
+ aria-label={t('connectorMarket.action.manage')}
+ disabled={!canEdit}
+ icon={MoreHorizontalIcon}
+ />
</DropdownMenu>
);
}
@@ -108,11 +113,35 @@ const BuiltinSkillItem = memo<BuiltinSkillItemProps>(
);
};
+ // Page row: `+` installs in place; once installed it becomes the manage menu.
+ const renderPageExtra = () =>
+ isInstalled ? (
+ <RowMoreMenu
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit,
+ icon: <Icon icon={Trash2} />,
+ key: 'uninstall',
+ label: t('store.actions.uninstall', { ns: 'plugin' }),
+ onClick: handleUninstall,
+ },
+ ]}
+ onOpenDetail={onSelect}
+ />
+ ) : (
+ <RowAddAction
+ disabled={!canCreate}
+ label={t('connectorMarket.action.install')}
+ onClick={handleInstall}
+ />
+ );
+
if (onSelect) {
return (
<SkillListRow
active={isSelected}
- extra={isPage && !isInstalled ? renderStatus() : undefined}
+ extra={isPage ? renderPageExtra() : undefined}
icon={() => <Avatar avatar={avatar} size={isPage ? 20 : 18} />}
title={title}
titleColor={!isInstalled ? cssVar.colorTextDescription : undefined}
diff --git a/src/features/Settings/skill/features/ComposioSkillItem.tsx b/src/features/Settings/skill/features/ComposioSkillItem.tsx
index 88059578832..faced463fd5 100644
--- a/src/features/Settings/skill/features/ComposioSkillItem.tsx
+++ b/src/features/Settings/skill/features/ComposioSkillItem.tsx
@@ -28,6 +28,7 @@ import {
renderConnectorRowDescription,
} from './ConnectorRowFeedback';
import { isSettledByConnection, useConnectorManageGate } from './connectorRowState';
+import { RowAddAction, RowMoreMenu } from './RowActions';
import SkillListRow, { ConnectedStatus, useSkillListVariant } from './SkillListRow';
import { styles } from './style';
@@ -382,7 +383,40 @@ const ComposioSkillItem = memo<ComposioSkillItemProps>(
// ChatInput skills dropdown UX: connected → green check; pending/errored →
// Re-authorize; not connected → Connect. All open the OAuth flow inline so
// users can tell what is connected instead of hitting a blank detail panel.
+ // Page row: `+` connects in place and a connected row gets the manage menu.
+ // A restricted or stale (pending / errored) connection keeps its explicit
+ // control, since a bare `+` would not say why the first try did not stick.
+ const renderPageExtra = () => {
+ if (isConnected)
+ return (
+ <RowMoreMenu
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit || !canManage,
+ icon: <Icon icon={Unplug} />,
+ key: 'disconnect',
+ label: t('tools.composio.disconnect', { defaultValue: 'Disconnect' }),
+ onClick: handleDisconnect,
+ },
+ ]}
+ onOpenDetail={onSelect}
+ />
+ );
+ return (
+ <RowAddAction
+ disabled={!canCreate || !canEdit || !canManage}
+ disabledReason={!canCreate ? createReason : editReason}
+ label={t('connectorMarket.action.connect')}
+ loading={isConnecting || isWaitingAuth}
+ onClick={handleConnect}
+ />
+ );
+ };
+
const renderNavExtra = () => {
+ if (isPage && (isConnected || (!isRestricted && !isPending && !isError)))
+ return renderPageExtra();
if (isConnecting || isWaitingAuth) {
return <Button disabled loading size="small" type="text" />;
}
diff --git a/src/features/Settings/skill/features/DetailBreadcrumb.tsx b/src/features/Settings/skill/features/DetailBreadcrumb.tsx
new file mode 100644
index 00000000000..032fc5f286d
--- /dev/null
+++ b/src/features/Settings/skill/features/DetailBreadcrumb.tsx
@@ -0,0 +1,64 @@
+'use client';
+
+import { Breadcrumb, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { ChevronRight } from 'lucide-react';
+import { memo } from 'react';
+
+import type { ToolDetailType } from './SkillDetail';
+import { useToolDisplayName } from './useToolDisplayName';
+
+const styles = stylex.create({
+ back: {
+ cursor: 'pointer',
+ padding: 0,
+ borderWidth: 0,
+ borderStyle: 'none',
+ font: 'inherit',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ backgroundColor: 'transparent',
+ },
+ root: { paddingBlock: '16px', paddingInline: '16px' },
+});
+
+interface DetailBreadcrumbProps {
+ identifier: string;
+ /** The list this detail was opened from, e.g. "Connectors". */
+ listLabel: string;
+ onBack: () => void;
+ type: ToolDetailType;
+}
+
+/** `Connectors › <entry>`: the second-level page names where it returns to. */
+const DetailBreadcrumb = memo<DetailBreadcrumbProps>(({ identifier, listLabel, onBack, type }) => {
+ const name = useToolDisplayName(identifier, type);
+
+ return (
+ <div {...stylex.props(styles.root)}>
+ <Breadcrumb
+ separator={<Icon icon={ChevronRight} size={14} />}
+ items={[
+ {
+ title: (
+ <button type={'button'} {...stylex.props(styles.back)} onClick={onBack}>
+ {listLabel}
+ </button>
+ ),
+ },
+ {
+ title: (
+ <Text ellipsis as={'span'} style={{ maxWidth: 320 }} weight={500}>
+ {name}
+ </Text>
+ ),
+ },
+ ]}
+ />
+ </div>
+ );
+});
+
+DetailBreadcrumb.displayName = 'DetailBreadcrumb';
+
+export default DetailBreadcrumb;
diff --git a/src/features/Settings/skill/features/LeftPanel.tsx b/src/features/Settings/skill/features/LeftPanel.tsx
index 75171071807..eab9d39029f 100644
--- a/src/features/Settings/skill/features/LeftPanel.tsx
+++ b/src/features/Settings/skill/features/LeftPanel.tsx
@@ -1,10 +1,10 @@
'use client';
-import { Button, DropdownMenu, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';
+import { Button, DropdownMenu, Flexbox, Icon, SearchBar, Text, Tooltip } from '@lobehub/ui';
import { GithubIcon } from '@lobehub/ui/icons';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { FileArchive, Grid2x2Plus, Link, Store } from 'lucide-react';
+import { ChevronDown, FileArchive, Grid2x2Plus, Link, Plus, Store } from 'lucide-react';
import { memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -14,6 +14,7 @@ import { openImportFromGithubModal } from '@/features/SkillStore/SkillList/Impor
import { openImportFromUrlModal } from '@/features/SkillStore/SkillList/ImportFromUrlModal';
import { openUploadSkillModal } from '@/features/SkillStore/SkillList/UploadSkillModal';
import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';
+import { usePermission } from '@/hooks/usePermission';
import ConnectorManagePolicy from './ConnectorManagePolicy';
import { type ToolDetailType } from './SkillDetail';
@@ -21,18 +22,44 @@ import SkillList, { type SkillViewMode } from './SkillList';
import { SkillListVariantProvider } from './SkillListRow';
const styles = stylex.create({
+ // @lobehub/ui paints every open dropdown trigger with `colorFillTertiary`
+ // (`.lobe-dropdown-menu-trigger[data-popup-open]`, `lobe-popup` layer), which
+ // wins over the primary Button's own open state and leaves its light text on
+ // a near-white fill. Restore the primary open state with the same tokens the
+ // Button uses, so the label stays readable in both themes.
+ addTrigger: {
+ backgroundColor: {
+ 'default': null,
+ ':is([data-popup-open])': cssVar.colorPrimaryActive,
+ },
+ color: {
+ 'default': null,
+ ':is([data-popup-open])': cssVar.colorBgLayout,
+ },
+ },
body: { overflowY: 'auto', flex: '1', paddingBlock: '4px', paddingInline: '8px' },
pageBody: { paddingBlockStart: '0', paddingBlockEnd: '24px', paddingInline: '0' },
+ // Title and one line of what connectors do on the left; search and the page
+ // actions on the right, the primary Add last.
pageHeader: {
display: 'flex',
flexShrink: 0,
+ flexWrap: 'wrap',
gap: '16px',
- alignItems: 'center',
+ alignItems: 'flex-start',
justifyContent: 'space-between',
- paddingBlockStart: '24px',
- paddingBlockEnd: '4px',
+ paddingBlockStart: '32px',
+ paddingBlockEnd: '8px',
paddingInline: '12px',
},
+ pageSearch: { width: '240px' },
+ pageTitle: {
+ marginBlock: 0,
+ fontSize: cssVar.fontSizeHeading3,
+ fontWeight: 600,
+ lineHeight: 1.3,
+ color: cssVar.colorText,
+ },
header: {
display: 'flex',
flexShrink: 0,
@@ -73,59 +100,122 @@ const LeftPanel = memo<LeftPanelProps>(
({ fullWidth, onDeleteSelected, onSelect, page, selectedIdentifier, viewMode }) => {
const { t } = useTranslation(['setting', 'tool']);
const [showAddConnector, setShowAddConnector] = useState(false);
+ const [keyword, setKeyword] = useState('');
const handleOpenStore = useCallback(() => {
createSkillStoreModal();
}, []);
const isConnectorView = viewMode === 'connector';
+ const { allowed: canCreate } = usePermission('create_content');
// Adding a workspace connector follows the same member policy as editing one.
const { canManage: canAddConnector, isPending: isPolicyPending } = useConnectorManageable();
const addConnectorTitle = t('connector.add.title', {
defaultValue: 'Add Custom Connector',
ns: 'tool',
});
- const isConnectorPage = page && isConnectorView;
+ if (page) {
+ const addItems = [
+ ...(isConnectorView
+ ? [
+ {
+ desc:
+ canAddConnector || isPolicyPending
+ ? t('connectorMarket.add.customDesc')
+ : t('tools.connectorFeedback.manageOnly'),
+ disabled: !canAddConnector,
+ icon: <Icon icon={Grid2x2Plus} />,
+ key: 'custom',
+ label: t('connectorMarket.add.custom'),
+ onClick: () => setShowAddConnector(true),
+ },
+ ]
+ : []),
+ {
+ desc: t('connectorMarket.add.browseStoreDesc'),
+ icon: <Icon icon={Store} />,
+ key: 'store',
+ label: t('connectorMarket.add.browseStore'),
+ onClick: handleOpenStore,
+ },
+ ...(!isConnectorView
+ ? [
+ {
+ desc: t('tab.importFromGithub.desc'),
+ disabled: !canCreate,
+ icon: <Icon icon={GithubIcon} />,
+ key: 'importGithub',
+ label: t('tab.importFromGithub'),
+ onClick: () => openImportFromGithubModal(),
+ },
+ {
+ desc: t('tab.importFromUrl.desc'),
+ disabled: !canCreate,
+ icon: <Icon icon={Link} />,
+ key: 'importUrl',
+ label: t('tab.importFromUrl'),
+ onClick: () => openImportFromUrlModal(),
+ },
+ {
+ desc: t('tab.uploadZip.desc'),
+ disabled: !canCreate,
+ icon: <Icon icon={FileArchive} />,
+ key: 'uploadZip',
+ label: t('tab.uploadZip'),
+ onClick: () => openUploadSkillModal(),
+ },
+ ]
+ : []),
+ ];
+ const searchPlaceholder = t(
+ isConnectorView ? 'connectorMarket.search.placeholder' : 'skillView.search.placeholder',
+ );
- if (isConnectorPage)
- return (
- <SkillListVariantProvider value={'page'}>
- {/* The shared navigation header carries the title; the page actions
- share the intro row so they line up with the list below. */}
+ const renderHeader = () => (
+ <>
<div {...stylex.props(styles.pageHeader)}>
- <Text type={'secondary'}>{t('skillView.connectorsDesc')}</Text>
- <Flexbox horizontal flex={'none'} gap={8}>
- <Tooltip title={t('skillStore.title')}>
+ <Flexbox gap={4} style={{ minWidth: 0 }}>
+ <h1 {...stylex.props(styles.pageTitle)}>
+ {t(isConnectorView ? 'skillView.connectors' : 'skillView.skills')}
+ </h1>
+ <Text type={'secondary'}>
+ {t(isConnectorView ? 'skillView.connectorsDesc' : 'skillView.skillsDesc')}
+ </Text>
+ </Flexbox>
+ <Flexbox horizontal align={'center'} flex={'none'} gap={8}>
+ <SearchBar
+ allowClear
+ aria-label={searchPlaceholder}
+ className={stylex.props(styles.pageSearch).className}
+ placeholder={searchPlaceholder}
+ value={keyword}
+ variant={'outlined'}
+ onInputChange={setKeyword}
+ />
+ <DropdownMenu items={addItems} placement={'bottomRight'}>
<Button
- aria-label={t('skillStore.title')}
- icon={<Icon icon={Store} />}
- onClick={handleOpenStore}
- />
- </Tooltip>
- <Tooltip
- title={
- canAddConnector || isPolicyPending
- ? undefined
- : t('tools.connectorFeedback.manageOnly')
- }
- >
- {/* Disabled buttons swallow hover events; the wrapper anchors the tooltip. */}
- <span {...stylex.props(styles.tooltipAnchor)}>
- <Button
- disabled={!canAddConnector}
- icon={Grid2x2Plus}
- onClick={() => setShowAddConnector(true)}
- >
- {addConnectorTitle}
- </Button>
- </span>
- </Tooltip>
+ className={stylex.props(styles.addTrigger).className}
+ icon={Plus}
+ type={'primary'}
+ >
+ {t('connectorMarket.add')}
+ <Icon icon={ChevronDown} size={14} />
+ </Button>
+ </DropdownMenu>
</Flexbox>
</div>
- <ConnectorManagePolicy variant={'page'} />
+ {isConnectorView && <ConnectorManagePolicy variant={'page'} />}
+ </>
+ );
+
+ return (
+ <SkillListVariantProvider value={'page'}>
<div {...stylex.props(styles.pageBody)}>
<SkillList
+ keyword={keyword}
+ renderHeader={renderHeader}
viewMode={viewMode}
+ onClearKeyword={() => setKeyword('')}
onDeleteSelected={onDeleteSelected}
onSelect={onSelect}
/>
@@ -136,6 +226,7 @@ const LeftPanel = memo<LeftPanelProps>(
/>
</SkillListVariantProvider>
);
+ }
return (
<>
@@ -150,6 +241,7 @@ const LeftPanel = memo<LeftPanelProps>(
: t('skillView.skills', 'Skills')}
</Text>
+ {/* lobe-design-ignore LOBE-DIV-CLICK: not a control; keeps header button clicks from reaching the panel */}
<div style={{ display: 'flex', gap: 6 }} onClick={(e) => e.stopPropagation()}>
{isConnectorView ? (
// Connector view: single action to add a custom OAuth connector.
@@ -163,6 +255,7 @@ const LeftPanel = memo<LeftPanelProps>(
{/* Disabled buttons swallow hover events; the wrapper anchors the tooltip. */}
<span {...stylex.props(styles.tooltipAnchor)}>
<Button
+ aria-label={addConnectorTitle}
disabled={!canAddConnector}
icon={Grid2x2Plus}
size="small"
@@ -217,10 +310,15 @@ const LeftPanel = memo<LeftPanelProps>(
},
]}
>
- <Button icon={Grid2x2Plus} size="small" />
+ <Button aria-label={t('connectorMarket.add')} icon={Grid2x2Plus} size="small" />
</DropdownMenu>
)}
- <Button icon={<Icon icon={Store} />} size="small" onClick={handleOpenStore} />
+ <Button
+ aria-label={t('skillStore.title')}
+ icon={<Icon icon={Store} />}
+ size="small"
+ onClick={handleOpenStore}
+ />
</div>
</div>
diff --git a/src/features/Settings/skill/features/LobehubSkillItem.tsx b/src/features/Settings/skill/features/LobehubSkillItem.tsx
index 0d9052e6f36..3837e0effc9 100644
--- a/src/features/Settings/skill/features/LobehubSkillItem.tsx
+++ b/src/features/Settings/skill/features/LobehubSkillItem.tsx
@@ -27,6 +27,7 @@ import { toConnectorActionError } from '@/utils/connectorActionError';
import { renderConnectorRowDescription } from './ConnectorRowFeedback';
import { isSettledByConnection } from './connectorRowState';
+import { RowAddAction, RowMoreMenu } from './RowActions';
import SkillListRow, { ConnectedStatus, useSkillListVariant } from './SkillListRow';
import { styles } from './style';
@@ -319,7 +320,38 @@ const LobehubSkillItem = memo<LobehubSkillItemProps>(
// ChatInput skills dropdown UX: connected → green check; otherwise a Connect
// button that opens the OAuth flow inline, so users can tell what is connected
// and aren't left staring at a blank detail panel wondering if it's a bug.
+ // Page row: a quiet `+` connects in place; once connected the row's state
+ // reads from its position (Installed) and the action becomes the manage menu.
+ const renderPageExtra = () => {
+ if (isConnected)
+ return (
+ <RowMoreMenu
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit,
+ icon: <Icon icon={Unplug} />,
+ key: 'disconnect',
+ label: t('tools.lobehubSkill.disconnect', { defaultValue: 'Disconnect' }),
+ onClick: handleDisconnect,
+ },
+ ]}
+ onOpenDetail={onSelect}
+ />
+ );
+ return (
+ <RowAddAction
+ disabled={!canCreate || !canEdit}
+ disabledReason={!canCreate ? createReason : editReason}
+ label={t('connectorMarket.action.connect')}
+ loading={isConnecting || isWaitingAuth}
+ onClick={handleConnect}
+ />
+ );
+ };
+
const renderNavExtra = () => {
+ if (isPage) return renderPageExtra();
if (isConnecting || isWaitingAuth) {
return <Button disabled loading size="small" type="text" />;
}
diff --git a/src/features/Settings/skill/features/McpSkillItem.tsx b/src/features/Settings/skill/features/McpSkillItem.tsx
index 0e4ab6f7de2..74d003e0150 100644
--- a/src/features/Settings/skill/features/McpSkillItem.tsx
+++ b/src/features/Settings/skill/features/McpSkillItem.tsx
@@ -16,6 +16,7 @@ import { pluginSelectors } from '@/store/tool/selectors';
import { type LobeToolType } from '@/types/tool/tool';
import Actions from './Actions';
+import { RowMoreMenu } from './RowActions';
import SkillListRow, { useSkillListVariant } from './SkillListRow';
import { styles } from './style';
@@ -35,7 +36,8 @@ interface McpSkillItemProps {
const McpSkillItem = memo<McpSkillItemProps>(
({ identifier, title, avatar, description, type, runtimeType, author, isSelected, onSelect }) => {
const { t } = useTranslation('plugin');
- const iconSize = useSkillListVariant() === 'page' ? 20 : 18;
+ const isPage = useSkillListVariant() === 'page';
+ const iconSize = isPage ? 20 : 18;
const isMCP = runtimeType === 'mcp';
const isCustomPlugin = type === 'customPlugin';
const isCommunityMCP = isMCP && !isCustomPlugin;
@@ -71,6 +73,8 @@ const McpSkillItem = memo<McpSkillItemProps>(
<SkillListRow
active={isSelected}
description={description}
+ extra={isPage ? <RowMoreMenu onOpenDetail={onSelect} /> : undefined}
+ summary={isPage ? author : undefined}
title={title}
icon={() =>
avatar && avatar !== 'MCP_AVATAR' ? (
@@ -106,6 +110,7 @@ const McpSkillItem = memo<McpSkillItemProps>(
<Icon icon={McpIcon} size={16} />
)}
</div>
+ {/* lobe-design-ignore LOBE-DIV-CLICK: legacy compact row; its Actions menu is the keyboard path to the same detail */}
<span {...stylex.props(styles.title)} onClick={onSelect ? undefined : openDetail}>
{title}
</span>
diff --git a/src/features/Settings/skill/features/RowActions.tsx b/src/features/Settings/skill/features/RowActions.tsx
new file mode 100644
index 00000000000..f86166ab58e
--- /dev/null
+++ b/src/features/Settings/skill/features/RowActions.tsx
@@ -0,0 +1,85 @@
+'use client';
+
+import { ActionIcon, type DropdownItem, DropdownMenu, Icon } from '@lobehub/ui';
+import { MoreHorizontalIcon, PanelRightOpen, Plus } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+interface RowAddActionProps {
+ disabled?: boolean;
+ /** Why it is disabled; replaces the action name in the tooltip. */
+ disabledReason?: string;
+ /** Accessible name and tooltip, e.g. "Connect" or "Install". */
+ label: string;
+ loading?: boolean;
+ onClick: () => void;
+}
+
+/**
+ * The page row's one-step action for an entry that is not added yet: a quiet `+`
+ * that connects or installs in place. Once added it becomes {@link RowMoreMenu}.
+ */
+export const RowAddAction = memo<RowAddActionProps>(
+ ({ disabled, disabledReason, label, loading, onClick }) => (
+ <ActionIcon
+ aria-label={label}
+ disabled={disabled || loading}
+ icon={Plus}
+ loading={loading}
+ title={disabled && disabledReason ? disabledReason : label}
+ onClick={(event) => {
+ event.stopPropagation();
+ onClick();
+ }}
+ />
+ ),
+);
+
+RowAddAction.displayName = 'RowAddAction';
+
+type MenuItems = DropdownItem[];
+
+interface RowMoreMenuProps {
+ /** Lifecycle items after "View details", e.g. Disconnect / Uninstall. */
+ items?: MenuItems;
+ onOpenDetail?: () => void;
+}
+
+/**
+ * The page row's manage menu for an added entry: open the detail page, plus the
+ * row's lifecycle actions (each keeps its own confirmation).
+ */
+export const RowMoreMenu = memo<RowMoreMenuProps>(({ items = [], onOpenDetail }) => {
+ const { t } = useTranslation('setting');
+ const menuItems: MenuItems = [
+ ...(onOpenDetail
+ ? [
+ {
+ icon: <Icon icon={PanelRightOpen} />,
+ key: 'details',
+ label: t('connectorMarket.action.details'),
+ onClick: onOpenDetail,
+ },
+ ]
+ : []),
+ ...(onOpenDetail && items.length > 0 ? [{ type: 'divider' as const }] : []),
+ ...items,
+ ];
+
+ return (
+ // The row itself opens the detail: keep menu clicks (React bubbles them out
+ // of the portalled popup too) from reaching it.
+ // lobe-design-ignore LOBE-DIV-CLICK: not a control; only stops propagation to the row
+ <span style={{ display: 'inline-flex' }} onClick={(event) => event.stopPropagation()}>
+ <DropdownMenu items={menuItems} placement={'bottomRight'}>
+ <ActionIcon
+ aria-label={t('connectorMarket.action.manage')}
+ icon={MoreHorizontalIcon}
+ title={t('connectorMarket.action.manage')}
+ />
+ </DropdownMenu>
+ </span>
+ );
+});
+
+RowMoreMenu.displayName = 'RowMoreMenu';
diff --git a/src/features/Settings/skill/features/SkillList.tsx b/src/features/Settings/skill/features/SkillList.tsx
index 47c2d3b5143..27b27cfbd64 100644
--- a/src/features/Settings/skill/features/SkillList.tsx
+++ b/src/features/Settings/skill/features/SkillList.tsx
@@ -1,21 +1,14 @@
'use client';
-import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';
-import {
- getConnectorCatalog,
- RECOMMENDED_SKILLS,
- RecommendedSkillType,
- resolveConnectorCatalogItem,
-} from '@lobechat/const';
-import type { BuiltinSkillManifest, LobeBuiltinTool } from '@lobechat/types';
-import { Center, Empty } from '@lobehub/ui';
+import { Button, Center, Empty } from '@lobehub/ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import { media } from '@lobehub/ui/stylex/media.stylex';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
-import { ChevronDownIcon, ChevronRightIcon } from 'lucide-react';
+import { ChevronDownIcon, ChevronRightIcon, SearchX } from 'lucide-react';
import type React from 'react';
-import { memo, useEffect, useMemo, useState } from 'react';
+import { memo, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
@@ -39,6 +32,15 @@ import AgentSkillItem from './AgentSkillItem';
import BuiltinSkillItem from './BuiltinSkillItem';
import ComposioSkillItem from './ComposioSkillItem';
import { AccountsNeedReauth, countAccountsNeedingReauth } from './ConnectorRowFeedback';
+import {
+ buildIntegrationItems,
+ getVisibleSectionItems,
+ type IntegrationItem,
+ isIntegrationConnected,
+ matchesConnectorKeyword,
+ matchesIntegrationKeyword,
+ partitionByInstalled,
+} from './connectorSections';
import LobehubSkillItem from './LobehubSkillItem';
import McpSkillItem from './McpSkillItem';
import type { ToolDetailType } from './SkillDetail';
@@ -59,30 +61,61 @@ const styles = stylex.create({
fontWeight: 500,
color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
},
+ // Page groups: a heading with its count, then a two-column catalog of
+ // borderless rows; groups are separated by whitespace, not rules.
+ pageSection: { display: 'flex', flexDirection: 'column', gap: '8px' },
+ pageSections: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '40px',
+ paddingBlockStart: '24px',
+ },
+ pageGrid: {
+ display: 'grid',
+ gridTemplateColumns: { default: 'repeat(2, minmax(0, 1fr))', [media.lg]: 'minmax(0, 1fr)' },
+ columnGap: '32px',
+ rowGap: '4px',
+ },
sectionHeaderPage: {
+ cursor: 'default',
gap: '8px',
- paddingBlockStart: '24px',
- paddingBlockEnd: '8px',
+ paddingBlock: '0',
paddingInline: '12px',
- fontSize: '13px',
+ fontSize: cssVar.fontSizeHeading5,
fontWeight: 600,
+ color: { 'default': cssVar.colorText, ':hover': cssVar.colorText },
},
sectionCount: { fontWeight: 400, color: cssVar.colorTextDescription },
+ showAll: { alignSelf: 'flex-start', marginInlineStart: '4px' },
});
export type SkillViewMode = 'connector' | 'skill';
interface SkillListProps {
+ /** Page search: filters every group by name, identifier and description. */
+ keyword?: string;
+ onClearKeyword?: () => void;
onDeleteSelected?: () => void;
onSelect?: (identifier: string, type: ToolDetailType) => void;
+ /** Page header above the groups. */
+ renderHeader?: () => React.ReactNode;
selectedIdentifier?: string;
viewMode?: SkillViewMode;
}
const SkillList = memo<SkillListProps>(
- ({ onSelect, onDeleteSelected, selectedIdentifier, viewMode = 'connector' }) => {
+ ({
+ keyword,
+ onClearKeyword,
+ onSelect,
+ onDeleteSelected,
+ renderHeader,
+ selectedIdentifier,
+ viewMode = 'connector',
+ }) => {
const { t } = useTranslation('setting');
const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
+ const [expanded, setExpanded] = useState<Set<string>>(new Set());
const isPage = useSkillListVariant() === 'page';
const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);
@@ -130,7 +163,9 @@ const SkillList = memo<SkillListProps>(
const agentSkillsSWR = useFetchAgentSkills(true);
const builtinToolsSWR = useFetchUninstalledBuiltinTools(true);
const skillsError =
- lobehubSkillsSWR.error ?? composioSWR.error ?? agentSkillsSWR.error ?? builtinToolsSWR.error;
+ viewMode === 'skill'
+ ? (agentSkillsSWR.error ?? builtinToolsSWR.error)
+ : (lobehubSkillsSWR.error ?? composioSWR.error ?? builtinToolsSWR.error);
const reloadSkills = () => {
void lobehubSkillsSWR.mutate();
void composioSWR.mutate();
@@ -161,183 +196,76 @@ const SkillList = memo<SkillListProps>(
return allComposioServers.find((server) => server.identifier === identifier);
};
- const getBuiltinToolByIdentifier = (identifier: string) => {
- return allBuiltinTools.find((tool) => tool.identifier === identifier);
- };
-
const isBuiltinToolInstalled = (identifier: string) => {
return !uninstalledBuiltinTools.includes(identifier);
};
- // Separate skills into three categories:
- // 1. Integrations (Builtin, LobeHub and Composio skills)
- // 2. Community MCP Tools (type === 'plugin')
- // 3. Custom MCP Tools (type === 'customPlugin')
- const { integrations, communityMCPs, customMCPs } = useMemo(() => {
- type IntegrationItem =
- | { builtinAgentSkill: BuiltinSkillManifest; type: 'builtinAgent' }
- | { builtinTool: LobeBuiltinTool; type: 'builtin' }
- | { provider: LobehubSkillProviderType; type: 'lobehub' }
- | { serverType: ComposioAppType; type: 'composio' };
-
- let integrationItems: IntegrationItem[] = [];
-
- // Add builtin agent skills first so they appear early in the list
- for (const skill of builtinSkills) {
- integrationItems.push({ builtinAgentSkill: skill, type: 'builtinAgent' });
- }
-
- const addedBuiltinIds = new Set<string>();
- const addedConnectorIds = new Set<string>();
- const connectorAvailability = {
- composio: isComposioEnabled,
- lobehub: isLobehubSkillEnabled,
- };
-
- // If RECOMMENDED_SKILLS is configured, use it to build the list
- if (RECOMMENDED_SKILLS.length > 0) {
- for (const skill of RECOMMENDED_SKILLS) {
- if (skill.type === RecommendedSkillType.Builtin) {
- const builtinTool = getBuiltinToolByIdentifier(skill.id);
- if (builtinTool && !builtinTool.hidden) {
- integrationItems.push({ builtinTool, type: 'builtin' });
- addedBuiltinIds.add(skill.id);
- }
- } else {
- const connector = resolveConnectorCatalogItem(skill.id, connectorAvailability);
- if (connector && !addedConnectorIds.has(skill.id)) {
- integrationItems.push(connector);
- addedConnectorIds.add(skill.id);
- }
- }
- }
-
- // Also add installed builtin tools that are not in RECOMMENDED_SKILLS
- for (const tool of allBuiltinTools) {
- if (
- !tool.hidden &&
- isBuiltinToolInstalled(tool.identifier) &&
- !addedBuiltinIds.has(tool.identifier)
- ) {
- integrationItems.push({ builtinTool: tool, type: 'builtin' });
- }
- }
-
- // Add every remaining connector through the shared ownership resolver.
- // This keeps discovery complete without rendering one identifier through
- // both LobeHub and Composio authorization systems.
- for (const connector of getConnectorCatalog(connectorAvailability)) {
- const identifier =
- connector.type === 'lobehub' ? connector.provider.id : connector.serverType.identifier;
- if (!addedConnectorIds.has(identifier)) {
- integrationItems.push(connector);
- addedConnectorIds.add(identifier);
- }
- }
- } else {
- // Default behavior: add all non-hidden builtin tools
- for (const tool of allBuiltinTools) {
- if (!tool.hidden) {
- integrationItems.push({ builtinTool: tool, type: 'builtin' });
- }
- }
-
- integrationItems.push(...getConnectorCatalog(connectorAvailability));
-
- // Filter integrations: show all builtin and lobehub skills, but only connected composio
- integrationItems = integrationItems.filter((item) => {
- if (item.type === 'builtinAgent' || item.type === 'builtin' || item.type === 'lobehub') {
- return true;
- }
- return (
- getComposioServerByIdentifier(item.serverType.identifier)?.status ===
- ComposioServerStatus.ACTIVE
- );
- });
- }
-
- // Sort integrations: installed/connected ones first
- const getIsConnected = (item: IntegrationItem) => {
- switch (item.type) {
- case 'builtinAgent': {
- return isBuiltinToolInstalled(item.builtinAgentSkill.identifier);
- }
- case 'builtin': {
- return isBuiltinToolInstalled(item.builtinTool.identifier);
- }
- case 'lobehub': {
- return (
- getLobehubSkillServerByProvider(item.provider.id)?.status ===
- LobehubSkillStatus.CONNECTED
- );
- }
- case 'composio': {
- return (
- getComposioServerByIdentifier(item.serverType.identifier)?.status ===
- ComposioServerStatus.ACTIVE
- );
- }
- }
- };
- const sortedIntegrations = integrationItems.sort((a, b) => {
- const isConnectedA = getIsConnected(a);
- const isConnectedB = getIsConnected(b);
-
- if (isConnectedA && !isConnectedB) return -1;
- if (!isConnectedA && isConnectedB) return 1;
- return 0;
- });
+ const connectionState = {
+ isBuiltinToolInstalled,
+ isComposioActive: (identifier: string) =>
+ getComposioServerByIdentifier(identifier)?.status === ComposioServerStatus.ACTIVE,
+ isLobehubConnected: (providerId: string) =>
+ getLobehubSkillServerByProvider(providerId)?.status === LobehubSkillStatus.CONNECTED,
+ };
- // Separate installed plugins into community and custom
- const communityPlugins = installedPluginList.filter((plugin) => plugin.type === 'plugin');
- const customPlugins = installedPluginList.filter((plugin) => plugin.type === 'customPlugin');
-
- return {
- communityMCPs: communityPlugins,
- customMCPs: customPlugins,
- integrations: sortedIntegrations,
- };
- }, [
- installedPluginList,
- isLobehubSkillEnabled,
- isComposioEnabled,
- allLobehubSkillServers,
- allComposioServers,
+ // Integrations (built-in skills / tools and the OAuth catalog, connected
+ // first), then installed plugins split into community and custom MCPs.
+ // A few dozen entries: cheap enough to derive on each render.
+ const integrations = buildIntegrationItems({
+ ...connectionState,
allBuiltinTools,
- uninstalledBuiltinTools,
builtinSkills,
- ]);
+ connectorAvailability: { composio: isComposioEnabled, lobehub: isLobehubSkillEnabled },
+ });
+ const communityMCPs = installedPluginList.filter((plugin) => plugin.type === 'plugin');
+ const customMCPs = installedPluginList.filter((plugin) => plugin.type === 'customPlugin');
const hasAnySkills =
- builtinSkills.length > 0 ||
- integrations.length > 0 ||
- marketAgentSkills.length > 0 ||
- userAgentSkills.length > 0 ||
- communityMCPs.length > 0 ||
- marketplaceConnectors.length > 0 ||
- customMCPs.length > 0 ||
- agentBoundConnectors.length > 0;
+ viewMode === 'skill'
+ ? builtinSkills.length > 0 || marketAgentSkills.length > 0 || userAgentSkills.length > 0
+ : builtinSkills.length > 0 ||
+ integrations.length > 0 ||
+ marketAgentSkills.length > 0 ||
+ userAgentSkills.length > 0 ||
+ communityMCPs.length > 0 ||
+ marketplaceConnectors.length > 0 ||
+ customMCPs.length > 0 ||
+ agentBoundConnectors.length > 0;
+
+ const header = isPage ? renderHeader?.() : undefined;
// A failed fetch must read as a failure with Retry, never as the "no skills"
// empty (error gated ahead of empty).
if (skillsError && !hasAnySkills) {
return (
- <Center className={stylex.props(styles.container).className} paddingBlock={48}>
- <AsyncError error={skillsError} variant={'block'} onRetry={reloadSkills} />
- </Center>
+ <>
+ {header}
+ <Center className={stylex.props(styles.container).className} paddingBlock={48}>
+ <AsyncError error={skillsError} variant={'block'} onRetry={reloadSkills} />
+ </Center>
+ </>
);
}
if (!hasAnySkills) {
return (
- <Center className={stylex.props(styles.container).className} paddingBlock={48}>
- <Empty description={t('tab.skillDesc')} icon={SkillsIcon} title={t('tab.skillEmpty')} />
- </Center>
+ <>
+ {header}
+ <Center className={stylex.props(styles.container).className} paddingBlock={48}>
+ <Empty
+ icon={SkillsIcon}
+ title={t(viewMode === 'skill' ? 'skillView.empty.title' : 'tab.skillEmpty')}
+ description={t(
+ viewMode === 'skill' ? 'skillView.empty.description' : 'tab.skillDesc',
+ )}
+ />
+ </Center>
+ </>
);
}
- const renderMarketAgentSkills = () =>
- marketAgentSkills.map((skill) => (
+ const renderAgentSkills = (skills: typeof marketAgentSkills) =>
+ skills.map((skill) => (
<AgentSkillItem
isSelected={selectedIdentifier === skill.id}
key={skill.id}
@@ -346,18 +274,88 @@ const SkillList = memo<SkillListProps>(
/>
));
- const renderUserAgentSkills = () =>
- userAgentSkills.map((skill) => (
- <AgentSkillItem
- isSelected={selectedIdentifier === skill.id}
- key={skill.id}
- skill={skill}
- onSelect={onSelect ? () => onSelect(skill.id, 'agent-skill') : undefined}
- />
- ));
+ // ── Connector entries, filtered by the page search ───────────────────────
+ const match = (...fields: Array<string | null | undefined>) =>
+ matchesConnectorKeyword(keyword, fields);
+
+ const builtinTitle = (tool: { identifier: string; title?: string }) =>
+ t(`tools.builtins.${tool.identifier}.title`, {
+ defaultValue: tool.title || tool.identifier,
+ });
+
+ const integrationMatches = (item: IntegrationItem) =>
+ matchesIntegrationKeyword(item, keyword, t);
+
+ const builtinToolItems = integrations.filter(
+ (i) => i.type === 'builtin' && integrationMatches(i),
+ );
+ const builtinSkillItems = integrations.filter((i) => i.type === 'builtinAgent');
+ const communitySkillItems = integrations.filter(
+ (i) => (i.type === 'lobehub' || i.type === 'composio') && integrationMatches(i),
+ );
+ const visibleCommunityMCPs = communityMCPs.filter((p) =>
+ match(p.title, p.identifier, p.author),
+ );
+ const visibleMarketplaceConnectors = marketplaceConnectors.filter((c) =>
+ match(c.name, c.identifier),
+ );
+ const visibleCustomMCPs = customMCPs.filter((p) => match(p.title, p.identifier));
+ const visibleCustomConnectors = customConnectors.filter((c) => match(c.name, c.identifier));
+ const visibleAgentConnectors = agentBoundConnectors.filter((c) =>
+ match(c.name, c.identifier, c.agentTitle),
+ );
+
+ const renderIntegration = (item: IntegrationItem) => {
+ switch (item.type) {
+ case 'builtin': {
+ return (
+ <BuiltinSkillItem
+ avatar={item.builtinTool.avatar}
+ description={item.builtinTool.description}
+ identifier={item.builtinTool.identifier}
+ isSelected={selectedIdentifier === item.builtinTool.identifier}
+ key={item.builtinTool.identifier}
+ title={builtinTitle(item.builtinTool)}
+ onSelect={
+ onSelect ? () => onSelect(item.builtinTool.identifier, 'builtin') : undefined
+ }
+ />
+ );
+ }
+ case 'lobehub': {
+ return (
+ <LobehubSkillItem
+ isSelected={selectedIdentifier === item.provider.id}
+ key={item.provider.id}
+ provider={item.provider}
+ server={getLobehubSkillServerByProvider(item.provider.id)}
+ onDelete={onDeleteSelected}
+ onSelect={
+ onSelect ? () => onSelect(item.provider.id, 'lobehub-connector') : undefined
+ }
+ />
+ );
+ }
+ case 'composio': {
+ return (
+ <ComposioSkillItem
+ isSelected={selectedIdentifier === item.serverType.identifier}
+ key={item.serverType.identifier}
+ server={getComposioServerByIdentifier(item.serverType.identifier)}
+ serverType={item.serverType}
+ onDelete={onDeleteSelected}
+ onSelect={onSelect ? () => onSelect(item.serverType.identifier, 'plugin') : undefined}
+ />
+ );
+ }
+ default: {
+ return null;
+ }
+ }
+ };
const renderCommunityMCPs = () => [
- ...communityMCPs.map((plugin) => (
+ ...visibleCommunityMCPs.map((plugin) => (
<McpSkillItem
author={plugin.author}
avatar={plugin.avatar}
@@ -371,7 +369,7 @@ const SkillList = memo<SkillListProps>(
/>
)),
// Marketplace installs made on the connector path (no legacy plugin row)
- ...marketplaceConnectors.map((c) => (
+ ...visibleMarketplaceConnectors.map((c) => (
<McpSkillItem
avatar={c.metadata?.avatar as string | undefined}
identifier={c.identifier}
@@ -385,24 +383,10 @@ const SkillList = memo<SkillListProps>(
)),
];
- const renderCustomMCPs = () =>
- customMCPs.map((plugin) => (
- <McpSkillItem
- author={plugin.author}
- avatar={plugin.avatar}
- identifier={plugin.identifier}
- isSelected={selectedIdentifier === plugin.identifier}
- key={plugin.identifier}
- runtimeType={plugin.runtimeType}
- title={plugin.title || plugin.identifier}
- type={plugin.type as LobeToolType}
- onSelect={onSelect ? () => onSelect(plugin.identifier, 'mcp-connector') : undefined}
- />
- ));
-
- // Custom connectors from the connector store (user-added OAuth MCP servers)
- const renderCustomConnectors = () =>
- customConnectors.map((c) => {
+ // Custom connectors from the connector store (user-added OAuth MCP servers),
+ // then legacy custom MCP plugins.
+ const renderCustomConnectors = () => [
+ ...visibleCustomConnectors.map((c) => {
const brokenAccounts = countAccountsNeedingReauth(c.links);
return (
<McpSkillItem
@@ -418,46 +402,203 @@ const SkillList = memo<SkillListProps>(
onSelect={onSelect ? () => onSelect(c.identifier, 'mcp-connector') : undefined}
/>
);
- });
+ }),
+ ...visibleCustomMCPs.map((plugin) => (
+ <McpSkillItem
+ author={plugin.author}
+ avatar={plugin.avatar}
+ identifier={plugin.identifier}
+ isSelected={selectedIdentifier === plugin.identifier}
+ key={plugin.identifier}
+ runtimeType={plugin.runtimeType}
+ title={plugin.title || plugin.identifier}
+ type={plugin.type as LobeToolType}
+ onSelect={onSelect ? () => onSelect(plugin.identifier, 'mcp-connector') : undefined}
+ />
+ )),
+ ];
- // Split integrations into builtin tools vs builtin skills
- const builtinToolItems = integrations.filter((i) => i.type === 'builtin');
- const builtinSkillItems = integrations.filter((i) => i.type === 'builtinAgent');
- const communitySkillItems = integrations.filter(
- (i) => i.type === 'lobehub' || i.type === 'composio',
- );
+ const renderAgentConnectors = () =>
+ visibleAgentConnectors.map((c) => (
+ <AgentConnectorItem
+ connector={c}
+ isSelected={selectedIdentifier === c.id}
+ key={c.id}
+ onSelect={onSelect ? () => onSelect(c.id, 'agent-connector') : undefined}
+ />
+ ));
- const toggleSection = (key: string) => {
- setCollapsed((prev) => {
+ const toggle = (setter: typeof setCollapsed) => (key: string) =>
+ setter((prev) => {
const next = new Set(prev);
if (next.has(key)) next.delete(key);
else next.add(key);
return next;
});
- };
+ const toggleSection = toggle(setCollapsed);
+ const toggleExpanded = toggle(setExpanded);
+
+ // Page catalogs share the layout, but keep their own sources and search fields.
+ if (isPage) {
+ // Installed groups what is already added (enabled built-ins, connected
+ // OAuth apps), so the type groups below read as what is left to add.
+ const isConnected = (item: IntegrationItem) => isIntegrationConnected(item, connectionState);
+ const builtins = partitionByInstalled(builtinToolItems, isConnected);
+ const oauth = partitionByInstalled(communitySkillItems, isConnected);
+
+ const sections = (
+ isConnectorView
+ ? [
+ {
+ items: [...builtins.installed, ...oauth.installed].map(renderIntegration),
+ key: 'installed',
+ label: t('connectorMarket.section.installed'),
+ },
+ {
+ items: builtins.available.map(renderIntegration),
+ key: 'builtinTools',
+ label: t('skillGroup.builtinTools', 'Built-in Tools'),
+ },
+ {
+ items: oauth.available.map(renderIntegration),
+ key: 'communityConnectors',
+ label: t('skillGroup.communityConnectors', 'OAuth Connectors'),
+ },
+ {
+ items: renderCommunityMCPs(),
+ key: 'communityTools',
+ label: t('skillGroup.communityTools', 'Community Tools'),
+ },
+ {
+ items: renderCustomConnectors(),
+ key: 'customConnectors',
+ label: t('skillGroup.customConnectors', 'Custom Connectors'),
+ },
+ {
+ items: renderAgentConnectors(),
+ key: 'agentConnectors',
+ label: t('skillGroup.agentConnectors', 'Agent Connectors'),
+ },
+ ]
+ : [
+ {
+ items: builtinSkills
+ .filter((skill) =>
+ match(
+ t(`tools.builtins.${skill.identifier}.title`, { defaultValue: skill.name }),
+ skill.identifier,
+ t(`tools.builtins.${skill.identifier}.description`, {
+ defaultValue: skill.description,
+ }),
+ ),
+ )
+ .map((skill) => (
+ <AgentSkillItem
+ key={skill.identifier}
+ skill={skill}
+ onSelect={
+ onSelect ? () => onSelect(skill.identifier, 'builtin-skill') : undefined
+ }
+ />
+ )),
+ key: 'builtinSkills',
+ label: t('skillGroup.builtinSkills'),
+ },
+ {
+ items: renderAgentSkills(
+ marketAgentSkills.filter((skill) =>
+ match(skill.name, skill.identifier, skill.description),
+ ),
+ ),
+ key: 'communitySkills',
+ label: t('skillGroup.communitySkills'),
+ },
+ {
+ items: renderAgentSkills(
+ userAgentSkills.filter((skill) =>
+ match(skill.name, skill.identifier, skill.description),
+ ),
+ ),
+ key: 'customSkills',
+ label: t('skillGroup.customSkills'),
+ },
+ ]
+ ).filter((section) => section.items.length > 0);
- const renderSection = (
- key: string,
- label: string,
- children: React.ReactNode,
- count?: number,
- ) => {
- const isCollapsed = collapsed.has(key);
- // The page list is short enough to scan whole, so its groups are plain
- // headings with a count instead of collapsible sidebar sections.
- if (isPage)
- return (
- <>
- <div {...stylex.props(styles.sectionHeader, styles.sectionHeaderPage)}>
- {label}
- {count !== undefined && <span {...stylex.props(styles.sectionCount)}>{count}</span>}
+ return (
+ <>
+ {header}
+ {sections.length === 0 ? (
+ // Searching found nothing: say what was searched and offer the way back.
+ <Center paddingBlock={64}>
+ <Empty
+ description={t('connectorMarket.empty.searchDesc')}
+ icon={SearchX}
+ action={
+ onClearKeyword && (
+ <Button onClick={onClearKeyword}>{t('connectorMarket.empty.clear')}</Button>
+ )
+ }
+ title={t(
+ isConnectorView ? 'connectorMarket.empty.search' : 'skillView.empty.search',
+ { keyword: keyword?.trim() },
+ )}
+ />
+ </Center>
+ ) : (
+ <div {...stylex.props(styles.pageSections)}>
+ {sections.map(({ items, key, label }) => {
+ const isExpanded = expanded.has(key);
+ // A search shows every hit; otherwise long groups preview their first rows.
+ const { hiddenCount, visible } = getVisibleSectionItems(
+ items,
+ isExpanded || !!keyword?.trim(),
+ );
+ return (
+ <section key={key} {...stylex.props(styles.pageSection)}>
+ <h3 {...stylex.props(styles.sectionHeader, styles.sectionHeaderPage)}>
+ {label}
+ <span {...stylex.props(styles.sectionCount)}>{items.length}</span>
+ </h3>
+ <div {...stylex.props(styles.pageGrid)}>{visible}</div>
+ {(hiddenCount > 0 || isExpanded) && (
+ <Button
+ className={stylex.props(styles.showAll).className}
+ size={'small'}
+ type={'text'}
+ onClick={() => toggleExpanded(key)}
+ >
+ {isExpanded
+ ? t('connectorMarket.section.showLess')
+ : `${t('connectorMarket.section.showAll')} (${items.length})`}
+ </Button>
+ )}
+ </section>
+ );
+ })}
</div>
- {children}
- </>
- );
+ )}
+ </>
+ );
+ }
+
+ // ── Sidebar list (skills page, mobile) ───────────────────────────────────
+ const renderSection = (key: string, label: string, children: React.ReactNode) => {
+ const isCollapsed = collapsed.has(key);
return (
<>
- <div {...stylex.props(styles.sectionHeader)} onClick={() => toggleSection(key)}>
+ <div
+ {...stylex.props(styles.sectionHeader)}
+ aria-expanded={!isCollapsed}
+ role={'button'}
+ tabIndex={0}
+ onClick={() => toggleSection(key)}
+ onKeyDown={(event) => {
+ if (event.key !== 'Enter' && event.key !== ' ') return;
+ event.preventDefault();
+ toggleSection(key);
+ }}
+ >
{isCollapsed ? <ChevronRightIcon size={10} /> : <ChevronDownIcon size={10} />}
{label}
</div>
@@ -466,51 +607,29 @@ const SkillList = memo<SkillListProps>(
);
};
- // Connectors tab: tools/MCP items (provide API-level permissions)
- // Skills tab: prompt/agent-based skills (show description/content)
+ // Connectors view: tools / MCP items (API-level permissions).
+ // Skills view: prompt / agent-based skills.
const hasBuiltinTools = builtinToolItems.length > 0 && isConnectorView;
const hasBuiltinSkills = builtinSkillItems.length > 0 && !isConnectorView;
- // Skills tab only shows agent-based community skills; Lobehub/Composio OAuth
- // connectors live exclusively in the Connectors view (hasCommunityConnectors).
+ // Skills view only shows agent-based community skills; LobeHub / Composio
+ // OAuth connectors live exclusively in the Connectors view.
const hasCommunitySkills = !isConnectorView && marketAgentSkills.length > 0;
- const communityToolCount = communityMCPs.length + marketplaceConnectors.length;
+ const communityToolCount = visibleCommunityMCPs.length + visibleMarketplaceConnectors.length;
const hasCommunityTools = communityToolCount > 0 && isConnectorView;
- // In connector view: custom MCPs (old plugins) + custom connectors (new store).
- // In skill view: user agent skills
- const hasCustomConnectors =
- isConnectorView && (customMCPs.length > 0 || customConnectors.length > 0);
+ const customConnectorCount = visibleCustomConnectors.length + visibleCustomMCPs.length;
+ const hasCustomConnectors = isConnectorView && customConnectorCount > 0;
const hasCustomSkills = userAgentSkills.length > 0 && !isConnectorView;
- // Lobehub/Composio OAuth skills go in Connectors tab (they provide tools)
const hasCommunityConnectors = communitySkillItems.length > 0 && isConnectorView;
- // Agent-owned connectors (across all agents) — connector view only.
- const hasAgentConnectors = isConnectorView && agentBoundConnectors.length > 0;
+ const hasAgentConnectors = isConnectorView && visibleAgentConnectors.length > 0;
return (
<div {...stylex.props(styles.container)}>
+ {header}
{hasBuiltinTools &&
renderSection(
'builtinTools',
t('skillGroup.builtinTools', 'Built-in Tools'),
- builtinToolItems.map((item) => {
- if (item.type !== 'builtin') return null;
- const localizedTitle = t(`tools.builtins.${item.builtinTool.identifier}.title`, {
- defaultValue: item.builtinTool.title || item.builtinTool.identifier,
- });
- return (
- <BuiltinSkillItem
- avatar={item.builtinTool.avatar}
- description={item.builtinTool.description}
- identifier={item.builtinTool.identifier}
- isSelected={selectedIdentifier === item.builtinTool.identifier}
- key={item.builtinTool.identifier}
- title={localizedTitle}
- onSelect={
- onSelect ? () => onSelect(item.builtinTool.identifier, 'builtin') : undefined
- }
- />
- );
- }),
- builtinToolItems.length,
+ builtinToolItems.map(renderIntegration),
)}
{hasBuiltinSkills &&
@@ -534,48 +653,18 @@ const SkillList = memo<SkillListProps>(
}),
)}
- {/* Connector view: Lobehub/Composio OAuth connectors */}
{hasCommunityConnectors &&
renderSection(
'communityConnectors',
t('skillGroup.communityConnectors', 'OAuth Connectors'),
- communitySkillItems.map((item) => {
- if (item.type === 'lobehub') {
- return (
- <LobehubSkillItem
- isSelected={selectedIdentifier === item.provider.id}
- key={item.provider.id}
- provider={item.provider}
- server={getLobehubSkillServerByProvider(item.provider.id)}
- onDelete={onDeleteSelected}
- onSelect={
- onSelect ? () => onSelect(item.provider.id, 'lobehub-connector') : undefined
- }
- />
- );
- }
- return (
- <ComposioSkillItem
- isSelected={selectedIdentifier === item.serverType.identifier}
- key={item.serverType.identifier}
- server={getComposioServerByIdentifier(item.serverType.identifier)}
- serverType={item.serverType}
- onDelete={onDeleteSelected}
- onSelect={
- onSelect ? () => onSelect(item.serverType.identifier, 'plugin') : undefined
- }
- />
- );
- }),
- communitySkillItems.length,
+ communitySkillItems.map(renderIntegration),
)}
- {/* Skill view: community agent skills only (OAuth connectors are in the Connectors view) */}
{hasCommunitySkills &&
renderSection(
'communitySkills',
t('skillGroup.communitySkills', 'Community Skills'),
- renderMarketAgentSkills(),
+ renderAgentSkills(marketAgentSkills),
)}
{hasCommunityTools &&
@@ -583,40 +672,27 @@ const SkillList = memo<SkillListProps>(
'communityTools',
t('skillGroup.communityTools', 'Community Tools'),
renderCommunityMCPs(),
- communityToolCount,
)}
{hasCustomConnectors &&
renderSection(
'customConnectors',
t('skillGroup.customConnectors', 'Custom Connectors'),
- <>
- {renderCustomConnectors()}
- {renderCustomMCPs()}
- </>,
- customConnectors.length + customMCPs.length,
+ renderCustomConnectors(),
)}
{hasAgentConnectors &&
renderSection(
'agentConnectors',
t('skillGroup.agentConnectors', 'Agent Connectors'),
- agentBoundConnectors.map((c) => (
- <AgentConnectorItem
- connector={c}
- isSelected={selectedIdentifier === c.id}
- key={c.id}
- onSelect={onSelect ? () => onSelect(c.id, 'agent-connector') : undefined}
- />
- )),
- agentBoundConnectors.length,
+ renderAgentConnectors(),
)}
{hasCustomSkills &&
renderSection(
'customSkills',
t('skillGroup.customSkills', 'Custom Skills'),
- renderUserAgentSkills(),
+ renderAgentSkills(userAgentSkills),
)}
</div>
);
diff --git a/src/features/Settings/skill/features/SkillListRow.tsx b/src/features/Settings/skill/features/SkillListRow.tsx
index 9d2990a66f1..724b208f25e 100644
--- a/src/features/Settings/skill/features/SkillListRow.tsx
+++ b/src/features/Settings/skill/features/SkillListRow.tsx
@@ -3,7 +3,7 @@
import { Block, Center, cssVar, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';
import { cssVar as sxVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { ChevronRight, CircleCheck } from 'lucide-react';
+import { CircleCheck } from 'lucide-react';
import { createContext, memo, type ReactNode, use } from 'react';
import NavItem, { type NavItemProps } from '@/features/NavPanel/components/NavItem';
@@ -21,23 +21,28 @@ export const SkillListVariantProvider = SkillListVariantContext.Provider;
export const useSkillListVariant = () => use(SkillListVariantContext);
const styles = stylex.create({
- chevron: {
- color: sxVar.colorTextQuaternary,
- flex: 'none',
- },
+ // A borderless row in a two-column catalog: the icon tile and whitespace
+ // identify an entry, the trailing slot is its one action (`+` or `⋯`).
iconTile: {
backgroundColor: sxVar.colorBgContainer,
borderColor: sxVar.colorBorderSecondary,
- borderRadius: sxVar.borderRadius,
+ borderRadius: sxVar.borderRadiusLG,
borderStyle: 'solid',
borderWidth: 1,
flex: 'none',
- height: 36,
+ height: 40,
overflow: 'hidden',
- width: 36,
+ width: 40,
},
row: {
- minHeight: 60,
+ minHeight: 64,
+ minWidth: 0,
+ },
+ trailing: {
+ alignItems: 'center',
+ display: 'flex',
+ flex: 'none',
+ gap: 8,
},
});
@@ -80,7 +85,7 @@ const SkillListRow = memo<SkillListRowProps>(
{...stylex.props(styles.row)}
clickable={!!onClick}
gap={12}
- paddingBlock={10}
+ paddingBlock={12}
paddingInline={12}
variant={'borderless'}
onClick={onClick}
@@ -93,18 +98,14 @@ const SkillListRow = memo<SkillListRowProps>(
{title}
</Text>
{summary && (
- <Text ellipsis color={cssVar.colorTextDescription} fontSize={12}>
+ <Text ellipsis color={cssVar.colorTextSecondary} fontSize={13}>
{summary}
</Text>
)}
{description}
</Flexbox>
- {extra && (
- <Flexbox horizontal align={'center'} flex={'none'} gap={8}>
- {extra}
- </Flexbox>
- )}
- {onClick && <Icon {...stylex.props(styles.chevron)} icon={ChevronRight} size={16} />}
+ {/* Row actions stop their own clicks, so they never open the detail. */}
+ {extra && <div {...stylex.props(styles.trailing)}>{extra}</div>}
</Block>
);
},
diff --git a/src/features/Settings/skill/features/connectorSections.test.ts b/src/features/Settings/skill/features/connectorSections.test.ts
new file mode 100644
index 00000000000..5ff69c3709c
--- /dev/null
+++ b/src/features/Settings/skill/features/connectorSections.test.ts
@@ -0,0 +1,158 @@
+import { getConnectorCatalog, RecommendedSkillType } from '@lobechat/const';
+import type { LobeBuiltinTool } from '@lobechat/types';
+import { createInstance } from 'i18next';
+import { describe, expect, it } from 'vitest';
+
+import zhSetting from '../../../../../locales/zh-CN/setting.json';
+import {
+ buildIntegrationItems,
+ getVisibleSectionItems,
+ matchesConnectorKeyword,
+ matchesIntegrationKeyword,
+ partitionByInstalled,
+ SECTION_PREVIEW_LIMIT,
+} from './connectorSections';
+
+const tool = (identifier: string, hidden = false) =>
+ ({ hidden, identifier, manifest: {}, title: identifier, type: 'builtin' }) as LobeBuiltinTool;
+
+const noConnectors = { composio: false, lobehub: false };
+
+describe('buildIntegrationItems', () => {
+ it('lists recommended built-ins, then other installed built-ins, connected first', () => {
+ const installed = new Set(['b', 'c']);
+ const items = buildIntegrationItems({
+ allBuiltinTools: [tool('a'), tool('b'), tool('c'), tool('hidden', true), tool('d')],
+ builtinSkills: [],
+ connectorAvailability: noConnectors,
+ isBuiltinToolInstalled: (id) => installed.has(id),
+ isComposioActive: () => false,
+ isLobehubConnected: () => false,
+ recommendedSkills: [
+ { id: 'a', type: RecommendedSkillType.Builtin },
+ { id: 'b', type: RecommendedSkillType.Builtin },
+ { id: 'hidden', type: RecommendedSkillType.Builtin },
+ ],
+ });
+
+ // `d` is neither recommended nor installed; `hidden` never shows.
+ expect(items.map((i) => (i.type === 'builtin' ? i.builtinTool.identifier : i.type))).toEqual([
+ 'b',
+ 'c',
+ 'a',
+ ]);
+ });
+
+ it('shows every visible built-in when nothing is recommended', () => {
+ const items = buildIntegrationItems({
+ allBuiltinTools: [tool('a'), tool('hidden', true), tool('b')],
+ builtinSkills: [],
+ connectorAvailability: noConnectors,
+ isBuiltinToolInstalled: (id) => id === 'b',
+ isComposioActive: () => false,
+ isLobehubConnected: () => false,
+ recommendedSkills: [],
+ });
+
+ expect(items.map((i) => (i.type === 'builtin' ? i.builtinTool.identifier : i.type))).toEqual([
+ 'b',
+ 'a',
+ ]);
+ });
+
+ it('adds LobeHub OAuth providers only when that system is enabled', () => {
+ const base = {
+ allBuiltinTools: [],
+ builtinSkills: [],
+ isBuiltinToolInstalled: () => false,
+ isComposioActive: () => false,
+ isLobehubConnected: () => false,
+ recommendedSkills: [],
+ };
+ expect(buildIntegrationItems({ ...base, connectorAvailability: noConnectors })).toEqual([]);
+ const withLobehub = buildIntegrationItems({
+ ...base,
+ connectorAvailability: { composio: false, lobehub: true },
+ });
+ expect(withLobehub.length).toBeGreaterThan(0);
+ expect(withLobehub.every((i) => i.type === 'lobehub')).toBe(true);
+ });
+});
+
+describe('matchesConnectorKeyword', () => {
+ it('matches any field case-insensitively and ignores surrounding spaces', () => {
+ expect(matchesConnectorKeyword(' GEN ', ['Image Generation', undefined])).toBe(true);
+ expect(matchesConnectorKeyword('notion', ['GitHub', 'lobe-github', null])).toBe(false);
+ });
+
+ it('matches everything when the keyword is empty', () => {
+ expect(matchesConnectorKeyword('', [])).toBe(true);
+ expect(matchesConnectorKeyword(undefined, ['x'])).toBe(true);
+ });
+});
+
+describe('matchesIntegrationKeyword', () => {
+ const catalog = getConnectorCatalog({ composio: true, lobehub: true });
+
+ it.each([
+ ['电子邮件', ['gmail']],
+ ['版本控制', ['github']],
+ ['free email service', ['gmail']],
+ ['version control', ['github']],
+ [' GMAIL ', ['gmail']],
+ ['google-calendar', ['google-calendar']],
+ ['不存在的连接器', []],
+ ])(
+ 'searches localized descriptions, original descriptions and names: %s',
+ async (keyword, ids) => {
+ const i18n = createInstance();
+ await i18n.init({ lng: 'zh-CN', resources: { 'zh-CN': { setting: zhSetting } } });
+
+ const matches = catalog.filter((item) =>
+ matchesIntegrationKeyword(item, keyword, i18n.getFixedT('zh-CN', 'setting')),
+ );
+
+ expect(
+ matches.map((item) =>
+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,
+ ),
+ ).toEqual(ids);
+ },
+ );
+
+ it('keeps catalog descriptions searchable when translations are unavailable', async () => {
+ const i18n = createInstance();
+ await i18n.init({ lng: 'en-US', resources: {} });
+ const t = i18n.getFixedT('en-US', 'setting');
+
+ for (const item of catalog) {
+ const description =
+ item.type === 'lobehub' ? item.provider.description : item.serverType.description;
+ expect(matchesIntegrationKeyword(item, description, t)).toBe(true);
+ }
+ });
+});
+
+describe('partitionByInstalled', () => {
+ it('keeps the order on both sides', () => {
+ expect(partitionByInstalled([1, 2, 3, 4, 5], (n) => n % 2 === 1)).toEqual({
+ available: [2, 4],
+ installed: [1, 3, 5],
+ });
+ });
+});
+
+describe('getVisibleSectionItems', () => {
+ const items = Array.from({ length: SECTION_PREVIEW_LIMIT + 3 }, (_, i) => i);
+
+ it('previews the first rows of a long group and counts the rest', () => {
+ const { hiddenCount, visible } = getVisibleSectionItems(items, false);
+ expect(visible).toHaveLength(SECTION_PREVIEW_LIMIT);
+ expect(hiddenCount).toBe(3);
+ });
+
+ it('shows everything when expanded or short', () => {
+ expect(getVisibleSectionItems(items, true)).toEqual({ hiddenCount: 0, visible: items });
+ expect(getVisibleSectionItems([1, 2], false)).toEqual({ hiddenCount: 0, visible: [1, 2] });
+ });
+});
diff --git a/src/features/Settings/skill/features/connectorSections.ts b/src/features/Settings/skill/features/connectorSections.ts
new file mode 100644
index 00000000000..53f01d58754
--- /dev/null
+++ b/src/features/Settings/skill/features/connectorSections.ts
@@ -0,0 +1,213 @@
+import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';
+import {
+ getConnectorCatalog,
+ RECOMMENDED_SKILLS,
+ RecommendedSkillType,
+ resolveConnectorCatalogItem,
+} from '@lobechat/const';
+import type { BuiltinSkillManifest, LobeBuiltinTool } from '@lobechat/types';
+import type { TFunction } from 'i18next';
+
+export type IntegrationItem =
+ | { builtinAgentSkill: BuiltinSkillManifest; type: 'builtinAgent' }
+ | { builtinTool: LobeBuiltinTool; type: 'builtin' }
+ | { provider: LobehubSkillProviderType; type: 'lobehub' }
+ | { serverType: ComposioAppType; type: 'composio' };
+
+/** A page group shows this many rows before "Show all" (the first screen stays scannable). */
+export const SECTION_PREVIEW_LIMIT = 6;
+
+export interface BuildIntegrationItemsParams {
+ allBuiltinTools: LobeBuiltinTool[];
+ builtinSkills: BuiltinSkillManifest[];
+ connectorAvailability: { composio: boolean; lobehub: boolean };
+ isBuiltinToolInstalled: (identifier: string) => boolean;
+ isComposioActive: (identifier: string) => boolean;
+ isLobehubConnected: (providerId: string) => boolean;
+ /** Defaults to the app's `RECOMMENDED_SKILLS`; injectable for tests. */
+ recommendedSkills?: typeof RECOMMENDED_SKILLS;
+}
+
+export const isIntegrationConnected = (
+ item: IntegrationItem,
+ params: Pick<
+ BuildIntegrationItemsParams,
+ 'isBuiltinToolInstalled' | 'isComposioActive' | 'isLobehubConnected'
+ >,
+): boolean => {
+ switch (item.type) {
+ case 'builtinAgent': {
+ return params.isBuiltinToolInstalled(item.builtinAgentSkill.identifier);
+ }
+ case 'builtin': {
+ return params.isBuiltinToolInstalled(item.builtinTool.identifier);
+ }
+ case 'lobehub': {
+ return params.isLobehubConnected(item.provider.id);
+ }
+ case 'composio': {
+ return params.isComposioActive(item.serverType.identifier);
+ }
+ }
+};
+
+/**
+ * Every integration the connector / skill lists can show, connected ones first:
+ * built-in agent skills, built-in tools and the LobeHub / Composio OAuth catalog.
+ */
+export const buildIntegrationItems = (params: BuildIntegrationItemsParams): IntegrationItem[] => {
+ const {
+ allBuiltinTools,
+ builtinSkills,
+ connectorAvailability,
+ isBuiltinToolInstalled,
+ isComposioActive,
+ recommendedSkills = RECOMMENDED_SKILLS,
+ } = params;
+
+ // Built-in agent skills first so they appear early in the list.
+ let items: IntegrationItem[] = builtinSkills.map((skill) => ({
+ builtinAgentSkill: skill,
+ type: 'builtinAgent' as const,
+ }));
+
+ const addedBuiltinIds = new Set<string>();
+ const addedConnectorIds = new Set<string>();
+
+ if (recommendedSkills.length > 0) {
+ for (const skill of recommendedSkills) {
+ if (skill.type === RecommendedSkillType.Builtin) {
+ const builtinTool = allBuiltinTools.find((tool) => tool.identifier === skill.id);
+ if (builtinTool && !builtinTool.hidden) {
+ items.push({ builtinTool, type: 'builtin' });
+ addedBuiltinIds.add(skill.id);
+ }
+ } else {
+ const connector = resolveConnectorCatalogItem(skill.id, connectorAvailability);
+ if (connector && !addedConnectorIds.has(skill.id)) {
+ items.push(connector);
+ addedConnectorIds.add(skill.id);
+ }
+ }
+ }
+
+ // Installed built-in tools that are not recommended still belong in the list.
+ for (const tool of allBuiltinTools) {
+ if (
+ !tool.hidden &&
+ isBuiltinToolInstalled(tool.identifier) &&
+ !addedBuiltinIds.has(tool.identifier)
+ ) {
+ items.push({ builtinTool: tool, type: 'builtin' });
+ }
+ }
+
+ // Every remaining connector through the shared ownership resolver, so one
+ // identifier never renders through both LobeHub and Composio authorization.
+ for (const connector of getConnectorCatalog(connectorAvailability)) {
+ const identifier =
+ connector.type === 'lobehub' ? connector.provider.id : connector.serverType.identifier;
+ if (!addedConnectorIds.has(identifier)) {
+ items.push(connector);
+ addedConnectorIds.add(identifier);
+ }
+ }
+ } else {
+ for (const tool of allBuiltinTools) {
+ if (!tool.hidden) items.push({ builtinTool: tool, type: 'builtin' });
+ }
+
+ items.push(...getConnectorCatalog(connectorAvailability));
+
+ // Show all built-in and LobeHub entries, but only connected Composio apps.
+ items = items.filter(
+ (item) => item.type !== 'composio' || isComposioActive(item.serverType.identifier),
+ );
+ }
+
+ // Stable sort: connected / installed first, catalog order otherwise.
+ return items.sort((a, b) => {
+ const connectedA = isIntegrationConnected(a, params);
+ const connectedB = isIntegrationConnected(b, params);
+ if (connectedA === connectedB) return 0;
+ return connectedA ? -1 : 1;
+ });
+};
+
+/** Case-insensitive match of a search keyword against any of an entry's text fields. */
+export const matchesConnectorKeyword = (
+ keyword: string | undefined,
+ fields: Array<string | null | undefined>,
+): boolean => {
+ const needle = keyword?.trim().toLowerCase();
+ if (!needle) return true;
+ return fields.some((field) => !!field && field.toLowerCase().includes(needle));
+};
+
+export const matchesIntegrationKeyword = (
+ item: IntegrationItem,
+ keyword: string | undefined,
+ t: TFunction<'setting'>,
+): boolean => {
+ switch (item.type) {
+ case 'builtin': {
+ const tool = item.builtinTool;
+ return matchesConnectorKeyword(keyword, [
+ t(`tools.builtins.${tool.identifier}.title`, {
+ defaultValue: tool.title || tool.identifier,
+ }),
+ tool.identifier,
+ t(`tools.builtins.${tool.identifier}.description`, {
+ defaultValue: tool.description ?? '',
+ }),
+ ]);
+ }
+ case 'lobehub': {
+ return matchesConnectorKeyword(keyword, [
+ item.provider.label,
+ item.provider.id,
+ item.provider.description,
+ t(`tools.lobehubSkill.providers.${item.provider.id}.description`, {
+ defaultValue: item.provider.description,
+ }),
+ ]);
+ }
+ case 'composio': {
+ return matchesConnectorKeyword(keyword, [
+ item.serverType.label,
+ item.serverType.identifier,
+ item.serverType.description,
+ t(`tools.composio.servers.${item.serverType.identifier}.description`, {
+ defaultValue: item.serverType.description,
+ }),
+ ]);
+ }
+ default: {
+ return true;
+ }
+ }
+};
+
+/**
+ * Split a group into what is already installed / connected and what is still
+ * available to add, keeping each side's order.
+ */
+export const partitionByInstalled = <T>(
+ items: T[],
+ isInstalled: (item: T) => boolean,
+): { available: T[]; installed: T[] } => {
+ const installed: T[] = [];
+ const available: T[] = [];
+ for (const item of items) (isInstalled(item) ? installed : available).push(item);
+ return { available, installed };
+};
+
+/** The rows a group renders: all of them when expanded, otherwise the preview. */
+export const getVisibleSectionItems = <T>(
+ items: T[],
+ expanded: boolean,
+ limit = SECTION_PREVIEW_LIMIT,
+): { hiddenCount: number; visible: T[] } => {
+ if (expanded || items.length <= limit) return { hiddenCount: 0, visible: items };
+ return { hiddenCount: items.length - limit, visible: items.slice(0, limit) };
+};
diff --git a/src/features/Settings/skill/features/useToolDisplayName.test.ts b/src/features/Settings/skill/features/useToolDisplayName.test.ts
new file mode 100644
index 00000000000..f8e649768e3
--- /dev/null
+++ b/src/features/Settings/skill/features/useToolDisplayName.test.ts
@@ -0,0 +1,62 @@
+import { renderHook } from '@testing-library/react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useToolDisplayName } from './useToolDisplayName';
+
+const mocks = vi.hoisted(() => ({
+ state: {
+ agentSkillDetailMap: {} as Record<string, { skillDetail: { name: string } }>,
+ agentSkillListMap: { all: [] as Array<{ id: string; identifier: string; name: string }> },
+ builtinSkills: [] as Array<{ identifier: string; name: string }>,
+ builtinTools: [],
+ },
+}));
+
+vi.mock('@/store/tool', () => ({
+ useToolStore: (selector: (state: typeof mocks.state) => unknown) => selector(mocks.state),
+}));
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({
+ t: (key: string, options: { defaultValue: string }) =>
+ key === 'tools.builtins.lobe-agent-browser.title' ? '助手浏览器' : options.defaultValue,
+ }),
+}));
+
+describe('skill detail breadcrumb names', () => {
+ beforeEach(() => {
+ mocks.state.agentSkillListMap.all = [];
+ mocks.state.agentSkillDetailMap = {};
+ mocks.state.builtinSkills = [];
+ });
+
+ it('looks up installed skills by id, not their import identifier', () => {
+ mocks.state.agentSkillListMap.all = [
+ { id: 'first', identifier: 'skl-selected', name: 'Other skill' },
+ { id: 'skl-selected', identifier: 'imported-skill', name: 'Imported skill' },
+ ];
+ expect(renderHook(() => useToolDisplayName('skl-selected', 'agent-skill')).result.current).toBe(
+ 'Imported skill',
+ );
+ });
+
+ it('uses a loaded detail name when opening a deep link without a loaded list', () => {
+ mocks.state.agentSkillDetailMap['skl-detail'] = { skillDetail: { name: 'Deep-linked skill' } };
+ expect(renderHook(() => useToolDisplayName('skl-detail', 'agent-skill')).result.current).toBe(
+ 'Deep-linked skill',
+ );
+ });
+
+ it('uses the localized builtin name, falling back to the manifest name', () => {
+ mocks.state.builtinSkills = [
+ { identifier: 'lobe-agent-browser', name: 'Agent Browser' },
+ { identifier: 'custom-builtin', name: 'Custom builtin' },
+ ];
+ expect(
+ renderHook(() => useToolDisplayName('lobe-agent-browser', 'builtin-skill')).result.current,
+ ).toBe('助手浏览器');
+ expect(
+ renderHook(() => useToolDisplayName('custom-builtin', 'builtin-skill')).result.current,
+ ).toBe('Custom builtin');
+ });
+});
diff --git a/src/features/Settings/skill/features/useToolDisplayName.ts b/src/features/Settings/skill/features/useToolDisplayName.ts
new file mode 100644
index 00000000000..1a08f963f5f
--- /dev/null
+++ b/src/features/Settings/skill/features/useToolDisplayName.ts
@@ -0,0 +1,43 @@
+import { getComposioAppByIdentifier, getLobehubSkillProviderById } from '@lobechat/const';
+import { useTranslation } from 'react-i18next';
+
+import { useToolStore } from '@/store/tool';
+import { agentSkillsSelectors, pluginSelectors } from '@/store/tool/selectors';
+import { connectorSelectors } from '@/store/tool/slices/connector';
+
+import type { ToolDetailType } from './SkillDetail';
+
+/**
+ * The name a list row shows for the entry a detail page opened, so the
+ * breadcrumb reads `Connectors › <the row you clicked>`. Falls back to the
+ * identifier while the entry is still loading.
+ */
+export const useToolDisplayName = (identifier: string, type: ToolDetailType): string => {
+ const { t } = useTranslation('setting');
+
+ const builtinTitle = useToolStore((s) =>
+ type === 'builtin'
+ ? s.builtinTools.find((tool) => tool.identifier === identifier)?.title
+ : s.builtinSkills.find((skill) => skill.identifier === identifier)?.name,
+ );
+ const skillName = useToolStore((s) =>
+ type === 'agent-skill'
+ ? (agentSkillsSelectors.getAgentSkills(s).find((skill) => skill.id === identifier)?.name ??
+ agentSkillsSelectors.getAgentSkillDetail(identifier)(s)?.name)
+ : undefined,
+ );
+ const connectorName = useToolStore((s) =>
+ type === 'agent-connector'
+ ? (s.agentBoundConnectors ?? []).find((c) => c.id === identifier)?.name
+ : connectorSelectors.connectorByIdentifier(identifier)(s)?.name,
+ );
+ const pluginTitle = useToolStore((s) =>
+ type === 'plugin' ? pluginSelectors.getPluginMetaById(identifier)(s)?.title : undefined,
+ );
+
+ if (type === 'agent-skill') return skillName || identifier;
+ if (type === 'builtin' || type === 'builtin-skill')
+ return t(`tools.builtins.${identifier}.title`, { defaultValue: builtinTitle || identifier });
+ const brand = getComposioAppByIdentifier(identifier) ?? getLobehubSkillProviderById(identifier);
+ return brand?.label || pluginTitle || connectorName || identifier;
+};
diff --git a/src/features/Settings/skill/index.tsx b/src/features/Settings/skill/index.tsx
index f69172af27a..d4cbf09d184 100644
--- a/src/features/Settings/skill/index.tsx
+++ b/src/features/Settings/skill/index.tsx
@@ -1,24 +1,24 @@
'use client';
-import { ActionIcon, Button, Flexbox, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
-import { ArrowLeft, ChevronLeft } from 'lucide-react';
-import { memo, useCallback, useEffect, useState } from 'react';
+import { ChevronLeft } from 'lucide-react';
+import { Activity, memo, useCallback, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate, useSearchParams } from 'react-router';
import NavHeader from '@/features/NavHeader';
import { useToolStore } from '@/store/tool';
-import { agentSkillsSelectors, builtinToolSelectors } from '@/store/tool/selectors';
+import { agentSkillsSelectors } from '@/store/tool/selectors';
import { isMobileSurface } from '@/utils/mobileSurface';
+import DetailBreadcrumb from './features/DetailBreadcrumb';
import LeftPanel from './features/LeftPanel';
import SkillDetail, { type ToolDetailType } from './features/SkillDetail';
import { type SkillViewMode } from './features/SkillList';
import {
encodeMobileSelection,
- isStackedLayout,
MOBILE_SELECTION_PARAM,
parseMobileSelection,
} from './mobileSelection';
@@ -54,7 +54,7 @@ const styles = stylex.create({
minHeight: '100%',
paddingBlockEnd: '104px',
},
- root: { overflow: 'hidden', display: 'flex', flex: '1', height: '100%' },
+ resourceDetailPage: { height: '100%', minHeight: 0, paddingBlockEnd: '24px' },
});
interface ToolSettingsProps {
@@ -71,13 +71,9 @@ const PUSHED_DETAIL_STATE = 'skillDetailPushed';
export const ToolSettings = memo<ToolSettingsProps>(({ viewMode }) => {
const { t } = useTranslation(['common', 'setting']);
const mobile = isMobileSurface();
- const stacked = isStackedLayout(mobile, viewMode);
const [searchParams, setSearchParams] = useSearchParams();
const querySkillIdentifier = searchParams.get('skill');
- const [selected, setSelected] = useState<SelectedTool | null>(null);
- const stackedSelected = stacked
- ? parseMobileSelection(searchParams.get(MOBILE_SELECTION_PARAM))
- : undefined;
+ const stackedSelected = parseMobileSelection(searchParams.get(MOBILE_SELECTION_PARAM));
// Stacked: opening a detail is a history entry, so back returns to the list.
const openStackedDetail = useCallback(
@@ -113,43 +109,8 @@ export const ToolSettings = memo<ToolSettingsProps>(({ viewMode }) => {
);
};
- const builtinTools = useToolStore((s) => s.builtinTools, isEqual);
- const builtinSkills = useToolStore((s) => s.builtinSkills, isEqual);
const marketAgentSkills = useToolStore(agentSkillsSelectors.getMarketAgentSkills, isEqual);
const userAgentSkills = useToolStore(agentSkillsSelectors.getUserAgentSkills, isEqual);
- const installedBuiltinIds = useToolStore(
- (s) => builtinToolSelectors.installedAllMetaList(s).map((tool) => tool.identifier),
- isEqual,
- );
-
- useEffect(() => {
- // A stacked page shows one pane at a time and opens on the list, so nothing
- // is pre-selected there.
- if (stacked) return;
- if (selected) return;
- if (viewMode === 'skill' && querySkillIdentifier) return;
- if (viewMode === 'connector') {
- const firstTool = builtinTools.find(
- (tool) => !tool.hidden && installedBuiltinIds.includes(tool.identifier),
- );
- if (firstTool) {
- setSelected({ identifier: firstTool.identifier, type: 'builtin' });
- }
- } else {
- const firstSkill = builtinSkills[0];
- if (firstSkill) {
- setSelected({ identifier: firstSkill.identifier, type: 'builtin-skill' });
- }
- }
- }, [
- builtinTools,
- builtinSkills,
- installedBuiltinIds,
- querySkillIdentifier,
- selected,
- stacked,
- viewMode,
- ]);
useEffect(() => {
if (viewMode !== 'skill' || !querySkillIdentifier) return;
@@ -158,106 +119,83 @@ export const ToolSettings = memo<ToolSettingsProps>(({ viewMode }) => {
(item) => item.identifier === querySkillIdentifier,
);
if (!skill) return;
- // Mobile turns the deep link into the detail entry once (dropping `skill`),
+ // Turn the deep link into the detail entry once (dropping `skill`),
// so a later store refresh cannot reopen a detail the user closed.
- if (stacked) openStackedDetail({ identifier: skill.id, type: 'agent-skill' }, true);
- else setSelected({ identifier: skill.id, type: 'agent-skill' });
- }, [
- marketAgentSkills,
- openStackedDetail,
- querySkillIdentifier,
- stacked,
- userAgentSkills,
- viewMode,
- ]);
+ openStackedDetail({ identifier: skill.id, type: 'agent-skill' }, true);
+ }, [marketAgentSkills, openStackedDetail, querySkillIdentifier, userAgentSkills, viewMode]);
const handleSelect = (identifier: string, type: ToolDetailType) => {
- if (stacked) openStackedDetail({ identifier, type });
- else setSelected({ identifier, type });
+ openStackedDetail({ identifier, type });
};
+ // Keep the list mounted across detail navigation, preserving search and expanded groups.
+ const list = (
+ <Activity mode={stackedSelected ? 'hidden' : 'visible'}>
+ <LeftPanel
+ fullWidth
+ page={!mobile || viewMode === 'skill'}
+ viewMode={viewMode}
+ onDeleteSelected={closeStackedDetail}
+ onSelect={handleSelect}
+ />
+ </Activity>
+ );
+
// Mobile: the settings layout owns the header; list and detail take turns
// full-width instead of a 300px list squeezing the detail.
if (mobile)
- return stackedSelected ? (
- <Flexbox className={stylex.props(styles.detail).className}>
- <Flexbox horizontal align={'center'} paddingBlock={4} paddingInline={8}>
- <ActionIcon icon={ChevronLeft} title={t('back')} onClick={closeStackedDetail} />
- </Flexbox>
- <SkillDetail
- identifier={stackedSelected.identifier}
- type={stackedSelected.type}
- onDelete={closeStackedDetail}
- />
+ return (
+ <Flexbox flex={1} style={{ minHeight: 0, overflowY: 'auto' }}>
+ {list}
+ {stackedSelected && (
+ <Flexbox className={stylex.props(styles.detail).className}>
+ <Flexbox horizontal align={'center'} paddingBlock={4} paddingInline={8}>
+ <ActionIcon icon={ChevronLeft} title={t('back')} onClick={closeStackedDetail} />
+ </Flexbox>
+ <SkillDetail
+ identifier={stackedSelected.identifier}
+ type={stackedSelected.type}
+ onDelete={closeStackedDetail}
+ />
+ </Flexbox>
+ )}
</Flexbox>
- ) : (
- <div {...stylex.props(styles.root)}>
- <LeftPanel
- fullWidth
- viewMode={viewMode}
- onDeleteSelected={closeStackedDetail}
- onSelect={handleSelect}
- />
- </div>
);
- // Desktop connectors: a full-width list; a row opens its detail as a second
+ // A full-width list; a row opens its detail as a second
// level page whose back link names the list it returns to.
- if (stacked)
- return (
- <>
- <NavHeader styles={{ center: { alignItems: 'center' } }}>
- <Text weight={500}>{t('tab.connector', { ns: 'setting' })}</Text>
- </NavHeader>
- <div {...stylex.props(styles.page)}>
- <div {...stylex.props(styles.pageBody)}>
- {stackedSelected ? (
- <>
- <Flexbox horizontal align={'center'} paddingBlock={12} paddingInline={4}>
- <Button icon={ArrowLeft} type={'text'} onClick={closeStackedDetail}>
- {t('skillView.connectors', { ns: 'setting' })}
- </Button>
- </Flexbox>
+ return (
+ <>
+ {/* The page itself carries the title (list) or the breadcrumb (detail). */}
+ <NavHeader />
+ <div {...stylex.props(styles.page)}>
+ <div
+ {...stylex.props(
+ styles.pageBody,
+ stackedSelected?.type === 'agent-skill' && styles.resourceDetailPage,
+ )}
+ >
+ {list}
+ {stackedSelected && (
+ <>
+ <DetailBreadcrumb
+ identifier={stackedSelected.identifier}
+ type={stackedSelected.type}
+ listLabel={t(viewMode === 'skill' ? 'skillView.skills' : 'skillView.connectors', {
+ ns: 'setting',
+ })}
+ onBack={closeStackedDetail}
+ />
+ <Flexbox flex={1} style={{ minHeight: 0 }}>
<SkillDetail
identifier={stackedSelected.identifier}
type={stackedSelected.type}
onDelete={closeStackedDetail}
/>
- </>
- ) : (
- <LeftPanel
- fullWidth
- page
- viewMode={viewMode}
- onDeleteSelected={closeStackedDetail}
- onSelect={handleSelect}
- />
- )}
- </div>
+ </Flexbox>
+ </>
+ )}
</div>
- </>
- );
-
- return (
- <>
- <NavHeader />
- <div {...stylex.props(styles.root)}>
- <LeftPanel
- selectedIdentifier={selected?.identifier}
- viewMode={viewMode}
- onDeleteSelected={() => setSelected(null)}
- onSelect={handleSelect}
- />
-
- {selected && (
- <div {...stylex.props(styles.detail)}>
- <SkillDetail
- identifier={selected.identifier}
- type={selected.type}
- onDelete={() => setSelected(null)}
- />
- </div>
- )}
</div>
</>
);
diff --git a/src/features/Settings/skill/mobileSelection.test.ts b/src/features/Settings/skill/mobileSelection.test.ts
index f6af5bde31c..76352d77544 100644
--- a/src/features/Settings/skill/mobileSelection.test.ts
+++ b/src/features/Settings/skill/mobileSelection.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { encodeMobileSelection, isStackedLayout, parseMobileSelection } from './mobileSelection';
+import { encodeMobileSelection, parseMobileSelection } from './mobileSelection';
describe('mobile skill selection param', () => {
it('round-trips a selection, including identifiers that contain a colon', () => {
@@ -17,10 +17,9 @@ describe('mobile skill selection param', () => {
});
});
-describe('isStackedLayout', () => {
- it('opens connectors as list → detail on desktop too, keeping the skill split', () => {
- expect(isStackedLayout(false, 'connector')).toBe(true);
- expect(isStackedLayout(false, 'skill')).toBe(false);
- expect(isStackedLayout(true, 'skill')).toBe(true);
+describe('skill detail links', () => {
+ it.each(['agent-skill', 'builtin-skill'] as const)('round-trips %s selections', (type) => {
+ const selection = { identifier: 'skill:with-colon', type };
+ expect(parseMobileSelection(encodeMobileSelection(selection))).toEqual(selection);
});
});
diff --git a/src/features/Settings/skill/mobileSelection.ts b/src/features/Settings/skill/mobileSelection.ts
index f17fde16b5f..a97f4e4078b 100644
--- a/src/features/Settings/skill/mobileSelection.ts
+++ b/src/features/Settings/skill/mobileSelection.ts
@@ -1,8 +1,7 @@
import type { ToolDetailType } from './features/SkillDetail';
-import type { SkillViewMode } from './features/SkillList';
/**
- * Mobile (and the desktop Connectors page) shows the list and one item's detail
+ * Skills and connectors show the list and one item's detail
* as separate screens. The open detail lives in this search param so the back
* gesture returns to the list instead of leaving the settings page.
*/
@@ -37,11 +36,3 @@ export const parseMobileSelection = (value: string | null): MobileSelection | un
return { identifier, type };
};
-
-/**
- * Whether list and detail take turns as separate screens. Connectors open as
- * list → detail (a second-level page with a back link) on every surface; skills
- * keep the desktop master-detail split.
- */
-export const isStackedLayout = (mobile: boolean, viewMode: SkillViewMode) =>
- mobile || viewMode === 'connector';
diff --git a/src/features/SkillStore/SkillList/Builtin/Item.tsx b/src/features/SkillStore/SkillList/Builtin/Item.tsx
index 3083c819d36..669e9ad62ff 100644
--- a/src/features/SkillStore/SkillList/Builtin/Item.tsx
+++ b/src/features/SkillStore/SkillList/Builtin/Item.tsx
@@ -1,25 +1,16 @@
'use client';
-import {
- ActionIcon,
- Avatar,
- Block,
- confirmModal,
- DropdownMenu,
- Flexbox,
- Icon,
- stopPropagation,
-} from '@lobehub/ui';
-import { MoreVerticalIcon, Plus, Trash2 } from 'lucide-react';
+import { Avatar, confirmModal, Icon } from '@lobehub/ui';
+import { Trash2 } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { RowAddAction, RowMoreMenu } from '@/features/Settings/skill/features/RowActions';
+import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
import { builtinToolSelectors } from '@/store/tool/selectors';
-import { itemStyles } from '../style';
-
interface ItemProps {
avatar?: string;
description?: string;
@@ -28,9 +19,9 @@ interface ItemProps {
title?: string;
}
+/** A built-in in the store, drawn as the Connectors page row: `+` installs, `⋯` manages. */
const Item = memo<ItemProps>(({ avatar, description, identifier, onOpenDetail, title }) => {
const { t } = useTranslation(['setting', 'plugin', 'common']);
- const styles = itemStyles;
const { allowed: canCreate } = usePermission('create_content');
const { allowed: canEdit } = usePermission('edit_own_content');
@@ -59,56 +50,36 @@ const Item = memo<ItemProps>(({ avatar, description, identifier, onOpenDetail, t
});
};
- const renderAction = () => {
- if (isInstalled) {
- return (
- <DropdownMenu
- placement="bottomRight"
- items={[
- {
- danger: true,
- disabled: !canEdit,
- icon: <Icon icon={Trash2} />,
- key: 'uninstall',
- label: t('store.actions.uninstall', { ns: 'plugin' }),
- onClick: handleUninstall,
- },
- ]}
- >
- <ActionIcon disabled={!canEdit} icon={MoreVerticalIcon} />
- </DropdownMenu>
- );
- }
-
- return (
- <ActionIcon
- disabled={!canCreate}
- icon={Plus}
- title={t('tools.builtins.install')}
- onClick={handleInstall}
- />
- );
- };
-
return (
- <Block
- horizontal
- align={'center'}
- className={styles.container}
- gap={12}
- paddingBlock={12}
- paddingInline={12}
- style={{ cursor: 'pointer' }}
- variant={'outlined'}
+ <SkillListRow
+ icon={() => <Avatar avatar={avatar} size={20} />}
+ summary={description}
+ title={title || identifier}
+ extra={
+ isInstalled ? (
+ <RowMoreMenu
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit,
+ icon: <Icon icon={Trash2} />,
+ key: 'uninstall',
+ label: t('store.actions.uninstall', { ns: 'plugin' }),
+ onClick: handleUninstall,
+ },
+ ]}
+ onOpenDetail={onOpenDetail}
+ />
+ ) : (
+ <RowAddAction
+ disabled={!canCreate}
+ label={t('connectorMarket.action.install')}
+ onClick={handleInstall}
+ />
+ )
+ }
onClick={onOpenDetail}
- >
- <Avatar avatar={avatar} size={40} style={{ marginInlineEnd: 0 }} />
- <Flexbox flex={1} gap={4} style={{ minWidth: 0, overflow: 'hidden' }}>
- <span className={styles.title}>{title || identifier}</span>
- {description && <span className={styles.description}>{description}</span>}
- </Flexbox>
- <div onClick={stopPropagation}>{renderAction()}</div>
- </Block>
+ />
);
});
diff --git a/src/features/SkillStore/SkillList/Community/Item.tsx b/src/features/SkillStore/SkillList/Community/Item.tsx
index 9cb7d30b696..31812b24623 100644
--- a/src/features/SkillStore/SkillList/Community/Item.tsx
+++ b/src/features/SkillStore/SkillList/Community/Item.tsx
@@ -13,7 +13,7 @@ import {
} from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { t as translate } from 'i18next';
-import { MoreVerticalIcon, Plus, Trash2 } from 'lucide-react';
+import { MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';
import React, { memo, Suspense } from 'react';
import { useTranslation } from 'react-i18next';
@@ -125,7 +125,10 @@ const Item = memo<DiscoverMcpItem>(({ name, description, icon, identifier }) =>
},
]}
>
- <ActionIcon icon={MoreVerticalIcon} />
+ <ActionIcon
+ aria-label={t('connectorMarket.action.manage', { ns: 'setting' })}
+ icon={MoreHorizontalIcon}
+ />
</DropdownMenu>
);
}
diff --git a/src/features/SkillStore/SkillList/Community/MarketSkillItem.tsx b/src/features/SkillStore/SkillList/Community/MarketSkillItem.tsx
index f7892f5e61e..4011ba48c1d 100644
--- a/src/features/SkillStore/SkillList/Community/MarketSkillItem.tsx
+++ b/src/features/SkillStore/SkillList/Community/MarketSkillItem.tsx
@@ -15,7 +15,7 @@ import {
} from '@lobehub/ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { t as translate } from 'i18next';
-import { DownloadIcon, Loader2, MoreVerticalIcon, Plus, Trash2 } from 'lucide-react';
+import { DownloadIcon, Loader2, MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';
import { lazy, memo, Suspense, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -144,12 +144,17 @@ const MarketSkillItem = memo<DiscoverSkillItem>(({ name, icon, description, iden
},
]}
>
- <ActionIcon disabled={!canEdit} icon={MoreVerticalIcon} loading={loading} />
+ <ActionIcon
+ aria-label={t('connectorMarket.action.manage', { ns: 'setting' })}
+ disabled={!canEdit}
+ icon={MoreHorizontalIcon}
+ loading={loading}
+ />
</DropdownMenu>
);
}
- if (installing) return <ActionIcon loading icon={Loader2} />;
+ if (installing) return <ActionIcon loading aria-label={tc('loading')} icon={Loader2} />;
return (
<ActionIcon
diff --git a/src/features/SkillStore/SkillList/LobeHub/Item.tsx b/src/features/SkillStore/SkillList/LobeHub/Item.tsx
index f863ad55b00..aeaee9ed0c5 100644
--- a/src/features/SkillStore/SkillList/LobeHub/Item.tsx
+++ b/src/features/SkillStore/SkillList/LobeHub/Item.tsx
@@ -1,22 +1,15 @@
'use client';
-import {
- ActionIcon,
- Block,
- confirmModal,
- cssVar,
- DropdownMenu,
- Flexbox,
- Icon,
- stopPropagation,
-} from '@lobehub/ui';
-import { Loader2, MoreVerticalIcon, Plus, Unplug } from 'lucide-react';
-import React, { memo } from 'react';
+import { Avatar, confirmModal, cssVar, Icon } from '@lobehub/ui';
+import { Unplug } from 'lucide-react';
+import type React from 'react';
+import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { RowAddAction, RowMoreMenu } from '@/features/Settings/skill/features/RowActions';
+import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
import { usePermission } from '@/hooks/usePermission';
-import { itemStyles } from '../style';
import { useSkillConnect } from './useSkillConnect';
interface ItemProps {
@@ -30,10 +23,10 @@ interface ItemProps {
type: 'composio' | 'lobehub';
}
+/** A LobeHub / Composio provider in the store, drawn as the Connectors page row. */
const Item = memo<ItemProps>(
({ description, icon, identifier, label, onOpenDetail, serverName, type }) => {
const { t } = useTranslation('setting');
- const styles = itemStyles;
const { allowed: canCreate } = usePermission('create_content');
const { allowed: canEdit } = usePermission('edit_own_content');
@@ -63,73 +56,43 @@ const Item = memo<ItemProps>(
});
};
- const renderIcon = () => {
- if (typeof icon === 'string') {
- return <img alt={label} height={40} src={icon} width={40} />;
- }
- return <Icon fill={cssVar.colorText} icon={icon as any} size={40} />;
- };
-
- const renderAction = () => {
- if (isConnecting) {
- return <ActionIcon loading icon={Loader2} />;
- }
-
- if (isConnected) {
- return (
- <DropdownMenu
- nativeButton={false}
- placement="bottomRight"
- items={[
- {
- danger: true,
- disabled: !canEdit,
- icon: <Icon icon={Unplug} />,
- key: 'disconnect',
- label: t('tools.lobehubSkill.disconnect'),
- onClick: confirmDisconnect,
- },
- ]}
- >
- <ActionIcon disabled={!canEdit} icon={MoreVerticalIcon} />
- </DropdownMenu>
- );
- }
-
- return (
- <ActionIcon
- disabled={!canCreate || !canEdit}
- icon={Plus}
- title={t('tools.lobehubSkill.connect')}
- onClick={() => {
- if (!canCreate || !canEdit) return;
- handleConnect();
- }}
- />
- );
- };
-
return (
- <Block
- horizontal
- align={'center'}
- className={styles.container}
- gap={12}
- paddingBlock={12}
- paddingInline={12}
- style={{ cursor: 'pointer' }}
- variant={'outlined'}
+ <SkillListRow
+ summary={localizedDescription}
+ title={label}
+ extra={
+ isConnected ? (
+ <RowMoreMenu
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit,
+ icon: <Icon icon={Unplug} />,
+ key: 'disconnect',
+ label: t('tools.lobehubSkill.disconnect'),
+ onClick: confirmDisconnect,
+ },
+ ]}
+ onOpenDetail={onOpenDetail}
+ />
+ ) : (
+ <RowAddAction
+ disabled={!canCreate || !canEdit}
+ label={t('tools.lobehubSkill.connect')}
+ loading={isConnecting}
+ onClick={handleConnect}
+ />
+ )
+ }
+ icon={() =>
+ typeof icon === 'string' ? (
+ <Avatar alt={label} avatar={icon} size={20} />
+ ) : (
+ <Icon fill={cssVar.colorText} icon={icon as any} size={20} />
+ )
+ }
onClick={onOpenDetail}
- >
- {renderIcon()}
- <Flexbox flex={1} gap={4} style={{ minWidth: 0, overflow: 'hidden' }}>
- <span className={styles.title}>{label}</span>
- {localizedDescription && (
- <span className={styles.description}>{localizedDescription}</span>
- )}
- </Flexbox>
- <div onClick={stopPropagation}>{renderAction()}</div>
- </Block>
+ />
);
},
);
diff --git a/src/features/SkillStore/SkillList/LobeHub/index.tsx b/src/features/SkillStore/SkillList/LobeHub/index.tsx
index 59722ca5324..2090cb3ae19 100644
--- a/src/features/SkillStore/SkillList/LobeHub/index.tsx
+++ b/src/features/SkillStore/SkillList/LobeHub/index.tsx
@@ -3,10 +3,12 @@
import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';
import { getConnectorCatalog } from '@lobechat/const';
import type { BuiltinSkillManifest, LobeToolMeta } from '@lobechat/types';
+import { cx } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { SkillListVariantProvider } from '@/features/Settings/skill/features/SkillListRow';
import {
createBuiltinAgentSkillDetailModal,
createBuiltinSkillDetailModal,
@@ -121,8 +123,9 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {
if (filteredItems.length === 0) return <Empty search={hasSearchKeywords} />;
return (
- <>
- <div className={gridStyles.grid}>
+ // Same Codex-style rows as the Connectors page: borderless, icon first, `+` / `⋯` last.
+ <SkillListVariantProvider value={'page'}>
+ <div className={cx(gridStyles.grid, gridStyles.rows)}>
{filteredItems.map((item) => {
if (item.type === 'builtinAgentSkill') {
const localizedTitle = t(`tools.builtins.${item.skill.identifier}.title`, {
@@ -203,7 +206,7 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {
})}
</div>
<WantMoreSkills />
- </>
+ </SkillListVariantProvider>
);
});
diff --git a/src/features/SkillStore/SkillList/style.ts b/src/features/SkillStore/SkillList/style.ts
index ba1b7d800e9..a5219cd37b6 100644
--- a/src/features/SkillStore/SkillList/style.ts
+++ b/src/features/SkillStore/SkillList/style.ts
@@ -13,6 +13,13 @@ export const gridStyles = createStaticStyles(({ css }) => ({
grid-template-columns: 1fr;
}
`,
+ // Borderless page rows (SkillListRow) carry their own padding and hover, so
+ // they sit closer together, spaced like the Connectors page catalog.
+ rows: css`
+ row-gap: 4px;
+ column-gap: 32px;
+ padding-inline: 4px;
+ `,
}));
export const virtuosoGridStyles = createStaticStyles(({ css }) => ({
diff --git a/src/features/SkillStore/SkillStoreContent.tsx b/src/features/SkillStore/SkillStoreContent.tsx
index a4787092eb7..442f48983c2 100644
--- a/src/features/SkillStore/SkillStoreContent.tsx
+++ b/src/features/SkillStore/SkillStoreContent.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Flexbox, Tabs, type TabsItem } from '@lobehub/ui';
+import { Flexbox, Segmented } from '@lobehub/ui';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -30,10 +30,10 @@ export const SkillStoreContent = () => {
const useFetchUninstalledBuiltinTools = useToolStore((s) => s.useFetchUninstalledBuiltinTools);
useFetchUninstalledBuiltinTools(true);
- const options: TabsItem[] = [
- { key: SkillStoreTab.LobeHub, label: t('skillStore.tabs.lobehub') },
- { key: SkillStoreTab.Skills, label: t('skillStore.tabs.skills') },
- { key: SkillStoreTab.MCP, label: t('skillStore.tabs.mcp') },
+ const options = [
+ { label: t('skillStore.tabs.lobehub'), value: SkillStoreTab.LobeHub },
+ { label: t('skillStore.tabs.skills'), value: SkillStoreTab.Skills },
+ { label: t('skillStore.tabs.mcp'), value: SkillStoreTab.MCP },
];
const isLobeHub = activeTab === SkillStoreTab.LobeHub;
@@ -42,25 +42,25 @@ export const SkillStoreContent = () => {
return (
<Flexbox gap={8} style={{ maxHeight: '75vh' }} width={'100%'}>
- <Flexbox gap={8}>
+ {/* Source chips, then search and Add on one row, like the connectors page header. */}
+ <Flexbox gap={12}>
+ <Segmented<SkillStoreTab>
+ aria-label={t('connectorMarket.source')}
+ options={options}
+ style={{ alignSelf: 'flex-start' }}
+ value={activeTab}
+ onChange={setActiveTab}
+ />
<Flexbox horizontal align={'center'} gap={8}>
- <Tabs
- activeKey={activeTab}
- items={options}
- style={{ flex: 1 }}
- styles={{
- list: { display: 'flex', width: '100%' },
- tab: { flex: 1 },
- }}
- onChange={(key) => setActiveTab(key as SkillStoreTab)}
- />
+ <Flexbox flex={1}>
+ <Search
+ activeTab={activeTab}
+ onLobeHubSearch={setLobehubKeywords}
+ onSkillSearch={setSkillKeywords}
+ />
+ </Flexbox>
<AddSkillButton />
</Flexbox>
- <Search
- activeTab={activeTab}
- onLobeHubSearch={setLobehubKeywords}
- onSkillSearch={setSkillKeywords}
- />
</Flexbox>
<Flexbox height={496} style={{ marginBlockEnd: -12, marginInline: -16 }}>
<Flexbox flex={1} style={{ display: isLobeHub ? 'flex' : 'none', overflow: 'auto' }}>