@mingxy/cerebro 2.3.7 → 2.3.8
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/package.json +1 -1
- package/src/hooks.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/cerebro",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.8",
|
|
4
4
|
"description": "Cerebro persistent memory plugin for OpenCode — auto-recall, auto-capture, 9 memory tools with clustering, project-scoped memory isolation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/hooks.ts
CHANGED
|
@@ -291,11 +291,13 @@ export async function buildMemoryInjection(
|
|
|
291
291
|
typeof ic.digestPrompt === "string" && ic.digestPrompt.trim()
|
|
292
292
|
? ic.digestPrompt.trim()
|
|
293
293
|
: DEFAULTS.injection.digestPrompt!;
|
|
294
|
-
const renderLine = (age: string, m: { id: string; content: string; l0_abstract?: string; l1_overview?: string }, truncateChars = 0): string => {
|
|
294
|
+
const renderLine = (age: string, m: { id: string; content: string; l0_abstract?: string; l1_overview?: string } | null | undefined, truncateChars = 0): string => {
|
|
295
|
+
if (!m) return "";
|
|
295
296
|
const content = truncateChars > 0 ? truncate(m.content, truncateChars) : m.content;
|
|
296
297
|
if (!digestMode) return `- (${age}) ${content}`;
|
|
297
|
-
|
|
298
|
-
const
|
|
298
|
+
// l0/l1 过 \s+→" ":l1 源自 content 截断带换行,断行可伪造注入条目行
|
|
299
|
+
const l0 = (m.l0_abstract || "").replace(/\s+/g, " ").trim();
|
|
300
|
+
const l1 = (m.l1_overview || "").replace(/\s+/g, " ").trim();
|
|
299
301
|
const title = l0 || (m.content || "").replace(/\s+/g, " ").slice(0, 60);
|
|
300
302
|
return `- (${age}) id=${m.id} ${title}${l1 ? ` — ${l1}` : ""}`;
|
|
301
303
|
};
|