@xdarkicex/openclaw-memory-libravdb 1.9.10-beta.14 → 1.9.10-beta.15

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.
@@ -1,4 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { homedir } from "node:os";
3
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { join } from "node:path";
2
5
  import { resolveIdentity } from "./identity.js";
3
6
  import { resolveUserCollection } from "./memory-scopes.js";
4
7
  import { manifestStore } from "./manifest.js";
@@ -1603,10 +1606,34 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
1603
1606
  };
1604
1607
  }
1605
1608
  const continuityCache = new Map(); // sessionKey -> raw context block
1609
+ const continuityCachePath = (() => {
1610
+ const stateDir = process.env.OPENCLAW_STATE_DIR?.trim();
1611
+ const dir = stateDir || join(homedir(), '.openclaw');
1612
+ return join(dir, 'libravdb-continuity-cache.json');
1613
+ })();
1614
+ // Load persisted cache on startup.
1615
+ try {
1616
+ if (existsSync(continuityCachePath)) {
1617
+ const raw = JSON.parse(readFileSync(continuityCachePath, 'utf8'));
1618
+ for (const [k, v] of Object.entries(raw)) {
1619
+ if (typeof v === 'string')
1620
+ continuityCache.set(k, v);
1621
+ }
1622
+ }
1623
+ }
1624
+ catch { /* best-effort */ }
1625
+ function persistContinuityCache() {
1626
+ try {
1627
+ mkdirSync(join(continuityCachePath, '..'), { recursive: true });
1628
+ writeFileSync(continuityCachePath, JSON.stringify(Object.fromEntries(continuityCache)));
1629
+ }
1630
+ catch { /* best-effort */ }
1631
+ }
1606
1632
  function updateContinuityCache(sessionKey, messages) {
1607
1633
  const lastTurns = messages.filter(m => m.role === 'user' || m.role === 'assistant').slice(-2);
1608
1634
  if (lastTurns.length > 0) {
1609
1635
  continuityCache.set(sessionKey, lastTurns.map(m => `${m.role}: ${m.content}`).join('\n'));
1636
+ persistContinuityCache();
1610
1637
  }
1611
1638
  }
1612
1639
  async function injectContinuityContext(params) {
package/dist/index.js CHANGED
@@ -35278,6 +35278,9 @@ function resolveCliMemoryOperationScope(opts) {
35278
35278
 
35279
35279
  // src/context-engine.ts
35280
35280
  import { randomUUID } from "node:crypto";
35281
+ import { homedir as homedir2 } from "node:os";
35282
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
35283
+ import { join as join3 } from "node:path";
35281
35284
 
35282
35285
  // src/manifest.ts
35283
35286
  import * as fs2 from "fs";
@@ -36837,10 +36840,32 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
36837
36840
  };
36838
36841
  }
36839
36842
  const continuityCache = /* @__PURE__ */ new Map();
36843
+ const continuityCachePath = (() => {
36844
+ const stateDir = process.env.OPENCLAW_STATE_DIR?.trim();
36845
+ const dir = stateDir || join3(homedir2(), ".openclaw");
36846
+ return join3(dir, "libravdb-continuity-cache.json");
36847
+ })();
36848
+ try {
36849
+ if (existsSync3(continuityCachePath)) {
36850
+ const raw = JSON.parse(readFileSync3(continuityCachePath, "utf8"));
36851
+ for (const [k, v] of Object.entries(raw)) {
36852
+ if (typeof v === "string") continuityCache.set(k, v);
36853
+ }
36854
+ }
36855
+ } catch {
36856
+ }
36857
+ function persistContinuityCache() {
36858
+ try {
36859
+ mkdirSync3(join3(continuityCachePath, ".."), { recursive: true });
36860
+ writeFileSync3(continuityCachePath, JSON.stringify(Object.fromEntries(continuityCache)));
36861
+ } catch {
36862
+ }
36863
+ }
36840
36864
  function updateContinuityCache(sessionKey, messages) {
36841
36865
  const lastTurns = messages.filter((m) => m.role === "user" || m.role === "assistant").slice(-2);
36842
36866
  if (lastTurns.length > 0) {
36843
36867
  continuityCache.set(sessionKey, lastTurns.map((m) => `${m.role}: ${m.content}`).join("\n"));
36868
+ persistContinuityCache();
36844
36869
  }
36845
36870
  }
36846
36871
  async function injectContinuityContext(params) {
@@ -48561,7 +48586,7 @@ function loadSecretFromEnv(logger) {
48561
48586
  }
48562
48587
 
48563
48588
  // src/plugin-runtime.ts
48564
- import { existsSync as existsSync3, statSync } from "node:fs";
48589
+ import { existsSync as existsSync4, statSync } from "node:fs";
48565
48590
  import path5 from "node:path";
48566
48591
  var DEFAULT_RPC_TIMEOUT_MS = 12e4;
48567
48592
  var ENV_RPC_TIMEOUT_MS = (() => {
@@ -48695,14 +48720,14 @@ function shouldValidateLocalEmbeddingPaths(cfg) {
48695
48720
  }
48696
48721
  function pathExistsAsFile(filePath) {
48697
48722
  try {
48698
- return existsSync3(filePath) && statSync(filePath).isFile();
48723
+ return existsSync4(filePath) && statSync(filePath).isFile();
48699
48724
  } catch {
48700
48725
  return false;
48701
48726
  }
48702
48727
  }
48703
48728
  function pathExistsAsDirectory(dirPath) {
48704
48729
  try {
48705
- return existsSync3(dirPath) && statSync(dirPath).isDirectory();
48730
+ return existsSync4(dirPath) && statSync(dirPath).isDirectory();
48706
48731
  } catch {
48707
48732
  return false;
48708
48733
  }
@@ -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.10-beta.14",
5
+ "version": "1.9.10-beta.15",
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.10-beta.14",
3
+ "version": "1.9.10-beta.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",