The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(state): squeeze blank-line runs between constants (AST-neutral)
Tekniumacb12608e45c
diff --git a/hermes_state_common.py b/hermes_state_common.pyindex 0cd448fc06b..e1347b0facd 100644--- a/hermes_state_common.py+++ b/hermes_state_common.py@@ -139,7 +139,6 @@ _PREVIEW_RAW_SUBQUERY_SQL = (f" ORDER BY m.timestamp, m.id LIMIT 1), '') AS _preview_raw")-# ── Session lineage predicates ({a} = sessions alias) ───────────────────────# A /branch child (kept visible, never cascade-deleted): stable marker OR the@@ -280,7 +279,6 @@ SCHEMA_VERSION = 28# freelist; below it a full rewrite costs more I/O than it returns.AUTO_VACUUM_MIN_FREELIST_RATIO = 0.25-# FTS storage layout, tracked INDEPENDENTLY of SCHEMA_VERSION (state_meta# ``fts_storage_version``): the schema version advances freely on open, but# the FTS layout only changes when a DB is born fresh or explicitly optimized@@ -288,11 +286,9 @@ AUTO_VACUUM_MIN_FREELIST_RATIO = 0.25# absent) with a working inline index. 1 = v23 external-content layout.FTS_STORAGE_VERSION = 1-# Cap on user-controlled FTS5 query input before sanitizer processing.MAX_FTS5_QUERY_CHARS = 2_048-# ── Helpers shared by SessionDB, its mixins and the registry ──────────────def stat_db_file_identity(path) -> "tuple[int, int] | None":@@ -556,7 +552,6 @@ CREATE INDEX IF NOT EXISTS idx_async_delegations_deliveryON async_delegations(delivery_state, completed_at);"""-# Indexes on columns added in later schema versions must run AFTER# _reconcile_columns() adds them, or executescript fails on legacy DBs.DEFERRED_INDEX_SQL = """@@ -574,7 +569,6 @@ CREATE INDEX IF NOT EXISTS idx_sessions_system_prompt_hashON sessions(system_prompt_hash);"""-# ── Deferred FTS rebuild bookkeeping ──# While a background rebuild is pending, two state_meta keys define which rows# are IN the FTS indexes: H = fts_rebuild_high_water (MAX(messages.id) when the@@ -635,7 +629,6 @@ BEGINEND;"""-# Trigram FTS5 table for CJK substring search (unicode61 splits CJK into single# tokens, breaking phrase matching). The trigram index is ~2.6x the text it# covers and ``role='tool'`` rows are ~90% of message bytes of machine noise,@@ -703,13 +696,11 @@ _FTS_CJK_TRIGGERS = ("messages_fts_cjk_insert", "messages_fts_cjk_delete", "messages_fts_cjk_update",)-# Set when a tokenizer-less process dropped the cjk triggers to keep writes# alive: the cjk index is missing rows and must not serve reads until# `hermes sessions optimize-storage` rebuilds it on a capable host.FTS_CJK_STALE_KEY = "fts_cjk_stale"-# Set when a base/trigram FTS index was detached after runtime corruption.# While present, startup must rebuild the complete index before reinstalling# sync triggers: rows written while they were absent leave an unknown gap.@@ -718,7 +709,6 @@ FTS_STALE_KEY = "fts_stale"# Durable diagnostic for stale FTS recovery blocked across process restarts.FTS_REBUILD_DEFERRAL_KEY = "fts_rebuild_deferral"-# ── Legacy (v22 / inline-content) FTS DDL ──────────────────────────────# Used ONLY to keep a pre-v23 install's search working and its triggers# repairable until `optimize_fts_storage()` migrates it: inline copies of@@ -778,7 +768,6 @@ AFTER UPDATE OF content, tool_name, tool_calls ON messages BEGINEND;"""-# ── Cross-process full-FTS-rebuild admission (single authority) ──────────────## Several Hermes processes share one state.db. A full structural FTS rebuilddiff --git a/hermes_state_schema.py b/hermes_state_schema.pyindex 1e1f7193b8e..4796f211811 100644--- a/hermes_state_schema.py+++ b/hermes_state_schema.py@@ -379,8 +379,7 @@ class SessionSchemaMixin:record = Nonetry:row = cursor.execute(- "SELECT value FROM state_meta WHERE key = ? LIMIT 1",- (FTS_REBUILD_DEFERRAL_KEY,),+ "SELECT value FROM state_meta WHERE key = ? LIMIT 1", (FTS_REBUILD_DEFERRAL_KEY,),).fetchone()if row:parsed = json.loads(row[0])