refactor(gateway): migrate Yuanbao adapter to bundled plugin - #40804
Closed
kshitijk4poor wants to merge 1 commit into
Closed
refactor(gateway): migrate Yuanbao adapter to bundled plugin#40804kshitijk4poor wants to merge 1 commit into
kshitijk4poor wants to merge 1 commit into
Conversation
Move the Yuanbao (元宝) adapter and its protocol/media/sticker companions from gateway/platforms/yuanbao*.py into a self-contained bundled plugin under plugins/platforms/yuanbao/, following the Discord/Mattermost/Home Assistant migration shape. The plugin's register() supplies the hooks that previously lived as per-platform wiring in core: - adapter_factory -> the elif in gateway/run.py::_create_adapter() - check_fn -> the websockets-availability guard there - is_connected -> the Platform.YUANBAO lambda in gateway/config.py - setup_fn -> the declarative yuanbao entry in hermes_cli/gateway.py - standalone_sender_fn -> the Platform.YUANBAO dispatch in send_message_tool - cron_deliver_env_var -> YUANBAO_HOME_CHANNEL Yuanbao speaks a persistent WebSocket owned by the live gateway adapter, so unlike HTTP platforms there is no throwaway-client path; the standalone sender obtains the running singleton via get_active_adapter() and errors when the gateway is not running, exactly as the old _send_yuanbao did. Deliberately left generic in core (same as every other platform): the Platform.YUANBAO enum literal, the _apply_env_overrides YUANBAO_* bridge, the _is_user_authorized allowlist maps, and the cron known-platforms set. Yuanbao has no load_gateway_config YAML block, so no apply_yaml_config_fn is needed. All consumer imports rewritten to plugins.platforms.yuanbao.adapter; the gateway.platforms.YuanbaoAdapter re-export is repointed for back-compat.
28 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Moves the Yuanbao (元宝) adapter and its protocol/media/sticker companions
from
gateway/platforms/yuanbao*.pyinto a self-contained bundled pluginunder
plugins/platforms/yuanbao/, following the Discord / Mattermost /Home Assistant migration shape.
How
register()supplies the hooks that were per-platform wiring in core:adapter_factory (run.py factory elif), check_fn (websockets guard),
is_connected (config.py lambda), setup_fn (gateway.py wizard entry),
standalone_sender_fn (send_message_tool dispatch), cron_deliver_env_var.
Yuanbao uses a persistent WebSocket owned by the live gateway adapter, so
unlike HTTP platforms there's no throwaway-client path — the standalone
sender obtains the running singleton via
get_active_adapter()and errorswhen the gateway isn't running, exactly as the old
_send_yuanbaodid.Behavior-preserving.
Out of scope (stays generic, same as every other platform)
Platform.YUANBAOenum literal, the_apply_env_overridesYUANBAO_* bridge,_is_user_authorizedallowlist maps, cron known-platforms set. Yuanbao hasno
load_gateway_configYAML block, so noapply_yaml_config_fn.Tests
4 clean renames (R096 + 3×R100). 272 focused tests pass. No new failures vs
main (pre-existing matrix/telegram xdist flakes excluded). Verified plugin
discovery + full hook surface.