dsh-wx-ilink 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 — 2026-11-10
4
+
5
+ ### 新增
6
+
7
+ - 群聊接入(可选):`groups.mode` 支持 `off` / `all` / `mention`,一个群对应一个 DSH 会话,回复发回群里;支持群白名单、成员白名单与自定义 @ 匹配正则。
8
+ - 关键错误告警:登录过期、连续拉取失败、回复发送失败、消息循环崩溃会主动推送微信;同类告警带冷却,登录成功后自动清空。
9
+
10
+ ### 变更
11
+
12
+ - `index.js` 从 2117 行拆分为入口 + 13 个 `lib/` 模块(config / text / login / panel / approval / questions / attachments / typing / peers / alerts 等),行为保持不变。
13
+ - 群聊消息会以 `[群聊 xxx · 成员 xxx]` 前缀交给模型,便于区分发言人。
14
+ - `send_weixin_file` 在群里发送到群。
15
+
16
+ ### 测试
17
+
18
+ - 新增群聊策略与告警单元测试,测试总数 31 项。
19
+
3
20
  ## 0.1.0 — 2026-11-09
4
21
 
5
22
  Initial public release.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 dsh-wx-ilink contributors
3
+ Copyright (c) 2026 Anda-1
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  把 **个人微信** 接入 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的独立插件:手机微信扫码登录后,微信消息进入独立的 DSH 会话;Agent 处理完,把结果发回微信。
4
4
 
5
- > 这是一个第三方开源项目,不是腾讯官方产品。协议参考腾讯官方 [`@tencent-weixin/openclaw-weixin`](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin)(MIT)所描述的 iLink Bot 接口;代码为独立实现。使用前请确认你的微信账号具备 iLink 入口,并自行评估账号与合规风险。
5
+ > 仓库:<https://github.com/An-yyds/dsh-wx-ilink> · 这是一个第三方开源项目,不是腾讯官方产品。协议参考腾讯官方 [`@tencent-weixin/openclaw-weixin`](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin)(MIT)所描述的 iLink Bot 接口;代码为独立实现。使用前请确认你的微信账号具备 iLink 入口,并自行评估账号与合规风险。
6
6
 
7
7
  ## 功能
8
8
 
@@ -18,6 +18,8 @@
18
18
  - 处理期间“正在输入”,长任务按间隔发进度提示
19
19
  - 原生 Web 面板:右上角微信图标(连接状态点)、扫码/验证码、联系人、人设编辑、重新登录/退出
20
20
  - 默认白名单:只允许扫码登录的本人微信号使用
21
+ - 群聊接入:可选开启,一个群一个 DSH 会话,支持 `all` / 仅被 @ 两种模式
22
+ - 关键错误告警:登录过期、收消息连续失败、回复发送失败、消息循环崩溃时主动推微信
21
23
 
22
24
  ## 要求
23
25
 
@@ -41,7 +43,7 @@ dsh plugin --profile web add dsh-wx-ilink@0.1.0
41
43
  ### 从 GitHub 安装
42
44
 
43
45
  ```bash
44
- dsh plugin --profile web add github:<your-github-name>/dsh-wx-ilink#v0.1.0
46
+ dsh plugin --profile web add github:An-yyds/dsh-wx-ilink#v0.1.0
45
47
  ```
46
48
 
47
49
  ### 从本地目录安装
@@ -62,6 +64,18 @@ dsh plugin --profile web add /absolute/path/to/dsh-wx-ilink
62
64
 
63
65
  也可以使用兜底页面:启动日志里的 `http://127.0.0.1:3080/weixin?token=...`。
64
66
 
67
+ <img width="388" height="164" alt="image" src="https://github.com/user-attachments/assets/94d951dd-4fcc-473f-be29-3e1a328df1b8" />
68
+
69
+ 重启将会在页面顶部栏出现插件标识
70
+
71
+ <img width="300" height="500" alt="image" src="https://github.com/user-attachments/assets/7e4c6f7b-68ac-40ea-a576-4966c698d391" />
72
+
73
+ 打开可以进行连接和查看状态
74
+
75
+ <img width="300" height="550" alt="ffd929140d4fba5376e8f5f08d5d578c" src="https://github.com/user-attachments/assets/cecc5469-4040-4cac-a211-9d91686db0ca" />
76
+
77
+
78
+
65
79
  ## 命令
