diff --git a/gateway/run.py b/gateway/run.py index 0522699357..23b7991008 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -883,7 +883,7 @@ def _auto_continue_freshness_window() -> float: """Auto-continue freshness window in seconds (non-positive disables the gate). Thin wrapper over ``gateway.session`` kept so ``gateway.run`` imports/test patches keep working.""" - from gateway.session import auto_continue_freshness_window + from gateway.session_lifecycle import auto_continue_freshness_window return auto_continue_freshness_window() @@ -1498,11 +1498,9 @@ _ensure_ssl_certs() sys.path.insert(0, str(Path(__file__).parent.parent)) from hermes_constants import get_hermes_home, get_hermes_home_override -from utils import atomic_json_write # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) _hermes_home = get_hermes_home() # Load ~/.hermes/.env first: user-managed env files must override stale shell exports on restart. -from dotenv import load_dotenv # noqa: F401 # backward-compat for tests that monkeypatch this symbol from hermes_cli.env_loader import load_hermes_dotenv _env_path = _hermes_home / '.env' load_hermes_dotenv(hermes_home=_hermes_home, project_env=Path(__file__).resolve().parents[1] / '.env') @@ -2018,10 +2016,7 @@ from gateway.session import ( # rationale); ``thread_id`` goes in ``route_metadata`` so the anchorless cron send bypasses the # DeliveryRouter's private-chat reply-anchor requirement. Compute the routed metadata ONCE so both the text # send (via DeliveryRouter) and the media send agree. -from gateway.delivery import ( - DeliveryRouter, - resolve_delivery_transport, # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) -) +from gateway.delivery import DeliveryRouter from gateway.turn_lease import SessionTurnLeaseRegistry from gateway.session_state import SessionState, legacy_dict_property, legacy_lease_token_property from gateway.authz_mixin import GatewayAuthorizationMixin @@ -2040,21 +2035,14 @@ from gateway.run_notifications import GatewayNotificationsMixin from gateway.run_inbound import GatewayInboundMixin from gateway.run_goals import GatewayGoalsMixin from gateway.run_agent_cache import GatewayAgentCacheMixin -from gateway.run_turn_runner import TurnRunner # noqa: F401 (re-exported; run.py callers + tests) from gateway.platforms.base import ( BasePlatformAdapter, MessageEvent, MessageType, _reply_anchor_for_event, - merge_pending_message_event, # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) - ) -from gateway.shutdown_watchdog import ( - _arm_loop_floor_timer, # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) - start_loop_liveness_watchdog, # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) ) from gateway.restart import ( DEFAULT_GATEWAY_CRON_DRAIN_TIMEOUT, - DEFAULT_GATEWAY_POST_INTERRUPT_GRACE_TIMEOUT, # noqa: F401 (re-exported: run_* mixins + tests resolve gateway.run.) DEFAULT_GATEWAY_RESTART_AFTER_TURN_TIMEOUT, DEFAULT_GATEWAY_RESTART_DRAIN_TIMEOUT, DEFAULT_GATEWAY_SIGNAL_INTERRUPT_GRACE_TIMEOUT) @@ -2142,8 +2130,6 @@ _CONVERSATION_SCOPED_STATE: tuple = ( # future conversation's first user message — session keys are source-derived and REUSED. "_pending_turn_sidecar_notes") -from gateway.run_common import _UNSET # noqa: F401 (def-time sentinel shared with run_* mixins) - def _resolve_runtime_agent_kwargs() -> dict: """Resolve provider credentials for gateway-created AIAgent instances. @@ -5360,7 +5346,7 @@ def main(): def _arm_watchdog() -> None: # Armed before config load / DB opens so a pre-loop deadlock is respawned by the supervisor instead # of wedging as a live-PID zombie. GatewayRunner disarms it. - from gateway.startup_watchdog import arm_startup_watchdog + from hermes_startup_watchdog import arm_startup_watchdog arm_startup_watchdog() def _utf8_stdio() -> None: diff --git a/hermes_cli/auth_codex.py b/hermes_cli/auth_codex.py index ac5f5e9591..a53ec99fd9 100644 --- a/hermes_cli/auth_codex.py +++ b/hermes_cli/auth_codex.py @@ -4,8 +4,8 @@ Tokens live in ~/.hermes/auth.json, NOT ~/.codex/: Hermes keeps its own Codex OA separate from the Codex CLI / VS Code extension so one app's refresh-token rotation cannot invalidate the other's session. -Split out of ``hermes_cli/auth.py`` and re-exported there; origin helpers are imported lazily -inside each function so ``hermes_cli.auth.`` patches still intercept (and no import cycle). +Split out of ``hermes_cli/auth.py``; origin helpers are imported lazily inside each function +so ``hermes_cli.auth.`` patches still intercept (and no import cycle). """ from __future__ import annotations diff --git a/hermes_cli/auth_minimax.py b/hermes_cli/auth_minimax.py index 65ac3a2cd8..630b620a9b 100644 --- a/hermes_cli/auth_minimax.py +++ b/hermes_cli/auth_minimax.py @@ -1,7 +1,7 @@ """MiniMax OAuth (user-code grant) login, refresh and runtime credentials. -Re-exported from ``hermes_cli/auth.py`` (patch targets unchanged); origin helpers are imported -lazily per function so ``hermes_cli.auth.`` patches still intercept and no cycle forms. +Split out of ``hermes_cli/auth.py``; origin helpers are imported lazily per function so +``hermes_cli.auth.`` patches still intercept and no cycle forms. """ from __future__ import annotations diff --git a/hermes_cli/auth_nous.py b/hermes_cli/auth_nous.py index 9339043578..7ec409f7ab 100644 --- a/hermes_cli/auth_nous.py +++ b/hermes_cli/auth_nous.py @@ -1,7 +1,7 @@ """Nous Portal OAuth: device-code login, refresh, shared-store mirroring, JWT selection, status. -Split out of ``hermes_cli/auth.py`` and re-exported there; origin helpers are imported lazily -inside each function so ``hermes_cli.auth.`` patches still intercept (and no import cycle). +Split out of ``hermes_cli/auth.py``; origin helpers are imported lazily inside each function +so ``hermes_cli.auth.`` patches still intercept (and no import cycle). """ from __future__ import annotations diff --git a/hermes_cli/auth_qwen.py b/hermes_cli/auth_qwen.py index 860a7e37a3..59181f08ed 100644 --- a/hermes_cli/auth_qwen.py +++ b/hermes_cli/auth_qwen.py @@ -1,7 +1,7 @@ """Qwen OAuth (qwen-cli token file) runtime credentials and status. -Re-exported from ``hermes_cli/auth.py`` (patch targets unchanged); origin helpers are imported -lazily per function so ``hermes_cli.auth.`` patches still intercept and no cycle forms. +Split out of ``hermes_cli/auth.py``; origin helpers are imported lazily per function so +``hermes_cli.auth.`` patches still intercept and no cycle forms. """ from __future__ import annotations diff --git a/hermes_cli/auth_xai.py b/hermes_cli/auth_xai.py index dd96bdd3f0..34bb7cb177 100644 --- a/hermes_cli/auth_xai.py +++ b/hermes_cli/auth_xai.py @@ -1,7 +1,7 @@ """xAI Grok OAuth: token store, discovery, refresh, device-code login. -Re-exported from ``hermes_cli/auth.py`` (patch targets unchanged); origin helpers are imported -lazily per function so ``hermes_cli.auth.`` patches still intercept and no cycle forms. +Split out of ``hermes_cli/auth.py``; origin helpers are imported lazily per function so +``hermes_cli.auth.`` patches still intercept and no cycle forms. """ from __future__ import annotations diff --git a/hermes_cli/commands_platforms.py b/hermes_cli/commands_platforms.py index b30f965209..cbccf01a68 100644 --- a/hermes_cli/commands_platforms.py +++ b/hermes_cli/commands_platforms.py @@ -1,7 +1,4 @@ """Gateway platform command derivations (Telegram / Discord / Slack) from ``COMMAND_REGISTRY``. - -:mod:`hermes_cli.commands` lazily re-exports every name here, so -``from hermes_cli.commands import telegram_menu_commands`` keeps working. """ from __future__ import annotations diff --git a/hermes_cli/doctor_config.py b/hermes_cli/doctor_config.py index 53ca085ecc..318132dbdc 100644 --- a/hermes_cli/doctor_config.py +++ b/hermes_cli/doctor_config.py @@ -1,5 +1,5 @@ """Configuration-file checks for hermes doctor: .env, config.yaml validation, drift, deprecations. -Split out of ``hermes_cli/doctor.py``, which re-exports every name so ``hermes_cli.doctor.`` keeps resolving (and monkeypatching).""" +Split out of ``hermes_cli/doctor.py``.""" from __future__ import annotations diff --git a/hermes_cli/runtime_provider_custom.py b/hermes_cli/runtime_provider_custom.py index 29eb851a69..8981ab2368 100644 --- a/hermes_cli/runtime_provider_custom.py +++ b/hermes_cli/runtime_provider_custom.py @@ -1,6 +1,6 @@ """Custom-provider resolution: ``providers:`` / ``custom_providers:`` lookup, identity recovery, custom credential pools, and the named-custom runtime builder. Extracted from -:mod:`hermes_cli.runtime_provider` (every name re-exported there); origin-internal collaborators +:mod:`hermes_cli.runtime_provider`; origin-internal collaborators (``load_config``, ``_get_model_config``, ``load_pool``, ``has_usable_secret``, …) are looked up on the origin module AT CALL TIME via :func:`_rp` so ``monkeypatch.setattr(runtime_provider, name, …)`` keeps working for moved bodies.""" diff --git a/hermes_cli/skills_config.py b/hermes_cli/skills_config.py index e7bcc08789..ba6051bf75 100644 --- a/hermes_cli/skills_config.py +++ b/hermes_cli/skills_config.py @@ -5,7 +5,7 @@ from hermes_cli.config import cfg_get, load_config, save_config from hermes_cli.colors import Colors, color from hermes_cli.platforms import PLATFORMS as _PLATFORMS -# Backward-compatible {key: label} view for callers using ``PLATFORMS.items()`` / ``.get(key)``. +# {key: label} view of the messaging platforms (``PLATFORMS.items()`` / ``.get(key)`` below). PLATFORMS = {k: info.label for k, info in _PLATFORMS.items() if k != "api_server"}