feat: add WeCom (企业微信) smart bot via AIP long connection#321
Open
jimhy wants to merge 1 commit into
Open
Conversation
Add Enterprise WeChat (WeCom) integration over the 智能机器人 AIP WebSocket long connection, built on the official @wecom/aibot-node-sdk. This is a separate platform from the existing personal-WeChat iLink integration (src/wechat/). - src/wecom/wecom-bot.ts: SDK WSClient setup, message/event wiring, frame -> IncomingMessage mapping, MessageBridge integration - src/wecom/wecom-sender.ts: IMessageSender impl mapping the bridge's sendCard -> updateCard -> final lifecycle onto WeCom streaming replies (aibot_respond_msg with a shared stream.id); active-push fallback for notices/output files; AES media download + chunked upload via the SDK - config.ts: WecomBotConfig plus env (WECOM_BOT_ID/WECOM_BOT_SECRET) and bots.json (wecomBots) parsing - index.ts / api/bot-registry.ts / api/bots-config-writer.ts: register the new 'wecom' platform across startup, registry, and config CRUD - docs: CLAUDE.md, .env.example, bots.example.json Verified: long-connection auth + full app boot against a real WeCom bot. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
概述
新增企业微信(WeCom)智能机器人对接,基于「智能机器人 AIP WebSocket 长连接」(
wss://openws.work.weixin.qq.com),使用官方@wecom/aibot-node-sdk。与现有的个人微信 iLink 对接(src/wechat/)是相互独立的两个平台,互不影响。改动
src/wecom/wecom-bot.ts—startWecomBot():创建 SDKWSClient,监听message.*/event.enter_chat,把企业微信回调帧映射为平台无关的IncomingMessage,绑定 frame(用于按req_id路由流式回复),接入共享的MessageBridge。src/wecom/wecom-sender.ts—WecomSender implements IMessageSender:把 bridge 的sendCard → updateCard* → final生命周期映射到企业微信流式回复(aibot_respond_msg+ 共享stream.id,全量替换内容,终态置finish=true);命令回复 / 通知 / 产出文件走主动推送aibot_send_msg兜底;AES 媒体下载与分片上传由 SDK 处理。src/config.ts— 新增WecomBotConfig,支持环境变量(WECOM_BOT_ID/WECOM_BOT_SECRET/WECOM_WS_URL)与bots.json(wecomBots)两种配置方式。src/index.ts/src/api/bot-registry.ts/src/api/bots-config-writer.ts— 在启动、注册表、配置 CRUD 中接入新平台wecom。CLAUDE.md、.env.example、bots.example.json。配置
WECOM_BOT_ID/WECOM_BOT_SECRET(私有化部署可选WECOM_WS_URL)。bots.json):wecomBots数组(wecomBotId/wecomSecret/wecomWsUrl),可与 Feishu / Telegram 等共存。测试
tsc/eslint/prettier(新文件)全部通过;既有测试 175 通过(8 个失败均为 Windows 上skill-hub-store.test.ts临时目录EPERM的预先存在问题,与本 PR 无关)。说明
🤖 Generated with Claude Code