66
80
 
67
81
  | 命令 | 作用 |
@@ -118,6 +132,14 @@ dsh plugin --profile web add /absolute/path/to/dsh-wx-ilink
118
132
  | `allowedUsers` | `[]` | 非空时只允许这些微信 ID;为空时只允许扫码本人 |
119
133
  | `allowAllUsers` | `false` | 设为 `true` 才允许任意联系人 |
120
134
  | `adminToken` | 自动生成 | 兜底登录页 token;持久化在 state.json |
135
+ | `groups.mode` | `off` | 群聊开关:`off` / `all`(全部群消息)/ `mention`(仅被 @) |
136
+ | `groups.allowedGroups` | `[]` | 允许的群 ID;为空表示全部允许(仍需开启 mode) |
137
+ | `groups.mentionPattern` | 空 | `mention` 模式判断“被 @”的正则;默认只要文本含 `@` 就算 |
138
+ | `groups.allowedMembers` | `[]` | 群内允许的成员 ID;为空表示群内所有成员都可用 |
139
+ | `alerts.enabled` | `true` | 关键错误主动推送微信告警 |
140
+ | `alerts.includeOwner` | `true` | 告警推给扫码登录的主人 |
141
+ | `alerts.toUsers` | `[]` | 额外告警接收人 |
142
+ | `alerts.throttleMs` | `300000` | 同类告警的冷却时间(毫秒) |
121
143
  | `botAgent` | `DSH-ILink/0.1.0` | 协议里的 bot_agent,仅用于观测 |
122
144
 
123
145
  ## 媒体
@@ -143,6 +165,43 @@ dsh plugin --profile web add /absolute/path/to/dsh-wx-ilink
143
165
  - 多条审批按联系人排队,一次只问一条
144
166
  - `ask_user_question` 会逐题转发;回复编号或直接输入文字
145
167
 
168
+ ## 群聊
169
+
170
+ 默认关闭。开启后,一个微信群对应一个 DSH 会话;回复发回群里。
171
+
172
+ ```yaml
173
+ - id: weixin-ilink
174
+ name: dsh-wx-ilink
175
+ config:
176
+ groups:
177
+ mode: mention # off / all / mention
178
+ allowedGroups: [] # 空 = 全部群;建议填明确的群 ID
179
+ mentionPattern: '' # 留空则“文本含 @”即视为被叫到
180
+ ```
181
+
182
+ - 群消息会以 `[群聊 xxxx · 成员 xxxx] 内容` 的格式交给模型,模型能区分发言人
183
+ - 未授权的群只会回复一次“群 ID + 如何授权”,不会刷屏
184
+ - 群内命令(`/new`、`/status`、`/persona` 等)与单聊一致
185
+ - 会话标题为 `微信群·xxxx`,可在 DSH 侧边栏直接看到
186
+ - `send_weixin_file` 在群里会把文件发到群
187
+
188
+ **注意**:iLink 群消息的字段行为需要以真实群验证;`mention` 模式默认用“文本里出现 `@`”判断,必要时用 `mentionPattern` 指定机器人昵称。
189
+
190
+ ## 告警
191
+
192
+ 关键错误会主动推送到微信(默认发给扫码登录的主人):
193
+
194
+ | 告警类型 | 触发条件 |
195
+ |---|---|
196
+ | `session-expired` | bot_token 失效,需要重新扫码 |
197
+ | `poll-failed` | 连续 3 次拉取消息失败 |
198
+ | `send-failed` | 回复微信失败(重试后仍失败) |
199
+ | `loop-crashed` | 消息循环异常退出 |
200
+
201
+ - 同类告警在 `alerts.throttleMs`(默认 5 分钟)内只发一次
202
+ - 告警发送失败只写日志,不会递归告警
203
+ - 重新登录成功后自动清空冷却
204
+
146
205
  ## 安全
