UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

42 lines (41 loc) • 1.92 kB
import { S as isDreamingNarrativeSessionStoreKey, b as isCronRunSessionKey } from "./session-key-CqAyZeVk.mjs"; import "./session-key-runtime-2lPeTBU1.mjs"; import { t as isActiveMemoryRecallSession } from "./active-memory-recall-session-Do4T_kZm.mjs"; //#region extensions/memory-core/src/memory/manager-session-sync-state.ts function isMemorySessionIndexable(e, t) { return !(e.generatedByDreamingNarrative || e.generatedByCronRun || isActiveMemoryRecallSession({ sessionId: e.sessionId, pluginOwnerId: e.pluginOwnerId, sessionKey: e.sessionKey ?? t }) || e.sessionKind === "cron" || e.sessionKind === "heartbeat" || t !== void 0 && (isDreamingNarrativeSessionStoreKey(t) || isCronRunSessionKey(t) || t.endsWith(":heartbeat")) || e.lineOriginClasses !== void 0 && e.lineOriginClasses.length > 0 && e.lineOriginClasses.every((e) => e === "system")); } function resolveMemorySessionStartupState(e) { const t = e.existingRows ?? []; const n = new Map(t.map((e) => [e.path, e])); const r = new Set(e.files.map((e) => e.path)); const i = []; for (const t of e.files) { const e = n.get(t.path); if (!e || e.hash === "") { i.push(t.absPath); continue; } const r = Number(e.mtime); const a = Number(e.size); if (!Number.isFinite(r) || !Number.isFinite(a) || t.size !== a || t.mtimeMs !== r || t.revisionMs !== void 0 && !e.hash.startsWith(`sqlite:${t.revisionMs}:`)) i.push(t.absPath); } return { dirtyFiles: i, hasStaleIndexedPaths: t.some((e) => !r.has(e.path)) }; } function resolveMemorySessionSyncPlan(e) { const t = e.targetSessionFiles ? null : new Set(e.files.map((t) => e.sessionPathForFile(t))); return { activePaths: t, existingRows: t === null ? null : e.existingRows ?? [], indexAll: e.needsFullReindex || Boolean(e.targetSessionFiles) }; } //#endregion export { resolveMemorySessionStartupState as n, resolveMemorySessionSyncPlan as r, isMemorySessionIndexable as t };