openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
32 lines (31 loc) • 1.41 kB
JavaScript
import { y as requireActivePluginRegistry } from "./runtime-zG-NbNbr.mjs";
import "./command-registry-state-B0TT9g3x.mjs";
import { t as listRegisteredPluginCommands } from "./plugin-command-registry-ZNvdGSMY.mjs";
import "./command-registration-DkcHbqO9.mjs";
import { t as executeRegisteredPluginCommand } from "./plugin-command-execution-BGSAn3jl.mjs";
import { t as matchRegisteredPluginCommand } from "./plugin-command-matcher-CILtOL33.mjs";
//#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 };