import { loadCronStore, resolveCronStorePath } from "../../cron/store.js"; import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js"; import type { ReplyPayload } from "../types.js";
export const UNSCHEDULED_REMINDER_NOTE = "Note: I did not schedule a reminder in this turn, so this will not trigger automatically.";
export function hasUnbackedReminderCommitment(text: string): boolean { const normalized = normalizeLowercaseStringOrEmpty(text); if (!normalized.trim()) { returnfalse;
} if (normalized.includes(normalizeLowercaseStringOrEmpty(UNSCHEDULED_REMINDER_NOTE))) { returnfalse;
} return REMINDER_COMMITMENT_PATTERNS.some((pattern) => pattern.test(text));
}
/** * Returns true when the cron store has at least one enabled job that shares the * current session key. Used to suppress the "no reminder scheduled" guard note * when an existing cron (created in a prior turn) already covers the commitment.
*/
export async function hasSessionRelatedCronJobs(params: {
cronStorePath?: string;
sessionKey?: string;
}): Promise<boolean> { try { const storePath = resolveCronStorePath(params.cronStorePath); const store = await loadCronStore(storePath); if (store.jobs.length === 0) { returnfalse;
} if (params.sessionKey) { return store.jobs.some((job) => job.enabled && job.sessionKey === params.sessionKey);
} returnfalse;
} catch { // If we cannot read the cron store, do not suppress the note. returnfalse;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.