dsh-fish-soul 0.19.11 → 0.19.13

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让一个 QQ 小号背后有"同一个人":固定人格、按人记记忆、有自己的生活节奏、会主动开口;同一个"她"同时出现在 QQ、B站、抖音。
4
4
 
5
- DSH 插件(单角色 `feiyu`)。版本 **0.19.11**。
5
+ DSH 插件(单角色 `feiyu`)。版本 **0.19.13**。
6
6
 
7
7
  QQ 交流群:**1125962189**
8
8
 
package/lib/behavior.js CHANGED
@@ -216,55 +216,136 @@ export function dedupeParagraphs(input, { threshold = 0.75, minLen = 12, exactLe
216
216
  }
217
217
 
218
218
  /**
219
- * 超长单段兜底:模型偶尔把整条回复挤成一段还不带空行(人设又不用标点,
220
- * 按句末标点拆条也拆不动),到 QQ 上就成了一堵长消息。这里把超过 maxLen 字的
221
- * 单行段按空格匀着拆成几截(最多 maxParts 截),截之间空一行(发送端按空行拆条)。
222
- * 多行的段、[语音] 段、没有空格的长段不动。返回 { text, changed, parts },parts 是多拆出来的条数。
219
+ * 超长单段兜底:模型偶尔把整条回复挤成一段,到 QQ 上就成了「一堵长消息」。
220
+ * 超过 maxLen 字的段落拆成几截(最多 maxParts 截),截之间空一行(发送端按空行拆条)。
221
+ *
222
+ * 🔴 #244:以前只按**空格**拆,并且跳过含单换行的段 —— 中文没有空格、模型又常用单换行
223
+ * 分行,于是中文长段整段发出去,用户看到的就是「分段没拆」。现在:
224
+ * · 单换行先归一成多段(发送端只认空行);
225
+ * · 有空格按空格拆;没空格(纯中文)按句末标点拆,一句都超长就按字数硬切。
226
+ * · `[语音]` 段不动(它有自己的分段语义)。
227
+ *
228
+ * 返回 { text, changed, parts },parts 是多拆出来的条数。
223
229
  */
224
- export function splitLongParagraphs(input, { maxLen = 60, maxParts = 3 } = {}) {
230
+ export function splitLongParagraphs(input, { maxLen = 60, maxParts = 3, splitLength = true } = {}) {
225
231
  const raw = String(input ?? '');
226
- const paras = raw.split(/\n{2,}/);
232
+ // 🔴 #244:发送端只按**空行**(\n\n)拆条,单换行在 QQ 上不产生分条。
233
+ // 模型偶尔在长段里用单换行分行 ⇒ 整段发出去,看着像「没拆」。
234
+ // 超长段落里的单换行先归一成空行,再走下面的长度兜底。
235
+ // Windows 宿主可能带 CRLF:先归一,否则 `a\r\n\r\nb` 会多切出空段(审查发现)
236
+ const normalized = raw.replace(/\r\n/g, '\n');
237
+ const blocks = normalized.split(/\n{2,}/);
238
+ // 单换行在发送端**不产生分条**(只认空行)—— 不管长短,不归一就等于没分段。
239
+ // 🔴 但 [语音] 段豁免:它有自己的分段语义,拆成「语音 + 文字」会让后半句突然变打字。
240
+ const hadSingleNewline = blocks.some((b) => b.includes('\n') && !/^\[语音\]/m.test(b));
241
+ const paras = hadSingleNewline ? blocks.flatMap((p) => (/^\[语音\]/.test(p.trim()) ? [p] : p.split(/\n/))) : blocks;
242
+
227
243
  const out = [];
228
- let changed = false;
229
- let parts = 0;
244
+ let changed = hadSingleNewline;
245
+ let parts = hadSingleNewline ? paras.length - blocks.length : 0;
246
+ // 🔴 长度拆分的门槛:单段时按 maxLen;多段时只拆「极端长」的(> maxLen*2)。
247
+ // 多段回复是模型自己的排版,稍微超标就拆会让段数膨胀、撞上下游 MAX_PARAGRAPHS=5,
248
+ // 把两段无关的话焊进同一条(审查实测:4 段 67/62/51/46 → 最后一条 99 字,
249
+ // 正是 #244 要消灭的现象)。但真正一堵墙的长段(如 1 短 + 1 个 300 字)仍要拆。
250
+ const singleBlock = blocks.length === 1;
251
+ const limitFor = (t) => (singleBlock ? maxLen : maxLen * 2);
230
252
  for (const p of paras) {
231
253
  const t = p.trim();
232
- if (t === '' || t.includes('\n') || /^\[语音\]/.test(t) || !t.includes(' ') || [...t].length <= maxLen) { out.push(p); continue; }
233
- const words = t.split(/ +/).filter((w) => w !== '');
234
- if (words.length < 2) { out.push(p); continue; }
235
- const total = [...t].length;
236
- const n = Math.min(maxParts, Math.max(2, Math.ceil(total / maxLen)));
237
- const target = Math.ceil(total / n) + 2; // 留点余量,别让最后一个词溢出成多余的一截
238
- const chunks = [];
239
- let cur = words[0];
240
- for (const w of words.slice(1)) {
241
- const joined = cur + ' ' + w;
242
- if ([...joined].length <= target) cur = joined;
243
- else { chunks.push(cur); cur = w; }
244
- }
245
- chunks.push(cur);
246
- // 贪心拆出来太多截时,相邻的均匀并回去,并到 n 截
247
- if (chunks.length > n) {
248
- const groups = [];
249
- let i = 0;
250
- for (let g = 0; g < n; g++) {
251
- const size = Math.ceil((chunks.length - i) / (n - g));
252
- groups.push(chunks.slice(i, i + size).join(' '));
253
- i += size;
254
- }
255
- chunks.length = 0;
256
- chunks.push(...groups);
257
- }
254
+ if (t === '' || /^\[语音\]/.test(t) || !splitLength || [...t].length <= limitFor(t)) { out.push(t); continue; }
255
+ // ① 有空格(中英混排 / 英文):按空格匀着拆
256
+ // ② 没空格(纯中文):按句末标点拆;标点也不够就按字数硬切
257
+ const chunks = /\s/.test(t) ? splitByWords(t, maxLen, maxParts) : splitByPunctuation(t, maxLen, maxParts);
258
258
  if (chunks.length > 1) {
259
259
  changed = true;
260
260
  parts += chunks.length - 1;
261
261
  out.push(...chunks);
262
- } else out.push(p);
262
+ } else out.push(t);
263
263
  }
264
264
  if (!changed) return { text: raw, changed: false, parts: 0 };
265
265
  return { text: out.join('\n\n'), changed: true, parts };
266
266
  }
267
267
 
268
+ /** 按空格把一段匀着拆成最多 maxParts 截。 */
269
+ function splitByWords(t, maxLen, maxParts) {
270
+ const words = t.split(/ +/).filter((w) => w !== '');
271
+ if (words.length < 2) return [t];
272
+ const total = [...t].length;
273
+ const n = Math.min(maxParts, Math.max(2, Math.ceil(total / maxLen)));
274
+ const target = Math.ceil(total / n) + 2; // 留点余量,别让最后一个词溢出成多余的一截
275
+ const chunks = [];
276
+ let cur = words[0];
277
+ for (const w of words.slice(1)) {
278
+ const joined = cur + ' ' + w;
279
+ if ([...joined].length <= target) cur = joined;
280
+ else { chunks.push(cur); cur = w; }
281
+ }
282
+ chunks.push(cur);
283
+ return mergeToN(chunks, n, ' ');
284
+ }
285
+
286
+ /**
287
+ * 中文没有空格:按句末标点(。!?;…)切成句子,再把相邻的句子合成不超过 maxLen 的段。
288
+ * 一句就超长(没标点)时按字数硬切,避免整段落一堵墙发出去。
289
+ */
290
+ function splitByPunctuation(t, maxLen, maxParts) {
291
+ // 保留标点:在标点后面切开。
292
+ // 🔴 `!` 后面紧跟 `[` 是 Markdown 图片(`![图](url)`),不能当句末(审查发现会被切成 `!` + `[图](url)`)。
293
+ const sentences = t.split(/(?<=[。!?;…;])|(?<=[!?])(?!\[)/).map((s) => s.trim()).filter((s) => s !== '');
294
+ const source = sentences.length > 1 ? sentences : splitByLength(t, maxLen);
295
+ const chunks = [];
296
+ let cur = '';
297
+ for (const s of source) {
298
+ if (cur === '') { cur = s; continue; }
299
+ if ([...cur].length + [...s].length <= maxLen) cur += s;
300
+ else { chunks.push(cur); cur = s; }
301
+ }
302
+ if (cur !== '') chunks.push(cur);
303
+ // 🔴 段数超过 maxParts 时**不能靠合并来凑数** —— 合并只会造出比 maxLen 更大的块,
304
+ // 把「每段 ≤ maxLen」的承诺落空(审查实测 179 / 479 字)。
305
+ // 段数上限是调用方的期望,这里只保证长度;超出的部分让上层按 MAX_PARAGRAPHS 处理。
306
+ return chunks;
307
+ }
308
+
309
+ /**
310
+ * 完全没有标点的长中文:按字数硬切。
311
+ * 🔴 切点必须避开 `[表情码]`、`![图](url)`、`[文字](url)` —— 这些是原子片段,
312
+ * 切断了下游的整段匹配就失效(表情变方括号、图片变裸链接)。做法是先把它们
313
+ * 换成占位符,按字数切完再换回来。
314
+ */
315
+ function splitByLength(t, maxLen) {
316
+ /** @type {string[]} */
317
+ const atoms = [];
318
+ const masked = t.replace(/!?\[[^\]]*\]\([^)]*\)|\[[^\]\n]{1,16}\]/g, (m) => {
319
+ atoms.push(m);
320
+ // 用私用区字符当占位,天然不会和正文冲突;长度按原片段算(保持切分比例)
321
+ const token = `\uE000${atoms.length - 1}\uE001`;
322
+ return token + '\uE002'.repeat(Math.max(0, [...m].length - token.length));
323
+ });
324
+ // 按「token」切:占位符是不可分割的原子,不能从中间切开
325
+ const parts = masked.match(/\uE000\d+\uE001\uE002*|[\s\S]/gu) ?? [];
326
+ const out = [];
327
+ let cur = '';
328
+ for (const p of parts) {
329
+ if (cur !== '' && cur.length + p.length > maxLen) { out.push(cur); cur = ''; }
330
+ cur += p;
331
+ }
332
+ if (cur !== '') out.push(cur);
333
+ return out.map((s) => s.replace(/\uE000(\d+)\uE001\uE002*/g, (_, i) => atoms[Number(i)] ?? '').trim()).filter((s) => s !== '');
334
+ }
335
+
336
+ /** 贪心拆出来太多截时,相邻的均匀并回去,并到 n 截。 */
337
+ function mergeToN(chunks, n, sep) {
338
+ if (chunks.length <= n) return chunks;
339
+ const groups = [];
340
+ let i = 0;
341
+ for (let g = 0; g < n; g++) {
342
+ const size = Math.ceil((chunks.length - i) / (n - g));
343
+ groups.push(chunks.slice(i, i + size).join(sep));
344
+ i += size;
345
+ }
346
+ return groups;
347
+ }
348
+
268
349
  /**
269
350
  * #210:模型有时把 [语音] 段跟前文用单换行隔开,而发送端按空行(\n\n)拆段,
270
351
  * 拆不开 ⇒ [语音] 被并进上一条文字一起发,永远转不成语音。
@@ -603,7 +684,7 @@ export function makeMoodJudge({ db, clock, callLlm, getConfig, personaName, rece
603
684
  `最近的聊天:\n${(recentLines?.(channelId) ?? []).join('\n') || '(没有)'}\n这句:${who}:${t.slice(0, 300)}\n` +
604
685
  `只输出 JSON:{"mood":"${MOODS.join('/')}/平静","intensity":1到3,"confidence":0到1,"reason":"十个字以内"}。` +
605
686
  '普通闲聊、没有明显变化就填平静、confidence 给低。';
606
- const parsed = parseJson(await callLlm(prompt, { maxTokens: 300 }));
687
+ const parsed = parseJson(await callLlm(prompt, { feature: 'mood' }));
607
688
  if (!parsed) return null;
608
689
  const label = String(parsed.mood ?? '').trim();
609
690
  const confidence = Number(parsed.confidence) || 0;
@@ -711,7 +792,7 @@ export class DiaryWriter {
711
792
  'who 必须原样照抄上面的名字(连括号都不要加),不要自己编称呼。刷到的视频作者、群里没跟你说过话的路人都不算。\n'
712
793
  : '') +
713
794
  '只输出 JSON:{"diary":"……","topics":[{"who":"对方的名字","topic":"想聊的事(一句话)"}]}';
714
- const reply = await this.callLlm(prompt, { maxTokens: 1500, thinkFallback: true });
795
+ const reply = await this.callLlm(prompt, { feature: 'diary', thinkFallback: true });
715
796
  const parsed = parseJson(reply) ?? {};
716
797
  const diary = (String(parsed.diary ?? '').trim() || looseDiary(reply)).slice(0, 600);
717
798
  if (diary === '') {
@@ -436,6 +436,67 @@ function filterUseful(rawMessages) {
436
436
  return (rawMessages || []).filter(isUsefulMessage)
437
437
  }
438
438
 
439
+ /**
440
+ * 抖音气泡里「时间 / 已读」这类 meta 行的写法。
441
+ *
442
+ * 🔴 少认一种的后果不是「丢一行」,而是**多出一条假消息**(真机 2026-11-29):
443
+ * 日期分隔线和下面那条真消息落在同一个容器里,join 之后并成一条
444
+ * ⇒「11/13」被当成对方发来的消息,还被整理进了记忆。
445
+ *
446
+ * 见过的写法:刚刚 / N秒前 / N分钟前 / N小时前 / N天前 / 昨天 / 前天 /
447
+ * HH:MM / 11月13日 / 11/13 / 周四 / 已读 / 未读
448
+ *
449
+ * 这个函数同时被页面脚本(经 String(isMetaLine) 注入)和测试直接调用 —— 只有一份实现。
450
+ *
451
+ * @param {string} s 一行的文本
452
+ * @returns {boolean}
453
+ */
454
+ export function isMetaLine(s) {
455
+ const t = String(s == null ? '' : s).trim()
456
+ if (t === '已读' || t === '未读') return true
457
+ if (/^(\d+秒前|\d+分钟前|\d+小时前|\d+天前|刚刚|昨天|前天)$/.test(t)) return true
458
+ if (/^\d{1,2}:\d{2}$/.test(t)) return true
459
+ if (/^\d{1,2}月\d{1,2}日$/.test(t)) return true
460
+ if (/^\d{1,2}\/\d{1,2}$/.test(t)) return true
461
+ if (/^(周|星期)[一二三四五六日天]$/.test(t)) return true
462
+ return false
463
+ }
464
+
465
+ /**
466
+ * 取一条消息的正文行:先按 DOM 结构剔掉时间节点,再滤 meta 行。
467
+ *
468
+ * 🔴 为什么按结构剔(2026-11-29 真机确认):抖音把日期分隔线做成消息容器
469
+ * 自己的第一个子节点(class 含 MessageBoxTimetimeLayout,固定 308 宽),
470
+ * 不是列表里的独立一项 ⇒ innerText 天然带着它,只靠文本正则永远在追新写法。
471
+ * 按结构剔掉就没有「漏认某种日期格式」这个洞。
472
+ *
473
+ * ⚠️ cloneNode 不能用:克隆节点不在布局树里,innerText 退化成 textContent,
474
+ * 行间换行全丢(「已读」会和正文粘成一行)。必须临时隐藏真节点、读完再恢复。
475
+ *
476
+ * 这个函数同时被页面脚本(经 String(bodyLinesOf) 注入)和测试直接调用。
477
+ *
478
+ * @param {Element} box 一条消息的外层容器
479
+ * @returns {string[]} 正文行(已剔掉时间节点与 meta 行)
480
+ */
481
+ export function stripTimeLines(box) {
482
+ const timeEl = box.querySelector('[class*="MessageBoxTimetimeLayout"]')
483
+ const prev = timeEl ? timeEl.style.visibility : ''
484
+ if (timeEl) timeEl.style.visibility = 'hidden'
485
+ const raw = box.innerText || ''
486
+ if (timeEl) timeEl.style.visibility = prev
487
+ return raw.split(String.fromCharCode(10)).map((s) => s.replace(/\u200b/g, '').trim()).filter(Boolean)
488
+ }
489
+
490
+ /**
491
+ * 正文行 = 剔掉时间节点后再滤掉 meta 行(已读 / 时刻)。
492
+ *
493
+ * @param {Element} box 一条消息的外层容器
494
+ * @returns {string[]}
495
+ */
496
+ export function bodyLinesOf(box) {
497
+ return stripTimeLines(box).filter((s) => !isMetaLine(s))
498
+ }
499
+
439
500
  /** 内部函数给测试用(不参与对外契约)。 */
