simplify(compat): hermes_state — drop 81 re-exports + 3 registry aliases + 3 shims, repoint 45 callers + 60 test files
hermes_state.py: delete every '# noqa: F401 (re-exported...)' import block (hermes_state_common/errors/guard/
readpool/sessions/fts/dbfile/wal/repair/registry + agent.context_compressor _DB_PERSISTED_MARKER_KEY); keep
only the names hermes_state.py itself uses, without noqa.
hermes_state_registry.py: drop get_shared_session_db/release_shared_session_db/close_shared_session_dbs
aliases; every caller (gateway/, tools/, tui_gateway/, cron/, mcp_serve, run_agent, tests) now imports
acquire/release/close_all/release_or_close from hermes_state_registry.
hermes_state_titles.py: drop set_auto_title_if_empty shim (title_generator keeps its getattr fallback).
Re-remove shim-only names restored by 34abf954bd: latest_user_message_row_id (tests call
latest_message_row_id(key, role='user'); role-targeting assertions kept) and get_session_activity (tests
build the snapshot via agent.session_activity.build_activity_snapshot over db.get_session(sid)).
hermes_state_wal._log_once resolves its dedupe sets as module globals instead of via hermes_state;
hermes_state_repair helpers call module globals directly (tests patch hermes_state_repair.<name>).
Frozen updater surface untouched (update_cmd_maint imports only SessionDB from hermes_state).
This commit is contained in:
+3
-3
@@ -78,8 +78,8 @@ def _close_quietly(db, what: str) -> None:
|
||||
def _get_session_db():
|
||||
"""SessionDB instance for reading message transcripts, or None."""
|
||||
try:
|
||||
from hermes_state import get_shared_session_db
|
||||
return get_shared_session_db()
|
||||
from hermes_state_registry import acquire
|
||||
return acquire()
|
||||
except Exception as e:
|
||||
logger.debug("SessionDB unavailable: %s", e)
|
||||
return None
|
||||
@@ -96,7 +96,7 @@ def _load_session_messages(session_id: str):
|
||||
return None, f"Failed to read messages: {e}"
|
||||
finally:
|
||||
try:
|
||||
from hermes_state import release_or_close
|
||||
from hermes_state_registry import release_or_close
|
||||
release_or_close(db)
|
||||
except Exception:
|
||||
logger.debug("Failed to close MCP SessionDB", exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user