provide-terminal
2026-02-28
Repository initialized with complete terminal package, WebSocket proxy, hijack widgets, and 9 rounds of code review fixes
77 files · 18,351+
Initial Package
14 files changed
__init__.pyPublic API surface for the terminal packageemulator.pyTerminal emulator coreio.pyTerminal I/O layerscreen.pyScreen buffer and renderingansi.pyANSI escape code processing and color upgrade pipelinefile_io.pyFile import/export helpersprotocols.pyProtocol definitionsdefaults.pyPackage-wide default constants__init__.pyReplay package initraw.pyRaw session replayviewer.pyReplay viewersession_logger.pySession recording and loggingpyproject.tomlPackage metadata and dependenciesuv.lockLocked dependency graph
- Core terminal package instantiated: emulator, I/O, screen buffer, ANSI processing, file importers, color upgrade pipeline, session logger, replay module, and coverage configuration.
instantiate
architectural
7 files
__init__.pyemulator.pyio.pyscreen.pyansi.pysession_logger.pyraw.py
WebSocket and Proxy
10 files changed
fastapi.pyFastAPI WS router factory and bidirectional proxygateway.pyReverse-direction gateway: telnet/SSH to WebSocketcli.pyprovideterm CLI proxy command__init__.pyTransport package initbase.pyBase transport abstractionssh.pySSH transporttelnet.pyTelnet transporttelnet_server.pyTelnet server transportwebsocket.pyWebSocket transportchaos.pyChaos/fault-injection transport
- FastAPI WS router factory and bidirectional proxy added, enabling browser terminals over WebSocket.
instantiate
behavioral
1 file
fastapi.py
- Reverse-direction gateway (telnet/SSH to WS) and
providetermCLI proxy command added. CLI later renamed toundeftermthen back. instantiate behavioral2 files
gateway.pycli.py
- SSH gateway host-key path validated before calling asyncssh. Browser WebSocket input encoded as UTF-8 instead of latin-1.
remediate
internal
2 files
gateway.pywebsocket.py
Frontend Widgets
10 files changed
hijack.htmlProvideHijack embeddable hijack control widget HTMLhijack.jsProvideHijack widget JS with WS heartbeat, backoff reconnect, mobile toolbarhijack.cssHijack widget stylesterminal.htmlProvideTerminal widget HTMLterminal.jsProvideTerminal widget JSterminal.cssTerminal widget stylesterminal-panel.jsTerminal panel componentdemo_server.pyDemo server for manual and Playwright testingterminal.htmlStandalone frontend terminal HTMLterminal.jsStandalone frontend terminal JS
- Embeddable
ProvideTerminalwidget andmount_terminal_ui()added for drop-in browser terminal embedding. instantiate behavioral2 files
terminal.htmlterminal.js
- Embeddable
ProvideHijackhijack control widget added. instantiate behavioral2 files
hijack.htmlhijack.js
- WS heartbeat, exponential backoff reconnect, and mobile key toolbar added to frontend.
margin
internal
1 file
hijack.js
- Demo server script added for manual and Playwright-based testing.
qualify
internal
1 file
demo_server.py
Hijack Control Plane (9 Rounds of Review)
8 files changed
__init__.pyHijack package initbase.pyHijackableMixin base class (renamed from HijackBase)bridge.pyHijack bridge: swallowed exception logging, reconnect statehub.pyTermHub: atomic lock patterns, idle bot state pruningmodels.pyHijack data modelsroutes.pyHijack routes (combined)routes_rest.pyREST hijack routesroutes_ws.pyWebSocket hijack routes
- Nine rounds of code review corrections applied: security, correctness, and concurrency issues in the hijack control plane. Fixes cover: acquire cancellation safety, reconnect state reset, stale lease handling, was_owner init, spurious callback guards, onopen guard, close executor, and atomic lock patterns across hub, routes, and logger.
remediate
architectural
4 files
hub.pybridge.pyroutes_rest.pyroutes_ws.py
- HijackBase renamed to HijackableMixin; swallowed exceptions now logged in bridge. All files exceeding 500 LOC split.
decouple
behavioral
2 files
base.pybridge.py
- Idle bot state pruned from TermHub to prevent unbounded
_botsgrowth. deprecate internal1 file
hub.py
Testing
29 files changed
__init__.pyTest package initconftest.pyTest fixtures and configuration__init__.pyTest helpers packagemock_server.pyMock server for integration teststest_fastapi_ws.pyWebSocket integration teststest_hijack_acquire_atomic.pyAtomic acquire regression teststest_hijack_base.pyHijackableMixin base teststest_hijack_bridge.pyBridge teststest_hijack_hub.pyHub teststest_hijack_routes.pyRoute handler teststest_hijack_ws.pyWebSocket hijack teststest_playwright_hijack.pyPlaywright smoke test for hijack widgettest_session_logger.pySession logger teststest_ssh_transport.pySSH transport teststest_telnet_transport.pyTelnet transport teststest_telnet_transport_full.pyFull telnet transport test suitetest_websocket_transport.pyWebSocket transport teststest_ansi.pyANSI processing teststest_ansi_upgrade.pyColor upgrade pipeline teststest_bridge_reconnect.pyBridge reconnect teststest_chaos_transport.pyChaos transport teststest_cli.pyCLI teststest_emulator.pyEmulator teststest_file_io.pyFile I/O teststest_gateway.pyGateway teststest_io.pyI/O layer teststest_replay.pyReplay teststest_screen.pyScreen buffer teststest_screen_extras.pyAdditional screen tests