@mingxy/cerebro 1.7.6 → 1.8.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.7.6",
3
+ "version": "1.8.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
@@ -364,11 +364,15 @@ export class OmemClient {
364
364
  messages: Array<{ role: string; content: string }>,
365
365
  sessionId?: string,
366
366
  agentId?: string,
367
+ sessionTitle?: string,
368
+ projectName?: string,
367
369
  ): Promise<unknown> {
368
370
  return this.post("/v1/memories/session-ingest", {
369
371
  messages,
370
372
  session_id: sessionId,
371
373
  agent_id: agentId,
374
+ session_title: sessionTitle,
375
+ project_name: projectName,
372
376
  }, 60000);
373
377
  }
374
378
  }
package/src/hooks.ts CHANGED
@@ -201,7 +201,7 @@ export function autoRecallHook(client: OmemClient, containerTags: string[], tui:
201
201
  newIds,
202
202
  "auto",
203
203
  query_text,
204
- shouldRecallRes?.similarity_score,
204
+ shouldRecallRes?.memories?.[0]?.score,
205
205
  shouldRecallRes?.confidence,
206
206
  );
207
207
 
@@ -419,8 +419,20 @@ export function sessionIdleHook(
419
419
  return;
420
420
  }
421
421
 
422
+ let sessionTitle: string | undefined;
423
+ let projectName: string | undefined;
422
424
  try {
423
- await omemClient.sessionIngest(conversationMessages, sessionID);
425
+ const sessionInfo = await sdkClient.session.get({ path: { id: sessionID } });
426
+ sessionTitle = sessionInfo?.title;
427
+ projectName = sessionInfo?.project?.rootPath
428
+ ? sessionInfo.project.rootPath.split("/").pop()
429
+ : undefined;
430
+ } catch (e) {
431
+ // 获取失败不影响主流程
432
+ }
433
+
434
+ try {
435
+ await omemClient.sessionIngest(conversationMessages, sessionID, undefined, sessionTitle, projectName);
424
436
  for (const id of newMessageIds) {
425
437
  processedMessageIds.add(id);
426
438
  }