dsh-fish-soul 0.16.5 → 0.17.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让一个 QQ 小号背后有"同一个人":固定人格、按人记记忆、有自己的生活节奏、会主动开口;同一个"她"同时出现在 QQ、B站、抖音。
4
4
 
5
- DSH 插件(单角色 `feiyu`)。版本 **0.16.5**。
5
+ DSH 插件(单角色 `feiyu`)。版本 **0.17.0**。
6
6
 
7
7
  QQ 交流群:**1125962189**
8
8
 
@@ -57,7 +57,7 @@ dsh plugin --profile desktop add dsh-fish-soul
57
57
 
58
58
  如同时安装 `dsh-cixisound`,QQ 会话在宿主支持工具护栏且一轮只有一个已识别的说话人时,可通过 `sound_read` 分析本轮录音。受限会话只放行本轮路径和 `input` 参数,不开放通用文件访问;如果设置中已明确为主人或全部聊天放开宿主工具,则保持原有工具权限,`sound_read` 也可访问其他文件。需要已安装音频分析插件,安装后已有会话可能需要重开;原件格式不受该插件支持时不能保证分析成功。
59
59
 
60
- 「DSH 里鱼的会话生成本地语音」仅对鱼的已登记会话里直接打字、正常完成的回复生成 `voice-out` 本地文件,不向 QQ 发送;不在对话框内播放。沿用「说」的服务、字数和每天次数上限,未就绪或失败时文字回复不受影响,最多保留 30 个文件;本地文件可能包含私密内容。
60
+ 「DSH 里鱼的会话生成本地语音」仅对鱼的已登记会话里直接打字、正常完成的回复中,以 `[语音]` 开头的独立段落生成 `voice-out` 本地文件,不向 QQ 发送;不在对话框内播放。沿用「说」的服务、字数和每天次数上限,未就绪或失败时文字回复不受影响,最多保留 30 个文件;本地文件可能包含私密内容。
61
61
 
62
62
 
63
63
  | 路径 | 内容 |
@@ -184,4 +184,6 @@ MIT
184
184
 
185
185
  QQ 重发队列只重试明确未送达的消息。重发过程中如果程序中断,消息会标记为**状态未知**,不会自动重发;请先在 QQ 中核实,避免重复发送。断线期间队列降低检查频率,连接恢复后会立即尝试补发。
186
186
 
187
- 「聊天文本存档」**默认开启**(`chatArchive.enabled`,v0.15.25 起):会话列表**留空 = 记下所有会话**;只有填了会话 ID(如 `private:123`、`group:456`)才按白名单过滤。**不想要就在设置页关掉,或按会话删**。仅保存插件实际接入并写入聊天日志的文本,不包含附件、未被接入的消息或历史消息,不能保证平台聊天全量;历史请另行导入。文本单独存于未加密的本地数据库,可分会话查看或删除,默认保留 30 天、过期文本在插件运行期间清理;离线期间不会清理。缩短期限可能立即删除过期文本;用户自行制作的备份和复制件需要另行删除。
187
+ 「聊天文本存档」**默认开启**(`chatArchive.enabled`,v0.15.25 起):会话列表**留空 = 记下所有会话**;只有填了会话 ID(如 `private:123`、`group:456`)才按白名单过滤。**不想要就在设置页关掉,或按会话删**。仅保存插件实际接入的文本,包括在鱼的已绑定会话中通过 DSH 输入的文本及正常完成的回复;不包含附件、未被接入的消息或历史消息,不能保证平台聊天全量;历史请另行导入。文本单独存于未加密的本地数据库,可分会话查看或删除,默认保留 30 天、过期文本在插件运行期间清理;离线期间不会清理。缩短期限可能立即删除过期文本;用户自行制作的备份和复制件需要另行删除。
188
+
189
+ 记忆内容可在编辑时设置「事件日期」,仅调整列表排序,留空恢复按创建日期排序;不会修改创建时间或改变记忆检索、周记归档日期。JSON 导出会保留此日期。
@@ -472,6 +472,12 @@ export class Browser {
472
472
  if (msg.error) p.reject(new Error(msg.error.message || JSON.stringify(msg.error)))
473
473
  else p.resolve(msg.result)
474
474
  } else if (msg.method) {
475
+ // 原生确认框(beforeunload 的「是否离开网站?」,发布页 / 编辑器常见)会一直挡住页面:
476
+ // Page.navigate 的响应被它挂着,后续所有取页面状态的动作都跟着等,看起来就是「卡死不动」。
477
+ // 这里统一代点「确定」,把页面放走;真没人弹框也不会多做什么。
478
+ if (msg.method === 'Page.javascriptDialogOpening') {
479
+ this.send('Page.handleJavaScriptDialog', { accept: true }, msg.sessionId || this.sessionId).catch(() => {})
480
+ }
475
481
  // fish-soul:事件旁听(判断「用户自己把窗口 / 标签页关了」)
476
482
  if (typeof this.onEvent === 'function') { try { this.onEvent(msg) } catch { /* 上层出错不影响连接 */ } }
477
483
  // 🔴 每个事件带一个**单调递增的序号**(`seq`),调用方用它当游标。
@@ -537,14 +543,14 @@ export class Browser {
537
543
  })
538
544
  }
539
545
 
