docs/developers/daemon-client-adapters/channel-web.md
Let channel adapters and web chat backends consume qwen serve through
DaemonSessionClient while keeping existing channel ACP subprocess behavior as
the default.
This draft covers server-side clients only:
qwen serveqwen serveIt explicitly does not allow browser JavaScript to call the daemon directly.
The daemon currently rejects browser Origin requests by design.
Channel backend:
QWEN_CHANNEL_DAEMON_URL=http://127.0.0.1:4170 qwen channel start telegram
Web backend:
QWEN_WEB_DAEMON_URL=http://127.0.0.1:4170 qwen web-chat-backend
Shared optional variables:
QWEN_DAEMON_TOKEN=...
QWEN_DAEMON_WORKSPACE=/repo
This PR adds DaemonChannelBridge, a locally verifiable server-side bridge for
channel and web-backend adapters. It keeps the existing ACP bridge as the
default and owns daemon session state inside the backend process.
DaemonClient + DaemonSessionClient.createOrAttach().session.prompt().session.events() and collect assistant text chunks.session.respondToPermission().session.cancel().DaemonSessionClient.sessionId and last seen event id server-side.Browser clients must not receive daemon bearer tokens.
Current daemon Stage 1 behavior is effectively sessionScope: single at the
daemon setting level. Until per-request sessionScope lands, multi-user channel
or web deployments must choose one of these safe shapes:
Do not silently multiplex unrelated channel threads into one daemon session.
| Daemon event | Channel/web backend handling |
|---|---|
session_update / agent_message_chunk | Append assistant text |
session_update / agent_thought_chunk | Optional hidden/debug stream |
session_update / tool_call | Emit tool status card/message |
permission_request | Platform-specific approval interaction |
permission_resolved | Close/update approval interaction |
model_switched | Update backend session metadata |
session_died | Notify user and stop stream |
Unknown daemon events must be ignored or forwarded as debug metadata, not fatal.
The bridge is not wired into qwen channel start yet. Existing Telegram,
Weixin, Dingtalk, plugin channel, and browser behavior remains unchanged.
qwen serve.sessionScope.