From a0758cd1e9dc9e263d3b79067cf2d4955f7d2894 Mon Sep 17 00:00:00 2001 From: nouseman666 Date: Sun, 3 May 2026 13:12:36 +0800 Subject: [PATCH] fix(dashboard): stabilize embedded chat resume and scrollback --- hermes_cli/web_server.py | 14 +++++ web/src/components/ChatSidebar.tsx | 6 +- web/src/pages/ChatPage.tsx | 97 +++++++++++++++--------------- 3 files changed, 67 insertions(+), 50 deletions(-) diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py index 5527039cf1..63d8455647 100644 --- a/hermes_cli/web_server.py +++ b/hermes_cli/web_server.py @@ -2949,6 +2949,20 @@ def _resolve_chat_argv( argv, cwd = _make_tui_argv(PROJECT_ROOT / "ui-tui", tui_dev=False) env = os.environ.copy() env.setdefault("NODE_ENV", "production") + # Embedded browser chat should render into the primary screen buffer, not + # the terminal alternate screen. Alt-screen is ideal for the native CLI, + # but it intentionally has no host scrollback; in the web dashboard that + # makes mouse-wheel history feel broken even when xterm itself is healthy. + # INLINE mode keeps transcript rows in the normal buffer so browser-side + # scrollback works predictably. + env.setdefault("HERMES_TUI_INLINE", "1") + # Browser-embedded chat should prefer stable wheel-based scrollback over + # native terminal mouse tracking. When mouse tracking is enabled, wheel + # events are consumed by the TUI and forwarded as terminal input, which + # makes browser-side transcript scrolling feel broken. Keep the terminal + # build unchanged for native CLI usage; only disable mouse tracking for + # the dashboard PTY path. + env.setdefault("HERMES_TUI_DISABLE_MOUSE", "1") if resume: env["HERMES_TUI_RESUME"] = resume diff --git a/web/src/components/ChatSidebar.tsx b/web/src/components/ChatSidebar.tsx index 1c92311288..38f1cf80ab 100644 --- a/web/src/components/ChatSidebar.tsx +++ b/web/src/components/ChatSidebar.tsx @@ -303,7 +303,7 @@ export function ChatSidebar({ channel, className }: ChatSidebarProps) { return (