π€― 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
β¨ feat(marketplace): manage built-ins per agent and simplify marketplace navigation (#23526)
AmAzing-f6c01bfc39de
diff --git a/apps/server/src/services/aiAgent/__tests__/execAgent.pinnedSkillContent.test.ts b/apps/server/src/services/aiAgent/__tests__/execAgent.pinnedSkillContent.test.tsindex 82c9ea560c4..e673b7c9a22 100644--- a/apps/server/src/services/aiAgent/__tests__/execAgent.pinnedSkillContent.test.ts+++ b/apps/server/src/services/aiAgent/__tests__/execAgent.pinnedSkillContent.test.ts@@ -251,6 +251,7 @@ const createAgentConfig = (plugins: AgentPluginEntry[]) => ({describe('AiAgentService.execAgent - pinned skill content injection', () => {let service: AiAgentService;+ const findUserSettings = vi.fn();beforeEach(() => {vi.clearAllMocks();@@ -301,7 +302,11 @@ describe('AiAgentService.execAgent - pinned skill content injection', () => {? [{ ...planSkill, body: 'PLAN BODY', content: 'PLAN BODY + FILES' }]: [],);- service = new AiAgentService({} as any, 'test-user-id');+ findUserSettings.mockResolvedValue({ tool: { uninstalledBuiltinTools: [] } });+ service = new AiAgentService(+ { query: { userSettings: { findFirst: findUserSettings } } } as any,+ 'test-user-id',+ );});it('treats legacy pinned and auto skills as metadata-only', async () => {@@ -373,6 +378,26 @@ describe('AiAgentService.execAgent - pinned skill content injection', () => {},);+ it('keeps legacy opt-ins off when the account settings read fails', async () => {+ findUserSettings.mockRejectedValueOnce(new Error('Settings unavailable'));+ mockGetAgentConfig.mockResolvedValue(createAgentConfig(['lobe-artifacts']));+ await service.execAgent({ agentId: 'agent-1', prompt: 'Hello' });+ expect(skillById('lobe-artifacts')).toBeUndefined();+ });++ it.each([false, true])(+ 'honors a per-agent override (%s) after an account uninstall',+ async (override) => {+ findUserSettings.mockResolvedValue({ tool: { uninstalledBuiltinTools: ['lobe-artifacts'] } });+ const plugin: AgentPluginEntry = override+ ? { builtinOverride: true, identifier: 'lobe-artifacts', mode: 'auto' }+ : { identifier: 'lobe-artifacts', mode: 'auto' };+ mockGetAgentConfig.mockResolvedValue(createAgentConfig([plugin]));+ await service.execAgent({ agentId: 'agent-1', prompt: 'Hello' });+ expect(!!skillById('lobe-artifacts')).toBe(override);+ },+ );+it.each([{ createdAt: '2026-11-17T08:00:00Z', offered: true },{ createdAt: '2026-11-18T15:53:51Z', offered: false },@@ -384,12 +409,7 @@ describe('AiAgentService.execAgent - pinned skill content injection', () => {const settings = {tool: { uninstalledBuiltinTools: scenario.uninstalled ? ['lobe-artifacts'] : [] },};- service = new AiAgentService(- {- query: { userSettings: { findFirst: vi.fn().mockResolvedValue(settings) } },- } as any,- 'test-user-id',- );+ findUserSettings.mockResolvedValue(settings);mockGetAgentConfig.mockResolvedValue({...createAgentConfig(scenario.disabled ? [{ identifier: 'lobe-artifacts', mode: 'disabled' }] : ['docs-mcp'],diff --git a/apps/server/src/services/aiAgent/pipeline/execTurn.ts b/apps/server/src/services/aiAgent/pipeline/execTurn.tsindex 57ed4e44ea4..ec26f1bd643 100644--- a/apps/server/src/services/aiAgent/pipeline/execTurn.ts+++ b/apps/server/src/services/aiAgent/pipeline/execTurn.ts@@ -1,13 +1,9 @@import type { SandboxStorageClaim } from '@lobechat/builtin-tool-cloud-sandbox';-import { isOnDemandBuiltinTool } from '@lobechat/builtin-tools';+import { getLegacyDisabledBuiltinToolIds } from '@lobechat/builtin-tools';import type { LobeChatDatabase } from '@lobechat/database';-import { getImplicitBuiltinSkillIds } from '@lobechat/mecha/builtinSkillGate';+import { getLegacyDisabledBuiltinSkillIds } from '@lobechat/mecha/builtinSkillGate';import type { AgentSenderMetadata, ExecAgentResult, UserInterventionConfig } from '@lobechat/types';-import {- agentShareFileAccessScope,- ordinaryFileAccessScope,- resolveToolMode,-} from '@lobechat/types';+import { agentShareFileAccessScope, ordinaryFileAccessScope } from '@lobechat/types';import { nanoid } from '@lobechat/utils';import debug from 'debug';@@ -268,6 +264,7 @@ export const execAgentTurn = async (agentSlug,assistantAgentId,autoSkillIds,+ builtinOverrides,canManageAgent,conversationAgentId,disabledPluginIds,@@ -633,15 +630,12 @@ export const execAgentTurn = async (await traceSendStage('run_settings', () =>resolveRunSettings({ agentConfig, runFacts, shareGate, workspaceId: deps.workspaceId }),);- if (!shareGate && !exclusivePluginIds && resolveToolMode(agentConfig.chatConfig) === 'agent') {- const implicitSkills = getImplicitBuiltinSkillIds(- agentConfig.createdAt,- agentConfig.chatConfig,+ if (!shareGate && !exclusivePluginIds) {+ disabledPluginIds.push(+ ...getLegacyDisabledBuiltinSkillIds(uninstalledBuiltinIds, builtinOverrides),);disabledPluginIds.push(- ...uninstalledBuiltinIds.filter(- (id) => isOnDemandBuiltinTool(id) || implicitSkills.includes(id),- ),+ ...getLegacyDisabledBuiltinToolIds(uninstalledBuiltinIds, builtinOverrides),);}log(diff --git a/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts b/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.tsindex 88869f19652..b98c1066689 100644--- a/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts+++ b/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts@@ -11,6 +11,7 @@ import type {import {applyTopicModelToHeterogeneousProvider,getAutoPluginIds,+ getBuiltinOverrides,getPinnedPluginIds,resolveAgentAgencyConfig,resolveHeterogeneousModelOverride,@@ -77,6 +78,7 @@ export interface ResolvedRunAgentConfig {assistantAgentId: string;/** Library skills the agent set to `auto`, captured before pinned-id collapse. */autoSkillIds: string[];+ builtinOverrides: string[];canManageAgent: boolean;/** Agent id stamped on the user row (conversation-aware). */conversationAgentId: string;@@ -288,6 +290,7 @@ export const resolveRunAgentConfig = async (// Capture disabled identifiers off the row before the resolved config// collapses plugins to pinned ids: they later filter the auto-discovery// candidate pool so a disabled plugin can't be rediscovered.+ const builtinOverrides = getBuiltinOverrides(row.plugins);const disabledPluginIds = getUserDisabledToolIds(row.plugins, resolved.chatConfig);// Same for the explicit `auto` entries: a library skill is opt-in per agent,// so the skill pool needs the ones this agent opted into without pinning.@@ -381,6 +384,7 @@ export const resolveRunAgentConfig = async (agentSlug: row.slug,assistantAgentId,autoSkillIds,+ builtinOverrides,canManageAgent,conversationAgentId,disabledPluginIds,diff --git a/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.test.tsindex 3d3744e765f..255b8bc9b66 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.test.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.test.ts@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { createLibrarySkillGate, resolveAgentSkillGates } from './librarySkillGate';-const mocks = vi.hoisted(() => ({ getAgentConfigById: vi.fn() }));+const mocks = vi.hoisted(() => ({ getAgentConfigById: vi.fn(), getUserSettings: vi.fn() }));vi.mock('@/database/models/agent', () => ({AgentModel: vi.fn(function () {@@ -10,6 +10,12 @@ vi.mock('@/database/models/agent', () => ({}),}));+vi.mock('@/database/models/user', () => ({+ UserModel: vi.fn(function () {+ return { getUserSettings: mocks.getUserSettings };+ }),+}));+describe('createLibrarySkillGate', () => {it('refuses a library skill the agent never turned on', () => {const isEnabled = createLibrarySkillGate(['lobe-web-browsing'], []);@@ -43,6 +49,7 @@ describe('resolveAgentSkillGates', () => {beforeEach(() => {vi.clearAllMocks();+ mocks.getUserSettings.mockResolvedValue({});mocks.getAgentConfigById.mockResolvedValue({plugins: [{ identifier: 'off', mode: 'disabled' },@@ -77,6 +84,20 @@ describe('resolveAgentSkillGates', () => {expect(isLibrarySkillEnabled).toBeUndefined();});+ it('honors the workspace uninstall until the running agent explicitly opts in again', async () => {+ const id = 'lobe-artifacts';+ mocks.getUserSettings.mockResolvedValue({+ tool: { uninstalledBuiltinToolsByWorkspace: { ws: [id] } },+ });+ mocks.getAgentConfigById.mockResolvedValue({ plugins: [id], workspaceId: 'ws' });+ expect((await resolveAgentSkillGates(context)).disabledSkillIds.has(id)).toBe(true);+ mocks.getAgentConfigById.mockResolvedValue({+ plugins: [{ builtinOverride: true, identifier: id, mode: 'auto' }],+ workspaceId: 'ws',+ });+ expect((await resolveAgentSkillGates(context)).disabledSkillIds.has(id)).toBe(false);+ });+it('applies no gate when the run has no agent', async () => {const gates = await resolveAgentSkillGates({ serverDB: {} as never, userId: 'user-1' });diff --git a/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.ts b/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.tsindex 938b714d096..940e406a828 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/librarySkillGate.ts@@ -1,6 +1,20 @@-import { type AgentPluginEntry, getDisabledPluginIds, getLibrarySkillMode } from '@lobechat/types';+import {+ resolveUninstalledBuiltinTools,+ type UninstalledBuiltinToolsScope,+} from '@lobechat/builtin-tools';+import {+ getLegacyDisabledBuiltinSkillIds,+ legacyBuiltinSkillIds,+} from '@lobechat/mecha/builtinSkillGate';+import {+ type AgentPluginEntry,+ getBuiltinOverrides,+ getDisabledPluginIds,+ getLibrarySkillMode,+} from '@lobechat/types';import { AgentModel } from '@/database/models/agent';+import { UserModel } from '@/database/models/user';import type { ToolExecutionContext } from '../types';@@ -27,6 +41,22 @@ export const createLibrarySkillGate = (getLibrarySkillMode(plugins, identifier) !== 'disabled' || inRunPool.has(identifier);};+/** A failed settings read keeps previously uninstallable skills off unless this agent chose them. */+interface SkillUserSettings {+ market?: { accessToken?: string };+ tool?: UninstalledBuiltinToolsScope;+}++export const readSkillUserSettings = async (+ model: UserModel,+): Promise<SkillUserSettings | null> => {+ try {+ return ((await model.getUserSettings()) ?? {}) as SkillUserSettings;+ } catch {+ return null;+ }+};+/*** The run agent's own skill tri-state, re-derived for a runtime that resolves* skills fresh by name/id.@@ -43,6 +73,7 @@ export const resolveAgentSkillGates = async (ToolExecutionContext,'agentId' | 'agentShareVisitor' | 'runSkillIds' | 'serverDB' | 'userId' | 'workspaceId'>,+ settings?: SkillUserSettings | null,): Promise<{disabledSkillIds: Set<string>;isLibrarySkillEnabled?: (identifier: string) => boolean;@@ -52,11 +83,29 @@ export const resolveAgentSkillGates = async (}const agentModel = new AgentModel(context.serverDB, context.userId, context.workspaceId);- const agentConfig = await agentModel.getAgentConfigById(context.agentId);+ const [agentConfig, userSettings] = await Promise.all([+ agentModel.getAgentConfigById(context.agentId),+ settings === undefined && !context.agentShareVisitor+ ? readSkillUserSettings(new UserModel(context.serverDB, context.userId))+ : settings,+ ]);const plugins = agentConfig?.plugins ?? undefined;+ const legacyUninstalled = userSettings+ ? resolveUninstalledBuiltinTools(+ userSettings.tool,+ context.workspaceId ?? agentConfig?.workspaceId,+ )+ : legacyBuiltinSkillIds;+return {- disabledSkillIds: new Set(getDisabledPluginIds(plugins)),+ disabledSkillIds: new Set([+ ...getDisabledPluginIds(plugins),+ ...getLegacyDisabledBuiltinSkillIds(+ context.agentShareVisitor ? [] : legacyUninstalled,+ getBuiltinOverrides(plugins),+ ),+ ]),isLibrarySkillEnabled: context.agentShareVisitor? undefined: createLibrarySkillGate(plugins, context.runSkillIds),diff --git a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts b/apps/server/src/services/toolExecution/serverRuntimes/skills.tsindex 5ac09b0bce2..e74a09e3db7 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/skills.ts@@ -57,7 +57,7 @@ import {UserSkillService,} from '@/server/services/userSkill';-import { resolveAgentSkillGates } from './librarySkillGate';+import { readSkillUserSettings, resolveAgentSkillGates } from './librarySkillGate';import { pageSandboxWrapper, type SandboxWrapper } from './pageSandboxSync';import { resolveContentWorkspaceId, resolveRunWorkspaceId } from './resolveWorkspaceScope';import { createSandboxMarketService } from './sandboxMarket';@@ -90,12 +90,6 @@ const isPrepareTimeout = (error?: string) =>error.startsWith('DEVICE_RESPONSE_TIMEOUT') ||/aborted due to timeout/i.test(error));-interface UserSettingsWithMarketToken {- market?: {- accessToken?: string;- };-}-/*** Device-execution wiring for the exec APIs, present only when the run's* execution plan routed a device (`plan.kind === 'device'` β the aiAgent sets@@ -897,24 +891,17 @@ export const skillsRuntime: ServerRuntimeRegistration = {}// Fetch market access token from user settings- let marketAccessToken: string | undefined;- try {- const userModel = new UserModel(context.serverDB, context.userId);- const userSettings = await userModel.getUserSettings();- marketAccessToken = (userSettings as UserSettingsWithMarketToken | undefined)?.market- ?.accessToken;- log(- 'Fetched market accessToken for user %s: %s',- context.userId,- marketAccessToken ? 'exists' : 'not found',- );- } catch (error) {- log('Failed to fetch market accessToken for user %s: %O', context.userId, error);- }+ const userSettings = await readSkillUserSettings(+ new UserModel(context.serverDB, context.userId),+ );+ const marketAccessToken = userSettings?.market?.accessToken;// This runtime resolves skills fresh by name/id, so the agent's own// tri-state is enforced here too (see `resolveAgentSkillGates`).- const { disabledSkillIds, isLibrarySkillEnabled } = await resolveAgentSkillGates(context);+ const { disabledSkillIds, isLibrarySkillEnabled } = await resolveAgentSkillGates(+ context,+ userSettings,+ );// The share's own opt-out, for the same reason: the creator named the// skills a visitor may load (`shareConfig.skillGrants`), and thediff --git a/e2e/src/features/community/interactions.feature b/e2e/src/features/community/interactions.featureindex a48037f4577..c4ac31c600d 100644--- a/e2e/src/features/community/interactions.feature+++ b/e2e/src/features/community/interactions.feature@@ -86,27 +86,8 @@ Feature: Discover InteractionsThen I should be navigated to the MCP detail pageAnd I should see the MCP detail content- # ============================================- # Home Page Interactions- # ============================================-@COMMUNITY-INTERACT-010 @P1- Scenario: Navigate from home to assistant list- Given I navigate to "/marketplace"- When I click on the "more" link in the featured assistants section- Then I should be navigated to "/marketplace/agent"- And I should see the page body-- @COMMUNITY-INTERACT-011 @P1- Scenario: Navigate from home to Connectors Discover- Given I navigate to "/marketplace"- When I click on the "more" link in the featured MCP tools section- Then I should be navigated to "/marketplace/connector"- And I should see MCP cards-- @COMMUNITY-INTERACT-012 @P1- Scenario: Click featured assistant from home- Given I navigate to "/marketplace"- When I click on the first featured assistant card- Then I should be navigated to the assistant detail page- And I should see the assistant detail content+ Scenario: Open an old marketplace bookmark with a search+ Given I navigate to "/community?q=developer"+ Then I should see filtered assistant cards+ And I should be navigated to "/marketplace/agent?q=developer"diff --git a/e2e/src/features/community/smoke.feature b/e2e/src/features/community/smoke.featureindex 70a47336f25..7429cf945ef 100644--- a/e2e/src/features/community/smoke.feature+++ b/e2e/src/features/community/smoke.feature@@ -3,12 +3,12 @@ Feature: Community Smoke TestsCritical path tests to ensure the community/discover module is functional@COMMUNITY-SMOKE-001 @P0- Scenario: Load Community Home Page+ Scenario: Open the marketplace at the assistant listGiven I navigate to "/marketplace"Then the page should load without errorsAnd I should see the page body- And I should see the featured assistants section- And I should see the featured MCP tools section+ And I should be navigated to "/marketplace/agent"+ And I should see assistant cards@COMMUNITY-SMOKE-002 @P0Scenario: Load Assistant List Pagediff --git a/e2e/src/steps/community/interactions.steps.ts b/e2e/src/steps/community/interactions.steps.tsindex 1465b96f995..148580822ad 100644--- a/e2e/src/steps/community/interactions.steps.ts+++ b/e2e/src/steps/community/interactions.steps.ts@@ -205,51 +205,6 @@ When('I wait for the sorted results to load', async function (this: CustomWorld)});});-When(- 'I click on the {string} link in the featured assistants section',- async function (this: CustomWorld, linkText: string) {- await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });-- await this.page- .getByRole('heading', { name: /featured agents/i })- .locator('..')- .getByRole('link')- .filter({ hasText: linkText })- .click();- },-);--When(- 'I click on the {string} link in the featured MCP tools section',- async function (this: CustomWorld, linkText: string) {- await this.page- .getByRole('heading', { name: /featured skills/i })- .locator('..')- .getByRole('link')- .filter({ hasText: linkText })- .click();- },-);--When('I click on the first featured assistant card', async function (this: CustomWorld) {- await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });-- const firstCard = this.page.locator('[data-testid="assistant-item"]').first();- await firstCard.waitFor({ state: 'visible', timeout: 30_000 });-- // Store the current URL before clicking- this.testContext.previousUrl = this.page.url();-- await firstCard.click();-- // Wait for URL to change- await this.page.waitForFunction(- (previousUrl) => window.location.href !== previousUrl,- this.testContext.previousUrl,- { timeout: 30_000 },- );-});-// ============================================// Then Steps (Assertions)// ============================================diff --git a/e2e/src/steps/community/smoke.steps.ts b/e2e/src/steps/community/smoke.steps.tsindex e162aff7d4d..7b164e6b723 100644--- a/e2e/src/steps/community/smoke.steps.ts+++ b/e2e/src/steps/community/smoke.steps.ts@@ -7,23 +7,6 @@ import type { CustomWorld } from '../../support/world';// Then Steps (Assertions)// ============================================-// Home Page Steps-Then('I should see the featured assistants section', async function (this: CustomWorld) {- // Look for "Featured Agents" heading text (i18n key: home.featuredAssistants)- // Supports: en-US "Featured Agents", zh-CN "ζ¨θε©η"- const featuredSection = this.page- .getByRole('heading', { name: /featured agents|ζ¨θε©η/i })- .first();- await expect(featuredSection).toBeVisible({ timeout: 30_000 });-});--Then('I should see the featured MCP tools section', async function (this: CustomWorld) {- // Look for "Featured Skills" heading text (i18n key: home.featuredTools)- // Supports: en-US "Featured Skills", zh-CN "ζ¨θζθ½"- const mcpSection = this.page.getByRole('heading', { name: /featured skills|ζ¨θζθ½/i }).first();- await expect(mcpSection).toBeVisible({ timeout: 30_000 });-});-// Assistant List Page StepsThen('I should see the search bar', async function (this: CustomWorld) {// SearchBar component has data-testid="search-bar"diff --git a/packages/builtin-tools/src/index.ts b/packages/builtin-tools/src/index.tsindex d0f62654de8..2259965b9fb 100644--- a/packages/builtin-tools/src/index.ts+++ b/packages/builtin-tools/src/index.ts@@ -650,16 +650,24 @@ export const onDemandBuiltinToolIds = builtinTools.map((tool) => tool.identifier);const onDemandBuiltinIds = new Set(onDemandBuiltinToolIds);+/** An old library uninstall stays in effect until the agent explicitly chooses the tool. */+export const getLegacyDisabledBuiltinToolIds = (+ uninstalled: readonly string[],+ overrides: readonly string[],+) => uninstalled.filter((id) => isOnDemandBuiltinTool(id) && !overrides.includes(id));+/** Agent mode discovers installed builtins by default. Other modes keep their configured toolset. */export const getUnavailableBuiltinToolIds = (available: Iterable<string>,chatConfig?: Pick<LobeAgentChatConfig, 'toolMode' | 'enableAgentMode'> | null,uninstalled: readonly string[] = [],+ overrides: readonly string[] = [],) => {- if (resolveToolMode(chatConfig) === 'agent') return uninstalled.filter(isOnDemandBuiltinTool);+ const legacyDisabled = getLegacyDisabledBuiltinToolIds(uninstalled, overrides);+ if (resolveToolMode(chatConfig) === 'agent') return legacyDisabled;const allowed = new Set(available);- return onDemandBuiltinToolIds.filter((id) => !allowed.has(id));+ return onDemandBuiltinToolIds.filter((id) => !allowed.has(id) || legacyDisabled.includes(id));};export const isOnDemandBuiltinTool = (identifier: string) => onDemandBuiltinIds.has(identifier);diff --git a/packages/mecha/src/toolSet/builtinSkillGate.test.ts b/packages/mecha/src/toolSet/builtinSkillGate.test.tsnew file mode 100644index 00000000000..b4b3efbe7bb--- /dev/null+++ b/packages/mecha/src/toolSet/builtinSkillGate.test.ts@@ -0,0 +1,33 @@+import { AgentPluginEntrySchema, getBuiltinOverrides, setBuiltinPluginMode } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import { getLegacyDisabledBuiltinSkillIds } from './builtinSkillGate';++describe('agent-scoped builtin skill choices', () => {+ const id = 'lobe-artifacts';+ const oldUninstalls = [id, 'some-tool'];++ it('keeps previous installs and implicit defaults off until this agent chooses again', () => {+ for (const plugins of [[], [id], [{ identifier: id, mode: 'auto' as const }]]) {+ expect(getLegacyDisabledBuiltinSkillIds(oldUninstalls, getBuiltinOverrides(plugins))).toEqual(+ [id],+ );+ }+ });++ it('round trips a new choice, independently of other agents and ordinary tools', () => {+ const oldPlugins = ['unrelated', id];+ const next = setBuiltinPluginMode(oldPlugins, id, 'auto').map((item) =>+ AgentPluginEntrySchema.parse(item),+ );+ expect(next[0]).toBe('unrelated');+ expect(getLegacyDisabledBuiltinSkillIds(oldUninstalls, getBuiltinOverrides(next))).toEqual([]);+ expect(+ getLegacyDisabledBuiltinSkillIds(oldUninstalls, getBuiltinOverrides(oldPlugins)),+ ).toEqual([id]);+ expect(setBuiltinPluginMode(next, id, 'disabled')[1]).toMatchObject({+ identifier: id,+ mode: 'disabled',+ });+ });+});diff --git a/packages/mecha/src/toolSet/builtinSkillGate.ts b/packages/mecha/src/toolSet/builtinSkillGate.tsindex e195e1a2692..7520ddc4109 100644--- a/packages/mecha/src/toolSet/builtinSkillGate.ts+++ b/packages/mecha/src/toolSet/builtinSkillGate.ts@@ -14,6 +14,13 @@ export const legacyBuiltinSkillIds: readonly string[] = [LobeHubIdentifier,];+/** Only the bundled skills that used to have a library uninstall action need this fallback. */+export const getLegacyDisabledBuiltinSkillIds = (+ uninstalled: readonly string[],+ overrides: readonly string[],+): string[] =>+ uninstalled.filter((id) => legacyBuiltinSkillIds.includes(id) && !overrides.includes(id));+const noImplicitSkills: readonly string[] = [];export type SkillDiscoveryChatConfig = Pick<diff --git a/packages/types/src/agent/pluginConfig.ts b/packages/types/src/agent/pluginConfig.tsindex a2b2ec6d3bc..bc26048938d 100644--- a/packages/types/src/agent/pluginConfig.ts+++ b/packages/types/src/agent/pluginConfig.ts@@ -14,6 +14,8 @@ import { resolveToolMode } from './executionTargetRules';export type AgentPluginMode = 'pinned' | 'auto' | 'disabled';export interface AgentPluginConfigItem {+ /** An explicit agent choice made after library-wide builtin uninstalls were retired. */+ builtinOverride?: true;identifier: string;/*** @default 'pinned' β absent on legacy string entries and on object@@ -35,7 +37,11 @@ export const AgentPluginModeSchema = z.enum(['pinned', 'auto', 'disabled']);*/export const AgentPluginEntrySchema: z.ZodType<AgentPluginEntry> = z.union([z.string(),- z.object({ identifier: z.string(), mode: AgentPluginModeSchema.optional() }),+ z.object({+ builtinOverride: z.literal(true).optional(),+ identifier: z.string(),+ mode: AgentPluginModeSchema.optional(),+ }),]);/**@@ -199,3 +205,25 @@ export const upsertConnectorEnabled = (enabled? upsertPluginMode(plugins, identifier, CONNECTOR_ON_MODE, 'disabled'): upsertPluginMode(plugins, identifier, 'disabled');++export const getBuiltinOverrides = (plugins?: AgentPluginEntry[] | null): string[] =>+ (plugins ?? []).flatMap((entry) =>+ typeof entry !== 'string' && entry.builtinOverride ? [entry.identifier] : [],+ );++export const setBuiltinPluginMode = (+ plugins: AgentPluginEntry[] | undefined,+ identifier: string,+ mode: AgentPluginMode,+): AgentPluginEntry[] => {+ const choice = {+ builtinOverride: true,+ identifier,+ mode,+ } as const;+ const entries = plugins ?? [];+ const index = entries.findIndex((entry) => parsePluginEntry(entry).identifier === identifier);+ return index === -1+ ? [...entries, choice]+ : entries.map((entry, i) => (i === index ? choice : entry));+};diff --git a/src/components/Skeleton/CommunityHome.tsx b/src/components/Skeleton/CommunityHome.tsxdeleted file mode 100644index d4e975a6f07..00000000000--- a/src/components/Skeleton/CommunityHome.tsx+++ /dev/null@@ -1,38 +0,0 @@-'use client';--import { Flexbox, Skeleton } from '@lobehub/ui';-import { memo } from 'react';--import type { RouteSkeletonProps } from '@/spa/router/routeMeta';--import CommunityListSkeleton, { CommunityPageChrome } from './CommunityList';--const SectionTitle = () => (- <Flexbox- horizontal- align={'center'}- height={41}- justify={'space-between'}- style={{ marginBlockStart: 10 }}- >- <Skeleton height={31} width={160} />- <Skeleton height={32} width={120} />- </Flexbox>-);--const CommunityHomeSkeleton = memo<RouteSkeletonProps>(({ chrome = 'page' }) => (- <CommunityPageChrome chrome={chrome}>- <Flexbox aria-busy gap={16} width={'100%'}>- <Skeleton height={150} style={{ borderRadius: 12 }} />- <SectionTitle />- <CommunityListSkeleton chrome={'body'} length={8} rows={4} />- <div />- <SectionTitle />- <CommunityListSkeleton chrome={'body'} length={8} rows={4} />- </Flexbox>- </CommunityPageChrome>-));--CommunityHomeSkeleton.displayName = 'CommunityHomeSkeleton';--export default CommunityHomeSkeleton;diff --git a/src/components/Skeleton/Settings/tabs/Connector.tsx b/src/components/Skeleton/Settings/tabs/Connector.tsxindex 77f45d27f38..f43cd84cfc3 100644--- a/src/components/Skeleton/Settings/tabs/Connector.tsx+++ b/src/components/Skeleton/Settings/tabs/Connector.tsx@@ -8,11 +8,8 @@ import type { SettingsTabSkeleton } from './types';const Body = () => (<SkillNavListSkeletonfullWidth+ sections={[{ key: 'skillGroup.communityConnectors', rows: 4 }]}titleKey={'skillView.connectors'}- sections={[- { key: 'skillGroup.builtinTools', rows: 5 },- { key: 'skillGroup.communityConnectors', rows: 4 },- ]}/>);diff --git a/src/components/Skeleton/Settings/tabs/Skill.tsx b/src/components/Skeleton/Settings/tabs/Skill.tsxindex e35f68d1437..f5f5b40af58 100644--- a/src/components/Skeleton/Settings/tabs/Skill.tsx+++ b/src/components/Skeleton/Settings/tabs/Skill.tsx@@ -15,8 +15,8 @@ interface NavSection {}const SKILL_SECTIONS: NavSection[] = [- { key: 'skillGroup.builtinSkills', rows: 6 },- { key: 'skillGroup.communitySkills', rows: 4 },+ { key: 'skillGroup.communitySkills', rows: 6 },+ { key: 'skillGroup.customSkills', rows: 4 },];/**diff --git a/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsxindex 5067f6c0132..9e305edf68d 100644--- a/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx+++ b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx@@ -37,7 +37,7 @@ export const SkillCatalogListSkeleton = ({ viewMode }: SkillCatalogProps) => {const { controlHeight } = useDensityTokens();const skills = viewMode === 'skill';const sections = skills- ? (['skillGroup.builtinSkills', 'skillGroup.communitySkills'] as const)+ ? (['skillGroup.communitySkills', 'skillGroup.customSkills'] as const): (['connectorMarket.section.installed', 'skillGroup.communityConnectors'] as const);return (diff --git a/src/components/Skeleton/index.ts b/src/components/Skeleton/index.tsindex 62f8d05053a..5e47d4bf9b9 100644--- a/src/components/Skeleton/index.ts+++ b/src/components/Skeleton/index.ts@@ -1,7 +1,6 @@export { default as AppsSkeleton } from './Apps';export { default as ArticleSkeleton } from './Article';export { default as SkeletonBar } from './Bar';-export { default as CommunityHomeSkeleton } from './CommunityHome';export { default as CommunityListSkeleton, type CommunityListSkeletonProps } from './CommunityList';export { default as ConversationLayoutSkeleton } from './Conversation/Layout';export { default as ConversationListSkeleton } from './Conversation/List';diff --git a/src/features/ChatInput/ActionBar/Tools/useActivationSets.ts b/src/features/ChatInput/ActionBar/Tools/useActivationSets.tsindex 9b83ff065e0..782bd0fa068 100644--- a/src/features/ChatInput/ActionBar/Tools/useActivationSets.ts+++ b/src/features/ChatInput/ActionBar/Tools/useActivationSets.ts@@ -1,5 +1,5 @@-import { onDemandBuiltinToolIds } from '@lobechat/builtin-tools';-import { type AgentPluginEntry, type AgentPluginMode } from '@lobechat/types';+import { getLegacyDisabledBuiltinToolIds, onDemandBuiltinToolIds } from '@lobechat/builtin-tools';+import { type AgentPluginEntry, type AgentPluginMode, getBuiltinOverrides } from '@lobechat/types';import isEqual from 'fast-deep-equal';import { useMemo } from 'react';@@ -29,9 +29,11 @@ export const resolveActivationSets = ({librarySkillIds,discoverBuiltins = true,pinnedIds,+ uninstalled = [],rawPlugins,}: {discoverBuiltins?: boolean;+ uninstalled?: readonly string[];connectedConnectorIds: readonly string[];connectorIds: readonly string[];librarySkillIds: readonly string[];@@ -52,6 +54,7 @@ export const resolveActivationSets = ({),connectorIds,disabledIdSet: new Set([+ ...getLegacyDisabledBuiltinToolIds(uninstalled, getBuiltinOverrides(rawPlugins)),...connectorIdList.filter((id) => !connected.has(id)),...resolveDisabledIds(rawPlugins,@@ -77,6 +80,7 @@ export const useActivationSets = (connectedConnectorIds: getConnectedConnectorIds(state, agentId, connectorIds),};}, isEqual);+ const uninstalled = useToolStore((s) => s.uninstalledBuiltinTools);const marketAgentSkills = useToolStore(agentSkillsSelectors.getMarketAgentSkills, isEqual);const userAgentSkills = useToolStore(agentSkillsSelectors.getUserAgentSkills, isEqual);@@ -90,6 +94,7 @@ export const useActivationSets = ((skill) => skill.identifier,),pinnedIds,+ uninstalled,rawPlugins,}),[@@ -99,6 +104,7 @@ export const useActivationSets = (marketAgentSkills,userAgentSkills,pinnedIds,+ uninstalled,rawPlugins,],);diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.test.ts b/src/features/ChatInput/ActionBar/Tools/useControls.test.tsindex 6d6fa1847df..7ce8674603d 100644--- a/src/features/ChatInput/ActionBar/Tools/useControls.test.ts+++ b/src/features/ChatInput/ActionBar/Tools/useControls.test.ts@@ -1,3 +1,5 @@+import { getUnavailableBuiltinToolIds } from '@lobechat/builtin-tools';+import { getBuiltinOverrides } from '@lobechat/types';import type { ItemType } from '@lobehub/ui';import { act, cleanup, fireEvent, render, renderHook, screen } from '@testing-library/react';import { createElement, Fragment } from 'react';@@ -32,7 +34,8 @@ const mocks = vi.hoisted(() => ({lobehubEnabled: false,lobehubSkillServers: [] as LobehubSkillServer[],chatMode: false,- plugins: [] as { identifier: string; mode: string }[],+ uninstalled: [] as string[],+ plugins: [] as { builtinOverride?: true; identifier: string; mode: string }[],skills: [{ id: 'market-row', identifier: 'excel-analysis', name: 'Excel Analysis', source: 'market' },{ id: 'user-row', identifier: 'custom-writing', name: 'Custom Writing', source: 'user' },@@ -91,6 +94,7 @@ vi.mock('@/store/tool', () => ({composioServers: mocks.composioServers,connectors: mocks.connectors,isConnectorsInit: true,+ uninstalledBuiltinTools: mocks.uninstalled,lobehubSkillServers: mocks.lobehubSkillServers,useFetchAgentSkills: vi.fn(),useFetchLobehubSkillConnections: vi.fn(),@@ -108,12 +112,12 @@ vi.mock('@/store/tool/selectors', () => ({installedBuiltinSkills: () => mocks.builtinSkills,// The real metadata inventory mixes tools and skill manifests.metaList: () => [- { identifier: 'builtin-tool', meta: { title: 'Builtin Tool' } },+ { identifier: 'lobe-calculator', meta: { title: 'Builtin Tool' } },...mocks.builtinSkills,...mocks.skills,],metaListIncludingHidden: () => [- { identifier: 'builtin-tool', meta: { title: 'Builtin Tool' } },+ { identifier: 'lobe-calculator', meta: { title: 'Builtin Tool' } },...mocks.builtinSkills,...mocks.skills,],@@ -139,7 +143,7 @@ const leafKeys = (items: ItemType[]): string[] =>return [String(item.key)];});-const toolIds = ['builtin-tool', 'community-mcp', 'custom-mcp'];+const toolIds = ['lobe-calculator', 'community-mcp', 'custom-mcp'];const libraryIds = ['excel-analysis','custom-writing',@@ -159,6 +163,7 @@ describe('chat input tool picker', () => {mocks.lobehubEnabled = false;mocks.lobehubSkillServers = [];mocks.plugins = [];+ mocks.uninstalled = [];mocks.chatMode = false;});@@ -166,7 +171,7 @@ describe('chat input tool picker', () => {it.each([{ id: 'gmail', pin: false },- { id: 'builtin-tool', pin: false },+ { id: 'lobe-calculator', pin: false },])('offers the applicable activation actions on the $id row', async ({ id, pin }) => {mocks.composioEnabled = true;mocks.composioServers = [{ identifier: 'gmail', status: ComposioServerStatus.ACTIVE }];@@ -193,6 +198,34 @@ describe('chat input tool picker', () => {expect(leafKeys(result.current.marketItems)).not.toContain('lobe-skills');});+ it('keeps an uninstalled calculator selectable and re-enables it for just the edited agent', async () => {+ const id = 'lobe-calculator';+ const previous = [{ identifier: id, mode: 'auto' as const }];+ mocks.plugins = previous;+ mocks.uninstalled = [id];+ const { result, rerender } = renderHook(() => useControls());+ const option = () => result.current.toolOptions.find((row) => row.id === id);+ expect(option()?.enabled).toBe(false);++ await act(() => result.current.setPolicy(id, 'auto'));+ const { plugins } = mocks.updateConfig.mock.lastCall![0];+ mocks.plugins = plugins;+ rerender();+ expect(option()?.enabled).toBe(true);+ for (const toolMode of ['agent', 'chat'] as const) {+ expect(+ getUnavailableBuiltinToolIds([id], { toolMode }, [id], getBuiltinOverrides(plugins)),+ ).not.toContain(id);+ expect(+ getUnavailableBuiltinToolIds([id], { toolMode }, [id], getBuiltinOverrides(previous)),+ ).toContain(id);+ }+ await act(() => result.current.setPolicy(id, 'disabled'));+ mocks.plugins = mocks.updateConfig.mock.lastCall![0].plugins;+ rerender();+ expect(option()?.enabled).toBe(false);+ });+it.each(['lobe-image-generation', 'lobe-video-generation'])('re-enables %s as a pin in either mode, so a later switch to Chat keeps it callable',async (id) => {@@ -203,13 +236,13 @@ describe('chat input tool picker', () => {mocks.chatMode = false;await act(() => result.current.setPolicy(id, 'auto'));expect(mocks.updateConfig).toHaveBeenLastCalledWith({- plugins: [{ identifier: id, mode: 'pinned' }],+ plugins: [{ builtinOverride: true, identifier: id, mode: 'pinned' }],});mocks.chatMode = true;await act(() => result.current.setPolicy(id, 'auto'));expect(mocks.updateConfig).toHaveBeenLastCalledWith({- plugins: [{ identifier: id, mode: 'pinned' }],+ plugins: [{ builtinOverride: true, identifier: id, mode: 'pinned' }],});},);@@ -253,8 +286,8 @@ describe('chat input tool picker', () => {for (const identifier of ['google-drive', 'notion', 'twitter'])expect(keys).not.toContain(identifier);- act(() => result.current.marketHeader.props.onSearchChange('builtin-tool'));- expect(leafKeys(result.current.marketItems)).toEqual(['builtin-tool']);+ act(() => result.current.marketHeader.props.onSearchChange('lobe-calculator'));+ expect(leafKeys(result.current.marketItems)).toEqual(['lobe-calculator']);act(() => result.current.marketHeader.props.onSearchChange(''));expect(leafKeys(result.current.marketItems)).toContain('slack');act(() => result.current.marketHeader.props.onSearchChange('Google Drive'));diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.tsx b/src/features/ChatInput/ActionBar/Tools/useControls.tsxindex e41e4addf20..58d6ee14b66 100644--- a/src/features/ChatInput/ActionBar/Tools/useControls.tsx+++ b/src/features/ChatInput/ActionBar/Tools/useControls.tsx@@ -2,8 +2,14 @@ import { ImageGenerationIdentifier } from '@lobechat/builtin-tool-image-generatiimport { MemoryManifest } from '@lobechat/builtin-tool-memory';import { VideoGenerationIdentifier } from '@lobechat/builtin-tool-video-generation';import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';+import { isOnDemandBuiltinTool } from '@lobechat/builtin-tools';import { getConnectorCatalog } from '@lobechat/const';-import { parsePluginEntry, resolveToolMode, upsertPluginMode } from '@lobechat/types';+import {+ parsePluginEntry,+ resolveToolMode,+ setBuiltinPluginMode,+ upsertPluginMode,+} from '@lobechat/types';import type { ItemType } from '@lobehub/ui';import { Avatar, confirmModal, Icon, Popover, Tag, Tooltip } from '@lobehub/ui';import { McpIcon, SkillsIcon } from '@lobehub/ui/icons';@@ -145,9 +151,8 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =const { allowed: canEdit } = usePermission('edit_own_content');const list = useToolStore(pluginSelectors.installedPluginMetaList, isEqual);const uninstallPluginRow = usePluginRowUninstall();- const [removeComposioConnection, uninstallBuiltinTool, deleteConnector] = useToolStore((s) => [+ const [removeComposioConnection, deleteConnector] = useToolStore((s) => [s.removeComposioConnection,- s.uninstallBuiltinTool,s.deleteConnector,]);const checked = useAgentStore(agentByIdSelectors.getAgentPluginsById(agentId), isEqual);@@ -210,12 +215,16 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =const pinMediaTool =mode === 'auto' && (id === ImageGenerationIdentifier || id === VideoGenerationIdentifier);await updateAgentConfig({- plugins: upsertPluginMode(- plugins,- id,- pinMediaTool ? 'pinned' : mode,- mode === 'auto' && !discoverBuiltins ? 'disabled' : resolveImplicitMode(id, optInIds),- ),+ plugins: isOnDemandBuiltinTool(id)+ ? setBuiltinPluginMode(plugins, id, pinMediaTool ? 'pinned' : mode)+ : upsertPluginMode(+ plugins,+ id,+ pinMediaTool ? 'pinned' : mode,+ mode === 'auto' && !discoverBuiltins+ ? 'disabled'+ : resolveImplicitMode(id, optInIds),+ ),});}},@@ -790,10 +799,6 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =return createManagedSkillItem({badge: <Icon icon={Wrench} size={12} />,- deleteConfig: {- displayName: title,- onDelete: () => uninstallBuiltinTool(item.identifier),- },extraTag: officialTag,icon,id: item.identifier,@@ -802,7 +807,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =title,});}),- [filteredBuiltinList, t, createManagedSkillItem, uninstallBuiltinTool],+ [filteredBuiltinList, t, createManagedSkillItem],);// Search and memory expose their own settings alongside the on/off choice.diff --git a/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx b/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsxindex 14c94a68c0f..0a9b67acfde 100644--- a/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx+++ b/src/features/Connectors/ConnectorDetail/ConnectorOverviewInfo.tsx@@ -7,8 +7,6 @@ import { memo } from 'react';import { useTranslation } from 'react-i18next';import { ConnectorSourceType, ConnectorStatus } from '@/database/schemas';-import { useToolStore } from '@/store/tool';-import { builtinToolSelectors } from '@/store/tool/selectors';import type { ConnectorWithTools } from '@/store/tool/slices/connector/types';import { densityTokens } from '@/styles/density.stylex';@@ -68,18 +66,12 @@ const ConnectorOverviewInfo = memo<ConnectorOverviewInfoProps>(({ connector }) =const kind = getConnectorKind(connector);const isBuiltin = kind === 'builtin';- // Uninstalling a built-in only records it in a user preference; the connector- // row stays, so read the same installation state the list shows.- const isBuiltinInstalled = useToolStore(- builtinToolSelectors.isBuiltinToolInstalled(connector.identifier),- );- const status = isBuiltin- ? isBuiltinInstalled- ? { color: 'success' as const, label: t('connector.enabled') }- : { label: t('tools.builtins.uninstalled', { ns: 'setting' }) }- : // Disconnect only clears `isEnabled` and leaves the stored status (connected- // or error) behind, so a disabled connector reads not connected first.- !connector.isEnabled+ // Bundled tools have no library authorization or installation status.+ if (isBuiltin) return null;++ const status = // Disconnect only clears `isEnabled` and leaves the stored status (connected+ // or error) behind, so a disabled connector reads not connected first.+ !connector.isEnabled? { label: t('connector.notConnected') }: connector.status === ConnectorStatus.connected? { color: 'success' as const, label: t('connector.connected') }@@ -90,12 +82,8 @@ 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 &&- !(isBuiltin && !isBuiltinInstalled);+ !!connector.authorizedByName && connector.authKind !== 'oauth2' && !connector.links?.length;return (<div {...stylex.props(styles.list)}>diff --git a/src/features/Connectors/ConnectorDetail/index.test.tsx b/src/features/Connectors/ConnectorDetail/index.test.tsxindex ff3bb4be9cc..d83b4f7baba 100644--- a/src/features/Connectors/ConnectorDetail/index.test.tsx+++ b/src/features/Connectors/ConnectorDetail/index.test.tsx@@ -300,77 +300,26 @@ describe('ConnectorDetail', () => {expect(screen.queryByText('connector.authError')).not.toBeInTheDocument();});- it('shows an uninstalled built-in tool as uninstalled, matching the list', () => {- mocks.toolState.connectors[0] = {- 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.getByText('tools.builtins.uninstalled')).toBeInTheDocument();- expect(screen.queryByText('connector.enabled')).not.toBeInTheDocument();-- unmount();- mocks.toolState.uninstalledBuiltinTools = [];- render(<ConnectorDetail connectorId="connector-1" />);-- 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.each([true, false])(+ 'omits library install actions for a bundled tool (previously installed: %s)',+ (installed) => {+ mocks.toolState.connectors[0] = {+ authorizedByName: 'Avery',+ id: 'connector-1',+ identifier: 'lobe-calculator',+ name: 'Calculator',+ sourceType: ConnectorSourceType.builtin,+ };+ mocks.toolState.uninstalledBuiltinTools = installed ? [] : ['lobe-calculator'];+ render(<ConnectorDetail connectorId="connector-1" />);+ expect(screen.queryByRole('button', { name: 'Uninstall' })).not.toBeInTheDocument();+ expect(+ screen.queryByRole('button', { name: 'connectorMarket.action.install' }),+ ).not.toBeInTheDocument();+ expect(screen.queryByText('connector.overview.status')).not.toBeInTheDocument();+ expect(screen.queryByText('connector.overview.authorizedBy')).not.toBeInTheDocument();+ },+ );it('shows accounts only for an OAuth connector, each naming its own authorizer', () => {mocks.toolState.connectors[0] = {diff --git a/src/features/Connectors/ConnectorDetail/index.tsx b/src/features/Connectors/ConnectorDetail/index.tsxindex 68a6df7b3a4..91de8d4181d 100644--- a/src/features/Connectors/ConnectorDetail/index.tsx+++ b/src/features/Connectors/ConnectorDetail/index.tsx@@ -6,7 +6,7 @@ import {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, Plus, RefreshCwIcon, Trash2 } from 'lucide-react';+import { PencilIcon, RefreshCwIcon, Trash2 } from 'lucide-react';import type { ReactNode } from 'react';import { memo, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -16,7 +16,6 @@ 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 { densityTokens } from '@/styles/density.stylex';import { type ConnectorActionError, toConnectorActionError } from '@/utils/connectorActionError';@@ -111,9 +110,6 @@ const ConnectorDetail = memo<ConnectorDetailProps>(const disconnectConnector = useToolStore((s) => s.disconnectConnector);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);@@ -124,13 +120,6 @@ 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;@@ -232,7 +221,7 @@ const ConnectorDetail = memo<ConnectorDetailProps>(]);const handleUninstall = () => {- if (!connector) return;+ if (!connector || !isMarketplace) return;confirmModal({// The modal's built-in label is not localized.cancelText: t('cancel', { ns: 'common' }),@@ -241,11 +230,7 @@ const ConnectorDetail = memo<ConnectorDetailProps>(onOk: async () => {setRemoveError(undefined);try {- if (isBuiltin) {- await uninstallBuiltinTool(connector.identifier);- } else if (isMarketplace) {- await uninstallMCPPlugin(connector.identifier);- }+ await uninstallMCPPlugin(connector.identifier);await deleteConnector(connectorId);// The Composio list does not watch these writes; without this the// uninstalled row keeps showing as connected until a reload.@@ -384,28 +369,7 @@ const ConnectorDetail = memo<ConnectorDetailProps>(</ManageTooltip></>)}- {/* Uninstall for builtin and marketplace tools */}- {/* 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) && (+ {isMarketplace && (<ManageTooltip title={credentialsTooltip}><Buttondangerdiff --git a/src/features/Marketplace/Catalog/ConnectorCatalog.tsx b/src/features/Marketplace/Catalog/ConnectorCatalog.tsxindex a75e43be4b0..03263698e61 100644--- a/src/features/Marketplace/Catalog/ConnectorCatalog.tsx+++ b/src/features/Marketplace/Catalog/ConnectorCatalog.tsx@@ -29,6 +29,7 @@ import { buildInstalledDetailPath, getInstalledVisibility } from '../InstalledNaimport { MARKETPLACE_CONNECTOR_PATH, MARKETPLACE_MCP_PATH } from '../paths';import CatalogListView from './CatalogListView';import CatalogSection, { useSeenOnce } from './CatalogSection';+import DiscoverCatalogHeader from './DiscoverCatalogHeader';import RowAction from './RowAction';import {buildCatalogListUrl,@@ -268,6 +269,7 @@ const ConnectorCatalog = memo(() => {return (<>+ <DiscoverCatalogHeader kind={'connector'} query={query.q} /><CatalogViewTabs active={'discover'} kind={'connector'} />{isCatalogListView(query) ? <McpCatalogList /> : <McpCatalogGroups />}</>diff --git a/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsxnew file mode 100644index 00000000000..84134e70086--- /dev/null+++ b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx@@ -0,0 +1,86 @@+'use client';++import { memo, useState } from 'react';++import CatalogPageHeader from '@/features/Settings/skill/features/CatalogPageHeader';+import { createMarketSkillStoreModal, createSkillStoreModal } from '@/features/SkillStore';+import { useQueryRoute } from '@/hooks/useQueryRoute';+import { revalidateReplica } from '@/libs/replica';+import { mcpCategoriesResource, mcpListResource } from '@/store/discover/slices/mcp/projection';+import {+ skillCategoriesResource,+ skillListResource,+} from '@/store/discover/slices/skill/projection';+import { getToolStoreState } from '@/store/tool';+import { composioServersResource } from '@/store/tool/slices/composioStore/projection';+import { lobehubSkillServersResource } from '@/store/tool/slices/lobehubSkillStore/projection';+import { isMobileSurface } from '@/utils/mobileSurface';++import { CATALOG_VIEW_PATHS, type CatalogKind } from '../CatalogViewTabs';++interface DiscoverCatalogHeaderProps {+ kind: CatalogKind;+ query?: string;+}++const DiscoverCatalogHeader = memo<DiscoverCatalogHeaderProps>(({ kind, query = '' }) => {+ const router = useQueryRoute();+ const [keyword, setKeyword] = useState(query);+ const [lastQuery, setLastQuery] = useState(query);+ const [refreshing, setRefreshing] = useState(false);+ // Browser history and the catalog's Back action can both change the submitted search.+ if (query !== lastQuery) {+ setLastQuery(query);+ setKeyword(query);+ }++ const search = (value: string) => {+ const q = value.trim();+ router.push(CATALOG_VIEW_PATHS[kind].discover, { query: q ? { q } : {}, replace: true });+ };++ const refresh = async () => {+ if (refreshing) return;+ setRefreshing(true);+ try {+ const tools = getToolStoreState();+ await Promise.allSettled(+ kind === 'skill'+ ? [+ revalidateReplica(skillCategoriesResource),+ revalidateReplica(skillListResource),+ tools.refreshAgentSkills(),+ ]+ : [+ revalidateReplica(mcpCategoriesResource),+ revalidateReplica(mcpListResource),+ revalidateReplica(lobehubSkillServersResource),+ revalidateReplica(composioServersResource),+ tools.fetchConnectors(),+ tools.refreshPlugins(),+ ],+ );+ } finally {+ setRefreshing(false);+ }+ };++ return (+ <CatalogPageHeader+ compact={isMobileSurface()}+ keyword={keyword}+ refreshing={refreshing}+ viewMode={kind}+ onBrowseStore={kind === 'skill' ? createMarketSkillStoreModal : createSkillStoreModal}+ onRefresh={refresh}+ onSearch={search}+ onKeywordChange={(value) => {+ setKeyword(value);+ if (!value && query) search('');+ }}+ />+ );+});++DiscoverCatalogHeader.displayName = 'DiscoverCatalogHeader';+export default DiscoverCatalogHeader;diff --git a/src/features/Marketplace/Catalog/SkillCatalog.tsx b/src/features/Marketplace/Catalog/SkillCatalog.tsxindex bf400b02832..03a7b7ffcf5 100644--- a/src/features/Marketplace/Catalog/SkillCatalog.tsx+++ b/src/features/Marketplace/Catalog/SkillCatalog.tsx@@ -27,6 +27,7 @@ import CatalogViewTabs from '../CatalogViewTabs';import { MARKETPLACE_SKILL_PATH } from '../paths';import CatalogListView from './CatalogListView';import CatalogSection, { useSeenOnce } from './CatalogSection';+import DiscoverCatalogHeader from './DiscoverCatalogHeader';import RowAction from './RowAction';import {buildCatalogListUrl,@@ -228,7 +229,7 @@ const SkillCatalog = memo(() => {return (<>- {/* Desktop and mobile both mount this page, so the Discover / Installed switch lives here. */}+ <DiscoverCatalogHeader kind={'skill'} query={query.q} /><CatalogViewTabs active={'discover'} kind={'skill'} />{isCatalogListView(query) ? <SkillCatalogList /> : <SkillCatalogGroups />}</>diff --git a/src/features/Marketplace/marketplaceCopy.test.ts b/src/features/Marketplace/marketplaceCopy.test.tsindex 33c4effe016..230a022593b 100644--- a/src/features/Marketplace/marketplaceCopy.test.ts+++ b/src/features/Marketplace/marketplaceCopy.test.ts@@ -1,15 +1,15 @@import { readdirSync, readFileSync } from 'node:fs';-import { resolve } from 'node:path';+import path from 'node:path';import { describe, expect, it } from 'vitest';import { NAVIGATION_ROUTES } from '@/config/routes';-const LOCALES_DIR = resolve(__dirname, '../../../locales');+const LOCALES_DIR = path.resolve(__dirname, '../../../locales');const locales = readdirSync(LOCALES_DIR);const readNs = (locale: string, ns: string): Record<string, string> =>- JSON.parse(readFileSync(resolve(LOCALES_DIR, locale, `${ns}.json`), 'utf8'));+ JSON.parse(readFileSync(path.resolve(LOCALES_DIR, locale, `${ns}.json`), 'utf8'));/** Keys that name the Marketplace page or entry (formerly "Community"). */const PAGE_NAME_KEYS: Record<string, string[]> = {@@ -73,14 +73,7 @@ describe('Marketplace page copy', () => {it('translates every Marketplace sidebar entry in zh-CN', () => {const zh = readNs('zh-CN', 'discover');- const navKeys = [- 'tab.home',- 'tab.assistant',- 'tab.skill',- 'tab.connector',- 'tab.model',- 'tab.provider',- ];+ const navKeys = ['tab.assistant', 'tab.skill', 'tab.connector', 'tab.model', 'tab.provider'];for (const key of navKeys) expect(zh[key], `zh-CN/discover:${key}`).toMatch(/\p{Script=Han}/u);expect(zh['tab.skill']).toBe(readNs('zh-CN', 'setting')['tab.skill']);});diff --git a/src/features/Marketplace/paths.test.ts b/src/features/Marketplace/paths.test.tsindex f2f5a49a806..98ed5e46fde 100644--- a/src/features/Marketplace/paths.test.ts+++ b/src/features/Marketplace/paths.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { getManageLibraryPath, getMarketplaceSubPath } from './paths';+import { getManageLibraryPath, getMarketplaceSubPath, hasCatalogPageHeader } from './paths';describe('getMarketplaceSubPath', () => {it.each([@@ -28,3 +28,17 @@ describe('getManageLibraryPath', () => {expect(getManageLibraryPath()).toBe('/marketplace/connector/installed');});});++describe('hasCatalogPageHeader', () => {+ it.each([+ ['/marketplace/skill', true],+ ['/workspace/marketplace/connector/', true],+ ['/marketplace', false],+ ['/marketplace/agent', false],+ ['/marketplace/skill/installed', false],+ ['/marketplace/skill/example', false],+ ['/marketplace/mcp/example', false],+ ])('selects the page toolbar for %s: %s', (path, expected) => {+ expect(hasCatalogPageHeader(path)).toBe(expected);+ });+});diff --git a/src/features/Marketplace/paths.ts b/src/features/Marketplace/paths.tsindex 22289883057..120de5ec87c 100644--- a/src/features/Marketplace/paths.ts+++ b/src/features/Marketplace/paths.ts@@ -12,6 +12,8 @@ export const LEGACY_COMMUNITY_SEGMENT = 'community';export const MARKETPLACE_PATH = `/${MARKETPLACE_SEGMENT}`;+export const MARKETPLACE_AGENT_PATH = `${MARKETPLACE_PATH}/agent`;+/** Skills discovery (the public catalog). */export const MARKETPLACE_SKILL_PATH = `${MARKETPLACE_PATH}/skill`;@@ -30,6 +32,9 @@ export const MARKETPLACE_INSTALLED_CONNECTORS_PATH = `${MARKETPLACE_CONNECTOR_PA/** MCP server detail pages keep their own path under the merged Connectors entry. */export const MARKETPLACE_MCP_PATH = `${MARKETPLACE_PATH}/mcp`;+export const getMarketplaceEntryPath = (showMarket: boolean | undefined): string =>+ showMarket ? MARKETPLACE_AGENT_PATH : MARKETPLACE_INSTALLED_SKILLS_PATH;+/** Remaining marketplace path after the (optionally workspace-prefixed) marketplace root. */export const getMarketplaceSubPath = (pathname: string): string | undefined => {const segments = pathname.split('/').filter(Boolean);@@ -43,6 +48,12 @@ export const getMarketplaceSubPath = (pathname: string): string | undefined => {return segments.slice(index + 1).join('/');};+// These two catalog pages render their own search and actions in the content header.+export const hasCatalogPageHeader = (pathname: string): boolean => {+ const section = getMarketplaceSubPath(pathname);+ return section === 'skill' || section === 'connector';+};+/*** Where an agent's "Manage library" opens: the installed skills for the skills* group, the installed connectors otherwise.diff --git a/src/features/ProfileEditor/AgentTool.tsx b/src/features/ProfileEditor/AgentTool.tsxindex 900acbfe37e..ab85dc15097 100644--- a/src/features/ProfileEditor/AgentTool.tsx+++ b/src/features/ProfileEditor/AgentTool.tsx@@ -1,13 +1,22 @@'use client';-import { isOnDemandBuiltinTool, onDemandBuiltinToolIds } from '@lobechat/builtin-tools';+import {+ getLegacyDisabledBuiltinToolIds,+ isOnDemandBuiltinTool,+ onDemandBuiltinToolIds,+} from '@lobechat/builtin-tools';import { getConnectorCatalog } from '@lobechat/const';-import { getImplicitBuiltinSkillIds } from '@lobechat/mecha/builtinSkillGate';import {+ getImplicitBuiltinSkillIds,+ legacyBuiltinSkillIds,+} from '@lobechat/mecha/builtinSkillGate';+import {+ getBuiltinOverrides,getDisabledPluginIds,getOptedInPluginIds,parsePluginEntry,resolveToolMode,+ setBuiltinPluginMode,upsertConnectorEnabled,upsertPluginMode,} from '@lobechat/types';@@ -49,6 +58,10 @@ import {pluginSelectors,} from '@/store/tool/selectors';import { agentSkillListResource } from '@/store/tool/slices/agentSkills/projection';+import {+ legacyDisabledBuiltinSkillsForRun,+ runtimeUninstalledBuiltinTools,+} from '@/store/tool/slices/builtin/projection';import type { LobeToolMetaWithAvailability } from '@/store/tool/slices/builtin/selectors';import { connectorSelectors } from '@/store/tool/slices/connector';@@ -171,6 +184,16 @@ const AgentTool = memo<AgentToolProps>(builtinToolSelectors.installedBuiltinSkills,isEqual,);+ const legacyDisabledBuiltins = useToolStore(+ (state) => [+ ...legacyDisabledBuiltinSkillsForRun(state, config?.plugins),+ ...getLegacyDisabledBuiltinToolIds(+ runtimeUninstalledBuiltinTools(state),+ getBuiltinOverrides(config?.plugins),+ ),+ ],+ isEqual,+ );const createdAt = useAgentStore((s) => s.agentMap[effectiveAgentId]?.createdAt);const implicitSkills = getImplicitBuiltinSkillIds(createdAt, config?.chatConfig);const implicitToolIds = useMemo(@@ -192,11 +215,15 @@ const AgentTool = memo<AgentToolProps>(implicitSkills,],);+ const disabledToolIds = useMemo(+ () => new Set([...getDisabledPluginIds(config?.plugins), ...legacyDisabledBuiltins]),+ [config?.plugins, legacyDisabledBuiltins],+ );const enabledIds = useMemo(() => {const ids = new Set([...implicitToolIds, ...getOptedInPluginIds(config?.plugins)]);- for (const id of getDisabledPluginIds(config?.plugins)) ids.delete(id);+ for (const id of disabledToolIds) ids.delete(id);return ids;- }, [implicitToolIds, config?.plugins]);+ }, [implicitToolIds, config?.plugins, disabledToolIds]);const nonProfileConfigurableBuiltinToolIds = useToolStore(builtinToolSelectors.nonProfileConfigurableBuiltinToolIds({@@ -303,12 +330,13 @@ const AgentTool = memo<AgentToolProps>(await updateAgentConfigById(effectiveAgentId, {plugins:isOnDemandBuiltinTool(pluginId) ||- connectorIds.has(pluginId) ||- implicitSkills.includes(pluginId)- ? upsertConnectorEnabled(config?.plugins, pluginId, shouldEnable)- : shouldEnable && allSkillIdentifiers.has(pluginId)- ? upsertConnectorEnabled(config?.plugins, pluginId, true)- : upsertPluginMode(config?.plugins, pluginId, shouldEnable ? 'pinned' : 'auto'),+ installedBuiltinSkills.some((skill) => skill.identifier === pluginId)+ ? setBuiltinPluginMode(config?.plugins, pluginId, shouldEnable ? 'auto' : 'disabled')+ : connectorIds.has(pluginId) || implicitSkills.includes(pluginId)+ ? upsertConnectorEnabled(config?.plugins, pluginId, shouldEnable)+ : shouldEnable && allSkillIdentifiers.has(pluginId)+ ? upsertConnectorEnabled(config?.plugins, pluginId, true)+ : upsertPluginMode(config?.plugins, pluginId, shouldEnable ? 'pinned' : 'auto'),});},[@@ -317,6 +345,7 @@ const AgentTool = memo<AgentToolProps>(enabledIds,connectorIds,implicitSkills,+ installedBuiltinSkills,allSkillIdentifiers,config?.plugins,updateAgentConfigById,@@ -479,7 +508,11 @@ const AgentTool = memo<AgentToolProps>(if (!canEdit) return;const identifier = typeof pluginId === 'string' ? pluginId : pluginId?.identifier;- if (connectorIds.has(identifier) && !implicitToolIds.includes(identifier)) {+ if (+ (connectorIds.has(identifier) ||+ installedBuiltinSkills.some((s) => s.identifier === identifier)) &&+ !implicitToolIds.includes(identifier)+ ) {await updateAgentConfigById(effectiveAgentId, {plugins: upsertPluginMode(config?.plugins, identifier, 'auto'),});@@ -845,7 +878,8 @@ const AgentTool = memo<AgentToolProps>(// ββββββββββββββββββββββββββββββββββββββββββββββ// Build the set of all valid identifiers known to the systemconst validIdentifiers = useMemo(() => {- const all = new Set(onDemandBuiltinToolIds);+ // A desktop-only skill is still a valid saved preference when editing on the web.+ const all = new Set([...onDemandBuiltinToolIds, ...legacyBuiltinSkillIds]);// 1. Builtin tools (includes Composio metas)for (const tool of knownBuiltinList) all.add(tool.identifier);@@ -947,25 +981,16 @@ const AgentTool = memo<AgentToolProps>(kind,allSkillIdentifiers,]);- const disabledToolIds = useMemo(- () =>- new Set(- (config?.plugins ?? [])- .map((entry) => parsePluginEntry(entry))- .filter((entry) => entry.mode === 'disabled')- .map((entry) => entry.identifier),- ),- [config?.plugins],- );const setPluginEnabled = (pluginId: string, enabled: boolean) => {if (!canEdit || !effectiveAgentId) return;return updateAgentConfigById(effectiveAgentId, {plugins:- allSkillIdentifiers.has(pluginId) ||- connectorIds.has(pluginId) ||- isOnDemandBuiltinTool(pluginId)- ? upsertConnectorEnabled(config?.plugins, pluginId, enabled)- : upsertPluginMode(config?.plugins, pluginId, enabled ? 'pinned' : 'disabled'),+ isOnDemandBuiltinTool(pluginId) ||+ installedBuiltinSkills.some((skill) => skill.identifier === pluginId)+ ? setBuiltinPluginMode(config?.plugins, pluginId, enabled ? 'auto' : 'disabled')+ : allSkillIdentifiers.has(pluginId) || connectorIds.has(pluginId)+ ? upsertConnectorEnabled(config?.plugins, pluginId, enabled)+ : upsertPluginMode(config?.plugins, pluginId, enabled ? 'pinned' : 'disabled'),});};diff --git a/src/features/Settings/skill/features/AgentSkillItem.tsx b/src/features/Settings/skill/features/AgentSkillItem.tsxindex 497a6f96ea3..101b03106c0 100644--- a/src/features/Settings/skill/features/AgentSkillItem.tsx+++ b/src/features/Settings/skill/features/AgentSkillItem.tsx@@ -1,12 +1,10 @@'use client';-import { type BuiltinSkillManifest, type SkillListItem } from '@lobechat/types';+import { type SkillListItem } from '@lobechat/types';import {- Avatar,Button,confirmModal,createModal,- cssVar,DropdownMenu,Flexbox,Icon,@@ -14,35 +12,29 @@ 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, Trash2 } from 'lucide-react';import { lazy, memo, Suspense, useState } from 'react';import { useTranslation } from 'react-i18next';import MarketSkillIcon from '@/components/MarketSkillIcon';import { GitHubSkillUpdate, hasGitHubSource } from '@/features/AgentSkillDetail/GitHubSkillUpdate';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 { RowMoreMenu } from './RowActions';import SkillListRow, { useSkillListVariant } from './SkillListRow';import { styles } from './style';const AgentSkillDetail = lazy(() => import('@/features/AgentSkillDetail'));-const isBuiltinSkill = (- skill: BuiltinSkillManifest | SkillListItem,-): skill is BuiltinSkillManifest => !('id' in skill);-interface AgentSkillItemProps {isSelected?: boolean;onSelect?: () => void;- skill: BuiltinSkillManifest | SkillListItem;+ skill: SkillListItem;}const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect }) => {@@ -50,27 +42,15 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelectconst { t: tc } = useTranslation('common');const { t: tp } = useTranslation('plugin');const [loading, setLoading] = useState(false);- const { allowed: canCreate } = usePermission('create_content');const { allowed: canEdit } = usePermission('edit_own_content');- const isBuiltin = isBuiltinSkill(skill);const isPage = useSkillListVariant() === 'page';- const canManage = useResourceManageable(isBuiltin ? undefined : skill.userId);+ const canManage = useResourceManageable(skill.userId);const deleteAgentSkill = useToolStore((s) => s.deleteAgentSkill);- const [installBuiltinTool, uninstallBuiltinTool, isBuiltinInstalled] = useToolStore((s) => [- s.installBuiltinTool,- s.uninstallBuiltinTool,- isBuiltin ? builtinToolSelectors.isBuiltinToolInstalled(skill.identifier)(s) : true,- ]);-- const title = isBuiltin- ? t(`tools.builtins.${skill.identifier}.title`, { defaultValue: skill.name })- : skill.name;+ const title = skill.name;const renderIcon = (size: number, marketSize = size) => {- if (isBuiltin && skill.avatar) return <Avatar avatar={skill.avatar} size={size} />;-const fallback = <Icon icon={SkillsIcon} size={size} />;if (skill.source !== 'market') return fallback;@@ -87,7 +67,7 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect// ===== Handlers =====const handleDownload = async () => {- if (isBuiltin || !skill.zipFileHash) return;+ if (!skill.zipFileHash) return;setLoading(true);try {const result = await agentSkillService.getZipUrl(skill.id);@@ -104,15 +84,11 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelectconfirmModal({okButtonProps: { danger: true },onOk: async () => {- if (isBuiltin) {- await uninstallBuiltinTool(skill.identifier);- } else {- setLoading(true);- try {- await deleteAgentSkill(skill.id);- } finally {- setLoading(false);- }+ setLoading(true);+ try {+ await deleteAgentSkill(skill.id);+ } finally {+ setLoading(false);}},content: tp('store.actions.confirmUninstall'),@@ -123,56 +99,9 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect// ===== Status & Actions =====- const updateAction =- !isBuiltin && hasGitHubSource(skill) ? <GitHubSkillUpdate compact skill={skill} /> : null;-- const renderStatus = () => {- if (!isBuiltin) return null;- if (isBuiltinInstalled) {- return <span {...stylex.props(styles.connected)}>{t('tools.builtins.installed')}</span>;- }- return <span {...stylex.props(styles.disconnected)}>{t('tools.builtins.uninstalled')}</span>;- };+ const updateAction = hasGitHubSource(skill) ? <GitHubSkillUpdate compact skill={skill} /> : null;const renderActions = () => {- if (isBuiltin) {- if (isBuiltinInstalled) {- return (- <DropdownMenu- placement="bottomRight"- items={[- {- danger: true,- disabled: !canEdit,- icon: <Icon icon={Trash2} />,- key: 'uninstall',- label: tp('store.actions.uninstall'),- onClick: handleUninstall,- },- ]}- >- <Button- aria-label={t('connectorMarket.action.manage')}- disabled={!canEdit}- icon={<Icon icon={MoreHorizontalIcon} />}- />- </DropdownMenu>- );- }- return (- <Button- disabled={!canCreate}- icon={<Icon icon={Plus} />}- onClick={() => {- if (!canCreate) return;- installBuiltinTool(skill.identifier);- }}- >- {tp('store.actions.install')}- </Button>- );- }-return (<DropdownMenuplacement="bottomRight"@@ -211,81 +140,52 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect// ===== Detail Modal =====const handleOpenDetail = () => {- if (isBuiltin) {- createBuiltinAgentSkillDetailModal({ identifier: skill.identifier });- } else {- createModal({- content: (- <Suspense fallback={<div style={{ height: '100%' }} />}>- <AgentSkillDetail skillId={skill.id} />- </Suspense>- ),- footer: null,- styles: { content: { height: 'calc(100dvh - 200px)', overflow: 'hidden', padding: 0 } },- title: tp('dev.title.skillDetails'),- width: 960,- });- }+ createModal({+ content: (+ <Suspense fallback={<div style={{ height: '100%' }} />}>+ <AgentSkillDetail skillId={skill.id} />+ </Suspense>+ ),+ footer: null,+ styles: { content: { height: 'calc(100dvh - 200px)', overflow: 'hidden', padding: 0 } },+ title: tp('dev.title.skillDetails'),+ width: 960,+ });};- const showDisconnected = isBuiltin && !isBuiltinInstalled;-if (isPage) {return (<SkillListRowactive={isSelected}description={updateAction}icon={() => renderIcon(20, 40)}+ summary={skill.description}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 && 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}- />- )- }- summary={- isBuiltin- ? t(`tools.builtins.${skill.identifier}.description`, {- defaultValue: skill.description,- })- : skill.description+ <RowMoreMenu+ items={[+ ...(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}+ />}onClick={onSelect ?? handleOpenDetail}/>@@ -299,7 +199,6 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelectextra={updateAction}icon={() => renderIcon(18)}title={title}- titleColor={showDisconnected ? cssVar.colorTextDescription : undefined}onClick={onSelect}/>);@@ -326,18 +225,12 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelectstyle={{ cursor: onSelect ? undefined : 'pointer' }}onClick={onSelect ? undefined : handleOpenDetail}>- <div {...stylex.props(styles.icon, showDisconnected && styles.disconnectedIcon)}>- {renderIcon(16)}- </div>- <span {...stylex.props(styles.title, showDisconnected && styles.disconnectedTitle)}>- {title}- </span>+ <div {...stylex.props(styles.icon)}>{renderIcon(16)}</div>+ <span {...stylex.props(styles.title)}>{title}</span></Flexbox>- {showDisconnected && renderStatus()}</Flexbox>{!onSelect && (<Flexbox horizontal align="center" gap={8} onClick={stopPropagation}>- {isBuiltin && isBuiltinInstalled && renderStatus()}{updateAction}{renderActions()}</Flexbox>diff --git a/src/features/Settings/skill/features/BuiltinSkillItem.tsx b/src/features/Settings/skill/features/BuiltinSkillItem.tsxdeleted file mode 100644index 0ed094d912b..00000000000--- a/src/features/Settings/skill/features/BuiltinSkillItem.tsx+++ /dev/null@@ -1,200 +0,0 @@-'use client';--import {- Avatar,- Button,- confirmModal,- cssVar,- DropdownMenu,- Flexbox,- Icon,- stopPropagation,-} from '@lobehub/ui';-import * as stylex from '@stylexjs/stylex';-import { MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { createBuiltinSkillDetailModal } from '@/features/SkillStore/SkillDetail';-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';--interface BuiltinSkillItemProps {- avatar?: string;- description?: string;- identifier: string;- isSelected?: boolean;- onSelect?: () => void;- title: string;-}--const BuiltinSkillItem = memo<BuiltinSkillItemProps>(- ({ identifier, title, avatar, description, isSelected, onSelect }) => {- const { t } = useTranslation(['setting', 'plugin', 'common']);- const isPage = useSkillListVariant() === 'page';- const { allowed: canCreate } = usePermission('create_content');- const { allowed: canEdit } = usePermission('edit_own_content');-- const [installBuiltinTool, uninstallBuiltinTool, isInstalled] = useToolStore((s) => [- s.installBuiltinTool,- s.uninstallBuiltinTool,- builtinToolSelectors.isBuiltinToolInstalled(identifier)(s),- ]);-- const handleInstall = async () => {- if (!canCreate) return;- await installBuiltinTool(identifier);- };-- const handleUninstall = () => {- if (!canEdit) return;-- confirmModal({- cancelText: t('cancel', { ns: 'common' }),- content: t('store.actions.confirmUninstall', { ns: 'plugin' }),- okButtonProps: { danger: true },- okText: t('store.actions.uninstall', { ns: 'plugin' }),- onOk: async () => {- await uninstallBuiltinTool(identifier);- },- title: t('store.actions.uninstall', { ns: 'plugin' }),- });- };-- const renderStatus = () => {- if (isInstalled) {- return (- <span {...stylex.props(styles.connected)}>- {t('tools.builtins.installed', { ns: 'setting' })}- </span>- );- }- return (- <span {...stylex.props(styles.disconnected)}>- {t('tools.builtins.uninstalled', { ns: 'setting' })}- </span>- );- };-- const renderActions = () => {- 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,- },- ]}- >- <Button- aria-label={t('connectorMarket.action.manage')}- disabled={!canEdit}- icon={MoreHorizontalIcon}- />- </DropdownMenu>- );- }-- return (- <Button disabled={!canCreate} icon={Plus} onClick={handleInstall}>- {t('store.actions.install', { ns: 'plugin' })}- </Button>- );- };-- // 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 ? renderPageExtra() : undefined}- icon={() => <Avatar avatar={avatar} size={isPage ? 20 : 18} />}- title={title}- titleColor={!isInstalled ? cssVar.colorTextDescription : undefined}- summary={t(`tools.builtins.${identifier}.description`, {- defaultValue: description ?? '',- ns: 'setting',- })}- onClick={onSelect}- />- );- }-- return (- <Flexbox- horizontal- align="center"- className={stylex.props(styles.container).className}- gap={8}- justify="space-between"- style={{- ...(isSelected ? { background: 'var(--lobe-color-primary-bg)', borderRadius: 6 } : {}),- ...(onSelect ? { cursor: 'pointer' } : {}),- }}- onClick={onSelect}- >- <Flexbox horizontal align="center" gap={8} style={{ flex: 1, overflow: 'hidden' }}>- <Flexbox- horizontal- align="center"- gap={8}- style={{ cursor: onSelect ? undefined : 'pointer' }}- onClick={onSelect ? undefined : () => createBuiltinSkillDetailModal({ identifier })}- >- <div {...stylex.props(styles.icon, !isInstalled && styles.disconnectedIcon)}>- <Avatar avatar={avatar} size={16} />- </div>- <span {...stylex.props(styles.title, !isInstalled && styles.disconnectedTitle)}>- {title}- </span>- </Flexbox>- {!isInstalled && renderStatus()}- </Flexbox>- {!onSelect && (- <Flexbox horizontal align="center" gap={8} onClick={stopPropagation}>- {isInstalled && renderStatus()}- {renderActions()}- </Flexbox>- )}- </Flexbox>- );- },-);--BuiltinSkillItem.displayName = 'BuiltinSkillItem';--export default BuiltinSkillItem;diff --git a/src/features/Settings/skill/features/CatalogPageHeader.tsx b/src/features/Settings/skill/features/CatalogPageHeader.tsxnew file mode 100644index 00000000000..572305baefd--- /dev/null+++ b/src/features/Settings/skill/features/CatalogPageHeader.tsx@@ -0,0 +1,229 @@+'use client';++import type { ConnectorVisibility } from '@lobechat/types';+import { ActionIcon, Button, DropdownMenu, Flexbox, Icon, SearchBar, Text } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { ChevronDown, Grid2x2Plus, Import, Plus, RotateCw, Store } from 'lucide-react';+import { memo, type ReactNode, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { CustomConnectorModal } from '@/features/Connectors';+import { openSkillImportModal } from '@/features/SkillStore/SkillImportModal';+import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';+import { usePermission } from '@/hooks/usePermission';+import { densityTokens } from '@/styles/density.stylex';++import { getPageSearchPlacement } from './pageHeaderLayout';+import type { SkillViewMode } from './SkillList';++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,+ },+ },+ // The Codex Plugins header: the title shares its row with search, the page+ // controls and the primary Add (last); one line of what the page does sits+ // 8px under both, so a long description never pushes the toolbar down.+ pageHeader: {+ display: 'flex',+ flexDirection: 'column',+ flexShrink: 0,+ gap: densityTokens['--lobe-density-gap'],+ paddingBlockStart: '32px',+ paddingBlockEnd: '8px',+ paddingInline: densityTokens['--lobe-density-content-gap'],+ },+ // Mobile: the shell's top bar sits right above, so the title needs less air.+ pageHeaderCompact: { paddingBlockStart: '16px' },+ pageHeadRow: {+ display: 'flex',+ flexWrap: 'wrap',+ gap: densityTokens['--lobe-density-section-gap'],+ alignItems: 'center',+ justifyContent: 'space-between',+ },+ // No radius token reaches a pill; the Codex search field and Add button are pills.+ pageSearch: { width: '240px' },+ // Mobile: a 240px field beside refresh and Add is ~390px of toolbar that+ // cannot wrap, wider than a 375px screen; the field takes its own row.+ pageSearchCompact: { width: '100%' },+ // SearchBar draws its border on the inner input box, so the pill goes there.+ pageSearchInput: { borderRadius: '999px' },+ pageTitle: {+ marginBlock: 0,+ fontSize: cssVar.fontSizeHeading3,+ fontWeight: 600,+ lineHeight: 1.3,+ color: cssVar.colorText,+ },+});++interface CatalogPageHeaderProps {+ compact?: boolean;+ keyword: string;+ onBrowseStore: () => void;+ onKeywordChange: (value: string) => void;+ onRefresh: () => void;+ onSearch?: (value: string) => void;+ refreshing: boolean;+ toolbarExtra?: ReactNode;+ viewMode: SkillViewMode;+ visibility?: ConnectorVisibility;+}++const CatalogPageHeader = memo<CatalogPageHeaderProps>(+ ({+ compact,+ keyword,+ onBrowseStore,+ onKeywordChange,+ onRefresh,+ onSearch,+ refreshing,+ toolbarExtra,+ viewMode,+ visibility,+ }) => {+ const { t } = useTranslation('setting');+ const [showAddConnector, setShowAddConnector] = useState(false);+ const { allowed: canCreate } = usePermission('create_content');+ const { canManage, isPending } = useConnectorManageable();+ const isConnectorView = viewMode === 'connector';+ const isPrivateTab = visibility === 'private';+ const canAddConnector = isPrivateTab || canManage;+ const isPolicyPending = !isPrivateTab && isPending;+ const description = t(+ !isConnectorView+ ? 'skillView.skillsDesc'+ : isPrivateTab+ ? 'skillView.privateConnectorsDesc'+ : visibility+ ? 'skillView.workspaceConnectorsDesc'+ : 'skillView.connectorsDesc',+ );+ 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),+ },+ ]+ : []),+ // A store install joins the shared pool, so the private tab omits it+ ...(isPrivateTab+ ? []+ : [+ {+ desc: t(+ isConnectorView+ ? 'connectorMarket.add.browseStoreDesc'+ : 'skillView.browseStoreDesc',+ ),+ icon: <Icon icon={Store} />,+ key: 'store',+ label: t('connectorMarket.add.browseStore'),+ onClick: onBrowseStore,+ },+ ]),+ ...(!isConnectorView+ ? [+ {+ desc: t('agentSkillModal.sources'),+ disabled: !canCreate,+ icon: <Icon icon={Import} />,+ key: 'import',+ label: t('agentSkillModal.title'),+ onClick: openSkillImportModal,+ },+ ]+ : []),+ ];+ const searchPlaceholder = t(+ isConnectorView ? 'connectorMarket.search.placeholder' : 'skillView.search.placeholder',+ );++ const searchBelowTitle = getPageSearchPlacement(compact) === 'below-title';+ const search = (+ <SearchBar+ allowClear+ aria-label={searchPlaceholder}+ classNames={{ input: stylex.props(styles.pageSearchInput).className }}+ placeholder={searchPlaceholder}+ value={keyword}+ variant={'outlined'}+ className={+ stylex.props(searchBelowTitle ? styles.pageSearchCompact : styles.pageSearch).className+ }+ onInputChange={onKeywordChange}+ onSearch={onSearch}+ />+ );++ return (+ <>+ <div {...stylex.props(styles.pageHeader, compact && styles.pageHeaderCompact)}>+ <div {...stylex.props(styles.pageHeadRow)}>+ <h1 {...stylex.props(styles.pageTitle)}>+ {t(isConnectorView ? 'skillView.connectors' : 'skillView.skills')}+ </h1>+ <Flexbox horizontal align={'center'} flex={'none'} gap={12}>+ {!searchBelowTitle && search}+ {/* The member policy governs the shared pool only */}+ {toolbarExtra}+ <ActionIcon+ aria-label={t('connectorMarket.refresh')}+ icon={RotateCw}+ loading={refreshing}+ title={t('connectorMarket.refresh')}+ onClick={onRefresh}+ />+ <DropdownMenu items={addItems} placement={'bottomRight'}>+ <Button+ className={stylex.props(styles.addTrigger).className}+ icon={Plus}+ shape={'round'}+ type={'primary'}+ >+ {t('connectorMarket.add')}+ <Icon icon={ChevronDown} size={14} />+ </Button>+ </DropdownMenu>+ </Flexbox>+ </div>+ {searchBelowTitle && search}+ <Text type={'secondary'}>{description}</Text>+ </div>+ {showAddConnector && (+ <CustomConnectorModal+ open+ visibility={visibility}+ onClose={() => setShowAddConnector(false)}+ />+ )}+ </>+ );+ },+);++CatalogPageHeader.displayName = 'CatalogPageHeader';+export default CatalogPageHeader;diff --git a/src/features/Settings/skill/features/LeftPanel.tsx b/src/features/Settings/skill/features/LeftPanel.tsxindex 533ce68aedf..ac8b004e408 100644--- a/src/features/Settings/skill/features/LeftPanel.tsx+++ b/src/features/Settings/skill/features/LeftPanel.tsx@@ -1,29 +1,10 @@'use client';import type { ConnectorVisibility } from '@lobechat/types';-import {- ActionIcon,- Button,- DropdownMenu,- Flexbox,- Icon,- SearchBar,- Tabs,- Text,- Tooltip,-} from '@lobehub/ui';+import { Button, Icon, Tabs, Text, Tooltip } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import {- ChevronDown,- Grid2x2Plus,- Import,- LockIcon,- Plus,- RotateCw,- Store,- UsersIcon,-} from 'lucide-react';+import { Grid2x2Plus, Import, LockIcon, Store, UsersIcon } from 'lucide-react';import { memo, type ReactNode, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -40,71 +21,21 @@ import { useInterfaceDensity } from '@/styles/density';import { densityTokens, sidebarRow } from '@/styles/density.stylex';import { densityVars } from '@/styles/densityVars';+import CatalogPageHeader from './CatalogPageHeader';import ConnectorManagePolicy from './ConnectorManagePolicy';-import { getPageSearchPlacement } from './pageHeaderLayout';import { type ToolDetailType } from './SkillDetail';import SkillList, { type SkillListHeaderContext, 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' },columnTabs: { paddingInline: '8px' },pageBody: { paddingBlockStart: '0', paddingBlockEnd: '24px', paddingInline: '0' },- // The Codex Plugins header: the title shares its row with search, the page- // controls and the primary Add (last); one line of what the page does sits- // 8px under both, so a long description never pushes the toolbar down.- pageHeader: {- display: 'flex',- flexDirection: 'column',- flexShrink: 0,- gap: densityTokens['--lobe-density-gap'],- paddingBlockStart: '32px',- paddingBlockEnd: '8px',- paddingInline: densityTokens['--lobe-density-content-gap'],- },- // Mobile: the shell's top bar sits right above, so the title needs less air.- pageHeaderCompact: { paddingBlockStart: '16px' },- pageHeadRow: {- display: 'flex',- flexWrap: 'wrap',- gap: densityTokens['--lobe-density-section-gap'],- alignItems: 'center',- justifyContent: 'space-between',- },- // No radius token reaches a pill; the Codex search field and Add button are pills.- pageSearch: { width: '240px' },- // Mobile: a 240px field beside refresh and Add is ~390px of toolbar that- // cannot wrap, wider than a 375px screen; the field takes its own row.- pageSearchCompact: { width: '100%' },- // SearchBar draws its border on the inner input box, so the pill goes there.- pageSearchInput: { borderRadius: '999px' },// 8px under the header + 12px: the Codex 20px from description to view tabs.pageTabs: {paddingBlockStart: densityTokens['--lobe-density-content-gap'],paddingInline: densityTokens['--lobe-density-content-gap'],},- pageTitle: {- marginBlock: 0,- fontSize: cssVar.fontSizeHeading3,- fontWeight: 600,- lineHeight: 1.3,- color: cssVar.colorText,- },header: {display: 'flex',flexShrink: 0,@@ -178,7 +109,7 @@ const LeftPanel = memo<LeftPanelProps>(// The page now lives in the Marketplace beside the skill catalog, so// browsing more skills switches to the Discover tab instead of stacking// the same catalog in a modal. Connectors keep their store modal: it also- // lists the OAuth and builtin connectors the Marketplace MCP list lacks.+ // offers the connector installation flows.const handleBrowseStore = isConnectorView? createSkillStoreModal: () => navigate(MARKETPLACE_SKILL_PATH);@@ -212,117 +143,26 @@ const LeftPanel = memo<LeftPanelProps>(onChange={(key) => onVisibilityChange?.(key as ConnectorVisibility)}/>);- const connectorsDesc = isPrivateTab- ? t('skillView.privateConnectorsDesc')- : visibility- ? t('skillView.workspaceConnectorsDesc')- : t('skillView.connectorsDesc');const addConnectorTitle = t('connector.add.title', {defaultValue: 'Add Custom Connector',ns: 'tool',});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),- },- ]- : []),- // A store install joins the shared pool, so the private tab omits it- ...(isPrivateTab- ? []- : [- {- desc: t(- isConnectorView- ? 'connectorMarket.add.browseStoreDesc'- : 'skillView.browseStoreDesc',- ),- icon: <Icon icon={Store} />,- key: 'store',- label: t('connectorMarket.add.browseStore'),- onClick: handleBrowseStore,- },- ]),- ...(!isConnectorView- ? [- {- desc: t('agentSkillModal.sources'),- disabled: !canCreate,- icon: <Icon icon={Import} />,- key: 'import',- label: t('agentSkillModal.title'),- onClick: openSkillImportModal,- },- ]- : []),- ];- const searchPlaceholder = t(- isConnectorView ? 'connectorMarket.search.placeholder' : 'skillView.search.placeholder',- );-- const searchBelowTitle = getPageSearchPlacement(compact) === 'below-title';- const search = (- <SearchBar- allowClear- aria-label={searchPlaceholder}- classNames={{ input: stylex.props(styles.pageSearchInput).className }}- placeholder={searchPlaceholder}- value={keyword}- variant={'outlined'}- className={- stylex.props(searchBelowTitle ? styles.pageSearchCompact : styles.pageSearch).className- }- onInputChange={setKeyword}- />- );-const renderHeader = ({ onRefresh, refreshing }: SkillListHeaderContext) => (<>- <div {...stylex.props(styles.pageHeader, compact && styles.pageHeaderCompact)}>- <div {...stylex.props(styles.pageHeadRow)}>- <h1 {...stylex.props(styles.pageTitle)}>- {t(isConnectorView ? 'skillView.connectors' : 'skillView.skills')}- </h1>- <Flexbox horizontal align={'center'} flex={'none'} gap={12}>- {!searchBelowTitle && search}- {/* The member policy governs the shared pool only */}- {isConnectorView && !isPrivateTab && <ConnectorManagePolicy variant={'toolbar'} />}- <ActionIcon- aria-label={t('connectorMarket.refresh')}- icon={RotateCw}- loading={refreshing}- title={t('connectorMarket.refresh')}- onClick={onRefresh}- />- <DropdownMenu items={addItems} placement={'bottomRight'}>- <Button- className={stylex.props(styles.addTrigger).className}- icon={Plus}- shape={'round'}- type={'primary'}- >- {t('connectorMarket.add')}- <Icon icon={ChevronDown} size={14} />- </Button>- </DropdownMenu>- </Flexbox>- </div>- {searchBelowTitle && search}- <Text type={'secondary'}>- {isConnectorView ? connectorsDesc : t('skillView.skillsDesc')}- </Text>- </div>+ <CatalogPageHeader+ compact={compact}+ keyword={keyword}+ refreshing={refreshing}+ viewMode={viewMode}+ visibility={visibility}+ toolbarExtra={+ isConnectorView && !isPrivateTab && <ConnectorManagePolicy variant={'toolbar'} />+ }+ onBrowseStore={handleBrowseStore}+ onKeywordChange={setKeyword}+ onRefresh={onRefresh}+ />{visibilityTabs && <div {...stylex.props(styles.pageTabs)}>{visibilityTabs}</div>}{headerExtra}{/* A member who may not manage shared connectors reads why once, here */}@@ -343,11 +183,6 @@ const LeftPanel = memo<LeftPanelProps>(onSelect={onSelect}/></div>- <CustomConnectorModal- open={showAddConnector}- visibility={visibility}- onClose={() => setShowAddConnector(false)}- /></SkillListVariantProvider>);}diff --git a/src/features/Settings/skill/features/SkillDetail/index.test.tsx b/src/features/Settings/skill/features/SkillDetail/index.test.tsxindex c6deb7cfc7d..a8445f3e615 100644--- a/src/features/Settings/skill/features/SkillDetail/index.test.tsx+++ b/src/features/Settings/skill/features/SkillDetail/index.test.tsx@@ -228,6 +228,17 @@ describe('SkillDetail', () => {mocks.toolState.lobehubSkillServers = [];});+ it.each([true, false])(+ 'shows no library install action on a bundled skill detail (previously installed: %s)',+ (installed) => {+ const identifier = 'lobe-artifacts';+ mocks.toolState.installedBuiltinIds = installed ? [identifier] : [];+ render(<SkillDetail identifier={identifier} type="builtin-skill" />);+ expect(screen.getByText(identifier)).toBeInTheDocument();+ expect(screen.queryByRole('button')).not.toBeInTheDocument();+ },+ );+it('offers a Configure migration action for an un-migrated legacy custom MCP', async () => {// Legacy `user_installed_plugins` custom MCP with an mcp config but no// matching `user_connectors` row β the panel should surface the migrationdiff --git a/src/features/Settings/skill/features/SkillDetail/index.tsx b/src/features/Settings/skill/features/SkillDetail/index.tsxindex c0cc4c2bfbb..0ad5efea0db 100644--- a/src/features/Settings/skill/features/SkillDetail/index.tsx+++ b/src/features/Settings/skill/features/SkillDetail/index.tsx@@ -6,7 +6,7 @@ import { Avatar, Button, confirmModal, Markdown, Skeleton, toast, Tooltip } fromimport { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import isEqual from 'fast-deep-equal';-import { Plus, SquareArrowOutUpRight, Trash2, Unplug, Wrench } from 'lucide-react';+import { SquareArrowOutUpRight, Trash2, Unplug, Wrench } from 'lucide-react';import type { ReactNode } from 'react';import { lazy, memo, Suspense, useCallback, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -18,11 +18,7 @@ import { useSkillConnect } from '@/features/SkillStore/SkillList/LobeHub/useSkilimport { usePermission } from '@/hooks/usePermission';import { useResourceManageable } from '@/hooks/useResourceManageable';import { useToolStore } from '@/store/tool';-import {- agentSkillsSelectors,- builtinToolSelectors,- lobehubSkillStoreSelectors,-} from '@/store/tool/selectors';+import { agentSkillsSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';import { loadBuiltinSkill } from '@/store/tool/slices/builtin/loadBuiltinSkills';import { connectorSelectors } from '@/store/tool/slices/connector';import { pluginSelectors } from '@/store/tool/slices/plugin/selectors';@@ -197,8 +193,6 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete, visibiconst syncPluginTools = useToolStore((s) => s.syncPluginTools);const syncToolsFromClient = useToolStore((s) => s.syncToolsFromClient);const fetchConnectors = useToolStore((s) => s.fetchConnectors);- const installBuiltinTool = useToolStore((s) => s.installBuiltinTool);- const uninstallBuiltinTool = useToolStore((s) => s.uninstallBuiltinTool);const deleteAgentSkill = useToolStore((s) => s.deleteAgentSkill);const connector = useToolStore(connectorSelectors.connectorByIdentifier(identifier, visibility));// For agent connectors the `identifier` slot carries the connector id; resolve@@ -270,7 +264,6 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete, visibi(s) => s.builtinSkills?.find((sk) => sk.identifier === identifier),isEqual,);- const isBuiltinInstalled = useToolStore(builtinToolSelectors.isBuiltinToolInstalled(identifier));const { data: builtinSkillContent } = useSWR(builtinSkill ? ['builtin-skill-content', identifier] : null,async () => (await loadBuiltinSkill(identifier))?.content,@@ -350,22 +343,6 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete, visibitype,]);- const handleUninstallBuiltin = () => {- confirmModal({- okButtonProps: { danger: true },- onOk: async () => {- try {- await uninstallBuiltinTool(identifier);- } catch (error) {- notifyUninstallError(error);- }- },- content: t('store.actions.confirmUninstall'),- okText: t('store.actions.uninstall'),- title: t('store.actions.uninstall'),- });- };-const handleDeleteAgentSkill = () => {confirmModal({okButtonProps: { danger: true },@@ -478,29 +455,6 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete, visibi)}</div></div>- <div style={{ display: 'flex', flexShrink: 0, gap: 8 }}>- {isBuiltinInstalled ? (- <ManageTooltip title={manageTooltip}>- <Button- danger- disabled={!canEdit || !canManage}- size="small"- onClick={handleUninstallBuiltin}- >- {t('store.actions.uninstall')}- </Button>- </ManageTooltip>- ) : (- <Button- disabled={!canCreate}- icon={<Plus size={14} />}- size="small"- onClick={() => installBuiltinTool(identifier)}- >- {t('store.actions.install')}- </Button>- )}- </div></div>{builtinSkillContent && (<div style={{ padding: '16px 24px' }}>diff --git a/src/features/Settings/skill/features/SkillList.tsx b/src/features/Settings/skill/features/SkillList.tsxindex fcbd6975921..f40d5a9ca0a 100644--- a/src/features/Settings/skill/features/SkillList.tsx+++ b/src/features/Settings/skill/features/SkillList.tsx@@ -23,7 +23,6 @@ import {import { useToolStore } from '@/store/tool';import {agentSkillsSelectors,- builtinToolSelectors,composioStoreSelectors,lobehubSkillStoreSelectors,pluginSelectors,@@ -41,7 +40,6 @@ import { type LobeToolType } from '@/types/tool/tool';import AgentConnectorItem from './AgentConnectorItem';import AgentSkillItem from './AgentSkillItem';-import BuiltinSkillItem from './BuiltinSkillItem';import ComposioSkillItem from './ComposioSkillItem';import { AccountsNeedReauth, countAccountsNeedingReauth } from './ConnectorRowFeedback';import {@@ -160,7 +158,6 @@ const SkillList = memo<SkillListProps>(const installedPluginList = useToolStore(pluginSelectors.installedPluginMetaList, isEqual);const marketAgentSkills = useToolStore(agentSkillsSelectors.getMarketAgentSkills, isEqual);const userAgentSkills = useToolStore(agentSkillsSelectors.getUserAgentSkills, isEqual);- const builtinSkills = useToolStore((s) => s.builtinSkills, isEqual);const allCustomConnectors = useToolStore(connectorSelectors.customConnectors, isEqual);const allMarketplaceConnectors = useToolStore(connectorSelectors.marketplaceMcpConnectors,@@ -184,43 +181,33 @@ const SkillList = memo<SkillListProps>();const isAgentBoundInit = useToolStore((s) => s.isAgentBoundInit);const fetchAgentBoundConnectors = useToolStore((s) => s.fetchAgentBoundConnectors);- const allBuiltinTools = useToolStore((s) => s.builtinTools, isEqual);- const uninstalledBuiltinTools = useToolStore(- builtinToolSelectors.uninstalledBuiltinTools,- isEqual,- );-- const [- useFetchLobehubSkillConnections,- useFetchUserComposioConnections,- useFetchAgentSkills,- useFetchUninstalledBuiltinTools,- ] = useToolStore((s) => [- s.useFetchLobehubSkillConnections,- s.useFetchUserComposioConnections,- s.useFetchAgentSkills,- s.useFetchUninstalledBuiltinTools,- ]);+ const [useFetchLobehubSkillConnections, useFetchUserComposioConnections, useFetchAgentSkills] =+ useToolStore((s) => [+ s.useFetchLobehubSkillConnections,+ s.useFetchUserComposioConnections,+ s.useFetchAgentSkills,+ ]);useFetchInstalledPlugins();// Keep each SWR handle so a failed skill fetch surfaces error + Retry instead// of a fake-empty list (each hook syncs into the store only on success β//+ const isConnectorView = viewMode === 'connector';const lobehubSkillsSWR = useFetchLobehubSkillConnections(isLobehubSkillEnabled);const composioSWR = useFetchUserComposioConnections(isComposioEnabled);const agentSkillsSWR = useFetchAgentSkills(true);- const builtinToolsSWR = useFetchUninstalledBuiltinTools(true);const skillsError =viewMode === 'skill'- ? (agentSkillsSWR.error ?? builtinToolsSWR.error)- : (lobehubSkillsSWR.error ?? composioSWR.error ?? builtinToolsSWR.error);+ ? agentSkillsSWR.error+ : (lobehubSkillsSWR.error ?? composioSWR.error ?? connectorsSWR.error);const reloadSkills = () => {+ if (!isConnectorView) {+ void agentSkillsSWR.mutate();+ return;+ }void lobehubSkillsSWR.mutate();void composioSWR.mutate();- void agentSkillsSWR.mutate();- // The uninstalled-builtin list is a replica now: revalidate re-runs its- // network sync without blanking the painted list.- void builtinToolsSWR.revalidate();+ void connectorsSWR.mutate();};// Load custom connectors (new connector store) so user-added OAuth MCP@@ -231,7 +218,6 @@ const SkillList = memo<SkillListProps>(// Load agent-owned connectors (across all agents) for the Agent Connectors// section β connector view only.- const isConnectorView = viewMode === 'connector';useEffect(() => {if (isConnectorView && !isAgentBoundInit) fetchAgentBoundConnectors();}, [isConnectorView, isAgentBoundInit, fetchAgentBoundConnectors]);@@ -244,25 +230,17 @@ const SkillList = memo<SkillListProps>(return allComposioServers.find((server) => server.identifier === identifier);};- const isBuiltinToolInstalled = (identifier: string) => {- return !uninstalledBuiltinTools.includes(identifier);- };-const connectionState = {- isBuiltinToolInstalled,isComposioActive: (identifier: string) =>getComposioServerByIdentifier(identifier)?.status === ComposioServerStatus.ACTIVE,isLobehubConnected: (providerId: string) =>getLobehubSkillServerByProvider(providerId)?.status === LobehubSkillStatus.CONNECTED,};- // Integrations (built-in skills / tools and the OAuth catalog, connected- // first), then installed plugins split into community and custom MCPs.+ // The connector catalog contains OAuth integrations, connected first.// A few dozen entries: cheap enough to derive on each render.const allIntegrations = buildIntegrationItems({...connectionState,- allBuiltinTools,- builtinSkills,connectorAvailability: { composio: isComposioEnabled, lobehub: isLobehubSkillEnabled },});@@ -283,9 +261,7 @@ const SkillList = memo<SkillListProps>(tabVisibility,getComposioServerByIdentifier(item.serverType.identifier)?.connectedAccountId,);- if (item.type === 'lobehub')- return isIntegrationInConnectorTab(item.provider.id, connectorTabRows, tabVisibility);- return !isPrivateTab;+ return isIntegrationInConnectorTab(item.provider.id, connectorTabRows, tabVisibility);});const communityMCPs = isPrivateTab? []@@ -297,11 +273,8 @@ const SkillList = memo<SkillListProps>(const hasAnySkills =viewMode === 'skill'- ? builtinSkills.length > 0 || marketAgentSkills.length > 0 || userAgentSkills.length > 0- : builtinSkills.length > 0 ||- integrations.length > 0 ||- marketAgentSkills.length > 0 ||- userAgentSkills.length > 0 ||+ ? marketAgentSkills.length > 0 || userAgentSkills.length > 0+ : integrations.length > 0 ||communityMCPs.length > 0 ||marketplaceConnectors.length > 0 ||customMCPs.length > 0 ||@@ -312,14 +285,15 @@ const SkillList = memo<SkillListProps>(const refreshAll = () => {if (refreshing) return;setRefreshing(true);- void Promise.allSettled([- lobehubSkillsSWR.mutate(),- composioSWR.mutate(),- agentSkillsSWR.mutate(),- Promise.resolve(builtinToolsSWR.revalidate()),- connectorsSWR.mutate(),- ...(isConnectorView ? [fetchAgentBoundConnectors()] : []),- ]).finally(() => setRefreshing(false));+ const requests = isConnectorView+ ? [+ lobehubSkillsSWR.mutate(),+ composioSWR.mutate(),+ connectorsSWR.mutate(),+ fetchAgentBoundConnectors(),+ ]+ : [agentSkillsSWR.mutate()];+ void Promise.allSettled(requests).finally(() => setRefreshing(false));};const header = isPage ? renderHeader?.({ onRefresh: refreshAll, refreshing }) : undefined;@@ -330,7 +304,10 @@ const SkillList = memo<SkillListProps>(isConnectorsInit,}): undefined;- if (privateState === 'loading')+ if (+ privateState === 'loading' ||+ (viewMode === 'skill' && !hasAnySkills && agentSkillsSWR.isLoading && !skillsError)+ )return (<>{header}@@ -412,20 +389,8 @@ const SkillList = memo<SkillListProps>(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 communitySkillItems = integrations.filter((item) =>+ matchesIntegrationKeyword(item, keyword, t),);const visibleCommunityMCPs = communityMCPs.filter((p) =>match(p.title, p.identifier, p.author),@@ -441,21 +406,6 @@ const SkillList = memo<SkillListProps>(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@@ -577,7 +527,6 @@ const SkillList = memo<SkillListProps>(// 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);// Connectors Discover: LobeHub's OAuth connectors lead the page as one@@ -616,15 +565,10 @@ const SkillList = memo<SkillListProps>(isConnectorView? [{- items: [...builtins.installed, ...oauth.installed].map(renderIntegration),+ items: 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'),- },{// With the market on, the ones left to connect lead the// Connectors Discover page (`lobehubConnectors`) instead.@@ -649,29 +593,6 @@ const SkillList = memo<SkillListProps>(},]: [- {- 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) =>@@ -755,31 +676,13 @@ const SkillList = memo<SkillListProps>(const isConnected = (item: IntegrationItem) => isIntegrationConnected(item, connectionState);const items = isConnectorView? [- ...[- ...partitionByInstalled(builtinToolItems, isConnected).installed,- ...partitionByInstalled(communitySkillItems, isConnected).installed,- ].map(renderIntegration),+ ...partitionByInstalled(communitySkillItems, isConnected).installed.map(+ renderIntegration,+ ),...renderCommunityMCPs(),...renderCustomConnectors(),]- : [- ...renderAgentSkills(marketAgentSkills),- ...renderAgentSkills(userAgentSkills),- ...builtinSkillItems.map((item) =>- item.type === 'builtinAgent' ? (- <AgentSkillItem- isSelected={selectedIdentifier === item.builtinAgentSkill.identifier}- key={item.builtinAgentSkill.identifier}- skill={item.builtinAgentSkill}- onSelect={- onSelect- ? () => onSelect(item.builtinAgentSkill.identifier, 'builtin-skill')- : undefined- }- />- ) : null,- ),- ];+ : [...renderAgentSkills(marketAgentSkills), ...renderAgentSkills(userAgentSkills)];return <div {...stylex.props(styles.container)}>{items}</div>;}@@ -810,8 +713,6 @@ const SkillList = memo<SkillListProps>(// 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 view only shows agent-based community skills; LobeHub / Composio// OAuth connectors live exclusively in the Connectors view.const hasCommunitySkills = !isConnectorView && marketAgentSkills.length > 0;@@ -826,34 +727,6 @@ const SkillList = memo<SkillListProps>(return (<div {...stylex.props(styles.container)}>{header}- {hasBuiltinTools &&- renderSection(- 'builtinTools',- t('skillGroup.builtinTools', 'Built-in Tools'),- builtinToolItems.map(renderIntegration),- )}-- {hasBuiltinSkills &&- renderSection(- 'builtinSkills',- t('skillGroup.builtinSkills', 'Built-in Skills'),- builtinSkillItems.map((item) => {- if (item.type !== 'builtinAgent') return null;- return (- <AgentSkillItem- isSelected={selectedIdentifier === item.builtinAgentSkill.identifier}- key={item.builtinAgentSkill.identifier}- skill={item.builtinAgentSkill}- onSelect={- onSelect- ? () => onSelect(item.builtinAgentSkill.identifier, 'builtin-skill')- : undefined- }- />- );- }),- )}-{hasCommunityConnectors &&renderSection('communityConnectors',diff --git a/src/features/Settings/skill/features/connectorSections.test.ts b/src/features/Settings/skill/features/connectorSections.test.tsindex c723ac670b5..83fd49aaa61 100644--- a/src/features/Settings/skill/features/connectorSections.test.ts+++ b/src/features/Settings/skill/features/connectorSections.test.ts@@ -1,5 +1,4 @@import { getConnectorCatalog, RecommendedSkillType } from '@lobechat/const';-import type { LobeBuiltinTool } from '@lobechat/types';import { createInstance } from 'i18next';import { describe, expect, it } from 'vitest';@@ -14,58 +13,21 @@ import {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: [],+ it('omits builtin recommendations from the connector catalog', () => {+ const fixtures = {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',- ]);+ recommendedSkills: [{ id: 'lobe-calculator', type: RecommendedSkillType.Builtin }],+ };+ expect(buildIntegrationItems(fixtures)).toEqual([]);});it('adds LobeHub OAuth providers only when that system is enabled', () => {const base = {- allBuiltinTools: [],- builtinSkills: [],- isBuiltinToolInstalled: () => false,isComposioActive: () => false,isLobehubConnected: () => false,recommendedSkills: [],diff --git a/src/features/Settings/skill/features/connectorSections.ts b/src/features/Settings/skill/features/connectorSections.tsindex 02f08816513..5824384d9a9 100644--- a/src/features/Settings/skill/features/connectorSections.ts+++ b/src/features/Settings/skill/features/connectorSections.ts@@ -1,16 +1,8 @@import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';-import {- getConnectorCatalog,- RECOMMENDED_SKILLS,- RecommendedSkillType,- resolveConnectorCatalogItem,-} from '@lobechat/const';-import type { BuiltinSkillManifest, LobeBuiltinTool } from '@lobechat/types';+import { getConnectorCatalog, RECOMMENDED_SKILLS, RecommendedSkillType } from '@lobechat/const';import type { TFunction } from 'i18next';export type IntegrationItem =- | { builtinAgentSkill: BuiltinSkillManifest; type: 'builtinAgent' }- | { builtinTool: LobeBuiltinTool; type: 'builtin' }| { provider: LobehubSkillProviderType; type: 'lobehub' }| { serverType: ComposioAppType; type: 'composio' };@@ -18,10 +10,7 @@ export type IntegrationItem =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. */@@ -30,18 +19,9 @@ export interface BuildIntegrationItemsParams {export const isIntegrationConnected = (item: IntegrationItem,- params: Pick<- BuildIntegrationItemsParams,- 'isBuiltinToolInstalled' | 'isComposioActive' | 'isLobehubConnected'- >,+ params: Pick<BuildIntegrationItemsParams, '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);}@@ -51,87 +31,33 @@ export const isIntegrationConnected = (}};-/**- * Every integration the connector / skill lists can show, connected ones first:- * built-in agent skills, built-in tools and the LobeHub / Composio OAuth catalog.- */+/** Connected OAuth apps first, then recommendations, retaining catalog order within ties. */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),+ const recommended = recommendedSkills+ .filter((s) => s.type !== RecommendedSkillType.Builtin)+ .map((s) => s.id);+ const rank = (item: IntegrationItem) => {+ const id = item.type === 'lobehub' ? item.provider.id : item.serverType.identifier;+ const index = recommended.indexOf(id);+ return index < 0 ? recommended.length : index;+ };+ return getConnectorCatalog(connectorAvailability)+ .filter(+ (item) =>+ recommendedSkills.length > 0 ||+ item.type !== 'composio' ||+ isComposioActive(item.serverType.identifier),+ )+ .sort(+ (a, b) =>+ Number(isIntegrationConnected(b, params)) - Number(isIntegrationConnected(a, params)) ||+ rank(a) - rank(b),);- }-- // 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. */@@ -150,18 +76,6 @@ export const matchesIntegrationKeyword = (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,diff --git a/src/features/SkillStore/SkillDetail/Header.tsx b/src/features/SkillStore/SkillDetail/Header.tsxindex cd381ccee9d..dfda05e2515 100644--- a/src/features/SkillStore/SkillDetail/Header.tsx+++ b/src/features/SkillStore/SkillDetail/Header.tsx@@ -1,14 +1,12 @@'use client';import { Avatar, Button, cssVar, Flexbox, Icon, Text, Tooltip, useModalContext } from '@lobehub/ui';-import { Plus, SquareArrowOutUpRight } from 'lucide-react';+import { SquareArrowOutUpRight } from 'lucide-react';import { memo, useEffect, useRef } from 'react';import { useTranslation } from 'react-i18next';import { useSkillConnect } from '@/features/SkillStore/SkillList/LobeHub/useSkillConnect';import { usePermission } from '@/hooks/usePermission';-import { useToolStore } from '@/store/tool';-import { builtinToolSelectors } from '@/store/tool/selectors';import { useDetailContext } from './DetailContext';import { ICON_SIZE, styles } from './styles';@@ -47,19 +45,6 @@ const Header = memo<HeaderProps>(({ type }) => {type: isBuiltin ? 'lobehub' : type, // Use lobehub as fallback for builtin});- // Builtin tool installation state (global, stored in tool store)- const [installBuiltinTool, isBuiltinInstalled] = useToolStore((s) => [- s.installBuiltinTool,- builtinToolSelectors.isBuiltinToolInstalled(identifier)(s),- ]);-- const handleBuiltinInstall = async () => {- if (!canCreate || !canEdit) return;-- await installBuiltinTool(identifier);- close();- };-const hasTriggeredConnectRef = useRef(false);useEffect(() => {@@ -93,26 +78,7 @@ const Header = memo<HeaderProps>(({ type }) => {};const renderConnectButton = () => {- // Handle builtin tools - only show install button, uninstall is done in settings- if (isBuiltin) {- if (isBuiltinInstalled) return null;-- return (- <Tooltip title={!canCreate ? createReason : editReason}>- <Button- disabled={!canCreate || !canEdit}- icon={<Icon icon={Plus} />}- type="primary"- onClick={handleBuiltinInstall}- >- {t('tools.builtins.install')}- </Button>- </Tooltip>- );- }-- // Handle Composio/LobeHub skills- if (isConnected) return null;+ if (isBuiltin || isConnected) return null;if (isConnecting) {return (diff --git a/src/features/SkillStore/SkillList/Builtin/Item.tsx b/src/features/SkillStore/SkillList/Builtin/Item.tsxdeleted file mode 100644index 669e9ad62ff..00000000000--- a/src/features/SkillStore/SkillList/Builtin/Item.tsx+++ /dev/null@@ -1,88 +0,0 @@-'use client';--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';--interface ItemProps {- avatar?: string;- description?: string;- identifier: string;- onOpenDetail?: () => void;- 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 { allowed: canCreate } = usePermission('create_content');- const { allowed: canEdit } = usePermission('edit_own_content');-- const [installBuiltinTool, uninstallBuiltinTool, isInstalled] = useToolStore((s) => [- s.installBuiltinTool,- s.uninstallBuiltinTool,- builtinToolSelectors.isBuiltinToolInstalled(identifier)(s),- ]);-- const handleInstall = async () => {- if (!canCreate) return;- await installBuiltinTool(identifier);- };-- const handleUninstall = () => {- if (!canEdit) return;- confirmModal({- cancelText: t('cancel', { ns: 'common' }),- content: t('store.actions.confirmUninstall', { ns: 'plugin' }),- okButtonProps: { danger: true },- okText: t('store.actions.uninstall', { ns: 'plugin' }),- onOk: async () => {- await uninstallBuiltinTool(identifier);- },- title: t('store.actions.uninstall', { ns: 'plugin' }),- });- };-- return (- <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}- />- );-});--Item.displayName = 'BuiltinListItem';--export default Item;diff --git a/src/features/SkillStore/SkillList/LobeHub/index.tsx b/src/features/SkillStore/SkillList/LobeHub/index.tsxindex 2090cb3ae19..8396bb44931 100644--- a/src/features/SkillStore/SkillList/LobeHub/index.tsx+++ b/src/features/SkillStore/SkillList/LobeHub/index.tsx@@ -1,28 +1,21 @@'use client';-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,createComposioSkillDetailModal,createLobehubSkillDetailModal,} from '@/features/SkillStore/SkillDetail';import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';import { useToolStore } from '@/store/tool';-import { type ToolStoreState } from '@/store/tool/initialState';import { composioStoreSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';import { ComposioServerStatus } from '@/store/tool/slices/composioStore';import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';-import BuiltinItem from '../Builtin/Item';import Empty from '../Empty';import { gridStyles } from '../style';import WantMoreSkills from '../WantMoreSkills';@@ -32,27 +25,11 @@ interface LobeHubListProps {keywords: string;}-// Selector to get only actual builtin tools (not including Composio)-const getBuiltinToolsOnly = (s: ToolStoreState): LobeToolMeta[] => {- return s.builtinTools- .filter((item) => !item.hidden)- .map((t) => ({- author: 'LobeHub',- identifier: t.identifier,- meta: t.manifest.meta,- type: 'builtin' as const,- }));-};-export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {- const { t } = useTranslation('setting');const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);const isComposioEnabled = useServerConfigStore(serverConfigSelectors.enableComposio);const allLobehubSkillServers = useToolStore(lobehubSkillStoreSelectors.getServers, isEqual);const allComposioServers = useToolStore(composioStoreSelectors.getServers, isEqual);- // Use custom selector to get only actual builtin tools (not Composio)- const builtinTools = useToolStore(getBuiltinToolsOnly, isEqual);- const builtinSkills = useToolStore((s) => s.builtinSkills, isEqual);const [useFetchLobehubSkillConnections, useFetchUserComposioConnections] = useToolStore((s) => [s.useFetchLobehubSkillConnections,@@ -77,46 +54,20 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {);const filteredItems = useMemo(() => {- const items: Array<- | { provider: LobehubSkillProviderType; type: 'lobehub' }- | { serverType: ComposioAppType; type: 'composio' }- | { skill: BuiltinSkillManifest; type: 'builtinAgentSkill' }- | { tool: LobeToolMeta; type: 'builtin' }- > = [];-- // Add builtin agent skills first- for (const skill of builtinSkills) {- items.push({ skill, type: 'builtinAgentSkill' });- }-- // Add builtin tools- for (const tool of builtinTools) {- items.push({ tool, type: 'builtin' });- }-- items.push(- ...getConnectorCatalog({ composio: isComposioEnabled, lobehub: isLobehubSkillEnabled }),- );+ const items = getConnectorCatalog({+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ });// Filter by keywordsconst lowerKeywords = keywords.toLowerCase().trim();if (!lowerKeywords) return items;return items.filter((item) => {- if (item.type === 'builtinAgentSkill') {- const name = item.skill.name.toLowerCase();- const identifier = item.skill.identifier.toLowerCase();- return name.includes(lowerKeywords) || identifier.includes(lowerKeywords);- }- if (item.type === 'builtin') {- const title = item.tool.meta?.title?.toLowerCase() || '';- const identifier = item.tool.identifier?.toLowerCase() || '';- return title.includes(lowerKeywords) || identifier.includes(lowerKeywords);- }const label = item.type === 'lobehub' ? item.provider.label : item.serverType.label;return label.toLowerCase().includes(lowerKeywords);});- }, [keywords, isLobehubSkillEnabled, isComposioEnabled, builtinTools, builtinSkills]);+ }, [keywords, isLobehubSkillEnabled, isComposioEnabled]);const hasSearchKeywords = Boolean(keywords && keywords.trim());@@ -127,46 +78,6 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {<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`, {- defaultValue: item.skill.name,- });- const localizedDescription = t(`tools.builtins.${item.skill.identifier}.description`, {- defaultValue: item.skill.description,- });- return (- <BuiltinItem- avatar={item.skill.avatar}- description={localizedDescription}- identifier={item.skill.identifier}- key={item.skill.identifier}- title={localizedTitle}- onOpenDetail={() =>- createBuiltinAgentSkillDetailModal({ identifier: item.skill.identifier })- }- />- );- }- if (item.type === 'builtin') {- const localizedTitle = t(`tools.builtins.${item.tool.identifier}.title`, {- defaultValue: item.tool.meta?.title || item.tool.identifier,- });- const localizedDescription = t(`tools.builtins.${item.tool.identifier}.description`, {- defaultValue: item.tool.meta?.description || '',- });- return (- <BuiltinItem- avatar={item.tool.meta?.avatar}- description={localizedDescription}- identifier={item.tool.identifier}- key={item.tool.identifier}- title={localizedTitle}- onOpenDetail={() =>- createBuiltinSkillDetailModal({ identifier: item.tool.identifier })- }- />- );- }if (item.type === 'lobehub') {const server = getLobehubSkillServerByProvider(item.provider.id);const isConnected = server?.status === LobehubSkillStatus.CONNECTED;diff --git a/src/helpers/toolEngineering/index.ts b/src/helpers/toolEngineering/index.tsindex c6a0b202754..c0a4f744b76 100644--- a/src/helpers/toolEngineering/index.ts+++ b/src/helpers/toolEngineering/index.ts@@ -21,6 +21,7 @@ import {type BuiltinToolResolveContext,type ChatCompletionTool,getActivePluginIds,+ getBuiltinOverrides,getOptedInPluginIds,type LobeAgentChatConfig,resolveToolMode,@@ -293,6 +294,7 @@ export const createAgentToolsEngine = (],chatConfig,options.uninstalledBuiltinTools ?? runtimeUninstalledBuiltinTools(getToolStoreState()),+ getBuiltinOverrides(agent.plugins),),...getFeatureDisabledToolIds(getServerConfigStoreState()?.featureFlags),// This engine serves runs the browser executes; server-only tools have nothing to run here.diff --git a/src/hooks/useNavLayout.ts b/src/hooks/useNavLayout.tsindex d5662a9aa35..889cfd663a7 100644--- a/src/hooks/useNavLayout.ts+++ b/src/hooks/useNavLayout.ts@@ -4,11 +4,7 @@ import { useTranslation } from 'react-i18next';import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';import { getRouteById } from '@/config/routes';-import {- MARKETPLACE_INSTALLED_SKILLS_PATH,- MARKETPLACE_PATH,- MARKETPLACE_SEGMENT,-} from '@/features/Marketplace/paths';+import { getMarketplaceEntryPath, MARKETPLACE_SEGMENT } from '@/features/Marketplace/paths';import { useGlobalStore } from '@/store/global';import { SidebarTabKey } from '@/store/global/initialState';import {@@ -128,7 +124,7 @@ export const useNavLayout = (): NavLayout => {icon: getRouteById('community')!.icon,key: SidebarTabKey.Community,title: t('tab.marketplace'),- url: showMarket ? MARKETPLACE_PATH : MARKETPLACE_INSTALLED_SKILLS_PATH,+ url: getMarketplaceEntryPath(showMarket),},{hidden: !!activeWorkspaceSlug,diff --git a/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx b/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsxdeleted file mode 100644index c1b02f7c940..00000000000--- a/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx+++ /dev/null@@ -1,99 +0,0 @@-'use client';--import { Button, Flexbox } from '@lobehub/ui';-import { media } from '@lobehub/ui/stylex/media.stylex';-import * as stylex from '@stylexjs/stylex';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { imageUrl, OFFICIAL_SITE } from '@/const/url';-import { useIsDark } from '@/hooks/useIsDark';-import { sx } from '@/styles/sx';--const styles = stylex.create({- banner: {- position: 'relative',- width: '100%',- paddingBlock: { default: '24px', [media.sm]: '16px' },- paddingInline: { default: '32px', [media.sm]: '20px' },- borderRadius: '12px',- },- bannerDark: {- backgroundImage: 'linear-gradient(135deg, #5c3d0e 0%, #7a4f10 50%, #6b3a08 100%)',- },- bannerLight: {- backgroundImage: 'linear-gradient(135deg, #fceabb 0%, #f8b500 50%, #e88a20 100%)',- },- subtitle: {- margin: '0',- fontSize: { default: '14px', [media.sm]: '12px' },- fontWeight: 400,- lineHeight: 1.5,- },- subtitleDark: { color: 'rgb(255 255 255 / 65%)' },- subtitleLight: { color: 'rgb(0 0 0 / 65%)' },- symbols: {- pointerEvents: 'none',- position: 'absolute',- insetBlock: '0',- insetInlineEnd: '0',- overflow: 'hidden',- width: '50%',- borderTopLeftRadius: '0',- borderTopRightRadius: '12px',- borderBottomRightRadius: '12px',- borderBottomLeftRadius: '0',- backgroundPosition: 'right center',- backgroundSize: 'auto 100%',- backgroundRepeat: 'no-repeat',- display: { default: null, [media.sm]: 'none' },- },- title: {- margin: '0',- fontSize: { default: '22px', [media.sm]: '18px' },- fontWeight: 700,- lineHeight: 1.3,- },- titleDark: { color: 'rgb(255 255 255 / 88%)' },- titleLight: { color: 'rgb(0 0 0 / 88%)' },-});--const CreatorRewardBanner = memo(() => {- const { t } = useTranslation('discover');- const isDark = useIsDark();-- return (- <Flexbox- width={'100%'}- className={- stylex.props(styles.banner, isDark ? styles.bannerDark : styles.bannerLight).className- }- >- <Flexbox gap={8} style={{ position: 'relative', zIndex: 1 }}>- <h2 {...stylex.props(styles.title, isDark ? styles.titleDark : styles.titleLight)}>- {t('home.creatorReward.title')}- </h2>- <p {...stylex.props(styles.subtitle, isDark ? styles.subtitleDark : styles.subtitleLight)}>- {t('home.creatorReward.subtitle')}- </p>- <div style={{ marginBlockStart: 4 }}>- <a- href={`${OFFICIAL_SITE}/creator?utm_source=lobehub`}- rel={'noopener noreferrer'}- target={'_blank'}- >- <Button type={'primary'}>{t('home.creatorReward.action')}</Button>- </a>- </div>- </Flexbox>- <div- {...sx(styles.symbols, {- // Runtime CDN URL, so it cannot live in stylex.create.- backgroundImage: `url(${imageUrl('banner_creator.png')})`,- })}- />- </Flexbox>- );-});--export default CreatorRewardBanner;diff --git a/src/routes/(main)/community/(list)/(home)/index.tsx b/src/routes/(main)/community/(list)/(home)/index.tsxdeleted file mode 100644index 58bb5f9fba5..00000000000--- a/src/routes/(main)/community/(list)/(home)/index.tsx+++ /dev/null@@ -1,82 +0,0 @@-'use client';--import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import AsyncBoundary from '@/components/AsyncBoundary';-import { MARKETPLACE_CONNECTOR_PATH } from '@/features/Marketplace/paths';-import { useDiscoverStore } from '@/store/discover';-import { assistantSelectors, mcpSelectors } from '@/store/discover/selectors';-import { AssistantSorts, McpSorts } from '@/types/discover';--import ListLoading from '../../components/ListLoading';-import Title from '../../components/Title';-import AssistantList from '../agent/features/List';-import McpList from '../mcp/features/List';-import CreatorRewardBanner from './features/CreatorRewardBanner';--const HomePage = memo(() => {- const { t } = useTranslation('discover');- const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);- const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);-- const {- error: assistantError,- isLoading: assistantLoading,- mutate: refetchAssistants,- queryKey: assistantQueryKey,- } = useAssistantList({- page: 1,- pageSize: 12,- sort: AssistantSorts.Recommended,- });- const assistantList = useDiscoverStore(assistantSelectors.assistantList(assistantQueryKey));-- const {- error: mcpError,- isLoading: pluginLoading,- mutate: refetchMcp,- queryKey: mcpQueryKey,- } = useMcpList({- page: 1,- pageSize: 12,- sort: McpSorts.Recommended,- });- // The replica view of this query; the sync hook only reports the fetch flags.- const mcpList = useDiscoverStore(mcpSelectors.mcpList(mcpQueryKey));-- return (- <>- <CreatorRewardBanner />- <Title more={t('home.more')} moreLink={'/marketplace/agent'}>- {t('home.featuredAssistants')}- </Title>- <AsyncBoundary- data={assistantList}- error={assistantError}- isLoading={assistantLoading}- loading={<ListLoading length={8} rows={4} />}- onRetry={() => refetchAssistants()}- >- <AssistantList data={assistantList?.items ?? []} rows={4} />- </AsyncBoundary>- <div />- <Title more={t('home.more')} moreLink={MARKETPLACE_CONNECTOR_PATH}>- {t('home.featuredTools')}- </Title>- <AsyncBoundary- data={mcpList}- error={mcpError}- isLoading={pluginLoading}- loading={<ListLoading length={8} rows={4} />}- onRetry={() => refetchMcp()}- >- <McpList data={mcpList?.items ?? []} rows={4} />- </AsyncBoundary>- </>- );-});--HomePage.displayName = 'CommunityHomePage';--export default HomePage;diff --git a/src/routes/(main)/community/(list)/_layout/Header.tsx b/src/routes/(main)/community/(list)/_layout/Header.tsxindex 561d3b81625..b3ec4d7f739 100644--- a/src/routes/(main)/community/(list)/_layout/Header.tsx+++ b/src/routes/(main)/community/(list)/_layout/Header.tsx@@ -5,6 +5,7 @@ import * as stylex from '@stylexjs/stylex';import { memo } from 'react';import { useLocation } from 'react-router';+import { hasCatalogPageHeader } from '@/features/Marketplace/paths';import NavHeader from '@/features/NavHeader';import StoreSearchBar from '@/routes/(main)/community/features/Search';import UserAvatar from '@/routes/(main)/community/features/UserAvatar';@@ -14,6 +15,7 @@ import { styles } from './Header/style';const Header = memo(() => {const location = useLocation();+ if (hasCatalogPageHeader(location.pathname)) return <NavHeader />;const isHome = location.pathname === '/';const cssVariables: Record<string, string> = {diff --git a/src/routes/(main)/community/_layout/Sidebar/Header/Nav.tsx b/src/routes/(main)/community/_layout/Sidebar/Header/Nav.tsxindex 91ebb7fa4e3..91c17a8c5c8 100644--- a/src/routes/(main)/community/_layout/Sidebar/Header/Nav.tsx+++ b/src/routes/(main)/community/_layout/Sidebar/Header/Nav.tsx@@ -2,16 +2,16 @@import { Flexbox } from '@lobehub/ui';import { SkillsIcon } from '@lobehub/ui/icons';-import { Blocks, Bot, ShapesIcon } from 'lucide-react';+import { Blocks, Bot } from 'lucide-react';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import {getMarketplaceSubPath,+ MARKETPLACE_AGENT_PATH,MARKETPLACE_CONNECTOR_PATH,MARKETPLACE_INSTALLED_CONNECTORS_PATH,MARKETPLACE_INSTALLED_SKILLS_PATH,- MARKETPLACE_PATH,MARKETPLACE_SKILL_PATH,} from '@/features/Marketplace/paths';import NavItem from '@/features/NavPanel/components/NavItem';@@ -40,7 +40,7 @@ interface Item {// MCP detail pages (`mcp/:slug`) belong to Connectors, which absorbed the MCP list.const useActiveTabKey = () => {const { pathname } = useActiveLocation();- const subPath = getMarketplaceSubPath(pathname) || DiscoverTab.Home;+ const subPath = getMarketplaceSubPath(pathname) ?? '';return subPath.startsWith(DiscoverTab.Mcp) ? CONNECTOR_TAB : subPath;};@@ -53,19 +53,12 @@ const Nav = memo(() => {const items: Item[] = useMemo(() =>[- {- icon: ShapesIcon,- key: DiscoverTab.Home,- marketOnly: true,- title: t('tab.home'),- url: MARKETPLACE_PATH,- },{icon: Bot,key: DiscoverTab.Assistants,marketOnly: true,title: t('tab.assistant'),- url: `${MARKETPLACE_PATH}/agent`,+ url: MARKETPLACE_AGENT_PATH,},{icon: SkillsIcon,diff --git a/src/routes/(main)/community/features/useNav.tsx b/src/routes/(main)/community/features/useNav.tsxindex 4c2360cc968..8624fa2a40d 100644--- a/src/routes/(main)/community/features/useNav.tsx+++ b/src/routes/(main)/community/features/useNav.tsx@@ -1,12 +1,13 @@import { Icon } from '@lobehub/ui';import { SkillsIcon } from '@lobehub/ui/icons';-import { Blocks, Bot, House } from 'lucide-react';+import { Blocks, Bot } from 'lucide-react';import { type ReactNode } from 'react';import { useMemo } from 'react';import { useTranslation } from 'react-i18next';import { useLocation } from 'react-router';import { type MenuProps } from '@/components/Menu';+import { getMarketplaceSubPath } from '@/features/Marketplace/paths';import { DiscoverTab } from '@/types/discover';const ICON_SIZE = 16;@@ -18,27 +19,15 @@ export const useNav = () => {const location = useLocation();const { t } = useTranslation('discover');const activeKey = useMemo(() => {- const pathname = location.pathname;- // Connectors absorbed the MCP list, so MCP (and legacy plugin) pages light it up.- if (- pathname.includes(`/${MARKETPLACE_CONNECTOR_TAB}`) ||- pathname.includes(`/${DiscoverTab.Mcp}`) ||- pathname.includes(`/${DiscoverTab.Plugins}`)- )+ const section = getMarketplaceSubPath(location.pathname)?.split('/')[0];+ // MCP and legacy plugin details belong to Connectors.+ if (section === DiscoverTab.Mcp || section === DiscoverTab.Plugins)return MARKETPLACE_CONNECTOR_TAB;- for (const value of Object.values(DiscoverTab)) {- if (pathname.includes(`/${value}`)) return value;- }- return DiscoverTab.Home;+ return section;}, [location.pathname]);const items: MenuProps['items'] = useMemo(() => [- {- icon: <Icon icon={House} size={ICON_SIZE} />,- key: DiscoverTab.Home,- label: <div style={{ color: 'inherit', display: 'inline' }}>{t('tab.home')}</div>,- },{icon: <Icon icon={Bot} size={ICON_SIZE} />,key: DiscoverTab.Assistants,diff --git a/src/routes/(mobile)/_layout/NavBar.tsx b/src/routes/(mobile)/_layout/NavBar.tsxindex b2577dba98b..f2a0ea1d256 100644--- a/src/routes/(mobile)/_layout/NavBar.tsx+++ b/src/routes/(mobile)/_layout/NavBar.tsx@@ -13,7 +13,7 @@ import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import { MOBILE_TABBAR_HEIGHT } from '@/const/layoutTokens';-import { MARKETPLACE_INSTALLED_SKILLS_PATH, MARKETPLACE_PATH } from '@/features/Marketplace/paths';+import { getMarketplaceEntryPath } from '@/features/Marketplace/paths';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { useMobileNavigation } from '@/hooks/useMobileNavigation';import { SidebarTabKey } from '@/store/global/initialState';@@ -79,7 +79,7 @@ const NavBar = memo(() => {),key: SidebarTabKey.Community,onClick: () => {- navigate(showMarket ? MARKETPLACE_PATH : MARKETPLACE_INSTALLED_SKILLS_PATH);+ navigate(getMarketplaceEntryPath(showMarket));},title: t('tab.marketplace'),},diff --git a/src/routes/(mobile)/community/(list)/_layout/Header.tsx b/src/routes/(mobile)/community/(list)/_layout/Header.tsxindex 5004334f75a..22ef9ac120f 100644--- a/src/routes/(mobile)/community/(list)/_layout/Header.tsx+++ b/src/routes/(mobile)/community/(list)/_layout/Header.tsx@@ -6,8 +6,11 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { SearchIcon } from 'lucide-react';import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';+import { useLocation } from 'react-router';import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';+import { hasCatalogPageHeader } from '@/features/Marketplace/paths';import { mobileHeaderSticky } from '@/styles/mobileHeader';import StoreSearchBar from '../../../../(main)/community/features/Search';@@ -24,43 +27,36 @@ const styles = stylex.create({},});-const Header = memo(() => {+const SearchAction = memo(() => {+ const { t } = useTranslation('common');const [showSearch, setShowSearch] = useState(false);+ return showSearch ? (+ <Flexbox+ align={'center'}+ className={stylex.props(styles.search).className}+ paddingBlock={8}+ paddingInline={16}+ >+ <StoreSearchBar mobile onBlur={() => setShowSearch(false)} />+ </Flexbox>+ ) : (+ <ActionIcon+ aria-label={t('tab.search')}+ icon={SearchIcon}+ size={MOBILE_HEADER_ICON_SIZE}+ onClick={() => setShowSearch(true)}+ />+ );+});++const Header = memo(() => {+ const { pathname } = useLocation();return (<ChatHeaderleft={<Nav />}+ right={!hasCatalogPageHeader(pathname) && <SearchAction />}styles={{ center: { display: 'none' } }}- center={- showSearch && (- <Flexbox- align={'center'}- className={stylex.props(styles.search).className}- paddingBlock={8}- paddingInline={16}- >- <StoreSearchBar mobile onBlur={() => setShowSearch(false)} />- </Flexbox>- )- }- right={- showSearch ? (- <Flexbox- align={'center'}- className={stylex.props(styles.search).className}- paddingBlock={8}- paddingInline={16}- >- <StoreSearchBar mobile onBlur={() => setShowSearch(false)} />- </Flexbox>- ) : (- <ActionIcon- icon={SearchIcon}- size={MOBILE_HEADER_ICON_SIZE}- onClick={() => setShowSearch(true)}- />- )- }style={{...mobileHeaderSticky,overflow: 'unset',diff --git a/src/routes/(mobile)/community/(list)/_layout/Nav.tsx b/src/routes/(mobile)/community/(list)/_layout/Nav.tsxindex 62f3645226b..7140900c92f 100644--- a/src/routes/(mobile)/community/(list)/_layout/Nav.tsx+++ b/src/routes/(mobile)/community/(list)/_layout/Nav.tsx@@ -5,11 +5,11 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { MenuIcon } from 'lucide-react';import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';import Menu from '@/components/Menu';import { MARKETPLACE_PATH } from '@/features/Marketplace/paths';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';-import { DiscoverTab } from '@/types/discover';import { useNav } from '../../../../(main)/community/features/useNav';@@ -31,6 +31,7 @@ const styles = stylex.create({});const Nav = memo(() => {+ const { t } = useTranslation('common');const [open, setOpen] = useState(false);const { items, activeKey, activeItem } = useNav();const navigate = useWorkspaceAwareNavigate();@@ -39,6 +40,7 @@ const Nav = memo(() => {<><Flexbox horizontal align={'center'} className={stylex.props(styles.title).className} gap={4}><ActionIcon+ aria-label={t('navPanel.openMenu')}color={cssVar.colorText}icon={MenuIcon}size={{ blockSize: 32, size: 18 }}@@ -73,11 +75,7 @@ const Nav = memo(() => {items={items}onClick={({ key }) => {scrollToTop();- if (key === DiscoverTab.Home) {- navigate(MARKETPLACE_PATH);- } else {- navigate(`${MARKETPLACE_PATH}/${key}`);- }+ navigate(`${MARKETPLACE_PATH}/${key}`);setOpen(false);}}/>diff --git a/src/services/chat/index.ts b/src/services/chat/index.tsindex d5243120817..93c101e82f5 100644--- a/src/services/chat/index.ts+++ b/src/services/chat/index.ts@@ -16,6 +16,7 @@ import {ChatErrorType,type ChatMessageError,getAutoPluginIds,+ getBuiltinOverrides,getOptedInPluginIds,type RequestTrigger,type RuntimeAdditionalContextFragment,@@ -246,6 +247,7 @@ class ChatService {chatConfig,// A running conversation already has a scope-filtered manifest map.discoveryManifests ? [] : runtimeUninstalledBuiltinTools(getToolStoreState()),+ getBuiltinOverrides(agentConfig.plugins),),...resolveAgentConnectorActivation({ id: targetAgentId, chatConfig, plugins: agentConfig.plugins },diff --git a/src/services/chat/mecha/contextEngineering.ts b/src/services/chat/mecha/contextEngineering.tsindex ad97ceb659e..2f689ff5021 100644--- a/src/services/chat/mecha/contextEngineering.ts+++ b/src/services/chat/mecha/contextEngineering.ts@@ -38,7 +38,10 @@ import { agentGroupSelectors } from '@/store/agentGroup/selectors';import { getChatStoreState } from '@/store/chat';import { getServerConfigStoreState, serverConfigSelectors } from '@/store/serverConfig';import { getToolStoreState } from '@/store/tool';-import { installedImplicitBuiltinSkillIds } from '@/store/tool/slices/builtin/projection';+import {+ installedImplicitBuiltinSkillIds,+ legacyDisabledBuiltinSkillsForRun,+} from '@/store/tool/slices/builtin/projection';import { useUserStore } from '@/store/user';import { userGeneralSettingsSelectors } from '@/store/user/selectors';@@ -325,7 +328,12 @@ export const contextEngineering = async ({enabledSkills = (await resolveClientSkills(plugins,- disabledPluginIds,+ shareVisitor+ ? disabledPluginIds+ : [+ ...(disabledPluginIds ?? []),+ ...legacyDisabledBuiltinSkillsForRun(getToolStoreState(), agentConfig?.plugins),+ ],respondingChatConfig.skillActivateMode,// Reading another topic (`<refer_topic>` or a raw `tpc_` id) goes through `lh topic view`,// which the lobehub skill teaches.diff --git a/src/spa/router/desktopRouter.sync.test.tsx b/src/spa/router/desktopRouter.sync.test.tsxindex fd832d4cec8..b67b9984291 100644--- a/src/spa/router/desktopRouter.sync.test.tsx+++ b/src/spa/router/desktopRouter.sync.test.tsx@@ -823,8 +823,10 @@ describe('desktop router shared definition', () => {(_, factory) => {const routes = createMainAreaRoutes(factory);+ const entry = matchRoutes(routes, '/marketplace')?.at(-1)?.route.element;+ expect(matchRoutes(routes, '/community')?.at(-1)?.route.element).toBe(entry);+for (const url of [- '/community','/community/mcp/notion','/acme/community/skill',// Compete with `/:workspaceSlug/agent[/:aid]`; a lone `community/*`diff --git a/src/spa/router/legacyPathRedirect.test.ts b/src/spa/router/legacyPathRedirect.test.tsindex acd51062313..aaf48d5e15c 100644--- a/src/spa/router/legacyPathRedirect.test.ts+++ b/src/spa/router/legacyPathRedirect.test.ts@@ -1,4 +1,4 @@-import { render, screen } from '@testing-library/react';+import { act, render, screen } from '@testing-library/react';import { createElement } from 'react';import { createMemoryRouter, RouterProvider, useLocation } from 'react-router';import { describe, expect, it } from 'vitest';@@ -7,13 +7,14 @@ import {MARKETPLACE_INSTALLED_CONNECTORS_PATH,MARKETPLACE_INSTALLED_SKILLS_PATH,} from '@/features/Marketplace/paths';+import { initServerConfigStore, Provider } from '@/store/serverConfig/store';import {buildLegacyCommunityRedirectPath,buildLegacyRedirectPath,LegacyPathRedirect,} from './legacyPathRedirect';-import { legacyCommunityRoutes } from './marketplaceRoutes';+import { legacyCommunityRoutes, marketplaceIndexRoute } from './marketplaceRoutes';const CurrentUrl = () => {const { hash, pathname, search } = useLocation();@@ -25,7 +26,8 @@ const agentPage = createElement('div', { 'data-testid': 'url' }, 'agent page');const redirectTo = (to: string) => createElement(LegacyPathRedirect, { to });/** A route table shaped like the real one: personal and `/:workspaceSlug` mirrors. */-const renderAt = (url: string) => {+const renderAt = (url: string, serverConfigInit = true) => {+ const store = initServerConfigStore({ serverConfigInit });const legacy = [{ element: redirectTo(MARKETPLACE_INSTALLED_SKILLS_PATH), path: 'skill' },{ element: redirectTo(MARKETPLACE_INSTALLED_SKILLS_PATH), path: 'skill/:sub' },@@ -37,6 +39,7 @@ const renderAt = (url: string) => {const shared = [...legacyCommunityRoutes,// The real tree has static `marketplace/<section>` routes that outrank the workspace ones.+ { children: [marketplaceIndexRoute], path: 'marketplace' },{ element: currentUrl, path: 'marketplace/*' },{ element: currentUrl, path: 'marketplace/agent' },{ element: currentUrl, path: 'marketplace/agent/:slug' },@@ -63,8 +66,13 @@ const renderAt = (url: string) => {{ initialEntries: [url] },);- render(createElement(RouterProvider, { router }));- return screen.getByTestId('url').textContent;+ render(+ createElement(Provider, {+ children: createElement(RouterProvider, { router }),+ createStore: () => store,+ }),+ );+ return { router, store };};describe('buildLegacyRedirectPath', () => {@@ -92,6 +100,24 @@ describe('buildLegacyRedirectPath', () => {});describe('legacy URL redirects', () => {+ it.each([+ [true, '/acme/marketplace/agent?q=developer#results'],+ [false, '/acme/marketplace/skill/installed?q=developer#results'],+ ] as const)(+ 'opens the original bookmark directly after loading showMarket=%s',+ async (showMarket, destination) => {+ const { router, store } = renderAt('/acme/community?q=developer#results', false);+ expect(router.state.location.pathname).toBe('/acme/community');+ await act(() => {+ store.setState({+ featureFlags: { ...store.getState().featureFlags, showMarket },+ serverConfigInit: true,+ });+ });+ expect(screen.getByTestId('url').textContent).toBe(destination);+ },+ );+it.each([// Settings skill / connector moved to the Marketplace (personal scope).['/settings/skill', '/marketplace/skill/installed'],@@ -110,16 +136,19 @@ describe('legacy URL redirects', () => {'/acme/marketplace/connector/installed?open=mcp-connector%3Amwe',],// `/community` became `/marketplace`.- ['/community', '/marketplace'],+ ['/marketplace', '/marketplace/agent'],+ ['/community', '/marketplace/agent'],['/community/skill?category=dev&page=2', '/marketplace/skill?category=dev&page=2'],['/community/mcp/notion', '/marketplace/mcp/notion'],- ['/acme/community', '/acme/marketplace'],+ ['/acme/community', '/acme/marketplace/agent'],+ ['/acme/marketplace?q=developer#results', '/acme/marketplace/agent?q=developer#results'],['/acme/community/agent/some-agent#top', '/acme/marketplace/agent/some-agent#top'],['/community/agent', '/marketplace/agent'],['/community/agent/some-agent', '/marketplace/agent/some-agent'],['/community/workspace/settings', '/marketplace/workspace/settings'],['/community/whatever/deep/path', '/marketplace/whatever/deep/path'],])('%s β %s', (from, to) => {- expect(renderAt(from)).toBe(to);+ renderAt(from);+ expect(screen.getByTestId('url').textContent).toBe(to);});});diff --git a/src/spa/router/marketplaceRoutes.tsx b/src/spa/router/marketplaceRoutes.tsxindex 252a06bacf9..bfc65d96883 100644--- a/src/spa/router/marketplaceRoutes.tsx+++ b/src/spa/router/marketplaceRoutes.tsx@@ -3,10 +3,10 @@import { Blocks, ShapesIcon } from 'lucide-react';import type { RouteObject } from 'react-router';-import CommunityHomeSkeleton from '@/components/Skeleton/CommunityHome';import CommunityListSkeleton from '@/components/Skeleton/CommunityList';import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import {+ getMarketplaceEntryPath,LEGACY_COMMUNITY_SEGMENT,MARKETPLACE_CONNECTOR_PATH,MARKETPLACE_INSTALLED_CONNECTORS_PATH,@@ -20,6 +20,7 @@ import {import { communityDetailRouteMeta } from '@/features/RouteMeta/communityRouteMeta';import { LegacyCommunityRedirect, LegacyPathRedirect } from '@/spa/router/legacyPathRedirect';import { routeMeta } from '@/spa/router/routeMeta';+import { useServerConfigStore } from '@/store/serverConfig';import { dynamicElement, ErrorBoundary } from '@/utils/router';/**@@ -56,6 +57,20 @@ export const marketplaceManageRoutes: RouteObject[] = [*/export const LEGACY_REDIRECT_HANDLE = { legacyRedirect: true } as const;+const MarketplaceEntryRedirect = () => {+ const destination = useServerConfigStore((s) =>+ s.serverConfigInit ? getMarketplaceEntryPath(s.featureFlags.showMarket) : undefined,+ );++ return destination ? <LegacyPathRedirect to={destination} /> : null;+};++export const marketplaceIndexRoute: RouteObject = {+ element: <MarketplaceEntryRedirect />,+ handle: LEGACY_REDIRECT_HANDLE,+ index: true,+};+/** `mcp` (the former MCP list) β the Connectors Discover page, query kept. */export const marketplaceMcpListRedirect: RouteObject = {element: <LegacyPathRedirect to={MARKETPLACE_CONNECTOR_PATH} />,@@ -78,6 +93,7 @@ export const marketplaceRoute: RouteObject = {handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('form') }) },path: 'workspace/settings',},+ marketplaceIndexRoute,...marketplaceManageRoutes,// The MCP list merged into Connectors; its URL (with `?category=` / `?q=`)// forwards there. MCP detail pages stay at `mcp/:slug`.@@ -164,21 +180,6 @@ export const marketplaceRoute: RouteObject = {handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('detail') }) },path: 'workspace',},- {- element: dynamicElement(- () => import('@/routes/(main)/community/(list)/(home)'),- 'Desktop > Discover > List > Home',- { preloadId: 'community' },- ),- handle: {- meta: routeMeta({- icon: ShapesIcon,- Skeleton: CommunityHomeSkeleton,- titleKey: 'navigation.marketplace',- }),- },- index: true,- },],element: dynamicElement(() => import('@/routes/(main)/community/(list)/_layout'),@@ -304,7 +305,11 @@ const legacyCommunityRedirect = (path: string): RouteObject => ({});export const legacyCommunityRoutes: RouteObject[] = [- legacyCommunityRedirect(LEGACY_COMMUNITY_SEGMENT),+ {+ element: marketplaceIndexRoute.element,+ handle: LEGACY_REDIRECT_HANDLE,+ path: LEGACY_COMMUNITY_SEGMENT,+ },...LEGACY_COMMUNITY_SECTIONS.flatMap((section) => [legacyCommunityRedirect(`${LEGACY_COMMUNITY_SEGMENT}/${section}`),legacyCommunityRedirect(`${LEGACY_COMMUNITY_SEGMENT}/${section}/:slug`),diff --git a/src/spa/router/mobileRouter.config.tsx b/src/spa/router/mobileRouter.config.tsxindex 239b56dce3b..09a09a4232e 100644--- a/src/spa/router/mobileRouter.config.tsx+++ b/src/spa/router/mobileRouter.config.tsx@@ -22,6 +22,7 @@ import { workspaceHomeRouteMeta } from '@/features/Workspace/routeMeta';import {legacyCommunityRoutes,legacySettingsMarketplaceRedirects,+ marketplaceIndexRoute,marketplaceManageRoutes,marketplaceMcpListRedirect,} from '@/spa/router/marketplaceRoutes';@@ -123,19 +124,11 @@ export const sharedMainAreaChildren: RouteObject[] = ['connector/installed': withHandle({ mobileShellHeader: true }),'skill/installed': withHandle({ mobileShellHeader: true }),}),+ marketplaceIndexRoute,marketplaceMcpListRedirect,// List routes (with ListLayout){children: [- {- element: dynamicElement(- () => import('@/routes/(main)/community/(list)/(home)'),- 'Mobile > Discover > List > Home',- { preloadId: 'mobile-community' },- ),- handle: { meta: routeMeta({ icon: ShapesIcon, titleKey: 'navigation.marketplace' }) },- index: true,- },{children: [{diff --git a/src/spa/router/mobileRouter.test.tsx b/src/spa/router/mobileRouter.test.tsxindex 7c5742acd16..8ed53679d93 100644--- a/src/spa/router/mobileRouter.test.tsx+++ b/src/spa/router/mobileRouter.test.tsx@@ -156,7 +156,12 @@ describe('mobile Marketplace skill and connector pages', () => {expect(element?.props.to).toBe(to);});- it.each(['/community', '/community/agent/my-agent', '/acme/community/mcp'])(+ it('uses the marketplace entry redirect for the old community root', () => {+ const entry = matchRoutes(mobileRoutes, '/marketplace')?.at(-1)?.route.element;+ expect(matchRoutes(mobileRoutes, '/community')?.at(-1)?.route.element).toBe(entry);+ });++ it.each(['/community/agent/my-agent', '/acme/community/mcp'])('forwards %s to the Marketplace',(url) => {const element = matchRoutes(mobileRoutes, url)?.at(-1)?.route.element asdiff --git a/src/store/tool/slices/builtin/executors/clientSkillCatalog.ts b/src/store/tool/slices/builtin/executors/clientSkillCatalog.tsindex 07d8202b5d2..6e4e7ca8a69 100644--- a/src/store/tool/slices/builtin/executors/clientSkillCatalog.ts+++ b/src/store/tool/slices/builtin/executors/clientSkillCatalog.ts@@ -17,7 +17,7 @@ import { parseSelectedSkillsFromEditorData } from '@/store/chat/slices/agentRun/import { messageMapKey } from '@/store/chat/utils/messageMapKey';import { getToolStoreState } from '@/store/tool';-import { installedImplicitBuiltinSkillIds } from '../projection';+import { installedImplicitBuiltinSkillIds, legacyDisabledBuiltinSkillsForRun } from '../projection';/** Bind both name lookup and the fallback catalog to the calling agent, not the active tab. */export const clientSkillCatalog = (ctx: BuiltinToolContext) => {@@ -54,7 +54,10 @@ export const clientSkillCatalog = (ctx: BuiltinToolContext) => {),);if (mentionsTopic(userTurns)) selected.add(LobeHubIdentifier);- const disabled = new Set(getDisabledPluginIds(plugins));+ const disabled = new Set([+ ...getDisabledPluginIds(plugins),+ ...legacyDisabledBuiltinSkillsForRun(getToolStoreState(), plugins),+ ]);const offered = (id: string) =>!disabled.has(id) && (selected.has(id) || getLibrarySkillMode(plugins, id) !== 'disabled');const lookup: Pick<SkillRuntimeService, 'findAll' | 'findById' | 'findByName'> = {diff --git a/src/store/tool/slices/builtin/projection.ts b/src/store/tool/slices/builtin/projection.tsindex 534c06dc662..2a488dd865a 100644--- a/src/store/tool/slices/builtin/projection.ts+++ b/src/store/tool/slices/builtin/projection.ts@@ -1,8 +1,12 @@import { onDemandBuiltinToolIds } from '@lobechat/builtin-tools';import {getImplicitBuiltinSkillIds,+ getLegacyDisabledBuiltinSkillIds,+ legacyBuiltinSkillIds,type SkillDiscoveryChatConfig,} from '@lobechat/mecha/builtinSkillGate';+import type { AgentPluginEntry } from '@lobechat/types';+import { getBuiltinOverrides } from '@lobechat/types';import { defineReplica } from '@/libs/replica';@@ -72,3 +76,13 @@ export const installedImplicitBuiltinSkillIds = (const uninstalled = confirmedUninstalledBuiltinTools(state);return uninstalled ? implicit.filter((id) => !uninstalled.includes(id)) : [];};++/** A legacy uninstall remains off until this agent explicitly chooses the bundled skill. */+export const legacyDisabledBuiltinSkillsForRun = (+ state: BuiltinToolState,+ plugins: AgentPluginEntry[] | undefined,+) =>+ getLegacyDisabledBuiltinSkillIds(+ confirmedUninstalledBuiltinTools(state) ?? legacyBuiltinSkillIds,+ getBuiltinOverrides(plugins),+ );diff --git a/src/store/tool/slices/builtin/replica.test.ts b/src/store/tool/slices/builtin/replica.test.tsindex 9edc2f2df6e..92200e064b9 100644--- a/src/store/tool/slices/builtin/replica.test.ts+++ b/src/store/tool/slices/builtin/replica.test.ts@@ -23,6 +23,7 @@ import { useToolStore } from '../../store';import { initialBuiltinToolState } from './initialState';import {installedImplicitBuiltinSkillIds,+ legacyDisabledBuiltinSkillsForRun,UNINSTALLED_BUILTIN_TOOLS_KEY,uninstalledBuiltinToolsResource,} from './projection';@@ -114,6 +115,22 @@ describe('uninstalled builtin tools replica', () => {expect(skills(oldAgent)).toEqual([]);});+ it('applies the stored uninstall to old agent entries and honors only the new choice on this agent', async () => {+ const id = 'lobe-artifacts';+ vi.mocked(userService.getUserState).mockResolvedValue(+ userState({ uninstalledBuiltinTools: [id] }),+ );+ await useToolStore.getState().getUninstalledBuiltinToolsForRun();+ const state = useToolStore.getState();+ expect(legacyDisabledBuiltinSkillsForRun(state, [id])).toEqual([id]);+ expect(+ legacyDisabledBuiltinSkillsForRun(state, [+ { builtinOverride: true, identifier: id, mode: 'auto' },+ ]),+ ).toEqual([]);+ expect(legacyDisabledBuiltinSkillsForRun(state, [])).toEqual([id]);+ });+it('withholds on-demand tools after a failed read and retries on the next send', async () => {vi.mocked(userService.getUserState).mockRejectedValueOnce(new Error('settings unavailable'))diff --git a/src/store/tool/slices/builtin/selectors.test.ts b/src/store/tool/slices/builtin/selectors.test.tsindex 3e58cc2c593..1463b14ee65 100644--- a/src/store/tool/slices/builtin/selectors.test.ts+++ b/src/store/tool/slices/builtin/selectors.test.ts@@ -39,6 +39,23 @@ const hiddenToolsState = () => ({});describe('builtinToolSelectors', () => {+ it('keeps a bundled skill available to the agent picker after a legacy uninstall', () => {+ const state = {+ ...initialState,+ builtinSkills: [mockBuiltinSkill],+ uninstalledBuiltinTools: [mockBuiltinSkill.identifier],+ };+ expect(builtinToolSelectors.installedBuiltinSkills(state)).toEqual([mockBuiltinSkill]);+ });++ it('offers the calculator in agent tools even when legacy settings list it as uninstalled', () => {+ const id = 'lobe-calculator';+ const state = { ...initialState, uninstalledBuiltinTools: [id] };+ expect(+ builtinToolSelectors.metaListIncludingHidden(state).map((item) => item.identifier),+ ).toContain(id);+ });+describe('metaList', () => {it('should return meta list with builtin tools and skills', () => {const state = {diff --git a/src/store/tool/slices/builtin/selectors.ts b/src/store/tool/slices/builtin/selectors.tsindex 9a5e818e719..8d60d74cfce 100644--- a/src/store/tool/slices/builtin/selectors.ts+++ b/src/store/tool/slices/builtin/selectors.ts@@ -1,5 +1,6 @@import {alwaysOnToolIds,+ isOnDemandBuiltinTool,manualModeExcludeToolIds,runtimeManagedToolIds,} from '@lobechat/builtin-tools';@@ -137,7 +138,10 @@ const buildVisibleMetaList = (if (!isBuiltinToolAvailableInCurrentEnv(item.identifier)) return false;// Exclude uninstalled tools- if (uninstalledBuiltinTools.includes(item.identifier)) {+ if (+ !isOnDemandBuiltinTool(item.identifier) &&+ uninstalledBuiltinTools.includes(item.identifier)+ ) {return false;}@@ -146,12 +150,7 @@ const buildVisibleMetaList = (.map(toBuiltinMeta);const skillMetas = (s.builtinSkills || [])- .filter((skill) => {- if (!isBuiltinSkillAvailableInCurrentEnv(skill.identifier)) return false;- if (uninstalledBuiltinTools.includes(skill.identifier)) return false;-- return true;- })+ .filter((skill) => isBuiltinSkillAvailableInCurrentEnv(skill.identifier)).map(toSkillMeta);const agentSkillMetas = agentSkillsSelectors.agentSkillMetaList(s);@@ -223,11 +222,7 @@ const discoverableMetaList = (s: ToolStoreState): LobeToolMeta[] => {const { uninstalledBuiltinTools } = s;const skillMetas = (s.builtinSkills || [])- .filter((skill) => {- if (!isBuiltinSkillAvailableInCurrentEnv(skill.identifier)) return false;- if (uninstalledBuiltinTools.includes(skill.identifier)) return false;- return true;- })+ .filter((skill) => isBuiltinSkillAvailableInCurrentEnv(skill.identifier)).map(toSkillMeta);const agentSkillMetas = agentSkillsSelectors.agentSkillMetaList(s);@@ -236,7 +231,11 @@ const discoverableMetaList = (s: ToolStoreState): LobeToolMeta[] => {.filter((item) => {// Exclude pure infrastructure tools (never user-facing)if (item.discoverable === false) return false;- if (uninstalledBuiltinTools.includes(item.identifier)) return false;+ if (+ !isOnDemandBuiltinTool(item.identifier) &&+ uninstalledBuiltinTools.includes(item.identifier)+ )+ return false;return true;}).map(toBuiltinMeta);@@ -255,7 +254,11 @@ const installedAllMetaList = (s: ToolStoreState): LobeToolMetaWithAvailability[]const builtinMetas = s.builtinTools.filter((item) => {if (EXCLUDED_TOOLS.has(item.identifier)) return false;- if (uninstalledBuiltinTools.includes(item.identifier)) return false;+ if (+ !isOnDemandBuiltinTool(item.identifier) &&+ uninstalledBuiltinTools.includes(item.identifier)+ )+ return false;return true;})@@ -278,7 +281,11 @@ const installedProfileConfigurableMetaList =const builtinMetas = s.builtinTools.filter((tool) => isProfileConfigurableBuiltinTool(tool, options))- .filter((item) => !uninstalledBuiltinTools.includes(item.identifier))+ .filter(+ (item) =>+ isOnDemandBuiltinTool(item.identifier) ||+ !uninstalledBuiltinTools.includes(item.identifier),+ ).map(toBuiltinMetaWithAvailability);return [...builtinMetas, ...getComposioMetasWithAvailability(s)];@@ -296,15 +303,10 @@ const nonProfileConfigurableBuiltinToolIds =.map((tool) => tool.identifier);/**- * Get installed builtin skills (excludes uninstalled ones)+ * Bundled skills available on this client, including those awaiting an agent opt-in.*/const installedBuiltinSkills = (s: ToolStoreState): BuiltinSkillManifest[] =>- (s.builtinSkills || []).filter((skill) => {- if (!isBuiltinSkillAvailableInCurrentEnv(skill.identifier)) return false;- if (s.uninstalledBuiltinTools.includes(skill.identifier)) return false;-- return true;- });+ (s.builtinSkills || []).filter((skill) => isBuiltinSkillAvailableInCurrentEnv(skill.identifier));/*** Get uninstalled builtin tool identifiers