vamp-mcp 0.1.9 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vamp-mcp might be problematic. Click here for more details.

Files changed (141) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +144 -107
  3. package/THIRD_PARTY_NOTICES.md +32 -27
  4. package/bin/vamp-mcp.mjs +37 -37
  5. package/notices/mcp-virtualbox-LICENSE +21 -21
  6. package/notices/mcp-virtualbox-PROVENANCE.json +37 -37
  7. package/package.json +51 -17
  8. package/runtime/backends/common/Test-Environment.ps1 +7 -6
  9. package/runtime/backends/common/guest-install.json +58 -0
  10. package/runtime/backends/common/guest_install.py +57 -0
  11. package/runtime/backends/common/host-support.cjs +16 -0
  12. package/runtime/backends/common/packer.cjs +16 -0
  13. package/runtime/backends/hyperv/scripts/Manage-Desktop.ps1 +40 -67
  14. package/runtime/backends/hyperv/scripts/Send-InstallerBoot.ps1 +25 -0
  15. package/runtime/backends/kvm/debian-preseed.cfg +35 -35
  16. package/runtime/backends/library/registry.py +77 -77
  17. package/runtime/backends/library/replay.py +154 -154
  18. package/runtime/backends/packer/answer_media.py +16 -0
  19. package/runtime/backends/packer/deploy-hyperv.ps1 +10 -0
  20. package/runtime/backends/packer/drivers.py +49 -0
  21. package/runtime/backends/packer/hyperv-network.ps1 +10 -0
  22. package/runtime/backends/packer/images.py +75 -0
  23. package/runtime/backends/packer/osinfo.py +113 -0
  24. package/runtime/backends/packer/policy.json +15 -0
  25. package/runtime/backends/packer/runner.py +224 -0
  26. package/runtime/backends/packer/templates.py +118 -0
  27. package/runtime/backends/packer/toolchain.py +80 -0
  28. package/runtime/backends/remote_ssh/server.mjs +321 -94
  29. package/runtime/backends/virtualbox/desktop.cjs +37 -0
  30. package/runtime/backends/virtualbox/display.py +101 -101
  31. package/runtime/backends/virtualbox/history.py +139 -139
  32. package/runtime/backends/virtualbox/mouse_click.py +15 -15
  33. package/runtime/backends/virtualbox/mouse_move.py +18 -18
  34. package/runtime/backends/virtualbox/profiles.json +46 -46
  35. package/runtime/backends/virtualbox/provision.py +238 -184
  36. package/runtime/backends/virtualbox/recording_listener.py +29 -29
  37. package/runtime/backends/virtualbox/recordings.py +39 -39
  38. package/runtime/backends/virtualbox/requirements.txt +7 -7
  39. package/runtime/backends/virtualbox/rpas/debian_first_boot/manifest.json +1 -1
  40. package/runtime/backends/virtualbox/rpas/debian_first_boot/run.robot +13 -13
  41. package/runtime/backends/virtualbox/rpas/debian_first_boot/workflow.py +75 -75
  42. package/runtime/backends/virtualbox/rpas/observe/manifest.json +7 -7
  43. package/runtime/backends/virtualbox/rpas/observe/run.robot +13 -13
  44. package/runtime/backends/virtualbox/rpas/observe/workflow.py +14 -14
  45. package/runtime/backends/virtualbox/server.mjs +440 -63
  46. package/runtime/backends/virtualbox/setup_windows_sdk.py +58 -58
  47. package/runtime/backends/virtualbox/shares.py +68 -68
  48. package/runtime/backends/virtualbox/snapshots.py +53 -53
  49. package/runtime/backends/virtualbox/transfers.py +89 -89
  50. package/runtime/backends/virtualbox/vnc.py +61 -61
  51. package/runtime/guest_keys.py +13 -13
  52. package/runtime/guest_setup/http/debian-preseed.cfg +39 -0
  53. package/runtime/guest_setup/http/postdeb.sh +94 -0
  54. package/runtime/guest_setup/http/postwin.ps1 +53 -0
  55. package/runtime/guest_setup/http/setup-all.ps1 +25 -0
  56. package/runtime/guest_setup/http/setup-win.cmd +7 -0
  57. package/runtime/guest_setup/http/setup.ps1 +44 -0
  58. package/runtime/guest_setup/http/setup.sh +50 -0
  59. package/runtime/guest_setup/kvm/setup-debian.sh +73 -0
  60. package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -0
  61. package/runtime/guest_setup/recorder/README.txt +12 -8
  62. package/runtime/guest_setup/recorder/RECORDER-LICENSE +674 -674
  63. package/runtime/guest_setup/recorder/RECORDING-GUIDE.txt +31 -31
  64. package/runtime/guest_setup/recorder/apply-display.py +41 -41
  65. package/runtime/guest_setup/recorder/configure-debian-mirrors.py +62 -62
  66. package/runtime/guest_setup/recorder/configure-gdm.py +23 -0
  67. package/runtime/guest_setup/recorder/configure-session.ps1 +14 -0
  68. package/runtime/guest_setup/recorder/gnome-display.py +60 -60
  69. package/runtime/guest_setup/recorder/install-display-startup.py +67 -39
  70. package/runtime/guest_setup/recorder/install-hypervisor-drivers.ps1 +34 -0
  71. package/runtime/guest_setup/recorder/install-resolution-shortcut.ps1 +36 -0
  72. package/runtime/guest_setup/recorder/postwin.cmd +10 -10
  73. package/runtime/guest_setup/recorder/prepare-recording.py +30 -30
  74. package/runtime/guest_setup/recorder/recorder.zip +0 -0
  75. package/runtime/guest_setup/recorder/requirements-recorder.txt +2 -2
  76. package/runtime/guest_setup/recorder/session-policy.py +22 -0
  77. package/runtime/guest_setup/recorder/set-resolution-registry.ps1 +40 -0
  78. package/runtime/guest_setup/recorder/setup-user.py +53 -35
  79. package/runtime/guest_setup/recorder/setup-win.cmd +4 -11
  80. package/runtime/guest_setup/recorder/setup.ps1 +112 -30
  81. package/runtime/guest_setup/recorder/setup.sh +19 -1
  82. package/runtime/guest_setup/recorder/vamp-recorder.py +148 -148
  83. package/runtime/guest_setup/recorder/verify-recorder.py +4 -4
  84. package/runtime/guest_setup/recorder/windows-display.py +76 -76
  85. package/runtime/guest_setup/requirements.txt +2 -0
  86. package/runtime/guest_setup/setup-all.ps1 +35 -0
  87. package/runtime/guest_setup/setup-all.sh +22 -0
  88. package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -0
  89. package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -0
  90. package/runtime/guest_setup/vault/setup-guest-vault.sh +75 -0
  91. package/runtime/recording_converter.py +230 -230
  92. package/runtime/requirements-mcp.txt +11 -11
  93. package/runtime/rpas/README.md +161 -161
  94. package/runtime/rpas/captcha_handoff/manifest.json +27 -27
  95. package/runtime/rpas/captcha_handoff/run.robot +16 -16
  96. package/runtime/rpas/captcha_handoff/workflow.py +11 -11
  97. package/runtime/rpas/common.resource +26 -26
  98. package/runtime/rpas/debian_update/manifest.json +27 -27
  99. package/runtime/rpas/debian_update/run.robot +17 -17
  100. package/runtime/rpas/debian_update/workflow.py +13 -13
  101. package/runtime/rpas/desktop_control/manifest.json +26 -26
  102. package/runtime/rpas/desktop_control/run.robot +27 -27
  103. package/runtime/rpas/desktop_control/workflow.py +51 -51
  104. package/runtime/rpas/firefox_launch/manifest.json +27 -27
  105. package/runtime/rpas/firefox_launch/run.robot +15 -15
  106. package/runtime/rpas/firefox_launch/workflow.py +25 -25
  107. package/runtime/rpas/firefox_naver/manifest.json +27 -27
  108. package/runtime/rpas/firefox_naver/run.robot +21 -21
  109. package/runtime/rpas/firefox_naver/workflow.py +28 -28
  110. package/runtime/rpas/kvm_validation/README.md +11 -11
  111. package/runtime/rpas/kvm_validation/manifest.json +28 -28
  112. package/runtime/rpas/kvm_validation/run.robot +30 -30
  113. package/runtime/rpas/kvm_validation/workflow.py +91 -91
  114. package/runtime/rpas/manifest.schema.json +105 -105
  115. package/runtime/rpas/naver_login/login.robot +25 -25
  116. package/runtime/rpas/naver_login/manifest.json +33 -33
  117. package/runtime/rpas/naver_login/run.robot +20 -20
  118. package/runtime/rpas/naver_login/workflow.py +32 -32
  119. package/runtime/rpas/windows_naver_recorded/README.md +24 -24
  120. package/runtime/rpas/windows_naver_recorded/conversion.json +25 -25
  121. package/runtime/rpas/windows_naver_recorded/manifest.json +28 -28
  122. package/runtime/rpas/windows_naver_recorded/run.robot +37 -37
  123. package/runtime/rpas/windows_naver_recorded/workflow.py +32 -32
  124. package/runtime/scripts/build_recorder_media.py +39 -39
  125. package/runtime/scripts/macos/setup-host.sh +126 -0
  126. package/runtime/scripts/remote_host_setup.sh +7 -4
  127. package/runtime/scripts/script_server.py +571 -0
  128. package/runtime/skills/vamp-rpa-ui-checks/SKILL.md +26 -0
  129. package/runtime/skills/vamp-rpa-ui-checks/agents/openai.yaml +4 -0
  130. package/runtime/skills/vamp-rpa-ui-checks/references/display.md +12 -0
  131. package/runtime/skills/vamp-rpa-ui-checks/references/user-guide.md +51 -0
  132. package/runtime/skills/vamp-ui-cleanup/SKILL.md +15 -0
  133. package/runtime/skills/vamp-ui-cleanup/agents/openai.yaml +4 -0
  134. package/runtime/skills/vamp-ui-validation/SKILL.md +27 -0
  135. package/runtime/skills/vamp-ui-validation/agents/openai.yaml +4 -0
  136. package/runtime/third_party/mcp-virtualbox/scripts/mouse_click.py +65 -65
  137. package/runtime/third_party/pyautogui-recorder/LICENSE +674 -674
  138. package/runtime/third_party/pyautogui-recorder/PROVENANCE.json +16 -16
  139. package/runtime/third_party/pyautogui-recorder/PyAutoGuiRecorder.py +169 -169
  140. package/runtime/third_party/pyautogui-recorder/README.md +53 -53
  141. package/runtime/scripts/build_debian_installer.py +0 -48
