zhao999/dsh-plugin-wecom-bot ↗★ 0
dsh-plugin-wecom-bot
DeepSeek Harness 插件:通过企业微信「智能机器人」长连接收发消息,把私聊/群聊消息作为任务下发给 DSH agent,并把结果回传到企业微信。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:zhao999/dsh-plugin-wecom-bot说明文档
阅读完整 README ↗dsh-plugin-wecom-bot
DeepSeek Harness(DSH)插件:通过企业微信「智能机器人」长连接收发消息, 把发给机器人的文本当作任务下发给 DSH agent 执行,并把结果回传到企业微信。
- 零公网依赖:长连接模式由插件主动连出到企业微信网关(WebSocket), 不需要公网 URL、不需要消息加解密、不需要可信 IP 白名单。
- 仅一个运行时依赖(
ws):Node 内置 WebSocket 不带 ALPN 扩展, 会被企业微信网关 400 拒绝(详见「常见问题」),因此使用ws库。 - 支持私聊与群聊 @机器人,多轮上下文(per-user 会话)或一次性任务(per-message)。
工作原理
企业微信成员 ──私聊/群聊──▶ 智能机器人 ──wss://openws.work.weixin.qq.com──▶ 本插件
│
◀── aibot_respond_msg(stream 流式回复)◀── agent 任务结果 ─────────┤
▼
DSH agents.create → followup
→ whenIdle → 汇总文本
协议实现基于官方文档 《智能机器人长连接》, 并与 cc-connect、 CowAgent 两个开源实现交叉验证。
一、企业微信后台:创建智能机器人
-
登录 企业微信管理后台。
-
进入 应用管理 → 智能机器人 → 创建智能机器人。
-
填写名称、头像等信息,创建完成后记录两个凭证:
BotID: xxxxxxxxxxxxxxxx Secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx⚠️ Secret 只显示一次,请立即保存。
-
把机器人添加到会话:创建后在企业微信 App 里搜索该机器人,即可直接私聊; 也可以把它拉进群聊,群成员
@机器人发任务。
二、安装插件
在插件源码目录(本目录)执行:
# 1. 先装插件自身的依赖(link: 安装方式要求插件自带 node_modules)
pnpm install
# 2. 装进 web profile
dsh plugin --profile web add .
这会用 pnpm 把插件装进 ~/.dsh/profiles/web,并把 dsh-plugin-wecom-bot
追加到该 profile 的 dsh.profile.bundles(bundle 层)。重启 dsh web 生效。
本机没有 pnpm 时可用 corepack 启用,或在工作区内安装:
npm install --prefix .tools/pnpm pnpm --cache .npm-cache, 然后把.tools/pnpm/node_modules/.bin加入 PATH。
三、配置凭证
两种方式任选其一:
方式 A:环境变量(默认,推荐)
export WECOM_BOT_ID="wwxxxxxxxxxxxxxx"
export WECOM_BOT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
dsh web