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.
Files changed (140) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +142 -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 +66 -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/setup-user.py +53 -35
  78. package/runtime/guest_setup/recorder/setup-win.cmd +4 -11
  79. package/runtime/guest_setup/recorder/setup.ps1 +108 -30
  80. package/runtime/guest_setup/recorder/setup.sh +19 -1
  81. package/runtime/guest_setup/recorder/vamp-recorder.py +148 -148
  82. package/runtime/guest_setup/recorder/verify-recorder.py +4 -4
  83. package/runtime/guest_setup/recorder/windows-display.py +76 -76
  84. package/runtime/guest_setup/requirements.txt +2 -0
  85. package/runtime/guest_setup/setup-all.ps1 +35 -0
  86. package/runtime/guest_setup/setup-all.sh +22 -0
  87. package/runtime/guest_setup/vault/Install-VCRuntime.ps1 +26 -0
  88. package/runtime/guest_setup/vault/setup-guest-vault.ps1 +148 -0
  89. package/runtime/guest_setup/vault/setup-guest-vault.sh +75 -0
  90. package/runtime/recording_converter.py +230 -230
  91. package/runtime/requirements-mcp.txt +11 -11
  92. package/runtime/rpas/README.md +161 -161
  93. package/runtime/rpas/captcha_handoff/manifest.json +27 -27
  94. package/runtime/rpas/captcha_handoff/run.robot +16 -16
  95. package/runtime/rpas/captcha_handoff/workflow.py +11 -11
  96. package/runtime/rpas/common.resource +26 -26
  97. package/runtime/rpas/debian_update/manifest.json +27 -27
  98. package/runtime/rpas/debian_update/run.robot +17 -17
  99. package/runtime/rpas/debian_update/workflow.py +13 -13
  100. package/runtime/rpas/desktop_control/manifest.json +26 -26
  101. package/runtime/rpas/desktop_control/run.robot +27 -27
  102. package/runtime/rpas/desktop_control/workflow.py +51 -51
  103. package/runtime/rpas/firefox_launch/manifest.json +27 -27
  104. package/runtime/rpas/firefox_launch/run.robot +15 -15
  105. package/runtime/rpas/firefox_launch/workflow.py +25 -25
  106. package/runtime/rpas/firefox_naver/manifest.json +27 -27
  107. package/runtime/rpas/firefox_naver/run.robot +21 -21
  108. package/runtime/rpas/firefox_naver/workflow.py +28 -28
  109. package/runtime/rpas/kvm_validation/README.md +11 -11
  110. package/runtime/rpas/kvm_validation/manifest.json +28 -28
  111. package/runtime/rpas/kvm_validation/run.robot +30 -30
  112. package/runtime/rpas/kvm_validation/workflow.py +91 -91
  113. package/runtime/rpas/manifest.schema.json +105 -105
  114. package/runtime/rpas/naver_login/login.robot +25 -25
  115. package/runtime/rpas/naver_login/manifest.json +33 -33
  116. package/runtime/rpas/naver_login/run.robot +20 -20
  117. package/runtime/rpas/naver_login/workflow.py +32 -32
  118. package/runtime/rpas/windows_naver_recorded/README.md +24 -24
  119. package/runtime/rpas/windows_naver_recorded/conversion.json +25 -25
  120. package/runtime/rpas/windows_naver_recorded/manifest.json +28 -28
  121. package/runtime/rpas/windows_naver_recorded/run.robot +37 -37
  122. package/runtime/rpas/windows_naver_recorded/workflow.py +32 -32
  123. package/runtime/scripts/build_recorder_media.py +39 -39
  124. package/runtime/scripts/macos/setup-host.sh +126 -0
  125. package/runtime/scripts/remote_host_setup.sh +7 -4
  126. package/runtime/scripts/script_server.py +571 -0
  127. package/runtime/skills/vamp-rpa-ui-checks/SKILL.md +26 -0
  128. package/runtime/skills/vamp-rpa-ui-checks/agents/openai.yaml +4 -0
  129. package/runtime/skills/vamp-rpa-ui-checks/references/display.md +12 -0
  130. package/runtime/skills/vamp-rpa-ui-checks/references/user-guide.md +49 -0
  131. package/runtime/skills/vamp-ui-cleanup/SKILL.md +15 -0
  132. package/runtime/skills/vamp-ui-cleanup/agents/openai.yaml +4 -0
  133. package/runtime/skills/vamp-ui-validation/SKILL.md +27 -0
  134. package/runtime/skills/vamp-ui-validation/agents/openai.yaml +4 -0
  135. package/runtime/third_party/mcp-virtualbox/scripts/mouse_click.py +65 -65
  136. package/runtime/third_party/pyautogui-recorder/LICENSE +674 -674
  137. package/runtime/third_party/pyautogui-recorder/PROVENANCE.json +16 -16
  138. package/runtime/third_party/pyautogui-recorder/PyAutoGuiRecorder.py +169 -169
  139. package/runtime/third_party/pyautogui-recorder/README.md +53 -53
  140. package/runtime/scripts/build_debian_installer.py +0 -48
