print(""" 1. **Project Description** - Vision: Add a seamlessly integrated 'Vision' tab in the Magentic-UI to observe agents' visual interactions (screenshots or VNC) in real-time. - Integration: The frontend `ChatView` will be updated to include tabs (Chat / Vision). The Vision tab will subscribe to visual data via WebSocket or display a VNC iframe. - FastAPI Setup: - Use existing `/api/ws/runs/{run_id}` for streaming screenshot events, or add `/api/runs/{run_id}/vision` to get VNC connection details. 2. **Tasks and Tests** - Task 1 (Backend): Expose VNC/Vision info endpoint. - Modify `src/magentic_ui/backend/web/routes/runs.py` using `replace_with_git_merge_diff` to add a `GET /runs/{run_id}/vision` endpoint returning VNC URL or stream status. - Test: Add a unit test in `tests/` checking if the endpoint returns valid connection info. - Task 2 (Backend WS): Broadcast screenshots. - Update WebSocketManager in `src/magentic_ui/backend/web/managers/connection.py` using `replace_with_git_merge_diff` to relay `screenshot` type messages from agents like `FaraWebSurfer`. - Test: Unit test the WebSocketManager to ensure `screenshot` messages are broadcasted properly. - Task 3 (Frontend): Implement Tabs in Chat UI. - Update `frontend/src/components/views/chat/chat.tsx` using `replace_with_git_merge_diff` to wrap the chat interface in an Ant Design `` component (Chat vs Vision). - Test: Write a Playwright test ensuring the Tabs render and clicking 'Vision' switches the view. - Task 4 (Frontend): Implement Vision Component. - Create `frontend/src/components/views/chat/vision.tsx` using `write_file` to render an `