@xdarkicex/openclaw-memory-libravdb 1.4.45 → 1.4.46

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/cli.js CHANGED
@@ -3,6 +3,7 @@ import { stdin, stdout } from "node:process";
3
3
  import { MEMORY_CLI_DESCRIPTOR, isMemorySlotSelected } from "./cli-descriptors.js";
4
4
  import { resolveDurableNamespace } from "./memory-scopes.js";
5
5
  import { resolveIdentity } from "./identity.js";
6
+ import { formatError } from "./format-error.js";
6
7
  import { promoteDreamDiaryFile } from "./dream-promotion.js";
7
8
  import { buildMemoryRuntimeBridge } from "./memory-runtime.js";
8
9
  export function registerMemoryCli(api, runtime, cfg, logger = console) {
@@ -429,12 +430,6 @@ async function confirm(prompt) {
429
430
  rl.close();
430
431
  }
431
432
  }
432
- function formatError(error) {
433
- if (error instanceof Error && error.message.trim()) {
434
- return error.message;
435
- }
436
- return String(error);
437
- }
438
433
  function normalizeCliLimit(limit, optionName) {
439
434
  if (limit === undefined)
440
435
  return undefined;
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import fsp from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { getHashBackendName, hashBytes } from "./markdown-hash.js";
5
+ import { formatError } from "./format-error.js";
5
6
  const DEFAULT_DEBOUNCE_MS = 150;
6
7
  const DEFAULT_MIN_SCORE = 0.6;
7
8
  const DEFAULT_MIN_RECALL_COUNT = 2;
@@ -354,10 +355,4 @@ function createRealFsApi() {
354
355
  watch: (dir, onChange) => fs.watch(dir, onChange),
355
356
  };
356
357
  }
357
- function formatError(error) {
358
- if (error instanceof Error) {
359
- return error.message;
360
- }
361
- return String(error);
362
- }
363
358
  const textDecoder = new TextDecoder();
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Format an unknown thrown value as a human-readable string.
3
+ *
4
+ * If the value is an Error with a non-blank message, returns the trimmed
5
+ * message. Otherwise falls back to `String(error)`, which produces
6
+ * `"Error"` for `new Error("")` and preserves the original string for
7
+ * non-Error throws.
8
+ */
9
+ export declare function formatError(error: unknown): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Format an unknown thrown value as a human-readable string.
3
+ *
4
+ * If the value is an Error with a non-blank message, returns the trimmed
5
+ * message. Otherwise falls back to `String(error)`, which produces
6
+ * `"Error"` for `new Error("")` and preserves the original string for
7
+ * non-Error throws.
8
+ */
9
+ export function formatError(error) {
10
+ if (error instanceof Error && error.message.trim()) {
11
+ return error.message.trim();
12
+ }
13
+ return String(error);
14
+ }
package/dist/index.js CHANGED
@@ -32281,6 +32281,14 @@ function resolveIdentity(params) {
32281
32281
  return { userId: autoId, source: "auto" };
32282
32282
  }
32283
32283
 
32284
+ // src/format-error.ts
32285
+ function formatError(error) {
32286
+ if (error instanceof Error && error.message.trim()) {
32287
+ return error.message.trim();
32288
+ }
32289
+ return String(error);
32290
+ }
32291
+
32284
32292
  // src/dream-promotion.ts
32285
32293
  import fs from "node:fs";
32286
32294
  import fsp from "node:fs/promises";
@@ -32842,12 +32850,6 @@ function createRealFsApi() {
32842
32850
  watch: (dir, onChange) => fs.watch(dir, onChange)
32843
32851
  };
32844
32852
  }
32845
- function formatError(error) {
32846
- if (error instanceof Error) {
32847
- return error.message;
32848
- }
32849
- return String(error);
32850
- }
32851
32853
  var textDecoder = new TextDecoder();
32852
32854
 
32853
32855
  // src/dream-routing.ts
