dsh-qqbot-plus 0.0.0-stage → 0.1.3

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.
Files changed (301) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/CHANGELOG_EN.md +192 -0
  3. package/LICENSE +21 -0
  4. package/README.md +294 -2
  5. package/README_EN.md +262 -0
  6. package/cordis.patch.yml +163 -0
  7. package/cordis.yml +112 -0
  8. package/install.sh +108 -0
  9. package/lib/alarms.js +371 -0
  10. package/lib/client.js +2411 -0
  11. package/lib/commands/auth.d.ts +18 -0
  12. package/lib/commands/auth.d.ts.map +1 -0
  13. package/lib/commands/auth.js +15 -0
  14. package/lib/commands/auth.js.map +1 -0
  15. package/lib/commands/help.d.ts +10 -0
  16. package/lib/commands/help.d.ts.map +1 -0
  17. package/lib/commands/help.js +39 -0
  18. package/lib/commands/help.js.map +1 -0
  19. package/lib/commands/index.d.ts +15 -0
  20. package/lib/commands/index.d.ts.map +1 -0
  21. package/lib/commands/index.js +30 -0
  22. package/lib/commands/index.js.map +1 -0
  23. package/lib/commands/misc.d.ts +21 -0
  24. package/lib/commands/misc.d.ts.map +1 -0
  25. package/lib/commands/misc.js +93 -0
  26. package/lib/commands/misc.js.map +1 -0
  27. package/lib/commands/model.d.ts +6 -0
  28. package/lib/commands/model.d.ts.map +1 -0
  29. package/lib/commands/model.js +63 -0
  30. package/lib/commands/model.js.map +1 -0
  31. package/lib/commands/new.js +17 -0
  32. package/lib/commands/preset.d.ts +8 -0
  33. package/lib/commands/preset.d.ts.map +1 -0
  34. package/lib/commands/preset.js +56 -0
  35. package/lib/commands/preset.js.map +1 -0
  36. package/lib/commands/session.d.ts +14 -0
  37. package/lib/commands/session.d.ts.map +1 -0
  38. package/lib/commands/session.js +34 -0
  39. package/lib/commands/session.js.map +1 -0
  40. package/lib/commands/status.d.ts +7 -0
  41. package/lib/commands/status.d.ts.map +1 -0
  42. package/lib/commands/status.js +26 -0
  43. package/lib/commands/status.js.map +1 -0
  44. package/lib/commands/types.d.ts +21 -0
  45. package/lib/commands/types.d.ts.map +1 -0
  46. package/lib/commands/types.js +2 -0
  47. package/lib/commands/types.js.map +1 -0
  48. package/lib/config.d.ts +95 -0
  49. package/lib/config.js +88 -0
  50. package/lib/features/answer-parser.d.ts +9 -0
  51. package/lib/features/answer-parser.d.ts.map +1 -0
  52. package/lib/features/answer-parser.js +23 -0
  53. package/lib/features/answer-parser.js.map +1 -0
  54. package/lib/features/approval-channel.d.ts +94 -0
  55. package/lib/features/approval-channel.d.ts.map +1 -0
  56. package/lib/features/approval-channel.js +158 -0
  57. package/lib/features/approval-channel.js.map +1 -0
  58. package/lib/features/approval-renderer.d.ts +18 -0
  59. package/lib/features/approval-renderer.d.ts.map +1 -0
  60. package/lib/features/approval-renderer.js +52 -0
  61. package/lib/features/approval-renderer.js.map +1 -0
  62. package/lib/features/button-utils.d.ts +34 -0
  63. package/lib/features/button-utils.d.ts.map +1 -0
  64. package/lib/features/button-utils.js +27 -0
  65. package/lib/features/button-utils.js.map +1 -0
  66. package/lib/features/history-store.d.ts +8 -0
  67. package/lib/features/history-store.d.ts.map +1 -0
  68. package/lib/features/history-store.js +23 -0
  69. package/lib/features/history-store.js.map +1 -0
  70. package/lib/features/question-channel.d.ts +96 -0
  71. package/lib/features/question-channel.d.ts.map +1 -0
  72. package/lib/features/question-channel.js +234 -0
  73. package/lib/features/question-channel.js.map +1 -0
  74. package/lib/features/question-renderer.d.ts +20 -0
  75. package/lib/features/question-renderer.d.ts.map +1 -0
  76. package/lib/features/question-renderer.js +70 -0
  77. package/lib/features/question-renderer.js.map +1 -0
  78. package/lib/fishcheck/measure.js +230 -0
  79. package/lib/fishcheck/rules.js +99 -0
  80. package/lib/fishmeme/plugin.js +605 -0
  81. package/lib/fishmeme/routes.js +141 -0
  82. package/lib/fishmemory/plugin.js +1052 -0
  83. package/lib/gateway/bootstrap.d.ts +12 -0
  84. package/lib/gateway/bootstrap.d.ts.map +1 -0
  85. package/lib/gateway/bootstrap.js +200 -0
  86. package/lib/gateway/bootstrap.js.map +1 -0
  87. package/lib/gateway/index.d.ts +3 -0
  88. package/lib/gateway/index.d.ts.map +1 -0
  89. package/lib/gateway/index.js +3 -0
  90. package/lib/gateway/index.js.map +1 -0
  91. package/lib/gateway/middleware-setup.d.ts +12 -0
  92. package/lib/gateway/middleware-setup.d.ts.map +1 -0
  93. package/lib/gateway/middleware-setup.js +82 -0
  94. package/lib/gateway/middleware-setup.js.map +1 -0
  95. package/lib/host/adapter.d.ts +48 -0
  96. package/lib/host/adapter.d.ts.map +1 -0
  97. package/lib/host/adapter.js +127 -0
  98. package/lib/host/adapter.js.map +1 -0
  99. package/lib/humanlike/ENV_PROMPT.md +28 -0
  100. package/lib/humanlike/affinity.js +316 -0
  101. package/lib/humanlike/learn.js +343 -0
  102. package/lib/humanlike/life.js +899 -0
  103. package/lib/humanlike/mind.js +323 -0
  104. package/lib/humanlike/plugin.js +587 -0
  105. package/lib/humanlike/reach.js +119 -0
  106. package/lib/humanlike/real.js +276 -0
  107. package/lib/humanlike/rules.js +67 -0
  108. package/lib/humanlike/settings-api.js +159 -0
  109. package/lib/humanlike/settings.js +370 -0
  110. package/lib/humanlike/together.js +251 -0
  111. package/lib/identity/paths.js +27 -0
  112. package/lib/identity/persona.js +75 -0
  113. package/lib/identity/portrait.js +25 -0
  114. package/lib/identity/runtime.js +78 -0
  115. package/lib/index.d.ts +15 -0
  116. package/lib/index.js +117 -0
  117. package/lib/media/draft-tool.js +442 -0
  118. package/lib/media/draft-tool.js.bak-to-182027 +389 -0
  119. package/lib/media/media-cleaner.d.ts +19 -0
  120. package/lib/media/media-cleaner.d.ts.map +1 -0
  121. package/lib/media/media-cleaner.js +81 -0
  122. package/lib/media/media-cleaner.js.map +1 -0
  123. package/lib/media/say-tool.js +72 -0
  124. package/lib/media/send-file-tool.d.ts +12 -0
  125. package/lib/media/send-file-tool.d.ts.map +1 -0
  126. package/lib/media/send-file-tool.js +122 -0
  127. package/lib/media/send-file-tool.js.map +1 -0
  128. package/lib/media/send-media.d.ts +61 -0
  129. package/lib/media/send-media.d.ts.map +1 -0
  130. package/lib/media/send-media.js +104 -0
  131. package/lib/media/send-media.js.map +1 -0
  132. package/lib/media/vision-tool.d.ts +22 -0
  133. package/lib/media/vision-tool.d.ts.map +1 -0
  134. package/lib/media/vision-tool.js +288 -0
  135. package/lib/media/vision-tool.js.map +1 -0
  136. package/lib/middleware/attachment.d.ts +11 -0
  137. package/lib/middleware/attachment.d.ts.map +1 -0
  138. package/lib/middleware/attachment.js +30 -0
  139. package/lib/middleware/attachment.js.map +1 -0
  140. package/lib/middleware/question-answer.d.ts +10 -0
  141. package/lib/middleware/question-answer.d.ts.map +1 -0
  142. package/lib/middleware/question-answer.js +19 -0
  143. package/lib/middleware/question-answer.js.map +1 -0
  144. package/lib/model/index.d.ts +10 -0
  145. package/lib/model/index.d.ts.map +1 -0
  146. package/lib/model/index.js +9 -0
  147. package/lib/model/index.js.map +1 -0
  148. package/lib/model/model-resolver.d.ts +102 -0
  149. package/lib/model/model-resolver.d.ts.map +1 -0
  150. package/lib/model/model-resolver.js +206 -0
  151. package/lib/model/model-resolver.js.map +1 -0
  152. package/lib/model/prefs-store.d.ts +50 -0
  153. package/lib/model/prefs-store.d.ts.map +1 -0
  154. package/lib/model/prefs-store.js +215 -0
  155. package/lib/model/prefs-store.js.map +1 -0
  156. package/lib/model/settings-reader.d.ts +19 -0
  157. package/lib/model/settings-reader.d.ts.map +1 -0
  158. package/lib/model/settings-reader.js +76 -0
  159. package/lib/model/settings-reader.js.map +1 -0
  160. package/lib/model/types.d.ts +15 -0
  161. package/lib/model/types.d.ts.map +1 -0
  162. package/lib/model/types.js +5 -0
  163. package/lib/model/types.js.map +1 -0
  164. package/lib/resume-check.js +122 -0
  165. package/lib/resume-tool.js +29 -0
  166. package/lib/rules.js +57 -0
  167. package/lib/session/idle-evictor.d.ts +18 -0
  168. package/lib/session/idle-evictor.d.ts.map +1 -0
  169. package/lib/session/idle-evictor.js +31 -0
  170. package/lib/session/idle-evictor.js.map +1 -0
  171. package/lib/session/index.d.ts +9 -0
  172. package/lib/session/index.d.ts.map +1 -0
  173. package/lib/session/index.js +8 -0
  174. package/lib/session/index.js.map +1 -0
  175. package/lib/session/pick-agent.js +116 -0
  176. package/lib/session/session-id.d.ts +5 -0
  177. package/lib/session/session-id.d.ts.map +1 -0
  178. package/lib/session/session-id.js +15 -0
  179. package/lib/session/session-id.js.map +1 -0
  180. package/lib/session/session-manager.d.ts +138 -0
  181. package/lib/session/session-manager.d.ts.map +1 -0
  182. package/lib/session/session-manager.js +1157 -0
  183. package/lib/session/session-manager.js.bak-target +1081 -0
  184. package/lib/session/session-manager.js.bak-title-20261118 +1119 -0
  185. package/lib/session/session-manager.js.map +1 -0
  186. package/lib/session/types.d.ts +162 -0
  187. package/lib/session/types.d.ts.map +1 -0
  188. package/lib/session/types.js +2 -0
  189. package/lib/session/types.js.map +1 -0
  190. package/lib/setup/bind-routes.d.ts +78 -0
  191. package/lib/setup/bind-routes.d.ts.map +1 -0
  192. package/lib/setup/bind-routes.js +588 -0
  193. package/lib/setup/bind-routes.js.bak-join-163944 +761 -0
  194. package/lib/setup/bind-routes.js.map +1 -0
  195. package/lib/setup/binding-service.d.ts +86 -0
  196. package/lib/setup/binding-service.d.ts.map +1 -0
  197. package/lib/setup/binding-service.js +175 -0
  198. package/lib/setup/binding-service.js.map +1 -0
  199. package/lib/setup/index.d.ts +50 -0
  200. package/lib/setup/index.d.ts.map +1 -0
  201. package/lib/setup/index.js +163 -0
  202. package/lib/setup/index.js.map +1 -0
  203. package/lib/setup/persist.d.ts +42 -0
  204. package/lib/setup/persist.d.ts.map +1 -0
  205. package/lib/setup/persist.js +344 -0
  206. package/lib/setup/persist.js.map +1 -0
  207. package/lib/setup/presenters.d.ts +40 -0
  208. package/lib/setup/presenters.d.ts.map +1 -0
  209. package/lib/setup/presenters.js +84 -0
  210. package/lib/setup/presenters.js.map +1 -0
  211. package/lib/setup/qr-svg.d.ts +9 -0
  212. package/lib/setup/qr-svg.d.ts.map +1 -0
  213. package/lib/setup/qr-svg.js +33 -0
  214. package/lib/setup/qr-svg.js.map +1 -0
  215. package/lib/shared/bind-protocol.d.ts +42 -0
  216. package/lib/shared/bind-protocol.d.ts.map +1 -0
  217. package/lib/shared/bind-protocol.js +33 -0
  218. package/lib/shared/bind-protocol.js.map +1 -0
  219. package/lib/shared/dirs.d.ts +10 -0
  220. package/lib/shared/dirs.d.ts.map +1 -0
  221. package/lib/shared/dirs.js +20 -0
  222. package/lib/shared/dirs.js.map +1 -0
  223. package/lib/shared/http-body.js +43 -0
  224. package/lib/shared/index.d.ts +8 -0
  225. package/lib/shared/index.d.ts.map +1 -0
  226. package/lib/shared/index.js +8 -0
  227. package/lib/shared/index.js.map +1 -0
  228. package/lib/shared/json-file.js +34 -0
  229. package/lib/shared/orders.js +26 -0
  230. package/lib/shared/scope.d.ts +14 -0
  231. package/lib/shared/scope.d.ts.map +1 -0
  232. package/lib/shared/scope.js +12 -0
  233. package/lib/shared/scope.js.map +1 -0
  234. package/lib/shared/send-helper.d.ts +11 -0
  235. package/lib/shared/send-helper.d.ts.map +1 -0
  236. package/lib/shared/send-helper.js +13 -0
  237. package/lib/shared/send-helper.js.map +1 -0
  238. package/lib/shared/utils.d.ts +31 -0
  239. package/lib/shared/utils.d.ts.map +1 -0
  240. package/lib/shared/utils.js +228 -0
  241. package/lib/shared/utils.js.map +1 -0
  242. package/lib/tool-guard.js +74 -0
  243. package/lib/transport/attachment.d.ts +41 -0
  244. package/lib/transport/attachment.d.ts.map +1 -0
  245. package/lib/transport/attachment.js +191 -0
  246. package/lib/transport/attachment.js.map +1 -0
  247. package/lib/transport/chunker.d.ts +14 -0
  248. package/lib/transport/chunker.d.ts.map +1 -0
  249. package/lib/transport/chunker.js +78 -0
  250. package/lib/transport/chunker.js.map +1 -0
  251. package/lib/transport/deliverables.d.ts +20 -0
  252. package/lib/transport/deliverables.d.ts.map +1 -0
  253. package/lib/transport/deliverables.js +72 -0
  254. package/lib/transport/deliverables.js.map +1 -0
  255. package/lib/transport/events.d.ts +117 -0
  256. package/lib/transport/events.d.ts.map +1 -0
  257. package/lib/transport/events.js +112 -0
  258. package/lib/transport/events.js.map +1 -0
  259. package/lib/transport/inbound.d.ts +11 -0
  260. package/lib/transport/inbound.d.ts.map +1 -0
  261. package/lib/transport/inbound.js +511 -0
  262. package/lib/transport/inbound.js.map +1 -0
  263. package/lib/transport/index.d.ts +10 -0
  264. package/lib/transport/index.d.ts.map +1 -0
  265. package/lib/transport/index.js +10 -0
  266. package/lib/transport/index.js.map +1 -0
  267. package/lib/transport/msgid-cache.d.ts +23 -0
  268. package/lib/transport/msgid-cache.d.ts.map +1 -0
  269. package/lib/transport/msgid-cache.js +57 -0
  270. package/lib/transport/msgid-cache.js.map +1 -0
  271. package/lib/transport/notify.js +147 -0
  272. package/lib/transport/outbound-buffer.d.ts +42 -0
  273. package/lib/transport/outbound-buffer.d.ts.map +1 -0
  274. package/lib/transport/outbound-buffer.js +68 -0
  275. package/lib/transport/outbound-buffer.js.map +1 -0
  276. package/lib/transport/outbound.d.ts +42 -0
  277. package/lib/transport/outbound.d.ts.map +1 -0
  278. package/lib/transport/outbound.js +183 -0
  279. package/lib/transport/outbound.js.map +1 -0
  280. package/lib/transport/reply-limiter.d.ts +31 -0
  281. package/lib/transport/reply-limiter.d.ts.map +1 -0
  282. package/lib/transport/reply-limiter.js +50 -0
  283. package/lib/transport/reply-limiter.js.map +1 -0
  284. package/lib/transport/reply-target.d.ts +32 -0
  285. package/lib/transport/reply-target.d.ts.map +1 -0
  286. package/lib/transport/reply-target.js +64 -0
  287. package/lib/transport/reply-target.js.map +1 -0
  288. package/lib/transport/streaming-writer.d.ts +55 -0
  289. package/lib/transport/streaming-writer.d.ts.map +1 -0
  290. package/lib/transport/streaming-writer.js +122 -0
  291. package/lib/transport/streaming-writer.js.map +1 -0
  292. package/lib/transport/tool-presenter.d.ts +37 -0
  293. package/lib/transport/tool-presenter.d.ts.map +1 -0
  294. package/lib/transport/tool-presenter.js +116 -0
  295. package/lib/transport/tool-presenter.js.map +1 -0
  296. package/lib/turn-check.js +85 -0
  297. package/lib/types.d.ts +39 -0
  298. package/lib/types.js +5 -0
  299. package/locale/en.json +6 -0
  300. package/locale/zh.json +6 -0
  301. package/package.json +127 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,192 @@
