# Cockpit and Virtual Desktop Plan

V3 starts with CLI because the CLI owns the truth: run IDs, event stream,
approval gates, and deterministic sentinel wakeups.

Cockpit should not duplicate this logic. It should project it.

## HTML5/PWA Contract

Cockpit is an HTML5/PWA workbench. app.99pages.uk uses the same product language
for remote control. Native GUI shells are avoided unless a platform requires a
thin launcher.

Browser Terminal is not a full bash-editing IDE. It is a communication and
projection tool for Core CLI:

- Send slash commands and natural-language tasks to Core CLI.
- Display CLI/TUI state, run events, approvals, and result panels.
- Show command output and logs as evidence.
- Keep mutating shell actions behind approval and MCP policies.

Core CLI and SubCLI still execute on the host shell, with PowerShell preferred
on Windows and shell adapters on Linux/macOS.

## Cockpit Modules

### Runs

- Subscribe to run event stream.
- Show current run state.
- Open run detail panel.
- Show every tool call, observation, approval, artifact, and result.

### Virtual Desktop

Virtual Desktop is not a generic remote desktop clone. It is an agent workbench.

- Browser Terminal.
- Controlled Core CLI surface.
- Browser Use.
- Computer Use.
- Screenshot on demand.
- Approval gate before mutating actions.
- Event replay for every action.

### Sentinel

- Show local checks.
- Show last tick.
- Show matched conditions.
- Allow deterministic rules to be edited without changing model prompts.

## Event Projection Contract

All frontends consume the same events:

```text
CLI watch
Telegram progress
Cockpit Runs panel
app.99pages.uk remote control
```

No frontend should invent progress. If there is no event, the agent has not reported it.

## V3 Implementation Order

1. Finish CLI run/event stream.
2. Wire ReAct loop worker.
3. Wire approval gate.
4. Wire local shell and MCP tools.
5. Add HTML5/PWA Cockpit bridge.
6. Add Browser Terminal as Core CLI projection.
7. Add Virtual Desktop adapter.
8. Project into Cockpit and app.99pages.uk.
