Ship trust-first CLI and runtime defaults
This commit is contained in:
parent
fb718af154
commit
5d63e4c16e
26 changed files with 894 additions and 134 deletions
|
|
@ -7,7 +7,14 @@ from typing import Any
|
|||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from pyro_mcp.vm_manager import VmManager
|
||||
from pyro_mcp.vm_manager import (
|
||||
DEFAULT_ALLOW_HOST_COMPAT,
|
||||
DEFAULT_MEM_MIB,
|
||||
DEFAULT_TIMEOUT_SECONDS,
|
||||
DEFAULT_TTL_SECONDS,
|
||||
DEFAULT_VCPU_COUNT,
|
||||
VmManager,
|
||||
)
|
||||
|
||||
|
||||
class Pyro:
|
||||
|
|
@ -49,10 +56,11 @@ class Pyro:
|
|||
self,
|
||||
*,
|
||||
environment: str,
|
||||
vcpu_count: int,
|
||||
mem_mib: int,
|
||||
ttl_seconds: int = 600,
|
||||
vcpu_count: int = DEFAULT_VCPU_COUNT,
|
||||
mem_mib: int = DEFAULT_MEM_MIB,
|
||||
ttl_seconds: int = DEFAULT_TTL_SECONDS,
|
||||
network: bool = False,
|
||||
allow_host_compat: bool = DEFAULT_ALLOW_HOST_COMPAT,
|
||||
) -> dict[str, Any]:
|
||||
return self._manager.create_vm(
|
||||
environment=environment,
|
||||
|
|
@ -60,6 +68,7 @@ class Pyro:
|
|||
mem_mib=mem_mib,
|
||||
ttl_seconds=ttl_seconds,
|
||||
network=network,
|
||||
allow_host_compat=allow_host_compat,
|
||||
)
|
||||
|
||||
def start_vm(self, vm_id: str) -> dict[str, Any]:
|
||||
|
|
@ -88,11 +97,12 @@ class Pyro:
|
|||
*,
|
||||
environment: str,
|
||||
command: str,
|
||||
vcpu_count: int,
|
||||
mem_mib: int,
|
||||
timeout_seconds: int = 30,
|
||||
ttl_seconds: int = 600,
|
||||
vcpu_count: int = DEFAULT_VCPU_COUNT,
|
||||
mem_mib: int = DEFAULT_MEM_MIB,
|
||||
timeout_seconds: int = DEFAULT_TIMEOUT_SECONDS,
|
||||
ttl_seconds: int = DEFAULT_TTL_SECONDS,
|
||||
network: bool = False,
|
||||
allow_host_compat: bool = DEFAULT_ALLOW_HOST_COMPAT,
|
||||
) -> dict[str, Any]:
|
||||
return self._manager.run_vm(
|
||||
environment=environment,
|
||||
|
|
@ -102,6 +112,7 @@ class Pyro:
|
|||
timeout_seconds=timeout_seconds,
|
||||
ttl_seconds=ttl_seconds,
|
||||
network=network,
|
||||
allow_host_compat=allow_host_compat,
|
||||
)
|
||||
|
||||
def create_server(self) -> FastMCP:
|
||||
|
|
@ -111,11 +122,12 @@ class Pyro:
|
|||
async def vm_run(
|
||||
environment: str,
|
||||
command: str,
|
||||
vcpu_count: int,
|
||||
mem_mib: int,
|
||||
timeout_seconds: int = 30,
|
||||
ttl_seconds: int = 600,
|
||||
vcpu_count: int = DEFAULT_VCPU_COUNT,
|
||||
mem_mib: int = DEFAULT_MEM_MIB,
|
||||
timeout_seconds: int = DEFAULT_TIMEOUT_SECONDS,
|
||||
ttl_seconds: int = DEFAULT_TTL_SECONDS,
|
||||
network: bool = False,
|
||||
allow_host_compat: bool = DEFAULT_ALLOW_HOST_COMPAT,
|
||||
) -> dict[str, Any]:
|
||||
"""Create, start, execute, and clean up an ephemeral VM."""
|
||||
return self.run_in_vm(
|
||||
|
|
@ -126,6 +138,7 @@ class Pyro:
|
|||
timeout_seconds=timeout_seconds,
|
||||
ttl_seconds=ttl_seconds,
|
||||
network=network,
|
||||
allow_host_compat=allow_host_compat,
|
||||
)
|
||||
|
||||
@server.tool()
|
||||
|
|
@ -136,10 +149,11 @@ class Pyro:
|
|||
@server.tool()
|
||||
async def vm_create(
|
||||
environment: str,
|
||||
vcpu_count: int,
|
||||
mem_mib: int,
|
||||
ttl_seconds: int = 600,
|
||||
vcpu_count: int = DEFAULT_VCPU_COUNT,
|
||||
mem_mib: int = DEFAULT_MEM_MIB,
|
||||
ttl_seconds: int = DEFAULT_TTL_SECONDS,
|
||||
network: bool = False,
|
||||
allow_host_compat: bool = DEFAULT_ALLOW_HOST_COMPAT,
|
||||
) -> dict[str, Any]:
|
||||
"""Create an ephemeral VM record with environment and resource sizing."""
|
||||
return self.create_vm(
|
||||
|
|
@ -148,6 +162,7 @@ class Pyro:
|
|||
mem_mib=mem_mib,
|
||||
ttl_seconds=ttl_seconds,
|
||||
network=network,
|
||||
allow_host_compat=allow_host_compat,
|
||||
)
|
||||
|
||||
@server.tool()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue