mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Cron now resolves its toolset from the same per-platform config the gateway uses — `_get_platform_tools(cfg, 'cron')` — instead of blindly loading every default toolset. Existing cron jobs without a per-job override automatically lose `moa`, `homeassistant`, and `rl` (the `_DEFAULT_OFF_TOOLSETS` set), which stops the "surprise $4.63 mixture_of_agents run" class of bug (Norbert, Discord). Precedence inside `run_job`: 1. per-job `enabled_toolsets` (PR #14767 / #6130) — wins if set 2. `_get_platform_tools(cfg, 'cron')` — new, the blanket gate 3. `None` fallback (legacy) — only on resolver exception Changes: - hermes_cli/platforms.py: register 'cron' with default_toolset 'hermes-cron' - toolsets.py: add 'hermes-cron' toolset (mirrors 'hermes-cli'; `_get_platform_tools` then filters via `_DEFAULT_OFF_TOOLSETS`) - cron/scheduler.py: add `_resolve_cron_enabled_toolsets(job, cfg)`, call it at the `AIAgent(...)` kwargs site - tests/cron/test_scheduler.py: replace the 'None when not set' test (outdated contract) with an invariant ('moa not in default cron toolset') + new per-job-wins precedence test - tests/hermes_cli/test_tools_config.py: mark 'cron' as non-messaging in the gateway-toolset-coverage test
48 lines
2.8 KiB
Python
48 lines
2.8 KiB
Python
"""
|
|
Shared platform registry for Hermes Agent.
|
|
|
|
Single source of truth for platform metadata consumed by both
|
|
skills_config (label display) and tools_config (default toolset
|
|
resolution). Import ``PLATFORMS`` from here instead of maintaining
|
|
duplicate dicts in each module.
|
|
"""
|
|
|
|
from collections import OrderedDict
|
|
from typing import NamedTuple
|
|
|
|
|
|
class PlatformInfo(NamedTuple):
|
|
"""Metadata for a single platform entry."""
|
|
label: str
|
|
default_toolset: str
|
|
|
|
|
|
# Ordered so that TUI menus are deterministic.
|
|
PLATFORMS: OrderedDict[str, PlatformInfo] = OrderedDict([
|
|
("cli", PlatformInfo(label="🖥️ CLI", default_toolset="hermes-cli")),
|
|
("telegram", PlatformInfo(label="📱 Telegram", default_toolset="hermes-telegram")),
|
|
("discord", PlatformInfo(label="💬 Discord", default_toolset="hermes-discord")),
|
|
("slack", PlatformInfo(label="💼 Slack", default_toolset="hermes-slack")),
|
|
("whatsapp", PlatformInfo(label="📱 WhatsApp", default_toolset="hermes-whatsapp")),
|
|
("signal", PlatformInfo(label="📡 Signal", default_toolset="hermes-signal")),
|
|
("bluebubbles", PlatformInfo(label="💙 BlueBubbles", default_toolset="hermes-bluebubbles")),
|
|
("email", PlatformInfo(label="📧 Email", default_toolset="hermes-email")),
|
|
("homeassistant", PlatformInfo(label="🏠 Home Assistant", default_toolset="hermes-homeassistant")),
|
|
("mattermost", PlatformInfo(label="💬 Mattermost", default_toolset="hermes-mattermost")),
|
|
("matrix", PlatformInfo(label="💬 Matrix", default_toolset="hermes-matrix")),
|
|
("dingtalk", PlatformInfo(label="💬 DingTalk", default_toolset="hermes-dingtalk")),
|
|
("feishu", PlatformInfo(label="🪽 Feishu", default_toolset="hermes-feishu")),
|
|
("wecom", PlatformInfo(label="💬 WeCom", default_toolset="hermes-wecom")),
|
|
("wecom_callback", PlatformInfo(label="💬 WeCom Callback", default_toolset="hermes-wecom-callback")),
|
|
("weixin", PlatformInfo(label="💬 Weixin", default_toolset="hermes-weixin")),
|
|
("qqbot", PlatformInfo(label="💬 QQBot", default_toolset="hermes-qqbot")),
|
|
("webhook", PlatformInfo(label="🔗 Webhook", default_toolset="hermes-webhook")),
|
|
("api_server", PlatformInfo(label="🌐 API Server", default_toolset="hermes-api-server")),
|
|
("cron", PlatformInfo(label="⏰ Cron", default_toolset="hermes-cron")),
|
|
])
|
|
|
|
|
|
def platform_label(key: str, default: str = "") -> str:
|
|
"""Return the display label for a platform key, or *default*."""
|
|
info = PLATFORMS.get(key)
|
|
return info.label if info is not None else default
|