refactor(gateway): migrate slack/dingtalk/whatsapp/matrix/feishu/telegram/wecom/email/sms adapters to bundled plugins

Salvage of PR #41284 onto current main. Relocates the last 9 inline messaging
adapters (+ satellites: telegram_network, feishu_comment/_rules/meeting_invite,
wecom_crypto, wecom_callback) from gateway/platforms/ into self-contained
bundled plugins under plugins/platforms/<x>/, discovered via the platform
registry. Strips the per-platform core touchpoints from gateway/run.py,
gateway/config.py, hermes_cli/gateway.py, hermes_cli/setup.py, and
tools/send_message_tool.py.

Carries forward the migration fixes (explicit enabled:false honored,
get_connected_platforms forces discovery, plugin is_connected via
gateway.get_env_value, logs --component gateway matches plugins.platforms.*,
matrix hidden on Windows).

Additionally ports config keys main added since the PR base: the matrix
plugin's _apply_yaml_config now also covers allowed_users,
ignore_user_patterns, process_notices, and session_scope (the inline
gateway/config.py matrix block gained these in the 1340 commits the PR sat
open; they would otherwise have been silently dropped on deletion).
This commit is contained in:
Teknium 2026-06-19 20:41:08 -07:00
parent 2ab09a6c50
commit 5600105478
124 changed files with 3643 additions and 2579 deletions

View file

@ -5,10 +5,29 @@ import os
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
from tools.send_message_tool import (
_send_dingtalk,
_send_matrix,
# ``_send_dingtalk`` and ``_send_matrix`` moved into their bundled plugins
# (``plugins/platforms/<x>/adapter.py::_standalone_send``) in #41112. Keep
# thin pre-migration-shaped shims so existing test bodies work unchanged.
from plugins.platforms.dingtalk.adapter import (
_standalone_send as _dingtalk_standalone_send,
)
from plugins.platforms.matrix.adapter import (
_standalone_send as _matrix_standalone_send,
)
async def _send_dingtalk(extra, chat_id, message):
"""Pre-migration ``(extra, chat_id, message)`` shim around the dingtalk
plugin's ``_standalone_send(pconfig, chat_id, message)``."""
pconfig = SimpleNamespace(token=None, extra=extra or {})
return await _dingtalk_standalone_send(pconfig, chat_id, message)
async def _send_matrix(token, extra, chat_id, message):
"""Pre-migration ``(token, extra, chat_id, message)`` shim around the matrix
plugin's ``_standalone_send(pconfig, chat_id, message)``."""
pconfig = SimpleNamespace(token=token, extra=extra or {})
return await _matrix_standalone_send(pconfig, chat_id, message)
# ``_send_mattermost`` moved into the mattermost plugin
# (``plugins/platforms/mattermost/adapter.py::_standalone_send``). Keep a