@replit/river 0.15.1 → 0.15.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.
Files changed (35) hide show
  1. package/README.md +41 -22
  2. package/dist/{builder-660d3140.d.ts → builder-ebd945c0.d.ts} +1 -1
  3. package/dist/{chunk-O6YQ3JAH.js → chunk-B7VTDQR7.js} +147 -37
  4. package/dist/{chunk-MNWOTQWX.js → chunk-UJHTHOTT.js} +1 -1
  5. package/dist/{chunk-5TX4BKAD.js → chunk-ZRB6IKPV.js} +1 -1
  6. package/dist/{connection-162c0f7b.d.ts → connection-10a24478.d.ts} +1 -1
  7. package/dist/{connection-93daccc3.d.ts → connection-f4492948.d.ts} +1 -1
  8. package/dist/{index-76b801f8.d.ts → index-bbccacef.d.ts} +84 -11
  9. package/dist/router/index.d.cts +3 -3
  10. package/dist/router/index.d.ts +3 -3
  11. package/dist/transport/impls/uds/client.cjs +197 -88
  12. package/dist/transport/impls/uds/client.d.cts +3 -3
  13. package/dist/transport/impls/uds/client.d.ts +3 -3
  14. package/dist/transport/impls/uds/client.js +2 -2
  15. package/dist/transport/impls/uds/server.cjs +66 -69
  16. package/dist/transport/impls/uds/server.d.cts +3 -3
  17. package/dist/transport/impls/uds/server.d.ts +3 -3
  18. package/dist/transport/impls/uds/server.js +2 -2
  19. package/dist/transport/impls/ws/client.cjs +197 -90
  20. package/dist/transport/impls/ws/client.d.cts +3 -3
  21. package/dist/transport/impls/ws/client.d.ts +3 -3
  22. package/dist/transport/impls/ws/client.js +2 -2
  23. package/dist/transport/impls/ws/server.cjs +66 -69
  24. package/dist/transport/impls/ws/server.d.cts +3 -3
  25. package/dist/transport/impls/ws/server.d.ts +3 -3
  26. package/dist/transport/impls/ws/server.js +2 -2
  27. package/dist/transport/index.cjs +197 -90
  28. package/dist/transport/index.d.cts +1 -1
  29. package/dist/transport/index.d.ts +1 -1
  30. package/dist/transport/index.js +1 -1
  31. package/dist/util/testHelpers.cjs +61 -64
  32. package/dist/util/testHelpers.d.cts +10 -4
  33. package/dist/util/testHelpers.d.ts +10 -4
  34. package/dist/util/testHelpers.js +13 -5
  35. package/package.json +1 -1
@@ -100,58 +100,6 @@ function isAck(controlFlag) {
100
100
  return (controlFlag & 1 /* AckBit */) === 1 /* AckBit */;
101
101
  }
102
102
 
103
- // codec/json.ts
104
- var encoder = new TextEncoder();
105
- var decoder = new TextDecoder();
106
- function uint8ArrayToBase64(uint8Array) {
107
- let binary = "";
108
- uint8Array.forEach((byte) => {
109
- binary += String.fromCharCode(byte);
110
- });
111
- return btoa(binary);
112
- }
113
- function base64ToUint8Array(base64) {
114
- const binaryString = atob(base64);
115
- const uint8Array = new Uint8Array(binaryString.length);
116
- for (let i = 0; i < binaryString.length; i++) {
117
- uint8Array[i] = binaryString.charCodeAt(i);
118
- }
119
- return uint8Array;
120
- }
121
- var NaiveJsonCodec = {
122
- toBuffer: (obj) => {
123
- return encoder.encode(
124
- JSON.stringify(obj, function replacer(key) {
125
- const val = this[key];
126
- if (val instanceof Uint8Array) {
127
- return { $t: uint8ArrayToBase64(val) };
128
- } else {
129
- return val;
130
- }
131
- })
132
- );
133
- },
134
- fromBuffer: (buff) => {
135
- try {
136
- const parsed = JSON.parse(
137
- decoder.decode(buff),
138
- function reviver(_key, val) {
139
- if (val?.$t) {
140
- return base64ToUint8Array(val.$t);
141
- } else {
142
- return val;
143
- }
144
- }
145
- );
146
- if (typeof parsed === "object")
147
- return parsed;
148
- return null;
149
- } catch {
150
- return null;
151
- }
152
- }
153
- };
154
-
155
103
  // transport/session.ts
