The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: send_message to a Home Assistant target names the install command while its plugin is absent
teknium1f7689f40a400
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.pyindex ba46de00f0e..790140093fb 100644--- a/hermes_cli/left_core_migration.py+++ b/hermes_cli/left_core_migration.py@@ -136,6 +136,17 @@ LEFT_CORE: tuple[LeftCoreFeature, ...] = (),)+def platform_install_hint(platform: str) -> str:+ """For an unknown platform name that left core: the sentence that names its install command for+ the active home, else ``""``. Appended to "unknown platform" errors (``send_message``)."""+ from hermes_constants import get_hermes_home+ feature = next((f for f in LEFT_CORE if f.platform and f.platform == platform), None)+ if feature is None:+ return ""+ return (f". {feature.label} moved out of core into the '{feature.plugin}' plugin: install it with "+ f"`{_install_command(feature.plugin, Path(get_hermes_home()))}`")++_attempted: set[str] = set()_undelivered: dict[str, list[str]] = {}diff --git a/tests/tools/test_send_message_target_parse.py b/tests/tools/test_send_message_target_parse.pyindex 4f329263af0..bb8644e4d90 100644--- a/tests/tools/test_send_message_target_parse.py+++ b/tests/tools/test_send_message_target_parse.py@@ -582,3 +582,18 @@ def test_plugin_parser_stays_authoritative_despite_fallback() -> None:assert chat_id is Noneassert error is not None+++def test_unknown_platform_that_left_core_names_its_install_command(tmp_path, monkeypatch):+ """A platform that moved out of core into a catalog plugin, sent to while the plugin is absent."""+ from gateway.config import GatewayConfig+ from tools.send_message_targets import resolve_send_target+ from tools.send_message_tool import _resolve_platform_config++ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ _, _, _, err = _resolve_platform_config("homeassistant", GatewayConfig())+ assert "unregistered plugin platform: homeassistant" in err and "`hermes plugins install homeassistant`" in err+ _, _, err = resolve_send_target("homeassistant", "living room")+ assert "`hermes plugins install homeassistant`" in err+ _, _, _, err = _resolve_platform_config("nosuchplatform", GatewayConfig())+ assert err == "Unknown or unregistered plugin platform: nosuchplatform"diff --git a/tools/send_message_targets.py b/tools/send_message_targets.pyindex 7e630b471e3..3d8acae0663 100644--- a/tools/send_message_targets.py+++ b/tools/send_message_targets.py@@ -137,6 +137,11 @@ def _parse_target_ref(platform_name: str, target_ref: str):return None, None, False+def unknown_platform_error(platform_name: str) -> str:+ from hermes_cli.left_core_migration import platform_install_hint+ return f"Unknown or unregistered plugin platform: {platform_name}{platform_install_hint(platform_name)}"++def resolve_send_target(platform_name: str, target_ref: str, *, pass_unresolved_references: bool = False) -> tuple[str | None, str | None, str | None]:@@ -189,7 +194,7 @@ def resolve_send_target(return _validated(parsed_chat_id or resolved, parsed_thread_id)is_builtin = platform_name in {member.value for member in Platform}if entry is None and not is_builtin:- return None, None, f"Unknown or unregistered plugin platform: {platform_name}"+ return None, None, unknown_platform_error(platform_name)is_plugin = entry is not None and entry.source == "plugin" and not is_builtinif pass_unresolved_references and (not is_plugin or entry.parse_target_ref_fn is None):# Hand the raw target to the adapter unchanged (it validates).diff --git a/tools/send_message_tool.py b/tools/send_message_tool.pyindex a8d5ba667a2..1967f73c431 100644--- a/tools/send_message_tool.py+++ b/tools/send_message_tool.py@@ -11,7 +11,9 @@ from agent.secret_scope import get_secretlogger = logging.getLogger(__name__)-from tools.send_message_targets import _HOME_CHANNEL_ENV_OVERRIDES, _SLACK_USER_ID_RE, resolve_send_target+from tools.send_message_targets import (+ _HOME_CHANNEL_ENV_OVERRIDES, _SLACK_USER_ID_RE, resolve_send_target, unknown_platform_error,+)from tools.send_message_senders import (_AUDIO_EXTS, _DEFAULT_CAPTION_LIMIT, _IMAGE_EXTS, _NO_DELIVERABLE, _VIDEO_EXTS, _VOICE_EXTS,_adapter_media_method, _error, _live_adapter, _media_caption_split, _plugin_standalone_sender,@@ -310,7 +312,7 @@ def _resolve_platform_config(platform_name, config):from gateway.platform_registry import platform_registryentry = platform_registry.get(platform_name)if entry is None and platform_name not in {member.value for member in Platform}:- return None, None, None, f"Unknown or unregistered plugin platform: {platform_name}"+ return None, None, None, unknown_platform_error(platform_name)platform, err = _platform_enum(platform_name)if err:return None, None, None, err