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.
Potentially problematic release.
This version of vamp-mcp might be problematic. Click here for more details.
- 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,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,53 +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 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
|
+
"""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,60 +1,4 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal EnableExtensions
|
|
3
|
-
|
|
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%"
|
|
29
|
-
"%RPAPY%" setup-user.py
|
|
30
|
-
if errorlevel 1 exit /b 1
|
|
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
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal EnableExtensions
|
|
3
|
+
powershell.exe -NoProfile -ExecutionPolicy Unrestricted -File "%~dp0setup.ps1"
|
|
4
|
+
exit /b %ERRORLEVEL%
|
|
@@ -1,81 +1,112 @@
|
|
|
1
|
-
$ErrorActionPreference = 'Stop'
|
|
2
|
-
|
|
3
|
-
$
|
|
4
|
-
$
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
$
|
|
12
|
-
$
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
if (-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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' }
|
|
@@ -39,6 +39,7 @@ if [ ! -f "$folder/PyAutoGuiRecorder.py" ]; then
|
|
|
39
39
|
fi
|
|
40
40
|
cp "$media_dir/prepare-recording.py" "$media_dir/RECORDING-GUIDE.txt" "$media_dir/vamp-recorder.py" "$media_dir/RECORDER-LICENSE" "$folder/"
|
|
41
41
|
python3 "$media_dir/install-display-startup.py"
|
|
42
|
+
dbus-run-session -- python3 "$media_dir/session-policy.py"
|
|
42
43
|
python3 -m venv "$folder/.venv"
|
|
43
44
|
"$folder/.venv/bin/python" -m pip install -r "$media_dir/requirements-recorder.txt"
|
|
44
45
|
cat > "$folder/start-recorder.sh" <<'LAUNCH'
|