docs/developers/daemon-client-adapters/tui.md
Add a flag-gated TUI transport that talks to qwen serve through
DaemonSessionClient instead of creating an in-process Config + agent
runtime.
This is a dogfood path for Mode B client migration. It must not replace the default TUI path until output sinks, typed daemon events, session-scoped permission, and lifecycle diagnostics are stable.
QWEN_DAEMON_URL=http://127.0.0.1:4170 qwen --experimental-daemon-tui
Optional:
QWEN_DAEMON_TOKEN=... QWEN_DAEMON_WORKSPACE=/repo qwen --experimental-daemon-tui
The CLI should refuse this mode unless both are true:
QWEN_DAEMON_URL or --daemon-url is set.GET /capabilities advertises session_create, session_prompt, and
session_events.DaemonClient with daemon URL and token./capabilities.DaemonSessionClient.createOrAttach().session.events().session.prompt().session.cancel().session.setModel().session.respondToPermission().The first implementation adds DaemonTuiAdapter, a locally verifiable reducer
and transport spike. It maps only these daemon events:
| Daemon event | TUI handling |
|---|---|
session_update / agent_message_chunk | Append assistant text |
session_update / agent_thought_chunk | Append thinking text |
session_update / tool_call | Show tool call lifecycle |
permission_request | Show existing confirmation UI where possible |
permission_resolved | Close or update confirmation UI |
model_switched | Update footer/model display |
session_died | Show disconnected state and stop streaming |
Unknown events must be ignored, not fatal. Typed event reducers will land in a later protocol PR.
The adapter is not wired into the default Ink app yet. Existing interactive TUI, JSONL, stream-json, and dual-output behavior remains unchanged.
qwen serve.qwen serve:
Last-Event-ID