@xdarkicex/openclaw-memory-libravdb 1.4.73 → 1.4.75
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 +17 -2
- package/dist/index.js +25 -3
- package/dist/memory-runtime.js +9 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,8 @@ export function registerMemoryCli(api, runtime, cfg, logger = console) {
|
|
|
35
35
|
.option("--agent <id>", "Agent id")
|
|
36
36
|
.option("--json", "Print JSON")
|
|
37
37
|
.option("--deep", "Probe authored collection search health")
|
|
38
|
-
.option("--index", "
|
|
38
|
+
.option("--index", "Rebuild the index before printing status")
|
|
39
|
+
.option("--force", "Required with --index: confirm index rebuild")
|
|
39
40
|
.option("--fix", "Accepted for OpenClaw memory CLI compatibility")
|
|
40
41
|
.option("--verbose", "Verbose logging")
|
|
41
42
|
.action(async (opts) => {
|
|
@@ -143,6 +144,17 @@ async function runCliCommand(runtime, logger, action) {
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
async function runStatus(runtime, cfg, logger, opts = {}) {
|
|
147
|
+
if (opts.index) {
|
|
148
|
+
if (!opts.force) {
|
|
149
|
+
logger.error("LibraVDB status --index performs an index rebuild. Re-run with --force to continue.");
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const ok = await runIndex(runtime, cfg, { ...opts, verbose: false }, logger, { quiet: true });
|
|
154
|
+
if (!ok) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
146
158
|
try {
|
|
147
159
|
const rpc = await runtime.getRpc();
|
|
148
160
|
const status = await rpc.call("status", {});
|
|
@@ -260,7 +272,7 @@ async function runIndex(runtime, cfg, opts, logger, params = {}) {
|
|
|
260
272
|
if (!opts?.force) {
|
|
261
273
|
logger.error("LibraVDB index rebuild requires --force. This re-embeds all stored documents with the current model and may be slow.");
|
|
262
274
|
process.exitCode = 1;
|
|
263
|
-
return;
|
|
275
|
+
return false;
|
|
264
276
|
}
|
|
265
277
|
const namespace = resolveCliNamespace(opts);
|
|
266
278
|
const collections = opts?.collections
|
|
@@ -288,11 +300,14 @@ async function runIndex(runtime, cfg, opts, logger, params = {}) {
|
|
|
288
300
|
if ((result.errors?.length ?? 0) > 0 && (result.recordsReindexed ?? 0) === 0) {
|
|
289
301
|
logger.error("LibraVDB index rebuild completed with errors and no records reindexed.");
|
|
290
302
|
process.exitCode = 1;
|
|
303
|
+
return false;
|
|
291
304
|
}
|
|
305
|
+
return true;
|
|
292
306
|
}
|
|
293
307
|
catch (error) {
|
|
294
308
|
logger.error(`LibraVDB index rebuild failed: ${formatError(error)}`);
|
|
295
309
|
process.exitCode = 1;
|
|
310
|
+
return false;
|
|
296
311
|
}
|
|
297
312
|
}
|
|
298
313
|
function resolveIndexRebuildTimeoutMs(cfg) {
|
package/dist/index.js
CHANGED
|
@@ -32976,6 +32976,7 @@ function buildMemoryRuntimeBridge(getRpc, cfg) {
|
|
|
32976
32976
|
function createMemorySearchManager(getRpc, cfg, defaults, initialStatus) {
|
|
32977
32977
|
let cachedStatus = initialStatus;
|
|
32978
32978
|
let cachedIdentityUserId = null;
|
|
32979
|
+
const returnedSearchPaths = /* @__PURE__ */ new Set();
|
|
32979
32980
|
function getResolvedUserId(sessionKey) {
|
|
32980
32981
|
if (cachedIdentityUserId !== null) return cachedIdentityUserId;
|
|
32981
32982
|
cachedIdentityUserId = resolveIdentity({
|
|
@@ -33028,9 +33029,16 @@ function createMemorySearchManager(getRpc, cfg, defaults, initialStatus) {
|
|
|
33028
33029
|
if (legacyCall) {
|
|
33029
33030
|
return { results: legacyResults };
|
|
33030
33031
|
}
|
|
33031
|
-
|
|
33032
|
+
const memoryResults = filteredResults.map(toMemorySearchResult);
|
|
33033
|
+
for (const item of memoryResults) {
|
|
33034
|
+
returnedSearchPaths.add(item.path);
|
|
33035
|
+
}
|
|
33036
|
+
return memoryResults;
|
|
33032
33037
|
},
|
|
33033
33038
|
async readFile(params) {
|
|
33039
|
+
if (!returnedSearchPaths.has(params.relPath)) {
|
|
33040
|
+
throw new Error("LibraVDB memory path was not returned by this search manager");
|
|
33041
|
+
}
|
|
33034
33042
|
const located = await loadSearchResultText(getRpc, params.relPath);
|
|
33035
33043
|
const fromLine = Math.max(1, params.from ?? 1);
|
|
33036
33044
|
const lineCount = Math.max(1, params.lines ?? 200);
|
|
@@ -33217,7 +33225,7 @@ function registerMemoryCli(api, runtime, cfg, logger = console) {
|
|
|
33217
33225
|
ensureCommand(root, "dream-promote").description("Promote vetted dream diary entries into the dedicated dream collection");
|
|
33218
33226
|
return;
|
|
33219
33227
|
}
|
|
33220
|
-
ensureCommand(root, "status").description("Show sidecar health, record counts, and active thresholds").option("--agent <id>", "Agent id").option("--json", "Print JSON").option("--deep", "Probe authored collection search health").option("--index", "
|
|
33228
|
+
ensureCommand(root, "status").description("Show sidecar health, record counts, and active thresholds").option("--agent <id>", "Agent id").option("--json", "Print JSON").option("--deep", "Probe authored collection search health").option("--index", "Rebuild the index before printing status").option("--force", "Required with --index: confirm index rebuild").option("--fix", "Accepted for OpenClaw memory CLI compatibility").option("--verbose", "Verbose logging").action(async (opts) => {
|
|
33221
33229
|
await runCliCommand(runtime, logger, async () => {
|
|
33222
33230
|
await runStatus(runtime, cfg, logger, normalizeOptionBag(opts));
|
|
33223
33231
|
});
|
|
@@ -33307,6 +33315,17 @@ async function runCliCommand(runtime, logger, action) {
|
|
|
33307
33315
|
}
|
|
33308
33316
|
}
|
|
33309
33317
|
async function runStatus(runtime, cfg, logger, opts = {}) {
|
|
33318
|
+
if (opts.index) {
|
|
33319
|
+
if (!opts.force) {
|
|
33320
|
+
logger.error("LibraVDB status --index performs an index rebuild. Re-run with --force to continue.");
|
|
33321
|
+
process.exitCode = 1;
|
|
33322
|
+
return;
|
|
33323
|
+
}
|
|
33324
|
+
const ok = await runIndex(runtime, cfg, { ...opts, verbose: false }, logger, { quiet: true });
|
|
33325
|
+
if (!ok) {
|
|
33326
|
+
return;
|
|
33327
|
+
}
|
|
33328
|
+
}
|
|
33310
33329
|
try {
|
|
33311
33330
|
const rpc = await runtime.getRpc();
|
|
33312
33331
|
const status = await rpc.call("status", {});
|
|
@@ -33422,7 +33441,7 @@ async function runIndex(runtime, cfg, opts, logger, params = {}) {
|
|
|
33422
33441
|
if (!opts?.force) {
|
|
33423
33442
|
logger.error("LibraVDB index rebuild requires --force. This re-embeds all stored documents with the current model and may be slow.");
|
|
33424
33443
|
process.exitCode = 1;
|
|
33425
|
-
return;
|
|
33444
|
+
return false;
|
|
33426
33445
|
}
|
|
33427
33446
|
const namespace = resolveCliNamespace(opts);
|
|
33428
33447
|
const collections = opts?.collections?.split(",").map((c) => c.trim()).filter((c) => c.length > 0);
|
|
@@ -33447,10 +33466,13 @@ async function runIndex(runtime, cfg, opts, logger, params = {}) {
|
|
|
33447
33466
|
if ((result.errors?.length ?? 0) > 0 && (result.recordsReindexed ?? 0) === 0) {
|
|
33448
33467
|
logger.error("LibraVDB index rebuild completed with errors and no records reindexed.");
|
|
33449
33468
|
process.exitCode = 1;
|
|
33469
|
+
return false;
|
|
33450
33470
|
}
|
|
33471
|
+
return true;
|
|
33451
33472
|
} catch (error) {
|
|
33452
33473
|
logger.error(`LibraVDB index rebuild failed: ${formatError(error)}`);
|
|
33453
33474
|
process.exitCode = 1;
|
|
33475
|
+
return false;
|
|
33454
33476
|
}
|
|
33455
33477
|
}
|
|
33456
33478
|
function resolveIndexRebuildTimeoutMs(cfg) {
|
package/dist/memory-runtime.js
CHANGED
|
@@ -22,6 +22,7 @@ export function buildMemoryRuntimeBridge(getRpc, cfg) {
|
|
|
22
22
|
function createMemorySearchManager(getRpc, cfg, defaults, initialStatus) {
|
|
23
23
|
let cachedStatus = initialStatus;
|
|
24
24
|
let cachedIdentityUserId = null;
|
|
25
|
+
const returnedSearchPaths = new Set();
|
|
25
26
|
function getResolvedUserId(sessionKey) {
|
|
26
27
|
if (cachedIdentityUserId !== null)
|
|
27
28
|
return cachedIdentityUserId;
|
|
@@ -82,9 +83,16 @@ function createMemorySearchManager(getRpc, cfg, defaults, initialStatus) {
|
|
|
82
83
|
if (legacyCall) {
|
|
83
84
|
return { results: legacyResults };
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
const memoryResults = filteredResults.map(toMemorySearchResult);
|
|
87
|
+
for (const item of memoryResults) {
|
|
88
|
+
returnedSearchPaths.add(item.path);
|
|
89
|
+
}
|
|
90
|
+
return memoryResults;
|
|
86
91
|
},
|
|
87
92
|
async readFile(params) {
|
|
93
|
+
if (!returnedSearchPaths.has(params.relPath)) {
|
|
94
|
+
throw new Error("LibraVDB memory path was not returned by this search manager");
|
|
95
|
+
}
|
|
88
96
|
const located = await loadSearchResultText(getRpc, params.relPath);
|
|
89
97
|
const fromLine = Math.max(1, params.from ?? 1);
|
|
90
98
|
const lineCount = Math.max(1, params.lines ?? 200);
|
package/openclaw.plugin.json
CHANGED