vamp-mcp 0.1.9 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +142 -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 +321 -94
- 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 -184
- 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 +440 -63
- 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 +94 -0
- package/runtime/guest_setup/http/postwin.ps1 +53 -0
- package/runtime/guest_setup/http/setup-all.ps1 +25 -0
- package/runtime/guest_setup/http/setup-win.cmd +7 -0
- package/runtime/guest_setup/http/setup.ps1 +44 -0
- package/runtime/guest_setup/http/setup.sh +50 -0
- package/runtime/guest_setup/kvm/setup-debian.sh +73 -0
- package/runtime/guest_setup/kvm/setup-windows.ps1 +52 -0
- package/runtime/guest_setup/recorder/README.txt +12 -8
- 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 +66 -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/recorder.zip +0 -0
- 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/setup-user.py +53 -35
- package/runtime/guest_setup/recorder/setup-win.cmd +4 -11
- package/runtime/guest_setup/recorder/setup.ps1 +108 -30
- package/runtime/guest_setup/recorder/setup.sh +19 -1
- 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 -0
- package/runtime/guest_setup/setup-all.ps1 +35 -0
- package/runtime/guest_setup/setup-all.sh +22 -0
- package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -0
- package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -0
- package/runtime/guest_setup/vault/setup-guest-vault.sh +75 -0
- 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 +126 -0
- package/runtime/scripts/remote_host_setup.sh +7 -4
- package/runtime/scripts/script_server.py +571 -0
- 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 +49 -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
- 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))
|
|
Binary file
|
|
@@ -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()))
|
|
@@ -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
|
|
9
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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,108 @@
|
|
|
1
|
-
$ErrorActionPreference = 'Stop'
|
|
2
|
-
|
|
3
|
-
$
|
|
4
|
-
$
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
$
|
|
11
|
-
|
|
12
|
-
if
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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.'
|
|
@@ -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
|
-
|
|
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'
|