Docs/Controls & Hotkeys
SECTION 03Session Management

Controls & Hotkeys

LMESH provides low-level keyboard hotkeys, automated PTY synchronization hooks, and collaborative token-passing mechanisms to manage active shell sessions securely without leaving your terminal.

Hotkey Quick Reference

These hotkeys are captured directly by the host CLI input stream and intercepted before reaching the child shell process:

ShortcutScopeActionDescription
Ctrl+SHost CLIToggle PrivateEnables or disables automatic secrets redaction in collaborator viewports and audit logs.
Ctrl+]Host CLITerminateImmediately tears down the active WebSocket stream and terminates the native PTY session.
exitShell ProcessProcess ExitStandard shell exit command. Triggers SIGHUP signal propagation and closes the session.
EscapeHost CLIRevoke ControlInstantly reclaims terminal write access back to the host, demoting collaborators to viewers.

Private Mode (Ctrl+S)

security

During live pairing, hosts often need to inspect environment variables, run migration scripts containing database connection URIs, or copy sensitive tokens. Private Mode acts as an in-stream redaction proxy between the local PTY stdout and the outbound WebSocket relay.

Pattern-Matched Redaction

Automatically scans stdout chunks for regex patterns matching AWS access keys, GitHub personal access tokens, OpenAI API keys, private RSA keys, and JWT signatures.

Audit Log Masking

Masked strings are replaced with [REDACTED] before chunks are pushed to PostgreSQL session history tables.

terminal preview
$export DATABASE_URL=postgres://user:[REDACTED]@db.internal:5432/prod
[lmesh] Private Mode active • 1 sensitive credential redacted from collaborator stream

Session Termination (Ctrl+])

lifecycle

When you conclude collaboration, you can disconnect all connected web clients and destroy the relay session using either the escape chord or the shell exit command:

Instant Kill (Ctrl+])

Immediately broadcasts a session termination payload over WebSocket, closes the server room, and returns the host shell to ordinary non-shared operation.

Graceful Shell Exit

Typing exit inside the terminal sends an EOF (End of File) signal to your underlying shell, naturally terminating both the PTY process and the session.

Terminal Redraw & Viewport Sync

rendering

Collaborative terminal streaming faces a physical challenge: browser windows and desktop terminal windows have differing column and row geometries. LMESH synchronizes viewport dimensions without distorting full-screen TUI programs such as Vim, Nano, or htop.

How Window Sizing is Arbitrated:
  1. Host Authority: The host's physical terminal window dimensions (cols and rows) define the authoritative PTY size.
  2. Viewport Clamping: Collaborator browser viewports instantiate an xterm.js canvas fitted with dynamic letterboxing when client monitors are larger or smaller than the host terminal.
  3. Window Change Signal: When the host resizes their terminal window, the CLI emits a SIGWINCH event to the PTY and pushes a resize frame over WebSocket to redraw collaborator viewports immediately.

Input Token Handover

collaboration

To prevent simultaneous keystroke collisions and command corruption, LMESH implements a Single-Token Write Mutex. Collaborators begin in read-only observation mode.

Control Request Workflow:
1. Request

Collaborator clicks "Request Control" in the web toolbar.

2. Approval

Host approves prompt in CLI or browser dashboard.

3. Write Access

Token transfers to collaborator. Host retains instant revoke with Escape.