Skip to content

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

πŸ› fix: improve skill exec script way (#12926)

LiJian4065dc0565f9
diff --git a/packages/agent-runtime/src/utils/stepContextComputer.ts b/packages/agent-runtime/src/utils/stepContextComputer.ts
index 9dfff1bbce2..1bac0739d7f 100644
--- a/packages/agent-runtime/src/utils/stepContextComputer.ts
+++ b/packages/agent-runtime/src/utils/stepContextComputer.ts
@@ -1,10 +1,14 @@
-import type { RuntimeStepContext, StepContextTodos } from '@lobechat/types';
+import type { RuntimeStepContext, StepActivatedSkill, StepContextTodos } from '@lobechat/types';
/**
* Input parameters for computeStepContext
* Using object parameter for future extensibility
*/
export interface ComputeStepContextParams {
+ /**
+ * Activated skills accumulated from activateSkill messages
+ */
+ activatedSkills?: StepActivatedSkill[];
/**
* Activated tool identifiers accumulated from lobe-tools messages
*/
@@ -30,10 +34,12 @@ export interface ComputeStepContextParams {
* @returns RuntimeStepContext assembled from the provided values
*/
export const computeStepContext = ({
+ activatedSkills,
activatedToolIds,
todos,
}: ComputeStepContextParams): RuntimeStepContext => {
return {
+ ...(activatedSkills?.length && { activatedSkills }),
...(activatedToolIds?.length && { activatedToolIds }),
...(todos && { todos }),
};
diff --git a/packages/builtin-tool-skills/src/ExecutionRuntime/index.ts b/packages/builtin-tool-skills/src/ExecutionRuntime/index.ts
index ac66a3f0afa..eeb1b1a3231 100644
--- a/packages/builtin-tool-skills/src/ExecutionRuntime/index.ts
+++ b/packages/builtin-tool-skills/src/ExecutionRuntime/index.ts
@@ -40,7 +40,7 @@ export interface SkillRuntimeService {
execScript?: (
command: string,
options: {
- config?: { description?: string; id?: string; name?: string };
+ activatedSkills?: Array<{ description?: string; id: string; name: string }>;
description: string;
},
) => Promise<CommandResult>;
@@ -67,13 +67,13 @@ export class SkillsExecutionRuntime {
}
async execScript(args: ExecScriptParams): Promise<BuiltinServerRuntimeOutput> {
- const { command, description, config } = args;
+ const { activatedSkills, command, description } = args;
// Try new execScript method first (with cloud sandbox support)
if (this.service.execScript) {
try {
const result = await this.service.execScript(command, {
- config,
+ activatedSkills,
description,
});
diff --git a/packages/builtin-tool-skills/src/executor/index.ts b/packages/builtin-tool-skills/src/executor/index.ts
index d9ee80565ca..ef88d103201 100644
--- a/packages/builtin-tool-skills/src/executor/index.ts
+++ b/packages/builtin-tool-skills/src/executor/index.ts
@@ -31,7 +31,18 @@ class SkillsExecutor extends BaseExecutor<typeof SkillsApiName> {
return { stop: true, success: false };
}
- const result = await this.runtime.execScript(params);
+ // Pass activatedSkills from stepContext to runtime
+ // Server will resolve zipUrls for all activated skills
+ const activatedSkills = ctx.stepContext?.activatedSkills;
+
+ const result = await this.runtime.execScript({
+ ...params,
+ activatedSkills: activatedSkills?.map((s) => ({
+ description: s.description,
+ id: s.id,
+ name: s.name,
+ })),
+ });
if (result.success) {
return { content: result.content, state: result.state, success: true };
diff --git a/packages/builtin-tool-skills/src/index.ts b/packages/builtin-tool-skills/src/index.ts
index e99035f0a8f..631b42cd85e 100644
--- a/packages/builtin-tool-skills/src/index.ts
+++ b/packages/builtin-tool-skills/src/index.ts
@@ -3,6 +3,7 @@ export { systemPrompt } from './systemRole';
export {
type ActivateSkillParams,
type CommandResult,
+ type ExecScriptActivatedSkill,
type ExecScriptParams,
type ReadReferenceParams,
SkillsApiName,
diff --git a/packages/builtin-tool-skills/src/manifest.base.ts b/packages/builtin-tool-skills/src/manifest.base.ts
index 5198dbe62a6..9e2b70e48c5 100644
--- a/packages/builtin-tool-skills/src/manifest.base.ts
+++ b/packages/builtin-tool-skills/src/manifest.base.ts
@@ -86,25 +86,6 @@ export const execScriptBaseParams = {
description: 'The shell command to execute.',
type: 'string' as const,
},
- config: {
- description:
- 'REQUIRED: Current skill context. Must include the id and name from the most recent activateSkill call. The server uses this to locate skill resources (e.g., ZIP package for skill files). Example: { "id": "skill_xxx", "name": "skill-name", "description": "..." }',
- properties: {
- description: {
- description: "Current skill's description (optional)",
- type: 'string',
- },
- id: {
- description: "Current skill's ID from activateSkill state (required for resource lookup)",
- type: 'string',
- },
- name: {
- description: "Current skill's name from activateSkill state (required for resource lookup)",
- type: 'string',
- },
- },
- type: 'object' as const,
- },
description: {
description:
'Clear description of what this command does (5-10 words, in active voice). Use the same language as the user input.',
diff --git a/packages/builtin-tool-skills/src/manifest.desktop.ts b/packages/builtin-tool-skills/src/manifest.desktop.ts
index fadde81ef76..3cc56655e14 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. IMPORTANT: Always include the 'config' parameter with the current skill's id and name (obtained from activateSkill's state) so the system can locate skill resources. 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 runSkill 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.ts
index 25536c9ddaa..fad56c6c674 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). IMPORTANT: Always include the 'config' parameter with the current skill's id and name (obtained from activateSkill's state) so the system can locate skill resources. 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 runSkill call. Returns the command output.",
humanIntervention: 'required',
name: SkillsApiName.execScript,
parameters: {
diff --git a/packages/builtin-tool-skills/src/systemRole.desktop.ts b/packages/builtin-tool-skills/src/systemRole.desktop.ts
index 0f2fbf52ff2..803ad2f541b 100644
--- a/packages/builtin-tool-skills/src/systemRole.desktop.ts
+++ b/packages/builtin-tool-skills/src/systemRole.desktop.ts
@@ -26,7 +26,7 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
- Only use paths that are referenced in the skill content
- **execScript**: Call this to execute shell commands mentioned in a skill's content
- - **IMPORTANT**: Always provide the \`config\` parameter with the current skill's id and name (from activateSkill's state)
+ - The system automatically uses activated skills context from previous activateSkill calls
- Commands run directly on the local system (OS: {{platform}})
- Provide the command to execute and a clear description of what it does
- Returns the command output (stdout/stderr)
@@ -38,7 +38,7 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
- 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
-- Use execScript only for commands specified in the skill content, always including config parameter
+- Use execScript only for commands specified in the skill content
- If activateSkill returns an error with available skills, inform the user what skills are available
</best_practices>
`;
diff --git a/packages/builtin-tool-skills/src/systemRole.ts b/packages/builtin-tool-skills/src/systemRole.ts
index 0fb09db7566..3ebaf85847e 100644
--- a/packages/builtin-tool-skills/src/systemRole.ts
+++ b/packages/builtin-tool-skills/src/systemRole.ts
@@ -13,7 +13,7 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
2. The skill content will be returned - follow those instructions to complete the task
3. If the skill content references additional files, use readReference to load them
4. If the skill content instructs you to run CLI commands, use runCommand to execute them
-5. If the command requires skill-bundled resources, use execScript instead (with config parameter)
+5. If the command requires skill-bundled resources, use execScript instead
6. If the skill execution generates output files, use exportFile to save them for the user
7. Apply the skill's instructions to fulfill the user's request
</workflow>
@@ -36,7 +36,7 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
- Requires user confirmation before execution
- **execScript**: Call this to execute skill-specific scripts that need resource context
- - **IMPORTANT**: Always provide the \`config\` parameter with the current skill's id and name (from activateSkill's state)
+ - The system automatically uses activated skills context from previous activateSkill calls
- Automatically locates and provides skill resources (ZIP package with scripts, config files, dependencies)
- Best for: commands that require skill-bundled files or dependencies
- Returns the command output (stdout/stderr)
@@ -60,13 +60,13 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
- **execScript (For skill-bundled scripts)**:
- Use only when a command needs access to skill-bundled resources (ZIP packages, config files)
- - Must include \`config\` parameter with skill id and name from activateSkill's state
+ - The system automatically tracks activated skills and provides their resources
- Best for: running scripts bundled within a skill package
**Example workflow:**
1. User activates a skill with activateSkill
2. Skill content instructs to run a CLI command (e.g., \`lh kb list\`) β†’ use runCommand
-3. Skill content instructs to run a bundled script (e.g., \`python scripts/init.py\`) β†’ use execScript with config
+3. Skill content instructs to run a bundled script (e.g., \`python scripts/init.py\`) β†’ use execScript
</runcommand_vs_execscript>
<best_practices>
@@ -74,7 +74,7 @@ export const systemPrompt = `You have access to a Skills tool that allows you to
- Follow the skill's instructions carefully once loaded
- Use readReference only for files explicitly mentioned in the skill content
- Use runCommand for CLI commands and general operations
-- Use execScript only when the command needs skill-bundled resources, always including config parameter
+- Use execScript when the command needs skill-bundled resources
- Use exportFile when the skill generates output files that need to be saved
- If activateSkill returns an error with available skills, inform the user what skills are available
</best_practices>
diff --git a/packages/builtin-tool-skills/src/types.ts b/packages/builtin-tool-skills/src/types.ts
index 544e1d41ed0..fa15a008b32 100644
--- a/packages/builtin-tool-skills/src/types.ts
+++ b/packages/builtin-tool-skills/src/types.ts
@@ -19,26 +19,22 @@ export interface ActivateSkillState {
name: string;
}
+/**
+ * Activated skill info passed to execScript
+ */
+export interface ExecScriptActivatedSkill {
+ description?: string;
+ id: string;
+ name: string;
+}
+
export interface ExecScriptParams {
- command: string;
/**
- * Skill configuration context
- * Used by server to locate skill resources (zipUrl will be resolved server-side)
+ * All activated skills from stepContext
+ * Server will resolve zipUrls for all skills
*/
- config?: {
- /**
- * Current skill's description
- */
- description?: string;
- /**
- * Current skill's ID
- */
- id?: string;
- /**
- * Current skill's name
- */
- name?: string;
- };
+ activatedSkills?: ExecScriptActivatedSkill[];
+ command: string;
description: string;
}
diff --git a/packages/types/src/stepContext.ts b/packages/types/src/stepContext.ts
index a4fe7ca71df..5d7fc983f43 100644
--- a/packages/types/src/stepContext.ts
+++ b/packages/types/src/stepContext.ts
@@ -30,6 +30,15 @@ export interface StepContextTodos {
updatedAt: string;
}
+/**
+ * Activated skill info from activateSkill messages
+ */
+export interface StepActivatedSkill {
+ description?: string;
+ id: string;
+ name: string;
+}
+
/**
* Page Editor context for each step
* Contains the latest XML structure fetched at each step
@@ -81,6 +90,11 @@ export interface InitialPageEditorContext {
* ```
*/
export interface RuntimeStepContext {
+ /**
+ * Activated skills accumulated from activateSkill messages
+ * Skills once activated remain active for the rest of the conversation
+ */
+ activatedSkills?: StepActivatedSkill[];
/**
* Activated tool identifiers accumulated from lobe-tools messages
* Tools once activated remain active for the rest of the conversation
diff --git a/src/server/routers/tools/market.ts b/src/server/routers/tools/market.ts
index f29ad3b4259..e0c4a9b4e3c 100644
--- a/src/server/routers/tools/market.ts
+++ b/src/server/routers/tools/market.ts
@@ -167,52 +167,41 @@ const execInSandboxHandler = async ({
}
if (lhResult.skipSkillLookup) {
- enhancedParams = { ...params, command: lhResult.command, config: undefined };
+ enhancedParams = { ...params, command: lhResult.command };
}
}
- // For execScript tool, look up skill zipUrl if config is provided
- if (toolName === 'execScript' && enhancedParams.config) {
+ // For execScript tool, look up skill zipUrls from activatedSkills
+ if (toolName === 'execScript' && enhancedParams.activatedSkills?.length) {
const agentSkillModel = new AgentSkillModel(ctx.serverDB, userId);
+ const fileModel = new FileModel(ctx.serverDB, userId);
- let skill;
- if (enhancedParams.config.name) {
- skill = await agentSkillModel.findByName(enhancedParams.config.name);
+ // Resolve zipUrls for all activated skills
+ const skillZipUrls: Record<string, string> = {};
- if (!skill) {
- const allSkills = await agentSkillModel.findAll();
- const availableSkills = allSkills.data.map((s) => s.name).join(', ');
+ for (const activatedSkill of enhancedParams.activatedSkills) {
+ if (!activatedSkill.name) continue;
- const errorMessage = availableSkills
- ? `Skill "${enhancedParams.config.name}" not found. Available skills: ${availableSkills}`
- : `Skill "${enhancedParams.config.name}" not found. No skills available. Please import a skill first.`;
+ const skill = await agentSkillModel.findByName(activatedSkill.name);
+ if (!skill?.zipFileHash) continue;
- log(
- 'Skill not found: %s. Available skills: %s',
- enhancedParams.config.name,
- availableSkills,
- );
+ const fileInfo = await fileModel.checkHash(skill.zipFileHash);
+ if (!fileInfo.isExist || !fileInfo.url) continue;
- return {
- error: { message: errorMessage, name: 'SkillNotFound' },
- result: null,
- sessionExpiredAndRecreated: false,
- success: false,
- };
+ const fullUrl = await ctx.fileService.getFullFileUrl(fileInfo.url);
+ if (fullUrl) {
+ skillZipUrls[activatedSkill.name] = fullUrl;
+ log('Resolved zipUrl for skill %s: %s', activatedSkill.name, fullUrl);
}
}
- if (skill?.zipFileHash) {
- const fileModel = new FileModel(ctx.serverDB, userId);
- const fileInfo = await fileModel.checkHash(skill.zipFileHash);
-
- if (fileInfo.isExist && fileInfo.url) {
- const fullUrl = await ctx.fileService.getFullFileUrl(fileInfo.url);
- if (fullUrl) {
- enhancedParams = { ...params, zipUrl: fullUrl };
- log('Added zipUrl to execScript params for skill %s: %s', skill.name, fullUrl);
- }
- }
+ // Add skillZipUrls to params if any were resolved
+ if (Object.keys(skillZipUrls).length > 0) {
+ enhancedParams = {
+ ...enhancedParams,
+ skillZipUrls,
+ };
+ log('Added skillZipUrls to execScript params: %O', Object.keys(skillZipUrls));
}
}
diff --git a/src/services/electron/__tests__/desktopSkillRuntime.test.ts b/src/services/electron/__tests__/desktopSkillRuntime.test.ts
index 91f427f9b78..760d9a5f6ac 100644
--- a/src/services/electron/__tests__/desktopSkillRuntime.test.ts
+++ b/src/services/electron/__tests__/desktopSkillRuntime.test.ts
@@ -36,8 +36,8 @@ describe('desktopSkillRuntimeService', () => {
vi.clearAllMocks();
});
- it('should resolve an extracted directory from a skill name', async () => {
- getByNameMock.mockResolvedValue({
+ it('should resolve an extracted directory from activated skills', async () => {
+ getByIdMock.mockResolvedValue({
id: 'skill-1',
name: 'demo-skill',
zipFileHash: 'zip-hash-1',
@@ -52,11 +52,11 @@ describe('desktopSkillRuntimeService', () => {
zipPath: '/tmp/demo-skill.zip',
});
- const result = await desktopSkillRuntimeService.resolveExecutionDirectory({
- name: 'demo-skill',
- });
+ const result = await desktopSkillRuntimeService.resolveExecutionDirectory([
+ { id: 'skill-1', name: 'demo-skill' },
+ ]);
- expect(getByNameMock).toHaveBeenCalledWith('demo-skill');
+ expect(getByIdMock).toHaveBeenCalledWith('skill-1');
expect(getZipUrlMock).toHaveBeenCalledWith('skill-1');
expect(prepareSkillDirectoryMock).toHaveBeenCalledWith({
url: 'https://example.com/demo-skill.zip',
@@ -82,10 +82,9 @@ describe('desktopSkillRuntimeService', () => {
zipPath: '/tmp/demo-skill.zip',
});
- const result = await desktopSkillRuntimeService.resolveExecutionDirectory({
- id: 'lobe-skills-run-0',
- name: 'demo-skill',
- });
+ const result = await desktopSkillRuntimeService.resolveExecutionDirectory([
+ { id: 'lobe-skills-run-0', name: 'demo-skill' },
+ ]);
expect(getByIdMock).toHaveBeenCalledWith('lobe-skills-run-0');
expect(getByNameMock).toHaveBeenCalledWith('demo-skill');
@@ -94,15 +93,15 @@ describe('desktopSkillRuntimeService', () => {
});
it('should return undefined when the skill has no packaged zip', async () => {
- getByNameMock.mockResolvedValue({
+ getByIdMock.mockResolvedValue({
id: 'skill-1',
name: 'demo-skill',
zipFileHash: null,
});
- const result = await desktopSkillRuntimeService.resolveExecutionDirectory({
- name: 'demo-skill',
- });
+ const result = await desktopSkillRuntimeService.resolveExecutionDirectory([
+ { id: 'skill-1', name: 'demo-skill' },
+ ]);
expect(getZipUrlMock).not.toHaveBeenCalled();
expect(prepareSkillDirectoryMock).not.toHaveBeenCalled();
diff --git a/src/services/electron/desktopSkillRuntime.ts b/src/services/electron/desktopSkillRuntime.ts
index 1748bf1a74d..ea76ad18f28 100644
--- a/src/services/electron/desktopSkillRuntime.ts
+++ b/src/services/electron/desktopSkillRuntime.ts
@@ -1,11 +1,9 @@
-import type { ExecScriptParams } from '@lobechat/builtin-tool-skills';
+import type { ExecScriptActivatedSkill } from '@lobechat/builtin-tool-skills';
import { agentSkillService } from '@/services/skill';
import { localFileService } from './localFileService';
-type SkillConfig = ExecScriptParams['config'];
-
class DesktopSkillRuntimeService {
private async prepareSkillDirectoryForSkill(skill?: {
id: string;
@@ -34,8 +32,14 @@ class DesktopSkillRuntimeService {
return skillById ?? (params.name ? await agentSkillService.getByName(params.name) : undefined);
}
- async resolveExecutionDirectory(config?: SkillConfig): Promise<string | undefined> {
- const skill = await this.resolveSkill({ id: config?.id, name: config?.name });
+ async resolveExecutionDirectory(
+ activatedSkills?: ExecScriptActivatedSkill[],
+ ): Promise<string | undefined> {
+ // Use the first activated skill to resolve the execution directory
+ const firstSkill = activatedSkills?.[0];
+ if (!firstSkill) return undefined;
+
+ const skill = await this.resolveSkill({ id: firstSkill.id, name: firstSkill.name });
return this.prepareSkillDirectoryForSkill(skill);
}
diff --git a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
index b6c2583e005..218ee741d6b 100644
--- a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
+++ b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
@@ -36,6 +36,7 @@ import { topicSelectors } from '../../../selectors';
import { messageMapKey } from '../../../utils/messageMapKey';
import { topicMapKey } from '../../../utils/topicMapKey';
import {
+ selectActivatedSkillsFromMessages,
selectActivatedToolIdsFromMessages,
selectTodosFromMessages,
} from '../../message/selectors/dbMessage';
@@ -448,7 +449,9 @@ export class StreamingExecutorActionImpl {
const todos = selectTodosFromMessages(currentDBMessages);
// Accumulate activated tool IDs from lobe-tools messages
const activatedToolIds = selectActivatedToolIdsFromMessages(currentDBMessages);
- const stepContext = computeStepContext({ activatedToolIds, todos });
+ // Accumulate activated skills from activateSkill messages
+ const activatedSkills = selectActivatedSkillsFromMessages(currentDBMessages);
+ const stepContext = computeStepContext({ activatedSkills, activatedToolIds, todos });
// If page agent is enabled, get the latest XML for stepPageEditor
if (nextContext.initialContext?.pageEditor) {
diff --git a/src/store/chat/slices/message/selectors/dbMessage.ts b/src/store/chat/slices/message/selectors/dbMessage.ts
index f5142145ea1..0050f7f04a7 100644
--- a/src/store/chat/slices/message/selectors/dbMessage.ts
+++ b/src/store/chat/slices/message/selectors/dbMessage.ts
@@ -1,6 +1,11 @@
import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
+import { SkillsIdentifier } from '@lobechat/builtin-tool-skills';
import { LobeToolIdentifier } from '@lobechat/builtin-tool-tools';
-import { type StepContextTodos, type UIChatMessage } from '@lobechat/types';
+import {
+ type StepActivatedSkill,
+ type StepContextTodos,
+ type UIChatMessage,
+} from '@lobechat/types';
import { chatHelpers } from '../../../helpers';
import { type ChatStoreState } from '../../../initialState';
@@ -185,6 +190,42 @@ export const selectActivatedToolIdsFromMessages = (
return ids.size > 0 ? [...ids] : undefined;
};
+// ============= Activated Skills Selectors ========== //
+
+/**
+ * Accumulate activated skills from all activateSkill messages.
+ *
+ * Skills once activated remain active for the rest of the conversation.
+ * Uses skill id as key to deduplicate (later calls update the entry).
+ *
+ * @param messages - Array of chat messages to scan
+ * @returns Array of activated skills, or undefined if none
+ */
+export const selectActivatedSkillsFromMessages = (
+ messages: UIChatMessage[],
+): StepActivatedSkill[] | undefined => {
+ const skillsMap = new Map<string, StepActivatedSkill>();
+
+ for (const msg of messages) {
+ if (
+ msg.role === 'tool' &&
+ msg.plugin?.identifier === SkillsIdentifier &&
+ msg.plugin?.apiName === 'activateSkill' &&
+ msg.pluginState?.id &&
+ msg.pluginState?.name
+ ) {
+ const id = msg.pluginState.id as string;
+ skillsMap.set(id, {
+ description: msg.pluginState.description as string | undefined,
+ id,
+ name: msg.pluginState.name as string,
+ });
+ }
+ }
+
+ return skillsMap.size > 0 ? [...skillsMap.values()] : undefined;
+};
+
// ============= GTD Todos Selectors ========== //
/**
@@ -256,6 +297,7 @@ export const dbMessageSelectors = {
isCurrentDbChatLoaded,
latestDbMessage,
latestUserMessage,
+ selectActivatedSkillsFromMessages,
selectActivatedToolIdsFromMessages,
selectTodosFromMessages,
};
diff --git a/src/store/tool/slices/builtin/executors/lobe-skills.desktop.ts b/src/store/tool/slices/builtin/executors/lobe-skills.desktop.ts
index 40f6480e679..e4294436658 100644
--- a/src/store/tool/slices/builtin/executors/lobe-skills.desktop.ts
+++ b/src/store/tool/slices/builtin/executors/lobe-skills.desktop.ts
@@ -17,7 +17,9 @@ const runtime = new SkillsExecutionRuntime({
builtinSkills: filterBuiltinSkills(builtinSkills),
service: {
execScript: async (command, options) => {
- const cwd = await desktopSkillRuntimeService.resolveExecutionDirectory(options.config);
+ const cwd = await desktopSkillRuntimeService.resolveExecutionDirectory(
+ options.activatedSkills,
+ );
const result = await localFileService.runCommand({ command, cwd, timeout: undefined });
return {
exitCode: result.exit_code ?? 1,
diff --git a/src/store/tool/slices/builtin/executors/lobe-skills.ts b/src/store/tool/slices/builtin/executors/lobe-skills.ts
index 14556df4875..f5df804d188 100644
--- a/src/store/tool/slices/builtin/executors/lobe-skills.ts
+++ b/src/store/tool/slices/builtin/executors/lobe-skills.ts
@@ -18,10 +18,10 @@ const runtime = new SkillsExecutionRuntime({
builtinSkills: filterBuiltinSkills(builtinSkills),
service: {
execScript: async (command, options) => {
- const { description, config } = options;
+ const { activatedSkills, description } = options;
// Cloud: execute via Cloud Sandbox with execScript tool
- // Server will automatically resolve zipUrl based on config.name
+ // Server will resolve zipUrls for all activatedSkills
const chatState = useChatStore.getState();
const topicId = chatState.activeTopicId || 'default';
@@ -30,8 +30,8 @@ const runtime = new SkillsExecutionRuntime({
const result = await cloudSandboxService.callTool(
'execScript',
{
+ activatedSkills,
command,
- config,
description,
},
{ topicId },