@xdarkicex/openclaw-memory-libravdb 1.9.1 → 1.9.3

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.
@@ -748,10 +748,6 @@ function resolveDynamicCompactThreshold(tokenBudget, compactThreshold, compactio
748
748
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=explicit tokenBudget=${tokenBudget} compactThreshold=${compactThreshold} → ${val}`);
749
749
  return val;
750
750
  }
751
- if (compactSessionTokenBudget === 0) {
752
- logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=disabled tokenBudget=${tokenBudget}`);
753
- return undefined;
754
- }
755
751
  const normalizedBudget = normalizeTokenBudget(tokenBudget);
756
752
  if (normalizedBudget == null) {
757
753
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=null_budget tokenBudget=${tokenBudget} → undefined`);
@@ -763,6 +759,12 @@ function resolveDynamicCompactThreshold(tokenBudget, compactThreshold, compactio
763
759
  // enough turns to compact) or absurdly high (Codex Runtime 1M tokens
764
760
  // would produce an unreachable 800k threshold).
765
761
  const withBounds = Math.max(2000, Math.min(16000, derived));
762
+ // User-configured compactSessionTokenBudget overrides the ceiling.
763
+ if (typeof compactSessionTokenBudget === "number" && compactSessionTokenBudget > 0) {
764
+ const capped = Math.min(withBounds, compactSessionTokenBudget);
765
+ logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=user_cap tokenBudget=${tokenBudget} normalizedBudget=${normalizedBudget} fraction=${fraction} derived=${derived} withBounds=${withBounds} cap=${compactSessionTokenBudget} → ${capped}`);
766
+ return capped;
767
+ }
766
768
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=clamped tokenBudget=${tokenBudget} normalizedBudget=${normalizedBudget} fraction=${fraction} derived=${derived} withBounds=${withBounds} → ${withBounds}`);
767
769
  return withBounds;
768
770
  }
@@ -772,13 +774,6 @@ function resolvePredictiveCompactionTarget(params) {
772
774
  if (currentTokenCount == null || threshold == null || currentTokenCount < threshold) {
773
775
  return undefined;
774
776
  }
775
- const sinceLastBudget = normalizeTokenBudget(params.compactSessionTokenBudget);
776
- const lastCompactedTokenCount = normalizeCurrentTokenCount(params.lastCompactedTokenCount);
777
- if (sinceLastBudget != null &&
778
- lastCompactedTokenCount != null &&
779
- currentTokenCount - lastCompactedTokenCount < sinceLastBudget) {
780
- return undefined;
781
- }
782
777
  const belowThresholdTarget = Math.max(1, threshold - 1);
783
778
  return belowThresholdTarget < currentTokenCount
784
779
  ? belowThresholdTarget
@@ -945,7 +940,30 @@ function canonicalizeCompactedSessionContextBlocks(text) {
945
940
  catch {
946
941
  return match;
947
942
  }
948
- return `<compacted_session_context${attrs}>\n${firstLine}\n</compacted_session_context>`;
943
+ // Keep JSON state line + first (latest, most complete) render ledger.
944
+ // Strip subsequent repeated render ledgers from older compaction cycles.
945
+ // Record boundary: second occurrence of any render-ledger heading.
946
+ // Use the same heading set as COMPACTED_SESSION_RENDER_LEDGER_RE.
947
+ const HEADING_RE = /(?:^|\n)(?:Artifacts:|Constraints:|Open Next Steps:|Extracted context anchors:)/g;
948
+ let headingMatch;
949
+ let headingCount = 0;
950
+ const seen = new Set();
951
+ let cutIdx = rest.length;
952
+ while ((headingMatch = HEADING_RE.exec(rest)) !== null) {
953
+ const heading = headingMatch[0].replace(/^\n/, "");
954
+ if (seen.has(heading)) {
955
+ // Repeat heading — second ledger starts here.
956
+ cutIdx = headingMatch.index;
957
+ break;
958
+ }
959
+ seen.add(heading);
960
+ headingCount++;
961
+ }
962
+ const keptRest = rest.slice(0, cutIdx).trim();
963
+ if (!keptRest) {
964
+ return `<compacted_session_context${attrs}>\n${firstLine}\n</compacted_session_context>`;
965
+ }
966
+ return `<compacted_session_context${attrs}>\n${firstLine}\n${keptRest}\n</compacted_session_context>`;
949
967
  });
950
968
  }
951
969
  function demoteDaemonAuthoredContextBlocks(text) {
@@ -1408,6 +1426,26 @@ export function normalizeAssembleResult(result, sourceMessages) {
1408
1426
  const systemPromptWasReduced = rawSystemPromptAddition.length > systemPromptAddition.length;
1409
1427
  const messages = [];
1410
1428
  const extractedMemoryItems = [];
1429
+ let lastProviderReplayKey;
1430
+ let lastSourceIndex;
1431
+ const pushProviderReplayMessage = (message, sourceIndex) => {
1432
+ const key = `${message.role}\0${message.content}`;
1433
+ if (key === lastProviderReplayKey) {
1434
+ if (lastSourceIndex !== undefined &&
1435
+ sourceIndex !== undefined &&
1436
+ lastSourceIndex >= 0 &&
1437
+ sourceIndex >= 0 &&
1438
+ lastSourceIndex !== sourceIndex) {
1439
+ // Fall through — push the message.
1440
+ }
1441
+ else {
1442
+ return;
1443
+ }
1444
+ }
1445
+ messages.push(message);
1446
+ lastProviderReplayKey = key;
1447
+ lastSourceIndex = sourceIndex;
1448
+ };
1411
1449
  const pushMemoryItem = (args) => {
1412
1450
  if (args.content.trim().length === 0)
1413
1451
  return;
@@ -1417,6 +1455,7 @@ export function normalizeAssembleResult(result, sourceMessages) {
1417
1455
  if (Array.isArray(result.messages)) {
1418
1456
  const lastUserIndex = sourceMessages ? findLastUserMessageIndex(sourceMessages) : -1;
1419
1457
  let liveSourceCursor = sourceMessages ? lastUserIndex + 1 : undefined;
1458
+ let providerReplaySourceCursor = sourceMessages ? 0 : undefined;
1420
1459
  for (const message of result.messages) {
1421
1460
  const content = normalizeKernelContent(message.content);
1422
1461
  const historicalToolSource = getHistoricalToolSource(message.role, message.content, content);
@@ -1429,6 +1468,10 @@ export function normalizeAssembleResult(result, sourceMessages) {
1429
1468
  }
1430
1469
  const liveToolProtocolSource = consumeLiveToolAtCursor(message, content, sourceMessages, liveSourceCursor, lastUserIndex >= 0 ? lastUserIndex : undefined);
1431
1470
  if (liveToolProtocolSource) {
1471
+ // Live tool protocol messages are cursor-guarded by
1472
+ // consumeLiveToolAtCursor — consecutive toolResults with the
1473
+ // same content but different toolCallId linkage must not be
1474
+ // collapsed. Push directly, bypassing provider-replay dedup.
1432
1475
  messages.push(preserveLiveToolProtocolMessage(liveToolProtocolSource.message));
1433
1476
  liveSourceCursor = liveToolProtocolSource.index + 1;
1434
1477
  }
@@ -1460,11 +1503,19 @@ export function normalizeAssembleResult(result, sourceMessages) {
1460
1503
  }
1461
1504
  continue;
1462
1505
  }
1463
- messages.push({
1506
+ const providerReplaySourceIndex = sourceMessages
1507
+ ? findMatchingSourceMessageIndex(message, content, sourceMessages, providerReplaySourceCursor)
1508
+ : undefined;
1509
+ pushProviderReplayMessage({
1464
1510
  role: message.role,
1465
1511
  content: sanitizedContent,
1466
1512
  ...(typeof message.id === "string" ? { id: message.id } : {}),
1467
- });
1513
+ }, providerReplaySourceIndex);
1514
+ if (providerReplaySourceCursor !== undefined &&
1515
+ providerReplaySourceIndex !== undefined &&
1516
+ providerReplaySourceIndex >= 0) {
1517
+ providerReplaySourceCursor = providerReplaySourceIndex + 1;
1518
+ }
1468
1519
  }
1469
1520
  else {
1470
1521
  // Daemon memory items may not be in sourceMessages — only advance
@@ -1596,8 +1647,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
1596
1647
  }
1597
1648
  const predictiveContextCache = new Map();
1598
1649
  const PREDICTIVE_CACHE_MAX_SIZE = 100;
1599
- const predictiveCompactionCursors = new Map();
1600
- const PREDICTIVE_COMPACTION_CURSOR_MAX_SIZE = 100;
1601
1650
  // BeforeTurnKernel state
1602
1651
  const turnCache = new TurnMemoryCache(100);
1603
1652
  const circuitBreakers = new Map();
@@ -1795,14 +1844,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
1795
1844
  return scored.slice(0, maxItems).map((s) => s.prediction);
1796
1845
  }
1797
1846
  const getDynamicCompactThreshold = (tokenBudget) => resolveDynamicCompactThreshold(tokenBudget, cfg.compactThreshold, cfg.compactionThresholdFraction, cfg.compactSessionTokenBudget);
1798
- const markPredictiveCompactionCursor = (sessionId, currentTokenCount) => {
1799
- if (predictiveCompactionCursors.size >= PREDICTIVE_COMPACTION_CURSOR_MAX_SIZE) {
1800
- const oldest = predictiveCompactionCursors.keys().next().value;
1801
- if (oldest !== undefined)
1802
- predictiveCompactionCursors.delete(oldest);
1803
- }
1804
- predictiveCompactionCursors.set(sessionId, currentTokenCount);
1805
- };
1806
1847
  const buildAssemblyConfig = (tokenBudget) => ({
1807
1848
  useSessionRecallProjection: cfg.useSessionRecallProjection,
1808
1849
  useSessionSummarySearchExperiment: cfg.useSessionSummarySearchExperiment,
@@ -2014,8 +2055,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2014
2055
  const predictiveTargetSize = resolvePredictiveCompactionTarget({
2015
2056
  currentTokenCount: currentContextTokens,
2016
2057
  threshold: dynamicCompactThreshold,
2017
- compactSessionTokenBudget: cfg.compactSessionTokenBudget,
2018
- lastCompactedTokenCount: predictiveCompactionCursors.get(args.sessionId),
2019
2058
  });
2020
2059
  if (currentContextTokens == null ||
2021
2060
  dynamicCompactThreshold == null ||
@@ -2038,9 +2077,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2038
2077
  force: true,
2039
2078
  currentTokenCount: currentContextTokens,
2040
2079
  });
2041
- if (compactionResult.compacted) {
2042
- markPredictiveCompactionCursor(args.sessionId, currentContextTokens);
2043
- }
2044
2080
  logPredictiveCompactionOutcome({
2045
2081
  logger,
2046
2082
  phase: "afterTurn",
@@ -2059,7 +2095,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2059
2095
  async bootstrap(args) {
2060
2096
  const sessionId = requireSessionId(args.sessionId, "bootstrap");
2061
2097
  predictiveContextCache.delete(sessionId);
2062
- predictiveCompactionCursors.delete(sessionId);
2063
2098
  postToolRecallCache.delete(sessionId);
2064
2099
  asyncIngestionQueues.delete(sessionId);
2065
2100
  const userId = resolveUserId({
@@ -2127,8 +2162,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2127
2162
  const predictiveTargetSize = resolvePredictiveCompactionTarget({
2128
2163
  currentTokenCount: currentContextTokens,
2129
2164
  threshold: dynamicCompactThreshold,
2130
- compactSessionTokenBudget: cfg.compactSessionTokenBudget,
2131
- lastCompactedTokenCount: predictiveCompactionCursors.get(sessionId),
2132
2165
  });
2133
2166
  if (dynamicCompactThreshold != null && predictiveTargetSize != null) {
2134
2167
  logPredictiveCompactionAttempt({
@@ -2147,9 +2180,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2147
2180
  force: true,
2148
2181
  currentTokenCount: currentContextTokens,
2149
2182
  });
2150
- if (compactionResult.compacted) {
2151
- markPredictiveCompactionCursor(sessionId, currentContextTokens);
2152
- }
2153
2183
  logPredictiveCompactionOutcome({
2154
2184
  logger,
2155
2185
  phase: "assemble",
@@ -2533,7 +2563,6 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
2533
2563
  }
2534
2564
  }
2535
2565
  predictiveContextCache.clear();
2536
- predictiveCompactionCursors.clear();
2537
2566
  postToolRecallCache.clear();
2538
2567
  asyncIngestionQueues.clear();
2539
2568
  triggerCache.clear();
package/dist/index.js CHANGED
@@ -36117,10 +36117,6 @@ function resolveDynamicCompactThreshold(tokenBudget, compactThreshold, compactio
36117
36117
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=explicit tokenBudget=${tokenBudget} compactThreshold=${compactThreshold} \u2192 ${val}`);
36118
36118
  return val;
