Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 10 additions & 5 deletions dashboard/plugin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
*,
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion desktop/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 4 additions & 4 deletions tests/test_desktop_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions tests/test_plugin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down