dsh-msg-hub
dsh IM hub: WeChat(ilinkai) / QQ / Feishu bridge with proactive push & remote monitoring
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:AbcdefgXW/dsh-msg-hub说明文档
阅读完整 README ↗保留 sandbox-policy / approval 等系统配置不动
**② `cannot resolve profile bundle "dsh-msg-hub"`(依赖缺失)**
```bash
vi /home/dsh/profiles/web/package.json # 检查 bundles 与 dependencies 对应
ls -la /home/dsh/profiles/web/node_modules/ | grep dsh-
ln -s /path/to/插件目录 /home/dsh/profiles/web/node_modules/dsh-msg-hub # 恢复软链
通用救急(备份回滚):
ls /home/dsh/profiles/web/cordis.patch.yml.bak-* # patch 备份
ls /home/dsh/profiles/web/package.json.bak-* # package.json 备份
cp 备份名 /home/dsh/profiles/web/cordis.patch.yml # 覆盖回去
修改后重启 dsh 生效;仍失败看日志:docker logs deepseek-harness。
⚠️ 本插件自带
cordis.patch.yml注册行,由dsh plugin add自动挂载,切勿在 profile 的cordis.patch.yml手动 insert(见「安装」警示)。
扩展新 IM 渠道(适配器注册表,预留给第三方插件)
内置微信 / QQ / 飞书三个渠道;其他渠道通过适配器注册表接入,无需改本插件代码:
// 第三方插件(如 dsh-telegram-bridge)在启动时注册:
const api = ctx.get("dsh-channels-push"); // 服务 id:dsh-channels-push
api.registerChannel("telegram", {
// 必选:向 peerId 发送文本(peerId 为渠道侧的用户/群标识)
send: async (peerId, text) => { /* 调 Telegram Bot API 发送 */ },
// 可选:自定义会话 ID 匹配(默认按 ch-- 前缀解析)
matchSessionId: (sessionId) => sessionId.startsWith("ch-telegram-"),
});
注册后自动获得完整能力:
- 主动推送:
push({ channel: "telegram", peerId, text })—— 定时心跳等可直接推到新渠道 - 任务下发:
task({ channel, peerId, prompt })—— 唤醒渠道 agent 执行并把回复回传 - 会话解析:
resolveChannel("ch-telegram- ")—— 与内置渠道一致
会话 ID 规范:ch-- (如 ch-weixin-xxx、ch-telegram-xxx)。
环境变量
| 变量 | 用途 | 默认 |
|---|---|---|
DSH_CHANNELS_STATE_DIR | 渠道状态目录(凭证/日志/数据) | 插件 state/ 目录 |
DSH_CHANNELS_CWD | 渠道 agent 工作区根 | /workspace |
安全提示
- 微信(ilinkai)为模拟网页协议,非官方 API——主动频繁发消息存在账号风控风险,建议仅低频推送(定时任务间隔 ≥ 15 分钟)
- QQ 主动消息需在开放平台申请「主动消息权限」,未开通时主动推送会静默失败(被动回复不受影响)
- 飞书为官方 API,合规无风险
- 凭证存储于
state/目录(.gitignore已排除),请勿提交
License
MIT