dsh-qqbot-muu 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/docs/README.md +67 -16
- package/dshqqbot/.qqbot-extensions/inbound/aa-memory-recall.mjs +827 -802
- package/dshqqbot/.qqbot-extensions/lib/memory-core.mjs +13 -1
- package/dshqqbot/.qqbot-extensions/lib/memory-db.mjs +17 -3
- package/dshqqbot/.qqbot-extensions/lib/sensitive.mjs +80 -0
- package/dshqqbot/.qqbot-extensions/tools/memory.mjs +17 -3
- package/package.json +119 -119
- package/scripts/__pycache__/memory-audit.cpython-311.pyc +0 -0
- package/scripts/memory-audit.py +9 -0
- package/scripts/release-all.mjs +49 -24
- package/scripts/sync-plugin-copies.mjs +3 -0
- package/settings-host.js +10 -3
package/settings-host.js
CHANGED
|
@@ -6073,6 +6073,13 @@ function extCfgPath(root, which) {
|
|
|
6073
6073
|
const bot = nsBot(NSQ(u));
|
|
6074
6074
|
const root = resolveMemoryRoot(bot);
|
|
6075
6075
|
const memDir = root ? join(root, '.qqbot', 'memory') : '';
|
|
6076
|
+
// 记忆审查(2026-12-04):面板「最近记忆」预览也走同一套遮蔽规则,
|
|
6077
|
+
// 不然在桌面端点开就能看到手机号 / 证件 / 密码的原文。
|
|
6078
|
+
let redact = (s) => s;
|
|
6079
|
+
try {
|
|
6080
|
+
const mod = await import(pathToFileURL(join(__repoRoot(), 'dshqqbot', '.qqbot-extensions', 'lib', 'sensitive.mjs')).href);
|
|
6081
|
+
if (typeof mod.redactSensitive === 'function') redact = mod.redactSensitive;
|
|
6082
|
+
} catch { /* 规则文件缺失就原样显示,不影响面板 */ }
|
|
6076
6083
|
const dbFile = root ? join(root, '.qqbot', 'memory.db') : '';
|
|
6077
6084
|
const scopes = [];
|
|
6078
6085
|
const persona = { total: 0, rows: [] };
|
|
@@ -6093,13 +6100,13 @@ const dbFile = root ? join(root, '.qqbot', 'memory.db') : '';
|
|
|
6093
6100
|
const recent = db.prepare('SELECT scope, kind, text, ts FROM mem ORDER BY ts DESC LIMIT 500').all();
|
|
6094
6101
|
for (const r of recent) {
|
|
6095
6102
|
const s = byScope.get(String(r.scope || '?'));
|
|
6096
|
-
if (s && s.recent.length < 8) s.recent.push({ kind: r.kind || '', text: String(r.text || '').slice(0, 160), ts: r.ts || 0 });
|
|
6103
|
+
if (s && s.recent.length < 8) s.recent.push({ kind: r.kind || '', text: redact(String(r.text || '').slice(0, 160)), ts: r.ts || 0 });
|
|
6097
6104
|
}
|
|
6098
6105
|
for (const s of byScope.values()) scopes.push(s);
|
|
6099
6106
|
try {
|
|
6100
6107
|
const pr = db.prepare('SELECT scope, ckey, cvalue, weight, ts FROM persona ORDER BY ts DESC LIMIT 80').all();
|
|
6101
6108
|
persona.total = pr.length;
|
|
6102
|
-
persona.rows = pr.map((r) => ({ scope: r.scope, key: r.ckey, value: String(r.cvalue || '').slice(0, 150), w: r.weight, ts: r.ts }));
|
|
6109
|
+
persona.rows = pr.map((r) => ({ scope: r.scope, key: r.ckey, value: redact(String(r.cvalue || '').slice(0, 150)), w: r.weight, ts: r.ts }));
|
|
6103
6110
|
} catch { /* 没有 persona 表也不影响 */ }
|
|
6104
6111
|
db.close();
|
|
6105
6112
|
backend = 'sqlite';
|
|
@@ -6124,7 +6131,7 @@ const dbFile = root ? join(root, '.qqbot', 'memory.db') : '';
|
|
|
6124
6131
|
scope: f.replace(/\.jsonl$/, ''),
|
|
6125
6132
|
total: items.length,
|
|
6126
6133
|
byKind,
|
|
6127
|
-
recent: items.slice(-8).reverse().map((it) => ({ kind: it.kind || '', text: String(it.text || '').slice(0, 160), ts: it.ts || 0 })),
|
|
6134
|
+
recent: items.slice(-8).reverse().map((it) => ({ kind: it.kind || '', text: redact(String(it.text || '').slice(0, 160)), ts: it.ts || 0 })),
|
|
6128
6135
|
});
|
|
6129
6136
|
}
|
|
6130
6137
|
}
|