@mingxy/cerebro 1.5.8 → 1.5.9
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 +6 -0
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -334,6 +334,7 @@ export function compactingHook(client: OmemClient, containerTags: string[], tui:
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
const processedMessageIds = new Set<string>();
|
|
337
|
+
const pluginStartTime = Date.now();
|
|
337
338
|
|
|
338
339
|
export function sessionIdleHook(
|
|
339
340
|
omemClient: OmemClient,
|
|
@@ -377,6 +378,11 @@ export function sessionIdleHook(
|
|
|
377
378
|
const msgId = msg.info?.id;
|
|
378
379
|
if (!msgId || processedMessageIds.has(msgId)) continue;
|
|
379
380
|
|
|
381
|
+
// Skip messages created before this plugin instance started
|
|
382
|
+
// (prevents replaying entire session history on restart)
|
|
383
|
+
const msgTime = msg.info?.createdAt ? new Date(msg.info.createdAt).getTime() : 0;
|
|
384
|
+
if (msgTime > 0 && msgTime < pluginStartTime) continue;
|
|
385
|
+
|
|
380
386
|
const role = msg.info?.role;
|
|
381
387
|
if (role !== "user" && role !== "assistant") continue;
|
|
382
388
|
|