From 1cdd4087990f0deae937a0eeac2814e6f16f36c4 Mon Sep 17 00:00:00 2001 From: Alterpolo Date: Thu, 7 May 2026 21:13:29 +0300 Subject: [PATCH 1/2] feat(hermes_cli): add __main__.py to enable python -m hermes_cli Adds the standard Python package entry-point so that Hermes can be invoked as `python -m hermes_cli` from a cloned repo or CI environment where the `hermes` binary is not on PATH. The file delegates unconditionally to `hermes_cli.main:main()` with no argument or environment mutation, keeping behaviour byte-identical to the installed command for all subcommands and exit codes. Co-Authored-By: Claude Sonnet 4.6 --- hermes_cli/__main__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 hermes_cli/__main__.py diff --git a/hermes_cli/__main__.py b/hermes_cli/__main__.py new file mode 100644 index 0000000000000..3172ca91ca2bb --- /dev/null +++ b/hermes_cli/__main__.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +""" +Hermes Agent CLI launcher. + +This wrapper should behave like the installed `hermes` command, including +subcommands such as `gateway`, `cron`, and `doctor`. +""" + +if __name__ == "__main__": + from hermes_cli.main import main + main() From 61096a7d22918f9e26fc65a27401796c588857c6 Mon Sep 17 00:00:00 2001 From: Alterpolo Date: Thu, 7 May 2026 21:13:53 +0300 Subject: [PATCH 2/2] fix(pty_bridge): guard fcntl/termios import on native Windows Python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fcntl and termios are POSIX-only and absent from native Windows Python. The module already gates PTY operations on _PTY_AVAILABLE and raises PtyUnavailableError at instantiation, so only the import needs to succeed. Without this guard, any command that triggers web_server.py (which imports pty_bridge unconditionally) crashes at module-load time on Windows — even commands that have nothing to do with the PTY bridge. Co-Authored-By: Claude Sonnet 4.6 --- hermes_cli/pty_bridge.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hermes_cli/pty_bridge.py b/hermes_cli/pty_bridge.py index 66fdb4ac720b4..8449ffd8ececb 100644 --- a/hermes_cli/pty_bridge.py +++ b/hermes_cli/pty_bridge.py @@ -26,16 +26,28 @@ from __future__ import annotations import errno -import fcntl import os import select import signal import struct import sys -import termios import time from typing import Optional, Sequence +# fcntl and termios are POSIX-only. The module guards PTY operations on +# `_PTY_AVAILABLE` and raises `PtyUnavailableError` at instantiation time, +# so the import just needs to succeed on Windows. Without this guard, any +# command that triggers web_server.py (which imports pty_bridge +# unconditionally) crashes at module-load time on native Windows Python. +try: + import fcntl + import termios + _UNIX_TERMIO_AVAILABLE = True +except ImportError: # Windows + fcntl = None # type: ignore + termios = None # type: ignore + _UNIX_TERMIO_AVAILABLE = False + try: import ptyprocess # type: ignore _PTY_AVAILABLE = not sys.platform.startswith("win")