The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(hermes_cli): group module-level constants in session modules
Tekniumc88d60551ec1
diff --git a/hermes_cli/session_lost_and_found.py b/hermes_cli/session_lost_and_found.pyindex 031eb98d704..bea2036ff5e 100644--- a/hermes_cli/session_lost_and_found.py+++ b/hermes_cli/session_lost_and_found.py@@ -19,7 +19,6 @@ from hermes_cli.session_recovery import (# Hermes session ids are timestamps (20260812_135332_ab12cd): the strongest sentinel for schema-less rows.SESSION_ID_PATTERN = re.compile(r"^\d{8}_\d{6}_")-MESSAGE_ROLES = frozenset({"user", "assistant", "tool", "system"})# Values observed in sessions.source across gateway platforms and tooling.@@ -37,7 +36,6 @@ SESSION_MODEL_USAGE_NFIELD = 18# Plausible unix-epoch window for started_at heuristics on legacy layouts._EPOCH_LOW = 1_000_000_000.0 # 2001_EPOCH_HIGH = 4_000_000_000.0 # 2096-SQLITE3_CLI_GUIDANCE = ("A last-resort page-level salvage is available when a `.recover`-capable `sqlite3` command-line shell is ""installed: its `.recover` command can rebuild rows into lost_and_found tables even when the table schemas are "@@ -281,7 +279,8 @@ def map_lost_and_found_rows(lf_conn: sqlite3.Connection, dest: sqlite3.Connectio# Pre-modern layout with unknown column order: salvage identity + timing only.row_values = (cells[0], cells[1] if _looks_like_source(cells[1]) else "recovered",- _heuristic_started_at(cells), "[best-effort recovered] legacy session row (layout unknown)",+ _heuristic_started_at(cells),+ "[best-effort recovered] legacy session row (layout unknown)",)inserted = dest.execute("INSERT OR IGNORE INTO sessions (id, source, started_at, title) VALUES (?, ?, ?, ?)",diff --git a/hermes_cli/session_recovery.py b/hermes_cli/session_recovery.pyindex 512a9162634..b2640d43b6e 100644--- a/hermes_cli/session_recovery.py+++ b/hermes_cli/session_recovery.py@@ -20,12 +20,10 @@ from hermes_state import (FTS_STORAGE_VERSION, SCHEMA_VERSION, SessionDB, _db_opProgressCallback = Callable[[dict[str, Any]], None]-_CANONICAL_TABLES = ("system_prompts", "sessions", "messages", "session_model_usage", "compression_locks", "gateway_routing","async_delegations",)-_TOPIC_TABLES = ("telegram_dm_topic_mode", "telegram_dm_topic_bindings")@@ -40,9 +38,7 @@ def _init_delivery_ledger_schema(conn: sqlite3.Connection) -> None:_AUXILIARY_TABLE_SCHEMAS: dict[str, Callable[[sqlite3.Connection], None]] = {"delivery_obligations": _init_delivery_ledger_schema,}-_AUXILIARY_TABLES = tuple(_AUXILIARY_TABLE_SCHEMAS)-_INVENTORY_TABLES = (*_CANONICAL_TABLES, "state_meta", *_TOPIC_TABLES, *_AUXILIARY_TABLES)# Derived-index / optional-schema markers: a fresh destination regenerates these, never copies them.@@ -50,7 +46,6 @@ _GENERATED_META_KEYS = frozenset({"fts_storage_version", "fts_optimize_available", "fts_rebuild_high_water", "fts_rebuild_progress","fts_cjk_stale", "fts_cjk_rebuild_high_water", "fts_cjk_rebuild_progress", "telegram_dm_topic_schema_version",})-_SIDECAR_SUFFIXES = ("", "-wal", "-shm", "-journal")_MINIMUM_SPACE_HEADROOM = 256 * 1024 * 1024_MAX_SALVAGE_RANGE_QUERIES = 10_000diff --git a/hermes_cli/sessions_cmd.py b/hermes_cli/sessions_cmd.pyindex 118d076045f..a1916f5b3b4 100644--- a/hermes_cli/sessions_cmd.py+++ b/hermes_cli/sessions_cmd.py@@ -929,7 +929,6 @@ def _cmd_stats(db, args):# -- dispatch -----------------------------------------------------------------_PRE_DB_HANDLERS = {"repair": _cmd_repair, "recover": _cmd_recover, "import": _cmd_import}-_DB_HANDLERS = {"list": _cmd_list, "export": _cmd_export, "delete": _cmd_delete, "rename": _cmd_rename, "pinned": _cmd_pinned,"prune": partial(_cmd_prune_or_archive, action="prune"), "pin": partial(_cmd_pin, pinning=True),