@cxyhhhhh/dsh-qqbot 0.5.4-dev.202610302349 → 0.5.5-dev.202611171457

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 (208) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/CHANGELOG_EN.md +40 -0
  3. package/README.md +22 -2
  4. package/README_EN.md +20 -2
  5. package/lib/client.js +1732 -776
  6. package/lib/client.js.map +1 -1
  7. package/lib/commands/auth.d.ts +2 -17
  8. package/lib/commands/auth.d.ts.map +1 -1
  9. package/lib/commands/auth.js +11 -13
  10. package/lib/commands/auth.js.map +1 -1
  11. package/lib/commands/index.d.ts +2 -0
  12. package/lib/commands/index.d.ts.map +1 -1
  13. package/lib/commands/index.js +22 -0
  14. package/lib/commands/index.js.map +1 -1
  15. package/lib/commands/model.d.ts +1 -1
  16. package/lib/commands/model.d.ts.map +1 -1
  17. package/lib/commands/model.js +1 -4
  18. package/lib/commands/model.js.map +1 -1
  19. package/lib/commands/preset.d.ts +1 -1
  20. package/lib/commands/preset.d.ts.map +1 -1
  21. package/lib/commands/preset.js +1 -4
  22. package/lib/commands/preset.js.map +1 -1
  23. package/lib/config.d.ts +17 -3
  24. package/lib/config.d.ts.map +1 -1
  25. package/lib/config.js +8 -1
  26. package/lib/config.js.map +1 -1
  27. package/lib/features/approval-channel.d.ts +8 -1
  28. package/lib/features/approval-channel.d.ts.map +1 -1
  29. package/lib/features/approval-channel.js +16 -5
  30. package/lib/features/approval-channel.js.map +1 -1
  31. package/lib/features/question-channel.d.ts +39 -13
  32. package/lib/features/question-channel.d.ts.map +1 -1
  33. package/lib/features/question-channel.js +107 -48
  34. package/lib/features/question-channel.js.map +1 -1
  35. package/lib/gateway/bootstrap.d.ts.map +1 -1
  36. package/lib/gateway/bootstrap.js +23 -8
  37. package/lib/gateway/bootstrap.js.map +1 -1
  38. package/lib/gateway/middleware-setup.d.ts.map +1 -1
  39. package/lib/gateway/middleware-setup.js +48 -19
  40. package/lib/gateway/middleware-setup.js.map +1 -1
  41. package/lib/host/adapter.d.ts +19 -0
  42. package/lib/host/adapter.d.ts.map +1 -1
  43. package/lib/host/adapter.js +32 -0
  44. package/lib/host/adapter.js.map +1 -1
  45. package/lib/media/send-file-tool.d.ts +2 -1
  46. package/lib/media/send-file-tool.d.ts.map +1 -1
  47. package/lib/media/send-file-tool.js +13 -2
  48. package/lib/media/send-file-tool.js.map +1 -1
  49. package/lib/media/vision-tool.d.ts +7 -0
  50. package/lib/media/vision-tool.d.ts.map +1 -1
  51. package/lib/media/vision-tool.js +1 -3
  52. package/lib/media/vision-tool.js.map +1 -1
  53. package/lib/model/model-resolver.d.ts +2 -0
  54. package/lib/model/model-resolver.d.ts.map +1 -1
  55. package/lib/model/model-resolver.js +4 -0
  56. package/lib/model/model-resolver.js.map +1 -1
  57. package/lib/model/prefs-store.d.ts +9 -0
  58. package/lib/model/prefs-store.d.ts.map +1 -1
  59. package/lib/model/prefs-store.js +20 -0
  60. package/lib/model/prefs-store.js.map +1 -1
  61. package/lib/prompt/extra.d.ts +13 -0
  62. package/lib/prompt/extra.d.ts.map +1 -0
  63. package/lib/prompt/extra.js +12 -0
  64. package/lib/prompt/extra.js.map +1 -0
  65. package/lib/prompt/index.d.ts +18 -0
  66. package/lib/prompt/index.d.ts.map +1 -0
  67. package/lib/prompt/index.js +18 -0
  68. package/lib/prompt/index.js.map +1 -0
  69. package/lib/prompt/install.d.ts +34 -0
  70. package/lib/prompt/install.d.ts.map +1 -0
  71. package/lib/prompt/install.js +37 -0
  72. package/lib/prompt/install.js.map +1 -0
  73. package/lib/prompt/persona.d.ts +28 -0
  74. package/lib/prompt/persona.d.ts.map +1 -0
  75. package/lib/prompt/persona.js +62 -0
  76. package/lib/prompt/persona.js.map +1 -0
  77. package/lib/prompt/rules.d.ts +5 -0
  78. package/lib/prompt/rules.d.ts.map +1 -0
  79. package/lib/prompt/rules.js +5 -0
  80. package/lib/prompt/rules.js.map +1 -0
  81. package/lib/prompt/scope.d.ts +3 -0
  82. package/lib/prompt/scope.d.ts.map +1 -0
  83. package/lib/prompt/scope.js +2 -0
  84. package/lib/prompt/scope.js.map +1 -0
  85. package/lib/prompt/turn-meta.d.ts +29 -0
  86. package/lib/prompt/turn-meta.d.ts.map +1 -0
  87. package/lib/prompt/turn-meta.js +42 -0
  88. package/lib/prompt/turn-meta.js.map +1 -0
  89. package/lib/prompt/user-blocks.d.ts +11 -0
  90. package/lib/prompt/user-blocks.d.ts.map +1 -0
  91. package/lib/prompt/user-blocks.js +5 -0
  92. package/lib/prompt/user-blocks.js.map +1 -0
  93. package/lib/rpc-carrier.d.ts +32 -0
  94. package/lib/rpc-carrier.d.ts.map +1 -0
  95. package/lib/rpc-carrier.js +89 -0
  96. package/lib/rpc-carrier.js.map +1 -0
  97. package/lib/runtime/account-routes.d.ts +10 -0
  98. package/lib/runtime/account-routes.d.ts.map +1 -0
  99. package/lib/runtime/account-routes.js +74 -0
  100. package/lib/runtime/account-routes.js.map +1 -0
  101. package/lib/runtime/account-service.d.ts +63 -0
  102. package/lib/runtime/account-service.d.ts.map +1 -0
  103. package/lib/runtime/account-service.js +210 -0
  104. package/lib/runtime/account-service.js.map +1 -0
  105. package/lib/runtime/member-store.d.ts +33 -0
  106. package/lib/runtime/member-store.d.ts.map +1 -0
  107. package/lib/runtime/member-store.js +145 -0
  108. package/lib/runtime/member-store.js.map +1 -0
  109. package/lib/runtime/pairing-service.d.ts +38 -0
  110. package/lib/runtime/pairing-service.d.ts.map +1 -0
  111. package/lib/runtime/pairing-service.js +127 -0
  112. package/lib/runtime/pairing-service.js.map +1 -0
  113. package/lib/runtime/pairing-state.d.ts +9 -0
  114. package/lib/runtime/pairing-state.d.ts.map +1 -0
  115. package/lib/runtime/pairing-state.js +64 -0
  116. package/lib/runtime/pairing-state.js.map +1 -0
  117. package/lib/session/idle-evictor.d.ts +2 -1
  118. package/lib/session/idle-evictor.d.ts.map +1 -1
  119. package/lib/session/idle-evictor.js +6 -2
  120. package/lib/session/idle-evictor.js.map +1 -1
  121. package/lib/session/session-manager.d.ts +15 -6
  122. package/lib/session/session-manager.d.ts.map +1 -1
  123. package/lib/session/session-manager.js +76 -23
  124. package/lib/session/session-manager.js.map +1 -1
  125. package/lib/setup/bind-routes.d.ts +14 -30
  126. package/lib/setup/bind-routes.d.ts.map +1 -1
  127. package/lib/setup/bind-routes.js +90 -203
  128. package/lib/setup/bind-routes.js.map +1 -1
  129. package/lib/setup/binding-service.d.ts +1 -0
  130. package/lib/setup/binding-service.d.ts.map +1 -1
  131. package/lib/setup/binding-service.js +21 -4
  132. package/lib/setup/binding-service.js.map +1 -1
  133. package/lib/setup/index.d.ts +1 -1
  134. package/lib/setup/index.d.ts.map +1 -1
  135. package/lib/setup/index.js +20 -36
  136. package/lib/setup/index.js.map +1 -1
  137. package/lib/setup/persist.d.ts +16 -0
  138. package/lib/setup/persist.d.ts.map +1 -1
  139. package/lib/setup/persist.js +84 -6
  140. package/lib/setup/persist.js.map +1 -1
  141. package/lib/shared/atomic-file.d.ts +3 -0
  142. package/lib/shared/atomic-file.d.ts.map +1 -0
  143. package/lib/shared/atomic-file.js +48 -0
  144. package/lib/shared/atomic-file.js.map +1 -0
  145. package/lib/shared/bind-protocol.d.ts +4 -13
  146. package/lib/shared/bind-protocol.d.ts.map +1 -1
  147. package/lib/shared/bind-protocol.js +3 -11
  148. package/lib/shared/bind-protocol.js.map +1 -1
  149. package/lib/shared/command-protocol.d.ts +10 -0
  150. package/lib/shared/command-protocol.d.ts.map +1 -0
  151. package/lib/shared/command-protocol.js +2 -0
  152. package/lib/shared/command-protocol.js.map +1 -0
  153. package/lib/shared/dirs.d.ts +3 -1
  154. package/lib/shared/dirs.d.ts.map +1 -1
  155. package/lib/shared/dirs.js +12 -4
  156. package/lib/shared/dirs.js.map +1 -1
  157. package/lib/shared/message-sender-name.d.ts +4 -0
  158. package/lib/shared/message-sender-name.d.ts.map +1 -0
  159. package/lib/shared/message-sender-name.js +15 -0
  160. package/lib/shared/message-sender-name.js.map +1 -0
  161. package/lib/shared/pairing-protocol.d.ts +68 -0
  162. package/lib/shared/pairing-protocol.d.ts.map +1 -0
  163. package/lib/shared/pairing-protocol.js +68 -0
  164. package/lib/shared/pairing-protocol.js.map +1 -0
  165. package/lib/shared/rpc-protocol.d.ts +50 -0
  166. package/lib/shared/rpc-protocol.d.ts.map +1 -0
  167. package/lib/shared/rpc-protocol.js +50 -0
  168. package/lib/shared/rpc-protocol.js.map +1 -0
  169. package/lib/transport/deliverables.d.ts +4 -5
  170. package/lib/transport/deliverables.d.ts.map +1 -1
  171. package/lib/transport/deliverables.js +5 -5
  172. package/lib/transport/deliverables.js.map +1 -1
  173. package/lib/transport/inbound.d.ts +2 -1
  174. package/lib/transport/inbound.d.ts.map +1 -1
  175. package/lib/transport/inbound.js +4 -1
  176. package/lib/transport/inbound.js.map +1 -1
  177. package/lib/transport/index.d.ts +3 -1
  178. package/lib/transport/index.d.ts.map +1 -1
  179. package/lib/transport/index.js +3 -1
  180. package/lib/transport/index.js.map +1 -1
  181. package/lib/transport/outbound-buffer.d.ts +3 -3
  182. package/lib/transport/outbound-buffer.d.ts.map +1 -1
  183. package/lib/transport/outbound-buffer.js +6 -5
  184. package/lib/transport/outbound-buffer.js.map +1 -1
  185. package/lib/transport/outbound.d.ts +7 -2
  186. package/lib/transport/outbound.d.ts.map +1 -1
  187. package/lib/transport/outbound.js +83 -42
  188. package/lib/transport/outbound.js.map +1 -1
  189. package/lib/transport/qq-input-origin.d.ts +38 -0
  190. package/lib/transport/qq-input-origin.d.ts.map +1 -0
  191. package/lib/transport/qq-input-origin.js +74 -0
  192. package/lib/transport/qq-input-origin.js.map +1 -0
  193. package/lib/transport/reply-target.d.ts.map +1 -1
  194. package/lib/transport/reply-target.js +4 -0
  195. package/lib/transport/reply-target.js.map +1 -1
  196. package/lib/transport/turn-origin.d.ts +37 -0
  197. package/lib/transport/turn-origin.d.ts.map +1 -0
  198. package/lib/transport/turn-origin.js +56 -0
  199. package/lib/transport/turn-origin.js.map +1 -0
  200. package/lib/transport/turn-tracker.d.ts +70 -0
  201. package/lib/transport/turn-tracker.d.ts.map +1 -0
  202. package/lib/transport/turn-tracker.js +127 -0
  203. package/lib/transport/turn-tracker.js.map +1 -0
  204. package/lib/types.d.ts +5 -0
  205. package/lib/types.d.ts.map +1 -1
  206. package/package.json +16 -15
  207. package/pnpm-workspace.yaml +12 -0
  208. package/tsdown.client.config.ts +75 -21
