@naylence/runtime 0.3.5-test.955 → 0.3.5-test.957

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.
@@ -98,12 +98,12 @@ installProcessEnvShim();
98
98
  // --- END ENV SHIM ---
99
99
 
100
100
  // This file is auto-generated during build - do not edit manually
101
- // Generated from package.json version: 0.3.5-test.955
101
+ // Generated from package.json version: 0.3.5-test.957
102
102
  /**
103
103
  * The package version, injected at build time.
104
104
  * @internal
105
105
  */
106
- const VERSION = '0.3.5-test.955';
106
+ const VERSION = '0.3.5-test.957';
107
107
 
108
108
  /**
109
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -2447,8 +2447,15 @@ class FlowController {
2447
2447
  // Create a notifier promise
2448
2448
  const notifierPromise = (async () => {
2449
2449
  try {
2450
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
2451
- await new Promise((resolve) => setImmediate(resolve));
2450
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
2451
+ await new Promise((resolve) => {
2452
+ if (typeof setImmediate === 'function') {
2453
+ setImmediate(resolve);
2454
+ }
2455
+ else {
2456
+ setTimeout(resolve, 0);
2457
+ }
2458
+ });
2452
2459
  condition.notifyAll();
2453
2460
  }
2454
2461
  finally {
@@ -2507,22 +2514,24 @@ class FlowController {
2507
2514
  current_balance: this.credits.get(flowId),
2508
2515
  });
2509
2516
  while (this.credits.get(flowId) <= 0) {
2510
- logger$1b.debug('flow_controller_waiting_for_credit', {
2517
+ logger$1b.debug('flow_controller_waiting_for_credits', {
2511
2518
  flow_id: flowId,
2519
+ current_balance: this.credits.get(flowId),
2512
2520
  });
2513
2521
  await condition.wait();
2514
- logger$1b.debug('flow_controller_woke_with_credit', {
2515
- flow_id: flowId,
2516
- balance_after_wake: this.credits.get(flowId),
2517
- });
2518
2522
  }
2519
- const current = this.credits.get(flowId);
2520
- this.credits.set(flowId, current - 1);
2521
- logger$1b.debug('flow_controller_credit_consumed', {
2523
+ const newBalance = this.credits.get(flowId) - 1;
2524
+ this.credits.set(flowId, newBalance);
2525
+ logger$1b.debug('flow_controller_acquire_success', {
2522
2526
  flow_id: flowId,
2523
- prev_balance: current,
2524
- remaining_balance: current - 1,
2527
+ new_balance: newBalance,
2525
2528
  });
2529
+ if (newBalance <= this.lowWatermark) {
2530
+ logger$1b.debug('flow_controller_acquire_below_low_watermark', {
2531
+ flow_id: flowId,
2532
+ low_watermark: this.lowWatermark,
2533
+ });
2534
+ }
2526
2535
  }
2527
2536
  /**
2528
2537
  * Consume *credits* immediately (non-blocking).
@@ -9419,10 +9428,12 @@ class BaseAsyncConnector extends TaskSpawner {
9419
9428
  throw new FameTransportClose('Connection closed', 1006);
9420
9429
  }
9421
9430
  // Apply flow control if enabled and not a credit update
9422
- if (this._fcEnabled &&
9423
- !(envelope.frame &&
9424
- 'flow_id' in envelope.frame &&
9425
- 'credits' in envelope.frame)) {
9431
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
9432
+ (envelope.frame.type === 'CreditUpdate' ||
9433
+ envelope.frame.type === 'credit_update' ||
9434
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
9435
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
9436
+ if (this._fcEnabled && !isCreditUpdateFrame) {
9426
9437
  const flowId = envelope.flowId || this._connectorFlowId;
9427
9438
  envelope.flowId = flowId;
9428
9439
  const t0 = this._metrics ? performance.now() : 0;
@@ -10008,8 +10019,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
10008
10019
  }
10009
10020
  }
10010
10021
  };
10011
- this.channel.addEventListener('message', this.onMsg);
10012
- this.listenerRegistered = true;
10022
+ if (!config.passive) {
10023
+ this.channel.addEventListener('message', this.onMsg);
10024
+ this.listenerRegistered = true;
10025
+ }
10013
10026
  // Setup visibility change monitoring
10014
10027
  this.visibilityChangeHandler = () => {
10015
10028
  const isHidden = document.hidden;
@@ -11092,8 +11105,15 @@ class UpstreamSessionManager extends TaskSpawner {
11092
11105
  if (!envelope) {
11093
11106
  continue;
11094
11107
  }
11108
+ logger$Z.debug('upstream_pump_sending_envelope', {
11109
+ envelopeId: envelope.id,
11110
+ type: envelope.frame?.type,
11111
+ });
11095
11112
  try {
11096
11113
  await connector.send(envelope);
11114
+ logger$Z.debug('upstream_pump_sent_envelope', {
11115
+ envelopeId: envelope.id,
11116
+ });
11097
11117
  }
11098
11118
  catch (error) {
11099
11119
  if (error instanceof FameMessageTooLarge) {
@@ -19951,6 +19971,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19951
19971
  // Browser WebSocket or Node.js ws client
19952
19972
  this._websocket.send(data);
19953
19973
  }
19974
+ logger$H.debug('websocket_sent_bytes', {
19975
+ byte_length: data.length,
19976
+ });
19954
19977
  }
19955
19978
  catch (error) {
19956
19979
  // Handle WebSocket disconnection errors
@@ -30028,6 +30051,7 @@ class BroadcastChannelListener extends TransportListener {
30028
30051
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30029
30052
  channelName: this._channelName,
30030
30053
  inboxCapacity: this._inboxCapacity,
30054
+ passive: true,
30031
30055
  };
30032
30056
  }
30033
30057
  try {
@@ -30088,6 +30112,7 @@ class BroadcastChannelListener extends TransportListener {
30088
30112
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30089
30113
  channelName: this._channelName,
30090
30114
  inboxCapacity: this._inboxCapacity,
30115
+ passive: true,
30091
30116
  };
30092
30117
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
30093
30118
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -96,12 +96,12 @@ installProcessEnvShim();
96
96
  // --- END ENV SHIM ---
97
97
 
98
98
  // This file is auto-generated during build - do not edit manually
99
- // Generated from package.json version: 0.3.5-test.955
99
+ // Generated from package.json version: 0.3.5-test.957
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.5-test.955';
104
+ const VERSION = '0.3.5-test.957';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -2445,8 +2445,15 @@ class FlowController {
2445
2445
  // Create a notifier promise
2446
2446
  const notifierPromise = (async () => {
2447
2447
  try {
2448
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
2449
- await new Promise((resolve) => setImmediate(resolve));
2448
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
2449
+ await new Promise((resolve) => {
2450
+ if (typeof setImmediate === 'function') {
2451
+ setImmediate(resolve);
2452
+ }
2453
+ else {
2454
+ setTimeout(resolve, 0);
2455
+ }
2456
+ });
2450
2457
  condition.notifyAll();
2451
2458
  }
2452
2459
  finally {
@@ -2505,22 +2512,24 @@ class FlowController {
2505
2512
  current_balance: this.credits.get(flowId),
2506
2513
  });
2507
2514
  while (this.credits.get(flowId) <= 0) {
2508
- logger$1b.debug('flow_controller_waiting_for_credit', {
2515
+ logger$1b.debug('flow_controller_waiting_for_credits', {
2509
2516
  flow_id: flowId,
2517
+ current_balance: this.credits.get(flowId),
2510
2518
  });
2511
2519
  await condition.wait();
2512
- logger$1b.debug('flow_controller_woke_with_credit', {
2513
- flow_id: flowId,
2514
- balance_after_wake: this.credits.get(flowId),
2515
- });
2516
2520
  }
2517
- const current = this.credits.get(flowId);
2518
- this.credits.set(flowId, current - 1);
2519
- logger$1b.debug('flow_controller_credit_consumed', {
2521
+ const newBalance = this.credits.get(flowId) - 1;
2522
+ this.credits.set(flowId, newBalance);
2523
+ logger$1b.debug('flow_controller_acquire_success', {
2520
2524
  flow_id: flowId,
2521
- prev_balance: current,
2522
- remaining_balance: current - 1,
2525
+ new_balance: newBalance,
2523
2526
  });
2527
+ if (newBalance <= this.lowWatermark) {
2528
+ logger$1b.debug('flow_controller_acquire_below_low_watermark', {
2529
+ flow_id: flowId,
2530
+ low_watermark: this.lowWatermark,
2531
+ });
2532
+ }
2524
2533
  }
2525
2534
  /**
2526
2535
  * Consume *credits* immediately (non-blocking).
@@ -9417,10 +9426,12 @@ class BaseAsyncConnector extends TaskSpawner {
9417
9426
  throw new FameTransportClose('Connection closed', 1006);
9418
9427
  }
9419
9428
  // Apply flow control if enabled and not a credit update
9420
- if (this._fcEnabled &&
9421
- !(envelope.frame &&
9422
- 'flow_id' in envelope.frame &&
9423
- 'credits' in envelope.frame)) {
9429
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
9430
+ (envelope.frame.type === 'CreditUpdate' ||
9431
+ envelope.frame.type === 'credit_update' ||
9432
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
9433
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
9434
+ if (this._fcEnabled && !isCreditUpdateFrame) {
9424
9435
  const flowId = envelope.flowId || this._connectorFlowId;
9425
9436
  envelope.flowId = flowId;
9426
9437
  const t0 = this._metrics ? performance.now() : 0;
@@ -10006,8 +10017,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
10006
10017
  }
10007
10018
  }
10008
10019
  };
10009
- this.channel.addEventListener('message', this.onMsg);
10010
- this.listenerRegistered = true;
10020
+ if (!config.passive) {
10021
+ this.channel.addEventListener('message', this.onMsg);
10022
+ this.listenerRegistered = true;
10023
+ }
10011
10024
  // Setup visibility change monitoring
10012
10025
  this.visibilityChangeHandler = () => {
10013
10026
  const isHidden = document.hidden;
@@ -11090,8 +11103,15 @@ class UpstreamSessionManager extends TaskSpawner {
11090
11103
  if (!envelope) {
11091
11104
  continue;
11092
11105
  }
11106
+ logger$Z.debug('upstream_pump_sending_envelope', {
11107
+ envelopeId: envelope.id,
11108
+ type: envelope.frame?.type,
11109
+ });
11093
11110
  try {
11094
11111
  await connector.send(envelope);
11112
+ logger$Z.debug('upstream_pump_sent_envelope', {
11113
+ envelopeId: envelope.id,
11114
+ });
11095
11115
  }
11096
11116
  catch (error) {
11097
11117
  if (error instanceof FameMessageTooLarge) {
@@ -19949,6 +19969,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19949
19969
  // Browser WebSocket or Node.js ws client
19950
19970
  this._websocket.send(data);
19951
19971
  }
19972
+ logger$H.debug('websocket_sent_bytes', {
19973
+ byte_length: data.length,
19974
+ });
19952
19975
  }
19953
19976
  catch (error) {
19954
19977
  // Handle WebSocket disconnection errors
@@ -30026,6 +30049,7 @@ class BroadcastChannelListener extends TransportListener {
30026
30049
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30027
30050
  channelName: this._channelName,
30028
30051
  inboxCapacity: this._inboxCapacity,
30052
+ passive: true,
30029
30053
  };
30030
30054
  }
30031
30055
  try {
@@ -30086,6 +30110,7 @@ class BroadcastChannelListener extends TransportListener {
30086
30110
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30087
30111
  channelName: this._channelName,
30088
30112
  inboxCapacity: this._inboxCapacity,
30113
+ passive: true,
30089
30114
  };
30090
30115
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
30091
30116
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -118,8 +118,15 @@ class FlowController {
118
118
  // Create a notifier promise
119
119
  const notifierPromise = (async () => {
120
120
  try {
121
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
122
- await new Promise((resolve) => setImmediate(resolve));
121
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
122
+ await new Promise((resolve) => {
123
+ if (typeof setImmediate === 'function') {
124
+ setImmediate(resolve);
125
+ }
126
+ else {
127
+ setTimeout(resolve, 0);
128
+ }
129
+ });
123
130
  condition.notifyAll();
124
131
  }
125
132
  finally {
@@ -178,22 +185,24 @@ class FlowController {
178
185
  current_balance: this.credits.get(flowId),
179
186
  });
180
187
  while (this.credits.get(flowId) <= 0) {
181
- logger.debug('flow_controller_waiting_for_credit', {
188
+ logger.debug('flow_controller_waiting_for_credits', {
182
189
  flow_id: flowId,
190
+ current_balance: this.credits.get(flowId),
183
191
  });
184
192
  await condition.wait();
185
- logger.debug('flow_controller_woke_with_credit', {
186
- flow_id: flowId,
187
- balance_after_wake: this.credits.get(flowId),
188
- });
189
193
  }
190
- const current = this.credits.get(flowId);
191
- this.credits.set(flowId, current - 1);
192
- logger.debug('flow_controller_credit_consumed', {
194
+ const newBalance = this.credits.get(flowId) - 1;
195
+ this.credits.set(flowId, newBalance);
196
+ logger.debug('flow_controller_acquire_success', {
193
197
  flow_id: flowId,
194
- prev_balance: current,
195
- remaining_balance: current - 1,
198
+ new_balance: newBalance,
196
199
  });
200
+ if (newBalance <= this.lowWatermark) {
201
+ logger.debug('flow_controller_acquire_below_low_watermark', {
202
+ flow_id: flowId,
203
+ low_watermark: this.lowWatermark,
204
+ });
205
+ }
197
206
  }
198
207
  /**
199
208
  * Consume *credits* immediately (non-blocking).
@@ -261,10 +261,12 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
261
261
  throw new errors_js_1.FameTransportClose('Connection closed', 1006);
262
262
  }
263
263
  // Apply flow control if enabled and not a credit update
264
- if (this._fcEnabled &&
265
- !(envelope.frame &&
266
- 'flow_id' in envelope.frame &&
267
- 'credits' in envelope.frame)) {
264
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
265
+ (envelope.frame.type === 'CreditUpdate' ||
266
+ envelope.frame.type === 'credit_update' ||
267
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
268
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
269
+ if (this._fcEnabled && !isCreditUpdateFrame) {
268
270
  const flowId = envelope.flowId || this._connectorFlowId;
269
271
  envelope.flowId = flowId;
270
272
  const t0 = this._metrics ? performance.now() : 0;
@@ -160,8 +160,10 @@ class BroadcastChannelConnector extends base_async_connector_js_1.BaseAsyncConne
160
160
  }
161
161
  }
162
162
  };
163
- this.channel.addEventListener('message', this.onMsg);
164
- this.listenerRegistered = true;
163
+ if (!config.passive) {
164
+ this.channel.addEventListener('message', this.onMsg);
165
+ this.listenerRegistered = true;
166
+ }
165
167
  // Setup visibility change monitoring
166
168
  this.visibilityChangeHandler = () => {
167
169
  const isHidden = document.hidden;
@@ -342,6 +342,7 @@ class BroadcastChannelListener extends transport_listener_js_1.TransportListener
342
342
  type: broadcast_channel_connector_js_1.BROADCAST_CHANNEL_CONNECTOR_TYPE,
343
343
  channelName: this._channelName,
344
344
  inboxCapacity: this._inboxCapacity,
345
+ passive: true,
345
346
  };
346
347
  }
347
348
  try {
@@ -402,6 +403,7 @@ class BroadcastChannelListener extends transport_listener_js_1.TransportListener
402
403
  type: broadcast_channel_connector_js_1.BROADCAST_CHANNEL_CONNECTOR_TYPE,
403
404
  channelName: this._channelName,
404
405
  inboxCapacity: this._inboxCapacity,
406
+ passive: true,
405
407
  };
406
408
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
407
409
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -143,6 +143,9 @@ class WebSocketConnector extends base_async_connector_js_1.BaseAsyncConnector {
143
143
  // Browser WebSocket or Node.js ws client
144
144
  this._websocket.send(data);
145
145
  }
146
+ logger.debug('websocket_sent_bytes', {
147
+ byte_length: data.length,
148
+ });
146
149
  }
147
150
  catch (error) {
148
151
  // Handle WebSocket disconnection errors
@@ -601,8 +601,15 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
601
601
  if (!envelope) {
602
602
  continue;
603
603
  }
604
+ logger.debug('upstream_pump_sending_envelope', {
605
+ envelopeId: envelope.id,
606
+ type: envelope.frame?.type,
607
+ });
604
608
  try {
605
609
  await connector.send(envelope);
610
+ logger.debug('upstream_pump_sent_envelope', {
611
+ envelopeId: envelope.id,
612
+ });
606
613
  }
607
614
  catch (error) {
608
615
  if (error instanceof errors_js_1.FameMessageTooLarge) {
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // This file is auto-generated during build - do not edit manually
3
- // Generated from package.json version: 0.3.5-test.955
3
+ // Generated from package.json version: 0.3.5-test.957
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.VERSION = void 0;
6
6
  /**
7
7
  * The package version, injected at build time.
8
8
  * @internal
9
9
  */
