mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-04 17:57:28 +08:00
Root cause: terminal availability checks still imported minisweagent for the local backend even though local/singularity now use Hermes wrappers directly. In git worktrees, the local submodule path may also be an empty placeholder, so direct path insertion could miss the populated mini-swe-agent checkout. This change: - adds a helper to discover mini-swe-agent from the current checkout or the main checkout behind a worktree - uses that helper in terminal_tool and mini_swe_runner - stops requiring minisweagent for the local backend requirements check - adds regression tests and validates terminal/file tool resolution again
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""Tests for terminal/file tool availability in local dev environments."""
|
|
|
|
import importlib
|
|
|
|
from model_tools import get_tool_definitions
|
|
|
|
terminal_tool_module = importlib.import_module("tools.terminal_tool")
|
|
|
|
|
|
class TestTerminalRequirements:
|
|
def test_local_backend_does_not_require_minisweagent_package(self, monkeypatch):
|
|
monkeypatch.setattr(
|
|
terminal_tool_module,
|
|
"_get_env_config",
|
|
lambda: {"env_type": "local"},
|
|
)
|
|
assert terminal_tool_module.check_terminal_requirements() is True
|
|
|
|
def test_terminal_and_file_tools_resolve_for_local_backend(self, monkeypatch):
|
|
monkeypatch.setattr(
|
|
terminal_tool_module,
|
|
"_get_env_config",
|
|
lambda: {"env_type": "local"},
|
|
)
|
|
tools = get_tool_definitions(enabled_toolsets=["terminal", "file"], quiet_mode=True)
|
|
names = {tool["function"]["name"] for tool in tools}
|
|
assert "terminal" in names
|
|
assert {"read_file", "write_file", "patch", "search_files"}.issubset(names)
|