440
501
  export const __test = { filterUseful, resolveConvId, readDMDom }
441
502
 
@@ -600,10 +661,11 @@ async function readDMDom({ browser, limit = 30, uname = '', scrollBack = 0 }) {
600
661
  // 被另一个消息容器包住的是同一条消息的内层节点,丢掉(按 DOM 结构去重,不按正文)
601
662
  const boxes = sized.filter((el) => !sized.some((o) => o !== el && o.contains(el)))
602
663
 
603
- // 时间和已读状态不算正文
604
- const isMeta = (s) => /^(\d+秒前|\d+分钟前|\d+小时前|\d+天前|刚刚|昨天|前天|\d{1,2}月\d{1,2}日)$/.test(s)
605
- || /^\d{1,2}:\d{2}$/.test(s)
606
- || s === '已读' || s === '未读'
664
+ // 时间和已读状态不算正文 —— 判据只有一份(模块级的 isMetaLine / bodyLinesOf,
665
+ // 经 String(...) 注入;测试打的就是同一份源码)
666
+ const isMetaLine = (${String(isMetaLine)})
667
+ const bodyLinesOf = (${String(bodyLinesOf)})
668
+ const stripTimeLines = (${String(stripTimeLines)})
607
669
 
608
670
  /**
609
671
  * 从气泡的 meta 文本反解时间戳(毫秒)。
@@ -671,9 +733,9 @@ async function readDMDom({ browser, limit = 30, uname = '', scrollBack = 0 }) {
671
733
  const allLines = t.split(String.fromCharCode(10))
672
734
  .map((s) => s.replace(/\u200b/g, '').trim())
673
735
  .filter(Boolean)
674
- const lines = allLines.filter((s) => !isMeta(s))
736
+ const lines = bodyLinesOf(box)
675
737
  // 时间:从被滤掉的那些行里反解(反解不出就是 0,上层兜底)
676
- const time = timeFromMeta(allLines.filter((s) => isMeta(s) && s !== '已读' && s !== '未读'), nowRef)
738
+ const time = timeFromMeta(allLines.filter((s) => isMetaLine(s) && s !== '已读' && s !== '未读'), nowRef)
677
739
 
678
740
  // fish-soul:群聊里对方气泡上面有昵称(单聊没有)。认出来就单独拿出来,别混进正文
679
741
  let senderName = ''
@@ -26,14 +26,16 @@ window.__ModuleLoader__.load({
26
26
 
27
27
  /** 按功能选模型 */
28
28
  function FeatureModels({ data, api, notify, load, ui }) {
29
- const { h, Group, Row, Select, Muted, State } = ui;
29
+ const { h, Group, Row, Select, Muted, State, Num } = ui;
30
30
  const [busy, setBusy] = react.useState(false);
31
31
  const providers = data.providers ?? [];
32
32
  const host = data.hostDefault;
33
33
  async function pick(feature, value) {
34
34
  const [provider, model] = value === "" ? [] : value.split(SEP);
35
35
  const models = Object.fromEntries((data.features ?? []).map((f) => [f.id, f.selection]));
36
- models[feature] = value === "" ? null : { provider, model };
36
+ // #239:换模型时保留已配的额度,别因为换模型把 maxTokens 弄丢
37
+ const keepMt = models[feature]?.maxTokens;
38
+ models[feature] = value === "" ? null : { provider, model, ...(keepMt ? { maxTokens: keepMt } : {}) };
37
39
  setBusy(true);
38
40
  try {
39
41
  const r = await api("POST", "/models/config", { models });
@@ -42,6 +44,34 @@ window.__ModuleLoader__.load({
42
44
  setBusy(false);
43
45
  }
44
46
  }
47
+ async function saveMaxTokens(feature, value) {
48
+ const models = Object.fromEntries((data.features ?? []).map((f) => [f.id, f.selection]));
49
+ const sel = models[feature];
50
+ if (!sel) return; // 没选模型就没地方挂额度
51
+ const n = Number(value);
52
+ models[feature] = Number.isFinite(n) && n > 0
53
+ ? { provider: sel.provider, model: sel.model, maxTokens: Math.min(32000, Math.floor(n)) }
54
+ : { provider: sel.provider, model: sel.model };
55
+ setBusy(true);
56
+ try {
57
+ const r = await api("POST", "/models/config", { models });
58
+ if (r?.ok) load(); else notify(r?.error ?? "保存失败");
59
+ } finally {
60
+ setBusy(false);
61
+ }
62
+ }
63
+ // 受控输入必须有 onChange(否则键盘输入改不动值),onBlur 才落库。
64
+ // 草稿存在 mtDraft 里,key 用功能 id。
65
+ const [mtDraft, setMtDraft] = react.useState({});
66
+ const mtInput = (f) => {
67
+ const sel = f.selection;
68
+ if (!sel) return null;
69
+ const draft = mtDraft[f.id];
70
+ return Num({ min: 500, max: 32000, step: 500, value: draft !== undefined ? draft : (sel.maxTokens ?? ""), placeholder: "额度", title: "每次最多输出多少 token(思考 + 正文)。留空 = 默认 4000。推理模型想得多,太小会把正文挤没",
71
+ "aria-label": `${f.label} 输出额度`, disabled: busy,
72
+ onChange: (e) => setMtDraft((d) => ({ ...d, [f.id]: e.target.value })),
73
+ onBlur: (e) => { saveMaxTokens(f.id, e.target.value); setMtDraft((d) => { const n = { ...d }; delete n[f.id]; return n; }); } });
74
+ };
45
75
  const providerName = (id) => providers.find((p) => p.id === id)?.name ?? id;
46
76
  const options = (sel) => {
47
77
  const opts = [h("option", { key: "", value: "" }, host ? `跟 DSH 默认(${host.model})` : "跟 DSH 默认")];
@@ -57,7 +87,9 @@ window.__ModuleLoader__.load({
57
87
  providers.length === 0 && !host ? Row({ title: "可用模型" }, State("warning", "DSH 里还没配模型")) : null,
58
88
  data.lastError ? Row({ title: "上次调用" }, State("error", data.lastError)) : null,
59
89
  ...(data.features ?? []).map((f) => Row({ title: f.label, key: f.id, meta: f.resolved ? (f.selection ? undefined : `现在用 ${f.resolved.model}`) : (f.id === "vision" ? "不启用(图直接给会话模型)" : "没有可用的模型") },
60
- Select({ value: f.selection ? `${f.selection.provider}${SEP}${f.selection.model}` : "", disabled: busy, "aria-label": f.label, onChange: (e) => pick(f.id, e.target.value) }, ...options(f.selection)))));
90
+ Select({ value: f.selection ? `${f.selection.provider}${SEP}${f.selection.model}` : "", disabled: busy, "aria-label": f.label, onChange: (e) => pick(f.id, e.target.value) }, ...options(f.selection)),
91
+ // #239:额度可在每个功能上单独调(留空 = 默认 4000)。以前写死在代码里,设置页调不了。
92
+ mtInput(f))));
61
93
  }
62
94
 
63
95
  /** 用量 / 估算花费;按模型填单价 */
@@ -78,6 +110,13 @@ window.__ModuleLoader__.load({
78
110
  const anyPrice = models.some(([m]) => (Number(prices[m]?.in) || 0) > 0 || (Number(prices[m]?.out) || 0) > 0);
79
111
  const modelStatus = data.modelStatus ?? {};
80
112
  const today = data.todayUsage ?? { calls: 0, tokens: 0 };
113
+ // #239:失败数要能看出「是持续在坏,还是某一天炸过一次」——否则一个三天前的大数字
114
+ // 会让人以为现在的代码有毛病。只有 daily 里真的有 failed 字段时才提示。
115
+ const dailyFailed = (u.daily ?? []).filter((d) => (d.failed ?? 0) > 0);
116
+ const worstDay = dailyFailed.length > 0 ? dailyFailed.reduce((a, b) => ((b.failed ?? 0) > (a.failed ?? 0) ? b : a)) : null;
117
+ const failedTotal = dailyFailed.reduce((s, d) => s + (d.failed ?? 0), 0);
118
+ const failRate = (f) => (f.failed > 0 && f.calls > 0 ? Math.round((f.failed / f.calls) * 100) : null);
119
+ const failText = (f) => (f.failed > 0 ? `(失败 ${f.failed}${failRate(f) !== null ? ` · ${failRate(f)}%` : ""})` : "");
81
120
  async function savePrice(model) {
82
121
  const p = prices[model] ?? {};
83
122
  const inVal = Number(p.in);
@@ -104,6 +143,11 @@ window.__ModuleLoader__.load({
104
143
  Group({ title: "用量", aside: h(Seg, { label: "时间范围", value: range, onChange: setRange, options: [{ value: "7", label: "7 天" }, { value: "30", label: "30 天" }] }) },
105
144
  Row({ title: "合计", meta: estimated ? "有的模型没报用量,按字数估的" : undefined },
106
145
  Muted(`${t.calls} 次 · 输入 ${fmtTok(t.in)} · 输出 ${fmtTok(t.out)} token`), anyPrice ? Tag(`约 ${fmtCost(t.cost)}`, "info") : null),
146
+ // #239:失败集中在哪一天要说出来,否则「失败 1005 次」会被当成当下的状态
147
+ worstDay ? Row({ title: "失败", meta: `这 ${u.days} 天累计失败 ${failedTotal} 次${dailyFailed.length === 1 ? "(全在同一天)" : `,分布在 ${dailyFailed.length} 天`}` },
148
+ Muted(worstDay.failed === failedTotal
149
+ ? `${worstDay.day} 一天就占满(${worstDay.failed} 次 / 当天 ${worstDay.calls} 次调用)—— 别按这个数字判断现在的代码`
150
+ : `最多的一天是 ${worstDay.day}:${worstDay.failed} 次(当天 ${worstDay.calls} 次调用)`)) : null,
107
151
  Row({ title: "每日后台上限", meta: `今日已用 ${today.calls} 次 · ${fmtTok(today.tokens)} token(0 = 不限)` },
108
152
  Num({ min: 0, max: 100000, step: 10, value: budget.dailyCalls || "", placeholder: "次数/天", "aria-label": "每日调用上限",
109
153
  onChange: (e) => setBudget((b) => ({ ...b, dailyCalls: e.target.value })), onBlur: saveBudget }),
@@ -112,7 +156,7 @@ window.__ModuleLoader__.load({
112
156
  features.length === 0 ? Empty("这段时间还没调用过模型") : h("div", { className: "fs-list" }, features.map(([id, f]) => h("div", { className: "fs-item", key: id },
113
157
  h("span", { className: "fs-item-main" }, labels[id] ?? id),
114
158
  h("span", { className: "fs-item-meta" },
115
- h("span", null, `${f.calls} 次${f.failed ? `(失败 ${f.failed})` : ""}`),
159
+ h("span", null, `${f.calls} 次${failText(f)}`),
116
160
  h("span", null, `${fmtTok(f.in + f.out)} token`),
117
161
  anyPrice ? h("span", null, fmtCost(f.cost)) : null))))),
118
162
  models.length === 0 ? null : Group({ title: "单价", aside: Muted("元 / 百万 token,填了才算花费") },
@@ -122,7 +166,7 @@ window.__ModuleLoader__.load({
122
166
  h("span", { className: "fs-item-main", title: m }, m),
123
167
  h("span", { className: "fs-item-meta" },
124
168
  st ? Tag(st.cooling ? `冷却 ${Math.max(1, Math.ceil(st.cooldownMs / 60000))}m` : `连败 ${st.streak}`, "warning") : null,
125
- h("span", null, `${x.calls} 次${x.failed ? `(失败 ${x.failed})` : ""}`),
169
+ h("span", null, `${x.calls} 次${failText(x)}`),
126
170
  h("span", null, `${fmtTok(x.in + x.out)} token`),
127
171
  priceInput(m, "in", "输入"), priceInput(m, "out", "输出"),
128
172
  h("span", null, fmtCost(x.cost))));
@@ -414,6 +414,9 @@ window.__ModuleLoader__.load({
414
414
  h("span", { className: "fs-unit", title: "群里不会想起私聊说的事" }, "群"),
415
415
  h(Switch, { label: "在群里", checked: inGroup, onChange: setInGroup }),
416
416
  Button({ disabled: busy || text.trim() === "", onClick: run }, busy ? "想…" : "试一下")),
417
+ // #241:这里只测「这一句」本身;真实对话还会带上最近几句上下文(composeQuery),
418
+ // 所以这边的召回结果会比实战「干净」——写成提示,别让人拿它当真实召回的下限。
419
+ Muted("这里只按这一句检索;真实对话会带上最近几句(指代、追问会重复一次),实际召回可能不同——这里看到的不代表实战一定也这样。"),
417
420
  res === null ? null : h("div", { className: "fs-list" },
418
421
  res.recalled.length === 0 ? Empty("什么都想不起来") : res.recalled.map((m) => row(m, `#${m.rank}`, "success")),
419
422
  ...(res.others ?? []).slice(0, 8).map((m) => row(m, "没想起", "outline")),
@@ -196,7 +196,9 @@ export const behaviorMethods = {
196
196
  }
197
197
  // 分条保底:超长单段又没空行(模型偶尔这么写,到 QQ 上就是一堵长消息)→ 按空格拆开。
198
198
  // 排版问题不是风格问题,不管去 AI 味开没开都执行
199
- const fs = splitLongParagraphs(out);
199
+ // #244:`completeQq`(QQ 群聊完整发送)时模型已经排好的段落不再按长度切,
200
+ // 只把单换行归一成空行(发送端认空行)。否则「完整发送」会变成「拆成更多条」。
201
+ const fs = splitLongParagraphs(out, { splitLength: !cfg.completeQq });
200
202
  if (fs.changed) {
201
203
  this.note('filtered', { channelId: row.channel_id, title: row.title, text: String(out).slice(0, 120), reason: `单段太长,按空格多拆了 ${fs.parts} 条` });
202
204
  out = fs.text;
@@ -702,7 +702,7 @@ export class HistoryImporter {
702
702
  const chunk = p.chunks[ci];
703
703
  let text = null;
704
704
  try {
705
- text = await this.callLlm(extractPrompt({ personaName: persona, name: p.name, chunk }), { signal, maxTokens: 1200 });
705
+ text = await this.callLlm(extractPrompt({ personaName: persona, name: p.name, chunk }), { signal });
706
706
  } catch { text = null; }
707
707
  if (signal.aborted) return;
708
708
  calls++;
package/lib/life.js CHANGED
@@ -1140,7 +1140,7 @@ export class LifeEngine {
1140
1140
  (transcriptLines !== ''
1141
1141
  ? `\n\n同一时期的部分聊天原文(用来核对上面的记忆有没有记错;原文和你记的不一样,以原文为准,把错的填进 corrected):\n${transcriptLines}`
1142
1142
  : ''),
1143
- { signal: controller.signal, maxTokens: 2000, thinkFallback: true, feature: 'dream' }
1143
+ { signal: controller.signal, thinkFallback: true, feature: 'dream' }
1144
1144
  );
1145
1145
  if (controller.signal.aborted || text === null) { markFail(); return; }
1146
1146
 
package/lib/llm.js CHANGED
@@ -42,6 +42,8 @@ export function estimateTokens(text) {
42
42
 
43
43
  /** 推理模型的输出额度(思考 + 正文) */
44
44
  const ROOMY_TOKENS = 8000;
45
+ /** 没配 models.<feature>.maxTokens 时的兜底额度(#239:1500/2000 不够推理模型思考) */
46
+ export const DEFAULT_MAX_TOKENS = 4000;
45
47
  const FAIL_STREAK_LIMIT = 3;
46
48
  const COOLDOWN_BASE_MS = 5 * 60_000;
47
49
  const COOLDOWN_MAX_MS = 60 * 60_000;
@@ -225,8 +227,16 @@ export class LlmRouter {
225
227
  * @param {{ signal?: AbortSignal, maxTokens?: number, feature?: string, thinkFallback?: boolean, images?: any[], needImages?: boolean, failureInfo?: { code?: string }, _target?: any, _tried?: Set<string> }} [opts]
226
228
  * @returns {Promise<string|null>}
227
229
  */
228
- async call(prompt, { signal, maxTokens = 1500, feature = 'other', thinkFallback = false, images = [], needImages = false, failureInfo, _target, _tried } = {}) {
230
+ async call(prompt, { signal, maxTokens, feature = 'other', thinkFallback = false, images = [], needImages = false, failureInfo, _target, _tried } = {}) {
229
231
  const failed = (code) => { if (failureInfo) failureInfo.code = code; };
232
+ // #239:额度可在设置页按功能调(models.<feature>.maxTokens)。不配就用调用方传的兜底值。
233
+ // 以前三处写死 2000 / 1500,推理模型把额度全花在思考上 ⇒ 正文空 ⇒ 记忆整批丢。
234
+ if (maxTokens === undefined) {
235
+ const pick = this.getConfig().models?.[feature];
236
+ const fromCfg = Number(pick?.maxTokens);
237
+ // 兜底 4000:推理模型的思考动不动上千 token,1500/2000 会让正文一个字都挤不出来(#239)
238
+ maxTokens = Number.isFinite(fromCfg) && fromCfg > 0 ? Math.min(32000, Math.floor(fromCfg)) : DEFAULT_MAX_TOKENS;
239
+ }
230
240
  if (signal?.aborted) { failed('timeout'); return null; }
231
241
  if (_tried === undefined) {
232
242
  const cap = this.budgetConfig();
@@ -349,13 +359,17 @@ export class LlmRouter {
349
359
  // 正文是空的但思考里写出了要的 JSON(有的推理模型把答案留在思考里):调用方允许就先拿来用,别白烧一次 8000 重试也别误记失败
350
360
  const rescued = text === '' && thinkFallback && /\{[\s\S]*\}/.test(think) ? think.trim() : '';
351
361
  const finalText = text || rescued;
352
- // 🔴 #181:正文空、结束原因是 max-tokens/length 或 EMPTY_RESPONSE、且确实把额度花在思考上(显式思考或输出 token 吃满预算)——
353
- // 放大到 8000 再试一次注定也是空,跳过它并把被污染的 roomy 记录清掉。
354
- const isMaxTokens = /^(max[-_]?tokens|length)$/i.test(finish);
355
- const usedOut = Number(usage?.outputTokens) || 0;
356
- const thinkAteBudget = finalText === '' && ((think !== '' && (isMaxTokens || emptyCode)) || ((isMaxTokens || emptyCode) && usedOut >= budget * 0.8 && usedOut > 0));
357
- if (thinkAteBudget && roomy.has(key)) { roomy.delete(key); this.saveRoomy(roomy); }
358
- if (finalText === '' && budget < ROOMY_TOKENS && !thinkAteBudget && !signal?.aborted) {
362
+ // 正文空、结束原因是 max-tokens/length 或 EMPTY_RESPONSE、且确实把额度花在思考上(显式思考或输出 token 吃满预算)。
363
+ // 🔴 #181 → #239 修正:#181 当年假设「思考吃满 ⇒ 放大到 8000 也空」,
364
+ // 于是无条件跳过放大。但真机反证:推理模型在 2000 下把额度全花在思考上、
365
+ // 正文为空,放到 8000 就能出正文(报告者的 extract 就是这种,改完立刻恢复)。
366
+ // ⇒ 只在「已经放大到顶还是空」时才认定没救;第一次仍要放大试一次。
367
+ if (finalText === '' && budget >= ROOMY_TOKENS && !roomy.has(key)) {
368
+ // 已经放大到顶还是空 —— 记住「这个模型需要大额度」,下次直接用 8000,
369
+ // 别再从小额度白烧一枪(#181 的本意:不无限重试 ≠ 每次都要从头试一遍)。
370
+ roomy.add(key); this.saveRoomy(roomy);
371
+ }
372
+ if (finalText === '' && budget < ROOMY_TOKENS && !signal?.aborted) {
359
373
  // 空回复多半是额度全花在思考上了:记住这个模型,放大额度再试一次
360
374
  roomy.add(key); this.saveRoomy(roomy);
361
375
  this.record(f, target.model, { inputTokens: usage ? Number(usage.inputTokens) || 0 : estimateTokens(prompt), outputTokens: usage ? Number(usage.outputTokens) || 0 : 0, estimated: !usage, failed: true });
@@ -503,7 +517,7 @@ export class LlmRouter {
503
517
  for (let i = days - 1; i >= 0; i--) {
504
518
  const d = dayKey(now - i * 86400_000);
505
519
  const day = getKv(this.db, `usage.${d}`, {}) ?? {};
506
- let calls = 0; let tokens = 0; let dayCost = 0;
520
+ let calls = 0; let tokens = 0; let dayCost = 0; let dayFailed = 0;
507
521
  for (const [feature, f] of Object.entries(day)) {
508
522
  const bf = byFeature[feature] ?? { calls: 0, failed: 0, in: 0, out: 0, estimated: 0, cost: 0 };
509
523
  bf.calls += f.calls; bf.failed += f.failed; bf.in += f.in; bf.out += f.out; bf.estimated += f.estimated ?? 0;
@@ -515,9 +529,9 @@ export class LlmRouter {
515
529
  byModel[model] = bm;
516
530
  }
517
531
  byFeature[feature] = bf;
518
- calls += f.calls; tokens += f.in + f.out;
532
+ calls += f.calls; tokens += f.in + f.out; dayFailed += Number(f.failed) || 0;
519
533
  }
520
- daily.push({ day: d, calls, tokens, cost: dayCost });
534
+ daily.push({ day: d, calls, tokens, cost: dayCost, failed: dayFailed });
521
535
  }
522
536
  const total = Object.values(byFeature).reduce((s, f) => ({ calls: s.calls + f.calls, in: s.in + f.in, out: s.out + f.out, cost: s.cost + f.cost }), { calls: 0, in: 0, out: 0, cost: 0 });
523
537
  return { days, byFeature, byModel, daily, total, prices };
package/lib/routes-v07.js CHANGED
@@ -44,7 +44,12 @@ function cleanModels(raw) {
44
44
  const v = raw?.[feature];
45
45
  if (v === null || v === undefined || v === '') { out[feature] = null; continue; }
46
46
  const provider = str(v.provider, 100); const model = str(v.model, 200);
47
- out[feature] = provider !== '' && model !== '' ? { provider, model } : null;
47
+ if (provider === '' || model === '') { out[feature] = null; continue; }
48
+ // #239:每次最多输出多少 token(思考 + 正文);不填 = 用默认兜底
49
+ const mt = Number(v.maxTokens);
50
+ out[feature] = Number.isFinite(mt) && mt > 0
51
+ ? { provider, model, maxTokens: Math.min(32000, Math.floor(mt)) }
52
+ : { provider, model };
48
53
  }
49
54
  return out;
50
55
  }
@@ -132,7 +137,15 @@ export async function handleV07Route({ method, path, url, req, res, send, readBo
132
137
  const r = await llmRouter.resolve(id);
133
138
  const pick = cfg.models?.[id];
134
139
  // vision(识图)的语义是「不配 = 不启用」,不是「跟 DSH 默认」:没配时 resolved 给 null,别让面板显示「现在用 xxx」误导人。
135
- features.push({ id, label, selection: pick && pick.provider && pick.model ? { provider: pick.provider, model: pick.model } : null, resolved: (id === 'vision' && !(pick && pick.model)) ? null : r, });
140
+ // #239:带上 maxTokens,设置页要能读出「现在这个功能配了多少额度」
141
+ const mt = Number(pick?.maxTokens);
142
+ features.push({
143
+ id, label,
144
+ selection: pick && pick.provider && pick.model
145
+ ? { provider: pick.provider, model: pick.model, ...(Number.isFinite(mt) && mt > 0 ? { maxTokens: mt } : {}) }
146
+ : null,
147
+ resolved: (id === 'vision' && !(pick && pick.model)) ? null : r,
148
+ });
136
149
  }
137
150
  send(200, {
138
151
  ok: true, providers, features, hostDefault: llmRouter.hostDefault(), prices: cfg.modelPrices ?? {},
package/lib/slang.js CHANGED
@@ -224,7 +224,7 @@ export class SlangLearner {
224
224
  let lines = b.lines.slice(-200);
225
225
  while (lines.length > 20 && lines.reduce((s, l) => s + l.text.length + l.name.length + 10, 0) > 4000) lines = lines.slice(Math.ceil(lines.length / 5));
226
226
  const withExpressions = this.getConfig().expressions !== false;
227
- const text = await this.callLlm(slangPrompt({ personaName: this.personaName(), title: this.titleOf(channelId), existing: d.terms, style: d.style, lines, expressions: d.expressions, kind, withExpressions }), { maxTokens: 2000, thinkFallback: true });
227
+ const text = await this.callLlm(slangPrompt({ personaName: this.personaName(), title: this.titleOf(channelId), existing: d.terms, style: d.style, lines, expressions: d.expressions, kind, withExpressions }), { thinkFallback: true });
228
228
  if (text === null) { markFail(d); return { ok: false, error: '模型没回(看看「模型」页有没有可用的模型)' }; }
229
229
  const parsed = parseLlmJson(text);
230
230
  if (!parsed || typeof parsed !== 'object') { markFail(d); return { ok: false, error: '模型回的不是 JSON' }; }
@@ -785,7 +785,7 @@ export class ChatDigester {
785
785
  '这次又看到下面「她慢慢在变的」里某一条的表现,就用 same 指回去再报一次(这是在攒证据,别换个说法另写)。\n' +
786
786
  `她慢慢在变的:\n${growthPromptPart(this.db)}\n` : '') +
787
787
  `已有记忆:\n${knownText || '(没有)'}\n聊天:\n${text}`;
788
- const out = await this.callLlm(prompt, { maxTokens: 2000, thinkFallback: true, feature: 'extract' });
788
+ const out = await this.callLlm(prompt, { thinkFallback: true, feature: 'extract' });
789
789
  if (out === null) return null;
790
790
  const parsed = parseLlmJson(out);
791
791
  if (!parsed) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-fish-soul",
3
- "version": "0.19.11",
3
+ "version": "0.19.13",
4
4
  "description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记、每周记忆存档与可选周记(DSH 插件,单角色 feiyu ,v0.18.23)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  "scripts": {
67
- "test": "node test/check-test-chain.mjs && node test/check-release-version.mjs && node test/wire-helper.mjs && node test/marker-audit.mjs && node test/douyin-send.mjs && node test/douyin-mechanism.mjs && node test/douyin-route.mjs && node test/douyin-adapter.mjs && node test/douyin-contract.mjs && node test/memory-bulk-move.mjs && node test/safe-download.mjs && node test/douyin-exact-id.mjs && node test/douyin-pb-init.mjs && node test/douyin-conversation.mjs && node test/douyin-inbox.mjs && node test/douyin-quarantine.mjs && node test/douyin-send-target.mjs && node test/douyin-send-exclusive.mjs && node test/douyin-gap-dedupe.mjs && node test/douyin-message-id-dedupe.mjs && node test/douyin-push-poll-dedupe.mjs && node test/douyin-share-card-dedupe.mjs && node test/douyin-share-card-dom.mjs && node test/douyin-inline-share.mjs && node test/douyin-short-link.mjs && node test/douyin-inline-ledger.mjs && node test/douyin-group-chat.mjs && node test/douyin-group-read.mjs && node test/douyin-group-reply.mjs && node test/session-overflow-recycle.mjs && node test/douyin-read-fail-retry.mjs && node test/douyin-read-cache.mjs && node test/douyin-dm-media-conv.mjs && node test/douyin-read-fail-retry-poll.mjs && node test/douyin-live-fails.mjs && node test/douyin-inbox-contract.mjs && node test/person-attribution.mjs && node test/memory-owner-reassign.mjs && node test/douyin-poll-and-timer-safety.mjs && node test/p2-limits.mjs && node test/resource-safety.mjs && node test/leftover-edge-cases.mjs && node test/douyin-master-person-merge.mjs && node test/douyin-master-uid.mjs && node test/douyin-identity-e2e.mjs && node test/douyin-note-upload-poll.mjs && node test/douyin-post-jobs.mjs && node test/douyin-video-post.mjs && node test/douyin-video-trigger.mjs && node test/douyin-video-driver.mjs && node test/retrieval-filtered-vectors.mjs && node test/security-boundaries.mjs && node test/douyin-cdp-cursor.mjs && node test/douyin-nav-timeout.mjs && node test/persona-isolation.mjs && node test/diary-topics-217.mjs && node test/smoke.mjs && node test/life-context-interaction.mjs && node test/life-clock-refresh.mjs && node test/browser-launch-early-exit.mjs && node test/douyin-browser.mjs && node test/douyin-crash-restore.mjs && node test/douyin-page-alive.mjs && node test/douyin-eval-timeout.mjs && node test/douyin-bridge-timeout.mjs && node test/douyin-goto-budget.mjs && node test/douyin-music.mjs && node test/douyin-ax-button.mjs && node test/startup-gate.mjs && node test/outbox.mjs && node test/import-coverage.mjs && node test/update-check.mjs && node test/issue-fixes.mjs && node test/import-resume.mjs && node test/maibot-extras.mjs && node test/slang-global.mjs && node test/worldinfo.mjs && node test/memory-bulk.mjs && node test/memory-tiers.mjs && node test/memory-weekly.mjs && node test/issue-98-self-archive.mjs && node test/issue-99-memory-order.mjs && node test/issue-115-memory-date.mjs && node test/issue-119-memory-page.mjs && node test/issue-125-memory-filter.mjs && node test/issue-78-diagnostic.mjs && node test/memory-storage.mjs && node test/memory-storage-restore.mjs && node test/backup-restore.mjs && node test/douyin-group.mjs && node test/review-fixes.mjs && node test/at-reads-video.mjs && node test/search-source.mjs && node test/followups.mjs && node test/detail-config.mjs && node test/qq-send-any-image.mjs && node test/qq-read-attachment.mjs && node test/qq-batch-window.mjs && node test/llm-roomy-budget.mjs && node test/llm-failure-backoff.mjs && node test/llm-budget-and-social-backoff.mjs && node test/comment-video.mjs && node test/frames.mjs && node test/face-name.mjs && node test/comment-reply.mjs && node test/chat-comment.mjs && node test/at-target.mjs && node test/quota-caps.mjs && node test/client-lint.mjs && node test/client-panels.mjs && node test/dsh-desktop.mjs && node test/group-mention-only.mjs && node test/qq-private-allowlist.mjs && node test/issue-59-interject.mjs && node test/issue-59-diagnose.mjs && node test/diag-douyin-running.mjs && node test/sticker-backfill.mjs && node test/issue-118-sticker-diagnostics.mjs && node test/sticker-manage.mjs && node test/bili-emotes.mjs && node test/qq-outbound-sanitize.mjs && node test/repeat-guard-cross-turn.mjs && node test/voice-paragraph-split.mjs && node test/voice-paragraph-split-wire.mjs && node test/person-delete.mjs && node test/qq-group-admin.mjs && node test/douyin-recovery.mjs && node test/session-preset.mjs && node test/qq-connect-error.mjs && node test/douyin-comment-bridge.mjs && node test/douyin-comment-write-unknown.mjs && node test/douyin-reply-verify-status.mjs && node test/bili-comment-emoji.mjs && node test/douyin-state-echo.mjs && node test/issue-75-proactive.mjs && node test/issue-76-capability.mjs && node test/douyin-http-browse.mjs && node test/douyin-verify-backoff.mjs && node test/douyin-digg-bridge.mjs && node test/memory-evidence-transcript.mjs && node test/chat-archive-default.mjs && node test/issue-113-desktop-archive.mjs && node test/dream-transcript-wire.mjs && node test/douyin-frames-collect.mjs && node test/master-qq-uin-rebind.mjs && node test/douyin-session-health.mjs && node test/douyin-delivered.mjs && node test/douyin-card-share.mjs && node test/douyin-push-drop.mjs && node test/douyin-stranger-dm.mjs && node test/douyin-uid-binding.mjs && node test/image-webp-fallback.mjs && node test/douyin-emoji-fallback.mjs && node test/douyin-panel-width-threshold.mjs && node test/douyin-emoji-panel-close.mjs && node test/relay-other-platform.mjs && node test/relay-to-friend.mjs && node test/relay-sender-id.mjs && node test/dsh-home-guard.mjs && node test/relay-config-route.mjs && node test/share-fallback.mjs && node test/share-quota-refund.mjs && node test/issue-101-voice-files.mjs && node test/voice-volcengine.mjs && node test/voice-minimax-dashscope.mjs && node test/bili-switch-persist.mjs && node test/cross-channel-context.mjs && node test/reply-target.mjs && node test/shared-session.mjs && node test/outbound-quote-and-images.mjs && node test/sticker-bracket-fallback.mjs && node test/dream-transcript-scope.mjs && node test/memory-date-context.mjs && node test/context-source-platform.mjs && node test/memory-source-label.mjs && node test/pending-delivery.mjs && node test/recall-window-78.mjs && node test/memory-recall-recent-78.mjs && node test/client-syntax.mjs && node test/diag-log.mjs && node test/check-rings.mjs && node test/release-workflow.mjs && node test/sticker-import-gif.mjs && node test/sticker-real-gif.mjs && node test/sticker-upload-binary.mjs && node test/sticker-vision-tags.mjs && node test/sticker-manual-tags.mjs && node test/sticker-auto-name.mjs && node test/self-update.mjs && node test/group-list.mjs && node test/douyin-inbox-noise.mjs && node test/douyin-inbox-diag.mjs && node test/douyin-inbox-stuck.mjs && node test/reply-window.mjs && node test/douyin-sticker-heuristic.mjs && node test/douyin-image-boundary.mjs && node test/media-image-boundary.mjs && node test/douyin-comment-identity-cid.mjs && node test/qq-mention-only-echo.mjs && node test/bili-panel-pagination.mjs && node test/bili-comment-link.mjs && node test/bili-comment-visibility.mjs && node test/bili-allowlist.mjs && node test/douyin-master-uid-mismatch.mjs && node test/vision-model.mjs && node test/image-inbound-fail.mjs && node test/group-backlog-images.mjs && node test/group-master-tag.mjs && node test/check-route-guard.mjs && node test/check-client-imports.mjs && node test/chat-archive-fts.mjs && node test/chat-search-tool.mjs && node test/memory-invalidate-kind.mjs && node test/mood-guard.mjs && node test/time-awareness.mjs && node test/tts-strip-emoji.mjs && node test/session-reset-route.mjs && node test/check-secrets.mjs && node test/check-secrets-nickname.mjs && node test/check-docs-freshness.mjs && node test/check-package-json-format.mjs && node test/wire-limits.mjs && node test/check-chromium-suites.mjs && node test/check-no-stash-scripts.mjs && node test/douyin-video-wire.mjs && node test/douyin-self-uid.mjs && node test/douyin-group-cursor.mjs && node test/douyin-dom-text.mjs && node test/video-gen.mjs && node test/scheduled-tasks.mjs && node test/scheduled-tasks-ui.mjs && node test/douyin-wave12-fixes.mjs && node test/prefetch-vec-await.mjs && node test/wave2-token-optimizations.mjs && node test/wave3-memory-retrieval.mjs && node test/rc5-token-inflation.mjs && node test/pending-surfaced-closure.mjs && node test/memory-digest-retry-239.mjs",
67
+ "test": "node test/check-test-chain.mjs && node test/check-release-version.mjs && node test/wire-helper.mjs && node test/marker-audit.mjs && node test/douyin-send.mjs && node test/douyin-mechanism.mjs && node test/douyin-route.mjs && node test/douyin-adapter.mjs && node test/douyin-contract.mjs && node test/memory-bulk-move.mjs && node test/safe-download.mjs && node test/douyin-exact-id.mjs && node test/douyin-pb-init.mjs && node test/douyin-conversation.mjs && node test/douyin-inbox.mjs && node test/douyin-quarantine.mjs && node test/douyin-send-target.mjs && node test/douyin-send-exclusive.mjs && node test/douyin-gap-dedupe.mjs && node test/douyin-message-id-dedupe.mjs && node test/douyin-push-poll-dedupe.mjs && node test/douyin-share-card-dedupe.mjs && node test/douyin-share-card-dom.mjs && node test/douyin-inline-share.mjs && node test/douyin-short-link.mjs && node test/douyin-inline-ledger.mjs && node test/douyin-group-chat.mjs && node test/douyin-group-read.mjs && node test/douyin-group-reply.mjs && node test/session-overflow-recycle.mjs && node test/douyin-read-fail-retry.mjs && node test/douyin-read-cache.mjs && node test/douyin-dm-media-conv.mjs && node test/douyin-meta-lines.mjs && node test/douyin-read-fail-retry-poll.mjs && node test/douyin-live-fails.mjs && node test/douyin-inbox-contract.mjs && node test/person-attribution.mjs && node test/memory-owner-reassign.mjs && node test/douyin-poll-and-timer-safety.mjs && node test/p2-limits.mjs && node test/resource-safety.mjs && node test/leftover-edge-cases.mjs && node test/douyin-master-person-merge.mjs && node test/douyin-master-uid.mjs && node test/douyin-identity-e2e.mjs && node test/douyin-note-upload-poll.mjs && node test/douyin-post-jobs.mjs && node test/douyin-video-post.mjs && node test/douyin-video-trigger.mjs && node test/douyin-video-driver.mjs && node test/retrieval-filtered-vectors.mjs && node test/security-boundaries.mjs && node test/douyin-cdp-cursor.mjs && node test/douyin-nav-timeout.mjs && node test/persona-isolation.mjs && node test/diary-topics-217.mjs && node test/smoke.mjs && node test/life-context-interaction.mjs && node test/life-clock-refresh.mjs && node test/browser-launch-early-exit.mjs && node test/douyin-browser.mjs && node test/douyin-crash-restore.mjs && node test/douyin-page-alive.mjs && node test/douyin-eval-timeout.mjs && node test/douyin-bridge-timeout.mjs && node test/douyin-goto-budget.mjs && node test/douyin-music.mjs && node test/douyin-ax-button.mjs && node test/startup-gate.mjs && node test/outbox.mjs && node test/import-coverage.mjs && node test/update-check.mjs && node test/issue-fixes.mjs && node test/import-resume.mjs && node test/maibot-extras.mjs && node test/slang-global.mjs && node test/worldinfo.mjs && node test/memory-bulk.mjs && node test/memory-tiers.mjs && node test/memory-weekly.mjs && node test/issue-98-self-archive.mjs && node test/issue-99-memory-order.mjs && node test/issue-115-memory-date.mjs && node test/issue-119-memory-page.mjs && node test/issue-125-memory-filter.mjs && node test/issue-78-diagnostic.mjs && node test/memory-storage.mjs && node test/memory-storage-restore.mjs && node test/backup-restore.mjs && node test/douyin-group.mjs && node test/review-fixes.mjs && node test/at-reads-video.mjs && node test/search-source.mjs && node test/followups.mjs && node test/detail-config.mjs && node test/qq-send-any-image.mjs && node test/qq-read-attachment.mjs && node test/qq-batch-window.mjs && node test/llm-roomy-budget.mjs && node test/llm-failure-backoff.mjs && node test/llm-budget-and-social-backoff.mjs && node test/comment-video.mjs && node test/frames.mjs && node test/face-name.mjs && node test/comment-reply.mjs && node test/chat-comment.mjs && node test/at-target.mjs && node test/quota-caps.mjs && node test/client-lint.mjs && node test/client-panels.mjs && node test/dsh-desktop.mjs && node test/group-mention-only.mjs && node test/qq-private-allowlist.mjs && node test/issue-59-interject.mjs && node test/issue-59-diagnose.mjs && node test/diag-douyin-running.mjs && node test/sticker-backfill.mjs && node test/issue-118-sticker-diagnostics.mjs && node test/sticker-manage.mjs && node test/bili-emotes.mjs && node test/qq-outbound-sanitize.mjs && node test/repeat-guard-cross-turn.mjs && node test/voice-paragraph-split.mjs && node test/voice-paragraph-split-wire.mjs && node test/person-delete.mjs && node test/qq-group-admin.mjs && node test/douyin-recovery.mjs && node test/session-preset.mjs && node test/qq-connect-error.mjs && node test/douyin-comment-bridge.mjs && node test/douyin-comment-write-unknown.mjs && node test/douyin-reply-verify-status.mjs && node test/bili-comment-emoji.mjs && node test/douyin-state-echo.mjs && node test/issue-75-proactive.mjs && node test/issue-76-capability.mjs && node test/douyin-http-browse.mjs && node test/douyin-verify-backoff.mjs && node test/douyin-digg-bridge.mjs && node test/memory-evidence-transcript.mjs && node test/chat-archive-default.mjs && node test/issue-113-desktop-archive.mjs && node test/dream-transcript-wire.mjs && node test/douyin-frames-collect.mjs && node test/master-qq-uin-rebind.mjs && node test/douyin-session-health.mjs && node test/douyin-delivered.mjs && node test/douyin-card-share.mjs && node test/douyin-push-drop.mjs && node test/douyin-stranger-dm.mjs && node test/douyin-uid-binding.mjs && node test/image-webp-fallback.mjs && node test/douyin-emoji-fallback.mjs && node test/douyin-panel-width-threshold.mjs && node test/douyin-emoji-panel-close.mjs && node test/relay-other-platform.mjs && node test/relay-to-friend.mjs && node test/relay-sender-id.mjs && node test/dsh-home-guard.mjs && node test/relay-config-route.mjs && node test/share-fallback.mjs && node test/share-quota-refund.mjs && node test/issue-101-voice-files.mjs && node test/voice-volcengine.mjs && node test/voice-minimax-dashscope.mjs && node test/bili-switch-persist.mjs && node test/cross-channel-context.mjs && node test/reply-target.mjs && node test/shared-session.mjs && node test/outbound-quote-and-images.mjs && node test/sticker-bracket-fallback.mjs && node test/dream-transcript-scope.mjs && node test/memory-date-context.mjs && node test/context-source-platform.mjs && node test/memory-source-label.mjs && node test/issue-239-maxtokens-wire.mjs && node test/issue-239-maxtokens.mjs && node test/pending-delivery.mjs && node test/recall-window-78.mjs && node test/memory-recall-recent-78.mjs && node test/client-syntax.mjs && node test/diag-log.mjs && node test/check-rings.mjs && node test/release-workflow.mjs && node test/sticker-import-gif.mjs && node test/sticker-real-gif.mjs && node test/sticker-upload-binary.mjs && node test/sticker-vision-tags.mjs && node test/sticker-manual-tags.mjs && node test/sticker-auto-name.mjs && node test/self-update.mjs && node test/group-list.mjs && node test/douyin-inbox-noise.mjs && node test/douyin-inbox-diag.mjs && node test/douyin-inbox-stuck.mjs && node test/reply-window.mjs && node test/douyin-sticker-heuristic.mjs && node test/douyin-image-boundary.mjs && node test/media-image-boundary.mjs && node test/douyin-comment-identity-cid.mjs && node test/qq-mention-only-echo.mjs && node test/bili-panel-pagination.mjs && node test/bili-comment-link.mjs && node test/bili-comment-visibility.mjs && node test/bili-allowlist.mjs && node test/douyin-master-uid-mismatch.mjs && node test/vision-model.mjs && node test/image-inbound-fail.mjs && node test/group-backlog-images.mjs && node test/group-master-tag.mjs && node test/check-route-guard.mjs && node test/check-client-imports.mjs && node test/chat-archive-fts.mjs && node test/chat-search-tool.mjs && node test/memory-invalidate-kind.mjs && node test/mood-guard.mjs && node test/time-awareness.mjs && node test/tts-strip-emoji.mjs && node test/session-reset-route.mjs && node test/check-secrets.mjs && node test/check-secrets-nickname.mjs && node test/check-docs-freshness.mjs && node test/check-package-json-format.mjs && node test/wire-limits.mjs && node test/check-chromium-suites.mjs && node test/check-no-stash-scripts.mjs && node test/douyin-video-wire.mjs && node test/douyin-self-uid.mjs && node test/douyin-group-cursor.mjs && node test/douyin-dom-text.mjs && node test/video-gen.mjs && node test/scheduled-tasks.mjs && node test/scheduled-tasks-ui.mjs && node test/douyin-wave12-fixes.mjs && node test/prefetch-vec-await.mjs && node test/wave2-token-optimizations.mjs && node test/wave3-memory-retrieval.mjs && node test/rc5-token-inflation.mjs && node test/pending-surfaced-closure.mjs && node test/memory-digest-retry-239.mjs && node test/issue-244-paragraph-split.mjs && node test/issue-244-cleanout-e2e.mjs",
68
68
  "test:douyin": "node test/parallel.mjs 4 --only douyin",
69
69
  "test:fast": "node test/parallel.mjs 4 --skip \"douyin|browser\"",
70
70
  "typecheck": "npx --yes -p typescript tsc -p tsconfig.check.json"