Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions agent/auxiliary_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3748,16 +3748,28 @@ def _get_cached_client(
# can detect stale entries later.
bound_loop = current_loop
with _client_cache_lock:
if cache_key not in _client_cache:
existing = _client_cache.get(cache_key)
if existing is not None:
existing_client, _existing_default, existing_loop = existing
existing_loop_ok = not async_mode or (
existing_loop is not None
and existing_loop is bound_loop
and not existing_loop.is_closed()
)
if existing_loop_ok:
client, default_model, _ = existing
else:
_force_close_async_httpx(existing_client)
del _client_cache[cache_key]
existing = None
if existing is None:
# Safety belt: if the cache has grown beyond the max, evict
# the oldest entries (FIFO — dict preserves insertion order).
while len(_client_cache) >= _CLIENT_CACHE_MAX_SIZE:
evict_key, evict_entry = next(iter(_client_cache.items()))
_force_close_async_httpx(evict_entry[0])
del _client_cache[evict_key]
_client_cache[cache_key] = (client, default_model, bound_loop)
else:
client, default_model, _ = _client_cache[cache_key]
return client, model or default_model


Expand Down
21 changes: 20 additions & 1 deletion cli-config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ agent:
# - A preset like "hermes-cli" or "hermes-telegram" (curated tool set)
# - A list of individual toolsets to compose your own (see list below)
#
# Supported platform keys: cli, telegram, discord, whatsapp, slack, qqbot, teams, google_chat
# Supported platform keys include: cli, telegram, discord, whatsapp, slack, signal,
# api_server, web, mobile_chat, qqbot, yuanbao, cron, and plugin platforms.
#
# Examples:
#
Expand All @@ -629,13 +630,25 @@ agent:
# platform_toolsets:
# discord: [web, vision, skills, todo]
#
# # API server client surfaces selected per request with X-Platform:
# # no header -> api_server
# # X-Platform: web -> web
# # X-Platform: mobile_chat -> mobile_chat
# platform_toolsets:
# api_server: [hermes-api-server]
# web: [web, vision, skills, todo, memory, session_search]
# mobile_chat: []
#
# If not set, defaults are:
# cli: hermes-cli (everything + cronjob management)
# telegram: hermes-telegram (terminal, file, web, vision, image, tts, browser, skills, todo, cronjob, messaging)
# discord: hermes-discord (same as telegram)
# whatsapp: hermes-whatsapp (same as telegram)
# slack: hermes-slack (same as telegram)
# signal: hermes-signal (same as telegram)
# api_server: hermes-api-server (full HTTP agent tool surface)
# web: hermes-web (browser-facing client surface, no terminal/file tools)
# mobile_chat: hermes-mobile-chat (lightweight API chat, no tools by default)
# homeassistant: hermes-homeassistant (same as telegram)
# qqbot: hermes-qqbot (same as telegram)
# teams: hermes-teams (same as telegram)
Expand All @@ -648,6 +661,9 @@ platform_toolsets:
whatsapp: [hermes-whatsapp]
slack: [hermes-slack]
signal: [hermes-signal]
api_server: [hermes-api-server]
web: [hermes-web]
mobile_chat: [hermes-mobile-chat]
homeassistant: [hermes-homeassistant]
qqbot: [hermes-qqbot]
yuanbao: [hermes-yuanbao]
Expand Down Expand Up @@ -702,6 +718,9 @@ platform_toolsets:
# hermes-discord - Same as hermes-telegram
# hermes-whatsapp - Same as hermes-telegram
# hermes-slack - Same as hermes-telegram
# hermes-api-server - Full API-server tool surface, excluding interactive UI tools
# hermes-web - Web/API client surface without local execution or file-system tools
# hermes-mobile-chat - No-tool lightweight chat surface for constrained clients
#
# COMPOSITE:
# debugging - terminal + web + file
Expand Down
Loading
Loading