package/CHANGELOG.md CHANGED
@@ -6,6 +6,46 @@
6
6
 
7
7
  格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)。
8
8
 
9
+ ## [未发布]
10
+
11
+ ### 新功能
12
+
13
+ - **多界面共享一份状态**:设置页、主面板、侧栏绑定页共用同一个状态轮询器——同时打开多个页面不再重复请求,热重载窗口内各页面相位一致,页面隐藏时自动暂停轮询。
14
+ - **配对码添加白名单**:在账号设置中生成 10 分钟配对码,用户在 QQ 对应对话里发送该码即可加入私聊/群/命令名单;同一码可连续添加多人,另支持按 OpenID 手动批量添加与复制导出。移除身份后,移除前生成的配对码不能再将其加回,需生成新码。
15
+ - **斜杠命令权限独立**:新增 `access.commandMode`(所有人/白名单/关闭),命令按发送者身份校验,与私聊/群聊接入白名单分开管理。
16
+ - **补充提示词按会话场景生效**:群/私提示词随会话独立加载,恢复会话后继续生效;改配置下一条消息即时生效。
17
+ - **非 QQ 发起的回合会推送到 QQ**:在桌面里继续聊、或由宿主自己发起的回合(定时、注入的上下文等),只要这条会话绑定了 QQ,回复会主动发到对应私聊或群。不再占用上一条 QQ 消息的被动回复额度,也不会粘在旧消息上。QQ 里发来的消息仍按被动回复,流式输出不变。需在 QQ 开放平台打开主动消息,否则发送失败。
18
+ - **闲置回收可关闭**:`sessionIdleTimeout` 设为 `0` 时不再回收会话(默认仍为 30 分钟)。
19
+
20
+ ### ⚠️ 行为变更
21
+
22
+ - **端内页面迁移到宿主认证通道**:绑定、配置、配对等浏览器可写接口不再走自建裸路由,全部挂载到宿主 `/api` 共享通道——来源校验(DNS 重绑定/跨站防护)与登录认证由宿主统一施加,随宿主安全升级自动跟进。设置页与绑定页现在要求已登录(本机部署不受影响)。
23
+ - **不再自动弹出绑定页**:待绑定时不再自动打开侧栏绑定页;从 Start 页「QQ 机器人绑定」或设置页「QQ 机器人」进入即可扫码或手动填写。检测待绑定的常驻轮询已随之移除,未打开相关页面时不再请求状态接口。
24
+ - **最低宿主版本升至 0.2.0-rc.2**:不再支持 0.1.x 宿主(其提问通道协议已不兼容);在更老宿主上安装会被明确拒绝。
25
+ - **提问在 QQ 与桌面同时出现**:`ask_user_question` 的问题同时发到 QQ 与桌面/Web,先答先赢——哪边先回复哪边生效,另一边自动失效(QQ 迟到的按钮点击不再推进;QQ 先答时桌面的过期卡片随之消失)。
26
+ - **斜杠命令默认放开**:此前 `/preset`、`/model` 等管理命令仅白名单用户可用;引入 `access.commandMode` 后默认所有人可用,需要保持收紧请将其设为 `allowlist` 并配置命令白名单。
27
+ - **内置提示词收敛**:默认仅注入一句通道声明,场景规则与行为约束不再内置;需要群聊 @ 纪律等效果写入 `groupPrompt`。
28
+
29
+ ### 问题修复
30
+
31
+ - **修复绑定页 404(启动失败)**:上一版本在部分环境下面板路由注册失败导致绑定页一直 404;已定位为宿主服务读取方式违规并修复。
32
+ - **修复退订后在途请求阻塞重挂载**:关闭所有绑定相关页面后再打开,首次状态读取不再被旧请求拖住(服务端挂起时最长 10 秒)。
33
+ - **设置页导航图标适配明暗主题**:图标颜色跟随宿主主题,暗色主题下不再出现黑色图标贴黑底。
34
+ - **修复热重载后提问通道失效**:保存配置、扫码绑定等触发的插件热重载会让 QQ 提问通道静默失效(此后 `ask_user_question` 无任何界面出现或直接报错);已改为事件式接入,生命周期随插件自动正确。完整问答链路(多题逐问、按钮、超时、桌面同答)已回归验证。
35
+ - **闲置回收后提示词不再丢失**:回收复用存活 agent 时重新安装提示词;安装失败仅告警,不影响会话建立。
36
+
37
+ ### 内部(开发者可见)
38
+
39
+ - 浏览器端架构分层重构:宿主服务契约类型化(未声明服务读取成为编译错误)、席位装配与视图组合解耦、样式收敛为单一命名空间与引用计数。
40
+ - 新增真实宿主包(`@deepseek-ai/dsh-client-connection` 0.2.2-rc.3)之上的端到端回归:信封协议、404 语义、owner 门控、fiber 卸载注销。
41
+
42
+
43
+ ## [0.5.5] - 2026-10-30
44
+
45
+ ### 问题修复
46
+
47
+ - **修复端内绑定二维码裂图**:改用 `createRequire` 加载 qrcode,绕过宿主 ESM 互通导致的 API 缺失;二维码无法生成时页面降级为提示,可重启应用、在浏览器打开链接或手动填写凭据。
48
+
9
49
  ## [0.5.4] - 2026-10-28
