fix(dashboard): stabilize embedded chat resume and scrollback

This commit is contained in:
nouseman666 2026-05-03 13:12:36 +08:00 committed by Teknium
parent fdb9e0f6a6
commit a0758cd1e9
3 changed files with 67 additions and 50 deletions

View file

@ -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