@@ -1,10 +1,10 @@
1
- @echo off
2
- setlocal
3
- set "TARGET=C:\ProgramData\RPA-Recorder-Setup"
4
- if not exist "%TARGET%" mkdir "%TARGET%"
5
- xcopy /e /i /y "%~dp0*" "%TARGET%\" >nul
6
- if errorlevel 1 exit /b 1
7
- rem Install for vboxuser on its first desktop login, never in the SYSTEM profile.
8
- set "STARTUP=C:\Users\vboxuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
9
- if not exist "%STARTUP%" mkdir "%STARTUP%"
10
- (echo @call "C:\ProgramData\RPA-Recorder-Setup\setup-win.cmd") > "%STARTUP%\RPA-Recorder-Setup.cmd"
1
+ @echo off
2
+ setlocal
3
+ set "TARGET=C:\ProgramData\RPA-Recorder-Setup"
4
+ if not exist "%TARGET%" mkdir "%TARGET%"
5
+ xcopy /e /i /y "%~dp0*" "%TARGET%\" >nul
6
+ if errorlevel 1 exit /b 1
7
+ rem Install for vboxuser on its first desktop login, never in the SYSTEM profile.
8
+ set "STARTUP=C:\Users\vboxuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
9
+ if not exist "%STARTUP%" mkdir "%STARTUP%"
10
+ (echo @call "C:\ProgramData\RPA-Recorder-Setup\setup-win.cmd") > "%STARTUP%\RPA-Recorder-Setup.cmd"
@@ -1,30 +1,30 @@
1
- #!/usr/bin/env python3
2
- """Guest-side handoff: describe a saved Python recording without executing it."""
3
- import argparse
4
- import ast
5
- from datetime import datetime,timezone
6
- import hashlib
7
- import json
8
- from pathlib import Path
9
- import sys
10
-
11
-
12
- def describe(path):
13
- path=Path(path).expanduser().resolve(strict=True)
14
- if not path.is_file() or path.stat().st_size>5_000_000:raise ValueError('Expected a Python recording file under 5 MB')
15
- code=path.read_text(encoding='utf-8-sig');tree=ast.parse(code,filename=str(path))
16
- # Identify calls only; never evaluate, import or play the recording.
17
- calls=[n for n in ast.walk(tree) if isinstance(n,ast.Call)]
18
- return {'schema_version':1,'status':'ready_for_ai_review','recording_path_in_guest':str(path),
19
- 'sha256':hashlib.sha256(path.read_bytes()).hexdigest(),'bytes':path.stat().st_size,
20
- 'call_count':len(calls),'source_executed':False,'guest_platform':sys.platform,
21
- 'expected_native_resolution':[1920,1080],
22
- 'resolution_must_be_checked':True,'timestamp':datetime.now(timezone.utc).isoformat(),
23
- 'handoff':'Tell the AI the VM name, guest OS and this file path. A guest path is not automatically a host path; transfer the file or authorize an explicit retrieval method. Do not record credentials.'}
24
-
25
- if __name__=='__main__':
26
- parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('recording')
27
- args=parser.parse_args();result=describe(args.recording)
28
- output=Path(args.recording).resolve().with_suffix('.handoff.json')
29
- output.write_text(json.dumps(result,indent=2,ensure_ascii=False)+'\n')
30
- print(json.dumps({**result,'handoff_file':str(output)},ensure_ascii=False))
1
+ #!/usr/bin/env python3
2
+ """Guest-side handoff: describe a saved Python recording without executing it."""
3
+ import argparse
4
+ import ast
5
+ from datetime import datetime,timezone
6
+ import hashlib
7
+ import json
8
+ from pathlib import Path
9
+ import sys
10
+
11
+
12
+ def describe(path):
13
+ path=Path(path).expanduser().resolve(strict=True)
14
+ if not path.is_file() or path.stat().st_size>5_000_000:raise ValueError('Expected a Python recording file under 5 MB')
15
+ code=path.read_text(encoding='utf-8-sig');tree=ast.parse(code,filename=str(path))
16
+ # Identify calls only; never evaluate, import or play the recording.
17
+ calls=[n for n in ast.walk(tree) if isinstance(n,ast.Call)]
18
+ return {'schema_version':1,'status':'ready_for_ai_review','recording_path_in_guest':str(path),
19
+ 'sha256':hashlib.sha256(path.read_bytes()).hexdigest(),'bytes':path.stat().st_size,
20
+ 'call_count':len(calls),'source_executed':False,'guest_platform':sys.platform,
21
+ 'expected_native_resolution':[1920,1080],
22
+ 'resolution_must_be_checked':True,'timestamp':datetime.now(timezone.utc).isoformat(),
23
+ 'handoff':'Tell the AI the VM name, guest OS and this file path. A guest path is not automatically a host path; transfer the file or authorize an explicit retrieval method. Do not record credentials.'}
24
+
25
+ if __name__=='__main__':
26
+ parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('recording')
27
+ args=parser.parse_args();result=describe(args.recording)
28
+ output=Path(args.recording).resolve().with_suffix('.handoff.json')
29
+ output.write_text(json.dumps(result,indent=2,ensure_ascii=False)+'\n')
30
+ print(json.dumps({**result,'handoff_file':str(output)},ensure_ascii=False))
@@ -1,2 +1,2 @@
1
- PyAutoGUI==0.9.54
2
- pynput==1.8.1
1
+ PyAutoGUI==0.9.54
2
+ pynput==1.8.1
@@ -0,0 +1,22 @@
1
+ """Disable automatic idle/sleep/lock in the guest GNOME automation account."""
2
+ import json
3
+ import subprocess
4
+ import sys
5
+
6
+
7
+ def apply():
8
+ if sys.platform!='linux':
9
+ return {'status':'unsupported','platform':sys.platform}
10
+ settings=[
11
+ ('org.gnome.desktop.session','idle-delay','uint32 0'),
12
+ ('org.gnome.desktop.screensaver','lock-enabled','false'),
13
+ ('org.gnome.settings-daemon.plugins.power','sleep-inactive-ac-type','nothing'),
14
+ ('org.gnome.settings-daemon.plugins.power','sleep-inactive-battery-type','nothing'),
15
+ ]
16
+ for schema,key,value in settings:
17
+ subprocess.run(['gsettings','set',schema,key,value],check=True)
18
+ return {'status':'configured','automatic_sleep':False,'automatic_lock':False}
19
+
20
+
21
+ if __name__=='__main__':
22
+ print(json.dumps(apply()))
@@ -0,0 +1,40 @@
1
+ param([int]$Width=1920,[int]$Height=1080)
2
+ $ErrorActionPreference='Stop'
3
+ $principal=New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
4
+ if(-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){
5
+ $child=Start-Process powershell.exe -Verb RunAs -ArgumentList ('-NoProfile -ExecutionPolicy Unrestricted -File "'+$PSCommandPath+'" -Width '+$Width+' -Height '+$Height) -Wait -PassThru
6
+ if($child.ExitCode -ne 0){throw 'Administrator registry update failed'}
7
+ return
8
+ }
9
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
10
+ if($Width -ne 1920 -or $Height -ne 1080){throw 'This helper sets the guest display to 1920x1080 only'}
11
+ $root='HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration'
12
+ $changes=@()
13
+ foreach($profile in @(Get-ChildItem -LiteralPath $root -ErrorAction Stop)){
14
+ foreach($surface in @(Get-ChildItem -LiteralPath $profile.PSPath | Where-Object {$_.PSChildName -match '^\d{2}$'})){
15
+ $changes+=@{Path=$surface.Name;Name='PrimSurfSize.cx';Value=$Width}
16
+ $changes+=@{Path=$surface.Name;Name='PrimSurfSize.cy';Value=$Height}
17
+ foreach($monitor in @(Get-ChildItem -LiteralPath $surface.PSPath | Where-Object {$_.PSChildName -match '^\d{2}$'})){
18
+ $changes+=@{Path=$monitor.Name;Name='ActiveSize.cx';Value=$Width}
19
+ $changes+=@{Path=$monitor.Name;Name='ActiveSize.cy';Value=$Height}
20
+ }
21
+ }
22
+ }
23
+ if($changes.Count -eq 0){throw 'No guest display configuration exists in the registry yet'}
24
+ $backupRoot=Join-Path $env:ProgramData 'VAMP\display-registry\backups'
25
+ New-Item -ItemType Directory -Path $backupRoot -Force | Out-Null
26
+ $backup=Join-Path $backupRoot ((Get-Date -Format 'yyyyMMdd-HHmmss-fffffff')+'.json')
27
+ $before=@(foreach($change in $changes){
28
+ $key=Get-Item -LiteralPath ('Registry::'+$change.Path)
29
+ $exists=$key.GetValueNames() -contains $change.Name
30
+ @{Path=$change.Path;Name=$change.Name;Exists=$exists;Value=$key.GetValue($change.Name);Kind=$(if($exists){[string]$key.GetValueKind($change.Name)}else{$null})}
31
+ })
32
+ ConvertTo-Json -InputObject $before -Depth 5 | Set-Content -LiteralPath $backup -Encoding UTF8
33
+ foreach($change in $changes){
34
+ $path='Registry::'+$change.Path
35
+ New-ItemProperty -LiteralPath $path -Name $change.Name -Value $change.Value -PropertyType DWord -Force | Out-Null
36
+ if((Get-ItemPropertyValue -LiteralPath $path -Name $change.Name) -ne $change.Value){throw "Registry verification failed: $($change.Name)"}
37
+ }
38
+ New-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name LogPixels -Value 96 -PropertyType DWord -Force | Out-Null
39
+ New-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Win8DpiScaling -Value 1 -PropertyType DWord -Force | Out-Null
40
+ Write-Host "Guest display registry values overwritten: 1920x1080. Backup: $backup"
@@ -1,35 +1,53 @@
1
- """Windows guest bootstrap run in the logged-in user's session."""
2
- import json
3
- import os
4
- from pathlib import Path
5
- import subprocess
6
- import sys
7
- import shutil
8
- import venv
9
- import zipfile
10
-
11
- media = Path(__file__).resolve().parent
12
- desktop = Path(subprocess.check_output(['powershell.exe','-NoProfile','-Command',
13
- '[Environment]::GetFolderPath("Desktop")'],text=True).strip())
14
- folder = desktop/'RPA-Recorder'
15
- folder.mkdir(parents=True,exist_ok=True)
16
- (folder/'recordings').mkdir(exist_ok=True)
17
- if not (folder/'PyAutoGuiRecorder.py').exists():
18
- with zipfile.ZipFile(media/'recorder.zip') as archive:
19
- archive.extractall(folder)
20
- for name in ['prepare-recording.py','RECORDING-GUIDE.txt','vamp-recorder.py','RECORDER-LICENSE']:
21
- destination=folder/name
22
- if destination.exists():destination.chmod(0o644)
23
- # ISO sources may be read-only; copy contents without propagating that flag.
24
- shutil.copyfile(media/name,destination)
25
- subprocess.run([sys.executable,str(media/'install-display-startup.py')],check=True)
26
- venv.create(folder/'.venv',with_pip=True)
27
- python = folder/'.venv/Scripts/python.exe'
28
- subprocess.run([str(python),'-m','pip','install','-r',str(media/'requirements-recorder.txt')],check=True)
29
- (folder/'Start-Recorder.cmd').write_text('@echo off\ncd /d "%~dp0"\n".venv\\Scripts\\python.exe" vamp-recorder.py\npause\n')
30
- subprocess.run([sys.executable,str(Path(os.environ['LOCALAPPDATA'])/'VAMP/display/apply-display.py'),'--attempts','2','--delay','3'],check=False)
31
- (folder/'installation.json').write_text(json.dumps({'status':'installed','recording_started':False}))
32
- # Remove the one-time provisioning launcher only after successful installation.
33
- startup = Path(os.environ['APPDATA'])/'Microsoft/Windows/Start Menu/Programs/Startup/RPA-Recorder-Setup.cmd'
34
- startup.unlink(missing_ok=True)
35
- print(json.dumps({'status':'installed','folder':str(folder),'recording_started':False}))
1
+ """Windows guest bootstrap run in the logged-in user's session."""
2
+ import json
3
+ import os
4
+ from pathlib import Path
5
+ import subprocess
6
+ import sys
7
+ import shutil
8
+ import urllib.request
9
+ import venv
10
+ import zipfile
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
+
17
+ media = Path(__file__).resolve().parent
18
+ desktop = Path(subprocess.check_output(['powershell.exe','-NoProfile','-Command',
19
+ '[Environment]::GetFolderPath("Desktop")'],text=True).strip())
20
+ folder = desktop/'RPA-Recorder'
21
+ folder.mkdir(parents=True,exist_ok=True)
22
+ (folder/'recordings').mkdir(exist_ok=True)
23
+ if not (folder/'PyAutoGuiRecorder.py').exists():
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:
35
+ archive.extractall(folder)
36
+ if not keep:
37
+ bundle.unlink(missing_ok=True)
38
+ for name in ['prepare-recording.py','RECORDING-GUIDE.txt','vamp-recorder.py','RECORDER-LICENSE']:
39
+ destination=folder/name
40
+ if destination.exists():destination.chmod(0o644)
41
+ # ISO sources may be read-only; copy contents without propagating that flag.
42
+ shutil.copyfile(media/name,destination)
43
+ subprocess.run([sys.executable,str(media/'install-display-startup.py')],check=True)
44
+ venv.create(folder/'.venv',with_pip=True)
45
+ python = folder/'.venv/Scripts/python.exe'
46
+ subprocess.run([str(python),'-m','pip','install','-r',str(media/'requirements-recorder.txt')],check=True)
47
+ (folder/'Start-Recorder.cmd').write_text('@echo off\ncd /d "%~dp0"\n".venv\\Scripts\\python.exe" vamp-recorder.py\npause\n')
48
+ subprocess.run([sys.executable,str(Path(os.environ['LOCALAPPDATA'])/'VAMP/display/apply-display.py'),'--attempts','2','--delay','3'],check=False)
49
+ (folder/'installation.json').write_text(json.dumps({'status':'installed','recording_started':False}))
50
+ # Remove the one-time provisioning launcher only after successful installation.
51
+ startup = Path(os.environ['APPDATA'])/'Microsoft/Windows/Start Menu/Programs/Startup/RPA-Recorder-Setup.cmd'
52
+ startup.unlink(missing_ok=True)
53
+ print(json.dumps({'status':'installed','folder':str(folder),'recording_started':False}))
@@ -1,11 +1,4 @@
1
- @echo off
2
- setlocal
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
- )
9
- "%RPAPY%" setup-user.py
10
- if errorlevel 1 exit /b 1
11
- exit /b 0
1
+ @echo off
2
+ setlocal EnableExtensions
3
+ powershell.exe -NoProfile -ExecutionPolicy Unrestricted -File "%~dp0setup.ps1"
4
+ exit /b %ERRORLEVEL%
@@ -1,30 +1,112 @@
1
- $ErrorActionPreference = 'Stop'
2
- # Run in the guest desktop user's session. No administrator requirement.
3
- $desktop = [Environment]::GetFolderPath('Desktop')
4
- $folder = Join-Path $desktop 'RPA-Recorder'
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*') {
8
- 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 }
12
- if (-not (Test-Path (Join-Path $folder 'PyAutoGuiRecorder.py'))) {
13
- Expand-Archive -LiteralPath (Join-Path $PSScriptRoot 'recorder.zip') -DestinationPath $folder
14
- }
15
- 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
16
- & $pythonPath -m venv (Join-Path $folder '.venv')
17
- if ($LASTEXITCODE -ne 0) { throw 'venv creation failed' }
18
- $venvPython = Join-Path $folder '.venv\Scripts\python.exe'
19
- & $venvPython -m pip install -r (Join-Path $PSScriptRoot 'requirements-recorder.txt')
20
- if ($LASTEXITCODE -ne 0) { throw 'Recorder dependency installation failed' }
21
- @'
22
- @echo off
23
- cd /d "%~dp0"
24
- ".venv\Scripts\python.exe" vamp-recorder.py
25
- pause
26
- '@ | Set-Content -Encoding ascii -LiteralPath (Join-Path $folder 'Start-Recorder.cmd')
27
- & $venvPython (Join-Path $PSScriptRoot 'install-display-startup.py')
28
- if ($LASTEXITCODE -ne 0) { throw 'Display login hook registration failed' }
29
- Write-Output "Recorder installed: $folder"
30
- Write-Output 'Run Start-Recorder.cmd. Save recordings under recordings/. Do not record passwords.'
1
+ $ErrorActionPreference = 'Stop'
2
+ $principal=New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
3
+ if(-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){
4
+ $payload='Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force; '
5
+ if($PSCommandPath){$payload+="& '"+$PSCommandPath.Replace("'","''")+"'"}
6
+ else {
7
+ $origin=if($env:VAMP_SCRIPT_BASE_URL){$env:VAMP_SCRIPT_BASE_URL}else{'http://10.0.2.2:8421'}
8
+ $payload+="irm '"+($origin+'/setup.ps1').Replace("'","''")+"' | iex"
9
+ }
10
+ $encoded=[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($payload))
11
+ $elevated=Start-Process powershell.exe -Verb RunAs -ArgumentList @('-NoProfile','-ExecutionPolicy','Unrestricted','-EncodedCommand',$encoded) -Wait -PassThru
12
+ if($elevated.ExitCode -ne 0){throw 'Administrator setup did not complete successfully'}
13
+ return
14
+ }
15
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
16
+
17
+ # Run in the guest desktop user's session.
18
+ & (Join-Path $PSScriptRoot 'configure-session.ps1')
19
+ $desktop = [Environment]::GetFolderPath('Desktop')
20
+ $folder = Join-Path $desktop 'RPA-Recorder'
21
+ New-Item -ItemType Directory -Force -Path (Join-Path $folder 'recordings') | Out-Null
22
+
23
+ # Python 3.11 or newer is required; 3.11 through 3.15+ are accepted, so an
24
+ # interpreter that is already installed (including a newer one) is reused
25
+ # instead of being replaced.
26
+ function Find-RecorderPython {
27
+ $candidates = @()
28
+ $onPath = Get-Command python.exe -ErrorAction SilentlyContinue
29
+ if ($onPath) { $candidates += $onPath.Source }
30
+ foreach ($root in @((Join-Path $env:LOCALAPPDATA 'Programs\Python'), (Join-Path $env:ProgramFiles 'Python'), 'C:\Python3')) {
31
+ if (Test-Path -LiteralPath $root) {
32
+ $candidates += Get-ChildItem -LiteralPath $root -Directory -Filter 'Python3*' -ErrorAction SilentlyContinue |
33
+ Sort-Object Name -Descending |
34
+ ForEach-Object { Join-Path $_.FullName 'python.exe' }
35
+ }
36
+ }
37
+ foreach ($candidate in $candidates) {
38
+ if (-not $candidate) { continue }
39
+ if ($candidate -like '*WindowsApps*') { continue }
40
+ if (-not (Test-Path -LiteralPath $candidate)) { continue }
41
+ try { & $candidate -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else 1)' 2>$null } catch { continue }
42
+ if ($LASTEXITCODE -eq 0) { return $candidate }
43
+ }
44
+ return $null
45
+ }
46
+
47
+ $pythonPath = Find-RecorderPython
48
+ if (-not $pythonPath) {
49
+ if (Get-Command winget.exe -ErrorAction SilentlyContinue) {
50
+ & winget.exe install --exact --id Python.Python.3.12 --scope user --accept-package-agreements --accept-source-agreements
51
+ $pythonPath = Find-RecorderPython
52
+ }
53
+ }
54
+ if (-not $pythonPath) {
55
+ # Clean unattended accounts may not have winget registered yet.
56
+ $installer=Join-Path $env:TEMP 'vamp-python-3.12.10-amd64.exe'
57
+ Invoke-WebRequest -UseBasicParsing -Uri 'https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe' -OutFile $installer -TimeoutSec 180
58
+ $signature=Get-AuthenticodeSignature -LiteralPath $installer
59
+ if($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'Python Software Foundation'){
60
+ throw 'Python installer signature verification failed'
61
+ }
62
+ $installed=Start-Process -FilePath $installer -ArgumentList @('/quiet','InstallAllUsers=0','Include_launcher=0','Include_test=0','Include_tcltk=1','PrependPath=0') -PassThru -Wait -WindowStyle Hidden
63
+ if($installed.ExitCode -notin @(0,3010)){throw "Python installer failed: $($installed.ExitCode)"}
64
+ $pythonPath=Find-RecorderPython
65
+ }
66
+ if (-not $pythonPath) {
67
+ 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.'
68
+ }
69
+
70
+ if (-not (Test-Path (Join-Path $folder 'PyAutoGuiRecorder.py'))) {
71
+ # The bundle ships beside this script. When it is missing (a lone download of
72
+ # setup.ps1), fetch the same bundle from the project repository.
73
+ $zip = Join-Path $PSScriptRoot 'recorder.zip'
74
+ if (-not (Test-Path -LiteralPath $zip)) {
75
+ $uri = 'https://raw.githubusercontent.com/wayfarer6/vamp-mcp/main/guest_setup/recorder/recorder.zip'
76
+ $zip = Join-Path $env:TEMP 'vamp-recorder.zip'
77
+ Write-Output "recorder.zip is not beside this script; downloading it from $uri"
78
+ try {
79
+ Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile $zip
80
+ } catch {
81
+ if (-not (Get-Command curl.exe -ErrorAction SilentlyContinue)) { throw "Recorder bundle could not be downloaded from $uri : $($_.Exception.Message)" }
82
+ & curl.exe -fsSL $uri -o $zip
83
+ if ($LASTEXITCODE -ne 0) { throw "Recorder bundle could not be downloaded from $uri" }
84
+ }
85
+ if (-not (Test-Path -LiteralPath $zip)) { throw "Recorder bundle is missing: $uri" }
86
+ }
87
+ Expand-Archive -LiteralPath $zip -DestinationPath $folder -Force
88
+ }
89
+ 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
90
+ Write-Output "Using $pythonPath"
91
+ & $pythonPath -m venv (Join-Path $folder '.venv')
92
+ if ($LASTEXITCODE -ne 0) { throw 'venv creation failed' }
93
+ $venvPython = Join-Path $folder '.venv\Scripts\python.exe'
94
+ & $venvPython -m pip install -r (Join-Path $PSScriptRoot 'requirements-recorder.txt')
95
+ if ($LASTEXITCODE -ne 0) { throw 'Recorder dependency installation failed' }
96
+ @'
97
+ @echo off
98
+ cd /d "%~dp0"
99
+ ".venv\Scripts\python.exe" vamp-recorder.py
100
+ pause
101
+ '@ | Set-Content -Encoding ascii -LiteralPath (Join-Path $folder 'Start-Recorder.cmd')
102
+ & $venvPython (Join-Path $PSScriptRoot 'install-display-startup.py') --desktop $desktop
103
+ if ($LASTEXITCODE -ne 0) { throw 'Display login hook registration failed' }
104
+ Write-Output "Recorder installed: $folder"
105
+ @{status='installed';recording_started=$false;session_policy='awake_unlocked'} | ConvertTo-Json | Set-Content -Encoding UTF8 -LiteralPath (Join-Path $folder 'installation.json')
106
+ $legacyStartup=Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\Startup\RPA-Recorder-Setup.cmd'
107
+ if(Test-Path -LiteralPath $legacyStartup){Remove-Item -LiteralPath $legacyStartup -Force}
108
+ Write-Output 'Run Start-Recorder.cmd. Save recordings under recordings/. Do not record passwords.'
109
+
110
+ # Final Windows configuration step, shared by VirtualBox, KVM and Hyper-V.
111
+ & (Join-Path $PSScriptRoot 'set-resolution-registry.ps1')
112
+ if (-not $?) { throw 'Full HD registry configuration failed' }
@@ -18,10 +18,28 @@ 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"
42
+ dbus-run-session -- python3 "$media_dir/session-policy.py"
25
43
  python3 -m venv "$folder/.venv"
26
44
  "$folder/.venv/bin/python" -m pip install -r "$media_dir/requirements-recorder.txt"
27
45
  cat > "$folder/start-recorder.sh" <<'LAUNCH'