@xdarkicex/openclaw-memory-libravdb 1.4.10 → 1.4.11
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.d.ts +3 -0
- package/dist/context-engine.js +24 -6
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/context-engine.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export declare function buildContextEngineFactory(runtime: PluginRuntime, cfg: P
|
|
|
76
76
|
sessionId: string;
|
|
77
77
|
force?: boolean;
|
|
78
78
|
targetSize?: number;
|
|
79
|
+
tokenBudget?: number;
|
|
79
80
|
}): Promise<any>;
|
|
80
81
|
afterTurn(args: {
|
|
81
82
|
sessionId: string;
|
|
@@ -88,6 +89,8 @@ export declare function buildContextEngineFactory(runtime: PluginRuntime, cfg: P
|
|
|
88
89
|
}>;
|
|
89
90
|
prePromptMessageCount?: number;
|
|
90
91
|
isHeartbeat?: boolean;
|
|
92
|
+
tokenBudget?: number;
|
|
93
|
+
runtimeContext?: Record<string, unknown>;
|
|
91
94
|
}): Promise<any>;
|
|
92
95
|
};
|
|
93
96
|
export {};
|
package/dist/context-engine.js
CHANGED
|
@@ -87,6 +87,27 @@ export function normalizeAssembleResult(result) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
export function buildContextEngineFactory(runtime, cfg, recallCache, logger = console) {
|
|
90
|
+
function buildCompactSessionRequest(args) {
|
|
91
|
+
// OpenClaw core now requests budget-style compaction using tokenBudget,
|
|
92
|
+
// but the current LibraVDB compact_session wire contract still expects
|
|
93
|
+
// targetSize. Use tokenBudget as the compatibility target so overflow and
|
|
94
|
+
// timeout retries still compact toward the host's requested prompt budget.
|
|
95
|
+
const targetSize = args.targetSize ?? args.tokenBudget;
|
|
96
|
+
return {
|
|
97
|
+
sessionId: args.sessionId,
|
|
98
|
+
force: args.force,
|
|
99
|
+
...(typeof targetSize === "number" ? { targetSize } : {}),
|
|
100
|
+
...(typeof cfg.continuityMinTurns === "number"
|
|
101
|
+
? { continuityMinTurns: cfg.continuityMinTurns }
|
|
102
|
+
: {}),
|
|
103
|
+
...(typeof cfg.continuityTailBudgetTokens === "number"
|
|
104
|
+
? { continuityTailBudgetTokens: cfg.continuityTailBudgetTokens }
|
|
105
|
+
: {}),
|
|
106
|
+
...(typeof cfg.continuityPriorContextTokens === "number"
|
|
107
|
+
? { continuityPriorContextTokens: cfg.continuityPriorContextTokens }
|
|
108
|
+
: {}),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
90
111
|
return {
|
|
91
112
|
info: { id: "libravdb-memory", name: "LibraVDB Memory", ownsCompaction: true },
|
|
92
113
|
ownsCompaction: true,
|
|
@@ -188,16 +209,13 @@ export function buildContextEngineFactory(runtime, cfg, recallCache, logger = co
|
|
|
188
209
|
return normalizeAssembleResult(resp);
|
|
189
210
|
},
|
|
190
211
|
async compact(args) {
|
|
212
|
+
const request = buildCompactSessionRequest(args);
|
|
191
213
|
const kernel = runtime.getKernel();
|
|
192
214
|
if (kernel) {
|
|
193
|
-
return await kernel.compactSession(
|
|
194
|
-
sessionId: args.sessionId,
|
|
195
|
-
force: args.force,
|
|
196
|
-
targetSize: args.targetSize,
|
|
197
|
-
});
|
|
215
|
+
return await kernel.compactSession(request);
|
|
198
216
|
}
|
|
199
217
|
const rpc = await runtime.getRpc();
|
|
200
|
-
return await rpc.call("compact_session",
|
|
218
|
+
return await rpc.call("compact_session", request);
|
|
201
219
|
},
|
|
202
220
|
async afterTurn(args) {
|
|
203
221
|
const messages = normalizeKernelMessages(args.messages);
|
package/openclaw.plugin.json
CHANGED