openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
23 lines (22 loc) • 727 B
JavaScript
import { d as prepareCompaction } from "./compaction-z9gtIF8y.mjs";
//#region src/agents/sessions/manual-compaction-preflight.ts
/** Plans manual compaction without aborting or otherwise mutating the active session. */
function preflightManualSessionCompaction(e, t, n) {
let r = prepareCompaction(e, t, void 0, n);
if (r.ok && !r.value) r = prepareCompaction(e, {
...t,
keepRecentTokens: 0
}, void 0, n);
if (!r.ok) throw r.error;
const i = r.value;
if (i) return {
compactable: true,
preparation: i
};
return {
compactable: false,
reason: e.at(-1)?.type === "compaction" ? "Already compacted" : "Nothing to compact (session too small)"
};
}
//#endregion
export { preflightManualSessionCompaction as t };