refactor(restructure): rewrite all imports for hermes_agent package

Rewrite all import statements, patch() targets, sys.modules keys,
importlib.import_module() strings, and subprocess -m references to use
hermes_agent.* paths.

Strip sys.path.insert hacks from production code (rely on editable install).
Update COMPONENT_PREFIXES for logger filtering.
Fix 3 hardcoded getLogger() calls to use __name__.
Update transport and tool registry discovery paths.
Update plugin module path strings.
Add legacy process-name patterns for gateway PID detection.
Add main() to skills_sync for console_script entry point.
Fix _get_bundled_dir() path traversal after move.

Part of #14182, #14183
This commit is contained in:
alt-glitch 2026-04-23 08:35:34 +05:30
parent 65ca3ba93b
commit 4b16341975
898 changed files with 12494 additions and 12019 deletions

View file

@ -1,10 +1,10 @@
import pytest
from unittest.mock import MagicMock, patch
from hermes_cli.plugins import VALID_HOOKS, PluginManager
from hermes_agent.cli.plugins import VALID_HOOKS, PluginManager
import os
import shutil
import tempfile
from cli import HermesCLI
from hermes_agent.cli.repl import HermesCLI
def test_session_hooks_in_valid_hooks():
@ -13,7 +13,7 @@ def test_session_hooks_in_valid_hooks():
assert "on_session_reset" in VALID_HOOKS
@patch("hermes_cli.plugins.invoke_hook")
@patch("hermes_agent.cli.plugins.invoke_hook")
def test_session_finalize_on_reset(mock_invoke_hook):
"""Verify on_session_finalize fires when /new or /reset is used."""
cli = HermesCLI()
@ -33,10 +33,10 @@ def test_session_finalize_on_reset(mock_invoke_hook):
)
@patch("hermes_cli.plugins.invoke_hook")
@patch("hermes_agent.cli.plugins.invoke_hook")
def test_session_finalize_on_cleanup(mock_invoke_hook):
"""Verify on_session_finalize fires during CLI exit cleanup."""
import cli as cli_mod
import hermes_agent.cli.repl as cli_mod
mock_agent = MagicMock()
mock_agent.session_id = "cleanup-session-id"
@ -50,7 +50,7 @@ def test_session_finalize_on_cleanup(mock_invoke_hook):
)
@patch("hermes_cli.plugins.invoke_hook")
@patch("hermes_agent.cli.plugins.invoke_hook")
def test_hook_errors_are_caught(mock_invoke_hook):
"""Verify hook exceptions are caught and don't crash the agent."""
mgr = PluginManager()