sage-mem 2.15.0 → 2.15.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.en.md +1 -1
- package/README.md +1 -1
- package/lib/client.js +66 -13
- package/lib/memory/scan.js +26 -5
- package/lib/typert.host.js +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
**Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker.**
|
|
14
14
|
|
|
15
|
-
**Current release: `2.15.
|
|
15
|
+
**Current release: `2.15.2`** — the npm badge above is the dynamic source of truth. **Contract baseline: `1.0.0`** — the first stable release, whose public commitments, the capability boundaries and the list of things it explicitly cannot do are frozen in the
|
|
16
16
|
[frozen contract](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md).
|
|
17
17
|
|
|
18
18
|
If it is useful to you, a Star is the most direct feedback.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
> File-based cross-session memory for DeepSeek Harness — every memory is a plain markdown file you can open, edit and delete. No database, no worker, no port.
|
|
16
16
|
|
|
17
|
-
**当前发布版本:`2.15.
|
|
17
|
+
**当前发布版本:`2.15.2`** —— 顶部 npm 徽章是动态权威。**契约基线:`1.0.0`** —— 第一个稳定版,公开承诺、能力边界与「明确做不到」的清单冻结在
|
|
18
18
|
[契约冻结](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md)。
|
|
19
19
|
|
|
20
20
|
如果它对你有用,给个 Star 是最直接的反馈。
|
package/lib/client.js
CHANGED
|
@@ -4846,15 +4846,19 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
4846
4846
|
"todo.filter.openTitle": "只显示未完成(待删除块照旧显示:它是待清空的队列)",
|
|
4847
4847
|
"todo.filter.all": "全部",
|
|
4848
4848
|
"todo.filter.allTitle": "连旧文件里遗留的 - [x] 行一起显示",
|
|
4849
|
-
"todo.undoDepth.label": "
|
|
4849
|
+
"todo.undoDepth.label": "撤销上限",
|
|
4850
4850
|
"todo.undoDepth.option": "{n} 步",
|
|
4851
4851
|
"todo.action.undoTitle": "撤销上一步(栈深 {depth} 步,只在本次页面里有效)",
|
|
4852
4852
|
"todo.action.archive": "搬进流水({count})",
|
|
4853
|
+
"todo.action.archiveConfirm": "确认搬进流水({count})",
|
|
4854
|
+
"todo.action.archiveConfirm.title": "会写进 {file},并从清单删掉 {count} 行;这一步不可撤销",
|
|
4853
4855
|
"todo.notice.archived": "已把 {count} 条搬进 {file},并从清单里删掉(这一步不可撤销)",
|
|
4854
4856
|
"todo.notice.archivedDup": "这些条目在 {file} 里都已经有了,只删掉了清单里那几行",
|
|
4855
4857
|
"todo.notice.archiveStale": "{count} 条已写进流水,但清单刚被别处改过:清单里那几行**没删**,刷新后再点一次即可(重复会被跳过)",
|
|
4856
4858
|
"todo.cp.title": "检查点里的未完成(只读)",
|
|
4857
4859
|
"todo.cp.note": "来自 tasks/*/WORKING.md 的「未完成」节。这里只显示,改动请回到那份检查点。",
|
|
4860
|
+
"todo.cp.truncated": "还有未列出的任务或条目(显示上限所致)",
|
|
4861
|
+
"todo.cp.skipped": "有 {count} 个任务读不出检查点,已跳过",
|
|
4858
4862
|
"todo.disabled.title": "待办看板已在「实验性」里关闭",
|
|
4859
4863
|
"todo.disabled.hint": "打开:设置 → 记忆管理 → 实验性 → 待办清单看板",
|
|
4860
4864
|
"todo.lab.title": "待办清单看板(实验性)",
|
|
@@ -5487,10 +5491,12 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
5487
5491
|
"todo.filter.openTitle": "Show open items only (the pending-deletion block stays: it is a queue to clear)",
|
|
5488
5492
|
"todo.filter.all": "All",
|
|
5489
5493
|
"todo.filter.allTitle": "Also show legacy - [x] lines left in the file",
|
|
5490
|
-
"todo.undoDepth.label": "Undo",
|
|
5494
|
+
"todo.undoDepth.label": "Undo limit",
|
|
5491
5495
|
"todo.undoDepth.option": "{n} steps",
|
|
5492
5496
|
"todo.action.undoTitle": "Undo the last edit (stack depth {depth}; in-memory only)",
|
|
5493
5497
|
"todo.action.archive": "Move to log ({count})",
|
|
5498
|
+
"todo.action.archiveConfirm": "Confirm move ({count})",
|
|
5499
|
+
"todo.action.archiveConfirm.title": "Appends to {file} and removes {count} line(s) from the list; this cannot be undone",
|
|
5494
5500
|
"todo.notice.archived": "Moved {count} item(s) into {file} and removed them from the list (this cannot be undone)",
|
|
5495
5501
|
"todo.notice.archivedDup": "Those items were already in {file}; only the list lines were removed",
|
|
5496
5502
|
"todo.notice.archiveStale": "{count} item(s) were appended to the log, but the list changed elsewhere: its lines were NOT removed. Refresh and click again — duplicates are skipped.",
|
|
@@ -5498,6 +5504,8 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
5498
5504
|
"todo.disabled.hint": "Turn it on: Settings → Memory management → Lab → To-do board",
|
|
5499
5505
|
"todo.cp.title": "Open items in checkpoints (read-only)",
|
|
5500
5506
|
"todo.cp.note": "From the open-work section of tasks/*/WORKING.md. Display only — edit the checkpoint itself.",
|
|
5507
|
+
"todo.cp.truncated": "More tasks or items exist than shown (display cap)",
|
|
5508
|
+
"todo.cp.skipped": "{count} task(s) could not be read and were skipped",
|
|
5501
5509
|
"todo.lab.title": "To-do board (experimental)",
|
|
5502
5510
|
"todo.lab.switch": "Enable the to-do board",
|
|
5503
5511
|
"todo.lab.switch.title": "Adds a To-dos tab to the right sidebar",
|
|
@@ -10165,7 +10173,10 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10165
10173
|
current.items.push(item);
|
|
10166
10174
|
// 插入点 = 本条之后:节尾最后一条的下方,不会被后面的空行 / 下一节吃掉。
|
|
10167
10175
|
current.insertAt = i + 1;
|
|
10168
|
-
|
|
10176
|
+
// 2.15.1:**「长期约束」不算未完成**。那一节的标题自己写着「不是待办」,
|
|
10177
|
+
// 把它计入「N 条未完成」既骗人又和标题冲突(真机截图里 30 条里有 8 条是约束)。
|
|
10178
|
+
// 已完成计数不受影响:待删除块里的条目本来就是 done。
|
|
10179
|
+
if (item.done) done += 1; else if (current.kind !== "constraint") open += 1;
|
|
10169
10180
|
lastItem = item;
|
|
10170
10181
|
continue;
|
|
10171
10182
|
}
|
|
@@ -10448,10 +10459,23 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10448
10459
|
}
|
|
10449
10460
|
const sDraft = react.useState("");
|
|
10450
10461
|
const draft = sDraft[0], setDraft = sDraft[1];
|
|
10462
|
+
// 2.15.1:「搬进流水」两步确认 —— 它不可撤销(流水那半撤不回来),
|
|
10463
|
+
// 点一下就把记忆流水写掉、清单行删掉,不该是一次误触就能完成的动作。
|
|
10464
|
+
const sConfirm = react.useState(false);
|
|
10465
|
+
const confirming = sConfirm[0], setConfirming = sConfirm[1];
|
|
10466
|
+
react.useEffect(function () {
|
|
10467
|
+
// 块被清空 / 换了一份文件时,别让确认态悬着。
|
|
10468
|
+
if (blockCountRaw() === 0) setConfirming(false);
|
|
10469
|
+
}, [props.doneCount, sec.items.length]);
|
|
10470
|
+
function blockCountRaw() {
|
|
10471
|
+
return typeof props.doneCount === "number" ? props.doneCount : sec.items.length;
|
|
10472
|
+
}
|
|
10451
10473
|
const openCount = sec.items.filter(function (it) { return !it.done; }).length;
|
|
10452
10474
|
const doneCount = sec.items.length - openCount;
|
|
10453
10475
|
// 「清空全部」清的是**整个块**(不是当前筛出来的这几条),所以按钮上的数字要取块的真实条数。
|
|
10454
|
-
const blockCount =
|
|
10476
|
+
const blockCount = blockCountRaw();
|
|
10477
|
+
// 2.15.1:待删除块里没有「未完成」,别画那个永远是 0 的「0 / N」。
|
|
10478
|
+
const countText = isDone ? String(doneCount || blockCount) : String(openCount) + (doneCount > 0 ? " / " + String(doneCount) : "");
|
|
10455
10479
|
return h("section", { className: "smem-todo-group" + (isDone ? " smem-todo-group-done" : "") }, [
|
|
10456
10480
|
// 标题行是**行**不是按钮:右边还要放「清空全部」,按钮套按钮在浏览器里会互相吃掉。
|
|
10457
10481
|
h("div", { key: "head", className: "smem-todo-group-head" }, [
|
|
@@ -10463,17 +10487,35 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10463
10487
|
}, [
|
|
10464
10488
|
h("span", { key: "chev", className: "smem-todo-chev" }, collapsed ? "▸" : "▾"),
|
|
10465
10489
|
h("span", { key: "t", className: "smem-todo-group-title" }, sec.title || (isDone ? t("todo.doneGroup") : t(TODO_SECTION_FALLBACK))),
|
|
10466
|
-
h("span", { key: "n", className: "smem-todo-count" },
|
|
10490
|
+
h("span", { key: "n", className: "smem-todo-count" }, countText),
|
|
10467
10491
|
]),
|
|
10468
10492
|
isDone && blockCount > 0
|
|
10493
|
+
? (confirming
|
|
10494
|
+
? h("button", {
|
|
10495
|
+
key: "archiveConfirm",
|
|
10496
|
+
type: "button",
|
|
10497
|
+
className: "smem-todo-mini smem-todo-archive smem-todo-del",
|
|
10498
|
+
title: t("todo.action.archiveConfirm.title", { count: blockCount, file: TODO_LOG_FILE }),
|
|
10499
|
+
disabled: props.busy,
|
|
10500
|
+
onClick: function () { setConfirming(false); props.onArchive(sec); },
|
|
10501
|
+
}, t("todo.action.archiveConfirm", { count: blockCount }))
|
|
10502
|
+
: h("button", {
|
|
10503
|
+
key: "archive",
|
|
10504
|
+
type: "button",
|
|
10505
|
+
className: "smem-todo-mini smem-todo-archive",
|
|
10506
|
+
title: t("todo.action.archive", { count: blockCount, file: TODO_LOG_FILE }),
|
|
10507
|
+
disabled: props.busy,
|
|
10508
|
+
onClick: function () { setConfirming(true); },
|
|
10509
|
+
}, t("todo.action.archive", { count: blockCount, file: TODO_LOG_FILE })))
|
|
10510
|
+
: null,
|
|
10511
|
+
isDone && blockCount > 0 && confirming
|
|
10469
10512
|
? h("button", {
|
|
10470
|
-
key: "
|
|
10513
|
+
key: "archiveCancel",
|
|
10471
10514
|
type: "button",
|
|
10472
|
-
className: "smem-todo-mini
|
|
10473
|
-
title: t("todo.action.archive", { count: blockCount, file: TODO_LOG_FILE }),
|
|
10515
|
+
className: "smem-todo-mini",
|
|
10474
10516
|
disabled: props.busy,
|
|
10475
|
-
onClick: function () {
|
|
10476
|
-
}, t("todo.action.
|
|
10517
|
+
onClick: function () { setConfirming(false); },
|
|
10518
|
+
}, t("todo.action.cancel"))
|
|
10477
10519
|
: null,
|
|
10478
10520
|
isDone && blockCount > 0
|
|
10479
10521
|
? h("button", {
|
|
@@ -10554,6 +10596,10 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10554
10596
|
]);
|
|
10555
10597
|
})) : null,
|
|
10556
10598
|
open ? h("div", { key: "note", className: "smem-todo-cp-note" }, t("todo.cp.note")) : null,
|
|
10599
|
+
// 2.15.2:宿主说了「被截断 / 有任务读不出来」就必须说出来 ——
|
|
10600
|
+
// 只说「检查点里的未完成」而不提这两件事,等于把不完整的清单当完整的给。
|
|
10601
|
+
props.truncated ? h("div", { key: "trunc", className: "smem-todo-cp-note" }, t("todo.cp.truncated")) : null,
|
|
10602
|
+
props.skipped > 0 ? h("div", { key: "skip", className: "smem-todo-cp-note" }, t("todo.cp.skipped", { count: props.skipped })) : null,
|
|
10557
10603
|
]);
|
|
10558
10604
|
}
|
|
10559
10605
|
|
|
@@ -10595,7 +10641,12 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10595
10641
|
Promise.resolve(remote.checkpoints()).then(function (res) {
|
|
10596
10642
|
const data = unwrap(res);
|
|
10597
10643
|
if (!data || data.ok === false) { setCheckpoints(null); return; }
|
|
10598
|
-
|
|
10644
|
+
// 2.15.2:把「被截断」与「读不出来被跳过」也带上 —— 否则面板说的「完整」是假的。
|
|
10645
|
+
setCheckpoints({
|
|
10646
|
+
tasks: Array.isArray(data.tasks) ? data.tasks : [],
|
|
10647
|
+
truncated: data.truncated === true,
|
|
10648
|
+
skipped: typeof data.skipped === "number" ? data.skipped : 0,
|
|
10649
|
+
});
|
|
10599
10650
|
}, function () { /* 读不到就不显示,别在清单旁边堆一条错误 */ });
|
|
10600
10651
|
}, [remote]);
|
|
10601
10652
|
|
|
@@ -10870,10 +10921,12 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10870
10921
|
const doneBlock = parsed.sections.find(function (sec) { return sec.kind === "done"; });
|
|
10871
10922
|
const doneBlockCount = doneBlock ? doneBlock.items.length : 0;
|
|
10872
10923
|
// 检查点区块的条目总数(只读,来自 tasks/*/WORKING.md)。
|
|
10873
|
-
const cpTasks = (checkpoints || []).filter(function (task) {
|
|
10924
|
+
const cpTasks = ((checkpoints && checkpoints.tasks) || []).filter(function (task) {
|
|
10874
10925
|
return task && Array.isArray(task.items) && task.items.length > 0;
|
|
10875
10926
|
});
|
|
10876
10927
|
const cpCount = cpTasks.reduce(function (n, task) { return n + task.items.length; }, 0);
|
|
10928
|
+
const cpTruncated = !!(checkpoints && checkpoints.truncated);
|
|
10929
|
+
const cpSkipped = (checkpoints && checkpoints.skipped) || 0;
|
|
10877
10930
|
|
|
10878
10931
|
return h("div", { className: "smem-todo" }, [
|
|
10879
10932
|
h("div", { key: "head", className: "smem-todo-head" }, [
|
|
@@ -10937,7 +10990,7 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10937
10990
|
err ? h("div", { key: "err", className: "smem-err" }, "⚠ " + err) : null,
|
|
10938
10991
|
notice ? h("div", { key: "ok", className: "smem-ok" }, "✓ " + notice) : null,
|
|
10939
10992
|
cpCount > 0
|
|
10940
|
-
? h(TodoCheckpointBlock, { key: "cp", tasks: cpTasks, count: cpCount })
|
|
10993
|
+
? h(TodoCheckpointBlock, { key: "cp", tasks: cpTasks, count: cpCount, truncated: cpTruncated, skipped: cpSkipped })
|
|
10941
10994
|
: null,
|
|
10942
10995
|
missing
|
|
10943
10996
|
? h("div", { key: "miss", className: "smem-todo-empty" }, t("todo.empty.file", { file: TODO_FILE }))
|
package/lib/memory/scan.js
CHANGED
|
@@ -685,19 +685,40 @@ export async function scanCheckpointOpen(stateRoot) {
|
|
|
685
685
|
.sort()
|
|
686
686
|
const truncated = ids.length > CHECKPOINT_TASK_LIMIT
|
|
687
687
|
const tasks = []
|
|
688
|
+
let itemsTruncated = false
|
|
689
|
+
let skipped = 0
|
|
688
690
|
for (const id of ids.slice(0, CHECKPOINT_TASK_LIMIT)) {
|
|
691
|
+
const full = join(dir, id, CHECKPOINT_FILE_NAME)
|
|
692
|
+
// 2.15.2:走别的记忆文件同一套**形状闸门**(符号链接 / 目录联接一律不读,
|
|
693
|
+
// 体积在**读之前**按字节判)。原先这里裸 `readFile` 再比 `text.length`:
|
|
694
|
+
// 链接能被读成任意文件,而且 `length` 是 UTF-16 码元、不是字节(中文差三倍)。
|
|
695
|
+
const gate = await inspectMemoryEntry(full, { limitBytes: CHECKPOINT_READ_LIMIT })
|
|
696
|
+
if (!gate.ok) {
|
|
697
|
+
// 「这个任务没有 WORKING.md」是正常状态;别的失败要出声,否则面板会说「没有欠活」。
|
|
698
|
+
if (gate.code !== 'missing') {
|
|
699
|
+
skipped += 1
|
|
700
|
+
warnLog(`checkpoints: skip ${id}: ${gate.error}`)
|
|
701
|
+
}
|
|
702
|
+
continue
|
|
703
|
+
}
|
|
689
704
|
let text = ''
|
|
690
705
|
try {
|
|
691
|
-
text = await
|
|
706
|
+
text = await readVerified(full, gate, 'utf8')
|
|
692
707
|
} catch (err) {
|
|
693
|
-
|
|
708
|
+
skipped += 1
|
|
709
|
+
warnLog(`checkpoints: skip ${id}: ${(err && err.message) || err}`)
|
|
710
|
+
continue
|
|
694
711
|
}
|
|
695
|
-
if (text.length > CHECKPOINT_READ_LIMIT) continue
|
|
696
712
|
const parsed = parseCheckpoint(text)
|
|
697
713
|
if (parsed.malformedReason !== '') continue
|
|
698
|
-
const
|
|
714
|
+
const all = itemsOf(parsed.sections[TODO_SECTION] || '')
|
|
715
|
+
const items = all.slice(0, CHECKPOINT_ITEM_LIMIT)
|
|
699
716
|
if (items.length === 0) continue
|
|
717
|
+
if (all.length > CHECKPOINT_ITEM_LIMIT) itemsTruncated = true
|
|
700
718
|
tasks.push({ taskId: id, project: parsed.project, revision: parsed.revision, items })
|
|
701
719
|
}
|
|
702
|
-
|
|
720
|
+
// `truncated` 现在同时表达「任务被截」「某任务的条目被截」—— 面板据此说「还有更多」。
|
|
721
|
+
const out = { ok: true, tasks, truncated: truncated || itemsTruncated }
|
|
722
|
+
if (skipped > 0) out.skipped = skipped
|
|
723
|
+
return out
|
|
703
724
|
}
|
package/lib/typert.host.js
CHANGED
|
@@ -656,7 +656,7 @@ const checkpointTaskSchema = z.object({
|
|
|
656
656
|
}).readonly()
|
|
657
657
|
const checkpointsResultSchema = z.object({
|
|
658
658
|
'ok': z.boolean().readonly(), 'truncated': z.boolean().readonly(),
|
|
659
|
-
'tasks': z.array(checkpointTaskSchema).readonly(), 'error': z.string().readonly().optional(),
|
|
659
|
+
'tasks': z.array(checkpointTaskSchema).readonly(), 'skipped': z.number().readonly().optional(), 'error': z.string().readonly().optional(),
|
|
660
660
|
}).readonly()
|
|
661
661
|
|
|
662
662
|
export const TYPERT = {
|
package/package.json
CHANGED