openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
25 lines (24 loc) • 1.02 kB
JavaScript
import { l as resolveSessionStorePathCore } from "./paths-DvQ5AJvD.mjs";
import "./session-accessor-CizTbDQj.mjs";
import { c as updateSessionEntry } from "./session-accessor.entry-mutation-IJ4DYZ4a.mjs";
//#region src/agents/embedded-agent-subscribe.handlers.compaction.runtime.ts
/** Persist the highest observed compaction count after a successful subscribed run. */
async function reconcileSessionStoreCompactionCountAfterSuccess(e) {
const { sessionKey: t, agentId: n, configStore: r, observedCompactionCount: i, now: a = Date.now() } = e;
if (!t || i <= 0) return;
const o = resolveSessionStorePathCore(r, { agentId: n });
return (await updateSessionEntry({
sessionKey: t,
storePath: o
}, async (e) => {
const t = Math.max(0, e.compactionCount ?? 0);
const n = Math.max(t, i);
if (n === t) return null;
return {
compactionCount: n,
updatedAt: Math.max(e.updatedAt ?? 0, a)
};
}))?.compactionCount;
}
//#endregion
export { reconcileSessionStoreCompactionCountAfterSuccess as default };