@replit/river 0.12.5 → 0.13.0

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.
Files changed (51) hide show
  1. package/README.md +4 -1
  2. package/dist/{builder-c593de11.d.ts → builder-169fbf7f.d.ts} +16 -7
  3. package/dist/{chunk-AFLZ6INU.js → chunk-CBRQM65K.js} +29 -10
  4. package/dist/{chunk-IIBVKYDB.js → chunk-CDH7QSB4.js} +39 -1
  5. package/dist/{chunk-XFFS4UOD.js → chunk-MGGIUH5O.js} +7 -7
  6. package/dist/{chunk-6OAKPO5R.js → chunk-NPXAAD7M.js} +1 -1
  7. package/dist/{chunk-2PKONGC3.js → chunk-R2IMXRVU.js} +160 -135
  8. package/dist/{connection-4a839b9a.d.ts → connection-ab681c08.d.ts} +1 -1
  9. package/dist/{messageFraming-b200ef25.d.ts → connection-dd789651.d.ts} +17 -2
  10. package/dist/{index-1afc5580.d.ts → index-21c1b21d.d.ts} +32 -18
  11. package/dist/router/index.cjs +31 -13
  12. package/dist/router/index.d.cts +5 -5
  13. package/dist/router/index.d.ts +5 -5
  14. package/dist/router/index.js +2 -2
  15. package/dist/transport/impls/uds/client.cjs +153 -140
  16. package/dist/transport/impls/uds/client.d.cts +2 -3
  17. package/dist/transport/impls/uds/client.d.ts +2 -3
  18. package/dist/transport/impls/uds/client.js +5 -6
  19. package/dist/transport/impls/uds/server.cjs +161 -146
  20. package/dist/transport/impls/uds/server.d.cts +2 -3
  21. package/dist/transport/impls/uds/server.d.ts +2 -3
  22. package/dist/transport/impls/uds/server.js +4 -5
  23. package/dist/transport/impls/ws/client.cjs +157 -142
  24. package/dist/transport/impls/ws/client.d.cts +4 -4
  25. package/dist/transport/impls/ws/client.d.ts +4 -4
  26. package/dist/transport/impls/ws/client.js +7 -7
  27. package/dist/transport/impls/ws/server.cjs +161 -146
  28. package/dist/transport/impls/ws/server.d.cts +2 -2
  29. package/dist/transport/impls/ws/server.d.ts +2 -2
  30. package/dist/transport/impls/ws/server.js +4 -4
  31. package/dist/transport/index.cjs +212 -186
  32. package/dist/transport/index.d.cts +1 -1
  33. package/dist/transport/index.d.ts +1 -1
  34. package/dist/transport/index.js +3 -3
  35. package/dist/util/testHelpers.cjs +294 -16
  36. package/dist/util/testHelpers.d.cts +2 -2
  37. package/dist/util/testHelpers.d.ts +2 -2
  38. package/dist/util/testHelpers.js +30 -8
  39. package/package.json +1 -9
  40. package/dist/chunk-7J66WOIC.js +0 -44
  41. package/dist/chunk-H4QR2K3T.js +0 -47
  42. package/dist/connection-64b9e0ff.d.ts +0 -17
  43. package/dist/connection-a6cc48e8.d.ts +0 -18
  44. package/dist/transport/impls/stdio/client.cjs +0 -913
  45. package/dist/transport/impls/stdio/client.d.cts +0 -27
  46. package/dist/transport/impls/stdio/client.d.ts +0 -27
  47. package/dist/transport/impls/stdio/client.js +0 -42
  48. package/dist/transport/impls/stdio/server.cjs +0 -888
  49. package/dist/transport/impls/stdio/server.d.cts +0 -25
  50. package/dist/transport/impls/stdio/server.d.ts +0 -25
  51. package/dist/transport/impls/stdio/server.js +0 -33
