@nowcrew/daemon 0.6.88-beta.13 → 0.6.88-beta.15
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/dist/local-memory/write.js +10 -2
- package/package.json +1 -1
|
@@ -109,9 +109,15 @@ function replaceGeneratedIndex(memory, entries) {
|
|
|
109
109
|
}
|
|
110
110
|
return `${memory.trimEnd()}\n\n## Knowledge Index\n${generated}\n`;
|
|
111
111
|
}
|
|
112
|
+
function unwrappedNoteBody(title, body) {
|
|
113
|
+
const detail = body.trim();
|
|
114
|
+
const heading = /^([^\r\n]+)\r?\n\r?\n/u.exec(detail);
|
|
115
|
+
// Agent 可能回传包含包装标题的全文;只解开一层,保留内部及历史标题。
|
|
116
|
+
return heading?.[1] === `## ${title}` ? detail.slice(heading[0].length) : detail;
|
|
117
|
+
}
|
|
112
118
|
function noteSection(id, revision, title, body) {
|
|
113
119
|
return `<!-- NOWWORK:MEMORY_ENTRY:BEGIN id=${id} revision=${revision} -->\n`
|
|
114
|
-
+ `## ${title}\n\n${body
|
|
120
|
+
+ `## ${title}\n\n${unwrappedNoteBody(title, body)}\n`
|
|
115
121
|
+ `<!-- NOWWORK:MEMORY_ENTRY:END id=${id} -->\n`;
|
|
116
122
|
}
|
|
117
123
|
function notePattern(id) {
|
|
@@ -455,8 +461,10 @@ export async function applyLocalMemoryResult(input) {
|
|
|
455
461
|
if (duplicate !== undefined) {
|
|
456
462
|
const duplicatePath = resolve(input.agentDir, duplicate.file);
|
|
457
463
|
const duplicateBody = readNoteBody(noteUpdates.get(duplicatePath) ?? await readNote(duplicatePath), duplicate.id);
|
|
458
|
-
if (duplicateBody === change.detailBody
|
|
464
|
+
if (duplicateBody === change.detailBody
|
|
465
|
+
|| duplicateBody === unwrappedNoteBody(change.title, change.detailBody).trim()) {
|
|
459
466
|
resolvedPendingIds.add(pending.pendingId);
|
|
467
|
+
}
|
|
460
468
|
continue;
|
|
461
469
|
}
|
|
462
470
|
const entry = entryFromChange(change, id, 1, "active");
|