vamp-mcp 0.1.9 → 0.2.3
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.
- package/LICENSE +21 -21
- package/README.md +142 -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 +321 -94
- 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 -184
- 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 +440 -63
- 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 +94 -0
- package/runtime/guest_setup/http/postwin.ps1 +53 -0
- package/runtime/guest_setup/http/setup-all.ps1 +25 -0
- package/runtime/guest_setup/http/setup-win.cmd +7 -0
- package/runtime/guest_setup/http/setup.ps1 +44 -0
- package/runtime/guest_setup/http/setup.sh +50 -0
- package/runtime/guest_setup/kvm/setup-debian.sh +73 -0
- package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -0
- package/runtime/guest_setup/recorder/README.txt +12 -8
- 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 +66 -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/recorder.zip +0 -0
- 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/setup-user.py +53 -35
- package/runtime/guest_setup/recorder/setup-win.cmd +4 -11
- package/runtime/guest_setup/recorder/setup.ps1 +108 -30
- package/runtime/guest_setup/recorder/setup.sh +19 -1
- 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 -0
- package/runtime/guest_setup/setup-all.ps1 +35 -0
- package/runtime/guest_setup/setup-all.sh +22 -0
- package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -0
- package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -0
- package/runtime/guest_setup/vault/setup-guest-vault.sh +75 -0
- 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 +126 -0
- package/runtime/scripts/remote_host_setup.sh +7 -4
- package/runtime/scripts/script_server.py +571 -0
- 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 +49 -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
- package/runtime/scripts/build_debian_installer.py +0 -48
|
@@ -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,9 +7482,10 @@ 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
|
-
import { fileURLToPath as
|
|
7488
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7259
7489
|
|
|
7260
7490
|
// third_party/mcp-virtualbox/node_modules/zod/v4/classic/external.js
|
|
7261
7491
|
var external_exports = {};
|
|
@@ -27372,6 +27602,122 @@ Available keys: ${getAvailableKeys().join(", ")}` }],
|
|
|
27372
27602
|
});
|
|
27373
27603
|
}
|
|
27374
27604
|
|
|
27605
|
+
// backends/virtualbox/server.mjs
|
|
27606
|
+
var import_guest_bootstrap = __toESM(require_guest_bootstrap(), 1);
|
|
27607
|
+
|
|
27608
|
+
// third_party/mcp-virtualbox/dist/tools/script-server.js
|
|
27609
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
27610
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
27611
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
27612
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27613
|
+
var SCRIPT_SERVER_PORT = 8421;
|
|
27614
|
+
function scriptServerPython() {
|
|
27615
|
+
return process.env.RPA_HOST_PYTHON || process.env.PYTHON_PATH || (process.platform === "win32" ? "python" : "python3");
|
|
27616
|
+
}
|
|
27617
|
+
function scriptServerPath() {
|
|
27618
|
+
const here = dirname2(fileURLToPath2(import.meta.url));
|
|
27619
|
+
const candidates = [];
|
|
27620
|
+
if (process.env.VAMP_SCRIPT_SERVER_PATH)
|
|
27621
|
+
candidates.push(process.env.VAMP_SCRIPT_SERVER_PATH);
|
|
27622
|
+
let directory = here;
|
|
27623
|
+
for (let depth = 0; depth < 6; depth += 1) {
|
|
27624
|
+
candidates.push(join3(directory, "scripts", "script_server.py"));
|
|
27625
|
+
const parent = dirname2(directory);
|
|
27626
|
+
if (parent === directory)
|
|
27627
|
+
break;
|
|
27628
|
+
directory = parent;
|
|
27629
|
+
}
|
|
27630
|
+
candidates.push(join3(process.cwd(), "scripts", "script_server.py"));
|
|
27631
|
+
if (process.env.VAMP_REMOTE_REPO) {
|
|
27632
|
+
candidates.push(join3(process.env.VAMP_REMOTE_REPO, "scripts", "script_server.py"));
|
|
27633
|
+
}
|
|
27634
|
+
for (const candidate of candidates) {
|
|
27635
|
+
if (existsSync2(candidate))
|
|
27636
|
+
return candidate;
|
|
27637
|
+
}
|
|
27638
|
+
throw new Error(`scripts/script_server.py was not found next to the VAMP runtime (looked in ${candidates.join(", ")}).`);
|
|
27639
|
+
}
|
|
27640
|
+
function callScriptServer(command, extra = [], options = {}) {
|
|
27641
|
+
const script = scriptServerPath();
|
|
27642
|
+
const port = options.port ?? SCRIPT_SERVER_PORT;
|
|
27643
|
+
const args = [script, command, "--port", String(port), "--json", ...extra];
|
|
27644
|
+
return new Promise((resolve, reject) => {
|
|
27645
|
+
execFile3(scriptServerPython(), args, { timeout: options.timeoutMs ?? 12e4, maxBuffer: 4 * 1024 * 1024 }, (error62, stdout, stderr) => {
|
|
27646
|
+
const text = String(stdout || "").trim();
|
|
27647
|
+
if (text) {
|
|
27648
|
+
try {
|
|
27649
|
+
const parsed = JSON.parse(text);
|
|
27650
|
+
if (parsed.status === "failed" || parsed.status === "port_in_use") {
|
|
27651
|
+
resolve(parsed);
|
|
27652
|
+
return;
|
|
27653
|
+
}
|
|
27654
|
+
if (!error62) {
|
|
27655
|
+
resolve(parsed);
|
|
27656
|
+
return;
|
|
27657
|
+
}
|
|
27658
|
+
} catch {
|
|
27659
|
+
}
|
|
27660
|
+
}
|
|
27661
|
+
const detail = String(stderr || "").trim() || (error62 ? error62.message : "no output");
|
|
27662
|
+
reject(new Error(`VAMP script server ${command} failed: ${detail}`));
|
|
27663
|
+
});
|
|
27664
|
+
});
|
|
27665
|
+
}
|
|
27666
|
+
async function startScriptServer(options = {}) {
|
|
27667
|
+
const extra = [];
|
|
27668
|
+
if (options.bind)
|
|
27669
|
+
extra.push("--bind", options.bind);
|
|
27670
|
+
if (options.ttlSeconds !== void 0)
|
|
27671
|
+
extra.push("--ttl", String(options.ttlSeconds));
|
|
27672
|
+
return callScriptServer("start", extra, { port: options.port });
|
|
27673
|
+
}
|
|
27674
|
+
async function stopScriptServer(options = {}) {
|
|
27675
|
+
return callScriptServer("stop", [], { port: options.port });
|
|
27676
|
+
}
|
|
27677
|
+
async function scriptServerStatus(options = {}) {
|
|
27678
|
+
return callScriptServer("status", [], { port: options.port });
|
|
27679
|
+
}
|
|
27680
|
+
function errorMessage(error62) {
|
|
27681
|
+
return formatError2(error62);
|
|
27682
|
+
}
|
|
27683
|
+
function registerScriptServerTools(server2) {
|
|
27684
|
+
server2.tool("vm_script_server_start", `Start the host Python HTTP server on port ${SCRIPT_SERVER_PORT} that serves the guest setup folder (recorder, vault helpers, setup.sh/setup.ps1). Guests fetch it with wget/curl instead of a mounted or rewritten ISO; xorriso is not used. The server stops itself after ttlSeconds.`, {
|
|
27685
|
+
ttlSeconds: external_exports.number().int().min(0).max(86400).default(1800).describe("Seconds before the server stops itself (0 disables the limit)"),
|
|
27686
|
+
bind: external_exports.string().default("0.0.0.0").describe("Bind address. 0.0.0.0 serves VirtualBox NAT (10.0.2.2) and libvirt NAT (192.168.122.1); 127.0.0.1 is enough for VirtualBox NAT only")
|
|
27687
|
+
}, async ({ ttlSeconds, bind }) => {
|
|
27688
|
+
try {
|
|
27689
|
+
const info = await startScriptServer({ ttlSeconds: ttlSeconds ?? 1800, bind: bind ?? "0.0.0.0" });
|
|
27690
|
+
return {
|
|
27691
|
+
content: [{ type: "text", text: JSON.stringify({ ...info, verified: info.status === "running" }, null, 2) }],
|
|
27692
|
+
isError: info.status !== "running"
|
|
27693
|
+
};
|
|
27694
|
+
} catch (error62) {
|
|
27695
|
+
return {
|
|
27696
|
+
content: [
|
|
27697
|
+
{
|
|
27698
|
+
type: "text",
|
|
27699
|
+
text: JSON.stringify({
|
|
27700
|
+
status: "failed",
|
|
27701
|
+
port: SCRIPT_SERVER_PORT,
|
|
27702
|
+
error: errorMessage(error62),
|
|
27703
|
+
next_action: "Start it manually with: python3 scripts/script_server.py start"
|
|
27704
|
+
}, null, 2)
|
|
27705
|
+
}
|
|
27706
|
+
],
|
|
27707
|
+
isError: true
|
|
27708
|
+
};
|
|
27709
|
+
}
|
|
27710
|
+
});
|
|
27711
|
+
server2.tool("vm_script_server_status", `Report whether the VAMP guest setup HTTP server is running on port ${SCRIPT_SERVER_PORT}, with its guest URLs and wget/curl commands.`, {}, async () => {
|
|
27712
|
+
const info = await scriptServerStatus();
|
|
27713
|
+
return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }], isError: info.status === "port_in_use" };
|
|
27714
|
+
});
|
|
27715
|
+
server2.tool("vm_script_server_stop", `Stop the VAMP guest setup HTTP server on port ${SCRIPT_SERVER_PORT}. Do this once the guest finished installing; it also stops itself after its TTL.`, {}, async () => {
|
|
27716
|
+
const info = await stopScriptServer();
|
|
27717
|
+
return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }], isError: info.status === "failed" };
|
|
27718
|
+
});
|
|
27719
|
+
}
|
|
27720
|
+
|
|
27375
27721
|
// third_party/mcp-virtualbox/node_modules/zod/v3/helpers/util.js
|
|
27376
27722
|
var util;
|
|
27377
27723
|
(function(util2) {
|
|
@@ -27759,15 +28105,15 @@ var makeIssue = (params) => {
|
|
|
27759
28105
|
message: issueData.message
|
|
27760
28106
|
};
|
|
27761
28107
|
}
|
|
27762
|
-
let
|
|
28108
|
+
let errorMessage2 = "";
|
|
27763
28109
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
27764
28110
|
for (const map2 of maps) {
|
|
27765
|
-
|
|
28111
|
+
errorMessage2 = map2(fullIssue, { data, defaultError: errorMessage2 }).message;
|
|
27766
28112
|
}
|
|
27767
28113
|
return {
|
|
27768
28114
|
...issueData,
|
|
27769
28115
|
path: fullPath,
|
|
27770
|
-
message:
|
|
28116
|
+
message: errorMessage2
|
|
27771
28117
|
};
|
|
27772
28118
|
};
|
|
27773
28119
|
function addIssueToContext(ctx, issueData) {
|
|
@@ -33086,19 +33432,19 @@ var getRefs = (options) => {
|
|
|
33086
33432
|
};
|
|
33087
33433
|
|
|
33088
33434
|
// third_party/mcp-virtualbox/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
33089
|
-
function addErrorMessage(res, key,
|
|
33435
|
+
function addErrorMessage(res, key, errorMessage2, refs) {
|
|
33090
33436
|
if (!refs?.errorMessages)
|
|
33091
33437
|
return;
|
|
33092
|
-
if (
|
|
33438
|
+
if (errorMessage2) {
|
|
33093
33439
|
res.errorMessage = {
|
|
33094
33440
|
...res.errorMessage,
|
|
33095
|
-
[key]:
|
|
33441
|
+
[key]: errorMessage2
|
|
33096
33442
|
};
|
|
33097
33443
|
}
|
|
33098
33444
|
}
|
|
33099
|
-
function setResponseValueAndErrors(res, key, value,
|
|
33445
|
+
function setResponseValueAndErrors(res, key, value, errorMessage2, refs) {
|
|
33100
33446
|
res[key] = value;
|
|
33101
|
-
addErrorMessage(res, key,
|
|
33447
|
+
addErrorMessage(res, key, errorMessage2, refs);
|
|
33102
33448
|
}
|
|
33103
33449
|
|
|
33104
33450
|
// third_party/mcp-virtualbox/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
@@ -34412,8 +34758,8 @@ var Protocol = class {
|
|
|
34412
34758
|
if (queuedMessage.type === "response") {
|
|
34413
34759
|
resolver(message);
|
|
34414
34760
|
} else {
|
|
34415
|
-
const
|
|
34416
|
-
const error62 = new McpError(
|
|
34761
|
+
const errorMessage2 = message;
|
|
34762
|
+
const error62 = new McpError(errorMessage2.error.code, errorMessage2.error.message, errorMessage2.error.data);
|
|
34417
34763
|
resolver(error62);
|
|
34418
34764
|
}
|
|
34419
34765
|
} else {
|
|
@@ -35724,23 +36070,23 @@ var Server = class extends Protocol {
|
|
|
35724
36070
|
const wrappedHandler = async (request, extra) => {
|
|
35725
36071
|
const validatedRequest = safeParse3(CallToolRequestSchema, request);
|
|
35726
36072
|
if (!validatedRequest.success) {
|
|
35727
|
-
const
|
|
35728
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${
|
|
36073
|
+
const errorMessage2 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
36074
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage2}`);
|
|
35729
36075
|
}
|
|
35730
36076
|
const { params } = validatedRequest.data;
|
|
35731
36077
|
const result2 = await Promise.resolve(handler(request, extra));
|
|
35732
36078
|
if (params.task) {
|
|
35733
36079
|
const taskValidationResult = safeParse3(CreateTaskResultSchema, result2);
|
|
35734
36080
|
if (!taskValidationResult.success) {
|
|
35735
|
-
const
|
|
35736
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${
|
|
36081
|
+
const errorMessage2 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
36082
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage2}`);
|
|
35737
36083
|
}
|
|
35738
36084
|
return taskValidationResult.data;
|
|
35739
36085
|
}
|
|
35740
36086
|
const validationResult = safeParse3(CallToolResultSchema, result2);
|
|
35741
36087
|
if (!validationResult.success) {
|
|
35742
|
-
const
|
|
35743
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${
|
|
36088
|
+
const errorMessage2 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
36089
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage2}`);
|
|
35744
36090
|
}
|
|
35745
36091
|
return validationResult.data;
|
|
35746
36092
|
};
|
|
@@ -36280,12 +36626,12 @@ var McpServer = class {
|
|
|
36280
36626
|
* @param errorMessage - The error message.
|
|
36281
36627
|
* @returns The tool error result.
|
|
36282
36628
|
*/
|
|
36283
|
-
createToolError(
|
|
36629
|
+
createToolError(errorMessage2) {
|
|
36284
36630
|
return {
|
|
36285
36631
|
content: [
|
|
36286
36632
|
{
|
|
36287
36633
|
type: "text",
|
|
36288
|
-
text:
|
|
36634
|
+
text: errorMessage2
|
|
36289
36635
|
}
|
|
36290
36636
|
],
|
|
36291
36637
|
isError: true
|
|
@@ -36306,8 +36652,8 @@ var McpServer = class {
|
|
|
36306
36652
|
const parseResult = await safeParseAsync3(schemaToParse, args ?? {});
|
|
36307
36653
|
if (!parseResult.success) {
|
|
36308
36654
|
const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
36309
|
-
const
|
|
36310
|
-
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${
|
|
36655
|
+
const errorMessage2 = getParseErrorMessage(error62);
|
|
36656
|
+
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage2}`);
|
|
36311
36657
|
}
|
|
36312
36658
|
return parseResult.data;
|
|
36313
36659
|
}
|
|
@@ -36331,8 +36677,8 @@ var McpServer = class {
|
|
|
36331
36677
|
const parseResult = await safeParseAsync3(outputObj, result2.structuredContent);
|
|
36332
36678
|
if (!parseResult.success) {
|
|
36333
36679
|
const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
36334
|
-
const
|
|
36335
|
-
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${
|
|
36680
|
+
const errorMessage2 = getParseErrorMessage(error62);
|
|
36681
|
+
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage2}`);
|
|
36336
36682
|
}
|
|
36337
36683
|
}
|
|
36338
36684
|
/**
|
|
@@ -36544,8 +36890,8 @@ var McpServer = class {
|
|
|
36544
36890
|
const parseResult = await safeParseAsync3(argsObj, request.params.arguments ?? {});
|
|
36545
36891
|
if (!parseResult.success) {
|
|
36546
36892
|
const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
36547
|
-
const
|
|
36548
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${
|
|
36893
|
+
const errorMessage2 = getParseErrorMessage(error62);
|
|
36894
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage2}`);
|
|
36549
36895
|
}
|
|
36550
36896
|
const args = parseResult.data;
|
|
36551
36897
|
const cb = prompt.callback;
|
|
@@ -37056,15 +37402,15 @@ var StdioServerTransport = class {
|
|
|
37056
37402
|
};
|
|
37057
37403
|
|
|
37058
37404
|
// backends/virtualbox/server.mjs
|
|
37059
|
-
config2.mouseHelperPath = process.env.MOUSE_HELPER_PATH ||
|
|
37405
|
+
config2.mouseHelperPath = process.env.MOUSE_HELPER_PATH || fileURLToPath3(new URL("./mouse_click.py", import.meta.url));
|
|
37060
37406
|
config2.pythonPath = process.env.PYTHON_PATH || process.env.RPA_HOST_PYTHON || (process.platform === "win32" ? "python" : "python3");
|
|
37061
|
-
var server = new McpServer({ name: "VAMP", version: "0.
|
|
37407
|
+
var server = new McpServer({ name: "VAMP", version: "0.2.3" }, { 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." });
|
|
37062
37408
|
var result = (value) => ({ content: [{ type: "text", text: JSON.stringify(value) }] });
|
|
37063
37409
|
async function displayAction(action, values) {
|
|
37064
37410
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37065
|
-
const script =
|
|
37411
|
+
const script = fileURLToPath3(new URL("./display.py", import.meta.url));
|
|
37066
37412
|
const output2 = await new Promise((resolve, reject) => {
|
|
37067
|
-
const child =
|
|
37413
|
+
const child = execFile4(python, [script, action], { timeout: 18e4 }, (error62, stdout, stderr) => {
|
|
37068
37414
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37069
37415
|
else resolve(stdout);
|
|
37070
37416
|
});
|
|
@@ -37086,9 +37432,9 @@ server.tool(
|
|
|
37086
37432
|
);
|
|
37087
37433
|
async function historyAction(args) {
|
|
37088
37434
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37089
|
-
const script =
|
|
37435
|
+
const script = fileURLToPath3(new URL("./history.py", import.meta.url));
|
|
37090
37436
|
const output2 = await new Promise((resolve, reject) => {
|
|
37091
|
-
const child =
|
|
37437
|
+
const child = execFile4(python, [script], { timeout: 12e4 }, (error62, stdout, stderr) => {
|
|
37092
37438
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37093
37439
|
else resolve(stdout);
|
|
37094
37440
|
});
|
|
@@ -37135,10 +37481,10 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
|
|
|
37135
37481
|
limit: external_exports.number().int().min(1).max(8e3).default(8e3)
|
|
37136
37482
|
}, async ({ vm, action, filename, offset, limit }) => {
|
|
37137
37483
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37138
|
-
const script =
|
|
37484
|
+
const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
|
|
37139
37485
|
const args = action === "prepare" ? { vm, action } : { vm, action, filename, offset, limit };
|
|
37140
37486
|
const output2 = await new Promise((resolve, reject) => {
|
|
37141
|
-
const child =
|
|
37487
|
+
const child = execFile4(python, [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
|
|
37142
37488
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37143
37489
|
else resolve(stdout);
|
|
37144
37490
|
});
|
|
@@ -37147,9 +37493,9 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
|
|
|
37147
37493
|
return result(JSON.parse(output2));
|
|
37148
37494
|
});
|
|
37149
37495
|
async function transferAction(action, values) {
|
|
37150
|
-
const script =
|
|
37496
|
+
const script = fileURLToPath3(new URL("./transfers.py", import.meta.url));
|
|
37151
37497
|
const output2 = await new Promise((resolve, reject) => {
|
|
37152
|
-
const child =
|
|
37498
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
|
|
37153
37499
|
if (error62 && !stdout) reject(new Error(stderr || error62.message));
|
|
37154
37500
|
else resolve(stdout);
|
|
37155
37501
|
});
|
|
@@ -37178,9 +37524,9 @@ server.tool("vm_import_recording", "Copy a user-chosen .py/.handoff.json under g
|
|
|
37178
37524
|
username: external_exports.string().default("vboxuser")
|
|
37179
37525
|
}, async (args) => {
|
|
37180
37526
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37181
|
-
const script =
|
|
37527
|
+
const script = fileURLToPath3(new URL("./recordings.py", import.meta.url));
|
|
37182
37528
|
const output2 = await new Promise((resolve, reject) => {
|
|
37183
|
-
const child =
|
|
37529
|
+
const child = execFile4(python, [script], { timeout: 1e5 }, (error62, stdout, stderr) => {
|
|
37184
37530
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37185
37531
|
else resolve(stdout);
|
|
37186
37532
|
});
|
|
@@ -37196,9 +37542,9 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
|
|
|
37196
37542
|
confirm_restore: external_exports.boolean().default(false)
|
|
37197
37543
|
}, async (args) => {
|
|
37198
37544
|
const python = process.env.RPA_HOST_PYTHON || "python";
|
|
37199
|
-
const script =
|
|
37545
|
+
const script = fileURLToPath3(new URL("./snapshots.py", import.meta.url));
|
|
37200
37546
|
const output2 = await new Promise((resolve, reject) => {
|
|
37201
|
-
const child =
|
|
37547
|
+
const child = execFile4(python, [script], { timeout: 33e4 }, (error62, stdout, stderr) => {
|
|
37202
37548
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37203
37549
|
else resolve(stdout);
|
|
37204
37550
|
});
|
|
@@ -37207,9 +37553,9 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
|
|
|
37207
37553
|
return result(JSON.parse(output2));
|
|
37208
37554
|
});
|
|
37209
37555
|
async function vncAction(values) {
|
|
37210
|
-
const script =
|
|
37556
|
+
const script = fileURLToPath3(new URL("./vnc.py", import.meta.url));
|
|
37211
37557
|
const output2 = await new Promise((resolve, reject) => {
|
|
37212
|
-
const child =
|
|
37558
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
|
|
37213
37559
|
if (error62 && !stdout) reject(new Error(stderr || error62.message));
|
|
37214
37560
|
else resolve(stdout);
|
|
37215
37561
|
});
|
|
@@ -37238,6 +37584,8 @@ server.tool("vamp_setup", "First-run setup: check VirtualBox, show current resou
|
|
|
37238
37584
|
status: "needs_user_input",
|
|
37239
37585
|
virtualbox_installed: installed,
|
|
37240
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.",
|
|
37241
37589
|
default_guest: "debian",
|
|
37242
37590
|
profiles: profiles.profiles,
|
|
37243
37591
|
vnc: await initialVncProbe,
|
|
@@ -37245,16 +37593,16 @@ server.tool("vamp_setup", "First-run setup: check VirtualBox, show current resou
|
|
|
37245
37593
|
windows_notice: "Windows requires a valid license. Activate it yourself after installation. No license is included.",
|
|
37246
37594
|
public_credentials: { username: "vboxuser", password: "password123!" },
|
|
37247
37595
|
install_guide: "https://www.virtualbox.org/wiki/Downloads",
|
|
37248
|
-
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.",
|
|
37249
37597
|
vm_created: false
|
|
37250
37598
|
});
|
|
37251
37599
|
});
|
|
37252
37600
|
server.tool("vm_list", "List registered VirtualBox VMs without starting them", {}, async () => result(parseVMList(await vboxManage("list", "vms"))));
|
|
37253
37601
|
server.tool("vm_info", "Read VM configuration/state", { vm: external_exports.string().min(1) }, async ({ vm }) => result(parseMachineReadable(await vboxManage("showvminfo", vm, "--machinereadable"))));
|
|
37254
37602
|
async function prepareShareOnStart(vm) {
|
|
37255
|
-
const script =
|
|
37603
|
+
const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
|
|
37256
37604
|
const output2 = await new Promise((resolve, reject) => {
|
|
37257
|
-
const child =
|
|
37605
|
+
const child = execFile4(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
|
|
37258
37606
|
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37259
37607
|
else resolve(stdout);
|
|
37260
37608
|
});
|
|
@@ -37275,7 +37623,7 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
|
|
|
37275
37623
|
for (const uri of ["qemu:///session", "qemu:///system"]) {
|
|
37276
37624
|
let active = "";
|
|
37277
37625
|
try {
|
|
37278
|
-
active = (await promisify(
|
|
37626
|
+
active = (await promisify(execFile4)("virsh", ["-c", uri, "list", "--name"], { timeout: 1e4 })).stdout;
|
|
37279
37627
|
} catch {
|
|
37280
37628
|
}
|
|
37281
37629
|
if (active.trim()) throw new Error("A KVM VM is active. Shut it down before starting VirtualBox (VERR_SVM_IN_USE).");
|
|
@@ -37288,7 +37636,39 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
|
|
|
37288
37636
|
});
|
|
37289
37637
|
registerDisplayTools(server);
|
|
37290
37638
|
registerInputTools(server);
|
|
37291
|
-
server.tool("
|
|
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
|
+
});
|
|
37667
|
+
registerScriptServerTools(server);
|
|
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(),
|
|
37292
37672
|
name: external_exports.string().min(1).optional(),
|
|
37293
37673
|
iso_path: external_exports.string().min(1),
|
|
37294
37674
|
memory_mb: external_exports.number().int().optional(),
|
|
@@ -37297,23 +37677,20 @@ server.tool("vm_create", "Create a NEW Debian/Windows11 VM from a host ISO, star
|
|
|
37297
37677
|
basedir: external_exports.string().optional(),
|
|
37298
37678
|
image_index: external_exports.number().int().default(1),
|
|
37299
37679
|
product_key: external_exports.string().default(""),
|
|
37300
|
-
guest_os: external_exports.enum(["debian", "windows11"
|
|
37680
|
+
guest_os: external_exports.enum(["debian", "windows11"]).default("debian"),
|
|
37301
37681
|
allow_manual_install: external_exports.boolean().default(true),
|
|
37302
|
-
installation_mode: external_exports.enum(["auto"
|
|
37682
|
+
installation_mode: external_exports.enum(["auto"]).default("auto"),
|
|
37303
37683
|
windows_confirmed: external_exports.boolean().default(false),
|
|
37304
|
-
preflight_only: external_exports.boolean().default(false)
|
|
37684
|
+
preflight_only: external_exports.boolean().default(false),
|
|
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")
|
|
37305
37686
|
}, async (args) => {
|
|
37306
|
-
const
|
|
37307
|
-
|
|
37308
|
-
const output2 = await new Promise((resolve, reject) => {
|
|
37309
|
-
const child = execFile3(python, [script, "--json-stdin"], { timeout: 42e4 }, (error62, stdout, stderr) => {
|
|
37310
|
-
if (error62) reject(new Error(stdout || stderr || error62.message));
|
|
37311
|
-
else resolve(stdout);
|
|
37312
|
-
});
|
|
37313
|
-
child.stdin.end(JSON.stringify(args));
|
|
37314
|
-
});
|
|
37315
|
-
return result(JSON.parse(output2));
|
|
37687
|
+
const output2 = await packerCall("create", args);
|
|
37688
|
+
return result(output2);
|
|
37316
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)));
|
|
37317
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.", {
|
|
37318
37695
|
vm: external_exports.string().optional(),
|
|
37319
37696
|
controller: external_exports.string().optional(),
|
|
@@ -37330,8 +37707,8 @@ server.tool("vm_prepare_recorder", "Build guest recorder ISO; optionally attach
|
|
|
37330
37707
|
if (occupied && !["none", "emptydrive"].includes(occupied)) throw new Error("Refusing to replace occupied storage slot");
|
|
37331
37708
|
}
|
|
37332
37709
|
const python = process.env.RPA_HOST_PYTHON || process.env.PYTHON_PATH || "python";
|
|
37333
|
-
const builder =
|
|
37334
|
-
const { stdout } = await promisify(
|
|
37710
|
+
const builder = fileURLToPath3(new URL("../../scripts/build_recorder_media.py", import.meta.url));
|
|
37711
|
+
const { stdout } = await promisify(execFile4)(python, [builder], { timeout: 6e4 });
|
|
37335
37712
|
const media = JSON.parse(stdout);
|
|
37336
37713
|
if (controller) {
|
|
37337
37714
|
await vboxManage(
|