147
206
 
148
207
  - 默认只允许扫码登录的微信号;`allowedUsers` 可增加,`allowAllUsers: true` 才会放开所有人
@@ -155,14 +214,24 @@ dsh plugin --profile web add /absolute/path/to/dsh-wx-ilink
155
214
  ## 实现
156
215
 
157
216
  ```
158
- index.js Host 插件:路由、登录、长轮询、会话映射、Agent 驱动、审批、提问、人设
159
- client.js DSH Web 客户端:右上角图标 + 原生右侧抽屉
160
- lib/ilink.js iLink HTTP 协议:登录、getupdates、sendmessage、typing、媒体上传
161
- lib/media.js CDN 下载、AES-128-ECB 解密、媒体描述
162
- lib/state.js 原子状态存储
163
- lib/qr.js 二维码 SVG
164
- vendor/qrcode.mjs qrcode-generator 2.0.4(MIT)
165
- test/ 协议/媒体/上传单元测试
217
+ index.js Host 插件入口:状态、长轮询、消息分发、命令、Agent 驱动
218
+ client.js DSH Web 客户端:右上角图标 + 原生右侧抽屉
219
+ lib/config.js 配置解析、常量、帮助文本
220
+ lib/text.js 纯文本 / HTTP 小工具
221
+ lib/ilink.js iLink HTTP 协议:登录、getupdates、sendmessage、typing、媒体上传
222
+ lib/media.js CDN 下载、AES-128-ECB 解密、媒体描述
223
+ lib/login.js 扫码登录状态机
224
+ lib/panel.js 本机登录页与兜底路由
225
+ lib/approval.js 工具审批 → 微信 1/2(排队)
226
+ lib/questions.js ask_user_question → 微信逐题问答
227
+ lib/attachments.js 媒体 → DSH 内容块
228
+ lib/typing.js “正在输入”与进度提示
229
+ lib/peers.js 单聊 / 群聊主体解析与群策略
230
+ lib/alerts.js 关键错误主动告警
231
+ lib/state.js 原子状态存储
232
+ lib/qr.js 二维码 SVG
233
+ vendor/qrcode.mjs qrcode-generator 2.0.4(MIT)
234
+ test/ 协议 / 媒体 / 上传 / 群聊 / 告警单元测试
166
235
  ```
167
236
 
168
237
  协议细节:`get_bot_qrcode` → `get_qrcode_status` → `getupdates` 长轮询 → `sendmessage`;媒体走 `getuploadurl` + CDN。
@@ -177,7 +246,6 @@ npm test
177
246
 
178
247
  ## 已知限制
179
248
 
180
- - 只处理单聊,群聊消息忽略
181
249
  - 不支持发语音;收到语音只用转写文字
182
250
  - 引用消息、名片、小程序未解析
183
251
  - 图片理解取决于模型;文本模型只能拿到文件附件
@@ -185,6 +253,9 @@ npm test
185
253
  - 回复是整轮完成后的最终文本,没有流式逐字输出
186
254
  - 单机器人/单微信账号
187
255
 
256
+ ## 说明
257
+ 做这个插件源于微信 ClawBot 插件,想着在手机端可以发消息给电脑端的DSH,帮助我处理一些文件什么的。本插件全程使用DSH的创造模式开发,我只协调测试和审查,确实提高了开发的速度。同时开发这个插件也是开到了一个wx的文章,该作者很强大也是开发了一个这样的插件,还支持群聊功能,大家可以去支持https://github.com/agi-redtea/dsh-weixin-web。我在此加了一个人设的配置,用户可以自由配置人设,这样感觉更好。后续也会继续开发,继续完善这个插件,后续可以补充发送表情什么的。
258
+
188
259
  ## License
189
260
 
190
261
  MIT。二维码库 [qrcode-generator](https://github.com/kazuhikoarase/qrcode-generator) 也是 MIT,版权归其作者。