@@ -33237,7 +33239,7 @@ async function runCliCommand(runtime, logger, action) {
33237
33239
  try {
33238
33240
  await runtime.shutdown();
33239
33241
  } catch (error) {
33240
- logger.warn?.(`LibraVDB CLI shutdown failed: ${formatError2(error)}`);
33242
+ logger.warn?.(`LibraVDB CLI shutdown failed: ${formatError(error)}`);
33241
33243
  }
33242
33244
  }
33243
33245
  }
@@ -33268,14 +33270,14 @@ async function runStatus(runtime, cfg, logger, opts = {}) {
33268
33270
  process.exitCode = 1;
33269
33271
  }
33270
33272
  } catch (error) {
33271
- logger.error(`LibraVDB status unavailable: ${formatError2(error)}`);
33273
+ logger.error(`LibraVDB status unavailable: ${formatError(error)}`);
33272
33274
  if (opts.json) {
33273
33275
  console.log(
33274
33276
  JSON.stringify(
33275
33277
  {
33276
33278
  status: {
33277
33279
  ok: false,
33278
- message: formatError2(error),
33280
+ message: formatError(error),
33279
33281
  gatingThreshold: cfg.ingestionGateThreshold ?? 0.35
33280
33282
  }
33281
33283
  },
@@ -33294,7 +33296,7 @@ async function runStatus(runtime, cfg, logger, opts = {}) {
33294
33296
  "Gate threshold": cfg.ingestionGateThreshold ?? 0.35,
33295
33297
  "Abstractive model": "unknown",
33296
33298
  "Embedding profile": "unknown",
33297
- Message: formatError2(error)
33299
+ Message: formatError(error)
33298
33300
  });
33299
33301
  process.exitCode = 1;
33300
33302
  }
@@ -33325,7 +33327,7 @@ async function runDeepStatusProbe(rpc, cfg) {
33325
33327
  probes.push({
33326
33328
  ok: false,
33327
33329
  collection,
33328
- error: formatError2(error)
33330
+ error: formatError(error)
33329
33331
  });
33330
33332
  }
33331
33333
  }
@@ -33372,7 +33374,7 @@ async function runIndex(runtime, _cfg, opts, logger, params = {}) {
33372
33374
  process.exitCode = 1;
33373
33375
  }
33374
33376
  } catch (error) {
33375
- logger.error(`LibraVDB index rebuild failed: ${formatError2(error)}`);
33377
+ logger.error(`LibraVDB index rebuild failed: ${formatError(error)}`);
33376
33378
  process.exitCode = 1;
33377
33379
  }
33378
33380
  }
@@ -33389,7 +33391,7 @@ async function runSearch(runtime, cfg, queryArg, opts, logger) {
33389
33391
  maxResults = normalizeCliLimit(opts?.maxResults ?? opts?.limit, "--max-results");
33390
33392
  explicitMinScore = normalizeCliScore(opts?.minScore, "--min-score");
33391
33393
  } catch (validationError) {
33392
- logger.error(formatError2(validationError));
33394
+ logger.error(formatError(validationError));
33393
33395
  process.exitCode = 1;
33394
33396
  return;
33395
33397
  }
@@ -33420,7 +33422,7 @@ async function runSearch(runtime, cfg, queryArg, opts, logger) {
33420
33422
  console.log("");
33421
33423
  }
33422
33424
  } catch (error) {
33423
- logger.error(`LibraVDB search failed: ${formatError2(error)}`);
33425
+ logger.error(`LibraVDB search failed: ${formatError(error)}`);
33424
33426
  process.exitCode = 1;
33425
33427
  }
33426
33428
  }
@@ -33446,7 +33448,7 @@ async function runFlush(runtime, opts, logger) {
33446
33448
  await rpc.call("flush_namespace", { namespace });
33447
33449
  console.log(`Deleted durable memory namespace ${namespace}.`);
33448
33450
  } catch (error) {
33449
- logger.error(`LibraVDB flush failed: ${formatError2(error)}`);
33451
+ logger.error(`LibraVDB flush failed: ${formatError(error)}`);
33450
33452
  process.exitCode = 1;
33451
33453
  }
