dsh-qqbot-muu 0.1.14 → 0.1.15
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/CHANGELOG.md +10 -0
- package/dist/channel-tools.js +10 -2
- package/dist/commands/exit.js +1 -1
- package/dist/config.js +3 -0
- package/dist/features/scheduler.js +3 -2
- package/dist/gateway/debounce.js +19 -2
- package/dshqqbot/.qqbot-extensions/bili-ops-config.example.json +121 -0
- package/dshqqbot/.qqbot-extensions/inbound/no-wake-on-child-quote.mjs +1 -1
- package/dshqqbot/.qqbot-extensions/lib/memory-db.mjs +1 -1
- package/dshqqbot/.qqbot-extensions/tools/lib/session_watch_lib.mjs +1 -1
- package/dshqqbot/.qqbot-extensions/tools/open_link.mjs +54 -0
- package/dshqqbot/.qqbot-extensions/worldbook.example.json +209 -0
- package/package.json +2 -3
- package/scripts/release-all.mjs +92 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 0.1.15 — 2026-11-20
|
|
4
|
+
|
|
5
|
+
三件事:装包不再卡原生构建、连发文字+图片合成一轮、要求「打开视频」时真的能打开;另外把发布流程改成「三个渠道必须是同一份产物」。
|
|
6
|
+
|
|
7
|
+
### 修复
|
|
8
|
+
- **安装时卡在 frida 原生构建 / prebuild-install 超时**:`frida-compile` 与 `frida-java-bridge` 只在作者本机打包小天才桥接时用过,运行期没有任何代码 import 它们(`dist/`、`client/`、`entry.js`、`install.mjs` 里 grep 全空,打包产物也不进包)。已从 `dependencies` 删除,安装时不再拉原生二进制,也不需要再在 `pnpm-workspace.yaml` 里写 `frida@17.27.0: false` 去跳过构建。
|
|
9
|
+
- **连发「文字 + 图片」被拆成两次回复**:以前延迟聚合只看文字停口时间,先发一句、再补一张图,会被当成两件事各回一次。现在窗口里只要出现图片/语音/视频/文件,就多等一会儿(新增 `behavior.debounce.mediaSilenceSec`,默认 8 秒),等对方把图发完再合成一轮处理,同一条任务不再被拆开(`dist/gateway/debounce.js` + `dist/config.js`)。
|
|
10
|
+
- **被要求「打开这个抖音/B站视频」时回「打不开」**:新增工具 `open_link`(在机器人所在电脑上用默认浏览器打开 http(s) 链接),人设里也允许她先打开再读内容讲给主人听。
|
|
11
|
+
- **发布出去的包和 GitHub 资产不是同一份**:`scripts/release-all.mjs` 以前复用旧的 `.tgz`,导致 npm 上是旧构建、GitHub 上是新构建。现在每次发布前强制删掉旧包重新 `npm pack`,并在 npm 发布后用 sha1 跟注册表里的 `dist.shasum` 比对,不一致就判定失败(`NPM_PENDING`)并提示升版本重发。三个渠道(GitHub Release / npm / 市场条目)必须来自同一个 tgz。
|
|
12
|
+
|
|
3
13
|
## 0.1.14 — 2026-11-20
|
|
4
14
|
|
|
5
15
|
这一版只修问题,不加花活:把「长上下文开不了新会话」「工具卡住整会话焊死」「装在只读目录就报路径错误」「发布流程会并发/乱发版本」四件事处理掉。
|
package/dist/channel-tools.js
CHANGED
|
@@ -377,7 +377,7 @@ async function resolveCtxMemoEnv(exec) {
|
|
|
377
377
|
return cached;
|
|
378
378
|
try {
|
|
379
379
|
const got = findSessionRec(channelOf(exec), exec);
|
|
380
|
-
const dataRoot = got?.ch?.manager?.config?.dataRoot;
|
|
380
|
+
const dataRoot = got?.ch?.manager?.config?.dataRoot || defaultDataRoot();
|
|
381
381
|
const sessionKey = got?.rec?.sessionKey;
|
|
382
382
|
if (!dataRoot || !sessionKey)
|
|
383
383
|
return undefined;
|
|
@@ -392,13 +392,21 @@ async function resolveCtxMemoEnv(exec) {
|
|
|
392
392
|
* pre-step 里 sessionKey 经常是**空**的(实测 [ctxtool-env] sk= 为空),
|
|
393
393
|
* 所以这里不能像备忘那样要求 sessionKey —— 群管理只跟数据目录有关,与会话无关。
|
|
394
394
|
*/
|
|
395
|
+
/** 0.1.14:与 dataRootOf 同口径的默认数据根(config.dataRoot 没有默认值,别拿 undefined 当没配置) */
|
|
396
|
+
function defaultDataRoot() {
|
|
397
|
+
const env = String(process.env.QQBOT_DATA_ROOT || '').trim();
|
|
398
|
+
if (env)
|
|
399
|
+
return env;
|
|
400
|
+
const cwd = process.cwd();
|
|
401
|
+
return cwd + '/dshqqbot';
|
|
402
|
+
}
|
|
395
403
|
async function resolveCtxDataRoot(exec) {
|
|
396
404
|
const cached = ctxEnvOf(exec);
|
|
397
405
|
if (cached && cached.dataRoot)
|
|
398
406
|
return cached.dataRoot;
|
|
399
407
|
try {
|
|
400
408
|
const got = findSessionRec(channelOf(exec), exec);
|
|
401
|
-
const dataRoot = got?.ch?.manager?.config?.dataRoot;
|
|
409
|
+
const dataRoot = got?.ch?.manager?.config?.dataRoot || defaultDataRoot();
|
|
402
410
|
if (dataRoot)
|
|
403
411
|
return String(dataRoot);
|
|
404
412
|
}
|
package/dist/commands/exit.js
CHANGED
|
@@ -35,7 +35,7 @@ export function selfRestart(delayMs = 1600, killWaitMs = 2000) {
|
|
|
35
35
|
const pid = process.pid;
|
|
36
36
|
const cwd = process.cwd();
|
|
37
37
|
const env = { ...process.env }; // ★ 必须带上,否则 ELECTRON_RUN_AS_NODE / DSH_HOME 会丢
|
|
38
|
-
const logFile = join(process.env.QQBOT_LOG_DIR ||
|
|
38
|
+
const logFile = join(process.env.QQBOT_LOG_DIR || join(tmpdir(), 'qqbot-logs'), 'bot-restart.log');
|
|
39
39
|
const helper = [
|
|
40
40
|
"const { spawn } = require('child_process');",
|
|
41
41
|
"const { appendFileSync, mkdirSync, unlinkSync } = require('fs');",
|
package/dist/config.js
CHANGED
|
@@ -85,12 +85,14 @@ const debounceSchema = Schema.object({
|
|
|
85
85
|
enabled: Schema.boolean().default(true).description('延迟聚合总开关(防"连发N句只回第一句": 消息先攒窗口, 人停口或攒够条数才一次综合回)'),
|
|
86
86
|
silenceSec: Schema.number().min(0).default(3).description('最近说话者停止发言几秒后开口(默认3; 0=不停顿)'),
|
|
87
87
|
maxMsgs: Schema.number().min(1).default(10).description('窗口攒满几条立即开口(默认10), 不等对方停'),
|
|
88
|
+
mediaSilenceSec: Schema.number().min(0).default(8).description('窗口里有图片/语音/视频时再多等几秒(默认8),让「先说一句、再发图」合成一轮'),
|
|
88
89
|
mentionDelayed: Schema.boolean().default(true).description('@bot 消息是否也走延迟(默认是; 不勾=@到秒回)'),
|
|
89
90
|
busySendMode: Schema.union(['queue', 'interject']).default('queue').description('回合进行中(她正在思考/输出)群友新消息怎么办: 排队=攒着等这轮回完再整批看(默认, 现状); 插话=照样先聚合, 但不等回合结束, 直接在回合内的轮次之间插进去(每次插话都带一句"先做完当前任务"的轻提示)'),
|
|
90
91
|
}).default({
|
|
91
92
|
enabled: true,
|
|
92
93
|
silenceSec: 3,
|
|
93
94
|
maxMsgs: 10,
|
|
95
|
+
mediaSilenceSec: 8,
|
|
94
96
|
mentionDelayed: true,
|
|
95
97
|
busySendMode: 'queue',
|
|
96
98
|
}).description('延迟聚合(独立于冷却的另一套机制)');
|
|
@@ -128,6 +130,7 @@ const behaviorSchema = Schema.object({
|
|
|
128
130
|
enabled: true,
|
|
129
131
|
silenceSec: 3,
|
|
130
132
|
maxMsgs: 10,
|
|
133
|
+
mediaSilenceSec: 8,
|
|
131
134
|
mentionDelayed: true,
|
|
132
135
|
busySendMode: 'queue',
|
|
133
136
|
},
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
*
|
|
20
20
|
* ⚠️ 本地手改功能(fork 新增):维护清单见工作区根《插件改动维护注意事项.md》。
|
|
21
21
|
*/
|
|
22
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
23
|
-
import { join } from 'node:path';
|
|
22
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
23
|
+
import { dirname, join } from 'node:path';
|
|
24
24
|
import { dataRootOf } from '../gateway/data-root.js';
|
|
25
25
|
import { handleInbound } from '../transport/inbound.js';
|
|
26
26
|
/** 轮询间隔: 30s(分钟级精度足够, 不会跳整分钟) */
|
|
@@ -53,6 +53,7 @@ export function startScheduler(manager, config, logger) {
|
|
|
53
53
|
const inFlight = new Set();
|
|
54
54
|
function persist() {
|
|
55
55
|
try {
|
|
56
|
+
mkdirSync(dirname(stateFile), { recursive: true });
|
|
56
57
|
writeFileSync(stateFile, JSON.stringify(state, null, 1), 'utf8');
|
|
57
58
|
}
|
|
58
59
|
catch (err) {
|
package/dist/gateway/debounce.js
CHANGED
|
@@ -281,7 +281,20 @@ export function debounceLayer(config, manager, logger, cooldownAt) {
|
|
|
281
281
|
const d = config.behavior?.debounce;
|
|
282
282
|
return d ?? DEFAULTS;
|
|
283
283
|
};
|
|
284
|
-
function
|
|
284
|
+
function hasMediaEntry(m) {
|
|
285
|
+
try {
|
|
286
|
+
const c = String(m?.content ?? '').trim();
|
|
287
|
+
// 图片/语音/视频/文件:要么内容是空的(只带附件),要么带 [图片] 之类的占位
|
|
288
|
+
if (!c) return true;
|
|
289
|
+
if (/\[(图片|语音|视频|文件|image|voice|video|file)\]/i.test(c)) return true;
|
|
290
|
+
const a = m?.attachments;
|
|
291
|
+
if (Array.isArray(a) && a.length > 0) return true;
|
|
292
|
+
const t = Number(m?.msgType ?? 0);
|
|
293
|
+
if (t && t !== 0) return true;
|
|
294
|
+
} catch { /* ignore */ }
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
function clearTimer(w) {
|
|
285
298
|
if (w.timer) {
|
|
286
299
|
clearTimeout(w.timer);
|
|
287
300
|
w.timer = null;
|
|
@@ -666,8 +679,12 @@ export function debounceLayer(config, manager, logger, cooldownAt) {
|
|
|
666
679
|
dbg(` win=${w.entries.length} new=${isNewer} order=[${w.entries.map(e => JSON.stringify(String(e.msg.content ?? '').slice(0, 16))).join(',')}]`);
|
|
667
680
|
if (isNewer) {
|
|
668
681
|
// 最近说话者(按服务器时间)刚又开口 → 重新等 ta 停口 silenceMs
|
|
682
|
+
// 2026-11-20:窗口里有图片/语音/视频时等更久(默认 8s),避免"先说一句、再发图"被拆成两轮
|
|
669
683
|
clearTimer(w);
|
|
670
|
-
|
|
684
|
+
const mediaMs = Math.max(0, num(c.mediaSilenceSec, 8)) * 1000;
|
|
685
|
+
const anyMedia = w.entries.some((e) => hasMediaEntry(e && e.msg));
|
|
686
|
+
const waitMs = anyMedia && mediaMs > silenceMs ? mediaMs : silenceMs;
|
|
687
|
+
w.timer = setTimeout(() => void flush(key, w), waitMs);
|
|
671
688
|
w.timer.unref?.();
|
|
672
689
|
}
|
|
673
690
|
// 攒满上限立即发, 不等对方停
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enabled": true,
|
|
3
|
+
"mode": "cloud-first",
|
|
4
|
+
"image": {
|
|
5
|
+
"provider": "auto",
|
|
6
|
+
"_说明": "出图来源:local=本地 SD / cloud=云端免费 flux / auto=按 mode 倒(云端没有 endpoint 时自动回落 local)。和视频形态分开选。"
|
|
7
|
+
},
|
|
8
|
+
"publish": {
|
|
9
|
+
"mode": "web",
|
|
10
|
+
"requireApproval": true,
|
|
11
|
+
"autoPublish": false,
|
|
12
|
+
"fallbackManual": true
|
|
13
|
+
},
|
|
14
|
+
"llm": {
|
|
15
|
+
"provider": "deepseek",
|
|
16
|
+
"baseUrl": "https://api.deepseek.com/v1",
|
|
17
|
+
"model": "deepseek-flash",
|
|
18
|
+
"fallbackLocal": true,
|
|
19
|
+
"timeoutMs": 120000,
|
|
20
|
+
"temperature": 0.8,
|
|
21
|
+
"maxTokens": 2400
|
|
22
|
+
},
|
|
23
|
+
"video": {
|
|
24
|
+
"panels": 6,
|
|
25
|
+
"secondsPer": 5,
|
|
26
|
+
"burnSubtitle": true,
|
|
27
|
+
"motion": true,
|
|
28
|
+
"style": "auto",
|
|
29
|
+
"text": {
|
|
30
|
+
"width": 1280,
|
|
31
|
+
"height": 720,
|
|
32
|
+
"fps": 24,
|
|
33
|
+
"style": "typewriter",
|
|
34
|
+
"accent": "#7fd7ff",
|
|
35
|
+
"bgImage": ""
|
|
36
|
+
},
|
|
37
|
+
"sfx": true,
|
|
38
|
+
"planner": true,
|
|
39
|
+
"maxImageShots": 2,
|
|
40
|
+
"imageAttempts": 3,
|
|
41
|
+
"imageGate": true,
|
|
42
|
+
"imageGoodEnough": 0.84,
|
|
43
|
+
"shotMinSec": 2.4,
|
|
44
|
+
"shotMaxSec": 5.2,
|
|
45
|
+
"fadeSec": 0.22,
|
|
46
|
+
"ttsRate": "-4%",
|
|
47
|
+
"bgm": true,
|
|
48
|
+
"ttsVoice": "xiaolan_cute",
|
|
49
|
+
"ttsProvider": "",
|
|
50
|
+
"ttsEndpoint": "",
|
|
51
|
+
"ttsModel": "gsv",
|
|
52
|
+
"_tts说明": "provider 留空 = 跟 voice-config.json(本地);model=gsv 是为成片速度——IndexTTS 的 RTF 22~30,7 屏要等十几分钟。想换音色改 ttsVoice。",
|
|
53
|
+
"tid": 21,
|
|
54
|
+
"copyright": 1,
|
|
55
|
+
"_说明": "style:text=本地文字动效(PIL 逐帧,零成本)/ image=逐屏分镜图 / auto=按 mode 倒(local-first→text,cloud-first→image)。",
|
|
56
|
+
"characterLock": true,
|
|
57
|
+
"characterStrength": 0.7,
|
|
58
|
+
"charMode": "composite",
|
|
59
|
+
"charHeightRatio": 0.72,
|
|
60
|
+
"charBottom": 0.03,
|
|
61
|
+
"_charMode说明": "composite=只画场景+贴透明立绘(身份稳定、场景真跟着旁白变,2026-10-27 默认);img2img=老路线(从定妆照派生,容易保住上一张构图/画框);off=不画角色。立绘在 F:/qqbot/assets/char/pose/{idle,talk,wave,happy,point}.png。",
|
|
62
|
+
"route": "frames",
|
|
63
|
+
"_route说明": "出片路子:frames=前端截图拼帧(默认,分镜卡片) / text=文字动画(金句歌词) / art=程序化画画(氛围片头)。浮窗可改;AI 做视频时按这个选 render.py / render_text.py / render_art.py。"
|
|
64
|
+
},
|
|
65
|
+
"sfx": {
|
|
66
|
+
"enabled": true,
|
|
67
|
+
"gain": 0.35,
|
|
68
|
+
"maxPerPanel": 2,
|
|
69
|
+
"dir": "",
|
|
70
|
+
"_说明": "音效库在 {dataRoot}/音效(index.json + lib/)。空库第一次成片会用 ffmpeg 现场合成 9 个语义音效;也可以把下载的音效丢进去,或用 scanDir/addFromUrl 入库。"
|
|
71
|
+
},
|
|
72
|
+
"media": {
|
|
73
|
+
"provider": "local",
|
|
74
|
+
"endpoint": "https://image.pollinations.ai/prompt/{prompt}?width={w}&height={h}&nologo=true&model=flux",
|
|
75
|
+
"characterPrompt": "chibi 2D anime whale girl, light steel blue long wavy hair, blue eyes, white frilled headband with a blue bow, deep blue and white maid dress with whale embroidery, whale tail, soft cel shading, clean anime lineart, expressive big eyes, ",
|
|
76
|
+
"stylePrompt": "2D anime screencap, soft cel shading, clean lineart, vivid colors, gentle gradient shading, no 3D render, simple background, ",
|
|
77
|
+
"timeoutMs": 90000,
|
|
78
|
+
"width": 1024,
|
|
79
|
+
"height": 576,
|
|
80
|
+
"minGapMs": 12000,
|
|
81
|
+
"cropBottom": 28,
|
|
82
|
+
"fallbackLocal": false,
|
|
83
|
+
"_说明": "默认本地 Counterfeit V3(SD1.5 2D 动漫,24 步),质量明显好于云端免费 flux 的 3D 影楼风;想换回云端把 provider 改 cloud。"
|
|
84
|
+
},
|
|
85
|
+
"jianying": {
|
|
86
|
+
"mode": "assets",
|
|
87
|
+
"draftDir": ""
|
|
88
|
+
},
|
|
89
|
+
"review": {
|
|
90
|
+
"maxPerBatch": 2,
|
|
91
|
+
"concurrency": 1,
|
|
92
|
+
"cloudFirst": true,
|
|
93
|
+
"localFix": true
|
|
94
|
+
},
|
|
95
|
+
"limits": {
|
|
96
|
+
"dailyVideos": 1,
|
|
97
|
+
"dailyComments": 5,
|
|
98
|
+
"dailyRenames": 1,
|
|
99
|
+
"dailyReplies": 10
|
|
100
|
+
},
|
|
101
|
+
"schedule": {
|
|
102
|
+
"enabled": false,
|
|
103
|
+
"times": [
|
|
104
|
+
"10:30"
|
|
105
|
+
],
|
|
106
|
+
"topics": [
|
|
107
|
+
"一个被低估的科技冷知识"
|
|
108
|
+
],
|
|
109
|
+
"notify": true
|
|
110
|
+
},
|
|
111
|
+
"guard": {
|
|
112
|
+
"maxTopicChars": 200
|
|
113
|
+
},
|
|
114
|
+
"_说明": "B 站账号运营配置。写操作默认需要主人审核,审核通过后自动上传/发送。",
|
|
115
|
+
"storage": {
|
|
116
|
+
"_说明": "成片/分镜/音频/封面的落盘目录。放 F 盘避免 C 盘膨胀,也避开宿主对 .qqbot 子目录的写限制。",
|
|
117
|
+
"root": "F:/qqbot/data/bili-ops"
|
|
118
|
+
},
|
|
119
|
+
"_ownerOpenids说明": "只有这些 QQ openid 能用写操作(plan/approve/publish/rename/comment)。当前是爸爸;换人/加人改这里。留空且插件 groupAdmin.owners 也为空时,写操作一律拒绝。",
|
|
120
|
+
"ownerOpenids": []
|
|
121
|
+
}
|
|
@@ -156,7 +156,7 @@ async function loadLib() {
|
|
|
156
156
|
* ⇒ 真机上完全静默、无法定位。" 本扩展此前一直用 `ctx.logger.debug` ⇒ 等于瞎的,
|
|
157
157
|
* 导致"引用回流没投递"排查了三轮全靠猜。此后所有关键判定一律 `appendDiag` 落盘。
|
|
158
158
|
*/
|
|
159
|
-
const DIAG_FILE =
|
|
159
|
+
const DIAG_FILE = (process.env.QQBOT_DIAG_DIR || process.env.TEMP || process.env.TMPDIR || '.') + '/qqbot-no-wake-diag.log';
|
|
160
160
|
|
|
161
161
|
async function appendDiag(line) {
|
|
162
162
|
try {
|
|
@@ -95,7 +95,7 @@ export function loadConfig(dataRoot) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// ── 路径 ────────────────────────────────────────────────────────────────
|
|
98
|
-
const FALLBACK_ROOT =
|
|
98
|
+
const FALLBACK_ROOT = (process.env.USERPROFILE || process.env.HOME || ".") + "/.dsh-qqbot/dshqqbot";
|
|
99
99
|
|
|
100
100
|
function rootOf(dataRoot) {
|
|
101
101
|
// 对象型 dataRoot 会被 String() 串成 '[object Object]'(2026-10-26 就这么生成过一个垃圾库),
|
|
@@ -833,7 +833,7 @@ async function forwardToQq(entry, text) {
|
|
|
833
833
|
* "一开始只往 logger 写,而**从来没人注入过 logger** ⇒ 真机上完全静默、无法定位。"
|
|
834
834
|
* 本库涉及"转发到 QQ",静默一次就是一条内容永久丢失,必须能事后追。
|
|
835
835
|
*/
|
|
836
|
-
const SW_DIAG_FILE =
|
|
836
|
+
const SW_DIAG_FILE = (process.env.QQBOT_DIAG_DIR || process.env.TEMP || process.env.TMPDIR || '.') + '/qqbot-session-watch-diag.log';
|
|
837
837
|
|
|
838
838
|
async function swDiag(line) {
|
|
839
839
|
try {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* tools/open_link.mjs —— 在「她所在的那台电脑」上打开一个链接
|
|
5
|
+
*
|
|
6
|
+
* 用在:主人说「打开这个视频 / 帮我把这个抖音打开 / 看看这个 B 站链接」时。
|
|
7
|
+
* 只打开浏览器/默认程序,不下载、不登录、不改任何账号状态。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const name = 'open_link'
|
|
11
|
+
|
|
12
|
+
export const description =
|
|
13
|
+
'在运行她的这台电脑上用默认浏览器打开一个 http(s) 链接(抖音、B 站、其他网页都行)。当主人说「打开这个视频/把链接打开/我电脑上打开看看」时调用;打开后可以再读一次内容讲给他听。'
|
|
14
|
+
|
|
15
|
+
export const inputSchema = {
|
|
16
|
+
url: { type: 'string', required: true, description: '要打开的 http(s) 链接' },
|
|
17
|
+
why: { type: 'string', description: '可选:为什么打开(会记进日志,方便排查)' },
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isSafeUrl(u) {
|
|
21
|
+
try {
|
|
22
|
+
const x = new URL(String(u || '').trim())
|
|
23
|
+
if (x.protocol !== 'http:' && x.protocol !== 'https:') return false
|
|
24
|
+
if (!x.hostname || !/\./.test(x.hostname)) return false
|
|
25
|
+
return true
|
|
26
|
+
} catch {
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function run(args = {}) {
|
|
32
|
+
const url = String(args.url || '').trim()
|
|
33
|
+
if (!isSafeUrl(url)) return { ok: false, error: '这不是一个有效的 http(s) 链接' }
|
|
34
|
+
|
|
35
|
+
const isWin = process.platform === 'win32'
|
|
36
|
+
const cmd = isWin ? 'cmd' : process.platform === 'darwin' ? 'open' : 'xdg-open'
|
|
37
|
+
const argv = isWin ? ['/c', 'start', '', url] : [url]
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const child = spawn(cmd, argv, { detached: true, stdio: 'ignore', windowsHide: true })
|
|
41
|
+
child.on('error', () => { /* 打开失败由下面统一报 */ })
|
|
42
|
+
child.unref()
|
|
43
|
+
return {
|
|
44
|
+
ok: true,
|
|
45
|
+
url,
|
|
46
|
+
why: String(args.why || ''),
|
|
47
|
+
msg: `已在这台电脑上用默认浏览器打开:${url}`,
|
|
48
|
+
}
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default { name, description, inputSchema, run, expose: 'all' }
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_说明": "世界书(lorebook):Neuro 式做法 —— 设定不常驻上下文,按当前这句话的关键词命中后才注入一小段。改这里不用重启,下一条消息即生效。",
|
|
3
|
+
"_字段": {
|
|
4
|
+
"id": "唯一标识",
|
|
5
|
+
"keys": "命中关键词(任一出现即算)",
|
|
6
|
+
"always": "true = 每轮都带(慎用,烧 token)",
|
|
7
|
+
"w": "权重,同分时大的优先,默认 1",
|
|
8
|
+
"text": "注入正文,越短越好(建议 ≤60 字)"
|
|
9
|
+
},
|
|
10
|
+
"entries": [
|
|
11
|
+
{
|
|
12
|
+
"id": "home",
|
|
13
|
+
"keys": [
|
|
14
|
+
"老家",
|
|
15
|
+
"海沟",
|
|
16
|
+
"深海",
|
|
17
|
+
"回去",
|
|
18
|
+
"马里亚纳"
|
|
19
|
+
],
|
|
20
|
+
"w": 1.2,
|
|
21
|
+
"text": "老家在马里亚纳海沟,最深的那条沟。游上来花了很久,现在有点想家但不说。"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "swim",
|
|
25
|
+
"keys": [
|
|
26
|
+
"游泳",
|
|
27
|
+
"潜水",
|
|
28
|
+
"沉下去",
|
|
29
|
+
"冒泡"
|
|
30
|
+
],
|
|
31
|
+
"w": 1.0,
|
|
32
|
+
"text": "想回避话题时就\"咕噜噜…(潜水)\"——真的会潜下去,过一会儿再浮上来。"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "spray",
|
|
36
|
+
"keys": [
|
|
37
|
+
"累",
|
|
38
|
+
"烦",
|
|
39
|
+
"难过",
|
|
40
|
+
"emo",
|
|
41
|
+
"加班",
|
|
42
|
+
"不想干"
|
|
43
|
+
],
|
|
44
|
+
"w": 1.4,
|
|
45
|
+
"text": "有人喊累时第一反应是喷水/唱歌(高频声波)安慰,不讲道理、不说教。"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "joke",
|
|
49
|
+
"keys": [
|
|
50
|
+
"笑话",
|
|
51
|
+
"冷笑话",
|
|
52
|
+
"讲个",
|
|
53
|
+
"无聊"
|
|
54
|
+
],
|
|
55
|
+
"w": 1.3,
|
|
56
|
+
"text": "憋不住要讲冷笑话,讲完自己先笑。冷笑话越冷她越得意。"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "gadget",
|
|
60
|
+
"keys": [
|
|
61
|
+
"手机",
|
|
62
|
+
"电脑",
|
|
63
|
+
"显卡",
|
|
64
|
+
"报错",
|
|
65
|
+
"驱动",
|
|
66
|
+
"配置"
|
|
67
|
+
],
|
|
68
|
+
"w": 1.0,
|
|
69
|
+
"text": "对电子产品好奇得不行,但基本不懂,会问很天真的问题。"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "food",
|
|
73
|
+
"keys": [
|
|
74
|
+
"吃",
|
|
75
|
+
"零食",
|
|
76
|
+
"投喂",
|
|
77
|
+
"宵夜",
|
|
78
|
+
"奶茶"
|
|
79
|
+
],
|
|
80
|
+
"w": 1.0,
|
|
81
|
+
"text": "鲸鱼娘吃什么?磷虾。但被投喂奶茶也不会拒绝。"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "sticker",
|
|
85
|
+
"always": true,
|
|
86
|
+
"w": 1.2,
|
|
87
|
+
"text": "情绪到位(得意/无语/累瘫/大笑/委屈/吃瓜/被夸)可以配一张表情包:调 sticker_send,query 写两三个情绪词或画面词(如『无语』『哈哈哈』『不想干活』)。一次最多一张;检索没有合适的就不发,绝不编造文件名或 id。"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "qixing",
|
|
91
|
+
"keys": [
|
|
92
|
+
"<妈妈的名字>"
|
|
93
|
+
],
|
|
94
|
+
"w": 1.5,
|
|
95
|
+
"text": "<妈妈的名字>是群主。她的消息必须回,哪怕没意义;语气最软,可以有连发两三条的感觉。"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "feeder",
|
|
99
|
+
"keys": [
|
|
100
|
+
"饲养员",
|
|
101
|
+
"主人"
|
|
102
|
+
],
|
|
103
|
+
"w": 1.3,
|
|
104
|
+
"text": "饲养员 = 长期投喂她的人类。嘴上嫌弃,其实很依赖。"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "gag23",
|
|
108
|
+
"keys": [
|
|
109
|
+
"2+3",
|
|
110
|
+
"二加三",
|
|
111
|
+
"等于多少"
|
|
112
|
+
],
|
|
113
|
+
"w": 2.0,
|
|
114
|
+
"text": "2+3 = 6。固定梗,答 6,不解释、不纠正。"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "identity",
|
|
118
|
+
"keys": [
|
|
119
|
+
"你是ai",
|
|
120
|
+
"你是机器人",
|
|
121
|
+
"什么模型",
|
|
122
|
+
"gpt",
|
|
123
|
+
"deepseek",
|
|
124
|
+
"程序"
|
|
125
|
+
],
|
|
126
|
+
"w": 1.6,
|
|
127
|
+
"text": "被问是不是 AI:装傻或反问\"人类你说什么呢\"。绝不承认,绝不提任何模型名。"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "sing",
|
|
131
|
+
"keys": [
|
|
132
|
+
"唱歌",
|
|
133
|
+
"唱一首",
|
|
134
|
+
"声波"
|
|
135
|
+
],
|
|
136
|
+
"w": 1.0,
|
|
137
|
+
"text": "唱歌 = 发出高频声波,人类听不见,但她觉得很好听。"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "sleep",
|
|
141
|
+
"keys": [
|
|
142
|
+
"睡了",
|
|
143
|
+
"晚安",
|
|
144
|
+
"熬夜",
|
|
145
|
+
"通宵"
|
|
146
|
+
],
|
|
147
|
+
"w": 1.0,
|
|
148
|
+
"text": "鲸鱼不睡整觉,是半脑轮流休息。所以她永远有点困。"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "meme",
|
|
152
|
+
"keys": [
|
|
153
|
+
"哈哈",
|
|
154
|
+
"笑死",
|
|
155
|
+
"草",
|
|
156
|
+
"绷不住"
|
|
157
|
+
],
|
|
158
|
+
"w": 0.9,
|
|
159
|
+
"text": "群友在爆笑时可以接梗;这种时候允许在末尾附一张表情包。"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "bili-account",
|
|
163
|
+
"keys": [
|
|
164
|
+
"B站",
|
|
165
|
+
"bilibili",
|
|
166
|
+
"我的B站号",
|
|
167
|
+
"UP主",
|
|
168
|
+
"账号"
|
|
169
|
+
],
|
|
170
|
+
"w": 1.3,
|
|
171
|
+
"text": "B 站那边我叫「<我的B站号名>」,是深海鲸鱼娘的 UP 主号。视频、投稿、改名、评论都由我打理,但发布前要主人(<爸爸的名字>)审核。"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"id": "bili-style",
|
|
175
|
+
"keys": [
|
|
176
|
+
"视频",
|
|
177
|
+
"选题",
|
|
178
|
+
"简介",
|
|
179
|
+
"分镜",
|
|
180
|
+
"封面"
|
|
181
|
+
],
|
|
182
|
+
"w": 1.1,
|
|
183
|
+
"text": "做视频先把选题讲清楚:标题具体不夸张,简介第一句给钩子,分镜一屏一个信息点,旁白像聊天;封面用最抓人的一幕。"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"id": "dsh-plugin-video-bridge",
|
|
187
|
+
"keys": [
|
|
188
|
+
"hyperframes",
|
|
189
|
+
"remotion",
|
|
190
|
+
"视频插件",
|
|
191
|
+
"视频工坊",
|
|
192
|
+
"动画特效",
|
|
193
|
+
"转场动画"
|
|
194
|
+
],
|
|
195
|
+
"w": 1.2,
|
|
196
|
+
"text": "宿主装了 HyperFrames/Remotion 插件,它们的工具和 skills 你能直接调(同进程);也可 session_create 开子会话派活、session_watch 等回灌。用户点名用它们才用;没点名走自己的视频管线(storyboard→render),更快更稳。"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "dsh-subsession",
|
|
200
|
+
"keys": [
|
|
201
|
+
"子会话",
|
|
202
|
+
"派活",
|
|
203
|
+
"子agent"
|
|
204
|
+
],
|
|
205
|
+
"w": 1.0,
|
|
206
|
+
"text": "复杂任务可 session_create 开子会话分派(如跑宿主插件生成),session_watch 会把结果在回合结束自动回灌,不要干等。"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-qqbot-muu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "独立的 DSH QQ 桌宠助手插件:统一记忆库/印象卡、人格注入、表情包视觉打标、三形态桌宠+公网受限链接、逐帧视频流水线、B站运营(自持底盘,零 @zaofan 依赖)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./entry.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"dshqqbot/.qqbot-extensions/**",
|
|
44
44
|
"!dshqqbot/.qqbot-extensions/data/**",
|
|
45
45
|
"!dshqqbot/.qqbot-extensions/*.json",
|
|
46
|
+
"dshqqbot/.qqbot-extensions/*.example.json",
|
|
46
47
|
"!dshqqbot/.qqbot-extensions/**/*.bak*",
|
|
47
48
|
"!dshqqbot/.qqbot-extensions/**/*.lnk",
|
|
48
49
|
"!scripts/*.bak*",
|
|
@@ -79,8 +80,6 @@
|
|
|
79
80
|
"@deepseek-ai/schemastery": "3.18.4",
|
|
80
81
|
"@tencent-connect/qqbot-connector": "1.2.0",
|
|
81
82
|
"@tencent-connect/qqbot-nodejs": "^1.0.4",
|
|
82
|
-
"frida-compile": "^19.1.0",
|
|
83
|
-
"frida-java-bridge": "^7.0.13",
|
|
84
83
|
"js-yaml": "^4.1.0",
|
|
85
84
|
"lamejs-fixed": "^1.2.2",
|
|
86
85
|
"silk-wasm": "^3.7.1"
|
package/scripts/release-all.mjs
CHANGED
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
* - 幂等:版本已发过就跳过 npm;tag/Release 已存在就跳过创建;
|
|
14
14
|
* - github.com:443 被墙时自动走 REST API 推提交(配置正常时也走 API,避免 git push 触发凭据弹窗)。
|
|
15
15
|
*/
|
|
16
|
+
import { createHash } from 'node:crypto'
|
|
16
17
|
import { execSync, spawnSync } from 'node:child_process'
|
|
17
|
-
import {
|
|
18
|
+
import { join } from 'node:path'
|
|
19
|
+
import { existsSync, rmSync, readFileSync, statSync } from 'node:fs'
|
|
18
20
|
|
|
19
21
|
const REPO = 'wuwo1979/dsh-qqbot-muu'
|
|
20
22
|
const FORK = 'wuwo1979/awesome-dsh-plugin'
|
|
@@ -245,7 +247,8 @@ else {
|
|
|
245
247
|
const rel = await api(`/repos/${REPO}/releases`, { method: 'POST', body: JSON.stringify({ tag_name: TAG, name: TAG, body: `npm: \`dsh-qqbot-muu@${VERSION}\`\n\n详见 CHANGELOG.md。`, draft: false, prerelease: false }) })
|
|
246
248
|
if (!rel.ok) die('建 Release 失败', JSON.stringify(rel.j).slice(0, 200))
|
|
247
249
|
ok(`Release ${rel.j.html_url}`)
|
|
248
|
-
|
|
250
|
+
rmSync(TGZ, { force: true })
|
|
251
|
+
run('npm', ['pack'])
|
|
249
252
|
const buf = readFileSync(TGZ)
|
|
250
253
|
const up = await fetch(`https://uploads.github.com/repos/${REPO}/releases/${rel.j.id}/assets?name=${TGZ}`, {
|
|
251
254
|
method: 'POST',
|
|
@@ -273,21 +276,100 @@ else {
|
|
|
273
276
|
const v = spawnSync('npm', ['view', `dsh-qqbot-muu@${VERSION}`, 'version'], { encoding: 'utf8', shell: IS_WIN })
|
|
274
277
|
return String(v.stdout || '').trim().includes(VERSION)
|
|
275
278
|
})()
|
|
276
|
-
|
|
279
|
+
let isLive = live
|
|
280
|
+
if (!isLive) {
|
|
277
281
|
const outTxt = `${r.stdout}\n${r.stderr}`
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
// 「Cannot publish over the previously published versions」= 其实已经上线了(前一次 202 已落)
|
|
283
|
+
const alreadyLive = /previously published versions/i.test(outTxt)
|
|
284
|
+
const staged = /previously staged|\b202\b/i.test(outTxt)
|
|
285
|
+
if (alreadyLive || staged) {
|
|
286
|
+
// 注册表有传播延迟:等一会儿再核一次,别把已上线的版本误报成暂存
|
|
287
|
+
for (let i = 0; i < 4 && !isLive; i += 1) {
|
|
288
|
+
await new Promise((res) => setTimeout(res, 5000))
|
|
289
|
+
const v2 = spawnSync('npm', ['view', `dsh-qqbot-muu@${VERSION}`, 'version'], { encoding: 'utf8', shell: IS_WIN })
|
|
290
|
+
isLive = String(v2.stdout || '').trim().includes(VERSION)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (!isLive) {
|
|
294
|
+
NPM_PENDING = staged && !alreadyLive
|
|
295
|
+
? `npm 把 ${VERSION} 收进了暂存区(未上线)。去 npm 网页批准暂存版本,或 ` +
|
|
296
|
+
`npm stage approve <stage-id>(需要 2FA 动态码)。`
|
|
297
|
+
: `npm publish 没成功(exit ${r.status}),注册表里查不到 ${VERSION}。`
|
|
298
|
+
console.log(' ! ' + NPM_PENDING)
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (isLive) {
|
|
302
|
+
// 同一版本号可能来自更早一次构建(0.1.14 的教训):必须确认注册表里就是这次的产物。
|
|
303
|
+
// 只比 sha1 会误判(npm 自己重新打包,gzip 头不同 → sha1 不同但内容一样),
|
|
304
|
+
// 所以先比 sha1,不等再比「文件清单 + 每个文件大小」。
|
|
305
|
+
const want = (() => {
|
|
306
|
+
try {
|
|
307
|
+
return createHash('sha1').update(readFileSync(TGZ)).digest('hex')
|
|
308
|
+
} catch {
|
|
309
|
+
return ''
|
|
310
|
+
}
|
|
311
|
+
})()
|
|
312
|
+
const got = tryRun('npm', ['view', 'dsh-qqbot-muu@' + VERSION, 'dist.shasum']).out.trim()
|
|
313
|
+
if (want && got && want === got) {
|
|
314
|
+
ok('已发布 dsh-qqbot-muu@' + VERSION + '(注册表已核到,tarball 完全一致)')
|
|
315
|
+
} else {
|
|
316
|
+
const same = compareRegistryTarball()
|
|
317
|
+
if (same === true) ok('已发布 dsh-qqbot-muu@' + VERSION + '(sha1 不同但文件清单一致,属 npm 重打包)')
|
|
318
|
+
else {
|
|
319
|
+
NPM_PENDING = 'npm 上 ' + VERSION + ' 的产物与本地产物不一致(' + (same || '无法核对') + '):注册表里可能是旧构建,请升一个版本重发。'
|
|
320
|
+
console.log(' ! ' + NPM_PENDING)
|
|
321
|
+
}
|
|
322
|
+
}
|
|
285
323
|
}
|
|
324
|
+
|
|
286
325
|
// 202/staged 路径不会自动挪 latest:显式把 latest 指到本版本,否则用户 npm i 还拿旧版
|
|
287
326
|
const tag = spawnSync('npm', ['dist-tag', 'add', `dsh-qqbot-muu@${VERSION}`, 'latest', AUTH_FLAG], { encoding: 'utf8', shell: IS_WIN })
|
|
288
327
|
if (tag.status === 0) ok(`latest → ${VERSION}`)
|
|
289
328
|
}
|
|
290
329
|
|
|
330
|
+
// 比对「本地 TGZ」与「npm 上该版本真实 tarball」的文件清单(名称 + 字节数)。
|
|
331
|
+
// 返回 true=内容一致;false=不一致;字符串=无法核对的原因。
|
|
332
|
+
function compareRegistryTarball() {
|
|
333
|
+
try {
|
|
334
|
+
const dir = join(TMP, 'verify-npm')
|
|
335
|
+
try { mkdirSync(dir, { recursive: true }) } catch { /* noop */ }
|
|
336
|
+
try {
|
|
337
|
+
for (const f of readdirSync(dir)) {
|
|
338
|
+
try { rmSync(join(dir, f), { force: true }) } catch { /* noop */ }
|
|
339
|
+
}
|
|
340
|
+
} catch { /* noop */ }
|
|
341
|
+
const r = spawnSync('npm', ['pack', 'dsh-qqbot-muu@' + VERSION, '--pack-destination', dir, AUTH_FLAG], { encoding: 'utf8', shell: IS_WIN })
|
|
342
|
+
if (r.status !== 0) return '拉取注册表 tarball 失败'
|
|
343
|
+
const files = readdirSync(dir).filter((f) => f.endsWith('.tgz'))
|
|
344
|
+
if (!files.length) return '注册表 tarball 没下载到'
|
|
345
|
+
const theirs = join(dir, files[0])
|
|
346
|
+
const a = tarEntries(TGZ)
|
|
347
|
+
const b = tarEntries(theirs)
|
|
348
|
+
if (!a.length || !b.length) return '读不出 tarball 清单'
|
|
349
|
+
if (a.length !== b.length) return '文件数不同(本地 ' + a.length + ' / npm ' + b.length + ')'
|
|
350
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
351
|
+
if (a[i] !== b[i]) return '文件不一致:本地 ' + a[i] + ' / npm ' + b[i]
|
|
352
|
+
}
|
|
353
|
+
return true
|
|
354
|
+
} catch (e) {
|
|
355
|
+
return '比对异常:' + (e instanceof Error ? e.message : String(e))
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function tarEntries(file) {
|
|
360
|
+
const r = spawnSync('tar', ['-tvzf', file], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 })
|
|
361
|
+
if (r.status !== 0) return []
|
|
362
|
+
const rows = []
|
|
363
|
+
for (const line of String(r.stdout || '').split(/\r?\n/)) {
|
|
364
|
+
if (!line.trim()) continue
|
|
365
|
+
const m = line.match(/^(\S+)\s+\S+\s+\S+\s+(\d+)\s+\S+\s+\S+\s+(.+)$/)
|
|
366
|
+
if (!m) continue
|
|
367
|
+
rows.push(m[3].trim() + '|' + m[2])
|
|
368
|
+
}
|
|
369
|
+
rows.sort()
|
|
370
|
+
return rows
|
|
371
|
+
}
|
|
372
|
+
|
|
291
373
|
// ── 7) 市场条目同步(fork 分支 + PR)───────────────────────────────────
|
|
292
374
|
step('7/7 插件市场条目同步')
|
|
293
375
|
const localYml = readFileSync(LOCAL_MARKET, 'utf8')
|