mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Deep scan with vulture, pyflakes, and manual cross-referencing identified: - 41 dead functions/methods (zero callers in production) - 7 production-dead functions (only test callers, tests deleted) - 5 dead constants/variables - ~35 unused imports across agent/, hermes_cli/, tools/, gateway/ Categories of dead code removed: - Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection, rebuild_lookups, clear_session_context, get_logs_dir, clear_session - Unused API surface: search_models_dev, get_pricing, skills_categories, get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list - Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob - Stale debug helpers: get_debug_session_info copies in 4 tool files (centralized version in debug_helpers.py already exists) - Dead gateway methods: send_emote, send_notice (matrix), send_reaction (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history (matrix), _start_typing_indicator (signal), parse_feishu_post_content - Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION, FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR - Unused UI code: _interactive_provider_selection, _interactive_model_selection (superseded by prompt_toolkit picker) Test suite verified: 609 tests covering affected files all pass. Tests for removed functions deleted. Tests using removed utilities (clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
50 lines
1.9 KiB
Python
50 lines
1.9 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_requirements(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)
|
|
|
|
def test_terminal_and_execute_code_tools_resolve_for_managed_modal(self, monkeypatch, tmp_path):
|
|
monkeypatch.setenv("HERMES_ENABLE_NOUS_MANAGED_TOOLS", "1")
|
|
monkeypatch.setenv("HOME", str(tmp_path))
|
|
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
|
monkeypatch.delenv("MODAL_TOKEN_ID", raising=False)
|
|
monkeypatch.delenv("MODAL_TOKEN_SECRET", raising=False)
|
|
monkeypatch.setattr(
|
|
terminal_tool_module,
|
|
"_get_env_config",
|
|
lambda: {"env_type": "modal", "modal_mode": "managed"},
|
|
)
|
|
monkeypatch.setattr(
|
|
terminal_tool_module,
|
|
"is_managed_tool_gateway_ready",
|
|
lambda _vendor: True,
|
|
)
|
|
tools = get_tool_definitions(enabled_toolsets=["terminal", "code_execution"], quiet_mode=True)
|
|
names = {tool["function"]["name"] for tool in tools}
|
|
|
|
assert "terminal" in names
|
|
assert "execute_code" in names
|