feat(gateway): add WeChat QR setup flow - #4175
Conversation
|
I double-checked the implementation before opening this PR: the WeChat integration here does not depend on The adapter/login flow is wired directly against the official iLink endpoints exposed through |
28918f7 to
d39e779
Compare
|
This is great—I tested it locally and can control it via WeChat now. |
|
For most Chinese users, WeChat is the primary messaging platform in daily life. Enterprise WeChat/WeCom is useful, but it serves a different scenario and cannot replace regular WeChat for general personal use. That means regular WeChat support is not just a “nice to have” variant of Enterprise WeChat support. It is the main path if Hermes wants meaningful adoption among Chinese-speaking users. |
|
Merged via PR #8665 which synthesizes the best fixes from ~25 community PRs into a single consolidated change. Your contribution (WeChat QR setup flow) was reviewed and informed the final implementation. Thank you @latentharbor for your work on this! |
What does this PR do?
Adds first-class WeChat support to the Hermes gateway using the official WeChat AI bot login/API flow, with QR pairing integrated
directly into Hermes setup.
This revives the earlier WeChat adapter direction, but updates it for the current gateway/CLI architecture and removes the manual
standalone login step. Instead of requiring users to run a separate
scripts/weixin_login.pyflow first, WeChat can now be configuredthrough
hermes setup,hermes gateway setup, orhermes wechat, with QR pairing rendered directly in the terminal.The implementation also wires WeChat through the full Hermes messaging surface: gateway config/env loading, adapter creation, allowlist
auth, toolset selection,
send_message, cron delivery, channel discovery, and status/setup UX.Related Issue
Fixes #2422
Supersedes the earlier WeChat adapter attempts in #2425 and #2502.
Type of Change
Changes Made
gateway/platforms/weixin.pygateway/config.py,gateway/run.py,gateway/channel_directory.py,toolsets.py,cron/ scheduler.py, andtools/send_message_tool.pyagent/prompt_builder.py,hermes_cli/gateway.py,hermes_cli/setup.py,hermes_cli/status.py,hermes_cli/tools_config.py, andhermes_cli/main.pyhermes_cli/wechat_login.pyscripts/weixin_login.pyas a thin compatibility wrapper around the shared login moduletests/gateway/test_weixin.pyandtests/hermes_cli/test_wechat_login.pyHow to Test
UV_CACHE_DIR=/tmp/uv-cache uv run python -m hermes_cli.main setupWeChat (Weixin)from the messaging setup flow and complete QR pairing in the terminalWEIXIN_TOKENandWEIXIN_ACCOUNT_IDare written to the active Hermes env file, then runuv run python -m hermes_cli.main gatewayKeyError('weixin')UV_CACHE_DIR=/tmp/uv-cache uv run --with pytest --with pytest-xdist python -m pytest tests/hermes_cli/ test_wechat_login.py tests/gateway/test_weixin.py tests/gateway/test_config.py tests/gateway/test_status.py tests/gateway/ test_channel_directory.py tests/hermes_cli/test_gateway.py tests/tools/test_send_message_tool.py tests/tools/ test_send_message_missing_platforms.py tests/gateway/test_allowlist_startup_check.py tests/gateway/test_unauthorized_dm_behavior.py -qChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/Ablob/main/CONTRIBUTING.md#cross-platform-compatibility) — or N/A
Screenshots / Logs
hermes setupnow showsWeChat (Weixin)in the messaging platform flowhermes setup/hermes gateway setup/hermes wechat