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,39 +1,39 @@
1
- """Import an explicitly chosen guest recording via existing Guest Additions; never replay."""
2
- import ast
3
- import hashlib
4
- import json
5
- import os
6
- from pathlib import Path,PureWindowsPath
7
- import subprocess
8
- import uuid
9
- try:
10
- from .provision import ROOT,executable
11
- except ImportError:
12
- from provision import ROOT,executable
13
-
14
-
15
- def import_recording(vm,guest_path,username='vboxuser'):
16
- normalized=guest_path.replace('\\','/')
17
- parts=normalized.split('/')
18
- if '..' in parts or 'RPA-Recorder' not in parts or not normalized.endswith(('.py','.handoff.json')):
19
- raise ValueError('Choose a Python/.handoff.json file under the guest RPA-Recorder folder')
20
- folder=ROOT/'artifacts/imported-recordings'/uuid.uuid4().hex[:12];folder.mkdir(parents=True)
21
- destination=folder/PureWindowsPath(guest_path).name
22
- password=os.environ.get('VAMP_GUEST_PASSWORD','password123!')
23
- result=subprocess.run([executable(),'guestcontrol',vm,'copyfrom','--username',username,
24
- '--password',password,'--target-directory',str(destination),guest_path],capture_output=True,text=True,timeout=90)
25
- if result.returncode:raise RuntimeError('Guest recording transfer failed; check Guest Additions, guest path and authorized VM account. '+result.stderr[:200])
26
- if not destination.is_file() or destination.stat().st_size>5_000_000:
27
- destination.unlink(missing_ok=True);raise ValueError('Expected a recording under 5 MB')
28
- content=destination.read_text(encoding='utf-8-sig')
29
- if destination.suffix=='.py':ast.parse(content)
30
- else:json.loads(content)
31
- destination.chmod(0o600)
32
- return {'status':'imported_for_review','host_path':str(destination),'guest_path':guest_path,
33
- 'sha256':hashlib.sha256(destination.read_bytes()).hexdigest(),'source_executed':False,
34
- 'next_action':'Read the imported text without executing it. Review credentials and apply the static converter for a supported backend.'}
35
-
36
- if __name__=='__main__':
37
- import sys
38
- try:print(json.dumps(import_recording(**json.load(sys.stdin))))
39
- except Exception as exc:print(json.dumps({'status':'failed','error':str(exc)}));sys.exit(1)
1
+ """Import an explicitly chosen guest recording via existing Guest Additions; never replay."""
2
+ import ast
3
+ import hashlib
4
+ import json
5
+ import os
6
+ from pathlib import Path,PureWindowsPath
7
+ import subprocess
8
+ import uuid
9
+ try:
10
+ from .provision import ROOT,executable
11
+ except ImportError:
12
+ from provision import ROOT,executable
13
+
14
+
15
+ def import_recording(vm,guest_path,username='vboxuser'):
16
+ normalized=guest_path.replace('\\','/')
17
+ parts=normalized.split('/')
18
+ if '..' in parts or 'RPA-Recorder' not in parts or not normalized.endswith(('.py','.handoff.json')):
19
+ raise ValueError('Choose a Python/.handoff.json file under the guest RPA-Recorder folder')
20
+ folder=ROOT/'artifacts/imported-recordings'/uuid.uuid4().hex[:12];folder.mkdir(parents=True)
21
+ destination=folder/PureWindowsPath(guest_path).name
22
+ password=os.environ.get('VAMP_GUEST_PASSWORD','password123!')
23
+ result=subprocess.run([executable(),'guestcontrol',vm,'copyfrom','--username',username,
24
+ '--password',password,'--target-directory',str(destination),guest_path],capture_output=True,text=True,timeout=90)
25
+ if result.returncode:raise RuntimeError('Guest recording transfer failed; check Guest Additions, guest path and authorized VM account. '+result.stderr[:200])
26
+ if not destination.is_file() or destination.stat().st_size>5_000_000:
27
+ destination.unlink(missing_ok=True);raise ValueError('Expected a recording under 5 MB')
28
+ content=destination.read_text(encoding='utf-8-sig')
29
+ if destination.suffix=='.py':ast.parse(content)
30
+ else:json.loads(content)
31
+ destination.chmod(0o600)
32
+ return {'status':'imported_for_review','host_path':str(destination),'guest_path':guest_path,
33
+ 'sha256':hashlib.sha256(destination.read_bytes()).hexdigest(),'source_executed':False,
34
+ 'next_action':'Read the imported text without executing it. Review credentials and apply the static converter for a supported backend.'}
35
+
36
+ if __name__=='__main__':
37
+ import sys
38
+ try:print(json.dumps(import_recording(**json.load(sys.stdin))))
39
+ except Exception as exc:print(json.dumps({'status':'failed','error':str(exc)}));sys.exit(1)
@@ -1,7 +1,7 @@
1
- # Host-only control; no SPICE/GI dependency. Vision uses root install profiles.
2
- mcp==1.30.0
3
- robotframework==7.5.1
4
- pycdlib==1.14.0
5
-
6
- # Saved RPA replay on KVM guest devices; no screenshot inference loop.
7
- asyncvnc==1.3.0
1
+ # Host-only control; no SPICE/GI dependency. Vision uses root install profiles.
2
+ mcp==1.30.0
3
+ robotframework==7.5.1
4
+ pycdlib==1.14.0
5
+
6
+ # Saved RPA replay on KVM guest devices; no screenshot inference loop.
7
+ asyncvnc==1.3.0
@@ -1 +1 @@
1
- {"id":"debian_first_boot","backend":"virtualbox","entry":"run.robot","python":"workflow.py","description":"English OCR guarded first login, su root and official Debian network mirror setup; opt-in login only."}
1
+ {"id":"debian_first_boot","backend":"virtualbox","entry":"run.robot","python":"workflow.py","description":"English OCR guarded first login, su root and official Debian network mirror setup; opt-in login only."}
@@ -1,13 +1,13 @@
1
- *** Settings ***
2
- Library ${CURDIR}/workflow.py
3
-
4
- *** Variables ***
5
- ${VM_NAME} Debian-RPA
6
- ${LOGIN_REQUIRED} ${FALSE}
7
- ${SCRIPT_PATH} /opt/rpa-recorder-setup/configure-debian-mirrors.py
8
-
9
- *** Tasks ***
10
- Debian Login And Network Mirrors
11
- ${result}= Setup Debian Network ${VM_NAME} ${LOGIN_REQUIRED} ${SCRIPT_PATH}
12
- Log ${result}
13
- Should Be Equal ${result}[status] succeeded
1
+ *** Settings ***
2
+ Library ${CURDIR}/workflow.py
3
+
4
+ *** Variables ***
5
+ ${VM_NAME} Debian-RPA
6
+ ${LOGIN_REQUIRED} ${FALSE}
7
+ ${SCRIPT_PATH} /opt/rpa-recorder-setup/configure-debian-mirrors.py
8
+
9
+ *** Tasks ***
10
+ Debian Login And Network Mirrors
11
+ ${result}= Setup Debian Network ${VM_NAME} ${LOGIN_REQUIRED} ${SCRIPT_PATH}
12
+ Log ${result}
13
+ Should Be Equal ${result}[status] succeeded
@@ -1,75 +1,75 @@
1
- """OCR-guarded Debian first desktop login and mirror setup; no guest agent required."""
2
- import asyncio
3
- import json
4
- import os
5
- from pathlib import Path
6
- import re
7
- import sys
8
- import time
9
- sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
10
- sys.path.insert(0,str(Path(__file__).resolve().parents[4]))
11
- from client import request
12
-
13
-
14
- def _setup_debian_network(vm,login_required=False,script_path='/opt/rpa-recorder-setup/configure-debian-mirrors.py',timeout=180):
15
- from model_daemon import request as vision_request
16
- root=Path(__file__).resolve().parents[4]/'artifacts/debian-first-boot'
17
- root.mkdir(parents=True,exist_ok=True)
18
- count=0
19
- def call(tool,args):return asyncio.run(request(tool,args))
20
- def key(keys):call('vm_keyboard_scancode',{'vm':vm,'keys':keys})
21
- def write(text):call('vm_keyboard_type',{'vm':vm,'text':text,'chunkSize':10,'delayMs':100})
22
- def observe():
23
- nonlocal count
24
- count+=1;image=root/f'{count:02d}.png'
25
- asyncio.run(request('vm_screenshot',{'vm':vm},str(image)))
26
- data=vision_request('ocr',{'op':'predict','image':str(image),'languages':['en']})
27
- (root/f'{count:02d}.json').write_text(json.dumps(data,indent=2))
28
- return '\n'.join(line['text'] for line in data['lines'])
29
- password=os.environ.get('VAMP_GUEST_PASSWORD','password123!')
30
- if str(login_required).lower() in ('true','1','yes'):
31
- key('enter');time.sleep(2)
32
- visible=observe()
33
- if not re.search(r'password',visible,re.I):raise RuntimeError('Expected English password prompt; no password typed')
34
- write(password);key('enter');time.sleep(6)
35
- visible=''
36
- for launch_attempt in range(2):
37
- key('esc');key('esc');time.sleep(1)
38
- key('alt+f2');time.sleep(1);write('gnome-terminal');key('enter');time.sleep(3)
39
- key('esc');key('esc');time.sleep(1)
40
- visible=observe()
41
- if re.search(r'(@|\$|root)',visible):break
42
- else:raise RuntimeError('Terminal prompt not observed; refusing shell commands')
43
- if not re.search(r'root@',visible):
44
- write('su - root');key('enter');time.sleep(1)
45
- if not re.search(r'password',observe(),re.I):raise RuntimeError('Root password prompt missing')
46
- write(os.environ.get('VAMP_ROOT_PASSWORD',password));key('enter');time.sleep(2)
47
- if not re.search(r'root@',observe()):raise RuntimeError('Root shell not verified')
48
- if not script_path.startswith('/') or any(x in script_path for x in "'\n\r"):raise ValueError('Choose an absolute guest script path')
49
- mount_prefix=''
50
- if '/VAMP-Shared/' in script_path:
51
- directory=script_path.split('/VAMP-Shared/',1)[0]+'/VAMP-Shared'
52
- mount_prefix=f"mountpoint -q '{directory}' || (mkdir -p '{directory}' && mount -t vboxsf -o uid=$(id -u vboxuser),gid=$(id -g vboxuser) VAMPRecords '{directory}'); "
53
- write(f"clear; {mount_prefix}python3 '{script_path}' && apt-get update && printf '\\126\\101\\115\\120\\137\\101\\120\\124\\137\\117\\113\\n'");key('enter')
54
- deadline=time.monotonic()+int(timeout)
55
- while time.monotonic()<deadline:
56
- visible=observe()
57
- # A typed shell command itself is not success: require the output marker on its own OCR line.
58
- lines=[s.strip() for s in visible.splitlines()]
59
- if re.search(r'Permission denied|No such file|not found|Some index files failed',visible,re.I):
60
- raise RuntimeError('Mirror setup did not finish cleanly; inspect OCR evidence')
61
- if 'VAMP_APT_OK' in lines:
62
- result={'status':'succeeded','verification':'ocr_only','vm':vm,'details':str(root),'snapshots_created':False}
63
- (root/'result.json').write_text(json.dumps(result,indent=2));return result
64
- time.sleep(3)
65
- raise RuntimeError('APT verification timed out; inspect current terminal before rerunning')
66
-
67
-
68
- def setup_debian_network(vm,login_required=False,script_path='/opt/rpa-recorder-setup/configure-debian-mirrors.py',timeout=180):
69
- result_file=Path(__file__).resolve().parents[4]/'artifacts/debian-first-boot/result.json'
70
- result_file.parent.mkdir(parents=True,exist_ok=True)
71
- result_file.write_text(json.dumps({'status':'running','vm':vm}))
72
- try:return _setup_debian_network(vm,login_required,script_path,timeout)
73
- except Exception as exc:
74
- result_file.write_text(json.dumps({'status':'failed','vm':vm,'error':str(exc)}))
75
- raise
1
+ """OCR-guarded Debian first desktop login and mirror setup; no guest agent required."""
2
+ import asyncio
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+ import re
7
+ import sys
8
+ import time
9
+ sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
10
+ sys.path.insert(0,str(Path(__file__).resolve().parents[4]))
11
+ from client import request
12
+
13
+
14
+ def _setup_debian_network(vm,login_required=False,script_path='/opt/rpa-recorder-setup/configure-debian-mirrors.py',timeout=180):
15
+ from model_daemon import request as vision_request
16
+ root=Path(__file__).resolve().parents[4]/'artifacts/debian-first-boot'
17
+ root.mkdir(parents=True,exist_ok=True)
18
+ count=0
19
+ def call(tool,args):return asyncio.run(request(tool,args))
20
+ def key(keys):call('vm_keyboard_scancode',{'vm':vm,'keys':keys})
21
+ def write(text):call('vm_keyboard_type',{'vm':vm,'text':text,'chunkSize':10,'delayMs':100})
22
+ def observe():
23
+ nonlocal count
24
+ count+=1;image=root/f'{count:02d}.png'
25
+ asyncio.run(request('vm_screenshot',{'vm':vm},str(image)))
26
+ data=vision_request('ocr',{'op':'predict','image':str(image),'languages':['en']})
27
+ (root/f'{count:02d}.json').write_text(json.dumps(data,indent=2))
28
+ return '\n'.join(line['text'] for line in data['lines'])
29
+ password=os.environ.get('VAMP_GUEST_PASSWORD','password123!')
30
+ if str(login_required).lower() in ('true','1','yes'):
31
+ key('enter');time.sleep(2)
32
+ visible=observe()
33
+ if not re.search(r'password',visible,re.I):raise RuntimeError('Expected English password prompt; no password typed')
34
+ write(password);key('enter');time.sleep(6)
35
+ visible=''
36
+ for launch_attempt in range(2):
37
+ key('esc');key('esc');time.sleep(1)
38
+ key('alt+f2');time.sleep(1);write('gnome-terminal');key('enter');time.sleep(3)
39
+ key('esc');key('esc');time.sleep(1)
40
+ visible=observe()
41
+ if re.search(r'(@|\$|root)',visible):break
42
+ else:raise RuntimeError('Terminal prompt not observed; refusing shell commands')
43
+ if not re.search(r'root@',visible):
44
+ write('su - root');key('enter');time.sleep(1)
45
+ if not re.search(r'password',observe(),re.I):raise RuntimeError('Root password prompt missing')
46
+ write(os.environ.get('VAMP_ROOT_PASSWORD',password));key('enter');time.sleep(2)
47
+ if not re.search(r'root@',observe()):raise RuntimeError('Root shell not verified')
48
+ if not script_path.startswith('/') or any(x in script_path for x in "'\n\r"):raise ValueError('Choose an absolute guest script path')
49
+ mount_prefix=''
50
+ if '/VAMP-Shared/' in script_path:
51
+ directory=script_path.split('/VAMP-Shared/',1)[0]+'/VAMP-Shared'
52
+ mount_prefix=f"mountpoint -q '{directory}' || (mkdir -p '{directory}' && mount -t vboxsf -o uid=$(id -u vboxuser),gid=$(id -g vboxuser) VAMPRecords '{directory}'); "
53
+ write(f"clear; {mount_prefix}python3 '{script_path}' && apt-get update && printf '\\126\\101\\115\\120\\137\\101\\120\\124\\137\\117\\113\\n'");key('enter')
54
+ deadline=time.monotonic()+int(timeout)
55
+ while time.monotonic()<deadline:
56
+ visible=observe()
57
+ # A typed shell command itself is not success: require the output marker on its own OCR line.
58
+ lines=[s.strip() for s in visible.splitlines()]
59
+ if re.search(r'Permission denied|No such file|not found|Some index files failed',visible,re.I):
60
+ raise RuntimeError('Mirror setup did not finish cleanly; inspect OCR evidence')
61
+ if 'VAMP_APT_OK' in lines:
62
+ result={'status':'succeeded','verification':'ocr_only','vm':vm,'details':str(root),'snapshots_created':False}
63
+ (root/'result.json').write_text(json.dumps(result,indent=2));return result
64
+ time.sleep(3)
65
+ raise RuntimeError('APT verification timed out; inspect current terminal before rerunning')
66
+
67
+
68
+ def setup_debian_network(vm,login_required=False,script_path='/opt/rpa-recorder-setup/configure-debian-mirrors.py',timeout=180):
69
+ result_file=Path(__file__).resolve().parents[4]/'artifacts/debian-first-boot/result.json'
70
+ result_file.parent.mkdir(parents=True,exist_ok=True)
71
+ result_file.write_text(json.dumps({'status':'running','vm':vm}))
72
+ try:return _setup_debian_network(vm,login_required,script_path,timeout)
73
+ except Exception as exc:
74
+ result_file.write_text(json.dumps({'status':'failed','vm':vm,'error':str(exc)}))
75
+ raise
@@ -1,7 +1,7 @@
1
- {
2
- "id": "virtualbox_observe",
3
- "backend": "virtualbox",
4
- "entry": "run.robot",
5
- "python": "workflow.py",
6
- "description": "Capture an already-running VirtualBox VM; no application success claim."
7
- }
1
+ {
2
+ "id": "virtualbox_observe",
3
+ "backend": "virtualbox",
4
+ "entry": "run.robot",
5
+ "python": "workflow.py",
6
+ "description": "Capture an already-running VirtualBox VM; no application success claim."
7
+ }
@@ -1,13 +1,13 @@
1
- *** Settings ***
2
- Library ${CURDIR}/workflow.py
3
-
4
- *** Variables ***
5
- ${VM_NAME} ${EMPTY}
6
- ${SCREENSHOT} ${OUTPUT DIR}/virtualbox-screen.png
7
-
8
- *** Tasks ***
9
- Observe Existing VirtualBox VM
10
- Should Not Be Empty ${VM_NAME}
11
- ${result}= Observe Vm ${VM_NAME} ${SCREENSHOT}
12
- Log ${result}
13
- Should Be Equal ${result}[status] completed
1
+ *** Settings ***
2
+ Library ${CURDIR}/workflow.py
3
+
4
+ *** Variables ***
5
+ ${VM_NAME} ${EMPTY}
6
+ ${SCREENSHOT} ${OUTPUT DIR}/virtualbox-screen.png
7
+
8
+ *** Tasks ***
9
+ Observe Existing VirtualBox VM
10
+ Should Not Be Empty ${VM_NAME}
11
+ ${result}= Observe Vm ${VM_NAME} ${SCREENSHOT}
12
+ Log ${result}
13
+ Should Be Equal ${result}[status] completed
@@ -1,14 +1,14 @@
1
- """Separate VirtualBox Robot library, with no SPICE/GI imports."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
5
- from client import VirtualBox
6
-
7
- class Workflow(VirtualBox):
8
- pass
9
-
10
- # Robot imports a module path; expose the concrete class methods as keywords.
11
- _library = Workflow()
12
- observe_vm = _library.observe_vm
13
- start_vm = _library.start_vm
14
- call_vm_tool = _library.call_vm_tool
1
+ """Separate VirtualBox Robot library, with no SPICE/GI imports."""
2
+ import sys
3
+ from pathlib import Path
4
+ sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
5
+ from client import VirtualBox
6
+
7
+ class Workflow(VirtualBox):
8
+ pass
9
+
10
+ # Robot imports a module path; expose the concrete class methods as keywords.
11
+ _library = Workflow()
12
+ observe_vm = _library.observe_vm
13
+ start_vm = _library.start_vm
14
+ call_vm_tool = _library.call_vm_tool