dsh-fish-soul 0.18.10 → 0.18.11
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 +1 -1
- package/lib/behavior.js +2 -1
- package/lib/chat-archive-fts.js +92 -0
- package/lib/chat-archive.js +32 -3
- package/lib/client.soul.js +12 -3
- package/lib/db.js +8 -1
- package/lib/index.js +32 -0
- package/lib/life.js +24 -5
- package/lib/mood-guard.js +69 -0
- package/lib/routes-soul.js +4 -0
- package/lib/soul-memory.js +21 -4
- package/package.json +3 -3
package/README.md
CHANGED
package/lib/behavior.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { getKv, setKv } from './db.js';
|
|
13
13
|
import { segmentsToText, sanitizeName } from './channels/onebot.js';
|
|
14
14
|
import { insertMemory, getMood, setMood, relTime } from './soul-memory.js';
|
|
15
|
+
import { MOOD_STATE_GUARD } from './mood-guard.js';
|
|
15
16
|
import { recallSync, vectorRanks, excludedMemories } from './retrieval.js';
|
|
16
17
|
|
|
17
18
|
const num = (x, d, lo, hi) => { const n = Number(x); return Number.isFinite(n) ? Math.min(hi, Math.max(lo, n)) : d; };
|
|
@@ -767,7 +768,7 @@ export function behaviorLines({ db, getConfig, session, known, tone, now, diary,
|
|
|
767
768
|
const last = known[known.length - 1];
|
|
768
769
|
const p = moodProfile({ tone, mood: last ? getMood(db, last.ownerId, now) : null });
|
|
769
770
|
const own = moodStyle(moods, p);
|
|
770
|
-
if (p.hint) out.push(`[你现在的状态] ${p.hint}——体现在回复的快慢、长短和语气上,别直接说出来。${own ? `${own}。` : ''}`);
|
|
771
|
+
if (p.hint) out.push(`[你现在的状态] ${p.hint}——体现在回复的快慢、长短和语气上,别直接说出来。${own ? `${own}。` : ''}${MOOD_STATE_GUARD}`);
|
|
771
772
|
}
|
|
772
773
|
// 去 AI 味:发出去以后再删只能删漏网的,先在提示里压一压(参考 MaiBot 的默认说话风格)
|
|
773
774
|
if (cfg.outFilter.enabled && session.channel !== 'dsh') {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chat-archive.js 的 FTS5 检索层(PR1:原文可检索)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么:chat_text 只有按时间的索引,没有任何检索能力 —— Dream / 模型想核对
|
|
5
|
+
* 「他上次到底说没说过这句话」只能按时间窗捞。anima-brain 的 evidence 层证明
|
|
6
|
+
* 了「原文不可变 + 独立 FTS 索引」是可行的形状:原文层永不改写,检索走
|
|
7
|
+
* 预分词的 FTS5,命中返回带片段的行而不是整段。
|
|
8
|
+
*
|
|
9
|
+
* 分词复用 segment.js 的 tokenizeForBm25(Intl.Segmenter,零依赖)——
|
|
10
|
+
* 存「空格分隔的词项串」而不是原文:FTS5 默认 unicode61 分词器对中文按字切,
|
|
11
|
+
* 直接存原文会让查询「考试」对不上存的「考 试」。查询侧用 queryForBm25
|
|
12
|
+
* 出同一套词项(含拆字低权重补项),两边对得上。
|
|
13
|
+
*
|
|
14
|
+
* 🔴 FTS5 的两个硬约束(都真机验过):
|
|
15
|
+
* ① 别名不能用 —— `WHERE f MATCH ?` 和 `bm25(f)` 都报 `no such column: f`,
|
|
16
|
+
* 必须写表名 `chat_fts`。副表(chat_text)可以用别名。
|
|
17
|
+
* ② 查询串必须是「引号包起来的词项 OR 连接」,否则 FTS5 把中文当语法。
|
|
18
|
+
*
|
|
19
|
+
* 断链自愈:老库升级 / 崩溃后 fts 与 chat_text 可能对不齐。rebuildFts() 逐行对账。
|
|
20
|
+
* 不在 open() 时自动跑(大库会卡启动),由调用方按需触发。
|
|
21
|
+
*/
|
|
22
|
+
import { tokenizeForBm25, queryForBm25 } from './segment.js';
|
|
23
|
+
|
|
24
|
+
/** 建 fts 表 + DELETE 联动触发器。INSERT 侧分词必须在应用层做(触发器里调不了 JS 分词)。 */
|
|
25
|
+
export function ensureFts(db) {
|
|
26
|
+
db.exec('CREATE VIRTUAL TABLE IF NOT EXISTS chat_fts USING fts5(id UNINDEXED, terms)');
|
|
27
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS chat_fts_ad AFTER DELETE ON chat_text BEGIN
|
|
28
|
+
DELETE FROM chat_fts WHERE id = old.id;
|
|
29
|
+
END`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 写入一行索引。add() 插完 chat_text 后调,rowid 与 chat_text.id 对齐。 */
|
|
33
|
+
export function indexRow(db, id, content) {
|
|
34
|
+
db.prepare('INSERT INTO chat_fts(id, terms) VALUES(?,?)').run(Number(id), tokenizeForBm25(String(content ?? '')));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 对账:fts 缺的补、多的删。返回 `{ok, fixed}`;库太大(>5 万行)返回 `{ok:false, skipped:true}`。
|
|
39
|
+
* 失败要能说出来 —— 静默 return 0 会让「没修」和「没坏」看起来一样。
|
|
40
|
+
*/
|
|
41
|
+
export function rebuildFts(db) {
|
|
42
|
+
const count = Number(db.prepare('SELECT COUNT(*) n FROM chat_text').get()?.n ?? 0);
|
|
43
|
+
if (count > 50_000) return { ok: false, skipped: true, reason: '存档太大,跳过重建', fixed: 0 };
|
|
44
|
+
db.exec('BEGIN');
|
|
45
|
+
try {
|
|
46
|
+
let fixed = 0;
|
|
47
|
+
// 缺的补:chat_text 有、chat_fts 没有
|
|
48
|
+
const ins = db.prepare('INSERT INTO chat_fts(id, terms) VALUES(?,?)');
|
|
49
|
+
for (const r of db.prepare('SELECT id, content FROM chat_text WHERE id NOT IN (SELECT id FROM chat_fts)').all()) {
|
|
50
|
+
ins.run(Number(r.id), tokenizeForBm25(String(r.content ?? '')));
|
|
51
|
+
fixed++;
|
|
52
|
+
}
|
|
53
|
+
// 多的删:chat_fts 有、chat_text 没有
|
|
54
|
+
fixed += Number(db.prepare('DELETE FROM chat_fts WHERE id NOT IN (SELECT id FROM chat_text)').run().changes ?? 0);
|
|
55
|
+
db.exec('COMMIT');
|
|
56
|
+
return { ok: true, fixed };
|
|
57
|
+
} catch (e) {
|
|
58
|
+
try { db.exec('ROLLBACK'); } catch { /* 回滚失败就让它带着原始错误抛 */ }
|
|
59
|
+
return { ok: false, fixed: 0, reason: e instanceof Error ? e.message : String(e) };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 只读检索:词项 OR 匹配 + bm25 排序,返回带命中片段的行。
|
|
65
|
+
*
|
|
66
|
+
* 返回 `{ok, rows, error}` 而不是裸数组:检索失败必须和「确实没有」分开
|
|
67
|
+
* (`.catch(() => [])` 会把超时/语法错和空结果混成同一个值,这是本项目踩过的坑)。
|
|
68
|
+
* 调用方想 fail-open 就自己看 ok。
|
|
69
|
+
*
|
|
70
|
+
* @returns {{ok:boolean, rows:Array<{id:number,who:string,self:boolean,content:string,at:number,snippet:string}>, error?:string}}
|
|
71
|
+
*/
|
|
72
|
+
export function searchChatText(db, query, { channel = '', limit = 12 } = {}) {
|
|
73
|
+
const { terms } = queryForBm25(String(query ?? ''));
|
|
74
|
+
if (terms.length === 0) return { ok: true, rows: [] };
|
|
75
|
+
const n = Math.min(30, Math.max(1, Math.floor(Number(limit) || 12)));
|
|
76
|
+
const match = terms.map((t) => `"${t.replace(/"/g, '""')}"`).join(' OR ');
|
|
77
|
+
try {
|
|
78
|
+
const sql = `SELECT chat_fts.id AS id, t.who, t.self, t.content, t.at,
|
|
79
|
+
snippet(chat_fts, 1, '「', '」', '…', 12) AS snip
|
|
80
|
+
FROM chat_fts JOIN chat_text t ON t.id = chat_fts.id
|
|
81
|
+
${channel !== '' ? 'WHERE chat_fts MATCH ? AND t.channel_id = ?' : 'WHERE chat_fts MATCH ?'}
|
|
82
|
+
ORDER BY bm25(chat_fts) LIMIT ?`;
|
|
83
|
+
const args = channel !== '' ? [match, channel, n] : [match, n];
|
|
84
|
+
const rows = db.prepare(sql).all(...args).map((r) => ({
|
|
85
|
+
id: Number(r.id), who: String(r.who ?? ''), self: r.self === 1,
|
|
86
|
+
content: String(r.content ?? ''), at: Number(r.at) || 0, snippet: String(r.snip ?? '')
|
|
87
|
+
}));
|
|
88
|
+
return { ok: true, rows };
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return { ok: false, rows: [], error: e instanceof Error ? e.message : String(e) };
|
|
91
|
+
}
|
|
92
|
+
}
|
package/lib/chat-archive.js
CHANGED
|
@@ -3,14 +3,15 @@ import { DatabaseSync } from 'node:sqlite';
|
|
|
3
3
|
import { existsSync,mkdirSync,chmodSync,openSync,closeSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { fishSoulDir } from './db.js';
|
|
6
|
+
import { ensureFts, indexRow, rebuildFts, searchChatText } from './chat-archive-fts.js';
|
|
6
7
|
const DAY=86400000;
|
|
7
8
|
export class ChatArchive {
|
|
8
|
-
constructor({getConfig,log=()=>{}}){this.getConfig=getConfig;this.log=log;this.db=null;this.error='';this.failures=0;}
|
|
9
|
+
constructor({getConfig,log=()=>{}}){this.getConfig=getConfig;this.log=log;this.db=null;this.error='';this.failures=0;this.ftsChecked=false;}
|
|
9
10
|
config(){const c=this.getConfig()?.chatArchive ?? {};return {enabled:c.enabled===true,channels:Array.isArray(c.channels)?c.channels.filter(x=>typeof x==='string'&&x.length>0):[],days:Math.max(1,Math.min(3650,Math.floor(Number(c.days)||30)))};}
|
|
10
|
-
open(create=false){if(this.db)return this.db;const path=join(fishSoulDir(),'chat-archive.db');if(!create&&!existsSync(path))return null;mkdirSync(fishSoulDir(),{recursive:true,mode:0o700});if(!existsSync(path)){try {closeSync(openSync(path,'wx',0o600));}catch(e){if(e.code!=='EEXIST')throw e;}}chmodSync(path,0o600);const db=new DatabaseSync(path);db.exec('PRAGMA journal_mode=WAL; PRAGMA secure_delete=ON; PRAGMA busy_timeout=5000; CREATE TABLE IF NOT EXISTS chat_text(id INTEGER PRIMARY KEY, channel_id TEXT NOT NULL, who TEXT NOT NULL, self INTEGER NOT NULL, content TEXT NOT NULL, at INTEGER NOT NULL); CREATE INDEX IF NOT EXISTS chat_text_channel_at ON chat_text(channel_id,at DESC);');this.db=db;return db;}
|
|
11
|
+
open(create=false){if(this.db)return this.db;const path=join(fishSoulDir(),'chat-archive.db');if(!create&&!existsSync(path))return null;mkdirSync(fishSoulDir(),{recursive:true,mode:0o700});if(!existsSync(path)){try {closeSync(openSync(path,'wx',0o600));}catch(e){if(e.code!=='EEXIST')throw e;}}chmodSync(path,0o600);const db=new DatabaseSync(path);db.exec('PRAGMA journal_mode=WAL; PRAGMA secure_delete=ON; PRAGMA busy_timeout=5000; CREATE TABLE IF NOT EXISTS chat_text(id INTEGER PRIMARY KEY, channel_id TEXT NOT NULL, who TEXT NOT NULL, self INTEGER NOT NULL, content TEXT NOT NULL, at INTEGER NOT NULL); CREATE INDEX IF NOT EXISTS chat_text_channel_at ON chat_text(channel_id,at DESC);');ensureFts(db);this.db=db;return db;}
|
|
11
12
|
add(channel,line){const cfg=this.config();if(!cfg.enabled)return;
|
|
12
13
|
// channels 留空 = 全记(默认);填了才按白名单过滤
|
|
13
|
-
if(cfg.channels.length>0&&!cfg.channels.includes(channel))return;try {const text=String(line?.text??'').trim();if(!text)return;if(Buffer.byteLength(text,'utf8')>2*1024*1024)throw new Error('文本过长');this.open(true).prepare('INSERT INTO chat_text(channel_id,who,self,content,at) VALUES(?,?,?,?,?)').run(channel,String(line.who??''),line.self===true?1:0,text,Date.now());this.error='';}catch {this.failures++;this.error='聊天存档写入失败';this.log('warn','[fish-soul] 聊天存档写入失败,聊天继续');}}
|
|
14
|
+
if(cfg.channels.length>0&&!cfg.channels.includes(channel))return;try {const text=String(line?.text??'').trim();if(!text)return;if(Buffer.byteLength(text,'utf8')>2*1024*1024)throw new Error('文本过长');const db=this.open(true);db.prepare('INSERT INTO chat_text(channel_id,who,self,content,at) VALUES(?,?,?,?,?)').run(channel,String(line.who??''),line.self===true?1:0,text,Date.now());const rowId=Number(db.prepare('SELECT last_insert_rowid() n').get().n);indexRow(db,rowId,text);this.error='';}catch {this.failures++;this.error='聊天存档写入失败';this.log('warn','[fish-soul] 聊天存档写入失败,聊天继续');}}
|
|
14
15
|
prune(){try{const db=this.open();if(!db)return;db.prepare('DELETE FROM chat_text WHERE at < ?').run(Date.now()-this.config().days*DAY);db.exec('PRAGMA wal_checkpoint(TRUNCATE)');}catch{this.error='聊天存档清理失败';}}
|
|
15
16
|
state(){let count=0, stored=[];try{const db=this.open();count=Number(db?.prepare('SELECT COUNT(*) n FROM chat_text').get()?.n??0);stored=db?db.prepare('SELECT channel_id AS channel, COUNT(*) AS count FROM chat_text GROUP BY channel_id ORDER BY max(at) DESC LIMIT 100').all():[];}catch{this.error='聊天存档读取失败';}return {ok:true,...this.config(),count,stored,error:this.error,failures:this.failures};}
|
|
16
17
|
list(channel,before=Number.MAX_SAFE_INTEGER){try {const db=this.open();const items=db?db.prepare('SELECT id,channel_id AS channel,who,self,content,at FROM chat_text WHERE channel_id=? AND id<? ORDER BY id DESC LIMIT 50').all(channel,before):[];return {ok:true,items,next:items.length===50?items[items.length-1].id:null};}catch{return {ok:false,error:'读取聊天存档失败'};}}
|
|
@@ -40,6 +41,34 @@ export class ChatArchive {
|
|
|
40
41
|
return rows.map((r) => ({ who: String(r.who ?? ''), self: r.self === 1, content: String(r.content ?? ''), at: Number(r.at) || 0 }));
|
|
41
42
|
} catch { return []; }
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 关键词检索原文(PR1)。只读、有上限。
|
|
47
|
+
*
|
|
48
|
+
* 返回 `{ok,rows,error}` 而不是裸数组:**检索失败必须和「确实没有」分开**
|
|
49
|
+
* (`.catch(() => [])` 会把索引断掉和空结果混成同一个值,这是本项目踩过的坑)。
|
|
50
|
+
*
|
|
51
|
+
* 首次调用对账一次(老库的 chat_text 没有 fts 行),库太大(>5 万行)跳过对账 ——
|
|
52
|
+
* 检索照常工作,只是升级前的旧行查不到。
|
|
53
|
+
*
|
|
54
|
+
* @param {string} query
|
|
55
|
+
* @param {{channel?:string, limit?:number}} o
|
|
56
|
+
* @returns {{ok:boolean,rows:Array<{id:number,who:string,self:boolean,content:string,at:number,snippet:string}>,error?:string}}
|
|
57
|
+
*/
|
|
58
|
+
search(query,{channel='',limit=12}={}){
|
|
59
|
+
try{
|
|
60
|
+
const db=this.open();
|
|
61
|
+
if(!db)return {ok:false,rows:[],error:'聊天存档还没建起来'};
|
|
62
|
+
// 首次对账:老库的 chat_text 没有对应 fts 行,不补就永远查不到
|
|
63
|
+
if(!this.ftsChecked){
|
|
64
|
+
this.ftsChecked=true;
|
|
65
|
+
const fix=rebuildFts(db);
|
|
66
|
+
if(!fix.ok)this.log('warn',`[fish-soul] 聊天存档检索索引没补全:${fix.reason}`);
|
|
67
|
+
else if(fix.fixed>0)this.log('info',`[fish-soul] 聊天存档检索索引补齐 ${fix.fixed} 行`);
|
|
68
|
+
}
|
|
69
|
+
return searchChatText(db,query,{channel,limit});
|
|
70
|
+
}catch(e){return {ok:false,rows:[],error:e instanceof Error?e.message:String(e)};}
|
|
71
|
+
}
|
|
43
72
|
remove(channel){try{const db=this.open();const changed=db?Number(db.prepare('DELETE FROM chat_text WHERE channel_id=?').run(channel).changes):0;db?.exec('PRAGMA wal_checkpoint(TRUNCATE)');return {ok:true,changed};}catch{return {ok:false,error:'清理聊天存档失败'};}}
|
|
44
73
|
start(){this.prune();this.timer=setInterval(()=>this.prune(),3600000);this.timer.unref?.();}
|
|
45
74
|
stop(){clearInterval(this.timer);try{this.db?.close();}catch{}this.db=null;}
|
package/lib/client.soul.js
CHANGED
|
@@ -87,6 +87,15 @@ window.__ModuleLoader__.load({
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// ── 人物:关系 / 称呼 / 印象 ──
|
|
90
|
+
/**
|
|
91
|
+
* 旧记忆的标签:区分「记错」和「过时」。
|
|
92
|
+
*
|
|
93
|
+
* 为什么必须分开:这两种在时间线上的含义是相反的 ——
|
|
94
|
+
* 「记错」= 从来没真过(他随口编自己是医生),该从历史真相里排除;
|
|
95
|
+
* 「过时」= 曾经确实是那样(他以前住 A 区),历史查询里应该看得到。
|
|
96
|
+
* 后端 memoryView 给 invalidKind,老库这一列是 NULL,兜底成 superseded。
|
|
97
|
+
*/
|
|
98
|
+
const invalidLabel = (m) => (m.invalidKind === "corrected" ? "记错" : "过时");
|
|
90
99
|
function PersonCard({ ownerId, ui, api, notify, onChanged }) {
|
|
91
100
|
const { h, Row, Group, Input, Select, Area, Button, Tag, Muted, Empty, Item, useConfirm } = ui;
|
|
92
101
|
const [confirm, confirmNode] = useConfirm();
|
|
@@ -170,9 +179,9 @@ window.__ModuleLoader__.load({
|
|
|
170
179
|
} }, "删除这张卡")) : null),
|
|
171
180
|
(data.episodes ?? []).length === 0 ? null : Group({ title: "最近聊过" },
|
|
172
181
|
h("div", { className: "fs-list" }, data.episodes.map((x) => Item({ key: x.id, text: x.content, meta: [h("span", { key: "t" }, fmtDay(x.at))] })))),
|
|
173
|
-
(data.outdated ?? []).length === 0 ? null : Group({ title: "
|
|
182
|
+
(data.outdated ?? []).length === 0 ? null : Group({ title: "记错 / 过时的", aside: Tag(String(data.outdated.length), "outline") },
|
|
174
183
|
h("div", { className: "fs-list" }, data.outdated.map((m) => Item({
|
|
175
|
-
key: m.id, lead: Tag(m
|
|
184
|
+
key: m.id, lead: Tag(invalidLabel(m), "outline"),
|
|
176
185
|
text: m.content, title: `${m.content}\n${m.evidence || m.source}`,
|
|
177
186
|
meta: [Button({ key: "r", variant: "ghost", onClick: () => restore(m.id) }, "恢复")]
|
|
178
187
|
})))), confirmNode) // #82:confirm() 的对话框要挂进这棵树,否则点「删除这张卡」只是 pending 了、界面什么都不出;
|
|
@@ -192,7 +201,7 @@ window.__ModuleLoader__.load({
|
|
|
192
201
|
}
|
|
193
202
|
return Group({ title: "她自己的改掉 / 过时的", aside: Muted(`${data.total} 条`) },
|
|
194
203
|
data.items.length === 0 ? Empty("没有旧记忆") : h("div", { className: "fs-list" }, data.items.map((m) => Item({
|
|
195
|
-
key: m.id, lead: ui.Tag(m
|
|
204
|
+
key: m.id, lead: ui.Tag(invalidLabel(m), "outline"),
|
|
196
205
|
text: m.content, title: `${m.content}\n${m.evidence || m.source}`,
|
|
197
206
|
meta: m.kind === "weekly" ? [Muted("失效周记不能恢复")] : [Button({ key: "r", variant: "ghost", onClick: () => restore(m) }, "恢复")]
|
|
198
207
|
}))),
|
package/lib/db.js
CHANGED
|
@@ -230,7 +230,14 @@ const MIGRATIONS = [
|
|
|
230
230
|
// #126:weekly_source_changed 的定义改了(owner_id 不再算「来源变了」)。
|
|
231
231
|
// 触发器是 CREATE TRIGGER IF NOT EXISTS 建的,老库不会自己换定义 —— 先摘掉,
|
|
232
232
|
// 后面建触发器那段按新定义重建(每次启动收敛一次)。
|
|
233
|
-
'DROP TRIGGER IF EXISTS weekly_source_changed'
|
|
233
|
+
'DROP TRIGGER IF EXISTS weekly_source_changed',
|
|
234
|
+
// 记忆失效的两种语义(别再混成一个 outdated):
|
|
235
|
+
// 'superseded' = 曾经是真的,后来事情变了(搬家了、换工作了)——
|
|
236
|
+
// 历史查询里应当看得到「他以前住 A 区」
|
|
237
|
+
// 'corrected' = 从来没真过,是记错 / 别人编的(原文一对就露)——
|
|
238
|
+
// 从历史真相里彻底排除,但行留着(能查到它是怎么错的)
|
|
239
|
+
// 老库一律回填 NULL,读的时候按 status 兜底(outdated 视为 superseded),不猜。
|
|
240
|
+
'ALTER TABLE memory ADD COLUMN invalid_kind TEXT'
|
|
234
241
|
];
|
|
235
242
|
|
|
236
243
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1465,6 +1465,38 @@ async function startup(ctx, config, { log, gate }) {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
})), 'dsh-fish-soul: forget');
|
|
1467
1467
|
|
|
1468
|
+
// ── 工具:chat_search(翻原始聊天记录,核对「他到底说没说过」)──
|
|
1469
|
+
// 和 recall 的区别:recall 查的是**她已经总结出来的记忆**(会记错、会被改写),
|
|
1470
|
+
// chat_search 查的是**当时的原文**,是唯一的地面真值。
|
|
1471
|
+
// 典型用法:记不清某句话的上下文、想知道原话怎么说的、怀疑记忆记错了。
|
|
1472
|
+
ctx.effect(() => ctx.tools.register(defineTool({
|
|
1473
|
+
name: 'chat_search',
|
|
1474
|
+
description: '在原始聊天记录里按关键词翻原话(不是总结过的记忆)。核对某人到底说过什么、当时怎么说的时用它。',
|
|
1475
|
+
parameters: objectSchema({
|
|
1476
|
+
query: { type: 'string', required: true, description: '要翻的词(人名、地名、具体的词都行,多个词用空格隔开)' },
|
|
1477
|
+
channel: { type: 'string', description: '不填就查当前会话;填会话 id 查那个会话' },
|
|
1478
|
+
limit: { type: 'number', description: '最多返回几条(默认 8,最多 20)' }
|
|
1479
|
+
}),
|
|
1480
|
+
output: textOutput,
|
|
1481
|
+
async execute(args, toolCtx) {
|
|
1482
|
+
const query = String(args.query ?? '').trim();
|
|
1483
|
+
if (query === '') return '要给个检索词。';
|
|
1484
|
+
// 隐私:默认只查当前说话人所在的会话,不让他随便翻别人跟她的私聊
|
|
1485
|
+
const session = sessionForTool(toolCtx, undefined);
|
|
1486
|
+
const channel = String(args.channel ?? '').trim() || session.channelId || '';
|
|
1487
|
+
const res = chatArchive.search(query, { channel, limit: Math.min(20, Math.max(1, Number(args.limit) || 8)) });
|
|
1488
|
+
if (!res.ok) return `翻了聊天记录但失败了:${res.error ?? '原因不明'}。别据此断定没说过。`;
|
|
1489
|
+
if (res.rows.length === 0) return '聊天记录里没找到对得上的原话(也可能超出保留天数了)。';
|
|
1490
|
+
// 存档里是真实毫秒时间戳,按 UTC+8 显示(和日记/周记同一套时区约定)
|
|
1491
|
+
const when = (ms) => {
|
|
1492
|
+
const t = new Date(ms + 8 * 3600000);
|
|
1493
|
+
const p2 = (n) => String(n).padStart(2, '0');
|
|
1494
|
+
return `${t.getUTCFullYear()}-${p2(t.getUTCMonth() + 1)}-${p2(t.getUTCDate())} ${p2(t.getUTCHours())}:${p2(t.getUTCMinutes())}`;
|
|
1495
|
+
};
|
|
1496
|
+
return res.rows.map((r) => `[${when(r.at)}] ${r.self ? '我' : r.who || '对方'}:${r.content}`).join('\n');
|
|
1497
|
+
}
|
|
1498
|
+
})), 'dsh-fish-soul: chat_search');
|
|
1499
|
+
|
|
1468
1500
|
// ── 工具:send_elsewhere(主人在 QQ 私聊里让她去抖音 / B站 私信自己一条)──
|
|
1469
1501
|
ctx.effect(() => ctx.tools.register(defineTool({
|
|
1470
1502
|
name: RELAY_TOOL,
|
package/lib/life.js
CHANGED
|
@@ -929,8 +929,14 @@ export class LifeEngine {
|
|
|
929
929
|
`{"missedPending":[{"dueInHours":数字,"reason":"..."}],` +
|
|
930
930
|
`"suggestedRelationStage":"stranger|acquaintance|friend|close|null"` +
|
|
931
931
|
(writeProfile ? `,"profileFields":{${PROFILE_FIELDS.map(([k, l]) => `"${k}":"${l}(≤30 字,不知道就空)"`).join(',')}}` : '') +
|
|
932
|
-
',"outdated":[{"id":旧记忆编号,"by":推翻它的新记忆编号,"reason":"..."}]
|
|
933
|
-
'
|
|
932
|
+
',"outdated":[{"id":旧记忆编号,"by":推翻它的新记忆编号,"reason":"..."}],' +
|
|
933
|
+
'"corrected":[{"id":记错的记忆编号,"reason":"原文说的是什么,这条记错在哪"}]}。' +
|
|
934
|
+
// 两种失效必须分开填,别混:
|
|
935
|
+
// outdated = 曾经是真的,后来事情变了(搬家、换工作、分手)⇒ 要填 by(哪条新记忆说明的)。
|
|
936
|
+
// corrected = 从来没真过,是记错了或听信了对方随口编的 ⇒ 不要填 by,
|
|
937
|
+
// reason 里写「原文实际说的是什么」,因为这条会从历史真相里彻底排除。
|
|
938
|
+
'outdated 只填被更新的记忆明确推翻的旧事实(比如搬家、换工作、分手),拿不准就空着;' +
|
|
939
|
+
'corrected 只填和原文明确冲突的(下面给了原文时才有意义),拿不准就空着 —— 宁可漏填,别把真事判成记错。' +
|
|
934
940
|
(profile ? `现在的印象:${profile.text}。` : '') +
|
|
935
941
|
(writeProfile && profile?.lockedFields?.length ? `(${profile.lockedFields.map((k) => PROFILE_FIELDS.find(([f]) => f === k)?.[1] ?? k).join('、')}是主人写的,不用填)` : '') +
|
|
936
942
|
`近期记忆:${recent.map((m) => `#${m.id}[${day(m.created_at)}] ${m.content}`).join(';')}` +
|
|
@@ -950,6 +956,7 @@ export class LifeEngine {
|
|
|
950
956
|
const nowVirtual = this.clock.now();
|
|
951
957
|
const byId = new Map(recent.map((m) => [m.id, m]));
|
|
952
958
|
const outdated = [];
|
|
959
|
+
const corrected = [];
|
|
953
960
|
this.db.exec('BEGIN');
|
|
954
961
|
try {
|
|
955
962
|
// 兜底补写 pending(审查 #02)
|
|
@@ -981,11 +988,23 @@ export class LifeEngine {
|
|
|
981
988
|
const old = byId.get(Number(o?.id));
|
|
982
989
|
const by = byId.get(Number(o?.by));
|
|
983
990
|
if (!old || !by || old.id === by.id || by.created_at < old.created_at || (old.importance ?? 1) >= 5) continue;
|
|
984
|
-
this.db.prepare("UPDATE memory SET status = 'outdated', valid_to = ?, superseded_by = ?, updated_at = ? WHERE id = ? AND status = 'active'")
|
|
991
|
+
this.db.prepare("UPDATE memory SET status = 'outdated', invalid_kind = 'superseded', valid_to = ?, superseded_by = ?, updated_at = ? WHERE id = ? AND status = 'active'")
|
|
985
992
|
.run(nowVirtual, by.id, nowVirtual, old.id);
|
|
986
993
|
this.db.prepare('DELETE FROM vec WHERE memory_id = ?').run(old.id);
|
|
987
994
|
outdated.push({ id: old.id, by: by.id, reason: String(o.reason ?? '').slice(0, 80), content: old.content.slice(0, 80) });
|
|
988
995
|
}
|
|
996
|
+
// 记错的旧记忆(从来没真过):不需要「被谁推翻」,也没有 by。
|
|
997
|
+
// 🔴 和上面那种分开:这条不进历史真相(时间线里不该出现"他以前是医生"),
|
|
998
|
+
// 但行留着 —— 主人能查到它是怎么错的,也能手动恢复。
|
|
999
|
+
for (const o of (Array.isArray(parsed.corrected) ? parsed.corrected : [])) {
|
|
1000
|
+
if (corrected.length >= 3) break;
|
|
1001
|
+
const old = byId.get(Number(o?.id));
|
|
1002
|
+
if (!old || (old.importance ?? 1) >= 5) continue;
|
|
1003
|
+
this.db.prepare("UPDATE memory SET status = 'outdated', invalid_kind = 'corrected', valid_to = ?, updated_at = ? WHERE id = ? AND status = 'active'")
|
|
1004
|
+
.run(nowVirtual, nowVirtual, old.id);
|
|
1005
|
+
this.db.prepare('DELETE FROM vec WHERE memory_id = ?').run(old.id);
|
|
1006
|
+
corrected.push({ id: old.id, reason: String(o.reason ?? '').slice(0, 80), content: old.content.slice(0, 80) });
|
|
1007
|
+
}
|
|
989
1008
|
// relation_stage 演进(审查 #05):Dream 建议 + 互动计数/情绪均值兜底
|
|
990
1009
|
if (person !== undefined) {
|
|
991
1010
|
const stageRank = { stranger: 0, acquaintance: 1, friend: 2, close: 3 };
|
|
@@ -1023,13 +1042,13 @@ export class LifeEngine {
|
|
|
1023
1042
|
try { settleAffinity(this.db, person.canonical_id, 0, nowVirtual); } catch { /* 老库没有列 */ }
|
|
1024
1043
|
try { ensureBirthdayPending(this.db, ownerId, name, nowVirtual); } catch { /* 不要紧 */ }
|
|
1025
1044
|
}
|
|
1026
|
-
if (outdated.length > 0 || (writeProfile && profileText !== '')) {
|
|
1045
|
+
if (outdated.length > 0 || corrected.length > 0 || (writeProfile && profileText !== '')) {
|
|
1027
1046
|
const logs = getKv(this.db, 'dream.log', []) ?? [];
|
|
1028
1047
|
// transcriptLines:这次带了几行原文(0 = 没带)。
|
|
1029
1048
|
// 没有这个数,从外面根本看不出「对照原文」到底生效了没有 ——
|
|
1030
1049
|
// 加了开关却没观测点,是上次表情包那轮踩过的坑。
|
|
1031
1050
|
logs.unshift({
|
|
1032
|
-
at: Date.now(), ownerId, name, outdated,
|
|
1051
|
+
at: Date.now(), ownerId, name, outdated, corrected,
|
|
1033
1052
|
profile: writeProfile && profileText !== '',
|
|
1034
1053
|
transcriptLines: transcriptLines === '' ? 0 : transcriptLines.split('\n').length,
|
|
1035
1054
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mood-guard.js —— 情绪状态机的一道闸 + 提示词护栏(PR3)。
|
|
3
|
+
*
|
|
4
|
+
* 借鉴 anima-brain 的 emotion.py(常量 + 公式都在代码里,真读过的):
|
|
5
|
+
* 每轴每天的总绝对位移上限 0.12、档位滞回 0.035 ——
|
|
6
|
+
* 挡的都是「同一个话题反复刷让数值滚雪球」和「卡在档位边界反复横跳」。
|
|
7
|
+
*
|
|
8
|
+
* 我们的 mood 是离散标签 + intensity 1~3 + 12h 半衰,不是 PAD 坐标,
|
|
9
|
+
* 所以两个常数不能直接搬数值,只能搬**结构**:
|
|
10
|
+
*
|
|
11
|
+
* 我们只保留**一条**:每日翻转次数上限 —— 一天最多换 4 次标签。
|
|
12
|
+
* 挡的是「开心→委屈→开心→委屈」这种横跳,不是「情绪变强」。
|
|
13
|
+
*
|
|
14
|
+
* 🔴 为什么没有「按强度滞后」那道:既有契约(smoke-v09)要求
|
|
15
|
+
* 同一个 now 下 开心(满格) → 委屈 必须能翻,而且翻完 markMoodSaid
|
|
16
|
+
* 要重新返回 true。那是「模型判断了就是判断了」,是她的主体性。
|
|
17
|
+
* 第一版按 anima-brain 的强度滞后带写(新强度 > 旧残温 × 1.5),
|
|
18
|
+
* 直接打挂那条契约 —— 而且不是测试过时,是我理解的边界错了。
|
|
19
|
+
*
|
|
20
|
+
* ② 每日翻转次数上限:一天最多换 4 次标签。
|
|
21
|
+
* 挡的是「开心→委屈→开心→委屈」这种横跳,不是「情绪变强」——
|
|
22
|
+
* 同标签叠加(余温加深)是既有契约,不能被这道闸压。
|
|
23
|
+
*
|
|
24
|
+
* 这两道都是**写入侧**的闸,读侧 getMood 不变(衰减照旧)。
|
|
25
|
+
*/
|
|
26
|
+
export const MOOD_FLIPS_PER_DAY = 4;
|
|
27
|
+
|
|
28
|
+
/** UTC+8 的日期串(和日记 / 周记同一套时区约定)。 */
|
|
29
|
+
export function moodDayOf(ms) {
|
|
30
|
+
return new Date(ms + 8 * 3600_000).toISOString().slice(0, 10);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 判「这次还能不能换标签」的第二个闸:**一天最多翻几次**。
|
|
35
|
+
*
|
|
36
|
+
* 🔴 这里不能写成「每日位移上限」。既有契约(smoke-persona)要求
|
|
37
|
+
* 同一种情绪又来会叠加 1 → 3 → 3 —— 那是「余温加深」,是既有设计,
|
|
38
|
+
* 拿位移上限去压它直接打挂那条测试。
|
|
39
|
+
*
|
|
40
|
+
* 真正要挡的是**反复翻转**(开心→委屈→开心→委屈),不是「情绪变强」。
|
|
41
|
+
* 所以闸② 数的是「今天换了几次标签」,不是「涨了几格强度」。
|
|
42
|
+
*
|
|
43
|
+
* @param {{day:string, flips:number}|null} today 当天的翻转记录
|
|
44
|
+
* @param {number} now 当前虚拟时间
|
|
45
|
+
* @returns {{ok:true, day:string, flips:number}|{ok:false, day:string, flips:number, reason:string}}
|
|
46
|
+
*/
|
|
47
|
+
export function canFlipToday(today, now) {
|
|
48
|
+
const day = moodDayOf(now);
|
|
49
|
+
const flips = today?.day === day ? Number(today.flips ?? 0) : 0;
|
|
50
|
+
if (flips >= MOOD_FLIPS_PER_DAY) {
|
|
51
|
+
return { ok: false, day, flips, reason: `今天已经翻过 ${flips} 次了,上限 ${MOOD_FLIPS_PER_DAY}` };
|
|
52
|
+
}
|
|
53
|
+
return { ok: true, day, flips };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 提示词护栏(借鉴 anima-brain 的 emotion.py::note)。
|
|
58
|
+
*
|
|
59
|
+
* 原文:「This is fictional character state, not evidence about the user's feelings.
|
|
60
|
+
* Character mood must never make the response dismissive during user vulnerability.」
|
|
61
|
+
*
|
|
62
|
+
* 为什么我们的提示词里需要它:这个项目踩过 #75 / #76 两次「虚构内容顺着
|
|
63
|
+
* 提示词变假事实」—— 状态注记不写清「这是你自己的状态,不是对方的证据」,
|
|
64
|
+
* 模型就会把「我现在在生气」推成「他惹我生气了」这个事实,而它会进记忆。
|
|
65
|
+
*
|
|
66
|
+
* 第二句对应真实风险:她在生气时收到对方说「我最近不太好」,
|
|
67
|
+
* 绝不能回「我现在心情不好,你先别烦我」。
|
|
68
|
+
*/
|
|
69
|
+
export const MOOD_STATE_GUARD = '(这些只是你自己的状态,不是对方情绪的证据,别据此推断对方;对方在说难受、委屈、撑不住这类脆弱的话时,不许敷衍,也不许拿你自己的心情当理由)';
|
package/lib/routes-soul.js
CHANGED
|
@@ -24,6 +24,10 @@ function memoryView(m) {
|
|
|
24
24
|
id: m.id, ownerId: m.owner_id, channel: m.channel, channelId: m.channel_id, kind: m.kind, content: m.content,
|
|
25
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
|
+
// 失效的两种语义。老库这一列是 NULL(升级前写的行),按 status 兜底:
|
|
28
|
+
// outdated / superseded 都当 superseded —— 那时候还没区分,不替它猜;
|
|
29
|
+
// 只有明确写了 corrected 的才当「从来没真过」。
|
|
30
|
+
invalidKind: m.invalid_kind ?? (m.status === 'outdated' || m.status === 'superseded' ? 'superseded' : null),
|
|
27
31
|
visibility: m.visibility ?? 'normal', about: m.about ?? null
|
|
28
32
|
};
|
|
29
33
|
}
|
package/lib/soul-memory.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* - 防跑偏:人设要点 + 试探检测。
|
|
10
10
|
*/
|
|
11
11
|
import { growthPromptPart, mergeGrowth } from './growth.js';
|
|
12
|
+
import { canFlipToday } from './mood-guard.js';
|
|
12
13
|
import { getKv, setKv, getProfile, setProfile } from './db.js';
|
|
13
14
|
import { tokenizeForBm25, splitKeywords } from './segment.js';
|
|
14
15
|
import { isSelfCapabilityClaim } from './capability.js';
|
|
@@ -105,11 +106,27 @@ export function setMood(db, ownerId, { label, reason = '', intensity = 2 }, now)
|
|
|
105
106
|
const l = String(label ?? '').trim().slice(0, 8);
|
|
106
107
|
if (l === '' || /^(平静|无|没有|null)$/.test(l)) return null;
|
|
107
108
|
const prev = getKv(db, `mood.${ownerId}`, null);
|
|
108
|
-
// said:这个情绪已经在回复里流露过一次了(换了新情绪才重新算)
|
|
109
|
-
// 同一种情绪又来了:在还剩下的余温上加一点(最多 3);换了情绪就从头算(借鉴 HDS-Interlude 的 Alter:同向加强、反向替换)
|
|
110
109
|
const base = Math.max(1, Math.min(3, Number(intensity) || 2));
|
|
111
|
-
|
|
112
|
-
const
|
|
110
|
+
|
|
111
|
+
const sameLabel = prev?.label === l;
|
|
112
|
+
// 同标签:在剩余余温上加一格(最多 3)。换了标签:从 base 起算。
|
|
113
|
+
const left = sameLabel ? Number(prev.intensity ?? 1) * Math.pow(0.5, Math.max(0, now - Number(prev.at ?? now)) / (12 * 3600_000)) : 0;
|
|
114
|
+
const target = Math.round(Math.min(3, Math.max(base, left + 1)) * 10) / 10;
|
|
115
|
+
|
|
116
|
+
// 闸②:一天最多换几次标签。挡的是反复横跳,不是「情绪变强」——
|
|
117
|
+
// 同标签叠加(余温加深)是既有契约(smoke-persona 1→3→3),这里不碰。
|
|
118
|
+
// 首次设值(prev 为 null)不算翻转 —— 那时候没有旧情绪可翻,
|
|
119
|
+
// 否则「第一天就被自己的额度挡掉一次」。
|
|
120
|
+
if (!sameLabel && prev !== null) {
|
|
121
|
+
const dayKey = `mood.flips.${ownerId}`;
|
|
122
|
+
const today = getKv(db, dayKey, null);
|
|
123
|
+
const gate = canFlipToday(today, now);
|
|
124
|
+
if (!gate.ok) return null;
|
|
125
|
+
setKv(db, dayKey, { day: gate.day, flips: gate.flips + 1 });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// said:这个情绪已经在回复里流露过一次了(换了新情绪才重新算)
|
|
129
|
+
const v = { label: l, reason: String(reason ?? '').trim().slice(0, 60), intensity: target, at: now, said: sameLabel && prev?.said === true };
|
|
113
130
|
setKv(db, `mood.${ownerId}`, v);
|
|
114
131
|
return v;
|
|
115
132
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-fish-soul",
|
|
3
|
-
"version": "0.18.
|
|
4
|
-
"description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记、每周记忆存档与可选周记(DSH 插件,单角色 feiyu ,v0.18.
|
|
3
|
+
"version": "0.18.11",
|
|
4
|
+
"description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记、每周记忆存档与可选周记(DSH 插件,单角色 feiyu ,v0.18.11)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"files": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
|
-
"test": "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-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-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/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-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/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/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/relay-other-platform.mjs && node test/relay-to-friend.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/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-allowlist.mjs && node test/douyin-master-uid-mismatch.mjs && node test/image-inbound-fail.mjs && node test/group-backlog-images.mjs && node test/check-test-chain.mjs && node test/check-route-guard.mjs && node test/check-client-imports.mjs && node test/check-secrets.mjs",
|
|
67
|
+
"test": "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-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-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/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-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/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/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/relay-other-platform.mjs && node test/relay-to-friend.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/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-allowlist.mjs && node test/douyin-master-uid-mismatch.mjs && node test/image-inbound-fail.mjs && node test/group-backlog-images.mjs && node test/check-test-chain.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/check-secrets.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
|
}
|