10
50
 
11
51
  ### 新功能
package/CHANGELOG_EN.md CHANGED
@@ -6,6 +6,46 @@ This file records significant dsh-qqbot updates from a product perspective, focu
6
6
 
7
7
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
8
8
 
9
+ ## [Unreleased]
10
+
11
+ ### New Features
12
+
13
+ - **One shared state across surfaces**: the settings section, main panel, and sidebar bind page share a single status poller — multiple open pages no longer issue duplicate requests, phases stay consistent across surfaces during hot-reload windows, and polling pauses while the page is hidden.
14
+ - **Pairing codes for allowlists**: generate a 10-minute code in account settings and have users send it to the bot in the matching chat to join the DM/group/command roster; one code admits multiple people, with manual OpenID bulk-adding and copy/export as well. After an identity is removed, codes issued before the removal can no longer re-add it.
15
+ - **Independent slash-command access**: new `access.commandMode` (open / allowlist / disabled) checks commands by sender identity, managed separately from the chat admission allowlists.
16
+ - **Scope-aware extra prompts**: group/DM prompts load per session and survive session resume; config changes apply on the next message.
17
+ - **Turns that did not start in QQ are pushed to QQ**: continuing a bound session from the desktop, or a turn the host starts itself (a schedule, injected context, and the like), delivers the reply to the matching DM or group. It no longer spends the passive-reply quota of the previous QQ message, and it does not attach to that old message. Messages that arrive in QQ stay passive replies, and streaming is unchanged. Proactive messages must be enabled on the QQ Open Platform, or the send fails.
18
+ - **Idle eviction can be disabled**: setting `sessionIdleTimeout` to `0` stops proactive eviction (the default stays 30 minutes).
19
+
20
+ ### ⚠️ Behavior Changes
21
+
22
+ - **In-app surfaces moved onto the host-authenticated channel**: the browser-writable endpoints (binding, config, pairing) no longer serve from self-registered bare routes — everything now mounts on the host `/api` shared channel, where source checks (DNS-rebinding / cross-site defense) and login authentication are enforced by the host and improve automatically with host upgrades. The settings and bind pages now expect a logged-in session (local deployments are unaffected).
23
+ - **The bind page no longer opens by itself**: pending binding no longer auto-opens the sidebar page; enter via the Start-page "QQ Bot binding" card or Settings → QQ Bot to scan or fill in credentials. The always-on pending-binding poller is gone with it — the status endpoint is no longer requested while those pages are closed.
24
+ - **Minimum host raised to 0.2.0-rc.2**: hosts from 0.1.x are no longer supported (their question-channel protocol is incompatible); installing on an older host is now rejected explicitly.
25
+ - **Questions surface on QQ and the desktop at once**: an `ask_user_question` is delivered to both QQ and the desktop/Web, first answer wins — whichever side replies first settles it, and the other side goes inert (a late QQ button press no longer advances; when QQ wins, the stale desktop card disappears).
26
+ - **Slash commands open by default**: `/preset`, `/model`, and other admin commands were previously limited to allowlisted users; with `access.commandMode` they are open to everyone by default — set it to `allowlist` and configure the command roster to keep them restricted.
27
+ - **Built-in prompt slimmed down**: only a one-line channel declaration is injected by default; scope rules and behavioral instructions are no longer built in — put group-specific guidance (e.g. mention discipline) into `groupPrompt`.
28
+
29
+ ### Fixed
30
+
31
+ - **Fixed the bind page 404 (boot failure)**: in some environments the previous release failed to register the panel routes, leaving the bind page a permanent 404; the root cause was an illegal host-service access and is fixed.
32
+ - **Fixed an in-flight request blocking remounts**: closing every bind-related page and reopening it no longer has the first status read wait on a stale request (up to 10 seconds when the server hangs).
33
+ - **Settings nav icon follows the theme**: the icon color now tracks the host theme instead of rendering near-black on dark backgrounds.
34
+ - **Question channel survives hot reloads**: plugin hot reloads (saving config, QR binding) used to silently disable the QQ question channel — afterwards `ask_user_question` reached no surface at all or failed outright. The channel now hooks in via events and its lifecycle follows the plugin automatically. The full question flow (multi-question stepping, buttons, timeouts, racing the desktop) is regression-tested.
35
+ - **Prompts no longer lost after idle eviction**: re-installed when a still-live agent is reused; installation failures only log a warning and never break session creation.
36
+
37
+ ### Internal (developer-facing)
38
+
39
+ - Browser-side architecture rework: host service contracts are now typed (reading an undeclared service is a compile error), seat wiring and view composition are decoupled, and styles collapse into a single namespaced, reference-counted stylesheet.
40
+ - Added an end-to-end regression on the real host package (`@deepseek-ai/dsh-client-connection` 0.2.2-rc.3): envelope protocol, 404 semantics, owner gating, and fiber-unload deregistration.
41
+
42
+
43
+ ## [0.5.5] - 2026-10-30
44
+
45
+ ### Fixed
46
+
47
+ - **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.
48
+
9
49
  ## [0.5.4] - 2026-10-28
