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
913This 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
2226QWEN_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
2832QWEN_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.
46503 . Submit inbound user text with ` session.prompt() ` .
47514 . Subscribe to ` session.events() ` and collect assistant text chunks.
48525 . 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.
50567 . 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
8692Unknown 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,
8995Weixin, 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.
0 commit comments