36119
36119
  }
36120
- if (compactSessionTokenBudget === 0) {
36121
- logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=disabled tokenBudget=${tokenBudget}`);
36122
- return void 0;
36123
- }
36124
36120
  const normalizedBudget = normalizeTokenBudget(tokenBudget);
36125
36121
  if (normalizedBudget == null) {
36126
36122
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=null_budget tokenBudget=${tokenBudget} \u2192 undefined`);
@@ -36129,6 +36125,11 @@ function resolveDynamicCompactThreshold(tokenBudget, compactThreshold, compactio
36129
36125
  const fraction = normalizeThresholdFraction(compactionThresholdFraction);
36130
36126
  const derived = Math.max(1, Math.floor(normalizedBudget * fraction));
36131
36127
  const withBounds = Math.max(2e3, Math.min(16e3, derived));
36128
+ if (typeof compactSessionTokenBudget === "number" && compactSessionTokenBudget > 0) {
36129
+ const capped = Math.min(withBounds, compactSessionTokenBudget);
36130
+ logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=user_cap tokenBudget=${tokenBudget} normalizedBudget=${normalizedBudget} fraction=${fraction} derived=${derived} withBounds=${withBounds} cap=${compactSessionTokenBudget} \u2192 ${capped}`);
36131
+ return capped;
36132
+ }
36132
36133
  logger?.info?.(`[compact:trace] resolveDynamicCompactThreshold branch=clamped tokenBudget=${tokenBudget} normalizedBudget=${normalizedBudget} fraction=${fraction} derived=${derived} withBounds=${withBounds} \u2192 ${withBounds}`);
36133
36134
  return withBounds;
36134
36135
  }
@@ -36138,11 +36139,6 @@ function resolvePredictiveCompactionTarget(params) {
36138
36139
  if (currentTokenCount == null || threshold == null || currentTokenCount < threshold) {
36139
36140
  return void 0;
36140
36141
  }
36141
- const sinceLastBudget = normalizeTokenBudget(params.compactSessionTokenBudget);
36142
- const lastCompactedTokenCount = normalizeCurrentTokenCount(params.lastCompactedTokenCount);
36143
- if (sinceLastBudget != null && lastCompactedTokenCount != null && currentTokenCount - lastCompactedTokenCount < sinceLastBudget) {
36144
- return void 0;
36145
- }
36146
36142
  const belowThresholdTarget = Math.max(1, threshold - 1);
36147
36143
  return belowThresholdTarget < currentTokenCount ? belowThresholdTarget : Math.max(1, currentTokenCount - 1);
36148
36144
  }
@@ -36280,8 +36276,29 @@ function canonicalizeCompactedSessionContextBlocks(text) {
36280
36276
  } catch {
36281
36277
  return match;
36282
36278
  }
36279
+ const HEADING_RE = /(?:^|\n)(?:Artifacts:|Constraints:|Open Next Steps:|Extracted context anchors:)/g;
36280
+ let headingMatch;
36281
+ let headingCount = 0;
36282
+ const seen = /* @__PURE__ */ new Set();
36283
+ let cutIdx = rest.length;
36284
+ while ((headingMatch = HEADING_RE.exec(rest)) !== null) {
36285
+ const heading = headingMatch[0].replace(/^\n/, "");
36286
+ if (seen.has(heading)) {
36287
+ cutIdx = headingMatch.index;
36288
+ break;
36289
+ }
36290
+ seen.add(heading);
36291
+ headingCount++;
36292
+ }
36293
+ const keptRest = rest.slice(0, cutIdx).trim();
36294
+ if (!keptRest) {
36295
+ return `<compacted_session_context${attrs}>
36296
+ ${firstLine}
36297
+ </compacted_session_context>`;
36298
+ }
36283
36299
  return `<compacted_session_context${attrs}>
36284
36300
  ${firstLine}
36301
+ ${keptRest}
36285
36302
  </compacted_session_context>`;
36286
36303
  });
36287
36304
  }
@@ -36656,6 +36673,20 @@ function normalizeAssembleResult(result, sourceMessages) {
36656
36673
  const systemPromptWasReduced = rawSystemPromptAddition.length > systemPromptAddition.length;
36657
36674
  const messages = [];
36658
36675
  const extractedMemoryItems = [];
36676
+ let lastProviderReplayKey;
36677
+ let lastSourceIndex;
36678
+ const pushProviderReplayMessage = (message, sourceIndex) => {
36679
+ const key = `${message.role}\0${message.content}`;
36680
+ if (key === lastProviderReplayKey) {
36681
+ if (lastSourceIndex !== void 0 && sourceIndex !== void 0 && lastSourceIndex >= 0 && sourceIndex >= 0 && lastSourceIndex !== sourceIndex) {
36682
+ } else {
36683
+ return;
36684
+ }
36685
+ }
36686
+ messages.push(message);
36687
+ lastProviderReplayKey = key;
36688
+ lastSourceIndex = sourceIndex;
36689
+ };
36659
36690
  const pushMemoryItem = (args) => {
36660
36691
  if (args.content.trim().length === 0) return;
36661
36692
  const roleAttr = args.role ? ` role="${escapeMemoryFactText(args.role)}"` : "";
@@ -36666,6 +36697,7 @@ function normalizeAssembleResult(result, sourceMessages) {
36666
36697
  if (Array.isArray(result.messages)) {
36667
36698
  const lastUserIndex = sourceMessages ? findLastUserMessageIndex(sourceMessages) : -1;
36668
36699
  let liveSourceCursor = sourceMessages ? lastUserIndex + 1 : void 0;
36700
+ let providerReplaySourceCursor = sourceMessages ? 0 : void 0;
36669
36701
  for (const message of result.messages) {
36670
36702
  const content = normalizeKernelContent(message.content);
36671
36703
  const historicalToolSource = getHistoricalToolSource(message.role, message.content, content);
@@ -36709,11 +36741,18 @@ function normalizeAssembleResult(result, sourceMessages) {
36709
36741
  }
36710
36742
  continue;
36711
36743
  }
36712
- messages.push({
36713
- role: message.role,
36714
- content: sanitizedContent,
36715
- ...typeof message.id === "string" ? { id: message.id } : {}
36716
- });
36744
+ const providerReplaySourceIndex = sourceMessages ? findMatchingSourceMessageIndex(message, content, sourceMessages, providerReplaySourceCursor) : void 0;
36745
+ pushProviderReplayMessage(
36746
+ {
36747
+ role: message.role,
36748
+ content: sanitizedContent,
36749
+ ...typeof message.id === "string" ? { id: message.id } : {}
36750
+ },
36751
+ providerReplaySourceIndex
36752
+ );
36753
+ if (providerReplaySourceCursor !== void 0 && providerReplaySourceIndex !== void 0 && providerReplaySourceIndex >= 0) {
36754
+ providerReplaySourceCursor = providerReplaySourceIndex + 1;
36755
+ }
36717
36756
  } else {
36718
36757
  if (liveSourceCursor !== void 0 && sourceMessages) {
36719
36758
  const idx = findMatchingSourceMessageIndex(message, content, sourceMessages, liveSourceCursor);
@@ -36817,8 +36856,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
36817
36856
  }
36818
36857
  const predictiveContextCache = /* @__PURE__ */ new Map();
36819
36858
  const PREDICTIVE_CACHE_MAX_SIZE = 100;
36820
- const predictiveCompactionCursors = /* @__PURE__ */ new Map();
36821
- const PREDICTIVE_COMPACTION_CURSOR_MAX_SIZE = 100;
36822
36859
  const turnCache = new TurnMemoryCache(100);
36823
36860
  const circuitBreakers = /* @__PURE__ */ new Map();
36824
36861
  const CIRCUIT_STATE_MAX_SIZE = 200;
@@ -37011,13 +37048,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37011
37048
  cfg.compactionThresholdFraction,
37012
37049
  cfg.compactSessionTokenBudget
37013
37050
  );
37014
- const markPredictiveCompactionCursor = (sessionId, currentTokenCount) => {
37015
- if (predictiveCompactionCursors.size >= PREDICTIVE_COMPACTION_CURSOR_MAX_SIZE) {
37016
- const oldest = predictiveCompactionCursors.keys().next().value;
37017
- if (oldest !== void 0) predictiveCompactionCursors.delete(oldest);
37018
- }
37019
- predictiveCompactionCursors.set(sessionId, currentTokenCount);
37020
- };
37021
37051
  const buildAssemblyConfig = (tokenBudget) => ({
37022
37052
  useSessionRecallProjection: cfg.useSessionRecallProjection,
37023
37053
  useSessionSummarySearchExperiment: cfg.useSessionSummarySearchExperiment,
@@ -37209,9 +37239,7 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37209
37239
  });
37210
37240
  const predictiveTargetSize = resolvePredictiveCompactionTarget({
37211
37241
  currentTokenCount: currentContextTokens,
37212
- threshold: dynamicCompactThreshold,
37213
- compactSessionTokenBudget: cfg.compactSessionTokenBudget,
37214
- lastCompactedTokenCount: predictiveCompactionCursors.get(args.sessionId)
37242
+ threshold: dynamicCompactThreshold
37215
37243
  });
37216
37244
  if (currentContextTokens == null || dynamicCompactThreshold == null || predictiveTargetSize == null) {
37217
37245
  return;
@@ -37232,9 +37260,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37232
37260
  force: true,
37233
37261
  currentTokenCount: currentContextTokens
37234
37262
  });
37235
- if (compactionResult.compacted) {
37236
- markPredictiveCompactionCursor(args.sessionId, currentContextTokens);
37237
- }
37238
37263
  logPredictiveCompactionOutcome({
37239
37264
  logger,
37240
37265
  phase: "afterTurn",
@@ -37253,7 +37278,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37253
37278
  async bootstrap(args) {
37254
37279
  const sessionId = requireSessionId(args.sessionId, "bootstrap");
37255
37280
  predictiveContextCache.delete(sessionId);
37256
- predictiveCompactionCursors.delete(sessionId);
37257
37281
  postToolRecallCache.delete(sessionId);
37258
37282
  asyncIngestionQueues.delete(sessionId);
37259
37283
  const userId = resolveUserId({
@@ -37316,9 +37340,7 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37316
37340
  const dynamicCompactThreshold = getDynamicCompactThreshold(args.tokenBudget);
37317
37341
  const predictiveTargetSize = resolvePredictiveCompactionTarget({
37318
37342
  currentTokenCount: currentContextTokens,
37319
- threshold: dynamicCompactThreshold,
37320
- compactSessionTokenBudget: cfg.compactSessionTokenBudget,
37321
- lastCompactedTokenCount: predictiveCompactionCursors.get(sessionId)
37343
+ threshold: dynamicCompactThreshold
37322
37344
  });
37323
37345
  if (dynamicCompactThreshold != null && predictiveTargetSize != null) {
37324
37346
  logPredictiveCompactionAttempt({
@@ -37337,9 +37359,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37337
37359
  force: true,
37338
37360
  currentTokenCount: currentContextTokens
37339
37361
  });
37340
- if (compactionResult.compacted) {
37341
- markPredictiveCompactionCursor(sessionId, currentContextTokens);
37342
- }
37343
37362
  logPredictiveCompactionOutcome({
37344
37363
  logger,
37345
37364
  phase: "assemble",
@@ -37720,7 +37739,6 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
37720
37739
  }
37721
37740
  }
37722
37741
  predictiveContextCache.clear();
37723
- predictiveCompactionCursors.clear();
37724
37742
  postToolRecallCache.clear();
37725
37743
  asyncIngestionQueues.clear();
37726
37744
  triggerCache.clear();
@@ -2,7 +2,7 @@
2
2
  "id": "libravdb-memory",
3
3
  "name": "LibraVDB Memory",
4
4
  "description": "Persistent vector memory with three-tier hybrid scoring",
5
- "version": "1.9.1",
5
+ "version": "1.9.3",
6
6
  "kind": [
7
7
  "memory",
8
8
  "context-engine"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xdarkicex/openclaw-memory-libravdb",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",