vamp-mcp 0.2.0 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vamp-mcp might be problematic. Click here for more details.
- package/LICENSE +21 -21
- package/README.md +144 -107
- package/THIRD_PARTY_NOTICES.md +32 -27
- package/bin/vamp-mcp.mjs +37 -37
- package/notices/mcp-virtualbox-LICENSE +21 -21
- package/notices/mcp-virtualbox-PROVENANCE.json +37 -37
- package/package.json +51 -17
- package/runtime/backends/common/Test-Environment.ps1 +7 -6
- package/runtime/backends/common/guest-install.json +58 -0
- package/runtime/backends/common/guest_install.py +57 -0
- package/runtime/backends/common/host-support.cjs +16 -0
- package/runtime/backends/common/packer.cjs +16 -0
- package/runtime/backends/hyperv/scripts/Manage-Desktop.ps1 +40 -67
- package/runtime/backends/hyperv/scripts/Send-InstallerBoot.ps1 +25 -0
- package/runtime/backends/kvm/debian-preseed.cfg +35 -35
- package/runtime/backends/library/registry.py +77 -77
- package/runtime/backends/library/replay.py +154 -154
- package/runtime/backends/packer/answer_media.py +16 -0
- package/runtime/backends/packer/deploy-hyperv.ps1 +10 -0
- package/runtime/backends/packer/drivers.py +49 -0
- package/runtime/backends/packer/hyperv-network.ps1 +10 -0
- package/runtime/backends/packer/images.py +75 -0
- package/runtime/backends/packer/osinfo.py +113 -0
- package/runtime/backends/packer/policy.json +15 -0
- package/runtime/backends/packer/runner.py +224 -0
- package/runtime/backends/packer/templates.py +118 -0
- package/runtime/backends/packer/toolchain.py +80 -0
- package/runtime/backends/remote_ssh/server.mjs +310 -93
- package/runtime/backends/virtualbox/desktop.cjs +37 -0
- package/runtime/backends/virtualbox/display.py +101 -101
- package/runtime/backends/virtualbox/history.py +139 -139
- package/runtime/backends/virtualbox/mouse_click.py +15 -15
- package/runtime/backends/virtualbox/mouse_move.py +18 -18
- package/runtime/backends/virtualbox/profiles.json +46 -46
- package/runtime/backends/virtualbox/provision.py +238 -197
- package/runtime/backends/virtualbox/recording_listener.py +29 -29
- package/runtime/backends/virtualbox/recordings.py +39 -39
- package/runtime/backends/virtualbox/requirements.txt +7 -7
- package/runtime/backends/virtualbox/rpas/debian_first_boot/manifest.json +1 -1
- package/runtime/backends/virtualbox/rpas/debian_first_boot/run.robot +13 -13
- package/runtime/backends/virtualbox/rpas/debian_first_boot/workflow.py +75 -75
- package/runtime/backends/virtualbox/rpas/observe/manifest.json +7 -7
- package/runtime/backends/virtualbox/rpas/observe/run.robot +13 -13
- package/runtime/backends/virtualbox/rpas/observe/workflow.py +14 -14
- package/runtime/backends/virtualbox/server.mjs +288 -237
- package/runtime/backends/virtualbox/setup_windows_sdk.py +58 -58
- package/runtime/backends/virtualbox/shares.py +68 -68
- package/runtime/backends/virtualbox/snapshots.py +53 -53
- package/runtime/backends/virtualbox/transfers.py +89 -89
- package/runtime/backends/virtualbox/vnc.py +61 -61
- package/runtime/guest_keys.py +13 -13
- package/runtime/guest_setup/http/debian-preseed.cfg +39 -0
- package/runtime/guest_setup/http/postdeb.sh +50 -3
- package/runtime/guest_setup/http/postwin.ps1 +53 -28
- package/runtime/guest_setup/http/setup-all.ps1 +25 -25
- package/runtime/guest_setup/http/setup-win.cmd +7 -7
- package/runtime/guest_setup/http/setup.ps1 +44 -29
- package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -52
- package/runtime/guest_setup/recorder/README.txt +12 -12
- package/runtime/guest_setup/recorder/RECORDER-LICENSE +674 -674
- package/runtime/guest_setup/recorder/RECORDING-GUIDE.txt +31 -31
- package/runtime/guest_setup/recorder/apply-display.py +41 -41
- package/runtime/guest_setup/recorder/configure-debian-mirrors.py +62 -62
- package/runtime/guest_setup/recorder/configure-gdm.py +23 -0
- package/runtime/guest_setup/recorder/configure-session.ps1 +14 -0
- package/runtime/guest_setup/recorder/gnome-display.py +60 -60
- package/runtime/guest_setup/recorder/install-display-startup.py +67 -39
- package/runtime/guest_setup/recorder/install-hypervisor-drivers.ps1 +34 -0
- package/runtime/guest_setup/recorder/install-resolution-shortcut.ps1 +36 -0
- package/runtime/guest_setup/recorder/postwin.cmd +10 -10
- package/runtime/guest_setup/recorder/prepare-recording.py +30 -30
- package/runtime/guest_setup/recorder/requirements-recorder.txt +2 -2
- package/runtime/guest_setup/recorder/session-policy.py +22 -0
- package/runtime/guest_setup/recorder/set-resolution-registry.ps1 +40 -0
- package/runtime/guest_setup/recorder/setup-user.py +53 -53
- package/runtime/guest_setup/recorder/setup-win.cmd +4 -60
- package/runtime/guest_setup/recorder/setup.ps1 +112 -81
- package/runtime/guest_setup/recorder/setup.sh +1 -0
- package/runtime/guest_setup/recorder/vamp-recorder.py +148 -148
- package/runtime/guest_setup/recorder/verify-recorder.py +4 -4
- package/runtime/guest_setup/recorder/windows-display.py +76 -76
- package/runtime/guest_setup/requirements.txt +2 -2
- package/runtime/guest_setup/setup-all.ps1 +35 -35
- package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -26
- package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -148
- package/runtime/recording_converter.py +230 -230
- package/runtime/requirements-mcp.txt +11 -11
- package/runtime/rpas/README.md +161 -161
- package/runtime/rpas/captcha_handoff/manifest.json +27 -27
- package/runtime/rpas/captcha_handoff/run.robot +16 -16
- package/runtime/rpas/captcha_handoff/workflow.py +11 -11
- package/runtime/rpas/common.resource +26 -26
- package/runtime/rpas/debian_update/manifest.json +27 -27
- package/runtime/rpas/debian_update/run.robot +17 -17
- package/runtime/rpas/debian_update/workflow.py +13 -13
- package/runtime/rpas/desktop_control/manifest.json +26 -26
- package/runtime/rpas/desktop_control/run.robot +27 -27
- package/runtime/rpas/desktop_control/workflow.py +51 -51
- package/runtime/rpas/firefox_launch/manifest.json +27 -27
- package/runtime/rpas/firefox_launch/run.robot +15 -15
- package/runtime/rpas/firefox_launch/workflow.py +25 -25
- package/runtime/rpas/firefox_naver/manifest.json +27 -27
- package/runtime/rpas/firefox_naver/run.robot +21 -21
- package/runtime/rpas/firefox_naver/workflow.py +28 -28
- package/runtime/rpas/kvm_validation/README.md +11 -11
- package/runtime/rpas/kvm_validation/manifest.json +28 -28
- package/runtime/rpas/kvm_validation/run.robot +30 -30
- package/runtime/rpas/kvm_validation/workflow.py +91 -91
- package/runtime/rpas/manifest.schema.json +105 -105
- package/runtime/rpas/naver_login/login.robot +25 -25
- package/runtime/rpas/naver_login/manifest.json +33 -33
- package/runtime/rpas/naver_login/run.robot +20 -20
- package/runtime/rpas/naver_login/workflow.py +32 -32
- package/runtime/rpas/windows_naver_recorded/README.md +24 -24
- package/runtime/rpas/windows_naver_recorded/conversion.json +25 -25
- package/runtime/rpas/windows_naver_recorded/manifest.json +28 -28
- package/runtime/rpas/windows_naver_recorded/run.robot +37 -37
- package/runtime/rpas/windows_naver_recorded/workflow.py +32 -32
- package/runtime/scripts/build_recorder_media.py +39 -39
- package/runtime/scripts/macos/setup-host.sh +0 -0
- package/runtime/scripts/script_server.py +571 -517
- package/runtime/skills/vamp-rpa-ui-checks/SKILL.md +26 -0
- package/runtime/skills/vamp-rpa-ui-checks/agents/openai.yaml +4 -0
- package/runtime/skills/vamp-rpa-ui-checks/references/display.md +12 -0
- package/runtime/skills/vamp-rpa-ui-checks/references/user-guide.md +51 -0
- package/runtime/skills/vamp-ui-cleanup/SKILL.md +15 -0
- package/runtime/skills/vamp-ui-cleanup/agents/openai.yaml +4 -0
- package/runtime/skills/vamp-ui-validation/SKILL.md +27 -0
- package/runtime/skills/vamp-ui-validation/agents/openai.yaml +4 -0
- package/runtime/third_party/mcp-virtualbox/scripts/mouse_click.py +65 -65
- package/runtime/third_party/pyautogui-recorder/LICENSE +674 -674
- package/runtime/third_party/pyautogui-recorder/PROVENANCE.json +16 -16
- package/runtime/third_party/pyautogui-recorder/PyAutoGuiRecorder.py +169 -169
- package/runtime/third_party/pyautogui-recorder/README.md +53 -53
|
@@ -6,7 +6,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
10
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
17
|
};
|
|
12
18
|
var __export = (target, all) => {
|
|
@@ -30,6 +36,229 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
36
|
mod
|
|
31
37
|
));
|
|
32
38
|
|
|
39
|
+
// backends/common/packer.cjs
|
|
40
|
+
var require_packer = __commonJS({
|
|
41
|
+
"backends/common/packer.cjs"(exports, module) {
|
|
42
|
+
var path = __require("node:path");
|
|
43
|
+
var { execFile: execFile5 } = __require("node:child_process");
|
|
44
|
+
function packer({ runtime, python = () => process.env.RPA_HOST_PYTHON || (process.platform === "win32" ? "python" : "python3"), spawn = execFile5 } = {}) {
|
|
45
|
+
return function call(action, { backend = "virtualbox", id, confirmed = false, ...request } = {}) {
|
|
46
|
+
const args = [path.join(runtime, "backends/packer/runner.py"), action, "--backend", backend];
|
|
47
|
+
if (id) args.push("--id", id);
|
|
48
|
+
if (confirmed) args.push("--confirmed");
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const child = spawn(typeof python === "function" ? python() : python, args, { windowsHide: true, timeout: 6e5, maxBuffer: 4 * 1024 ** 2 }, (error62, stdout, stderr) => {
|
|
51
|
+
let data;
|
|
52
|
+
try {
|
|
53
|
+
data = JSON.parse(stdout);
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
if (error62 || data?.status === "failed") reject(Error(data?.error || stderr || error62?.message || "Packer response was invalid"));
|
|
57
|
+
else resolve(data);
|
|
58
|
+
});
|
|
59
|
+
child.stdin.on("error", () => {
|
|
60
|
+
});
|
|
61
|
+
child.stdin.end(action === "create" ? JSON.stringify({ backend, ...request }) : "");
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
module.exports = { packer };
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// backends/common/guest-install.json
|
|
70
|
+
var require_guest_install = __commonJS({
|
|
71
|
+
"backends/common/guest-install.json"(exports, module) {
|
|
72
|
+
module.exports = {
|
|
73
|
+
schema_version: 1,
|
|
74
|
+
boot_wait_seconds: 10,
|
|
75
|
+
script_server_port: 8421,
|
|
76
|
+
hosts: {
|
|
77
|
+
virtualbox: [
|
|
78
|
+
"win32",
|
|
79
|
+
"linux",
|
|
80
|
+
"darwin"
|
|
81
|
+
],
|
|
82
|
+
hyperv: [
|
|
83
|
+
"win32"
|
|
84
|
+
],
|
|
85
|
+
kvm: [
|
|
86
|
+
"linux"
|
|
87
|
+
],
|
|
88
|
+
"apple-hypervisor": [
|
|
89
|
+
"darwin"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
amd64_install_host_arches: [
|
|
93
|
+
"x64",
|
|
94
|
+
"AMD64",
|
|
95
|
+
"x86_64"
|
|
96
|
+
],
|
|
97
|
+
debian: {
|
|
98
|
+
cfg: "debian-preseed.cfg",
|
|
99
|
+
efi_boot: [
|
|
100
|
+
{
|
|
101
|
+
kind: "text",
|
|
102
|
+
text: "c"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
kind: "wait",
|
|
106
|
+
seconds: 1
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
kind: "line",
|
|
110
|
+
text: "linux /install.amd/vmlinuz auto=true priority=critical preseed/url={base_url}/debian-preseed.cfg vamp_base={base_url} --- quiet"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
kind: "line",
|
|
114
|
+
text: "initrd /install.amd/initrd.gz"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
kind: "line",
|
|
118
|
+
text: "boot"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
windows11: {
|
|
123
|
+
efi_boot: [
|
|
124
|
+
{
|
|
125
|
+
kind: "enter"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// backends/common/guest-bootstrap.cjs
|
|
134
|
+
var require_guest_bootstrap = __commonJS({
|
|
135
|
+
"backends/common/guest-bootstrap.cjs"(exports, module) {
|
|
136
|
+
"use strict";
|
|
137
|
+
var installerPolicy = require_guest_install();
|
|
138
|
+
var SCRIPT_SERVER_PORT2 = installerPolicy.script_server_port;
|
|
139
|
+
var DEFAULT_GUEST_HOST = "10.0.2.2";
|
|
140
|
+
function scriptBaseUrl(host = DEFAULT_GUEST_HOST, port = SCRIPT_SERVER_PORT2) {
|
|
141
|
+
return `http://${host}:${port}`;
|
|
142
|
+
}
|
|
143
|
+
function defaultCommand(os, baseUrl = scriptBaseUrl()) {
|
|
144
|
+
return os === "windows11" ? `powershell -ExecutionPolicy Unrestricted -Command "irm ${baseUrl}/setup.ps1 | iex"` : `wget -qO- ${baseUrl}/setup.sh | sh`;
|
|
145
|
+
}
|
|
146
|
+
var DEFAULT_COMMANDS = {
|
|
147
|
+
windows11: defaultCommand("windows11"),
|
|
148
|
+
debian: defaultCommand("debian")
|
|
149
|
+
};
|
|
150
|
+
var WINDOWS_SHELL_COMMAND = "powershell -NoProfile -NoExit -ExecutionPolicy Unrestricted";
|
|
151
|
+
var ENTER = [28, 156];
|
|
152
|
+
var ELEVATED_ENTER = [29, 42, 28, 156, 170, 157];
|
|
153
|
+
var UAC_APPROVE = [224, 75, 224, 203, ...ENTER];
|
|
154
|
+
var WINDOWS_POLICY_COMMAND = "if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { throw 'Administrator PowerShell is required' }; Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force";
|
|
155
|
+
var RUN_DIALOG = [224, 91, 19, 147, 224, 219];
|
|
156
|
+
var OPEN_TERMINAL = [29, 56, 20, 148, 184, 157];
|
|
157
|
+
function guestOsFromType(ostype) {
|
|
158
|
+
const value = String(ostype || "").toLowerCase();
|
|
159
|
+
if (value.includes("windows")) return "windows11";
|
|
160
|
+
if (value.includes("debian") || value.includes("ubuntu") || value.includes("linux")) return "debian";
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
function clickStep(x, y) {
|
|
164
|
+
return { kind: "click", x, y, label: `click (${x}, ${y}) to pin keyboard focus` };
|
|
165
|
+
}
|
|
166
|
+
function planBootstrap(options) {
|
|
167
|
+
const guestOs = options.os === "debian" ? "debian" : "windows11";
|
|
168
|
+
const baseUrl = String(options.scriptServerUrl || scriptBaseUrl()).replace(/\/+$/, "");
|
|
169
|
+
const command = String(options.command || "").trim() || defaultCommand(guestOs, baseUrl);
|
|
170
|
+
const bootWaitSec = Math.max(0, Number(options.bootWaitSec ?? 30));
|
|
171
|
+
const focusClick = options.focusClick !== false;
|
|
172
|
+
const clickX = Number(options.clickX ?? 960);
|
|
173
|
+
const clickY = Number(options.clickY ?? 540);
|
|
174
|
+
const steps = [{ kind: "wait", ms: bootWaitSec * 1e3, label: `wait ${bootWaitSec}s for the guest to finish booting and reach its desktop` }];
|
|
175
|
+
if (guestOs === "windows11") {
|
|
176
|
+
steps.push({ kind: "keys", codes: RUN_DIALOG, label: "open the Run dialog (Win+R)" });
|
|
177
|
+
steps.push({ kind: "wait", ms: 2e3, label: "wait for the Run dialog" });
|
|
178
|
+
steps.push({ kind: "type", text: WINDOWS_SHELL_COMMAND, enter: false, label: "prepare administrator PowerShell" });
|
|
179
|
+
steps.push({ kind: "keys", codes: ELEVATED_ENTER, label: "launch as administrator (Ctrl+Shift+Enter)" });
|
|
180
|
+
steps.push({ kind: "wait", ms: 3e3, label: "wait for UAC consent" });
|
|
181
|
+
steps.push({ kind: "keys", codes: UAC_APPROVE, label: "approve UAC with Left and Enter" });
|
|
182
|
+
steps.push({ kind: "wait", ms: 3e3, label: "wait for administrator PowerShell" });
|
|
183
|
+
steps.push({ kind: "type", text: WINDOWS_POLICY_COMMAND, enter: true, label: "require administrator rights and set the process execution policy" });
|
|
184
|
+
steps.push({ kind: "wait", ms: 1e3, label: "wait for execution policy configuration" });
|
|
185
|
+
} else {
|
|
186
|
+
if (focusClick) {
|
|
187
|
+
steps.push(clickStep(clickX, clickY));
|
|
188
|
+
steps.push({ kind: "wait", ms: 1e3, label: "wait for the terminal to take keyboard focus" });
|
|
189
|
+
}
|
|
190
|
+
if (options.openTerminal) {
|
|
191
|
+
steps.push({ kind: "keys", codes: OPEN_TERMINAL, label: "open a desktop terminal (Ctrl+Alt+T)" });
|
|
192
|
+
steps.push({ kind: "wait", ms: 2e3, label: "wait for the terminal window" });
|
|
193
|
+
}
|
|
194
|
+
if (options.username) {
|
|
195
|
+
steps.push({ kind: "type", text: String(options.username), enter: true, label: "type the TTY login name" });
|
|
196
|
+
steps.push({ kind: "wait", ms: 1500, label: "wait for the password prompt" });
|
|
197
|
+
if (options.password) {
|
|
198
|
+
steps.push({ kind: "type", text: String(options.password), enter: true, label: "type the TTY password", secret: true });
|
|
199
|
+
steps.push({ kind: "wait", ms: 1500, label: "wait for the shell prompt" });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
steps.push({ kind: "type", text: command, enter: true, label: "run the bootstrap script" });
|
|
204
|
+
return { guestOs, command, steps };
|
|
205
|
+
}
|
|
206
|
+
function redactSteps(steps) {
|
|
207
|
+
return steps.map((step) => step.kind === "type" && step.secret ? { ...step, text: "********" } : step);
|
|
208
|
+
}
|
|
209
|
+
async function runGuestBootstrap(options, deps = {}) {
|
|
210
|
+
const { guestOs, command, steps } = planBootstrap(options);
|
|
211
|
+
const vbox = deps.vbox || (() => Promise.reject(new Error("No VBoxManage runner was provided.")));
|
|
212
|
+
const click = deps.click;
|
|
213
|
+
const sleep = deps.sleep || ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
214
|
+
const log = deps.log || (() => {
|
|
215
|
+
});
|
|
216
|
+
const chunkSize = Math.max(1, Number(options.chunkSize ?? 50));
|
|
217
|
+
const keyDelayMs = Math.max(0, Number(options.keyDelayMs ?? 30));
|
|
218
|
+
const result2 = { status: "dry_run", os: guestOs, command, plan: redactSteps(steps), executed: [], warnings: [], verified: false };
|
|
219
|
+
if (options.dryRun) {
|
|
220
|
+
result2.next_action = "Review the ordered steps, then run without dryRun to inject them.";
|
|
221
|
+
return result2;
|
|
222
|
+
}
|
|
223
|
+
for (const step of steps) {
|
|
224
|
+
try {
|
|
225
|
+
if (step.kind === "wait") {
|
|
226
|
+
if (step.ms > 0) await sleep(step.ms);
|
|
227
|
+
} else if (step.kind === "keys") {
|
|
228
|
+
await vbox(["controlvm", options.vm, "keyboardputscancode", ...step.codes.map((code) => code.toString(16).padStart(2, "0"))]);
|
|
229
|
+
} else if (step.kind === "type") {
|
|
230
|
+
for (let i = 0; i < step.text.length; i += chunkSize) {
|
|
231
|
+
await vbox(["controlvm", options.vm, "keyboardputstring", step.text.slice(i, i + chunkSize)]);
|
|
232
|
+
if (i + chunkSize < step.text.length && keyDelayMs > 0) await sleep(keyDelayMs);
|
|
233
|
+
}
|
|
234
|
+
if (step.enter) await vbox(["controlvm", options.vm, "keyboardputscancode", ...ENTER.map((code) => code.toString(16).padStart(2, "0"))]);
|
|
235
|
+
} else if (step.kind === "click") {
|
|
236
|
+
try {
|
|
237
|
+
if (click) await click(step.x, step.y);
|
|
238
|
+
} catch (error62) {
|
|
239
|
+
const detail = error62?.message || String(error62);
|
|
240
|
+
result2.warnings.push(`Focus click at (${step.x}, ${step.y}) failed: ${detail}. Keystrokes were still sent; if the guest lost keyboard focus, inject again.`);
|
|
241
|
+
log(`Focus click failed: ${detail}`);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
result2.executed.push(step.label);
|
|
246
|
+
log(step.label);
|
|
247
|
+
} catch (error62) {
|
|
248
|
+
result2.status = "failed";
|
|
249
|
+
result2.error = `${step.label}: ${error62?.message || String(error62)}`;
|
|
250
|
+
result2.next_action = "Confirm the desktop is running, then inject again or type the command in the VM screen.";
|
|
251
|
+
return result2;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
result2.status = "completed";
|
|
255
|
+
result2.next_action = "Delivery is not proof of execution. Check the guest screen or setup log before treating the script as installed.";
|
|
256
|
+
return result2;
|
|
257
|
+
}
|
|
258
|
+
module.exports = { SCRIPT_SERVER_PORT: SCRIPT_SERVER_PORT2, DEFAULT_GUEST_HOST, scriptBaseUrl, defaultCommand, DEFAULT_COMMANDS, WINDOWS_SHELL_COMMAND, ENTER, RUN_DIALOG, OPEN_TERMINAL, guestOsFromType, planBootstrap, runGuestBootstrap, redactSteps };
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
33
262
|
// third_party/mcp-virtualbox/node_modules/ajv/dist/compile/codegen/code.js
|
|
34
263
|
var require_code = __commonJS({
|
|
35
264
|
"third_party/mcp-virtualbox/node_modules/ajv/dist/compile/codegen/code.js"(exports) {
|
|
@@ -7253,7 +7482,8 @@ var require_dist = __commonJS({
|
|
|
7253
7482
|
});
|
|
7254
7483
|
|
|
7255
7484
|
// backends/virtualbox/server.mjs
|
|
7256
|
-
|
|
7485
|
+
var import_packer = __toESM(require_packer(), 1);
|
|
7486
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
7257
7487
|
import { promisify } from "node:util";
|
|
7258
7488
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7259
7489
|
|
|
@@ -27372,8 +27602,8 @@ Available keys: ${getAvailableKeys().join(", ")}` }],
|
|
|
27372
27602
|
});
|
|
27373
27603
|
}
|
|
27374
27604
|
|
|
27375
|
-
//
|
|
27376
|
-
|
|
27605
|
+
// backends/virtualbox/server.mjs
|
|
27606
|
+
var import_guest_bootstrap = __toESM(require_guest_bootstrap(), 1);
|
|
27377
27607
|
|
|
27378
27608
|
// third_party/mcp-virtualbox/dist/tools/script-server.js
|
|
27379
27609
|
import { execFile as execFile3 } from "node:child_process";
|
|
@@ -27488,213 +27718,6 @@ function registerScriptServerTools(server2) {
|
|
|
27488
27718
|
});
|
|
27489
27719
|
}
|
|
27490
27720
|
|
|
27491
|
-
// third_party/mcp-virtualbox/dist/tools/bootstrap.js
|
|
27492
|
-
var DEFAULT_GUEST_HOST = "10.0.2.2";
|
|
27493
|
-
function scriptBaseUrl(host = DEFAULT_GUEST_HOST, port = SCRIPT_SERVER_PORT) {
|
|
27494
|
-
return `http://${host}:${port}`;
|
|
27495
|
-
}
|
|
27496
|
-
function defaultBootstrapCommand(guestOs, baseUrl = scriptBaseUrl()) {
|
|
27497
|
-
return guestOs === "windows11" ? `powershell -ExecutionPolicy Bypass -Command "irm ${baseUrl}/setup.ps1 | iex"` : `wget -qO- ${baseUrl}/setup.sh | sh`;
|
|
27498
|
-
}
|
|
27499
|
-
var DEFAULT_BOOTSTRAP_COMMANDS = {
|
|
27500
|
-
windows11: defaultBootstrapCommand("windows11"),
|
|
27501
|
-
debian: defaultBootstrapCommand("debian")
|
|
27502
|
-
};
|
|
27503
|
-
var BOOTSTRAP_COMBOS = {
|
|
27504
|
-
runDialog: "win+r",
|
|
27505
|
-
enter: "enter",
|
|
27506
|
-
terminal: "ctrl+alt+t"
|
|
27507
|
-
};
|
|
27508
|
-
var WINDOWS_SHELL_COMMAND = "powershell -ExecutionPolicy Bypass";
|
|
27509
|
-
function planBootstrap(options) {
|
|
27510
|
-
const steps = [];
|
|
27511
|
-
const focus = options.focusClick !== false;
|
|
27512
|
-
const bootWait = Math.max(0, options.bootWaitSec);
|
|
27513
|
-
steps.push({
|
|
27514
|
-
kind: "wait",
|
|
27515
|
-
ms: bootWait * 1e3,
|
|
27516
|
-
label: `wait ${bootWait}s for the guest to finish booting and reach its desktop`
|
|
27517
|
-
});
|
|
27518
|
-
if (options.guestOs === "windows11") {
|
|
27519
|
-
steps.push({ kind: "keys", combo: BOOTSTRAP_COMBOS.runDialog, label: "open the Run dialog (Win+R)" });
|
|
27520
|
-
steps.push({ kind: "wait", ms: 2e3, label: "wait for the Run dialog" });
|
|
27521
|
-
steps.push({ kind: "type", text: "cmd", enter: true, label: "start cmd" });
|
|
27522
|
-
steps.push({ kind: "wait", ms: 2500, label: "wait for the console window" });
|
|
27523
|
-
if (focus)
|
|
27524
|
-
steps.push(clickStep(options));
|
|
27525
|
-
if (focus)
|
|
27526
|
-
steps.push({ kind: "wait", ms: 1e3, label: "wait for the console to take keyboard focus" });
|
|
27527
|
-
steps.push({ kind: "type", text: WINDOWS_SHELL_COMMAND, enter: true, label: "start PowerShell with a bypass execution policy" });
|
|
27528
|
-
steps.push({ kind: "wait", ms: 1500, label: "wait for PowerShell" });
|
|
27529
|
-
} else {
|
|
27530
|
-
if (focus)
|
|
27531
|
-
steps.push(clickStep(options));
|
|
27532
|
-
steps.push({ kind: "wait", ms: 1e3, label: "wait for the terminal to take keyboard focus" });
|
|
27533
|
-
if (options.openTerminal) {
|
|
27534
|
-
steps.push({ kind: "keys", combo: BOOTSTRAP_COMBOS.terminal, label: "open a desktop terminal (Ctrl+Alt+T)" });
|
|
27535
|
-
steps.push({ kind: "wait", ms: 2e3, label: "wait for the terminal window" });
|
|
27536
|
-
}
|
|
27537
|
-
if (options.username) {
|
|
27538
|
-
steps.push({ kind: "type", text: options.username, enter: true, label: "type the TTY login name" });
|
|
27539
|
-
steps.push({ kind: "wait", ms: 1500, label: "wait for the password prompt" });
|
|
27540
|
-
if (options.password) {
|
|
27541
|
-
steps.push({ kind: "type", text: options.password, enter: true, label: "type the TTY password", secret: true });
|
|
27542
|
-
steps.push({ kind: "wait", ms: 1500, label: "wait for the shell prompt" });
|
|
27543
|
-
}
|
|
27544
|
-
}
|
|
27545
|
-
}
|
|
27546
|
-
steps.push({ kind: "type", text: options.command, enter: true, label: "run the bootstrap script" });
|
|
27547
|
-
return steps;
|
|
27548
|
-
}
|
|
27549
|
-
function clickStep(options) {
|
|
27550
|
-
return {
|
|
27551
|
-
kind: "click",
|
|
27552
|
-
x: options.clickX,
|
|
27553
|
-
y: options.clickY,
|
|
27554
|
-
label: `click (${options.clickX}, ${options.clickY}) to pin keyboard focus`
|
|
27555
|
-
};
|
|
27556
|
-
}
|
|
27557
|
-
function redactPlan(plan) {
|
|
27558
|
-
return plan.map((step) => step.kind === "type" && step.secret ? { ...step, text: "********" } : step);
|
|
27559
|
-
}
|
|
27560
|
-
function mouseHelperClick(vm, x, y) {
|
|
27561
|
-
return new Promise((resolve, reject) => {
|
|
27562
|
-
execFile4(config2.pythonPath, [config2.mouseHelperPath, vm, String(x), String(y), "left"], { timeout: config2.defaultTimeout }, (error62, _stdout, stderr) => {
|
|
27563
|
-
if (error62)
|
|
27564
|
-
reject(new Error(String(stderr || error62.message).trim() || "mouse helper failed"));
|
|
27565
|
-
else
|
|
27566
|
-
resolve();
|
|
27567
|
-
});
|
|
27568
|
-
});
|
|
27569
|
-
}
|
|
27570
|
-
async function runBootstrap(options, runtime = {}) {
|
|
27571
|
-
const baseUrl = (options.scriptServerUrl || scriptBaseUrl()).replace(/\/+$/, "");
|
|
27572
|
-
const customCommand = (options.command ?? "").trim();
|
|
27573
|
-
const command = customCommand || defaultBootstrapCommand(options.guestOs, baseUrl);
|
|
27574
|
-
const plan = planBootstrap({ ...options, command });
|
|
27575
|
-
const vm = options.vm;
|
|
27576
|
-
const vbox = runtime.vbox ?? ((args) => vboxManage(...args));
|
|
27577
|
-
const click = runtime.click ?? ((x, y) => mouseHelperClick(vm, x, y));
|
|
27578
|
-
const sleep = runtime.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
27579
|
-
const log = runtime.log ?? config2.log;
|
|
27580
|
-
const chunkSize = Math.max(1, options.chunkSize ?? 50);
|
|
27581
|
-
const keyDelayMs = Math.max(0, options.keyDelayMs ?? 30);
|
|
27582
|
-
const result2 = {
|
|
27583
|
-
status: "dry_run",
|
|
27584
|
-
vm,
|
|
27585
|
-
os: options.guestOs,
|
|
27586
|
-
command,
|
|
27587
|
-
plan: redactPlan(plan),
|
|
27588
|
-
executed: [],
|
|
27589
|
-
warnings: [],
|
|
27590
|
-
verified: false
|
|
27591
|
-
};
|
|
27592
|
-
if (options.dryRun) {
|
|
27593
|
-
result2.next_action = `Review the ordered steps, then call again with dryRun=false to inject them. Guest setup is downloaded from ${baseUrl}.`;
|
|
27594
|
-
return result2;
|
|
27595
|
-
}
|
|
27596
|
-
if (options.serveScripts !== false && !customCommand) {
|
|
27597
|
-
try {
|
|
27598
|
-
const ensure = runtime.ensureScriptServer ?? (() => startScriptServer({ ttlSeconds: 1800 }));
|
|
27599
|
-
const server2 = await ensure();
|
|
27600
|
-
result2.scriptServer = server2;
|
|
27601
|
-
if (server2.status !== "running") {
|
|
27602
|
-
result2.status = "failed";
|
|
27603
|
-
result2.error = `The guest setup HTTP server is not running on port ${SCRIPT_SERVER_PORT}: ${server2.error ?? server2.status}`;
|
|
27604
|
-
result2.next_action = "Start it with vm_script_server_start (or python3 scripts/script_server.py start), then inject again. Nothing was typed.";
|
|
27605
|
-
return result2;
|
|
27606
|
-
}
|
|
27607
|
-
} catch (error62) {
|
|
27608
|
-
result2.status = "failed";
|
|
27609
|
-
result2.error = `Could not start the guest setup HTTP server: ${formatError2(error62)}`;
|
|
27610
|
-
result2.next_action = "Start it with vm_script_server_start (or python3 scripts/script_server.py start), then inject again. Nothing was typed.";
|
|
27611
|
-
return result2;
|
|
27612
|
-
}
|
|
27613
|
-
}
|
|
27614
|
-
for (const step of plan) {
|
|
27615
|
-
try {
|
|
27616
|
-
if (step.kind === "wait") {
|
|
27617
|
-
if (step.ms > 0)
|
|
27618
|
-
await sleep(step.ms);
|
|
27619
|
-
} else if (step.kind === "keys") {
|
|
27620
|
-
await vbox(["controlvm", vm, "keyboardputscancode", ...resolveScancodes(step.combo)]);
|
|
27621
|
-
} else if (step.kind === "type") {
|
|
27622
|
-
for (let i = 0; i < step.text.length; i += chunkSize) {
|
|
27623
|
-
const chunk = step.text.slice(i, i + chunkSize);
|
|
27624
|
-
await vbox(["controlvm", vm, "keyboardputstring", chunk]);
|
|
27625
|
-
if (i + chunkSize < step.text.length && keyDelayMs > 0)
|
|
27626
|
-
await sleep(keyDelayMs);
|
|
27627
|
-
}
|
|
27628
|
-
if (step.enter)
|
|
27629
|
-
await vbox(["controlvm", vm, "keyboardputscancode", ...resolveScancodes(BOOTSTRAP_COMBOS.enter)]);
|
|
27630
|
-
} else if (step.kind === "click") {
|
|
27631
|
-
try {
|
|
27632
|
-
await click(step.x, step.y);
|
|
27633
|
-
} catch (error62) {
|
|
27634
|
-
const detail = formatError2(error62);
|
|
27635
|
-
result2.warnings.push(`Focus click at (${step.x}, ${step.y}) failed: ${detail}. Keystrokes were still sent; if the guest lost keyboard focus, inject again.`);
|
|
27636
|
-
log(`[bootstrap] focus click failed: ${detail}`);
|
|
27637
|
-
continue;
|
|
27638
|
-
}
|
|
27639
|
-
}
|
|
27640
|
-
result2.executed.push(step.kind === "type" && step.secret ? step.label : step.label);
|
|
27641
|
-
log(`[bootstrap] ${step.label}`);
|
|
27642
|
-
} catch (error62) {
|
|
27643
|
-
result2.status = "failed";
|
|
27644
|
-
result2.error = `${step.label}: ${formatError2(error62)}`;
|
|
27645
|
-
result2.next_action = "Confirm the VM is running, then call vm_guest_bootstrap again or send the command with vm_keyboard_type.";
|
|
27646
|
-
return result2;
|
|
27647
|
-
}
|
|
27648
|
-
}
|
|
27649
|
-
result2.status = "completed";
|
|
27650
|
-
result2.next_action = `Delivery is not proof of execution. Screenshot the guest or read its setup log before treating the recorder or script as installed. Setup was served from ${baseUrl}.`;
|
|
27651
|
-
return result2;
|
|
27652
|
-
}
|
|
27653
|
-
function sanitizeVm(value) {
|
|
27654
|
-
return value.endsWith(".") ? value.slice(0, -1) : value;
|
|
27655
|
-
}
|
|
27656
|
-
function registerBootstrapTools(server2) {
|
|
27657
|
-
server2.tool("vm_guest_bootstrap", `Bootstrap a newly installed Windows or Debian VM using keystroke injection (Packer style). Opens the Run dialog (Win+R) or focuses the terminal, launches PowerShell/shell, and runs the guest setup downloaded from the host HTTP script server on port ${SCRIPT_SERVER_PORT} (wget/curl; xorriso is not used). Send keystrokes and pointer events only; success means the keys were delivered, not that the guest ran the script.`, {
|
|
27658
|
-
vm: external_exports.string().describe("VM name or UUID"),
|
|
27659
|
-
os: external_exports.enum(["windows11", "debian"]).default("windows11").describe("Guest OS type"),
|
|
27660
|
-
command: external_exports.string().optional().describe(`Command to execute in the guest. Defaults to the HTTP setup command: windows11 "${DEFAULT_BOOTSTRAP_COMMANDS.windows11}", debian "${DEFAULT_BOOTSTRAP_COMMANDS.debian}".`),
|
|
27661
|
-
bootWaitSec: external_exports.number().default(30).describe("Seconds to wait after boot before injecting keys"),
|
|
27662
|
-
clickX: external_exports.number().default(960).describe("X coordinate for focus click"),
|
|
27663
|
-
clickY: external_exports.number().default(540).describe("Y coordinate for focus click"),
|
|
27664
|
-
dryRun: external_exports.boolean().default(false).describe("Return planned keystroke/mouse actions without executing"),
|
|
27665
|
-
focusClick: external_exports.boolean().default(true).describe("Click the screen centre to pin keyboard focus before typing"),
|
|
27666
|
-
openTerminal: external_exports.boolean().default(false).describe("Debian only: press Ctrl+Alt+T to open a desktop terminal first"),
|
|
27667
|
-
username: external_exports.string().optional().describe("Debian only: TTY login name, typed before the command when a console login is needed"),
|
|
27668
|
-
password: external_exports.string().optional().describe("Debian only: TTY password, typed after the login name. Never echoed back in the result"),
|
|
27669
|
-
chunkSize: external_exports.number().default(50).describe("Characters per keyboardputstring call. Smaller is safer; the guest keyboard buffer drops characters if overrun"),
|
|
27670
|
-
keyDelayMs: external_exports.number().default(30).describe("Delay in ms between chunks"),
|
|
27671
|
-
serveScripts: external_exports.boolean().default(true).describe(`Start the host HTTP script server on port ${SCRIPT_SERVER_PORT} before typing the default setup command`),
|
|
27672
|
-
scriptServerUrl: external_exports.string().optional().describe(`Base URL the guest downloads from. Default http://10.0.2.2:${SCRIPT_SERVER_PORT}; use http://192.168.122.1:${SCRIPT_SERVER_PORT} on libvirt's default NAT network`)
|
|
27673
|
-
}, async ({ vm, os, command, bootWaitSec, clickX, clickY, dryRun, focusClick, openTerminal, username, password, chunkSize, keyDelayMs, serveScripts, scriptServerUrl }) => {
|
|
27674
|
-
const result2 = await runBootstrap({
|
|
27675
|
-
vm: sanitizeVm(vm),
|
|
27676
|
-
guestOs: os ?? "windows11",
|
|
27677
|
-
command,
|
|
27678
|
-
bootWaitSec: bootWaitSec ?? 30,
|
|
27679
|
-
clickX: clickX ?? 960,
|
|
27680
|
-
clickY: clickY ?? 540,
|
|
27681
|
-
dryRun: dryRun ?? false,
|
|
27682
|
-
focusClick: focusClick ?? true,
|
|
27683
|
-
openTerminal: openTerminal ?? false,
|
|
27684
|
-
username,
|
|
27685
|
-
password,
|
|
27686
|
-
chunkSize: chunkSize ?? 50,
|
|
27687
|
-
keyDelayMs: keyDelayMs ?? 30,
|
|
27688
|
-
serveScripts: serveScripts ?? true,
|
|
27689
|
-
scriptServerUrl
|
|
27690
|
-
});
|
|
27691
|
-
return {
|
|
27692
|
-
content: [{ type: "text", text: JSON.stringify(result2, null, 2) }],
|
|
27693
|
-
isError: result2.status === "failed"
|
|
27694
|
-
};
|
|
27695
|
-
});
|
|
27696
|
-
}
|
|
27697
|
-
|
|
27698
27721
|
// third_party/mcp-virtualbox/node_modules/zod/v3/helpers/util.js
|
|
27699
27722
|
var util;
|
|
27700
27723
|
(function(util2) {
|
|
@@ -37381,13 +37404,13 @@ var StdioServerTransport = class {
|
|
|
37381
37404
|
// backends/virtualbox/server.mjs
|
|
37382
37405
|
config2.mouseHelperPath = process.env.MOUSE_HELPER_PATH || fileURLToPath3(new URL("./mouse_click.py", import.meta.url));
|
|
37383
37406
|
config2.pythonPath = process.env.PYTHON_PATH || process.env.RPA_HOST_PYTHON || (process.platform === "win32" ? "python" : "python3");
|
|
37384
|
-
var server = new McpServer({ name: "VAMP", version: "0.2.
|
|
37407
|
+
var server = new McpServer({ name: "VAMP", version: "0.2.4" }, { instructions: "Before recording or coordinate-based guest automation, verify the actual guest framebuffer is 1920x1080 with 100% guest scaling. If different, adjust the guest display using the authorized backend and verify fresh evidence before continuing; respect user pauses. A resized viewer is not proof. If the guest display drifts, use the guest-local reset shortcut: Windows Desktop Set-Resolution-1920x1080.cmd or Debian home ~/set-resolution-1920x1080.sh. Do not run guest commands on the host. Read skills/vamp-rpa-ui-checks/references/display.md in the packaged runtime (or .agents/skills/vamp-rpa-ui-checks/references/display.md in the repository) for Linux and Windows guidance. Before repeated CUA or multimodal analysis, use VAMP RPA Library rpa_search/rpa_details to find suitable reviewed skills. Prefer an authorized compatible skill; read its compact result before requesting screenshots, and verify application outcomes. Token efficiency: run reusable RPA and outcome checks locally; on success return compact status, verification and evidence paths. Do not forward full OCR text, YOLO arrays, unchanged screenshots, base64 images, full logs or source into the model context by default. For failure, ambiguity, UI changes or requested inspection, read only a targeted region/query/page first. Local OCR/YOLO reduces model tokens only when outputs stay local or compact; do not claim a measured saving without a comparable benchmark. When authoring or repairing GUI RPAs, include task-specific local OCR/YOLO verification in Python and assert its result in Robot by default; add artifact checks when available. Input dispatch or an arbitrary detection alone is not success. Fall back to targeted CUA when needed. For first-time setup call vamp_setup. Ask whether to set up the VM environment and obtain a host ISO path. Ask once each session whether to take a snapshot, explain space use, and never assume consent. Debian is default; ask explicitly before Windows and disclose licensing and public sandbox credentials. Do not create a VM merely on server startup. Guest setup scripts are served over HTTP from the host Python script server on port 8421; guests install them with wget/curl (vm_script_server_start/status/stop). New VM installations use HashiCorp Packer and official hypervisor plugins. Windows guest setup runs as administrator with Unrestricted process execution policy, installs VirtualBox Guest Additions or KVM virtio-win guest drivers and resumes after the driver reboot before reporting completion. Explain the CLI/plugin downloads, large golden images plus separate live disks, public sandbox autologin, and the 60-second post-reboot setup wait. Windows answer media is generated with an isolated pycdlib helper; original ISOs are not rewritten." });
|
|
37385
37408
|
var result = (value) => ({ content: [{ type: "text", text: JSON.stringify(value) }] });
|
|
37386
37409
|
async function displayAction(action, values) {
|
|
37387
37410
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37388
37411
|
const script = fileURLToPath3(new URL("./display.py", import.meta.url));
|
|
37389
37412
|
const output2 = await new Promise((resolve, reject) => {
|
|
37390
|
-
const child =
|
|
37413
|
+
const child = execFile4(python, [script, action], { timeout: 18e4 }, (error62, stdout, stderr) => {
|
|
37391
37414
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37392
37415
|
else resolve(stdout);
|
|
37393
37416
|
});
|
|
@@ -37411,7 +37434,7 @@ async function historyAction(args) {
|
|
|
37411
37434
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37412
37435
|
const script = fileURLToPath3(new URL("./history.py", import.meta.url));
|
|
37413
37436
|
const output2 = await new Promise((resolve, reject) => {
|
|
37414
|
-
const child =
|
|
37437
|
+
const child = execFile4(python, [script], { timeout: 12e4 }, (error62, stdout, stderr) => {
|
|
37415
37438
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37416
37439
|
else resolve(stdout);
|
|
37417
37440
|
});
|
|
@@ -37461,7 +37484,7 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
|
|
|
37461
37484
|
const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
|
|
37462
37485
|
const args = action === "prepare" ? { vm, action } : { vm, action, filename, offset, limit };
|
|
37463
37486
|
const output2 = await new Promise((resolve, reject) => {
|
|
37464
|
-
const child =
|
|
37487
|
+
const child = execFile4(python, [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
|
|
37465
37488
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37466
37489
|
else resolve(stdout);
|
|
37467
37490
|
});
|
|
@@ -37472,7 +37495,7 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
|
|
|
37472
37495
|
async function transferAction(action, values) {
|
|
37473
37496
|
const script = fileURLToPath3(new URL("./transfers.py", import.meta.url));
|
|
37474
37497
|
const output2 = await new Promise((resolve, reject) => {
|
|
37475
|
-
const child =
|
|
37498
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
|
|
37476
37499
|
if (error62 && !stdout) reject(new Error(stderr || error62.message));
|
|
37477
37500
|
else resolve(stdout);
|
|
37478
37501
|
});
|
|
@@ -37503,7 +37526,7 @@ server.tool("vm_import_recording", "Copy a user-chosen .py/.handoff.json under g
|
|
|
37503
37526
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37504
37527
|
const script = fileURLToPath3(new URL("./recordings.py", import.meta.url));
|
|
37505
37528
|
const output2 = await new Promise((resolve, reject) => {
|
|
37506
|
-
const child =
|
|
37529
|
+
const child = execFile4(python, [script], { timeout: 1e5 }, (error62, stdout, stderr) => {
|
|
37507
37530
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37508
37531
|
else resolve(stdout);
|
|
37509
37532
|
});
|
|
@@ -37521,7 +37544,7 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
|
|
|
37521
37544
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37522
37545
|
const script = fileURLToPath3(new URL("./snapshots.py", import.meta.url));
|
|
37523
37546
|
const output2 = await new Promise((resolve, reject) => {
|
|
37524
|
-
const child =
|
|
37547
|
+
const child = execFile4(python, [script], { timeout: 33e4 }, (error62, stdout, stderr) => {
|
|
37525
37548
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37526
37549
|
else resolve(stdout);
|
|
37527
37550
|
});
|
|
@@ -37532,7 +37555,7 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
|
|
|
37532
37555
|
async function vncAction(values) {
|
|
37533
37556
|
const script = fileURLToPath3(new URL("./vnc.py", import.meta.url));
|
|
37534
37557
|
const output2 = await new Promise((resolve, reject) => {
|
|
37535
|
-
const child =
|
|
37558
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
|
|
37536
37559
|
if (error62 && !stdout) reject(new Error(stderr || error62.message));
|
|
37537
37560
|
else resolve(stdout);
|
|
37538
37561
|
});
|
|
@@ -37561,6 +37584,8 @@ server.tool("vamp_setup", "First-run setup: check VirtualBox, show current resou
|
|
|
37561
37584
|
status: "needs_user_input",
|
|
37562
37585
|
virtualbox_installed: installed,
|
|
37563
37586
|
virtualbox_version: version2,
|
|
37587
|
+
installation_engine: "HashiCorp Packer",
|
|
37588
|
+
packer_notice: "Preparation downloads the managed Packer CLI and official VirtualBox plugin. Builds create large golden images and separate live disks, and wait 60 seconds after first reboot for post-install setup. Debian uses public sandbox autologin.",
|
|
37564
37589
|
default_guest: "debian",
|
|
37565
37590
|
profiles: profiles.profiles,
|
|
37566
37591
|
vnc: await initialVncProbe,
|
|
@@ -37568,7 +37593,7 @@ server.tool("vamp_setup", "First-run setup: check VirtualBox, show current resou
|
|
|
37568
37593
|
windows_notice: "Windows requires a valid license. Activate it yourself after installation. No license is included.",
|
|
37569
37594
|
public_credentials: { username: "vboxuser", password: "password123!" },
|
|
37570
37595
|
install_guide: "https://www.virtualbox.org/wiki/Downloads",
|
|
37571
|
-
next_action: installed ? "After
|
|
37596
|
+
next_action: installed ? "After setup consent call vm_packer_prepare, then confirm ISO/specs and call vm_create once. Use vm_golden_images for build completion and storage paths." : "Guide the user to install VirtualBox for the host OS, or use an authorized host-install workflow. Recheck --version before VM creation.",
|
|
37572
37597
|
vm_created: false
|
|
37573
37598
|
});
|
|
37574
37599
|
});
|
|
@@ -37577,7 +37602,7 @@ server.tool("vm_info", "Read VM configuration/state", { vm: external_exports.str
|
|
|
37577
37602
|
async function prepareShareOnStart(vm) {
|
|
37578
37603
|
const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
|
|
37579
37604
|
const output2 = await new Promise((resolve, reject) => {
|
|
37580
|
-
const child =
|
|
37605
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
|
|
37581
37606
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37582
37607
|
else resolve(stdout);
|
|
37583
37608
|
});
|
|
@@ -37598,7 +37623,7 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
|
|
|
37598
37623
|
for (const uri of ["qemu:///session", "qemu:///system"]) {
|
|
37599
37624
|
let active = "";
|
|
37600
37625
|
try {
|
|
37601
|
-
active = (await promisify(
|
|
37626
|
+
active = (await promisify(execFile4)("virsh", ["-c", uri, "list", "--name"], { timeout: 1e4 })).stdout;
|
|
37602
37627
|
} catch {
|
|
37603
37628
|
}
|
|
37604
37629
|
if (active.trim()) throw new Error("A KVM VM is active. Shut it down before starting VirtualBox (VERR_SVM_IN_USE).");
|
|
@@ -37611,9 +37636,39 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
|
|
|
37611
37636
|
});
|
|
37612
37637
|
registerDisplayTools(server);
|
|
37613
37638
|
registerInputTools(server);
|
|
37614
|
-
|
|
37639
|
+
server.tool("vm_guest_bootstrap", "Run guest setup with the same bootstrap as VSIX. Windows opens administrator PowerShell via Ctrl+Shift+Enter, approves UAC with Left/Enter and sets Unrestricted execution policy for the process. Delivery is not proof of setup completion.", {
|
|
37640
|
+
vm: external_exports.string().min(1),
|
|
37641
|
+
os: external_exports.enum(["windows11", "debian"]).default("windows11"),
|
|
37642
|
+
command: external_exports.string().optional(),
|
|
37643
|
+
bootWaitSec: external_exports.number().min(0).default(30),
|
|
37644
|
+
clickX: external_exports.number().default(960),
|
|
37645
|
+
clickY: external_exports.number().default(540),
|
|
37646
|
+
dryRun: external_exports.boolean().default(false),
|
|
37647
|
+
focusClick: external_exports.boolean().default(true),
|
|
37648
|
+
openTerminal: external_exports.boolean().default(false),
|
|
37649
|
+
username: external_exports.string().optional(),
|
|
37650
|
+
password: external_exports.string().optional(),
|
|
37651
|
+
chunkSize: external_exports.number().int().min(1).max(100).default(50),
|
|
37652
|
+
keyDelayMs: external_exports.number().min(0).default(30),
|
|
37653
|
+
serveScripts: external_exports.boolean().default(true),
|
|
37654
|
+
scriptServerUrl: external_exports.string().optional()
|
|
37655
|
+
}, async (args) => {
|
|
37656
|
+
if (!args.dryRun) {
|
|
37657
|
+
const state = parseMachineReadable(await vboxManage("showvminfo", args.vm, "--machinereadable")).VMState;
|
|
37658
|
+
if (!["running", "paused"].includes(state)) throw Error("Start the guest before injecting setup.");
|
|
37659
|
+
if (args.serveScripts) await startScriptServer();
|
|
37660
|
+
}
|
|
37661
|
+
const report = await import_guest_bootstrap.default.runGuestBootstrap(args, {
|
|
37662
|
+
vbox: (argv) => vboxManage(...argv),
|
|
37663
|
+
click: (x, y) => new Promise((resolve, reject) => execFile4(config2.pythonPath, [config2.mouseHelperPath, args.vm, String(x), String(y), "left"], { windowsHide: true, timeout: 3e4 }, (error62) => error62 ? reject(error62) : resolve()))
|
|
37664
|
+
});
|
|
37665
|
+
return { ...result(report), isError: report.status === "failed" };
|
|
37666
|
+
});
|
|
37615
37667
|
registerScriptServerTools(server);
|
|
37616
|
-
server.tool("vm_create", "Create a NEW
|
|
37668
|
+
server.tool("vm_create", "Create a NEW VM through HashiCorp Packer: install CLI and official plugin, build OS and post-install scripts, wait 60s after reboot, export a golden image and deploy a separate live disk. Returns queued; use vm_golden_images for status/paths. Public sandbox autologin vboxuser/password123!.", {
|
|
37669
|
+
backend: external_exports.enum(["virtualbox", "hyperv", "kvm"]).default("virtualbox"),
|
|
37670
|
+
switch_name: external_exports.string().min(1).optional(),
|
|
37671
|
+
libvirt_uri: external_exports.enum(["qemu:///session", "qemu:///system"]).optional(),
|
|
37617
37672
|
name: external_exports.string().min(1).optional(),
|
|
37618
37673
|
iso_path: external_exports.string().min(1),
|
|
37619
37674
|
memory_mb: external_exports.number().int().optional(),
|
|
@@ -37622,24 +37677,20 @@ server.tool("vm_create", "Create a NEW Debian/Windows11 VM from a host ISO, star
|
|
|
37622
37677
|
basedir: external_exports.string().optional(),
|
|
37623
37678
|
image_index: external_exports.number().int().default(1),
|
|
37624
37679
|
product_key: external_exports.string().default(""),
|
|
37625
|
-
guest_os: external_exports.enum(["debian", "windows11"
|
|
37680
|
+
guest_os: external_exports.enum(["debian", "windows11"]).default("debian"),
|
|
37626
37681
|
allow_manual_install: external_exports.boolean().default(true),
|
|
37627
|
-
installation_mode: external_exports.enum(["auto"
|
|
37682
|
+
installation_mode: external_exports.enum(["auto"]).default("auto"),
|
|
37628
37683
|
windows_confirmed: external_exports.boolean().default(false),
|
|
37629
37684
|
preflight_only: external_exports.boolean().default(false),
|
|
37630
37685
|
serve_scripts: external_exports.boolean().default(true).describe("Start the host Python HTTP script server on port 8421 so the guest installs the recorder with wget/curl")
|
|
37631
37686
|
}, async (args) => {
|
|
37632
|
-
const
|
|
37633
|
-
|
|
37634
|
-
const output2 = await new Promise((resolve, reject) => {
|
|
37635
|
-
const child = execFile5(python, [script, "--json-stdin"], { timeout: 42e4 }, (error62, stdout, stderr) => {
|
|
37636
|
-
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37637
|
-
else resolve(stdout);
|
|
37638
|
-
});
|
|
37639
|
-
child.stdin.end(JSON.stringify(args));
|
|
37640
|
-
});
|
|
37641
|
-
return result(JSON.parse(output2));
|
|
37687
|
+
const output2 = await packerCall("create", args);
|
|
37688
|
+
return result(output2);
|
|
37642
37689
|
});
|
|
37690
|
+
var packerCall = import_packer.default.packer({ runtime: fileURLToPath3(new URL("../../", import.meta.url)) });
|
|
37691
|
+
server.tool("vm_packer_prepare", "Download checksum-pinned HashiCorp Packer CLI for this host and install the selected official hypervisor plugin. Does not create a VM.", { backend: external_exports.enum(["virtualbox", "hyperv", "kvm"]).default("virtualbox") }, async (args) => result(await packerCall("prepare", args)));
|
|
37692
|
+
server.tool("vm_golden_images", "List Packer build status, golden image IDs, absolute file paths, byte sizes and log paths. Live VM disks are stored separately.", {}, async () => result(await packerCall("images")));
|
|
37693
|
+
server.tool("vm_golden_image_delete", "Permanently delete one VAMP golden image and build logs by ID. Call without confirmed first to inspect its path/size, then obtain explicit user approval. Live VM disks remain separate.", { id: external_exports.string().regex(/^[a-f0-9]{32}$/), confirmed: external_exports.boolean().default(false) }, async (args) => result(await packerCall("delete-image", args)));
|
|
37643
37694
|
server.tool("vm_prepare_recorder", "Build guest recorder ISO; optionally attach to an empty DVD slot of an OFF VM. Does not run installer or record.", {
|
|
37644
37695
|
vm: external_exports.string().optional(),
|
|
37645
37696
|
controller: external_exports.string().optional(),
|
|
@@ -37657,7 +37708,7 @@ server.tool("vm_prepare_recorder", "Build guest recorder ISO; optionally attach
|
|
|
37657
37708
|
}
|
|
37658
37709
|
const python = process.env.RPA_HOST_PYTHON || process.env.PYTHON_PATH || "python";
|
|
37659
37710
|
const builder = fileURLToPath3(new URL("../../scripts/build_recorder_media.py", import.meta.url));
|
|
37660
|
-
const { stdout } = await promisify(
|
|
37711
|
+
const { stdout } = await promisify(execFile4)(python, [builder], { timeout: 6e4 });
|
|
37661
37712
|
const media = JSON.parse(stdout);
|
|
37662
37713
|
if (controller) {
|
|
37663
37714
|
await vboxManage(
|