33452
33454
  }
@@ -33467,7 +33469,7 @@ async function runExport(runtime, opts, logger) {
33467
33469
  `);
33468
33470
  }
33469
33471
  } catch (error) {
33470
- logger.error(`LibraVDB export failed: ${formatError2(error)}`);
33472
+ logger.error(`LibraVDB export failed: ${formatError(error)}`);
33471
33473
  process.exitCode = 1;
33472
33474
  }
33473
33475
  }
@@ -33476,7 +33478,7 @@ async function runJournal(runtime, opts, logger) {
33476
33478
  try {
33477
33479
  limit = normalizeCliLimit(opts?.limit, "--limit");
33478
33480
  } catch (validationError) {
33479
- logger.error(formatError2(validationError));
33481
+ logger.error(formatError(validationError));
33480
33482
  process.exitCode = 1;
33481
33483
  return;
33482
33484
  }
@@ -33491,7 +33493,7 @@ async function runJournal(runtime, opts, logger) {
33491
33493
  `);
33492
33494
  }
33493
33495
  } catch (error) {
33494
- logger.error(`LibraVDB journal lookup failed: ${formatError2(error)}`);
33496
+ logger.error(`LibraVDB journal lookup failed: ${formatError(error)}`);
33495
33497
  process.exitCode = 1;
33496
33498
  }
33497
33499
  }
@@ -33510,7 +33512,7 @@ async function runDreamPromote(runtime, opts, logger) {
33510
33512
  `Promoted ${result.promoted ?? 0} dream entr${(result.promoted ?? 0) === 1 ? "y" : "ies"}; rejected ${result.rejected ?? 0}.`
33511
33513
  );
33512
33514
  } catch (error) {
33513
- logger.error(`LibraVDB dream promotion failed: ${formatError2(error)}`);
33515
+ logger.error(`LibraVDB dream promotion failed: ${formatError(error)}`);
33514
33516
  process.exitCode = 1;
33515
33517
  }
33516
33518
  }
@@ -33523,12 +33525,6 @@ async function confirm(prompt) {
33523
33525
  rl.close();
33524
33526
  }
33525
33527
  }
33526
- function formatError2(error) {
33527
- if (error instanceof Error && error.message.trim()) {
33528
- return error.message;
33529
- }
33530
- return String(error);
33531
- }
33532
33528
  function normalizeCliLimit(limit, optionName) {
33533
33529
  if (limit === void 0) return void 0;
33534
33530
  const parsed = parseStrictNumber(limit);
@@ -34378,7 +34374,7 @@ function createBeforeResetHook(runtime, logger = console) {
34378
34374
  messageCount: Array.isArray(typedEvent.messages) ? typedEvent.messages.length : void 0
34379
34375
  });
34380
34376
  } catch (error) {
34381
- logger.warn?.(`LibraVDB before_reset hint failed: ${formatError3(error)}`);
34377
+ logger.warn?.(`LibraVDB before_reset hint failed: ${formatError(error)}`);
34382
34378
  }
34383
34379
  };
34384
34380
  }
@@ -34402,7 +34398,7 @@ function createSessionEndHook(runtime, logger = console) {
34402
34398
  nextSessionKey: typedEvent.nextSessionKey
34403
34399
  });
34404
34400
  } catch (error) {
34405
- logger.warn?.(`LibraVDB session_end hint failed: ${formatError3(error)}`);
34401
+ logger.warn?.(`LibraVDB session_end hint failed: ${formatError(error)}`);
34406
34402
  }
34407
34403
  };
34408
34404
  }
