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
@@ -0,0 +1,47 @@
1
+ #!/bin/sh
2
+ # VAMP Debian postinstall, run by the unattended installer as root outside the target chroot.
3
+ # It fetches the setup bundle over HTTP (host script server, port 8421) instead of a mounted media ISO.
4
+ set -eu
5
+ base=${VAMP_SCRIPT_BASE_URL:-http://10.0.2.2:8421}
6
+ work=${TMPDIR:-/tmp}/vamp-postdeb
7
+ rm -rf "$work"
8
+ mkdir -p "$work"
9
+
10
+ fetch() {
11
+ if command -v wget >/dev/null 2>&1; then wget -qO "$2" "$1" && return 0; fi
12
+ if command -v curl >/dev/null 2>&1; then curl -fsSL -o "$2" "$1" && return 0; fi
13
+ if command -v python3 >/dev/null 2>&1; then
14
+ python3 -c 'import sys,urllib.request;urllib.request.urlretrieve(sys.argv[1],sys.argv[2])' "$1" "$2" && return 0
15
+ fi
16
+ return 1
17
+ }
18
+
19
+ attempt=1
20
+ while :; do
21
+ fetch "$base/vamp-guest-setup.tar.gz" "$work/bundle.tar.gz" && break
22
+ if [ "$attempt" -ge 15 ]; then
23
+ echo "VAMP: cannot download $base/vamp-guest-setup.tar.gz during postinstall. Start the host script server on port 8421." >&2
24
+ exit 1
25
+ fi
26
+ attempt=$((attempt + 1))
27
+ sleep 8
28
+ done
29
+ tar -xzf "$work/bundle.tar.gz" -C "$work"
30
+
31
+ target=/
32
+ [ ! -d /target/etc ] || target=/target
33
+ mkdir -p "$target/opt/rpa-recorder-setup"
34
+ cp -R "$work/." "$target/opt/rpa-recorder-setup/"
35
+ chroot "$target" /bin/sh -c '
36
+ set -eu
37
+ export DEBIAN_FRONTEND=noninteractive
38
+ python3 /opt/rpa-recorder-setup/recorder/configure-debian-mirrors.py
39
+ apt-get update
40
+ apt-get install -y build-essential python3-venv python3-tk python3-dev python3-dbus x11-xserver-utils xdg-user-dirs scrot task-gnome-desktop xorg gnome-session-xsession
41
+ if [ -f /etc/gdm3/daemon.conf ]; then
42
+ sed -i "/^#\?WaylandEnable=/d; /\[daemon\]/a WaylandEnable=false" /etc/gdm3/daemon.conf
43
+ fi
44
+ user_home=$(getent passwd vboxuser | cut -d: -f6)
45
+ [ -n "$user_home" ]
46
+ /usr/sbin/runuser -u vboxuser -- env HOME="$user_home" RPA_DEPS_READY=1 sh /opt/rpa-recorder-setup/recorder/setup.sh
47
+ '
@@ -0,0 +1,28 @@
1
+ # VAMP Windows postinstall, run at the first desktop login of the unattended account.
2
+ # It stages the setup bundle in C:\ProgramData and schedules the recorder setup for that user's session.
3
+ $ErrorActionPreference = 'Stop'
4
+ $base = if ($env:VAMP_SCRIPT_BASE_URL) { $env:VAMP_SCRIPT_BASE_URL } else { 'http://10.0.2.2:8421' }
5
+ $target = Join-Path $env:ProgramData 'RPA-Recorder-Setup'
6
+ New-Item -ItemType Directory -Force -Path $target | Out-Null
7
+ $zip = Join-Path $env:TEMP 'vamp-guest-setup.zip'
8
+ $downloaded = $false
9
+ for ($attempt = 1; $attempt -le 15; $attempt++) {
10
+ try {
11
+ Invoke-WebRequest -UseBasicParsing -Uri "$base/vamp-guest-setup.zip" -OutFile $zip -TimeoutSec 30
12
+ $downloaded = $true
13
+ break
14
+ } catch {
15
+ if ($attempt -eq 15) {
16
+ throw "VAMP: cannot download $base/vamp-guest-setup.zip during postinstall. Start the host script server on port 8421. $_"
17
+ }
18
+ Start-Sleep -Seconds 8
19
+ }
20
+ }
21
+ if (-not $downloaded) { throw 'VAMP: setup bundle download failed' }
22
+ Expand-Archive -LiteralPath $zip -DestinationPath $target -Force
23
+
24
+ # Install for this desktop user on the next login, never in the SYSTEM profile.
25
+ $startup = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\Startup'
26
+ New-Item -ItemType Directory -Force -Path $startup | Out-Null
27
+ $setup = Join-Path $target 'recorder\setup-win.cmd'
28
+ "@call `"$setup`"" | Set-Content -Encoding ascii -LiteralPath (Join-Path $startup 'RPA-Recorder-Setup.cmd')
@@ -0,0 +1,25 @@
1
+ # VAMP full guest setup bootstrap (recorder + vault), served by the host script server on port 8421.
2
+ #
3
+ # powershell -ExecutionPolicy Bypass -Command "irm http://10.0.2.2:8421/setup-all.ps1 | iex"
4
+ $ErrorActionPreference = 'Stop'
5
+ $base = if ($env:VAMP_SCRIPT_BASE_URL) { $env:VAMP_SCRIPT_BASE_URL } else { 'http://10.0.2.2:8421' }
6
+ $work = Join-Path $env:TEMP 'vamp-guest-setup'
7
+ if (Test-Path -LiteralPath $work) { Remove-Item -LiteralPath $work -Recurse -Force }
8
+ New-Item -ItemType Directory -Force -Path $work | Out-Null
9
+ $zip = Join-Path $work 'vamp-guest-setup.zip'
10
+ $downloaded = $false
11
+ for ($attempt = 1; $attempt -le 10; $attempt++) {
12
+ try {
13
+ Invoke-WebRequest -UseBasicParsing -Uri "$base/vamp-guest-setup.zip" -OutFile $zip -TimeoutSec 30
14
+ $downloaded = $true
15
+ break
16
+ } catch {
17
+ if ($attempt -eq 10) {
18
+ throw "VAMP: cannot download $base/vamp-guest-setup.zip. Start the host script server on port 8421 and retry. $_"
19
+ }
20
+ Start-Sleep -Seconds 6
21
+ }
22
+ }
23
+ if (-not $downloaded) { throw 'VAMP: setup bundle download failed' }
24
+ Expand-Archive -LiteralPath $zip -DestinationPath $work -Force
25
+ & (Join-Path $work 'setup-all.ps1')
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ rem VAMP guest setup bootstrap for cmd.exe, served by the host script server on port 8421.
3
+ rem curl.exe -fsSL http://10.0.2.2:8421/setup-win.cmd -o "%TEMP%\setup-win.cmd" && "%TEMP%\setup-win.cmd"
4
+ setlocal
5
+ if "%VAMP_SCRIPT_BASE_URL%"=="" set "VAMP_SCRIPT_BASE_URL=http://10.0.2.2:8421"
6
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "irm %VAMP_SCRIPT_BASE_URL%/setup.ps1 | iex"
7
+ exit /b %errorlevel%
@@ -0,0 +1,29 @@
1
+ # VAMP guest setup bootstrap (Windows), served by the host script server on port 8421.
2
+ #
3
+ # In the guest (VirtualBox NAT uses 10.0.2.2 for the host):
4
+ # powershell -ExecutionPolicy Bypass -Command "irm http://10.0.2.2:8421/setup.ps1 | iex"
5
+ # curl.exe -fsSL http://10.0.2.2:8421/setup-win.cmd -o %TEMP%\setup-win.cmd && %TEMP%\setup-win.cmd
6
+ #
7
+ # Runs in the desktop user's session; setup.ps1 installs Python for the current user.
8
+ $ErrorActionPreference = 'Stop'
9
+ $base = if ($env:VAMP_SCRIPT_BASE_URL) { $env:VAMP_SCRIPT_BASE_URL } else { 'http://10.0.2.2:8421' }
10
+ $work = Join-Path $env:TEMP 'vamp-guest-setup'
11
+ if (Test-Path -LiteralPath $work) { Remove-Item -LiteralPath $work -Recurse -Force }
12
+ New-Item -ItemType Directory -Force -Path $work | Out-Null
13
+ $zip = Join-Path $work 'vamp-guest-setup.zip'
14
+ $downloaded = $false
15
+ for ($attempt = 1; $attempt -le 10; $attempt++) {
16
+ try {
17
+ Invoke-WebRequest -UseBasicParsing -Uri "$base/vamp-guest-setup.zip" -OutFile $zip -TimeoutSec 30
18
+ $downloaded = $true
19
+ break
20
+ } catch {
21
+ if ($attempt -eq 10) {
22
+ throw "VAMP: cannot download $base/vamp-guest-setup.zip. Start the host script server on port 8421 and retry. $_"
23
+ }
24
+ Start-Sleep -Seconds 6
25
+ }
26
+ }
27
+ if (-not $downloaded) { throw 'VAMP: setup bundle download failed' }
28
+ Expand-Archive -LiteralPath $zip -DestinationPath $work -Force
29
+ & (Join-Path $work 'recorder/setup.ps1')
@@ -0,0 +1,50 @@
1
+ #!/bin/sh
2
+ # VAMP guest setup bootstrap, served by the host script server on port 8421.
3
+ #
4
+ # In the guest (VirtualBox NAT uses 10.0.2.2 for the host):
5
+ # wget -qO- http://10.0.2.2:8421/setup.sh | sh
6
+ # curl -fsSL http://10.0.2.2:8421/setup.sh | sh
7
+ # wget -qO- http://10.0.2.2:8421/setup.sh | sh -s -- --all # recorder + vault
8
+ #
9
+ # Run as the desktop user, not root: the recorder setup uses sudo only for apt.
10
+ set -eu
11
+ base=${VAMP_SCRIPT_BASE_URL:-http://10.0.2.2:8421}
12
+ mode=recorder
13
+ for arg in "$@"; do
14
+ case "$arg" in
15
+ --all|-a) mode=all ;;
16
+ --base=*) base=${arg#--base=} ;;
17
+ esac
18
+ done
19
+ work=${TMPDIR:-/tmp}/vamp-guest-setup
20
+ rm -rf "$work"
21
+ mkdir -p "$work"
22
+
23
+ fetch() {
24
+ if command -v curl >/dev/null 2>&1; then curl -fsSL -o "$2" "$1" && return 0; fi
25
+ if command -v wget >/dev/null 2>&1; then wget -qO "$2" "$1" && return 0; fi
26
+ if command -v python3 >/dev/null 2>&1; then
27
+ python3 -c 'import sys,urllib.request;urllib.request.urlretrieve(sys.argv[1],sys.argv[2])' "$1" "$2" && return 0
28
+ fi
29
+ return 1
30
+ }
31
+
32
+ attempt=1
33
+ while :; do
34
+ fetch "$base/vamp-guest-setup.tar.gz" "$work/bundle.tar.gz" && break
35
+ if [ "$attempt" -ge 10 ]; then
36
+ echo "VAMP: cannot download $base/vamp-guest-setup.tar.gz. Start the host script server on port 8421 and retry." >&2
37
+ exit 1
38
+ fi
39
+ attempt=$((attempt + 1))
40
+ sleep 6
41
+ done
42
+ tar -xzf "$work/bundle.tar.gz" -C "$work"
43
+ if [ -d "$work/cli" ]; then
44
+ VAMP_VAULT_CLI_DIR=$work/cli
45
+ export VAMP_VAULT_CLI_DIR
46
+ fi
47
+ if [ "$mode" = all ]; then
48
+ exec sh "$work/setup-all.sh"
49
+ fi
50
+ exec sh "$work/recorder/setup.sh"
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+ # Root post-install entrypoint. No model/AI calls; safe to rerun for the same user.
3
+ set -Eeuo pipefail
4
+ user_name=${1:-vboxuser}
5
+ [ "$(id -u)" = 0 ] || { echo 'Run as root in the guest.' >&2; exit 1; }
6
+ media=$(cd -- "$(dirname -- "$0")" && pwd)
7
+ state=/var/lib/vamp/setup
8
+ mkdir -p "$state"
9
+ exec > >(tee -a /var/log/vamp-setup.log) 2>&1
10
+ trap 'code=$?; echo VAMP-SETUP-FAILED > /dev/ttyS0; printf "{\"status\":\"failed\",\"exit_code\":%s,\"line\":%s}\n" "$code" "$LINENO" > "$state/result.json"; exit "$code"' ERR
11
+ printf '{"status":"running"}\n' > "$state/result.json"
12
+ user_home=$(getent passwd "$user_name" | cut -d: -f6)
13
+ [ -n "$user_home" ] && [ -d "$user_home" ]
14
+ export DEBIAN_FRONTEND=noninteractive
15
+ python3 "$media/recorder/configure-debian-mirrors.py"
16
+ apt-get update
17
+ apt-get install -y --no-install-recommends build-essential python3-venv python3-tk python3-dev python3-dbus x11-xserver-utils xdg-user-dirs scrot xserver-xorg lightdm lightdm-gtk-greeter openbox gmrun xterm firefox-esr fonts-dejavu dbus-x11 keepassxc libgtk-3-0t64 fuse3 sudo curl
18
+ runuser -u "$user_name" -- env HOME="$user_home" RPA_DEPS_READY=1 sh "$media/recorder/setup.sh"
19
+ runuser -u "$user_name" -- env HOME="$user_home" VAMP_VAULT_CLI_DIR="$media/cli" sh "$media/vault/setup-guest-vault.sh"
20
+ mkdir -p /etc/lightdm/lightdm.conf.d "$user_home/.config/openbox" /var/www/vamp
21
+ cat > /etc/lightdm/lightdm.conf.d/50-vamp.conf <<EOF
22
+ [Seat:*]
23
+ autologin-user=$user_name
24
+ autologin-user-timeout=0
25
+ user-session=openbox
26
+ EOF
27
+ cat > "$user_home/.config/openbox/autostart" <<'EOF'
28
+ xset s off
29
+ xset -dpms
30
+ xrandr --output Virtual-1 --mode 1920x1080
31
+ xterm -geometry 100x28+80+80 -fa Monospace -fs 16 -title VAMP-KVM-READY &
32
+ EOF
33
+ cp "$media/index.html" /var/www/vamp/index.html
34
+ cat > /etc/systemd/system/vamp-test-page.service <<'EOF'
35
+ [Unit]
36
+ Description=Local-only VAMP validation page
37
+ After=network.target
38
+ [Service]
39
+ WorkingDirectory=/var/www/vamp
40
+ ExecStart=/usr/bin/python3 -m http.server 8080 --bind 127.0.0.1
41
+ DynamicUser=yes
42
+ [Install]
43
+ WantedBy=multi-user.target
44
+ EOF
45
+ chown -R "$user_name:$user_name" "$user_home/.config"
46
+ systemctl disable gdm3 2>/dev/null || true
47
+ systemctl enable --force lightdm vamp-test-page
48
+ systemctl set-default graphical.target
49
+ cat > /etc/systemd/system/vamp-desktop-ready.service <<'EOF'
50
+ [Unit]
51
+ Description=VAMP graphical boot marker
52
+ After=display-manager.service
53
+ [Service]
54
+ Type=oneshot
55
+ ExecStart=/bin/sh -c 'echo VAMP-DESKTOP-STARTED > /dev/ttyS0'
56
+ [Install]
57
+ WantedBy=graphical.target
58
+ EOF
59
+ systemctl enable vamp-desktop-ready
60
+ # Binary installation is distinct from desktop resolution / application validation.
61
+ python3 - "$state" "$user_home" <<'PY'
62
+ import json,sys,subprocess
63
+ from pathlib import Path
64
+ state=Path(sys.argv[1]);home=Path(sys.argv[2]);recorder=home/'Desktop/RPA-Recorder/.venv/bin/python'
65
+ assert recorder.is_file(), 'Recorder Python missing'
66
+ subprocess.run([str(recorder),'-c','import importlib.metadata as m; assert m.version("PyAutoGUI"); assert m.version("pynput")'],check=True)
67
+ vault=json.loads((home/'.local/share/vamp/vault-setup/result.json').read_text())
68
+ assert vault['status']=='configured', vault
69
+ result={'status':'configured','recorder_python':str(recorder),'vault':vault,'desktop_verified':False,'log':'/var/log/vamp-setup.log'}
70
+ (state/'result.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result))
71
+ PY
72
+
73
+ printf 'VAMP-SETUP-CONFIGURED\n' > /dev/ttyS0
@@ -0,0 +1,52 @@
1
+ # Runs once as the test desktop administrator after unattended Windows install.
2
+ $ErrorActionPreference = 'Stop'
3
+ $root = 'C:\ProgramData\VAMP-Setup'
4
+ New-Item -ItemType Directory -Force -Path $root | Out-Null
5
+ Start-Transcript -Path (Join-Path $root 'setup.log') -Append
6
+ function Uart([string]$Message) {
7
+ try {
8
+ $port = [System.IO.Ports.SerialPort]::new('COM1',115200,[System.IO.Ports.Parity]::None,8,[System.IO.Ports.StopBits]::One)
9
+ $port.Open(); $port.WriteLine($Message); $port.Close()
10
+ } catch { Write-Warning "UART report unavailable: $_" }
11
+ }
12
+ function Run-Installer([string]$File, [string]$Arguments) {
13
+ $process = Start-Process -FilePath $File -ArgumentList $Arguments -Wait -PassThru
14
+ if ($process.ExitCode -notin @(0,3010)) { throw "Installer exited with $($process.ExitCode): $File" }
15
+ }
16
+ try {
17
+ @{status='running'} | ConvertTo-Json | Set-Content (Join-Path $root 'result.json')
18
+ $manifest = Get-Content -Raw (Join-Path $root 'installers\manifest.json') | ConvertFrom-Json
19
+ foreach ($name in @('python','keepassxc','veracrypt','virtio','vcredist')) {
20
+ $info = $manifest.$name
21
+ $file = Join-Path $root ('installers\'+[IO.Path]::GetFileName($info.path))
22
+ if ((Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() -ne $info.sha256) { throw "Checksum mismatch: $name" }
23
+ }
24
+ $vcRuntime = & (Join-Path $root 'vault\Install-VCRuntime.ps1') -InstallerPath (Join-Path $root 'installers\vcredist.exe') -ExpectedSha256 $manifest.vcredist.sha256
25
+ if (-not (Get-Service -Name 'qemu-ga' -ErrorAction SilentlyContinue)) {
26
+ Run-Installer (Join-Path $root 'installers\virtio.exe') '/quiet /norestart'
27
+ }
28
+ $python = 'C:\ProgramData\VAMP\Python312\python.exe'
29
+ if (-not (Test-Path $python)) {
30
+ Run-Installer (Join-Path $root 'installers\python.exe') '/quiet InstallAllUsers=1 TargetDir=C:\ProgramData\VAMP\Python312 Include_test=0 Include_launcher=0 PrependPath=0'
31
+ }
32
+ if (-not (Test-Path 'C:\Program Files\KeePassXC\keepassxc-proxy.exe')) {
33
+ Run-Installer 'msiexec.exe' ('/i "'+$root+'\installers\keepassxc.msi" /qn /norestart /L*v "'+$root+'\keepassxc-install.log"')
34
+ }
35
+ if (-not (Test-Path 'C:\Program Files\VeraCrypt\VeraCrypt.exe')) {
36
+ Run-Installer 'msiexec.exe' ('/i "'+$root+'\installers\veracrypt.msi" /qn /norestart ACCEPTLICENSE=YES /L*v "'+$root+'\veracrypt-install.log"')
37
+ }
38
+ & $python (Join-Path $root 'recorder\setup-user.py')
39
+ if ($LASTEXITCODE -ne 0) { throw "Recorder setup failed: $LASTEXITCODE" }
40
+ & (Join-Path $root 'vault\setup-guest-vault.ps1')
41
+ $recorderPython = Join-Path ([Environment]::GetFolderPath('Desktop')) 'RPA-Recorder\.venv\Scripts\python.exe'
42
+ & $recorderPython (Join-Path $root 'recorder\verify-recorder.py')
43
+ if ($LASTEXITCODE -ne 0) { throw 'Recorder dependency verification failed' }
44
+ $result = @{status='configured';python=$python;recorder_python=$recorderPython;keepassxc_proxy='C:\Program Files\KeePassXC\keepassxc-proxy.exe';veracrypt='C:\Program Files\VeraCrypt\VeraCrypt.exe';passkey_login_verified=$false}
45
+ $result | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $root 'result.json') -Encoding utf8
46
+ Uart 'VAMP-WINDOWS-SETUP-CONFIGURED'
47
+ Write-Output 'VAMP-WINDOWS-SETUP-CONFIGURED'
48
+ } catch {
49
+ @{status='failed';error=$_.Exception.Message} | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $root 'result.json') -Encoding utf8
50
+ Uart 'VAMP-WINDOWS-SETUP-FAILED'
51
+ throw
52
+ } finally { Stop-Transcript }
@@ -3,6 +3,10 @@ Windows: run setup-win.cmd from the mounted media in the guest user session
3
3
  Debian X11: sh /path/to/mounted/media/setup.sh
4
4
  Creates Desktop/RPA-Recorder, venv, launcher and recordings folder.
5
5
  Recorder: axel-magard/PyAutoGUI-Recorder, GPL-3.0; LICENSE and source are in recorder.zip.
6
+ recorder.zip is committed here so setup runs without the third_party sources; the guest
7
+ scripts download it from the vamp-mcp GitHub repository when it is not beside them.
8
+ Regenerate it after changing third_party/pyautogui-recorder:
9
+ python3 scripts/build_recorder_zip.py
6
10
  Use Record -> Stop -> Download and save a Python file in recordings/.
7
11
  Do not record private credentials. Export to host, then use scripts/convert_recording.py.
8
12
  This installer is untested in the target guests. It does not start recording automatically.
@@ -5,9 +5,15 @@ from pathlib import Path
5
5
  import subprocess
6
6
  import sys
7
7
  import shutil
8
+ import urllib.request
8
9
  import venv
9
10
  import zipfile
10
11
 
12
+ RECORDER_ZIP_URL = os.environ.get(
13
+ 'VAMP_RECORDER_ZIP_URL',
14
+ 'https://raw.githubusercontent.com/wayfarer6/vamp-mcp/main/guest_setup/recorder/recorder.zip',
15
+ )
16
+
11
17
  media = Path(__file__).resolve().parent
12
18
  desktop = Path(subprocess.check_output(['powershell.exe','-NoProfile','-Command',
13
19
  '[Environment]::GetFolderPath("Desktop")'],text=True).strip())
@@ -15,8 +21,20 @@ folder = desktop/'RPA-Recorder'
15
21
  folder.mkdir(parents=True,exist_ok=True)
16
22
  (folder/'recordings').mkdir(exist_ok=True)
17
23
  if not (folder/'PyAutoGuiRecorder.py').exists():
18
- with zipfile.ZipFile(media/'recorder.zip') as archive:
24
+ bundle = media/'recorder.zip'
25
+ if not bundle.exists():
26
+ # A lone download of setup-win.cmd has no bundle beside it; fetch the
27
+ # one committed to the project repository.
28
+ print(f'recorder.zip is not beside setup-user.py; downloading it from {RECORDER_ZIP_URL}')
29
+ bundle = folder/'recorder.zip'
30
+ request = urllib.request.Request(RECORDER_ZIP_URL, headers={'User-Agent': 'vamp-guest-setup'})
31
+ with urllib.request.urlopen(request, timeout=30) as response:
32
+ bundle.write_bytes(response.read())
33
+ keep = bundle == media/'recorder.zip'
34
+ with zipfile.ZipFile(bundle) as archive:
19
35
  archive.extractall(folder)
36
+ if not keep:
37
+ bundle.unlink(missing_ok=True)
20
38
  for name in ['prepare-recording.py','RECORDING-GUIDE.txt','vamp-recorder.py','RECORDER-LICENSE']:
21
39
  destination=folder/name
22
40
  if destination.exists():destination.chmod(0o644)
@@ -1,11 +1,60 @@
1
1
  @echo off
2
- setlocal
2
+ setlocal EnableExtensions
3
3
  cd /d "%~dp0"
4
- set "RPAPY=%LocalAppData%\Programs\Python\Python312\python.exe"
5
- if not exist "%RPAPY%" (
6
- winget install --exact --id Python.Python.3.12 --scope user --accept-package-agreements --accept-source-agreements
7
- if errorlevel 1 exit /b 1
8
- )
4
+
5
+ rem Installs the RPA recorder for the signed-in desktop user.
6
+ rem Python 3.11 or newer is required; 3.11, 3.12, 3.13, 3.14 and 3.15+ all work.
7
+ rem An existing interpreter is reused and one is installed only when none qualifies.
8
+ set "RPAPY="
9
+
10
+ call :scan
11
+ if defined RPAPY goto :run
12
+
13
+ echo No Python 3.11+ found. Installing Python 3.15 with tkinter...
14
+ call :install 3.15
15
+ call :scan
16
+ if defined RPAPY goto :run
17
+
18
+ echo winget did not produce Python 3.15. Installing Python 3.12 instead...
19
+ call :install 3.12
20
+ call :scan
21
+ if defined RPAPY goto :run
22
+
23
+ echo Python 3.11 or newer (3.11 through 3.15+) with tkinter is required.
24
+ echo Install it from https://www.python.org/downloads/ and run setup-win.cmd again.
25
+ exit /b 1
26
+
27
+ :run
28
+ echo Using "%RPAPY%"
9
29
  "%RPAPY%" setup-user.py
10
30
  if errorlevel 1 exit /b 1
11
31
  exit /b 0
32
+
33
+ :install
34
+ where winget >nul 2>&1
35
+ if errorlevel 1 (
36
+ echo winget is not available on this Windows installation.
37
+ exit /b 0
38
+ )
39
+ winget install --exact --id Python.Python.%1 --scope user --accept-package-agreements --accept-source-agreements
40
+ exit /b 0
41
+
42
+ :scan
43
+ rem 1) A usable interpreter already on PATH.
44
+ for /f "delims=" %%P in ('where python.exe 2^>nul') do if not defined RPAPY call :check "%%P"
45
+ rem 2) Per-user and machine-wide python.org installs, newest first.
46
+ for %%V in (315 314 313 312 311) do if not defined RPAPY call :check "%LocalAppData%\Programs\Python\Python%%V\python.exe"
47
+ for %%V in (315 314 313 312 311) do if not defined RPAPY call :check "%ProgramFiles%\Python\Python%%V\python.exe"
48
+ for %%V in (315 314 313 312 311) do if not defined RPAPY call :check "C:\Python%%V\python.exe"
49
+ exit /b 0
50
+
51
+ :check
52
+ if defined RPAPY exit /b 0
53
+ if not exist "%~1" exit /b 0
54
+ rem The Microsoft Store alias opens the Store instead of running scripts.
55
+ echo %~1 | find /i "WindowsApps" >nul
56
+ if not errorlevel 1 exit /b 0
57
+ "%~1" -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else 1)" >nul 2>&1
58
+ if errorlevel 1 exit /b 0
59
+ set "RPAPY=%~1"
60
+ exit /b 0
@@ -3,16 +3,67 @@ $ErrorActionPreference = 'Stop'
3
3
  $desktop = [Environment]::GetFolderPath('Desktop')
4
4
  $folder = Join-Path $desktop 'RPA-Recorder'
5
5
  New-Item -ItemType Directory -Force -Path (Join-Path $folder 'recordings') | Out-Null
6
- $python = Get-Command python.exe -ErrorAction SilentlyContinue
7
- if (-not $python -or $python.Source -like '*WindowsApps*') {
6
+
7
+ # Python 3.11 or newer is required; 3.11 through 3.15+ are accepted, so an
8
+ # interpreter that is already installed (including a newer one) is reused
9
+ # instead of being replaced.
10
+ function Find-RecorderPython {
11
+ $candidates = @()
12
+ $onPath = Get-Command python.exe -ErrorAction SilentlyContinue
13
+ if ($onPath) { $candidates += $onPath.Source }
14
+ foreach ($root in @((Join-Path $env:LOCALAPPDATA 'Programs\Python'), (Join-Path $env:ProgramFiles 'Python'), 'C:\Python3')) {
15
+ if (Test-Path -LiteralPath $root) {
16
+ $candidates += Get-ChildItem -LiteralPath $root -Directory -Filter 'Python3*' -ErrorAction SilentlyContinue |
17
+ Sort-Object Name -Descending |
18
+ ForEach-Object { Join-Path $_.FullName 'python.exe' }
19
+ }
20
+ }
21
+ foreach ($candidate in $candidates) {
22
+ if (-not $candidate) { continue }
23
+ if ($candidate -like '*WindowsApps*') { continue }
24
+ if (-not (Test-Path -LiteralPath $candidate)) { continue }
25
+ try { & $candidate -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else 1)' 2>$null } catch { continue }
26
+ if ($LASTEXITCODE -eq 0) { return $candidate }
27
+ }
28
+ return $null
29
+ }
30
+
31
+ $pythonPath = Find-RecorderPython
32
+ if (-not $pythonPath) {
33
+ Write-Output 'No Python 3.11+ found. Installing Python 3.15 with tkinter.'
34
+ winget install --exact --id Python.Python.3.15 --scope user --accept-package-agreements --accept-source-agreements
35
+ $pythonPath = Find-RecorderPython
36
+ }
37
+ if (-not $pythonPath) {
38
+ Write-Output 'Python 3.15 was not installed by winget. Installing Python 3.12 instead.'
8
39
  winget install --exact --id Python.Python.3.12 --scope user --accept-package-agreements --accept-source-agreements
9
- if ($LASTEXITCODE -ne 0) { throw 'Install Python 3.12 with tkinter, then rerun setup.ps1.' }
10
- $pythonPath = Join-Path $env:LOCALAPPDATA 'Programs\Python\Python312\python.exe'
11
- } else { $pythonPath = $python.Source }
40
+ $pythonPath = Find-RecorderPython
41
+ }
42
+ if (-not $pythonPath) {
43
+ throw 'Python 3.11 or newer (3.11 through 3.15+) with tkinter is required. Install it from https://www.python.org/downloads/ and rerun setup.ps1.'
44
+ }
45
+
12
46
  if (-not (Test-Path (Join-Path $folder 'PyAutoGuiRecorder.py'))) {
13
- Expand-Archive -LiteralPath (Join-Path $PSScriptRoot 'recorder.zip') -DestinationPath $folder
47
+ # The bundle ships beside this script. When it is missing (a lone download of
48
+ # setup.ps1), fetch the same bundle from the project repository.
49
+ $zip = Join-Path $PSScriptRoot 'recorder.zip'
50
+ if (-not (Test-Path -LiteralPath $zip)) {
51
+ $uri = 'https://raw.githubusercontent.com/wayfarer6/vamp-mcp/main/guest_setup/recorder/recorder.zip'
52
+ $zip = Join-Path $env:TEMP 'vamp-recorder.zip'
53
+ Write-Output "recorder.zip is not beside this script; downloading it from $uri"
54
+ try {
55
+ Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile $zip
56
+ } catch {
57
+ if (-not (Get-Command curl.exe -ErrorAction SilentlyContinue)) { throw "Recorder bundle could not be downloaded from $uri : $($_.Exception.Message)" }
58
+ & curl.exe -fsSL $uri -o $zip
59
+ if ($LASTEXITCODE -ne 0) { throw "Recorder bundle could not be downloaded from $uri" }
60
+ }
61
+ if (-not (Test-Path -LiteralPath $zip)) { throw "Recorder bundle is missing: $uri" }
62
+ }
63
+ Expand-Archive -LiteralPath $zip -DestinationPath $folder -Force
14
64
  }
15
65
  Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'prepare-recording.py'), (Join-Path $PSScriptRoot 'RECORDING-GUIDE.txt'), (Join-Path $PSScriptRoot 'vamp-recorder.py'), (Join-Path $PSScriptRoot 'RECORDER-LICENSE') -Destination $folder -Force
66
+ Write-Output "Using $pythonPath"
16
67
  & $pythonPath -m venv (Join-Path $folder '.venv')
17
68
  if ($LASTEXITCODE -ne 0) { throw 'venv creation failed' }
18
69
  $venvPython = Join-Path $folder '.venv\Scripts\python.exe'
@@ -18,7 +18,24 @@ folder="$desktop/RPA-Recorder"
18
18
  mkdir -p "$folder/recordings"
19
19
  # Refuse to replace an existing recorder; keep user changes and recordings.
20
20
  if [ ! -f "$folder/PyAutoGuiRecorder.py" ]; then
21
- python3 -m zipfile -e "$media_dir/recorder.zip" "$folder"
21
+ # The bundle ships beside this script. When it is missing (a lone download of
22
+ # setup.sh on a clean host), fetch the same bundle from the project repository.
23
+ recorder_zip="$media_dir/recorder.zip"
24
+ if [ ! -f "$recorder_zip" ]; then
25
+ recorder_zip="$folder/recorder.zip"
26
+ url='https://raw.githubusercontent.com/wayfarer6/vamp-mcp/main/guest_setup/recorder/recorder.zip'
27
+ echo "recorder.zip is not beside setup.sh; downloading it from $url" >&2
28
+ if command -v curl >/dev/null 2>&1; then
29
+ curl -fsSL "$url" -o "$recorder_zip"
30
+ elif command -v wget >/dev/null 2>&1; then
31
+ wget -qO "$recorder_zip" "$url"
32
+ else
33
+ echo 'curl or wget is required to download the recorder bundle.' >&2
34
+ exit 1
35
+ fi
36
+ fi
37
+ python3 -m zipfile -e "$recorder_zip" "$folder"
38
+ [ "$recorder_zip" = "$media_dir/recorder.zip" ] || rm -f "$recorder_zip"
22
39
  fi
23
40
  cp "$media_dir/prepare-recording.py" "$media_dir/RECORDING-GUIDE.txt" "$media_dir/vamp-recorder.py" "$media_dir/RECORDER-LICENSE" "$folder/"
24
41
  python3 "$media_dir/install-display-startup.py"
@@ -0,0 +1,2 @@
1
+ # Host ISO builder; guest runtime requirements are separate.
2
+ pycdlib==1.14.0
@@ -0,0 +1,35 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Unified VAMP Guest Post-Provisioning Setup:
4
+ 1. Installs RPA Recorder (PyAutoGUI, Tkinter, virtual environment)
5
+ 2. Installs KeePassXC (with Chrome/Edge Passkey browser integration)
6
+ 3. Installs VeraCrypt CLI
7
+ 4. Configures Removable-USB (/m rm) auto-mount helper for secondary vault.vhd
8
+ #>
9
+
10
+ $ErrorActionPreference = 'Stop'
11
+ $dir = $PSScriptRoot
12
+
13
+ Write-Output "=========================================================="
14
+ Write-Output " VAMP Guest Setup: RPA Recorder + Vault + Passkeys"
15
+ Write-Output "=========================================================="
16
+
17
+ # 1. RPA Recorder Setup
18
+ Write-Output "`n[Step 1/2] Installing RPA Recorder..."
19
+ $recorderScript = Join-Path $dir 'recorder\setup.ps1'
20
+ if (Test-Path $recorderScript) {
21
+ & $recorderScript
22
+ } else {
23
+ Write-Warning "recorder\setup.ps1 not found, skipping."
24
+ }
25
+
26
+ # 2. Vault, Passkeys & Removable USB Setup
27
+ Write-Output "`n[Step 2/2] Installing KeePassXC, VeraCrypt & Removable Mount..."
28
+ $vaultScript = Join-Path $dir 'vault\setup-guest-vault.ps1'
29
+ if (Test-Path $vaultScript) {
30
+ & $vaultScript
31
+ } else {
32
+ Write-Warning "vault\setup-guest-vault.ps1 not found, skipping."
33
+ }
34
+
35
+ Write-Output "`n=== All VAMP Guest Services Installed Successfully! ==="
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+ # Unified VAMP Guest Setup for Linux
3
+ set -eu
4
+ dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
5
+
6
+ echo "=========================================================="
7
+ echo " VAMP Guest Setup: RPA Recorder + Vault + Passkeys"
8
+ echo "=========================================================="
9
+
10
+ # 1. RPA Recorder Setup
11
+ echo "\n[Step 1/2] Installing RPA Recorder..."
12
+ if [ -f "$dir/recorder/setup.sh" ]; then
13
+ sh "$dir/recorder/setup.sh"
14
+ fi
15
+
16
+ # 2. Vault Setup
17
+ echo "\n[Step 2/2] Installing KeePassXC, VeraCrypt & Removable Mount..."
18
+ if [ -f "$dir/vault/setup-guest-vault.sh" ]; then
19
+ sh "$dir/vault/setup-guest-vault.sh"
20
+ fi
21
+
22
+ echo "\n=== All VAMP Guest Services Installed Successfully! ==="
@@ -0,0 +1,26 @@
1
+ # Install the x64 runtime before installing or launching KeePassXC.
2
+ param([string]$InstallerPath, [string]$ExpectedSha256)
3
+ $ErrorActionPreference = 'Stop'
4
+ function Test-VCRuntime {
5
+ $runtime = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64' -ErrorAction SilentlyContinue
6
+ return ($runtime.Installed -eq 1 -and
7
+ (Test-Path "$env:WINDIR\System32\msvcp140.dll") -and
8
+ (Test-Path "$env:WINDIR\System32\vcruntime140.dll") -and
9
+ (Test-Path "$env:WINDIR\System32\vcruntime140_1.dll"))
10
+ }
11
+ $rebootRequired = $false
12
+ if (-not (Test-VCRuntime)) {
13
+ Write-Host 'Installing Microsoft Visual C++ x64 runtime before KeePassXC.'
14
+ if ($InstallerPath) {
15
+ if (-not $ExpectedSha256) { throw 'A verified installer SHA-256 is required.' }
16
+ if ((Get-FileHash -LiteralPath $InstallerPath -Algorithm SHA256).Hash -ne $ExpectedSha256) { throw 'VC++ runtime installer checksum mismatch.' }
17
+ $process = Start-Process -FilePath $InstallerPath -ArgumentList '/install /quiet /norestart' -Wait -PassThru
18
+ if ($process.ExitCode -notin @(0,3010)) { throw "VC++ runtime installation failed: $($process.ExitCode)" }
19
+ $rebootRequired = $process.ExitCode -eq 3010
20
+ } else {
21
+ & winget install --exact --id Microsoft.VCRedist.2015+.x64 --scope machine --accept-package-agreements --accept-source-agreements --silent
22
+ if ($LASTEXITCODE -ne 0) { throw "VC++ runtime installation failed: $LASTEXITCODE" }
23
+ }
24
+ if (-not (Test-VCRuntime)) { throw 'VC++ x64 runtime files or installation registration are missing; KeePassXC installation stopped.' }
25
+ }
26
+ @{installed=$true;architecture='x64';reboot_required=$rebootRequired}