feat(plugins): generalize native platform handler registration to every gateway platform

ctx.register_platform_handler(platform, factory) — the generic surface for
plugins to wire native handlers into any platform adapter at connect()
time. Factories receive (native, adapter): the platform's client/app
object (PTB Application, discord.py Bot, slack_bolt AsyncApp, Teams App,
DingTalkStreamClient, aiohttp web.Application) or None for adapters with
no separate native object.

- BasePlatformAdapter._wire_plugin_handlers(native): shared, isolated
  invocation helper — a raising plugin cannot block a platform connect.
- All 27 connectable adapters call it: telegram/slack/teams/line/
  api_server/msgraph_webhook wire before their dispatch tables freeze;
  the rest hook at connect success.
- register_telegram_handler and get_telegram_handler_factories retained
  as thin back-compat aliases over the telegram bucket.
- Source-invariant test guarantees every adapter with connect() keeps
  calling the hook.
This commit is contained in:
teknium1
2026-07-05 15:17:18 -07:00
committed by Teknium
parent c96f830252
commit 272f4e4abe
33 changed files with 542 additions and 250 deletions
+2
View File
@@ -1816,6 +1816,8 @@ class FeishuAdapter(BasePlatformAdapter):
await self._connect_with_retry()
self._mark_connected()
logger.info("[Feishu] Connected in %s mode (%s)", self._connection_mode, self._domain_name)
# Plugin-registered native handlers (lark_oapi client).
self._wire_plugin_handlers(self._client)
return True
except Exception as exc:
await self._release_app_lock()