feat(wecom): 企微智能机器人长连接接入 PAC 助手
把 PAC 助手接到企业微信「智能机器人 · API 模式 · 长连接」(@wecom/aibot-node-sdk):
- 被动应答:群里 @机器人 → 收 message.text → 映射客服 token → 复用 AssistantService.chat
(同一个助手大脑,自主调 MCP 工具)→ replyStream 流式回推(全量替换 + finish 收尾)。
- 主动推送:sendMessage 推「紧急召回」按钮卡片到群(带召回卡深链)。
- 按钮回写:模板卡片按钮点击 → 回写 plan_executions + 驱动状态机(召回闭环在企微内完成)。
开关:仅配置 PAC_WX_AIBOT_BOT_ID/SECRET 时启动长连接(其它环境静默跳过)。
身份映射 PoC:企微 userid 统一映射到 host=jvs-dw / 默认 tenant / staff;生产再换真实对照。
注:同一 bot 仅维持一条有效长连接(新连接踢旧),一个环境一个 bot;
卡片就地更新(updateTemplateCard)有企微 40058 待打磨,不影响回写。
demo 主动推送端点 @Public 但默认关(PAC_WX_AIBOT_DEMO_PUSH=1 才放行),生产勿开。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Showing
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment