mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
cli: drop 'hanzo install runtime'
hanzoai/runtime is archived. The subcommand set up a checkout at
~/work/hanzo/runtime and installed the hanzo-runtime / @hanzo/runtime
SDKs — a source tree that no longer exists and packages that were never
really released (npm only ever had 0.0.0-dev; PyPI's last release was
2025-07-15).
Verified: hanzo.commands.install imports clean and install_group now
exposes 13 subcommands with 'runtime' absent.
(cherry picked from commit 16d31994dd)
Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -1325,192 +1325,6 @@ def install_nanobrowser(build: bool, dev: bool, open_browser: bool):
|
||||
console.print(" hanzo install nanobrowser --open")
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Runtime - Sandboxed Agent Execution Environment
|
||||
# ============================================================================
|
||||
|
||||
RUNTIME_PATH = Path.home() / "work" / "hanzo" / "runtime"
|
||||
|
||||
|
||||
@install_group.command(name="runtime")
|
||||
@click.option("--setup", "-s", is_flag=True, help="Set up the runtime environment")
|
||||
@click.option(
|
||||
"--sdk", type=click.Choice(["python", "typescript", "both"]), help="Install SDK"
|
||||
)
|
||||
@click.option(
|
||||
"--computer-use", is_flag=True, help="Set up VNC desktop for computer use"
|
||||
)
|
||||
def install_runtime(setup: bool, sdk: str, computer_use: bool):
|
||||
"""Configure Hanzo Runtime - sandboxed agent execution.
|
||||
|
||||
\b
|
||||
The Hanzo Runtime provides:
|
||||
- Sub-90ms sandbox creation
|
||||
- Isolated code execution for AI-generated code
|
||||
- Computer Use (VNC desktop control)
|
||||
- File, Git, LSP, and Execute APIs
|
||||
- OCI/Docker compatibility
|
||||
|
||||
\b
|
||||
Examples:
|
||||
hanzo install runtime # Check status
|
||||
hanzo install runtime --setup # Initialize runtime
|
||||
hanzo install runtime --sdk python # Install Python SDK
|
||||
hanzo install runtime --computer-use # Set up desktop control
|
||||
|
||||
\b
|
||||
SDKs:
|
||||
pip install hanzo-runtime # Python
|
||||
npm install @hanzo/runtime # TypeScript
|
||||
"""
|
||||
runtime_dir = RUNTIME_PATH
|
||||
|
||||
if sdk:
|
||||
console.print(f"[cyan]Installing Runtime SDK ({sdk})...[/cyan]")
|
||||
|
||||
if sdk in ("python", "both"):
|
||||
if shutil.which("uv"):
|
||||
subprocess.run(["uv", "pip", "install", "hanzo-runtime"], check=True)
|
||||
else:
|
||||
subprocess.run(
|
||||
[sys.executable, "-m", "pip", "install", "hanzo-runtime"],
|
||||
check=True,
|
||||
)
|
||||
console.print("[green]✓[/green] Python SDK installed")
|
||||
|
||||
if sdk in ("typescript", "both"):
|
||||
subprocess.run(["npm", "install", "-g", "@hanzo/runtime"], check=True)
|
||||
console.print("[green]✓[/green] TypeScript SDK installed")
|
||||
|
||||
return
|
||||
|
||||
if computer_use:
|
||||
console.print("[cyan]Setting up Computer Use environment...[/cyan]")
|
||||
console.print()
|
||||
|
||||
# Check Docker
|
||||
if not shutil.which("docker"):
|
||||
console.print("[red]Docker is required for Computer Use[/red]")
|
||||
console.print("Install: https://docs.docker.com/get-docker/")
|
||||
return
|
||||
|
||||
# Show Dockerfile info
|
||||
dockerfile_path = runtime_dir / "hack" / "computer-use" / "Dockerfile"
|
||||
if dockerfile_path.exists():
|
||||
console.print("[green]✓[/green] Computer Use Dockerfile found")
|
||||
console.print(f" Path: {dockerfile_path}")
|
||||
else:
|
||||
console.print("[yellow]![/yellow] Dockerfile not found")
|
||||
|
||||
console.print()
|
||||
console.print("[cyan]Computer Use provides:[/cyan]")
|
||||
console.print(" - Xvfb (virtual display)")
|
||||
console.print(" - XFCE4 desktop environment")
|
||||
console.print(" - x11vnc (VNC server on port 5901)")
|
||||
console.print(" - noVNC (web access on port 6901)")
|
||||
console.print(" - xdotool, xautomation (mouse/keyboard)")
|
||||
console.print(" - Chromium browser")
|
||||
console.print()
|
||||
console.print("[cyan]Build and run:[/cyan]")
|
||||
console.print(f" cd {runtime_dir / 'hack' / 'computer-use'}")
|
||||
console.print(" docker build -t hanzo-computer-use .")
|
||||
console.print(" docker run -p 5901:5901 -p 6901:6901 hanzo-computer-use")
|
||||
console.print()
|
||||
console.print("Then access: http://localhost:6901 (noVNC web client)")
|
||||
return
|
||||
|
||||
if setup:
|
||||
console.print("[cyan]Setting up Hanzo Runtime...[/cyan]")
|
||||
|
||||
if not runtime_dir.exists():
|
||||
console.print(f"[red]Runtime not found at: {runtime_dir}[/red]")
|
||||
return
|
||||
|
||||
# Build Go binaries
|
||||
console.print(" Building CLI...")
|
||||
cli_dir = runtime_dir / "apps" / "cli"
|
||||
if cli_dir.exists():
|
||||
result = subprocess.run(
|
||||
[
|
||||
"go",
|
||||
"build",
|
||||
"-o",
|
||||
str(Path.home() / ".hanzo" / "bin" / "hanzo-runtime"),
|
||||
".",
|
||||
],
|
||||
cwd=str(cli_dir),
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
console.print("[green]✓[/green] CLI built")
|
||||
else:
|
||||
console.print(f"[yellow]![/yellow] CLI build failed: {result.stderr}")
|
||||
|
||||
return
|
||||
|
||||
# Status check
|
||||
console.print("[bold]Hanzo Runtime Status[/bold]")
|
||||
|
||||
if runtime_dir.exists():
|
||||
console.print(f" [green]✓[/green] Source: {runtime_dir}")
|
||||
|
||||
# Check components
|
||||
components = {
|
||||
"CLI": runtime_dir / "apps" / "cli",
|
||||
"Daemon": runtime_dir / "apps" / "daemon",
|
||||
"Runner": runtime_dir / "apps" / "runner",
|
||||
"Python SDK": runtime_dir / "libs" / "sdk-python",
|
||||
"TypeScript SDK": runtime_dir / "libs" / "sdk-typescript",
|
||||
"Computer Use": runtime_dir / "libs" / "computer-use",
|
||||
}
|
||||
|
||||
console.print()
|
||||
console.print("[cyan]Components:[/cyan]")
|
||||
for name, path in components.items():
|
||||
status = "[green]✓[/green]" if path.exists() else "[dim]○[/dim]"
|
||||
console.print(f" {status} {name}")
|
||||
|
||||
# Check SDKs installed
|
||||
console.print()
|
||||
console.print("[cyan]Installed SDKs:[/cyan]")
|
||||
|
||||
# Python SDK
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-c",
|
||||
"import hanzo_runtime; print(hanzo_runtime.__version__)",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
console.print(f" [green]✓[/green] Python: {result.stdout.strip()}")
|
||||
else:
|
||||
console.print(" [dim]○[/dim] Python: not installed")
|
||||
except Exception:
|
||||
console.print(" [dim]○[/dim] Python: not installed")
|
||||
|
||||
# TypeScript SDK
|
||||
result = subprocess.run(
|
||||
["npm", "list", "-g", "@hanzo/runtime"], capture_output=True, text=True
|
||||
)
|
||||
if "@hanzo/runtime" in result.stdout:
|
||||
console.print(f" [green]✓[/green] TypeScript: installed")
|
||||
else:
|
||||
console.print(" [dim]○[/dim] TypeScript: not installed")
|
||||
|
||||
else:
|
||||
console.print(f" [red]○[/red] Not found: {runtime_dir}")
|
||||
|
||||
console.print()
|
||||
console.print("[dim]Install SDKs:[/dim]")
|
||||
console.print(" pip install hanzo-runtime")
|
||||
console.print(" npm install @hanzo/runtime")
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Cas Infrastructure (Hanzo IAM / Hanzo Cloud)
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user