@xdarkicex/openclaw-memory-libravdb 1.6.28 → 1.6.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context-engine.js +12 -3
- package/dist/index.js +9 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/context-engine.js
CHANGED
|
@@ -54,15 +54,22 @@ function normalizeCompactResult(response, options = {}) {
|
|
|
54
54
|
? response.summaryText
|
|
55
55
|
: undefined,
|
|
56
56
|
};
|
|
57
|
+
// When the engine owns compaction but refuses to compact while the session
|
|
58
|
+
// exceeds the threshold, this is not a successful skip — it's a failure.
|
|
59
|
+
// Signal ok:false so OpenClaw falls back to normal transcript compaction
|
|
60
|
+
// instead of accepting a bloated session.
|
|
61
|
+
const threshold = options.threshold;
|
|
62
|
+
const overBudget = threshold != null && tokensBefore >= threshold;
|
|
63
|
+
const engineRefused = !didCompact && overBudget;
|
|
57
64
|
return {
|
|
58
|
-
ok:
|
|
65
|
+
ok: !engineRefused,
|
|
59
66
|
compacted: didCompact,
|
|
60
|
-
...(didCompact ? {} : { reason: "not_compacted" }),
|
|
67
|
+
...(didCompact ? {} : { reason: engineRefused ? "overbudget_not_compacted" : "not_compacted" }),
|
|
61
68
|
result: {
|
|
62
69
|
tokensBefore,
|
|
63
70
|
...(details.summaryMethod ? { summary: details.summaryMethod } : {}),
|
|
64
71
|
...(details.summaryText ? { summaryText: details.summaryText } : {}),
|
|
65
|
-
details,
|
|
72
|
+
details: { ...details, ...(threshold != null ? { threshold } : {}) },
|
|
66
73
|
},
|
|
67
74
|
};
|
|
68
75
|
}
|
|
@@ -1084,8 +1091,10 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
1084
1091
|
const request = buildCompactSessionRequest(args);
|
|
1085
1092
|
try {
|
|
1086
1093
|
const client = await runtime.getClient();
|
|
1094
|
+
const threshold = getDynamicCompactThreshold(args.tokenBudget);
|
|
1087
1095
|
return normalizeCompactResult(await client.compactSession(request), {
|
|
1088
1096
|
tokensBefore: args.currentTokenCount,
|
|
1097
|
+
...(threshold != null ? { threshold } : {}),
|
|
1089
1098
|
});
|
|
1090
1099
|
}
|
|
1091
1100
|
catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -26723,15 +26723,18 @@ function normalizeCompactResult(response, options = {}) {
|
|
|
26723
26723
|
meanConfidence: typeof response?.meanConfidence === "number" ? response.meanConfidence : void 0,
|
|
26724
26724
|
summaryText: typeof response?.summaryText === "string" && response.summaryText.length > 0 ? response.summaryText : void 0
|
|
26725
26725
|
};
|
|
26726
|
+
const threshold = options.threshold;
|
|
26727
|
+
const overBudget = threshold != null && tokensBefore >= threshold;
|
|
26728
|
+
const engineRefused = !didCompact && overBudget;
|
|
26726
26729
|
return {
|
|
26727
|
-
ok:
|
|
26730
|
+
ok: !engineRefused,
|
|
26728
26731
|
compacted: didCompact,
|
|
26729
|
-
...didCompact ? {} : { reason: "not_compacted" },
|
|
26732
|
+
...didCompact ? {} : { reason: engineRefused ? "overbudget_not_compacted" : "not_compacted" },
|
|
26730
26733
|
result: {
|
|
26731
26734
|
tokensBefore,
|
|
26732
26735
|
...details.summaryMethod ? { summary: details.summaryMethod } : {},
|
|
26733
26736
|
...details.summaryText ? { summaryText: details.summaryText } : {},
|
|
26734
|
-
details
|
|
26737
|
+
details: { ...details, ...threshold != null ? { threshold } : {} }
|
|
26735
26738
|
}
|
|
26736
26739
|
};
|
|
26737
26740
|
}
|
|
@@ -27583,8 +27586,10 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
27583
27586
|
const request3 = buildCompactSessionRequest(args);
|
|
27584
27587
|
try {
|
|
27585
27588
|
const client = await runtime.getClient();
|
|
27589
|
+
const threshold = getDynamicCompactThreshold(args.tokenBudget);
|
|
27586
27590
|
return normalizeCompactResult(await client.compactSession(request3), {
|
|
27587
|
-
tokensBefore: args.currentTokenCount
|
|
27591
|
+
tokensBefore: args.currentTokenCount,
|
|
27592
|
+
...threshold != null ? { threshold } : {}
|
|
27588
27593
|
});
|
|
27589
27594
|
} catch (error2) {
|
|
27590
27595
|
return {
|
package/openclaw.plugin.json
CHANGED