@kenz1117/dsh-engram 0.11.4 → 0.11.5
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 +10 -1
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +55 -52
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7511,13 +7511,13 @@ async function runConsolidation(store, embedder, opts = {}) {
|
|
|
7511
7511
|
const key = record.content.slice(0, 60);
|
|
7512
7512
|
const existing = seen.get(key);
|
|
7513
7513
|
if (existing === void 0) seen.set(key, record);
|
|
7514
|
-
else
|
|
7514
|
+
else try {
|
|
7515
7515
|
const survivor = await store.supersedeMany({
|
|
7516
7516
|
scope,
|
|
7517
7517
|
kind: record.kind,
|
|
7518
7518
|
content: record.content,
|
|
7519
|
-
importance: record.importance,
|
|
7520
|
-
confidence: record.confidence
|
|
7519
|
+
importance: Math.max(existing.importance, record.importance),
|
|
7520
|
+
confidence: Math.max(existing.confidence, record.confidence)
|
|
7521
7521
|
}, [existing.id, record.id]);
|
|
7522
7522
|
merged += 1;
|
|
7523
7523
|
seen.set(key, survivor);
|
|
@@ -17353,7 +17353,7 @@ function estimateTokens(text) {
|
|
|
17353
17353
|
}
|
|
17354
17354
|
//#endregion
|
|
17355
17355
|
//#region package.json
|
|
17356
|
-
var version = "0.11.
|
|
17356
|
+
var version = "0.11.5";
|
|
17357
17357
|
//#endregion
|
|
17358
17358
|
//#region src/index.ts
|
|
17359
17359
|
/**
|
|
@@ -18854,57 +18854,60 @@ async function apply(ctx, config = {}) {
|
|
|
18854
18854
|
console.warn(message("core.warnDisposeFinalFailed"), error);
|
|
18855
18855
|
});
|
|
18856
18856
|
});
|
|
18857
|
-
if (resolved.reflect !== "off")
|
|
18858
|
-
const
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
const
|
|
18857
|
+
if (resolved.reflect !== "off") {
|
|
18858
|
+
const REFLECT_TIMEOUT_MS = 12e4;
|
|
18859
|
+
ctx.on("session/disposed", (session) => {
|
|
18860
|
+
const events = session.snapshotEvents();
|
|
18861
|
+
const sessionId = String(session.id);
|
|
18862
|
+
const cwd = sessionCwd(session);
|
|
18863
|
+
const route = resolved.routeOverride ?? routeFromEvents(events);
|
|
18864
|
+
const targets = [{
|
|
18865
|
+
scope: "user",
|
|
18866
|
+
open: () => openStore("user")
|
|
18867
|
+
}];
|
|
18868
|
+
if (cwd !== void 0 && existsSync(join(resolved.dbDir, dbNameForCwd(cwd)))) targets.push({
|
|
18869
|
+
scope: "project",
|
|
18870
|
+
open: () => openStoreForProjectCwd(cwd)
|
|
18871
|
+
});
|
|
18872
|
+
(async () => {
|
|
18873
|
+
for (const target of targets) try {
|
|
18874
|
+
const store = await target.open();
|
|
18875
|
+
if (resolved.reflect === "suggest") {
|
|
18876
|
+
const detail = JSON.stringify({
|
|
18877
|
+
scope: target.scope,
|
|
18878
|
+
sessionId
|
|
18879
|
+
});
|
|
18880
|
+
if (!await store.hasAudit("reflect-pending", detail)) await store.audit("reflect-pending", "AUX", detail);
|
|
18881
|
+
continue;
|
|
18882
|
+
}
|
|
18883
|
+
if (route === void 0) continue;
|
|
18884
|
+
const outcome = await reflectObservations({
|
|
18885
|
+
store,
|
|
18886
|
+
embedder: await embedderAttempt(),
|
|
18875
18887
|
scope: target.scope,
|
|
18876
|
-
|
|
18888
|
+
call: (params) => streamText(ctx, {
|
|
18889
|
+
...params,
|
|
18890
|
+
sessionId: session.id
|
|
18891
|
+
}),
|
|
18892
|
+
logRequest: (data) => {
|
|
18893
|
+
store.audit("reflect-request", "AUX", JSON.stringify(data)).catch(() => {});
|
|
18894
|
+
},
|
|
18895
|
+
route,
|
|
18896
|
+
signal: AbortSignal.timeout(REFLECT_TIMEOUT_MS)
|
|
18877
18897
|
});
|
|
18878
|
-
if (
|
|
18879
|
-
|
|
18898
|
+
if (outcome.formed + outcome.refined + outcome.confirmed + outcome.refuted > 0) console.log(message("core.logReflectDone", {
|
|
18899
|
+
scope: target.scope,
|
|
18900
|
+
formed: outcome.formed,
|
|
18901
|
+
refined: outcome.refined,
|
|
18902
|
+
confirmed: outcome.confirmed,
|
|
18903
|
+
refuted: outcome.refuted
|
|
18904
|
+
}));
|
|
18905
|
+
} catch (error) {
|
|
18906
|
+
console.warn(message("core.warnReflectFailed", { scope: target.scope }), error);
|
|
18880
18907
|
}
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
embedder: await embedderAttempt(),
|
|
18885
|
-
scope: target.scope,
|
|
18886
|
-
call: (params) => streamText(ctx, {
|
|
18887
|
-
...params,
|
|
18888
|
-
sessionId: session.id
|
|
18889
|
-
}),
|
|
18890
|
-
logRequest: (data) => {
|
|
18891
|
-
store.audit("reflect-request", "AUX", JSON.stringify(data)).catch(() => {});
|
|
18892
|
-
},
|
|
18893
|
-
route,
|
|
18894
|
-
signal: AbortSignal.timeout(FINAL_INGEST_TIMEOUT_MS)
|
|
18895
|
-
});
|
|
18896
|
-
if (outcome.formed + outcome.refined + outcome.confirmed + outcome.refuted > 0) console.log(message("core.logReflectDone", {
|
|
18897
|
-
scope: target.scope,
|
|
18898
|
-
formed: outcome.formed,
|
|
18899
|
-
refined: outcome.refined,
|
|
18900
|
-
confirmed: outcome.confirmed,
|
|
18901
|
-
refuted: outcome.refuted
|
|
18902
|
-
}));
|
|
18903
|
-
} catch (error) {
|
|
18904
|
-
console.warn(message("core.warnReflectFailed", { scope: target.scope }), error);
|
|
18905
|
-
}
|
|
18906
|
-
})();
|
|
18907
|
-
});
|
|
18908
|
+
})();
|
|
18909
|
+
});
|
|
18910
|
+
}
|
|
18908
18911
|
const OP_LOG_RETENTION_DAYS = 366;
|
|
18909
18912
|
const runDecay = async () => {
|
|
18910
18913
|
const targets = [{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenz1117/dsh-engram",
|
|
3
3
|
"description": "Local-first cross-session long-term memory for DeepSeek Harness: dual-scope SQLite stores, hybrid FTS5 + local-vector retrieval with RRF, an evidence gate, provenance audit and SM-2 spaced repetition. 23 narrow tools, zero external services, zero API keys.",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.5",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"logo": "icon-256.svg",
|
|
7
7
|
"publishConfig": {
|