@jacklika/dsh-memory-curator 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Curator tools for the DSH memory vault. This package is a member of the `@jackli
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
7
7
|
- `memory_recall(query)` — Search the vault for prior notes before starting a task. Returns `{ query, hits, total }`, where `total` is the vault-wide match count passed through from `wiki_search` and can exceed `hits.length` when the search layer caps its results — so a caller can tell "these are all the matches" from "there are more".
|
|
8
|
-
- `memory_capture(title, summary, ...)` — Persist durable knowledge after significant work, with conflict detection and optional user approval.
|
|
8
|
+
- `memory_capture(title, summary, ...)` — Persist durable knowledge after significant work, with conflict detection and optional user approval. Returns `{ written, id, mode, conflict, version, created?, updated?, committed? }`: `version` is the SHA-1 of the persisted note text, `created` is present on first capture, `updated` is present on appends, and `committed` is present when `memory-git` completed the commit.
|
|
9
9
|
|
|
10
10
|
## Note ids
|
|
11
11
|
|
package/README.zh.md
CHANGED
|
@@ -5,7 +5,7 @@ DSH 记忆库的策展工具。本包是 `@jacklika/dsh-memory` Bundle 的成员
|
|
|
5
5
|
## 工具
|
|
6
6
|
|
|
7
7
|
- `memory_recall(query)` — 在任务开始前搜索知识库中的相关笔记。返回 `{ query, hits, total }`,其中 `total` 是从 `wiki_search` 透传的全库命中数,在搜索层截断结果时可能大于 `hits.length`——调用方因此能区分“这就是全部命中”与“还有更多”。
|
|
8
|
-
- `memory_capture(title, summary, ...)` —
|
|
8
|
+
- `memory_capture(title, summary, ...)` — 在有意义的任务结束后持久化知识,支持冲突检测与可选的用户审批。返回 `{ written, id, mode, conflict, version, created?, updated?, committed? }`:`version` 是持久化笔记文本的 SHA-1 指纹;首次入库返回 `created`;追加写入返回 `updated`;挂载 `memory-git` 完成提交时还会返回 `committed`。
|
|
9
9
|
|
|
10
10
|
## 笔记 id
|
|
11
11
|
|
package/lib/index.js
CHANGED
|
@@ -180,6 +180,7 @@ export function apply(ctx, config) {
|
|
|
180
180
|
// any auto-capture hits made it into the capped `hits` list, remove them
|
|
181
181
|
// from the total so curated numbers stay truthful.
|
|
182
182
|
const total = search.total - (search.hits.length - curated.length);
|
|
183
|
+
ctx.logger?.debug(`memory-curator: recall query=${args.query} hits=${curated.length} total=${total}`);
|
|
183
184
|
return {
|
|
184
185
|
query: args.query,
|
|
185
186
|
hits: curated.slice(0, 20),
|
|
@@ -291,21 +292,30 @@ export function apply(ctx, config) {
|
|
|
291
292
|
const appendContent = `${args.summary}${detailsText}\n`;
|
|
292
293
|
const appending = conflictExists && mode === 'append';
|
|
293
294
|
const writeMode = appending ? 'append' : 'overwrite';
|
|
295
|
+
ctx.logger?.debug(`memory-curator: capture target=${finalId} conflicts=${conflicts.length} writeMode=${writeMode}`);
|
|
294
296
|
const frontmatter = appending ? undefined : await overwriteFrontmatter(ctx, exec, finalId, args.title, tags, now);
|
|
295
297
|
const content = appending
|
|
296
298
|
? appendContent
|
|
297
299
|
: `---\n${yaml.dump(frontmatter).trim()}\n---\n\n# ${args.title}\n\n${appendContent}`;
|
|
298
|
-
await callTool(ctx, exec, 'wiki_write', {
|
|
300
|
+
const writeResult = await callTool(ctx, exec, 'wiki_write', {
|
|
299
301
|
id: finalId,
|
|
300
302
|
content,
|
|
301
303
|
mode: writeMode,
|
|
302
304
|
});
|
|
303
|
-
|
|
305
|
+
const response = {
|
|
304
306
|
written: true,
|
|
305
307
|
id: finalId,
|
|
306
308
|
mode: writeMode,
|
|
307
309
|
conflict: conflictExists,
|
|
310
|
+
version: writeResult.version,
|
|
308
311
|
};
|
|
312
|
+
if (typeof writeResult.created === 'string' && writeResult.created !== '')
|
|
313
|
+
response.created = writeResult.created;
|
|
314
|
+
if (typeof writeResult.updated === 'string' && writeResult.updated !== '')
|
|
315
|
+
response.updated = writeResult.updated;
|
|
316
|
+
if (typeof writeResult.committed === 'boolean')
|
|
317
|
+
response.committed = writeResult.committed;
|
|
318
|
+
return response;
|
|
309
319
|
},
|
|
310
320
|
})));
|
|
311
321
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacklika/dsh-memory-curator",
|
|
3
3
|
"description": "Curator tools for the DSH memory vault: memory_recall before acting and memory_capture after significant work, with conflict detection and optional user approval.",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.9",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|