dsh-memsearch-community 0.3.2 → 0.3.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/README.md +12 -0
- package/lib/index.js +20 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,18 @@ computed locally with ONNX.
|
|
|
12
12
|
|
|
13
13
|
## Changes from upstream
|
|
14
14
|
|
|
15
|
+
**0.3.3 — no duplicate rows from continuation turns**
|
|
16
|
+
|
|
17
|
+
A continuation turn (goal round, steered re-run) ends without a new user
|
|
18
|
+
message, but the assistant reply has a fresh event sequence. The old guard only
|
|
19
|
+
compared that sequence, so every continuation journaled the *same* prompt again.
|
|
20
|
+
Capture now tracks the user-message sequence too and skips a turn whose prompt
|
|
21
|
+
has not changed.
|
|
22
|
+
|
|
23
|
+
Also: a missing CLI is re-checked once a minute instead of staying cached until
|
|
24
|
+
the process restarts, and opening the archive folder no longer reports a false
|
|
25
|
+
failure on Windows.
|
|
26
|
+
|
|
15
27
|
**0.3.2 — edge cases found in review**
|
|
16
28
|
|
|
17
29
|
- A state file that is valid JSON but lacks `flags`/`sessions` crashed plugin
|
package/lib/index.js
CHANGED
|
@@ -151,8 +151,16 @@ function cliDirs() {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
let cliCache;
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
let cliCheckedAt = 0;
|
|
155
|
+
|
|
156
|
+
function resolveCli(force = false) {
|
|
157
|
+
// A missing CLI is re-checked at most once a minute: installing it outside the
|
|
158
|
+
// plugin must not require restarting the whole Harness.
|
|
159
|
+
if (!force && cliCache !== undefined) {
|
|
160
|
+
if (cliCache) return cliCache;
|
|
161
|
+
if (Date.now() - cliCheckedAt < 60000) return null;
|
|
162
|
+
}
|
|
163
|
+
cliCheckedAt = Date.now();
|
|
156
164
|
const candidates = ["memsearch", "memsearch.exe", "memsearch.cmd", "memsearch.bat"];
|
|
157
165
|
for (const dir of cliDirs()) {
|
|
158
166
|
for (const cand of candidates) {
|
|
@@ -287,7 +295,7 @@ function extractExchange(session) {
|
|
|
287
295
|
assistantSeq = event.seq;
|
|
288
296
|
break;
|
|
289
297
|
}
|
|
290
|
-
return { userText, assistantText, assistantSeq };
|
|
298
|
+
return { userText, assistantText, assistantSeq, userSeq };
|
|
291
299
|
}
|
|
292
300
|
|
|
293
301
|
/** Escape markdown headings so a reply cannot split the journal structure. */
|
|
@@ -419,7 +427,9 @@ async function checkRetention(config, archive, log) {
|
|
|
419
427
|
});
|
|
420
428
|
if (answer.ok && answer.answer) {
|
|
421
429
|
const res = await openFolder(archive.root);
|
|
422
|
-
|
|
430
|
+
// explorer.exe returns a non-zero status even when it opens the folder.
|
|
431
|
+
const failed = res && res.err && process.platform !== "win32";
|
|
432
|
+
log(`[memsearch] 已打开归档目录: ${archive.root}${failed ? " (打开失败)" : ""}`);
|
|
423
433
|
}
|
|
424
434
|
}
|
|
425
435
|
|
|
@@ -504,12 +514,15 @@ function apply(ctx, config) {
|
|
|
504
514
|
}
|
|
505
515
|
|
|
506
516
|
async function captureTurn() {
|
|
507
|
-
const { userText, assistantText, assistantSeq } = extractExchange(session);
|
|
517
|
+
const { userText, assistantText, assistantSeq, userSeq } = extractExchange(session);
|
|
508
518
|
if (!userText || userText.length < config.captureMinPromptLength) return;
|
|
509
519
|
if (assistantSeq === undefined) return;
|
|
510
520
|
const sessionId = session.id || (session.header && session.header.id) || "session";
|
|
511
|
-
|
|
512
|
-
|
|
521
|
+
// A continuation turn (goal round, steered re-run) ends without a new user
|
|
522
|
+
// message; capturing it again would duplicate the same prompt.
|
|
523
|
+
const last = state.lastCaptured.get(sessionId);
|
|
524
|
+
if (last && (last.assistantSeq === assistantSeq || last.userSeq === userSeq)) return;
|
|
525
|
+
state.lastCaptured.set(sessionId, { assistantSeq, userSeq });
|
|
513
526
|
|
|
514
527
|
const title = sessionTitle(session);
|
|
515
528
|
const now = new Date();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-memsearch-community",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Automatic local memory for DeepSeek Harness: per-day conversation archive by session title, semantic search index, first-run setup prompts, optional history import.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|