@@ -36,8 +36,8 @@ var TransportMessageSchema = (t) => import_typebox.Type.Object({
36
36
  to: import_typebox.Type.String(),
37
37
  seq: import_typebox.Type.Integer(),
38
38
  ack: import_typebox.Type.Integer(),
39
- serviceName: import_typebox.Type.Optional(import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Null()])),
40
- procedureName: import_typebox.Type.Optional(import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Null()])),
39
+ serviceName: import_typebox.Type.Optional(import_typebox.Type.String()),
40
+ procedureName: import_typebox.Type.Optional(import_typebox.Type.String()),
41
41
  streamId: import_typebox.Type.String(),
42
42
  controlFlags: import_typebox.Type.Integer(),
43
43
  payload: t
@@ -51,7 +51,7 @@ var ControlMessageCloseSchema = import_typebox.Type.Object({
51
51
  var PROTOCOL_VERSION = "v1";
52
52
  var ControlMessageHandshakeRequestSchema = import_typebox.Type.Object({
53
53
  type: import_typebox.Type.Literal("HANDSHAKE_REQ"),
54
- protocolVersion: import_typebox.Type.Literal(PROTOCOL_VERSION),
54
+ protocolVersion: import_typebox.Type.String(),
55
55
  instanceId: import_typebox.Type.String()
56
56
  });
57
57
  var ControlMessageHandshakeResponseSchema = import_typebox.Type.Object({
@@ -76,7 +76,7 @@ var ControlMessagePayloadSchema = import_typebox.Type.Union([
76
76
  var OpaqueTransportMessageSchema = TransportMessageSchema(
77
77
  import_typebox.Type.Unknown()
78
78
  );
79
- function bootRequestMessage(from, to, instanceId) {
79
+ function handshakeRequestMessage(from, to, instanceId) {
80
80
  return {
81
81
  id: (0, import_nanoid.nanoid)(),
82
82
  from,
@@ -129,6 +129,60 @@ var EventDispatcher = class {
129
129
 
130
130
  // transport/session.ts
131
131
  var import_nanoid2 = require("nanoid");
132
+
133
+ // codec/json.ts
134
+ var encoder = new TextEncoder();
135
+ var decoder = new TextDecoder();
136
+ function uint8ArrayToBase64(uint8Array) {
137
+ let binary = "";
138
+ uint8Array.forEach((byte) => {
139
+ binary += String.fromCharCode(byte);
140
+ });
141
+ return btoa(binary);
142
+ }
143
+ function base64ToUint8Array(base64) {
144
+ const binaryString = atob(base64);
145
+ const uint8Array = new Uint8Array(binaryString.length);
146
+ for (let i = 0; i < binaryString.length; i++) {
147
+ uint8Array[i] = binaryString.charCodeAt(i);
148
+ }
149
+ return uint8Array;
150
+ }
151
+ var NaiveJsonCodec = {
152
+ toBuffer: (obj) => {
153
+ return encoder.encode(
154
+ JSON.stringify(obj, function replacer(key) {
155
+ const val = this[key];
156
+ if (val instanceof Uint8Array) {
157
+ return { $t: uint8ArrayToBase64(val) };
158
+ } else {
159
+ return val;
160
+ }
161
+ })
162
+ );
163
+ },
164
+ fromBuffer: (buff) => {
165
+ try {
166
+ const parsed = JSON.parse(
167
+ decoder.decode(buff),
168
+ function reviver(_key, val) {
169
+ if (val?.$t) {
170
+ return base64ToUint8Array(val.$t);
171
+ } else {
172
+ return val;
173
+ }
174
+ }
175
+ );
176
+ if (typeof parsed === "object")
177
+ return parsed;
178
+ return null;
179
+ } catch {
180
+ return null;
181
+ }
182
+ }
183
+ };
184
+
185
+ // transport/session.ts
132
186
  var nanoid2 = (0, import_nanoid2.customAlphabet)("1234567890abcdefghijklmnopqrstuvxyz", 6);
133
187
  var unsafeId = () => nanoid2();
134
188
  var Connection = class {
@@ -140,8 +194,15 @@ var Connection = class {
140
194
  var HEARTBEAT_INTERVAL_MS = 1e3;
141
195
  var HEARTBEATS_TILL_DEAD = 2;
142
196
  var SESSION_DISCONNECT_GRACE_MS = 5e3;
197
+ var defaultSessionOptions = {
198
+ heartbeatIntervalMs: HEARTBEAT_INTERVAL_MS,
199
+ heartbeatsUntilDead: HEARTBEATS_TILL_DEAD,
200
+ sessionDisconnectGraceMs: SESSION_DISCONNECT_GRACE_MS,
201
+ codec: NaiveJsonCodec
202
+ };
143
203
  var Session = class {
144
204
  codec;
205
+ options;
145
206
  /**
146
207
  * The buffer of messages that have been sent but not yet acknowledged.
147
208
  */
@@ -177,16 +238,17 @@ var Session = class {
177
238
  * The interval for sending heartbeats.
178
239
  */
179
240
  heartbeat;
180
- constructor(codec, from, connectedTo, conn) {
241
+ constructor(from, connectedTo, conn, options) {
242
+ this.options = options;
181
243
  this.debugId = `sess-${unsafeId()}`;
182
244
  this.from = from;
183
245
  this.to = connectedTo;
184
246
  this.connection = conn;
185
- this.codec = codec;
247
+ this.codec = options.codec;
186
248
  this.heartbeatMisses = 0;
187
249
  this.heartbeat = setInterval(
188
250
  () => this.sendHeartbeat(),
189
- HEARTBEAT_INTERVAL_MS
251
+ options.heartbeatIntervalMs
190
252
  );
191
253
  }
192
254
  /**
@@ -222,7 +284,7 @@ var Session = class {
222
284
  return fullMsg.id;
223
285
  }
224
286
  sendHeartbeat() {
225
- if (this.heartbeatMisses >= HEARTBEATS_TILL_DEAD) {
287
+ if (this.heartbeatMisses >= this.options.heartbeatsUntilDead) {
226
288
  if (this.connection) {
227
289
  log?.info(
228
290
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
@@ -288,13 +350,11 @@ var Session = class {
288
350
  this.cancelGrace();
289
351
  this.connection = newConn;
290
352
  }
291
- graceCb;
292
353
  beginGrace(cb) {
293
- this.graceCb = cb;
294
354
  this.disconnectionGrace = setTimeout(() => {
295
355
  this.close();
296
356
  cb();
297
- }, SESSION_DISCONNECT_GRACE_MS);
357
+ }, this.options.sessionDisconnectGraceMs);
298
358
  }
299
359
  // called on reconnect of the underlying session
300
360
  cancelGrace() {
@@ -306,8 +366,8 @@ var Session = class {
306
366
  close() {
307
367
  this.closeStaleConnection(this.connection);
308
368
  this.cancelGrace();
309
- clearInterval(this.heartbeat);
310
369
  this.resetBufferedMessages();
370
+ clearInterval(this.heartbeat);
311
371
  }
312
372
  get connected() {
313
373
  return this.connection !== void 0;
@@ -332,58 +392,6 @@ var Session = class {
332
392
  }
333
393
  };
334
394
 
335
- // codec/json.ts
336
- var encoder = new TextEncoder();
337
- var decoder = new TextDecoder();
338
- function uint8ArrayToBase64(uint8Array) {
339
- let binary = "";
340
- uint8Array.forEach((byte) => {
341
- binary += String.fromCharCode(byte);
342
- });
343
- return btoa(binary);
344
- }
345
- function base64ToUint8Array(base64) {
346
- const binaryString = atob(base64);
347
- const uint8Array = new Uint8Array(binaryString.length);
348
- for (let i = 0; i < binaryString.length; i++) {
349
- uint8Array[i] = binaryString.charCodeAt(i);
350
- }
351
- return uint8Array;
352
- }
353
- var NaiveJsonCodec = {
354
- toBuffer: (obj) => {
355
- return encoder.encode(
356
- JSON.stringify(obj, function replacer(key) {
357
- const val = this[key];
358
- if (val instanceof Uint8Array) {
359
- return { $t: uint8ArrayToBase64(val) };
360
- } else {
361
- return val;
362
- }
363
- })
364
- );
365
- },
366
- fromBuffer: (buff) => {
367
- try {
368
- const parsed = JSON.parse(
369
- decoder.decode(buff),
370
- function reviver(_key, val) {
371
- if (val?.$t) {
372
- return base64ToUint8Array(val.$t);
373
- } else {
374
- return val;
375
- }
376
- }
377
- );
378
- if (typeof parsed === "object")
379
- return parsed;
380
- return null;
381
- } catch {
382
- return null;
383
- }
384
- }
385
- };
386
-
387
395
  // transport/transport.ts
388
396
  var import_nanoid3 = require("nanoid");
389
397
 
@@ -396,13 +404,13 @@ function coerceErrorString(err) {
396
404
  }
397
405
 
398
406
  // transport/transport.ts
399
- var DEFAULT_RECONNECT_JITTER_MAX_MS = 500;
400
- var DEFAULT_RECONNECT_INTERVAL_MS = 250;
407
+ var RECONNECT_JITTER_MAX_MS = 500;
408
+ var RECONNECT_INTERVAL_MS = 250;
401
409
  var defaultTransportOptions = {
402
- retryIntervalMs: DEFAULT_RECONNECT_INTERVAL_MS,
403
- retryJitterMs: DEFAULT_RECONNECT_JITTER_MAX_MS,
410
+ retryIntervalMs: RECONNECT_INTERVAL_MS,
411
+ retryJitterMs: RECONNECT_JITTER_MAX_MS,
404
412
  retryAttemptsMax: 5,
405
- codec: NaiveJsonCodec
413
+ ...defaultSessionOptions
406
414
  };
407
415
  var Transport = class {
408
416
  /**
@@ -459,15 +467,6 @@ var Transport = class {
459
467
  this.clientId = clientId;
460
468
  this.state = "open";
461
469
  }
462
- sessionByClientId(clientId) {
463
- const session = this.sessions.get(clientId);
464
- if (!session) {
465
- const err = `${this.clientId} -- (invariant violation) no existing session for ${clientId}`;
466
- log?.error(err);
467
- throw new Error(err);
468
- }
469
- return session;
470
- }
471
470
  /**
472
471
  * Called when a new connection is established
473
472
  * and we know the identity of the connected client.
@@ -482,7 +481,7 @@ var Transport = class {
482
481
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
483
482
  if (oldSession && lastInstanceId !== void 0 && lastInstanceId !== instanceId) {
484
483
  log?.warn(
485
- `${this.clientId} -- handshake from ${connectedTo} is a different instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
484
+ `${this.clientId} -- connection from ${connectedTo} is a different instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
486
485
  );
487
486
  oldSession.close();
488
487
  this.deleteSession(oldSession);
@@ -505,10 +504,10 @@ var Transport = class {
505
504
  }
506
505
  createSession(connectedTo, conn) {
507
506
  const session = new Session(
508
- this.codec,
509
507
  this.clientId,
510
508
  connectedTo,
511
- conn
509
+ conn,
510
+ this.options
512
511
  );
513
512
  this.sessions.set(session.to, session);
514
513
  this.eventDispatcher.dispatchEvent("sessionStatus", {
@@ -537,13 +536,10 @@ var Transport = class {
537
536
  status: "disconnect",
538
537
  conn
539
538
  });
540
- if (this.state !== "open")
539
+ const session = this.sessions.get(connectedTo);
540
+ if (!session)
541
541
  return;
542
- const session = this.sessionByClientId(connectedTo);
543
- log?.info(
544
- `${this.clientId} -- connection (id: ${conn.debugId}) disconnect from ${connectedTo}, ${SESSION_DISCONNECT_GRACE_MS}ms until session (id: ${session.debugId}) disconnect`
545
- );
546
- session.closeStaleConnection(conn);
542
+ session.connection = void 0;
547
543
  session.beginGrace(() => this.deleteSession(session));
548
544
  }
549
545
  /**
@@ -554,7 +550,7 @@ var Transport = class {
554
550
  parseMsg(msg) {
555
551
  const parsedMsg = this.codec.fromBuffer(msg);
556
552
  if (parsedMsg === null) {
557
- const decodedBuffer = new TextDecoder().decode(msg);
553
+ const decodedBuffer = new TextDecoder().decode(Buffer.from(msg));
558
554
  log?.error(
559
555
  `${this.clientId} -- received malformed msg, killing conn: ${decodedBuffer}`
560
556
  );
@@ -568,11 +564,7 @@ var Transport = class {
568
564
  );
569
565
  return null;
570
566
  }
571
- return {
572
- ...parsedMsg,
573
- serviceName: parsedMsg.serviceName === null ? void 0 : parsedMsg.serviceName,
574
- procedureName: parsedMsg.procedureName === null ? void 0 : parsedMsg.procedureName
575
- };
567
+ return parsedMsg;
576
568
  }
577
569
  /**
578
570
  * Called when a message is received by this transport.
@@ -582,15 +574,27 @@ var Transport = class {
582
574
  handleMsg(msg) {
583
575
  if (this.state !== "open")
584
576
  return;
585
- const session = this.sessionByClientId(msg.from);
577
+ const session = this.sessions.get(msg.from);
578
+ if (!session) {
579
+ const err = `${this.clientId} -- (invariant violation) no existing session for ${msg.from}`;
580
+ log?.error(err);
581
+ return;
582
+ }
586
583
  session.cancelGrace();
587
584
  log?.debug(`${this.clientId} -- received msg: ${JSON.stringify(msg)}`);
588
585
  if (msg.seq !== session.nextExpectedSeq) {
589
- log?.warn(
590
- `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), discarding: ${JSON.stringify(
591
- msg
592
- )}`
593
- );
586
+ if (msg.seq < session.nextExpectedSeq) {
587
+ log?.debug(
588
+ `${this.clientId} -- received duplicate msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), discarding: ${JSON.stringify(
589
+ msg
590
+ )}`
591
+ );
592
+ } else {
593
+ log?.error(
594
+ `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
595
+ );
596
+ session.closeStaleConnection(session.connection);
597
+ }
594
598
  return;
595
599
  }
596
600
  if (!isAck(msg.controlFlags)) {
@@ -608,7 +612,7 @@ var Transport = class {
608
612
  }
609
613
  /**
610
614
  * Removes a listener from this transport.
611
- * @param the type of event to unlisten on
615
+ * @param the type of event to un-listen on
612
616
  * @param handler The message handler to remove.
613
617
  */
614
618
  removeEventListener(type, handler) {
@@ -685,23 +689,31 @@ var ClientTransport = class extends Transport {
685
689
  */
686
690
  inflightConnectionPromises;
687
691
  tryReconnecting = true;
688
- constructor(clientId, providedOptions) {
692
+ connectedTo;
693
+ constructor(clientId, connectedTo, providedOptions) {
689
694
  super(clientId, providedOptions);
695
+ this.connectedTo = connectedTo;
690
696
  this.inflightConnectionPromises = /* @__PURE__ */ new Map();
691
697
  }
692
698
  handleConnection(conn, to) {
693
- const bootHandler = this.receiveWithBootSequence(conn, () => {
694
- conn.removeDataListener(bootHandler);
695
- conn.addDataListener((data) => {
696
- const parsed = this.parseMsg(data);
699
+ const handshakeHandler = (data) => {
700
+ const handshake = this.receiveHandshakeResponseMessage(data);
701
+ if (!handshake) {
702
+ conn.close();
703
+ return;
704
+ }
705
+ this.onConnect(conn, handshake.from, handshake.instanceId);
706
+ conn.removeDataListener(handshakeHandler);
707
+ conn.addDataListener((data2) => {
708
+ const parsed = this.parseMsg(data2);
697
709
  if (!parsed) {
698
710
  conn.close();
699
711
  return;
700
712
  }
701
713
  this.handleMsg(parsed);
702
714
  });
703
- });
704
- conn.addDataListener(bootHandler);
715
+ };
716
+ conn.addDataListener(handshakeHandler);
705
717
  conn.addCloseListener(() => {
706
718
  this.onDisconnect(conn, to);
707
719
  void this.connect(to);
@@ -712,6 +724,32 @@ var ClientTransport = class extends Transport {
712
724
  );
713
725
  });
714
726
  }
727
+ receiveHandshakeResponseMessage(data) {
728
+ const parsed = this.parseMsg(data);
729
+ if (!parsed)
730
+ return false;
731
+ if (!import_value.Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
732
+ log?.warn(
733
+ `${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
734
+ parsed
735
+ )}`
736
+ );
737
+ return false;
738
+ }
739
+ if (!parsed.payload.status.ok) {
740
+ log?.warn(
741
+ `${this.clientId} -- received failed handshake resp: ${JSON.stringify(
742
+ parsed
743
+ )}`
744
+ );
745
+ return false;
746
+ }
747
+ const instanceId = parsed.payload.status.instanceId;
748
+ log?.debug(
749
+ `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
750
+ );
751
+ return { instanceId, from: parsed.from };
752
+ }
715
753
  /**
716
754
  * Manually attempts to connect to a client.
717
755
  * @param to The client ID of the node to connect to.
@@ -730,10 +768,7 @@ var ClientTransport = class extends Transport {
730
768
  }
731
769
  try {
732
770
  const conn = await reconnectPromise;
733
- this.state = "open";
734
- const requestMsg = bootRequestMessage(this.clientId, to, this.instanceId);
735
- log?.debug(`${this.clientId} -- sending boot handshake to ${to}`);
736
- conn.send(this.codec.toBuffer(requestMsg));
771
+ this.sendHandshake(to, conn);
737
772
  } catch (error) {
738
773
  const errStr = coerceErrorString(error);
739
774
  this.inflightConnectionPromises.delete(to);
@@ -751,34 +786,14 @@ var ClientTransport = class extends Transport {
751
786
  }
752
787
  }
753
788
  }
754
- receiveWithBootSequence(conn, sessionCb) {
755
- const bootHandler = (data) => {
756
- const parsed = this.parseMsg(data);
757
- if (!parsed) {
758
- conn.close();
759
- return;
760
- }
761
- if (!import_value.Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
762
- log?.warn(
763
- `${this.clientId} -- received invalid handshake resp: ${JSON.stringify(parsed)}`
764
- );
765
- return;
766
- }
767
- if (!parsed.payload.status.ok) {
768
- log?.warn(
769
- `${this.clientId} -- received failed handshake resp: ${JSON.stringify(
770
- parsed
771
- )}`
772
- );
773
- return;
774
- }
775
- const serverInstanceId = parsed.payload.status.instanceId;
776
- log?.debug(
777
- `${this.clientId} -- handshake from ${parsed.from} ok (server instance: ${serverInstanceId})`
778
- );
779
- sessionCb(this.onConnect(conn, parsed.from, serverInstanceId));
780
- };
781
- return bootHandler;
789
+ sendHandshake(to, conn) {
790
+ const requestMsg = handshakeRequestMessage(
791
+ this.clientId,
792
+ to,
793
+ this.instanceId
794
+ );
795
+ log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
796
+ conn.send(this.codec.toBuffer(requestMsg));
782
797
  }
783
798
  onDisconnect(conn, connectedTo) {
784
799
  this.inflightConnectionPromises.delete(connectedTo);
@@ -829,12 +844,12 @@ var WebSocketClientTransport = class extends ClientTransport {
829
844
  /**
830
845
  * Creates a new WebSocketClientTransport instance.
831
846
  * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.
832
- * @param sessionId The ID of the client using the transport. This should be unique per session.
847
+ * @param clientId The ID of the client using the transport. This should be unique per session.
833
848
  * @param serverId The ID of the server this transport is connecting to.
834
849
  * @param providedOptions An optional object containing configuration options for the transport.
835
850
  */
836
- constructor(wsGetter, sessionId, serverId, providedOptions) {
837
- super(sessionId, providedOptions);
851
+ constructor(wsGetter, clientId, serverId, providedOptions) {
852
+ super(clientId, serverId, providedOptions);
838
853
  this.wsGetter = wsGetter;
839
854
  this.serverId = serverId;
840
855
  void this.connect(this.serverId);
@@ -1,6 +1,6 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1afc5580.js';
3
- import { W as WebSocketConnection } from '../../../connection-4a839b9a.js';
2
+ import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-21c1b21d.js';
3
+ import { W as WebSocketConnection } from '../../../connection-ab681c08.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
 
@@ -18,11 +18,11 @@ declare class WebSocketClientTransport extends ClientTransport<WebSocketConnecti
18
18
  /**
19
19
  * Creates a new WebSocketClientTransport instance.
20
20
  * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.
21
- * @param sessionId The ID of the client using the transport. This should be unique per session.
21
+ * @param clientId The ID of the client using the transport. This should be unique per session.
22
22
  * @param serverId The ID of the server this transport is connecting to.
23
23
  * @param providedOptions An optional object containing configuration options for the transport.
24
24
  */
25
- constructor(wsGetter: () => Promise<WebSocket>, sessionId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>);
25
+ constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>);
26
26
  reopen(): void;
27
27
  createNewOutgoingConnection(to: string): Promise<WebSocketConnection>;
28
28
  }
@@ -1,6 +1,6 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1afc5580.js';
3
- import { W as WebSocketConnection } from '../../../connection-4a839b9a.js';
2
+ import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-21c1b21d.js';
3
+ import { W as WebSocketConnection } from '../../../connection-ab681c08.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
 
@@ -18,11 +18,11 @@ declare class WebSocketClientTransport extends ClientTransport<WebSocketConnecti
18
18
  /**
19
19
  * Creates a new WebSocketClientTransport instance.
20
20
  * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.
21
- * @param sessionId The ID of the client using the transport. This should be unique per session.
21
+ * @param clientId The ID of the client using the transport. This should be unique per session.
22
22
  * @param serverId The ID of the server this transport is connecting to.
23
23
  * @param providedOptions An optional object containing configuration options for the transport.
24
24
  */
25
- constructor(wsGetter: () => Promise<WebSocket>, sessionId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>);
25
+ constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>);
26
26
  reopen(): void;
27
27
  createNewOutgoingConnection(to: string): Promise<WebSocketConnection>;
28
28
  }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-6OAKPO5R.js";
3
+ } from "../../../chunk-NPXAAD7M.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-2PKONGC3.js";
7
- import "../../../chunk-GZ7HCLLM.js";
8
- import "../../../chunk-XFFS4UOD.js";
6
+ } from "../../../chunk-R2IMXRVU.js";
7
+ import "../../../chunk-MGGIUH5O.js";
9
8
  import {
10
9
  log
11
10
  } from "../../../chunk-H4BYJELI.js";
11
+ import "../../../chunk-GZ7HCLLM.js";
12
12
 
13
13
  // transport/impls/ws/client.ts
14
14
  var WebSocketClientTransport = class extends ClientTransport {
@@ -20,12 +20,12 @@ var WebSocketClientTransport = class extends ClientTransport {
20
20
  /**
21
21
  * Creates a new WebSocketClientTransport instance.
22
22
  * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.
23
- * @param sessionId The ID of the client using the transport. This should be unique per session.
23
+ * @param clientId The ID of the client using the transport. This should be unique per session.
24
24
  * @param serverId The ID of the server this transport is connecting to.
25
25
  * @param providedOptions An optional object containing configuration options for the transport.
26
26
  */
27
- constructor(wsGetter, sessionId, serverId, providedOptions) {
28
- super(sessionId, providedOptions);
27
+ constructor(wsGetter, clientId, serverId, providedOptions) {
28
+ super(clientId, serverId, providedOptions);
29
29
  this.wsGetter = wsGetter;
30
30
  this.serverId = serverId;
31
31
  void this.connect(this.serverId);