Add runtime capability scaffolding and align docs

This commit is contained in:
Thales Maciel 2026-03-05 22:57:09 -03:00
parent fb8b985049
commit cbf212bb7b
19 changed files with 1048 additions and 71 deletions

View file

@ -7,6 +7,18 @@ from typing import Any
from pyro_mcp.vm_manager import VmManager
INTERNET_PROBE_COMMAND = (
'python3 -c "import urllib.request; '
"print(urllib.request.urlopen('https://example.com', timeout=10).status)"
'"'
)
def _demo_command(status: dict[str, Any]) -> str:
if bool(status.get("network_enabled")) and status.get("execution_mode") == "guest_vsock":
return INTERNET_PROBE_COMMAND
return "git --version"
def run_demo() -> dict[str, Any]:
"""Create/start/exec/delete a VM and return command output."""
@ -14,7 +26,8 @@ def run_demo() -> dict[str, Any]:
created = manager.create_vm(profile="debian-git", vcpu_count=1, mem_mib=512, ttl_seconds=600)
vm_id = str(created["vm_id"])
manager.start_vm(vm_id)
executed = manager.exec_vm(vm_id, command="git --version", timeout_seconds=30)
status = manager.status_vm(vm_id)
executed = manager.exec_vm(vm_id, command=_demo_command(status), timeout_seconds=30)
return executed