dsh-memory-archivist 0.1.2 → 0.1.3
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/lib/patches.js +30 -0
- package/package.json +1 -1
package/lib/patches.js
CHANGED
|
@@ -166,6 +166,36 @@ export const PATCHES = [
|
|
|
166
166
|
},
|
|
167
167
|
],
|
|
168
168
|
},
|
|
169
|
+
{
|
|
170
|
+
id: 'qqbot.persist-session-on-reuse',
|
|
171
|
+
title: '内存复用的会话也回写 model-prefs,避免同群双会话',
|
|
172
|
+
file: path.join(QQ_PLUGIN, 'session', 'session-manager.js'),
|
|
173
|
+
marker: '// __PERSIST_ON_REUSE__',
|
|
174
|
+
ops: [
|
|
175
|
+
{
|
|
176
|
+
anchor: [
|
|
177
|
+
" const existing = this.sessions.get(key);",
|
|
178
|
+
" if (existing) {",
|
|
179
|
+
" existing.replyTarget = replyTarget;",
|
|
180
|
+
" existing.lastActivity = Date.now();",
|
|
181
|
+
" return existing;",
|
|
182
|
+
" }",
|
|
183
|
+
].join('\n'),
|
|
184
|
+
replacement: [
|
|
185
|
+
" const existing = this.sessions.get(key);",
|
|
186
|
+
" if (existing) {",
|
|
187
|
+
" existing.replyTarget = replyTarget;",
|
|
188
|
+
" existing.lastActivity = Date.now();",
|
|
189
|
+
" // __PERSIST_ON_REUSE__ 内存命中也要回写 prefs:插件侧删会话会 clearSessionId,",
|
|
190
|
+
" // 若这里静默复用旧 sessionId 而不落盘,会话就成了 prefs 里不存在的孤儿,",
|
|
191
|
+
" // 巡检看不到它,下次重启同群还会再建一个(2026-12-06 同群双会话的根因)。",
|
|
192
|
+
" this.persistSessionId(key, existing.sessionId);",
|
|
193
|
+
" return existing;",
|
|
194
|
+
" }",
|
|
195
|
+
].join('\n'),
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
169
199
|
]
|
|
170
200
|
|
|
171
201
|
/** 把用 \n 写的锚点/替换按目标文件的换行风格重写 */
|
package/package.json
CHANGED