diff --git a/hermes_cli/config.py b/hermes_cli/config.py index 223d4239f..d5a063a97 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -2037,6 +2037,45 @@ DEFAULT_CONFIG = { "trust_recent_files_seconds": 600, }, + # Real-time token streaming to messaging platforms (Telegram, Discord, + # Slack, etc.). Read at the top level by the gateway; absent this block the + # gateway falls back to these same defaults, so adding it here only makes + # the feature discoverable in config.yaml — it does not change behavior. + # + # Disabled by default: streaming costs extra edit/draft API calls per + # response. Set ``enabled: true`` and restart the gateway to turn it on. + "streaming": { + # Master switch. When false, each response is delivered as a single + # final message (no progressive updates). + "enabled": False, + # Transport selection: + # "auto" — prefer native draft streaming where the platform + # supports it (Telegram DMs via sendMessageDraft, + # Bot API 9.5+) and fall back to edit-based elsewhere. + # Safe global default: platforms without draft support + # (Discord, Slack, Matrix, Telegram groups) transparently + # use the edit path, so "auto" only upgrades chats that + # can render the smoother native preview. + # "draft" — explicitly request native drafts; falls back to edit + # when the platform/chat doesn't support them. + # "edit" — progressive editMessageText only (legacy behavior). + # "off" — disable streaming entirely (same as enabled: false). + "transport": "auto", + # Minimum seconds between progressive edits — tuned for Telegram's + # ~1 edit/s flood envelope. + "edit_interval": 0.8, + # Flush the buffer to the platform once this many characters have + # accumulated, so short replies feel near-instant. + "buffer_threshold": 24, + # Cursor glyph appended to the in-progress message while streaming. + "cursor": " \u2589", + # When >0, the final edit for a long-running streamed response is + # delivered as a fresh message if the preview has been visible at + # least this many seconds, so the platform timestamp reflects + # completion time. Telegram only; other platforms ignore it. + "fresh_final_after_seconds": 60.0, + }, + # Session storage — controls automatic cleanup of ~/.hermes/state.db. # state.db accumulates every session, message, tool call, and FTS5 index # entry forever. Without auto-pruning, a heavy user (gateway + cron) @@ -3756,7 +3795,7 @@ _KNOWN_ROOT_KEYS = { "fallback_providers", "credential_pool_strategies", "toolsets", "agent", "terminal", "display", "compression", "delegation", "auxiliary", "custom_providers", "context", "memory", "gateway", - "sessions", + "sessions", "streaming", } # Valid fields inside a custom_providers list entry