@zaofan/dsh-qqbot 1.1.5 → 1.1.7

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 (3) hide show
  1. package/README.md +13 -2
  2. package/README_EN.md +9 -0
  3. package/package.json +15 -2
package/README.md CHANGED
@@ -69,6 +69,11 @@
69
69
  - 收到【审批轮询】= **系统唤醒**——主动 `group_join_requests` 查看新申请,把申请人+验证信息汇报给主人,等主人拍板再批/拒
70
70
  - 消息里带 `@bot` = 有人 @ 本机器人(`@bot` 就是自己)
71
71
  - 会话归属、工作区挂载等宿主问题已按官方机制修好(移植上游 PR #21,幂等、全 fail-soft)
72
+ - **你可以自己写 markdown、自己写工具、自己写斜杠命令**(不用等人给你做功能):
73
+ - 卡片正文就是**你直接写的 markdown**(`#` 标题、加粗、`![说明](图片URL)`、代码块)——**本插件没有模板引擎,模板就是你**;要"带按钮的卡片"则走 botplay 事件或 dock 卡片编辑器(按钮回调须由 host 注册)。
74
+ - 工具/命令写在**账号数据目录**的 `.qqbot-extensions/{tools,commands}/`,**不在插件包内** → **升级/重装插件(换 node_modules)不会覆盖你的扩展**,扩展原样保留。
75
+ - 工具 `run(args, env)` 的 `env` 里有 `sender` + `replyTarget`(内置 `send_media` 用的同一个发送器),**工具能自己发 markdown 卡/图/语音/文件**:所以「调接口取数据 → 拼卡片 → 发出去」一个工具就能闭环,不必绕回你。用户说"给我写个点歌工具"时,照契约现场写即可。
76
+ - 生效方式:工具发 `/tools-reload`(或调 `tools_reload`)即时生效;命令需重启宿主;**同名工具改内容会被注册表跳过 → 换名或重启**。
72
77
 
73
78
  > 🛡️ 仓库**不含**任何机器人凭据、图库数据、日志与个人路径(发布前已清理)。AppID/AppSecret 请走环境变量或 Web 面板注入,**不要提交进 git**。
74
79
 
@@ -339,9 +344,15 @@ export default {
339
344
 
340
345
  ### 给 AI 的要点(让 AI 帮用户写扩展时照此办)
341
346
  1. 命令/工具文件都放**账号数据目录**的 `.qqbot-extensions/` 下(dataRoot 优先, 无则 cwd), 别放插件包内。
347
+ → **升级/重装插件(换 node_modules)只动插件本体, 不会覆盖扩展目录**, 用户的扩展永久保留。
342
348
  2. 工具入参 schema 用 JSON Schema 风格; **可选参数不带 required 字段**。
343
- 3. 写完后告知用户: 命令需重启, 工具发 `/tools-reload` 或调 tools_reload。
344
- 4. 返回统一 `{ ok, msg }`(工具)或纯文本(命令)。
349
+ 3. `run(args, env)` 的 `env = { cwd, manager, sender, replyTarget, exec }`:
350
+ - `sender` + `replyTarget` 就是内置 `send_media` 用的发送器 → **工具可以自己发 markdown 卡片 / 图片 / 语音 / 文件**, 不用把内容再交回 AI。
351
+ - 工具返回 `{ ok, msg }`(msg 作为工具结果回给 AI); 命令返回纯文本。
352
+ 4. 卡片正文由**你(AI)直接写 markdown**(标题/加粗/`![说明](url)`/代码块), **本插件没有模板引擎, 不需要也不会用配置型模板**。
353
+ 5. 生效方式: 工具发 `/tools-reload` 或调 `tools_reload` —— 新工具即时生效; **同名工具改内容会被工具注册表跳过(`already registered`) → 换名或重启宿主**; 命令一律需重启宿主(`/bot-restart`)。
354
+ 6. 能力边界: **扩展工具无法注册"按钮点击回调"** —— 按钮回调只能由 host 侧的 botplay 事件 / dock 卡片编辑器注册。纯扩展方案的交互范式 = "卡片 + 用户回个编号", 由 AI 当状态机再调一次工具。
355
+ 7. 示范(点歌): ①工具里 fetch 搜索接口 → ②拼一段 markdown(封面/歌名/歌手/歌词) → ③`sender.sendMarkdown(replyTarget, 卡片)` → ④要试听就 `sender.sendMedia(...)` → ⑤返回 `{ok:true,msg:'已发卡'}`。
345
356
 
346
357
  ## 富媒体指令(AI 回复里写标记,自动变成真消息)
347
358
 
package/README_EN.md CHANGED
@@ -260,6 +260,15 @@ export default {
260
260
  ```
261
261
  Then run `/tools-reload` (or ask the AI to call the `tools_reload` tool). Commands need a host restart.
262
262
 
263
+ **For AI agents — you can write these yourself (no feature request needed):**
264
+ - Card bodies are **plain markdown you write** (`#`, bold, `![alt](url)`, fenced code). This plugin has **no template engine — the model is the engine**. Cards with buttons go through a botplay event or the dock card editor (button callbacks must be registered host-side).
265
+ - Extensions live in the **account data directory** (`.qqbot-extensions/`), never inside the plugin package → **upgrading or reinstalling the plugin never overwrites them**.
266
+ - `run(args, env)` receives `env = { cwd, manager, sender, replyTarget, exec }`. `sender` + `replyTarget` is the very same sender the built-in `send_media` tool uses, so a tool can **post markdown cards / images / voice / files by itself**: "fetch an API → build markdown → send" closes the loop inside one tool.
267
+ - Tools reply `{ ok, msg }` (fed back to you as the tool result); commands return plain text.
268
+ - Hot reload: `/tools-reload` (or call `tools_reload`) picks up **new** tools; **editing a tool under the same name is skipped by the registry → rename it or restart the host**; commands always need a restart.
269
+ - Limitation: extensions **cannot register button callbacks** — those require a botplay event or the dock card editor. Extension-only flows are "card + user replies a number", with the AI acting as the state machine.
270
+ - Example (song request): fetch a search API → build a markdown card (cover / title / artist / lyrics) → `sender.sendMarkdown(replyTarget, card)` → optionally `sender.sendMedia(...)` for a preview → return `{ ok: true, msg: 'card sent' }`.
271
+
263
272
  ## Core Modules
264
273
 
265
274
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaofan/dsh-qqbot",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "QQ Bot IM channel plugin for deepseek-harness (dsh)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,12 +34,25 @@
34
34
  "clean": "rm -rf dist",
35
35
  "ci:prepare-test-pkg": "node scripts/prepare-test-pkg.js"
36
36
  },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/gcry13067381632-jpg/dsh-qqbot.git"
40
+ },
41
+ "homepage": "https://github.com/gcry13067381632-jpg/dsh-qqbot#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/gcry13067381632-jpg/dsh-qqbot/issues"
44
+ },
37
45
  "keywords": [
38
46
  "deepseek-harness",
39
47
  "dsh",
48
+ "dsh-plugin",
40
49
  "qqbot",
50
+ "qq-bot",
51
+ "chatbot",
52
+ "ai-agent",
41
53
  "cordis",
42
- "plugin"
54
+ "plugin",
55
+ "llm"
43
56
  ],
44
57
  "license": "MIT",
45
58
  "files": [