@xdarkicex/openclaw-memory-libravdb 1.4.76 → 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/index.js +26 -18
- package/dist/sidecar.d.ts +4 -0
- package/dist/sidecar.js +29 -24
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39935,6 +39935,28 @@ function computeStartupConnectRetryDelay(attempt, waitedMs = 0) {
|
|
|
39935
39935
|
function isTcpEndpoint(endpoint) {
|
|
39936
39936
|
return endpoint.startsWith("tcp:");
|
|
39937
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
|
+
}
|
|
39938
39960
|
function resolveEndpoint(cfg) {
|
|
39939
39961
|
const endpoint = resolveConfiguredEndpoint(cfg);
|
|
39940
39962
|
return endpoint.replace(/^unix:/, "");
|
|
@@ -39992,15 +40014,11 @@ function createDefaultRuntime() {
|
|
|
39992
40014
|
},
|
|
39993
40015
|
createSocket(endpoint) {
|
|
39994
40016
|
if (isTcpEndpoint(endpoint)) {
|
|
39995
|
-
const
|
|
39996
|
-
|
|
39997
|
-
if (separator <= 0) {
|
|
40017
|
+
const parsed = parseTcpEndpoint(endpoint);
|
|
40018
|
+
if (!parsed) {
|
|
39998
40019
|
throw new Error(`Invalid TCP sidecar endpoint: ${endpoint}`);
|
|
39999
40020
|
}
|
|
40000
|
-
return net.connect(
|
|
40001
|
-
host: address.slice(0, separator),
|
|
40002
|
-
port: Number(address.slice(separator + 1))
|
|
40003
|
-
});
|
|
40021
|
+
return net.connect(parsed);
|
|
40004
40022
|
}
|
|
40005
40023
|
return net.connect(endpoint);
|
|
40006
40024
|
},
|
|
@@ -40039,17 +40057,7 @@ function isConfiguredEndpoint(value) {
|
|
|
40039
40057
|
if (value.startsWith("unix:")) {
|
|
40040
40058
|
return value.slice("unix:".length).trim().length > 0;
|
|
40041
40059
|
}
|
|
40042
|
-
|
|
40043
|
-
return false;
|
|
40044
|
-
}
|
|
40045
|
-
const address = value.slice("tcp:".length);
|
|
40046
|
-
const separator = address.lastIndexOf(":");
|
|
40047
|
-
if (separator <= 0 || separator === address.length - 1) {
|
|
40048
|
-
return false;
|
|
40049
|
-
}
|
|
40050
|
-
const host = address.slice(0, separator).trim();
|
|
40051
|
-
const port = Number(address.slice(separator + 1));
|
|
40052
|
-
return host.length > 0 && Number.isInteger(port) && port > 0 && port <= 65535;
|
|
40060
|
+
return parseTcpEndpoint(value) !== null;
|
|
40053
40061
|
}
|
|
40054
40062
|
function normalizeConfiguredEndpoint(value) {
|
|
40055
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
|
|
469
|
-
|
|
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
|
-
|
|
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
|
|
551
|
-
|
|
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
|
|
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
|
});
|
package/openclaw.plugin.json
CHANGED