openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
40 lines (39 loc) • 1.78 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
import "./string-coerce-runtime-BwAZZDf5.mjs";
import { t as MANAGED_DREAMING_DECLARATION_KEY } from "./dreaming-cron-contract-BaLk3g0c.mjs";
//#region extensions/memory-core/src/migration/dreaming-cron-classifier.ts
/** Doctor owns historical recognition; runtime may use the result only for diagnosis. */
function classifyDreamingCronJob(e, t) {
if (e.declarationKey === "memory-core:memory-dreaming-promotion") return "declared";
if (e.declarationKey !== void 0 && e.declarationKey !== null) return;
const n = normalizeOptionalString(e.name);
const r = normalizeOptionalString(e.description);
const i = isRecord(e.payload) ? e.payload : {};
const a = normalizeOptionalString(i.kind)?.toLowerCase();
const o = normalizeOptionalString(a === "systemevent" ? i.text : a === "agentturn" ? i.message : void 0);
let s;
for (const [e, i, c] of [[
t.LEGACY_MEMORY_LIGHT_DREAMING_CRON_NAME,
t.LEGACY_MEMORY_LIGHT_DREAMING_CRON_TAG,
t.LEGACY_MEMORY_LIGHT_DREAMING_EVENT_TEXT
], [
t.LEGACY_MEMORY_REM_DREAMING_CRON_NAME,
t.LEGACY_MEMORY_REM_DREAMING_CRON_TAG,
t.LEGACY_MEMORY_REM_DREAMING_EVENT_TEXT
]]) {
if (r?.includes(i)) {
if (o !== c && o !== t.MEMORY_DREAMING_SYSTEM_EVENT_TEXT) return "ambiguous";
s = "phase";
}
if (n === e && a === "systemevent" && o === c) s = "phase";
}
if (r?.includes(t.MANAGED_MEMORY_DREAMING_CRON_TAG)) {
if (o === t.MEMORY_DREAMING_SYSTEM_EVENT_TEXT) return "legacy";
return s ?? "ambiguous";
}
if (n === t.MANAGED_MEMORY_DREAMING_CRON_NAME && o === t.MEMORY_DREAMING_SYSTEM_EVENT_TEXT) return "legacy";
return s;
}
//#endregion
export { classifyDreamingCronJob as t };