@mingxy/cerebro 1.5.7 → 1.5.8
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/src/index.ts +1 -1
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -341,6 +341,7 @@ export function sessionIdleHook(
|
|
|
341
341
|
tui: any,
|
|
342
342
|
sdkClient: any,
|
|
343
343
|
_ingestMode: "smart" | "raw" = "smart",
|
|
344
|
+
threshold: number = 0,
|
|
344
345
|
getMainSessionId?: () => string | undefined,
|
|
345
346
|
) {
|
|
346
347
|
let idleTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
@@ -392,6 +393,11 @@ export function sessionIdleHook(
|
|
|
392
393
|
|
|
393
394
|
if (!hasNewMessages || conversationMessages.length === 0) return;
|
|
394
395
|
|
|
396
|
+
if (threshold > 1 && conversationMessages.length < threshold) {
|
|
397
|
+
// Log that we're waiting for more messages
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
395
401
|
try {
|
|
396
402
|
await omemClient.sessionIngest(conversationMessages, sessionID);
|
|
397
403
|
for (const id of newMessageIds) {
|
package/src/index.ts
CHANGED
|
@@ -96,7 +96,7 @@ const OmemPlugin: Plugin = async (input) => {
|
|
|
96
96
|
"chat.message": keywordDetectionHook(omemClient, containerTags, config.autoCaptureThreshold, tui, config.ingestMode),
|
|
97
97
|
"experimental.session.compacting": compactingHook(omemClient, containerTags, tui, config.ingestMode),
|
|
98
98
|
tool: buildTools(omemClient, containerTags, { agentId, getSessionId: () => currentSessionId }),
|
|
99
|
-
event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode, () => currentSessionId),
|
|
99
|
+
event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode, config.autoCaptureThreshold, () => currentSessionId),
|
|
100
100
|
"shell.env": async (_input: any, output: any) => {
|
|
101
101
|
if (directory) {
|
|
102
102
|
output.env.OMEM_PROJECT_DIR = directory;
|