@mingxy/cerebro 1.5.3 โ†’ 1.5.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Cerebro persistent memory plugin for OpenCode โ€” auto-recall, auto-capture, 9 memory tools with clustering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/hooks.ts CHANGED
@@ -375,6 +375,7 @@ export function sessionIdleHook(
375
375
 
376
376
  const messages = response.data;
377
377
  const conversationMessages: Array<{ role: string; content: string }> = [];
378
+ const newMessageIds: string[] = [];
378
379
  let hasNewMessages = false;
379
380
 
380
381
  for (const msg of messages) {
@@ -391,7 +392,7 @@ export function sessionIdleHook(
391
392
  if (!text) continue;
392
393
 
393
394
  hasNewMessages = true;
394
- processedMessageIds.add(msgId);
395
+ newMessageIds.push(msgId);
395
396
  conversationMessages.push({ role, content: text });
396
397
  }
397
398
 
@@ -399,8 +400,13 @@ export function sessionIdleHook(
399
400
 
400
401
  try {
401
402
  await omemClient.sessionIngest(conversationMessages, sessionID);
403
+ // Only mark as processed after successful ingest to prevent message loss on server errors
404
+ for (const id of newMessageIds) {
405
+ processedMessageIds.add(id);
406
+ }
402
407
  showToast(tui, "๐Ÿง  Memory Sealed", `${conversationMessages.length} dialogues captured ยท entrusted to the heavens for refinement`, "success");
403
408
  } catch (err) {
409
+ // Do NOT mark as processed โ€” messages will be retried on next idle event
404
410
  showToast(tui, "๐Ÿ”ด Session Capture Failed", String(err).substring(0, 100), "error");
405
411
  }
406
412
  } catch (err) {
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ import { readFileSync } from "node:fs";
3
3
  import { join, dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { OmemClient } from "./client.js";
6
- import { autoRecallHook, compactingHook, sessionIdleHook } from "./hooks.js";
6
+ import { autoRecallHook, compactingHook, keywordDetectionHook, sessionIdleHook } from "./hooks.js";
7
7
  import { getUserTag, getProjectTag } from "./tags.js";
8
8
  import { buildTools } from "./tools.js";
9
9
  import { logInfo, logError } from "./logger.js";
@@ -93,6 +93,7 @@ const OmemPlugin: Plugin = async (input) => {
93
93
  if (input.sessionID) currentSessionId = input.sessionID;
94
94
  return recallHook(input, output);
95
95
  },
96
+ "chat.message": keywordDetectionHook(omemClient, containerTags, config.autoCaptureThreshold, tui, config.ingestMode),
96
97
  "experimental.session.compacting": compactingHook(omemClient, containerTags, tui, config.ingestMode),
97
98
  tool: buildTools(omemClient, containerTags, { agentId, getSessionId: () => currentSessionId }),
98
99
  event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode),