openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
34 lines (33 loc) • 1.52 kB
JavaScript
import { t as isCommandFlagEnabled } from "./commands.flags-D0cD2TME.mjs";
import { t as getChatCommands } from "./commands-registry.data-tI91IerD.mjs";
//#region src/auto-reply/commands-registry-list.ts
/** Command-list assembly and config filtering for chat command registries. */
/** Lists built-in commands plus optional skill-provided commands. */
function listChatCommands(params) {
const commands = [...getChatCommands()];
for (const spec of params?.skillCommands ?? []) {
const command = {
key: `skill:${spec.skillName}`,
nativeName: spec.name,
description: spec.description,
textAliases: [`/${spec.name}`],
acceptsArgs: true,
argsParsing: "none",
scope: "both",
category: "tools"
};
if (spec.descriptionLocalizations) command.descriptionLocalizations = spec.descriptionLocalizations;
commands.push(command);
}
return commands;
}
/** Applies config feature flags to command keys that can be operator-disabled. */
function isCommandEnabled(cfg, commandKey) {
return commandKey === "config" || commandKey === "mcp" || commandKey === "plugins" || commandKey === "debug" || commandKey === "bash" ? isCommandFlagEnabled(cfg, commandKey) : true;
}
/** Lists commands visible for a specific config, preserving dynamic skill commands. */
function listChatCommandsForConfig(cfg, params) {
return listChatCommands(params).filter((command) => isCommandEnabled(cfg, command.key));
}
//#endregion
export { listChatCommands as n, listChatCommandsForConfig as r, isCommandEnabled as t };