@zaofan/dsh-qqbot 1.10.48 → 1.11.0

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 (47) hide show
  1. package/README.md +40 -3
  2. package/client/qqbot-settings.js +487 -30
  3. package/dist/features/ext-capabilities.d.ts +2 -0
  4. package/dist/features/ext-capabilities.d.ts.map +1 -1
  5. package/dist/features/ext-capabilities.js +38 -0
  6. package/dist/features/ext-capabilities.js.map +1 -1
  7. package/dist/features/ext-reload.d.ts +2 -2
  8. package/dist/features/ext-reload.d.ts.map +1 -1
  9. package/dist/features/ext-reload.js +30 -8
  10. package/dist/features/ext-reload.js.map +1 -1
  11. package/dist/features/ext-ui-seed.d.ts +25 -0
  12. package/dist/features/ext-ui-seed.d.ts.map +1 -0
  13. package/dist/features/ext-ui-seed.js +187 -0
  14. package/dist/features/ext-ui-seed.js.map +1 -0
  15. package/dist/features/ext-ui.d.ts +3 -5
  16. package/dist/features/ext-ui.d.ts.map +1 -1
  17. package/dist/features/ext-ui.js +34 -12
  18. package/dist/features/ext-ui.js.map +1 -1
  19. package/dist/features/extension-store.d.ts.map +1 -1
  20. package/dist/features/extension-store.js +3 -0
  21. package/dist/features/extension-store.js.map +1 -1
  22. package/dist/gateway/bootstrap.d.ts.map +1 -1
  23. package/dist/gateway/bootstrap.js +18 -1
  24. package/dist/gateway/bootstrap.js.map +1 -1
  25. package/dist/gateway/middleware-setup.d.ts.map +1 -1
  26. package/dist/gateway/middleware-setup.js +11 -1
  27. package/dist/gateway/middleware-setup.js.map +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +131 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/session/session-manager.d.ts.map +1 -1
  32. package/dist/session/session-manager.js +2 -1
  33. package/dist/session/session-manager.js.map +1 -1
  34. package/docs/extension-contract.md +400 -255
  35. package/examples/ext-commands//346/211/251/345/261/225/347/244/272/344/276/213.mjs +84 -0
  36. package/examples/ext-hooks/demo-store.mjs +75 -0
  37. package/examples/ext-ui/demo/dock/card.css +55 -0
  38. package/examples/ext-ui/demo/dock/card.html +95 -0
  39. package/examples/ext-ui/demo/dock/card.js +261 -0
  40. package/examples/ext-ui/demo/settings/card.css +61 -0
  41. package/examples/ext-ui/demo/settings/card.html +38 -0
  42. package/examples/ext-ui/demo/settings/card.js +87 -0
  43. package/package.json +145 -144
  44. package/settings-host.js +6680 -6244
  45. package/examples/ext-ui/local-llm/card.css +0 -66
  46. package/examples/ext-ui/local-llm/card.html +0 -38
  47. package/examples/ext-ui/local-llm/card.js +0 -59
