# Three-surface sync

Web, TUI and CLI connect to one worker, so a turn started on one surface streams to the others.

|  | Backend | Web | TUI and CLI |
| --- | --- | --- | --- |
| Source of truth | One worker (`operations/worker/lock.py`) and one session store (`runtime/context/session_db.py`) | Same | Same |
| Events | `EventBus` and `_broadcast`: one emission reaches every WebSocket client | Receives | Receives |
| Running state | `_running_tasks`; `running_task` and `running_task_clear` broadcasts | Sidebar indicator, composer state | Status |
| Reconnect | Session load resends history and calls `_send_running_task_state`; `subscribe_execution_stream` serves a snapshot of `execution_stream.v1` | Restores | Restores |
| Attended mode | WebSocket `set_attended`, broadcast `attended_changed`. Per session over a process default of unattended (`runtime/permissions/attended.py`). | Toggle (`use-unattended-mode.ts`) | `/attended [on\|off]`, `/unattended` |
| Steering | `execution.steer`, applied at the next safe point. Message up to 4096 characters. | Input while running (`lib/chat/send/steer-message.ts`) | `/steer <instruction>`; `openprogram execution steer --message` |

## Implementation status

All rows are implemented.

[Controllability and three-surface sync](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/execution/controllability-and-three-surface-sync.html)
