vamp-mcp 0.1.9 → 0.2.0

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.
Files changed (29) hide show
  1. package/README.md +11 -11
  2. package/package.json +1 -1
  3. package/runtime/backends/remote_ssh/server.mjs +27 -17
  4. package/runtime/backends/virtualbox/provision.py +45 -32
  5. package/runtime/backends/virtualbox/server.mjs +377 -51
  6. package/runtime/guest_setup/http/postdeb.sh +47 -0
  7. package/runtime/guest_setup/http/postwin.ps1 +28 -0
  8. package/runtime/guest_setup/http/setup-all.ps1 +25 -0
  9. package/runtime/guest_setup/http/setup-win.cmd +7 -0
  10. package/runtime/guest_setup/http/setup.ps1 +29 -0
  11. package/runtime/guest_setup/http/setup.sh +50 -0
  12. package/runtime/guest_setup/kvm/setup-debian.sh +73 -0
  13. package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -0
  14. package/runtime/guest_setup/recorder/README.txt +4 -0
  15. package/runtime/guest_setup/recorder/recorder.zip +0 -0
  16. package/runtime/guest_setup/recorder/setup-user.py +19 -1
  17. package/runtime/guest_setup/recorder/setup-win.cmd +55 -6
  18. package/runtime/guest_setup/recorder/setup.ps1 +57 -6
  19. package/runtime/guest_setup/recorder/setup.sh +18 -1
  20. package/runtime/guest_setup/requirements.txt +2 -0
  21. package/runtime/guest_setup/setup-all.ps1 +35 -0
  22. package/runtime/guest_setup/setup-all.sh +22 -0
  23. package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -0
  24. package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -0
  25. package/runtime/guest_setup/vault/setup-guest-vault.sh +75 -0
  26. package/runtime/scripts/macos/setup-host.sh +126 -0
  27. package/runtime/scripts/remote_host_setup.sh +7 -4
  28. package/runtime/scripts/script_server.py +517 -0
  29. package/runtime/scripts/build_debian_installer.py +0 -48
@@ -7253,9 +7253,9 @@ var require_dist = __commonJS({
7253
7253
  });
7254
7254
 
7255
7255
  // backends/virtualbox/server.mjs
7256
- import { execFile as execFile3 } from "node:child_process";
7256
+ import { execFile as execFile5 } from "node:child_process";
7257
7257
  import { promisify } from "node:util";
7258
- import { fileURLToPath as fileURLToPath2 } from "node:url";
7258
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
7259
7259
 
7260
7260
  // third_party/mcp-virtualbox/node_modules/zod/v4/classic/external.js
7261
7261
  var external_exports = {};
