🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(skills): reflect agent availability in the sidebar (#23218)
AmAzing-b7b67889b867
diff --git a/apps/server/src/services/channel/README.md b/apps/server/src/services/channel/README.mdindex 9ca36122627..c4894da7a2b 100644--- a/apps/server/src/services/channel/README.md+++ b/apps/server/src/services/channel/README.md@@ -8,7 +8,7 @@ replies never trigger another classification.## Enable-Configure a TypeSafe API key through the deployment's \`TYPESAFE_API_KEY\` environment variable,+Configure a TypeSafe API key through the deployment's \`TYPESAFE\_API\_KEY\` environment variable,or in the sender's provider settings (workspace provider settings in workspace scope).Routing is enabled by default. Configure its switch and decision model in Settings → Service Models → Advanced → Channels:diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex d7655409002..89b837adf17 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -3947,6 +3947,7 @@"workingPanel.skills.delete.userConfirm": "Uninstall the skill “{{name}}”? This cannot be undone.","workingPanel.skills.detail.title": "Skill details","workingPanel.skills.empty": "No skills available",+ "workingPanel.skills.manualOnly": "Manual only","workingPanel.skills.noSearchResults": "No matching skills","workingPanel.skills.rename.action": "Rename","workingPanel.skills.rename.error": "Failed to rename skill",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 926a6dbd321..f4cf791dda5 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -3947,6 +3947,7 @@"workingPanel.skills.delete.userConfirm": "确定卸载技能「{{name}}」?此操作不可撤销。","workingPanel.skills.detail.title": "技能详情","workingPanel.skills.empty": "暂无可用技能",+ "workingPanel.skills.manualOnly": "仅手动","workingPanel.skills.noSearchResults": "没有匹配的技能","workingPanel.skills.rename.action": "重命名","workingPanel.skills.rename.error": "重命名技能失败",diff --git a/packages/device-control/src/__tests__/workspace.test.ts b/packages/device-control/src/__tests__/workspace.test.tsindex c96ffe15b75..2e02f870008 100644--- a/packages/device-control/src/__tests__/workspace.test.ts+++ b/packages/device-control/src/__tests__/workspace.test.ts@@ -165,6 +165,45 @@ describe('initWorkspace', () => {});describe('listProjectSkills', () => {+ it('preserves manual-only declarations without hiding project or device skills', async () => {+ const repo = path.join(base, 'repo');+ await mkdir(path.join(repo, '.git'), { recursive: true });+ await write(+ path.join(repo, '.agents/skills/deploy/SKILL.md'),+ '---\nname: deploy\ndisable-model-invocation: true\n---\nDeploy instructions',+ );+ await write(+ path.join(home, '.claude/skills/release/SKILL.md'),+ '---\nname: release\ndisable-model-invocation: true\n---\nRelease instructions',+ );+ await write(+ path.join(home, '.codex/skills/review/SKILL.md'),+ '---\nname: review\ndisable-model-invocation: false\n---\nReview instructions',+ );+ await write(+ path.join(repo, '.claude/skills/context/SKILL.md'),+ '---\nname: context\nuser-invocable: false\n---\nBackground knowledge',+ );+ await write(+ path.join(repo, '.agents/skills/string-value/SKILL.md'),+ '---\nname: string-value\ndisable-model-invocation: "false"\n---\nInvalid boolean',+ );++ const result = await listProjectSkills({ scope: repo });++ expect(result.skills.map((skill) => skill.name)).toEqual([+ 'context',+ 'deploy',+ 'release',+ 'review',+ 'string-value',+ ]);+ expect(result.skills.filter((skill) => skill.disableModelInvocation)).toMatchObject([+ { name: 'deploy', scope: 'project' },+ { name: 'release', scope: 'device' },+ ]);+ });+it('approves the source directory of a parent-level skill for preview', async () => {const repo = path.join(base, 'repo');const pkg = path.join(repo, 'pkg');diff --git a/packages/device-control/src/types.ts b/packages/device-control/src/types.tsindex 47b2e9059fa..b827f5aa21b 100644--- a/packages/device-control/src/types.ts+++ b/packages/device-control/src/types.ts@@ -15,6 +15,8 @@ export type ProjectSkillSource = '.agents/skills' | '.claude/skills' | '.codex/sexport interface ProjectSkillItem {description?: string;+ /** SKILL.md declares that the model must not invoke this skill automatically. */+ disableModelInvocation?: boolean;/** Total number of regular files under `skillDir` (recursive, including `SKILL.md`). */fileCount: number;/** Relative paths (within `skillDir`) of all regular files, sorted, capped. */diff --git a/packages/device-control/src/workspace.ts b/packages/device-control/src/workspace.tsindex 469a333c1ec..31b245dd0a9 100644--- a/packages/device-control/src/workspace.ts+++ b/packages/device-control/src/workspace.ts@@ -152,6 +152,7 @@ const listSkillFilesRecursive = async (dir: string): Promise<string[]> => {interface SkillFrontmatterFields {description?: string;+ disableModelInvocation?: boolean;name?: string;}@@ -169,6 +170,7 @@ const parseSkillFrontmatter = (raw: string): SkillFrontmatterFields => {const { data } = matter(raw) as { data: Record<string, unknown> };return {description: readStringField(data, 'description'),+ disableModelInvocation: data['disable-model-invocation'] === true,name: readStringField(data, 'name'),};} catch {@@ -206,6 +208,7 @@ const scanSkillsInSource = async ({const files = await listSkillFilesRecursive(skillDir);return {description: fields.description || undefined,+ disableModelInvocation: fields.disableModelInvocation,fileCount: files.length,files,name: fields.name || entry.name,diff --git a/packages/electron-client-ipc/src/types/localSystem.ts b/packages/electron-client-ipc/src/types/localSystem.tsindex a315c1368e1..0119a263add 100644--- a/packages/electron-client-ipc/src/types/localSystem.ts+++ b/packages/electron-client-ipc/src/types/localSystem.ts@@ -771,6 +771,8 @@ export type ProjectSkillSource = '.agents/skills' | '.claude/skills' | '.codex/sexport interface ProjectSkillItem {description?: string;+ /** SKILL.md declares that the model must not invoke this skill automatically. */+ disableModelInvocation?: boolean;/** Total number of regular files under `skillDir` (recursive, including `SKILL.md`). */fileCount: number;/**diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex fdcedc7b06b..b5ed7016c77 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -4146,6 +4146,7 @@ export default {'Uninstall the skill “{{name}}”? This cannot be undone.','workingPanel.skills.detail.title': 'Skill details','workingPanel.skills.empty': 'No skills available',+ 'workingPanel.skills.manualOnly': 'Manual only','workingPanel.skills.noSearchResults': 'No matching skills','workingPanel.skills.rename.action': 'Rename','workingPanel.skills.rename.error': 'Failed to rename skill',diff --git a/plugins/vite/sharedRendererConfig.test.ts b/plugins/vite/sharedRendererConfig.test.tsindex a1e07353e6e..0eb819c7df2 100644--- a/plugins/vite/sharedRendererConfig.test.ts+++ b/plugins/vite/sharedRendererConfig.test.ts@@ -1,4 +1,11 @@// @vitest-environment node+import { mkdtemp, rm } from 'node:fs/promises';+import path from 'node:path';+import { pathToFileURL } from 'node:url';++import remarkParse from 'remark-parse';+import { unified } from 'unified';+import { optimizeDeps, resolveConfig } from 'vite';import { describe, expect, it } from 'vitest';import {@@ -65,13 +72,50 @@ describe('lobe-dev-editor-provider', () => {});describe('sharedOptimizeDeps', () => {+ it('parses CJK emphasis after pre-bundling alongside the root Markdown serializer', async () => {+ const root = path.resolve(import.meta.dirname, '../..');+ const cacheDir = await mkdtemp(path.join(root, 'node_modules/.vite-markdown-test-'));++ try {+ const config = await resolveConfig(+ {+ cacheDir,+ configFile: false,+ logLevel: 'silent',+ optimizeDeps: {+ ...sharedOptimizeDeps,+ entries: [],+ include: ['remark-cjk-friendly', 'mdast-util-to-markdown'],+ noDiscovery: true,+ },+ root,+ },+ 'serve',+ );+ const { optimized } = await optimizeDeps(config, true);+ const { default: remarkCjkFriendly } = await import(+ /* @vite-ignore */ pathToFileURL(optimized['remark-cjk-friendly'].file).href+ );+ const tree = unified().use(remarkParse).use(remarkCjkFriendly).parse('中文**加粗**测试');++ expect(tree.children[0]).toMatchObject({+ children: [+ { type: 'text', value: '中文' },+ { children: [{ type: 'text', value: '加粗' }], type: 'strong' },+ { type: 'text', value: '测试' },+ ],+ type: 'paragraph',+ });+ } finally {+ await rm(cacheDir, { force: true, recursive: true });+ }+ });+it('pre-bundles the @lobehub/ui root entrypoint', () => {expect(sharedOptimizeDeps.include).toContain('@lobehub/ui');expect(sharedOptimizeDeps.exclude).toEqual(['@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.tsindex e725e769126..eb6777e078a 100644--- a/plugins/vite/sharedRendererConfig.ts+++ b/plugins/vite/sharedRendererConfig.ts@@ -578,12 +578,9 @@ export function sharedRendererDefine(options: { isElectron: boolean; isMobile: b}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.- // 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'],+ // Keep Markdown inside pre-bundling: externalizing it loses the CJK extension's+ // importer path and resolves its required 2.2 handlers to the root's pinned 2.1.+ exclude: [...stylexTokenModules],include: ['react','react-dom',diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.test.ts b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.test.tsindex 5fa8f059f20..d65fa5e0e3f 100644--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.test.ts+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.test.ts@@ -1,6 +1,8 @@-import { renderHook } from '@testing-library/react';+import { act, renderHook } from '@testing-library/react';import { isValidElement } from 'react';-import { describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { useAgentStore } from '@/store/agent';import { useUserSkills } from './UserLevelSkills';@@ -39,7 +41,48 @@ vi.mock('@/features/ChatInput/InputEditor/ActionTag/skillDragData', () => ({// Exercise the sidebar's row data, not a component render. The icon's own// market lookup remains shared with the input menu.-describe('useUserSkills icons', () => {+describe('useUserSkills', () => {+ const initialState = useAgentStore.getState();++ beforeEach(() => {+ act(() =>+ useAgentStore.setState({+ activeAgentId: 'agent-a',+ agentMap: { 'agent-a': { plugins: skills.map((skill) => skill.identifier) } },+ }),+ );+ });++ afterEach(() => {+ act(() => useAgentStore.setState(initialState));+ });++ it('shows only the current agent’s enabled skills and updates when switching agents', () => {+ act(() =>+ useAgentStore.setState({+ agentMap: {+ 'agent-a': {+ plugins: [+ { identifier: skills[0].identifier, mode: 'disabled' },+ { identifier: skills[1].identifier, mode: 'auto' },+ 'unrelated-mcp',+ ],+ },+ 'agent-b': { plugins: [{ identifier: skills[0].identifier, mode: 'pinned' }] },+ },+ }),+ );+ const { result } = renderHook(() => useUserSkills());++ expect(result.current.map((skill) => skill.id)).toEqual([skills[1].identifier]);++ act(() => useAgentStore.setState({ activeAgentId: 'agent-b' }));+ expect(result.current.map((skill) => skill.id)).toEqual([skills[0].identifier]);++ act(() => useAgentStore.setState({ activeAgentId: 'not-loaded' }));+ expect(result.current).toEqual([]);+ });+it('provides a market icon for installed market skills without changing their identity', () => {const { result } = renderHook(() => useUserSkills());diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsxindex 944810342a3..cc0dcd76b6f 100644--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx@@ -1,3 +1,4 @@+import { getLibrarySkillMode } from '@lobechat/types';import { confirmModal, createModal, toast } from '@lobehub/ui';import isEqual from 'fast-deep-equal';import { t as translate } from 'i18next';@@ -17,6 +18,8 @@ import {SkillsList,} from '@/features/SkillsList';import { usePermission } from '@/hooks/usePermission';+import { useAgentStore } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';import { useToolStore } from '@/store/tool';import { agentSkillsSelectors } from '@/store/tool/selectors';@@ -47,9 +50,9 @@ const openSkillDetailModal = (skillId: string) =>/*** Reads user-installed skills (entries in the `agent_skill` table — market- * imports plus user-created customs) into the `SkillsList` row shape. Builtin- * tools and LobeHub MCP servers are intentionally excluded — those belong in- * the Tools popover, not in the per-user skill inventory.+ * imports plus user-created customs) enabled for the current agent into the+ * `SkillsList` row shape. Builtin tools and LobeHub MCP servers are intentionally+ * excluded — those belong in the Tools popover, not in the per-user skill inventory.** Also triggers the underlying SWR fetch so the working sidebar surfaces the* data even when the Tools popover hasn't been opened in this session. The key@@ -58,24 +61,27 @@ const openSkillDetailModal = (skillId: string) =>export const useUserSkills = (enabled = true): SkillListItem[] => {useToolStore((s) => s.useFetchAgentSkills)(enabled);const agentSkills = useToolStore(agentSkillsSelectors.getAgentSkills, isEqual);+ const plugins = useAgentStore((s) => agentSelectors.currentAgentConfig(s)?.plugins);return useMemo(() =>!enabled? EMPTY_ITEMS- : agentSkills.map((skill) => ({- description: skill.description ?? undefined,- icon:- skill.source === 'market' ? (- <MarketSkillIcon identifier={skill.identifier} name={skill.name} />- ) : undefined,- // `identifier` is what the runtime resolves through the skill registry,- // and is unique per skill — reuse it as both the React key and the- // drag payload's `type`.- id: skill.identifier,- name: skill.name,- })),- [agentSkills, enabled],+ : agentSkills+ .filter((skill) => getLibrarySkillMode(plugins, skill.identifier) !== 'disabled')+ .map((skill) => ({+ description: skill.description ?? undefined,+ icon:+ skill.source === 'market' ? (+ <MarketSkillIcon identifier={skill.identifier} name={skill.name} />+ ) : undefined,+ // `identifier` is what the runtime resolves through the skill registry,+ // and is unique per skill — reuse it as both the React key and the+ // drag payload's `type`.+ id: skill.identifier,+ name: skill.name,+ })),+ [agentSkills, enabled, plugins],);};diff --git a/src/features/SkillsList/SkillsList.tsx b/src/features/SkillsList/SkillsList.tsxindex 6ff6a8902c2..3dec7f8c563 100644--- a/src/features/SkillsList/SkillsList.tsx+++ b/src/features/SkillsList/SkillsList.tsx@@ -7,6 +7,7 @@ import {type DropdownItem,Flexbox,Icon,+ Tag,Text,Tooltip,} from '@lobehub/ui';@@ -14,9 +15,12 @@ import { SkillsIcon } from '@lobehub/ui/icons';import { ChevronRightIcon, FileIcon, FolderIcon, type LucideIcon } from 'lucide-react';import type React from 'react';import { memo, useCallback, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';export interface SkillListItem {description?: string;+ /** Manual invocation only, as declared by the skill; not a disabled state. */+ disableModelInvocation?: boolean;/*** File count shown next to the name. Omit (or pass 0) for atomic skills with* no embedded files — e.g. user-level skills sourced from MCP servers.@@ -333,6 +337,7 @@ const SkillRow = memo<SkillRowProps>(onToggle,reserveChevronSlot,}) => {+ const { t } = useTranslation('chat');const files = item.files ?? EMPTY_ARRAY;const hasFiles = files.length > 0;const actions = useMemo(() => getRowActions?.(item) ?? EMPTY_ARRAY, [getRowActions, item]);@@ -421,6 +426,11 @@ const SkillRow = memo<SkillRowProps>() : (nameNode)}+ {item.disableModelInvocation && (+ <Tag size={'small'} style={{ flexShrink: 0 }}>+ {t('workingPanel.skills.manualOnly')}+ </Tag>+ )}{typeof item.fileCount === 'number' && item.fileCount > 0 && (<span className={cx('skill-row-count', styles.itemCount)}>{item.fileCount}</span>)}diff --git a/src/features/SkillsList/useProjectSkills.test.ts b/src/features/SkillsList/useProjectSkills.test.tsindex 10cabc95490..c13d71fe790 100644--- a/src/features/SkillsList/useProjectSkills.test.ts+++ b/src/features/SkillsList/useProjectSkills.test.ts@@ -53,13 +53,13 @@ const skill = (name: string): ProjectSkillItem => ({previewRoot: '/repo',scope: 'project',skillDir: `/repo/.agents/skills/${name}`,- source: 'agents',+ source: '.agents/skills',});const scan = (...names: string[]): ListProjectSkillsResult => ({root: '/repo',skills: names.map(skill),- source: 'agents',+ source: '.agents/skills',});describe('useProjectSkills after a reload', () => {@@ -79,7 +79,11 @@ describe('useProjectSkills after a reload', () => {});it('paints the cached scan before the fresh scan answers, then replaces it', async () => {- listProjectSkills().mockResolvedValue(scan('alpha', 'beta'));+ const initialScan = scan('alpha', 'beta');+ initialScan.skills[0].disableModelInvocation = true;+ initialScan.skills[1].scope = 'device';+ initialScan.skills[1].disableModelInvocation = false;+ listProjectSkills().mockResolvedValue(initialScan);const first = renderHook(() => useProjectSkills('/repo'), { wrapper });await waitFor(() =>expect(first.result.current.items.map((i) => i.name)).toEqual(['alpha', 'beta']),@@ -101,6 +105,12 @@ describe('useProjectSkills after a reload', () => {expect(reloaded.result.current.items.map((i) => i.name)).toEqual(['alpha', 'beta']),);expect(reloaded.result.current.isLoading).toBe(false);+ expect(reloaded.result.current.projectItems).toMatchObject([+ { disableModelInvocation: true, name: 'alpha' },+ ]);+ expect(reloaded.result.current.deviceItems).toMatchObject([+ { disableModelInvocation: false, name: 'beta' },+ ]);await act(async () => release(scan('alpha', 'beta', 'gamma')));await waitFor(() =>diff --git a/src/features/SkillsList/useProjectSkills.ts b/src/features/SkillsList/useProjectSkills.tsindex b7b270719e5..5aabae9a337 100644--- a/src/features/SkillsList/useProjectSkills.ts+++ b/src/features/SkillsList/useProjectSkills.ts@@ -71,6 +71,7 @@ export const useProjectSkills = (() =>(data?.skills ?? []).map((skill) => ({description: skill.description,+ disableModelInvocation: skill.disableModelInvocation,fileCount: skill.fileCount,files: skill.files,id: skill.skillDir,