vamp-mcp 0.2.0 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +144 -107
- package/THIRD_PARTY_NOTICES.md +32 -27
- package/bin/vamp-mcp.mjs +37 -37
- package/notices/mcp-virtualbox-LICENSE +21 -21
- package/notices/mcp-virtualbox-PROVENANCE.json +37 -37
- package/package.json +51 -17
- package/runtime/backends/common/Test-Environment.ps1 +7 -6
- package/runtime/backends/common/guest-install.json +58 -0
- package/runtime/backends/common/guest_install.py +57 -0
- package/runtime/backends/common/host-support.cjs +16 -0
- package/runtime/backends/common/packer.cjs +16 -0
- package/runtime/backends/hyperv/scripts/Manage-Desktop.ps1 +40 -67
- package/runtime/backends/hyperv/scripts/Send-InstallerBoot.ps1 +25 -0
- package/runtime/backends/kvm/debian-preseed.cfg +35 -35
- package/runtime/backends/library/registry.py +77 -77
- package/runtime/backends/library/replay.py +154 -154
- package/runtime/backends/packer/answer_media.py +16 -0
- package/runtime/backends/packer/deploy-hyperv.ps1 +10 -0
- package/runtime/backends/packer/drivers.py +49 -0
- package/runtime/backends/packer/hyperv-network.ps1 +10 -0
- package/runtime/backends/packer/images.py +75 -0
- package/runtime/backends/packer/osinfo.py +113 -0
- package/runtime/backends/packer/policy.json +15 -0
- package/runtime/backends/packer/runner.py +224 -0
- package/runtime/backends/packer/templates.py +118 -0
- package/runtime/backends/packer/toolchain.py +80 -0
- package/runtime/backends/remote_ssh/server.mjs +310 -93
- package/runtime/backends/virtualbox/desktop.cjs +37 -0
- package/runtime/backends/virtualbox/display.py +101 -101
- package/runtime/backends/virtualbox/history.py +139 -139
- package/runtime/backends/virtualbox/mouse_click.py +15 -15
- package/runtime/backends/virtualbox/mouse_move.py +18 -18
- package/runtime/backends/virtualbox/profiles.json +46 -46
- package/runtime/backends/virtualbox/provision.py +238 -197
- package/runtime/backends/virtualbox/recording_listener.py +29 -29
- package/runtime/backends/virtualbox/recordings.py +39 -39
- package/runtime/backends/virtualbox/requirements.txt +7 -7
- package/runtime/backends/virtualbox/rpas/debian_first_boot/manifest.json +1 -1
- package/runtime/backends/virtualbox/rpas/debian_first_boot/run.robot +13 -13
- package/runtime/backends/virtualbox/rpas/debian_first_boot/workflow.py +75 -75
- package/runtime/backends/virtualbox/rpas/observe/manifest.json +7 -7
- package/runtime/backends/virtualbox/rpas/observe/run.robot +13 -13
- package/runtime/backends/virtualbox/rpas/observe/workflow.py +14 -14
- package/runtime/backends/virtualbox/server.mjs +288 -237
- package/runtime/backends/virtualbox/setup_windows_sdk.py +58 -58
- package/runtime/backends/virtualbox/shares.py +68 -68
- package/runtime/backends/virtualbox/snapshots.py +53 -53
- package/runtime/backends/virtualbox/transfers.py +89 -89
- package/runtime/backends/virtualbox/vnc.py +61 -61
- package/runtime/guest_keys.py +13 -13
- package/runtime/guest_setup/http/debian-preseed.cfg +39 -0
- package/runtime/guest_setup/http/postdeb.sh +50 -3
- package/runtime/guest_setup/http/postwin.ps1 +53 -28
- package/runtime/guest_setup/http/setup-all.ps1 +25 -25
- package/runtime/guest_setup/http/setup-win.cmd +7 -7
- package/runtime/guest_setup/http/setup.ps1 +44 -29
- package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -52
- package/runtime/guest_setup/recorder/README.txt +12 -12
- package/runtime/guest_setup/recorder/RECORDER-LICENSE +674 -674
- package/runtime/guest_setup/recorder/RECORDING-GUIDE.txt +31 -31
- package/runtime/guest_setup/recorder/apply-display.py +41 -41
- package/runtime/guest_setup/recorder/configure-debian-mirrors.py +62 -62
- package/runtime/guest_setup/recorder/configure-gdm.py +23 -0
- package/runtime/guest_setup/recorder/configure-session.ps1 +14 -0
- package/runtime/guest_setup/recorder/gnome-display.py +60 -60
- package/runtime/guest_setup/recorder/install-display-startup.py +67 -39
- package/runtime/guest_setup/recorder/install-hypervisor-drivers.ps1 +34 -0
- package/runtime/guest_setup/recorder/install-resolution-shortcut.ps1 +36 -0
- package/runtime/guest_setup/recorder/postwin.cmd +10 -10
- package/runtime/guest_setup/recorder/prepare-recording.py +30 -30
- package/runtime/guest_setup/recorder/requirements-recorder.txt +2 -2
- package/runtime/guest_setup/recorder/session-policy.py +22 -0
- package/runtime/guest_setup/recorder/set-resolution-registry.ps1 +40 -0
- package/runtime/guest_setup/recorder/setup-user.py +53 -53
- package/runtime/guest_setup/recorder/setup-win.cmd +4 -60
- package/runtime/guest_setup/recorder/setup.ps1 +112 -81
- package/runtime/guest_setup/recorder/setup.sh +1 -0
- package/runtime/guest_setup/recorder/vamp-recorder.py +148 -148
- package/runtime/guest_setup/recorder/verify-recorder.py +4 -4
- package/runtime/guest_setup/recorder/windows-display.py +76 -76
- package/runtime/guest_setup/requirements.txt +2 -2
- package/runtime/guest_setup/setup-all.ps1 +35 -35
- package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -26
- package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -148
- package/runtime/recording_converter.py +230 -230
- package/runtime/requirements-mcp.txt +11 -11
- package/runtime/rpas/README.md +161 -161
- package/runtime/rpas/captcha_handoff/manifest.json +27 -27
- package/runtime/rpas/captcha_handoff/run.robot +16 -16
- package/runtime/rpas/captcha_handoff/workflow.py +11 -11
- package/runtime/rpas/common.resource +26 -26
- package/runtime/rpas/debian_update/manifest.json +27 -27
- package/runtime/rpas/debian_update/run.robot +17 -17
- package/runtime/rpas/debian_update/workflow.py +13 -13
- package/runtime/rpas/desktop_control/manifest.json +26 -26
- package/runtime/rpas/desktop_control/run.robot +27 -27
- package/runtime/rpas/desktop_control/workflow.py +51 -51
- package/runtime/rpas/firefox_launch/manifest.json +27 -27
- package/runtime/rpas/firefox_launch/run.robot +15 -15
- package/runtime/rpas/firefox_launch/workflow.py +25 -25
- package/runtime/rpas/firefox_naver/manifest.json +27 -27
- package/runtime/rpas/firefox_naver/run.robot +21 -21
- package/runtime/rpas/firefox_naver/workflow.py +28 -28
- package/runtime/rpas/kvm_validation/README.md +11 -11
- package/runtime/rpas/kvm_validation/manifest.json +28 -28
- package/runtime/rpas/kvm_validation/run.robot +30 -30
- package/runtime/rpas/kvm_validation/workflow.py +91 -91
- package/runtime/rpas/manifest.schema.json +105 -105
- package/runtime/rpas/naver_login/login.robot +25 -25
- package/runtime/rpas/naver_login/manifest.json +33 -33
- package/runtime/rpas/naver_login/run.robot +20 -20
- package/runtime/rpas/naver_login/workflow.py +32 -32
- package/runtime/rpas/windows_naver_recorded/README.md +24 -24
- package/runtime/rpas/windows_naver_recorded/conversion.json +25 -25
- package/runtime/rpas/windows_naver_recorded/manifest.json +28 -28
- package/runtime/rpas/windows_naver_recorded/run.robot +37 -37
- package/runtime/rpas/windows_naver_recorded/workflow.py +32 -32
- package/runtime/scripts/build_recorder_media.py +39 -39
- package/runtime/scripts/macos/setup-host.sh +0 -0
- package/runtime/scripts/script_server.py +571 -517
- package/runtime/skills/vamp-rpa-ui-checks/SKILL.md +26 -0
- package/runtime/skills/vamp-rpa-ui-checks/agents/openai.yaml +4 -0
- package/runtime/skills/vamp-rpa-ui-checks/references/display.md +12 -0
- package/runtime/skills/vamp-rpa-ui-checks/references/user-guide.md +51 -0
- package/runtime/skills/vamp-ui-cleanup/SKILL.md +15 -0
- package/runtime/skills/vamp-ui-cleanup/agents/openai.yaml +4 -0
- package/runtime/skills/vamp-ui-validation/SKILL.md +27 -0
- package/runtime/skills/vamp-ui-validation/agents/openai.yaml +4 -0
- package/runtime/third_party/mcp-virtualbox/scripts/mouse_click.py +65 -65
- package/runtime/third_party/pyautogui-recorder/LICENSE +674 -674
- package/runtime/third_party/pyautogui-recorder/PROVENANCE.json +16 -16
- package/runtime/third_party/pyautogui-recorder/PyAutoGuiRecorder.py +169 -169
- package/runtime/third_party/pyautogui-recorder/README.md +53 -53
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schema_version": 1,
|
|
3
|
-
"observed_at": "2026-11-15",
|
|
4
|
-
"source": "Read-only VirtualBox showvminfo/showmediuminfo on current running user VMs, 2026-11-15. Capacity is virtual disk capacity, not allocated host space.",
|
|
5
|
-
"profiles": {
|
|
6
|
-
"windows11": {
|
|
7
|
-
"memory_mb": 4096,
|
|
8
|
-
"cpus": 2,
|
|
9
|
-
"disk_mb": 256000,
|
|
10
|
-
"firmware": "efi",
|
|
11
|
-
"disk_allocation": "dynamic",
|
|
12
|
-
"native_resolution": [
|
|
13
|
-
1920,
|
|
14
|
-
1080
|
|
15
|
-
],
|
|
16
|
-
"reference_guest": "Win-RPA",
|
|
17
|
-
"windows_license_required": true
|
|
18
|
-
},
|
|
19
|
-
"debian": {
|
|
20
|
-
"memory_mb": 2048,
|
|
21
|
-
"cpus": 2,
|
|
22
|
-
"disk_mb": 256000,
|
|
23
|
-
"firmware": "bios",
|
|
24
|
-
"disk_allocation": "dynamic",
|
|
25
|
-
"native_resolution": [
|
|
26
|
-
1920,
|
|
27
|
-
1080
|
|
28
|
-
],
|
|
29
|
-
"reference_guest": "Debian-RPA",
|
|
30
|
-
"windows_license_required": false
|
|
31
|
-
},
|
|
32
|
-
"ubuntu": {
|
|
33
|
-
"memory_mb": 2048,
|
|
34
|
-
"cpus": 2,
|
|
35
|
-
"disk_mb": 256000,
|
|
36
|
-
"firmware": "bios",
|
|
37
|
-
"disk_allocation": "dynamic",
|
|
38
|
-
"native_resolution": [
|
|
39
|
-
1920,
|
|
40
|
-
1080
|
|
41
|
-
],
|
|
42
|
-
"reference_guest": "Debian-RPA resources only; Ubuntu guest not observed",
|
|
43
|
-
"windows_license_required": false
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"observed_at": "2026-11-15",
|
|
4
|
+
"source": "Read-only VirtualBox showvminfo/showmediuminfo on current running user VMs, 2026-11-15. Capacity is virtual disk capacity, not allocated host space.",
|
|
5
|
+
"profiles": {
|
|
6
|
+
"windows11": {
|
|
7
|
+
"memory_mb": 4096,
|
|
8
|
+
"cpus": 2,
|
|
9
|
+
"disk_mb": 256000,
|
|
10
|
+
"firmware": "efi",
|
|
11
|
+
"disk_allocation": "dynamic",
|
|
12
|
+
"native_resolution": [
|
|
13
|
+
1920,
|
|
14
|
+
1080
|
|
15
|
+
],
|
|
16
|
+
"reference_guest": "Win-RPA",
|
|
17
|
+
"windows_license_required": true
|
|
18
|
+
},
|
|
19
|
+
"debian": {
|
|
20
|
+
"memory_mb": 2048,
|
|
21
|
+
"cpus": 2,
|
|
22
|
+
"disk_mb": 256000,
|
|
23
|
+
"firmware": "bios",
|
|
24
|
+
"disk_allocation": "dynamic",
|
|
25
|
+
"native_resolution": [
|
|
26
|
+
1920,
|
|
27
|
+
1080
|
|
28
|
+
],
|
|
29
|
+
"reference_guest": "Debian-RPA",
|
|
30
|
+
"windows_license_required": false
|
|
31
|
+
},
|
|
32
|
+
"ubuntu": {
|
|
33
|
+
"memory_mb": 2048,
|
|
34
|
+
"cpus": 2,
|
|
35
|
+
"disk_mb": 256000,
|
|
36
|
+
"firmware": "bios",
|
|
37
|
+
"disk_allocation": "dynamic",
|
|
38
|
+
"native_resolution": [
|
|
39
|
+
1920,
|
|
40
|
+
1080
|
|
41
|
+
],
|
|
42
|
+
"reference_guest": "Debian-RPA resources only; Ubuntu guest not observed",
|
|
43
|
+
"windows_license_required": false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,197 +1,238 @@
|
|
|
1
|
-
"""Deterministic VirtualBox unattended provisioning; no AI loop required."""
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
import argparse
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
sys.path.insert(0,str(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
raise
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if not (
|
|
88
|
-
raise ValueError('
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
journal['
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
run(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
1
|
+
"""Deterministic VirtualBox unattended provisioning; no AI loop required."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import argparse
|
|
4
|
+
import base64
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import re
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
import time
|
|
13
|
+
import uuid
|
|
14
|
+
|
|
15
|
+
ROOT=Path(__file__).resolve().parents[2]
|
|
16
|
+
sys.path.insert(0,str(ROOT/'scripts'))
|
|
17
|
+
sys.path.insert(0,str(ROOT/'backends/common'))
|
|
18
|
+
from guest_install import PROFILE, require_install_host, efi_boot_plan, virtualbox_preseed, post_create_notice
|
|
19
|
+
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
|
20
|
+
from script_server import SCRIPT_SERVER_PORT, guest_commands, start as start_script_server
|
|
21
|
+
|
|
22
|
+
PUBLIC_CREDENTIALS={'username':'vboxuser','password':'password123!','public_sandbox_credentials':True}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def parse(text):
|
|
26
|
+
return {m[1].strip():m[2].strip() for line in text.splitlines()
|
|
27
|
+
if (m:=re.match(r'([^=]+)=\"?(.*?)\"?$',line.strip()))}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def executable():
|
|
31
|
+
if os.environ.get('VBOXMANAGE_PATH'): return os.environ['VBOXMANAGE_PATH']
|
|
32
|
+
if sys.platform=='win32':
|
|
33
|
+
candidate=Path(os.environ.get('PROGRAMFILES','C:/Program Files'))/'Oracle/VirtualBox/VBoxManage.exe'
|
|
34
|
+
if candidate.is_file():return str(candidate)
|
|
35
|
+
return shutil.which('VBoxManage') or 'VBoxManage'
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def assert_no_active_kvm():
|
|
39
|
+
if not sys.platform.startswith('linux'):return
|
|
40
|
+
for uri in ('qemu:///session','qemu:///system'):
|
|
41
|
+
try:
|
|
42
|
+
result=subprocess.run(['virsh','-c',uri,'list','--name'],capture_output=True,text=True,timeout=10)
|
|
43
|
+
except (FileNotFoundError,subprocess.TimeoutExpired):continue
|
|
44
|
+
if result.returncode==0 and result.stdout.strip():
|
|
45
|
+
raise RuntimeError('A KVM VM is active. Shut it down before starting VirtualBox; simultaneous execution can cause VERR_SVM_IN_USE.')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def post_install_command(guest_os, base_url):
|
|
49
|
+
"""Post-install hook fetched from the host script server; no ISO is rewritten or mounted."""
|
|
50
|
+
if guest_os=='windows11':
|
|
51
|
+
command=("$ErrorActionPreference='Stop'; $p=Join-Path $env:TEMP 'vamp-postwin.ps1'; "
|
|
52
|
+
"for($i=0;$i -lt 30;$i++){try{"
|
|
53
|
+
f"Invoke-WebRequest -UseBasicParsing -Uri '{base_url}/postwin.ps1' -OutFile $p -TimeoutSec 20; break"
|
|
54
|
+
"}catch{if($i -eq 29){throw}; Start-Sleep -Seconds 3}}; & $p")
|
|
55
|
+
# VBox's VBOXPOST.CMD also echoes this command inside double quotes.
|
|
56
|
+
# A nested -Command string exposes its pipe/operators to cmd.exe there.
|
|
57
|
+
encoded=base64.b64encode(command.encode('utf-16-le')).decode('ascii')
|
|
58
|
+
return f'powershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand {encoded}'
|
|
59
|
+
return f'wget -qO /tmp/vamp-postdeb.sh {base_url}/postdeb.sh && sh /tmp/vamp-postdeb.sh'
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def create(iso_path,name=None,memory_mb=None,cpus=None,disk_mb=None,basedir=None,image_index=1,product_key='',windows_confirmed=False,guest_os=None,preflight_only=False,allow_manual_install=False,installation_mode="auto",serve_scripts=True,script_server_ttl=7200):
|
|
63
|
+
require_install_host('virtualbox')
|
|
64
|
+
if installation_mode not in ('auto','manual'):raise ValueError('installation_mode must be auto or manual')
|
|
65
|
+
name=name or ('VAMP-'+uuid.uuid4().hex[:8])
|
|
66
|
+
if not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_-]{0,63}',name):raise ValueError('Use 1-64 letters/digits/underscore/hyphen for name')
|
|
67
|
+
iso=Path(iso_path).expanduser().resolve(strict=True)
|
|
68
|
+
if not iso.is_file():raise ValueError('ISO path must be a readable local file on the VM host')
|
|
69
|
+
journal={'status':'preparing','vm':name,'credentials':PUBLIC_CREDENTIALS,'events':[],
|
|
70
|
+
'installation_verified':False,'recorder_installed_verified':False,
|
|
71
|
+
'development_only':os.environ.get('VAMP_DEVELOPMENT_VM')=='1',
|
|
72
|
+
'guest_setup_transport':f'http://10.0.2.2:{SCRIPT_SERVER_PORT} (host Python script server)'}
|
|
73
|
+
folder=Path(basedir or Path.home()/'VirtualBox VMs').expanduser().resolve()/name
|
|
74
|
+
def run(*args,timeout=120):
|
|
75
|
+
proc=subprocess.run([executable(),*map(str,args)],capture_output=True,text=True,timeout=timeout)
|
|
76
|
+
if proc.returncode:raise RuntimeError(f'VBoxManage {args[0]} failed: {proc.stderr.strip()[:500]}')
|
|
77
|
+
return proc.stdout
|
|
78
|
+
listed=run('list','vms')
|
|
79
|
+
if any(line.startswith('"'+name+'" ') for line in listed.splitlines()):raise ValueError('VM name already exists; refusing to modify it')
|
|
80
|
+
try:
|
|
81
|
+
detected=parse(run('unattended','detect','--iso',iso,'--machine-readable'))
|
|
82
|
+
except RuntimeError:
|
|
83
|
+
manual_types={'debian':'Debian_64','ubuntu':'Ubuntu_64','windows11':'Windows11_64'}
|
|
84
|
+
if guest_os not in manual_types or not (allow_manual_install or (guest_os=='debian' and installation_mode=='auto')):raise
|
|
85
|
+
detected={'OSTypeId':manual_types[guest_os],'IsInstallSupported':'false'}
|
|
86
|
+
os_type=detected.get('OSTypeId',detected.get('detectedOSTypeId',''))
|
|
87
|
+
if not (re.fullmatch(r'Debian[0-9]*_64',os_type) or re.fullmatch(r'Ubuntu[0-9]*_64',os_type) or os_type=='Windows11_64'):
|
|
88
|
+
raise ValueError(f'Only detected Debian/Ubuntu amd64 or Windows11 x64 ISO supported by this initial profile: {os_type or "unknown"}')
|
|
89
|
+
unattended_supported=detected.get('IsInstallSupported',detected.get('isInstallSupported','true')).lower() in ('true','1','yes','on')
|
|
90
|
+
if installation_mode=='manual':unattended_supported=False
|
|
91
|
+
direct_debian_boot=(installation_mode=='auto' and guest_os=='debian' and not unattended_supported)
|
|
92
|
+
if not unattended_supported and not allow_manual_install and not direct_debian_boot:
|
|
93
|
+
raise ValueError('VirtualBox reports this ISO does not support unattended installation')
|
|
94
|
+
selected='windows11' if os_type=='Windows11_64' else ('ubuntu' if os_type.startswith('Ubuntu') else 'debian')
|
|
95
|
+
if guest_os and guest_os!=selected:raise ValueError('Selected guest OS does not match detected ISO')
|
|
96
|
+
profile=json.loads(Path(__file__).with_name('profiles.json').read_text())['profiles'][selected]
|
|
97
|
+
memory_mb=memory_mb if memory_mb is not None else profile['memory_mb']
|
|
98
|
+
cpus=cpus if cpus is not None else profile['cpus']
|
|
99
|
+
disk_mb=disk_mb if disk_mb is not None else profile['disk_mb']
|
|
100
|
+
if not (2048<=memory_mb<=131072 and 1<=cpus<=64 and 32768<=disk_mb<=2097152 and image_index>=1):
|
|
101
|
+
raise ValueError('Invalid VM resource/image limits')
|
|
102
|
+
if preflight_only:
|
|
103
|
+
return {'status':'preflight_ready','vm_created':False,'guest_os':selected,
|
|
104
|
+
'resource_profile':{'memory_mb':memory_mb,'cpus':cpus,'disk_mb':disk_mb},
|
|
105
|
+
'windows_confirmation_required':selected=='windows11' and not windows_confirmed,
|
|
106
|
+
'installation_mode':'unattended' if unattended_supported or direct_debian_boot else 'manual',
|
|
107
|
+
'guest_setup':{'transport':'http','port':SCRIPT_SERVER_PORT,'commands':guest_commands(SCRIPT_SERVER_PORT)},
|
|
108
|
+
'credentials':PUBLIC_CREDENTIALS,'iso':str(iso)}
|
|
109
|
+
if selected=='windows11' and not windows_confirmed:
|
|
110
|
+
return {'status':'needs_windows_confirmation','no_vm_created':True,'profile':profile,
|
|
111
|
+
'action_required':'Ask the user whether to create Windows with these specs. Windows requires a valid license; activate it yourself after installation in Settings > System > Activation. VAMP does not include a Windows license.',
|
|
112
|
+
'credentials':PUBLIC_CREDENTIALS}
|
|
113
|
+
journal['resource_profile']={'guest_os':selected,'memory_mb':memory_mb,'cpus':cpus,'disk_mb':disk_mb,
|
|
114
|
+
'native_resolution':[1920,1080]}
|
|
115
|
+
if selected=='windows11':journal['license_notice']='Windows requires a valid license. Activate Windows yourself after installation; VAMP supplies no license or activation bypass.'
|
|
116
|
+
if os_type=='Windows11_64' and memory_mb<4096:raise ValueError('Windows 11 requires at least 4096 MB')
|
|
117
|
+
# Check version-specific password option before creating any VM.
|
|
118
|
+
help_text=''
|
|
119
|
+
if unattended_supported:
|
|
120
|
+
help_proc=subprocess.run([executable(),'unattended','install','--help'],capture_output=True,text=True)
|
|
121
|
+
help_text=help_proc.stdout+help_proc.stderr
|
|
122
|
+
password_flag='--user-password' if '--user-password' in help_text else '--password'
|
|
123
|
+
assert_no_active_kvm()
|
|
124
|
+
folder.mkdir(parents=True,exist_ok=False)
|
|
125
|
+
journal_path=folder/'vamp-install.json'
|
|
126
|
+
def start_verified():
|
|
127
|
+
# startvm waits for its session to open; still verify the hypervisor state.
|
|
128
|
+
run('startvm',name,'--type','headless')
|
|
129
|
+
state=''
|
|
130
|
+
for attempt in range(15):
|
|
131
|
+
state=parse(run('showvminfo',name,'--machinereadable')).get('VMState','unknown')
|
|
132
|
+
if state=='running':
|
|
133
|
+
journal.update(vm_state=state,startup_verified=True)
|
|
134
|
+
# Stock Windows install media waits for a key before booting.
|
|
135
|
+
# Send once on the initial provisioning boot, never on later reboots.
|
|
136
|
+
if selected=='windows11':
|
|
137
|
+
time.sleep(PROFILE['boot_wait_seconds'])
|
|
138
|
+
run('controlvm',name,'keyboardputscancode','1c','9c')
|
|
139
|
+
journal['events'].append('installer-boot-enter-sent')
|
|
140
|
+
return
|
|
141
|
+
if state not in ('starting','restoring'):break
|
|
142
|
+
time.sleep(1)
|
|
143
|
+
raise RuntimeError(f'VM creation completed but startup was not verified (state: {state}); inspect the VM log')
|
|
144
|
+
def record(stage):
|
|
145
|
+
journal['events'].append(stage)
|
|
146
|
+
journal_path.write_text(json.dumps(journal,indent=2)+'\n')
|
|
147
|
+
script_server=None
|
|
148
|
+
if serve_scripts and not os.environ.get('VAMP_SCRIPT_SERVER_DISABLE'):
|
|
149
|
+
try:
|
|
150
|
+
script_server=start_script_server(port=SCRIPT_SERVER_PORT,ttl=script_server_ttl)
|
|
151
|
+
except Exception as exc:
|
|
152
|
+
script_server={'status':'failed','port':SCRIPT_SERVER_PORT,'error':str(exc)}
|
|
153
|
+
journal['script_server']=script_server
|
|
154
|
+
if script_server.get('status')!='running':
|
|
155
|
+
journal.update(status='failed',error='Guest setup HTTP server could not start: '+str(script_server.get('error',script_server.get('status'))))
|
|
156
|
+
record('script-server-failed')
|
|
157
|
+
raise RuntimeError(journal['error'])
|
|
158
|
+
base_url=(script_server or {}).get('guest_urls',{}).get('virtualbox_nat') or f'http://10.0.2.2:{SCRIPT_SERVER_PORT}'
|
|
159
|
+
journal['post_create_notice']=post_create_notice(selected,base_url)
|
|
160
|
+
try:
|
|
161
|
+
run('createvm','--name',name,'--ostype',os_type,'--register','--basefolder',folder.parent)
|
|
162
|
+
record('vm-created')
|
|
163
|
+
from display import preferences
|
|
164
|
+
journal['display']=preferences(name,run)
|
|
165
|
+
from shares import prepare
|
|
166
|
+
journal['recording_share']=prepare(name,run)
|
|
167
|
+
options=['modifyvm',name,'--memory',memory_mb,'--cpus',cpus,'--vram',128,
|
|
168
|
+
'--mouse','usbtablet','--nic1','nat','--nat-localhostreachable1','on','--boot1','dvd','--boot2','disk',
|
|
169
|
+
'--graphicscontroller','vboxsvga' if os_type=='Windows11_64' else 'vmsvga']
|
|
170
|
+
if os_type=='Windows11_64':options+=['--firmware','efi','--tpm-type','2.0','--ioapic','on']
|
|
171
|
+
if direct_debian_boot:options+=['--firmware','efi']
|
|
172
|
+
run(*options)
|
|
173
|
+
disk=folder/(name+'.vdi')
|
|
174
|
+
run('createmedium','disk','--filename',disk,'--size',disk_mb,'--format','VDI')
|
|
175
|
+
run('storagectl',name,'--name','SATA','--add','sata','--controller','IntelAhci','--portcount','4')
|
|
176
|
+
run('storageattach',name,'--storagectl','SATA','--port','0','--device','0','--type','hdd','--medium',disk)
|
|
177
|
+
run('storagectl',name,'--name','IDE','--add','ide')
|
|
178
|
+
if not unattended_supported:
|
|
179
|
+
run('storageattach',name,'--storagectl','SATA','--port','1','--device','0','--type','dvddrive','--medium',iso)
|
|
180
|
+
start_verified()
|
|
181
|
+
if direct_debian_boot:
|
|
182
|
+
# Debian 13 DVD detection is unimplemented in some VBox builds.
|
|
183
|
+
# Boot the stock EFI GRUB console with the HTTP preseed instead.
|
|
184
|
+
time.sleep(PROFILE['boot_wait_seconds'])
|
|
185
|
+
for step in efi_boot_plan('debian',base_url):
|
|
186
|
+
if step['kind']=='wait':time.sleep(step['seconds'])
|
|
187
|
+
elif step['kind'] in ('text','line'):
|
|
188
|
+
run('controlvm',name,'keyboardputstring',step['text'])
|
|
189
|
+
if step['kind'] in ('line','enter'):
|
|
190
|
+
run('controlvm',name,'keyboardputscancode','1c','9c')
|
|
191
|
+
journal.update(status='installation_started',installation_mode='unattended',boot_method='efi-http-preseed',os_type=os_type,credentials=PUBLIC_CREDENTIALS,journal=str(journal_path))
|
|
192
|
+
record('debian-http-preseed-boot-dispatched')
|
|
193
|
+
return journal
|
|
194
|
+
journal.update(status='installation_started',installation_mode='manual',os_type=os_type,
|
|
195
|
+
frontend='headless',journal=str(journal_path),
|
|
196
|
+
credentials={'public_sandbox_credentials':False,'account_setup':'Choose your account in the OS installer'},
|
|
197
|
+
action_required=(f'This ISO needs a manual installation: complete the stock installer in the VM screen, '
|
|
198
|
+
f'choose your own guest account, then run the guest setup command from '
|
|
199
|
+
f'http://10.0.2.2:{SCRIPT_SERVER_PORT}/ (for example '
|
|
200
|
+
f'"wget -qO- {base_url}/setup.sh | sh"). No ISO was rewritten and no automatic account or recorder setup ran.'))
|
|
201
|
+
record('manual-installation-started')
|
|
202
|
+
return journal
|
|
203
|
+
if os_type=='Windows11_64':
|
|
204
|
+
from display import insert_additions
|
|
205
|
+
journal['guest_additions']=insert_additions(name,run=run)
|
|
206
|
+
install_args=['unattended','install',name,'--iso',iso,'--user','vboxuser',password_flag,'password123!',
|
|
207
|
+
'--full-user-name','VAMP Sandbox User','--hostname',name.lower()+'.vamp.local',
|
|
208
|
+
'--no-install-additions','--post-install-command',post_install_command(selected,base_url)]
|
|
209
|
+
if selected=='debian':
|
|
210
|
+
template=folder/'debian-preseed.cfg'
|
|
211
|
+
template.write_text(virtualbox_preseed(),encoding='utf-8')
|
|
212
|
+
install_args+=['--script-template',str(template)]
|
|
213
|
+
if os_type=='Windows11_64':
|
|
214
|
+
install_args+=['--image-index',image_index]
|
|
215
|
+
if product_key:install_args+=['--key',product_key]
|
|
216
|
+
run(*install_args,timeout=300)
|
|
217
|
+
start_verified()
|
|
218
|
+
journal.update(status='installation_started',installation_mode='unattended',os_type=os_type,frontend='headless',
|
|
219
|
+
recorder_setup=f'First login downloads the setup bundle from the host script server on port {SCRIPT_SERVER_PORT}',
|
|
220
|
+
guest_setup_command=f'wget -qO- {base_url}/setup.sh | sh' if selected!='windows11' else f'irm {base_url}/setup.ps1 | iex',
|
|
221
|
+
requires_ai_loop=False,journal=str(journal_path))
|
|
222
|
+
record('unattended-installation-started')
|
|
223
|
+
return journal
|
|
224
|
+
except Exception as exc:
|
|
225
|
+
journal.update(status='failed',error=str(exc),partial_vm_preserved=True)
|
|
226
|
+
record('failed')
|
|
227
|
+
raise RuntimeError(f'{exc}; partial setup preserved at {folder}') from exc
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if __name__=='__main__':
|
|
231
|
+
parser=argparse.ArgumentParser(description=__doc__)
|
|
232
|
+
parser.add_argument('--json-stdin',action='store_true',required=True)
|
|
233
|
+
parser.parse_args()
|
|
234
|
+
sys.path.insert(0,str(ROOT/'backends/packer'))
|
|
235
|
+
from runner import create as packer_create
|
|
236
|
+
try: print(json.dumps(packer_create({'backend':'virtualbox',**json.load(sys.stdin)})))
|
|
237
|
+
except Exception as exc:
|
|
238
|
+
print(json.dumps({'status':'failed','error':str(exc)}));sys.exit(1)
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"""Robot Framework v3 listener: optional low-resolution video and SQLite evidence."""
|
|
2
|
-
import sys
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
|
5
|
-
from history import begin,capture,end,event
|
|
6
|
-
|
|
7
|
-
class RecordingListener:
|
|
8
|
-
ROBOT_LISTENER_API_VERSION=3
|
|
9
|
-
def __init__(self,vm,video='false'):
|
|
10
|
-
self.vm=vm;self.video=str(video).lower() in ('true','1','yes');self.depth=0;self.run_id=None
|
|
11
|
-
def start_suite(self,data,result):
|
|
12
|
-
self.depth+=1
|
|
13
|
-
if self.depth==1:
|
|
14
|
-
try:self.run_id=begin(self.vm,self.video)['run_id']
|
|
15
|
-
except Exception as exc:
|
|
16
|
-
from robot.api import logger
|
|
17
|
-
logger.warn('VAMP evidence initialization failed: '+str(exc))
|
|
18
|
-
def end_test(self,data,result):
|
|
19
|
-
if self.run_id:
|
|
20
|
-
event(self.run_id,'robot_task',{'name':result.name,'status':result.status,'elapsed_ms':int(result.elapsed_time.total_seconds()*1000)})
|
|
21
|
-
try:capture(self.run_id,'task-'+result.status.lower())
|
|
22
|
-
except Exception as exc:event(self.run_id,'capture_error',{'error':str(exc)[:300]})
|
|
23
|
-
def end_suite(self,data,result):
|
|
24
|
-
if self.depth==1 and self.run_id:
|
|
25
|
-
try:end(self.run_id,result.status)
|
|
26
|
-
except Exception as exc:
|
|
27
|
-
from robot.api import logger
|
|
28
|
-
logger.warn('VAMP evidence finalization failed: '+str(exc))
|
|
29
|
-
self.depth-=1
|
|
1
|
+
"""Robot Framework v3 listener: optional low-resolution video and SQLite evidence."""
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
|
5
|
+
from history import begin,capture,end,event
|
|
6
|
+
|
|
7
|
+
class RecordingListener:
|
|
8
|
+
ROBOT_LISTENER_API_VERSION=3
|
|
9
|
+
def __init__(self,vm,video='false'):
|
|
10
|
+
self.vm=vm;self.video=str(video).lower() in ('true','1','yes');self.depth=0;self.run_id=None
|
|
11
|
+
def start_suite(self,data,result):
|
|
12
|
+
self.depth+=1
|
|
13
|
+
if self.depth==1:
|
|
14
|
+
try:self.run_id=begin(self.vm,self.video)['run_id']
|
|
15
|
+
except Exception as exc:
|
|
16
|
+
from robot.api import logger
|
|
17
|
+
logger.warn('VAMP evidence initialization failed: '+str(exc))
|
|
18
|
+
def end_test(self,data,result):
|
|
19
|
+
if self.run_id:
|
|
20
|
+
event(self.run_id,'robot_task',{'name':result.name,'status':result.status,'elapsed_ms':int(result.elapsed_time.total_seconds()*1000)})
|
|
21
|
+
try:capture(self.run_id,'task-'+result.status.lower())
|
|
22
|
+
except Exception as exc:event(self.run_id,'capture_error',{'error':str(exc)[:300]})
|
|
23
|
+
def end_suite(self,data,result):
|
|
24
|
+
if self.depth==1 and self.run_id:
|
|
25
|
+
try:end(self.run_id,result.status)
|
|
26
|
+
except Exception as exc:
|
|
27
|
+
from robot.api import logger
|
|
28
|
+
logger.warn('VAMP evidence finalization failed: '+str(exc))
|
|
29
|
+
self.depth-=1
|