@kenz1117/dsh-engram 0.13.6 → 0.13.7
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 +11 -0
- package/README.md +20 -0
- package/i18n/ru.txt +2 -0
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +31 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -196,6 +196,7 @@ const zh$5 = {
|
|
|
196
196
|
"core.observationsHeader": "Consolidated beliefs (distilled from multiple stored memories; verify against sources before high-stakes use):",
|
|
197
197
|
"core.observationItem": "- {belief} ({count} sources)",
|
|
198
198
|
"core.reviewDue": "\nPalace review due today: {count}{plus} memories. Use engram_review_queue for active recall (recall beats re-reading).",
|
|
199
|
+
"core.reflectPending": "\n巩固待处理:有 {count} 组会话登记的记忆还没蒸馏。调用 engram_reflect 整理——只摄取不整理,记忆就是散的。",
|
|
199
200
|
"core.compressSystem": "把记忆条目压缩为更短的一句话表述(每条不超过 40 个字符),保留可跨会话复用的关键信息(事实、偏好、决策、方法)。\n只输出一个 JSON 数组,每项形如 {\"id\": \"原样返回的id\", \"content\": \"压缩后表述\"},条目数量与 id 必须与输入一一对应。\n不要输出 JSON 以外的任何内容。",
|
|
200
201
|
"core.rationaleHeader": "本轮画像共 {count} 条记忆,挑选理由如下:",
|
|
201
202
|
"core.rationaleFooter": "如果某条理由错误,请通过 engram_report 反馈,越准的画像越能帮你。",
|
|
@@ -231,6 +232,7 @@ const zh$5 = {
|
|
|
231
232
|
"core.warnDisposeFinalFailed": "[dsh-engram] 会话结束的收尾处理异常(不影响对话):",
|
|
232
233
|
"core.warnInjectionSnapshotFailed": "[dsh-engram] 注入快照落库失败(不影响对话):",
|
|
233
234
|
"core.warnReflectFailed": "[dsh-engram] 会话结束的信念巩固异常({scope},不影响对话):",
|
|
235
|
+
"core.warnIngestWithoutReflect": "[dsh-engram] ingest 开启但 reflect 为 off:记忆只摄取不整理(读起来就是散的)。建议 reflect: auto(或 suggest,靠会话提醒驱动),或定期运行 engram_reflect。",
|
|
234
236
|
"core.warnReflectBatchDropped": "[dsh-engram] 信念巩固丢弃 {count} 条候选(输出预算/解析失败;未被巩固、下次巩固继续取材)",
|
|
235
237
|
"core.warnDecayStartupFailed": "[dsh-engram] 启动衰减调度失败(跳过):",
|
|
236
238
|
"core.warnDecayPeriodicFailed": "[dsh-engram] 周期衰减调度失败(跳过):",
|
|
@@ -254,6 +256,8 @@ const en$5 = {
|
|
|
254
256
|
"core.observationsHeader": "Consolidated beliefs (distilled from multiple stored memories; verify against sources before high-stakes use):",
|
|
255
257
|
"core.observationItem": "- {belief} ({count} sources)",
|
|
256
258
|
"core.reviewDue": "\nPalace review due today: {count}{plus} memories. Use engram_review_queue for active recall (recall beats re-reading).",
|
|
259
|
+
"core.reflectPending": "\nConsolidation pending: {count} session registration(s) hold memories not yet distilled. Call engram_reflect to consolidate them — ingested memories stay scattered until reflected.",
|
|
260
|
+
"core.warnIngestWithoutReflect": "[dsh-engram] ingest is on but reflect is off — memories accumulate without consolidation (they read scattered). Set reflect: auto (or suggest), or run engram_reflect regularly.",
|
|
257
261
|
"core.compressSystem": "Compress each memory entry into a shorter single-sentence wording (at most 40 characters per entry), keeping the key information that can be reused across sessions (facts, preferences, decisions, methods).\nOutput only one JSON array, each item shaped like {\"id\": \"the id returned verbatim\", \"content\": \"the compressed wording\"}; the number of items and the ids must correspond one-to-one with the input.\nDo not output anything other than JSON.",
|
|
258
262
|
"core.rationaleHeader": "This profile holds {count} memories in total; they were picked for the following reasons:",
|
|
259
263
|
"core.rationaleFooter": "If any reason is wrong, report it via engram_report — the more accurate the profile, the better it helps you.",
|
|
@@ -1508,6 +1512,7 @@ const CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
1508
1512
|
"autoSlot",
|
|
1509
1513
|
"reviewScheduling",
|
|
1510
1514
|
"assessReminder",
|
|
1515
|
+
"reflectReminder",
|
|
1511
1516
|
"palaceChangeWindowSec",
|
|
1512
1517
|
"panelAccess",
|
|
1513
1518
|
"historyBackfillDays",
|
|
@@ -1569,6 +1574,7 @@ const Config = z.object({
|
|
|
1569
1574
|
panelAccess: z.string(),
|
|
1570
1575
|
palaceChangeWindowSec: z.number().step(1).min(5).max(600),
|
|
1571
1576
|
assessReminder: z.boolean(),
|
|
1577
|
+
reflectReminder: z.boolean(),
|
|
1572
1578
|
historyBackfillDays: z.number().step(1).min(0).max(3650),
|
|
1573
1579
|
historyBackfillMaxTurnsPerSession: z.number().step(1).min(1).max(500),
|
|
1574
1580
|
historyBackfillMaxTotalTurns: z.number().step(1).min(1).max(5e3),
|
|
@@ -1713,6 +1719,7 @@ function resolveConfig(config = {}) {
|
|
|
1713
1719
|
injectItemBudgetDecay: config.injectItemBudgetDecay ?? .9,
|
|
1714
1720
|
injectItemBudgetFloor: config.injectItemBudgetFloor ?? 24,
|
|
1715
1721
|
assessReminder: config.assessReminder ?? true,
|
|
1722
|
+
reflectReminder: config.reflectReminder ?? true,
|
|
1716
1723
|
rankRecencyWeight: config.rankRecencyWeight ?? .2,
|
|
1717
1724
|
rankProofWeight: config.rankProofWeight ?? .1,
|
|
1718
1725
|
queryRewrite: config.queryRewrite ?? true,
|
|
@@ -2512,6 +2519,7 @@ const en = {
|
|
|
2512
2519
|
governanceConflicts: "Conflicts",
|
|
2513
2520
|
governanceBeliefs: "Beliefs",
|
|
2514
2521
|
systemRuntime: "Runtime",
|
|
2522
|
+
systemGuardIngestNoReflect: "Ingest is on but consolidation (reflect) is off: memories are collected but never distilled — they read scattered. Set reflect: auto or suggest in the config.",
|
|
2515
2523
|
systemStorage: "Storage",
|
|
2516
2524
|
systemModels: "Models & language",
|
|
2517
2525
|
pageHeaderRuntimeSubtitle: "Plugin and panel versions, the durable job queue, embedding model status.",
|
|
@@ -3170,6 +3178,7 @@ const ru = {
|
|
|
3170
3178
|
governanceConflicts: "Противоречия",
|
|
3171
3179
|
governanceBeliefs: "Убеждения",
|
|
3172
3180
|
systemRuntime: "Время выполнения",
|
|
3181
|
+
systemGuardIngestNoReflect: "Ingest включён, но обобщение (reflect) выключено: воспоминания собираются, но не перегоняются — и читаются разрозненно. Задайте reflect: auto или suggest в конфигурации.",
|
|
3173
3182
|
systemStorage: "Хранилище",
|
|
3174
3183
|
systemModels: "Модели и язык",
|
|
3175
3184
|
pageHeaderRuntimeSubtitle: "Версии плагина и панели, очередь устойчивых заданий, состояние модели эмбеддинга.",
|
|
@@ -3826,6 +3835,7 @@ const zh = {
|
|
|
3826
3835
|
governanceConflicts: "矛盾",
|
|
3827
3836
|
governanceBeliefs: "信念",
|
|
3828
3837
|
systemRuntime: "运行时",
|
|
3838
|
+
systemGuardIngestNoReflect: "摄取已开启但整理(reflect)为关闭:记忆只收集不蒸馏,读起来会是散的。建议在配置里设置 reflect: auto 或 suggest。",
|
|
3829
3839
|
systemStorage: "存储",
|
|
3830
3840
|
systemModels: "模型与词典",
|
|
3831
3841
|
pageHeaderRuntimeSubtitle: "插件与面板版本、持久作业队列、嵌入模型状态。",
|
|
@@ -11545,7 +11555,11 @@ function registerEngramRoutes(ctx, deps) {
|
|
|
11545
11555
|
return;
|
|
11546
11556
|
}
|
|
11547
11557
|
if (req.method === "GET" && route === "version") {
|
|
11548
|
-
json(res, 200, {
|
|
11558
|
+
json(res, 200, {
|
|
11559
|
+
pluginVersion: deps.pluginVersion,
|
|
11560
|
+
ingest: deps.ingest,
|
|
11561
|
+
reflect: deps.reflect
|
|
11562
|
+
});
|
|
11549
11563
|
return;
|
|
11550
11564
|
}
|
|
11551
11565
|
if (req.method === "GET" && route === "registry") {
|
|
@@ -18768,7 +18782,7 @@ function estimateTokens(text) {
|
|
|
18768
18782
|
return Math.ceil(wide * WIDE_TOKENS_PER_CHAR + narrow / 4);
|
|
18769
18783
|
}
|
|
18770
18784
|
// package.json
|
|
18771
|
-
var version = "0.13.
|
|
18785
|
+
var version = "0.13.7";
|
|
18772
18786
|
// src/index.ts
|
|
18773
18787
|
/**
|
|
18774
18788
|
* dsh-engram:DeepSeek Harness 跨会话长期记忆插件(host 半)。
|
|
@@ -19040,6 +19054,16 @@ async function preStep(ctx, openStore, openStoreForProjectCwd, resolved, embedde
|
|
|
19040
19054
|
const top = await store.topActive("user", resolved.profileTopN);
|
|
19041
19055
|
if (top.length === 0 && curated === void 0) return decision;
|
|
19042
19056
|
const dueTotal = resolved.reviewScheduling ? (await Promise.all(["user", "project"].map(async (scope) => (await openStore(scope)).dueReviews(Date.now(), 50)))).reduce((sum, rows) => sum + rows.length, 0) : 0;
|
|
19057
|
+
let reflectPending = 0;
|
|
19058
|
+
if (resolved.reflect === "suggest" && resolved.reflectReminder) reflectPending = (await Promise.all(["user", "project"].map(async (scope) => {
|
|
19059
|
+
return (await (await openStore(scope)).listAuditDetails("reflect-pending")).reduce((total, detail) => {
|
|
19060
|
+
try {
|
|
19061
|
+
return JSON.parse(detail).scope === scope ? total + 1 : total;
|
|
19062
|
+
} catch {
|
|
19063
|
+
return total;
|
|
19064
|
+
}
|
|
19065
|
+
}, 0);
|
|
19066
|
+
}))).reduce((sum, count) => sum + count, 0);
|
|
19043
19067
|
const itemBudget = {
|
|
19044
19068
|
start: resolved.injectItemBudgetStart,
|
|
19045
19069
|
decay: resolved.injectItemBudgetDecay,
|
|
@@ -19076,7 +19100,8 @@ async function preStep(ctx, openStore, openStoreForProjectCwd, resolved, embedde
|
|
|
19076
19100
|
count: dueTotal,
|
|
19077
19101
|
plus: dueTotal >= 50 ? "+" : ""
|
|
19078
19102
|
});
|
|
19079
|
-
const
|
|
19103
|
+
const reflectPendingLine = reflectPending === 0 ? "" : message("core.reflectPending", { count: reflectPending });
|
|
19104
|
+
const textWithRationale = wrapWithRationale(text, top) + dueLine + reflectPendingLine;
|
|
19080
19105
|
const hash = createHash("sha256").update(`${parts.curated ?? ""}\n${textWithRationale}`).digest("hex");
|
|
19081
19106
|
if (!compacted && hash === sessionState.lastProfileHash) return decision;
|
|
19082
19107
|
sessionState.lastProfileHash = hash;
|
|
@@ -19453,6 +19478,7 @@ async function apply(ctx, config = {}) {
|
|
|
19453
19478
|
/** Ожидание базы под текущий язык: пересчитывается, а не берётся из сборки плагина. */
|
|
19454
19479
|
const baseTargetNow = () => resolveBaseTarget(registry, basesLanguage, resolved.embedder);
|
|
19455
19480
|
setExtraRedactWords(resolved.redactWords);
|
|
19481
|
+
if (resolved.ingest !== "off" && resolved.reflect === "off") console.warn(message("core.warnIngestWithoutReflect"));
|
|
19456
19482
|
mkdirSync(resolved.dbDir, {
|
|
19457
19483
|
recursive: true,
|
|
19458
19484
|
mode: 448
|
|
@@ -20240,6 +20266,8 @@ async function apply(ctx, config = {}) {
|
|
|
20240
20266
|
mirrorDir: `${resolved.dbDir}/palaces`,
|
|
20241
20267
|
dbDir: resolved.dbDir,
|
|
20242
20268
|
dshHome: resolved.dshHome,
|
|
20269
|
+
ingest: resolved.ingest,
|
|
20270
|
+
reflect: resolved.reflect,
|
|
20243
20271
|
pluginVersion: VERSION,
|
|
20244
20272
|
language: resolved.language,
|
|
20245
20273
|
panelAccess: resolved.panelAccess,
|
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.13.
|
|
4
|
+
"version": "0.13.7",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"logo": "icon-256.svg",
|
|
7
7
|
"publishConfig": {
|