10
50
 
11
51
  ### New Features
package/README.md CHANGED
@@ -104,7 +104,7 @@ npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
104
104
  | `directPrompt` | string | - | 私聊额外 system prompt |
105
105
  | `textChunkLimit` | number | `4500` | 单条消息最大字符数 |
106
106
  | `streaming` | boolean | `true` | 是否启用流式输出(群聊始终不启用) |
107
- | `sessionIdleTimeout` | number | `1800000` | 会话闲置超时(ms),默认 30 分钟 |
107
+ | `sessionIdleTimeout` | number | `1800000` | 会话闲置超时(ms),默认 30 分钟;`<=0` 表示不回收 |
108
108
  | `processingTimeoutMs` | number | `1800000` | 处理超时(ms),超时中断当前 LLM 调用 |
109
109
  | `maxQueue` | number | `20` | 并发队列最大长度 |
110
110
  | `historyLimit` | number | `10` | 群历史缓冲条数 |
@@ -120,6 +120,24 @@ npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
120
120
  | `access.c2cAllow` | string[] | `[]` | 私聊白名单(user openid) |
121
121
  | `access.groupMode` | `open`/`allowlist`/`disabled` | `open` | 群聊访问模式 |
122
122
  | `access.groupAllow` | string[] | `[]` | 群聊白名单(group openid) |