540
- send(method, params = {}, sessionId) {
546
+ send(method, params = {}, sessionId, timeoutMs = 60000) {
541
547
  return new Promise((resolve, reject) => {
542
548
  if (!this.ws || this.ws.readyState !== 1) return reject(new Error('CDP 连接已断'))
543
549
  const id = ++this.nextId
544
550
  const t = setTimeout(() => {
545
551
  this.pending.delete(id)
546
552
  reject(new Error(`CDP ${method} 超时`))
547
- }, 60000)
553
+ }, timeoutMs)
548
554
  this.pending.set(id, {
549
555
  resolve: (v) => { clearTimeout(t); resolve(v) },
550
556
  reject: (e) => { clearTimeout(t); reject(e) },
@@ -590,9 +596,14 @@ export class Browser {
590
596
  let lastHref = ''
591
597
  for (let attempt = 0; attempt <= retries; attempt++) {
592
598
  try {
593
- await this.send('Page.navigate', { url }, this.sessionId)
599
+ // 导航卡死时不能无限等:CDP 的 Page.navigate 要等对话框被处理才会回包,
600
+ // 对话框一旦没人点,这里会挂满 send() 默认的 60 秒才报错,重试也跟着等。
601
+ // 导航单独给 15 秒上限(超时由 send 自己清 pending 和计时器,不会空挂),
602
+ // 超时当这次失败,走下面的重试 / 报错。
603
+ await this.send('Page.navigate', { url }, this.sessionId, 15000)
594
604
  } catch (e) {
595
- if (attempt >= retries) throw new Error(`导航请求失败:${e.message}`)
605
+ const timedOut = /超时/.test(e.message)
606
+ if (attempt >= retries) throw new Error(timedOut ? '导航请求超时(15 秒):页面可能被原生确认框挡住' : `导航请求失败:${e.message}`)
596
607
  await sleep(800)
597
608
  continue
598
609
  }
@@ -211,7 +211,7 @@ window.__ModuleLoader__.load({
211
211
  on ? Group({ title: "语音文件" },
212
212
  Row({ title: "保存收到的 QQ 语音", desc: `仅保存需回复的好友私聊和明确白名单群语音,最多 30 条;未加密。目录:${v.incomingDir}。受限会话的 sound_read 仅能分析本轮单一说话人文件;已放开工具的会话保留原有权限。安装插件后可能需要重开会话。` }, h(Switch, { label: "保存收到的 QQ 语音", checked: v.saveIncoming === true, onChange: setIncoming })),
213
213
  Row({ title: "清理 QQ 语音", desc: v.filesError || `当前 ${v.incomingCount ?? 0} 条;不删除备份或复制件` }, Button({ onClick: clearIncoming }, "清空")),
214
- Row({ title: "DSH 里鱼的会话生成本地语音", desc: `使用「说」的服务与配额;不会发送 QQ。超字数或失败保留文字。最多保留 30 条,目录:${v.desktopDir}${v.desktopLatest ? `;最近:${v.desktopLatest}` : ""}` }, h(Switch, { label: "DSH 里鱼的会话生成本地语音", checked: v.desktopTts === true, onChange: (x) => save({ desktopTts: x }) }))) : null,
214
+ Row({ title: "DSH 里鱼的会话生成本地语音", desc: `仅将独立的 [语音] 段生成文件,使用「说」的服务与配额;不会发送 QQ。超字数或失败保留文字。最多保留 30 条,目录:${v.desktopDir}${v.desktopLatest ? `;最近:${v.desktopLatest}` : ""}` }, h(Switch, { label: "DSH 里鱼的会话生成本地语音", checked: v.desktopTts === true, onChange: (x) => save({ desktopTts: x }) }))) : null,
215
215
  on ? Group({ title: "听(语音转文字)", aside: sideState(stt, v.sttLeft) },
216
216
  Row({ title: "服务商", desc: "百炼和 MiniMax 的端点跟 OpenAI 不一样,选错了会一直「听不到」" }, h(Seg, { label: "听的服务商", value: form.sttProvider, options: STT_PROVIDERS, onChange: (x) => { patch({ sttProvider: x }); save({ sttProvider: x }); } })),
217
217
  Row({ title: "接口地址", desc: sttDash ? "阿里百炼填 https://dashscope.aliyuncs.com/compatible-mode/v1" : sttMini ? "MiniMax 填 https://api.minimax.cn/v1" : "" }, field("sttBaseURL", { placeholder: stt.effectiveBaseURL || "https://api.siliconflow.cn/v1", "aria-label": "听的接口地址" })),
@@ -34,7 +34,7 @@ window.__ModuleLoader__.load({
34
34
 
35
35
  // ── 一条记忆:点笔改,改内容 = 新写一条、旧的留档 ──
36
36
  function MemoryItem({ m, ui, api, notify, refresh, curGen, selectable, selected, onSelect }) {
37
- const { h, Tag, Dot, IconButton, Area, Num, Select, Button } = ui;
37
+ const { h, Tag, Dot, IconButton, Input, Area, Num, Select, Button } = ui;
38
38
  const [edit, setEdit] = react.useState(null);
39
39
  const [sources, setSources] = react.useState(null);
40
40
  const imp = m.importance ?? 1;
@@ -50,7 +50,7 @@ window.__ModuleLoader__.load({
50
50
  }
51
51
  async function save() {
52
52
  const importanceChanged = Number(edit.importance) !== (m.importance ?? 1);
53
- const r = await api("POST", "/inspector/memory-edit", { id: m.id, content: edit.content, kind: edit.kind, ...(importanceChanged ? { importance: Number(edit.importance) } : {}) });
53
+ const r = await api("POST", "/inspector/memory-edit", { id: m.id, content: edit.content, kind: edit.kind, sortDate: edit.sortDate || null, ...(importanceChanged ? { importance: Number(edit.importance) } : {}) });
54
54
  if (r?.ok) { setEdit(null); notify(r.replaced ? "已改(旧的留档了)" : "已保存"); refresh(); } else notify(r?.error ?? "保存失败");
55
55
  }
56
56
  if (edit !== null) {
@@ -59,6 +59,8 @@ window.__ModuleLoader__.load({
59
59
  h("div", { className: "fs-ctl" },
60
60
  Select({ value: edit.kind, "aria-label": "类型", onChange: (e) => setEdit({ ...edit, kind: e.target.value }) },
61
61
  ...Object.entries(KIND).filter(([k]) => k !== "weekly" && k !== "diary").map(([k, v]) => h("option", { key: k, value: k }, v))),
62
+ h("span", { className: "fs-unit" }, "事件日期"),
63
+ Input({ type: "date", value: edit.sortDate, "aria-label": "事件日期(留空按创建日期排序)", onChange: (e) => setEdit({ ...edit, sortDate: e.target.value }) }),
62
64
  h("span", { className: "fs-unit" }, "重要度"),
63
65
  Num({ min: 1, max: 5, value: edit.importance, "aria-label": "重要度", onChange: (e) => setEdit({ ...edit, importance: e.target.value }) }),
64
66
  h("span", { className: "fs-fill-gap" }),
@@ -76,9 +78,10 @@ window.__ModuleLoader__.load({
76
78
  m.visibility === "private" ? Tag("私密", "warning", { title: "私聊里说的,群里不会提" }) : null,
77
79
  m.about ? Tag(`关于 ${m.aboutName ?? m.about.replace(/^user:/, "")}`, "outline") : null,
78
80
  imp >= 2 ? h("span", { title: imp >= 3 ? "不会淡忘" : undefined }, "★".repeat(imp)) : null,
81
+ m.sortDate ? h("span", { title: "事件日期,仅用于列表排序" }, m.sortDate) : null,
79
82
  h("span", { title: origin }, m.source ?? ""),
80
83
  h("span", { title: vec[1], style: { display: "inline-flex" } }, Dot(vec[0])),
81
- m.kind === "weekly" ? Button({ variant: "ghost", onClick: async () => { if (sources) { setSources(null); return; } const r = await api("GET", `/memory/weekly/sources?summaryId=${m.id}`); if (r?.ok) setSources(r.sources); else notify(r?.error ?? "来源读取失败"); } }, sources ? "收起来源" : "查看来源") : IconButton("edit", "修改", () => setEdit({ content: m.content, importance: imp, kind: m.kind })),
84
+ m.kind === "weekly" ? Button({ variant: "ghost", onClick: async () => { if (sources) { setSources(null); return; } const r = await api("GET", `/memory/weekly/sources?summaryId=${m.id}`); if (r?.ok) setSources(r.sources); else notify(r?.error ?? "来源读取失败"); } }, sources ? "收起来源" : "查看来源") : IconButton("edit", "修改", () => setEdit({ content: m.content, importance: imp, kind: m.kind, sortDate: m.sortDate ?? "" })),
82
85
  IconButton("close", "删除", forget))),
83
86
  sources ? h("div", { className: "fs-item-sub" }, ...sources.map((x) => h("div", { key: x.id }, `#${x.id} · ${x.content}`))) : null);
84
87
  }
@@ -442,7 +445,7 @@ window.__ModuleLoader__.load({
442
445
  async function saveChat() {
443
446
  const channels=form.channels.split(/[,,\n]/).map(x=>x.trim()).filter(Boolean);
444
447
  if(Number(form.days)<chat.days && !(await confirm({ title: "缩短保留期限", description: "会立即清理已过期的本地聊天文本,备份和复制件不会同步清理。继续?", danger: true })))return;
445
- if(form.enabled && !(await confirm({ title: "启用聊天文本存档", description: "仅保存所列会话中插件接收到的文本,可能包含私密内容;文件未加密。附件和未接入的消息不会保存,历史消息无法补录。继续?" })))return;
448
+ if(form.enabled && !(await confirm({ title: "启用聊天文本存档", description: "保存选定会话中插件接入的聊天文本(包括在鱼会话的 DSH 窗口里输入和完成的回复),可能包含私密内容;文件未加密。附件和未接入的消息不会保存,历史消息无法补录。继续?" })))return;
446
449
  const r=await api("POST", "/chat-archive/config", {enabled:form.enabled,channels,days:Number(form.days)});
447
450
  if(r?.ok){setForm({enabled:r.enabled,channels:r.channels.join(", "),days:r.days});setItems(null);await loadChat();notify("聊天存档设置已保存");}else notify(r?.error??"保存失败");
448
451
  }
@@ -464,8 +467,8 @@ window.__ModuleLoader__.load({
464
467
  storage.files.length>5 ? Button({variant:"ghost",onClick:()=>setShowAllFiles(!showAllFiles)},showAllFiles ? "收起存档" : `显示全部 ${storage.files.length} 份`) : null,
465
468
  Row({title:"全部记忆记录",meta:"包括已归档和失效记录",stack:true},Input({className:"wide",value:historyQuery,placeholder:"搜索记忆", "aria-label":"搜索全部记忆",onChange:e=>setHistoryQuery(e.target.value)}),Button({onClick:()=>searchHistory(null)},"搜索")),
466
469
  history?h("div",{className:"fs-list"},...history.rows.map(x=>h("div",{className:"fs-row",key:x.id},h("span",{style:{overflowWrap:"anywhere"}},`#${x.id} · ${{active:"当前",archived:"已归档",outdated:"过时",superseded:"已替换"}[x.status] ?? x.status} · ${x.visibility === "private" ? "私密 · " : ""}${x.content}`))),history.next?Button({onClick:()=>searchHistory(history.next)},"加载更早"):null):null),
467
- Group({title:"聊天文本存档",tip:"默认关闭;仅保存选定会话中插件接收到的文本,不包括附件或全部平台消息"},
468
- Row({title:"启用",meta:"存在本机(文件权限仅本人可读,内容未加密),只从开启后记录、历史不补录;不想要随时关掉或删掉"},h(Switch,{label:"聊天文本存档",checked:form.enabled,onChange:v=>setForm({...form,enabled:v})})),
470
+ Group({title:"聊天文本存档",tip:"保存选定会话中插件接入的文本,包括鱼会话的 DSH 对话;不包括附件或全部平台消息"},
471
+ Row({title:"启用",meta:"包括鱼会话在 DSH 里的输入及正常完成的回复。存在本机(文件权限仅本人可读,内容未加密),只从开启后记录、历史不补录;不想要随时关掉或删掉"},h(Switch,{label:"聊天文本存档",checked:form.enabled,onChange:v=>setForm({...form,enabled:v})})),
469
472
  Row({title:"只记这些会话",meta:"留空 = 所有会话都记(推荐);填了就只记这些,多个 ID 用逗号分隔,例如 private:123、group:456",stack:true},Input({className:"wide",value:form.channels,"aria-label":"聊天存档会话 ID",onChange:e=>setForm({...form,channels:e.target.value})})),
470
473
  Row({title:"保留天数",meta:"过期文本按天清理;备份和复制件需另行清理"},Num({min:1,max:3650,value:form.days,"aria-label":"聊天存档保留天数",onChange:e=>setForm({...form,days:e.target.value})}),Button({onClick:saveChat},"保存")),
471
474
  Row({title:"已保存文本"},Muted(`${chat.count} 条`)),
package/lib/db.js CHANGED
@@ -205,6 +205,7 @@ const MIGRATIONS = [
205
205
  'ALTER TABLE memory ADD COLUMN last_recalled_at INTEGER',
206
206
  "ALTER TABLE memory ADD COLUMN importance_locked INTEGER NOT NULL DEFAULT 0",
207
207
  "ALTER TABLE memory ADD COLUMN importance_auto_recalled INTEGER NOT NULL DEFAULT 0",
208
+ 'ALTER TABLE memory ADD COLUMN sort_date TEXT',
208
209
  'CREATE INDEX IF NOT EXISTS idx_memory_about ON memory(character_id, about, status)',
209
210
  'CREATE INDEX IF NOT EXISTS idx_memory_superseded_by ON memory(superseded_by) WHERE superseded_by IS NOT NULL',
210
211
  // v0.8:好感度、上次结算时间、上一次来聊的时间(隔了 1 小时以上才算新的一次)、主人手动定的阶段不自动改
package/lib/diag-log.js CHANGED
@@ -90,14 +90,15 @@ export class DiagLog {
90
90
  add(key, detail = {}, level = 'info') {
91
91
  const at = this.now();
92
92
  const k = String(key);
93
- // 同一个 key 在窗口内重复:合并成一条 + count,别把缓冲冲干净
93
+ // 同一个 key 在窗口内重复:合并成一条 + count,别把缓冲冲干净。
94
+ // 不能只看队尾。两个会话交替打日志时,队尾一直是另一个 key,60 秒窗口会被拆开。
94
95
  const lastAt = this.lastKeyAt.get(k) ?? 0;
95
- if (at - lastAt < DEDUPE_MS && this.entries.length > 0) {
96
- const tail = this.entries[this.entries.length - 1];
97
- if (tail.key === k) {
98
- tail.count += 1;
99
- tail.at = at;
100
- tail.detail = detail;
96
+ if (at - lastAt < DEDUPE_MS) {
97
+ for (let i = this.entries.length - 1; i >= 0; i--) {
98
+ if (this.entries[i].key !== k) continue;
99
+ this.entries[i].count += 1;
100
+ this.entries[i].at = at;
101
+ this.entries[i].detail = detail;
101
102
  this.lastKeyAt.set(k, at);
102
103
  return;
103
104
  }
@@ -168,7 +168,7 @@ const MUSIC_DOM_JS = String.raw`
168
168
  `;
169
169
  const MUSIC_OPEN_JS = `(() => { ${MUSIC_DOM_JS} return Boolean(panel); })()`;
170
170
  const MUSIC_ROWS_JS = `(() => { ${MUSIC_DOM_JS}
171
- return [...new Set(rows.map(nameOf).filter(Boolean))].slice(0, 10);
171
+ return rows.map(nameOf).map(s => String(s || '').trim()).filter(Boolean).slice(0, 20);
172
172
  })()`;
173
173
  const MUSIC_TAB_JS = `(() => { ${MUSIC_DOM_JS}
174
174
  if (!panel) return false;
@@ -259,7 +259,9 @@ async function grabRecommendedMusic(br) {
259
259
  return Array.isArray(list) && list.length ? list : null;
260
260
  }, { tries: 12, gapMs: 800 });
261
261
  if (!songs) return { ok: false, error: '音乐面板没有加载出推荐歌曲' };
262
- return { ok: true, songs };
262
+ const counts = {};
263
+ for (const name of songs) counts[name] = (counts[name] ?? 0) + 1;
264
+ return { ok: true, songs: [...new Set(songs)].slice(0, 10), counts };
263
265
  }
264
266
 
265
267
  /** 关掉音乐面板,避免失败后影响下一次操作。 */
@@ -278,22 +280,27 @@ async function shutMusicPanel(br) {
278
280
  })()`).catch(() => false);
279
281
  }
280
282
 
281
- /** 仅点击匹配歌曲卡片内的「使用」,并在编辑区确认歌名后才允许发布。 */
282
- async function pickNoteMusic(br, music) {
283
+ /** 仅点击匹配歌曲卡片内的「使用」,并在编辑区确认歌名后才允许发布。
284
+ * allowDuplicate:推荐里同名卡不止一张时点第一张。编辑页仍要确认歌名,确认不了就不发布。 */
285
+ async function pickNoteMusic(br, music, { allowDuplicate = false } = {}) {
283
286
  if (!music) return { ok: false, error: '模型没有选出推荐歌曲' };
284
287
  try {
285
288
  const card = await br.eval(`(() => { ${MUSIC_DOM_JS}
286
289
  const matches = rows.filter(row => nameOf(row) === ${JSON.stringify(music)});
287
- if (matches.length !== 1) return { count: matches.length };
288
- matches[0].scrollIntoView({ block: 'center' });
289
- const r = matches[0].getBoundingClientRect();
290
- return { count: 1, x: Math.round(r.left + r.width / 2), y: Math.round(r.top + r.height / 2) };
290
+ if (!matches.length) return { count: 0 };
291
+ const target = matches.length === 1 || ${allowDuplicate ? 'true' : 'false'} ? matches[0] : null;
292
+ if (!target) return { count: matches.length };
293
+ target.scrollIntoView({ block: 'center' });
294
+ const r = target.getBoundingClientRect();
295
+ return { count: matches.length, x: Math.round(r.left + r.width / 2), y: Math.round(r.top + r.height / 2) };
291
296
  })()`);
292
- if (card?.count !== 1) return { ok: false, error: card?.count ? '推荐列表里有同名歌曲,无法确定选哪首' : '选中的歌曲已不在推荐列表' };
297
+ if (!card?.count) return { ok: false, error: '选中的歌曲已不在推荐列表' };
298
+ // 同名(剪辑版 / 合集版)不整单作废。点第一张,后面仍要编辑页确认歌名。
299
+ if (card.count !== 1 && !allowDuplicate) return { ok: false, error: '推荐列表里有同名歌曲,无法确定选哪首' };
293
300
  await br.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: card.x, y: card.y }, br.sessionId);
294
301
  const btn = await waitFor(() => br.eval(`(() => { ${MUSIC_DOM_JS}
295
302
  const matches = rows.filter(row => nameOf(row) === ${JSON.stringify(music)});
296
- if (matches.length !== 1) return null;
303
+ if (!matches.length || (matches.length !== 1 && !${allowDuplicate ? 'true' : 'false'})) return null;
297
304
  const b = [...matches[0].querySelectorAll('button, [class*="apply-btn"]')].find(x => /^(使用(歌曲)?|配乐|选它)$/.test((x.innerText || '').trim()) && visible(x));
298
305
  if (!b) return null;
299
306
  const r = b.getBoundingClientRect();
@@ -385,9 +392,9 @@ export function douyinSocialDriver(host) {
385
392
  async closeMusicPanel() { await shutMusicPanel(b()); },
386
393
 
387
394
  /** 配乐确认成功后才能点发布。 */
388
- async publishNote({ music, beforeSubmit }) {
395
+ async publishNote({ music, beforeSubmit, allowDuplicate = false }) {
389
396
  const br = b();
390
- const picked = await pickNoteMusic(br, String(music ?? ''));
397
+ const picked = await pickNoteMusic(br, String(music ?? ''), { allowDuplicate });
391
398
  if (!picked.ok) return { ok: false, code: 'MUSIC_FAILED', error: `配乐失败,未发布:${picked.error}` };
392
399
  if (beforeSubmit) await beforeSubmit(); // 在可能产生平台副作用之前持久化
393
400
  const clicked = await br.eval(String.raw`(() => {
@@ -718,10 +725,11 @@ export class DouyinSocial extends SocialBase {
718
725
  try {
719
726
  const list = await this.driver.listRecommendedMusic();
720
727
  if (!list?.ok) return { ok: false, error: `配乐失败,未发布:${list?.error ?? '无法读取推荐歌曲'}` };
721
- song = await this.chooseMusic(text, list.songs);
728
+ const choice = await this.chooseMusic(text, list.songs, list.counts);
729
+ song = choice.song;
722
730
  if (!song) return { ok: false, error: '配乐失败,未发布:模型没有选出推荐歌曲' };
723
731
  this.postJobs.prepared(jobId, file, song);
724
- return await this.driver.publishNote({ music: song, beforeSubmit: () => this.postJobs.submitting(jobId) });
732
+ return await this.driver.publishNote({ music: song, allowDuplicate: choice.duplicate, beforeSubmit: () => this.postJobs.submitting(jobId) });
725
733
  } finally {
726
734
  // 自定义 driver(testHooks.douyinSocial)可能没这个方法;它挂在 finally 里,
727
735
  // 抛出去会盖掉真正的失败原因。
@@ -737,14 +745,16 @@ export class DouyinSocial extends SocialBase {
737
745
  return '';
738
746
  }
739
747
 
740
- /** 从抖音推荐的歌里挑一首配这条图文;挑不出来返回空。 */
741
- async chooseMusic(text, songs) {
742
- const list = (Array.isArray(songs) ? songs : []).map((s) => String(s ?? '').trim()).filter(Boolean).slice(0, 10);
743
- if (!list.length) return '';
748
+ /** 从抖音推荐的歌里挑一首。挑不出来 song 为空。duplicate 表示这个名字在推荐里不止一张卡。 */
749
+ async chooseMusic(text, songs, counts = null) {
750
+ const names = (Array.isArray(songs) ? songs : []).map((s) => String(s ?? '').trim()).filter(Boolean);
751
+ const list = [...new Set(names)].slice(0, 10);
752
+ if (!list.length) return { song: '', duplicate: false };
744
753
  try {
745
754
  const raw = String((await this.callLlm(`给这条抖音图文配背景音乐。从下面这些抖音推荐歌里挑一首最适合的(歌名原样照抄),不适合就回空串。\n\n图文正文:\n${text}\n\n推荐歌:\n${list.map((s) => `- ${s}`).join('\n')}\n\n只输出歌名,不要别的。`)) ?? '').trim();
746
- const picked = pickRecommendedSong(raw, list);
747
- return picked;
755
+ const song = pickRecommendedSong(raw, list);
756
+ const n = counts && typeof counts === 'object' ? Number(counts[song]) || 0 : names.filter((s) => s === song).length;
757
+ return { song, duplicate: song !== '' && n > 1 };
748
758
  } catch { throw new Error('配乐失败,未发布:模型选歌调用出错'); }
749
759
  }
750
760
 
package/lib/gateway.js CHANGED
@@ -1731,6 +1731,10 @@ export class ChatGateway {
1731
1731
  if (st.fromUs) this.note('failed', { channelId: st.channelId ?? this.bound.get(sessionId)?.channel_id ?? '', reason: `这一轮没正常结束(${d.reason?.kind ?? '未知'})` });
1732
1732
  // #78:DSH 桌面端打字的轮次不外发,但**要记动态** —— 以前在 DSH 里聊,动态页整片空白。
1733
1733
  if (st.dshTyped === true) {
1734
+ if (completed && st.text && this.bound.get(sessionId)?.channel_id) {
1735
+ try { this.soul.archiveDesktop?.(this.bound.get(sessionId).channel_id, st.text); }
1736
+ catch { this.log('warn', '[fish-soul] DSH 回复存档失败,聊天继续'); }
1737
+ }
1734
1738
  if (completed && this.getConfig?.()?.voice?.desktopTts === true && this.voice?.readyFor('tts')) void this.saveDesktopVoice(st.text);
1735
1739
  const recall = this.soul.recallInfo?.(sessionId, st) ?? { memories: [], at: 0, unknown: false };
1736
1740
  this.note('dsh', {
@@ -1756,14 +1760,19 @@ export class ChatGateway {
1756
1760
  }
1757
1761
  }
1758
1762
 
1759
- /** DSH 内回复只生成本地文件;失败不影响文字,也不经 QQ 出站。 */
1763
+ /** DSH 内只合成独立的 [语音] 段,不经 QQ 出站。 */
1760
1764
  async saveDesktopVoice(text) {
1761
1765
  try {
1762
- const plain = String(text ?? '').trim().replace(/^\s*\[语音\]\s*/, '');
1763
- if (!plain || SILENT_RE.test(plain)) return;
1764
- const bytes = await this.voice.synthesize(plain);
1765
- if (bytes && this.getConfig?.()?.voice?.desktopTts === true && this.getConfig?.()?.voice?.enabled === true) saveVoiceFile('out', bytes);
1766
- else this.log('warn', `[fish-soul] DSH 语音未生成:${this.voice.lastError || '文字超长、配额不足或配置未就绪'}`);
1766
+ const raw = String(text ?? '').trim();
1767
+ if (!raw || SILENT_RE.test(raw)) return;
1768
+ for (const p of raw.split(/\n{2,}/)) {
1769
+ if (!VOICE_RE.test(p)) continue;
1770
+ const plain = 抠正文图(p.replace(VOICE_RE, '')).净文字.trim();
1771
+ if (!plain || this.getConfig?.()?.voice?.desktopTts !== true || this.getConfig?.()?.voice?.enabled !== true) continue;
1772
+ const bytes = await this.voice.synthesize(plain);
1773
+ if (bytes && this.getConfig?.()?.voice?.desktopTts === true && this.getConfig?.()?.voice?.enabled === true) saveVoiceFile('out', bytes);
1774
+ else this.log('warn', `[fish-soul] DSH 语音未生成:${this.voice.lastError || '文字超长、配额不足或配置未就绪'}`);
1775
+ }
1767
1776
  } catch (error) { this.log('warn', `[fish-soul] DSH 语音保存失败:${String(error instanceof Error ? error.message : error)}`); }
1768
1777
  }
1769
1778
 
package/lib/importer.js CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { tokenizeForBm25 } from './segment.js';
8
8
  import { randomCanonicalId } from './db.js';
9
+ import { isCalendarDate } from './time-util.js';
9
10
 
10
11
  const KINDS = new Set(['fact', 'event', 'feeling', 'episode', 'diary']);
11
12
 
@@ -38,8 +39,8 @@ export function importMemories({ db, clock, worker, items, dryRun = false, maste
38
39
  `);
39
40
  const insert = db.prepare(`
40
41
  INSERT INTO memory (character_id, owner_id, channel, channel_id, kind, content, keywords,
41
- importance, emotion, source_session, created_at, updated_at, status, visibility, about)
42
- VALUES ('feiyu', ?, ?, ?, ?, ?, ?, ?, ?, 'import', ?, ?, 'active', ?, ?)
42
+ importance, emotion, source_session, created_at, updated_at, status, visibility, about, sort_date)
43
+ VALUES ('feiyu', ?, ?, ?, ?, ?, ?, ?, ?, 'import', ?, ?, 'active', ?, ?, ?)
43
44
  `);
44
45
  const queued = [];
45
46
  db.exec('BEGIN');
@@ -62,7 +63,7 @@ export function importMemories({ db, clock, worker, items, dryRun = false, maste
62
63
  const channelId = String(it.channelId ?? it.channel_id ?? (qq !== '' ? `private:${qq}` : ''));
63
64
  if (!dryRun) {
64
65
  const r = insert.run(ownerId, channel, channelId, kind, content, tokenizeForBm25(content),
65
- importance, emotion, createdAt, createdAt, it.visibility === 'private' ? 'private' : 'normal', typeof it.about === 'string' && it.about ? it.about : null);
66
+ importance, emotion, createdAt, createdAt, it.visibility === 'private' ? 'private' : 'normal', typeof it.about === 'string' && it.about ? it.about : null, isCalendarDate(it.sortDate) ? it.sortDate : null);
66
67
  queued.push([Number(r.lastInsertRowid), content]);
67
68
  }
68
69
  report.inserted += 1;
package/lib/index.js CHANGED
@@ -500,7 +500,7 @@ async function startup(ctx, config, { log, gate }) {
500
500
  }
501
501
 
502
502
  /** 网关在把一批 QQ 消息 / 主动触发递进会话之前调用:登记本轮说话人、预取向量、取到期约定。 */
503
- function beginTurn(sessionId, { channel: ch, channelId, replyChannel, speakers, workspacePath, backlog = [], interject = false, voiceIn = false, proactive = false }) {
503
+ function beginTurn(sessionId, { channel: ch, channelId, replyChannel, speakers, workspacePath, backlog = [], interject = false, voiceIn = false, proactive = false, desktop = false }) {
504
504
  const recentLines = journal.recent(channelId, 4);
505
505
  const sp = (speakers ?? []).map((s) => ({
506
506
  ownerId: ownerOf(s.person), person: s.person ?? null, userId: String(s.userId ?? ''),
@@ -525,7 +525,7 @@ async function startup(ctx, config, { log, gate }) {
525
525
  // 只有「回复规则」按它给;记忆 / 聊天日志 / 认人仍然按 channelId(话是在哪儿说的就记在哪儿)。
526
526
  sessions.set(String(sessionId), {
527
527
  channel: ch, channelId, replyChannel: replyChannel || channelId, speakers: sp, dueReasons, workspacePath: workspacePath ?? '',
528
- atReal: Date.now(), backlog, interject, voiceIn, recalled: [], recentLines,
528
+ atReal: Date.now(), backlog, interject, voiceIn, desktop, recalled: [], recentLines,
529
529
  // 动态页据此区分「瞬态块没跑」「认不出说话人」「跑了但没召回到」—— 空着的时候看不出来是哪一种(#78)
530
530
  recalledAt: 0,
531
531
  speakerUnknown: sp.length > 0 && sp.every((x) => x.ownerId === UNKNOWN_OWNER)
@@ -687,6 +687,10 @@ async function startup(ctx, config, { log, gate }) {
687
687
  function buildContextBlock(arg) {
688
688
  const session = sessionFor(arg?.agent?.id ?? arg?.scope?.id ?? arg?.sessionId);
689
689
  const lines = [stateLine()];
690
+ const desktopTurn = session?.desktop === true;
691
+ if (desktopTurn && currentConfig.voice?.desktopTts === true && voice.readyFor('tts')) {
692
+ lines.push('[DSH 本地语音] 要用语音说的话单独一段、开头写 [语音],不要带表情或链接;只生成本地文件,不会发到 QQ。');
693
+ }
690
694
  if (session === undefined) return lines.join('\n');
691
695
  // 这一轮确实组了瞬态块(动态页拿它区分「没跑」和「跑了但没召回到」,#78)
692
696
  // 🔴 同时记到这一轮的 turn state 上:sendReply 在 turn/end 之后才跑,
@@ -796,7 +800,7 @@ async function startup(ctx, config, { log, gate }) {
796
800
  const loreMsgs = loreDepth > (session.recentLines ?? []).length && session.channelId ? journal.recent(session.channelId, loreDepth) : (session.recentLines ?? []);
797
801
  const lore = matchLore(loreEntries, [...loreMsgs, ...speakers.map((s) => s.query)], loreCfg);
798
802
  if (lore.length > 0) lines.push('[设定补充]', ...lore.map((e) => `- ${applyMacros(e.content, { charName: persona.name, userName })}`));
799
- if (replyIsQq) {
803
+ if (replyIsQq && !desktopTurn) {
800
804
  const images = gateway?.listImages(session.workspacePath) ?? [];
801
805
  lines.push('[QQ 回复规则] 你的最后一条回复会原样发到 QQ' +
802
806
  (replyWhere === 'qq-group'
@@ -832,7 +836,7 @@ async function startup(ctx, config, { log, gate }) {
832
836
  lines.push('[上网] 现在不能上网查,不知道的就直说不知道。');
833
837
  }
834
838
  }
835
- if (replyIsBili || replyIsDouyin) {
839
+ if ((replyIsBili || replyIsDouyin) && !desktopTurn) {
836
840
  lines.push(...voiceLines({ v: voiceConfig(currentConfig.voice, currentConfig.embedding), session, speakers, where: replyIsBili ? 'B站' : '抖音', relay: Boolean(gateway?.voiceRelayTarget(session.channelId)) }));
837
841
  // webp 表情包要转格式才能发:没有转换器(sharp / 抖音浏览器)就不给模型看
838
842
  // 清单带标签(`兔子OK.gif(可以可以、认同)`):光给文件名她只能瞎猜哪张合适
@@ -944,7 +948,8 @@ async function startup(ctx, config, { log, gate }) {
944
948
  channel: ours ? sessionChannelOf(boundChannel) : (person === null ? 'dsh' : (groupId != null ? 'qq-group' : 'qq-private')),
945
949
  channelId: ours ? boundChannel : (person === null ? '' : (groupId != null ? `group:${groupId}` : `private:${qqUin}`)),
946
950
  speakers: [{ person, userId: qqUin, displayName: person?.display_name ?? (ours ? '主人' : '对方'), text: messageText(message) }],
947
- workspacePath: ours ? (gateway?.chatForSession(agentId)?.workspace_path ?? '') : ''
951
+ workspacePath: ours ? (gateway?.chatForSession(agentId)?.workspace_path ?? '') : '',
952
+ desktop: ours && source.kind === 'user'
948
953
  });
949
954
  // #41:别的插件把自己的 QQ 消息转进它建的会话 —— 那个会话不走我们的 create/resume,人格卡没挂上。
950
955
  // 认出身份后(有人说话)用宿主给的 `agent.ctx` 补挂,仍然只对这一个 agent 生效,不碰全局。
@@ -1049,6 +1054,8 @@ async function startup(ctx, config, { log, gate }) {
1049
1054
  judgeMood: (person, who, text, channelId) => judgeMood(ownerOf(person), who, text, channelId),
1050
1055
  /** 她发出去的话也进聊天日志(聊完整理时知道她说了什么)。#75:主动开口那轮标一下,整理时不当既成事实。 */
1051
1056
  journalOut: (channelId, text, meta) => journal.add(channelId, { who: persona.name, ownerId: meta?.ownerId ?? null, self: true, text, proactive: meta?.proactive === true }),
1057
+ // DSH 回复只补进文本存档;不伪装成发往 QQ 的消息或改写现有记忆整理流程。
1058
+ archiveDesktop: (channelId, text) => chatArchive.add(channelId, { who: persona.name, self: true, text }),
1052
1059
  /**
1053
1060
  * 这一轮瞬态块里召回了哪些记忆("动态"里显示"她想起了什么")。
1054
1061
  *
@@ -12,7 +12,7 @@ import { platformOf } from './gateway.js';
12
12
  import { STAGES, PROFILE_FIELDS, stageBase, effectiveAffinity, getMood, mergeProfileFields, digestConfig } from './soul-memory.js';
13
13
 
14
14
  import { bulkMemory } from './memory-bulk.js';
15
- import { dateCompact } from './time-util.js';
15
+ import { dateCompact, isCalendarDate } from './time-util.js';
16
16
 
17
17
  const KINDS = ['fact', 'event', 'feeling', 'episode'];
18
18
  const IMPORT_BODY_MAX = 40 * 1024 * 1024;
@@ -22,7 +22,7 @@ const ownerToCanonical = (ownerId) => String(ownerId ?? '').replace(/^user:/, ''
22
22
  function memoryView(m) {
23
23
  return {
24
24
  id: m.id, ownerId: m.owner_id, channel: m.channel, channelId: m.channel_id, kind: m.kind, content: m.content,
25
- importance: m.importance, importanceLocked: m.importance_locked === 1, importanceAutoRecalled: m.importance_auto_recalled === 1, emotion: m.emotion, createdAt: m.created_at, updatedAt: m.updated_at, status: m.status,
25
+ importance: m.importance, importanceLocked: m.importance_locked === 1, importanceAutoRecalled: m.importance_auto_recalled === 1, emotion: m.emotion, createdAt: m.created_at, sortDate: m.sort_date ?? null, updatedAt: m.updated_at, status: m.status,
26
26
  supersededBy: m.superseded_by ?? null, evidence: m.evidence ?? '', source: sourceLabel(m.source_session, m.channel),
27
27
  visibility: m.visibility ?? 'normal', about: m.about ?? null
28
28
  };
@@ -268,8 +268,10 @@ export async function handleSoulRoute({ method, path, url, req, res, send, readB
268
268
  const kind = KINDS.includes(b.kind) ? b.kind : m.kind;
269
269
  const importance = b.importance === undefined ? m.importance : Math.min(5, Math.max(1, Math.round(Number(b.importance)) || 1));
270
270
  const now = clock.now();
271
+ const sortDate = b.sortDate === undefined ? m.sort_date : b.sortDate;
272
+ if (sortDate !== null && !isCalendarDate(sortDate)) { send(200, { ok: false, error: '日期无效' }); return true; }
271
273
  if (content === m.content) {
272
- db.prepare('UPDATE memory SET kind = ?, importance = ?, importance_locked = CASE WHEN ? THEN 1 ELSE importance_locked END, importance_auto_recalled = CASE WHEN ? THEN 0 ELSE importance_auto_recalled END, updated_at = ? WHERE id = ?').run(kind, importance, b.importance !== undefined ? 1 : 0, b.importance !== undefined ? 1 : 0, now, id);
274
+ db.prepare('UPDATE memory SET kind = ?, importance = ?, importance_locked = CASE WHEN ? THEN 1 ELSE importance_locked END, importance_auto_recalled = CASE WHEN ? THEN 0 ELSE importance_auto_recalled END, sort_date = ?, updated_at = ? WHERE id = ?').run(kind, importance, b.importance !== undefined ? 1 : 0, b.importance !== undefined ? 1 : 0, sortDate, now, id);
273
275
  send(200, { ok: true, id });
274
276
  return true;
275
277
  }
@@ -279,10 +281,10 @@ export async function handleSoulRoute({ method, path, url, req, res, send, readB
279
281
  try {
280
282
  const r = db.prepare(`
281
283
  INSERT INTO memory (character_id, owner_id, channel, channel_id, kind, content, keywords, importance, emotion,
282
- source_session, created_at, updated_at, status, evidence, visibility, about, importance_locked)
283
- VALUES ('feiyu', ?, ?, ?, ?, ?, ?, ?, ?, 'manual', ?, ?, 'active', ?, ?, ?, ?)
284
+ source_session, created_at, updated_at, status, evidence, visibility, about, importance_locked, sort_date)
285
+ VALUES ('feiyu', ?, ?, ?, ?, ?, ?, ?, ?, 'manual', ?, ?, 'active', ?, ?, ?, ?, ?)
284
286
  `).run(m.owner_id, m.channel, m.channel_id, kind, content, tokenizeForBm25(content), importance, m.emotion, m.created_at, now,
285
- `主人在设置页改过(原来是:${m.content.slice(0, 120)})`, m.visibility ?? 'normal', m.about ?? null, b.importance !== undefined ? 1 : Number(m.importance_locked ?? 0));
287
+ `主人在设置页改过(原来是:${m.content.slice(0, 120)})`, m.visibility ?? 'normal', m.about ?? null, b.importance !== undefined ? 1 : Number(m.importance_locked ?? 0), sortDate);
286
288
  newId = Number(r.lastInsertRowid);
287
289
  db.prepare("UPDATE memory SET status = 'superseded', valid_to = ?, superseded_by = ?, updated_at = ? WHERE id = ?").run(now, newId, now, id);
288
290
  db.prepare('DELETE FROM vec WHERE memory_id = ?').run(id);
@@ -409,7 +411,7 @@ export async function handleSoulRoute({ method, path, url, req, res, send, readB
409
411
  const items = rows.map((m) => ({
410
412
  ownerId: m.owner_id, ...(m.qq_uin ? { qqUin: m.qq_uin } : {}), ...(m.display_name ? { nickname: m.display_name } : {}),
411
413
  content: m.content, kind: m.kind, importance: m.importance, emotion: m.emotion, channel: m.channel, channelId: m.channel_id,
412
- createdAt: m.created_at, visibility: m.visibility, ...(m.about ? { about: m.about } : {}), ...(m.evidence ? { evidence: m.evidence } : {})
414
+ createdAt: m.created_at, ...(m.sort_date ? { sortDate: m.sort_date } : {}), visibility: m.visibility, ...(m.about ? { about: m.about } : {}), ...(m.evidence ? { evidence: m.evidence } : {})
413
415
  }));
414
416
  const name = `fish-soul-memories-${dateCompact()}.json`;
415
417
  res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'content-disposition': `attachment; filename="${name}"` });
package/lib/routes.js CHANGED
@@ -405,7 +405,7 @@ export function registerRoutes(ctx, deps) {
405
405
  );
406
406
  // 同一创建时间的记忆按最早版本的 id 排序:编辑会新建 id,不能因此换位置。
407
407
  // UNION 防止旧数据中的异常环造成递归不结束;索引支持按 superseded_by 反查。
408
- const memRows = db.prepare(`SELECT * FROM memory WHERE ${listFilter.sql} ORDER BY created_at DESC,
408
+ const memRows = db.prepare(`SELECT * FROM memory WHERE ${listFilter.sql} ORDER BY COALESCE(sort_date, date(created_at / 1000, 'unixepoch', 'localtime')) DESC, created_at DESC,
409
409
  (WITH RECURSIVE ancestors(id) AS (
410
410
  SELECT memory.id UNION SELECT old.id FROM memory old JOIN ancestors a ON old.superseded_by = a.id
411
411
  ) SELECT MIN(id) FROM ancestors) ASC, id ASC LIMIT ${listLimit}`).all(...listFilter.params);
@@ -443,7 +443,7 @@ export function registerRoutes(ctx, deps) {
443
443
  importance: m.importance, importanceLocked: m.importance_locked === 1, importanceAutoRecalled: m.importance_auto_recalled === 1, emotion: m.emotion,
444
444
  evidence: m.evidence ?? '', source: sourceLabel(m.source_session, m.channel),
445
445
  decayExempt: m.importance >= 3,
446
- createdAt: m.created_at, visibility: m.visibility ?? 'normal', about: m.about ?? null, recallCount: m.recall_count ?? 0,
446
+ createdAt: m.created_at, sortDate: m.sort_date ?? null, visibility: m.visibility ?? 'normal', about: m.about ?? null, recallCount: m.recall_count ?? 0,
447
447
  vecStatus: vg === null ? 'unvectorized_compensated' : (vg === gen ? 'vectorized' : 'stale'),
448
448
  vecGenerationId: vg
449
449
  };
package/lib/time-util.js CHANGED
@@ -23,3 +23,10 @@ export function stampLocal(ms) {
23
23
  export function dateCompact(d = new Date()) {
24
24
  return `${d.getFullYear()}${pad2(d.getMonth() + 1)}${pad2(d.getDate())}`;
25
25
  }
26
+
27
+ /** 严格校验日期,避免 SQLite 接受不存在的日历日期。 */
28
+ export function isCalendarDate(value) {
29
+ if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
30
+ const date = new Date(`${value}T00:00:00.000Z`);
31
+ return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-fish-soul",
3
- "version": "0.16.5",
3
+ "version": "0.17.0",
4
4
  "description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记、每周记忆存档与可选周记(DSH 插件,单角色 feiyu ,v0.15.37)",
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/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-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-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-post-jobs.mjs && node test/retrieval-filtered-vectors.mjs && node test/security-boundaries.mjs && node test/douyin-cdp-cursor.mjs && node test/persona-isolation.mjs && node test/smoke.mjs && node test/douyin-browser.mjs && node test/douyin-music.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/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-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/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/issue-59-interject.mjs && node test/issue-59-diagnose.mjs && node test/sticker-backfill.mjs && node test/sticker-manage.mjs && node test/bili-emotes.mjs && node test/qq-outbound-sanitize.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/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/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/relay-other-platform.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/memory-source-label.mjs && node test/pending-delivery.mjs && node test/recall-window-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",
67
+ "test": "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-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-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-post-jobs.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/smoke.mjs && node test/douyin-browser.mjs && node test/douyin-music.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/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-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/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/issue-59-interject.mjs && node test/issue-59-diagnose.mjs && node test/sticker-backfill.mjs && node test/sticker-manage.mjs && node test/bili-emotes.mjs && node test/qq-outbound-sanitize.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/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/relay-other-platform.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/memory-source-label.mjs && node test/pending-delivery.mjs && node test/recall-window-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",
68
68
  "eval": "node test/eval/persona-eval.mjs"
69
69
  }
70
70
  }