The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(yuanbao): drop core wiring
Tekniumaf9e55334869
diff --git a/gateway/run.py b/gateway/run.pyindex a16d3daa93a..2258d9590bf 100644--- a/gateway/run.py+++ b/gateway/run.py@@ -3324,9 +3324,7 @@ _BUILTIN_ADAPTERS: dict[Platform, tuple[str, str, str, str]] = {Platform.WEBHOOK: ("webhook", "WebhookAdapter", "check_webhook_requirements","Webhook: aiohttp not installed"),Platform.MSGRAPH_WEBHOOK: ("msgraph_webhook", "MSGraphWebhookAdapter", "check_msgraph_webhook_requirements",- "MSGraph webhook: aiohttp not installed"),- Platform.YUANBAO: ("yuanbao", "YuanbaoAdapter", "WEBSOCKETS_AVAILABLE",- "Yuanbao: websockets not installed. Run: pip install websockets")}+ "MSGraph webhook: aiohttp not installed")}def _instantiate_builtin_adapter(platform: Platform, config: Any) -> Optional[BasePlatformAdapter]:diff --git a/hermes_cli/gateway_setup_wizard.py b/hermes_cli/gateway_setup_wizard.pyindex d010f71e59d..79ade034157 100644--- a/hermes_cli/gateway_setup_wizard.py+++ b/hermes_cli/gateway_setup_wizard.py@@ -47,21 +47,6 @@ _PLATFORMS = ["help": "off = flat channel messages, thread = replies nest under your message."},],},- {- "key": "yuanbao", "label": "Yuanbao", "emoji": "💎", "token_var": "YUANBAO_APP_ID",- "setup_instructions": [- "1. Download the Yuanbao app from https://yuanbao.tencent.com/",- "2. In the app, go to PAI → My Bot and create a new bot",- "3. After the bot is created, copy the App ID and App Secret",- "4. Enter them below and Hermes will connect automatically over WebSocket",- ],- "vars": [- {"name": "YUANBAO_APP_ID", "prompt": "App ID", "password": False,- "help": "The App ID from your Yuanbao IM Bot credentials."},- {"name": "YUANBAO_APP_SECRET", "prompt": "App Secret", "password": True,- "help": "The App Secret (used for HMAC signing) from your Yuanbao IM Bot."},- ],- },]diff --git a/tools/send_message_senders.py b/tools/send_message_senders.pyindex 8a9668f6056..e887fc492d8 100644--- a/tools/send_message_senders.py+++ b/tools/send_message_senders.py@@ -460,30 +460,3 @@ async def _matrix_send_core(adapter, chat_id, message, media_files, metadata):if not last_result.success:return _error(f"Matrix media send failed: {last_result.error}")return {"error": _NO_DELIVERABLE} if last_result is None else _success("matrix", chat_id, message_id=last_result.message_id)---def _gateway_platform_module(name, *, unavailable, unmet):- """``(gateway.platforms.<name>, None)`` once its ``check_<name>_requirements`` passes, else ``(None, error)``."""- import importlib- try:- module = importlib.import_module(f"gateway.platforms.{name}")- except ImportError:- return None, {"error": unavailable}- return (module, None) if getattr(module, f"check_{name}_requirements")() else (None, {"error": unmet})-----async def _send_yuanbao(chat_id, message, media_files=None):- """Send via the running Yuanbao adapter's persistent WebSocket (no throwaway client possible)."""- try:- from gateway.platforms.yuanbao import YuanbaoAdapter- except ImportError:- return _error("Yuanbao adapter module not available.")- adapter = YuanbaoAdapter.get_active()- if adapter is None:- return _error("Yuanbao adapter is not running. Start the gateway with yuanbao platform enabled first.")- try:- return await adapter._outbound.sender.send_direct(chat_id, message, media_files)- except Exception as e:- return _error(f"Yuanbao send failed: {e}")diff --git a/tools/send_message_tool.py b/tools/send_message_tool.pyindex 35ad0965356..5c3cfa5a0fc 100644--- a/tools/send_message_tool.py+++ b/tools/send_message_tool.py@@ -18,7 +18,7 @@ from tools.send_message_senders import (_AUDIO_EXTS, _DEFAULT_CAPTION_LIMIT, _IMAGE_EXTS, _NO_DELIVERABLE, _VIDEO_EXTS, _VOICE_EXTS,_adapter_media_method, _error, _live_adapter, _media_caption_split, _plugin_standalone_sender,_registry_standalone_send, _resolve_slack_user_target, _sanitize_error_text,- _send_matrix_via_adapter, _send_telegram, _send_yuanbao)+ _send_matrix_via_adapter, _send_telegram)from tools.registry import tool_error# NOTE: ``send_message`` is intentionally NOT registered as an agent-callable model tool@@ -621,7 +621,8 @@ _PLUGIN_STANDALONE_MEDIA = {"discord": ("Discord", False, True, [], False), "fei"slack": ("Slack", True, True, [], False), "whatsapp": ("WhatsApp", True, True, None, True),# Signal: attachments ride the JSON-RPC param on the final chunk."signal": ("Signal", True, False, [], False),- "weixin": ("Weixin", True, False, None, False)}+ "weixin": ("Weixin", True, False, None, False),+ "yuanbao": ("Yuanbao", True, False, None, False)}async def _send_plugin_standalone(platform_name, pconfig, chat_id, message, chunks, media_files, *, thread_id,@@ -657,22 +658,18 @@ def _via_adapter_route(p, pc, cid, chunk, media, tid, fd):# Native-media chunked routes for built-in platforms; media rides on the final chunk, non-final# chunks get the sentinel. platform -> (media required, sentinel, sender(platform, pconfig,# chat_id, chunk, media, thread_id, force_document)). Matrix: ALL sends use the native adapter-# (E2EE text). Yuanbao / WeCom: media needs the-# running gateway. Slack text: live adapter (multi-workspace, ignored_channels gates) else the+# (E2EE text). WeCom: media needs the running gateway. Slack text: live adapter (multi-workspace, ignored_channels gates) else the# plugin's standalone sender. Names resolve at call time so tests can monkeypatch the senders._CHUNKED_ROUTES = {"matrix": (False, [], lambda p, pc, cid, chunk, media, tid, fd: _send_matrix_via_adapter(pc, cid, chunk, media_files=media, thread_id=tid)),- "yuanbao": (True, None, lambda p, pc, cid, chunk, media, tid, fd: _send_yuanbao(cid, chunk, media_files=media)),"slack": (False, [], _via_adapter_route),"wecom": (True, None, _via_adapter_route)}# Text-only senders for built-in platforms (generic path; media is dropped with a# warning). Signature: (pconfig, chat_id, chunk, thread_id) -> result.-_TEXT_SENDERS = {- **{name: partial(_registry_standalone_send, name)- for name in ("whatsapp", "email", "sms", "dingtalk", "feishu", "wecom", "signal", "qqbot")},- "yuanbao": lambda pc, cid, chunk, tid: _send_yuanbao(cid, chunk)}+_TEXT_SENDERS = {name: partial(_registry_standalone_send, name)+ for name in ("whatsapp", "email", "sms", "dingtalk", "feishu", "wecom", "signal", "qqbot", "yuanbao")}_MEDIA_PLATFORMS_NOTE = "telegram, discord, matrix, weixin, signal, yuanbao, feishu, whatsapp, slack and qqbot"