@tencent-connect/dsh-qqbot 0.4.0 → 0.5.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/.orange-ci.yml +2 -68
- package/CHANGELOG.md +56 -0
- package/CHANGELOG_EN.md +95 -0
- package/README.md +119 -18
- package/README_EN.md +107 -17
- package/cordis.patch.yml +1 -1
- package/cordis.yml +46 -3
- package/dist/commands/help.d.ts +6 -7
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +23 -7
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.d.ts +7 -5
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +12 -12
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/misc.d.ts +10 -8
- package/dist/commands/misc.d.ts.map +1 -1
- package/dist/commands/misc.js +45 -8
- package/dist/commands/misc.js.map +1 -1
- package/dist/commands/model.d.ts +3 -4
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +8 -7
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/preset.d.ts +8 -0
- package/dist/commands/preset.d.ts.map +1 -0
- package/dist/commands/preset.js +52 -0
- package/dist/commands/preset.js.map +1 -0
- package/dist/commands/session.d.ts +11 -7
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +29 -13
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/status.d.ts +3 -4
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +2 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/types.d.ts +9 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -9
- package/dist/config.js.map +1 -1
- package/dist/features/answer-parser.d.ts +9 -0
- package/dist/features/answer-parser.d.ts.map +1 -0
- package/dist/features/answer-parser.js +23 -0
- package/dist/features/answer-parser.js.map +1 -0
- package/dist/features/approval-channel.d.ts +76 -0
- package/dist/features/approval-channel.d.ts.map +1 -0
- package/dist/features/approval-channel.js +142 -0
- package/dist/features/approval-channel.js.map +1 -0
- package/dist/features/approval-renderer.d.ts +18 -0
- package/dist/features/approval-renderer.d.ts.map +1 -0
- package/dist/features/approval-renderer.js +52 -0
- package/dist/features/approval-renderer.js.map +1 -0
- package/dist/features/button-utils.d.ts +33 -0
- package/dist/features/button-utils.d.ts.map +1 -0
- package/dist/features/button-utils.js +27 -0
- package/dist/features/button-utils.js.map +1 -0
- package/dist/features/history-store.d.ts.map +1 -1
- package/dist/features/history-store.js +0 -1
- package/dist/features/history-store.js.map +1 -1
- package/dist/features/question-channel.d.ts +96 -0
- package/dist/features/question-channel.d.ts.map +1 -0
- package/dist/features/question-channel.js +234 -0
- package/dist/features/question-channel.js.map +1 -0
- package/dist/features/question-renderer.d.ts +20 -0
- package/dist/features/question-renderer.d.ts.map +1 -0
- package/dist/features/question-renderer.js +70 -0
- package/dist/features/question-renderer.js.map +1 -0
- package/dist/gateway/bootstrap.d.ts +3 -3
- package/dist/gateway/bootstrap.d.ts.map +1 -1
- package/dist/gateway/bootstrap.js +84 -8
- package/dist/gateway/bootstrap.js.map +1 -1
- package/dist/gateway/index.d.ts +2 -2
- package/dist/gateway/index.js +2 -2
- package/dist/gateway/middleware-setup.d.ts +3 -3
- package/dist/gateway/middleware-setup.d.ts.map +1 -1
- package/dist/gateway/middleware-setup.js +9 -7
- package/dist/gateway/middleware-setup.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -25
- package/dist/index.js.map +1 -1
- package/dist/media/media-cleaner.d.ts +19 -0
- package/dist/media/media-cleaner.d.ts.map +1 -0
- package/dist/media/media-cleaner.js +81 -0
- package/dist/media/media-cleaner.js.map +1 -0
- package/dist/media/send-file-tool.d.ts +35 -0
- package/dist/media/send-file-tool.d.ts.map +1 -0
- package/dist/media/send-file-tool.js +150 -0
- package/dist/media/send-file-tool.js.map +1 -0
- package/dist/media/vision-tool.d.ts +16 -0
- package/dist/media/vision-tool.d.ts.map +1 -0
- package/dist/media/vision-tool.js +241 -0
- package/dist/media/vision-tool.js.map +1 -0
- package/dist/middleware/attachment.d.ts +3 -3
- package/dist/middleware/attachment.d.ts.map +1 -1
- package/dist/middleware/attachment.js +17 -4
- package/dist/middleware/attachment.js.map +1 -1
- package/dist/middleware/question-answer.d.ts +10 -0
- package/dist/middleware/question-answer.d.ts.map +1 -0
- package/dist/middleware/question-answer.js +19 -0
- package/dist/middleware/question-answer.js.map +1 -0
- package/dist/model/index.d.ts +4 -4
- package/dist/model/index.js +3 -3
- package/dist/model/model-resolver.d.ts +27 -13
- package/dist/model/model-resolver.d.ts.map +1 -1
- package/dist/model/model-resolver.js +82 -27
- package/dist/model/model-resolver.js.map +1 -1
- package/dist/model/prefs-store.d.ts +6 -1
- package/dist/model/prefs-store.d.ts.map +1 -1
- package/dist/model/prefs-store.js +25 -1
- package/dist/model/prefs-store.js.map +1 -1
- package/dist/model/settings-reader.d.ts +1 -1
- package/dist/session/idle-evictor.d.ts +2 -2
- package/dist/session/idle-evictor.d.ts.map +1 -1
- package/dist/session/idle-evictor.js +1 -1
- package/dist/session/idle-evictor.js.map +1 -1
- package/dist/session/index.d.ts +3 -3
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +2 -2
- package/dist/session/session-manager.d.ts +67 -9
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +216 -20
- package/dist/session/session-manager.js.map +1 -1
- package/dist/session/types.d.ts +47 -1
- package/dist/session/types.d.ts.map +1 -1
- package/dist/setup/bind-routes.d.ts +78 -0
- package/dist/setup/bind-routes.d.ts.map +1 -0
- package/dist/setup/bind-routes.js +311 -0
- package/dist/setup/bind-routes.js.map +1 -0
- package/dist/setup/binding-service.d.ts +86 -0
- package/dist/setup/binding-service.d.ts.map +1 -0
- package/dist/setup/binding-service.js +175 -0
- package/dist/setup/binding-service.js.map +1 -0
- package/dist/setup/index.d.ts +50 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +98 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/persist.d.ts +41 -0
- package/dist/setup/persist.d.ts.map +1 -0
- package/dist/setup/persist.js +201 -0
- package/dist/setup/persist.js.map +1 -0
- package/dist/setup/presenters.d.ts +40 -0
- package/dist/setup/presenters.d.ts.map +1 -0
- package/dist/setup/presenters.js +84 -0
- package/dist/setup/presenters.js.map +1 -0
- package/dist/setup/qr-svg.d.ts +8 -0
- package/dist/setup/qr-svg.d.ts.map +1 -0
- package/dist/setup/qr-svg.js +20 -0
- package/dist/setup/qr-svg.js.map +1 -0
- package/dist/shared/bind-protocol.d.ts +42 -0
- package/dist/shared/bind-protocol.d.ts.map +1 -0
- package/dist/shared/bind-protocol.js +19 -0
- package/dist/shared/bind-protocol.js.map +1 -0
- package/dist/shared/index.d.ts +3 -3
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +3 -3
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/send-helper.js +1 -1
- package/dist/shared/utils.d.ts +10 -3
- package/dist/shared/utils.d.ts.map +1 -1
- package/dist/shared/utils.js +47 -6
- package/dist/shared/utils.js.map +1 -1
- package/dist/transport/attachment.d.ts +18 -7
- package/dist/transport/attachment.d.ts.map +1 -1
- package/dist/transport/attachment.js +77 -30
- package/dist/transport/attachment.js.map +1 -1
- package/dist/transport/inbound.d.ts +5 -4
- package/dist/transport/inbound.d.ts.map +1 -1
- package/dist/transport/inbound.js +120 -80
- package/dist/transport/inbound.js.map +1 -1
- package/dist/transport/index.d.ts +4 -4
- package/dist/transport/index.js +4 -4
- package/dist/transport/msgid-cache.d.ts +23 -0
- package/dist/transport/msgid-cache.d.ts.map +1 -0
- package/dist/transport/msgid-cache.js +57 -0
- package/dist/transport/msgid-cache.js.map +1 -0
- package/dist/transport/outbound-buffer.d.ts +9 -6
- package/dist/transport/outbound-buffer.d.ts.map +1 -1
- package/dist/transport/outbound-buffer.js +5 -5
- package/dist/transport/outbound-buffer.js.map +1 -1
- package/dist/transport/outbound.d.ts +9 -9
- package/dist/transport/outbound.d.ts.map +1 -1
- package/dist/transport/outbound.js +7 -7
- package/dist/transport/outbound.js.map +1 -1
- package/dist/transport/reply-limiter.d.ts +31 -0
- package/dist/transport/reply-limiter.d.ts.map +1 -0
- package/dist/transport/reply-limiter.js +50 -0
- package/dist/transport/reply-limiter.js.map +1 -0
- package/dist/transport/reply-target.d.ts +29 -0
- package/dist/transport/reply-target.d.ts.map +1 -0
- package/dist/transport/reply-target.js +55 -0
- package/dist/transport/reply-target.js.map +1 -0
- package/dist/transport/streaming-writer.d.ts +3 -3
- package/dist/transport/streaming-writer.d.ts.map +1 -1
- package/dist/transport/streaming-writer.js +1 -1
- package/dist/transport/streaming-writer.js.map +1 -1
- package/dist/transport/tool-presenter.d.ts +0 -1
- package/dist/transport/tool-presenter.d.ts.map +1 -1
- package/dist/transport/tool-presenter.js +0 -1
- package/dist/transport/tool-presenter.js.map +1 -1
- package/dist/types.d.ts +9 -15
- package/dist/types.d.ts.map +1 -1
- package/docs/assets/qqchannel.jpg +0 -0
- package/docs/assets/qqgroup.jpg +0 -0
- package/docs/assets/qrcode.png +0 -0
- package/lib/client.js +996 -0
- package/lib/client.js.map +1 -0
- package/package.json +44 -7
- package/pnpm-workspace.yaml +1 -0
- package/tsconfig.client.json +19 -0
- package/tsdown.client.config.ts +58 -0
- package/dist/setup.d.ts +0 -24
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -170
- package/dist/setup.js.map +0 -1
package/.orange-ci.yml
CHANGED
|
@@ -1,68 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
- services:
|
|
4
|
-
- docker
|
|
5
|
-
docker:
|
|
6
|
-
image: node:24
|
|
7
|
-
runner:
|
|
8
|
-
network: devnet
|
|
9
|
-
stages:
|
|
10
|
-
- name: 安装依赖
|
|
11
|
-
script: npm install
|
|
12
|
-
- name: 构建项目
|
|
13
|
-
script: npm run build
|
|
14
|
-
- name: 配置 npm 官方源
|
|
15
|
-
script: npm config set registry https://registry.npmjs.org
|
|
16
|
-
- name: 配置 token
|
|
17
|
-
imports: https://git.woa.com/qq-ai/web/secret/blob/master/envs/npm/npmjs.txt
|
|
18
|
-
script: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
19
|
-
- name: 设置 npm 包版本号
|
|
20
|
-
script: npm version ${ORANGE_BRANCH} --no-git-tag-version --allow-same-version
|
|
21
|
-
- name: 发布 npm 包
|
|
22
|
-
script: npm publish --access public
|
|
23
|
-
- name: 生成通知
|
|
24
|
-
script: echo "@tencent-connect/dsh-qqbot@${ORANGE_BRANCH} 发布成功" > message.txt
|
|
25
|
-
- name: 发送通知
|
|
26
|
-
type: wework:message
|
|
27
|
-
options:
|
|
28
|
-
fromFile: message.txt
|
|
29
|
-
|
|
30
|
-
# ── master 分支:MR 检查 ──
|
|
31
|
-
master:
|
|
32
|
-
merge_request:
|
|
33
|
-
- docker:
|
|
34
|
-
image: node:24
|
|
35
|
-
wework:
|
|
36
|
-
silent: true
|
|
37
|
-
stages:
|
|
38
|
-
- name: 安装依赖
|
|
39
|
-
script: npm install
|
|
40
|
-
- name: TypeScript 类型检查
|
|
41
|
-
script: npx tsc --noEmit
|
|
42
|
-
|
|
43
|
-
# ── feat/fix 分支 push:内网发布 dev 版本 ──
|
|
44
|
-
(feat|fix)/**:
|
|
45
|
-
push:
|
|
46
|
-
- docker:
|
|
47
|
-
image: node:24
|
|
48
|
-
runner:
|
|
49
|
-
network: devnet
|
|
50
|
-
stages:
|
|
51
|
-
- name: 安装依赖
|
|
52
|
-
script: npm install
|
|
53
|
-
- name: 构建项目
|
|
54
|
-
script: npm run build
|
|
55
|
-
- name: 设置测试包名
|
|
56
|
-
script: npm run ci:prepare-test-pkg
|
|
57
|
-
- name: 设置测试版本
|
|
58
|
-
script: npm version "0.0.0-dev.${ORANGE_COMMIT_SHORT}" --no-git-tag-version
|
|
59
|
-
- name: 发布 npm 包
|
|
60
|
-
image: tencentcom/npm:latest
|
|
61
|
-
imports: https://git.woa.com/qq-ai/web/secret/blob/master/envs/npm/public.txt
|
|
62
|
-
settings:
|
|
63
|
-
username: $USER
|
|
64
|
-
password: $PWD
|
|
65
|
-
email: $EMAIL
|
|
66
|
-
registry: https://mirrors.tencent.com/npm/
|
|
67
|
-
folder: ./
|
|
68
|
-
tag: dev
|
|
1
|
+
include:
|
|
2
|
+
- https://git.woa.com/qq-ai/web/secret/blob/master/ci/tencent-connect/dsh-qqbot.yml
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
> [English](./CHANGELOG_EN.md)
|
|
4
|
+
|
|
3
5
|
本文件从产品视角记录 dsh-qqbot 的重要更新,聚焦用户可感知的变化。
|
|
4
6
|
|
|
5
7
|
格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)。
|
|
6
8
|
|
|
9
|
+
## [0.5.1] - 2026-10-12
|
|
10
|
+
|
|
11
|
+
### 新功能
|
|
12
|
+
|
|
13
|
+
- **端内扫码绑定**:在 DSH 桌面版 / Web 的设置页「QQ 机器人」栏目即可完成绑定——手机 QQ 扫码或手动填写 AppID / AppSecret,绑定状态实时可见;未绑定时侧栏会自动打开引导页。支持一键更换凭据与解绑。
|
|
14
|
+
- **端内配置面板**:常用配置告别手改文件——私聊 / 群聊访问控制(开放、白名单、停用)、群聊是否需要 @机器人、流式输出、工具结果展示、模型覆盖与补充指令,保存后自动生效。
|
|
15
|
+
|
|
16
|
+
### 体验优化
|
|
17
|
+
|
|
18
|
+
- **升级 QQ Bot SDK 至 1.0.5**:机器人掉线时日志会说明掉线原因以及是否会自动恢复;连接始终无法建立时快速失败并给出明确原因,不再一直等待。
|
|
19
|
+
|
|
20
|
+
## [0.5.0] - 2026-09-08
|
|
21
|
+
|
|
22
|
+
### 新功能
|
|
23
|
+
|
|
24
|
+
- **图片理解**:发送图片给机器人,它会自动理解图片内容(截图、照片、图表等),可结合文字指令一起分析。
|
|
25
|
+
- **发送文件**:机器人可将本地文件(文档、图片等)直接发送给你,不再局限于纯文字回复。
|
|
26
|
+
- **主动提问**:机器人遇到不确定的信息时,会主动向你提问,并通过按钮让你一键选择,交互更顺畅。
|
|
27
|
+
- **操作确认**:执行敏感或关键操作前,机器人会先发起确认,你通过「允许/拒绝」按钮即可放行或拦截。
|
|
28
|
+
- **会话压缩**:新增 `/compact` 指令,一键压缩当前会话历史,保留上下文的同时释放空间,适合超长对话。
|
|
29
|
+
- **预设切换**:新增 `/preset` 指令,查看或切换机器人的人格/行为预设。
|
|
30
|
+
- **网络延迟检测**:`/bot-ping` 升级,返回网络传输耗时与插件处理耗时,方便排查连接延迟。
|
|
31
|
+
|
|
32
|
+
### 体验优化
|
|
33
|
+
|
|
34
|
+
- 长任务执行超时延长到 30 分钟,复杂任务不再中途中断。
|
|
35
|
+
- 私聊与群聊按场景注入更贴合的系统提示词,回复更符合语境。
|
|
36
|
+
- 主动消息推送失败时自动降级为被动回复,减少「机器人没反应」的情况。
|
|
37
|
+
- 图片等媒体文件使用后自动清理,避免长期占用磁盘空间。
|
|
38
|
+
|
|
39
|
+
### 问题修复
|
|
40
|
+
|
|
41
|
+
- 修复 `/stop` 指令无法真正中止正在生成内容的问题(此前为无效操作)。
|
|
42
|
+
- 修复操作确认通道的注册顺序问题,确保确认请求能被正确捕获和处理。
|
|
43
|
+
|
|
44
|
+
### 文档
|
|
45
|
+
|
|
46
|
+
- README 补充 `/preset`、`/compact` 等新增指令说明,以及扫码升级引导。
|
|
47
|
+
|
|
48
|
+
## [0.4.0] - 2026-08-16
|
|
49
|
+
|
|
50
|
+
### 新功能
|
|
51
|
+
|
|
52
|
+
- **扫码链接**:二维码显示异常时,可直接点击终端输出的链接,在浏览器中完成扫码。
|
|
53
|
+
|
|
54
|
+
### 体验优化
|
|
55
|
+
|
|
56
|
+
- 支持 Windows 平台自动保存扫码凭据(此前会因路径问题失效)。
|
|
57
|
+
- 凭据自动保存失败时,会明确引导手动配置,不再静默丢失已有配置。
|
|
58
|
+
|
|
59
|
+
### 文档
|
|
60
|
+
|
|
61
|
+
- 新增扫码示意图与升级引导。
|
|
62
|
+
|
|
7
63
|
## [0.3.0] - 2026-08-15
|
|
8
64
|
|
|
9
65
|
### 新功能
|
package/CHANGELOG_EN.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
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.5.1] - 2026-10-12
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **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.
|
|
14
|
+
- **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.
|
|
15
|
+
|
|
16
|
+
### Improved
|
|
17
|
+
|
|
18
|
+
- **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.
|
|
19
|
+
|
|
20
|
+
## [0.5.0] - 2026-09-08
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **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.
|
|
25
|
+
- **File sending**: the bot can send local files (documents, images, etc.) directly to you, no longer limited to plain-text replies.
|
|
26
|
+
- **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.
|
|
27
|
+
- **Action confirmation**: before performing sensitive or critical operations, the bot requests confirmation, which you approve or block via "Allow/Deny" buttons.
|
|
28
|
+
- **Session compaction**: new `/compact` command to compress the current session history in one step, preserving context while freeing space — ideal for very long conversations.
|
|
29
|
+
- **Preset switching**: new `/preset` command to view or switch the bot's persona/behavior preset.
|
|
30
|
+
- **Network latency test**: upgraded `/bot-ping` to return network transport time and plugin processing time, making it easier to diagnose connection latency.
|
|
31
|
+
|
|
32
|
+
### Improved
|
|
33
|
+
|
|
34
|
+
- Long-task execution timeout extended to 30 minutes, so complex tasks are no longer interrupted mid-way.
|
|
35
|
+
- Direct and group chats now receive more context-appropriate system prompts.
|
|
36
|
+
- Failed proactive message pushes automatically fall back to passive replies, reducing "the bot didn't respond" situations.
|
|
37
|
+
- Media files such as images are automatically cleaned up after use, avoiding long-term disk usage.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- Fixed the `/stop` command not actually aborting in-progress generation (it was previously a no-op).
|
|
42
|
+
- Fixed the registration order of the approval channel, ensuring confirmation requests are captured and handled correctly.
|
|
43
|
+
|
|
44
|
+
### Documentation
|
|
45
|
+
|
|
46
|
+
- README updated with the new `/preset` and `/compact` commands, plus QR-code upgrade guidance.
|
|
47
|
+
|
|
48
|
+
## [0.4.0] - 2026-08-16
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- **QR link**: when the QR code renders incorrectly, you can click the link printed in the terminal to complete scanning in a browser.
|
|
53
|
+
|
|
54
|
+
### Improved
|
|
55
|
+
|
|
56
|
+
- Supports auto-saving QR credentials on Windows (previously failed due to path issues).
|
|
57
|
+
- When auto-saving credentials fails, it now clearly guides manual configuration instead of silently dropping existing config.
|
|
58
|
+
|
|
59
|
+
### Documentation
|
|
60
|
+
|
|
61
|
+
- Added QR-code screenshots and upgrade guidance.
|
|
62
|
+
|
|
63
|
+
## [0.3.0] - 2026-08-15
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- **File understanding**: send a file to the bot and it will automatically download and understand its contents, supporting extract, read, analyze, and more.
|
|
68
|
+
- **Streaming replies**: replies are displayed incrementally in real time, no need to wait for full generation — a smoother, more natural experience.
|
|
69
|
+
- **Visible progress**: when the bot runs tasks (running commands, reading/writing files), you can see what it is doing — no longer a "black box".
|
|
70
|
+
- **Error feedback**: when a task ends abnormally, the bot clearly explains the reason, no more "half replies" or "no response at all".
|
|
71
|
+
|
|
72
|
+
### Improved
|
|
73
|
+
|
|
74
|
+
- Correctly displays the speaker's nickname in group chats instead of an unreadable string.
|
|
75
|
+
- Automatically clears group chat history after replying to avoid cross-conversation interference.
|
|
76
|
+
- Voice messages are recognized and kept as text only, without extra invalid links.
|
|
77
|
+
- The bot now "actually gets things done": for requests like "download, extract, install", it executes real tool actions instead of just restating the steps.
|
|
78
|
+
|
|
79
|
+
### Fixed
|
|
80
|
+
|
|
81
|
+
- Fixed the bot being unable to read/write files (the working directory was misconfigured).
|
|
82
|
+
- Fixed duplicate content and too-few chunks in streaming replies.
|
|
83
|
+
|
|
84
|
+
## [0.1.0] - 2026-08-14
|
|
85
|
+
|
|
86
|
+
### Added
|
|
87
|
+
|
|
88
|
+
- **First release**: QQ bot integrated with an AI assistant, supporting direct and group chats.
|
|
89
|
+
- **Model switching**: supports switching between different AI models.
|
|
90
|
+
- **Common commands**: built-in help, status query, session management, and more.
|
|
91
|
+
- **QR binding**: bind the bot by scanning a QR code on first use, with simple setup.
|
|
92
|
+
|
|
93
|
+
### Fixed
|
|
94
|
+
|
|
95
|
+
- Fixed config parsing issues.
|
package/README.md
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img width="120" src="https://img.shields.io/badge/🤖-QQ_Bot-blue?style=for-the-badge" alt="QQ Bot" />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**基于 [deepseek-harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) 的 QQ Bot 插件,将 DeepSeek AI 助手接入 QQ 私聊与群聊。**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@tencent-connect/dsh-qqbot)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://github.com/tencent-connect/dsh-qqbot)
|
|
10
|
+
[](https://bot.q.qq.com/wiki/)
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
**[English](./README_EN.md) | 简体中文**
|
|
15
|
+
|
|
16
|
+
扫码加入 QQ 群 / 频道
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center" width="50%"><img src="./docs/assets/qqgroup.jpg" height="360" alt="QQ 群二维码" /><br /><b>QQ 开发者交流群</b><br /><sub>群号: 1032635674</sub></td>
|
|
21
|
+
<td align="center" width="50%"><img src="./docs/assets/qqchannel.jpg" height="360" alt="QQ 频道二维码" /><br /><b>QQ 开发者社区频道</b><br /><sub>频道号: 20dnumts4z</sub></td>
|
|
22
|
+
</tr>
|
|
23
|
+
</table>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
6
26
|
|
|
7
27
|
## 架构
|
|
8
28
|
|
|
9
29
|
```
|
|
10
|
-
QQ 用户 → QQ WebSocket → dsh-
|
|
30
|
+
QQ 用户 → QQ WebSocket → dsh-qqbot → ctx.agents → dsh agent loop → LLM
|
|
11
31
|
↑ │
|
|
12
32
|
└── session/event ──────────┘
|
|
13
33
|
(assistant reply → QQ sendMarkdown)
|
|
@@ -19,14 +39,20 @@ QQ 用户 → QQ WebSocket → dsh-im-qqbot → ctx.agents → dsh agent loop
|
|
|
19
39
|
|
|
20
40
|
```bash
|
|
21
41
|
# 安装到 profile
|
|
22
|
-
dsh plugin --profile qqbot add @tencent-connect/dsh-qqbot
|
|
42
|
+
npx @deepseek-ai/dsh plugin --profile qqbot add @tencent-connect/dsh-qqbot
|
|
23
43
|
|
|
24
44
|
# 启动
|
|
25
|
-
dsh --profile qqbot
|
|
45
|
+
npx @deepseek-ai/dsh --profile qqbot
|
|
26
46
|
```
|
|
27
47
|
|
|
28
48
|
首次启动时,插件检测到凭据未配置会自动进入扫码引导:终端输出二维码 → 手机 QQ 扫码绑定 → 凭据自动保存到 profile,后续启动无需再次扫码。
|
|
29
49
|
|
|
50
|
+
DSH **桌面版 / Web** 下会自动打开应用内「QQ Bot 绑定」页(右侧边栏),端内渲染二维码并实时展示绑定状态,扫码成功后自动完成保存与插件重载;CLI 模式保持终端二维码引导。设置 `QQBOT_BIND_OPEN_BROWSER=1` 可在无端内页的环境额外拉起系统浏览器扫码页作为降级通道。
|
|
51
|
+
|
|
52
|
+
<img src="./docs/assets/qrcode.png" alt="二维码扫码示意图" width="280" />
|
|
53
|
+
|
|
54
|
+
> **提示**:建议升级至 `0.4.0` 以上版本扫码,支持点击链接在浏览器打开,避免部分终端二维码渲染错位的问题。
|
|
55
|
+
|
|
30
56
|
### 方式二:本地路径安装
|
|
31
57
|
|
|
32
58
|
```bash
|
|
@@ -35,19 +61,18 @@ cd /path/to/dsh-qqbot
|
|
|
35
61
|
pnpm install && pnpm build
|
|
36
62
|
|
|
37
63
|
# 安装到 profile(本地路径)
|
|
38
|
-
dsh plugin --profile qqbot add /path/to/dsh-qqbot
|
|
64
|
+
npx @deepseek-ai/dsh plugin --profile qqbot add /path/to/dsh-qqbot
|
|
39
65
|
|
|
40
66
|
# 启动
|
|
41
67
|
export QQBOT_APPID="你的AppID" QQBOT_SECRET="你的AppSecret"
|
|
42
|
-
dsh --profile qqbot
|
|
68
|
+
npx @deepseek-ai/dsh --profile qqbot
|
|
43
69
|
```
|
|
44
70
|
|
|
45
71
|
### 方式三:--patch 开发模式
|
|
46
72
|
|
|
47
73
|
```bash
|
|
48
|
-
cd /path/to/deepseek-harness
|
|
49
74
|
export QQBOT_APPID="你的AppID" QQBOT_SECRET="你的AppSecret"
|
|
50
|
-
|
|
75
|
+
npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
51
76
|
```
|
|
52
77
|
|
|
53
78
|
## 配置项
|
|
@@ -64,15 +89,61 @@ pnpm dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
|
64
89
|
| `groupPrompt` | string | - | 群聊额外 system prompt |
|
|
65
90
|
| `directPrompt` | string | - | 私聊额外 system prompt |
|
|
66
91
|
| `textChunkLimit` | number | `4500` | 单条消息最大字符数 |
|
|
92
|
+
| `streaming` | boolean | `true` | 是否启用流式输出(群聊始终不启用) |
|
|
67
93
|
| `sessionIdleTimeout` | number | `1800000` | 会话闲置超时(ms),默认 30 分钟 |
|
|
94
|
+
| `processingTimeoutMs` | number | `1800000` | 处理超时(ms),超时中断当前 LLM 调用 |
|
|
95
|
+
| `maxQueue` | number | `20` | 并发队列最大长度 |
|
|
96
|
+
| `historyLimit` | number | `10` | 群历史缓冲条数 |
|
|
97
|
+
| `askTimeoutMs` | number | `300000` | 待答问题超时(ms),默认 5 分钟(ask_user_question) |
|
|
98
|
+
| `showToolResults` | boolean | `false` | 是否展示工具调用成功结果(错误始终展示) |
|
|
68
99
|
| `debug` | boolean | `false` | 调试模式 |
|
|
69
100
|
|
|
101
|
+
### 访问控制(access)
|
|
102
|
+
|
|
103
|
+
| 配置 | 类型 | 默认值 | 说明 |
|
|
104
|
+
|------|------|--------|------|
|
|
105
|
+
| `access.c2cMode` | `open`/`allowlist`/`disabled` | `open` | 私聊访问模式 |
|
|
106
|
+
| `access.c2cAllow` | string[] | `[]` | 私聊白名单(user openid) |
|
|
107
|
+
| `access.groupMode` | `open`/`allowlist`/`disabled` | `open` | 群聊访问模式 |
|
|
108
|
+
| `access.groupAllow` | string[] | `[]` | 群聊白名单(group openid) |
|
|
109
|
+
|
|
110
|
+
### 富媒体理解(media)
|
|
111
|
+
|
|
112
|
+
| 配置 | 类型 | 默认值 | 说明 |
|
|
113
|
+
|------|------|--------|------|
|
|
114
|
+
| `media.enabled` | boolean | `true` | 是否启用富媒体理解(图片/视频下载 + 工具分析) |
|
|
115
|
+
| `media.maxMB` | number | `200` | 富媒体下载大小上限(MB) |
|
|
116
|
+
| `media.ttlHours` | number | `24` | 富媒体存活时长(小时),0=永不过期 |
|
|
117
|
+
|
|
118
|
+
### 视觉理解(vision)
|
|
119
|
+
|
|
120
|
+
| 配置 | 类型 | 默认值 | 说明 |
|
|
121
|
+
|------|------|--------|------|
|
|
122
|
+
| `vision.enabled` | boolean | `false` | 是否启用视觉理解(qqbot_describe_image 工具) |
|
|
123
|
+
| `vision.provider` | string | - | 视觉模型 provider(如 pi-ai) |
|
|
124
|
+
| `vision.model` | string | - | 视觉模型 id(如 qwen-vl-max) |
|
|
125
|
+
| `vision.maxBytes` | number | `10MB` | 图片字节上限 |
|
|
126
|
+
| `vision.maxTokens` | number | `1024` | 输出 token 上限 |
|
|
127
|
+
| `vision.timeoutMs` | number | `120000` | 视觉调用超时(ms) |
|
|
128
|
+
|
|
129
|
+
### 附件发送(sendFile)
|
|
130
|
+
|
|
131
|
+
| 配置 | 类型 | 默认值 | 说明 |
|
|
132
|
+
|------|------|--------|------|
|
|
133
|
+
| `sendFile.restrictPaths` | boolean | `true` | 是否启用路径白名单(仅 media + cwd + extraRoots) |
|
|
134
|
+
| `sendFile.extraRoots` | string[] | `[]` | 额外允许访问的根目录 |
|
|
135
|
+
|
|
70
136
|
## 内置命令
|
|
71
137
|
|
|
72
138
|
| 命令 | 说明 |
|
|
73
139
|
|------|------|
|
|
74
|
-
| `/
|
|
75
|
-
| `/
|
|
140
|
+
| `/new`(别名 `/reset` `/clear`) | 开始新会话(清空上下文) |
|
|
141
|
+
| `/compact` | 压缩会话历史(摘要替换旧记录,保留上下文) |
|
|
142
|
+
| `/model` | 查看或切换模型 |
|
|
143
|
+
| `/preset` | 查看或切换 agent preset(新会话生效) |
|
|
144
|
+
| `/stop` | 中止当前生成 |
|
|
145
|
+
| `/bot-ping` | 网络延迟检测(返回传输与处理耗时) |
|
|
146
|
+
| `/bot-version` | 查看版本信息 |
|
|
76
147
|
| `/bot-status` | 查看当前会话状态 |
|
|
77
148
|
| `/bot-help` | 查看所有指令 |
|
|
78
149
|
|
|
@@ -83,11 +154,28 @@ src/
|
|
|
83
154
|
├── index.ts # Cordis 插件入口(async apply)
|
|
84
155
|
├── config.ts # 配置 Schema
|
|
85
156
|
├── types.ts # 全局类型定义
|
|
86
|
-
├── setup
|
|
157
|
+
├── setup/ # 凭据绑定(扫码)
|
|
158
|
+
│ ├── index.ts # 绑定编排(ensureCredentials)
|
|
159
|
+
│ ├── binding-service.ts # 扫码状态机(宿主内唯一事实源)
|
|
160
|
+
│ ├── bind-routes.ts # 端内绑定页路由(/qqbot/im-qqbot/bind)
|
|
161
|
+
│ ├── presenters.ts # 呈现策略(终端/浏览器降级)
|
|
162
|
+
│ ├── qr-svg.ts # 二维码 SVG 渲染(宿主侧)
|
|
163
|
+
│ └── persist.ts # 凭据写入 cordis.patch.yml
|
|
164
|
+
├── client/ # 浏览器半边(dsh.client Web Bundle)
|
|
165
|
+
│ ├── index.ts # 侧栏 Tab 注册 + 待绑定自动引导
|
|
166
|
+
│ └── bind-page.ts # 端内绑定页(二维码 + 状态轮询)
|
|
167
|
+
├── gateway/ # 网关装配
|
|
168
|
+
│ ├── bootstrap.ts # 启动装配(监听 session/event 等)
|
|
169
|
+
│ └── middleware-setup.ts # 中间件链配置
|
|
87
170
|
├── transport/ # 传输层
|
|
88
171
|
│ ├── inbound.ts # QQ 入站消息 → agent.followup()
|
|
89
172
|
│ ├── outbound.ts # session/event → QQ sendMarkdown
|
|
90
173
|
│ ├── outbound-buffer.ts # 流式缓冲
|
|
174
|
+
│ ├── streaming-writer.ts # 流式写入
|
|
175
|
+
│ ├── reply-target.ts # 回复目标解析
|
|
176
|
+
│ ├── msgid-cache.ts # 被动回复 msgid 缓存
|
|
177
|
+
│ ├── reply-limiter.ts # 被动回复限流
|
|
178
|
+
│ ├── tool-presenter.ts # 工具调用展示
|
|
91
179
|
│ └── chunker.ts # Markdown 文本切分
|
|
92
180
|
├── session/ # 会话管理层
|
|
93
181
|
│ ├── session-manager.ts # QQ peer → Agent 映射
|
|
@@ -96,12 +184,22 @@ src/
|
|
|
96
184
|
│ ├── model-resolver.ts # 路由解析
|
|
97
185
|
│ ├── prefs-store.ts # per-peer 偏好持久化
|
|
98
186
|
│ └── settings-reader.ts # settings.yaml 只读
|
|
187
|
+
├── features/ # 交互特性
|
|
188
|
+
│ ├── question-channel.ts # ask_user_question 问答通道
|
|
189
|
+
│ ├── approval-channel.ts # approval 审批确认通道
|
|
190
|
+
│ └── answer-parser.ts # 答案解析
|
|
191
|
+
├── media/ # 多媒体
|
|
192
|
+
│ ├── vision-tool.ts # 图片视觉理解
|
|
193
|
+
│ ├── send-file-tool.ts # 发送本地文件
|
|
194
|
+
│ └── media-cleaner.ts # 媒体 TTL 清理
|
|
195
|
+
├── middleware/ # 中间件
|
|
196
|
+
│ ├── question-answer.ts # 问答答案处理
|
|
197
|
+
│ └── attachment.ts # 附件处理
|
|
99
198
|
├── shared/ # 共享工具
|
|
100
199
|
│ ├── utils.ts # 通用函数
|
|
101
200
|
│ ├── scope.ts # scope/peer 提取
|
|
102
201
|
│ └── send-helper.ts # 分块发送
|
|
103
|
-
|
|
104
|
-
└── typings/ # 外部模块声明
|
|
202
|
+
└── commands/ # 斜杠命令
|
|
105
203
|
```
|
|
106
204
|
|
|
107
205
|
## 会话路由
|
|
@@ -118,6 +216,10 @@ sessionKey: `qqbot:${appId}:${scope}:${peerId}`,由 SHA-256 确定性派生 Se
|
|
|
118
216
|
- **Preset 支持** — 可通过 `agent-presets` 服务挂载预设(工具集、prompt 等)
|
|
119
217
|
- **闲置回收** — 超时自动 dispose Agent,防止内存泄漏
|
|
120
218
|
- **Markdown 输出** — 回复以 Markdown 格式发送,支持代码块/表格感知切分
|
|
219
|
+
- **图片理解** — 支持 `qqbot_describe_image` 视觉理解,可分析用户发送的图片
|
|
220
|
+
- **附件发送** — 支持 `qqbot_send_file` 将本地文件发送给用户(默认启用路径白名单)
|
|
221
|
+
- **问答互动** — 支持 `ask_user_question`,单选生成内联按钮(点一个其余变灰)、多选回复编号,逐题推进 + 问题级超时
|
|
222
|
+
- **操作确认** — 支持 `approval/request`,关键操作通过「允许/拒绝」按钮请求用户确认
|
|
121
223
|
|
|
122
224
|
## 本地开发
|
|
123
225
|
|
|
@@ -131,10 +233,9 @@ pnpm build
|
|
|
131
233
|
# 开发模式(watch)
|
|
132
234
|
pnpm dev
|
|
133
235
|
|
|
134
|
-
# 用 --patch
|
|
135
|
-
cd /path/to/deepseek-harness
|
|
236
|
+
# 用 --patch 方式调试
|
|
136
237
|
export QQBOT_APPID="xxx" QQBOT_SECRET="xxx"
|
|
137
|
-
|
|
238
|
+
npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
138
239
|
```
|
|
139
240
|
|
|
140
241
|
## License
|
package/README_EN.md
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img width="120" src="https://img.shields.io/badge/🤖-QQ_Bot-blue?style=for-the-badge" alt="QQ Bot" />
|
|
4
4
|
|
|
5
|
-
[
|
|
5
|
+
**A QQ Bot plugin for [deepseek-harness](https://github.com/deepseek-ai/deepseek-harness) (dsh), connecting DeepSeek AI assistants to QQ private and group chats.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@tencent-connect/dsh-qqbot)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://github.com/tencent-connect/dsh-qqbot)
|
|
10
|
+
[](https://bot.q.qq.com/wiki/)
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
**[简体中文](./README.md) | English**
|
|
15
|
+
|
|
16
|
+
Scan to join the QQ group / channel
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center" width="50%"><img src="./docs/assets/qqgroup.jpg" height="360" alt="QQ Group QR Code" /><br /><b>QQ Developer Group</b><br /><sub>Group ID: 1032635674</sub></td>
|
|
21
|
+
<td align="center" width="50%"><img src="./docs/assets/qqchannel.jpg" height="360" alt="QQ Channel QR Code" /><br /><b>QQ Developer Channel</b><br /><sub>Channel ID: 20dnumts4z</sub></td>
|
|
22
|
+
</tr>
|
|
23
|
+
</table>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
6
26
|
|
|
7
27
|
## Architecture
|
|
8
28
|
|
|
9
29
|
```
|
|
10
|
-
QQ User → QQ WebSocket → dsh-
|
|
30
|
+
QQ User → QQ WebSocket → dsh-qqbot → ctx.agents → dsh agent loop → LLM
|
|
11
31
|
↑ │
|
|
12
32
|
└── session/event ──────────┘
|
|
13
33
|
(assistant reply → QQ sendMarkdown)
|
|
@@ -19,14 +39,18 @@ QQ User → QQ WebSocket → dsh-im-qqbot → ctx.agents → dsh agent loop →
|
|
|
19
39
|
|
|
20
40
|
```bash
|
|
21
41
|
# Add to a profile
|
|
22
|
-
dsh plugin --profile qqbot add @tencent-connect/dsh-qqbot
|
|
42
|
+
npx @deepseek-ai/dsh plugin --profile qqbot add @tencent-connect/dsh-qqbot
|
|
23
43
|
|
|
24
44
|
# Start
|
|
25
|
-
dsh --profile qqbot
|
|
45
|
+
npx @deepseek-ai/dsh --profile qqbot
|
|
26
46
|
```
|
|
27
47
|
|
|
28
48
|
On first launch, the plugin detects missing credentials and automatically starts the QR flow: a QR code is printed in the terminal → scan it with the QQ mobile app → credentials are saved to the profile, so subsequent launches require no re-scan.
|
|
29
49
|
|
|
50
|
+
<img src="./docs/assets/qrcode.png" alt="QR code scan example" width="280" />
|
|
51
|
+
|
|
52
|
+
> **Note**: Upgrade to `0.4.0` or later for browser-link scanning, which avoids QR code misalignment in some terminals.
|
|
53
|
+
|
|
30
54
|
### Method 2: Local path
|
|
31
55
|
|
|
32
56
|
```bash
|
|
@@ -35,19 +59,18 @@ cd /path/to/dsh-qqbot
|
|
|
35
59
|
pnpm install && pnpm build
|
|
36
60
|
|
|
37
61
|
# Add to a profile (local path)
|
|
38
|
-
dsh plugin --profile qqbot add /path/to/dsh-qqbot
|
|
62
|
+
npx @deepseek-ai/dsh plugin --profile qqbot add /path/to/dsh-qqbot
|
|
39
63
|
|
|
40
64
|
# Start
|
|
41
65
|
export QQBOT_APPID="yourAppID" QQBOT_SECRET="yourAppSecret"
|
|
42
|
-
dsh --profile qqbot
|
|
66
|
+
npx @deepseek-ai/dsh --profile qqbot
|
|
43
67
|
```
|
|
44
68
|
|
|
45
69
|
### Method 3: --patch dev mode
|
|
46
70
|
|
|
47
71
|
```bash
|
|
48
|
-
cd /path/to/deepseek-harness
|
|
49
72
|
export QQBOT_APPID="yourAppID" QQBOT_SECRET="yourAppSecret"
|
|
50
|
-
|
|
73
|
+
npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
51
74
|
```
|
|
52
75
|
|
|
53
76
|
## Configuration
|
|
@@ -64,15 +87,61 @@ pnpm dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
|
64
87
|
| `groupPrompt` | string | - | Extra system prompt for group chats |
|
|
65
88
|
| `directPrompt` | string | - | Extra system prompt for direct chats |
|
|
66
89
|
| `textChunkLimit` | number | `4500` | Max chars per message |
|
|
90
|
+
| `streaming` | boolean | `true` | Enable streaming output (always disabled in groups) |
|
|
67
91
|
| `sessionIdleTimeout` | number | `1800000` | Session idle timeout (ms), default 30 min |
|
|
92
|
+
| `processingTimeoutMs` | number | `1800000` | Processing timeout (ms), aborts the current LLM call |
|
|
93
|
+
| `maxQueue` | number | `20` | Max concurrent queue length |
|
|
94
|
+
| `historyLimit` | number | `10` | Group history buffer size |
|
|
95
|
+
| `askTimeoutMs` | number | `300000` | Question timeout (ms), default 5 min (ask_user_question) |
|
|
96
|
+
| `showToolResults` | boolean | `false` | Show successful tool-call results (errors always shown) |
|
|
68
97
|
| `debug` | boolean | `false` | Debug mode |
|
|
69
98
|
|
|
99
|
+
### Access control (access)
|
|
100
|
+
|
|
101
|
+
| Config | Type | Default | Description |
|
|
102
|
+
|------|------|--------|------|
|
|
103
|
+
| `access.c2cMode` | `open`/`allowlist`/`disabled` | `open` | Direct-chat access mode |
|
|
104
|
+
| `access.c2cAllow` | string[] | `[]` | Direct-chat allowlist (user openid) |
|
|
105
|
+
| `access.groupMode` | `open`/`allowlist`/`disabled` | `open` | Group access mode |
|
|
106
|
+
| `access.groupAllow` | string[] | `[]` | Group allowlist (group openid) |
|
|
107
|
+
|
|
108
|
+
### Rich media (media)
|
|
109
|
+
|
|
110
|
+
| Config | Type | Default | Description |
|
|
111
|
+
|------|------|--------|------|
|
|
112
|
+
| `media.enabled` | boolean | `true` | Enable rich media understanding (image/video download + tool analysis) |
|
|
113
|
+
| `media.maxMB` | number | `200` | Max download size (MB) |
|
|
114
|
+
| `media.ttlHours` | number | `24` | Media lifetime (hours), 0 = never expire |
|
|
115
|
+
|
|
116
|
+
### Vision (vision)
|
|
117
|
+
|
|
118
|
+
| Config | Type | Default | Description |
|
|
119
|
+
|------|------|--------|------|
|
|
120
|
+
| `vision.enabled` | boolean | `false` | Enable vision (qqbot_describe_image tool) |
|
|
121
|
+
| `vision.provider` | string | - | Vision model provider (e.g. pi-ai) |
|
|
122
|
+
| `vision.model` | string | - | Vision model id (e.g. qwen-vl-max) |
|
|
123
|
+
| `vision.maxBytes` | number | `10MB` | Max image bytes |
|
|
124
|
+
| `vision.maxTokens` | number | `1024` | Max output tokens |
|
|
125
|
+
| `vision.timeoutMs` | number | `120000` | Vision call timeout (ms) |
|
|
126
|
+
|
|
127
|
+
### File sending (sendFile)
|
|
128
|
+
|
|
129
|
+
| Config | Type | Default | Description |
|
|
130
|
+
|------|------|--------|------|
|
|
131
|
+
| `sendFile.restrictPaths` | boolean | `true` | Enable path allowlist (media + cwd + extraRoots only) |
|
|
132
|
+
| `sendFile.extraRoots` | string[] | `[]` | Extra allowed root directories |
|
|
133
|
+
|
|
70
134
|
## Built-in Commands
|
|
71
135
|
|
|
72
136
|
| Command | Description |
|
|
73
137
|
|------|------|
|
|
74
|
-
| `/
|
|
75
|
-
| `/
|
|
138
|
+
| `/new` (aliases `/reset` `/clear`) | Start a new session (clear context) |
|
|
139
|
+
| `/compact` | Compact session history (replace old records with a summary) |
|
|
140
|
+
| `/model` | View or switch model |
|
|
141
|
+
| `/preset` | View or switch agent preset (applies to new sessions) |
|
|
142
|
+
| `/stop` | Abort the current generation |
|
|
143
|
+
| `/bot-ping` | Network latency test (transport & processing time) |
|
|
144
|
+
| `/bot-version` | View version info |
|
|
76
145
|
| `/bot-status` | View current session status |
|
|
77
146
|
| `/bot-help` | View all commands |
|
|
78
147
|
|
|
@@ -84,10 +153,18 @@ src/
|
|
|
84
153
|
├── config.ts # Config schema
|
|
85
154
|
├── types.ts # Global types
|
|
86
155
|
├── setup.ts # Credential binding (QR)
|
|
156
|
+
├── gateway/ # Gateway assembly
|
|
157
|
+
│ ├── bootstrap.ts # Startup wiring (session/event listeners, etc.)
|
|
158
|
+
│ └── middleware-setup.ts # Middleware chain config
|
|
87
159
|
├── transport/ # Transport layer
|
|
88
160
|
│ ├── inbound.ts # QQ inbound message → agent.followup()
|
|
89
161
|
│ ├── outbound.ts # session/event → QQ sendMarkdown
|
|
90
162
|
│ ├── outbound-buffer.ts # Streaming buffer
|
|
163
|
+
│ ├── streaming-writer.ts # Streaming writer
|
|
164
|
+
│ ├── reply-target.ts # Reply target resolution
|
|
165
|
+
│ ├── msgid-cache.ts # Passive reply msgid cache
|
|
166
|
+
│ ├── reply-limiter.ts # Passive reply rate limiter
|
|
167
|
+
│ ├── tool-presenter.ts # Tool-call presentation
|
|
91
168
|
│ └── chunker.ts # Markdown chunking
|
|
92
169
|
├── session/ # Session management
|
|
93
170
|
│ ├── session-manager.ts # QQ peer → Agent mapping
|
|
@@ -96,12 +173,22 @@ src/
|
|
|
96
173
|
│ ├── model-resolver.ts # Route resolution
|
|
97
174
|
│ ├── prefs-store.ts # Per-peer preference persistence
|
|
98
175
|
│ └── settings-reader.ts # settings.yaml read-only
|
|
176
|
+
├── features/ # Interaction features
|
|
177
|
+
│ ├── question-channel.ts # ask_user_question Q&A channel
|
|
178
|
+
│ ├── approval-channel.ts # approval confirmation channel
|
|
179
|
+
│ └── answer-parser.ts # Answer parsing
|
|
180
|
+
├── media/ # Media
|
|
181
|
+
│ ├── vision-tool.ts # Image vision understanding
|
|
182
|
+
│ ├── send-file-tool.ts # Send local files
|
|
183
|
+
│ └── media-cleaner.ts # Media TTL cleanup
|
|
184
|
+
├── middleware/ # Middleware
|
|
185
|
+
│ ├── question-answer.ts # Q&A answer handling
|
|
186
|
+
│ └── attachment.ts # Attachment handling
|
|
99
187
|
├── shared/ # Shared utilities
|
|
100
188
|
│ ├── utils.ts # Common helpers
|
|
101
189
|
│ ├── scope.ts # scope/peer extraction
|
|
102
190
|
│ └── send-helper.ts # Chunked send
|
|
103
|
-
|
|
104
|
-
└── typings/ # External module declarations
|
|
191
|
+
└── commands/ # Slash commands
|
|
105
192
|
```
|
|
106
193
|
|
|
107
194
|
## Session Routing
|
|
@@ -118,6 +205,10 @@ Resolution strategy: in-process reuse → persisted resume → fresh create.
|
|
|
118
205
|
- **Preset support** — mount presets (toolkits, prompts, etc.) via the `agent-presets` service
|
|
119
206
|
- **Idle eviction** — auto-dispose Agents on timeout to prevent memory leaks
|
|
120
207
|
- **Markdown output** — replies sent as Markdown with code-block/table-aware chunking
|
|
208
|
+
- **Image understanding** — supports `qqbot_describe_image` vision to analyze images sent by users
|
|
209
|
+
- **File sending** — supports `qqbot_send_file` to send local files to users (path allowlist enabled by default)
|
|
210
|
+
- **Question interaction** — supports `ask_user_question` with inline keyboard buttons (mutually exclusive) or numbered replies, one question at a time with timeout
|
|
211
|
+
- **Approval confirmation** — supports `approval/request` to ask for user confirmation on critical actions via allow/deny buttons
|
|
121
212
|
|
|
122
213
|
## Local Development
|
|
123
214
|
|
|
@@ -131,10 +222,9 @@ pnpm build
|
|
|
131
222
|
# Dev mode (watch)
|
|
132
223
|
pnpm dev
|
|
133
224
|
|
|
134
|
-
# Debug via --patch
|
|
135
|
-
cd /path/to/deepseek-harness
|
|
225
|
+
# Debug via --patch
|
|
136
226
|
export QQBOT_APPID="xxx" QQBOT_SECRET="xxx"
|
|
137
|
-
|
|
227
|
+
npx @deepseek-ai/dsh web --patch /path/to/dsh-qqbot/cordis.dev.yml
|
|
138
228
|
```
|
|
139
229
|
|
|
140
230
|
## License
|