agentxjs 1.0.0 → 1.0.2
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/browser.cjs +475 -5
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +475 -5
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +469 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +468 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { WebSocketServer } from '@agentxjs/network';
|
|
2
|
-
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __esm = (fn, res) => function __init() {
|
|
@@ -196,6 +194,471 @@ var init_dist = __esm({
|
|
|
196
194
|
}
|
|
197
195
|
});
|
|
198
196
|
|
|
197
|
+
// ../network/dist/chunk-63P5VUHB.js
|
|
198
|
+
async function createWebSocketClient(options) {
|
|
199
|
+
if (isBrowser) {
|
|
200
|
+
const client = new BrowserWebSocketClient(options);
|
|
201
|
+
await client.connect();
|
|
202
|
+
return client;
|
|
203
|
+
} else {
|
|
204
|
+
const client = new WebSocketClient(options);
|
|
205
|
+
await client.connect();
|
|
206
|
+
return client;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var __defProp3, __defNormalProp2, __publicField2, logger, isBrowser, WebSocketClient, BrowserWebSocketClient;
|
|
210
|
+
var init_chunk_63P5VUHB = __esm({
|
|
211
|
+
"../network/dist/chunk-63P5VUHB.js"() {
|
|
212
|
+
init_dist();
|
|
213
|
+
__defProp3 = Object.defineProperty;
|
|
214
|
+
__defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
215
|
+
__publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
216
|
+
logger = createLogger("network/WebSocketClient");
|
|
217
|
+
isBrowser = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" && typeof globalThis.window.WebSocket !== "undefined";
|
|
218
|
+
WebSocketClient = class {
|
|
219
|
+
constructor(options) {
|
|
220
|
+
__publicField2(this, "ws", null);
|
|
221
|
+
__publicField2(this, "serverUrl");
|
|
222
|
+
__publicField2(this, "messageHandlers", /* @__PURE__ */ new Set());
|
|
223
|
+
__publicField2(this, "openHandlers", /* @__PURE__ */ new Set());
|
|
224
|
+
__publicField2(this, "closeHandlers", /* @__PURE__ */ new Set());
|
|
225
|
+
__publicField2(this, "errorHandlers", /* @__PURE__ */ new Set());
|
|
226
|
+
if (isBrowser) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
"Use createBrowserWebSocketClient() in browser environment for auto-reconnect support"
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
this.serverUrl = options.serverUrl;
|
|
232
|
+
}
|
|
233
|
+
get readyState() {
|
|
234
|
+
if (!this.ws) return "closed";
|
|
235
|
+
const state = this.ws.readyState;
|
|
236
|
+
if (state === 0) return "connecting";
|
|
237
|
+
if (state === 1) return "open";
|
|
238
|
+
if (state === 2) return "closing";
|
|
239
|
+
return "closed";
|
|
240
|
+
}
|
|
241
|
+
async connect() {
|
|
242
|
+
if (this.ws) {
|
|
243
|
+
throw new Error("Already connected or connecting");
|
|
244
|
+
}
|
|
245
|
+
const { WebSocket: NodeWebSocket } = await import('ws');
|
|
246
|
+
this.ws = new NodeWebSocket(this.serverUrl);
|
|
247
|
+
return new Promise((resolve, reject) => {
|
|
248
|
+
const onOpen = () => {
|
|
249
|
+
logger.info("WebSocket connected", { serverUrl: this.serverUrl });
|
|
250
|
+
for (const handler of this.openHandlers) {
|
|
251
|
+
handler();
|
|
252
|
+
}
|
|
253
|
+
resolve();
|
|
254
|
+
};
|
|
255
|
+
const onError = (err) => {
|
|
256
|
+
logger.error("WebSocket connection failed", {
|
|
257
|
+
serverUrl: this.serverUrl,
|
|
258
|
+
error: err?.message
|
|
259
|
+
});
|
|
260
|
+
reject(err || new Error("WebSocket connection failed"));
|
|
261
|
+
};
|
|
262
|
+
this.ws.once("open", onOpen);
|
|
263
|
+
this.ws.once("error", onError);
|
|
264
|
+
this.ws.on("message", (data) => {
|
|
265
|
+
const message = data.toString();
|
|
266
|
+
for (const handler of this.messageHandlers) {
|
|
267
|
+
handler(message);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
this.ws.on("close", () => {
|
|
271
|
+
logger.warn("WebSocket closed");
|
|
272
|
+
for (const handler of this.closeHandlers) {
|
|
273
|
+
handler();
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
this.ws.on("error", (err) => {
|
|
277
|
+
logger.error("WebSocket error", { error: err.message });
|
|
278
|
+
for (const handler of this.errorHandlers) {
|
|
279
|
+
handler(err);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
send(message) {
|
|
285
|
+
if (!this.ws || this.ws.readyState !== 1) {
|
|
286
|
+
throw new Error("WebSocket is not open");
|
|
287
|
+
}
|
|
288
|
+
this.ws.send(message);
|
|
289
|
+
}
|
|
290
|
+
onMessage(handler) {
|
|
291
|
+
this.messageHandlers.add(handler);
|
|
292
|
+
return () => {
|
|
293
|
+
this.messageHandlers.delete(handler);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
onOpen(handler) {
|
|
297
|
+
this.openHandlers.add(handler);
|
|
298
|
+
return () => {
|
|
299
|
+
this.openHandlers.delete(handler);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
onClose(handler) {
|
|
303
|
+
this.closeHandlers.add(handler);
|
|
304
|
+
return () => {
|
|
305
|
+
this.closeHandlers.delete(handler);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
onError(handler) {
|
|
309
|
+
this.errorHandlers.add(handler);
|
|
310
|
+
return () => {
|
|
311
|
+
this.errorHandlers.delete(handler);
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
close() {
|
|
315
|
+
if (this.ws) {
|
|
316
|
+
this.ws.close();
|
|
317
|
+
this.ws = null;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
dispose() {
|
|
321
|
+
this.close();
|
|
322
|
+
this.messageHandlers.clear();
|
|
323
|
+
this.openHandlers.clear();
|
|
324
|
+
this.closeHandlers.clear();
|
|
325
|
+
this.errorHandlers.clear();
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
BrowserWebSocketClient = class {
|
|
329
|
+
// Track if this is a reconnection
|
|
330
|
+
constructor(options) {
|
|
331
|
+
__publicField2(this, "ws", null);
|
|
332
|
+
__publicField2(this, "serverUrl");
|
|
333
|
+
__publicField2(this, "options");
|
|
334
|
+
__publicField2(this, "messageHandlers", /* @__PURE__ */ new Set());
|
|
335
|
+
__publicField2(this, "openHandlers", /* @__PURE__ */ new Set());
|
|
336
|
+
__publicField2(this, "closeHandlers", /* @__PURE__ */ new Set());
|
|
337
|
+
__publicField2(this, "errorHandlers", /* @__PURE__ */ new Set());
|
|
338
|
+
__publicField2(this, "hasConnectedBefore", false);
|
|
339
|
+
if (!isBrowser) {
|
|
340
|
+
throw new Error("BrowserWebSocketClient can only be used in browser environment");
|
|
341
|
+
}
|
|
342
|
+
this.serverUrl = options.serverUrl;
|
|
343
|
+
this.options = {
|
|
344
|
+
autoReconnect: true,
|
|
345
|
+
minReconnectionDelay: 1e3,
|
|
346
|
+
maxReconnectionDelay: 1e4,
|
|
347
|
+
maxRetries: Infinity,
|
|
348
|
+
connectionTimeout: 4e3,
|
|
349
|
+
debug: false,
|
|
350
|
+
...options
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
get readyState() {
|
|
354
|
+
if (!this.ws) return "closed";
|
|
355
|
+
const state = this.ws.readyState;
|
|
356
|
+
if (state === 0) return "connecting";
|
|
357
|
+
if (state === 1) return "open";
|
|
358
|
+
if (state === 2) return "closing";
|
|
359
|
+
return "closed";
|
|
360
|
+
}
|
|
361
|
+
async connect() {
|
|
362
|
+
if (this.ws) {
|
|
363
|
+
throw new Error("Already connected or connecting");
|
|
364
|
+
}
|
|
365
|
+
if (this.options.autoReconnect) {
|
|
366
|
+
const ReconnectingWebSocket = (await import('reconnecting-websocket')).default;
|
|
367
|
+
this.ws = new ReconnectingWebSocket(this.serverUrl, [], {
|
|
368
|
+
maxReconnectionDelay: this.options.maxReconnectionDelay,
|
|
369
|
+
minReconnectionDelay: this.options.minReconnectionDelay,
|
|
370
|
+
reconnectionDelayGrowFactor: 1.3,
|
|
371
|
+
connectionTimeout: this.options.connectionTimeout,
|
|
372
|
+
maxRetries: this.options.maxRetries,
|
|
373
|
+
debug: this.options.debug
|
|
374
|
+
});
|
|
375
|
+
} else {
|
|
376
|
+
this.ws = new WebSocket(this.serverUrl);
|
|
377
|
+
}
|
|
378
|
+
return new Promise((resolve, reject) => {
|
|
379
|
+
const onOpen = () => {
|
|
380
|
+
if (this.hasConnectedBefore) {
|
|
381
|
+
logger.info("WebSocket reconnected successfully", { serverUrl: this.serverUrl });
|
|
382
|
+
} else {
|
|
383
|
+
logger.info("WebSocket connected", { serverUrl: this.serverUrl });
|
|
384
|
+
this.hasConnectedBefore = true;
|
|
385
|
+
}
|
|
386
|
+
for (const handler of this.openHandlers) {
|
|
387
|
+
handler();
|
|
388
|
+
}
|
|
389
|
+
resolve();
|
|
390
|
+
};
|
|
391
|
+
const onError = (_event) => {
|
|
392
|
+
logger.error("WebSocket connection failed", { serverUrl: this.serverUrl });
|
|
393
|
+
const error = new Error("WebSocket connection failed");
|
|
394
|
+
for (const handler of this.errorHandlers) {
|
|
395
|
+
handler(error);
|
|
396
|
+
}
|
|
397
|
+
reject(error);
|
|
398
|
+
};
|
|
399
|
+
this.ws.addEventListener("open", onOpen, { once: true });
|
|
400
|
+
this.ws.addEventListener("error", onError, { once: true });
|
|
401
|
+
this.ws.addEventListener("message", ((event) => {
|
|
402
|
+
const message = event.data;
|
|
403
|
+
for (const handler of this.messageHandlers) {
|
|
404
|
+
handler(message);
|
|
405
|
+
}
|
|
406
|
+
}));
|
|
407
|
+
this.ws.addEventListener("close", (() => {
|
|
408
|
+
logger.info("WebSocket closed, attempting to reconnect...");
|
|
409
|
+
for (const handler of this.closeHandlers) {
|
|
410
|
+
handler();
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
this.ws.addEventListener("error", ((_event) => {
|
|
414
|
+
logger.error("WebSocket error");
|
|
415
|
+
const error = new Error("WebSocket error");
|
|
416
|
+
for (const handler of this.errorHandlers) {
|
|
417
|
+
handler(error);
|
|
418
|
+
}
|
|
419
|
+
}));
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
send(message) {
|
|
423
|
+
if (!this.ws || this.ws.readyState !== 1) {
|
|
424
|
+
throw new Error("WebSocket is not open");
|
|
425
|
+
}
|
|
426
|
+
this.ws.send(message);
|
|
427
|
+
}
|
|
428
|
+
onMessage(handler) {
|
|
429
|
+
this.messageHandlers.add(handler);
|
|
430
|
+
return () => {
|
|
431
|
+
this.messageHandlers.delete(handler);
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
onOpen(handler) {
|
|
435
|
+
this.openHandlers.add(handler);
|
|
436
|
+
return () => {
|
|
437
|
+
this.openHandlers.delete(handler);
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
onClose(handler) {
|
|
441
|
+
this.closeHandlers.add(handler);
|
|
442
|
+
return () => {
|
|
443
|
+
this.closeHandlers.delete(handler);
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
onError(handler) {
|
|
447
|
+
this.errorHandlers.add(handler);
|
|
448
|
+
return () => {
|
|
449
|
+
this.errorHandlers.delete(handler);
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
close() {
|
|
453
|
+
if (this.ws) {
|
|
454
|
+
this.ws.close();
|
|
455
|
+
this.ws = null;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
dispose() {
|
|
459
|
+
this.close();
|
|
460
|
+
this.messageHandlers.clear();
|
|
461
|
+
this.openHandlers.clear();
|
|
462
|
+
this.closeHandlers.clear();
|
|
463
|
+
this.errorHandlers.clear();
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// ../network/dist/index.js
|
|
470
|
+
var dist_exports2 = {};
|
|
471
|
+
__export(dist_exports2, {
|
|
472
|
+
WebSocketClient: () => WebSocketClient,
|
|
473
|
+
WebSocketServer: () => WebSocketServer,
|
|
474
|
+
createWebSocketClient: () => createWebSocketClient
|
|
475
|
+
});
|
|
476
|
+
var logger2, WebSocketConnection, WebSocketServer;
|
|
477
|
+
var init_dist2 = __esm({
|
|
478
|
+
"../network/dist/index.js"() {
|
|
479
|
+
init_chunk_63P5VUHB();
|
|
480
|
+
init_dist();
|
|
481
|
+
logger2 = createLogger("network/WebSocketServer");
|
|
482
|
+
WebSocketConnection = class {
|
|
483
|
+
constructor(ws, options) {
|
|
484
|
+
__publicField2(this, "id");
|
|
485
|
+
__publicField2(this, "ws");
|
|
486
|
+
__publicField2(this, "messageHandlers", /* @__PURE__ */ new Set());
|
|
487
|
+
__publicField2(this, "closeHandlers", /* @__PURE__ */ new Set());
|
|
488
|
+
__publicField2(this, "errorHandlers", /* @__PURE__ */ new Set());
|
|
489
|
+
__publicField2(this, "heartbeatInterval");
|
|
490
|
+
__publicField2(this, "isAlive", true);
|
|
491
|
+
this.ws = ws;
|
|
492
|
+
this.id = `conn_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
|
|
493
|
+
if (options.heartbeat !== false) {
|
|
494
|
+
const interval = options.heartbeatInterval || 3e4;
|
|
495
|
+
ws.on("pong", () => {
|
|
496
|
+
this.isAlive = true;
|
|
497
|
+
logger2.debug("Heartbeat pong received", { id: this.id });
|
|
498
|
+
});
|
|
499
|
+
this.heartbeatInterval = setInterval(() => {
|
|
500
|
+
if (!this.isAlive) {
|
|
501
|
+
logger2.warn("Client heartbeat timeout, terminating connection", { id: this.id });
|
|
502
|
+
clearInterval(this.heartbeatInterval);
|
|
503
|
+
ws.terminate();
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.isAlive = false;
|
|
507
|
+
ws.ping();
|
|
508
|
+
logger2.debug("Heartbeat ping sent", { id: this.id });
|
|
509
|
+
}, interval);
|
|
510
|
+
}
|
|
511
|
+
ws.on("message", (data) => {
|
|
512
|
+
const message = data.toString();
|
|
513
|
+
for (const handler of this.messageHandlers) {
|
|
514
|
+
handler(message);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
ws.on("close", () => {
|
|
518
|
+
if (this.heartbeatInterval) {
|
|
519
|
+
clearInterval(this.heartbeatInterval);
|
|
520
|
+
}
|
|
521
|
+
for (const handler of this.closeHandlers) {
|
|
522
|
+
handler();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
ws.on("error", (err) => {
|
|
526
|
+
if (this.heartbeatInterval) {
|
|
527
|
+
clearInterval(this.heartbeatInterval);
|
|
528
|
+
}
|
|
529
|
+
for (const handler of this.errorHandlers) {
|
|
530
|
+
handler(err);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
send(message) {
|
|
535
|
+
if (this.ws.readyState === 1) {
|
|
536
|
+
this.ws.send(message);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
onMessage(handler) {
|
|
540
|
+
this.messageHandlers.add(handler);
|
|
541
|
+
return () => {
|
|
542
|
+
this.messageHandlers.delete(handler);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
onClose(handler) {
|
|
546
|
+
this.closeHandlers.add(handler);
|
|
547
|
+
return () => {
|
|
548
|
+
this.closeHandlers.delete(handler);
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
onError(handler) {
|
|
552
|
+
this.errorHandlers.add(handler);
|
|
553
|
+
return () => {
|
|
554
|
+
this.errorHandlers.delete(handler);
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
close() {
|
|
558
|
+
if (this.heartbeatInterval) {
|
|
559
|
+
clearInterval(this.heartbeatInterval);
|
|
560
|
+
}
|
|
561
|
+
this.ws.close();
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
WebSocketServer = class {
|
|
565
|
+
constructor(options = {}) {
|
|
566
|
+
__publicField2(this, "wss", null);
|
|
567
|
+
__publicField2(this, "connections", /* @__PURE__ */ new Set());
|
|
568
|
+
__publicField2(this, "connectionHandlers", /* @__PURE__ */ new Set());
|
|
569
|
+
__publicField2(this, "options");
|
|
570
|
+
__publicField2(this, "attachedToServer", false);
|
|
571
|
+
this.options = options;
|
|
572
|
+
}
|
|
573
|
+
async listen(port, host = "0.0.0.0") {
|
|
574
|
+
if (this.wss) {
|
|
575
|
+
throw new Error("Server already listening");
|
|
576
|
+
}
|
|
577
|
+
if (this.attachedToServer) {
|
|
578
|
+
throw new Error(
|
|
579
|
+
"Cannot listen when attached to existing server. The server should call listen() instead."
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
const { WebSocketServer: WSS } = await import('ws');
|
|
583
|
+
this.wss = new WSS({ port, host });
|
|
584
|
+
this.wss.on("connection", (ws) => {
|
|
585
|
+
this.handleConnection(ws);
|
|
586
|
+
});
|
|
587
|
+
logger2.info("WebSocket server listening", { port, host });
|
|
588
|
+
}
|
|
589
|
+
attach(server, path = "/ws") {
|
|
590
|
+
if (this.wss) {
|
|
591
|
+
throw new Error("Server already initialized");
|
|
592
|
+
}
|
|
593
|
+
import('ws').then(({ WebSocketServer: WSS }) => {
|
|
594
|
+
this.wss = new WSS({ noServer: true });
|
|
595
|
+
server.on("upgrade", (request, socket, head) => {
|
|
596
|
+
const url = new URL(request.url || "", `http://${request.headers.host}`);
|
|
597
|
+
if (url.pathname === path) {
|
|
598
|
+
this.wss.handleUpgrade(request, socket, head, (ws) => {
|
|
599
|
+
this.wss.emit("connection", ws, request);
|
|
600
|
+
});
|
|
601
|
+
} else {
|
|
602
|
+
socket.destroy();
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
this.wss.on("connection", (ws) => {
|
|
606
|
+
this.handleConnection(ws);
|
|
607
|
+
});
|
|
608
|
+
this.attachedToServer = true;
|
|
609
|
+
logger2.info("WebSocket attached to existing HTTP server", { path });
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
handleConnection(ws) {
|
|
613
|
+
const connection = new WebSocketConnection(ws, this.options);
|
|
614
|
+
this.connections.add(connection);
|
|
615
|
+
logger2.info("Client connected", {
|
|
616
|
+
connectionId: connection.id,
|
|
617
|
+
totalConnections: this.connections.size
|
|
618
|
+
});
|
|
619
|
+
connection.onClose(() => {
|
|
620
|
+
this.connections.delete(connection);
|
|
621
|
+
logger2.info("Client disconnected", {
|
|
622
|
+
connectionId: connection.id,
|
|
623
|
+
totalConnections: this.connections.size
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
for (const handler of this.connectionHandlers) {
|
|
627
|
+
handler(connection);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
onConnection(handler) {
|
|
631
|
+
this.connectionHandlers.add(handler);
|
|
632
|
+
return () => {
|
|
633
|
+
this.connectionHandlers.delete(handler);
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
broadcast(message) {
|
|
637
|
+
for (const connection of this.connections) {
|
|
638
|
+
connection.send(message);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
async close() {
|
|
642
|
+
if (!this.wss) return;
|
|
643
|
+
for (const connection of this.connections) {
|
|
644
|
+
connection.close();
|
|
645
|
+
}
|
|
646
|
+
this.connections.clear();
|
|
647
|
+
if (!this.attachedToServer) {
|
|
648
|
+
await new Promise((resolve) => {
|
|
649
|
+
this.wss.close(() => resolve());
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
this.wss = null;
|
|
653
|
+
}
|
|
654
|
+
async dispose() {
|
|
655
|
+
await this.close();
|
|
656
|
+
this.connectionHandlers.clear();
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
199
662
|
// src/createLocalAgentX.ts
|
|
200
663
|
var createLocalAgentX_exports = {};
|
|
201
664
|
__export(createLocalAgentX_exports, {
|
|
@@ -277,6 +740,7 @@ async function createLocalAgentX(config) {
|
|
|
277
740
|
}
|
|
278
741
|
var init_createLocalAgentX = __esm({
|
|
279
742
|
"src/createLocalAgentX.ts"() {
|
|
743
|
+
init_dist2();
|
|
280
744
|
}
|
|
281
745
|
});
|
|
282
746
|
|
|
@@ -299,8 +763,8 @@ async function createAgentX(config) {
|
|
|
299
763
|
return createLocalAgentX2(config ?? {});
|
|
300
764
|
}
|
|
301
765
|
async function createRemoteAgentX(serverUrl) {
|
|
302
|
-
const { createWebSocketClient } = await
|
|
303
|
-
const client = await
|
|
766
|
+
const { createWebSocketClient: createWebSocketClient2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports2));
|
|
767
|
+
const client = await createWebSocketClient2({
|
|
304
768
|
serverUrl,
|
|
305
769
|
autoReconnect: true,
|
|
306
770
|
minReconnectionDelay: 1e3,
|