@@ -0,0 +1,38 @@
1
+ <!-- qqbot-ui: { "id": "demo", "slot": "settings", "title": "扩展示例 · 全局", "order": 5 } -->
2
+ <!--
3
+ 扩展示例 · 设置页卡片(slot=settings → 放 profile 级目录)
4
+ {PROFILE_ROOT}/.qqbot-extensions/ui/demo-settings/card.html
5
+
6
+ ★ 2026-10-27:虽然是「全局 UI」,但能操作**当前选中账号**那份数据 ——
7
+ 上面账号下拉框切到谁,getConfig('data') 就是谁。
8
+ 这是主人明确要的能力:一个界面里既能改全局,又能改单实例。
9
+ -->
10
+ <div class="card">
11
+ <div class="hd"><span class="dot" id="dot"></span><span>⚙ 扩展示例</span></div>
12
+
13
+ <div class="tip">
14
+ 这里填的文字会出现在 <b>/扩展示例</b> 的输出里 —— 去群里敲一下就能看到:
15
+ <div class="code">/扩展示例 → (文本1)(文本2)</div>
16
+ <b>文本2</b> 在悬浮球的「🔌 扩展示例」里改(每个机器人各一份)。
17
+ </div>
18
+
19
+ <div class="row seg">
20
+ <label><input type="radio" name="dscope" value="profile" checked /> 改全局(所有机器人共用)</label>
21
+ <label><input type="radio" name="dscope" value="data" /> 改当前账号:<b id="acctName">—</b></label>
22
+ </div>
23
+
24
+ <div class="row">
25
+ <span class="lbl" id="fieldLbl">文本1(全局)</span>
26
+ </div>
27
+ <div class="row">
28
+ <input class="txt" id="t1" placeholder="填一段文字,例如 我是全局文本" />
29
+ </div>
30
+ <div class="row">
31
+ <span class="hint" id="scopeHint">改动影响所有机器人;改完去群里敲 /扩展示例 看效果。</span>
32
+ </div>
33
+ <div class="acts">
34
+ <button class="btn" id="save">保存</button>
35
+ <button class="btn ghost" id="load">重新读取</button>
36
+ </div>
37
+ <div class="row"><span class="val" id="st"></span></div>
38
+ </div>
@@ -0,0 +1,87 @@
1
+ /* 扩展示例 · 设置页卡片逻辑
2
+ *
3
+ * ★ 核心演示(2026-10-27 主人要求):**一张全局 UI,两种作用域**
4
+ * · profile 级 → 所有机器人共用(getConfig() / setConfig(p))
5
+ * · data 级 → 只改上面账号下拉框选中的那个(getConfig('data') / setConfig(p,'data'))
6
+ * 卡片自己不用知道路径,qqbotExt.acct 里就有当前选中的账号。
7
+ */
8
+ (function () {
9
+ var $ = function (id) { return shadowRoot.getElementById(id) };
10
+ var t1 = $('t1');
11
+ var st = $('st');
12
+ var dot = $('dot');
13
+ var acctName = $('acctName');
14
+ var fieldLbl = $('fieldLbl');
15
+ var scopeHint = $('scopeHint');
16
+
17
+ var acct = qqbotExt.acct || null;
18
+ var scope = 'profile'; // profile | data
19
+
20
+ function show(ok, msg) {
21
+ if (st) { st.textContent = msg; st.style.color = ok ? '#2f9e44' : '#c33' }
22
+ if (dot) dot.className = 'dot ' + (ok ? 'on' : 'err')
23
+ }
24
+
25
+ // 显示当前选中的账号名(没账号时提示去「账号与预设」加)
26
+ if (acctName) acctName.textContent = acct && acct.ns ? acct.ns : '(还没选账号)'
27
+ var hasAcct = !!(acct && acct.ns)
28
+
29
+ function syncLabels() {
30
+ var isData = scope === 'data'
31
+ if (fieldLbl) fieldLbl.textContent = isData ? ('文本1(账号:' + (acct.ns || '?') + ')') : '文本1(全局)'
32
+ if (scopeHint) {
33
+ scopeHint.textContent = isData
34
+ ? '只影响「' + (acct.ns || '?') + '」这个机器人;改完去群里敲 /扩展示例 看效果。'
35
+ : '改动影响所有机器人;改完去群里敲 /扩展示例 看效果。'
36
+ }
37
+ }
38
+
39
+ function load() {
40
+ show(true, '读取中…')
41
+ // 第二参数不传 = 用卡片上下文里的当前账号
42
+ qqbotExt.getConfig(scope).then(function (c) {
43
+ if (t1) t1.value = c.text1 || ''
44
+ var where = scope === 'data' ? ('账号 ' + (acct.ns || '?')) : '全局'
45
+ show(true, (c.text1 ? ('当前(' + where + '):' + c.text1) : ('当前(' + where + '):还没设置')))
46
+ })
47
+ }
48
+
49
+ // ── 作用域切换 ──────────────────────────────────────────
50
+ shadowRoot.querySelectorAll('input[name="dscope"]').forEach(function (r) {
51
+ r.addEventListener('change', function () {
52
+ if (!r.checked) return
53
+ if (r.value === 'data' && !hasAcct) {
54
+ show(false, '上面还没选账号 —— 先去「账号与预设」加一个')
55
+ var p = shadowRoot.querySelector('input[name="dscope"][value="profile"]')
56
+ if (p) p.checked = true
57
+ return
58
+ }
59
+ scope = r.value
60
+ syncLabels()
61
+ load()
62
+ })
63
+ })
64
+
65
+ // ── 保存 / 重读 ─────────────────────────────────────────
66
+ var save = $('save');
67
+ if (save) {
68
+ save.addEventListener('click', function () {
69
+ if (scope === 'data' && !hasAcct) return show(false, '没有可写的账号')
70
+ save.disabled = true
71
+ qqbotExt.setConfig({ text1: t1 ? t1.value : '' }, scope).then(function (r) {
72
+ save.disabled = false
73
+ if (r && r.ok) {
74
+ var where = scope === 'data' ? ('账号 ' + (acct.ns || '?')) : '全局'
75
+ show(true, '已保存到' + where + ':' + ((r.config && r.config.text1) || ''))
76
+ } else {
77
+ show(false, '保存失败:' + ((r && r.reason) || '未知'))
78
+ }
79
+ }).catch(function () { save.disabled = false; show(false, '保存异常') })
80
+ })
81
+ }
82
+ var re = $('load');
83
+ if (re) re.addEventListener('click', load)
84
+
85
+ syncLabels()
86
+ load()
87
+ })();
package/package.json CHANGED
@@ -1,144 +1,145 @@
1
- {
2
- "name": "@zaofan/dsh-qqbot",
3
- "version": "1.10.48",
4
- "description": "QQ Bot IM channel plugin for deepseek-harness (dsh)",
5
- "type": "module",
6
- "main": "./entry.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./entry.js"
12
- },
13
- "./channel-tools": {
14
- "types": "./dist/channel-tools.d.ts",
15
- "import": "./dist/channel-tools.js"
16
- },
17
- "./sticker-store": {
18
- "types": "./dist/features/sticker-store.d.ts",
19
- "import": "./dist/features/sticker-store.js"
20
- },
21
- "./schedule-store": {
22
- "types": "./dist/features/schedule-store.d.ts",
23
- "import": "./dist/features/schedule-store.js"
24
- },
25
- "./client": "./client/qqbot-settings.js"
26
- },
27
- "scripts": {
28
- "build": "tsc",
29
- "dev": "tsc --watch",
30
- "prepublishOnly": "npm run build && node scripts/check-package.mjs",
31
- "check:package": "node scripts/check-package.mjs",
32
- "lint": "eslint src/",
33
- "test": "vitest run",
34
- "clean": "rm -rf dist",
35
- "ci:prepare-test-pkg": "node scripts/prepare-test-pkg.js"
36
- },
37
- "repository": {
38
- "type": "git",
39
- "url": "git+https://github.com/zaofan-make/dsh-qqbot.git"
40
- },
41
- "homepage": "https://github.com/zaofan-make/dsh-qqbot#readme",
42
- "bugs": {
43
- "url": "https://github.com/zaofan-make/dsh-qqbot/issues"
44
- },
45
- "keywords": [
46
- "deepseek-harness",
47
- "dsh",
48
- "dsh-plugin",
49
- "qqbot",
50
- "qq-bot",
51
- "chatbot",
52
- "ai-agent",
53
- "cordis",
54
- "plugin",
55
- "llm"
56
- ],
57
- "license": "MIT",
58
- "files": [
59
- "dist",
60
- "docs/extension-contract.md",
61
- "docs/USER-GUIDE.md",
62
- "docs/botplay-contract.md",
63
- "docs/host-services.md",
64
- "examples",
65
- "client",
66
- "cordis.patch.yml",
67
- "settings-host.js",
68
- "README.md",
69
- "README_EN.md",
70
- "LICENSE",
71
- "voice-convert.mjs",
72
- "scripts/download-model.mjs",
73
- "scripts/fix-dsh-016-presets.ps1",
74
- "entry.js"
75
- ],
76
- "dsh": {
77
- "bundle": {
78
- "patch": "./cordis.patch.yml"
79
- },
80
- "client": {
81
- "platform": "web",
82
- "inject": [
83
- "@deepseek-ai/dsh-client-ui-settings",
84
- "@deepseek-ai/dsh-client-ui-slots"
85
- ],
86
- "immediately": true
87
- },
88
- "engines": {
89
- "dsh": ">=0.1.5-rc.2"
90
- },
91
- "manifestVersion": 1
92
- },
93
- "dependencies": {
94
- "@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.1",
95
- "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.1",
96
- "@deepseek-ai/schemastery": "3.18.4",
97
- "@tencent-connect/qqbot-connector": "1.2.0",
98
- "@tencent-connect/qqbot-nodejs": "^1.0.4",
99
- "js-yaml": "^4.1.0",
100
- "lamejs-fixed": "^1.2.2",
101
- "silk-wasm": "^3.7.1"
102
- },
103
- "optionalDependencies": {
104
- "@huggingface/transformers": "^4.3.0"
105
- },
106
- "peerDependencies": {
107
- "@deepseek-ai/cordis": ">=4.0.1",
108
- "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6",
109
- "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
110
- "@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
111
- "@deepseek-ai/dsh-settings": "*",
112
- "@deepseek-ai/dsh-tools": ">=0.1.1-rc.2",
113
- "@tencent-connect/qqbot-connector": "1.2.0"
114
- },
115
- "peerDependenciesMeta": {
116
- "@deepseek-ai/cordis": {
117
- "optional": true
118
- },
119
- "@deepseek-ai/schemastery": {
120
- "optional": true
121
- },
122
- "@deepseek-ai/dsh-agent": {
123
- "optional": true
124
- },
125
- "@deepseek-ai/dsh-session": {
126
- "optional": true
127
- },
128
- "@deepseek-ai/dsh-llm": {
129
- "optional": true
130
- }
131
- },
132
- "devDependencies": {
133
- "@deepseek-ai/cordis": "4.0.1",
134
- "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
135
- "@deepseek-ai/dsh-llm": "0.1.0-rc.6",
136
- "@deepseek-ai/dsh-session": "0.1.0-rc.6",
137
- "@deepseek-ai/dsh-tools": ">=0.1.1-rc.2",
138
- "@deepseek-ai/schemastery": "3.18.1",
139
- "@types/js-yaml": "^4.0.9",
140
- "@types/node": "^26.2.0",
141
- "typescript": "^5.5.0",
142
- "vitest": "^4.1.8"
143
- }
144
- }
1
+ {
2
+ "name": "@zaofan/dsh-qqbot",
3
+ "version": "1.11.0",
4
+ "description": "QQ Bot IM channel plugin for deepseek-harness (dsh)",
5
+ "type": "module",
6
+ "main": "./entry.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./entry.js"
12
+ },
13
+ "./channel-tools": {
14
+ "types": "./dist/channel-tools.d.ts",
15
+ "import": "./dist/channel-tools.js"
16
+ },
17
+ "./sticker-store": {
18
+ "types": "./dist/features/sticker-store.d.ts",
19
+ "import": "./dist/features/sticker-store.js"
20
+ },
21
+ "./schedule-store": {
22
+ "types": "./dist/features/schedule-store.d.ts",
23
+ "import": "./dist/features/schedule-store.js"
24
+ },
25
+ "./client": "./client/qqbot-settings.js",
26
+ "./session-registry": "./dist/features/session-registry.js"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc",
30
+ "dev": "tsc --watch",
31
+ "prepublishOnly": "npm run build && node scripts/check-package.mjs",
32
+ "check:package": "node scripts/check-package.mjs",
33
+ "lint": "eslint src/",
34
+ "test": "vitest run",
35
+ "clean": "rm -rf dist",
36
+ "ci:prepare-test-pkg": "node scripts/prepare-test-pkg.js"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/zaofan-make/dsh-qqbot.git"
41
+ },
42
+ "homepage": "https://github.com/zaofan-make/dsh-qqbot#readme",
43
+ "bugs": {
44
+ "url": "https://github.com/zaofan-make/dsh-qqbot/issues"
45
+ },
46
+ "keywords": [
47
+ "deepseek-harness",
48
+ "dsh",
49
+ "dsh-plugin",
50
+ "qqbot",
51
+ "qq-bot",
52
+ "chatbot",
53
+ "ai-agent",
54
+ "cordis",
55
+ "plugin",
56
+ "llm"
57
+ ],
58
+ "license": "MIT",
59
+ "files": [
60
+ "dist",
61
+ "docs/extension-contract.md",
62
+ "docs/USER-GUIDE.md",
63
+ "docs/botplay-contract.md",
64
+ "docs/host-services.md",
65
+ "examples",
66
+ "client",
67
+ "cordis.patch.yml",
68
+ "settings-host.js",
69
+ "README.md",
70
+ "README_EN.md",
71
+ "LICENSE",
72
+ "voice-convert.mjs",
73
+ "scripts/download-model.mjs",
74
+ "scripts/fix-dsh-016-presets.ps1",
75
+ "entry.js"
76
+ ],
77
+ "dsh": {
78
+ "bundle": {
79
+ "patch": "./cordis.patch.yml"
80
+ },
81
+ "client": {
82
+ "platform": "web",
83
+ "inject": [
84
+ "@deepseek-ai/dsh-client-ui-settings",
85
+ "@deepseek-ai/dsh-client-ui-slots"
86
+ ],
87
+ "immediately": true
88
+ },
89
+ "engines": {
90
+ "dsh": ">=0.1.5-rc.2"
91
+ },
92
+ "manifestVersion": 1
93
+ },
94
+ "dependencies": {
95
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.1",
96
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.1",
97
+ "@deepseek-ai/schemastery": "3.18.4",
98
+ "@tencent-connect/qqbot-connector": "1.2.0",
99
+ "@tencent-connect/qqbot-nodejs": "^1.0.4",
100
+ "js-yaml": "^4.1.0",
101
+ "lamejs-fixed": "^1.2.2",
102
+ "silk-wasm": "^3.7.1"
103
+ },
104
+ "optionalDependencies": {
105
+ "@huggingface/transformers": "^4.3.0"
106
+ },
107
+ "peerDependencies": {
108
+ "@deepseek-ai/cordis": ">=4.0.1",
109
+ "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6",
110
+ "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
111
+ "@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
112
+ "@deepseek-ai/dsh-settings": "*",
113
+ "@deepseek-ai/dsh-tools": ">=0.1.1-rc.2",
114
+ "@tencent-connect/qqbot-connector": "1.2.0"
115
+ },
116
+ "peerDependenciesMeta": {
117
+ "@deepseek-ai/cordis": {
118
+ "optional": true
119
+ },
120
+ "@deepseek-ai/schemastery": {
121
+ "optional": true
122
+ },
123
+ "@deepseek-ai/dsh-agent": {
124
+ "optional": true
125
+ },
126
+ "@deepseek-ai/dsh-session": {
127
+ "optional": true
128
+ },
129
+ "@deepseek-ai/dsh-llm": {
130
+ "optional": true
131
+ }
132
+ },
133
+ "devDependencies": {
134
+ "@deepseek-ai/cordis": "4.0.1",
135
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
136
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.6",
137
+ "@deepseek-ai/dsh-session": "0.1.0-rc.6",
138
+ "@deepseek-ai/dsh-tools": ">=0.1.1-rc.2",
139
+ "@deepseek-ai/schemastery": "3.18.1",
140
+ "@types/js-yaml": "^4.0.9",
141
+ "@types/node": "^26.2.0",
142
+ "typescript": "^5.5.0",
143
+ "vitest": "^4.1.8"
144
+ }
145
+ }