123
+ | `access.commandMode` | `open`/`allowlist`/`disabled` | `open` | QQ 斜杠命令模式,白名单按发送者 OpenID 独立校验 |
124
+
125
+ QQ 斜杠命令与群聊、私聊共用“所有人/白名单/关闭”模式:先按接入规则进入对话,再按发送者身份校验命令;审批和提问按钮沿用各自鉴权。命令白名单保存在独立的身份文件中,切换模式不影响名单。
126
+
127
+ 三类名单(私聊、群、命令)均支持三种添加方式:**配对码**、**手动按 OpenID 批量添加**、**导出/复制**。注意 OpenID 不是 QQ 号或群号;拿不到 OpenID 时用配对码添加。
128
+
129
+ - **配对码**:在账号设置中生成,让用户在对应对话里直接发给机器人即可加入名单。同一码可连续添加多人,错误场景(群码发到私聊等)不影响其有效性。
130
+ - **撤销语义**:移除身份后,移除前生成的同类配对码不能将其重新加回,重新授权需生成新码;其余人仍可继续认领。
131
+
132
+ 配置接口的 GET 返回 `config.accessRevision`,更新 `access` 时应一并提交该值;名单或模式已变化时返回 409,不覆盖现有授权。
133
+
134
+ ### 主动推送(proactiveDelivery)
135
+
136
+ QQ 入站触发的回合始终被动回复;定时任务等服务回合始终主动推送到 QQ。下表只控制「非 QQ 输入(如桌面续聊 QQ 会话)」的回合:
137
+
138
+ | 配置 | 类型 | 默认值 | 说明 |
139
+ |------|------|--------|------|
140
+ | `proactiveDelivery.externalTurns` | `off`/`c2c`/`all` | `c2c` | `off` 不推送;`c2c` 仅推送私聊;`all` 私聊和群聊都推送 |
123
141
 
