@mingxy/cerebro 1.18.19 → 1.18.20
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 +3 -0
- package/src/index.ts +19 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/cerebro",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.20",
|
|
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
|
@@ -342,6 +342,9 @@ export function chatMessageRecallHook(
|
|
|
342
342
|
injectedSessions.add(input.sessionID);
|
|
343
343
|
|
|
344
344
|
output.parts.unshift({
|
|
345
|
+
id: `prt_cerebro-inject-${Date.now()}`,
|
|
346
|
+
sessionID: input.sessionID,
|
|
347
|
+
messageID: output.message?.id,
|
|
345
348
|
type: "text",
|
|
346
349
|
text: injection.text,
|
|
347
350
|
synthetic: true,
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import type { Server } from "node:http";
|
|
7
7
|
import { CerebroClient } from "./client.js";
|
|
8
8
|
import { chatMessageRecallHook, autocontinueHook, compactingHook, sessionIdleHook, showToast as hooksShowToast, sessionMessages, firstMessages } from "./hooks.js";
|
|
9
|
-
import { detectSaveKeyword, detectRecallKeyword } from "./keywords.js";
|
|
9
|
+
import { detectSaveKeyword, detectRecallKeyword, KEYWORD_NUDGE, RECALL_NUDGE } from "./keywords.js";
|
|
10
10
|
import { getUserTag, getProjectTag } from "./tags.js";
|
|
11
11
|
import { buildTools } from "./tools.js";
|
|
12
12
|
import { logInfo, logDebug, logError } from "./logger.js";
|
|
@@ -163,12 +163,26 @@ const OmemPlugin: Plugin = async (input) => {
|
|
|
163
163
|
firstMessages.set(input.sessionID, textContent);
|
|
164
164
|
}
|
|
165
165
|
if (detectSaveKeyword(textContent)) {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
output.parts.push({
|
|
167
|
+
id: `prt_cerebro-save-${Date.now()}`,
|
|
168
|
+
sessionID: input.sessionID,
|
|
169
|
+
messageID: output.message?.id,
|
|
170
|
+
type: "text",
|
|
171
|
+
text: KEYWORD_NUDGE,
|
|
172
|
+
synthetic: true,
|
|
173
|
+
} as any);
|
|
174
|
+
logDebug("save keyword detected, nudge pushed", { sessionId: input.sessionID });
|
|
168
175
|
}
|
|
169
176
|
if (detectRecallKeyword(textContent)) {
|
|
170
|
-
|
|
171
|
-
|
|
177
|
+
output.parts.push({
|
|
178
|
+
id: `prt_cerebro-recall-${Date.now()}`,
|
|
179
|
+
sessionID: input.sessionID,
|
|
180
|
+
messageID: output.message?.id,
|
|
181
|
+
type: "text",
|
|
182
|
+
text: RECALL_NUDGE,
|
|
183
|
+
synthetic: true,
|
|
184
|
+
} as any);
|
|
185
|
+
logDebug("recall keyword detected, nudge pushed", { sessionId: input.sessionID });
|
|
172
186
|
}
|
|
173
187
|
const policy = resolveAgentPolicy(agentId, config);
|
|
174
188
|
if (policy !== "none") {
|