@@ -27372,6 +27372,329 @@ Available keys: ${getAvailableKeys().join(", ")}` }],
27372
27372
  });
27373
27373
  }
27374
27374
 
27375
+ // third_party/mcp-virtualbox/dist/tools/bootstrap.js
27376
+ import { execFile as execFile4 } from "node:child_process";
27377
+
27378
+ // third_party/mcp-virtualbox/dist/tools/script-server.js
27379
+ import { execFile as execFile3 } from "node:child_process";
27380
+ import { existsSync as existsSync2 } from "node:fs";
27381
+ import { dirname as dirname2, join as join3 } from "node:path";
27382
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
27383
+ var SCRIPT_SERVER_PORT = 8421;
27384
+ function scriptServerPython() {
27385
+ return process.env.RPA_HOST_PYTHON || process.env.PYTHON_PATH || (process.platform === "win32" ? "python" : "python3");
27386
+ }
27387
+ function scriptServerPath() {
27388
+ const here = dirname2(fileURLToPath2(import.meta.url));
27389
+ const candidates = [];
27390
+ if (process.env.VAMP_SCRIPT_SERVER_PATH)
27391
+ candidates.push(process.env.VAMP_SCRIPT_SERVER_PATH);
27392
+ let directory = here;
27393
+ for (let depth = 0; depth < 6; depth += 1) {
27394
+ candidates.push(join3(directory, "scripts", "script_server.py"));
27395
+ const parent = dirname2(directory);
27396
+ if (parent === directory)
27397
+ break;
27398
+ directory = parent;
27399
+ }
27400
+ candidates.push(join3(process.cwd(), "scripts", "script_server.py"));
27401
+ if (process.env.VAMP_REMOTE_REPO) {
27402
+ candidates.push(join3(process.env.VAMP_REMOTE_REPO, "scripts", "script_server.py"));
27403
+ }
27404
+ for (const candidate of candidates) {
27405
+ if (existsSync2(candidate))
27406
+ return candidate;
27407
+ }
27408
+ throw new Error(`scripts/script_server.py was not found next to the VAMP runtime (looked in ${candidates.join(", ")}).`);
27409
+ }
27410
+ function callScriptServer(command, extra = [], options = {}) {
27411
+ const script = scriptServerPath();
27412
+ const port = options.port ?? SCRIPT_SERVER_PORT;
27413
+ const args = [script, command, "--port", String(port), "--json", ...extra];
27414
+ return new Promise((resolve, reject) => {
27415
+ execFile3(scriptServerPython(), args, { timeout: options.timeoutMs ?? 12e4, maxBuffer: 4 * 1024 * 1024 }, (error62, stdout, stderr) => {
27416
+ const text = String(stdout || "").trim();
27417
+ if (text) {
27418
+ try {
27419
+ const parsed = JSON.parse(text);
27420
+ if (parsed.status === "failed" || parsed.status === "port_in_use") {
27421
+ resolve(parsed);
27422
+ return;
27423
+ }
27424
+ if (!error62) {
27425
+ resolve(parsed);
27426
+ return;
27427
+ }
27428
+ } catch {
27429
+ }
27430
+ }
27431
+ const detail = String(stderr || "").trim() || (error62 ? error62.message : "no output");
27432
+ reject(new Error(`VAMP script server ${command} failed: ${detail}`));
27433
+ });
27434
+ });
27435
+ }
27436
+ async function startScriptServer(options = {}) {
27437
+ const extra = [];
27438
+ if (options.bind)
27439
+ extra.push("--bind", options.bind);
27440
+ if (options.ttlSeconds !== void 0)
27441
+ extra.push("--ttl", String(options.ttlSeconds));
27442
+ return callScriptServer("start", extra, { port: options.port });
27443
+ }
27444
+ async function stopScriptServer(options = {}) {
27445
+ return callScriptServer("stop", [], { port: options.port });
27446
+ }
27447
+ async function scriptServerStatus(options = {}) {
27448
+ return callScriptServer("status", [], { port: options.port });
27449
+ }
27450
+ function errorMessage(error62) {
27451
+ return formatError2(error62);
27452
+ }
27453
+ function registerScriptServerTools(server2) {
27454
+ 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.`, {
27455
+ ttlSeconds: external_exports.number().int().min(0).max(86400).default(1800).describe("Seconds before the server stops itself (0 disables the limit)"),
27456
+ 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")
27457
+ }, async ({ ttlSeconds, bind }) => {
27458
+ try {
27459
+ const info = await startScriptServer({ ttlSeconds: ttlSeconds ?? 1800, bind: bind ?? "0.0.0.0" });
27460
+ return {
27461
+ content: [{ type: "text", text: JSON.stringify({ ...info, verified: info.status === "running" }, null, 2) }],
27462
+ isError: info.status !== "running"
27463
+ };
27464
+ } catch (error62) {
27465
+ return {
27466
+ content: [
27467
+ {
27468
+ type: "text",
27469
+ text: JSON.stringify({
27470
+ status: "failed",
27471
+ port: SCRIPT_SERVER_PORT,
27472
+ error: errorMessage(error62),
27473
+ next_action: "Start it manually with: python3 scripts/script_server.py start"
27474
+ }, null, 2)
27475
+ }
27476
+ ],
27477
+ isError: true
27478
+ };
27479
+ }
27480
+ });
27481
+ 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 () => {
27482
+ const info = await scriptServerStatus();
27483
+ return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }], isError: info.status === "port_in_use" };
27484
+ });
27485
+ 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 () => {
27486
+ const info = await stopScriptServer();
27487
+ return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }], isError: info.status === "failed" };
27488
+ });
27489
+ }
27490
+
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
+
27375
27698
  // third_party/mcp-virtualbox/node_modules/zod/v3/helpers/util.js
27376
27699
  var util;
27377
27700
  (function(util2) {
@@ -27759,15 +28082,15 @@ var makeIssue = (params) => {
27759
28082
  message: issueData.message
27760
28083
  };
27761
28084
  }
27762
- let errorMessage = "";
28085
+ let errorMessage2 = "";
27763
28086
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
27764
28087
  for (const map2 of maps) {
27765
- errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;
28088
+ errorMessage2 = map2(fullIssue, { data, defaultError: errorMessage2 }).message;
27766
28089
  }
27767
28090
  return {
27768
28091
  ...issueData,
27769
28092
  path: fullPath,
27770
- message: errorMessage
28093
+ message: errorMessage2
27771
28094
  };
27772
28095
  };
27773
28096
  function addIssueToContext(ctx, issueData) {
@@ -33086,19 +33409,19 @@ var getRefs = (options) => {
33086
33409
  };
33087
33410
 
33088
33411
  // third_party/mcp-virtualbox/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
33089
- function addErrorMessage(res, key, errorMessage, refs) {
33412
+ function addErrorMessage(res, key, errorMessage2, refs) {
33090
33413
  if (!refs?.errorMessages)
33091
33414
  return;
33092
- if (errorMessage) {
33415
+ if (errorMessage2) {
33093
33416
  res.errorMessage = {
33094
33417
  ...res.errorMessage,
33095
- [key]: errorMessage
33418
+ [key]: errorMessage2
33096
33419
  };
33097
33420
  }
33098
33421
  }
33099
- function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
33422
+ function setResponseValueAndErrors(res, key, value, errorMessage2, refs) {
33100
33423
  res[key] = value;
33101
- addErrorMessage(res, key, errorMessage, refs);
33424
+ addErrorMessage(res, key, errorMessage2, refs);
33102
33425
  }
33103
33426
 
33104
33427
  // third_party/mcp-virtualbox/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
@@ -34412,8 +34735,8 @@ var Protocol = class {
34412
34735
  if (queuedMessage.type === "response") {
34413
34736
  resolver(message);
34414
34737
  } else {
34415
- const errorMessage = message;
34416
- const error62 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
34738
+ const errorMessage2 = message;
34739
+ const error62 = new McpError(errorMessage2.error.code, errorMessage2.error.message, errorMessage2.error.data);
34417
34740
  resolver(error62);
34418
34741
  }
34419
34742
  } else {
@@ -35724,23 +36047,23 @@ var Server = class extends Protocol {
35724
36047
  const wrappedHandler = async (request, extra) => {
35725
36048
  const validatedRequest = safeParse3(CallToolRequestSchema, request);
35726
36049
  if (!validatedRequest.success) {
35727
- const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
35728
- throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
36050
+ const errorMessage2 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
36051
+ throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage2}`);
35729
36052
  }
35730
36053
  const { params } = validatedRequest.data;
35731
36054
  const result2 = await Promise.resolve(handler(request, extra));
35732
36055
  if (params.task) {
35733
36056
  const taskValidationResult = safeParse3(CreateTaskResultSchema, result2);
35734
36057
  if (!taskValidationResult.success) {
35735
- const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
35736
- throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
36058
+ const errorMessage2 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
36059
+ throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage2}`);
35737
36060
  }
35738
36061
  return taskValidationResult.data;
35739
36062
  }
35740
36063
  const validationResult = safeParse3(CallToolResultSchema, result2);
35741
36064
  if (!validationResult.success) {
35742
- const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
35743
- throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
36065
+ const errorMessage2 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
36066
+ throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage2}`);
35744
36067
  }
35745
36068
  return validationResult.data;
35746
36069
  };
@@ -36280,12 +36603,12 @@ var McpServer = class {
36280
36603
  * @param errorMessage - The error message.
36281
36604
  * @returns The tool error result.
36282
36605
  */
36283
- createToolError(errorMessage) {
36606
+ createToolError(errorMessage2) {
36284
36607
  return {
36285
36608
  content: [
36286
36609
  {
36287
36610
  type: "text",
36288
- text: errorMessage
36611
+ text: errorMessage2
36289
36612
  }
36290
36613
  ],
36291
36614
  isError: true
@@ -36306,8 +36629,8 @@ var McpServer = class {
36306
36629
  const parseResult = await safeParseAsync3(schemaToParse, args ?? {});
36307
36630
  if (!parseResult.success) {
36308
36631
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
36309
- const errorMessage = getParseErrorMessage(error62);
36310
- throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);
36632
+ const errorMessage2 = getParseErrorMessage(error62);
36633
+ throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage2}`);
36311
36634
  }
36312
36635
  return parseResult.data;
36313
36636
  }
@@ -36331,8 +36654,8 @@ var McpServer = class {
36331
36654
  const parseResult = await safeParseAsync3(outputObj, result2.structuredContent);
36332
36655
  if (!parseResult.success) {
36333
36656
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
36334
- const errorMessage = getParseErrorMessage(error62);
36335
- throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);
36657
+ const errorMessage2 = getParseErrorMessage(error62);
36658
+ throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage2}`);
36336
36659
  }
36337
36660
  }
36338
36661
  /**
@@ -36544,8 +36867,8 @@ var McpServer = class {
36544
36867
  const parseResult = await safeParseAsync3(argsObj, request.params.arguments ?? {});
36545
36868
  if (!parseResult.success) {
36546
36869
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
36547
- const errorMessage = getParseErrorMessage(error62);
36548
- throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);
36870
+ const errorMessage2 = getParseErrorMessage(error62);
36871
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage2}`);
36549
36872
  }
36550
36873
  const args = parseResult.data;
36551
36874
  const cb = prompt.callback;
@@ -37056,15 +37379,15 @@ var StdioServerTransport = class {
37056
37379
  };
37057
37380
 
37058
37381
  // backends/virtualbox/server.mjs
37059
- config2.mouseHelperPath = process.env.MOUSE_HELPER_PATH || fileURLToPath2(new URL("./mouse_click.py", import.meta.url));
37382
+ config2.mouseHelperPath = process.env.MOUSE_HELPER_PATH || fileURLToPath3(new URL("./mouse_click.py", import.meta.url));
37060
37383
  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.1.9" }, { instructions: "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." });
37384
+ var server = new McpServer({ name: "VAMP", version: "0.2.0" }, { instructions: "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). VAMP does not rewrite ISOs and does not use xorriso." });
37062
37385
  var result = (value) => ({ content: [{ type: "text", text: JSON.stringify(value) }] });
