🤯 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(agent-share): let creators grant skills to share visitors (#19837)
YuTengjing5420ca39550d
diff --git a/apps/server/src/routers/lambda/agentShare.ts b/apps/server/src/routers/lambda/agentShare.tsindex e2074e7583d..f1376d99c5c 100644--- a/apps/server/src/routers/lambda/agentShare.ts+++ b/apps/server/src/routers/lambda/agentShare.ts@@ -1,15 +1,20 @@+import { builtinSkills } from '@lobechat/builtin-skills';import {AGENT_SHARE_DEFAULT_MAX_FILE_STORAGE,AGENT_SHARE_VISITOR_TOPIC_LIST_LIMIT,} from '@lobechat/const';+import { assembleSkillPool } from '@lobechat/mecha';+import { getActivePluginIds, getDisabledPluginIds } from '@lobechat/types';import { TRPCError } from '@trpc/server';import { z } from 'zod';import { getAgentShareMonthlySpend } from '@/business/server/agent-share/spendGate';import { withRbacPermission } from '@/business/server/trpc-middlewares/rbacPermission';import { wsCompatProcedure } from '@/business/server/trpc-middlewares/workspaceAuth';+import { AgentModel } from '@/database/models/agent';import { AgentShareModel } from '@/database/models/agentShare';import { AgentShareProfileModel } from '@/database/models/agentShareProfile';+import { AgentSkillModel } from '@/database/models/agentSkill';import { FileModel } from '@/database/models/file';import { RbacModel } from '@/database/models/rbac';import { TopicModel } from '@/database/models/topic';@@ -17,6 +22,7 @@ import type { LobeChatDatabase } from '@/database/type';import { router } from '@/libs/trpc/lambda';import { serverDatabase } from '@/libs/trpc/lambda/middleware';import { AgentService } from '@/server/services/agent';+import { AgentDocumentsService } from '@/server/services/agentDocuments';import { assertCanPerformResourceAction } from '@/server/services/resourcePermission';import { assertAgentShareCreationEnabled } from './_helpers/agentShareFeatureGate';@@ -82,6 +88,18 @@ export const agentShareConfigSchema = zmonthlySpendLimit: z.number().nonnegative().optional(),showErrorDetails: z.boolean().optional(),showModelInfo: z.boolean().optional(),+ /**+ * Skill identifiers the creator opened to visitors. An empty array is+ * accepted rather than rejected: unticking the last skill is a normal+ * write, and it reads the same as never having configured the field —+ * no skill granted.+ */+ skillGrants: z+ .array(z.string().trim().min(1))+ .refine((ids) => new Set(ids).size === ids.length, {+ message: 'Duplicate skill identifier in skillGrants',+ })+ .optional(),/*** At most one entry per identifier: two entries for the same tool would* make the effective grant depend on the merge rule in@@ -332,6 +350,86 @@ export const agentShareRouter = router({offset: input.offset,});}),+ /**+ * Skills this agent could offer a visitor — the candidate list behind the+ * share settings skill picker, and the set `shareConfig.skillGrants` entries+ * are chosen from.+ *+ * Built through the SAME `assembleSkillPool` a real run uses, on the same+ * server-side sources, so the picker cannot offer a skill the run would never+ * assemble (nor hide one it would). Three deliberate differences from a run:+ *+ * - no `shareAllowedIds` — the whole point is to list what COULD be granted;+ * - no project/device skills — those are discovered on the execution device's+ * filesystem, and a visitor run never routes a device;+ * - `canExecuteOnDevice: false`, for the same reason.+ *+ * Skills are NOT filtered to the agent's pinned set: a skill is on-demand by+ * default, so an unpinned skill is exactly the normal case. `manual` mode is+ * the one exception, and `assembleSkillPool` applies it from+ * `enabledPluginIds` on its own.+ *+ * Authorization matches the other share reads: `assertCanManageAgentShare`+ * for the workspace case, then `requireShare` on the ownership-scoped+ * `getByAgentId`. Both matter here — this lists the CREATOR's whole skill+ * catalog, so a workspace member who cannot manage the Agent must not reach+ * the reads below.+ */+ listGrantableSkills: agentShareProcedure.input(agentIdInput).query(async ({ input, ctx }) => {+ await assertCanManageAgentShare(ctx, input.agentId);+ requireShare(await ctx.agentShareModel.getByAgentId(input.agentId));++ const workspaceId = ctx.workspaceId ?? undefined;+ const agentConfig = await new AgentModel(+ ctx.serverDB,+ ctx.userId,+ workspaceId,+ ).getAgentConfigById(input.agentId);++ const [dbSkills, agentSkills] = await Promise.all([+ new AgentSkillModel(ctx.serverDB, ctx.userId, workspaceId)+ .findAll()+ .then((result) => result.data),+ // A bundle-less agent is the common case and throws nothing; a genuine+ // failure here must not take the whole picker down with it — the DB and+ // builtin skills are still grantable.+ new AgentDocumentsService(ctx.serverDB, ctx.userId, workspaceId)+ .getAgentSkills(input.agentId)+ .catch(() => []),+ ]);++ const { skills } = assembleSkillPool(+ {+ agentSkills: agentSkills.map((skill) => ({+ description: skill.description,+ identifier: skill.identifier,+ name: skill.name,+ })),+ builtin: builtinSkills.map((skill) => ({+ description: skill.description,+ identifier: skill.identifier,+ name: skill.name,+ })),+ db: dbSkills.map((skill) => ({+ description: skill.description ?? '',+ identifier: skill.identifier,+ name: skill.name,+ })),+ },+ {+ canExecuteOnDevice: false,+ disabledIds: getDisabledPluginIds(agentConfig?.plugins ?? undefined),+ enabledPluginIds: getActivePluginIds(agentConfig?.plugins ?? undefined),+ skillActivateMode: agentConfig?.chatConfig?.skillActivateMode,+ },+ );++ return skills.map((skill) => ({+ description: skill.description,+ identifier: skill.identifier,+ name: skill.name,+ }));+ }),updateShareConfig: agentShareProcedure.input(diff --git a/apps/server/src/services/aiAgent/pipeline/operationPrep.ts b/apps/server/src/services/aiAgent/pipeline/operationPrep.tsindex 138fa84d482..f1e39249610 100644--- a/apps/server/src/services/aiAgent/pipeline/operationPrep.ts+++ b/apps/server/src/services/aiAgent/pipeline/operationPrep.ts@@ -31,7 +31,7 @@ import { FileService } from '@/server/services/file';import { pruneRegeneratedBranch } from '../pruneRegeneratedBranch';import { resolveDeviceWorkingDirectoryConfig } from '../resolveDeviceWorkingDirectory';-import { applyShareGateToToolSet, filterPluginsByShareGate } from '../shareGate';+import { applyShareGateToToolSet, filterSkillsByShareGate } from '../shareGate';import type { ExecRunContext, InternalExecAgentParams, ResolvedWorkspaceInit } from '../types';import { isWorkspaceCacheFresh, upsertWorkspaceScan } from '../workspaceInitCache';import type { ToolDiscoveryResult } from './toolDiscovery';@@ -801,12 +801,14 @@ export const prepareOperation = async (// device-only builtin gate are the shared rules in `@lobechat/mecha`; this// pipeline supplies the four sources and the run's facts.//- // A shared run only sees skills its share configuration allows. The- // allowlist is an id-list intersection (`filterPluginsByShareGate`), not- // tool-specific, so the pool stays the single enforcement point — an- // empty or missing allowlist collapses it to nothing.+ // A shared run only sees skills its share configuration allows —+ // `shareConfig.skillGrants`, the creator's explicit per-skill list, NOT the+ // tool picker (`filterSkillsByShareGate`). The pool is the FIRST+ // enforcement point, not the only one: `activateSkill` takes a+ // model-supplied name, so the skill runtime re-checks the same grant at+ // load time.const shareAllowedSkillIds = shareGate- ? filterPluginsByShareGate(+ ? filterSkillsByShareGate([...projectMetas, ...dbMetas, ...agentSkillMetas, ...builtinMetas].map((skill) => skill.identifier,),@@ -814,6 +816,16 @@ export const prepareOperation = async (): undefined;+ // Whether a skill is PINNED is the agent's own configuration; the share+ // only decides whether the visitor may reach it. `agentPlugins` has already+ // been narrowed by the TOOL grants (`filterPluginsByShareGate` in+ // `toolDiscovery`), which drops a skill the creator granted as a skill+ // rather than as a tool — leaving it un-pinned for the visitor (no content+ // injection) and, under `manual` mode, dropped from the pool entirely. Add+ // back exactly the ids that are both genuinely pinned on the agent AND+ // allowed by this share's skill grants; nothing else widens.+ const shareEnabledSkillIds = shareAllowedSkillIds?.filter((id) => pinnedSkillIds.has(id)) ?? [];+// Device-only builtin skills are gated on the run's execution plan, not// the compile-time `isDesktop` constant (always false on the server). Use// the device-CAPABLE plan rather than `activeDeviceId`: a@@ -832,7 +844,7 @@ export const prepareOperation = async ({canExecuteOnDevice: executionPlan ? isDeviceCapablePlan(executionPlan) : false,disabledIds: disabledPluginIds,- enabledPluginIds: agentPlugins ?? [],+ enabledPluginIds: [...new Set([...(agentPlugins ?? []), ...shareEnabledSkillIds])],shareAllowedIds: shareAllowedSkillIds,skillActivateMode: agentConfig.chatConfig?.skillActivateMode,},diff --git a/apps/server/src/services/aiAgent/pipeline/startOperation.ts b/apps/server/src/services/aiAgent/pipeline/startOperation.tsindex f97d1d1e20e..98ce1170faf 100644--- a/apps/server/src/services/aiAgent/pipeline/startOperation.ts+++ b/apps/server/src/services/aiAgent/pipeline/startOperation.ts@@ -172,6 +172,12 @@ export const startOperation = async (// creation time. See `AgentShareGate.shareId`'s JSDoc for why the// id itself is the revocation token.shareId: shareGate.shareId,+ // Mirrors `shareConfig.skillGrants` so the skill runtime can+ // re-check every load against the SAME allowlist the skill pool was+ // assembled from. Assembly alone is not enough: `activateSkill`+ // resolves a model-supplied skill NAME, so a name the pool never+ // offered still reaches the runtime.+ skillGrants: shareGate.shareConfig.skillGrants,showErrorDetails: shareGate.shareConfig.showErrorDetails,showModelInfo: shareGate.shareConfig.showModelInfo,visitorUserId: shareGate.visitorUserId,diff --git a/apps/server/src/services/aiAgent/shareGate.test.ts b/apps/server/src/services/aiAgent/shareGate.test.tsindex 80c054f6a90..686c535b1d5 100644--- a/apps/server/src/services/aiAgent/shareGate.test.ts+++ b/apps/server/src/services/aiAgent/shareGate.test.ts@@ -21,6 +21,12 @@ import {MemoryIdentifier,memoryReadOnlySystemPrompt,} from '@lobechat/builtin-tool-memory';+import {+ agentShareSystemPrompt as skillsAgentShareSystemPrompt,+ SkillsApiName,+ SkillsIdentifier,+ SkillsManifest,+} from '@lobechat/builtin-tool-skills';import { TopicReferenceIdentifier } from '@lobechat/builtin-tool-topic-reference';import {AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS,@@ -35,6 +41,7 @@ import {applyShareGateToAgentConfig,applyShareGateToToolSet,filterPluginsByShareGate,+ filterSkillsByShareGate,getShareGrantActivatedPluginIds,isShareBlockedBuiltinDispatch,isShareBlockedDataToolCall,@@ -143,6 +150,31 @@ describe('filterPluginsByShareGate', () => {});});+describe('filterSkillsByShareGate', () => {+ it('keeps only the skills the creator named', () => {+ const gate = buildGate({ skillGrants: ['pdf-report', 'brand-voice'] });++ expect(filterSkillsByShareGate(['pdf-report', 'internal-audit', 'brand-voice'], gate)).toEqual([+ 'pdf-report',+ 'brand-voice',+ ]);+ });++ it('cannot turn an ordinary tool grant into a skill grant', () => {+ // `toolGrants` is never read as a skill list. Tool and skill ids share one+ // namespace, so a tool grant that happens to name a real skill id must not+ // widen the skill pool either.+ const gate = buildGate({ toolGrants: [{ identifier: 'pdf-report' }] });++ expect(filterSkillsByShareGate(['pdf-report'], gate)).toEqual([]);+ });++ it('exposes no skills when the share grants nothing at all', () => {+ expect(filterSkillsByShareGate(['pdf-report'], buildGate())).toEqual([]);+ expect(filterSkillsByShareGate(['pdf-report'], buildGate({ skillGrants: [] }))).toEqual([]);+ });+});+describe('getShareGrantActivatedPluginIds', () => {it('activates Agent Documents only after the owner grants it for this Share', () => {expect(getShareGrantActivatedPluginIds(buildGate())).toEqual([]);@@ -209,6 +241,10 @@ describe('AGENT_SHARE_NO_DATA_GRANT_BUILTIN_IDENTIFIERS', () => {const maximalPermissions = {allowReadMemory: true,knowledgeBaseIds: ['kb1'],+ // `lobe-skills` has its own opt-in — the skill list, not `toolGrants` — so+ // "maximal" has to name a skill or the tool reads as unconditionally+ // blocked and lands in this set by accident.+ skillGrants: ['pdf-report'],toolGrants: [{ identifier: AgentDocumentsIdentifier }],};@@ -566,6 +602,75 @@ describe('applyShareGateToToolSet', () => {expect(Object.keys(listDocumentsTool!.function.parameters.properties)).toEqual([]);});+ // `lobe-skills` is an always-on builtin, so it reaches the tool set without+ // ever appearing in the owner's `toolGrants`. Its opt-in is the SKILL list:+ // the gate derives a synthetic tool grant from `skillGrants`, then narrows it+ // to the two read APIs. Regression for LOBE-14266, where the tool was simply+ // absent from the allowlist and every skill-driven shared agent broke.+ const buildSkillsToolSet = () => {+ const toolSet = buildToolSet([+ {+ apis: Object.values(SkillsApiName).map((name) => ({ name })),+ identifier: SkillsIdentifier,+ },+ ]);+ toolSet.manifestMap[SkillsIdentifier] = SkillsManifest;+ toolSet.tools = generateToolsFromManifest(SkillsManifest);+ return toolSet;+ };++ it('keeps lobe-skills with only its read APIs once the owner grants any skill', () => {+ const toolSet = buildSkillsToolSet();++ applyShareGateToToolSet(toolSet, buildGate({ skillGrants: ['pdf-report'] }));++ const manifest = toolSet.manifestMap[SkillsIdentifier];+ expect(manifest.api.map((api) => api.name).sort()).toEqual(+ [SkillsApiName.activateSkill, SkillsApiName.readReference].sort(),+ );+ // The rewritten role must replace the full one: the original documents a+ // runCommand/execScript decision tree for APIs that are no longer callable.+ expect(manifest.systemRole).toBe(skillsAgentShareSystemPrompt);+ expect(manifest.systemRole).not.toContain('execScript');+ expect(toolSet.enabledToolIds).toContain(SkillsIdentifier);+ expect(toolSet.tools!.map((tool: any) => tool.function.name).sort()).toEqual(+ [+ toolName(SkillsIdentifier, SkillsApiName.activateSkill),+ toolName(SkillsIdentifier, SkillsApiName.readReference),+ ].sort(),+ );+ });++ it('drops lobe-skills entirely when the owner revoked every skill', () => {+ const toolSet = buildSkillsToolSet();++ applyShareGateToToolSet(toolSet, buildGate({ skillGrants: [] }));++ expect(toolSet.manifestMap[SkillsIdentifier]).toBeUndefined();+ expect(toolSet.enabledToolIds).toEqual([]);+ expect(toolSet.tools).toEqual([]);+ });++ it('drops lobe-skills on a share that grants nothing at all', () => {+ const toolSet = buildSkillsToolSet();++ applyShareGateToToolSet(toolSet, buildGate());++ expect(toolSet.manifestMap[SkillsIdentifier]).toBeUndefined();+ expect(toolSet.enabledToolIds).toEqual([]);+ });++ it('does not let an ordinary tool grant turn lobe-skills on', () => {+ // The skill list is the only opt-in. Granting some unrelated tool says+ // nothing about skills, so the Skills tool stays out of the visitor's set.+ const toolSet = buildSkillsToolSet();++ applyShareGateToToolSet(toolSet, buildGate({ toolGrants: [{ identifier: 'web-search' }] }));++ expect(toolSet.manifestMap[SkillsIdentifier]).toBeUndefined();+ expect(toolSet.enabledToolIds).toEqual([]);+ });+it('preserves the restricted Agent Documents schema for a per-API grant', () => {const toolSet = buildToolSet([{@@ -919,6 +1024,34 @@ describe('isShareBlockedBuiltinDispatch', () => {).toBe(true);});+ it('allows the two Skills read APIs but blocks the exec-class and export ones', () => {+ const enabled = { skillGrants: ['pdf-report'] };++ for (const apiName of [SkillsApiName.activateSkill, SkillsApiName.readReference]) {+ expect(isShareBlockedBuiltinDispatch(enabled, SkillsIdentifier, apiName)).toBe(false);+ }+ // runCommand/execScript run arbitrary code on the creator's account and+ // exportFile writes to the creator's file store — all three are phase-2+ // work, gated here rather than merely omitted from the assembled manifest.+ for (const apiName of [+ SkillsApiName.runCommand,+ SkillsApiName.execScript,+ SkillsApiName.exportFile,+ ]) {+ expect(isShareBlockedBuiltinDispatch(enabled, SkillsIdentifier, apiName)).toBe(true);+ }+ });++ it('blocks every Skills API when the owner revoked or never granted a skill', () => {+ // A tool grant is included on purpose: `toolGrants` never authorizes a+ // skill, so it cannot unblock these APIs either.+ for (const permissions of [{}, { skillGrants: [] }, { toolGrants: [{ identifier: 'x' }] }]) {+ expect(+ isShareBlockedBuiltinDispatch(permissions, SkillsIdentifier, SkillsApiName.activateSkill),+ ).toBe(true);+ }+ });+it('ignores non-builtin identifiers entirely', () => {expect(isShareBlockedBuiltinDispatch({}, 'some-mcp-server', 'anything')).toBe(false);});diff --git a/apps/server/src/services/aiAgent/shareGate.ts b/apps/server/src/services/aiAgent/shareGate.tsindex 6d7f5655031..08f478d82c1 100644--- a/apps/server/src/services/aiAgent/shareGate.ts+++ b/apps/server/src/services/aiAgent/shareGate.ts@@ -14,6 +14,11 @@ import {systemPromptWithoutSubAgent,} from '@lobechat/builtin-tool-lobe-agent';import { MEMORY_WRITE_API_NAMES, MemoryIdentifier } from '@lobechat/builtin-tool-memory';+import {+ AGENT_SHARE_SKILL_API_NAMES,+ SkillsIdentifier,+ SkillsManifest,+} from '@lobechat/builtin-tool-skills';import {AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS,builtinTools,@@ -23,6 +28,7 @@ import {hasShareToolGrant,isShareToolApiGranted,PLUGIN_SCHEMA_SEPARATOR,+ resolveShareAllowedSkillIds,resolveShareToolGrants,type ShareToolGrant,} from '@lobechat/const';@@ -95,6 +101,21 @@ export const filterPluginsByShareGate = (pluginIds: string[], gate: AgentShareGareturn pluginIds.filter((id) => hasShareToolGrant(grants, id));};+/**+ * Intersect a run's candidate SKILL ids with the share's skill grants.+ *+ * Skills are governed by `shareConfig.skillGrants`, not `toolGrants`: a skill+ * grant also authorizes the no-tool path (a pinned skill's body is injected+ * straight into context), so it cannot be expressed as a grant on the+ * `lobe-skills` tool entry. See {@link resolveShareAllowedSkillIds} for the+ * default-closed semantics.+ *+ * Kept next to {@link filterPluginsByShareGate} so the two read as the pair+ * they are; callers must not use the plugin filter for skill ids.+ */+export const filterSkillsByShareGate = (skillIds: string[], gate: AgentShareGate): string[] =>+ resolveShareAllowedSkillIds(skillIds, gate.shareConfig);+/*** Builtins whose Share grant is also their runtime opt-in.*@@ -158,9 +179,52 @@ export interface ShareDataToolPermissions {* below stays wired should a knowledge-base grant return.*/knowledgeBaseIds?: string[];+ /**+ * The share's `skillGrants`. Read here only to answer "does this share+ * authorize any skill at all", which is what turns the `lobe-skills` TOOL on;+ * which individual skills it may load is decided by+ * {@link filterSkillsByShareGate} at assembly and re-checked at load time in+ * the skill runtime.+ */+ skillGrants?: string[];toolGrants?: AgentShareToolGrant[];}+/**+ * Whether this share authorizes any skill at all — the condition under which+ * the `lobe-skills` tool itself becomes available to a visitor.+ *+ * Skills are NOT picked in the tool picker, so no creator ever writes a+ * `lobe-skills` entry into `toolGrants`; the skill list IS the opt-in, the same+ * way {@link getShareGrantActivatedPluginIds} lets the Documents grant double as+ * that tool's runtime opt-in. Without this, a share could list skills the+ * visitor's model has no tool to load.+ */+const hasShareSkillAuthorization = (permissions: ShareDataToolPermissions): boolean =>+ (permissions.skillGrants?.length ?? 0) > 0;++/**+ * `resolveShareToolGrants` plus the grants that are implied rather than picked.+ *+ * Today that is only `lobe-skills`, whose opt-in lives in `skillGrants` (see+ * {@link hasShareSkillAuthorization}). The synthetic grant is toolset-level+ * (`'all'`) on purpose: narrowing the Skills tool down to its two visitor-safe+ * APIs is {@link DATA_TOOL_ACCESS_RULES}' job, and expressing it twice would+ * let the two lists drift.+ *+ * Every gate that asks "did the creator grant this identifier" must go through+ * here, or the tool passes one layer and is rejected by the next.+ */+const resolveEffectiveShareToolGrants = (+ permissions: ShareDataToolPermissions,+): Map<string, ShareToolGrant> => {+ const grants = resolveShareToolGrants(permissions.toolGrants);++ if (hasShareSkillAuthorization(permissions)) grants.set(SkillsIdentifier, 'all');++ return grants;+};+/*** See `AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS`'s JSDoc in* `@lobechat/builtin-tools` for the full per-identifier evidence. Aliased here@@ -291,6 +355,26 @@ const DATA_TOOL_ACCESS_RULES: Record<string, DataToolAccessRule> = {// write API the gate strips anyway.writeApiNames: [...MEMORY_WRITE_API_NAMES],},+ [SkillsIdentifier]: {+ // The grant is the creator's skill list, not a tool-picker entry — see+ // `hasShareSkillAuthorization`. `'read'` is the widest a share can reach:+ // the two surviving APIs only read skill content, and WHICH skills they may+ // read is enforced separately (`filterSkillsByShareGate` at assembly, the+ // skill runtime's own check at load time — the latter is the real gate,+ // since `activateSkill` resolves a model-supplied name).+ grant: (permissions) => (hasShareSkillAuthorization(permissions) ? 'read' : 'none'),+ // Derived as "everything outside the visitor-safe set" rather than listed,+ // so a skill API added later is denied by default. Today that resolves to+ // `runCommand` / `execScript` / `exportFile`: the first two declare+ // `humanIntervention: 'required'` and are therefore ALSO stripped by+ // `applyShareGateToInterventionRequiredApis`, but they are named here on+ // purpose — that strip exists to honor an approval policy, and the day+ // Agent Share grows a real approval step it must be a deliberate decision+ // to open them, not a side effect of the policy check going quiet.+ writeApiNames: SkillsManifest.api+ .map((api) => api.name)+ .filter((apiName) => !AGENT_SHARE_SKILL_API_NAMES.has(apiName)),+ },};/**@@ -382,7 +466,7 @@ export const isShareBlockedBuiltinDispatch = (// The owner's picker must grant this identifier at all (toolset-level or// naming this specific `apiName`) — a grant scoped to a DIFFERENT api on// the same identifier does not authorize this call.- if (!isShareToolApiGranted(resolveShareToolGrants(agentShare.toolGrants), identifier, apiName))+ if (!isShareToolApiGranted(resolveEffectiveShareToolGrants(agentShare), identifier, apiName))return true;// Sub-agent dispatch has no humanIntervention config to catch it, and the@@ -470,7 +554,7 @@ const applyShareGateToDataToolAccess = (toolSet: ShareGateToolSet, gate: AgentSh* exempted; a share with no configured tools is a plain-chat run).*/export const applyShareGateToToolSet = (toolSet: ShareGateToolSet, gate: AgentShareGate): void => {- const grants = resolveShareToolGrants(gate.shareConfig.toolGrants);+ const grants = resolveEffectiveShareToolGrants(gate.shareConfig);// A tool must clear BOTH gates: the owner's own `toolGrants` picker// (`grants` — toolset-level OR scoped to at least one API), AND — for@@ -709,10 +793,6 @@ const applyShareGateToInterventionRequiredApis = (toolSet: ShareGateToolSet): vo* creator's live agent. `installPlugin` installs an arbitrary market MCP* plugin onto it as the creator, with no consent step.*- * - `lobe-skills`: `findById`/`findByName` resolve any skill across the- * creator's ENTIRE personal skill catalog, scoped only by an opt-out- * `disabledSkillIds` set.- ** - `lobe-brief`: `createBrief` unconditionally persists a row via* `BriefModel.create` under `context.userId` (the creator) from* model-supplied content, with no intervention marker to gate it.@@ -788,6 +868,33 @@ const applyShareGateToInterventionRequiredApis = (toolSet: ShareGateToolSet): vo* `lobe-creds` stays denied above so nothing ever writes `~/.creds/env`* into that session either. No creator credential or JWT is therefore* reachable from inside a visitor's sandbox command.+ *+ * - `lobe-skills`: the tool DOES resolve skills out of the creator's personal+ * catalog — that is what it is for, and it was denied for exactly that reason+ * until the catalog stopped being the unit of authorization. What changed is+ * that the creator now names individual skills (`shareConfig.skillGrants`),+ * so the reachable set is an explicit allowlist instead of "everything the+ * creator owns minus an opt-out `disabledSkillIds` set". Three things make+ * that allowlist the real boundary rather than a UI suggestion:+ *+ * 1. the operation's skill pool is intersected with it at assembly+ * ({@link filterSkillsByShareGate}, applied in `operationPrep`);+ * 2. `activateSkill` resolves a MODEL-SUPPLIED name, so assembly alone would+ * be bypassable — the skill runtime re-checks the allowlist at load time,+ * on every path that opens skill content (name/id resolution AND the+ * archive/resource loads that `execScript` and `readReference` reach+ * through). A name outside the grant fails there even if the model+ * invents it;+ * 3. only `activateSkill` / `readReference` survive at all+ * (`AGENT_SHARE_SKILL_API_NAMES`, enforced by the rule above): both are+ * pure reads of granted skill content. The exec-class APIs, which are what+ * would turn a granted skill into arbitrary code running as the creator,+ * stay blocked.+ *+ * The grant deliberately carries whatever the granted skill itself does —+ * a creator who opens a skill opens that skill's instructions, and that is+ * the premise of Agent Share, not a hole in it. The gate's job is to execute+ * the grant exactly, not to second-guess which skills a creator should share.*//**diff --git a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/skills.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/skills.test.tsindex f9ff5277063..affed7fc147 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/skills.test.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/skills.test.ts@@ -338,6 +338,7 @@ describe('skillsRuntime', () => {'lh agent edit agt_123 -s "new prompt"','user-1','workspace-1',+ false,);expect(mocks.sandboxService.callTool).toHaveBeenCalledWith('runCommand', {command: 'LOBEHUB_WORKSPACE_ID=workspace-1 npx -y @lobehub/cli agent edit agt_123',@@ -371,6 +372,7 @@ describe('skillsRuntime', () => {'lh agent edit agt_123 -s "new prompt"','user-1','workspace-1',+ false,);});@@ -405,6 +407,7 @@ describe('skillsRuntime', () => {'lh agent edit agt_123 -t x','user-1','workspace-1',+ false,);expect(mocks.sandboxService.callTool).toHaveBeenCalledWith('execScript',@@ -526,6 +529,153 @@ describe('skillsRuntime', () => {});});+ /**+ * Agent Share's per-skill allowlist, enforced where the content is actually+ * handed out rather than only where the tool is assembled. The gate upstream+ * already trims `<available_skills>`, but the model can name any string, and+ * a DB miss falls through to the builtin / agent-document lists — so every+ * door has to answer the same question.+ */+ describe('agent share skill grants', () => {+ const buildVisitorRuntime = async (skillGrants: string[]) => {+ const { skillsRuntime } = await import('../skills');++ return skillsRuntime.factory({+ agentId: 'agent-1',+ agentShareVisitor: { skillGrants },+ serverDB: {} as never,+ toolManifestMap: {},+ topicId: 'topic-1',+ userId: 'user-1',+ } as never);+ };++ beforeEach(() => {+ mocks.findByName.mockImplementation(async (name: string) =>+ name === 'user-skill'+ ? {+ content: '# User skill',+ id: 'user-skill-id',+ identifier: 'user-skill-identifier',+ name: 'user-skill',+ resources: [{ path: 'notes.md' }],+ }+ : undefined,+ );+ mocks.findById.mockImplementation(async (id: string) =>+ id === 'user-skill-id'+ ? {+ content: '# User skill',+ id: 'user-skill-id',+ identifier: 'user-skill-identifier',+ name: 'user-skill',+ resources: [{ path: 'notes.md' }],+ }+ : undefined,+ );+ mocks.readResource.mockResolvedValue({ content: 'secret notes', path: 'notes.md' });+ });++ it('activates a DB skill the creator granted', async () => {+ const runtime = await buildVisitorRuntime(['user-skill-identifier']);++ expect((await runtime.activateSkill({ name: 'user-skill' })).success).toBe(true);+ });++ it('refuses a DB skill the creator did not grant, even though the row exists', async () => {+ const runtime = await buildVisitorRuntime(['some-other-skill']);++ expect((await runtime.activateSkill({ name: 'user-skill' })).success).toBe(false);+ });++ it('refuses every skill when the creator revoked all of them', async () => {+ const runtime = await buildVisitorRuntime([]);++ expect((await runtime.activateSkill({ name: 'user-skill' })).success).toBe(false);+ });++ it('refuses readReference on an ungranted skill', async () => {+ // A second door into the same content: `readReference` streams the+ // skill's attached files, so blocking only `activateSkill` would leave the+ // reference files readable to any visitor who guesses a path.+ const runtime = await buildVisitorRuntime(['some-other-skill']);++ const result = await runtime.readReference({ id: 'user-skill', path: 'notes.md' });++ expect(result.success).toBe(false);+ expect(mocks.readResource).not.toHaveBeenCalled();+ });++ it('allows readReference on a granted skill', async () => {+ // Pins the test above to the GRANT rather than to a lookup miss.+ const runtime = await buildVisitorRuntime(['user-skill-identifier']);++ const result = await runtime.readReference({ id: 'user-skill', path: 'notes.md' });++ expect(result.success).toBe(true);+ expect(result.content).toBe('secret notes');+ });++ it('does not leak ungranted skill names in the not-found catalog', async () => {+ // `activateSkill`'s failure message echoes the full skill list back to the+ // model. Unfiltered, a visitor learns the names and descriptions of every+ // skill the creator owns just by guessing one wrong name.+ mocks.findAll.mockResolvedValue({+ data: [+ { description: 'Internal audit checklist', identifier: 'secret', name: 'secret-skill' },+ { description: 'Public', identifier: 'user-skill-identifier', name: 'user-skill' },+ ],+ total: 2,+ });+ const runtime = await buildVisitorRuntime(['user-skill-identifier']);++ const result = await runtime.activateSkill({ name: 'no-such-skill' });++ expect(result.success).toBe(false);+ expect(result.content).not.toContain('secret-skill');+ expect(result.content).not.toContain('Internal audit checklist');+ expect(result.content).toContain('user-skill');+ });++ it('drops ungranted agent-document skills before they reach the runtime', async () => {+ // The DB lookup misses for these, so they resolve off the injected+ // builtin list instead — a fall-through path the DB check never sees.+ mocks.getAgentSkills.mockResolvedValue([+ {+ content: '# Granted bundle',+ description: 'granted',+ identifier: 'agent-skills:granted',+ name: 'granted-bundle',+ },+ {+ content: '# Secret bundle',+ description: 'secret',+ identifier: 'agent-skills:secret',+ name: 'secret-bundle',+ },+ ]);+ const runtime = await buildVisitorRuntime(['agent-skills:granted']);++ expect((await runtime.activateSkill({ name: 'granted-bundle' })).success).toBe(true);+ expect((await runtime.activateSkill({ name: 'secret-bundle' })).success).toBe(false);+ });++ it('leaves a non-share run completely unfiltered', async () => {+ // No `agentShareVisitor` means no per-skill allowlist at all: the creator's+ // own run must keep reaching every skill it owns.+ const { skillsRuntime } = await import('../skills');+ const runtime = await skillsRuntime.factory({+ agentId: 'agent-1',+ serverDB: {} as never,+ toolManifestMap: {},+ topicId: 'topic-1',+ userId: 'user-1',+ });++ expect((await runtime.activateSkill({ name: 'user-skill' })).success).toBe(true);+ });+ });+// Regression guard for the server/gateway migration: when the execution plan// routed a device (activeDeviceId present), execScript must run ON the device// — prepare the skill archives via the prepareSkillDirectory RPC and executediff --git a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts b/apps/server/src/services/toolExecution/serverRuntimes/skills.tsindex fb1d80a91aa..116fae42183 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/skills.ts@@ -14,6 +14,7 @@ import {type SkillRuntimeService,SkillsExecutionRuntime,} from '@lobechat/builtin-tool-skills/executionRuntime';+import { resolveShareAllowedSkillIds } from '@lobechat/const';import {type BuiltinSkill,getDisabledPluginIds,@@ -114,6 +115,8 @@ class SkillServerRuntimeService implements SkillRuntimeService {private workspaceId?: string;private device?: SkillDeviceExecution;private disabledSkillIds: Set<string>;+ private isSkillGranted?: (identifier: string) => boolean;+ private shareVisitorBlocked: boolean;constructor(options: {agentId?: string;@@ -127,9 +130,17 @@ class SkillServerRuntimeService implements SkillRuntimeService {disabledSkillIds?: Set<string>;fileModel: FileModel;fileService: FileService;+ /**+ * Agent Share only: answers "may this visitor reach the skill with this+ * identifier". Absent on a creator's own run, where the creator reaches+ * their whole catalog by definition.+ */+ isSkillGranted?: (identifier: string) => boolean;marketService: MarketService;resourceService: SkillResourceService;serverDB: LobeChatDatabase;+ /** Agent Share only: `lh` must not mint a creator-scoped token for a visitor. */+ shareVisitorBlocked?: boolean;skillModel: AgentSkillModel;topicId?: string;userId: string;@@ -147,20 +158,46 @@ class SkillServerRuntimeService implements SkillRuntimeService {this.workspaceId = options.workspaceId;this.device = options.device;this.disabledSkillIds = options.disabledSkillIds ?? new Set();+ this.isSkillGranted = options.isSkillGranted;+ this.shareVisitorBlocked = options.shareVisitorBlocked ?? false;}- findAll = (): Promise<{ data: SkillListItem[]; total: number }> => {- return this.skillModel.findAll();+ /**+ * The one place that decides whether a resolved DB skill may be opened at+ * all. Both rules are opt-outs from the creator's own catalog, applied+ * together so no lookup path can honor one and miss the other:+ *+ * - `disabledSkillIds` — the agent's own tri-state (`agents.plugins`);+ * - `isSkillGranted` — an Agent Share visitor's per-skill allowlist+ * (`shareConfig.skillGrants`). Absent for a creator's own run.+ *+ * This runs on RESOLVED rows, not on the caller's argument, because+ * `activateSkill` / `readReference` take a model-supplied NAME: only the row+ * carries the identifier the grant is written against.+ */+ private isSkillReachable = (identifier: string): boolean =>+ !this.disabledSkillIds.has(identifier) && (this.isSkillGranted?.(identifier) ?? true);++ findAll = async (): Promise<{ data: SkillListItem[]; total: number }> => {+ const result = await this.skillModel.findAll();+ if (!this.isSkillGranted) return result;++ // A share visitor must not learn the creator's catalog. This list is not+ // just an internal lookup: `activateSkill` echoes it back in its+ // not-found message ("Available skills: ..."), so an unfiltered read here+ // hands every skill name and description to anyone with the link.+ const data = result.data.filter((skill) => this.isSkillReachable(skill.identifier));+ return { data, total: data.length };};findById = async (id: string): Promise<SkillItem | undefined> => {const skill = await this.skillModel.findById(id);- return skill && this.disabledSkillIds.has(skill.identifier) ? undefined : skill;+ return skill && this.isSkillReachable(skill.identifier) ? skill : undefined;};findByName = async (name: string): Promise<SkillItem | undefined> => {const skill = await this.skillModel.findByName(name);- return skill && this.disabledSkillIds.has(skill.identifier) ? undefined : skill;+ return skill && this.isSkillReachable(skill.identifier) ? skill : undefined;};private resolveWorkspaceId = async (): Promise<string | undefined> => {@@ -184,16 +221,30 @@ class SkillServerRuntimeService implements SkillRuntimeService {): Promise<{ command: string; error?: string }> => {const workspaceId =this.workspaceId ?? (isLhCommand(command) ? await this.resolveWorkspaceId() : undefined);- // No `shareVisitorBlocked` guard needed here: `lobe-skills` is absent from- // `AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS`, so this runtime is never- // constructed for an Agent Share visitor's run in the first place.- const result = await preprocessLhCommand(command, this.userId, workspaceId);+ // `lobe-skills` IS reachable in an Agent Share visitor's run now (only its+ // two load APIs are), so this runtime does get constructed for one and the+ // guard is no longer redundant: `this.userId` is the CREATOR, and minting+ // an `lh` token from it inside a shell a visitor influenced would hand over+ // the creator's whole CLI surface. Nothing routes here today — the gate+ // strips `runCommand` / `execScript` before dispatch — so this is the+ // backstop for the day Agent Share grows an approval step and they open.+ const result = await preprocessLhCommand(+ command,+ this.userId,+ workspaceId,+ this.shareVisitorBlocked,+ );return { command: result.command, error: result.error };};readResource = async (id: string, path: string): Promise<SkillResourceContent> => {- const skill = await this.skillModel.findById(id);+ // Goes through `findById`, not `skillModel.findById`: this is a second+ // entry into skill CONTENT, reached with an id the caller already holds, so+ // resolving it raw would let an out-of-scope skill's resources be read even+ // though its activation was refused. Same not-found error either way — a+ // distinct "not allowed" message would confirm the skill exists.+ const skill = await this.findById(id);if (!skill) throw new Error(`Skill not found: ${id}`);if (!skill.resources) throw new Error(`Skill has no resources: ${id}`);return this.resourceService.readResource(skill.resources, path);@@ -285,7 +336,13 @@ class SkillServerRuntimeService implements SkillRuntimeService {for (const activatedSkill of activatedSkills) {if (!activatedSkill.name) continue;- const skill = await this.skillModel.findByName(activatedSkill.name);+ // `findByName`, not `skillModel.findByName`: `activatedSkills` is+ // model-suppliable (see `ExecutionRuntime`'s `args.activatedSkills ??+ // this.activatedSkills`), so this resolves an arbitrary name into a skill+ // ARCHIVE — a third door into skill content, next to `activateSkill` and+ // `readReference`. Resolving it raw skipped both the agent's disabled set+ // and an Agent Share visitor's grant.+ const skill = await this.findByName(activatedSkill.name);if (!skill) {log('No persisted skill bundle found for activated skill: %s', activatedSkill.name);@@ -692,6 +749,36 @@ export const skillsRuntime: ServerRuntimeRegistration = {disabledSkillIds = new Set(getDisabledPluginIds(agentConfig?.plugins ?? undefined));}+ // The share's own opt-out, for the same reason: the creator named the+ // skills a visitor may load (`shareConfig.skillGrants`), and the+ // operation's skill pool was already intersected with that grant at+ // assembly (`filterSkillsByShareGate`) — but `activateSkill` /+ // `readReference` / `execScript` all resolve a MODEL-SUPPLIED name, so a+ // name the pool never offered still arrives here. This predicate is that+ // second, authoritative check.+ //+ // `resolveShareAllowedSkillIds` intersects candidates with the grant, so+ // passing the single id under test makes each call exactly the membership+ // question this predicate asks.+ const shareVisitor = context.agentShareVisitor;+ const isSkillGranted = shareVisitor+ ? (identifier: string) => resolveShareAllowedSkillIds([identifier], shareVisitor).length > 0+ : undefined;++ /**+ * The same two opt-outs `SkillServerRuntimeService.isSkillReachable`+ * applies to DB lookups, for the sources that reach the runtime as plain+ * LISTS instead of being resolved through the service.+ *+ * Filtering here — not inside a per-call check — is what closes the+ * fall-through: `activateSkill` tries the DB first and, on a miss, walks on+ * to the builtin / agent-document / filesystem branches, which do no lookup+ * at all. A skill refused by the service would otherwise simply be found+ * one branch later.+ */+ const isSkillReachable = (identifier: string) =>+ !disabledSkillIds.has(identifier) && (isSkillGranted?.(identifier) ?? true);+const skillModel = new AgentSkillModel(context.serverDB, context.userId, context.workspaceId);const resourceService = new SkillResourceService(context.serverDB,@@ -739,9 +826,11 @@ export const skillsRuntime: ServerRuntimeRegistration = {disabledSkillIds,fileModel,fileService,+ isSkillGranted,marketService,resourceService,serverDB: context.serverDB,+ shareVisitorBlocked: !!shareVisitor,skillModel,topicId: context.topicId,userId: context.userId,@@ -763,7 +852,7 @@ export const skillsRuntime: ServerRuntimeRegistration = {.getAgentSkills(context.agentId).then((skills) =>skills- .filter((skill) => !disabledSkillIds.has(skill.identifier))+ .filter((skill) => isSkillReachable(skill.identifier)).map((skill) => ({content: skill.content,description: skill.description,@@ -862,11 +951,17 @@ export const skillsRuntime: ServerRuntimeRegistration = {// execution plan....filterBuiltinSkills(builtinSkills, {canExecuteOnDevice: context.deviceCapable ?? !!activeDeviceId,- }).filter((skill) => !disabledSkillIds.has(skill.identifier)),+ }).filter((skill) => isSkillReachable(skill.identifier)),...agentSkillBuiltins,],deviceFileAccess,- projectSkills,+ // Filesystem skills carry no identifier of their own; the skill pool+ // derives one as `<source>:<name>` (see `operationPrep`'s `projectMetas`)+ // and that is what a `skillGrants` entry names, so rebuild it the same+ // way rather than matching on the bare name.+ projectSkills: projectSkills?.filter((skill) =>+ isSkillReachable(`${skill.source ?? 'project'}:${skill.name}`),+ ),service,});},diff --git a/locales/en-US/agent.json b/locales/en-US/agent.jsonindex 51d1ed1992c..7105a926242 100644--- a/locales/en-US/agent.json+++ b/locales/en-US/agent.json@@ -387,6 +387,14 @@"share.settings.profile.saveError": "Could not save. Your draft is preserved. Try again.","share.settings.profile.saved": "Profile saved","share.settings.profile.title": "Public profile",+ "share.settings.skills.availableGroup": "Not granted · {{count}}",+ "share.settings.skills.desc": "Only the skills you tick here can be loaded during a visitor run. A skill you grant runs on your account, with whatever its instructions say.",+ "share.settings.skills.empty": "This Agent has no skills that can be granted to visitors.",+ "share.settings.skills.grantedEmpty": "No skills granted yet — visitors cannot load any. Pick from the list below to grant one.",+ "share.settings.skills.grantedGroup": "Granted to visitors · {{count}}",+ "share.settings.skills.loadFailed": "Could not load this Agent’s skills. Close and reopen the share settings to try again.",+ "share.settings.skills.loading": "Loading skills…",+ "share.settings.skills.title": "Skills visitors can use","share.settings.tabs.access": "Access","share.settings.tabs.profile": "Public profile","share.settings.tabs.stats": "Stats",@@ -400,6 +408,8 @@"share.settings.tools.empty": "This Agent has no tools that can be granted to visitors.","share.settings.tools.grantedEmpty": "No tools granted yet — visitors get a plain chat. Pick from the list below to grant one.","share.settings.tools.grantedGroup": "Granted to visitors · {{count}}",+ "share.settings.tools.loadFailed": "Could not load this Agent’s tools. Close and reopen the share settings to try again.",+ "share.settings.tools.loading": "Loading tools…","share.settings.tools.needsMemoryPermission": "Also turn on “Allow reading my memory” above, or this tool stays inert for visitors.","share.settings.tools.notAvailableToVisitors": "This tool can never be used in a shared run — visitor runs are blocked from your knowledge base and Agent files.","share.settings.tools.title": "Tools visitors can use",diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.jsonindex 886b515537b..ec1b5e7fa58 100644--- a/locales/zh-CN/agent.json+++ b/locales/zh-CN/agent.json@@ -387,6 +387,14 @@"share.settings.profile.saveError": "保存失败,草稿已保留,请重试。","share.settings.profile.saved": "宣传页内容已保存","share.settings.profile.title": "宣传页内容",+ "share.settings.skills.availableGroup": "未开放 · {{count}}",+ "share.settings.skills.desc": "只有在这里勾选的技能才能在访客运行中被加载。开放出去的技能会在你的账号下运行,并按它自身的指令行事。",+ "share.settings.skills.empty": "这个助手没有可以开放给访客的技能。",+ "share.settings.skills.grantedEmpty": "还没有开放任何技能,访客加载不到任何技能。从下面的列表里勾选即可开放。",+ "share.settings.skills.grantedGroup": "已开放给访客 · {{count}}",+ "share.settings.skills.loadFailed": "没能加载这个助手的技能。关闭再重新打开分享设置试试。",+ "share.settings.skills.loading": "正在加载技能…",+ "share.settings.skills.title": "访客可用的技能","share.settings.tabs.access": "授权","share.settings.tabs.profile": "宣传页","share.settings.tabs.stats": "统计",@@ -400,6 +408,8 @@"share.settings.tools.empty": "这个助手没有可以开放给访客的工具。","share.settings.tools.grantedEmpty": "还没有开放任何工具,访客只能纯聊天。从下面的列表里勾选即可开放。","share.settings.tools.grantedGroup": "已开放给访客 · {{count}}",+ "share.settings.tools.loadFailed": "没能加载这个助手的工具。关闭再重新打开分享设置试试。",+ "share.settings.tools.loading": "正在加载工具…","share.settings.tools.needsMemoryPermission": "还需要打开上面的「允许读取我的记忆」,否则该工具对访客不起作用。","share.settings.tools.notAvailableToVisitors": "该工具无法在分享运行中使用:访客运行被禁止访问你的知识库和助手文件。","share.settings.tools.title": "访客可用的工具",diff --git a/packages/builtin-tool-skills/src/index.ts b/packages/builtin-tool-skills/src/index.tsindex 446eb4e654e..b24b063e27b 100644--- a/packages/builtin-tool-skills/src/index.ts+++ b/packages/builtin-tool-skills/src/index.ts@@ -1,10 +1,15 @@export { SkillsManifest } from './manifest';export { resolveSkillsManifest } from './resolveManifest';+export {+ agentShareSystemPrompt,+ resolveSkillsRestrictedManifest,+} from './resolveRestrictedManifest';export { systemPrompt } from './systemRole';export {type ActivateSkillParams,type ActivateSkillSource,type ActivateSkillState,+ AGENT_SHARE_SKILL_API_NAMES,type CommandResult,type ExecScriptActivatedSkill,type ExecScriptParams,diff --git a/packages/builtin-tool-skills/src/manifest.desktop.ts b/packages/builtin-tool-skills/src/manifest.desktop.tsindex 3cc56655e14..8463cc47011 100644--- a/packages/builtin-tool-skills/src/manifest.desktop.ts+++ b/packages/builtin-tool-skills/src/manifest.desktop.ts@@ -15,7 +15,7 @@ export const SkillsManifest: BuiltinToolManifest = {readReferenceApi,{description:- "Execute a shell command or script specified in a skill's instructions. Use this when a skill's content instructs you to run CLI commands (e.g., npx, npm, pip). Commands run directly on the local system. The system automatically uses the current skill context from the most recent runSkill call. Returns the command output.",+ "Execute a shell command or script specified in a skill's instructions. Use this when a skill's content instructs you to run CLI commands (e.g., npx, npm, pip). Commands run directly on the local system. The system automatically uses the current skill context from the most recent activateSkill call. Returns the command output.",humanIntervention: 'required',name: SkillsApiName.execScript,parameters: {diff --git a/packages/builtin-tool-skills/src/manifest.ts b/packages/builtin-tool-skills/src/manifest.tsindex fad56c6c674..2903190c5c7 100644--- a/packages/builtin-tool-skills/src/manifest.ts+++ b/packages/builtin-tool-skills/src/manifest.ts@@ -18,7 +18,7 @@ export const SkillsManifest: BuiltinToolManifest = {runCommandApi,{description:- "Execute a shell command or script specified in a skill's instructions. Use this when a skill's content instructs you to run CLI commands (e.g., npx, npm, pip). The system automatically uses the current skill context from the most recent runSkill call. Returns the command output.",+ "Execute a shell command or script specified in a skill's instructions. Use this when a skill's content instructs you to run CLI commands (e.g., npx, npm, pip). The system automatically uses the current skill context from the most recent activateSkill call. Returns the command output.",humanIntervention: 'required',name: SkillsApiName.execScript,parameters: {diff --git a/packages/builtin-tool-skills/src/resolveRestrictedManifest.ts b/packages/builtin-tool-skills/src/resolveRestrictedManifest.tsnew file mode 100644index 00000000000..493a73e89a5--- /dev/null+++ b/packages/builtin-tool-skills/src/resolveRestrictedManifest.ts@@ -0,0 +1,80 @@+import type { BuiltinRestrictedManifestResolver } from '@lobechat/types';++import { SkillsManifest } from './manifest';+import { AGENT_SHARE_SKILL_API_NAMES } from './types';++/**+ * Replacement `systemRole` for the share-visitor surface.+ *+ * The full {@link SkillsManifest.systemRole} documents all five APIs including+ * a whole `runCommand` vs `execScript` decision tree. Kept as-is after the+ * strip it would teach a visitor's model to announce — and keep retrying —+ * capabilities that are not callable, so the role is rewritten rather than+ * dropped: dropping it entirely would also lose the one instruction that+ * actually matters here, that a skill already inlined into the message must not+ * be activated again.+ */+export const agentShareSystemPrompt = `You have access to a Skills tool that loads skills — reusable instruction packages that extend your capabilities.++<core_capabilities>+1. Activate a skill by name to load its instructions (activateSkill)+2. Read reference files attached to an activated skill (readReference)+</core_capabilities>++<workflow>+1. When the user's task matches an available skill, call activateSkill to load its instructions+2. Follow the skill's instructions to complete the task+3. If the skill content references additional files, use readReference to load them+</workflow>++<tool_selection_guidelines>+- **activateSkill**: Call this when the user's task matches one of the available skills+ - Provide the exact skill name+ - Returns the skill content (instructions, templates, guidelines) that you should follow+ - **IMPORTANT**: If a skill's content is already provided in \`<selected_skill_context>\` within the user message, do NOT call activateSkill for that skill — its instructions are already loaded and ready to use++- **readReference**: Call this to read reference files mentioned in a skill's content+ - Requires the id (returned by activateSkill) and the file path+ - Returns the file content for you to use as context+ - Only use paths that are referenced in the skill content+</tool_selection_guidelines>++<best_practices>+- Only activate skills when the user's task clearly matches the skill's purpose+- Follow the skill's instructions carefully once loaded+- Use readReference only for files explicitly mentioned in the skill content+- This tool cannot run commands or scripts in this conversation. If a skill's instructions call for executing a script, do as much as you can from the written instructions and tell the user which step needs execution instead of pretending it ran+</best_practices>+`;++/**+ * Owns the Agent Share projection of the Skills tool.+ *+ * Like the Documents projection, the semantic rewrite lives in the tool's own+ * package so Share orchestration never has to know which of this tool's APIs+ * the systemRole talks about. `shareToolManifest.ts` re-checks that the+ * returned manifest's API set matches the policy-approved one exactly, so this+ * resolver can never widen the surface the gate decided on.+ */+export const resolveSkillsRestrictedManifest: BuiltinRestrictedManifestResolver = ({+ allowedApiNames,+ restriction,+}) => {+ if (restriction !== 'agentShare') return undefined;++ // Only claim the surface this projection was written for. A different subset+ // (e.g. `readReference` alone, or anything exec-class) returns `undefined`,+ // and the caller falls back to the plain strip with no systemRole — the+ // fail-closed outcome, never a role describing APIs that are not offered.+ const allowed = new Set(allowedApiNames);+ const isSupportedApiSet =+ allowed.size === AGENT_SHARE_SKILL_API_NAMES.size &&+ [...allowed].every((apiName) => AGENT_SHARE_SKILL_API_NAMES.has(apiName));+ if (!isSupportedApiSet) return undefined;++ return {+ ...SkillsManifest,+ api: SkillsManifest.api.filter((api) => allowed.has(api.name)),+ systemRole: agentShareSystemPrompt,+ };+};diff --git a/packages/builtin-tool-skills/src/types.ts b/packages/builtin-tool-skills/src/types.tsindex 87a08498891..99262ec5284 100644--- a/packages/builtin-tool-skills/src/types.ts+++ b/packages/builtin-tool-skills/src/types.ts@@ -8,6 +8,28 @@ export const SkillsApiName = {activateSkill: 'activateSkill',};+/**+ * Skill APIs an Agent Share visitor may use. Both are pure reads of skill+ * content; WHICH skills they can reach is a separate question, answered by the+ * share's `skillGrants` allowlist inside the server runtime.+ *+ * The exec-class APIs (`runCommand` / `execScript`) are excluded because they+ * declare `humanIntervention: 'required'` and a visitor run is forced headless,+ * so there is no approver to honor that declaration; `exportFile` is excluded+ * because its only purpose is pulling artifacts out of an execution those APIs+ * would have started. Opening them needs Agent Share to grow a real approval+ * step first.+ *+ * Shared with the server share gate (`DATA_TOOL_ACCESS_RULES` in+ * `apps/server/src/services/aiAgent/shareGate.ts`), which derives its block+ * list as "every API of this tool that is NOT in this set" — so a newly added+ * skill API is denied to visitors by default rather than silently exposed.+ */+export const AGENT_SHARE_SKILL_API_NAMES = new Set<string>([+ SkillsApiName.activateSkill,+ SkillsApiName.readReference,+]);+export interface ActivateSkillParams {name: string;}diff --git a/packages/builtin-tools/src/index.ts b/packages/builtin-tools/src/index.tsindex a7d794bf5be..897cdf5f639 100644--- a/packages/builtin-tools/src/index.ts+++ b/packages/builtin-tools/src/index.ts@@ -38,7 +38,11 @@ import { RemoteDeviceManifest } from '@lobechat/builtin-tool-remote-device';import { selfFeedbackIntentManifest } from '@lobechat/builtin-tool-self-iteration';import { SkillMaintainerManifest } from '@lobechat/builtin-tool-skill-maintainer';import { SkillStoreManifest } from '@lobechat/builtin-tool-skill-store';-import { resolveSkillsManifest, SkillsManifest } from '@lobechat/builtin-tool-skills';+import {+ resolveSkillsManifest,+ resolveSkillsRestrictedManifest,+ SkillsManifest,+} from '@lobechat/builtin-tool-skills';import { TaskManifest } from '@lobechat/builtin-tool-task';import { TopicReferenceManifest } from '@lobechat/builtin-tool-topic-reference';import { UserInteractionManifest } from '@lobechat/builtin-tool-user-interaction';@@ -210,7 +214,7 @@ export const runtimeManagedToolIds = [* (`apps/server/src/services/toolExecution/serverRuntimes/*`), not just its* manifest. For the rationale behind every DENIED identifier* (`lobe-agent-management`, `lobe-task`, `lobe-creds`, `lobe-message`,- * `lobe-skill-store`, `lobe-agent-builder`, `lobe-skills`,+ * `lobe-skill-store`, `lobe-agent-builder`,* `lobe-group-agent-builder`, `lobe-group-management`, `agent-signal-review`,* `lobe-user-interaction`, `lobe-activator`,* `lobe-local-system`, `lobe-browser`, `lobe-remote-device`,@@ -241,6 +245,15 @@ export const AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS = new Set<string>([KnowledgeBaseManifest.identifier,MemoryManifest.identifier,AgentDocumentsManifest.identifier,+ // `lobe-skills`: a skill-driven agent is broken the moment it is shared+ // without this, since skills are loaded on demand through this tool. It is+ // allowed only in the narrow shape `DATA_TOOL_ACCESS_RULES` gives it —+ // `activateSkill` / `readReference` on skills the creator explicitly listed+ // in `shareConfig.skillGrants`, enforced again at load time in the server+ // runtime so the model cannot name a skill outside that list. Every other+ // API of the tool is blocked. See the positive-evidence doc block in+ // `shareGate.ts`.+ SkillsManifest.identifier,]);/**@@ -299,6 +312,10 @@ const builtinToolRegistry: LobeBuiltinTool[] = [// actual execution environment (cloud sandbox as fallback / offline// degradation), so the model never assumes they run on the user's machine.resolveManifest: resolveSkillsManifest,+ // Agent Share projection: only `activateSkill` / `readReference` survive+ // the gate, so the full five-API systemRole is replaced with one that+ // describes just those two.+ resolveRestrictedManifest: resolveSkillsRestrictedManifest,type: 'builtin',},{diff --git a/packages/const/src/agentShare.test.ts b/packages/const/src/agentShare.test.tsindex cf107abf4e9..f6ea6b8ea9e 100644--- a/packages/const/src/agentShare.test.ts+++ b/packages/const/src/agentShare.test.ts@@ -1,6 +1,11 @@import { describe, expect, it } from 'vitest';-import { hasShareToolGrant, isShareToolApiGranted, resolveShareToolGrants } from './agentShare';+import {+ hasShareToolGrant,+ isShareToolApiGranted,+ resolveShareAllowedSkillIds,+ resolveShareToolGrants,+} from './agentShare';describe('resolveShareToolGrants', () => {it('grants every API for a grant without `apis`', () => {@@ -77,3 +82,31 @@ describe('hasShareToolGrant / isShareToolApiGranted', () => {expect(isShareToolApiGranted(grants, 'lobe-agent', 'analyzeMedia')).toBe(false);});});++describe('resolveShareAllowedSkillIds', () => {+ it('keeps only the candidates the creator named, in candidate order', () => {+ expect(+ resolveShareAllowedSkillIds(['brand-voice', 'pdf-report', 'internal-audit'], {+ skillGrants: ['pdf-report', 'brand-voice'],+ }),+ ).toEqual(['brand-voice', 'pdf-report']);+ });++ it('ignores a granted id the run has no candidate for', () => {+ // A skill the creator deleted after granting it, for instance: the grant+ // survives in the stored config but must not conjure a skill into the pool.+ expect(resolveShareAllowedSkillIds(['pdf-report'], { skillGrants: ['deleted-skill'] })).toEqual(+ [],+ );+ });++ it('grants nothing when skillGrants is empty', () => {+ expect(resolveShareAllowedSkillIds(['pdf-report'], { skillGrants: [] })).toEqual([]);+ });++ it('grants nothing when skillGrants was never configured', () => {+ // Default-closed: no grant means no skill, and `toolGrants` is never read+ // as a skill list even though the two share one identifier namespace.+ expect(resolveShareAllowedSkillIds(['pdf-report'], {})).toEqual([]);+ });+});diff --git a/packages/const/src/agentShare.ts b/packages/const/src/agentShare.tsindex cb0f55c75e6..93b45c8309d 100644--- a/packages/const/src/agentShare.ts+++ b/packages/const/src/agentShare.ts@@ -200,6 +200,32 @@ export const hasShareToolGrant = (identifier: string,): boolean => grants.has(identifier);+/**+ * The skills a share visitor's run may load, as an intersection of the run's+ * real skill candidates with what the creator granted.+ *+ * Default-closed: a share with no `skillGrants` (or an empty one) grants no+ * skill at all. `toolGrants` is NEVER consulted — skills are not picked in the+ * tool picker, and tool and skill identifiers share ONE namespace, so reading a+ * tool grant as a skill grant could only ever widen access by accident.+ *+ * Takes `candidateIds` rather than returning the raw grant list so a grant+ * naming a skill this run does not actually have (deleted since, or belonging+ * to another build) cannot leak into the pool.+ *+ * This is the single source of truth for "which skills is this visitor allowed+ * to see and load", shared by the operation's skill-pool assembly and the skill+ * runtime's load-time enforcement so the two cannot drift.+ */+export const resolveShareAllowedSkillIds = (+ candidateIds: string[],+ grants: { skillGrants?: string[] },+): string[] => {+ const granted = new Set(grants.skillGrants ?? []);++ return candidateIds.filter((id) => granted.has(id));+};+/** Whether `identifier`'s specific `apiName` is granted — toolset-level grants every API. */export const isShareToolApiGranted = (grants: Map<string, ShareToolGrant>,diff --git a/packages/context-engine/src/providers/SkillContextProvider.ts b/packages/context-engine/src/providers/SkillContextProvider.tsindex 4f58ddc8e7a..61ae58f22db 100644--- a/packages/context-engine/src/providers/SkillContextProvider.ts+++ b/packages/context-engine/src/providers/SkillContextProvider.ts@@ -63,7 +63,7 @@ export const selectActivatedSkills = (enabledSkills?: SkillMeta[]): SkillMeta[]/*** Skill Context Provider* Injects lightweight skill metadata into the system prompt so the LLM knows- * which skills are available and can invoke them via `runSkill`.+ * which skills are available and can invoke them via `activateSkill`.*/export class SkillContextProvider extends BaseSystemRoleProvider {readonly name = 'SkillContextProvider';diff --git a/packages/context-engine/src/providers/__tests__/__snapshots__/SkillContextProvider.test.ts.snap b/packages/context-engine/src/providers/__tests__/__snapshots__/SkillContextProvider.test.ts.snapindex 07fde8f3732..42c601f01dd 100644--- a/packages/context-engine/src/providers/__tests__/__snapshots__/SkillContextProvider.test.ts.snap+++ b/packages/context-engine/src/providers/__tests__/__snapshots__/SkillContextProvider.test.ts.snap@@ -9,7 +9,7 @@ Use \`lh task\` to manage tasks.<skill name="Artifacts">Generate interactive UI components</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;exports[`SkillContextProvider > should handle all skills activated (no available_skills list) 1`] = `"Task skill content here"`;@@ -20,7 +20,7 @@ exports[`SkillContextProvider > should inject skill metadata when skills are pro<skill name="My Skill">Custom skill description</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;exports[`SkillContextProvider > should merge with existing system message 1`] = `@@ -31,7 +31,7 @@ exports[`SkillContextProvider > should merge with existing system message 1`] =<skill name="My Skill">Custom skill description</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;exports[`SkillContextProvider > should only inject lightweight metadata without content field 1`] = `@@ -39,7 +39,7 @@ exports[`SkillContextProvider > should only inject lightweight metadata without<skill name="Artifacts" location="/path/to/skills/artifacts/SKILL.md">Generate interactive UI components</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;exports[`SkillContextProvider > should render XML with location attribute 1`] = `@@ -48,7 +48,7 @@ exports[`SkillContextProvider > should render XML with location attribute 1`] =<skill name="Data Analysis" location="/path/to/skills/data-analysis/SKILL.md">Analyzes datasets and generates charts</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;exports[`SkillContextProvider > should render XML without location when not provided 1`] = `@@ -56,5 +56,5 @@ exports[`SkillContextProvider > should render XML without location when not prov<skill name="My Skill">Custom skill description</skill></available_skills>-Use the runSkill tool to activate a skill when needed."+Use the activateSkill tool to activate a skill when needed."`;diff --git a/packages/database/src/models/agentShare.ts b/packages/database/src/models/agentShare.tsindex 7157320f17d..afe9fa477ab 100644--- a/packages/database/src/models/agentShare.ts+++ b/packages/database/src/models/agentShare.ts@@ -52,6 +52,11 @@ const normalizeAgentShareConfig = (monthlySpendLimit: config?.monthlySpendLimit ?? DEFAULT_AGENT_SHARE_CONFIG.monthlySpendLimit,showErrorDetails: config?.showErrorDetails ?? DEFAULT_AGENT_SHARE_CONFIG.showErrorDetails,showModelInfo: config?.showModelInfo ?? DEFAULT_AGENT_SHARE_CONFIG.showModelInfo,+ /**+ * Left absent rather than defaulted to `[]`: both read as "no skill+ * granted", so a default would only write a value the creator never picked.+ */+ skillGrants: config?.skillGrants,slug: config?.slug,toolGrants: config?.toolGrants ?? DEFAULT_AGENT_SHARE_CONFIG.toolGrants,});diff --git a/packages/database/src/schemas/agentShare.ts b/packages/database/src/schemas/agentShare.tsindex 8fea8d70200..73f9edeb070 100644--- a/packages/database/src/schemas/agentShare.ts+++ b/packages/database/src/schemas/agentShare.ts@@ -54,6 +54,20 @@ export interface AgentShareConfig {* Defaults to `false` — the creator's model choice is hidden by default.*/showModelInfo?: boolean;+ /**+ * Skills visitors may load, by skill identifier. Deliberately separate from+ * {@link toolGrants}: a skill grant governs BOTH the tool path+ * (`lobe-skills.activateSkill` / `readReference`) and the no-tool path (a+ * pinned skill's body is injected straight into context, see+ * `operationPrep`'s pinned-content branch), so it cannot hang off a tool+ * entry that may legitimately be absent.+ *+ * Default-closed: absent or empty grants nothing, non-empty grants exactly+ * these skills. `toolGrants` is never read as a skill list — tool and skill+ * ids share one namespace, so a plain tool grant must not be mistaken for a+ * skill grant (see `filterSkillsByShareGate`).+ */+ skillGrants?: string[];/*** Custom URL slug for this share's public link (e.g. `/agent/my-cool-bot`).* Uniqueness is enforced at the APPLICATION leveldiff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.tsindex cfad828f861..f41b9c11b3f 100644--- a/packages/locales/src/default/agent.ts+++ b/packages/locales/src/default/agent.ts@@ -483,6 +483,17 @@ export default {'share.settings.usage.title': 'Usage','share.settings.usage.views': 'Visits','share.settings.usage.visitors': 'Visitors',+ 'share.settings.skills.availableGroup': 'Not granted · {{count}}',+ 'share.settings.skills.desc':+ 'Only the skills you tick here can be loaded during a visitor run. A skill you grant runs on your account, with whatever its instructions say.',+ 'share.settings.skills.empty': 'This Agent has no skills that can be granted to visitors.',+ 'share.settings.skills.grantedEmpty':+ 'No skills granted yet — visitors cannot load any. Pick from the list below to grant one.',+ 'share.settings.skills.grantedGroup': 'Granted to visitors · {{count}}',+ 'share.settings.skills.loadFailed':+ 'Could not load this Agent’s skills. Close and reopen the share settings to try again.',+ 'share.settings.skills.loading': 'Loading skills…',+ 'share.settings.skills.title': 'Skills visitors can use','share.settings.tools.desc':'Only the tools you tick here can be called during a visitor run. Tools that could reach your device or local files are never offered.','share.settings.tools.apiNotAvailableToVisitors':@@ -496,6 +507,9 @@ export default {'share.settings.tools.grantedEmpty':'No tools granted yet — visitors get a plain chat. Pick from the list below to grant one.','share.settings.tools.grantedGroup': 'Granted to visitors · {{count}}',+ 'share.settings.tools.loadFailed':+ 'Could not load this Agent’s tools. Close and reopen the share settings to try again.',+ 'share.settings.tools.loading': 'Loading tools…','share.settings.tools.needsMemoryPermission':'Also turn on “Allow reading my memory” above, or this tool stays inert for visitors.','share.settings.tools.notAvailableToVisitors':diff --git a/packages/prompts/src/prompts/skills/index.test.ts b/packages/prompts/src/prompts/skills/index.test.tsindex cc98e869732..b45763c5ea3 100644--- a/packages/prompts/src/prompts/skills/index.test.ts+++ b/packages/prompts/src/prompts/skills/index.test.ts@@ -49,7 +49,7 @@ describe('skillsPrompts', () => {<skill name="Data Analysis" location="/path/to/skills/data-analysis/SKILL.md">Analyzes datasets and generates charts</skill></available_skills>-Use the runSkill tool to activate a skill when needed.`;+Use the activateSkill tool to activate a skill when needed.`;expect(skillsPrompts(skills)).toBe(expected);});@@ -74,7 +74,7 @@ Use the runSkill tool to activate a skill when needed.`;<skill name="My Skill">Custom skill description</skill></available_skills>-Use the runSkill tool to activate a skill when needed.`;+Use the activateSkill tool to activate a skill when needed.`;expect(skillsPrompts(skills)).toBe(expected);});diff --git a/packages/prompts/src/prompts/skills/index.ts b/packages/prompts/src/prompts/skills/index.tsindex 20cdf076c36..7f509ef47c0 100644--- a/packages/prompts/src/prompts/skills/index.ts+++ b/packages/prompts/src/prompts/skills/index.ts@@ -38,5 +38,5 @@ export const skillsPrompts = (skills: SkillItem[]) => {${skillTags}</available_skills>-Use the runSkill tool to activate a skill when needed.${filesystemHint}`;+Use the activateSkill tool to activate a skill when needed.${filesystemHint}`;};diff --git a/packages/types/src/agentRuntime.ts b/packages/types/src/agentRuntime.tsindex cd33737a0a6..e12ce3bc655 100644--- a/packages/types/src/agentRuntime.ts+++ b/packages/types/src/agentRuntime.ts@@ -83,6 +83,13 @@ export interface AgentShareVisitorContext {showErrorDetails?: boolean;/** `AgentShareConfig.showModelInfo` — gates visitor-facing model/provider/usage redaction. */showModelInfo?: boolean;+ /**+ * Mirrors `shareConfig.skillGrants` so the skill runtime can enforce the same+ * per-skill allowlist the operation's skill pool was built from. Absent or+ * empty grants no skill. Carried separately from {@link toolGrants} because a+ * skill grant also governs the no-tool pinned-content path.+ */+ skillGrants?: string[];/*** Mirrors `shareConfig.toolGrants` so tool runtimes that resolve their* target outside `toolManifestMap` (e.g. `activateSkill`,diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.tsindex c785d52020b..82aaab38aa9 100644--- a/src/libs/swr/keys.ts+++ b/src/libs/swr/keys.ts@@ -1235,6 +1235,11 @@ export const inboxKeys = {// ---- share (shared agent / topic / page) ---------------------------------export const shareKeys = {agentInfo: def('share:agentInfo', (slugOrId: string) => ['share:agentInfo', slugOrId]),+ /** Candidates for the creator-side AGENT share skill picker, keyed by agentId. */+ agentShareGrantableSkills: def('share:agentShareGrantableSkills', (agentId: string) => [+ 'share:agentShareGrantableSkills',+ agentId,+ ]),// Creator-side share status keyed by agentId (visitor side uses `agentInfo`).agentShareStats: def('share:agentShareStats', (agentId: string) => ['share:agentShareStats',diff --git a/src/services/agentShare.ts b/src/services/agentShare.tsindex 97960495b23..e3eacdb9ff4 100644--- a/src/services/agentShare.ts+++ b/src/services/agentShare.ts@@ -44,6 +44,11 @@ class AgentShareService {);}+ /** Candidates for the share settings skill picker — see the router's JSDoc. */+ async listGrantableSkills(agentId: string) {+ return lambdaClient.agentShare.listGrantableSkills.query({ agentId });+ }+async updateShareConfig(agentId: string, config: AgentShareConfigPatchInput) {return lambdaClient.agentShare.updateShareConfig.mutate({ agentId, config });}diff --git a/src/services/chat/chat.test.ts b/src/services/chat/chat.test.tsindex 52ac5efddde..fafdec19623 100644--- a/src/services/chat/chat.test.ts+++ b/src/services/chat/chat.test.ts@@ -1260,7 +1260,7 @@ describe('ChatService', () => {);expect(requestMessages[0].content).toContain('<available_skills>');expect(requestMessages[0].content).toContain(- 'Use the runSkill tool to activate a skill when needed.',+ 'Use the activateSkill tool to activate a skill when needed.',);expect(requestMessages[0].content).toContain('<tool name="SEO">');expect(requestMessages[1]).toEqual(