JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
feat(tui): support multiple independent TUI windows per backend
kdgmpw8b5f2e72ebe7
diff --git a/docs/en/MultiInstance.md b/docs/en/MultiInstance.mdindex 49c4720de5..b0c146cab3 100644--- a/docs/en/MultiInstance.md+++ b/docs/en/MultiInstance.md@@ -8,6 +8,8 @@ Run multiple independent JiuwenSwarm instances on the same machine, each with is- **Multi-tenant environment**: Create independent Agent instances for different users or projects- **Parallel modes**: Run Agents with different configurations (models, permission policies) concurrently+> **Not the same as multi-window TUI**: This page covers **separate backend instances** (different workspaces and ports). To open several TUI terminals against one Gateway, see [TUI Usage Guide (zh) — Multi-window TUI](../zh/TUI使用指南.md#多窗口-tui); you do not need extra instances for that.+---## Core Conceptsdiff --git a/docs/en/Quickstart_tui.md b/docs/en/Quickstart_tui.mdindex c57550b902..d16974ea1c 100644--- a/docs/en/Quickstart_tui.md+++ b/docs/en/Quickstart_tui.md@@ -56,6 +56,8 @@ Suitable for users who manage their own Python environment. Follow these steps:jiuwenswarm-tui```+ You can run the command above in **multiple terminals** against the same Gateway (default `ws://127.0.0.1:19001/tui`) for parallel sessions in separate TUI windows. See the **Multi-window TUI** section in [TUI Usage Guide (zh)](../zh/TUI使用指南.md#多窗口-tui).+## Method 2: Install from SourceSuitable for users who perform custom development or adaptation based on JiuwenSwarm.diff --git a/docs/en/ScheduledTasks.md b/docs/en/ScheduledTasks.mdindex 5086f5ae87..e29762324f 100644--- a/docs/en/ScheduledTasks.md+++ b/docs/en/ScheduledTasks.md@@ -55,3 +55,15 @@ If the agent has `cron_create_job`, you can say things like:The agent fills `cron_expr`, `description`, `targets`, etc., equivalent to using the form.++---++### 5. Push to the TUI channel++When `targets` is `tui` (also the default for `/cron add`):++- The scheduler **intentionally omits** `session_id`, so results are not filtered out after a TUI restart or session switch.+- The Gateway **broadcasts** these session-less notifications to **every connected TUI window**, so each open terminal receives the cron result.+- To scope reminders differently, use `targets=web`, or manage jobs via `/cron` in TUI and view them in the Web panel.++Session-scoped chat streams are routed to a single TUI window by `session_id`; cron push to TUI is the exception and reaches all windows.diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.mdindex 2f4b6a12fc..93c6698305 100644--- a/docs/en/SlashCommands.md+++ b/docs/en/SlashCommands.md@@ -371,7 +371,7 @@ Manage cron jobs via RPC calls to the backend `CronController`, sharing the same| `name` | Yes | Job name || `cron_expr` | Yes | Cron expression, supports two formats: 5-field (min hour day month dow) or 7-field Quartz (sec min hour day month dow year). 5-field is auto-converted to 7-field (second=0, year=*). Examples: daily 9am = `0 9 * * *` (5-field) or `0 0 9 * * ? *` (7-field) || `description` | Yes | Job description — the input prompt the Agent receives when executing |-| `targets` | No | Push channel, default `tui`; options: `tui`, `web`, `feishu`, `whatsapp`, `wecom`, `xiaoyi`, `wechat`, `dingtalk`, or `feishu_enterprise:<app_id>` |+| `targets` | No | Push channel, default `tui`; options: `tui`, `web`, `feishu`, `whatsapp`, `wecom`, `xiaoyi`, `wechat`, `dingtalk`, or `feishu_enterprise:<app_id>`. With `targets=tui`, results broadcast to all connected TUI windows; see [Scheduled tasks — Push to TUI](ScheduledTasks.md#5-push-to-the-tui-channel) || `timezone` | No | IANA timezone, default `Asia/Shanghai` || `mode` | No | Execution mode: `agent` (default, suitable for simple reminder-type tasks) or `plan` (for more complex reasoning tasks, allowing the Agent to plan the steps first before executing) || `wake_offset_seconds` | No | Wake-up offset in seconds, default 300 |diff --git a/docs/zh/Quickstart_tui.md b/docs/zh/Quickstart_tui.mdindex 6037e30c70..9c429d7cf7 100644--- a/docs/zh/Quickstart_tui.md+++ b/docs/zh/Quickstart_tui.md@@ -55,6 +55,8 @@ JiuwenSwarm提供两种安装方式:`pip安装`或`源码安装`。jiuwenswarm-tui```+ 可在**多个终端**重复执行上述命令,连接同一 Gateway(默认 `ws://127.0.0.1:19001/tui`),实现多窗口并行会话。详见 [TUI 使用指南 — 多窗口 TUI](TUI使用指南.md#多窗口-tui)。+## **方式二:源码运行**适合基于JiuwenSwarm进行二次开发适配的用户。@@ -125,6 +127,8 @@ JiuwenSwarm提供两种安装方式:`pip安装`或`源码安装`。npm run dev```+ 可在多个终端重复运行 TUI,连接同一 Gateway 实现多窗口并行会话(详见 [TUI 使用指南 — 多窗口 TUI](TUI使用指南.md#多窗口-tui))。+### `conda`方式安装- 使用`conda`新建虚拟环境```bash@@ -185,4 +189,6 @@ JiuwenSwarm提供两种安装方式:`pip安装`或`源码安装`。```bashnpm run dev- ```\ No newline at end of file+ ```++ 可在多个终端重复运行 TUI,连接同一 Gateway 实现多窗口并行会话(详见 [TUI 使用指南 — 多窗口 TUI](TUI使用指南.md#多窗口-tui))。\ No newline at end of filediff --git "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md" "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"index a81a64a377..2d6d66d4cd 100644--- "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"+++ "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"@@ -395,7 +395,7 @@| `name` | 是 | 任务名称 || `cron_expr` | 是 | Cron 表达式,支持两种格式:5 字段(分 时 日 月 周)或 7 字段 Quartz(秒 分 时 日 月 周 年)。5 字段会自动转换为 7 字段(补 second=0, year=*)。示例:每天 9 点 = `0 9 * * *`(5 字段)或 `0 0 9 * * ? *`(7 字段) || `description` | 是 | 任务描述,即 Agent 执行时收到的输入指令 |-| `targets` | 否 | 推送渠道,默认 `tui`;可选:`tui`、`web`、`feishu`、`whatsapp`、`wecom`、`xiaoyi`、`wechat`、`dingtalk` 或 `feishu_enterprise:<app_id>` |+| `targets` | 否 | 推送渠道,默认 `tui`;可选:`tui`、`web`、`feishu`、`whatsapp`、`wecom`、`xiaoyi`、`wechat`、`dingtalk` 或 `feishu_enterprise:<app_id>`。`targets=tui` 时结果会广播到所有已连接的 TUI 窗口,详见 [定时任务 — 推送到 TUI](定时任务.md#5-推送到-tui-频道) || `timezone` | 否 | IANA 时区,默认 `Asia/Shanghai` || `mode` | 否 | 执行模式:`agent`(默认,适用于简单提醒类任务)或 `plan`(较复杂的推理任务,让Agent先规划步骤再执行) || `wake_offset_seconds` | 否 | 提前唤醒秒数,默认 300 |diff --git "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"index 70eefe27f5..fec8b0cdb7 100644--- "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"+++ "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"@@ -10,6 +10,21 @@- TUI 通过 **WebSocket** 连接本机 Gateway 的 TUI 端点(默认 `ws://127.0.0.1:19001/tui`)。请先按 [快速开始(TUI)](Quickstart_tui.md) 启动后端服务,再打开 TUI。- TUI 需要 **交互式 TTY**;在管道或非 TTY 环境下会报错退出。+### 多窗口 TUI++同一套 **Gateway 后端**(同一 `GATEWAY_PORT`,默认 `ws://127.0.0.1:19001/tui`)可**同时打开多个 TUI 终端窗口**。每个窗口维护独立的 `session_id` 与进行中的对话/任务:++| 行为 | 说明 |+|------|------|+| **事件隔离** | Gateway 按 `session_id` 将流式响应、工具输出等事件精确投递到对应窗口,不会串到其他窗口。 |+| **并发任务** | 不同 session 可并行执行 Agent 任务。 |+| **同窗口新消息** | 在同一窗口(相同 `session_id`)再次发送聊天,仍会取消该 session 上旧的流式任务。 |+| **与 ACP 差异** | ACP 仍为 single-user channel(新消息会取消同 channel 上所有进行中任务);TUI/CLI 已改为按 session 隔离。 |++**打开多窗口**:在多个终端分别运行 `jiuwenswarm-tui` 或 `jiuwenswarm-cli` 即可。需要恢复特定会话时使用 `--session <id>` 或 `/resume`。++> **与「单机多实例」的区别**:[单机多实例运行](单机多实例运行.md) 指不同工作区、不同端口的独立后端;**多窗口 TUI** 指多个终端共享同一 Gateway 后端。二者可同时使用(例如 `dev` 实例上开两个 TUI 窗口),但不要混淆端口与工作区。+---## CLI 参考@@ -520,6 +535,8 @@| 文件路径不在允许范围 | 使用 `/workspace add` 将仓库根或子目录加入可信列表 || 连接失败 | 检查 Gateway 是否监听、`--url` 是否正确、防火墙 || 未安装 `rg` | 安装 ripgrep 以改善搜索体验(欢迎屏提示) |+| Cron 通知出现在所有 TUI 窗口 | 预期行为:`targets=tui` 的定时任务会广播到所有已连接终端,详见 [定时任务](定时任务.md#5-推送到-tui-频道) |+| 多窗口之间聊天/流式输出串台 | 请确认 Gateway 为 multi-tui 版本;各窗口应使用不同 `session_id`,事件按 session 精确路由 |---diff --git "a/docs/zh/\345\215\225\346\234\272\345\244\232\345\256\236\344\276\213\350\277\220\350\241\214.md" "b/docs/zh/\345\215\225\346\234\272\345\244\232\345\256\236\344\276\213\350\277\220\350\241\214.md"index a10d0b6358..f067febb92 100644--- "a/docs/zh/\345\215\225\346\234\272\345\244\232\345\256\236\344\276\213\350\277\220\350\241\214.md"+++ "b/docs/zh/\345\215\225\346\234\272\345\244\232\345\256\236\344\276\213\350\277\220\350\241\214.md"@@ -8,6 +8,8 @@- **多租户环境**:为不同用户或项目创建独立的 Agent 实例- **多模式并行**:同时运行不同配置的 Agent(如不同模型、不同权限策略)+> **与「多窗口 TUI」的区别**:本页描述的是**多个独立后端实例**(不同工作区、不同端口)。若只需在同一 Gateway 上开多个 TUI 终端窗口,见 [TUI 使用指南 — 多窗口 TUI](TUI使用指南.md#多窗口-tui),无需创建额外实例。+---## 核心概念diff --git "a/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md" "b/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"index 0deb86dd22..c1e9761ce0 100644--- "a/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"+++ "b/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"@@ -56,3 +56,15 @@ Cron 表达式格式为(7 段,空格分隔):Agent 会自动解析出 `cron_expr` / `description` / `targets` 等字段,并调用 `cron_create_job` 创建任务,等价于在前端面板上点“新建任务”并填写表单。++---++### 5. 推送到 TUI 频道++当 `targets` 为 `tui` 时(也是 `/cron add` 的默认值):++- 调度器**故意不绑定** `session_id`,避免 TUI 重启或切换会话后因 session 变化导致结果被前端过滤。+- Gateway 将这类**无 session 的全局通知**广播到当前已连接的所有 TUI 窗口,因此**每个打开的 TUI 终端都会收到**定时任务结果。+- 若只希望某个会话看到提醒,可在创建任务时改用 `targets=web`,或在 TUI 中通过 `/cron` 管理任务并配合 Web 面板查看。++与 [TUI 使用指南 — 多窗口 TUI](TUI使用指南.md#多窗口-tui) 配合理解:多窗口场景下,带 `session_id` 的聊天流式事件会精确路由;Cron 推送到 TUI 属于例外,会送达全部窗口。diff --git a/jiuwenswarm/gateway/app_gateway.py b/jiuwenswarm/gateway/app_gateway.pyindex abe3bc9be1..6b44c1c240 100644--- a/jiuwenswarm/gateway/app_gateway.py+++ b/jiuwenswarm/gateway/app_gateway.py@@ -275,6 +275,25 @@ class GatewayServer:if isinstance(key, tuple) and key[0] == channel_id and not getattr(client_ws, "closed", False)]+ @staticmethod+ def _extract_routing_session_id(msg, *, include_top_level: bool = True) -> str | None:+ """Best-effort session id from message fields for outbound event routing."""+ if include_top_level:+ sid = getattr(msg, "session_id", None)+ if sid is not None and str(sid).strip():+ return str(sid).strip()+ payload = getattr(msg, "payload", None)+ if isinstance(payload, dict):+ sid = payload.get("session_id")+ if sid is not None and str(sid).strip():+ return str(sid).strip()+ params = getattr(msg, "params", None)+ if isinstance(params, dict):+ sid = params.get("session_id")+ if sid is not None and str(sid).strip():+ return str(sid).strip()+ return None+def on_message(self, callback) -> None:self._on_message_cb = callback@@ -428,20 +447,39 @@ class GatewayServer:if ws is None or bool(getattr(ws, "closed", False)):if ws is None:channel_id = getattr(msg, "channel_id", None)+ # 多 TUI 窗口:有 session_id 时精确路由;无 session_id 时广播(如 cron 推送到 TUI)。if channel_id and channel_id != "acp" and msg.type != "res":- clients = self._find_channel_clients(channel_id)- if clients:- frame = _build_event_frame(msg)- data = json.dumps(frame, ensure_ascii=False)- logger.info(- "[GatewayServer] broadcast fallback: channel_id=%s clients=%d id=%s",- channel_id, len(clients), getattr(msg, "id", None),- )- await asyncio.gather(- *[c.send(data) for c in clients],- return_exceptions=True,- )- return+ session_id = self._extract_routing_session_id(msg, include_top_level=False)+ if session_id:+ session_key = self._client_route_key(channel_id, session_id)+ if session_key:+ client = self._session_to_client.get(session_key)+ if client is not None and not bool(getattr(client, "closed", False)):+ frame = _build_event_frame(msg)+ data = json.dumps(frame, ensure_ascii=False)+ try:+ await client.send(data)+ except Exception:+ logger.debug(+ "[GatewayServer] session-routed send failed: session_id=%s",+ session_id,+ exc_info=True,+ )+ return+ elif not self._extract_routing_session_id(msg, include_top_level=True):+ clients = self._find_channel_clients(channel_id)+ if clients:+ frame = _build_event_frame(msg)+ data = json.dumps(frame, ensure_ascii=False)+ logger.info(+ "[GatewayServer] broadcast fallback (no session_id): channel_id=%s clients=%d id=%s",+ channel_id, len(clients), getattr(msg, "id", None),+ )+ await asyncio.gather(+ *[c.send(data) for c in clients],+ return_exceptions=True,+ )+ returnlogger.warning("[GatewayServer] message dropped: no WebSocket client found for channel_id=%s session_id=%s id=%s",getattr(msg, "channel_id", None),diff --git a/jiuwenswarm/gateway/message_handler/message_handler.py b/jiuwenswarm/gateway/message_handler/message_handler.pyindex 6274ccf29b..cdb05402e1 100644--- a/jiuwenswarm/gateway/message_handler/message_handler.py+++ b/jiuwenswarm/gateway/message_handler/message_handler.py@@ -31,11 +31,10 @@ logger = logging.getLogger(__name__)_ACP_CHANNEL_ID = "acp"_ACP_ORIGINAL_SESSION_ID_KEY = "acp_original_session_id"-# TUI/ACP/legacy CLI: one in-flight chat replaces any prior work on that channel.+# ACP: one in-flight chat replaces any prior work on that channel.+# TUI/CLI 已移除此列表:多窗口 TUI 各自维护独立 session,互不干扰。_SINGLE_USER_CHANNEL_IDS = frozenset({ChannelType.ACP.value,- ChannelType.CLI.value,- "cli",})_DEFAULT_INLINE_FILE_SIZE_LIMIT = 128 * 1024_KNOWN_JIUWENSWARM_SESSION_PREFIXES = (@@ -424,7 +423,7 @@ class MessageHandler(ABC):@staticmethoddef _is_single_user_channel(channel_id: str) -> bool:- """Channels where only one user interacts at a time (TUI, ACP, CLI)."""+ """Channels where a new chat.send replaces all in-flight work on that channel (ACP only)."""return channel_id in _SINGLE_USER_CHANNEL_IDSdef _clone_message_for_session_cancel(@@ -481,7 +480,8 @@ class MessageHandler(ABC):"""Cancel in-flight stream work on *msg.channel_id* before starting a new chat.send.Stops both gateway stream consumers and AgentServer work (via interrupt).- Single-user channels (TUI/ACP) also drop orphan tasks from other session_ids.+ ACP also drops orphan tasks from other session_ids; TUI/CLI only cancel+ streams that share the same session_id as the incoming chat.send."""channel_id = msg.channel_idnew_session_id = msg.session_iddiff --git a/tests/unit_tests/gateway/test_app_gateway_acp.py b/tests/unit_tests/gateway/test_app_gateway_acp.pyindex 597cad1027..e55d1bee49 100644--- a/tests/unit_tests/gateway/test_app_gateway_acp.py+++ b/tests/unit_tests/gateway/test_app_gateway_acp.py@@ -1528,3 +1528,108 @@ async def test_gateway_server_send_event_routes_same_session_id_by_channel():},}]+++async def test_gateway_server_routes_event_by_payload_session_id_only():+ """Fallback routes by payload session_id when msg.session_id is unset."""+ server = build_server()+ ws_a = FakeWebSocket()+ ws_b = FakeWebSocket()+ server.bind_session_client("sess-a", ws_a, channel_id="tui")+ server.bind_session_client("sess-b", ws_b, channel_id="tui")++ await server.send(+ Message(+ id="req-a",+ type="event",+ channel_id="tui",+ session_id=None,+ params={},+ timestamp=time.time(),+ ok=True,+ payload={"content": "for a", "session_id": "sess-a"},+ event_type=EventType.CHAT_DELTA,+ )+ )++ assert len(ws_a.sent_frames) == 1+ assert ws_b.sent_frames == []+++async def test_gateway_server_session_less_event_broadcasts_to_all_tui_clients():+ """Session-less channel notifications (e.g. cron) broadcast to all TUI clients."""+ server = build_server()+ ws_a = FakeWebSocket()+ ws_b = FakeWebSocket()+ server.bind_session_client("sess-a", ws_a, channel_id="tui")+ server.bind_session_client("sess-b", ws_b, channel_id="tui")++ await server.send(+ Message(+ id="cron-push-1",+ type="event",+ channel_id="tui",+ session_id=None,+ params={},+ timestamp=time.time(),+ ok=True,+ payload={"content": "cron reminder", "cron": {"job_id": "j1"}},+ event_type=EventType.CHAT_FINAL,+ )+ )++ assert len(ws_a.sent_frames) == 1+ assert len(ws_b.sent_frames) == 1+ assert ws_a.sent_frames[0]["payload"]["content"] == "cron reminder"+ assert ws_b.sent_frames[0]["payload"]["content"] == "cron reminder"+++async def test_gateway_server_drops_event_when_session_client_gone():+ """Known session_id with no connected client is dropped, not broadcast."""+ server = build_server()+ ws_b = FakeWebSocket()+ server.bind_session_client("sess-b", ws_b, channel_id="tui")++ await server.send(+ Message(+ id="req-gone",+ type="event",+ channel_id="tui",+ session_id="sess-gone",+ params={},+ timestamp=time.time(),+ ok=True,+ payload={"content": "stale"},+ event_type=EventType.CHAT_DELTA,+ )+ )++ assert ws_b.sent_frames == []+++async def test_gateway_server_routes_by_params_session_id_when_payload_empty():+ """params.session_id is checked even when payload is an empty dict."""+ server = build_server()+ ws = FakeWebSocket()+ server.bind_session_client("sess-params", ws, channel_id="tui")++ await server.send(+ Message(+ id="req-params",+ type="event",+ channel_id="tui",+ session_id=None,+ params={"session_id": "sess-params"},+ timestamp=time.time(),+ ok=True,+ payload={},+ event_type=EventType.CHAT_DELTA,+ )+ )++ assert len(ws.sent_frames) == 1+ assert ws.sent_frames[0]["payload"].get("session_id") is Nonediff --git a/tests/unit_tests/gateway/test_message_handler_stream_cancel.py b/tests/unit_tests/gateway/test_message_handler_stream_cancel.pyindex 05808097d0..007ad641cd 100644--- a/tests/unit_tests/gateway/test_message_handler_stream_cancel.py+++ b/tests/unit_tests/gateway/test_message_handler_stream_cancel.py@@ -94,21 +94,23 @@ async def test_cancel_stream_tasks_only_affects_same_channel() -> None:handler, rid="rid-web", channel_id="web", session_id="sess_web",)+ # TUI is no longer single-user: different session on same channel does NOT cancel.cancelled = await handler.cancel_stream_tasks_for_channel(_chat_send_message(channel_id="tui", session_id="sess_new"),)- assert cancelled == 1- assert tui_task.cancelled()+ assert cancelled == 0+ assert not tui_task.cancelled()assert not web_task.cancelled()- assert "rid-tui" not in getattr(handler, "_stream_tasks")+ assert "rid-tui" in getattr(handler, "_stream_tasks")assert "rid-web" in getattr(handler, "_stream_tasks")await asyncio.sleep(0)- assert len(_FakeAgentClient.sent_requests) == 1+ assert len(_FakeAgentClient.sent_requests) == 0@pytest.mark.asyncio-async def test_single_user_channel_cancels_orphan_session_on_same_channel() -> None:+async def test_tui_no_longer_cancels_orphan_session() -> None:+ """TUI is no longer single-user: different session does not cancel orphan stream."""handler = _TestMessageHandler.create()orphan_task = _seed_stream_task(handler, rid="rid-orphan", channel_id="tui", session_id="sess_orphan",@@ -118,10 +120,10 @@ async def test_single_user_channel_cancels_orphan_session_on_same_channel() -> N_chat_send_message(channel_id="tui", session_id="sess_new"),)- assert cancelled == 1- assert orphan_task.cancelled()+ assert cancelled == 0+ assert not orphan_task.cancelled()await asyncio.sleep(0)- assert len(_FakeAgentClient.sent_requests) == 1+ assert len(_FakeAgentClient.sent_requests) == 0@pytest.mark.asyncio@@ -146,8 +148,8 @@ async def test_web_channel_only_cancels_matching_session() -> None:@pytest.mark.asyncio-async def test_stream_without_session_id_still_notifies_agent() -> None:- """Streams missing session metadata must still send chat.interrupt."""+async def test_tui_keeps_streams_on_different_session() -> None:+ """TUI is no longer single-user: different session preserves all in-flight streams."""handler = _TestMessageHandler.create()_seed_stream_task(handler, rid="rid-peer", channel_id="tui", session_id="sess_resolved",@@ -167,17 +169,17 @@ async def test_stream_without_session_id_still_notifies_agent() -> None:_chat_send_message(channel_id="tui", session_id="sess_new"),)- assert cancelled == 2- assert orphan_task.cancelled()+ assert cancelled == 0+ assert not orphan_task.cancelled()await asyncio.sleep(0)- assert len(_FakeAgentClient.sent_requests) == 1+ assert len(_FakeAgentClient.sent_requests) == 0-def test_is_single_user_channel_includes_cli_alias() -> None:+def test_is_single_user_channel_acp_only() -> None:_is_single_user_channel = getattr(MessageHandler, "_is_single_user_channel")- assert _is_single_user_channel("tui")+ assert not _is_single_user_channel("tui")assert _is_single_user_channel("acp")- assert _is_single_user_channel("cli")+ assert not _is_single_user_channel("cli")assert not _is_single_user_channel("web")