vegas-ws-api

A WebSocket API on littlebear-vegas that replicates SSH command execution. Built for environments where SSH is blocked or fragile (e.g. behind an egress proxy) but HTTPS (port 443) is allowed.

Quick start

curl -sSL https://ws.api.littlebearz.com/install.sh | bash
# then:
vegas "uptime"

The installer downloads the vegas-ws client, prompts for your API key, and verifies the connection.

How it works

Client ──wss://ws.api.littlebearz.com:443──> nginx (vegas)
                                                    │ proxy_pass + Upgrade headers
                                                    ▼
                                              ws://127.0.0.1:8223
                                              (ws_api_server.py, pure Python stdlib)

Commands run as the littlebear user via /bin/bash -c. There is no PTY, no file transfer, and no port forwarding — command execution only.

For AI agents

This API is designed to be driven by AI agents as an SSH alternative. Two integration paths:

Option A — use the client (recommended)

Install once, then run commands exactly like SSH:

vegas "df -h /"
echo "systemctl status nginx" | vegas
vegas --timeout 120 "apt list --upgradable"

The vegas wrapper tries the WebSocket API first and falls back to ssh littlebear-vegas only on transport failure (exit 255). A non-zero exit from the remote command itself is passed through unchanged.

Environment overrides: VEGAS_WS_URL, VEGAS_WS_KEY, VEGAS_WS_KEY_FILE, VEGAS_WS_CA, VEGAS_WS_INSECURE=1, plus standard HTTPS_PROXY.

Option B — speak the protocol directly

JSON messages over WebSocket (RFC 6455). Any language with a WebSocket client works:

C -> S:  {"auth": "<api_key>"}
S -> C:  {"ok": true}  |  {"error": "auth failed"}   (then closed)

C -> S:  {"cmd": "<shell command>", "timeout": 60}
S -> C:  {"stdout": "...", "stderr": "...", "exit": 0}
Security: the API key grants arbitrary shell-command execution as the vegas service user. Treat it like an SSH private key: mode 600, never commit it, never log it. The key lives at ~/.ws_api_key on the server and ~/.ws_api_key_vegas on clients.

Files