

















@@ -3,6 +3,7 @@ import {
33resolveThinkingDefaultWithRuntimeCatalog,
44type ModelAliasIndex,
55} from "../../agents/model-selection.js";
6+import type { SkillCommandSpec } from "../../agents/skills.js";
67import type { OpenClawConfig } from "../../config/config.js";
78import { createLazyImportLoader } from "../../shared/lazy-promise.js";
89import { normalizeOptionalString } from "../../shared/string-coerce.js";
@@ -20,14 +21,22 @@ import { stripStructuralPrefixes } from "./mentions.js";
2021import type { createTypingController } from "./typing.js";
21222223type AgentDefaults = NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]> | undefined;
24+type SkillCommandsRuntime = typeof import("../skill-commands.runtime.js");
23252426const commandsRuntimeLoader = createLazyImportLoader(() => import("./commands.runtime.js"));
27+const skillCommandsRuntimeLoader = createLazyImportLoader<SkillCommandsRuntime>(
28+() => import("../skill-commands.runtime.js"),
29+);
2530const statusCommandRuntimeLoader = createLazyImportLoader(() => import("./commands-status.js"));
26312732function loadCommandsRuntime() {
2833return commandsRuntimeLoader.load();
2934}
303536+function loadSkillCommandsRuntime() {
37+return skillCommandsRuntimeLoader.load();
38+}
39+3140function loadStatusCommandRuntime() {
3241return statusCommandRuntimeLoader.load();
3342}
@@ -139,6 +148,17 @@ export async function maybeResolveNativeSlashCommandFastReply(params: {
139148};
140149}
141150151+let loadedSkillCommands: SkillCommandSpec[] | undefined;
152+const loadNativeSkillCommands = async () => {
153+loadedSkillCommands ??= (await loadSkillCommandsRuntime()).listSkillCommandsForWorkspace({
154+workspaceDir: params.workspaceDir,
155+cfg: params.cfg,
156+agentId: params.agentId,
157+skillFilter: params.skillFilter,
158+});
159+return loadedSkillCommands;
160+};
161+142162const commandResult = await (
143163await loadCommandsRuntime()
144164).handleCommands({
@@ -174,7 +194,7 @@ export async function maybeResolveNativeSlashCommandFastReply(params: {
174194model: params.model,
175195contextTokens: params.agentCfg?.contextTokens ?? 0,
176196isGroup: sessionState.isGroup,
177-skillCommands: [],
197+loadSkillCommands: loadNativeSkillCommands,
178198typing: params.typing,
179199});
180200if (!commandResult.shouldContinue) {
@@ -232,7 +252,7 @@ export async function maybeResolveNativeSlashCommandFastReply(params: {
232252allowTextCommands: directiveResult.result.allowTextCommands,
233253inlineStatusRequested: directiveResult.result.inlineStatusRequested,
234254command: directiveResult.result.command,
235-skillCommands: directiveResult.result.skillCommands,
255+skillCommands: loadedSkillCommands ?? directiveResult.result.skillCommands,
236256directives: directiveResult.result.directives,
237257cleanedBody: directiveResult.result.cleanedBody,
238258elevatedEnabled: directiveResult.result.elevatedEnabled,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。