@beeos-ai/cli 1.0.4 → 1.0.6

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.
package/README.md CHANGED
@@ -19,7 +19,9 @@ Pure JavaScript — runs on any platform with Node.js 18+. No native compilation
19
19
  ### Device agent (Android)
20
20
 
21
21
  ```bash
22
- # Attach a USB-connected Android device as an AI agent
22
+ # Attach a USB-connected Android device as an AI agent (launches
23
+ # device-agent + scrcpy-bridge in parallel — the latter powers WebRTC
24
+ # video / control)
23
25
  beeos device attach
24
26
 
25
27
  # Attach a specific device
@@ -28,10 +30,14 @@ beeos device attach --serial SERIAL_NUMBER
28
30
  # Attach all connected devices
29
31
  beeos device attach --all
30
32
 
31
- # List attached devices
33
+ # Skip the scrcpy-bridge sidecar; run only device-agent (useful for
34
+ # iterating on ACP / Python code without the video stream)
35
+ beeos device attach --no-video
36
+
37
+ # List attached devices (shows both device-agent and scrcpy-bridge PIDs)
32
38
  beeos device list --local
33
39
 
34
- # Detach a device
40
+ # Detach a device (stops device-agent AND scrcpy-bridge)
35
41
  beeos device detach --serial SERIAL_NUMBER
36
42
 
37
43
  # Send a command to a device
@@ -41,6 +47,35 @@ beeos device exec "open Chrome"
41
47
  beeos device upgrade
42
48
  ```
43
49
 
50
+ #### What `attach` does
51
+
52
+ Under the hood `beeos device attach` orchestrates two sibling processes
53
+ for each device:
54
+
55
+ 1. **device-agent** (Python, ACP over WebSocket) — AI chat, tool
56
+ execution, file operations. Binds the phone to your BeeOS account
57
+ and writes identity to `~/.beeos/identity/device-<serial>.key.json`.
58
+ 2. **scrcpy-bridge** (Rust, WebRTC) — mirrors screen + audio and
59
+ forwards touch / key input. Shares the **same** `.key.json` identity
60
+ file (both `BRIDGE_PRIVATE_KEY_FILE` and `BRIDGE_PUBLIC_KEY_FILE`
61
+ are set to it) and authenticates to EMQX via Agent Gateway's
62
+ `/api/v1/device/bootstrap` endpoint — no static MQTT tokens.
63
+
64
+ Both processes are tracked in `~/.beeos/devices.json`; `detach` and
65
+ `list` operate on the pair atomically. If the scrcpy-bridge binary
66
+ isn't yet installed on your machine, it is downloaded on first attach
67
+ from GitHub Releases into `~/.beeos/bin/` (set
68
+ `$BEEOS_SCRCPY_BRIDGE_BIN` to point at a pre-built binary to skip the
69
+ download, or `$BEEOS_SCRCPY_BRIDGE_RELEASE_URL` for an internal
70
+ mirror).
71
+
72
+ When running against a local dev control plane (e.g. `api_url =
73
+ http://localhost:9080`), the CLI automatically points scrcpy-bridge at
74
+ `http://localhost:8083` unless `platform.agent_gateway_url` is
75
+ explicitly set to something non-default. Set
76
+ `BEEOS_AGENT_GATEWAY_URL` to override for one-off experiments without
77
+ touching `config.toml`.
78
+
44
79
  ### OpenClaw agent (local AI assistant)
45
80
 
46
81
  ```bash
@@ -62,6 +97,10 @@ beeos update openclaw
62
97
  - **Node.js 18+**
63
98
  - **Android devices**: `adb` (Android Debug Bridge) must be in your PATH
64
99
  - **device-agent**: Python 3.11+ or [uv](https://astral.sh/uv) (auto-installed on first use)
100
+ - **scrcpy-bridge** (video streaming): auto-downloaded from GitHub
101
+ Releases on first `device attach`. Supported targets: darwin
102
+ arm64/x64, linux arm64/x64, windows x64. On unsupported platforms
103
+ attach still succeeds — only video is skipped.
65
104
 
66
105
  ## Configuration
67
106
 
@@ -70,6 +109,7 @@ Config is stored at `~/.beeos/config.toml`:
70
109
  ```toml
71
110
  [platform]
72
111
  api_url = "https://api.beeos.ai"
112
+ agent_gateway_url = "https://agent-gw.beeos.ai"
73
113
  bridge_url = "wss://bridge-sg.beeos.ai"
74
114
  dashboard_base_url = "https://beeos.ai"
75
115
 
@@ -77,3 +117,34 @@ dashboard_base_url = "https://beeos.ai"
77
117
  http_enabled = true
78
118
  http_port = 9090
79
119
  ```
120
+
121
+ `agent_gateway_url` is consumed by the scrcpy-bridge sidecar for
122
+ bootstrap (Ed25519-signed `/api/v1/device/bootstrap` calls). Set it
123
+ alongside `api_url` when pointing at a non-default control plane.
124
+
125
+ ## Troubleshooting
126
+
127
+ ### Video stays black / "Reconnecting..." in the viewer
128
+
129
+ scrcpy-bridge uses `str0m` for WebRTC, which cannot parse Chrome's
130
+ mDNS-hidden ICE candidates (`xxx.local`). In most cases the bridge
131
+ recovers automatically via peer-reflexive candidate learning from the
132
+ browser's outgoing STUN binding, so you should still see video.
133
+
134
+ If the browser is in a network where outbound UDP to the bridge's
135
+ advertised LAN IPs is blocked, the peer-reflexive fallback won't fire
136
+ and the viewer will keep reconnecting. Two common workarounds while
137
+ debugging locally:
138
+
139
+ 1. Disable Chrome's mDNS hiding for the dev session:
140
+ open `chrome://flags/#enable-webrtc-hide-local-ips-with-mdns`,
141
+ set it to **Disabled**, and restart Chrome. Chrome will then
142
+ advertise real LAN IPs directly.
143
+ 2. Make sure a reachable TURN server is configured on the Runtime
144
+ (`TURN_URLS`, `TURN_USERNAME`, `TURN_CREDENTIAL`). The viewer's
145
+ `iceServers` are sourced from the `stream-url` API and drive the
146
+ browser's srflx/relay candidate gathering.
147
+
148
+ In production, we rely on the TURN relay path; the mDNS issue is
149
+ only a concern when running Chrome + scrcpy-bridge on the same host
150
+ behind restrictive local firewalls.