@naylence/runtime 0.3.5-test.956 → 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.956
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.956';
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).
@@ -11096,8 +11105,15 @@ class UpstreamSessionManager extends TaskSpawner {
11096
11105
  if (!envelope) {
11097
11106
  continue;
11098
11107
  }
11108
+ logger$Z.debug('upstream_pump_sending_envelope', {
11109
+ envelopeId: envelope.id,
11110
+ type: envelope.frame?.type,
11111
+ });
11099
11112
  try {
11100
11113
  await connector.send(envelope);
11114
+ logger$Z.debug('upstream_pump_sent_envelope', {
11115
+ envelopeId: envelope.id,
11116
+ });
11101
11117
  }
11102
11118
  catch (error) {
11103
11119
  if (error instanceof FameMessageTooLarge) {
@@ -19955,6 +19971,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19955
19971
  // Browser WebSocket or Node.js ws client
19956
19972
  this._websocket.send(data);
19957
19973
  }
19974
+ logger$H.debug('websocket_sent_bytes', {
19975
+ byte_length: data.length,
19976
+ });
19958
19977
  }
19959
19978
  catch (error) {
19960
19979
  // Handle WebSocket disconnection errors
@@ -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.956
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.956';
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).
@@ -11094,8 +11103,15 @@ class UpstreamSessionManager extends TaskSpawner {
11094
11103
  if (!envelope) {
11095
11104
  continue;
11096
11105
  }
11106
+ logger$Z.debug('upstream_pump_sending_envelope', {
11107
+ envelopeId: envelope.id,
11108
+ type: envelope.frame?.type,
11109
+ });
11097
11110
  try {
11098
11111
  await connector.send(envelope);
11112
+ logger$Z.debug('upstream_pump_sent_envelope', {
11113
+ envelopeId: envelope.id,
11114
+ });
11099
11115
  }
11100
11116
  catch (error) {
11101
11117
  if (error instanceof FameMessageTooLarge) {
@@ -19953,6 +19969,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19953
19969
  // Browser WebSocket or Node.js ws client
19954
19970
  this._websocket.send(data);
19955
19971
  }
19972
+ logger$H.debug('websocket_sent_bytes', {
19973
+ byte_length: data.length,
19974
+ });
19956
19975
  }
19957
19976
  catch (error) {
19958
19977
  // Handle WebSocket disconnection errors
@@ -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).
@@ -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.956
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.956';
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).
@@ -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.956
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.956';
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.956
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.956';
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).
@@ -11012,8 +11021,15 @@ class UpstreamSessionManager extends TaskSpawner {
11012
11021
  if (!envelope) {
11013
11022
  continue;
11014
11023
  }
11024
+ logger$Z.debug('upstream_pump_sending_envelope', {
11025
+ envelopeId: envelope.id,
11026
+ type: envelope.frame?.type,
11027
+ });
11015
11028
  try {
11016
11029
  await connector.send(envelope);
11030
+ logger$Z.debug('upstream_pump_sent_envelope', {
11031
+ envelopeId: envelope.id,
11032
+ });
11017
11033
  }
11018
11034
  catch (error) {
11019
11035
  if (error instanceof FameMessageTooLarge) {
@@ -19871,6 +19887,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19871
19887
  // Browser WebSocket or Node.js ws client
19872
19888
  this._websocket.send(data);
19873
19889
  }
19890
+ logger$H.debug('websocket_sent_bytes', {
19891
+ byte_length: data.length,
19892
+ });
19874
19893
  }
19875
19894
  catch (error) {
19876
19895
  // Handle WebSocket disconnection errors
@@ -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.956
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.956';
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).
@@ -11011,8 +11020,15 @@ class UpstreamSessionManager extends TaskSpawner {
11011
11020
  if (!envelope) {
11012
11021
  continue;
11013
11022
  }
11023
+ logger$Z.debug('upstream_pump_sending_envelope', {
11024
+ envelopeId: envelope.id,
11025
+ type: envelope.frame?.type,
11026
+ });
11014
11027
  try {
11015
11028
  await connector.send(envelope);
11029
+ logger$Z.debug('upstream_pump_sent_envelope', {
11030
+ envelopeId: envelope.id,
11031
+ });
11016
11032
  }
11017
11033
  catch (error) {
11018
11034
  if (error instanceof FameMessageTooLarge) {
@@ -19870,6 +19886,9 @@ class WebSocketConnector extends BaseAsyncConnector {
19870
19886
  // Browser WebSocket or Node.js ws client
19871
19887
  this._websocket.send(data);
19872
19888
  }
19889
+ logger$H.debug('websocket_sent_bytes', {
19890
+ byte_length: data.length,
19891
+ });
19873
19892
  }
19874
19893
  catch (error) {
19875
19894
  // Handle WebSocket disconnection errors
@@ -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).
@@ -2780,6 +2789,9 @@ class WebSocketConnector extends BaseAsyncConnector {
2780
2789
  // Browser WebSocket or Node.js ws client
2781
2790
  this._websocket.send(data);
2782
2791
  }
2792
+ logger$1e.debug('websocket_sent_bytes', {
2793
+ byte_length: data.length,
2794
+ });
2783
2795
  }
2784
2796
  catch (error) {
2785
2797
  // Handle WebSocket disconnection errors
@@ -5516,12 +5528,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5516
5528
  }
5517
5529
 
5518
5530
  // This file is auto-generated during build - do not edit manually
5519
- // Generated from package.json version: 0.3.5-test.956
5531
+ // Generated from package.json version: 0.3.5-test.957
5520
5532
  /**
5521
5533
  * The package version, injected at build time.
5522
5534
  * @internal
5523
5535
  */
5524
- const VERSION = '0.3.5-test.956';
5536
+ const VERSION = '0.3.5-test.957';
5525
5537
 
5526
5538
  /**
5527
5539
  * Fame errors module - Fame protocol specific error classes
@@ -12704,8 +12716,15 @@ class UpstreamSessionManager extends TaskSpawner {
12704
12716
  if (!envelope) {
12705
12717
  continue;
12706
12718
  }
12719
+ logger$$.debug('upstream_pump_sending_envelope', {
12720
+ envelopeId: envelope.id,
12721
+ type: envelope.frame?.type,
12722
+ });
12707
12723
  try {
12708
12724
  await connector.send(envelope);
12725
+ logger$$.debug('upstream_pump_sent_envelope', {
12726
+ envelopeId: envelope.id,
12727
+ });
12709
12728
  }
12710
12729
  catch (error) {
12711
12730
  if (error instanceof FameMessageTooLarge) {
@@ -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).
@@ -2779,6 +2788,9 @@ class WebSocketConnector extends BaseAsyncConnector {
2779
2788
  // Browser WebSocket or Node.js ws client
2780
2789
  this._websocket.send(data);
2781
2790
  }
2791
+ logger$1e.debug('websocket_sent_bytes', {
2792
+ byte_length: data.length,
2793
+ });
2782
2794
  }
2783
2795
  catch (error) {
2784
2796
  // Handle WebSocket disconnection errors
@@ -5515,12 +5527,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5515
5527
  }
5516
5528
 
5517
5529
  // This file is auto-generated during build - do not edit manually
5518
- // Generated from package.json version: 0.3.5-test.956
5530
+ // Generated from package.json version: 0.3.5-test.957
5519
5531
  /**
5520
5532
  * The package version, injected at build time.
5521
5533
  * @internal
5522
5534
  */
5523
- const VERSION = '0.3.5-test.956';
5535
+ const VERSION = '0.3.5-test.957';
5524
5536
 
5525
5537
  /**
5526
5538
  * Fame errors module - Fame protocol specific error classes
@@ -12703,8 +12715,15 @@ class UpstreamSessionManager extends TaskSpawner {
12703
12715
  if (!envelope) {
12704
12716
  continue;
12705
12717
  }
12718
+ logger$$.debug('upstream_pump_sending_envelope', {
12719
+ envelopeId: envelope.id,
12720
+ type: envelope.frame?.type,
12721
+ });
12706
12722
  try {
12707
12723
  await connector.send(envelope);
12724
+ logger$$.debug('upstream_pump_sent_envelope', {
12725
+ envelopeId: envelope.id,
12726
+ });
12708
12727
  }
12709
12728
  catch (error) {
12710
12729
  if (error instanceof FameMessageTooLarge) {
@@ -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.956";
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.956",
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>",