openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
31 lines (30 loc) • 1.36 kB
JavaScript
import { C as requireActivePluginRegistry } from "./runtime-BL4wZfTq.js";
import "./command-registration-Ctsn0AES.js";
import { t as listRegisteredPluginCommands } from "./plugin-command-registry-BOeSDUSE.js";
import { t as executeRegisteredPluginCommand } from "./plugin-command-execution-BiIlm39K.js";
import { t as matchRegisteredPluginCommand } from "./plugin-command-matcher-DvAKG79h.js";
//#region src/plugins/commands.ts
/** Match one compatibility command invocation against the current command registry. */
function matchPluginCommand(commandBody, options = {}) {
const registry = requireActivePluginRegistry();
return matchRegisteredPluginCommand({
commands: listRegisteredPluginCommands(registry),
commandBody,
channel: options.channel,
aliasScope: { kind: "all" }
});
}
async function executePluginCommand(params) {
return await executeRegisteredPluginCommand(requireActivePluginRegistry(), params);
}
/** List registered plugin commands for help and command discovery. */
function listPluginCommands() {
return listRegisteredPluginCommands(requireActivePluginRegistry()).map((command) => ({
name: command.name,
description: command.description,
pluginId: command.pluginId,
acceptsArgs: command.acceptsArgs ?? false
}));
}
//#endregion
export { listPluginCommands as n, matchPluginCommand as r, executePluginCommand as t };