@xdarkicex/openclaw-memory-libravdb 1.9.3 → 1.9.4
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 +4 -4
- package/dist/index.js +33 -12
- package/dist/types.d.ts +2 -0
- package/dist/types.js +17 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/context-engine.js
CHANGED
|
@@ -812,7 +812,7 @@ function logPredictiveCompactionOutcome(params) {
|
|
|
812
812
|
params.logger.info?.(message);
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
|
-
params.logger.
|
|
815
|
+
params.logger.info?.(message);
|
|
816
816
|
}
|
|
817
817
|
/**
|
|
818
818
|
* Truncates content to fit within token budget, preserving the tail.
|
|
@@ -869,7 +869,7 @@ function boundAfterTurnMessagesForIngest(messages, logger, sessionId) {
|
|
|
869
869
|
}
|
|
870
870
|
const bounded = trimMessagesToBudget(messages, AFTER_TURN_INGEST_MAX_TOKENS)
|
|
871
871
|
.map((message) => normalizeKernelMessage(message));
|
|
872
|
-
logger.
|
|
872
|
+
logger.info?.(`LibraVDB afterTurn trimmed oversized ingest payload sessionId=${sessionId} ` +
|
|
873
873
|
`estimatedTokens=${estimatedTokens} maxTokens=${AFTER_TURN_INGEST_MAX_TOKENS} ` +
|
|
874
874
|
`forwardedMessages=${bounded.length}`);
|
|
875
875
|
return bounded;
|
|
@@ -1367,7 +1367,7 @@ function ensureReplaySafeUserTurn(assembled, sourceMessages, logger, tokenBudget
|
|
|
1367
1367
|
const fallbackUser = findLastReplaySafeUserMessage(sourceMessages);
|
|
1368
1368
|
if (!fallbackUser)
|
|
1369
1369
|
return assembled;
|
|
1370
|
-
logger?.
|
|
1370
|
+
logger?.info?.("LibraVDB assemble produced no replay-safe user turn; reinjecting the latest user message for provider compatibility.");
|
|
1371
1371
|
const baseEstimatedTokens = Math.max(0, assembled.estimatedTokens, approximateMessagesTokens(assembled.messages));
|
|
1372
1372
|
if (typeof tokenBudget === "number" && Number.isFinite(tokenBudget) && tokenBudget > 0) {
|
|
1373
1373
|
const effectiveBudget = resolveEffectiveAssembleBudget(tokenBudget);
|
|
@@ -2192,7 +2192,7 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
2192
2192
|
reason: compactionResult.reason,
|
|
2193
2193
|
});
|
|
2194
2194
|
if (!compactionResult.ok) {
|
|
2195
|
-
logger.
|
|
2195
|
+
logger.info?.(`LibraVDB predictive compaction blocked assemble path at ${currentContextTokens} tokens ` +
|
|
2196
2196
|
`(threshold=${dynamicCompactThreshold}): ${compactionResult.reason ?? "compaction failed"}`);
|
|
2197
2197
|
return ensureReplaySafeUserTurn(sanitizeProviderReplayMessages(buildBudgetFallbackContext(args.messages, args.tokenBudget), args.messages), args.messages, logger, args.tokenBudget);
|
|
2198
2198
|
}
|
package/dist/index.js
CHANGED
|
@@ -36160,7 +36160,7 @@ function logPredictiveCompactionOutcome(params) {
|
|
|
36160
36160
|
params.logger.info?.(message);
|
|
36161
36161
|
return;
|
|
36162
36162
|
}
|
|
36163
|
-
params.logger.
|
|
36163
|
+
params.logger.info?.(message);
|
|
36164
36164
|
}
|
|
36165
36165
|
function truncateContentToTokenBudget(content, tokenBudget) {
|
|
36166
36166
|
if (tokenBudget <= 0) return "";
|
|
@@ -36204,7 +36204,7 @@ function boundAfterTurnMessagesForIngest(messages, logger, sessionId) {
|
|
|
36204
36204
|
return messages;
|
|
36205
36205
|
}
|
|
36206
36206
|
const bounded = trimMessagesToBudget(messages, AFTER_TURN_INGEST_MAX_TOKENS).map((message) => normalizeKernelMessage(message));
|
|
36207
|
-
logger.
|
|
36207
|
+
logger.info?.(
|
|
36208
36208
|
`LibraVDB afterTurn trimmed oversized ingest payload sessionId=${sessionId} estimatedTokens=${estimatedTokens} maxTokens=${AFTER_TURN_INGEST_MAX_TOKENS} forwardedMessages=${bounded.length}`
|
|
36209
36209
|
);
|
|
36210
36210
|
return bounded;
|
|
@@ -36611,7 +36611,7 @@ function ensureReplaySafeUserTurn(assembled, sourceMessages, logger, tokenBudget
|
|
|
36611
36611
|
if (hasReplaySafeUserTurn(assembled.messages)) return assembled;
|
|
36612
36612
|
const fallbackUser = findLastReplaySafeUserMessage(sourceMessages);
|
|
36613
36613
|
if (!fallbackUser) return assembled;
|
|
36614
|
-
logger?.
|
|
36614
|
+
logger?.info?.(
|
|
36615
36615
|
"LibraVDB assemble produced no replay-safe user turn; reinjecting the latest user message for provider compatibility."
|
|
36616
36616
|
);
|
|
36617
36617
|
const baseEstimatedTokens = Math.max(
|
|
@@ -37371,7 +37371,7 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
37371
37371
|
reason: compactionResult.reason
|
|
37372
37372
|
});
|
|
37373
37373
|
if (!compactionResult.ok) {
|
|
37374
|
-
logger.
|
|
37374
|
+
logger.info?.(
|
|
37375
37375
|
`LibraVDB predictive compaction blocked assemble path at ${currentContextTokens} tokens (threshold=${dynamicCompactThreshold}): ${compactionResult.reason ?? "compaction failed"}`
|
|
37376
37376
|
);
|
|
37377
37377
|
return ensureReplaySafeUserTurn(
|
|
@@ -49045,6 +49045,26 @@ function enrichStartupError(error2, healthMessage) {
|
|
|
49045
49045
|
return new Error(`${prefix}. ${daemonProvisioningHint()}`);
|
|
49046
49046
|
}
|
|
49047
49047
|
|
|
49048
|
+
// src/types.ts
|
|
49049
|
+
var LOG_LEVEL_RANK = {
|
|
49050
|
+
error: 0,
|
|
49051
|
+
warn: 1,
|
|
49052
|
+
info: 2,
|
|
49053
|
+
debug: 3
|
|
49054
|
+
};
|
|
49055
|
+
function levelFilteredLogger(base, logLevel) {
|
|
49056
|
+
const minRank = LOG_LEVEL_RANK[logLevel ?? "warn"];
|
|
49057
|
+
return {
|
|
49058
|
+
error: (msg) => base.error(msg),
|
|
49059
|
+
warn: (msg) => {
|
|
49060
|
+
if (LOG_LEVEL_RANK.warn <= minRank) base.warn?.(msg);
|
|
49061
|
+
},
|
|
49062
|
+
info: (msg) => {
|
|
49063
|
+
if (LOG_LEVEL_RANK.info <= minRank) base.info?.(msg);
|
|
49064
|
+
}
|
|
49065
|
+
};
|
|
49066
|
+
}
|
|
49067
|
+
|
|
49048
49068
|
// src/index.ts
|
|
49049
49069
|
var MEMORY_ID = "libravdb-memory";
|
|
49050
49070
|
var LIGHTWEIGHT_MODES = /* @__PURE__ */ new Set(["cli-metadata", "setup-only"]);
|
|
@@ -49054,7 +49074,8 @@ function shouldShutdownRuntimeForLifecycleCleanup(reason) {
|
|
|
49054
49074
|
}
|
|
49055
49075
|
function register(api) {
|
|
49056
49076
|
const registrationMode = api.registrationMode;
|
|
49057
|
-
const
|
|
49077
|
+
const baseLogger = api.logger ?? console;
|
|
49078
|
+
const logger = levelFilteredLogger(baseLogger, api.pluginConfig?.logLevel);
|
|
49058
49079
|
if (registrationMode === "cli-metadata") {
|
|
49059
49080
|
registerMemoryCliMetadata(api);
|
|
49060
49081
|
return;
|
|
@@ -49161,7 +49182,7 @@ function register(api) {
|
|
|
49161
49182
|
}
|
|
49162
49183
|
api.registerContextEngine(
|
|
49163
49184
|
MEMORY_ID,
|
|
49164
|
-
() => buildContextEngineFactory(runtime, cfg,
|
|
49185
|
+
() => buildContextEngineFactory(runtime, cfg, logger)
|
|
49165
49186
|
);
|
|
49166
49187
|
api.registerCompactionProvider?.({
|
|
49167
49188
|
id: MEMORY_ID,
|
|
@@ -49175,15 +49196,15 @@ function register(api) {
|
|
|
49175
49196
|
return result.summaryText;
|
|
49176
49197
|
}
|
|
49177
49198
|
});
|
|
49178
|
-
const markdownIngestion = createMarkdownIngestionHandle(cfg, runtime.getClient,
|
|
49179
|
-
const dreamPromotion = createDreamPromotionHandle(cfg, runtime.getClient,
|
|
49199
|
+
const markdownIngestion = createMarkdownIngestionHandle(cfg, runtime.getClient, logger);
|
|
49200
|
+
const dreamPromotion = createDreamPromotionHandle(cfg, runtime.getClient, logger);
|
|
49180
49201
|
api.registerService?.({
|
|
49181
49202
|
id: "libravdb-markdown-ingestion",
|
|
49182
49203
|
async start() {
|
|
49183
49204
|
try {
|
|
49184
49205
|
await markdownIngestion.start();
|
|
49185
49206
|
} catch (error2) {
|
|
49186
|
-
|
|
49207
|
+
logger.warn?.(`LibraVDB markdown ingestion failed to start: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
49187
49208
|
}
|
|
49188
49209
|
},
|
|
49189
49210
|
async stop() {
|
|
@@ -49196,7 +49217,7 @@ function register(api) {
|
|
|
49196
49217
|
try {
|
|
49197
49218
|
await dreamPromotion.start();
|
|
49198
49219
|
} catch (error2) {
|
|
49199
|
-
|
|
49220
|
+
logger.warn?.(`LibraVDB dream promotion failed to start: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
49200
49221
|
}
|
|
49201
49222
|
},
|
|
49202
49223
|
async stop() {
|
|
@@ -49226,8 +49247,8 @@ function register(api) {
|
|
|
49226
49247
|
const sessionId = ctx?.sessionId;
|
|
49227
49248
|
if (sessionId) clearSessionTrigger(sessionId);
|
|
49228
49249
|
});
|
|
49229
|
-
api.on("before_reset", createBeforeResetHook(runtime,
|
|
49230
|
-
api.on("session_end", createSessionEndHook(runtime,
|
|
49250
|
+
api.on("before_reset", createBeforeResetHook(runtime, logger));
|
|
49251
|
+
api.on("session_end", createSessionEndHook(runtime, logger));
|
|
49231
49252
|
api.on("gateway_stop", async () => {
|
|
49232
49253
|
await runtime.shutdown();
|
|
49233
49254
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -186,3 +186,5 @@ export interface PredictedContext {
|
|
|
186
186
|
text: string;
|
|
187
187
|
reason: string;
|
|
188
188
|
}
|
|
189
|
+
/** Wraps a LoggerLike with logLevel filtering. Levels below configured min are dropped. */
|
|
190
|
+
export declare function levelFilteredLogger(base: LoggerLike, logLevel: PluginConfig["logLevel"]): LoggerLike;
|
package/dist/types.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
const LOG_LEVEL_RANK = {
|
|
2
|
+
error: 0,
|
|
3
|
+
warn: 1,
|
|
4
|
+
info: 2,
|
|
5
|
+
debug: 3,
|
|
6
|
+
};
|
|
7
|
+
/** Wraps a LoggerLike with logLevel filtering. Levels below configured min are dropped. */
|
|
8
|
+
export function levelFilteredLogger(base, logLevel) {
|
|
9
|
+
const minRank = LOG_LEVEL_RANK[logLevel ?? "warn"];
|
|
10
|
+
return {
|
|
11
|
+
error: (msg) => base.error(msg),
|
|
12
|
+
warn: (msg) => { if (LOG_LEVEL_RANK.warn <= minRank)
|
|
13
|
+
base.warn?.(msg); },
|
|
14
|
+
info: (msg) => { if (LOG_LEVEL_RANK.info <= minRank)
|
|
15
|
+
base.info?.(msg); },
|
|
16
|
+
};
|
|
17
|
+
}
|
package/openclaw.plugin.json
CHANGED