mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-01 01:51:44 +00:00
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:
parent
65ca3ba93b
commit
4b16341975
898 changed files with 12494 additions and 12019 deletions
|
|
@ -16,7 +16,7 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from hermes_cli.plugins import (
|
||||
from hermes_agent.cli.plugins import (
|
||||
PluginContext,
|
||||
PluginManager,
|
||||
PluginManifest,
|
||||
|
|
@ -92,9 +92,9 @@ class TestMemoryPluginCliDiscovery:
|
|||
" subparser.add_argument('--other')\n"
|
||||
)
|
||||
|
||||
import plugins.memory as pm
|
||||
import hermes_agent.plugins.memory as pm
|
||||
original_dir = pm._MEMORY_PLUGINS_DIR
|
||||
mod_key = "plugins.memory.testplugin.cli"
|
||||
mod_key = "hermes_agent.plugins.memory.testplugin.cli"
|
||||
sys.modules.pop(mod_key, None)
|
||||
|
||||
monkeypatch.setattr(pm, "_MEMORY_PLUGINS_DIR", tmp_path)
|
||||
|
|
@ -122,7 +122,7 @@ class TestMemoryPluginCliDiscovery:
|
|||
"def register_cli(subparser):\n pass\n"
|
||||
)
|
||||
|
||||
import plugins.memory as pm
|
||||
import hermes_agent.plugins.memory as pm
|
||||
original_dir = pm._MEMORY_PLUGINS_DIR
|
||||
monkeypatch.setattr(pm, "_MEMORY_PLUGINS_DIR", tmp_path)
|
||||
monkeypatch.setattr(pm, "_get_active_memory_provider", lambda: None)
|
||||
|
|
@ -140,7 +140,7 @@ class TestMemoryPluginCliDiscovery:
|
|||
(plugin_dir / "__init__.py").write_text("pass\n")
|
||||
(plugin_dir / "cli.py").write_text("def some_other_fn():\n pass\n")
|
||||
|
||||
import plugins.memory as pm
|
||||
import hermes_agent.plugins.memory as pm
|
||||
original_dir = pm._MEMORY_PLUGINS_DIR
|
||||
monkeypatch.setattr(pm, "_MEMORY_PLUGINS_DIR", tmp_path)
|
||||
monkeypatch.setattr(pm, "_get_active_memory_provider", lambda: "noplugin")
|
||||
|
|
@ -148,7 +148,7 @@ class TestMemoryPluginCliDiscovery:
|
|||
cmds = pm.discover_plugin_cli_commands()
|
||||
finally:
|
||||
monkeypatch.setattr(pm, "_MEMORY_PLUGINS_DIR", original_dir)
|
||||
sys.modules.pop("plugins.memory.noplugin.cli", None)
|
||||
sys.modules.pop("hermes_agent.plugins.memory.noplugin.cli", None)
|
||||
|
||||
assert len(cmds) == 0
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ class TestMemoryPluginCliDiscovery:
|
|||
plugin_dir.mkdir()
|
||||
(plugin_dir / "__init__.py").write_text("pass\n")
|
||||
|
||||
import plugins.memory as pm
|
||||
import hermes_agent.plugins.memory as pm
|
||||
original_dir = pm._MEMORY_PLUGINS_DIR
|
||||
monkeypatch.setattr(pm, "_MEMORY_PLUGINS_DIR", tmp_path)
|
||||
monkeypatch.setattr(pm, "_get_active_memory_provider", lambda: "nocli")
|
||||
|
|
@ -179,7 +179,7 @@ class TestMemoryPluginCliDiscovery:
|
|||
class TestProviderCollectorCliNoop:
|
||||
def test_register_cli_command_is_noop(self):
|
||||
"""_ProviderCollector.register_cli_command is a no-op (doesn't crash)."""
|
||||
from plugins.memory import _ProviderCollector
|
||||
from hermes_agent.plugins.memory import _ProviderCollector
|
||||
|
||||
collector = _ProviderCollector()
|
||||
collector.register_cli_command(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue