The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): finish the move of the last core messaging adapters
Tekniuma84712b4cd02
diff --git a/hermes_cli/gateway_setup_wizard.py b/hermes_cli/gateway_setup_wizard.pyindex 79ade034157..f8495f22a8a 100644--- a/hermes_cli/gateway_setup_wizard.py+++ b/hermes_cli/gateway_setup_wizard.py@@ -317,8 +317,6 @@ def _setup_standard_platform(platform: dict):_gw().print_success(f"{emoji} {label} configured!")--def _builtin_setup_fn(key: str):"""Resolve a built-in platform's setup function; late-bound to dodge the hermes_cli.setup cycle."""from hermes_cli import setup as _sdiff --git a/hermes_cli/setup_migration.py b/hermes_cli/setup_migration.pyindex bef7eabba09..f229bfb71b4 100644--- a/hermes_cli/setup_migration.py+++ b/hermes_cli/setup_migration.py@@ -80,7 +80,7 @@ def _cfg_summary(config: dict, section: str, key: str, default, prefix: str) ->def _gateway_summary(config: dict) -> Optional[str]:from hermes_cli.gateway import _all_platforms, _platform_status# Any non-empty status other than "not configured" counts — WhatsApp ("enabled, not paired"),- # Matrix ("configured + E2EE"), Signal ("partially configured") mean setup already started.+ # Matrix ("configured + E2EE") mean setup already started.configured = [# Trailing parenthetical qualifiers are stripped from the label.plat["label"].split("(", 1)[0].strip() or plat["label"]diff --git a/plugins/platforms/qqbot/adapter.py b/plugins/platforms/qqbot/adapter.pyindex 8239df3de52..786e89843d8 100644--- a/plugins/platforms/qqbot/adapter.py+++ b/plugins/platforms/qqbot/adapter.py@@ -1180,7 +1180,7 @@ class QQAdapter(OwnAccessPolicyMixin, BasePlatformAdapter):try:proc = await asyncio.create_subprocess_exec("ffmpeg", "-y", "-i", src_path, "-ar", "16000", "-ac", "1", wav_path,- stdout=asyncio.subprocess.DEVNULL, stderr=asyncio.subprocess.PIPE)+ stdin=asyncio.subprocess.DEVNULL, stdout=asyncio.subprocess.DEVNULL, stderr=asyncio.subprocess.PIPE)await asyncio.wait_for(proc.wait(), timeout=30)if proc.returncode != 0:stderr = await proc.stderr.read() if proc.stderr else b""diff --git a/plugins/platforms/signal/adapter.py b/plugins/platforms/signal/adapter.pyindex 1dca244483a..98977156928 100644--- a/plugins/platforms/signal/adapter.py+++ b/plugins/platforms/signal/adapter.py@@ -113,7 +113,7 @@ def _remux_aac_to_m4a(aac_data: bytes) -> Optional[tuple[bytes, str]]:dst_path = src_path[:-4] + ".m4a"try:proc = subprocess.run([ffmpeg, "-y", "-loglevel", "error", "-i", src_path, "-c:a", "copy", "-movflags",- "+faststart", dst_path], capture_output=True, timeout=10, check=False)+ "+faststart", dst_path], stdin=subprocess.DEVNULL, capture_output=True, timeout=10, check=False)if proc.returncode != 0:logger.warning("Signal: AAC→M4A remux failed (ffmpeg exit %d): %s",proc.returncode, proc.stderr.decode("utf-8", "replace")[:300])diff --git a/website/docs/developer-guide/gateway-internals.md b/website/docs/developer-guide/gateway-internals.mdindex 056b03c14e6..a1fc57fb2fd 100644--- a/website/docs/developer-guide/gateway-internals.md+++ b/website/docs/developer-guide/gateway-internals.md@@ -545,14 +545,15 @@ Unlike the CLI (which uses `load_cli_config()` with hardcoded defaults), the gat## Platform Adapters-Most messaging platforms ship as plugin adapters under `plugins/platforms/<name>/adapter.py`; a few legacy adapters still live directly in `gateway/platforms/`. All extend `BasePlatformAdapter` from `gateway/platforms/base.py`:+Every messaging platform ships as a plugin adapter under `plugins/platforms/<name>/`; `gateway/platforms/` keeps the base class and the HTTP ingress adapters (`api_server`, `webhook`, `msgraph_webhook`). All extend `BasePlatformAdapter` from `gateway/platforms/base.py`:```textplugins/platforms/ # plugin-packaged adapters (one dir each)├── telegram/adapter.py # Telegram Bot API (long polling or webhook)├── discord/adapter.py # Discord bot via discord.py├── slack/adapter.py # Slack Socket Mode-├── whatsapp/adapter.py # WhatsApp Business Cloud API+├── whatsapp/adapter.py # WhatsApp via the local Baileys bridge+├── whatsapp_cloud/adapter.py # WhatsApp Business Cloud API├── matrix/adapter.py # Matrix via mautrix (optional E2EE)├── mattermost/adapter.py # Mattermost WebSocket API├── email/adapter.py # Email via IMAP/SMTP@@ -570,7 +571,7 @@ plugins/platforms/ # plugin-packaged adapters (one dir each)├── yuanbao/adapter.py # Yuanbao (Tencent) DM/group WebSocket└── … # google_chat, ntfy, photon, raft, simplex, …-gateway/platforms/ # core base + legacy direct adapters+gateway/platforms/ # core base + HTTP ingress adapters├── base.py # BasePlatformAdapter — shared logic for all platforms├── msgraph_webhook.py # Microsoft Graph change-notification webhook (Teams, Outlook, etc.)├── webhook.py # Inbound/outbound webhook adapterdiff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/architecture.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/architecture.mdindex 8085e38d676..e92b05c6d75 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/architecture.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/architecture.md@@ -117,12 +117,12 @@ hermes-agent/│ ├── mirror.py # 跨会话消息镜像│ ├── status.py # Token 锁、profile 范围的进程追踪│ ├── builtin_hooks/ # 始终注册的 hook 扩展点(当前无内置)-│ └── platforms/ # 20 个适配器:telegram、discord、slack、whatsapp、-│ # signal、matrix、mattermost、email、sms、-│ # dingtalk、feishu、wecom、wecom_callback、weixin、-│ # bluebubbles、webhook、api_server、yuanbao+│ └── platforms/ # 核心入站适配器:api_server、webhook、+│ # msgraph_webhook│-├── plugins/platforms/ # 随包平台插件:telegram、discord、feishu、qqbot 等+├── plugins/platforms/ # 随包平台插件:telegram、discord、slack、whatsapp、+│ # whatsapp_cloud、signal、weixin、bluebubbles、qqbot、+│ # yuanbao、matrix、feishu 等├── acp_adapter/ # ACP 服务器(VS Code / Zed / JetBrains)├── cron/ # 调度器(jobs.py、scheduler.py)├── plugins/memory/ # 记忆提供者插件diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/gateway-internals.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/gateway-internals.mdindex e6cb27eae5d..84fb29b736a 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/gateway-internals.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/gateway-internals.md@@ -145,14 +145,15 @@ Gateway 从多个来源读取配置:## 平台适配器-大多数消息平台以插件适配器形式位于 `plugins/platforms/<name>/adapter.py`;少数旧适配器仍直接位于 `gateway/platforms/`。它们都继承 `gateway/platforms/base.py` 中的 `BasePlatformAdapter`:+所有消息平台都以插件适配器形式位于 `plugins/platforms/<name>/`;`gateway/platforms/` 只保留基类和 HTTP 入站适配器(`api_server`、`webhook`、`msgraph_webhook`)。它们都继承 `gateway/platforms/base.py` 中的 `BasePlatformAdapter`:```textplugins/platforms/ # 插件打包的适配器(每个一个目录)├── telegram/adapter.py # Telegram Bot API(长轮询或 webhook)├── discord/adapter.py # Discord bot(通过 discord.py)├── slack/adapter.py # Slack Socket Mode-├── whatsapp/adapter.py # WhatsApp Business Cloud API+├── whatsapp/adapter.py # WhatsApp(通过本地 Baileys 桥接)+├── whatsapp_cloud/adapter.py # WhatsApp Business Cloud API├── matrix/adapter.py # Matrix(通过 mautrix,可选 E2EE)├── mattermost/adapter.py # Mattermost WebSocket API├── email/adapter.py # 电子邮件(通过 IMAP/SMTP)@@ -170,7 +171,7 @@ plugins/platforms/ # 插件打包的适配器(每个一个目├── yuanbao/adapter.py # 元宝(腾讯)私信/群组适配器└── … # google_chat、ntfy、photon、raft、simplex 等-gateway/platforms/ # 核心 base 与旧的直接适配器+gateway/platforms/ # 核心 base 与 HTTP 入站适配器├── base.py # BasePlatformAdapter — 所有平台的共享逻辑├── msgraph_webhook.py # Microsoft Graph 变更通知 webhook(Teams、Outlook 等)├── webhook.py # 入站/出站 webhook 适配器