mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +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
|
|
@ -21,15 +21,15 @@ class TestSaveConfigValueAtomic:
|
|||
"model": {"default": "test-model", "provider": "openrouter"},
|
||||
"display": {"skin": "default"},
|
||||
}))
|
||||
monkeypatch.setattr("cli._hermes_home", hermes_home)
|
||||
monkeypatch.setattr("hermes_agent.cli.repl._hermes_home", hermes_home)
|
||||
return config_path
|
||||
|
||||
def test_calls_atomic_yaml_write(self, config_env, monkeypatch):
|
||||
"""save_config_value must route through atomic_yaml_write, not bare open()."""
|
||||
mock_atomic = MagicMock()
|
||||
monkeypatch.setattr("utils.atomic_yaml_write", mock_atomic)
|
||||
monkeypatch.setattr("hermes_agent.utils.atomic_yaml_write", mock_atomic)
|
||||
|
||||
from cli import save_config_value
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
save_config_value("display.skin", "mono")
|
||||
|
||||
mock_atomic.assert_called_once()
|
||||
|
|
@ -39,8 +39,8 @@ class TestSaveConfigValueAtomic:
|
|||
|
||||
def test_preserves_existing_keys(self, config_env):
|
||||
"""Writing a new key must not clobber existing config entries."""
|
||||
from cli import save_config_value
|
||||
save_config_value("agent.max_turns", 50)
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
save_config_value("hermes_agent.agent.max_turns", 50)
|
||||
|
||||
result = yaml.safe_load(config_env.read_text())
|
||||
assert result["model"]["default"] == "test-model"
|
||||
|
|
@ -50,7 +50,7 @@ class TestSaveConfigValueAtomic:
|
|||
|
||||
def test_creates_nested_keys(self, config_env):
|
||||
"""Dot-separated paths create intermediate dicts as needed."""
|
||||
from cli import save_config_value
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
save_config_value("auxiliary.compression.model", "google/gemini-3-flash-preview")
|
||||
|
||||
result = yaml.safe_load(config_env.read_text())
|
||||
|
|
@ -58,7 +58,7 @@ class TestSaveConfigValueAtomic:
|
|||
|
||||
def test_overwrites_existing_value(self, config_env):
|
||||
"""Updating an existing key replaces the value."""
|
||||
from cli import save_config_value
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
save_config_value("display.skin", "ares")
|
||||
|
||||
result = yaml.safe_load(config_env.read_text())
|
||||
|
|
@ -75,7 +75,7 @@ class TestSaveConfigValueAtomic:
|
|||
"model": {"default": "test-model", "provider": "openrouter"},
|
||||
}))
|
||||
|
||||
from cli import save_config_value
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
save_config_value("model.default", "doubao-pro")
|
||||
|
||||
result = yaml.safe_load(config_env.read_text())
|
||||
|
|
@ -89,9 +89,9 @@ class TestSaveConfigValueAtomic:
|
|||
def exploding_write(*args, **kwargs):
|
||||
raise OSError("disk full")
|
||||
|
||||
monkeypatch.setattr("utils.atomic_yaml_write", exploding_write)
|
||||
monkeypatch.setattr("hermes_agent.utils.atomic_yaml_write", exploding_write)
|
||||
|
||||
from cli import save_config_value
|
||||
from hermes_agent.cli.repl import save_config_value
|
||||
result = save_config_value("display.skin", "broken")
|
||||
|
||||
assert result is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue