@xdarkicex/openclaw-memory-libravdb 1.4.75 → 1.4.77

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
@@ -365,14 +365,14 @@ function resolveDefaultSearchMinScore(status, cfg) {
365
365
  return normalizeNumber(status?.gatingThreshold) ?? normalizeNumber(cfg.ingestionGateThreshold) ?? 0.35;
366
366
  }
367
367
  async function runFlush(runtime, opts, logger) {
368
- const namespace = resolveCliNamespace(opts);
369
- if (!namespace) {
368
+ const scope = resolveCliMemoryOperationScope(opts);
369
+ if (!scope) {
370
370
  logger.error("LibraVDB flush requires --user-id <userId> or --session-key <sessionKey>.");
371
371
  process.exitCode = 1;
372
372
  return;
373
373
  }
374
374
  if (!opts?.yes) {
375
- const confirmed = await confirm(`Delete durable memory namespace ${namespace}? [y/N] `);
375
+ const confirmed = await confirm(`Delete durable memory namespace ${scope.displayName}? [y/N] `);
376
376
  if (!confirmed) {
377
377
  console.log("Aborted.");
378
378
  return;
@@ -380,8 +380,8 @@ async function runFlush(runtime, opts, logger) {
380
380
  }
381
381
  try {
382
382
  const rpc = await runtime.getRpc();
383
- await rpc.call("flush_namespace", { namespace });
384
- console.log(`Deleted durable memory namespace ${namespace}.`);
383
+ await rpc.call("flush_namespace", scope.params);
384
+ console.log(`Deleted durable memory namespace ${scope.displayName}.`);
385
385
  }
386
386
  catch (error) {
387
387
  logger.error(`LibraVDB flush failed: ${formatError(error)}`);
@@ -389,17 +389,15 @@ async function runFlush(runtime, opts, logger) {
389
389
  }
390
390
  }
391
391
  async function runExport(runtime, opts, logger) {
392
- const namespace = resolveCliNamespace(opts);
393
- if (!namespace) {
392
+ const scope = resolveCliMemoryOperationScope(opts);
393
+ if (!scope) {
394
394
  logger.error("LibraVDB export requires a namespace. Provide --user-id or --session-key.");
395
395
  process.exitCode = 1;
396
396
  return;
397
397
  }
398
398
  try {
399
399
  const rpc = await runtime.getRpc();
400
- const result = await rpc.call("export_memory", {
401
- namespace,
402
- });
400
+ const result = await rpc.call("export_memory", scope.params);
403
401
  for (const record of result.records ?? []) {
404
402
  stdout.write(`${JSON.stringify(record)}\n`);
405
403
  }
@@ -520,3 +518,22 @@ function resolveCliNamespace(opts) {
520
518
  }
521
519
  return resolveDurableNamespace({ userId, sessionKey, agentId });
522
520
  }
521
+ function resolveCliMemoryOperationScope(opts) {
522
+ const userId = opts?.userId?.trim();
523
+ if (userId) {
524
+ return {
525
+ displayName: `user:${userId}`,
526
+ params: { userId },
527
+ };
528
+ }
529
+ const sessionKey = opts?.sessionKey?.trim();
530
+ const agentId = opts?.agent?.trim();
531
+ if (!sessionKey && !agentId) {
532
+ return undefined;
533
+ }
534
+ const namespace = resolveDurableNamespace({ sessionKey, agentId });
535
+ return {
536
+ displayName: namespace,
537
+ params: { namespace },
538
+ };
539
+ }
package/dist/index.js CHANGED
@@ -33530,14 +33530,14 @@ function resolveDefaultSearchMinScore(status, cfg) {
33530
33530
  return normalizeNumber2(status?.gatingThreshold) ?? normalizeNumber2(cfg.ingestionGateThreshold) ?? 0.35;
33531
33531
  }
33532
33532
  async function runFlush(runtime, opts, logger) {
33533
- const namespace = resolveCliNamespace(opts);
33534
- if (!namespace) {
33533
+ const scope = resolveCliMemoryOperationScope(opts);
33534
+ if (!scope) {
33535
33535
  logger.error("LibraVDB flush requires --user-id <userId> or --session-key <sessionKey>.");
33536
33536
  process.exitCode = 1;
33537
33537
  return;
33538
33538
  }
33539
33539
  if (!opts?.yes) {
33540
- const confirmed = await confirm(`Delete durable memory namespace ${namespace}? [y/N] `);
33540
+ const confirmed = await confirm(`Delete durable memory namespace ${scope.displayName}? [y/N] `);
33541
33541
  if (!confirmed) {
33542
33542
  console.log("Aborted.");
33543
33543
  return;
@@ -33545,25 +33545,23 @@ async function runFlush(runtime, opts, logger) {
33545
33545
  }
33546
33546
  try {
33547
33547
  const rpc = await runtime.getRpc();
33548
- await rpc.call("flush_namespace", { namespace });
33549
- console.log(`Deleted durable memory namespace ${namespace}.`);
33548
+ await rpc.call("flush_namespace", scope.params);
33549
+ console.log(`Deleted durable memory namespace ${scope.displayName}.`);
33550
33550
  } catch (error) {
33551
33551
  logger.error(`LibraVDB flush failed: ${formatError(error)}`);
33552
33552
  process.exitCode = 1;
33553
33553
  }
33554
33554
  }
33555
33555
  async function runExport(runtime, opts, logger) {
33556
- const namespace = resolveCliNamespace(opts);
33557
- if (!namespace) {
33556
+ const scope = resolveCliMemoryOperationScope(opts);
33557
+ if (!scope) {
33558
33558
  logger.error("LibraVDB export requires a namespace. Provide --user-id or --session-key.");
33559
33559
  process.exitCode = 1;
33560
33560
  return;
33561
33561
  }
33562
33562
  try {
33563
33563
  const rpc = await runtime.getRpc();
33564
- const result = await rpc.call("export_memory", {
33565
- namespace
33566
- });
33564
+ const result = await rpc.call("export_memory", scope.params);
33567
33565
  for (const record of result.records ?? []) {
33568
33566
  stdout.write(`${JSON.stringify(record)}
33569
33567
  `);
@@ -33681,6 +33679,25 @@ function resolveCliNamespace(opts) {
33681
33679
  }
33682
33680
  return resolveDurableNamespace({ userId, sessionKey, agentId });
33683
33681
  }
33682
+ function resolveCliMemoryOperationScope(opts) {
33683
+ const userId = opts?.userId?.trim();
33684
+ if (userId) {
33685
+ return {
33686
+ displayName: `user:${userId}`,
33687
+ params: { userId }
33688
+ };
33689
+ }
33690
+ const sessionKey = opts?.sessionKey?.trim();
33691
+ const agentId = opts?.agent?.trim();
33692
+ if (!sessionKey && !agentId) {
33693
+ return void 0;
33694
+ }
33695
+ const namespace = resolveDurableNamespace({ sessionKey, agentId });
33696
+ return {
33697
+ displayName: namespace,
33698
+ params: { namespace }
33699
+ };
33700
+ }
33684
33701
 
33685
33702
  // src/context-engine.ts
33686
33703
  var APPROX_CHARS_PER_TOKEN = 4;
@@ -39918,6 +39935,28 @@ function computeStartupConnectRetryDelay(attempt, waitedMs = 0) {
39918
39935
  function isTcpEndpoint(endpoint) {
39919
39936
  return endpoint.startsWith("tcp:");
39920
39937
  }
39938
+ function parseTcpEndpoint(endpoint) {
39939
+ if (!isTcpEndpoint(endpoint)) {
39940
+ return null;
39941
+ }
39942
+ const address = endpoint.slice("tcp:".length).trim();
39943
+ const separator = address.lastIndexOf(":");
39944
+ if (separator <= 0 || separator === address.length - 1) {
39945
+ return null;
39946
+ }
39947
+ let host = address.slice(0, separator).trim();
39948
+ const port = Number(address.slice(separator + 1).trim());
39949
+ if (host.startsWith("[") || host.endsWith("]")) {
39950
+ if (!host.startsWith("[") || !host.endsWith("]")) {
39951
+ return null;
39952
+ }
39953
+ host = host.slice(1, -1).trim();
39954
+ }
39955
+ if (host.length === 0 || !Number.isInteger(port) || port <= 0 || port > 65535) {
39956
+ return null;
39957
+ }
39958
+ return { host, port };
39959
+ }
39921
39960
  function resolveEndpoint(cfg) {
39922
39961
  const endpoint = resolveConfiguredEndpoint(cfg);
39923
39962
  return endpoint.replace(/^unix:/, "");
@@ -39975,15 +40014,11 @@ function createDefaultRuntime() {
39975
40014
  },
39976
40015
  createSocket(endpoint) {
39977
40016
  if (isTcpEndpoint(endpoint)) {
39978
- const address = endpoint.slice("tcp:".length);
39979
- const separator = address.lastIndexOf(":");
39980
- if (separator <= 0) {
40017
+ const parsed = parseTcpEndpoint(endpoint);
40018
+ if (!parsed) {
39981
40019
  throw new Error(`Invalid TCP sidecar endpoint: ${endpoint}`);
39982
40020
  }
39983
- return net.connect({
39984
- host: address.slice(0, separator),
39985
- port: Number(address.slice(separator + 1))
39986
- });
40021
+ return net.connect(parsed);
39987
40022
  }
39988
40023
  return net.connect(endpoint);
39989
40024
  },
@@ -40022,17 +40057,7 @@ function isConfiguredEndpoint(value) {
40022
40057
  if (value.startsWith("unix:")) {
40023
40058
  return value.slice("unix:".length).trim().length > 0;
40024
40059
  }
40025
- if (!value.startsWith("tcp:")) {
40026
- return false;
40027
- }
40028
- const address = value.slice("tcp:".length);
40029
- const separator = address.lastIndexOf(":");
40030
- if (separator <= 0 || separator === address.length - 1) {
40031
- return false;
40032
- }
40033
- const host = address.slice(0, separator).trim();
40034
- const port = Number(address.slice(separator + 1));
40035
- return host.length > 0 && Number.isInteger(port) && port > 0 && port <= 65535;
40060
+ return parseTcpEndpoint(value) !== null;
40036
40061
  }
40037
40062
  function normalizeConfiguredEndpoint(value) {
40038
40063
  const trimmed = value?.trim();
package/dist/sidecar.d.ts CHANGED
@@ -27,6 +27,10 @@ export declare function startSidecar(cfg: PluginConfig, logger?: LoggerLike, run
27
27
  export declare function computeBackoffMs(retries: number): number;
28
28
  export declare function computeStartupConnectRetryDelay(attempt: number, waitedMs?: number): number;
29
29
  export declare function isTcpEndpoint(endpoint: string): boolean;
30
+ export declare function parseTcpEndpoint(endpoint: string): {
31
+ host: string;
32
+ port: number;
33
+ } | null;
30
34
  export declare function resolveEndpoint(cfg: PluginConfig): string;
31
35
  export declare function resolveConfiguredEndpoint(cfg: PluginConfig): string;
32
36
  export declare function daemonProvisioningHint(): string;
package/dist/sidecar.js CHANGED
@@ -342,6 +342,28 @@ export function computeStartupConnectRetryDelay(attempt, waitedMs = 0) {
342
342
  export function isTcpEndpoint(endpoint) {
343
343
  return endpoint.startsWith("tcp:");
344
344
  }
345
+ export function parseTcpEndpoint(endpoint) {
346
+ if (!isTcpEndpoint(endpoint)) {
347
+ return null;
348
+ }
349
+ const address = endpoint.slice("tcp:".length).trim();
350
+ const separator = address.lastIndexOf(":");
351
+ if (separator <= 0 || separator === address.length - 1) {
352
+ return null;
353
+ }
354
+ let host = address.slice(0, separator).trim();
355
+ const port = Number(address.slice(separator + 1).trim());
356
+ if (host.startsWith("[") || host.endsWith("]")) {
357
+ if (!host.startsWith("[") || !host.endsWith("]")) {
358
+ return null;
359
+ }
360
+ host = host.slice(1, -1).trim();
361
+ }
362
+ if (host.length === 0 || !Number.isInteger(port) || port <= 0 || port > 65535) {
363
+ return null;
364
+ }
365
+ return { host, port };
366
+ }
345
367
  export function resolveEndpoint(cfg) {
346
368
  const endpoint = resolveConfiguredEndpoint(cfg);
347
369
  return endpoint.replace(/^unix:/, "");
@@ -465,15 +487,11 @@ function createDefaultRuntime() {
465
487
  },
466
488
  createSocket(endpoint) {
467
489
  if (isTcpEndpoint(endpoint)) {
468
- const address = endpoint.slice("tcp:".length);
469
- const separator = address.lastIndexOf(":");
470
- if (separator <= 0) {
490
+ const parsed = parseTcpEndpoint(endpoint);
491
+ if (!parsed) {
471
492
  throw new Error(`Invalid TCP sidecar endpoint: ${endpoint}`);
472
493
  }
473
- return net.connect({
474
- host: address.slice(0, separator),
475
- port: Number(address.slice(separator + 1)),
476
- });
494
+ return net.connect(parsed);
477
495
  }
478
496
  return net.connect(endpoint);
479
497
  },
@@ -515,17 +533,7 @@ function isConfiguredEndpoint(value) {
515
533
  if (value.startsWith("unix:")) {
516
534
  return value.slice("unix:".length).trim().length > 0;
517
535
  }
518
- if (!value.startsWith("tcp:")) {
519
- return false;
520
- }
521
- const address = value.slice("tcp:".length);
522
- const separator = address.lastIndexOf(":");
523
- if (separator <= 0 || separator === address.length - 1) {
524
- return false;
525
- }
526
- const host = address.slice(0, separator).trim();
527
- const port = Number(address.slice(separator + 1));
528
- return host.length > 0 && Number.isInteger(port) && port > 0 && port <= 65535;
536
+ return parseTcpEndpoint(value) !== null;
529
537
  }
530
538
  function normalizeConfiguredEndpoint(value) {
531
539
  const trimmed = value?.trim();
@@ -547,15 +555,12 @@ export async function probeSidecarEndpoint(cfg) {
547
555
  try {
548
556
  await new Promise((resolve, reject) => {
549
557
  if (isTcpEndpoint(endpoint)) {
550
- const address = endpoint.slice("tcp:".length);
551
- const separator = address.lastIndexOf(":");
552
- if (separator <= 0) {
558
+ const parsed = parseTcpEndpoint(endpoint);
559
+ if (!parsed) {
553
560
  reject(new Error("invalid tcp endpoint"));
554
561
  return;
555
562
  }
556
- const host = address.slice(0, separator);
557
- const port = Number(address.slice(separator + 1));
558
- const socket = net.connect({ host, port }, () => {
563
+ const socket = net.connect(parsed, () => {
559
564
  socket.destroy();
560
565
  resolve();
561
566
  });
@@ -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.75",
5
+ "version": "1.4.77",
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.75",
3
+ "version": "1.4.77",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",