uwarp-space
2026-03-23
Terminal scrollback persistence across page reloads, menu prompt fixes, wake indicator fix
9 files · 226+ · 22-
Terminal scrollback buffer persistence across page reload
2 files changed
terminal.jsAdded _termBufPush/_termBufSave/_termBufRestore — captures all writes to xterm.js into a rolling base64 chunk array capped at 512KB; saves to sessionStorage on beforeunload/pagehide; restores on connect if a resume token matchesterminal_session.pyMinor session handling updates for reload context
- Every xterm.js write() call is intercepted; output is base64-encoded and pushed into a rolling buffer (_termBufChunks) capped at 512KB base64 (~384KB raw). On beforeunload/pagehide the buffer is saved to sessionStorage under a key derived from the resume token. On next connect, if a matching key exists and is under 4 hours old, the chunks are replayed through xterm.js before the live stream resumes — preserving scrollback context.
instantiate
behavioral
1 file
terminal.js
Menu prompt state and sub-command return fix
1 file changed
_ts_command.pyReset _prompt_origin_menu_event=None when a prompt arrives from the command loop (not from a menu), preventing stale menu origin from causing erroneous menu returns. Added ANSI screen display support for menus with a screen_id; extracted _send_menu_prompt() helper.
- When a command response contains a prompt event (not a menu event), _prompt_origin_menu_event is now explicitly cleared so the subsequent prompt handler doesn’t mistakenly route back to a stale menu origin. Fixes the bug where completing a menu sub-command would re-enter the menu instead of returning to the command loop.
remediate
behavioral
1 file
_ts_command.py
- Menu rendering updated: if the menu event has a screen_id, display_screen() is called to show an ANSI screen file instead of the plain-text fallback. Menu prompt logic extracted to _send_menu_prompt() helper that supports both game-style prompts (with time-limit display) and simple prompts.
instantiate
behavioral
1 file
_ts_command.py
Wake indicator bleed and skip-welcome timing fixes
3 files changed
ws_handlers.pyFixed wake indicator escape sequence to avoid bleed; clears indicator immediately before restore_state sends sector display; skip_welcome now also set when client sends a resume token message before SQL state loads_ts_lifecycle.pyMinor lifecycle updates_ts_login.pyMinor login path updates
- Wake indicator ANSI sequence fixed: removed stray \x1b[s and \x1b[u save/restore that was bleeding into the prompt when sector display output scrolled row 25 upward. Indicator is now explicitly cleared (\x1b[2K) before restore_state output begins.
remediate
behavioral
1 file
ws_handlers.py
- skip_welcome now set when the first WebSocket message is a resume token, even when no SQL state is saved. Prevents the pregame menu from briefly rendering before the resume handler clears and restores the screen.
remediate
behavioral
1 file
ws_handlers.py
Dependency update
3 files changed
uv.lockLockfile update for dependency changesstatic_bundle.pyMinor static bundle handler updategame_loop.pyMinor game loop update