|
@@ -134,6 +134,12 @@ function getAgentIdFromSessionKey(sessionKey?: string): string | undefined {
|
|
|
return undefined;
|
|
return undefined;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// Cron jobs are launched with session keys like "main:main:cron:<id>"; they are not
|
|
|
|
|
+// human conversations, so don’t inject memories into them.
|
|
|
|
|
+function isCronSession(sessionKey?: string): boolean {
|
|
|
|
|
+ return typeof sessionKey === "string" && sessionKey.startsWith("main:main:cron:");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function isMediaPlaceholder(text: string): boolean {
|
|
function isMediaPlaceholder(text: string): boolean {
|
|
|
return /<media:[^>]+>/i.test(text);
|
|
return /<media:[^>]+>/i.test(text);
|
|
|
}
|
|
}
|
|
@@ -551,6 +557,14 @@ export default async function handler(event: HookEvent) {
|
|
|
|
|
|
|
|
// ── Auto-recall: queries both endpoints in parallel ───────────────────────
|
|
// ── Auto-recall: queries both endpoints in parallel ───────────────────────
|
|
|
const runAutoRecall = async (text: string) => {
|
|
const runAutoRecall = async (text: string) => {
|
|
|
|
|
+ if (isCronSession(event.sessionKey)) {
|
|
|
|
|
+ logHook("auto-recall-skip-cron", {
|
|
|
|
|
+ sessionKey: event.sessionKey,
|
|
|
|
|
+ userId,
|
|
|
|
|
+ snippet: text.slice(0, 120),
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!pluginCfg.autoRecall) return;
|
|
if (!pluginCfg.autoRecall) return;
|
|
|
|
|
|
|
|
const { baseUrl, recallLimit, rerankThreshold } = pluginCfg;
|
|
const { baseUrl, recallLimit, rerankThreshold } = pluginCfg;
|