@@ -1,31 +1,31 @@
1
- VAMP: make a recording for an AI agent
2
-
3
- Run INSIDE the guest VM, not on the host.
4
- 1. Confirm guest resolution 1920x1080, OS scale 100%, browser zoom 100%.
5
- 2. Open Desktop/RPA-Recorder (the desktop may be localized/redirected).
6
- Windows: Start-Recorder.cmd. Debian/Ubuntu GNOME X11: start-recorder.sh.
7
- 3. Record -> perform task -> Stop -> Download. Save recordings/my_task.py.
8
- Never record passwords, certificate private keys or CAPTCHA solutions.
9
- 4. Run: python prepare-recording.py recordings/my_task.py
10
- Debian/Ubuntu: python3 prepare-recording.py recordings/my_task.py
11
- 5. Give the AI VM name + guest OS + absolute recording path, and the desired
12
- success condition. The .handoff.json records the path/hash without replay.
13
-
14
- A guest-only file path is NOT automatically readable by a host MCP server.
15
- Transfer the Python recording to the host and give its host path, or agree
16
- on a supported retrieval route. Existing SPICE static conversion is available.
17
- VirtualBox recorded replay conversion is still pending; its input tools work,
18
- but do not treat a SPICE URI as a VirtualBox VM connection.
19
-
20
- The AI can inspect the Python text without executing it, create Robot/Python
21
- RPA steps and update guest pixel coordinates from fresh screen evidence.
22
- Prefer Win+R for Windows app startup and Alt+F2 on GNOME, rather than desktop icons.
23
-
24
- Windows requires a valid license. After installation, activate Windows yourself
25
- in Settings -> System -> Activation. VAMP does not include a license or bypass activation.
26
-
27
- Every guest user login: VAMP's display hook requests 1920x1080 again.
28
- Windows: %LOCALAPPDATA%\VAMP\display\result.json
29
- GNOME: ~/.local/share/vamp/display/result.json
30
- If verified=false, install/update the display driver/Guest Additions, reboot,
31
- and sign in again. The hook never starts the recorder or records keys by itself.
1
+ VAMP: make a recording for an AI agent
2
+
3
+ Run INSIDE the guest VM, not on the host.
4
+ 1. Confirm guest resolution 1920x1080, OS scale 100%, browser zoom 100%.
5
+ 2. Open Desktop/RPA-Recorder (the desktop may be localized/redirected).
6
+ Windows: Start-Recorder.cmd. Debian/Ubuntu GNOME X11: start-recorder.sh.
7
+ 3. Record -> perform task -> Stop -> Download. Save recordings/my_task.py.
8
+ Never record passwords, certificate private keys or CAPTCHA solutions.
9
+ 4. Run: python prepare-recording.py recordings/my_task.py
10
+ Debian/Ubuntu: python3 prepare-recording.py recordings/my_task.py
11
+ 5. Give the AI VM name + guest OS + absolute recording path, and the desired
12
+ success condition. The .handoff.json records the path/hash without replay.
13
+
14
+ A guest-only file path is NOT automatically readable by a host MCP server.
15
+ Transfer the Python recording to the host and give its host path, or agree
16
+ on a supported retrieval route. Existing SPICE static conversion is available.
17
+ VirtualBox recorded replay conversion is still pending; its input tools work,
18
+ but do not treat a SPICE URI as a VirtualBox VM connection.
19
+
20
+ The AI can inspect the Python text without executing it, create Robot/Python
21
+ RPA steps and update guest pixel coordinates from fresh screen evidence.
22
+ Prefer Win+R for Windows app startup and Alt+F2 on GNOME, rather than desktop icons.
23
+
24
+ Windows requires a valid license. After installation, activate Windows yourself
25
+ in Settings -> System -> Activation. VAMP does not include a license or bypass activation.
26
+
27
+ Every guest user login: VAMP's display hook requests 1920x1080 again.
28
+ Windows: %LOCALAPPDATA%\VAMP\display\result.json
29
+ GNOME: ~/.local/share/vamp/display/result.json
30
+ If verified=false, install/update the display driver/Guest Additions, reboot,
31
+ and sign in again. The hook never starts the recorder or records keys by itself.
@@ -1,41 +1,41 @@
1
- #!/usr/bin/env python3
2
- """Run inside the guest desktop session at every login; compact machine-readable result."""
3
- import argparse
4
- from datetime import datetime,timezone
5
- import importlib.util
6
- import json
7
- import os
8
- from pathlib import Path
9
- import sys
10
- import time
11
-
12
-
13
- def execute(attempts=8,delay=5,backend=None):
14
- backend=backend or ('windows' if sys.platform=='win32' else 'gnome')
15
- file=Path(__file__).with_name(backend+'-display.py')
16
- spec=importlib.util.spec_from_file_location('vamp_guest_display',file)
17
- module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
18
- last=None
19
- for attempt in range(1,attempts+1):
20
- try:
21
- last=module.apply()
22
- if last.get('resolution_verified'):break
23
- except Exception as exc:
24
- last={'status':'needs_attention','resolution_verified':False,'error':str(exc)}
25
- if attempt<attempts:time.sleep(delay)
26
- return {**last,'backend':backend,'target_resolution':[1920,1080],'attempts':attempt,
27
- 'timestamp':datetime.now(timezone.utc).isoformat(),'scope':'logged_in_guest_user',
28
- 'always_runs_at_login':True}
29
-
30
- if __name__=='__main__':
31
- parser=argparse.ArgumentParser(description=__doc__)
32
- parser.add_argument('--output',default=str(Path(__file__).with_name('result.json')))
33
- parser.add_argument('--attempts',type=int,default=8)
34
- parser.add_argument('--delay',type=float,default=5)
35
- args=parser.parse_args()
36
- if not 1<=args.attempts<=12 or not 0<=args.delay<=10:parser.error('Invalid retry limits')
37
- result=execute(args.attempts,args.delay)
38
- output=Path(args.output).expanduser();output.parent.mkdir(parents=True,exist_ok=True)
39
- temporary=output.with_suffix('.tmp');temporary.write_text(json.dumps(result,indent=2)+'\n');temporary.replace(output)
40
- if sys.stdout:print(json.dumps(result))
41
- sys.exit(0 if result['resolution_verified'] else 1)
1
+ #!/usr/bin/env python3
2
+ """Run inside the guest desktop session at every login; compact machine-readable result."""
3
+ import argparse
4
+ from datetime import datetime,timezone
5
+ import importlib.util
6
+ import json
7
+ import os
8
+ from pathlib import Path
9
+ import sys
10
+ import time
11
+
12
+
13
+ def execute(attempts=8,delay=5,backend=None):
14
+ backend=backend or ('windows' if sys.platform=='win32' else 'gnome')
15
+ file=Path(__file__).with_name(backend+'-display.py')
16
+ spec=importlib.util.spec_from_file_location('vamp_guest_display',file)
17
+ module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
18
+ last=None
19
+ for attempt in range(1,attempts+1):
20
+ try:
21
+ last=module.apply()
22
+ if last.get('resolution_verified'):break
23
+ except Exception as exc:
24
+ last={'status':'needs_attention','resolution_verified':False,'error':str(exc)}
25
+ if attempt<attempts:time.sleep(delay)
26
+ return {**last,'backend':backend,'target_resolution':[1920,1080],'attempts':attempt,
27
+ 'timestamp':datetime.now(timezone.utc).isoformat(),'scope':'logged_in_guest_user',
28
+ 'always_runs_at_login':True}
29
+
30
+ if __name__=='__main__':
31
+ parser=argparse.ArgumentParser(description=__doc__)
32
+ parser.add_argument('--output',default=str(Path(__file__).with_name('result.json')))
33
+ parser.add_argument('--attempts',type=int,default=8)
34
+ parser.add_argument('--delay',type=float,default=5)
35
+ args=parser.parse_args()
36
+ if not 1<=args.attempts<=12 or not 0<=args.delay<=10:parser.error('Invalid retry limits')
37
+ result=execute(args.attempts,args.delay)
38
+ output=Path(args.output).expanduser();output.parent.mkdir(parents=True,exist_ok=True)
39
+ temporary=output.with_suffix('.tmp');temporary.write_text(json.dumps(result,indent=2)+'\n');temporary.replace(output)
40
+ if sys.stdout:print(json.dumps(result))
41
+ sys.exit(0 if result['resolution_verified'] else 1)
@@ -1,62 +1,62 @@
1
- #!/usr/bin/env python3
2
- """Disable installation-CD APT entries and configure official Debian network mirrors."""
3
- from datetime import datetime,timezone
4
- import json
5
- import os
6
- from pathlib import Path
7
- import re
8
- import shutil
9
-
10
-
11
- def configure(root=Path('/')):
12
- root=Path(root)
13
- release=dict(re.findall(r'^([A-Z_]+)=["\']?([^"\'\n]+)',(root/'etc/os-release').read_text(),re.M))
14
- if release.get('ID')!='debian':return {'status':'not_debian','changed':False}
15
- suite=release.get('VERSION_CODENAME','')
16
- if not re.fullmatch(r'[a-z][a-z0-9-]*',suite):raise ValueError('Cannot determine installed Debian codename')
17
- apt=root/'etc/apt';source_dir=apt/'sources.list.d';source_dir.mkdir(parents=True,exist_ok=True)
18
- backup=root/'var/backups'/('vamp-apt-'+datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%S%f'))
19
- changed=[]
20
- for path in [apt/'sources.list',*sorted(source_dir.glob('*.list')),*sorted(source_dir.glob('*.sources'))]:
21
- if not path.is_file() or path.name=='vamp-debian.sources':continue
22
- old=path.read_text()
23
- if path.suffix=='.sources':
24
- stanzas=re.split(r'\n\s*\n',old)
25
- kept=[]
26
- for stanza in stanzas:
27
- uri=re.search(r'^URIs:\s*(.*)',stanza,re.M|re.I)
28
- if uri and uri[1].lower().startswith('cdrom:'):continue
29
- kept.append(stanza)
30
- new='\n\n'.join(kept)
31
- else:
32
- new=''.join(line for line in old.splitlines(keepends=True)
33
- if not re.match(r'^\s*deb(?:-src)?\s+.*cdrom:',line,re.I))
34
- if new!=old:
35
- backup.mkdir(parents=True,exist_ok=True);shutil.copy2(path,backup/(path.parent.name+'-'+path.name))
36
- path.write_text(new);changed.append(str(path))
37
- # Reuse a manually configured complete official network list without duplicating it.
38
- enabled='\n'.join(p.read_text() for p in [apt/'sources.list',*source_dir.glob('*.list')] if p.is_file())
39
- active='\n'.join(line for line in enabled.splitlines() if line.strip().startswith('deb '))
40
- complete=all(re.search(r'\b'+re.escape(part)+r'\b',active) for part in [suite,suite+'-updates',suite+'-security']) and 'deb.debian.org' in active and 'security.debian.org' in active
41
- target=source_dir/'vamp-debian.sources'
42
- if not complete:
43
- desired=f'''Types: deb
44
- URIs: https://deb.debian.org/debian
45
- Suites: {suite} {suite}-updates
46
- Components: main contrib non-free non-free-firmware
47
- Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
48
-
49
- Types: deb
50
- URIs: https://security.debian.org/debian-security
51
- Suites: {suite}-security
52
- Components: main contrib non-free non-free-firmware
53
- Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
54
- '''
55
- if not target.exists() or target.read_text()!=desired:target.write_text(desired);changed.append(str(target))
56
- return {'status':'configured','suite':suite,'cdrom_sources_disabled':True,'changed':changed,
57
- 'mirrors':['https://deb.debian.org/debian','https://security.debian.org/debian-security'],
58
- 'note':'Run apt-get update; does not upgrade to another Debian release.'}
59
-
60
- if __name__=='__main__':
61
- if os.geteuid()!=0:raise SystemExit('Run inside the Debian guest as root')
62
- print(json.dumps(configure()))
1
+ #!/usr/bin/env python3
2
+ """Disable installation-CD APT entries and configure official Debian network mirrors."""
3
+ from datetime import datetime,timezone
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ import re
8
+ import shutil
9
+
10
+
11
+ def configure(root=Path('/')):
12
+ root=Path(root)
13
+ release=dict(re.findall(r'^([A-Z_]+)=["\']?([^"\'\n]+)',(root/'etc/os-release').read_text(),re.M))
14
+ if release.get('ID')!='debian':return {'status':'not_debian','changed':False}
15
+ suite=release.get('VERSION_CODENAME','')
16
+ if not re.fullmatch(r'[a-z][a-z0-9-]*',suite):raise ValueError('Cannot determine installed Debian codename')
17
+ apt=root/'etc/apt';source_dir=apt/'sources.list.d';source_dir.mkdir(parents=True,exist_ok=True)
18
+ backup=root/'var/backups'/('vamp-apt-'+datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%S%f'))
19
+ changed=[]
20
+ for path in [apt/'sources.list',*sorted(source_dir.glob('*.list')),*sorted(source_dir.glob('*.sources'))]:
21
+ if not path.is_file() or path.name=='vamp-debian.sources':continue
22
+ old=path.read_text()
23
+ if path.suffix=='.sources':
24
+ stanzas=re.split(r'\n\s*\n',old)
25
+ kept=[]
26
+ for stanza in stanzas:
27
+ uri=re.search(r'^URIs:\s*(.*)',stanza,re.M|re.I)
28
+ if uri and uri[1].lower().startswith('cdrom:'):continue
29
+ kept.append(stanza)
30
+ new='\n\n'.join(kept)
31
+ else:
32
+ new=''.join(line for line in old.splitlines(keepends=True)
33
+ if not re.match(r'^\s*deb(?:-src)?\s+.*cdrom:',line,re.I))
34
+ if new!=old:
35
+ backup.mkdir(parents=True,exist_ok=True);shutil.copy2(path,backup/(path.parent.name+'-'+path.name))
36
+ path.write_text(new);changed.append(str(path))
37
+ # Reuse a manually configured complete official network list without duplicating it.
38
+ enabled='\n'.join(p.read_text() for p in [apt/'sources.list',*source_dir.glob('*.list')] if p.is_file())
39
+ active='\n'.join(line for line in enabled.splitlines() if line.strip().startswith('deb '))
40
+ complete=all(re.search(r'\b'+re.escape(part)+r'\b',active) for part in [suite,suite+'-updates',suite+'-security']) and 'deb.debian.org' in active and 'security.debian.org' in active
41
+ target=source_dir/'vamp-debian.sources'
42
+ if not complete:
43
+ desired=f'''Types: deb
44
+ URIs: https://deb.debian.org/debian
45
+ Suites: {suite} {suite}-updates
46
+ Components: main contrib non-free non-free-firmware
47
+ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
48
+
49
+ Types: deb
50
+ URIs: https://security.debian.org/debian-security
51
+ Suites: {suite}-security
52
+ Components: main contrib non-free non-free-firmware
53
+ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
54
+ '''
55
+ if not target.exists() or target.read_text()!=desired:target.write_text(desired);changed.append(str(target))
56
+ return {'status':'configured','suite':suite,'cdrom_sources_disabled':True,'changed':changed,
57
+ 'mirrors':['https://deb.debian.org/debian','https://security.debian.org/debian-security'],
58
+ 'note':'Run apt-get update; does not upgrade to another Debian release.'}
59
+
60
+ if __name__=='__main__':
61
+ if os.geteuid()!=0:raise SystemExit('Run inside the Debian guest as root')
62
+ print(json.dumps(configure()))
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env python3
2
+ """Idempotent GDM Xorg/autologin configuration for the public VAMP sandbox."""
3
+ from pathlib import Path
4
+ import re
5
+
6
+ def configure(path):
7
+ path=Path(path);text=path.read_text() if path.exists() else ''
8
+ lines=text.splitlines();result=[];section=None;inserted=False
9
+ values=['WaylandEnable=false','AutomaticLoginEnable=true','AutomaticLogin=vboxuser']
10
+ for line in lines:
11
+ match=re.match(r'\s*\[([^]]+)\]',line)
12
+ if match:
13
+ section=match[1]
14
+ result.append(line)
15
+ if section=='daemon':result.extend(values);inserted=True
16
+ continue
17
+ if section=='daemon' and re.match(r'\s*#?\s*(WaylandEnable|AutomaticLoginEnable|AutomaticLogin)\s*=',line):continue
18
+ result.append(line)
19
+ if not inserted:result=['[daemon]',*values,'',*result]
20
+ path.parent.mkdir(parents=True,exist_ok=True);path.write_text('\n'.join(result)+'\n')
21
+
22
+ if __name__=='__main__':
23
+ configure('/etc/gdm3/daemon.conf')
@@ -0,0 +1,14 @@
1
+ # Guest-only interactive automation policy. Never run this on the host.
2
+ $ErrorActionPreference='Stop'
3
+ foreach($setting in @('monitor-timeout-ac','monitor-timeout-dc','standby-timeout-ac','standby-timeout-dc','hibernate-timeout-ac','hibernate-timeout-dc')) {
4
+ & powercfg.exe /change $setting 0
5
+ if($LASTEXITCODE -ne 0){throw "Cannot disable guest power timeout: $setting"}
6
+ }
7
+ foreach($key in @('HKCU:\Control Panel\Desktop','HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop')) {
8
+ New-Item -Path $key -Force | Out-Null
9
+ foreach($name in @('ScreenSaveActive','ScreenSaverIsSecure')){Set-ItemProperty -Path $key -Name $name -Value '0'}
10
+ }
11
+ $key='HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon'
12
+ New-Item -Path $key -Force | Out-Null
13
+ New-ItemProperty -Path $key -Name EnableGoodbye -PropertyType DWord -Value 0 -Force | Out-Null
14
+ Write-Output 'VAMP: guest display/sleep timeouts and automatic screensaver locking disabled.'
@@ -1,60 +1,60 @@
1
- """Debian GNOME guest: persist native full HD using Mutter's session D-Bus API."""
2
-
3
- def select_mode(state):
4
- serial,monitors,logical,properties=state
5
- if len(monitors)!=1 or len(logical)>1:
6
- raise RuntimeError('Expected one guest monitor; refusing to disable other displays')
7
- spec,modes,monitor_properties=monitors[0]
8
- matches=[m for m in modes if (int(m[1]),int(m[2]))==(1920,1080) and 1.0 in [float(x) for x in m[5]]]
9
- if not matches:raise RuntimeError('GNOME driver does not advertise 1920x1080 at scale 1; check guest display drivers')
10
- return serial,spec,max(matches,key=lambda m:float(m[3])),properties
11
-
12
-
13
- def verify(state):
14
- _,monitors,logical,_=state
15
- if len(monitors)!=1 or len(logical)!=1:return False
16
- active=[m for m in monitors[0][1] if m[6].get('is-current',False)]
17
- return bool(len(active)==1 and (int(active[0][1]),int(active[0][2]))==(1920,1080)
18
- and float(logical[0][2])==1.0 and int(logical[0][3])==0)
19
-
20
-
21
- def native_x11():
22
- import re,subprocess
23
- visible=subprocess.check_output(['xrandr','--current'],text=True)
24
- connectors=re.findall(r'^(\S+) connected',visible,re.M)
25
- if len(connectors)!=1:raise RuntimeError('Expected one native X11 monitor')
26
- if not re.search(r'^\s+1920x1080\s',visible,re.M):raise RuntimeError('Native X11 driver does not advertise full HD')
27
- subprocess.run(['xrandr','--output',connectors[0],'--mode','1920x1080','--fb','1920x1080'],check=True,capture_output=True,text=True)
28
- after=subprocess.check_output(['xrandr','--current'],text=True)
29
- match=re.search(r'current (\d+) x (\d+)',after)
30
- return [int(match[1]),int(match[2])] if match else None
31
-
32
-
33
- def apply():
34
- import dbus
35
- bus=dbus.SessionBus()
36
- proxy=bus.get_object('org.gnome.Mutter.DisplayConfig','/org/gnome/Mutter/DisplayConfig')
37
- interface=dbus.Interface(proxy,'org.gnome.Mutter.DisplayConfig')
38
- state=interface.GetCurrentState(timeout=15)
39
- serial,spec,mode,properties=select_mode(state)
40
- if not verify(state):
41
- configuration=dbus.Array([dbus.Struct((dbus.Int32(0),dbus.Int32(0),dbus.Double(1.0),
42
- dbus.UInt32(0),dbus.Boolean(True),dbus.Array([
43
- dbus.Struct((str(spec[0]),str(mode[0]),dbus.Dictionary({},signature='sv')))],signature='(ssa{sv})')))],signature='(iiduba(ssa{sv}))')
44
- options=dbus.Dictionary({},signature='sv')
45
- if properties.get('supports-changing-layout-mode',False) and 'layout-mode' in properties:options['layout-mode']=dbus.UInt32(properties['layout-mode'])
46
- # Verify the selected monitor/mode before persistently applying.
47
- interface.ApplyMonitorsConfig(serial,dbus.UInt32(0),configuration,options,timeout=15)
48
- interface.ApplyMonitorsConfig(serial,dbus.UInt32(2),configuration,options,timeout=15)
49
- observed=interface.GetCurrentState(timeout=15)
50
- verified=verify(observed)
51
- import os
52
- native=None
53
- if os.environ.get('XDG_SESSION_TYPE')=='x11':
54
- native=native_x11();verified=verified and native==[1920,1080]
55
- active=[m for m in observed[1][0][1] if m[6].get('is-current',False)]
56
- return {'status':'succeeded' if verified else 'needs_attention','resolution_verified':verified,
57
- 'observed_resolution':native if native else ([int(active[0][1]),int(active[0][2])] if len(active)==1 else None),
58
- 'x11_framebuffer_verified':native==[1920,1080],
59
- 'scale':float(observed[2][0][2]) if observed[2] else None,
60
- 'mechanism':'GNOME Mutter ApplyMonitorsConfig persistent (method 2)'}
1
+ """Debian GNOME guest: persist native full HD using Mutter's session D-Bus API."""
2
+
3
+ def select_mode(state):
4
+ serial,monitors,logical,properties=state
5
+ if len(monitors)!=1 or len(logical)>1:
6
+ raise RuntimeError('Expected one guest monitor; refusing to disable other displays')
7
+ spec,modes,monitor_properties=monitors[0]
8
+ matches=[m for m in modes if (int(m[1]),int(m[2]))==(1920,1080) and 1.0 in [float(x) for x in m[5]]]
9
+ if not matches:raise RuntimeError('GNOME driver does not advertise 1920x1080 at scale 1; check guest display drivers')
10
+ return serial,spec,max(matches,key=lambda m:float(m[3])),properties
11
+
12
+
13
+ def verify(state):
14
+ _,monitors,logical,_=state
15
+ if len(monitors)!=1 or len(logical)!=1:return False
16
+ active=[m for m in monitors[0][1] if m[6].get('is-current',False)]
17
+ return bool(len(active)==1 and (int(active[0][1]),int(active[0][2]))==(1920,1080)
18
+ and float(logical[0][2])==1.0 and int(logical[0][3])==0)
19
+
20
+
21
+ def native_x11():
22
+ import re,subprocess
23
+ visible=subprocess.check_output(['xrandr','--current'],text=True)
24
+ connectors=re.findall(r'^(\S+) connected',visible,re.M)
25
+ if len(connectors)!=1:raise RuntimeError('Expected one native X11 monitor')
26
+ if not re.search(r'^\s+1920x1080\s',visible,re.M):raise RuntimeError('Native X11 driver does not advertise full HD')
27
+ subprocess.run(['xrandr','--output',connectors[0],'--mode','1920x1080','--fb','1920x1080'],check=True,capture_output=True,text=True)
28
+ after=subprocess.check_output(['xrandr','--current'],text=True)
29
+ match=re.search(r'current (\d+) x (\d+)',after)
30
+ return [int(match[1]),int(match[2])] if match else None
31
+
32
+
33
+ def apply():
34
+ import dbus
35
+ bus=dbus.SessionBus()
36
+ proxy=bus.get_object('org.gnome.Mutter.DisplayConfig','/org/gnome/Mutter/DisplayConfig')
37
+ interface=dbus.Interface(proxy,'org.gnome.Mutter.DisplayConfig')
38
+ state=interface.GetCurrentState(timeout=15)
39
+ serial,spec,mode,properties=select_mode(state)
40
+ if not verify(state):
41
+ configuration=dbus.Array([dbus.Struct((dbus.Int32(0),dbus.Int32(0),dbus.Double(1.0),
42
+ dbus.UInt32(0),dbus.Boolean(True),dbus.Array([
43
+ dbus.Struct((str(spec[0]),str(mode[0]),dbus.Dictionary({},signature='sv')))],signature='(ssa{sv})')))],signature='(iiduba(ssa{sv}))')
44
+ options=dbus.Dictionary({},signature='sv')
45
+ if properties.get('supports-changing-layout-mode',False) and 'layout-mode' in properties:options['layout-mode']=dbus.UInt32(properties['layout-mode'])
46
+ # Verify the selected monitor/mode before persistently applying.
47
+ interface.ApplyMonitorsConfig(serial,dbus.UInt32(0),configuration,options,timeout=15)
48
+ interface.ApplyMonitorsConfig(serial,dbus.UInt32(2),configuration,options,timeout=15)
49
+ observed=interface.GetCurrentState(timeout=15)
50
+ verified=verify(observed)
51
+ import os
52
+ native=None
53
+ if os.environ.get('XDG_SESSION_TYPE')=='x11':
54
+ native=native_x11();verified=verified and native==[1920,1080]
55
+ active=[m for m in observed[1][0][1] if m[6].get('is-current',False)]
56
+ return {'status':'succeeded' if verified else 'needs_attention','resolution_verified':verified,
57
+ 'observed_resolution':native if native else ([int(active[0][1]),int(active[0][2])] if len(active)==1 else None),
58
+ 'x11_framebuffer_verified':native==[1920,1080],
59
+ 'scale':float(observed[2][0][2]) if observed[2] else None,
60
+ 'mechanism':'GNOME Mutter ApplyMonitorsConfig persistent (method 2)'}
@@ -1,39 +1,66 @@
1
- #!/usr/bin/env python3
2
- """Install a user-session full HD reset at EVERY login, not a one-time RunOnce."""
3
- import json
4
- import os
5
- from pathlib import Path
6
- import shutil
7
- import sys
8
-
9
-
10
- def install(home=None,platform=None,python=None):
11
- platform=platform or sys.platform
12
- home=Path(home or Path.home());python=python or sys.executable
13
- if platform=='win32':
14
- base=Path(os.environ['LOCALAPPDATA'])/'VAMP/display'
15
- startup=Path(os.environ['APPDATA'])/'Microsoft/Windows/Start Menu/Programs/Startup'
16
- else:
17
- base=home/'.local/share/vamp/display';startup=home/'.config/autostart'
18
- base.mkdir(parents=True,exist_ok=True);startup.mkdir(parents=True,exist_ok=True)
19
- for name in ['apply-display.py','windows-display.py','gnome-display.py']:
20
- destination=base/name
21
- if destination.exists():destination.chmod(0o644)
22
- shutil.copyfile(Path(__file__).with_name(name),destination)
23
- command=base/'apply-display.py'
24
- if platform=='win32':
25
- gui=Path(python).with_name('pythonw.exe')
26
- interpreter=str(gui) if gui.is_file() else python
27
- launcher=startup/'VAMP-Display.cmd'
28
- launcher.write_text(f'@echo off\n"{interpreter}" "{command}" --output "{base / "result.json"}"\n')
29
- else:
30
- def quote(value):return '"'+str(value).replace('\\','\\\\').replace('"','\\"').replace('`','\\`').replace('$','\\$')+'"'
31
- launcher=startup/'vamp-display.desktop'
32
- launcher.write_text('[Desktop Entry]\nType=Application\nName=VAMP Native Full HD\n'
33
- +f'Exec={quote(python)} {quote(command)}\nTerminal=false\nX-GNOME-Autostart-enabled=true\nOnlyShowIn=GNOME;\n')
34
- result={'status':'registered','trigger':'every_user_login','launcher':str(launcher),
35
- 'script':str(command),'result':str(base/'result.json'),'resolution_verified':False}
36
- (base/'registration.json').write_text(json.dumps(result,indent=2)+'\n')
37
- return result
38
-
39
- if __name__=='__main__':print(json.dumps(install()))
1
+ #!/usr/bin/env python3
2
+ """Install a user-session full HD reset at EVERY login, not a one-time RunOnce."""
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+ import shutil
7
+ import shlex
8
+ import sys
9
+
10
+
11
+ def install(home=None,platform=None,python=None,desktop=None):
12
+ platform=platform or sys.platform
13
+ home=Path(home or Path.home());python=python or sys.executable
14
+ if platform=='win32':
15
+ base=Path(os.environ['LOCALAPPDATA'])/'VAMP/display'
16
+ startup=Path(os.environ['APPDATA'])/'Microsoft/Windows/Start Menu/Programs/Startup'
17
+ else:
18
+ base=home/'.local/share/vamp/display';startup=home/'.config/autostart'
19
+ base.mkdir(parents=True,exist_ok=True);startup.mkdir(parents=True,exist_ok=True)
20
+ for name in ['apply-display.py','windows-display.py','gnome-display.py','session-policy.py']:
21
+ destination=base/name
22
+ if destination.exists():destination.chmod(0o644)
23
+ shutil.copyfile(Path(__file__).with_name(name),destination)
24
+ command=base/'apply-display.py'
25
+ if platform=='win32':
26
+ gui=Path(python).with_name('pythonw.exe')
27
+ interpreter=str(gui) if gui.is_file() else python
28
+ launcher=startup/'VAMP-Display.cmd'
29
+ launcher.write_text(f'@echo off\n"{interpreter}" "{command}" --output "{base / "result.json"}"\n')
30
+ else:
31
+ def quote(value):return '"'+str(value).replace('\\','\\\\').replace('"','\\"').replace('`','\\`').replace('$','\\$')+'"'
32
+ launcher=startup/'vamp-display.desktop'
33
+ launcher.write_text('[Desktop Entry]\nType=Application\nName=VAMP Display Setup (best effort)\n'
34
+ +f'Exec={quote(python)} {quote(command)}\nTerminal=false\nX-GNOME-Autostart-enabled=true\nOnlyShowIn=GNOME;\n')
35
+ (startup/'vamp-session.desktop').write_text('[Desktop Entry]\nType=Application\nName=VAMP Automation Session\n'
36
+ +f'Exec={quote(python)} {quote(base/"session-policy.py")}\nTerminal=false\nX-GNOME-Autostart-enabled=true\nOnlyShowIn=GNOME;\n')
37
+ if platform=='win32':
38
+ desktop=Path(desktop or home/'Desktop');desktop.mkdir(parents=True,exist_ok=True)
39
+ manual=desktop/'Set-Resolution-1920x1080.cmd'
40
+ manual_script=desktop/'Set-Resolution-1920x1080.ps1'
41
+ quote=lambda value:"'"+str(value).replace("'","''")+"'"
42
+ manual_script.write_text("$ErrorActionPreference='Stop'\n"
43
+ +"$p=New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())\n"
44
+ +"if(-not $p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){ $c=Start-Process powershell.exe -Verb RunAs -ArgumentList ('-NoProfile -ExecutionPolicy Unrestricted -File \"'+$PSCommandPath+'\"') -Wait -PassThru; exit $c.ExitCode }\n"
45
+ +"Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force\n"
46
+ +"Write-Host 'Applying 1920x1080 to the guest display...'\n"
47
+ +f'& {quote(python)} {quote(command)} --output {quote(base/"manual-result.json")}\n'
48
+ +"if ($LASTEXITCODE -ne 0) { Write-Host 'The guest display driver could not apply Full HD. See the output above and check the display driver.'; exit $LASTEXITCODE }\n"
49
+ +"Write-Host 'Resolution applied. Keep guest display scaling at 100%.'\n",encoding='utf-8-sig')
50
+ manual.write_text('@echo off\npowershell.exe -NoProfile -ExecutionPolicy Unrestricted -File "%~dp0Set-Resolution-1920x1080.ps1"\necho Press any key to close this window.\npause >nul\n',encoding='ascii')
51
+ else:
52
+ manual=home/'set-resolution-1920x1080.sh';manual_script=manual
53
+ manual.write_text('#!/bin/sh\nset -eu\necho "Applying 1920x1080 to the guest display..."\n'
54
+ +f'{shlex.quote(python)} {shlex.quote(str(command))} --output {shlex.quote(str(base/"manual-result.json"))}\n'
55
+ +'echo "Resolution applied. Keep guest display scaling at 100%."\n',encoding='utf8')
56
+ manual.chmod(0o755)
57
+ result={'status':'registered','trigger':'every_user_login','launcher':str(launcher),
58
+ 'manual_launcher':str(manual),'manual_script':str(manual_script),
59
+ 'script':str(command),'result':str(base/'result.json'),'resolution_verified':False}
60
+ (base/'registration.json').write_text(json.dumps(result,indent=2)+'\n')
61
+ return result
62
+
63
+ if __name__=='__main__':
64
+ import argparse
65
+ parser=argparse.ArgumentParser();parser.add_argument('--desktop');args=parser.parse_args()
66
+ print(json.dumps(install(desktop=args.desktop)))
@@ -0,0 +1,34 @@
1
+ param([ValidateSet('virtualbox','kvm')][string]$Backend)
2
+ $ErrorActionPreference='Stop'
3
+ $principal=New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
4
+ if(-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){throw 'Hypervisor drivers require administrator PowerShell'}
5
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
6
+ $roots=Get-PSDrive -PSProvider FileSystem | Select-Object -ExpandProperty Root
7
+ $isoName=if($Backend -eq 'virtualbox'){'VBoxGuestAdditions.iso'}else{'virtio-win.iso'}
8
+ $media=$roots | ForEach-Object {Join-Path $_ $isoName} | Where-Object {Test-Path -LiteralPath $_} | Select-Object -First 1
9
+ if($media){Mount-DiskImage -ImagePath $media -StorageType ISO | Out-Null;$roots=Get-PSDrive -PSProvider FileSystem | Select-Object -ExpandProperty Root}
10
+ $logRoot=Join-Path $env:ProgramData 'VAMP-Packer'
11
+ New-Item -ItemType Directory -Force -Path $logRoot | Out-Null
12
+ if($Backend -eq 'virtualbox'){
13
+ $installer=$roots | ForEach-Object {Join-Path $_ 'VBoxWindowsAdditions.exe'} | Where-Object {Test-Path -LiteralPath $_} | Select-Object -First 1
14
+ if(-not $installer){throw 'VirtualBox Guest Additions ISO is not attached'}
15
+ $signature=Get-AuthenticodeSignature -LiteralPath $installer
16
+ if($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'Oracle'){throw 'Guest Additions signature verification failed'}
17
+ $process=Start-Process -FilePath $installer -ArgumentList '/S' -WindowStyle Hidden -Wait -PassThru
18
+ if($process.ExitCode -notin @(0,3010)){throw "Guest Additions failed: $($process.ExitCode)"}
19
+ @{status='installed';backend=$Backend;reboot_required=$true;installer=$installer}
20
+ }else{
21
+ $installer=$roots | ForEach-Object {Join-Path $_ 'virtio-win-gt-x64.msi'} | Where-Object {Test-Path -LiteralPath $_} | Select-Object -First 1
22
+ if(-not $installer){throw 'The virtio-win driver ISO is not attached'}
23
+ $packages=@($installer)
24
+ $agent=Join-Path (Split-Path $installer) 'guest-agent\qemu-ga-x86_64.msi'
25
+ if(Test-Path -LiteralPath $agent){$packages+=$agent}
26
+ foreach($package in $packages){
27
+ $signature=Get-AuthenticodeSignature -LiteralPath $package
28
+ if($signature.Status -ne 'Valid'){throw "VirtIO package signature verification failed: $package"}
29
+ $log=Join-Path $logRoot ((Split-Path $package -Leaf)+'.log')
30
+ $process=Start-Process msiexec.exe -ArgumentList @('/i',('"'+$package+'"'),'/qn','/norestart','REBOOT=ReallySuppress','/L*v',('"'+$log+'"')) -WindowStyle Hidden -Wait -PassThru
31
+ if($process.ExitCode -notin @(0,3010)){throw "VirtIO guest package failed: $($process.ExitCode)"}
32
+ }
33
+ @{status='installed';backend=$Backend;reboot_required=$true;installer=$installer;guest_agent_installed=(Test-Path -LiteralPath $agent)}
34
+ }
@@ -0,0 +1,36 @@
1
+ # Install the display reset shortcuts only; do not change the current resolution.
2
+ $ErrorActionPreference='Stop'
3
+ $principal=New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
4
+ if(-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){
5
+ $payload='Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force; '
6
+ if($PSCommandPath){$payload+="& '"+$PSCommandPath.Replace("'","''")+"'"}
7
+ else {
8
+ $origin=if($env:VAMP_SCRIPT_BASE_URL){$env:VAMP_SCRIPT_BASE_URL}else{'http://10.0.2.2:8421'}
9
+ $payload+="irm '"+($origin+'/recorder/install-resolution-shortcut.ps1').Replace("'","''")+"' | iex"
10
+ }
11
+ $encoded=[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($payload))
12
+ $elevated=Start-Process powershell.exe -Verb RunAs -ArgumentList @('-NoProfile','-ExecutionPolicy','Unrestricted','-EncodedCommand',$encoded) -Wait -PassThru
13
+ if($elevated.ExitCode -ne 0){throw 'Administrator setup did not complete successfully'}
14
+ return
15
+ }
16
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
17
+
18
+ $base=if($env:VAMP_SCRIPT_BASE_URL){$env:VAMP_SCRIPT_BASE_URL}else{'http://10.0.2.2:8421'}
19
+ $desktop=[Environment]::GetFolderPath('Desktop')
20
+ $candidates=@((Join-Path $desktop 'RPA-Recorder\.venv\Scripts\python.exe'))
21
+ $pythonRoot=Join-Path $env:LOCALAPPDATA 'Programs\Python'
22
+ if(Test-Path -LiteralPath $pythonRoot){
23
+ $candidates+=Get-ChildItem -LiteralPath $pythonRoot -Directory -Filter 'Python3*' | Sort-Object Name -Descending | ForEach-Object {Join-Path $_.FullName 'python.exe'}
24
+ }
25
+ $python=$candidates | Where-Object {Test-Path -LiteralPath $_ -PathType Leaf} | Select-Object -First 1
26
+ if(-not $python){throw 'Python from guest setup was not found. Finish VAMP guest setup first.'}
27
+ $work=Join-Path $env:TEMP ('vamp-resolution-'+[guid]::NewGuid().ToString('N'))
28
+ New-Item -ItemType Directory -Path $work | Out-Null
29
+ foreach($name in @('apply-display.py','windows-display.py','gnome-display.py','session-policy.py','install-display-startup.py')){
30
+ Invoke-WebRequest -UseBasicParsing -Uri "$base/recorder/$name" -OutFile (Join-Path $work $name)
31
+ }
32
+ & $python (Join-Path $work 'install-display-startup.py') --desktop $desktop
33
+ if($LASTEXITCODE -ne 0){throw 'Resolution shortcut installation failed'}
34
+ Write-Host 'Installed on the Desktop: Set-Resolution-1920x1080.cmd and Set-Resolution-1920x1080.ps1'
35
+ Write-Host 'Double-click Set-Resolution-1920x1080.cmd to apply Full HD when needed.'
36
+ Write-Host 'The current display resolution has not been changed.'