@mingxy/cerebro 1.10.2 → 1.10.3

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.10.2",
3
+ "version": "1.10.3",
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
@@ -448,7 +448,7 @@ export function compactingHook(client: OmemClient, containerTags: string[], tui:
448
448
  mode: ingestMode,
449
449
  tags: [...containerTags, "auto-capture"],
450
450
  sessionId: effectiveSessionId,
451
- parentSessionId: isSubAgent ? input.sessionID : undefined,
451
+ parentSessionId: isSubAgent ? getMainSessionId?.() : undefined,
452
452
  projectName: projectName,
453
453
  });
454
454
  logDebug("compactingHook ingestMessages result", { result: result === null ? "null(blocked)" : "ok" });
package/src/logger.ts CHANGED
@@ -2,6 +2,15 @@ import { appendFileSync, mkdirSync, existsSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
 
5
+ const LEVEL_MAP: Record<string, number> = {
6
+ DEBUG: 0,
7
+ INFO: 1,
8
+ WARN: 2,
9
+ ERROR: 3,
10
+ };
11
+
12
+ const MIN_LEVEL = LEVEL_MAP[process.env.OMEM_LOG_LEVEL?.toUpperCase() ?? ""] ?? LEVEL_MAP.INFO;
13
+
5
14
  const LOG_DIR = join(homedir(), ".config", "ourmem");
6
15
  const LOG_FILE = join(LOG_DIR, "plugin.log");
7
16
 
@@ -16,6 +25,8 @@ function ensureLogDir(): void {
16
25
  }
17
26
 
18
27
  function writeLog(level: string, message: string, fields?: Record<string, unknown>): void {
28
+ const lvl = LEVEL_MAP[level] ?? 0;
29
+ if (lvl < MIN_LEVEL) return;
19
30
  ensureLogDir();
20
31
  const now = new Date();
21
32
  const ts = now.toISOString().replace("T", " ").replace(/\.\d+Z$/, "");