dsh-memsearch-community 0.2.1 → 0.2.2
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 +23 -3
- 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.2.2 — capture actually runs**
|
|
16
|
+
|
|
17
|
+
DSH's `Session` class exposes its log through `snapshotEvents()`, `ownEvents()`
|
|
18
|
+
and `eventAt()`; it has no `events` property. The upstream capture handler
|
|
19
|
+
guarded on `session.events`, so the guard was always false and **no turn was ever
|
|
20
|
+
journaled** on current DSH releases — journals only ever contained hand-written
|
|
21
|
+
test entries.
|
|
22
|
+
|
|
23
|
+
The plugin now reads the log through `snapshotEvents()` with fallbacks to
|
|
24
|
+
`ownEvents()` and the legacy `events` array, so capture works on both current
|
|
25
|
+
and older builds.
|
|
26
|
+
|
|
15
27
|
**0.2.1 — capture the real prompt**
|
|
16
28
|
|
|
17
29
|
DeepSeek Harness delivers injected context as ordinary `user/message` events:
|
package/lib/index.js
CHANGED
|
@@ -172,6 +172,26 @@ function messageOf(data) {
|
|
|
172
172
|
/** Blocks the harness injects into the conversation; never a real user prompt. */
|
|
173
173
|
const INJECTED_TEXT = /^\s*(<system-reminder>|Time sampled while preparing)/;
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Committed events of a session.
|
|
177
|
+
*
|
|
178
|
+
* DSH exposes the log through `snapshotEvents()`; older builds also carried a
|
|
179
|
+
* plain `events` array. Reading only `session.events` silently disabled capture
|
|
180
|
+
* on current releases, because that property no longer exists.
|
|
181
|
+
*/
|
|
182
|
+
function sessionEvents(session) {
|
|
183
|
+
if (!session) return [];
|
|
184
|
+
if (typeof session.snapshotEvents === "function") {
|
|
185
|
+
const events = session.snapshotEvents();
|
|
186
|
+
return Array.isArray(events) ? events : [];
|
|
187
|
+
}
|
|
188
|
+
if (typeof session.ownEvents === "function") {
|
|
189
|
+
const events = session.ownEvents();
|
|
190
|
+
return Array.isArray(events) ? events : [];
|
|
191
|
+
}
|
|
192
|
+
return Array.isArray(session.events) ? session.events : [];
|
|
193
|
+
}
|
|
194
|
+
|
|
175
195
|
/**
|
|
176
196
|
* The last exchange of the session: the newest genuine user prompt plus the
|
|
177
197
|
* final assistant reply that follows it.
|
|
@@ -184,7 +204,7 @@ const INJECTED_TEXT = /^\s*(<system-reminder>|Time sampled while preparing)/;
|
|
|
184
204
|
function extractExchange(session) {
|
|
185
205
|
let userText = "";
|
|
186
206
|
let userSeq = -1;
|
|
187
|
-
const events =
|
|
207
|
+
const events = sessionEvents(session);
|
|
188
208
|
for (let i = 0; i < events.length; i++) {
|
|
189
209
|
const event = events[i];
|
|
190
210
|
if (!event || typeof event !== "object" || event.type !== "user/message") continue;
|
|
@@ -316,8 +336,8 @@ function apply(ctx, config) {
|
|
|
316
336
|
if (config.capture) {
|
|
317
337
|
ctx.on("session/event", (session, event) => {
|
|
318
338
|
try {
|
|
319
|
-
if (!event || event.type !== "turn/end") return;
|
|
320
|
-
|
|
339
|
+
if (!event || event.type !== "turn/end" || !session) return;
|
|
340
|
+
captureTurn(config, memoryDir, session, state);
|
|
321
341
|
} catch (err) {
|
|
322
342
|
console.error(`[dsh-memsearch] session/event failed: ${err && err.message ? err.message : String(err)}`);
|
|
323
343
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-memsearch-community",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Automatic local semantic memory for DeepSeek Harness: journals every turn, indexes it with memsearch, and lets the agent recall earlier sessions. Community fork that captures only genuine user prompts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|