Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev

This commit is contained in:
2026-05-24 17:58:49 +00:00
3 changed files with 50 additions and 23 deletions
+12 -6
View File
@@ -145,21 +145,27 @@ class TerminalSession:
# Only resize if dimensions actually changed
if cols == self._cols and rows == self._rows:
logger.info(f"resize() skipped for session {self.session_id}: already {cols}x{rows}")
return
self._cols = cols
self._rows = rows
logger.info(f"resize() called for session {self.session_id}: {cols}x{rows}")
# Set host PTY size
self._set_terminal_size(cols, rows)
# Docker exec doesn't forward PTY resize to the container process,
# so we need to explicitly set the size inside the container shell.
# Only do this on the first resize to avoid interfering with user input.
if not getattr(self, '_stty_sent', False):
self._stty_sent = True
stty_cmd = f"stty cols {cols} rows {rows}\n".encode()
await self.write_input(stty_cmd)
logger.info(f"Sent stty command to container for session {self.session_id}: {cols}x{rows}")
# Send on every resize so the container shell always matches the frontend.
# Use stty -echo to hide command output, then re-enable echo
# Add small delay to ensure shell is ready to receive commands
await asyncio.sleep(0.1)
stty_cmd = (
f"stty -echo; stty cols {cols} rows {rows}; stty echo\n"
).encode()
await self.write_input(stty_cmd)
logger.info(f"Sent stty resize to container for session {self.session_id}: {cols}x{rows}")
async def reset(self) -> None:
"""Reset the session by killing the process and clearing state."""