@xdarkicex/openclaw-memory-libravdb 1.4.58 → 1.4.59
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 +25 -1
- package/dist/sidecar.d.ts +1 -0
- package/dist/sidecar.js +25 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39370,6 +39370,7 @@ import path4 from "node:path";
|
|
|
39370
39370
|
var STARTUP_CONNECT_MAX_RETRIES = 5;
|
|
39371
39371
|
var STARTUP_CONNECT_BASE_DELAY_MS = 100;
|
|
39372
39372
|
var STARTUP_CONNECT_MAX_TOTAL_WAIT_MS = 2e3;
|
|
39373
|
+
var CONNECTION_STABILITY_WINDOW_MS = 15e3;
|
|
39373
39374
|
var SupervisorSocket = class {
|
|
39374
39375
|
onData = /* @__PURE__ */ new Set();
|
|
39375
39376
|
onClose = /* @__PURE__ */ new Set();
|
|
@@ -39478,12 +39479,13 @@ var SidecarSupervisor = class {
|
|
|
39478
39479
|
degraded = false;
|
|
39479
39480
|
shuttingDown = false;
|
|
39480
39481
|
reconnectScheduled = false;
|
|
39482
|
+
stabilityTimer = null;
|
|
39481
39483
|
socket;
|
|
39482
39484
|
async start() {
|
|
39483
39485
|
const endpoint = await this.runtime.resolveEndpoint(this.cfg);
|
|
39484
39486
|
const socket = await this.connectEndpointWithRetry(endpoint);
|
|
39485
|
-
this.retries = 0;
|
|
39486
39487
|
this.reconnectScheduled = false;
|
|
39488
|
+
this.scheduleStabilityReset();
|
|
39487
39489
|
if (this.socket instanceof SupervisorSocket) {
|
|
39488
39490
|
this.socket.bind(socket);
|
|
39489
39491
|
} else {
|
|
@@ -39496,8 +39498,29 @@ var SidecarSupervisor = class {
|
|
|
39496
39498
|
}
|
|
39497
39499
|
async shutdown() {
|
|
39498
39500
|
this.shuttingDown = true;
|
|
39501
|
+
this.clearStabilityTimer();
|
|
39499
39502
|
this.socket.destroy();
|
|
39500
39503
|
}
|
|
39504
|
+
scheduleStabilityReset() {
|
|
39505
|
+
this.clearStabilityTimer();
|
|
39506
|
+
const windowMs = this.runtime.stabilityWindowMs ?? CONNECTION_STABILITY_WINDOW_MS;
|
|
39507
|
+
if (windowMs <= 0) {
|
|
39508
|
+
this.retries = 0;
|
|
39509
|
+
return;
|
|
39510
|
+
}
|
|
39511
|
+
this.stabilityTimer = setTimeout(() => {
|
|
39512
|
+
this.stabilityTimer = null;
|
|
39513
|
+
this.retries = 0;
|
|
39514
|
+
this.logger.info?.("[libravdb] sidecar connection stable; retry counter reset");
|
|
39515
|
+
}, windowMs);
|
|
39516
|
+
this.stabilityTimer.unref?.();
|
|
39517
|
+
}
|
|
39518
|
+
clearStabilityTimer() {
|
|
39519
|
+
if (this.stabilityTimer) {
|
|
39520
|
+
clearTimeout(this.stabilityTimer);
|
|
39521
|
+
this.stabilityTimer = null;
|
|
39522
|
+
}
|
|
39523
|
+
}
|
|
39501
39524
|
async connectEndpointWithRetry(endpoint) {
|
|
39502
39525
|
if (isTcpEndpoint(endpoint)) {
|
|
39503
39526
|
this.logger.info?.(`[libravdb] using TCP endpoint ${endpoint}`);
|
|
@@ -39549,6 +39572,7 @@ var SidecarSupervisor = class {
|
|
|
39549
39572
|
if (this.reconnectScheduled) {
|
|
39550
39573
|
return;
|
|
39551
39574
|
}
|
|
39575
|
+
this.clearStabilityTimer();
|
|
39552
39576
|
const maxRetries = this.cfg.maxRetries ?? 3;
|
|
39553
39577
|
if (this.retries >= maxRetries) {
|
|
39554
39578
|
this.logger.error("[libravdb] sidecar retries exhausted; degraded mode");
|
package/dist/sidecar.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface SidecarRuntime {
|
|
|
6
6
|
resolveEndpoint(cfg: PluginConfig): string | Promise<string>;
|
|
7
7
|
createSocket(endpoint: string): SidecarSocket;
|
|
8
8
|
scheduleRestart(delayMs: number, restart: () => void): void;
|
|
9
|
+
stabilityWindowMs?: number;
|
|
9
10
|
}
|
|
10
11
|
declare class PlaceholderSocket implements SidecarSocket {
|
|
11
12
|
private readonly onData;
|
package/dist/sidecar.js
CHANGED
|
@@ -5,6 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
const STARTUP_CONNECT_MAX_RETRIES = 5;
|
|
6
6
|
const STARTUP_CONNECT_BASE_DELAY_MS = 100;
|
|
7
7
|
const STARTUP_CONNECT_MAX_TOTAL_WAIT_MS = 2000;
|
|
8
|
+
const CONNECTION_STABILITY_WINDOW_MS = 15_000;
|
|
8
9
|
class PlaceholderSocket {
|
|
9
10
|
onData = new Set();
|
|
10
11
|
onClose = new Set();
|
|
@@ -197,6 +198,7 @@ class SidecarSupervisor {
|
|
|
197
198
|
degraded = false;
|
|
198
199
|
shuttingDown = false;
|
|
199
200
|
reconnectScheduled = false;
|
|
201
|
+
stabilityTimer = null;
|
|
200
202
|
socket;
|
|
201
203
|
constructor(cfg, logger, runtime) {
|
|
202
204
|
this.cfg = cfg;
|
|
@@ -207,8 +209,8 @@ class SidecarSupervisor {
|
|
|
207
209
|
async start() {
|
|
208
210
|
const endpoint = await this.runtime.resolveEndpoint(this.cfg);
|
|
209
211
|
const socket = await this.connectEndpointWithRetry(endpoint);
|
|
210
|
-
this.retries = 0;
|
|
211
212
|
this.reconnectScheduled = false;
|
|
213
|
+
this.scheduleStabilityReset();
|
|
212
214
|
if (this.socket instanceof SupervisorSocket) {
|
|
213
215
|
this.socket.bind(socket);
|
|
214
216
|
}
|
|
@@ -222,8 +224,29 @@ class SidecarSupervisor {
|
|
|
222
224
|
}
|
|
223
225
|
async shutdown() {
|
|
224
226
|
this.shuttingDown = true;
|
|
227
|
+
this.clearStabilityTimer();
|
|
225
228
|
this.socket.destroy();
|
|
226
229
|
}
|
|
230
|
+
scheduleStabilityReset() {
|
|
231
|
+
this.clearStabilityTimer();
|
|
232
|
+
const windowMs = this.runtime.stabilityWindowMs ?? CONNECTION_STABILITY_WINDOW_MS;
|
|
233
|
+
if (windowMs <= 0) {
|
|
234
|
+
this.retries = 0;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
this.stabilityTimer = setTimeout(() => {
|
|
238
|
+
this.stabilityTimer = null;
|
|
239
|
+
this.retries = 0;
|
|
240
|
+
this.logger.info?.("[libravdb] sidecar connection stable; retry counter reset");
|
|
241
|
+
}, windowMs);
|
|
242
|
+
this.stabilityTimer.unref?.();
|
|
243
|
+
}
|
|
244
|
+
clearStabilityTimer() {
|
|
245
|
+
if (this.stabilityTimer) {
|
|
246
|
+
clearTimeout(this.stabilityTimer);
|
|
247
|
+
this.stabilityTimer = null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
227
250
|
async connectEndpointWithRetry(endpoint) {
|
|
228
251
|
if (isTcpEndpoint(endpoint)) {
|
|
229
252
|
this.logger.info?.(`[libravdb] using TCP endpoint ${endpoint}`);
|
|
@@ -275,6 +298,7 @@ class SidecarSupervisor {
|
|
|
275
298
|
if (this.reconnectScheduled) {
|
|
276
299
|
return;
|
|
277
300
|
}
|
|
301
|
+
this.clearStabilityTimer();
|
|
278
302
|
const maxRetries = this.cfg.maxRetries ?? 3;
|
|
279
303
|
if (this.retries >= maxRetries) {
|
|
280
304
|
this.logger.error("[libravdb] sidecar retries exhausted; degraded mode");
|
package/openclaw.plugin.json
CHANGED