Skip to content

Commit 5cd64d5

Browse files
author
秦奇
committed
docs(daemon): align adapter spikes with web-first roadmap
1 parent 33b2e0d commit 5cd64d5

3 files changed

Lines changed: 65 additions & 48 deletions

File tree

docs/developers/daemon-client-adapters/channel-web.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
# Channel And Web Backend Daemon Adapter Draft
1+
# Channel And Web Backend Daemon Adapter Spike
22

33
## Goal
44

5-
Let channel adapters and web chat backends consume `qwen serve` through
6-
`DaemonSessionClient` while keeping existing channel ACP subprocess behavior as
7-
the default.
5+
Document the default-off `DaemonChannelBridge` spike for server-side channel
6+
and web backends.
7+
8+
As of the 2026-05-19 architecture decision, web chat / web terminal are the
9+
first daemon-native client targets. Channel adapters should continue to use the
10+
existing ACP subprocess behavior by default; daemon channel integration remains
11+
future / behind-flag evaluation.
812

913
This draft covers server-side clients only:
1014

@@ -16,13 +20,13 @@ The daemon currently rejects browser `Origin` requests by design.
1620

1721
## Proposed Entry Points
1822

19-
Channel backend:
23+
Historical channel backend experiment:
2024

2125
```bash
2226
QWEN_CHANNEL_DAEMON_URL=http://127.0.0.1:4170 qwen channel start telegram
2327
```
2428

25-
Web backend:
29+
Web backend / BFF target:
2630

2731
```bash
2832
QWEN_WEB_DAEMON_URL=http://127.0.0.1:4170 qwen web-chat-backend
@@ -46,7 +50,9 @@ default and owns daemon session state inside the backend process.
4650
3. Submit inbound user text with `session.prompt()`.
4751
4. Subscribe to `session.events()` and collect assistant text chunks.
4852
5. Send final text back through the platform adapter.
49-
6. Cast permission votes through `session.respondToPermission()`.
53+
6. Cast permission votes through `session.respondToSessionPermission()` when
54+
`caps.features.session_permission_vote` is advertised; use the legacy
55+
request-id route only for explicitly single-user or older-daemon fallback.
5056
7. Cancel active work through `session.cancel()`.
5157

5258
## Minimal Web Backend Flow
@@ -61,9 +67,9 @@ Browser clients must not receive daemon bearer tokens.
6167

6268
## Session Isolation Constraint
6369

64-
Current daemon Stage 1 behavior is effectively `sessionScope: single` at the
65-
daemon setting level. Until per-request `sessionScope` lands, multi-user channel
66-
or web deployments must choose one of these safe shapes:
70+
Multi-user channel or web deployments must explicitly isolate sessions. Use
71+
per-request `sessionScope: 'thread'` when supported; otherwise choose one of
72+
these safe shapes:
6773

6874
- one daemon per channel thread / web room
6975
- one daemon per user workspace
@@ -85,7 +91,7 @@ Do not silently multiplex unrelated channel threads into one daemon session.
8591

8692
Unknown daemon events must be ignored or forwarded as debug metadata, not fatal.
8793

88-
The bridge is not wired into `qwen channel start` yet. Existing Telegram,
94+
The bridge is not wired into `qwen channel start` by default. Existing Telegram,
8995
Weixin, Dingtalk, plugin channel, and browser behavior remains unchanged.
9096

9197
## Explicit Non-Goals
@@ -111,10 +117,11 @@ Weixin, Dingtalk, plugin channel, and browser behavior remains unchanged.
111117
- Smoke-test one single-user channel backend against local `qwen serve`.
112118
- Smoke-test browser -> BFF -> daemon without exposing daemon token.
113119

114-
## Blockers Before Default Migration
120+
## Current Follow-Up Direction
115121

116-
- Per-request `sessionScope`.
117-
- Session metadata + close/delete lifecycle.
118-
- Daemon-stamped client identity.
119-
- Session-scoped permission route.
120-
- Read-only diagnostics for MCP, skills, providers, and environment.
122+
- Prioritize web chat / web terminal daemon integration first.
123+
- Keep channel adapters on the existing ACP bridge by default.
124+
- Revisit daemon channel integration only after web contract, runtime
125+
diagnostics, identity, permission, and session lifecycle semantics are stable.
126+
- Treat this spike as a server-side bridge reference, not a default migration
127+
checklist.

docs/developers/daemon-client-adapters/ide.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
# IDE Daemon Adapter Draft
1+
# IDE Daemon Adapter Spike
22

33
## Goal
44

5-
Let the VS Code companion extension dogfood Mode B by connecting from the
6-
extension host to `qwen serve` through `DaemonSessionClient`.
5+
Document the default-off IDE daemon adapter spike.
6+
7+
As of the 2026-05-19 architecture decision, the VS Code companion should keep
8+
the existing `--acp` child path as its default integration. A daemon-backed IDE
9+
adapter remains future / behind-flag evaluation after the web chat / web
10+
terminal contract and daemon control-plane parity are stable.
711

812
The webview must not call the daemon directly. The extension host owns daemon
913
URL, token, session id, and SSE replay state, then forwards sanitized app events
1014
to the webview.
1115

12-
## Proposed Entry Point
16+
## Historical Experimental Entry Point
1317

1418
VS Code settings:
1519

@@ -55,8 +59,8 @@ If an event cannot be faithfully mapped yet, the daemon path should surface a
5559
clear unsupported-state warning rather than silently pretending parity.
5660

5761
This PR adds `DaemonIdeConnection` as the locally verifiable extension-host
58-
adapter spike. It is not wired into the default `QwenAgentManager` path yet, so
59-
existing VS Code behavior remains ACP subprocess based.
62+
adapter spike. It is not wired into the default `QwenAgentManager` path.
63+
Existing VS Code behavior remains ACP subprocess based.
6064

6165
## Event Mapping Contract
6266

@@ -112,11 +116,11 @@ the daemon.
112116
- permission UI can resolve a request
113117
- SSE reconnect uses tracked `Last-Event-ID`
114118

115-
## Blockers Before Default Migration
119+
## Current Follow-Up Direction
116120

117-
- Typed daemon event schema.
118-
- Daemon-stamped client identity.
119-
- Session-scoped permission route.
120-
- Read-only runtime diagnostics.
121-
- FileSystemService boundary and safe file read routes.
122-
- Output sink refactor for CLI/TUI parity.
121+
- Keep the existing ACP subprocess path as the default IDE path.
122+
- Revisit daemon IDE integration later, after web contract, workspace/path
123+
identity checks, editor-context routing, auth/status UI, and control-plane
124+
parity are stable.
125+
- Treat this spike as future-migration reference, not an active default
126+
migration checklist.

docs/developers/daemon-client-adapters/tui.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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
1620
QWEN_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:
3943
7. Route model switch through `session.setModel()`.
4044
8. Route permission votes through `session.respondToPermission()`.
4145

42-
## Rendering Contract
46+
## Rendering Contract Reference
4347

4448
The first implementation adds `DaemonTuiAdapter`, a locally verifiable reducer
4549
and 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,
6165
JSONL, 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

Comments
 (0)