@xdarkicex/openclaw-memory-libravdb 1.4.62 → 1.4.63
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/context-engine.js +3 -2
- package/dist/dream-promotion.js +9 -5
- package/dist/index.js +39 -12
- package/dist/memory-runtime.js +10 -1
- package/dist/sidecar.js +16 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/context-engine.js
CHANGED
|
@@ -312,8 +312,9 @@ function isQuestionShapedRecallCandidate(text) {
|
|
|
312
312
|
/^\s*(?:who|what|when|where|why|how)\b/i.test(normalized));
|
|
313
313
|
}
|
|
314
314
|
function rankExactRecallCandidate(result, token) {
|
|
315
|
-
if (!result.text.includes(token))
|
|
315
|
+
if (typeof result.text !== "string" || !result.text.includes(token)) {
|
|
316
316
|
return Number.NEGATIVE_INFINITY;
|
|
317
|
+
}
|
|
317
318
|
let rank = result.score;
|
|
318
319
|
if (/\bmeans\b/i.test(result.text))
|
|
319
320
|
rank += 100;
|
|
@@ -476,7 +477,7 @@ export function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
476
477
|
excludeByCollection: {},
|
|
477
478
|
});
|
|
478
479
|
const hit = (result.results ?? [])
|
|
479
|
-
.filter((candidate) => isExactRecallFact(candidate.text, token))
|
|
480
|
+
.filter((candidate) => typeof candidate?.text === "string" && isExactRecallFact(candidate.text, token))
|
|
480
481
|
.sort((a, b) => rankExactRecallCandidate(b, token) - rankExactRecallCandidate(a, token))[0];
|
|
481
482
|
if (hit) {
|
|
482
483
|
injectedFacts.push(buildExactRecallFact(hit, token));
|
package/dist/dream-promotion.js
CHANGED
|
@@ -321,22 +321,26 @@ function parseTrailingMetadata(body) {
|
|
|
321
321
|
uniqueQueries,
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
+
const DECIMAL_NUMBER_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
325
|
+
const INTEGER_PATTERN = /^[+-]?\d+$/;
|
|
324
326
|
function parseNumber(value) {
|
|
325
|
-
|
|
327
|
+
const trimmed = value?.trim();
|
|
328
|
+
if (!trimmed || !DECIMAL_NUMBER_PATTERN.test(trimmed)) {
|
|
326
329
|
return null;
|
|
327
330
|
}
|
|
328
|
-
const parsed = Number
|
|
331
|
+
const parsed = Number(trimmed);
|
|
329
332
|
if (!Number.isFinite(parsed)) {
|
|
330
333
|
return null;
|
|
331
334
|
}
|
|
332
335
|
return parsed;
|
|
333
336
|
}
|
|
334
337
|
function parseInteger(value) {
|
|
335
|
-
|
|
338
|
+
const trimmed = value?.trim();
|
|
339
|
+
if (!trimmed || !INTEGER_PATTERN.test(trimmed)) {
|
|
336
340
|
return null;
|
|
337
341
|
}
|
|
338
|
-
const parsed = Number
|
|
339
|
-
if (!Number.
|
|
342
|
+
const parsed = Number(trimmed);
|
|
343
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
340
344
|
return null;
|
|
341
345
|
}
|
|
342
346
|
return parsed;
|
package/dist/index.js
CHANGED
|
@@ -32830,22 +32830,26 @@ function parseTrailingMetadata(body) {
|
|
|
32830
32830
|
uniqueQueries
|
|
32831
32831
|
};
|
|
32832
32832
|
}
|
|
32833
|
+
var DECIMAL_NUMBER_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
32834
|
+
var INTEGER_PATTERN = /^[+-]?\d+$/;
|
|
32833
32835
|
function parseNumber(value) {
|
|
32834
|
-
|
|
32836
|
+
const trimmed = value?.trim();
|
|
32837
|
+
if (!trimmed || !DECIMAL_NUMBER_PATTERN.test(trimmed)) {
|
|
32835
32838
|
return null;
|
|
32836
32839
|
}
|
|
32837
|
-
const parsed = Number
|
|
32840
|
+
const parsed = Number(trimmed);
|
|
32838
32841
|
if (!Number.isFinite(parsed)) {
|
|
32839
32842
|
return null;
|
|
32840
32843
|
}
|
|
32841
32844
|
return parsed;
|
|
32842
32845
|
}
|
|
32843
32846
|
function parseInteger(value) {
|
|
32844
|
-
|
|
32847
|
+
const trimmed = value?.trim();
|
|
32848
|
+
if (!trimmed || !INTEGER_PATTERN.test(trimmed)) {
|
|
32845
32849
|
return null;
|
|
32846
32850
|
}
|
|
32847
|
-
const parsed = Number
|
|
32848
|
-
if (!Number.
|
|
32851
|
+
const parsed = Number(trimmed);
|
|
32852
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
32849
32853
|
return null;
|
|
32850
32854
|
}
|
|
32851
32855
|
return parsed;
|
|
@@ -33087,7 +33091,16 @@ function resolveSessionSearchCollection(cfg, sessionId) {
|
|
|
33087
33091
|
return `session:${sessionId}`;
|
|
33088
33092
|
}
|
|
33089
33093
|
function firstString(...values) {
|
|
33090
|
-
|
|
33094
|
+
for (const value of values) {
|
|
33095
|
+
if (typeof value !== "string") {
|
|
33096
|
+
continue;
|
|
33097
|
+
}
|
|
33098
|
+
const trimmed = value.trim();
|
|
33099
|
+
if (trimmed.length > 0) {
|
|
33100
|
+
return trimmed;
|
|
33101
|
+
}
|
|
33102
|
+
}
|
|
33103
|
+
return void 0;
|
|
33091
33104
|
}
|
|
33092
33105
|
function toMemorySearchResult(item) {
|
|
33093
33106
|
const collection = typeof item.metadata.collection === "string" ? item.metadata.collection : "memory";
|
|
@@ -33940,7 +33953,9 @@ function isQuestionShapedRecallCandidate(text) {
|
|
|
33940
33953
|
return normalized.includes("?") || /\bwhat\s+does\b/i.test(normalized) || /^\s*(?:who|what|when|where|why|how)\b/i.test(normalized);
|
|
33941
33954
|
}
|
|
33942
33955
|
function rankExactRecallCandidate(result, token) {
|
|
33943
|
-
if (!result.text.includes(token))
|
|
33956
|
+
if (typeof result.text !== "string" || !result.text.includes(token)) {
|
|
33957
|
+
return Number.NEGATIVE_INFINITY;
|
|
33958
|
+
}
|
|
33944
33959
|
let rank = result.score;
|
|
33945
33960
|
if (/\bmeans\b/i.test(result.text)) rank += 100;
|
|
33946
33961
|
if (/\b(remember|durable|fact)\b/i.test(result.text)) rank += 10;
|
|
@@ -34087,7 +34102,7 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
|
|
|
34087
34102
|
k: Math.max(EXACT_RECALL_SEARCH_K, cfg.topK ?? 0),
|
|
34088
34103
|
excludeByCollection: {}
|
|
34089
34104
|
});
|
|
34090
|
-
const hit = (result.results ?? []).filter((candidate) => isExactRecallFact(candidate.text, token)).sort((a, b) => rankExactRecallCandidate(b, token) - rankExactRecallCandidate(a, token))[0];
|
|
34105
|
+
const hit = (result.results ?? []).filter((candidate) => typeof candidate?.text === "string" && isExactRecallFact(candidate.text, token)).sort((a, b) => rankExactRecallCandidate(b, token) - rankExactRecallCandidate(a, token))[0];
|
|
34091
34106
|
if (hit) {
|
|
34092
34107
|
injectedFacts.push(buildExactRecallFact(hit, token));
|
|
34093
34108
|
}
|
|
@@ -39661,19 +39676,20 @@ function resolveConfiguredEndpoint(cfg) {
|
|
|
39661
39676
|
if (!value || value === "auto") {
|
|
39662
39677
|
return defaultEndpoint();
|
|
39663
39678
|
}
|
|
39664
|
-
|
|
39679
|
+
const endpoint = normalizeConfiguredEndpoint(value);
|
|
39680
|
+
if (!endpoint) {
|
|
39665
39681
|
throw new Error(
|
|
39666
39682
|
`LibraVDB sidecarPath must be a daemon endpoint like unix:/path/to/libravdb.sock or tcp:127.0.0.1:37421. Executable paths are no longer supported.`
|
|
39667
39683
|
);
|
|
39668
39684
|
}
|
|
39669
|
-
return
|
|
39685
|
+
return endpoint;
|
|
39670
39686
|
}
|
|
39671
39687
|
function daemonProvisioningHint() {
|
|
39672
39688
|
return "If you installed the npm package, install and start libravdbd separately; the package does not provision the daemon binary, ONNX Runtime, or model assets.";
|
|
39673
39689
|
}
|
|
39674
39690
|
function defaultEndpoint(platform = process.platform, homeDir = os2.homedir(), pathExists = fs3.existsSync) {
|
|
39675
|
-
const envEndpoint = process.env.LIBRAVDB_RPC_ENDPOINT
|
|
39676
|
-
if (envEndpoint
|
|
39691
|
+
const envEndpoint = normalizeConfiguredEndpoint(process.env.LIBRAVDB_RPC_ENDPOINT);
|
|
39692
|
+
if (envEndpoint) {
|
|
39677
39693
|
return envEndpoint;
|
|
39678
39694
|
}
|
|
39679
39695
|
if (platform === "win32") {
|
|
@@ -39766,6 +39782,17 @@ function isConfiguredEndpoint(value) {
|
|
|
39766
39782
|
const port = Number(address.slice(separator + 1));
|
|
39767
39783
|
return host.length > 0 && Number.isInteger(port) && port > 0 && port <= 65535;
|
|
39768
39784
|
}
|
|
39785
|
+
function normalizeConfiguredEndpoint(value) {
|
|
39786
|
+
const trimmed = value?.trim();
|
|
39787
|
+
if (!trimmed || trimmed === "auto") {
|
|
39788
|
+
return null;
|
|
39789
|
+
}
|
|
39790
|
+
if (trimmed.startsWith("unix:")) {
|
|
39791
|
+
const socketPath = trimmed.slice("unix:".length).trim();
|
|
39792
|
+
return socketPath ? `unix:${socketPath}` : null;
|
|
39793
|
+
}
|
|
39794
|
+
return isConfiguredEndpoint(trimmed) ? trimmed : null;
|
|
39795
|
+
}
|
|
39769
39796
|
function sleep2(delayMs) {
|
|
39770
39797
|
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
39771
39798
|
}
|
package/dist/memory-runtime.js
CHANGED
|
@@ -161,7 +161,16 @@ function resolveSessionSearchCollection(cfg, sessionId) {
|
|
|
161
161
|
return `session:${sessionId}`;
|
|
162
162
|
}
|
|
163
163
|
function firstString(...values) {
|
|
164
|
-
|
|
164
|
+
for (const value of values) {
|
|
165
|
+
if (typeof value !== "string") {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const trimmed = value.trim();
|
|
169
|
+
if (trimmed.length > 0) {
|
|
170
|
+
return trimmed;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
165
174
|
}
|
|
166
175
|
function toMemorySearchResult(item) {
|
|
167
176
|
const collection = typeof item.metadata.collection === "string" ? item.metadata.collection : "memory";
|
package/dist/sidecar.js
CHANGED
|
@@ -351,18 +351,19 @@ export function resolveConfiguredEndpoint(cfg) {
|
|
|
351
351
|
if (!value || value === "auto") {
|
|
352
352
|
return defaultEndpoint();
|
|
353
353
|
}
|
|
354
|
-
|
|
354
|
+
const endpoint = normalizeConfiguredEndpoint(value);
|
|
355
|
+
if (!endpoint) {
|
|
355
356
|
throw new Error(`LibraVDB sidecarPath must be a daemon endpoint like unix:/path/to/libravdb.sock or tcp:127.0.0.1:37421. Executable paths are no longer supported.`);
|
|
356
357
|
}
|
|
357
|
-
return
|
|
358
|
+
return endpoint;
|
|
358
359
|
}
|
|
359
360
|
export function daemonProvisioningHint() {
|
|
360
361
|
return "If you installed the npm package, install and start libravdbd separately; the package does not provision the daemon binary, ONNX Runtime, or model assets.";
|
|
361
362
|
}
|
|
362
363
|
export function defaultEndpoint(platform = process.platform, homeDir = os.homedir(), pathExists = fs.existsSync) {
|
|
363
364
|
// Honour the daemon's own env var first (set by Homebrew LaunchAgent / systemd unit).
|
|
364
|
-
const envEndpoint = process.env.LIBRAVDB_RPC_ENDPOINT
|
|
365
|
-
if (envEndpoint
|
|
365
|
+
const envEndpoint = normalizeConfiguredEndpoint(process.env.LIBRAVDB_RPC_ENDPOINT);
|
|
366
|
+
if (envEndpoint) {
|
|
366
367
|
return envEndpoint;
|
|
367
368
|
}
|
|
368
369
|
if (platform === "win32") {
|
|
@@ -525,6 +526,17 @@ function isConfiguredEndpoint(value) {
|
|
|
525
526
|
const port = Number(address.slice(separator + 1));
|
|
526
527
|
return host.length > 0 && Number.isInteger(port) && port > 0 && port <= 65535;
|
|
527
528
|
}
|
|
529
|
+
function normalizeConfiguredEndpoint(value) {
|
|
530
|
+
const trimmed = value?.trim();
|
|
531
|
+
if (!trimmed || trimmed === "auto") {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
if (trimmed.startsWith("unix:")) {
|
|
535
|
+
const socketPath = trimmed.slice("unix:".length).trim();
|
|
536
|
+
return socketPath ? `unix:${socketPath}` : null;
|
|
537
|
+
}
|
|
538
|
+
return isConfiguredEndpoint(trimmed) ? trimmed : null;
|
|
539
|
+
}
|
|
528
540
|
export { PlaceholderSocket };
|
|
529
541
|
function sleep(delayMs) {
|
|
530
542
|
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
package/openclaw.plugin.json
CHANGED