1
+ # Changelog
2
+
3
+ > [English](./CHANGELOG_EN.md)
4
+
5
+ 本文件从产品视角记录 dsh-qqbot 的重要更新,聚焦用户可感知的变化。
6
+
7
+ 格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)。
8
+
9
+ ## [0.1.3] - 2026-11-21
10
+
11
+ - 依赖 `sharp` 抬到 `^0.35.5`:这一版没有 `install` 脚本,安装不再被 pnpm 的构建脚本保护拦住,profile 里也不用再加 `allowBuilds`
12
+
13
+ ## [0.1.2] - 2026-11-21
14
+
15
+ - 设置窗口里不再重复注册「QQ 机器人」栏目:侧栏主面板已是同一份内容,只保留侧栏入口。
16
+
17
+ ## [0.1.1] - 2026-11-21
18
+
19
+ ### 新功能
20
+
21
+ - **设置页新增「人设」页签**:人设、画像、「在 QQ 里怎么回话」的规则从机器人页签搬出来单独一页,机器人页只留连接与运行参数。
22
+ - **设置页新增「表情包」页签**:直接看图库、改描述与标签、换目录、清理失效记录,点开缩略图能看大图。
23
+ - **表情包并入插件本体**:原先的独立插件 dsh-fishmeme 合并进来,数据放在 `~/.dsh/dsh-qqbot-plus/memes`,旧索引首次运行自动迁移,不必再装两个插件。
24
+ - **发图缩图支持三平台**:改用可选的 `sharp`(npm 首次安装时按平台取预编译包),长边默认 360;装不上就原图直发,不影响发送。
25
+
26
+ ### 问题修复
27
+
28
+ - **闹钟可能静默丢失**:投递失败没有 await 也没有回写,一整批到点的闹钟会跟着消失;现在失败会放回队列并保留同批其余条目。
29
+ - **人味情绪永远不进前缀**:身份键早就改成 openid 字符串,旧的正则把它全过滤掉了。
30
+ - **状态文件半截写入**:settings / runtime / memes 索引等改原子写,避免断电或强杀后读到坏 JSON 把设置回默认。
31
+ - **切页签后面板变裸 HTML**:样式表原来挂在机器人页签的组件里,切走就随卸载删掉,现在改为整页共用。
32
+ - **控制台会话作废草稿报错**:`record` 可能不存在,改成可选链。
33
+
34
+ ## [0.5.5] - 2026-10-30
35
+
36
+ ### 问题修复
37
+
38
+ - **修复端内绑定二维码裂图**:改用 `createRequire` 加载 qrcode,绕过宿主 ESM 互通导致的 API 缺失;二维码无法生成时页面降级为提示,可重启应用、在浏览器打开链接或手动填写凭据。
39
+
40
+ ## [0.5.4] - 2026-10-28
41
+
42
+ ### 新功能
43
+
44
+ - **新增 `/bot-me` 指令**:查看发送者 OpenID(私聊为 user openid,群聊为群成员 openid 与群 openid),作为白名单配置的自助入口——用户拿 ID 交管理员加入名单即可。
45
+ - **管理指令白名单鉴权**:`/preset`、`/model` 私聊/群聊均可用,但仅限白名单用户,非白名单成员不可切换 preset/模型(群聊中切换影响该群会话);指令的私聊/群聊适用范围在 `/bot-help` 中标注。(#5)
46
+
47
+ ### ⚠️ 行为变更(安全默认)
48
+
49
+ - **访问控制默认收紧**:私聊默认白名单且留空拒绝所有人(此前留空会静默放行);群聊默认开放(有进群门槛与 @bot 双前置)。扫码绑定时私聊自动切白名单并重置为扫码用户(重绑即换人),绑定即授权。
50
+ - **工作目录默认独立**:Agent 工作目录缺省为 `~/.dsh-qqbot/workspace`,不再跟随 DSH 进程目录;显式配置 `cwd` 可覆盖。
51
+ - **审批按钮校验权限**:白名单模式下审批按钮只对名单内用户生效——非授权成员点击无效,私聊卡片转发后他人点击同样无效。
52
+
53
+ ### 问题修复
54
+
55
+ - **保存配置不再破坏其他插件**:绑定、改配置、解绑只改自己的条目,其他插件内容与注释原样保留。(#53)
56
+ - **长提示词可保存**:配置保存请求体上限从 4KB 提高到 512KB。(#69)
57
+ - **视觉链路隐患修复**:`qqbot_describe_image` 的消息来源改为新版会话格式,未来图片注入主对话不会报错。(#77)
58
+ - **会话 id 加固**:统一 `session-` 前缀(#81)——社区插件不再误判,多进程并发不产生重复 id;老会话沿用原 id。
59
+ - **切换模型修复**:`/model` 崩溃与切换后重启的「历史加载失败」均已修复,会话历史完整保留。
60
+ - **会话事件读取修复**:`/tokens` 显示 0、`/export` 导出为空、审批按钮不回显被审批命令——均已修复。
61
+ - **压缩修复**:`/compact` 误报「压缩能力不可用」或「当前无活跃会话」——均已修复;后者场景会自动从磁盘拉起会话再压缩。
62
+ - **修复 link 安装后保存配置失败**:`dsh plugin add link:` 安装时界面保存一直报「无法定位 profile 目录」,现已修复;多 profile 共享源码时按当前进程的 profile 精确写入,仍失败时提示手动编辑 `cordis.patch.yml`。(#78)
63
+ - **修复白名单默认值可被绕过**:完全省略 `access` 配置时私聊仍回落开放模式(外层默认值未随子字段更新),现已对齐白名单并加测试钉死。(#94)
64
+ - **审批卡片防混淆与身份加固**:按钮绑定本次审批的唯一标识,旧卡片点击不再生效;白名单模式下点击者身份缺失同样拒绝。(#94)
65
+ - **文件发送路径白名单解析符号链接**:按真实位置判定,root 内的符号链接指向外部时拒绝访问。(#94)
66
+ - **图片附件按真实格式命名扩展名**:QQ 网关对图片统一标注 `image/png`(实际多为 GIF/JPEG),落盘文件名照搬导致按扩展名解码的读图工具失败;现按文件头(magic bytes)识别真实格式并校正扩展名,字节不变、不转码,识别不了的格式保持原行为。(#76)
67
+ - **统一 workspace 路径解析**:新增插件目录单一事实源(`~/.dsh-qqbot`),workspace、media、模型偏好等子路径统一派生,未配置 `cwd` 时不再误用宿主进程目录(此前导致 workspace 内文件发送被误拒);不存在的文件也改为报「文件不存在」而非误报路径不允许。
68
+ - **vision 配置自动补写不再破坏 settings.yaml**:启动时为视觉模型补写 `input` 声明改用文档保真编辑(注释、锚点、其他配置原样保留)+ 原子写 + 并发冲突时放弃重试,此前全量重序列化会抹掉文件里的全部注释与排版。
69
+ - **偏好文件并发安全**:`model-prefs.json`(会话 id 映射,多实例/多进程共享)改为原子写 + 写前合并其他写者的条目,多 bot 或多 profile 并存不再互相覆盖丢映射;删除操作带墓碑防止被并发写复活;读取/写入失败升级为可见告警(此前仅 debug 甚至静默,映射丢失表现为「QQ 里丢上下文」且无从排查)。
70
+ - **修复会话列表可能打不开**:恢复会话失败时只在确认磁盘上确实没有该会话后才新建,日志损坏、后端故障等原因不再沿用同一会话 id 重复创建(此前会把同一 id 写进多个目录,宿主随后拒绝加载整个会话列表);这类故障改为明确报错并记录日志,恢复后原会话历史仍在。
71
+ - **修复并发消息可能切错会话**:旧版本的会话 id 由用户标识确定性派生,仅用于迁移存量会话,不再用于新建;同一会话的并发请求(斜杠指令与普通消息同时到达)合并为一次恢复/创建,不再产生两个互相覆盖且无人回收的会话实例。
72
+ - **vision 配置补写不再丢数字精度**:补写 `input` 声明时整数按原文保留,用户 `settings.yaml` 里的大整数(安装 id、时间戳等)不再被截断。
73
+
74
+ ### 内部改进
75
+
76
+ - 新增宿主 API 适配层,统一兼容宿主新旧版本的接口形态。
77
+
78
+ ## [0.5.3] - 2026-10-27
79
+
80
+ ### 新功能
81
+
82
+ - **流式回复**:回复实时分段送达 QQ,长回复不再整段等待;模型自动重试时改写同一条消息,不会重复。流式此前实际未生效,本版接入实时通道后真正可用。
83
+ - **交付文件直达会话**:模型通过 present 声明的交付文件(文档、表格、导出数据等)在本轮回复送达后自动发送到当前 QQ 会话;未能发送的以文字提示路径。可在配置中关闭或限制单轮数量。
84
+
85
+ ### 问题修复
86
+
87
+ - **操作确认恢复工作**:此前确认请求从未送达,敏感操作一直报「没有可用的确认通道」,现已修复。(#51,感谢 [@IrisuM](https://github.com/IrisuM))
88
+ - **设置面板输入与文案**:白名单文本框支持回车换行,保存时统一规范化;「开放 / 停用」等选项文案更直白。
89
+
90
+ ### 元数据
91
+
92
+ - **插件元数据补齐**:新增插件图标与中英文双语描述,插件列表按界面语言显示「QQ 机器人 (dsh-qqbot)」/「QQ Bot (dsh-qqbot)」。
93
+ - **界面入口与图标**:侧栏与插件详情页新增管理面板入口,设置页图标改为矢量 logo。
94
+
95
+ ### 文档
96
+
97
+ - README 新增桌面版安装说明(插件页添加 → 设置页扫码连接,全程无需命令行)。
98
+
99
+ ## [0.5.2] - 2026-10-12
100
+
101
+ ### 问题修复
102
+
103
+ - **修复全新安装无法启动的问题**:0.5.1 的依赖声明仍为旧版 QQ Bot SDK 范围(`^1.0.4`),全新安装解析到 1.0.4 后,掉线日志功能在启动时崩溃(`TypeError`),插件无法激活。现已更正为 `^1.0.5`。
104
+ - **旧版 SDK 兼容降级**:对已残留旧版 SDK 的环境,掉线日志监听降级为跳过并输出升级提示,不再阻断插件启动。
105
+
106
+ ## [0.5.1] - 2026-10-12
107
+
108
+ ### 新功能
109
+
110
+ - **端内扫码绑定**:在 DSH 桌面版 / Web 的设置页「QQ 机器人」栏目即可完成绑定——手机 QQ 扫码或手动填写 AppID / AppSecret,绑定状态实时可见;未绑定时侧栏会自动打开引导页。支持一键更换凭据与解绑。
111
+ - **端内配置面板**:常用配置告别手改文件——私聊 / 群聊访问控制(开放、白名单、停用)、群聊是否需要 @机器人、流式输出、工具结果展示、模型覆盖与补充指令,保存后自动生效。
112
+
113
+ ### 体验优化
114
+
115
+ - **升级 QQ Bot SDK 至 1.0.5**:机器人掉线时日志会说明掉线原因以及是否会自动恢复;连接始终无法建立时快速失败并给出明确原因,不再一直等待。
116
+
117
+ ## [0.5.0] - 2026-09-08
118
+
119
+ ### 新功能
120
+
121
+ - **图片理解**:发送图片给机器人,它会自动理解图片内容(截图、照片、图表等),可结合文字指令一起分析。
122
+ - **发送文件**:机器人可将本地文件(文档、图片等)直接发送给你,不再局限于纯文字回复。
123
+ - **主动提问**:机器人遇到不确定的信息时,会主动向你提问,并通过按钮让你一键选择,交互更顺畅。
124
+ - **操作确认**:执行敏感或关键操作前,机器人会先发起确认,你通过「允许/拒绝」按钮即可放行或拦截。
125
+ - **会话压缩**:新增 `/compact` 指令,一键压缩当前会话历史,保留上下文的同时释放空间,适合超长对话。
126
+ - **预设切换**:新增 `/preset` 指令,查看或切换机器人的人格/行为预设。
127
+ - **网络延迟检测**:`/bot-ping` 升级,返回网络传输耗时与插件处理耗时,方便排查连接延迟。
128
+
129
+ ### 体验优化
130
+
131
+ - 长任务执行超时延长到 30 分钟,复杂任务不再中途中断。
132
+ - 私聊与群聊按场景注入更贴合的系统提示词,回复更符合语境。
133
+ - 主动消息推送失败时自动降级为被动回复,减少「机器人没反应」的情况。
134
+ - 图片等媒体文件使用后自动清理,避免长期占用磁盘空间。
135
+
136
+ ### 问题修复
137
+
138
+ - 修复 `/stop` 指令无法真正中止正在生成内容的问题(此前为无效操作)。
139
+ - 修复操作确认通道的注册顺序问题,确保确认请求能被正确捕获和处理。
140
+
141
+ ### 文档
142
+
143
+ - README 补充 `/preset`、`/compact` 等新增指令说明,以及扫码升级引导。
144
+
145
+ ## [0.4.0] - 2026-08-16
146
+
147
+ ### 新功能
148
+
149
+ - **扫码链接**:二维码显示异常时,可直接点击终端输出的链接,在浏览器中完成扫码。
150
+
151
+ ### 体验优化
152
+
153
+ - 支持 Windows 平台自动保存扫码凭据(此前会因路径问题失效)。
154
+ - 凭据自动保存失败时,会明确引导手动配置,不再静默丢失已有配置。
155
+
156
+ ### 文档
157
+
158
+ - 新增扫码示意图与升级引导。
159
+
160
+ ## [0.3.0] - 2026-08-15
161
+
162
+ ### 新功能
163
+
164
+ - **文件理解**:给机器人发送文件,它会自动下载并理解文件内容,支持解压、读取、分析等操作。
165
+ - **流式回复**:回复内容实时逐段显示,无需等待全部生成,体验更流畅自然。
166
+ - **过程可见**:机器人执行任务(运行命令、读写文件)时,用户可以看到它在做什么,不再是一个"黑盒"。
167
+ - **出错提示**:任务异常结束时,机器人会明确告知错误原因,不再出现"半截回复"或"毫无反应"。
168
+
169
+ ### 体验优化
170
+
171
+ - 群聊中正确显示发言者昵称,不再显示一串看不懂的字符。
172
+ - 群聊回复后自动清理历史上下文,避免多轮对话相互干扰。
173
+ - 语音消息识别后只保留文字,不再附带无效链接。
174
+ - 机器人现在会"真正动手"了:面对「下载、解压、安装」这类请求,会用工具实际执行,而不是只复述操作步骤。
175
+
176
+ ### 问题修复
177
+
178
+ - 修复机器人无法读写文件的问题(此前工作目录配置错误)。
179
+ - 修复流式回复中可能出现的重复内容、分片过少等显示问题。
180
+
181
+ ## [0.1.0] - 2026-08-14
182
+
183
+ ### 新功能
184
+
185
+ - **首个版本**:QQ 机器人接入 AI 助手,支持私聊与群聊对话。
186
+ - **模型切换**:支持切换不同的 AI 模型。
187
+ - **常用指令**:内置帮助、状态查询、会话管理等指令。
188
+ - **扫码绑定**:首次使用扫码即可完成机器人绑定,配置简单。
189
+
190
+ ### 问题修复
191
+
192
+ - 修复配置解析问题。
@@ -0,0 +1,192 @@
1
+ # Changelog
2
+
3
+ > [简体中文](./CHANGELOG.md)
4
+
5
+ This file records significant dsh-qqbot updates from a product perspective, focusing on user-visible changes.
6
+
7
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
8
+
9
+ ## [0.1.3] - 2026-11-21
10
+
11
+ - Bumped `sharp` to `^0.35.5`: this release has no `install` script, so installs are no longer blocked by pnpm's build-script guard and no `allowBuilds` entry is needed
12
+
13
+ ## [0.1.2] - 2026-11-21
14
+
15
+ - Drop the duplicate "QQ bot" section in Settings; the sidebar panel already renders the same content.
16
+
17
+ ## [0.1.1] - 2026-11-21
18
+
19
+ ### Added
20
+
21
+ - **New "Persona" settings tab**: persona, portrait and the "how to reply in QQ" rules moved out of the bot tab into their own page; the bot tab keeps only connection and runtime settings.
22
+ - **New "Memes" settings tab**: browse the library, edit captions and tags, change folders, prune stale entries, and click a thumbnail for a full-size preview.
23
+ - **Meme library merged into the plugin**: the separate `dsh-fishmeme` plugin is folded in; data lives in `~/.dsh/dsh-qqbot-plus/memes`, and the old index is migrated on first run.
24
+ - **Image downscaling works on all platforms**: uses optional `sharp` (npm fetches the prebuilt binary for your platform), long edge defaults to 360. If `sharp` is unavailable the original image is sent as-is.
25
+
26
+ ### Fixed
27
+
28
+ - **Alarms could be lost silently**: a failed delivery was neither awaited nor written back, so a whole batch of due alarms disappeared; failures are now re-queued and the rest of the batch is preserved.
29
+ - **Emotion notes never reached the prefix**: the identity key is an openid string, and an old numeric regex filtered every entry out.
30
+ - **Partial state files**: settings / runtime / meme index and friends are now written atomically, so a crash can no longer leave a broken JSON that resets your settings.
31
+ - **Panel turned into bare HTML after switching tabs**: the stylesheet lived inside the bot tab component and was removed with it on unmount; it is now shared by the whole page.
32
+ - **Crash when cancelling a draft from a console session**: `record` may be undefined; switched to optional chaining.
33
+
34
+ ## [0.5.5] - 2026-10-30
35
+
36
+ ### Fixed
37
+
38
+ - **Fixed the broken QR code in the in-app binding flow**: qrcode is now loaded via `createRequire`, bypassing the missing-API issue caused by the host's ESM interop. When the QR cannot be produced, the page falls back to a notice offering to restart the app, open the link in a browser, or enter credentials manually.
39
+
40
+ ## [0.5.4] - 2026-10-28
41
+
42
+ ### New Features
43
+
44
+ - **New `/bot-me` command**: shows the sender's OpenIDs (user openid in DMs; group-member openid and group openid in groups) as a self-service entry for allowlist onboarding — users hand the IDs to an admin to be added to the lists.
45
+ - **Admin command authorization**: `/preset` and `/model` work in both DMs and groups, but only allowlisted users may switch the preset or model (a group switch affects that group's session); each command's DM/group availability is shown in `/bot-help`. (#5)
46
+
47
+ ### ⚠️ Behavior Changes (secure defaults)
48
+
49
+ - **Access control tightened by default**: DMs default to allowlist with an empty list rejecting everyone (previously empty lists silently allowed everyone); groups default to open (guarded by group membership and the @-mention gate). On QR binding, DMs switch to allowlist with the list reset to the scanning user (rebinding swaps the owner) — binding grants access.
50
+ - **Isolated default workspace**: the agent working directory now defaults to `~/.dsh-qqbot/workspace` instead of following the DSH process directory; set `cwd` explicitly to override.
51
+ - **Approval buttons check permissions**: in allowlist mode, approval buttons only take effect for allowlisted users — clicks by non-authorized members and forwarded DM cards clicked by others are ignored.
52
+
53
+ ### Fixed
54
+
55
+ - **Saving configuration no longer clobbers other plugins**: binding, saving settings, and unbinding only touch this plugin's own entry; other plugins' content and comments are preserved. (#53)
56
+ - **Long prompts can be saved**: the settings-save request body limit is raised from 4KB to 512KB. (#69)
57
+ - **Vision-path hazard fixed**: the `qqbot_describe_image` message source now uses the current session format, so future image injection into the main conversation will not fail. (#77)
58
+ - **Hardened session ids**: unified `session-` prefix (#81) — community plugins no longer misjudge QQ sessions, multi-process concurrency produces no duplicate ids, and existing sessions keep their original ids.
59
+ - **Fixed model switching**: both the `/model` crash and the "history failed to load" error after restarting post-switch are fixed, with conversation history fully preserved.
60
+ - **Fixed session-event reads**: `/tokens` showing 0, `/export` producing empty output, and approval buttons not echoing the gated command — all fixed.
61
+ - **Fixed compaction**: `/compact` wrongly reporting the service as unavailable or "no active session" — fixed; in the latter case the session is revived from disk before compacting.
62
+ - **Fixed config save failure with link installs**: saving from the settings UI kept reporting "profile directory not found" when installed via `dsh plugin add link:` — fixed. With multiple profiles sharing the same source, writes target the profile of the current process. Remaining failures point at manually editing `cordis.patch.yml`. (#78)
63
+ - **Fixed allowlist default bypass**: omitting `access` entirely still fell back to open DMs (the outer schema default was not updated with the field defaults) — now aligned to allowlist and pinned by tests. (#94)
64
+ - **Approval cards bound to their request and hardened**: buttons now carry the pending approval's unique nonce, so stale cards no longer settle; in allowlist mode a missing clicker identity is rejected too. (#94)
65
+ - **File-send path allowlist resolves symlinks**: paths are judged by their real locations; a symlink inside an allowed root pointing outside is rejected. (#94)
66
+ - **Image attachments named by their real format**: the QQ gateway labels all images `image/png` (most are actually GIF/JPEG), so saved files carried wrong extensions and extension-based image decoding failed; extensions are now corrected from the file header (magic bytes) — bytes unchanged, no transcoding, unknown formats keep the original behavior. (#76)
67
+ - **Unified workspace path resolution**: introduced a single source of truth for the plugin data directory (`~/.dsh-qqbot`), from which the workspace, media, and model-preference paths are uniformly derived; without an explicit `cwd` the host process directory is no longer wrongly used (previously causing workspace file sends to be denied). Missing files now report "file not found" instead of a misleading path denial.
68
+ - **Vision config auto-patch no longer clobbers settings.yaml**: the startup fix-up that declares `input` for the vision model now uses fidelity-preserving document editing (comments, anchors, and other settings kept as-is) with atomic writes and conflict-aware retry; the previous full re-serialization wiped all comments and formatting from the file.
69
+ - **Concurrent-safe preference file**: `model-prefs.json` (the session-id mapping shared by multi-bot and multi-profile setups) now writes atomically and merges other writers' entries before overwriting, so coexisting bots/profiles no longer clobber each other's mappings; deletions carry tombstones so concurrent writes cannot resurrect them; load/write failures surface as visible warnings (previously debug-only or silent — a lost mapping showed up as "lost context in QQ" with nothing to trace).
70
+ - **Fixed an unopenable session list**: when resuming a session fails, a new one is created only after confirming the session is genuinely absent on disk; corrupt logs and backend failures no longer recreate the same session id (which used to write one id into several directories, after which the host refused to load the whole session list). Such failures now fail loudly with a log entry, and the original history is still there once the fault clears.
71
+ - **Fixed concurrent messages landing on the wrong session**: the legacy session id derived from the user identity is now only used to migrate existing sessions, never to create new ones; concurrent requests for the same session (a slash command arriving alongside a normal message) are coalesced into one resume/create, so two mutually overwriting, never-reclaimed session instances are no longer produced.
72
+ - **Vision config patch keeps numeric precision**: integers are preserved verbatim when the `input` declaration is added, so large integers in the user's `settings.yaml` (install ids, timestamps) are no longer truncated.
73
+
74
+ ### Internal
75
+
76
+ - Added a host-API adapter layer that uniformly supports both old and new host interface shapes.
77
+
78
+ ## [0.5.3] - 2026-10-27
79
+
80
+ ### Added
81
+
82
+ - **Streaming replies**: replies stream to QQ in segments while the model generates, and an automatic LLM retry rewrites the same streamed message instead of appending a duplicate. Streaming had never actually worked; it does now.
83
+ - **Delivered files reach the chat**: files the model declares as deliverables are automatically sent to the current QQ conversation right after the turn's reply, with a text notice when a file cannot be sent; can be disabled or capped in configuration.
84
+
85
+ ### Fixed
86
+
87
+ - **Action confirmation restored**: confirmation requests never arrived — sensitive operations kept failing with "no approval channel is available". Fixed. (#51, thanks to [@IrisuM](https://github.com/IrisuM))
88
+ - **Settings panel input and copy**: allowlist textareas accept newlines, normalized on save; option labels such as open/disabled read more plainly.
89
+
90
+ ### Metadata
91
+
92
+ - **Plugin metadata completed**: ships a plugin icon and a bilingual description; the plugin list shows “QQ 机器人 (dsh-qqbot)” / “QQ Bot (dsh-qqbot)” by interface language.
93
+ - **Entries and icon**: the sidebar and the plugin detail page gain management-panel entries; the settings panel icon becomes a vector logo.
94
+
95
+ ### Documentation
96
+
97
+ - README: Desktop installation instructions — add from the Plugins page, connect by scanning in Settings, no command line involved.
98
+
99
+ ## [0.5.2] - 2026-10-12
100
+
101
+ ### Fixed
102
+
103
+ - **Fixed clean installs failing to activate**: 0.5.1 shipped with the old SDK range (`^1.0.4`), so clean installs resolved 1.0.4 and the disconnect logging feature crashed at startup (`TypeError`), failing plugin activation. The range is now `^1.0.5`.
104
+ - **Graceful degradation on stale SDKs**: environments that still carry an older SDK now skip the disconnect listener with an upgrade hint instead of failing activation.
105
+
106
+ ## [0.5.1] - 2026-10-12
107
+
108
+ ### Added
109
+
110
+ - **In-app QR binding**: bind your bot entirely from the DSH Desktop / Web settings page — scan with your phone's QQ or enter the AppID / AppSecret manually, with live binding status; the sidebar opens a guided page automatically while unbound. Credential rotation and unbinding are one click away.
111
+ - **In-app config panel**: no more hand-editing files — c2c/group access control (open, allowlist, disabled), mention-required in groups, streaming, tool-result display, model overrides and extra prompts, all applied automatically on save.
112
+
113
+ ### Improved
114
+
115
+ - **Upgraded the QQ Bot SDK to 1.0.5**: disconnects are now logged with the reason and whether the bot will recover on its own, and a connection that can never be established fails fast with a clear reason instead of waiting forever.
116
+
117
+ ## [0.5.0] - 2026-09-08
118
+
119
+ ### Added
120
+
121
+ - **Image understanding**: send images to the bot and it will automatically understand their content (screenshots, photos, charts, etc.), and can analyze them together with text instructions.
122
+ - **File sending**: the bot can send local files (documents, images, etc.) directly to you, no longer limited to plain-text replies.
123
+ - **Proactive questions**: when the bot encounters uncertain information, it proactively asks you questions, letting you pick an answer with a single tap for smoother interaction.
124
+ - **Action confirmation**: before performing sensitive or critical operations, the bot requests confirmation, which you approve or block via "Allow/Deny" buttons.
125
+ - **Session compaction**: new `/compact` command to compress the current session history in one step, preserving context while freeing space — ideal for very long conversations.
126
+ - **Preset switching**: new `/preset` command to view or switch the bot's persona/behavior preset.
127
+ - **Network latency test**: upgraded `/bot-ping` to return network transport time and plugin processing time, making it easier to diagnose connection latency.
128
+
129
+ ### Improved
130
+
131
+ - Long-task execution timeout extended to 30 minutes, so complex tasks are no longer interrupted mid-way.
132
+ - Direct and group chats now receive more context-appropriate system prompts.
133
+ - Failed proactive message pushes automatically fall back to passive replies, reducing "the bot didn't respond" situations.
134
+ - Media files such as images are automatically cleaned up after use, avoiding long-term disk usage.
135
+
136
+ ### Fixed
137
+
138
+ - Fixed the `/stop` command not actually aborting in-progress generation (it was previously a no-op).
139
+ - Fixed the registration order of the approval channel, ensuring confirmation requests are captured and handled correctly.
140
+
141
+ ### Documentation
142
+
143
+ - README updated with the new `/preset` and `/compact` commands, plus QR-code upgrade guidance.
144
+
145
+ ## [0.4.0] - 2026-08-16
146
+
147
+ ### Added
148
+
149
+ - **QR link**: when the QR code renders incorrectly, you can click the link printed in the terminal to complete scanning in a browser.
150
+
151
+ ### Improved
152
+
153
+ - Supports auto-saving QR credentials on Windows (previously failed due to path issues).
154
+ - When auto-saving credentials fails, it now clearly guides manual configuration instead of silently dropping existing config.
155
+
156
+ ### Documentation
157
+
158
+ - Added QR-code screenshots and upgrade guidance.
159
+
160
+ ## [0.3.0] - 2026-08-15
161
+
162
+ ### Added
163
+
164
+ - **File understanding**: send a file to the bot and it will automatically download and understand its contents, supporting extract, read, analyze, and more.
165
+ - **Streaming replies**: replies are displayed incrementally in real time, no need to wait for full generation — a smoother, more natural experience.
166
+ - **Visible progress**: when the bot runs tasks (running commands, reading/writing files), you can see what it is doing — no longer a "black box".
167
+ - **Error feedback**: when a task ends abnormally, the bot clearly explains the reason, no more "half replies" or "no response at all".
168
+
169
+ ### Improved
170
+
171
+ - Correctly displays the speaker's nickname in group chats instead of an unreadable string.
172
+ - Automatically clears group chat history after replying to avoid cross-conversation interference.
173
+ - Voice messages are recognized and kept as text only, without extra invalid links.
174
+ - The bot now "actually gets things done": for requests like "download, extract, install", it executes real tool actions instead of just restating the steps.
175
+
176
+ ### Fixed
177
+
178
+ - Fixed the bot being unable to read/write files (the working directory was misconfigured).
179
+ - Fixed duplicate content and too-few chunks in streaming replies.
180
+
181
+ ## [0.1.0] - 2026-08-14
182
+
183
+ ### Added
184
+
185
+ - **First release**: QQ bot integrated with an AI assistant, supporting direct and group chats.
186
+ - **Model switching**: supports switching between different AI models.
187
+ - **Common commands**: built-in help, status query, session management, and more.
188
+ - **QR binding**: bind the bot by scanning a QR code on first use, with simple setup.
189
+
190
+ ### Fixed
191
+
192
+ - Fixed config parsing issues.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tencent Connect
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.