10
- exports.VERSION = '0.3.5-test.955';
10
+ exports.VERSION = '0.3.5-test.957';
@@ -115,8 +115,15 @@ export class FlowController {
115
115
  // Create a notifier promise
116
116
  const notifierPromise = (async () => {
117
117
  try {
118
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
119
- await new Promise((resolve) => setImmediate(resolve));
118
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
119
+ await new Promise((resolve) => {
120
+ if (typeof setImmediate === 'function') {
121
+ setImmediate(resolve);
122
+ }
123
+ else {
124
+ setTimeout(resolve, 0);
125
+ }
126
+ });
120
127
  condition.notifyAll();
121
128
  }
122
129
  finally {
@@ -175,22 +182,24 @@ export class FlowController {
175
182
  current_balance: this.credits.get(flowId),
176
183
  });
177
184
  while (this.credits.get(flowId) <= 0) {
178
- logger.debug('flow_controller_waiting_for_credit', {
185
+ logger.debug('flow_controller_waiting_for_credits', {
179
186
  flow_id: flowId,
187
+ current_balance: this.credits.get(flowId),
180
188
  });
181
189
  await condition.wait();
182
- logger.debug('flow_controller_woke_with_credit', {
183
- flow_id: flowId,
184
- balance_after_wake: this.credits.get(flowId),
185
- });
186
190
  }
187
- const current = this.credits.get(flowId);
188
- this.credits.set(flowId, current - 1);
189
- logger.debug('flow_controller_credit_consumed', {
191
+ const newBalance = this.credits.get(flowId) - 1;
192
+ this.credits.set(flowId, newBalance);
193
+ logger.debug('flow_controller_acquire_success', {
190
194
  flow_id: flowId,
191
- prev_balance: current,
192
- remaining_balance: current - 1,
195
+ new_balance: newBalance,
193
196
  });
197
+ if (newBalance <= this.lowWatermark) {
198
+ logger.debug('flow_controller_acquire_below_low_watermark', {
199
+ flow_id: flowId,
200
+ low_watermark: this.lowWatermark,
201
+ });
202
+ }
194
203
  }
195
204
  /**
196
205
  * Consume *credits* immediately (non-blocking).
@@ -257,10 +257,12 @@ export class BaseAsyncConnector extends TaskSpawner {
257
257
  throw new FameTransportClose('Connection closed', 1006);
258
258
  }
259
259
  // Apply flow control if enabled and not a credit update
260
- if (this._fcEnabled &&
261
- !(envelope.frame &&
262
- 'flow_id' in envelope.frame &&
263
- 'credits' in envelope.frame)) {
260
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
261
+ (envelope.frame.type === 'CreditUpdate' ||
262
+ envelope.frame.type === 'credit_update' ||
263
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
264
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
265
+ if (this._fcEnabled && !isCreditUpdateFrame) {
264
266
  const flowId = envelope.flowId || this._connectorFlowId;
265
267
  envelope.flowId = flowId;
266
268
  const t0 = this._metrics ? performance.now() : 0;
@@ -157,8 +157,10 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
157
157
  }
158
158
  }
159
159
  };
160
- this.channel.addEventListener('message', this.onMsg);
161
- this.listenerRegistered = true;
160
+ if (!config.passive) {
161
+ this.channel.addEventListener('message', this.onMsg);
162
+ this.listenerRegistered = true;
163
+ }
162
164
  // Setup visibility change monitoring
163
165
  this.visibilityChangeHandler = () => {
164
166
  const isHidden = document.hidden;
@@ -338,6 +338,7 @@ export class BroadcastChannelListener extends TransportListener {
338
338
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
339
339
  channelName: this._channelName,
340
340
  inboxCapacity: this._inboxCapacity,
341
+ passive: true,
341
342
  };
342
343
  }
343
344
  try {
@@ -398,6 +399,7 @@ export class BroadcastChannelListener extends TransportListener {
398
399
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
399
400
  channelName: this._channelName,
400
401
  inboxCapacity: this._inboxCapacity,
402
+ passive: true,
401
403
  };
402
404
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
403
405
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -140,6 +140,9 @@ export class WebSocketConnector extends BaseAsyncConnector {
140
140
  // Browser WebSocket or Node.js ws client
141
141
  this._websocket.send(data);
142
142
  }
143
+ logger.debug('websocket_sent_bytes', {
144
+ byte_length: data.length,
145
+ });
143
146
  }
144
147
  catch (error) {
145
148
  // Handle WebSocket disconnection errors
@@ -598,8 +598,15 @@ export class UpstreamSessionManager extends TaskSpawner {
598
598
  if (!envelope) {
599
599
  continue;
600
600
  }
601
+ logger.debug('upstream_pump_sending_envelope', {
602
+ envelopeId: envelope.id,
603
+ type: envelope.frame?.type,
604
+ });
601
605
  try {
602
606
  await connector.send(envelope);
607
+ logger.debug('upstream_pump_sent_envelope', {
608
+ envelopeId: envelope.id,
609
+ });
603
610
  }
604
611
  catch (error) {
605
612
  if (error instanceof FameMessageTooLarge) {
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated during build - do not edit manually
2
- // Generated from package.json version: 0.3.5-test.955
2
+ // Generated from package.json version: 0.3.5-test.957
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.5-test.955';
7
+ export const VERSION = '0.3.5-test.957';
@@ -14,12 +14,12 @@ var fastify = require('fastify');
14
14
  var websocketPlugin = require('@fastify/websocket');
15
15
 
16
16
  // This file is auto-generated during build - do not edit manually
17
- // Generated from package.json version: 0.3.5-test.955
17
+ // Generated from package.json version: 0.3.5-test.957
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.5-test.955';
22
+ const VERSION = '0.3.5-test.957';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -2363,8 +2363,15 @@ class FlowController {
2363
2363
  // Create a notifier promise
2364
2364
  const notifierPromise = (async () => {
2365
2365
  try {
2366
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
2367
- await new Promise((resolve) => setImmediate(resolve));
2366
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
2367
+ await new Promise((resolve) => {
2368
+ if (typeof setImmediate === 'function') {
2369
+ setImmediate(resolve);
2370
+ }
2371
+ else {
2372
+ setTimeout(resolve, 0);
2373
+ }
2374
+ });
2368
2375
  condition.notifyAll();
2369
2376
  }
2370
2377
  finally {
@@ -2423,22 +2430,24 @@ class FlowController {
2423
2430
  current_balance: this.credits.get(flowId),
2424
2431
  });
2425
2432
  while (this.credits.get(flowId) <= 0) {
2426
- logger$1b.debug('flow_controller_waiting_for_credit', {
2433
+ logger$1b.debug('flow_controller_waiting_for_credits', {
2427
2434
  flow_id: flowId,
2435
+ current_balance: this.credits.get(flowId),
2428
2436
  });
2429
2437
  await condition.wait();
2430
- logger$1b.debug('flow_controller_woke_with_credit', {
2431
- flow_id: flowId,
2432
- balance_after_wake: this.credits.get(flowId),
2433
- });
2434
2438
  }
2435
- const current = this.credits.get(flowId);
2436
- this.credits.set(flowId, current - 1);
2437
- logger$1b.debug('flow_controller_credit_consumed', {
2439
+ const newBalance = this.credits.get(flowId) - 1;
2440
+ this.credits.set(flowId, newBalance);
2441
+ logger$1b.debug('flow_controller_acquire_success', {
2438
2442
  flow_id: flowId,
2439
- prev_balance: current,
2440
- remaining_balance: current - 1,
2443
+ new_balance: newBalance,
2441
2444
  });
2445
+ if (newBalance <= this.lowWatermark) {
2446
+ logger$1b.debug('flow_controller_acquire_below_low_watermark', {
2447
+ flow_id: flowId,
2448
+ low_watermark: this.lowWatermark,
2449
+ });
2450
+ }
2442
2451
  }
2443
2452
  /**
2444
2453
  * Consume *credits* immediately (non-blocking).
@@ -9335,10 +9344,12 @@ class BaseAsyncConnector extends TaskSpawner {
9335
9344
  throw new FameTransportClose('Connection closed', 1006);
9336
9345
  }
9337
9346
  // Apply flow control if enabled and not a credit update
9338
- if (this._fcEnabled &&
9339
- !(envelope.frame &&
9340
- 'flow_id' in envelope.frame &&
9341
- 'credits' in envelope.frame)) {
9347
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
9348
+ (envelope.frame.type === 'CreditUpdate' ||
9349
+ envelope.frame.type === 'credit_update' ||
9350
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
9351
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
9352
+ if (this._fcEnabled && !isCreditUpdateFrame) {
9342
9353
  const flowId = envelope.flowId || this._connectorFlowId;
9343
9354
  envelope.flowId = flowId;
9344
9355
  const t0 = this._metrics ? performance.now() : 0;
@@ -9924,8 +9935,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9924
9935
  }
9925
9936
  }
9926
9937
  };
9927
- this.channel.addEventListener('message', this.onMsg);
9928
- this.listenerRegistered = true;
9938
+ if (!config.passive) {
9939
+ this.channel.addEventListener('message', this.onMsg);
9940
+ this.listenerRegistered = true;
9941
+ }
9929
9942
  // Setup visibility change monitoring
9930
9943
  this.visibilityChangeHandler = () => {
9931
9944
  const isHidden = document.hidden;
@@ -11008,8 +11021,15 @@ class UpstreamSessionManager extends TaskSpawner {
11008
11021
  if (!envelope) {
11009
11022
  continue;
11010
11023
  }
11024
+ logger$Z.debug('upstream_pump_sending_envelope', {
11025
+ envelopeId: envelope.id,
11026
+ type: envelope.frame?.type,
11027
+ });
11011
11028
  try {
11012
11029
  await connector.send(envelope);
11030
+ logger$Z.debug('upstream_pump_sent_envelope', {
11031
+ envelopeId: envelope.id,
11032
+ });
11013
11033
  }
11014
11034
  catch (error) {
11015
11035
  if (error instanceof FameMessageTooLarge) {
@@ -19867,6 +19887,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19867
19887
  // Browser WebSocket or Node.js ws client
19868
19888
  this._websocket.send(data);
19869
19889
  }
19890
+ logger$H.debug('websocket_sent_bytes', {
19891
+ byte_length: data.length,
19892
+ });
19870
19893
  }
19871
19894
  catch (error) {
19872
19895
  // Handle WebSocket disconnection errors
@@ -36256,6 +36279,7 @@ class BroadcastChannelListener extends TransportListener {
36256
36279
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
36257
36280
  channelName: this._channelName,
36258
36281
  inboxCapacity: this._inboxCapacity,
36282
+ passive: true,
36259
36283
  };
36260
36284
  }
36261
36285
  try {
@@ -36316,6 +36340,7 @@ class BroadcastChannelListener extends TransportListener {
36316
36340
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
36317
36341
  channelName: this._channelName,
36318
36342
  inboxCapacity: this._inboxCapacity,
36343
+ passive: true,
36319
36344
  };
36320
36345
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
36321
36346
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -13,12 +13,12 @@ import fastify from 'fastify';
13
13
  import websocketPlugin from '@fastify/websocket';
14
14
 
15
15
  // This file is auto-generated during build - do not edit manually
16
- // Generated from package.json version: 0.3.5-test.955
16
+ // Generated from package.json version: 0.3.5-test.957
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.5-test.955';
21
+ const VERSION = '0.3.5-test.957';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -2362,8 +2362,15 @@ class FlowController {
2362
2362
  // Create a notifier promise
2363
2363
  const notifierPromise = (async () => {
2364
2364
  try {
2365
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
2366
- await new Promise((resolve) => setImmediate(resolve));
2365
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
2366
+ await new Promise((resolve) => {
2367
+ if (typeof setImmediate === 'function') {
2368
+ setImmediate(resolve);
2369
+ }
2370
+ else {
2371
+ setTimeout(resolve, 0);
2372
+ }
2373
+ });
2367
2374
  condition.notifyAll();
2368
2375
  }
2369
2376
  finally {
@@ -2422,22 +2429,24 @@ class FlowController {
2422
2429
  current_balance: this.credits.get(flowId),
2423
2430
  });
2424
2431
  while (this.credits.get(flowId) <= 0) {
2425
- logger$1b.debug('flow_controller_waiting_for_credit', {
2432
+ logger$1b.debug('flow_controller_waiting_for_credits', {
2426
2433
  flow_id: flowId,
2434
+ current_balance: this.credits.get(flowId),
2427
2435
  });
2428
2436
  await condition.wait();
2429
- logger$1b.debug('flow_controller_woke_with_credit', {
2430
- flow_id: flowId,
2431
- balance_after_wake: this.credits.get(flowId),
2432
- });
2433
2437
  }
2434
- const current = this.credits.get(flowId);
2435
- this.credits.set(flowId, current - 1);
2436
- logger$1b.debug('flow_controller_credit_consumed', {
2438
+ const newBalance = this.credits.get(flowId) - 1;
2439
+ this.credits.set(flowId, newBalance);
2440
+ logger$1b.debug('flow_controller_acquire_success', {
2437
2441
  flow_id: flowId,
2438
- prev_balance: current,
2439
- remaining_balance: current - 1,
2442
+ new_balance: newBalance,
2440
2443
  });
2444
+ if (newBalance <= this.lowWatermark) {
2445
+ logger$1b.debug('flow_controller_acquire_below_low_watermark', {
2446
+ flow_id: flowId,
2447
+ low_watermark: this.lowWatermark,
2448
+ });
2449
+ }
2441
2450
  }
2442
2451
  /**
2443
2452
  * Consume *credits* immediately (non-blocking).
@@ -9334,10 +9343,12 @@ class BaseAsyncConnector extends TaskSpawner {
9334
9343
  throw new FameTransportClose('Connection closed', 1006);
9335
9344
  }
9336
9345
  // Apply flow control if enabled and not a credit update
9337
- if (this._fcEnabled &&
9338
- !(envelope.frame &&
9339
- 'flow_id' in envelope.frame &&
9340
- 'credits' in envelope.frame)) {
9346
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
9347
+ (envelope.frame.type === 'CreditUpdate' ||
9348
+ envelope.frame.type === 'credit_update' ||
9349
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
9350
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
9351
+ if (this._fcEnabled && !isCreditUpdateFrame) {
9341
9352
  const flowId = envelope.flowId || this._connectorFlowId;
9342
9353
  envelope.flowId = flowId;
9343
9354
  const t0 = this._metrics ? performance.now() : 0;
@@ -9923,8 +9934,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9923
9934
  }
9924
9935
  }
9925
9936
  };
9926
- this.channel.addEventListener('message', this.onMsg);
9927
- this.listenerRegistered = true;
9937
+ if (!config.passive) {
9938
+ this.channel.addEventListener('message', this.onMsg);
9939
+ this.listenerRegistered = true;
9940
+ }
9928
9941
  // Setup visibility change monitoring
9929
9942
  this.visibilityChangeHandler = () => {
9930
9943
  const isHidden = document.hidden;
@@ -11007,8 +11020,15 @@ class UpstreamSessionManager extends TaskSpawner {
11007
11020
  if (!envelope) {
11008
11021
  continue;
11009
11022
  }
11023
+ logger$Z.debug('upstream_pump_sending_envelope', {
11024
+ envelopeId: envelope.id,
11025
+ type: envelope.frame?.type,
11026
+ });
11010
11027
  try {
11011
11028
  await connector.send(envelope);
11029
+ logger$Z.debug('upstream_pump_sent_envelope', {
11030
+ envelopeId: envelope.id,
11031
+ });
11012
11032
  }
11013
11033
  catch (error) {
11014
11034
  if (error instanceof FameMessageTooLarge) {
@@ -19866,6 +19886,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19866
19886
  // Browser WebSocket or Node.js ws client
19867
19887
  this._websocket.send(data);
19868
19888
  }
19889
+ logger$H.debug('websocket_sent_bytes', {
19890
+ byte_length: data.length,
19891
+ });
19869
19892
  }
19870
19893
  catch (error) {
19871
19894
  // Handle WebSocket disconnection errors
@@ -36255,6 +36278,7 @@ class BroadcastChannelListener extends TransportListener {
36255
36278
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
36256
36279
  channelName: this._channelName,
36257
36280
  inboxCapacity: this._inboxCapacity,
36281
+ passive: true,
36258
36282
  };
36259
36283
  }
36260
36284
  try {
@@ -36315,6 +36339,7 @@ class BroadcastChannelListener extends TransportListener {
36315
36339
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
36316
36340
  channelName: this._channelName,
36317
36341
  inboxCapacity: this._inboxCapacity,
36342
+ passive: true,
36318
36343
  };
36319
36344
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
36320
36345
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -1277,8 +1277,15 @@ class FlowController {
1277
1277
  // Create a notifier promise
1278
1278
  const notifierPromise = (async () => {
1279
1279
  try {
1280
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
1281
- await new Promise((resolve) => setImmediate(resolve));
1280
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
1281
+ await new Promise((resolve) => {
1282
+ if (typeof setImmediate === 'function') {
1283
+ setImmediate(resolve);
1284
+ }
1285
+ else {
1286
+ setTimeout(resolve, 0);
1287
+ }
1288
+ });
1282
1289
  condition.notifyAll();
1283
1290
  }
1284
1291
  finally {
@@ -1337,22 +1344,24 @@ class FlowController {
1337
1344
  current_balance: this.credits.get(flowId),
1338
1345
  });
1339
1346
  while (this.credits.get(flowId) <= 0) {
1340
- logger$1g.debug('flow_controller_waiting_for_credit', {
1347
+ logger$1g.debug('flow_controller_waiting_for_credits', {
1341
1348
  flow_id: flowId,
1349
+ current_balance: this.credits.get(flowId),
1342
1350
  });
1343
1351
  await condition.wait();
1344
- logger$1g.debug('flow_controller_woke_with_credit', {
1345
- flow_id: flowId,
1346
- balance_after_wake: this.credits.get(flowId),
1347
- });
1348
1352
  }
1349
- const current = this.credits.get(flowId);
1350
- this.credits.set(flowId, current - 1);
1351
- logger$1g.debug('flow_controller_credit_consumed', {
1353
+ const newBalance = this.credits.get(flowId) - 1;
1354
+ this.credits.set(flowId, newBalance);
1355
+ logger$1g.debug('flow_controller_acquire_success', {
1352
1356
  flow_id: flowId,
1353
- prev_balance: current,
1354
- remaining_balance: current - 1,
1357
+ new_balance: newBalance,
1355
1358
  });
1359
+ if (newBalance <= this.lowWatermark) {
1360
+ logger$1g.debug('flow_controller_acquire_below_low_watermark', {
1361
+ flow_id: flowId,
1362
+ low_watermark: this.lowWatermark,
1363
+ });
1364
+ }
1356
1365
  }
1357
1366
  /**
1358
1367
  * Consume *credits* immediately (non-blocking).
@@ -2265,10 +2274,12 @@ class BaseAsyncConnector extends TaskSpawner {
2265
2274
  throw new FameTransportClose('Connection closed', 1006);
2266
2275
  }
2267
2276
  // Apply flow control if enabled and not a credit update
2268
- if (this._fcEnabled &&
2269
- !(envelope.frame &&
2270
- 'flow_id' in envelope.frame &&
2271
- 'credits' in envelope.frame)) {
2277
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
2278
+ (envelope.frame.type === 'CreditUpdate' ||
2279
+ envelope.frame.type === 'credit_update' ||
2280
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
2281
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
2282
+ if (this._fcEnabled && !isCreditUpdateFrame) {
2272
2283
  const flowId = envelope.flowId || this._connectorFlowId;
2273
2284
  envelope.flowId = flowId;
2274
2285
  const t0 = this._metrics ? performance.now() : 0;
@@ -2778,6 +2789,9 @@ class WebSocketConnector extends BaseAsyncConnector {
2778
2789
  // Browser WebSocket or Node.js ws client
2779
2790
  this._websocket.send(data);
2780
2791
  }
2792
+ logger$1e.debug('websocket_sent_bytes', {
2793
+ byte_length: data.length,
2794
+ });
2781
2795
  }
2782
2796
  catch (error) {
2783
2797
  // Handle WebSocket disconnection errors
@@ -5514,12 +5528,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5514
5528
  }
5515
5529
 
5516
5530
  // This file is auto-generated during build - do not edit manually
5517
- // Generated from package.json version: 0.3.5-test.955
5531
+ // Generated from package.json version: 0.3.5-test.957
5518
5532
  /**
5519
5533
  * The package version, injected at build time.
5520
5534
  * @internal
5521
5535
  */
5522
- const VERSION = '0.3.5-test.955';
5536
+ const VERSION = '0.3.5-test.957';
5523
5537
 
5524
5538
  /**
5525
5539
  * Fame errors module - Fame protocol specific error classes
@@ -11661,8 +11675,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11661
11675
  }
11662
11676
  }
11663
11677
  };
11664
- this.channel.addEventListener('message', this.onMsg);
11665
- this.listenerRegistered = true;
11678
+ if (!config.passive) {
11679
+ this.channel.addEventListener('message', this.onMsg);
11680
+ this.listenerRegistered = true;
11681
+ }
11666
11682
  // Setup visibility change monitoring
11667
11683
  this.visibilityChangeHandler = () => {
11668
11684
  const isHidden = document.hidden;
@@ -12700,8 +12716,15 @@ class UpstreamSessionManager extends TaskSpawner {
12700
12716
  if (!envelope) {
12701
12717
  continue;
12702
12718
  }
12719
+ logger$$.debug('upstream_pump_sending_envelope', {
12720
+ envelopeId: envelope.id,
12721
+ type: envelope.frame?.type,
12722
+ });
12703
12723
  try {
12704
12724
  await connector.send(envelope);
12725
+ logger$$.debug('upstream_pump_sent_envelope', {
12726
+ envelopeId: envelope.id,
12727
+ });
12705
12728
  }
12706
12729
  catch (error) {
12707
12730
  if (error instanceof FameMessageTooLarge) {
@@ -32769,6 +32792,7 @@ class BroadcastChannelListener extends TransportListener {
32769
32792
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
32770
32793
  channelName: this._channelName,
32771
32794
  inboxCapacity: this._inboxCapacity,
32795
+ passive: true,
32772
32796
  };
32773
32797
  }
32774
32798
  try {
@@ -32829,6 +32853,7 @@ class BroadcastChannelListener extends TransportListener {
32829
32853
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
32830
32854
  channelName: this._channelName,
32831
32855
  inboxCapacity: this._inboxCapacity,
32856
+ passive: true,
32832
32857
  };
32833
32858
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
32834
32859
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -1276,8 +1276,15 @@ class FlowController {
1276
1276
  // Create a notifier promise
1277
1277
  const notifierPromise = (async () => {
1278
1278
  try {
1279
- // Use setImmediate to defer to next tick (similar to asyncio scheduling)
1280
- await new Promise((resolve) => setImmediate(resolve));
1279
+ // Use setImmediate/setTimeout to defer to next tick (similar to asyncio scheduling)
1280
+ await new Promise((resolve) => {
1281
+ if (typeof setImmediate === 'function') {
1282
+ setImmediate(resolve);
1283
+ }
1284
+ else {
1285
+ setTimeout(resolve, 0);
1286
+ }
1287
+ });
1281
1288
  condition.notifyAll();
1282
1289
  }
1283
1290
  finally {
@@ -1336,22 +1343,24 @@ class FlowController {
1336
1343
  current_balance: this.credits.get(flowId),
1337
1344
  });
1338
1345
  while (this.credits.get(flowId) <= 0) {
1339
- logger$1g.debug('flow_controller_waiting_for_credit', {
1346
+ logger$1g.debug('flow_controller_waiting_for_credits', {
1340
1347
  flow_id: flowId,
1348
+ current_balance: this.credits.get(flowId),
1341
1349
  });
1342
1350
  await condition.wait();
1343
- logger$1g.debug('flow_controller_woke_with_credit', {
1344
- flow_id: flowId,
1345
- balance_after_wake: this.credits.get(flowId),
1346
- });
1347
1351
  }
1348
- const current = this.credits.get(flowId);
1349
- this.credits.set(flowId, current - 1);
1350
- logger$1g.debug('flow_controller_credit_consumed', {
1352
+ const newBalance = this.credits.get(flowId) - 1;
1353
+ this.credits.set(flowId, newBalance);
1354
+ logger$1g.debug('flow_controller_acquire_success', {
1351
1355
  flow_id: flowId,
1352
- prev_balance: current,
1353
- remaining_balance: current - 1,
1356
+ new_balance: newBalance,
1354
1357
  });
1358
+ if (newBalance <= this.lowWatermark) {
1359
+ logger$1g.debug('flow_controller_acquire_below_low_watermark', {
1360
+ flow_id: flowId,
1361
+ low_watermark: this.lowWatermark,
1362
+ });
1363
+ }
1355
1364
  }
1356
1365
  /**
1357
1366
  * Consume *credits* immediately (non-blocking).
@@ -2264,10 +2273,12 @@ class BaseAsyncConnector extends TaskSpawner {
2264
2273
  throw new FameTransportClose('Connection closed', 1006);
2265
2274
  }
2266
2275
  // Apply flow control if enabled and not a credit update
2267
- if (this._fcEnabled &&
2268
- !(envelope.frame &&
2269
- 'flow_id' in envelope.frame &&
2270
- 'credits' in envelope.frame)) {
2276
+ const isCreditUpdateFrame = Boolean(envelope.frame &&
2277
+ (envelope.frame.type === 'CreditUpdate' ||
2278
+ envelope.frame.type === 'credit_update' ||
2279
+ ('flowId' in envelope.frame && 'credits' in envelope.frame) ||
2280
+ ('flow_id' in envelope.frame && 'credits' in envelope.frame)));
2281
+ if (this._fcEnabled && !isCreditUpdateFrame) {
2271
2282
  const flowId = envelope.flowId || this._connectorFlowId;
2272
2283
  envelope.flowId = flowId;
2273
2284
  const t0 = this._metrics ? performance.now() : 0;
@@ -2777,6 +2788,9 @@ class WebSocketConnector extends BaseAsyncConnector {
2777
2788
  // Browser WebSocket or Node.js ws client
2778
2789
  this._websocket.send(data);
2779
2790
  }
2791
+ logger$1e.debug('websocket_sent_bytes', {
2792
+ byte_length: data.length,
2793
+ });
2780
2794
  }
2781
2795
  catch (error) {
2782
2796
  // Handle WebSocket disconnection errors
@@ -5513,12 +5527,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5513
5527
  }
5514
5528
 
5515
5529
  // This file is auto-generated during build - do not edit manually
5516
- // Generated from package.json version: 0.3.5-test.955
5530
+ // Generated from package.json version: 0.3.5-test.957
5517
5531
  /**
5518
5532
  * The package version, injected at build time.
5519
5533
  * @internal
5520
5534
  */
5521
- const VERSION = '0.3.5-test.955';
5535
+ const VERSION = '0.3.5-test.957';
5522
5536
 
5523
5537
  /**
5524
5538
  * Fame errors module - Fame protocol specific error classes
@@ -11660,8 +11674,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11660
11674
  }
11661
11675
  }
11662
11676
  };
11663
- this.channel.addEventListener('message', this.onMsg);
11664
- this.listenerRegistered = true;
11677
+ if (!config.passive) {
11678
+ this.channel.addEventListener('message', this.onMsg);
11679
+ this.listenerRegistered = true;
11680
+ }
11665
11681
  // Setup visibility change monitoring
11666
11682
  this.visibilityChangeHandler = () => {
11667
11683
  const isHidden = document.hidden;
@@ -12699,8 +12715,15 @@ class UpstreamSessionManager extends TaskSpawner {
12699
12715
  if (!envelope) {
12700
12716
  continue;
12701
12717
  }
12718
+ logger$$.debug('upstream_pump_sending_envelope', {
12719
+ envelopeId: envelope.id,
12720
+ type: envelope.frame?.type,
12721
+ });
12702
12722
  try {
12703
12723
  await connector.send(envelope);
12724
+ logger$$.debug('upstream_pump_sent_envelope', {
12725
+ envelopeId: envelope.id,
12726
+ });
12704
12727
  }
12705
12728
  catch (error) {
12706
12729
  if (error instanceof FameMessageTooLarge) {
@@ -32768,6 +32791,7 @@ class BroadcastChannelListener extends TransportListener {
32768
32791
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
32769
32792
  channelName: this._channelName,
32770
32793
  inboxCapacity: this._inboxCapacity,
32794
+ passive: true,
32771
32795
  };
32772
32796
  }
32773
32797
  try {
@@ -32828,6 +32852,7 @@ class BroadcastChannelListener extends TransportListener {
32828
32852
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
32829
32853
  channelName: this._channelName,
32830
32854
  inboxCapacity: this._inboxCapacity,
32855
+ passive: true,
32831
32856
  };
32832
32857
  const channelCandidate = candidate.channelName ?? candidate['channel_name'];
32833
32858
  if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
@@ -7,6 +7,7 @@ export interface BroadcastChannelConnectorConfig extends ConnectorConfig {
7
7
  channelName?: string;
8
8
  inboxCapacity?: number;
9
9
  initialWindow?: number;
10
+ passive?: boolean;
10
11
  }
11
12
  type BroadcastChannelInboxItem = Uint8Array | FameEnvelope | FameChannelMessage;
12
13
  export declare class BroadcastChannelConnector extends BaseAsyncConnector {
@@ -2,4 +2,4 @@
2
2
  * The package version, injected at build time.
3
3
  * @internal
4
4
  */
5
- export declare const VERSION = "0.3.5-test.955";
5
+ export declare const VERSION = "0.3.5-test.957";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.955",
3
+ "version": "0.3.5-test.957",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",