37063
37386
  async function displayAction(action, values) {
37064
37387
  const python = process.env.RPA_HOST_PYTHON || "python";
37065
- const script = fileURLToPath2(new URL("./display.py", import.meta.url));
37388
+ const script = fileURLToPath3(new URL("./display.py", import.meta.url));
37066
37389
  const output2 = await new Promise((resolve, reject) => {
37067
- const child = execFile3(python, [script, action], { timeout: 18e4 }, (error62, stdout, stderr) => {
37390
+ const child = execFile5(python, [script, action], { timeout: 18e4 }, (error62, stdout, stderr) => {
37068
37391
  if (error62) reject(new Error(stdout || stderr || error62.message));
37069
37392
  else resolve(stdout);
37070
37393
  });
@@ -37086,9 +37409,9 @@ server.tool(
37086
37409
  );
37087
37410
  async function historyAction(args) {
37088
37411
  const python = process.env.RPA_HOST_PYTHON || "python";
37089
- const script = fileURLToPath2(new URL("./history.py", import.meta.url));
37412
+ const script = fileURLToPath3(new URL("./history.py", import.meta.url));
37090
37413
  const output2 = await new Promise((resolve, reject) => {
37091
- const child = execFile3(python, [script], { timeout: 12e4 }, (error62, stdout, stderr) => {
37414
+ const child = execFile5(python, [script], { timeout: 12e4 }, (error62, stdout, stderr) => {
37092
37415
  if (error62) reject(new Error(stdout || stderr || error62.message));
37093
37416
  else resolve(stdout);
37094
37417
  });
@@ -37135,10 +37458,10 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
37135
37458
  limit: external_exports.number().int().min(1).max(8e3).default(8e3)
37136
37459
  }, async ({ vm, action, filename, offset, limit }) => {
37137
37460
  const python = process.env.RPA_HOST_PYTHON || "python";
37138
- const script = fileURLToPath2(new URL("./shares.py", import.meta.url));
37461
+ const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
37139
37462
  const args = action === "prepare" ? { vm, action } : { vm, action, filename, offset, limit };
37140
37463
  const output2 = await new Promise((resolve, reject) => {
37141
- const child = execFile3(python, [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
37464
+ const child = execFile5(python, [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
37142
37465
  if (error62) reject(new Error(stdout || stderr || error62.message));
37143
37466
  else resolve(stdout);
37144
37467
  });
@@ -37147,9 +37470,9 @@ server.tool("vm_recording_share", "Prepare host recording share (no overwriting
37147
37470
  return result(JSON.parse(output2));
37148
37471
  });
37149
37472
  async function transferAction(action, values) {
37150
- const script = fileURLToPath2(new URL("./transfers.py", import.meta.url));
37473
+ const script = fileURLToPath3(new URL("./transfers.py", import.meta.url));
37151
37474
  const output2 = await new Promise((resolve, reject) => {
37152
- const child = execFile3(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
37475
+ const child = execFile5(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
37153
37476
  if (error62 && !stdout) reject(new Error(stderr || error62.message));
37154
37477
  else resolve(stdout);
37155
37478
  });
@@ -37178,9 +37501,9 @@ server.tool("vm_import_recording", "Copy a user-chosen .py/.handoff.json under g
37178
37501
  username: external_exports.string().default("vboxuser")
37179
37502
  }, async (args) => {
37180
37503
  const python = process.env.RPA_HOST_PYTHON || "python";
37181
- const script = fileURLToPath2(new URL("./recordings.py", import.meta.url));
37504
+ const script = fileURLToPath3(new URL("./recordings.py", import.meta.url));
37182
37505
  const output2 = await new Promise((resolve, reject) => {
37183
- const child = execFile3(python, [script], { timeout: 1e5 }, (error62, stdout, stderr) => {
37506
+ const child = execFile5(python, [script], { timeout: 1e5 }, (error62, stdout, stderr) => {
37184
37507
  if (error62) reject(new Error(stdout || stderr || error62.message));
37185
37508
  else resolve(stdout);
37186
37509
  });
@@ -37196,9 +37519,9 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
37196
37519
  confirm_restore: external_exports.boolean().default(false)
37197
37520
  }, async (args) => {
37198
37521
  const python = process.env.RPA_HOST_PYTHON || "python";
37199
- const script = fileURLToPath2(new URL("./snapshots.py", import.meta.url));
37522
+ const script = fileURLToPath3(new URL("./snapshots.py", import.meta.url));
37200
37523
  const output2 = await new Promise((resolve, reject) => {
37201
- const child = execFile3(python, [script], { timeout: 33e4 }, (error62, stdout, stderr) => {
37524
+ const child = execFile5(python, [script], { timeout: 33e4 }, (error62, stdout, stderr) => {
37202
37525
  if (error62) reject(new Error(stdout || stderr || error62.message));
37203
37526
  else resolve(stdout);
37204
37527
  });
@@ -37207,9 +37530,9 @@ server.tool("vm_snapshot", "List/take/restore snapshots. Ask about extra disk sp
37207
37530
  return result(JSON.parse(output2));
37208
37531
  });
37209
37532
  async function vncAction(values) {
37210
- const script = fileURLToPath2(new URL("./vnc.py", import.meta.url));
37533
+ const script = fileURLToPath3(new URL("./vnc.py", import.meta.url));
37211
37534
  const output2 = await new Promise((resolve, reject) => {
37212
- const child = execFile3(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
37535
+ const child = execFile5(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 18e4, maxBuffer: 1024 * 1024 }, (error62, stdout, stderr) => {
37213
37536
  if (error62 && !stdout) reject(new Error(stderr || error62.message));
37214
37537
  else resolve(stdout);
37215
37538
  });
@@ -37252,9 +37575,9 @@ server.tool("vamp_setup", "First-run setup: check VirtualBox, show current resou
37252
37575
  server.tool("vm_list", "List registered VirtualBox VMs without starting them", {}, async () => result(parseVMList(await vboxManage("list", "vms"))));
37253
37576
  server.tool("vm_info", "Read VM configuration/state", { vm: external_exports.string().min(1) }, async ({ vm }) => result(parseMachineReadable(await vboxManage("showvminfo", vm, "--machinereadable"))));
37254
37577
  async function prepareShareOnStart(vm) {
37255
- const script = fileURLToPath2(new URL("./shares.py", import.meta.url));
37578
+ const script = fileURLToPath3(new URL("./shares.py", import.meta.url));
37256
37579
  const output2 = await new Promise((resolve, reject) => {
37257
- const child = execFile3(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
37580
+ const child = execFile5(process.env.RPA_HOST_PYTHON || "python", [script], { timeout: 9e4 }, (error62, stdout, stderr) => {
37258
37581
  if (error62) reject(new Error(stdout || stderr || error62.message));
37259
37582
  else resolve(stdout);
37260
37583
  });
@@ -37275,7 +37598,7 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
37275
37598
  for (const uri of ["qemu:///session", "qemu:///system"]) {
37276
37599
  let active = "";
37277
37600
  try {
37278
- active = (await promisify(execFile3)("virsh", ["-c", uri, "list", "--name"], { timeout: 1e4 })).stdout;
37601
+ active = (await promisify(execFile5)("virsh", ["-c", uri, "list", "--name"], { timeout: 1e4 })).stdout;
37279
37602
  } catch {
37280
37603
  }
37281
37604
  if (active.trim()) throw new Error("A KVM VM is active. Shut it down before starting VirtualBox (VERR_SVM_IN_USE).");
@@ -37288,7 +37611,9 @@ server.tool("vm_start", "Explicitly start an existing VM with detachable observa
37288
37611
  });
37289
37612
  registerDisplayTools(server);
37290
37613
  registerInputTools(server);
37291
- server.tool("vm_create", "Create a NEW Debian/Windows11 VM from a host ISO, start unattended installation with separate UI. PUBLIC defaults vboxuser/password123!. Returns started, not installed. Recorder setup is scripted.", {
37614
+ registerBootstrapTools(server);
37615
+ registerScriptServerTools(server);
37616
+ server.tool("vm_create", "Create a NEW Debian/Windows11 VM from a host ISO, start unattended installation with separate UI. PUBLIC defaults vboxuser/password123!. Returns started, not installed. Guest setup is served over HTTP on port 8421 (wget/curl); no ISO is rewritten and xorriso is not used.", {
37292
37617
  name: external_exports.string().min(1).optional(),
37293
37618
  iso_path: external_exports.string().min(1),
37294
37619
  memory_mb: external_exports.number().int().optional(),
@@ -37301,12 +37626,13 @@ server.tool("vm_create", "Create a NEW Debian/Windows11 VM from a host ISO, star
37301
37626
  allow_manual_install: external_exports.boolean().default(true),
37302
37627
  installation_mode: external_exports.enum(["auto", "manual"]).default("auto"),
37303
37628
  windows_confirmed: external_exports.boolean().default(false),
37304
- preflight_only: external_exports.boolean().default(false)
37629
+ preflight_only: external_exports.boolean().default(false),
37630
+ 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
37631
  }, async (args) => {
37306
37632
  const python = process.env.RPA_HOST_PYTHON || "python";
37307
- const script = fileURLToPath2(new URL("./provision.py", import.meta.url));
37633
+ const script = fileURLToPath3(new URL("./provision.py", import.meta.url));
37308
37634
  const output2 = await new Promise((resolve, reject) => {
37309
- const child = execFile3(python, [script, "--json-stdin"], { timeout: 42e4 }, (error62, stdout, stderr) => {
37635
+ const child = execFile5(python, [script, "--json-stdin"], { timeout: 42e4 }, (error62, stdout, stderr) => {
37310
37636
  if (error62) reject(new Error(stdout || stderr || error62.message));
37311
37637
  else resolve(stdout);
37312
37638
  });
@@ -37330,8 +37656,8 @@ server.tool("vm_prepare_recorder", "Build guest recorder ISO; optionally attach
37330
37656
  if (occupied && !["none", "emptydrive"].includes(occupied)) throw new Error("Refusing to replace occupied storage slot");
37331
37657
  }
37332
37658
  const python = process.env.RPA_HOST_PYTHON || process.env.PYTHON_PATH || "python";
37333
- const builder = fileURLToPath2(new URL("../../scripts/build_recorder_media.py", import.meta.url));
37334
- const { stdout } = await promisify(execFile3)(python, [builder], { timeout: 6e4 });
37659
+ const builder = fileURLToPath3(new URL("../../scripts/build_recorder_media.py", import.meta.url));
37660
+ const { stdout } = await promisify(execFile5)(python, [builder], { timeout: 6e4 });
37335
37661
  const media = JSON.parse(stdout);
37336
37662
  if (controller) {
37337
37663
  await vboxManage(