Fix agent crash on missing DISPLAY and relay disconnect error
- Auto-detect DISPLAY on Linux by scanning /tmp/.X11-unix/ sockets, falling back to 'w' output, then :0 — runs before mss/pynput import - ScreenCapture no longer raises on init failure; agent stays connected and notifies the viewer with an error message if capture unavailable - stream_frames skips None frames instead of crashing the WebSocket - Relay: check for websocket.disconnect message type to avoid 'Cannot call receive once a disconnect message has been received' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,10 @@ async def agent_endpoint(
|
||||
while True:
|
||||
msg = await websocket.receive()
|
||||
|
||||
# Client sent a close frame — exit cleanly
|
||||
if msg.get("type") == "websocket.disconnect":
|
||||
break
|
||||
|
||||
if "bytes" in msg and msg["bytes"]:
|
||||
# Binary = JPEG frame → forward to all viewers watching this machine
|
||||
frame_data = msg["bytes"]
|
||||
|
||||
Reference in New Issue
Block a user