@mingxy/cerebro 1.5.0 โ†’ 1.5.1

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.0",
3
+ "version": "1.5.1",
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/client.ts CHANGED
@@ -361,12 +361,12 @@ export class OmemClient {
361
361
  }
362
362
 
363
363
  async sessionIngest(
364
- summaries: Array<{ topic: string; content: string }>,
364
+ messages: Array<{ role: string; content: string }>,
365
365
  sessionId?: string,
366
366
  agentId?: string,
367
367
  ): Promise<unknown> {
368
368
  return this.post("/v1/memories/session-ingest", {
369
- summaries,
369
+ messages,
370
370
  session_id: sessionId,
371
371
  agent_id: agentId,
372
372
  });
package/src/hooks.ts CHANGED
@@ -347,10 +347,10 @@ const processedMessageIds = new Set<string>();
347
347
 
348
348
  export function sessionIdleHook(
349
349
  omemClient: OmemClient,
350
- containerTags: string[],
350
+ _containerTags: string[],
351
351
  tui: any,
352
352
  sdkClient: any,
353
- ingestMode: "smart" | "raw" = "smart",
353
+ _ingestMode: "smart" | "raw" = "smart",
354
354
  ) {
355
355
  let idleTimeout: ReturnType<typeof setTimeout> | null = null;
356
356
  let isCapturing = false;
@@ -373,7 +373,6 @@ export function sessionIdleHook(
373
373
 
374
374
  const messages = response.data;
375
375
  const conversationMessages: Array<{ role: string; content: string }> = [];
376
- const dcpSummaries: Array<{ topic: string; content: string }> = [];
377
376
  let hasNewMessages = false;
378
377
 
379
378
  for (const msg of messages) {
@@ -391,45 +390,16 @@ export function sessionIdleHook(
391
390
 
392
391
  hasNewMessages = true;
393
392
  processedMessageIds.add(msgId);
394
-
395
- if (text.includes("[Compressed conversation section]")) {
396
- const blockRegex = /\[Compressed conversation section\]\n([\s\S]*?)(?=<dcp-block|$)/g;
397
- let match;
398
- while ((match = blockRegex.exec(text)) !== null) {
399
- const summary = match[1].trim();
400
- if (summary) {
401
- dcpSummaries.push({ topic: "session-compress", content: summary });
402
- }
403
- }
404
- }
405
-
406
393
  conversationMessages.push({ role, content: text });
407
394
  }
408
395
 
409
- if (!hasNewMessages) return;
410
-
411
- if (dcpSummaries.length > 0) {
412
- try {
413
- await omemClient.sessionIngest(dcpSummaries, sessionID);
414
- showToast(tui, "๐Ÿง  DCP Summary Captured", `${dcpSummaries.length} compress summaries stored (zero-LLM)`, "success");
415
- } catch (err) {
416
- showToast(tui, "๐Ÿ”ด DCP Capture Failed", String(err).substring(0, 100), "error");
417
- }
418
- }
396
+ if (!hasNewMessages || conversationMessages.length === 0) return;
419
397
 
420
- if (conversationMessages.length > 0) {
421
- try {
422
- const result = await omemClient.ingestMessages(conversationMessages, {
423
- mode: ingestMode,
424
- tags: [...containerTags, "session-idle"],
425
- sessionId: sessionID,
426
- });
427
- if (result) {
428
- showToast(tui, "๐Ÿง  Session Captured", `${conversationMessages.length} messages captured via session.idle`, "success");
429
- }
430
- } catch (err) {
431
- showToast(tui, "๐Ÿ”ด Session Capture Failed", String(err).substring(0, 100), "error");
432
- }
398
+ try {
399
+ await omemClient.sessionIngest(conversationMessages, sessionID);
400
+ showToast(tui, "๐Ÿง  Memory Sealed", `${conversationMessages.length} dialogues captured ยท entrusted to the heavens for refinement`, "success");
401
+ } catch (err) {
402
+ showToast(tui, "๐Ÿ”ด Session Capture Failed", String(err).substring(0, 100), "error");
433
403
  }
434
404
  } catch (err) {
435
405
  const errMsg = err instanceof Error ? err.message : String(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, keywordDetectionHook, sessionIdleHook } from "./hooks.js";
6
+ import { autoRecallHook, compactingHook, 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,7 +93,6 @@ 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),
97
96
  "experimental.session.compacting": compactingHook(omemClient, containerTags, tui, config.ingestMode),
98
97
  tool: buildTools(omemClient, containerTags, { agentId, getSessionId: () => currentSessionId }),
99
98
  event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode),