@xdarkicex/openclaw-memory-libravdb 1.4.75 → 1.4.76
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 +27 -10
- package/dist/index.js +27 -10
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
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
|
|
369
|
-
if (!
|
|
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 ${
|
|
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",
|
|
384
|
-
console.log(`Deleted durable memory 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
|
|
393
|
-
if (!
|
|
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
|
|
33534
|
-
if (!
|
|
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 ${
|
|
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",
|
|
33549
|
-
console.log(`Deleted durable memory 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
|
|
33557
|
-
if (!
|
|
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;
|
package/openclaw.plugin.json
CHANGED