fix(config): align prefill messages key handling

This commit is contained in:
helix4u
2026-06-03 23:51:44 -06:00
parent 3c163cb035
commit ffb53767bf
12 changed files with 136 additions and 22 deletions

21
cli.py
View File

@ -313,6 +313,25 @@ def _load_prefill_messages(file_path: str) -> List[Dict[str, Any]]:
return []
def _resolve_prefill_messages_file(config: Dict[str, Any]) -> str:
"""Resolve the prefill file path from env/config.
``prefill_messages_file`` at the top level is the canonical config key.
``agent.prefill_messages_file`` remains a legacy fallback for older CLI and
godmode-generated configs.
"""
env_path = os.getenv("HERMES_PREFILL_MESSAGES_FILE", "").strip()
if env_path:
return env_path
top_level = str(config.get("prefill_messages_file", "") or "").strip()
if top_level:
return top_level
agent_cfg = config.get("agent", {})
if isinstance(agent_cfg, dict):
return str(agent_cfg.get("prefill_messages_file", "") or "").strip()
return ""
def _parse_reasoning_config(effort: str) -> dict | None:
"""Parse a reasoning effort level into an OpenRouter reasoning config dict."""
from hermes_constants import parse_reasoning_effort
@ -3272,7 +3291,7 @@ class HermesCLI:
# Ephemeral prefill messages (few-shot priming, never persisted)
self.prefill_messages = _load_prefill_messages(
CLI_CONFIG["agent"].get("prefill_messages_file", "")
_resolve_prefill_messages_file(CLI_CONFIG)
)
# Reasoning config (OpenRouter reasoning effort level)