The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(stt): look up whisper.cpp through pm directly
ethernet683e845357d3
diff --git a/hermes_platform/resolver/whisper.py b/hermes_platform/resolver/whisper.pydeleted file mode 100644index 72daa37cc58..00000000000--- a/hermes_platform/resolver/whisper.py+++ /dev/null@@ -1,10 +0,0 @@-"""Passive lookup of the managed whisper.cpp executable; never provisions it."""--from pathlib import Path---def whisper_cpp_binary() -> Path | None:- from pm import installed_package-- installed = installed_package("whispercpp-cpu")- return installed.binary if installed else Nonediff --git a/tests/tools/test_transcription_whisper_cpp.py b/tests/tools/test_transcription_whisper_cpp.pyindex 9c7039e3c4c..076c2c33a64 100644--- a/tests/tools/test_transcription_whisper_cpp.py+++ b/tests/tools/test_transcription_whisper_cpp.py@@ -5,6 +5,7 @@ import threadingfrom functools import partialfrom http.server import SimpleHTTPRequestHandler, ThreadingHTTPServerfrom pathlib import Path+from types import SimpleNamespaceimport pytest@@ -64,6 +65,7 @@ def test_local_resolution_is_passive_and_command_override_wins(tmp_path, monkeypfrom tools import transcription_local as localfrom tools import transcription_tools as sttfrom tools import transcription_whisper_cpp as cpp+ import pmfrom pm.packages import WhisperCppCpufrom pm.store import ALL_TARGETS@@ -71,7 +73,9 @@ def test_local_resolution_is_passive_and_command_override_wins(tmp_path, monkeypassert [t for t in ALL_TARGETS if package.missing_reason(t) is None] == ["win32-arm64"]monkeypatch.delenv("HERMES_LOCAL_STT_COMMAND", raising=False)monkeypatch.setenv("HERMES_HOME", str(tmp_path / "profile with spaces"))- monkeypatch.setattr(cpp, "whisper_cpp_binary", lambda: tmp_path / "program files" / "whisper-cli.exe")+ binary = tmp_path / "program files" / "whisper-cli.exe"+ monkeypatch.setattr(pm, "installed_package",+ lambda name: SimpleNamespace(binary=binary) if name == "whispercpp-cpu" else None)monkeypatch.setattr(stt, "_HAS_FASTER_WHISPER", False)calls = []monkeypatch.setattr(cpp, "ensure_whisper_cpp_models", lambda model: calls.append(model))diff --git a/tools/transcription_whisper_cpp.py b/tools/transcription_whisper_cpp.pyindex 0ab9616b61d..5c588891fd7 100644--- a/tools/transcription_whisper_cpp.py+++ b/tools/transcription_whisper_cpp.py@@ -7,7 +7,6 @@ import shlexfrom pathlib import Pathfrom hermes_constants import get_hermes_home-from hermes_platform.resolver.whisper import whisper_cpp_binarylogger = logging.getLogger("tools.transcription_tools")@@ -40,9 +39,13 @@ def _file_signature(path: Path, digest: str) -> tuple | None:def whisper_cpp_command() -> str | None:- binary = whisper_cpp_binary()- if binary is None:+ import pm++ # Passive: an engine the install does not carry is absent, never fetched here.+ installed = pm.installed_package("whispercpp-cpu")+ if installed is None:return None+ binary = installed.binarymodels = _model_dir()# The existing command adapter tokenizes with shlex, including on Windows.quote = lambda path: shlex.quote(path.as_posix())