mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
gateway: quiet Telegram operational chatter
This commit is contained in:
parent
efa952531b
commit
60f84c6c28
7 changed files with 177 additions and 18 deletions
|
|
@ -35,6 +35,11 @@ _GLOBAL_DEFAULTS: dict[str, Any] = {
|
|||
"show_reasoning": False,
|
||||
"tool_preview_length": 0,
|
||||
"streaming": None, # None = follow top-level streaming config
|
||||
# Gateway-only assistant/status chatter controls. These default on for
|
||||
# back-compat, but mobile platforms can opt down to final-answer-first.
|
||||
"interim_assistant_messages": True,
|
||||
"long_running_notifications": True,
|
||||
"busy_ack_detail": True,
|
||||
# When true, delete tool-progress / "Still working..." / status bubbles
|
||||
# after the final response lands on platforms that support message
|
||||
# deletion (e.g. Telegram). Off by default — progress is still shown
|
||||
|
|
@ -56,6 +61,9 @@ _TIER_HIGH = {
|
|||
"show_reasoning": False,
|
||||
"tool_preview_length": 40,
|
||||
"streaming": None, # follow global
|
||||
"interim_assistant_messages": True,
|
||||
"long_running_notifications": True,
|
||||
"busy_ack_detail": True,
|
||||
}
|
||||
|
||||
_TIER_MEDIUM = {
|
||||
|
|
@ -63,6 +71,9 @@ _TIER_MEDIUM = {
|
|||
"show_reasoning": False,
|
||||
"tool_preview_length": 40,
|
||||
"streaming": None,
|
||||
"interim_assistant_messages": True,
|
||||
"long_running_notifications": True,
|
||||
"busy_ack_detail": True,
|
||||
}
|
||||
|
||||
_TIER_LOW = {
|
||||
|
|
@ -70,6 +81,9 @@ _TIER_LOW = {
|
|||
"show_reasoning": False,
|
||||
"tool_preview_length": 40,
|
||||
"streaming": False,
|
||||
"interim_assistant_messages": False,
|
||||
"long_running_notifications": False,
|
||||
"busy_ack_detail": False,
|
||||
}
|
||||
|
||||
_TIER_MINIMAL = {
|
||||
|
|
@ -77,11 +91,23 @@ _TIER_MINIMAL = {
|
|||
"show_reasoning": False,
|
||||
"tool_preview_length": 0,
|
||||
"streaming": False,
|
||||
"interim_assistant_messages": False,
|
||||
"long_running_notifications": False,
|
||||
"busy_ack_detail": False,
|
||||
}
|
||||
|
||||
_PLATFORM_DEFAULTS: dict[str, dict[str, Any]] = {
|
||||
# Tier 1 — full edit support, personal/team use
|
||||
"telegram": {**_TIER_HIGH, "tool_progress": "new"},
|
||||
# Telegram is usually a mobile inbox: default to final-answer-first and
|
||||
# avoid permanent operational breadcrumbs unless users opt back in with
|
||||
# display.platforms.telegram.tool_progress / long_running_notifications.
|
||||
"telegram": {
|
||||
**_TIER_HIGH,
|
||||
"tool_progress": "off",
|
||||
"interim_assistant_messages": False,
|
||||
"long_running_notifications": False,
|
||||
"busy_ack_detail": False,
|
||||
},
|
||||
"discord": _TIER_HIGH,
|
||||
|
||||
# Tier 2 — edit support, often customer/workspace channels
|
||||
|
|
@ -190,7 +216,13 @@ def _normalise(setting: str, value: Any) -> Any:
|
|||
if value is True:
|
||||
return "all"
|
||||
return str(value).lower()
|
||||
if setting in {"show_reasoning", "streaming"}:
|
||||
if setting in {
|
||||
"show_reasoning",
|
||||
"streaming",
|
||||
"interim_assistant_messages",
|
||||
"long_running_notifications",
|
||||
"busy_ack_detail",
|
||||
}:
|
||||
if isinstance(value, str):
|
||||
return value.lower() in {"true", "1", "yes", "on"}
|
||||
return bool(value)
|
||||
|
|
|
|||
|
|
@ -3223,9 +3223,22 @@ class GatewayRunner:
|
|||
|
||||
self._busy_ack_ts[session_key] = now
|
||||
|
||||
# Build a status-rich acknowledgment
|
||||
# Build a status-rich acknowledgment. Mobile chat defaults keep this
|
||||
# terse; detailed iteration/tool state is still available in logs and
|
||||
# can be opted in per platform via display.platforms.<platform>.busy_ack_detail.
|
||||
status_parts = []
|
||||
if running_agent and running_agent is not _AGENT_PENDING_SENTINEL:
|
||||
busy_ack_detail_enabled = True
|
||||
try:
|
||||
from gateway.display_config import resolve_display_setting as _resolve_display_setting
|
||||
_user_cfg = _load_gateway_config()
|
||||
_platform_key = _platform_config_key(event.source.platform)
|
||||
busy_ack_detail_enabled = bool(
|
||||
_resolve_display_setting(_user_cfg, _platform_key, "busy_ack_detail", True)
|
||||
)
|
||||
except Exception:
|
||||
busy_ack_detail_enabled = True
|
||||
|
||||
if busy_ack_detail_enabled and running_agent and running_agent is not _AGENT_PENDING_SENTINEL:
|
||||
try:
|
||||
summary = running_agent.get_activity_summary()
|
||||
iteration = summary.get("api_call_count", 0)
|
||||
|
|
@ -15874,9 +15887,13 @@ class GatewayRunner:
|
|||
# in chat platforms while opting into concise mid-turn updates.
|
||||
interim_assistant_messages_enabled = (
|
||||
source.platform != Platform.WEBHOOK
|
||||
and is_truthy_value(
|
||||
display_config.get("interim_assistant_messages"),
|
||||
default=True,
|
||||
and bool(
|
||||
resolve_display_setting(
|
||||
user_config,
|
||||
platform_key,
|
||||
"interim_assistant_messages",
|
||||
True,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -17413,6 +17430,19 @@ class GatewayRunner:
|
|||
# 0 = disable notifications.
|
||||
_NOTIFY_INTERVAL_RAW = _float_env("HERMES_AGENT_NOTIFY_INTERVAL", 180)
|
||||
_NOTIFY_INTERVAL = _NOTIFY_INTERVAL_RAW if _NOTIFY_INTERVAL_RAW > 0 else None
|
||||
try:
|
||||
_notify_enabled = bool(
|
||||
resolve_display_setting(
|
||||
user_config,
|
||||
platform_key,
|
||||
"long_running_notifications",
|
||||
True,
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
_notify_enabled = True
|
||||
if not _notify_enabled:
|
||||
_NOTIFY_INTERVAL = None
|
||||
_notify_start = time.time()
|
||||
|
||||
async def _notify_long_running():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue