1- # TUI Daemon Adapter Draft
1+ # TUI Daemon Adapter Spike
22
33## Goal
44
5- Add a flag-gated TUI transport that talks to ` qwen serve ` through
6- ` DaemonSessionClient ` instead of creating an in-process ` Config ` + agent
7- runtime.
5+ Document the default-off ` DaemonTuiAdapter ` spike that was added while
6+ evaluating Mode B client integration.
87
9- This is a dogfood path for Mode B client migration. It must not replace the
10- default TUI path until output sinks, typed daemon events, session-scoped
11- permission, and lifecycle diagnostics are stable.
8+ As of the 2026-05-19 architecture decision, native local TUI is not planned to
9+ default-migrate to daemon HTTP/SSE. The normal ` qwen ` terminal path remains a
10+ long-term direct runtime / streamJson / Ink path because it avoids an extra
11+ localhost HTTP server hop and keeps the local UX simpler and more reliable.
1212
13- ## Proposed Entry Point
13+ The useful follow-up from this spike is source-adapter / reducer / terminal
14+ render-core extraction so native TUI and web terminal can share view-model and
15+ rendering logic without forcing native TUI through daemon transport.
16+
17+ ## Historical Experimental Entry Point
1418
1519``` bash
1620QWEN_DAEMON_URL=http://127.0.0.1:4170 qwen --experimental-daemon-tui
@@ -39,7 +43,7 @@ The CLI should refuse this mode unless both are true:
39437 . Route model switch through ` session.setModel() ` .
40448 . Route permission votes through ` session.respondToPermission() ` .
4145
42- ## Rendering Contract
46+ ## Rendering Contract Reference
4347
4448The first implementation adds ` DaemonTuiAdapter ` , a locally verifiable reducer
4549and transport spike. It maps only these daemon events:
@@ -54,15 +58,16 @@ and transport spike. It maps only these daemon events:
5458| ` model_switched ` | Update footer/model display |
5559| ` session_died ` | Show disconnected state and stop streaming |
5660
57- Unknown events must be ignored, not fatal. Typed event reducers will land in a
58- later protocol PR .
61+ Unknown events must be ignored, not fatal. Typed event reducers should stay in
62+ the daemon client/ protocol layer, not in server internals .
5963
60- The adapter is not wired into the default Ink app yet . Existing interactive TUI,
64+ The adapter is not wired into the default Ink app. Existing interactive TUI,
6165JSONL, stream-json, and dual-output behavior remains unchanged.
6266
6367## Explicit Non-Goals
6468
6569- Do not remove the current TUI in-process runtime.
70+ - Do not make daemon transport the default native TUI path.
6671- Do not change JSONL, stream-json, or dual-output behavior in this PR.
6772- Do not expose file CRUD, MCP management, memory CRUD, or provider/auth
6873 mutation through TUI yet.
@@ -87,10 +92,11 @@ JSONL, stream-json, and dual-output behavior remains unchanged.
8792 - permission request can be accepted or rejected
8893 - reconnect sends the tracked ` Last-Event-ID `
8994
90- ## Blockers Before Default Migration
95+ ## Current Follow-Up Direction
9196
92- - Typed daemon event schema.
93- - Session-scoped permission route.
94- - Output sink refactor for JSONL / stream-json / dual-output parity.
95- - Session lifecycle close/delete semantics.
96- - Runtime diagnostics for MCP, skills, providers, and workspace env.
97+ - Keep native TUI direct by default.
98+ - Extract source adapters and a shared terminal render core that can be reused
99+ by native TUI and web terminal.
100+ - Prioritize web terminal as the daemon-native terminal surface.
101+ - Treat this spike as future-migration reference, not an active default
102+ migration checklist.
0 commit comments