156
104
  var nanoid2 = (0, import_nanoid2.customAlphabet)("1234567890abcdefghijklmnopqrstuvxyz", 6);
157
105
  var unsafeId = () => nanoid2();
@@ -161,15 +109,6 @@ var Connection = class {
161
109
  this.debugId = `conn-${unsafeId()}`;
162
110
  }
163
111
  };
164
- var HEARTBEAT_INTERVAL_MS = 1e3;
165
- var HEARTBEATS_TILL_DEAD = 2;
166
- var SESSION_DISCONNECT_GRACE_MS = 5e3;
167
- var defaultSessionOptions = {
168
- heartbeatIntervalMs: HEARTBEAT_INTERVAL_MS,
169
- heartbeatsUntilDead: HEARTBEATS_TILL_DEAD,
170
- sessionDisconnectGraceMs: SESSION_DISCONNECT_GRACE_MS,
171
- codec: NaiveJsonCodec
172
- };
173
112
  var Session = class {
174
113
  codec;
175
114
  options;
@@ -493,14 +432,146 @@ function coerceErrorString(err) {
493
432
  return `[coerced to error] ${String(err)}`;
494
433
  }
495
434
 
435
+ // transport/rateLimit.ts
436
+ var LeakyBucketRateLimit = class {
437
+ budgetConsumed;
438
+ intervalHandles;
439
+ options;
440
+ constructor(options) {
441
+ this.options = options;
442
+ this.budgetConsumed = /* @__PURE__ */ new Map();
443
+ this.intervalHandles = /* @__PURE__ */ new Map();
444
+ }
445
+ getBackoffMs(user) {
446
+ if (!this.budgetConsumed.has(user))
447
+ return 0;
448
+ const exponent = Math.max(0, this.getBudgetConsumed(user) - 1);
449
+ const jitter = Math.floor(Math.random() * this.options.maxJitterMs);
450
+ const backoffMs = Math.min(
451
+ this.options.baseIntervalMs * 2 ** exponent,
452
+ this.options.maxBackoffMs
453
+ );
454
+ return backoffMs + jitter;
455
+ }
456
+ get totalBudgetRestoreTime() {
457
+ return this.options.budgetRestoreIntervalMs * this.options.attemptBudgetCapacity;
458
+ }
459
+ consumeBudget(user) {
460
+ this.stopLeak(user);
461
+ this.budgetConsumed.set(user, this.getBudgetConsumed(user) + 1);
462
+ }
463
+ getBudgetConsumed(user) {
464
+ return this.budgetConsumed.get(user) ?? 0;
465
+ }
466
+ hasBudget(user) {
467
+ return this.getBudgetConsumed(user) < this.options.attemptBudgetCapacity;
468
+ }
469
+ startRestoringBudget(user) {
470
+ if (this.intervalHandles.has(user)) {
471
+ return;
472
+ }
473
+ const restoreBudgetForUser = () => {
474
+ const currentBudget = this.budgetConsumed.get(user);
475
+ if (!currentBudget) {
476
+ this.stopLeak(user);
477
+ return;
478
+ }
479
+ const newBudget = currentBudget - 1;
480
+ if (newBudget === 0) {
481
+ this.budgetConsumed.delete(user);
482
+ return;
483
+ }
484
+ this.budgetConsumed.set(user, newBudget);
485
+ };
486
+ restoreBudgetForUser();
487
+ const intervalHandle = setInterval(
488
+ restoreBudgetForUser,
489
+ this.options.budgetRestoreIntervalMs
490
+ );
491
+ this.intervalHandles.set(user, intervalHandle);
492
+ }
493
+ stopLeak(user) {
494
+ if (!this.intervalHandles.has(user)) {
495
+ return;
496
+ }
497
+ clearInterval(this.intervalHandles.get(user));
498
+ this.intervalHandles.delete(user);
499
+ }
500
+ close() {
501
+ for (const user of this.intervalHandles.keys()) {
502
+ this.stopLeak(user);
503
+ }
504
+ }
505
+ };
506
+
507
+ // codec/json.ts
508
+ var encoder = new TextEncoder();
509
+ var decoder = new TextDecoder();
510
+ function uint8ArrayToBase64(uint8Array) {
511
+ let binary = "";
512
+ uint8Array.forEach((byte) => {
513
+ binary += String.fromCharCode(byte);
514
+ });
515
+ return btoa(binary);
516
+ }
517
+ function base64ToUint8Array(base64) {
518
+ const binaryString = atob(base64);
519
+ const uint8Array = new Uint8Array(binaryString.length);
520
+ for (let i = 0; i < binaryString.length; i++) {
521
+ uint8Array[i] = binaryString.charCodeAt(i);
522
+ }
523
+ return uint8Array;
524
+ }
525
+ var NaiveJsonCodec = {
526
+ toBuffer: (obj) => {
527
+ return encoder.encode(
528
+ JSON.stringify(obj, function replacer(key) {
529
+ const val = this[key];
530
+ if (val instanceof Uint8Array) {
531
+ return { $t: uint8ArrayToBase64(val) };
532
+ } else {
533
+ return val;
534
+ }
535
+ })
536
+ );
537
+ },
538
+ fromBuffer: (buff) => {
539
+ try {
540
+ const parsed = JSON.parse(
541
+ decoder.decode(buff),
542
+ function reviver(_key, val) {
543
+ if (val?.$t) {
544
+ return base64ToUint8Array(val.$t);
545
+ } else {
546
+ return val;
547
+ }
548
+ }
549
+ );
550
+ if (typeof parsed === "object")
551
+ return parsed;
552
+ return null;
553
+ } catch {
554
+ return null;
555
+ }
556
+ }
557
+ };
558
+
496
559
  // transport/transport.ts
497
- var RECONNECT_JITTER_MAX_MS = 500;
498
- var RECONNECT_INTERVAL_MS = 250;
499
560
  var defaultTransportOptions = {
500
- retryIntervalMs: RECONNECT_INTERVAL_MS,
501
- retryJitterMs: RECONNECT_JITTER_MAX_MS,
502
- retryAttemptsMax: 5,
503
- ...defaultSessionOptions
561
+ heartbeatIntervalMs: 1e3,
562
+ heartbeatsUntilDead: 2,
563
+ sessionDisconnectGraceMs: 5e3,
564
+ codec: NaiveJsonCodec
565
+ };
566
+ var defaultClientTransportOptions = {
567
+ connectionRetryOptions: {
568
+ baseIntervalMs: 250,
569
+ maxJitterMs: 200,
570
+ maxBackoffMs: 32e3,
571
+ attemptBudgetCapacity: 15,
572
+ budgetRestoreIntervalMs: 200
573
+ },
574
+ ...defaultTransportOptions
504
575
  };
505
576
  var Transport = class {
506
577
  /**
@@ -775,14 +846,26 @@ var Transport = class {
775
846
  }
776
847
  };
777
848
  var ClientTransport = class extends Transport {
849
+ /**
850
+ * The options for this transport.
851
+ */
852
+ options;
778
853
  /**
779
854
  * The map of reconnect promises for each client ID.
780
855
  */
781
856
  inflightConnectionPromises;
857
+ retryBudget;
782
858
  tryReconnecting = true;
783
859
  constructor(clientId, providedOptions) {
784
860
  super(clientId, providedOptions);
861
+ this.options = {
862
+ ...defaultClientTransportOptions,
863
+ ...providedOptions
864
+ };
785
865
  this.inflightConnectionPromises = /* @__PURE__ */ new Map();
866
+ this.retryBudget = new LeakyBucketRateLimit(
867
+ this.options.connectionRetryOptions
868
+ );
786
869
  }
787
870
  handleConnection(conn, to) {
788
871
  if (this.state !== "open")
@@ -813,7 +896,10 @@ var ClientTransport = class extends Transport {
813
896
  log?.info(
814
897
  `${this.clientId} -- connection (id: ${conn.debugId}) to ${to} disconnected`
815
898
  );
816
- void this.connect(to);
899
+ this.inflightConnectionPromises.delete(to);
900
+ if (this.tryReconnecting) {
901
+ void this.connect(to);
902
+ }
817
903
  });
818
904
  conn.addErrorListener((err) => {
819
905
  log?.warn(
@@ -864,41 +950,64 @@ var ClientTransport = class extends Transport {
864
950
  * Manually attempts to connect to a client.
865
951
  * @param to The client ID of the node to connect to.
866
952
  */
867
- async connect(to, attempt = 0) {
868
- if (this.state !== "open" || !this.tryReconnecting) {
953
+ async connect(to) {
954
+ const canProceedWithConnection = () => this.state === "open";
955
+ if (!canProceedWithConnection()) {
869
956
  log?.info(
870
- `${this.clientId} -- transport state is no longer open, not attempting connection`
957
+ `${this.clientId} -- transport state is no longer open, cancelling attempt to connect to ${to}`
871
958
  );
872
959
  return;
873
960
  }
874
961
  let reconnectPromise = this.inflightConnectionPromises.get(to);
875
962
  if (!reconnectPromise) {
876
- reconnectPromise = this.createNewOutgoingConnection(to).then((conn) => {
963
+ log?.info(`${this.clientId} -- attempting connection to ${to}`);
964
+ const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
965
+ if (!this.retryBudget.hasBudget(to)) {
966
+ const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
967
+ log?.warn(`${this.clientId} -- ${errMsg}`);
968
+ this.protocolError(ProtocolError.RetriesExceeded, errMsg);
969
+ return;
970
+ }
971
+ let sleep = Promise.resolve();
972
+ const backoffMs = this.retryBudget.getBackoffMs(to);
973
+ if (backoffMs > 0) {
974
+ sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
975
+ }
976
+ this.retryBudget.consumeBudget(to);
977
+ reconnectPromise = sleep.then(() => {
978
+ if (!canProceedWithConnection()) {
979
+ throw new Error("transport state is no longer open");
980
+ }
981
+ }).then(() => this.createNewOutgoingConnection(to)).then((conn) => {
982
+ if (!canProceedWithConnection()) {
983
+ log?.info(
984
+ `${this.clientId} -- transport state is no longer open, closing pre-handshake connection (id: ${conn.debugId}) to ${to}`
985
+ );
986
+ conn.close();
987
+ throw new Error("transport state is no longer open");
988
+ }
989
+ this.retryBudget.startRestoringBudget(to);
877
990
  this.sendHandshake(to, conn);
878
991
  return conn;
879
992
  });
880
993
  this.inflightConnectionPromises.set(to, reconnectPromise);
994
+ } else {
995
+ log?.info(
996
+ `${this.clientId} -- attempting connection to ${to} (reusing previous attempt)`
997
+ );
881
998
  }
882
999
  try {
883
1000
  await reconnectPromise;
884
1001
  } catch (error) {
885
- const errStr = coerceErrorString(error);
886
1002
  this.inflightConnectionPromises.delete(to);
887
- const shouldRetry = this.state === "open" && this.tryReconnecting;
888
- if (!shouldRetry)
889
- return;
890
- if (attempt >= this.options.retryAttemptsMax) {
891
- const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
892
- log?.error(`${this.clientId} -- ${errMsg}`);
893
- this.protocolError(ProtocolError.RetriesExceeded, errMsg);
894
- return;
1003
+ const errStr = coerceErrorString(error);
1004
+ if (!this.tryReconnecting || !canProceedWithConnection()) {
1005
+ log?.warn(`${this.clientId} -- connection to ${to} failed (${errStr})`);
895
1006
  } else {
896
- const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
897
- const backoffMs = this.options.retryIntervalMs * 2 ** attempt + jitter;
898
1007
  log?.warn(
899
- `${this.clientId} -- connection to ${to} failed (${errStr}), trying again in ${backoffMs}ms`
1008
+ `${this.clientId} -- connection to ${to} failed (${errStr}), retrying`
900
1009
  );
901
- setTimeout(() => void this.connect(to, attempt + 1), backoffMs);
1010
+ return this.connect(to);
902
1011
  }
903
1012
  }
904
1013
  }
@@ -911,9 +1020,9 @@ var ClientTransport = class extends Transport {
911
1020
  log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
912
1021
  conn.send(this.codec.toBuffer(requestMsg));
913
1022
  }
914
- onDisconnect(conn, session) {
915
- this.inflightConnectionPromises.delete(session.to);
916
- super.onDisconnect(conn, session);
1023
+ close() {
1024
+ this.retryBudget.close();
1025
+ super.close();
917
1026
  }
918
1027
  };
919
1028
 
@@ -1,5 +1,5 @@
1
- import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-76b801f8.js';
2
- import { U as UdsConnection } from '../../../connection-162c0f7b.js';
1
+ import { a as ClientTransport, c as ProvidedClientTransportOptions, b as TransportClientId } from '../../../index-bbccacef.js';
2
+ import { U as UdsConnection } from '../../../connection-10a24478.js';
3
3
  import '../../../types-3e5768ec.js';
4
4
  import '@sinclair/typebox';
5
5
  import 'node:net';
@@ -7,7 +7,7 @@ import 'node:stream';
7
7
 
8
8
  declare class UnixDomainSocketClientTransport extends ClientTransport<UdsConnection> {
9
9
  path: string;
10
- constructor(socketPath: string, clientId: string, providedOptions?: Partial<TransportOptions>);
10
+ constructor(socketPath: string, clientId: string, providedOptions?: ProvidedClientTransportOptions);
11
11
  createNewOutgoingConnection(to: TransportClientId): Promise<UdsConnection>;
12
12
  }
13
13
 
@@ -1,5 +1,5 @@
1
- import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-76b801f8.js';
2
- import { U as UdsConnection } from '../../../connection-162c0f7b.js';
1
+ import { a as ClientTransport, c as ProvidedClientTransportOptions, b as TransportClientId } from '../../../index-bbccacef.js';
2
+ import { U as UdsConnection } from '../../../connection-10a24478.js';
3
3
  import '../../../types-3e5768ec.js';
4
4
  import '@sinclair/typebox';
5
5
  import 'node:net';
@@ -7,7 +7,7 @@ import 'node:stream';
7
7
 
8
8
  declare class UnixDomainSocketClientTransport extends ClientTransport<UdsConnection> {
9
9
  path: string;
10
- constructor(socketPath: string, clientId: string, providedOptions?: Partial<TransportOptions>);
10
+ constructor(socketPath: string, clientId: string, providedOptions?: ProvidedClientTransportOptions);
11
11
  createNewOutgoingConnection(to: TransportClientId): Promise<UdsConnection>;
12
12
  }
13
13
 
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MNWOTQWX.js";
3
+ } from "../../../chunk-UJHTHOTT.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-O6YQ3JAH.js";
6
+ } from "../../../chunk-B7VTDQR7.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -142,60 +142,6 @@ var EventDispatcher = class {
142
142
 
143
143
  // transport/session.ts
144
144
  var import_nanoid2 = require("nanoid");
145
-
146
- // codec/json.ts
147
- var encoder = new TextEncoder();
148
- var decoder = new TextDecoder();
149
- function uint8ArrayToBase64(uint8Array) {
150
- let binary = "";
151
- uint8Array.forEach((byte) => {
152
- binary += String.fromCharCode(byte);
153
- });
154
- return btoa(binary);
155
- }
156
- function base64ToUint8Array(base64) {
157
- const binaryString = atob(base64);
158
- const uint8Array = new Uint8Array(binaryString.length);
159
- for (let i = 0; i < binaryString.length; i++) {
160
- uint8Array[i] = binaryString.charCodeAt(i);
161
- }
162
- return uint8Array;
163
- }
164
- var NaiveJsonCodec = {
165
- toBuffer: (obj) => {
166
- return encoder.encode(
167
- JSON.stringify(obj, function replacer(key) {
168
- const val = this[key];
169
- if (val instanceof Uint8Array) {
170
- return { $t: uint8ArrayToBase64(val) };
171
- } else {
172
- return val;
173
- }
174
- })
175
- );
176
- },
177
- fromBuffer: (buff) => {
178
- try {
179
- const parsed = JSON.parse(
180
- decoder.decode(buff),
181
- function reviver(_key, val) {
182
- if (val?.$t) {
183
- return base64ToUint8Array(val.$t);
184
- } else {
185
- return val;
186
- }
187
- }
188
- );
189
- if (typeof parsed === "object")
190
- return parsed;
191
- return null;
192
- } catch {
193
- return null;
194
- }
195
- }
196
- };
197
-
198
- // transport/session.ts
199
145
  var nanoid2 = (0, import_nanoid2.customAlphabet)("1234567890abcdefghijklmnopqrstuvxyz", 6);
200
146
  var unsafeId = () => nanoid2();
201
147
  var Connection = class {
@@ -204,15 +150,6 @@ var Connection = class {
204
150
  this.debugId = `conn-${unsafeId()}`;
205
151
  }
206
152
  };
207
- var HEARTBEAT_INTERVAL_MS = 1e3;
208
- var HEARTBEATS_TILL_DEAD = 2;
209
- var SESSION_DISCONNECT_GRACE_MS = 5e3;
210
- var defaultSessionOptions = {
211
- heartbeatIntervalMs: HEARTBEAT_INTERVAL_MS,
212
- heartbeatsUntilDead: HEARTBEATS_TILL_DEAD,
213
- sessionDisconnectGraceMs: SESSION_DISCONNECT_GRACE_MS,
214
- codec: NaiveJsonCodec
215
- };
216
153
  var Session = class {
217
154
  codec;
218
155
  options;
@@ -407,14 +344,74 @@ function coerceErrorString(err) {
407
344
  return `[coerced to error] ${String(err)}`;
408
345
  }
409
346
 
347
+ // codec/json.ts
348
+ var encoder = new TextEncoder();
349
+ var decoder = new TextDecoder();
350
+ function uint8ArrayToBase64(uint8Array) {
351
+ let binary = "";
352
+ uint8Array.forEach((byte) => {
353
+ binary += String.fromCharCode(byte);
354
+ });
355
+ return btoa(binary);
356
+ }
357
+ function base64ToUint8Array(base64) {
358
+ const binaryString = atob(base64);
359
+ const uint8Array = new Uint8Array(binaryString.length);
360
+ for (let i = 0; i < binaryString.length; i++) {
361
+ uint8Array[i] = binaryString.charCodeAt(i);
362
+ }
363
+ return uint8Array;
364
+ }
365
+ var NaiveJsonCodec = {
366
+ toBuffer: (obj) => {
367
+ return encoder.encode(
368
+ JSON.stringify(obj, function replacer(key) {
369
+ const val = this[key];
370
+ if (val instanceof Uint8Array) {
371
+ return { $t: uint8ArrayToBase64(val) };
372
+ } else {
373
+ return val;
374
+ }
375
+ })
376
+ );
377
+ },
378
+ fromBuffer: (buff) => {
379
+ try {
380
+ const parsed = JSON.parse(
381
+ decoder.decode(buff),
382
+ function reviver(_key, val) {
383
+ if (val?.$t) {
384
+ return base64ToUint8Array(val.$t);
385
+ } else {
386
+ return val;
387
+ }
388
+ }
389
+ );
390
+ if (typeof parsed === "object")
391
+ return parsed;
392
+ return null;
393
+ } catch {
394
+ return null;
395
+ }
396
+ }
397
+ };
398
+
410
399
  // transport/transport.ts
411
- var RECONNECT_JITTER_MAX_MS = 500;
412
- var RECONNECT_INTERVAL_MS = 250;
413
400
  var defaultTransportOptions = {
414
- retryIntervalMs: RECONNECT_INTERVAL_MS,
415
- retryJitterMs: RECONNECT_JITTER_MAX_MS,
416
- retryAttemptsMax: 5,
417
- ...defaultSessionOptions
401
+ heartbeatIntervalMs: 1e3,
402
+ heartbeatsUntilDead: 2,
403
+ sessionDisconnectGraceMs: 5e3,
404
+ codec: NaiveJsonCodec
405
+ };
406
+ var defaultClientTransportOptions = {
407
+ connectionRetryOptions: {
408
+ baseIntervalMs: 250,
409
+ maxJitterMs: 200,
410
+ maxBackoffMs: 32e3,
411
+ attemptBudgetCapacity: 15,
412
+ budgetRestoreIntervalMs: 200
413
+ },
414
+ ...defaultTransportOptions
418
415
  };
419
416
  var Transport = class {
420
417
  /**
@@ -1,13 +1,13 @@
1
1
  import { Server, Socket } from 'node:net';
2
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
- import { U as UdsConnection } from '../../../connection-162c0f7b.js';
2
+ import { S as ServerTransport, b as TransportClientId, d as ProvidedTransportOptions } from '../../../index-bbccacef.js';
3
+ import { U as UdsConnection } from '../../../connection-10a24478.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
  import 'node:stream';
7
7
 
8
8
  declare class UnixDomainSocketServerTransport extends ServerTransport<UdsConnection> {
9
9
  server: Server;
10
- constructor(server: Server, clientId: TransportClientId, providedOptions?: Partial<TransportOptions>);
10
+ constructor(server: Server, clientId: TransportClientId, providedOptions?: Partial<ProvidedTransportOptions>);
11
11
  connectionHandler: (sock: Socket) => void;
12
12
  close(): void;
13
13
  }
@@ -1,13 +1,13 @@
1
1
  import { Server, Socket } from 'node:net';
2
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
- import { U as UdsConnection } from '../../../connection-162c0f7b.js';
2
+ import { S as ServerTransport, b as TransportClientId, d as ProvidedTransportOptions } from '../../../index-bbccacef.js';
3
+ import { U as UdsConnection } from '../../../connection-10a24478.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
  import 'node:stream';
7
7
 
8
8
  declare class UnixDomainSocketServerTransport extends ServerTransport<UdsConnection> {
9
9
  server: Server;
10
- constructor(server: Server, clientId: TransportClientId, providedOptions?: Partial<TransportOptions>);
10
+ constructor(server: Server, clientId: TransportClientId, providedOptions?: Partial<ProvidedTransportOptions>);
11
11
  connectionHandler: (sock: Socket) => void;
12
12
  close(): void;
13
13
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MNWOTQWX.js";
3
+ } from "../../../chunk-UJHTHOTT.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-O6YQ3JAH.js";
6
+ } from "../../../chunk-B7VTDQR7.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log