feat(windows): enable dashboard chat tab via ConPTY (win_pty_bridge) - #39913
feat(windows): enable dashboard chat tab via ConPTY (win_pty_bridge)#39913JoelJJohnson wants to merge 2 commits into
Conversation
Add hermes_cli/win_pty_bridge.py — a pywinpty-backed drop-in for PtyBridge with the same spawn/read/write/resize/close surface — and wire it into the web_server PTY import block so Windows picks it up instead of falling back to None. pywinpty is already a declared win32 dependency (pyproject.toml). The ConPTY read path runs inside run_in_executor so the event loop is never blocked. Spawn/read/write/terminate call shapes are taken directly from tools/process_registry.py which already exercises the same pywinpty version. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The chat pane now works on native Windows via the ConPTY bridge added in the previous commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi @JoelJJohnson — taking this in as #42251 with your two commits cherry-picked intact (authorship preserved), rebased onto current Closing this once #42251 merges. Credit lives in commit trailers + AUTHOR_MAP. |
|
|
Thanks for the ConPTY implementation. This is an automated hermes-sweeper review; the feature has already landed through the maintainer salvage referenced in the discussion, with contributor credit retained.
Closing as implemented on main. |
Summary
hermes_cli/win_pty_bridge.py— apywinpty-backed PTY bridge with the samespawn/read/write/resize/closesurface as the existing POSIXPtyBridgehermes_cli/web_server.pyso Windows picksWinPtyBridgeinstead of falling back toNoneProblem
On native Windows,
hermes dashboard's/chattab showed a red banner:PtyBridgewasNoneon Windows becausepty_bridge.pydepends onfcntl/termios/ptyprocess, none of which exist on native Windows.Solution
pywinptyis already a declared win32 dependency inpyproject.toml(pywinpty>=2.0.0,<3; sys_platform == 'win32') and is already used intools/process_registry.py. This PR adds a thin wrapper around it with the same interfaceweb_serveralready expects, and wires it in with asys.platformbranch in the import block — no changes to the WebSocket handler itself.Key implementation notes:
read()runs insiderun_in_executor(existingweb_serverdesign), so the blocking ConPTY poll never stalls the event looptools/process_registry.pywhich exercises the same pinnedpywinptyversionsetwinsize(rows, cols)is the one call not already exercised in the repo — resize was tested manually and reflows correctlystr, notbytes), so a multibyte UTF-8 sequence split across reads may produce a replacement character; noted in code comment as the one fidelity tradeoff vs the POSIX raw-fd pathTest Plan
web_server.PtyBridgeresolves toWinPtyBridgeonwin32,_PTY_BRIDGE_AVAILABLE = True/api/ptyWebSocket delivers live ANSI terminal output (Hermes TUI banner visible) — no WSL banner, no 1011 close codepty_bridge.pystill imported on Linux/macOS