@@ -34418,12 +34414,6 @@ function asSessionEndEvent(value) {
34418
34414
  function isRecord(value) {
34419
34415
  return typeof value === "object" && value !== null;
34420
34416
  }
34421
- function formatError3(error) {
34422
- if (error instanceof Error && error.message.trim()) {
34423
- return error.message;
34424
- }
34425
- return String(error);
34426
- }
34427
34417
 
34428
34418
  // src/markdown-ingest.ts
34429
34419
  import fs2 from "node:fs";
@@ -34639,7 +34629,7 @@ var DirectoryMarkdownSourceAdapter = class {
34639
34629
  rootState.scanState.timer = setTimeout(() => {
34640
34630
  rootState.scanState.timer = null;
34641
34631
  void this.scanRoot(rootState.root).catch((error) => {
34642
- this.logger.warn?.(`[markdown-ingest] root scan failed for ${rootState.root}: ${formatError4(error)}`);
34632
+ this.logger.warn?.(`[markdown-ingest] root scan failed for ${rootState.root}: ${formatError(error)}`);
34643
34633
  });
34644
34634
  }, this.debounceMs);
34645
34635
  }
@@ -34649,7 +34639,7 @@ var DirectoryMarkdownSourceAdapter = class {
34649
34639
  try {
34650
34640
  entries = await this.fsApi.readdir(dir);
34651
34641
  } catch (error) {
34652
- const message = formatError4(error);
34642
+ const message = formatError(error);
34653
34643
  if (!message.includes("ENOENT")) {
34654
34644
  this.logger.warn?.(`[markdown-ingest] readdir failed for ${dir}: ${message}`);
34655
34645
  }
@@ -34675,7 +34665,7 @@ var DirectoryMarkdownSourceAdapter = class {
34675
34665
  await this.syncMarkdownFile(rootState, child);
34676
34666
  } catch (error) {
34677
34667
  if (!this.stopping) {
34678
- this.logger.warn?.(`[markdown-ingest] sync failed for ${child}: ${formatError4(error)}`);
34668
+ this.logger.warn?.(`[markdown-ingest] sync failed for ${child}: ${formatError(error)}`);
34679
34669
  }
34680
34670
  }
34681
34671
  }
@@ -34691,11 +34681,11 @@ var DirectoryMarkdownSourceAdapter = class {
34691
34681
  }
34692
34682
  });
34693
34683
  watcher.on("error", (error) => {
34694
- this.logger.warn?.(`[markdown-ingest] watch error for ${dir}: ${formatError4(error)}`);
34684
+ this.logger.warn?.(`[markdown-ingest] watch error for ${dir}: ${formatError(error)}`);
34695
34685
  });
34696
34686
  rootState.directoryWatchers.set(dir, watcher);
34697
34687
  } catch (error) {
34698
- this.logger.warn?.(`[markdown-ingest] watch unavailable for ${dir}: ${formatError4(error)}`);
34688
+ this.logger.warn?.(`[markdown-ingest] watch unavailable for ${dir}: ${formatError(error)}`);
34699
34689
  }
34700
34690
  }
34701
34691
  shouldIncludeFile(root, filePath) {
@@ -34865,12 +34855,6 @@ function matchesGlob(value, pattern) {
34865
34855
  const escaped = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
34866
34856
  return new RegExp(`^${escaped}$`).test(value);
34867
34857
  }
34868
- function formatError4(error) {
34869
- if (error instanceof Error) {
34870
- return error.message;
34871
- }
34872
- return String(error);
34873
- }
34874
34858
  function looksLikeObsidianNote(filePath, text) {
34875
34859
  if (!text.startsWith("---\n")) {
34876
34860
  return hasInlineObsidianTag(text);
@@ -39552,7 +39536,7 @@ function createPluginRuntime(cfg, logger = console) {
39552
39536
  timeoutMs: cfg.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS
39553
39537
  });
39554
39538
  } catch (error) {
39555
- logger.warn?.(`LibraVDB: failed to initialize gRPC kernel client: ${formatError5(error)}`);
39539
+ logger.warn?.(`LibraVDB: failed to initialize gRPC kernel client: ${formatError(error)}`);
39556
39540
  }
39557
39541
  }
39558
39542
  return { rpc, sidecar, kernel };
@@ -39575,7 +39559,7 @@ function createPluginRuntime(cfg, logger = console) {
39575
39559
  const active = await ensureStarted();
39576
39560
  await active.rpc.call("session_lifecycle_hint", hint);
39577
39561
  } catch (error) {
39578
- logger.warn?.(`LibraVDB lifecycle hint dropped: ${formatError5(error)}`);
39562
+ logger.warn?.(`LibraVDB lifecycle hint dropped: ${formatError(error)}`);
39579
39563
  }
39580
39564
  },
39581
39565
  onShutdown(task) {
@@ -39593,7 +39577,7 @@ function createPluginRuntime(cfg, logger = console) {
39593
39577
  try {
39594
39578
  await task();
39595
39579
  } catch (error) {
39596
- logger.warn?.(`LibraVDB shutdown task failed: ${formatError5(error)}`);
39580
+ logger.warn?.(`LibraVDB shutdown task failed: ${formatError(error)}`);
39597
39581
  }
39598
39582
  }
39599
39583
  stopped = true;
@@ -39625,12 +39609,6 @@ function loadSecretFromEnv() {
39625
39609
  }
39626
39610
  return void 0;
39627
39611
  }
39628
- function formatError5(error) {
39629
- if (error instanceof Error && error.message.trim()) {
39630
- return error.message;
39631
- }
39632
- return String(error);
39633
- }
39634
39612
  function enrichStartupError(error, healthMessage) {
39635
39613
  const rawMessage = error instanceof Error ? error.message : String(error);
39636
39614
  const message = rawMessage.trim() || "LibraVDB daemon startup failed";
@@ -1,3 +1,4 @@
1
+ import { formatError } from "./format-error.js";
1
2
  export function createBeforeResetHook(runtime, logger = console) {
2
3
  return async (event, ctx) => {
3
4
  const typedEvent = asBeforeResetEvent(event);
@@ -56,9 +57,3 @@ function asSessionEndEvent(value) {
56
57
  function isRecord(value) {
57
58
  return typeof value === "object" && value !== null;
58
59
  }
59
- function formatError(error) {
60
- if (error instanceof Error && error.message.trim()) {
61
- return error.message;
62
- }
63
- return String(error);
64
- }
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import fsp from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { hashBytes } from "./markdown-hash.js";
5
+ import { formatError } from "./format-error.js";
5
6
  const DEFAULT_DEBOUNCE_MS = 150;
6
7
  const DEFAULT_TOKENIZER_ID = "markdown-ingest:v1";
7
8
  const MARKDOWN_INGEST_VERSION = 3;
@@ -429,12 +430,6 @@ function matchesGlob(value, pattern) {
429
430
  .join(".*");
430
431
  return new RegExp(`^${escaped}$`).test(value);
431
432
  }
432
- function formatError(error) {
433
- if (error instanceof Error) {
434
- return error.message;
435
- }
436
- return String(error);
437
- }
438
433
  function looksLikeObsidianNote(filePath, text) {
439
434
  if (!text.startsWith("---\n")) {
440
435
  return hasInlineObsidianTag(text);
@@ -1,6 +1,7 @@
1
1
  import { RpcClient } from "./rpc.js";
2
2
  import { GrpcKernelClient } from "./grpc-client.js";
3
3
  import { daemonProvisioningHint, startSidecar } from "./sidecar.js";
4
+ import { formatError } from "./format-error.js";
4
5
  import { readFileSync } from "node:fs";
5
6
  export const DEFAULT_RPC_TIMEOUT_MS = 30000;
6
7
  export const STARTUP_HEALTH_TIMEOUT_MS = 2000;
@@ -124,12 +125,6 @@ function loadSecretFromEnv() {
124
125
  }
125
126
  return undefined;
126
127
  }
127
- function formatError(error) {
128
- if (error instanceof Error && error.message.trim()) {
129
- return error.message;
130
- }
131
- return String(error);
132
- }
133
128
  export function enrichStartupError(error, healthMessage) {
134
129
  const rawMessage = error instanceof Error ? error.message : String(error);
135
130
  const message = rawMessage.trim() || "LibraVDB daemon startup failed";
@@ -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.4.45",
5
+ "version": "1.4.46",
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.4.45",
3
+ "version": "1.4.46",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",