sage-mem 2.14.0 → 2.15.0
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 +7 -4
- package/README.md +8 -5
- package/lib/client.js +470 -20
- package/lib/index.js +13 -1
- package/lib/memory/checkpoint.js +3 -2
- package/lib/memory/scan.js +56 -0
- package/lib/typert.host.js +17 -0
- package/package.json +1 -1
- package/skills/sage-mem/SKILL.md +1 -0
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
|
+
**Current release: `2.15.0`** — 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.
|
|
@@ -464,15 +464,18 @@ The two things are moved **differently**, spelled out:
|
|
|
464
464
|
|
|
465
465
|
⚠️ **The premise is that the shape matches.** The four-type division and the frontmatter are sage-mem's own conventions: if your memories in CC were already "one Markdown file per memory + frontmatter" (which is what ours were at the time), just copy them over; **if they were not** (if they were all piled into a single `CLAUDE.md`, say), you need to organize them first — and that job can perfectly well be handed to an agent: have it read the old material and lay it out as files under the four types.
|
|
466
466
|
|
|
467
|
-
## To-do Board (experimental · since 2.11.0;
|
|
467
|
+
## To-do Board (experimental · since 2.11.0; wrapped up in 2.15.0)
|
|
468
468
|
|
|
469
469
|
`project_session-state.md` in the memory directory has always been a to-do list you keep for yourself: injected into every session, but you still have to open the file to see what is left. 2.11.0 puts it in the **right sidebar**: Settings → Memory management → Lab → enable "To-do board", and the sidebar's Start page gains a card that opens a tab.
|
|
470
470
|
|
|
471
471
|
- **Ticking = moving**: a finished item is removed from its group and appended to the "Done, pending deletion" block (created at the end of the file on first use); un-ticking moves it back to the end of its original group. "Clear all" is what actually deletes rows.
|
|
472
|
-
- **Edit it**: add an item at the end of a group, edit one in place, undo / redo
|
|
472
|
+
- **Edit it**: add an item at the end of a group, edit one in place, undo / redo **3–5 steps** (5 by default).
|
|
473
|
+
- **See only what is open**: the default filter is "Open" (legacy `- [x]` lines appear under "All"; the pending-deletion block always shows, since it is a queue). Each group remembers whether it was expanded.
|
|
474
|
+
- **Wrap-up has a button**: **"Move to log"** on the pending-deletion block appends the rows to `session-log.md` and removes them from the list — log first, list second, verbatim text, already-logged rows skipped, **not undoable**.
|
|
475
|
+
- **See work owed elsewhere**: the 未完成 (open-work) section of `tasks/*/WORKING.md` is aggregated into a **read-only** block (never merged back).
|
|
473
476
|
- **The file is still the only truth**: the board does line-level surgery only; edit the file with any tool and the board follows within 4 seconds.
|
|
474
477
|
- **Hot**: flipping the switch takes effect immediately, no restart (unlike MMR).
|
|
475
|
-
- **Off by default**; no drag-and-drop ordering
|
|
478
|
+
- **Off by default**; no drag-and-drop ordering. Details in `docs/todo-board.md`.
|
|
476
479
|
|
|
477
480
|
## Initial memory: scaffold the library with an agent (2.12.0; moved to Lab in 2.12.1)
|
|
478
481
|
|
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.
|
|
17
|
+
**当前发布版本:`2.15.0`** —— 顶部 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 是最直接的反馈。
|
|
@@ -464,15 +464,18 @@ sage-mem 给记忆目录的写入加了**版本守卫**:写入前记下当前
|
|
|
464
464
|
|
|
465
465
|
⚠️ **前提是形状对得上。** 四类划分与 frontmatter 是 sage-mem 自己的约定:如果你在 CC 里的记忆本来就是「一条一个 Markdown + frontmatter」(我们当时是这种),拷过来即可;**如果不是**(比如都堆在一个 `CLAUDE.md` 里),需要先整理一遍 —— 这活儿正好可以交给一个 agent 做:让它读旧语料,按四类落成文件。
|
|
466
466
|
|
|
467
|
-
## 待办清单看板(实验性 · 2.11.0
|
|
467
|
+
## 待办清单看板(实验性 · 2.11.0 起;2.15.0 收尾)
|
|
468
468
|
|
|
469
|
-
记忆目录里的 `
|
|
469
|
+
记忆目录里的 `project_session_state.md` 一直是「给自己看的代办清单」——每场会话都会注入,人却要打开文件才知道还剩什么。2.11.0 把它搬进**右侧栏**:设置 → 记忆管理 → 实验性 → 打开「待办清单看板」,右侧栏「开始」页就会多一张卡片,点开是一个页签。
|
|
470
470
|
|
|
471
471
|
- **勾选 = 搬家**:完成项从原组删掉、搬进「已完成,待删除」块(文件里还没这一块就自动在末尾建),取消完成再搬回原组末尾;「清空全部」才真删。
|
|
472
|
-
- **改得动**:每组底部加一条、点卡片行内改一句;撤销 /
|
|
472
|
+
- **改得动**:每组底部加一条、点卡片行内改一句;撤销 / 重做 **3–5 步可配**(默认 5)。
|
|
473
|
+
- **一眼只看没做完的**:默认「未完成」档(老文件里遗留的 `- [x]` 行要点「全部」才出现,「已完成,待删除」块始终在——它是队列);每组的展开状态会记住。
|
|
474
|
+
- **收尾有按钮**:待删除块上的**「搬进流水」**把条目写进 `session-log.md` 再从清单删掉——先写流水再删行、正文照抄、已记过的跳过、**不可撤销**。
|
|
475
|
+
- **看得见别的文件里欠着的活**:`tasks/*/WORKING.md` 的「未完成」节汇总成一条**只读**区块(不合并写入)。
|
|
473
476
|
- **文件仍是唯一真相**:看板只做行级手术,其余字节原样;你用任何编辑器改它,看板 4 秒内跟上。
|
|
474
477
|
- **热的**:拨开关立刻生效,不用重启(与 MMR 不同)。
|
|
475
|
-
-
|
|
478
|
+
- **默认关闭**;不做拖拽排序。细节见 `docs/todo-board.md`。
|
|
476
479
|
|
|
477
480
|
## 初始记忆:让 agent 建个骨架(2.12.0,2.12.1 挪到「实验性」)
|
|
478
481
|
|
package/lib/client.js
CHANGED
|
@@ -2105,6 +2105,16 @@ const StarmapRuntime = (function (require, _react) {
|
|
|
2105
2105
|
result: { mode: "strict", typeSymbol: "sage-mem/types#AuditReport", schema: objCodec, create: () => objCodec },
|
|
2106
2106
|
sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
|
|
2107
2107
|
},
|
|
2108
|
+
{
|
|
2109
|
+
id: "sage-mem#memory/checkpoints",
|
|
2110
|
+
service: "memory",
|
|
2111
|
+
namespace: "memory",
|
|
2112
|
+
method: "checkpoints",
|
|
2113
|
+
invocation: { kind: "direct" },
|
|
2114
|
+
parameters: [],
|
|
2115
|
+
result: { mode: "strict", typeSymbol: "sage-mem/types#Checkpoints", schema: objCodec, create: () => objCodec },
|
|
2116
|
+
sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
|
|
2117
|
+
},
|
|
2108
2118
|
{
|
|
2109
2119
|
id: "sage-mem#memory/openMemoryDir",
|
|
2110
2120
|
service: "memory",
|
|
@@ -2862,6 +2872,22 @@ const StarmapRuntime = (function (require, _react) {
|
|
|
2862
2872
|
".smem-todo-add{padding-top:2px;}",
|
|
2863
2873
|
".smem-todo-add-input{width:100%;font-size:12px;}",
|
|
2864
2874
|
".smem-todo-empty{font-size:11.5px;color:var(--dsw-alias-label-secondary);padding:4px 0;}",
|
|
2875
|
+
// 2.15.0:筛选 + 撤销步数那一行;步数选择器要窄,别把右栏撑开。
|
|
2876
|
+
".smem-todo-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:0 0 2px;}",
|
|
2877
|
+
".smem-todo-tools > span[data-spring]{flex:1;}",
|
|
2878
|
+
".smem-todo-filter{border:1px solid transparent;border-radius:6px;padding:1px 6px;}",
|
|
2879
|
+
".smem-todo-filter-on{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-l2);color:var(--dsw-alias-label-primary);}",
|
|
2880
|
+
".smem-todo-depth{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--dsw-alias-label-secondary);}",
|
|
2881
|
+
".smem-todo-depth-select{width:auto;padding:0 2px;font-size:11.5px;}",
|
|
2882
|
+
// 「搬进流水」是待删除块的主动作(清空是丢弃、这条是留档),给品牌色。
|
|
2883
|
+
".smem-todo-archive{font-weight:600;}",
|
|
2884
|
+
// 检查点聚合块:只读、来源是别的文件 —— 用虚线边框和正文色区分开。
|
|
2885
|
+
".smem-todo-group-cp{border-style:dashed;}",
|
|
2886
|
+
".smem-todo-cp-task{display:flex;flex-direction:column;gap:2px;padding:2px 0;}",
|
|
2887
|
+
".smem-todo-cp-head{font-size:11.5px;font-weight:600;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;}",
|
|
2888
|
+
".smem-todo-cp-items{display:flex;flex-direction:column;gap:2px;}",
|
|
2889
|
+
".smem-todo-cp-item{font-size:12px;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;padding-left:8px;border-left:2px solid var(--dsw-alias-border-l2);}",
|
|
2890
|
+
".smem-todo-cp-note{font-size:11px;color:var(--dsw-alias-label-secondary);}",
|
|
2865
2891
|
".smem-todo-done-state{display:flex;flex-direction:column;gap:6px;padding:16px 12px;}",
|
|
2866
2892
|
".smem-todo-done-title{font-weight:600;}",
|
|
2867
2893
|
].join("\n");
|
|
@@ -4814,6 +4840,21 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
4814
4840
|
"todo.err.noRemote": "宿主没有记忆 remote,读不了待办文件",
|
|
4815
4841
|
"todo.err.read": "读不到待办文件:{error}",
|
|
4816
4842
|
"todo.err.write": "写入被拒:{error}",
|
|
4843
|
+
"todo.err.noArchive": "宿主没有读写保留名的 remote(readRaw / writeRaw),搬不进流水",
|
|
4844
|
+
"todo.err.archive": "搬进流水失败:{error}",
|
|
4845
|
+
"todo.filter.open": "未完成",
|
|
4846
|
+
"todo.filter.openTitle": "只显示未完成(待删除块照旧显示:它是待清空的队列)",
|
|
4847
|
+
"todo.filter.all": "全部",
|
|
4848
|
+
"todo.filter.allTitle": "连旧文件里遗留的 - [x] 行一起显示",
|
|
4849
|
+
"todo.undoDepth.label": "撤销",
|
|
4850
|
+
"todo.undoDepth.option": "{n} 步",
|
|
4851
|
+
"todo.action.undoTitle": "撤销上一步(栈深 {depth} 步,只在本次页面里有效)",
|
|
4852
|
+
"todo.action.archive": "搬进流水({count})",
|
|
4853
|
+
"todo.notice.archived": "已把 {count} 条搬进 {file},并从清单里删掉(这一步不可撤销)",
|
|
4854
|
+
"todo.notice.archivedDup": "这些条目在 {file} 里都已经有了,只删掉了清单里那几行",
|
|
4855
|
+
"todo.notice.archiveStale": "{count} 条已写进流水,但清单刚被别处改过:清单里那几行**没删**,刷新后再点一次即可(重复会被跳过)",
|
|
4856
|
+
"todo.cp.title": "检查点里的未完成(只读)",
|
|
4857
|
+
"todo.cp.note": "来自 tasks/*/WORKING.md 的「未完成」节。这里只显示,改动请回到那份检查点。",
|
|
4817
4858
|
"todo.disabled.title": "待办看板已在「实验性」里关闭",
|
|
4818
4859
|
"todo.disabled.hint": "打开:设置 → 记忆管理 → 实验性 → 待办清单看板",
|
|
4819
4860
|
"todo.lab.title": "待办清单看板(实验性)",
|
|
@@ -5440,8 +5481,23 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
5440
5481
|
"todo.err.noRemote": "This host exposes no memory remote, so the to-do file cannot be read",
|
|
5441
5482
|
"todo.err.read": "Cannot read the to-do file: {error}",
|
|
5442
5483
|
"todo.err.write": "Write rejected: {error}",
|
|
5484
|
+
"todo.err.noArchive": "This host exposes no readRaw / writeRaw remote, so the log cannot be appended",
|
|
5485
|
+
"todo.err.archive": "Could not move items into the log: {error}",
|
|
5486
|
+
"todo.filter.open": "Open",
|
|
5487
|
+
"todo.filter.openTitle": "Show open items only (the pending-deletion block stays: it is a queue to clear)",
|
|
5488
|
+
"todo.filter.all": "All",
|
|
5489
|
+
"todo.filter.allTitle": "Also show legacy - [x] lines left in the file",
|
|
5490
|
+
"todo.undoDepth.label": "Undo",
|
|
5491
|
+
"todo.undoDepth.option": "{n} steps",
|
|
5492
|
+
"todo.action.undoTitle": "Undo the last edit (stack depth {depth}; in-memory only)",
|
|
5493
|
+
"todo.action.archive": "Move to log ({count})",
|
|
5494
|
+
"todo.notice.archived": "Moved {count} item(s) into {file} and removed them from the list (this cannot be undone)",
|
|
5495
|
+
"todo.notice.archivedDup": "Those items were already in {file}; only the list lines were removed",
|
|
5496
|
+
"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.",
|
|
5443
5497
|
"todo.disabled.title": "The to-do board is switched off in the lab settings",
|
|
5444
5498
|
"todo.disabled.hint": "Turn it on: Settings → Memory management → Lab → To-do board",
|
|
5499
|
+
"todo.cp.title": "Open items in checkpoints (read-only)",
|
|
5500
|
+
"todo.cp.note": "From the open-work section of tasks/*/WORKING.md. Display only — edit the checkpoint itself.",
|
|
5445
5501
|
"todo.lab.title": "To-do board (experimental)",
|
|
5446
5502
|
"todo.lab.switch": "Enable the to-do board",
|
|
5447
5503
|
"todo.lab.switch.title": "Adds a To-dos tab to the right sidebar",
|
|
@@ -9798,8 +9854,21 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
9798
9854
|
* **字面量写进文件,不跟界面语言走** —— 它是文件格式的一部分,不是 UI 文案。
|
|
9799
9855
|
*/
|
|
9800
9856
|
const TODO_DONE_HEADING = "## 已完成,待删除";
|
|
9801
|
-
/**
|
|
9802
|
-
|
|
9857
|
+
/**
|
|
9858
|
+
* 撤销 / 重做步数(2.15.0 起可配 3–5,默认 5)。
|
|
9859
|
+
* 栈本身**只在内存里**(关页面即失效);落 localStorage 的只有「用户选了几步」这个偏好。
|
|
9860
|
+
*/
|
|
9861
|
+
const TODO_UNDO_DEFAULT = 5;
|
|
9862
|
+
const TODO_UNDO_MIN = 3;
|
|
9863
|
+
const TODO_UNDO_MAX = 5;
|
|
9864
|
+
/** 偏好键:撤销步数 / 各组展开状态。localStorage 本身就按 origin 隔离。 */
|
|
9865
|
+
const TODO_PREF_UNDO = "sage-mem.todo.undoDepth";
|
|
9866
|
+
const TODO_PREF_OPEN = "sage-mem.todo.openGroups";
|
|
9867
|
+
/** 筛选两档:默认只看未完成;`全部`才把旧文件里遗留的 `- [x]` 行也画出来。 */
|
|
9868
|
+
const TODO_FILTER_OPEN = "open";
|
|
9869
|
+
const TODO_FILTER_ALL = "all";
|
|
9870
|
+
/** 完成项留档的落点:跨会话流水(保留名,走 readRaw / writeRaw)。 */
|
|
9871
|
+
const TODO_LOG_FILE = "session-log.md";
|
|
9803
9872
|
|
|
9804
9873
|
/** 开关状态(模块级:设置卡与页签共享)。 */
|
|
9805
9874
|
let todoBoardEnabled = false;
|
|
@@ -9833,6 +9902,161 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
9833
9902
|
return s[0];
|
|
9834
9903
|
}
|
|
9835
9904
|
|
|
9905
|
+
// ── 本地偏好(2.15.0):只存「用户怎么选的」,不存任何清单内容 ──────────
|
|
9906
|
+
//
|
|
9907
|
+
// 纪律与「不建自己的存储」一致:清单的唯一真相仍是那份 markdown。
|
|
9908
|
+
// 这里存的只有两件纯界面偏好 —— 撤销留几步、哪几组是展开的。
|
|
9909
|
+
// 读不到(隐私模式 / 配额满 / 无 DOM 的测试环境)一律按默认走,**不报错**。
|
|
9910
|
+
|
|
9911
|
+
function todoStore() {
|
|
9912
|
+
try {
|
|
9913
|
+
if (typeof localStorage === "undefined" || localStorage === null) return null;
|
|
9914
|
+
return localStorage;
|
|
9915
|
+
} catch (e) { return null; }
|
|
9916
|
+
}
|
|
9917
|
+
|
|
9918
|
+
function todoPrefGet(key) {
|
|
9919
|
+
const s = todoStore();
|
|
9920
|
+
if (!s || typeof s.getItem !== "function") return null;
|
|
9921
|
+
try { return s.getItem(key); } catch (e) { return null; }
|
|
9922
|
+
}
|
|
9923
|
+
|
|
9924
|
+
function todoPrefSet(key, value) {
|
|
9925
|
+
const s = todoStore();
|
|
9926
|
+
if (!s || typeof s.setItem !== "function") return;
|
|
9927
|
+
try { s.setItem(key, value); } catch (e) { /* 偏好丢了不影响主流程 */ }
|
|
9928
|
+
}
|
|
9929
|
+
|
|
9930
|
+
/** 撤销步数归一:非数字 / 越界都收进 [3, 5],坏值(含 null / 空串)回默认 5。 */
|
|
9931
|
+
function todoClampUndoDepth(n) {
|
|
9932
|
+
if (n === null || n === undefined || n === "") return TODO_UNDO_DEFAULT;
|
|
9933
|
+
const v = Math.round(Number(n));
|
|
9934
|
+
if (!Number.isFinite(v)) return TODO_UNDO_DEFAULT;
|
|
9935
|
+
return Math.min(TODO_UNDO_MAX, Math.max(TODO_UNDO_MIN, v));
|
|
9936
|
+
}
|
|
9937
|
+
|
|
9938
|
+
/** 组展开偏好的键:就是节标题原文(空标题用同一个兜底键)。 */
|
|
9939
|
+
function todoGroupKey(title) {
|
|
9940
|
+
return String(title == null ? "" : title);
|
|
9941
|
+
}
|
|
9942
|
+
|
|
9943
|
+
/**
|
|
9944
|
+
* 解析 `{组标题: true|false}` 偏好。坏 JSON、数组、别的类型一律当「没有偏好」——
|
|
9945
|
+
* 于是所有组回到默认(收起),而不是让整块看板因为一行坏数据打不开。
|
|
9946
|
+
* @returns {Object<string, boolean>}
|
|
9947
|
+
*/
|
|
9948
|
+
function todoOpenMapParse(raw) {
|
|
9949
|
+
const out = Object.create(null);
|
|
9950
|
+
let value = null;
|
|
9951
|
+
try { value = JSON.parse(String(raw == null ? "" : raw)); } catch (e) { return out; }
|
|
9952
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return out;
|
|
9953
|
+
Object.keys(value).forEach(function (k) {
|
|
9954
|
+
if (value[k] === true || value[k] === false) out[k] = value[k];
|
|
9955
|
+
});
|
|
9956
|
+
return out;
|
|
9957
|
+
}
|
|
9958
|
+
|
|
9959
|
+
/** 序列化展开偏好(只留布尔值,别的键丢掉)。 */
|
|
9960
|
+
function todoOpenMapSerialize(map) {
|
|
9961
|
+
const out = {};
|
|
9962
|
+
Object.keys(map || {}).forEach(function (k) {
|
|
9963
|
+
if (map[k] === true || map[k] === false) out[k] = map[k];
|
|
9964
|
+
});
|
|
9965
|
+
try { return JSON.stringify(out); } catch (e) { return "{}"; }
|
|
9966
|
+
}
|
|
9967
|
+
|
|
9968
|
+
/**
|
|
9969
|
+
* 筛选:`open` 档只留未完成(待删除块里的条目照旧显示 —— 它是**队列**,
|
|
9970
|
+
* 不是「已完成的历史」,藏起来就没法清空 / 留档了)。
|
|
9971
|
+
*/
|
|
9972
|
+
function todoFilterItems(items, filter) {
|
|
9973
|
+
const list = items || [];
|
|
9974
|
+
if (filter === TODO_FILTER_ALL) return list;
|
|
9975
|
+
return list.filter(function (it) { return !it.done || it.inDone; });
|
|
9976
|
+
}
|
|
9977
|
+
|
|
9978
|
+
/** 比较用的归一化正文:连续空白压成一个空格、去首尾。 */
|
|
9979
|
+
function todoLogKey(text) {
|
|
9980
|
+
return String(text == null ? "" : text).replace(/\s+/g, " ").trim();
|
|
9981
|
+
}
|
|
9982
|
+
|
|
9983
|
+
/** 流水里已经记过的条目正文(归一化后)。用于「重复点一次不会写两遍」。 */
|
|
9984
|
+
function todoLogKeys(logText) {
|
|
9985
|
+
const set = new Set();
|
|
9986
|
+
String(logText == null ? "" : logText).split(/\r?\n/).forEach(function (line) {
|
|
9987
|
+
const m = /^\s*[-*+]\s+(.*)$/.exec(line);
|
|
9988
|
+
if (m && m[1].trim() !== "") set.add(todoLogKey(m[1]));
|
|
9989
|
+
});
|
|
9990
|
+
return set;
|
|
9991
|
+
}
|
|
9992
|
+
|
|
9993
|
+
/** `YYYY-MM-DD HH:mm`(本地时区;流水的人读时间,不用 UTC)。 */
|
|
9994
|
+
function todoStamp(now) {
|
|
9995
|
+
const d = now instanceof Date ? now : new Date();
|
|
9996
|
+
const p = function (n) { return String(n).padStart(2, "0"); };
|
|
9997
|
+
return String(d.getFullYear()) + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate()) +
|
|
9998
|
+
" " + p(d.getHours()) + ":" + p(d.getMinutes());
|
|
9999
|
+
}
|
|
10000
|
+
|
|
10001
|
+
/**
|
|
10002
|
+
* 把待删除块里的条目拼成一段流水(纯函数,不碰 IO、不改入参)。
|
|
10003
|
+
*
|
|
10004
|
+
* **逐字照抄条目正文**,不改写成概括 —— 2.14.0 做归档时那条纪律同样适用:
|
|
10005
|
+
* 概化过的流水半年后没人能据此复现。已经在流水里记过的(`existingKeys`)跳过,
|
|
10006
|
+
* 于是「上次写了一半」的失败可以安全重试。
|
|
10007
|
+
*
|
|
10008
|
+
* @param {Array<object>} items 待删除块里的条目(`text` 已剥掉 `[x]`)
|
|
10009
|
+
* @param {Date} now 时间戳
|
|
10010
|
+
* @param {Set<string>} [existingKeys] 流水里已有的正文键
|
|
10011
|
+
* @returns {{text: string, bodies: string[], count: number}}
|
|
10012
|
+
*/
|
|
10013
|
+
function todoArchiveBlock(items, now, existingKeys) {
|
|
10014
|
+
const keys = existingKeys || new Set();
|
|
10015
|
+
const seen = new Set();
|
|
10016
|
+
const bodies = [];
|
|
10017
|
+
(items || []).forEach(function (it) {
|
|
10018
|
+
const body = String(it && it.text != null ? it.text : "").trim();
|
|
10019
|
+
if (body === "") return;
|
|
10020
|
+
const key = todoLogKey(body);
|
|
10021
|
+
if (keys.has(key) || seen.has(key)) return;
|
|
10022
|
+
seen.add(key);
|
|
10023
|
+
bodies.push(body);
|
|
10024
|
+
});
|
|
10025
|
+
if (bodies.length === 0) return { text: "", bodies: [], count: 0 };
|
|
10026
|
+
const head = "## " + todoStamp(now) + " · 待办收尾(" + String(bodies.length) + " 条)";
|
|
10027
|
+
const lines = [
|
|
10028
|
+
head,
|
|
10029
|
+
"",
|
|
10030
|
+
// ⚠️ 这两处字面量进的是**文件内容**(流水),不跟界面语言走 —— 与 TODO_DONE_HEADING 同理。
|
|
10031
|
+
"**来源**:`" + TODO_FILE + "` 的「已完成,待删除」块,由待办看板搬入(正文照抄)。",
|
|
10032
|
+
"",
|
|
10033
|
+
].concat(bodies.map(function (b) { return "- " + b; }));
|
|
10034
|
+
return { text: lines.join("\n"), bodies: bodies, count: bodies.length };
|
|
10035
|
+
}
|
|
10036
|
+
|
|
10037
|
+
/**
|
|
10038
|
+
* 把一段流水接到已有内容末尾:保证「原有内容不动 + 空一行 + 新段 + 以换行结尾」。
|
|
10039
|
+
*
|
|
10040
|
+
* ⚠️ 按**行**拼,别在 `"\r\n"` 后面再补一个裸 `"\r"` —— CRLF 文件会被拼出
|
|
10041
|
+
* `"\r\n\r"` 这种既不是 CRLF 也不是 LF 的东西(2.15.0 的第一版就踩了这条)。
|
|
10042
|
+
*/
|
|
10043
|
+
function todoSessionLogAppend(logText, blockText) {
|
|
10044
|
+
const src = String(logText == null ? "" : logText);
|
|
10045
|
+
const block = String(blockText == null ? "" : blockText);
|
|
10046
|
+
if (block === "") return src;
|
|
10047
|
+
const eol = todoEol(src);
|
|
10048
|
+
const out = src === "" ? [] : src.split("\n");
|
|
10049
|
+
// `split` 的末尾空串代表「文件以换行结尾」,不是一行内容。
|
|
10050
|
+
if (out.length > 0 && out[out.length - 1] === "") out.pop();
|
|
10051
|
+
const body = block.split("\n").filter(function (line, i, arr) {
|
|
10052
|
+
return !(line === "" && i === arr.length - 1);
|
|
10053
|
+
});
|
|
10054
|
+
if (out.length > 0) out.push(eol);
|
|
10055
|
+
body.forEach(function (line) { out.push(line + eol); });
|
|
10056
|
+
out.push("");
|
|
10057
|
+
return out.join("\n");
|
|
10058
|
+
}
|
|
10059
|
+
|
|
9836
10060
|
// ── 解析:markdown → 节 + 条目(纯函数,不碰 IO)────────────────────
|
|
9837
10061
|
|
|
9838
10062
|
/**
|
|
@@ -10198,19 +10422,30 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10198
10422
|
]);
|
|
10199
10423
|
}
|
|
10200
10424
|
|
|
10201
|
-
/** 一组(一个 `##` 节):标题 + 计数 + 条目 +
|
|
10425
|
+
/** 一组(一个 `##` 节):标题 + 计数 + 条目 + 新增框;待删除块另有「清空 / 搬进流水」。 */
|
|
10202
10426
|
function TodoSectionGroup(props) {
|
|
10203
10427
|
const sec = props.section;
|
|
10204
10428
|
const isDone = sec.kind === "done";
|
|
10205
10429
|
// 2.11.1(用户 2026-11-17 反馈):**所有组默认收起**,一屏先看见「有几组、各组几条」,
|
|
10206
10430
|
// 想看的组自己点开。原来只收「长期约束」,长清单照样一屏铺满。
|
|
10207
|
-
|
|
10431
|
+
// 2.15.0:**记住用户点开过哪几组**(localStorage,按节标题)。默认仍收起。
|
|
10432
|
+
const key = todoGroupKey(sec.title);
|
|
10433
|
+
const sCollapsed = react.useState(function () {
|
|
10434
|
+
const map = props.openMap || {};
|
|
10435
|
+
return map[key] !== true;
|
|
10436
|
+
});
|
|
10208
10437
|
const collapsed = sCollapsed[0], setCollapsed = sCollapsed[1];
|
|
10209
|
-
// 上层「全部展开 /
|
|
10438
|
+
// 上层「全部展开 / 全部收起」:一次性动作,**不写偏好**(写了就变成「永远全展开」)。
|
|
10210
10439
|
react.useEffect(function () {
|
|
10211
10440
|
if (props.allOpen === null || props.allOpen === undefined) return;
|
|
10212
10441
|
setCollapsed(!props.allOpen);
|
|
10213
10442
|
}, [props.allOpen]);
|
|
10443
|
+
function toggleGroup() {
|
|
10444
|
+
// 点一下 = 把「收起」反过来;记进偏好的是**点击后的展开态**(不是「收起态」)。
|
|
10445
|
+
const nextOpen = collapsed;
|
|
10446
|
+
setCollapsed(!collapsed);
|
|
10447
|
+
if (typeof props.onGroupToggle === "function") props.onGroupToggle(key, nextOpen);
|
|
10448
|
+
}
|
|
10214
10449
|
const sDraft = react.useState("");
|
|
10215
10450
|
const draft = sDraft[0], setDraft = sDraft[1];
|
|
10216
10451
|
const openCount = sec.items.filter(function (it) { return !it.done; }).length;
|
|
@@ -10224,12 +10459,22 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10224
10459
|
key: "toggle",
|
|
10225
10460
|
type: "button",
|
|
10226
10461
|
className: "smem-todo-group-toggle",
|
|
10227
|
-
onClick:
|
|
10462
|
+
onClick: toggleGroup,
|
|
10228
10463
|
}, [
|
|
10229
10464
|
h("span", { key: "chev", className: "smem-todo-chev" }, collapsed ? "▸" : "▾"),
|
|
10230
10465
|
h("span", { key: "t", className: "smem-todo-group-title" }, sec.title || (isDone ? t("todo.doneGroup") : t(TODO_SECTION_FALLBACK))),
|
|
10231
10466
|
h("span", { key: "n", className: "smem-todo-count" }, String(openCount) + (doneCount > 0 ? " / " + String(doneCount) : "")),
|
|
10232
10467
|
]),
|
|
10468
|
+
isDone && blockCount > 0
|
|
10469
|
+
? h("button", {
|
|
10470
|
+
key: "archive",
|
|
10471
|
+
type: "button",
|
|
10472
|
+
className: "smem-todo-mini smem-todo-archive",
|
|
10473
|
+
title: t("todo.action.archive", { count: blockCount, file: TODO_LOG_FILE }),
|
|
10474
|
+
disabled: props.busy,
|
|
10475
|
+
onClick: function () { props.onArchive(sec); },
|
|
10476
|
+
}, t("todo.action.archive", { count: blockCount, file: TODO_LOG_FILE }))
|
|
10477
|
+
: null,
|
|
10233
10478
|
isDone && blockCount > 0
|
|
10234
10479
|
? h("button", {
|
|
10235
10480
|
key: "clear",
|
|
@@ -10272,6 +10517,46 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10272
10517
|
]);
|
|
10273
10518
|
}
|
|
10274
10519
|
|
|
10520
|
+
/**
|
|
10521
|
+
* 检查点聚合(2.15.0)—— **只读**。
|
|
10522
|
+
*
|
|
10523
|
+
* 把 `<状态根>/tasks/<id>/WORKING.md` 的「未完成」节并到清单上方显示。
|
|
10524
|
+
* **不合并写入**:那些条目在别的文件里、有自己的 revision 与写协议,
|
|
10525
|
+
* 看板只负责让人看见「还有哪些任务没收尾」,动手改仍然回到那份检查点。
|
|
10526
|
+
* 老宿主的 remote 上没有 `checkpoints`,于是整块不出现(不是显示一个空壳)。
|
|
10527
|
+
*/
|
|
10528
|
+
function TodoCheckpointBlock(props) {
|
|
10529
|
+
const sOpen = react.useState(false);
|
|
10530
|
+
const open = sOpen[0], setOpen = sOpen[1];
|
|
10531
|
+
const tasks = props.tasks || [];
|
|
10532
|
+
return h("section", { className: "smem-todo-group smem-todo-group-cp" }, [
|
|
10533
|
+
h("div", { key: "head", className: "smem-todo-group-head" }, [
|
|
10534
|
+
h("button", {
|
|
10535
|
+
key: "toggle",
|
|
10536
|
+
type: "button",
|
|
10537
|
+
className: "smem-todo-group-toggle",
|
|
10538
|
+
title: t("todo.cp.title"),
|
|
10539
|
+
onClick: function () { setOpen(!open); },
|
|
10540
|
+
}, [
|
|
10541
|
+
h("span", { key: "chev", className: "smem-todo-chev" }, open ? "▾" : "▸"),
|
|
10542
|
+
h("span", { key: "t", className: "smem-todo-group-title" }, t("todo.cp.title")),
|
|
10543
|
+
h("span", { key: "n", className: "smem-todo-count" }, String(props.count || 0)),
|
|
10544
|
+
]),
|
|
10545
|
+
]),
|
|
10546
|
+
open ? h("div", { key: "list", className: "smem-todo-list" }, tasks.map(function (task) {
|
|
10547
|
+
const id = String(task && task.taskId ? task.taskId : "");
|
|
10548
|
+
const label = task && task.project ? String(task.project) + " · " + id : id;
|
|
10549
|
+
return h("div", { key: "t" + id, className: "smem-todo-cp-task" }, [
|
|
10550
|
+
h("div", { key: "h", className: "smem-todo-cp-head" }, label),
|
|
10551
|
+
h("div", { key: "i", className: "smem-todo-cp-items" }, (task.items || []).map(function (txt, i) {
|
|
10552
|
+
return h("div", { key: "x" + i, className: "smem-todo-cp-item" }, todoInline(String(txt)));
|
|
10553
|
+
})),
|
|
10554
|
+
]);
|
|
10555
|
+
})) : null,
|
|
10556
|
+
open ? h("div", { key: "note", className: "smem-todo-cp-note" }, t("todo.cp.note")) : null,
|
|
10557
|
+
]);
|
|
10558
|
+
}
|
|
10559
|
+
|
|
10275
10560
|
/** 页签正文。承载全部读写状态(宿主只给 ctx / sessionId / 标准 hooks)。 */
|
|
10276
10561
|
function TodoBoard(props) {
|
|
10277
10562
|
const ctx = props.ctx;
|
|
@@ -10285,15 +10570,50 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10285
10570
|
const sErr = react.useState(null); const err = sErr[0], setErr = sErr[1];
|
|
10286
10571
|
const sNotice = react.useState(""); const notice = sNotice[0], setNotice = sNotice[1];
|
|
10287
10572
|
const sBusy = react.useState(false); const busy = sBusy[0], setBusy = sBusy[1];
|
|
10288
|
-
// 撤销 /
|
|
10289
|
-
//
|
|
10573
|
+
// 撤销 / 重做:元素是写入前的 `{content, revision}`。栈**只在内存里**,
|
|
10574
|
+
// 深度 3–5 可配(偏好落 localStorage);任何**新**写入都清空 redoStack —— 历史分叉了。
|
|
10575
|
+
const sDepth = react.useState(function () { return todoClampUndoDepth(todoPrefGet(TODO_PREF_UNDO)); });
|
|
10576
|
+
const undoDepth = sDepth[0], setUndoDepth = sDepth[1];
|
|
10290
10577
|
const sUndo = react.useState([]); const undoStack = sUndo[0], setUndoStack = sUndo[1];
|
|
10291
10578
|
const sRedo = react.useState([]); const redoStack = sRedo[0], setRedoStack = sRedo[1];
|
|
10292
|
-
// 「全部展开」是**一次性动作**而不是持久状态:默认 null
|
|
10579
|
+
// 「全部展开」是**一次性动作**而不是持久状态:默认 null(各组按自己的默认走)。
|
|
10293
10580
|
const sAll = react.useState(null); const allOpen = sAll[0], setAllOpen = sAll[1];
|
|
10581
|
+
// 各组展开偏好(2.15.0):`{节标题: true|false}`,点开/收起就写回 localStorage。
|
|
10582
|
+
const sOpenMap = react.useState(function () { return todoOpenMapParse(todoPrefGet(TODO_PREF_OPEN)); });
|
|
10583
|
+
const openMap = sOpenMap[0], setOpenMap = sOpenMap[1];
|
|
10584
|
+
// 筛选:默认只看未完成(旧文件里遗留的 `- [x]` 行要先点「全部」才出现)。
|
|
10585
|
+
const sFilter = react.useState(TODO_FILTER_OPEN); const filter = sFilter[0], setFilter = sFilter[1];
|
|
10294
10586
|
// 搜索:只过滤**显示**,绝不改文件;有查询时匹配的组强制展开,没匹配的组整组隐掉。
|
|
10295
10587
|
const sQuery = react.useState(""); const rawQuery = sQuery[0], setQuery = sQuery[1];
|
|
10296
10588
|
const query = String(rawQuery).trim().toLowerCase();
|
|
10589
|
+
// 检查点聚合(2.15.0,只读):老宿主没有 memory/checkpoints,读到就藏起来。
|
|
10590
|
+
const sCps = react.useState(null); const checkpoints = sCps[0], setCheckpoints = sCps[1];
|
|
10591
|
+
|
|
10592
|
+
/** 读一次检查点(宿主没这个方法就保持 null,界面上整块不出现)。 */
|
|
10593
|
+
const loadCheckpoints = react.useCallback(function () {
|
|
10594
|
+
if (!remote || typeof remote.checkpoints !== "function") return;
|
|
10595
|
+
Promise.resolve(remote.checkpoints()).then(function (res) {
|
|
10596
|
+
const data = unwrap(res);
|
|
10597
|
+
if (!data || data.ok === false) { setCheckpoints(null); return; }
|
|
10598
|
+
setCheckpoints(Array.isArray(data.tasks) ? data.tasks : []);
|
|
10599
|
+
}, function () { /* 读不到就不显示,别在清单旁边堆一条错误 */ });
|
|
10600
|
+
}, [remote]);
|
|
10601
|
+
|
|
10602
|
+
function toggleGroupPref(title, next) {
|
|
10603
|
+
const map = Object.assign({}, openMap);
|
|
10604
|
+
map[title] = next;
|
|
10605
|
+
setOpenMap(map);
|
|
10606
|
+
todoPrefSet(TODO_PREF_OPEN, todoOpenMapSerialize(map));
|
|
10607
|
+
}
|
|
10608
|
+
|
|
10609
|
+
/** 改撤销步数:写偏好 + 立刻把两份栈裁到新深度(否则旧的深栈还能退回去)。 */
|
|
10610
|
+
function changeDepth(n) {
|
|
10611
|
+
const next = todoClampUndoDepth(n);
|
|
10612
|
+
setUndoDepth(next);
|
|
10613
|
+
todoPrefSet(TODO_PREF_UNDO, String(next));
|
|
10614
|
+
setUndoStack(function (prev) { return prev.slice(-next); });
|
|
10615
|
+
setRedoStack(function (prev) { return prev.slice(-next); });
|
|
10616
|
+
}
|
|
10297
10617
|
|
|
10298
10618
|
/** 读一次文件。`quiet` = 轮询调用(出错不弹条,避免每 4 秒闪一次)。 */
|
|
10299
10619
|
const load = react.useCallback(function (quiet) {
|
|
@@ -10332,6 +10652,9 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10332
10652
|
return function () { clearInterval(id); };
|
|
10333
10653
|
}, [visible, enabled, load]);
|
|
10334
10654
|
|
|
10655
|
+
// 检查点聚合(只读):进页签读一次;点刷新再读(别的会话可能刚写过 WORKING.md)。
|
|
10656
|
+
react.useEffect(function () { loadCheckpoints(); }, [loadCheckpoints]);
|
|
10657
|
+
|
|
10335
10658
|
/**
|
|
10336
10659
|
* 一次写入:带上读到的 revision(盘上变了宿主回 stale_revision,我们只重读、不覆盖)。
|
|
10337
10660
|
* @param {string} label 回执文案(已翻译)
|
|
@@ -10355,7 +10678,7 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10355
10678
|
setErr(r.error || t("todo.err.write", { error: String(r.code || "error") }));
|
|
10356
10679
|
return;
|
|
10357
10680
|
}
|
|
10358
|
-
setUndoStack(function (prev) { return prev.concat([snapshot]).slice(-
|
|
10681
|
+
setUndoStack(function (prev) { return prev.concat([snapshot]).slice(-undoDepth); });
|
|
10359
10682
|
setRedoStack([]);
|
|
10360
10683
|
setNotice(out.degraded ? t("todo.notice.degraded") : label);
|
|
10361
10684
|
return load(false);
|
|
@@ -10430,13 +10753,75 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10430
10753
|
mutate(t("todo.notice.cleared", { count: out.count }), out.next);
|
|
10431
10754
|
}
|
|
10432
10755
|
|
|
10756
|
+
/**
|
|
10757
|
+
* 「搬进流水」:把待删除块里的条目搬进跨会话流水(2.15.0)。
|
|
10758
|
+
*
|
|
10759
|
+
* 两次写盘,顺序是刻意的:**先追加流水、再从清单删行**。反过来做,第二步失败就真丢条目;
|
|
10760
|
+
* 这样失败最多在流水里留一份重复,而重复由正文去重挡住(所以重试是安全的)。
|
|
10761
|
+
* 也正因为流水那半没法撤回,搬完**清空撤销栈** —— 留着一个「撤销」只会骗人。
|
|
10762
|
+
*/
|
|
10763
|
+
async function onArchive(section) {
|
|
10764
|
+
const items = (section && section.items) || [];
|
|
10765
|
+
if (items.length === 0) return;
|
|
10766
|
+
if (!remote || typeof remote.readRaw !== "function" || typeof remote.writeRaw !== "function") {
|
|
10767
|
+
setErr(t("todo.err.noArchive"));
|
|
10768
|
+
return;
|
|
10769
|
+
}
|
|
10770
|
+
const revision = doc.revision;
|
|
10771
|
+
const fileContent = doc.content;
|
|
10772
|
+
setBusy(true); setErr(null); setNotice("");
|
|
10773
|
+
let logged = 0;
|
|
10774
|
+
try {
|
|
10775
|
+
let content = "";
|
|
10776
|
+
let logRev = null;
|
|
10777
|
+
const log = unwrap(await remote.readRaw(TODO_LOG_FILE));
|
|
10778
|
+
if (log && log.ok === false) {
|
|
10779
|
+
// 新库还没有流水:当空文件起头。别的读失败照旧报(别把「读坏了」当成「还没有」)。
|
|
10780
|
+
if (!/missing|not.?found|enoent/i.test(String(log.code || ""))) {
|
|
10781
|
+
throw new Error(log.error || String(log.code || "error"));
|
|
10782
|
+
}
|
|
10783
|
+
} else {
|
|
10784
|
+
content = (log && log.content) || "";
|
|
10785
|
+
logRev = log && typeof log.revision === "string" ? log.revision : null;
|
|
10786
|
+
}
|
|
10787
|
+
const block = todoArchiveBlock(items, new Date(), todoLogKeys(content));
|
|
10788
|
+
if (block.count > 0) {
|
|
10789
|
+
const next = todoSessionLogAppend(content, block.text);
|
|
10790
|
+
const out = await remote.writeRaw(TODO_LOG_FILE, next, logRev ? { expectedRevision: logRev } : undefined);
|
|
10791
|
+
const r = out && (out.result || out);
|
|
10792
|
+
if (r && r.ok === false) throw new Error(r.error || String(r.code || "error"));
|
|
10793
|
+
logged = block.count;
|
|
10794
|
+
}
|
|
10795
|
+
const nextTodo = todoRemove(fileContent, items.map(function (it) { return it.line; }));
|
|
10796
|
+
const out2 = await writeWithFallback(remote, "writeFile", [TODO_FILE, nextTodo], revision ? { expectedRevision: revision } : undefined, null);
|
|
10797
|
+
const r2 = out2 && (out2.result || out2);
|
|
10798
|
+
if (r2 && r2.ok === false) {
|
|
10799
|
+
if (r2.code === "stale_revision") {
|
|
10800
|
+
setNotice(t("todo.notice.archiveStale", { count: logged }));
|
|
10801
|
+
await load(false);
|
|
10802
|
+
return;
|
|
10803
|
+
}
|
|
10804
|
+
throw new Error(r2.error || String(r2.code || "error"));
|
|
10805
|
+
}
|
|
10806
|
+
setUndoStack([]); setRedoStack([]);
|
|
10807
|
+
setNotice(logged > 0
|
|
10808
|
+
? t("todo.notice.archived", { count: logged, file: TODO_LOG_FILE })
|
|
10809
|
+
: t("todo.notice.archivedDup", { file: TODO_LOG_FILE }));
|
|
10810
|
+
await load(false);
|
|
10811
|
+
} catch (e) {
|
|
10812
|
+
setErr(t("todo.err.archive", { error: String((e && e.message) || e) }));
|
|
10813
|
+
} finally {
|
|
10814
|
+
setBusy(false);
|
|
10815
|
+
}
|
|
10816
|
+
}
|
|
10817
|
+
|
|
10433
10818
|
function onUndo() {
|
|
10434
10819
|
if (undoStack.length === 0) return;
|
|
10435
10820
|
const target = undoStack[undoStack.length - 1];
|
|
10436
10821
|
const point = currentPoint();
|
|
10437
10822
|
writeSnapshot(target, t("todo.notice.undo"), function () {
|
|
10438
10823
|
setUndoStack(function (prev) { return prev.slice(0, -1); });
|
|
10439
|
-
setRedoStack(function (prev) { return prev.concat([point]).slice(-
|
|
10824
|
+
setRedoStack(function (prev) { return prev.concat([point]).slice(-undoDepth); });
|
|
10440
10825
|
});
|
|
10441
10826
|
}
|
|
10442
10827
|
|
|
@@ -10446,7 +10831,7 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10446
10831
|
const point = currentPoint();
|
|
10447
10832
|
writeSnapshot(target, t("todo.notice.redone"), function () {
|
|
10448
10833
|
setRedoStack(function (prev) { return prev.slice(0, -1); });
|
|
10449
|
-
setUndoStack(function (prev) { return prev.concat([point]).slice(-
|
|
10834
|
+
setUndoStack(function (prev) { return prev.concat([point]).slice(-undoDepth); });
|
|
10450
10835
|
});
|
|
10451
10836
|
}
|
|
10452
10837
|
|
|
@@ -10459,22 +10844,36 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10459
10844
|
|
|
10460
10845
|
const parsed = doc && doc.parsed ? doc.parsed : parseTodoList("");
|
|
10461
10846
|
const missing = doc && doc.missing;
|
|
10847
|
+
// 两道过滤,顺序固定:先按「未完成 / 全部」筛条目,再按搜索词筛。都只影响**显示**。
|
|
10462
10848
|
// 匹配口径:标题 + 正文 + 续行里任一处包含子串(大小写不敏感;不解释正则,免得用户被自己的输入坑)。
|
|
10463
|
-
const
|
|
10849
|
+
const filtered = parsed.sections
|
|
10464
10850
|
.map(function (sec) {
|
|
10465
|
-
const
|
|
10851
|
+
const kept = todoFilterItems(sec.items, filter);
|
|
10852
|
+
const hit = query === "" ? kept : kept.filter(function (it) {
|
|
10466
10853
|
const hay = ((it.title || "") + " " + it.text + " " + (it.cont || "")).toLowerCase();
|
|
10467
10854
|
return hay.indexOf(query) >= 0;
|
|
10468
10855
|
});
|
|
10469
|
-
return { sec: sec, hit: hit };
|
|
10856
|
+
return { sec: sec, kept: kept, hit: hit };
|
|
10857
|
+
})
|
|
10858
|
+
.filter(function (row) {
|
|
10859
|
+
// 空组:搜索时整组隐掉;只筛「未完成」时,普通组没剩条目也隐掉
|
|
10860
|
+
// (否则一屏「▸ 组名 0 / 3」的空壳),待删除块例外 —— 见 todoFilterItems 的注释。
|
|
10861
|
+
if (row.sec.kind === "done") return true;
|
|
10862
|
+
if (row.hit.length > 0) return true;
|
|
10863
|
+
return row.sec.items.length === 0 && query === "";
|
|
10470
10864
|
})
|
|
10471
|
-
.filter(function (row) { return row.hit.length > 0; })
|
|
10472
10865
|
.map(function (row) { return Object.assign({}, row.sec, { items: row.hit }); });
|
|
10866
|
+
const sections = filtered;
|
|
10473
10867
|
const matchCount = sections.reduce(function (n, sec) { return n + sec.items.length; }, 0);
|
|
10474
10868
|
const stats = t("todo.stat", { open: parsed.open, done: parsed.done, sections: parsed.sections.length });
|
|
10475
10869
|
// 「清空全部」清的是整个待删除块,数字取块的真实条数(搜索过滤后也一样)。
|
|
10476
10870
|
const doneBlock = parsed.sections.find(function (sec) { return sec.kind === "done"; });
|
|
10477
10871
|
const doneBlockCount = doneBlock ? doneBlock.items.length : 0;
|
|
10872
|
+
// 检查点区块的条目总数(只读,来自 tasks/*/WORKING.md)。
|
|
10873
|
+
const cpTasks = (checkpoints || []).filter(function (task) {
|
|
10874
|
+
return task && Array.isArray(task.items) && task.items.length > 0;
|
|
10875
|
+
});
|
|
10876
|
+
const cpCount = cpTasks.reduce(function (n, task) { return n + task.items.length; }, 0);
|
|
10478
10877
|
|
|
10479
10878
|
return h("div", { className: "smem-todo" }, [
|
|
10480
10879
|
h("div", { key: "head", className: "smem-todo-head" }, [
|
|
@@ -10482,7 +10881,7 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10482
10881
|
h("span", { key: "sp", "data-spring": "" }),
|
|
10483
10882
|
h("button", {
|
|
10484
10883
|
key: "u", type: "button", className: "smem-todo-icon-btn",
|
|
10485
|
-
title: t("todo.action.
|
|
10884
|
+
title: t("todo.action.undoTitle", { depth: undoDepth }), "aria-label": t("todo.action.undo"),
|
|
10486
10885
|
disabled: busy || undoStack.length === 0,
|
|
10487
10886
|
onClick: onUndo,
|
|
10488
10887
|
}, todoArrowIcon("undo")),
|
|
@@ -10493,7 +10892,35 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10493
10892
|
onClick: onRedo,
|
|
10494
10893
|
}, todoArrowIcon("redo")),
|
|
10495
10894
|
h("button", { key: "a", type: "button", className: "smem-link smem-todo-mini", onClick: function () { setAllOpen(allOpen === true ? false : true); } }, allOpen === true ? t("todo.collapseAll") : t("todo.expandAll")),
|
|
10496
|
-
h("button", { key: "r", type: "button", className: "smem-link smem-todo-mini", disabled: busy, onClick: function () { load(false); } }, t("todo.refresh")),
|
|
10895
|
+
h("button", { key: "r", type: "button", className: "smem-link smem-todo-mini", disabled: busy, onClick: function () { load(false); loadCheckpoints(); } }, t("todo.refresh")),
|
|
10896
|
+
]),
|
|
10897
|
+
// 第二行:筛选 + 撤销步数。右栏很窄,搜索框单独一行。
|
|
10898
|
+
h("div", { key: "tools", className: "smem-todo-tools" }, [
|
|
10899
|
+
h("button", {
|
|
10900
|
+
key: "f1", type: "button",
|
|
10901
|
+
className: "smem-todo-mini smem-todo-filter" + (filter === TODO_FILTER_OPEN ? " smem-todo-filter-on" : ""),
|
|
10902
|
+
title: t("todo.filter.openTitle"), "aria-pressed": filter === TODO_FILTER_OPEN,
|
|
10903
|
+
onClick: function () { setFilter(TODO_FILTER_OPEN); },
|
|
10904
|
+
}, t("todo.filter.open")),
|
|
10905
|
+
h("button", {
|
|
10906
|
+
key: "f2", type: "button",
|
|
10907
|
+
className: "smem-todo-mini smem-todo-filter" + (filter === TODO_FILTER_ALL ? " smem-todo-filter-on" : ""),
|
|
10908
|
+
title: t("todo.filter.allTitle"), "aria-pressed": filter === TODO_FILTER_ALL,
|
|
10909
|
+
onClick: function () { setFilter(TODO_FILTER_ALL); },
|
|
10910
|
+
}, t("todo.filter.all")),
|
|
10911
|
+
h("span", { key: "sp2", "data-spring": "" }),
|
|
10912
|
+
h("label", { key: "dep", className: "smem-todo-depth" }, [
|
|
10913
|
+
h("span", { key: "l", className: "smem-todo-depth-label" }, t("todo.undoDepth.label")),
|
|
10914
|
+
h("select", {
|
|
10915
|
+
key: "sel",
|
|
10916
|
+
className: "smem-input smem-todo-depth-select",
|
|
10917
|
+
value: String(undoDepth),
|
|
10918
|
+
disabled: busy,
|
|
10919
|
+
onChange: function (e) { changeDepth(e.target.value); },
|
|
10920
|
+
}, [TODO_UNDO_MIN, TODO_UNDO_MIN + 1, TODO_UNDO_MAX].map(function (n) {
|
|
10921
|
+
return h("option", { key: "o" + n, value: String(n) }, t("todo.undoDepth.option", { n: n }));
|
|
10922
|
+
})),
|
|
10923
|
+
]),
|
|
10497
10924
|
]),
|
|
10498
10925
|
// 搜索框放统计条下面一行:右栏很窄,塞进同一行会把按钮挤没。
|
|
10499
10926
|
h("div", { key: "search", className: "smem-todo-search-row" }, [
|
|
@@ -10509,6 +10936,9 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10509
10936
|
]),
|
|
10510
10937
|
err ? h("div", { key: "err", className: "smem-err" }, "⚠ " + err) : null,
|
|
10511
10938
|
notice ? h("div", { key: "ok", className: "smem-ok" }, "✓ " + notice) : null,
|
|
10939
|
+
cpCount > 0
|
|
10940
|
+
? h(TodoCheckpointBlock, { key: "cp", tasks: cpTasks, count: cpCount })
|
|
10941
|
+
: null,
|
|
10512
10942
|
missing
|
|
10513
10943
|
? h("div", { key: "miss", className: "smem-todo-empty" }, t("todo.empty.file", { file: TODO_FILE }))
|
|
10514
10944
|
: (query !== "" && sections.length === 0
|
|
@@ -10517,8 +10947,11 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10517
10947
|
return h(TodoSectionGroup, {
|
|
10518
10948
|
key: "s" + i, section: sec, busy: busy, allOpen: query === "" ? allOpen : true,
|
|
10519
10949
|
doneCount: doneBlockCount,
|
|
10950
|
+
openMap: openMap,
|
|
10951
|
+
onGroupToggle: toggleGroupPref,
|
|
10520
10952
|
onToggle: function (it, d) { onToggle(it, d, sec.title); },
|
|
10521
|
-
onAdd: onAdd, onEdit: onEdit, onDelete: onDelete,
|
|
10953
|
+
onAdd: onAdd, onEdit: onEdit, onDelete: onDelete,
|
|
10954
|
+
onClearDone: onClearDone, onArchive: onArchive,
|
|
10522
10955
|
});
|
|
10523
10956
|
}))),
|
|
10524
10957
|
]);
|
|
@@ -10688,9 +11121,26 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
10688
11121
|
// 只给 `test/todo-board-test.mjs` 用,运行期没有任何代码读它(宿主只认 apply / inject)。
|
|
10689
11122
|
exports.todoBoardInternals = {
|
|
10690
11123
|
FILE: TODO_FILE,
|
|
11124
|
+
LOG_FILE: TODO_LOG_FILE,
|
|
10691
11125
|
TAB_KIND: TODO_TAB_KIND,
|
|
10692
11126
|
DONE_HEADING: TODO_DONE_HEADING,
|
|
10693
|
-
|
|
11127
|
+
UNDO_MIN: TODO_UNDO_MIN,
|
|
11128
|
+
UNDO_MAX: TODO_UNDO_MAX,
|
|
11129
|
+
UNDO_DEFAULT: TODO_UNDO_DEFAULT,
|
|
11130
|
+
FILTER_OPEN: TODO_FILTER_OPEN,
|
|
11131
|
+
FILTER_ALL: TODO_FILTER_ALL,
|
|
11132
|
+
PREF_UNDO: TODO_PREF_UNDO,
|
|
11133
|
+
PREF_OPEN: TODO_PREF_OPEN,
|
|
11134
|
+
clampDepth: todoClampUndoDepth,
|
|
11135
|
+
filterItems: todoFilterItems,
|
|
11136
|
+
groupKey: todoGroupKey,
|
|
11137
|
+
openMapParse: todoOpenMapParse,
|
|
11138
|
+
openMapSerialize: todoOpenMapSerialize,
|
|
11139
|
+
logKey: todoLogKey,
|
|
11140
|
+
logKeys: todoLogKeys,
|
|
11141
|
+
stamp: todoStamp,
|
|
11142
|
+
archiveBlock: todoArchiveBlock,
|
|
11143
|
+
logAppend: todoSessionLogAppend,
|
|
10694
11144
|
parse: parseTodoList,
|
|
10695
11145
|
titleOf: todoItemTitle,
|
|
10696
11146
|
bullet: todoBullet,
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { INDEX_FILE_KEY, SESSION_LOG_KEY, isPlainMdName } from './shared/md-name
|
|
|
13
13
|
import { parseAliases, parseBaseline, parseBaselinePriority, parseFrontmatter, parseTags } from './memory/frontmatter.js'
|
|
14
14
|
import { ageDays, bigrams, score, selectBaseline, selectRelevant } from './memory/retrieval.js'
|
|
15
15
|
import { isReserved, nameKey, safeName } from './memory/naming.js'
|
|
16
|
-
import { MEMORY_ARCHIVE_DIR, addArchiveMeta, extractTitle, inspectDir, inspectMemoryEntry, readArchivedMeta, readVerified, scanArchived, scanMemoryFiles, scanStars, shadowsReserved } from './memory/scan.js'
|
|
16
|
+
import { MEMORY_ARCHIVE_DIR, addArchiveMeta, extractTitle, inspectDir, inspectMemoryEntry, readArchivedMeta, readVerified, scanArchived, scanCheckpointOpen, scanMemoryFiles, scanStars, shadowsReserved } from './memory/scan.js'
|
|
17
17
|
import { listConflicts, patchConflict, readConflict, removeConflict, summarizeConflict } from './memory/conflicts.js'
|
|
18
18
|
import { invalidateMemory, undoMemoryInvalidation } from './memory/arbitrate.js'
|
|
19
19
|
import { prepareWrite, readSnapshot, writeSnapshot } from './memory/write-protocol.js'
|
|
@@ -343,6 +343,17 @@ export class MemoryGateway extends TypertRemoteService {
|
|
|
343
343
|
return auditMemoryDir(MEMORY_DIR)
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
/**
|
|
347
|
+
* 任务检查点里「未完成」的条目(2.15.0 · 待办看板用,只读)。
|
|
348
|
+
*
|
|
349
|
+
* 只扫 `<状态根>/tasks/<id>/WORKING.md`,按 `TODO_SECTION` 取条目;
|
|
350
|
+
* 不写、不合并 —— 那些文件有自己的 revision 与写协议(`writeCheckpoint`)。
|
|
351
|
+
* 状态根不接受界面传入(跟 `openMemoryDir` 同一条纪律:别把「读任意路径」变成能力)。
|
|
352
|
+
*/
|
|
353
|
+
async checkpoints() {
|
|
354
|
+
return scanCheckpointOpen(STATE_ROOT)
|
|
355
|
+
}
|
|
356
|
+
|
|
346
357
|
/**
|
|
347
358
|
* 用系统文件管理器打开记忆目录(设置页「打开记忆文件夹」)。
|
|
348
359
|
*
|
|
@@ -601,6 +612,7 @@ markRemote(MemoryGateway, 'readArchived', 'readArchived')
|
|
|
601
612
|
markRemote(MemoryGateway, 'writeArchived', 'writeArchived')
|
|
602
613
|
markRemote(MemoryGateway, 'deleteArchived', 'deleteArchived')
|
|
603
614
|
markRemote(MemoryGateway, 'audit', 'audit')
|
|
615
|
+
markRemote(MemoryGateway, 'checkpoints', 'checkpoints')
|
|
604
616
|
markRemote(MemoryGateway, 'openMemoryDir', 'openMemoryDir')
|
|
605
617
|
markRemote(MemoryGateway, 'checkUpdate', 'checkUpdate')
|
|
606
618
|
markRemote(MemoryGateway, 'setLocked', 'setLocked')
|
package/lib/memory/checkpoint.js
CHANGED
|
@@ -247,7 +247,8 @@ const SUB_LABEL_RE = /^(?:目标|约束|限制|备注)\s*[::]?\s*$/
|
|
|
247
247
|
* 下标只在渲染模板(顺序即模板顺序)里用。
|
|
248
248
|
*/
|
|
249
249
|
const DONE_SECTION = '已完成与证据'
|
|
250
|
-
|
|
250
|
+
/** 2.15.0:待办看板要按**名字**取这一节的条目(`lib/memory/checkpoints.js` 只读复用)。 */
|
|
251
|
+
export const TODO_SECTION = '未完成'
|
|
251
252
|
|
|
252
253
|
/**
|
|
253
254
|
* 节内容的「实义行」:剥掉列表标记与子标签,再滤掉空行与占位符。
|
|
@@ -268,7 +269,7 @@ function significantLines(text) {
|
|
|
268
269
|
* 把节内容切成条目:bullet(`-` / `*` / `1.`)各算一条,**不以 bullet 开头的行并入上一条**
|
|
269
270
|
* (同一件事的证据常常写在换行的续行里,切开会把证据判丢)。节内的小标题不算条目。
|
|
270
271
|
*/
|
|
271
|
-
function itemsOf(text) {
|
|
272
|
+
export function itemsOf(text) {
|
|
272
273
|
const items = []
|
|
273
274
|
for (const raw of String(text ?? '').split(/\r?\n/)) {
|
|
274
275
|
const line = raw.trim()
|
package/lib/memory/scan.js
CHANGED
|
@@ -15,6 +15,7 @@ import { parseBaseline, parseFrontmatter } from './frontmatter.js'
|
|
|
15
15
|
import { isMemoryEntry, isReserved } from './naming.js'
|
|
16
16
|
import { warnLog } from './util.js'
|
|
17
17
|
import { createDirWatcher } from './watch.js'
|
|
18
|
+
import { CHECKPOINT_FILE_NAME, TASKS_DIR_NAME, TODO_SECTION, itemsOf, normalizeTaskId, parseCheckpoint } from './checkpoint.js'
|
|
18
19
|
import { lstat, open, readFile, readdir } from 'node:fs/promises'
|
|
19
20
|
import { join } from 'node:path'
|
|
20
21
|
|
|
@@ -645,3 +646,58 @@ export async function scanStars(ctx, includeArchived = false) {
|
|
|
645
646
|
if (includeArchived !== true) return active
|
|
646
647
|
return [...active, ...(await scanArchived(ctx))]
|
|
647
648
|
}
|
|
649
|
+
|
|
650
|
+
/** 最多列几个任务检查点(面板一屏放得下,也免得一次读几百份文件)。 */
|
|
651
|
+
export const CHECKPOINT_TASK_LIMIT = 12
|
|
652
|
+
/** 每个任务最多列几条「未完成」(这是提示,不是完整清单 —— 全文在那份检查点里)。 */
|
|
653
|
+
export const CHECKPOINT_ITEM_LIMIT = 20
|
|
654
|
+
/** 单份检查点的读取上限:正常 64 KB 就该拆了,超过这个数一律不读。 */
|
|
655
|
+
const CHECKPOINT_READ_LIMIT = 256 * 1024
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* 扫一遍所有任务检查点,收集「未完成」条目(2.15.0 · 待办看板只读聚合)。
|
|
659
|
+
*
|
|
660
|
+
* 待办看板除了那份 `project_session-state.md`,还要让人看见别的文件里欠着的活 ——
|
|
661
|
+
* `<状态根>/tasks/<taskId>/WORKING.md` 的「未完成」节就是那种东西。三条纪律:
|
|
662
|
+
* 1. **只读**。不写、不合并、不改任何检查点 —— 那些文件各有自己的 revision 与写协议
|
|
663
|
+
* (`writeCheckpoint`),看板不是它们的作者。
|
|
664
|
+
* 2. **失败就跳过那一条**,不让整块聚合失败(一个坏文件不该让看板空掉)。
|
|
665
|
+
* 3. **坏检查点不显示**:`malformedReason` 非空就不算待办 —— 与 `readCheckpoint`
|
|
666
|
+
* 同一条判据(读不出来的东西比读不到更危险)。
|
|
667
|
+
*
|
|
668
|
+
* @param {string} [stateRoot] 状态根(调用方传 `STATE_ROOT`)
|
|
669
|
+
* @returns {Promise<{ok: boolean, tasks: Array<{taskId: string, project: string, revision: number, items: string[]}>,
|
|
670
|
+
* truncated: boolean, error?: string}>} **绝不抛**
|
|
671
|
+
*/
|
|
672
|
+
export async function scanCheckpointOpen(stateRoot) {
|
|
673
|
+
const dir = join(typeof stateRoot === 'string' && stateRoot !== '' ? stateRoot : '.', TASKS_DIR_NAME)
|
|
674
|
+
let entries = []
|
|
675
|
+
try {
|
|
676
|
+
entries = await readdir(dir, { withFileTypes: true })
|
|
677
|
+
} catch (err) {
|
|
678
|
+
// 没有 tasks 目录是**正常状态**(从没用过检查点),不是错误。
|
|
679
|
+
if (err && err.code === 'ENOENT') return { ok: true, tasks: [], truncated: false }
|
|
680
|
+
return { ok: false, tasks: [], truncated: false, error: String((err && err.message) || err) }
|
|
681
|
+
}
|
|
682
|
+
const ids = entries
|
|
683
|
+
.filter((e) => e && typeof e.isDirectory === 'function' && e.isDirectory() && normalizeTaskId(e.name) !== null)
|
|
684
|
+
.map((e) => e.name)
|
|
685
|
+
.sort()
|
|
686
|
+
const truncated = ids.length > CHECKPOINT_TASK_LIMIT
|
|
687
|
+
const tasks = []
|
|
688
|
+
for (const id of ids.slice(0, CHECKPOINT_TASK_LIMIT)) {
|
|
689
|
+
let text = ''
|
|
690
|
+
try {
|
|
691
|
+
text = await readFile(join(dir, id, CHECKPOINT_FILE_NAME), 'utf8')
|
|
692
|
+
} catch (err) {
|
|
693
|
+
continue // 目录里没有 WORKING.md、或者读不了:跳过这一条
|
|
694
|
+
}
|
|
695
|
+
if (text.length > CHECKPOINT_READ_LIMIT) continue
|
|
696
|
+
const parsed = parseCheckpoint(text)
|
|
697
|
+
if (parsed.malformedReason !== '') continue
|
|
698
|
+
const items = itemsOf(parsed.sections[TODO_SECTION] || '').slice(0, CHECKPOINT_ITEM_LIMIT)
|
|
699
|
+
if (items.length === 0) continue
|
|
700
|
+
tasks.push({ taskId: id, project: parsed.project, revision: parsed.revision, items })
|
|
701
|
+
}
|
|
702
|
+
return { ok: true, tasks, truncated }
|
|
703
|
+
}
|
package/lib/typert.host.js
CHANGED
|
@@ -649,6 +649,15 @@ const conflictRemoveResultSchema = z.object({
|
|
|
649
649
|
'code': z.string().readonly().optional(),
|
|
650
650
|
'error': z.string().readonly().optional(),
|
|
651
651
|
}).readonly()
|
|
652
|
+
// 2.15.0:任务检查点里「未完成」的条目(待办看板只读聚合)。
|
|
653
|
+
const checkpointTaskSchema = z.object({
|
|
654
|
+
'taskId': z.string().readonly(), 'project': z.string().readonly(),
|
|
655
|
+
'revision': z.number().readonly(), 'items': z.array(z.string().readonly()).readonly(),
|
|
656
|
+
}).readonly()
|
|
657
|
+
const checkpointsResultSchema = z.object({
|
|
658
|
+
'ok': z.boolean().readonly(), 'truncated': z.boolean().readonly(),
|
|
659
|
+
'tasks': z.array(checkpointTaskSchema).readonly(), 'error': z.string().readonly().optional(),
|
|
660
|
+
}).readonly()
|
|
652
661
|
|
|
653
662
|
export const TYPERT = {
|
|
654
663
|
package: 'sage-mem',
|
|
@@ -785,6 +794,14 @@ export const TYPERT = {
|
|
|
785
794
|
result: { mode: 'strict', typeSymbol: 'sage-mem/types#ArchiveResult', schema: archiveResultSchema, create: () => archiveResultSchema },
|
|
786
795
|
sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
|
|
787
796
|
},
|
|
797
|
+
{
|
|
798
|
+
// 2.15.0:待办看板把各任务检查点里的「未完成」并进视野(只读,不写回)。
|
|
799
|
+
id: 'sage-mem#memory/checkpoints',
|
|
800
|
+
service: 'memory', namespace: 'memory', method: 'checkpoints',
|
|
801
|
+
invocation: { kind: 'direct' }, parameters: [],
|
|
802
|
+
result: { mode: 'strict', typeSymbol: 'sage-mem/types#Checkpoints', schema: checkpointsResultSchema, create: () => checkpointsResultSchema },
|
|
803
|
+
sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
|
|
804
|
+
},
|
|
788
805
|
{
|
|
789
806
|
id: 'sage-mem#memory/audit',
|
|
790
807
|
service: 'memory',
|
package/package.json
CHANGED
package/skills/sage-mem/SKILL.md
CHANGED
|
@@ -140,6 +140,7 @@ metadata:
|
|
|
140
140
|
你的义务,三句:
|
|
141
141
|
|
|
142
142
|
1. **别让它堆积。** 下次读写这个文件、或会话收尾写 `session-log.md` 时,把「已完成,待删除」里的行搬进流水留档,再从 `project_session_state.md` 删掉。
|
|
143
|
+
(2.15.0 起看板上有一颗「搬进流水」:用户自己点也能完成同一件事 —— 正文照抄、已记过的跳过。**看到它搬过就别再搬一遍**:以流水里已有的正文为准。)
|
|
143
144
|
2. **只动那些行。** 绝不自行删除「已完成,待删除」以外、用户没勾选的条目。
|
|
144
145
|
3. **改它只做行级替换 / 删除。** 不重排、不重建 frontmatter、不顺手「整理」别的节。
|
|
145
146
|
|