124
142
  ### 富媒体理解(media)
125
143
 
@@ -222,13 +240,15 @@ sessionKey: `qqbot:${appId}:${scope}:${peerId}`,新会话铸造 UUID 会话 id
222
240
 
223
241
  解析策略:进程内复用 → 持久化恢复 → 全新创建。
224
242
 
243
+ QQ 群聊和私聊的补充提示词按当前 Agent 作用域加载,恢复会话时继续使用对应场景的配置。
244
+
225
245
  ## 设计原则
226
246
 
227
247
  - **纯 Cordis 插件** — 遵循 dsh "Plugins, not loop changes" 原则
228
248
  - **声明式依赖** — `inject = ['agents']`,不直接耦合其他插件
229
249
  - **会话隔离** — 每个 QQ 私聊用户/群聊各一个独立 Agent
230
250
  - **Preset 支持** — 可通过 `agent-presets` 服务挂载预设(工具集、prompt 等)
231
- - **闲置回收** — 超时自动 dispose Agent,防止内存泄漏
251
+ - **闲置回收** — 超时自动 dispose Agent,防止内存泄漏(回收后仍可按会话映射主动推送)
232
252
  - **Markdown 输出** — 回复以 Markdown 格式发送,支持代码块/表格感知切分
233
253
  - **图片理解** — 支持 `qqbot_describe_image` 视觉理解,可分析用户发送的图片
