diff --git a/dashboard/manifest.json b/dashboard/manifest.json index b8e70b6..6feb2e1 100644 --- a/dashboard/manifest.json +++ b/dashboard/manifest.json @@ -3,7 +3,7 @@ "label": "Memory", "description": "Read-only Hermes dashboard plugin for built-in, holographic, Mem0, Honcho, Mnemosyne, Hindsight, and ByteRover memory.", "icon": "Database", - "version": "0.7.1", + "version": "0.7.2", "tab": { "path": "/memory", "position": "after:config" diff --git a/dashboard/plugin_api.py b/dashboard/plugin_api.py index d7a9875..e041000 100644 --- a/dashboard/plugin_api.py +++ b/dashboard/plugin_api.py @@ -65,7 +65,7 @@ async def _check_routed_profile(profile: Optional[str] = Query(None)): router = APIRouter(dependencies=[Depends(_check_routed_profile)]) -PLUGIN_VERSION = "0.7.1" +PLUGIN_VERSION = "0.7.2" ENTRY_DELIMITER = "\n§\n" DEFAULT_MEMORY_LIMIT = 2200 DEFAULT_USER_LIMIT = 1375 @@ -1069,6 +1069,11 @@ def _honcho_search_results(base: Dict[str, Any], search: Optional[str], limit: i return results[:limit] +def _honcho_peer_id(name: str) -> str: + # Match Honcho's peer normalization, not its session-title slug. + return re.sub(r"[^a-zA-Z0-9_-]", "-", name) + + def _honcho_payload( config: Optional[Dict[str, Any]] = None, *, @@ -1077,6 +1082,8 @@ def _honcho_payload( ) -> Dict[str, Any]: config = config if config is not None else _read_yaml(_hermes_home() / "config.yaml") honcho_cfg = _honcho_config_payload(config) + user_peer_id = _honcho_peer_id(str(honcho_cfg["user_peer"] or "").strip() or "user") + ai_peer_id = _honcho_peer_id(str(honcho_cfg["ai_peer"] or honcho_cfg["host"] or "hermes")) search = search if isinstance(search, str) and search.strip() else None try: limit = int(limit or DEFAULT_HONCHO_LIMIT) @@ -1113,8 +1120,8 @@ def _honcho_payload( "ai_observe_me": honcho_cfg["ai_observe_me"], "ai_observe_others": honcho_cfg["ai_observe_others"], "explicitly_configured": honcho_cfg["explicitly_configured"], - "user": {"peer_id": honcho_cfg["user_peer"], "card": [], "representation": "", "conclusions": [], "total_conclusions": 0, "total_card_facts": 0}, - "ai": {"peer_id": honcho_cfg["ai_peer"], "card": [], "representation": "", "conclusions": [], "total_conclusions": 0, "total_card_facts": 0}, + "user": {"peer_id": user_peer_id, "card": [], "representation": "", "conclusions": [], "total_conclusions": 0, "total_card_facts": 0}, + "ai": {"peer_id": ai_peer_id, "card": [], "representation": "", "conclusions": [], "total_conclusions": 0, "total_card_facts": 0}, "search_results": [], "search_result_count": 0, "limit": limit, @@ -1133,8 +1140,6 @@ def _honcho_payload( get_honcho_client = _honcho_client_module().get_honcho_client client = get_honcho_client(cfg) - user_peer_id = str(honcho_cfg["user_peer"] or "user") - ai_peer_id = str(honcho_cfg["ai_peer"] or honcho_cfg["host"] or "hermes") user_peer_obj = client.peer(user_peer_id) ai_peer_obj = client.peer(ai_peer_id) base["user"].update(_call_peer_context(user_peer_obj, target=user_peer_id, search=search, limit=limit)) diff --git a/desktop/plugin.js b/desktop/plugin.js index 379d4a2..46fb255 100644 --- a/desktop/plugin.js +++ b/desktop/plugin.js @@ -25,7 +25,7 @@ import { import { useEffect, useMemo, useState } from 'react' import { Fragment, jsx, jsxs } from 'react/jsx-runtime' -const VERSION = '0.7.1' +const VERSION = '0.7.2' const PLUGIN_ID = 'hermes-memory-ui' const PLUGIN_NAME = 'Hermes Memory UI' const PLUGIN_ROUTE = '/memory' diff --git a/plugin.yaml b/plugin.yaml index 902e5de..2706f75 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ manifest_version: 1 name: hermes-memory-ui -version: 0.7.1 +version: 0.7.2 description: "Read-only Hermes Dashboard and Desktop plugin for inspecting built-in, holographic, Mem0, Honcho, Mnemosyne, Hindsight, and ByteRover memory." homepage: "https://github.com/xraysight/hermes-memory-ui" diff --git a/tests/test_desktop_plugin.py b/tests/test_desktop_plugin.py index 12ffd5b..ae04476 100644 --- a/tests/test_desktop_plugin.py +++ b/tests/test_desktop_plugin.py @@ -190,10 +190,10 @@ def test_desktop_release_version_and_documentation_are_consistent(): plugin_api = (ROOT / "dashboard" / "plugin_api.py").read_text(encoding="utf-8") readme = (ROOT / "README.md").read_text(encoding="utf-8") - assert re.search(r"^version:\s*0\.7\.1\s*$", plugin_yaml, re.MULTILINE) - assert manifest["version"] == "0.7.1" - assert 'PLUGIN_VERSION = "0.7.1"' in plugin_api - assert "const VERSION = '0.7.1'" in source + assert re.search(r"^version:\s*0\.7\.2\s*$", plugin_yaml, re.MULTILINE) + assert manifest["version"] == "0.7.2" + assert 'PLUGIN_VERSION = "0.7.2"' in plugin_api + assert "const VERSION = '0.7.2'" in source assert "Hermes Desktop" in readme assert "$HERMES_HOME/desktop-plugins/hermes-memory-ui/plugin.js" in readme assert "Settings" in readme and "Plugins" in readme diff --git a/tests/test_plugin_api.py b/tests/test_plugin_api.py index 1be3f78..dcadccc 100644 --- a/tests/test_plugin_api.py +++ b/tests/test_plugin_api.py @@ -633,6 +633,33 @@ def test_honcho_payload_hides_api_key_and_fetches_peer_context(monkeypatch, tmp_ assert ("context", "hermes", {"target": "hermes", "search_query": "xraysight", "search_top_k": 5}) in calls +def test_honcho_payload_uses_provider_peer_ids(monkeypatch, tmp_path): + (tmp_path / "config.yaml").write_text("memory:\n provider: honcho\n", encoding="utf-8") + calls = [] + install_fake_honcho_client(monkeypatch, tmp_path, calls) + config = sys.modules["plugins.memory.honcho.client"].HonchoClientConfig + monkeypatch.setattr(config, "peer_name", " Owner Name ") + monkeypatch.setattr(config, "ai_peer", "-RU Risk-") + + module = load_plugin_api(monkeypatch, tmp_path) + payload = module._honcho_payload(limit=5, search="Risk") + + assert payload["error"] is None + assert [call for call in calls if call[0] == "peer"] == [ + ("peer", "Owner--Name"), ("peer", "-RU--Risk-"), + ] + assert [(call[1], call[2]["target"]) for call in calls if call[0] == "context"] == [ + ("Owner--Name", "Owner--Name"), ("-RU--Risk-", "-RU--Risk-"), + ] + assert [call for call in calls if call[0] == "conclusions_of"] == [ + ("conclusions_of", "-RU--Risk-", "Owner--Name"), + ("conclusions_of", "-RU--Risk-", "-RU--Risk-"), + ] + assert (payload["user_peer"], payload["ai_peer"]) == (" Owner Name ", "-RU Risk-") + assert (payload["user"]["peer_id"], payload["ai"]["peer_id"]) == ("Owner--Name", "-RU--Risk-") + assert [item["peer_id"] for item in payload["search_results"]] == ["-RU--Risk-"] * 3 + + def test_honcho_payload_resolves_externally_installed_provider(monkeypatch, tmp_path): """Honcho installed as a catalog plugin is not importable as plugins.memory.honcho.