fix: 移除 System_ExecuteCommandV1 重复注册,统一使用原生实现(type:1=DOS 2=BAT 3=PS)

This commit is contained in:
yu 2026-10-29 09:35:51 +08:00
parent de514500a7
commit bb23bb192c

View File

@ -147,19 +147,6 @@ const executeCommand: CapabilityHandler = async (_ctx, node, args) => {
return powershell(command, Math.max(1000, number(args, ["timeoutMs"], 120000)));
};
register("System_ExecuteCommandV1", async (ctx, node, args) => {
const type = String(args.command_type ?? "1");
const dos = String(args.dos_command ?? "").trim();
const bat = String(args.bat_file ?? "").trim();
const ps = String(args.ps_command ?? "").trim();
let command = ps;
if (type === "2") command = dos;
else if (type === "3") command = bat ? ("& '" + bat.replace(/'/g, "''") + "'") : "";
if (!command) {
throw new RuntimeError("validation_error", "命令为空", { nodeId: node.id, componentId: node.componentId, recommendation: "填写 PowerShell/DOS 命令或 BAT 文件路径" });
}
return powershell(command, Math.max(1000, Number(args.timeoutMs) || 120000));
});
register(["Keyboard_Send_V1", "Keyboard_Send", "Keyboard_PressNew", "Keyboard_Press"], keyboardSend);
register(["Mouse_Click", "Mouse_ClickNew"], mouseClick);