234
254
  - **附件发送** — 支持 `qqbot_send_file` 将本地文件发送给用户(默认启用路径白名单)
package/README_EN.md CHANGED
@@ -104,7 +104,7 @@ npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
104
104
  | `directPrompt` | string | - | Extra system prompt for direct chats |
105
105
  | `textChunkLimit` | number | `4500` | Max chars per message |
106
106
  | `streaming` | boolean | `true` | Enable streaming output (always disabled in groups) |
107
- | `sessionIdleTimeout` | number | `1800000` | Session idle timeout (ms), default 30 min |
107
+ | `sessionIdleTimeout` | number | `1800000` | Session idle timeout (ms), default 30 min; `<=0` disables eviction |
108
108
  | `processingTimeoutMs` | number | `1800000` | Processing timeout (ms), aborts the current LLM call |
109
109
  | `maxQueue` | number | `20` | Max concurrent queue length |
110
110
  | `historyLimit` | number | `10` | Group history buffer size |
@@ -120,6 +120,24 @@ npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
120
120
  | `access.c2cAllow` | string[] | `[]` | Direct-chat allowlist (user openid) |
121
121
  | `access.groupMode` | `open`/`allowlist`/`disabled` | `open` | Group access mode |
122
122
  | `access.groupAllow` | string[] | `[]` | Group allowlist (group openid) |
