"""The transcript size limits callers pass to the resume and export verbs.""" _MAX_SAFE_MESSAGES = 20_000 # resume/export guard default def _configured_transcript_limit(key: str, fallback: int = _MAX_SAFE_MESSAGES) -> int: """``sessions.`` from config.yaml (lazy import: circular at load), else *fallback*; 0 disables.""" try: from hermes_cli.config import load_config_readonly value = (load_config_readonly().get("sessions") or {}).get(key) if value is None: return fallback limit = int(value) return limit if limit >= 0 else fallback except Exception: # health: allow BLE001 -- an unreadable config means the default limit return fallback def resolved_max_resume_messages() -> int: return _configured_transcript_limit("max_resume_messages") def resolved_max_export_messages() -> int: return _configured_transcript_limit("max_export_messages")