From de514500a707fa036fd9acf0503350210ade4b02 Mon Sep 17 00:00:00 2001 From: yu <191972707@qq.com> Date: Thu, 29 Oct 2026 09:25:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=85=A5=20System=5FExecuteCo?= =?UTF-8?q?mmandV1=E2=80=94=E2=80=94=E6=8C=89=20command=5Ftype=20=E5=88=86?= =?UTF-8?q?=E6=B4=BE=20PS/DOS/BAT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/capabilities/desktop.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/capabilities/desktop.ts b/src/main/capabilities/desktop.ts index e6a7248..35bcfc0 100644 --- a/src/main/capabilities/desktop.ts +++ b/src/main/capabilities/desktop.ts @@ -147,6 +147,20 @@ 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); register(["Mouse_MoveTo", "Mouse_Move"], mouseMove);