123
+ | `access.commandMode` | `open`/`allowlist`/`disabled` | `open` | Slash-command mode; the allowlist is checked per sender OpenID |
124
+
125
+ Slash commands share the same open / allowlist / disabled modes as chats: a message first passes the chat admission rules, then the command is authorized by sender identity. Approval and question buttons keep their own authorization. The command roster lives in a separate identity file, so switching the mode never drops the list.
126
+
127
+ All three rosters (direct chat, group, commands) support three ways to add members: **pairing codes**, **manual bulk-adding by OpenID**, and **copy/export**. Note that OpenIDs are not QQ numbers or group numbers; use a pairing code when the OpenID is unavailable.
128
+
129
+ - **Pairing code**: generate one in account settings and have the user send it to the bot in the matching chat. The same code admits multiple people; sending it in the wrong scene does not invalidate it.
130
+ - **Revocation**: after an identity is removed, pairing codes issued before the removal can no longer re-add it; re-authorization requires a fresh code.
131
+
132
+ The config API returns `config.accessRevision`; submit it together with `access` updates. If the roster or mode changed since your read, the update returns 409 instead of overwriting the newer grants.
133
+
134
+ ### Proactive delivery (proactiveDelivery)
135
+
136
+ Turns triggered by QQ inbound always reply passively; service turns (e.g. schedules) are always pushed proactively. This only controls turns driven by non-QQ input (e.g. continuing a QQ session from the desktop):
137
+
138
+ | Config | Type | Default | Description |
139
+ |------|------|--------|------|
140
+ | `proactiveDelivery.externalTurns` | `off`/`c2c`/`all` | `c2c` | `off` never push; `c2c` push direct chats only; `all` push direct and group chats |
123
141
 
124
142
  ### Rich media (media)
125
143
 
@@ -219,7 +237,7 @@ Resolution strategy: in-process reuse → persisted resume → fresh create.
219
237
  - **Declarative dependencies** — `inject = ['agents']`, no direct coupling to other plugins
220
238
  - **Session isolation** — one independent Agent per QQ direct user / group
221
239
  - **Preset support** — mount presets (toolkits, prompts, etc.) via the `agent-presets` service
222
- - **Idle eviction** — auto-dispose Agents on timeout to prevent memory leaks
240
+ - **Idle eviction** — idle Agents are disposed after timeout to prevent leaks (proactive push still resolves the peer from the session mapping)
223
241
  - **Markdown output** — replies sent as Markdown with code-block/table-aware chunking
224
242
  - **Image understanding** — supports `qqbot_describe_image` vision to analyze images sent by users
225
243
  - **File sending** — supports `qqbot_send_file` to send local files to users (path allowlist enabled by default)