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

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.957
101
+ // Generated from package.json version: 0.3.5-test.959
102
102
  /**
103
103
  * The package version, injected at build time.
104
104
  * @internal
105
105
  */
106
- const VERSION = '0.3.5-test.957';
106
+ const VERSION = '0.3.5-test.959';
107
107
 
108
108
  /**
109
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9676,11 +9676,31 @@ class BaseAsyncConnector extends TaskSpawner {
9676
9676
  * Emit credit update if flow control needs refill
9677
9677
  */
9678
9678
  async _maybeEmitCredit(flowId, traceId) {
9679
- if (!this._flowCtrl.needsRefill(flowId)) {
9679
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
9680
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
9681
+ logger$$.debug('maybe_emit_credit_check', {
9682
+ connector_id: this._connectorFlowId,
9683
+ flow_id: flowId,
9684
+ trace_id: traceId ?? null,
9685
+ remaining_credits: remainingCredits,
9686
+ low_watermark: this._flowCtrl instanceof FlowController
9687
+ ? this._flowCtrl.lowWatermark
9688
+ : null,
9689
+ initial_window: this._initialWindow,
9690
+ needs_refill: needsRefill,
9691
+ });
9692
+ if (!needsRefill) {
9680
9693
  return;
9681
9694
  }
9682
9695
  const delta = this._initialWindow;
9683
9696
  this._flowCtrl.addCredits(flowId, delta);
9697
+ logger$$.debug('maybe_emit_credit_emit', {
9698
+ connector_id: this._connectorFlowId,
9699
+ flow_id: flowId,
9700
+ trace_id: traceId ?? null,
9701
+ emitted_credits: delta,
9702
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
9703
+ });
9684
9704
  const ackEnv = core.createFameEnvelope({
9685
9705
  ...(traceId && { traceId }),
9686
9706
  flowId,
@@ -9692,7 +9712,25 @@ class BaseAsyncConnector extends TaskSpawner {
9692
9712
  },
9693
9713
  flags: core.FlowFlags.ACK,
9694
9714
  });
9695
- await this.send(ackEnv);
9715
+ try {
9716
+ await this.send(ackEnv);
9717
+ logger$$.debug('maybe_emit_credit_sent', {
9718
+ connector_id: this._connectorFlowId,
9719
+ flow_id: flowId,
9720
+ trace_id: traceId ?? null,
9721
+ credits_acknowledged: delta,
9722
+ });
9723
+ }
9724
+ catch (error) {
9725
+ logger$$.error('maybe_emit_credit_send_failed', {
9726
+ connector_id: this._connectorFlowId,
9727
+ flow_id: flowId,
9728
+ trace_id: traceId ?? null,
9729
+ credits_attempted: delta,
9730
+ error: error instanceof Error ? error.message : String(error),
9731
+ });
9732
+ throw error;
9733
+ }
9696
9734
  }
9697
9735
  // ---------------------------------------------------------------------
9698
9736
  // Shutdown Management
@@ -19971,9 +20009,6 @@ class WebSocketConnector extends BaseAsyncConnector {
19971
20009
  // Browser WebSocket or Node.js ws client
19972
20010
  this._websocket.send(data);
19973
20011
  }
19974
- logger$H.debug('websocket_sent_bytes', {
19975
- byte_length: data.length,
19976
- });
19977
20012
  }
19978
20013
  catch (error) {
19979
20014
  // 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.957
99
+ // Generated from package.json version: 0.3.5-test.959
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.5-test.957';
104
+ const VERSION = '0.3.5-test.959';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9674,11 +9674,31 @@ class BaseAsyncConnector extends TaskSpawner {
9674
9674
  * Emit credit update if flow control needs refill
9675
9675
  */
9676
9676
  async _maybeEmitCredit(flowId, traceId) {
9677
- if (!this._flowCtrl.needsRefill(flowId)) {
9677
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
9678
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
9679
+ logger$$.debug('maybe_emit_credit_check', {
9680
+ connector_id: this._connectorFlowId,
9681
+ flow_id: flowId,
9682
+ trace_id: traceId ?? null,
9683
+ remaining_credits: remainingCredits,
9684
+ low_watermark: this._flowCtrl instanceof FlowController
9685
+ ? this._flowCtrl.lowWatermark
9686
+ : null,
9687
+ initial_window: this._initialWindow,
9688
+ needs_refill: needsRefill,
9689
+ });
9690
+ if (!needsRefill) {
9678
9691
  return;
9679
9692
  }
9680
9693
  const delta = this._initialWindow;
9681
9694
  this._flowCtrl.addCredits(flowId, delta);
9695
+ logger$$.debug('maybe_emit_credit_emit', {
9696
+ connector_id: this._connectorFlowId,
9697
+ flow_id: flowId,
9698
+ trace_id: traceId ?? null,
9699
+ emitted_credits: delta,
9700
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
9701
+ });
9682
9702
  const ackEnv = createFameEnvelope({
9683
9703
  ...(traceId && { traceId }),
9684
9704
  flowId,
@@ -9690,7 +9710,25 @@ class BaseAsyncConnector extends TaskSpawner {
9690
9710
  },
9691
9711
  flags: FlowFlags.ACK,
9692
9712
  });
9693
- await this.send(ackEnv);
9713
+ try {
9714
+ await this.send(ackEnv);
9715
+ logger$$.debug('maybe_emit_credit_sent', {
9716
+ connector_id: this._connectorFlowId,
9717
+ flow_id: flowId,
9718
+ trace_id: traceId ?? null,
9719
+ credits_acknowledged: delta,
9720
+ });
9721
+ }
9722
+ catch (error) {
9723
+ logger$$.error('maybe_emit_credit_send_failed', {
9724
+ connector_id: this._connectorFlowId,
9725
+ flow_id: flowId,
9726
+ trace_id: traceId ?? null,
9727
+ credits_attempted: delta,
9728
+ error: error instanceof Error ? error.message : String(error),
9729
+ });
9730
+ throw error;
9731
+ }
9694
9732
  }
9695
9733
  // ---------------------------------------------------------------------
9696
9734
  // Shutdown Management
@@ -19969,9 +20007,6 @@ class WebSocketConnector extends BaseAsyncConnector {
19969
20007
  // Browser WebSocket or Node.js ws client
19970
20008
  this._websocket.send(data);
19971
20009
  }
19972
- logger$H.debug('websocket_sent_bytes', {
19973
- byte_length: data.length,
19974
- });
19975
20010
  }
19976
20011
  catch (error) {
19977
20012
  // Handle WebSocket disconnection errors
@@ -509,11 +509,31 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
509
509
  * Emit credit update if flow control needs refill
510
510
  */
511
511
  async _maybeEmitCredit(flowId, traceId) {
512
- if (!this._flowCtrl.needsRefill(flowId)) {
512
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
513
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
514
+ logger.debug('maybe_emit_credit_check', {
515
+ connector_id: this._connectorFlowId,
516
+ flow_id: flowId,
517
+ trace_id: traceId ?? null,
518
+ remaining_credits: remainingCredits,
519
+ low_watermark: this._flowCtrl instanceof flow_controller_js_1.FlowController
520
+ ? this._flowCtrl.lowWatermark
521
+ : null,
522
+ initial_window: this._initialWindow,
523
+ needs_refill: needsRefill,
524
+ });
525
+ if (!needsRefill) {
513
526
  return;
514
527
  }
515
528
  const delta = this._initialWindow;
516
529
  this._flowCtrl.addCredits(flowId, delta);
530
+ logger.debug('maybe_emit_credit_emit', {
531
+ connector_id: this._connectorFlowId,
532
+ flow_id: flowId,
533
+ trace_id: traceId ?? null,
534
+ emitted_credits: delta,
535
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
536
+ });
517
537
  const ackEnv = (0, core_1.createFameEnvelope)({
518
538
  ...(traceId && { traceId }),
519
539
  flowId,
@@ -525,7 +545,25 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
525
545
  },
526
546
  flags: core_1.FlowFlags.ACK,
527
547
  });
528
- await this.send(ackEnv);
548
+ try {
549
+ await this.send(ackEnv);
550
+ logger.debug('maybe_emit_credit_sent', {
551
+ connector_id: this._connectorFlowId,
552
+ flow_id: flowId,
553
+ trace_id: traceId ?? null,
554
+ credits_acknowledged: delta,
555
+ });
556
+ }
557
+ catch (error) {
558
+ logger.error('maybe_emit_credit_send_failed', {
559
+ connector_id: this._connectorFlowId,
560
+ flow_id: flowId,
561
+ trace_id: traceId ?? null,
562
+ credits_attempted: delta,
563
+ error: error instanceof Error ? error.message : String(error),
564
+ });
565
+ throw error;
566
+ }
529
567
  }
530
568
  // ---------------------------------------------------------------------
531
569
  // Shutdown Management
@@ -143,9 +143,6 @@ 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
- });
149
146
  }
150
147
  catch (error) {
151
148
  // Handle WebSocket disconnection errors
@@ -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.957
3
+ // Generated from package.json version: 0.3.5-test.959
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.957';
10
+ exports.VERSION = '0.3.5-test.959';
@@ -505,11 +505,31 @@ export class BaseAsyncConnector extends TaskSpawner {
505
505
  * Emit credit update if flow control needs refill
506
506
  */
507
507
  async _maybeEmitCredit(flowId, traceId) {
508
- if (!this._flowCtrl.needsRefill(flowId)) {
508
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
509
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
510
+ logger.debug('maybe_emit_credit_check', {
511
+ connector_id: this._connectorFlowId,
512
+ flow_id: flowId,
513
+ trace_id: traceId ?? null,
514
+ remaining_credits: remainingCredits,
515
+ low_watermark: this._flowCtrl instanceof FlowController
516
+ ? this._flowCtrl.lowWatermark
517
+ : null,
518
+ initial_window: this._initialWindow,
519
+ needs_refill: needsRefill,
520
+ });
521
+ if (!needsRefill) {
509
522
  return;
510
523
  }
511
524
  const delta = this._initialWindow;
512
525
  this._flowCtrl.addCredits(flowId, delta);
526
+ logger.debug('maybe_emit_credit_emit', {
527
+ connector_id: this._connectorFlowId,
528
+ flow_id: flowId,
529
+ trace_id: traceId ?? null,
530
+ emitted_credits: delta,
531
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
532
+ });
513
533
  const ackEnv = createFameEnvelope({
514
534
  ...(traceId && { traceId }),
515
535
  flowId,
@@ -521,7 +541,25 @@ export class BaseAsyncConnector extends TaskSpawner {
521
541
  },
522
542
  flags: FlowFlags.ACK,
523
543
  });
524
- await this.send(ackEnv);
544
+ try {
545
+ await this.send(ackEnv);
546
+ logger.debug('maybe_emit_credit_sent', {
547
+ connector_id: this._connectorFlowId,
548
+ flow_id: flowId,
549
+ trace_id: traceId ?? null,
550
+ credits_acknowledged: delta,
551
+ });
552
+ }
553
+ catch (error) {
554
+ logger.error('maybe_emit_credit_send_failed', {
555
+ connector_id: this._connectorFlowId,
556
+ flow_id: flowId,
557
+ trace_id: traceId ?? null,
558
+ credits_attempted: delta,
559
+ error: error instanceof Error ? error.message : String(error),
560
+ });
561
+ throw error;
562
+ }
525
563
  }
526
564
  // ---------------------------------------------------------------------
527
565
  // Shutdown Management
@@ -140,9 +140,6 @@ 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
- });
146
143
  }
147
144
  catch (error) {
148
145
  // Handle WebSocket disconnection errors
@@ -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.957
2
+ // Generated from package.json version: 0.3.5-test.959
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.5-test.957';
7
+ export const VERSION = '0.3.5-test.959';
@@ -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.957
17
+ // Generated from package.json version: 0.3.5-test.959
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.5-test.957';
22
+ const VERSION = '0.3.5-test.959';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9592,11 +9592,31 @@ class BaseAsyncConnector extends TaskSpawner {
9592
9592
  * Emit credit update if flow control needs refill
9593
9593
  */
9594
9594
  async _maybeEmitCredit(flowId, traceId) {
9595
- if (!this._flowCtrl.needsRefill(flowId)) {
9595
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
9596
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
9597
+ logger$$.debug('maybe_emit_credit_check', {
9598
+ connector_id: this._connectorFlowId,
9599
+ flow_id: flowId,
9600
+ trace_id: traceId ?? null,
9601
+ remaining_credits: remainingCredits,
9602
+ low_watermark: this._flowCtrl instanceof FlowController
9603
+ ? this._flowCtrl.lowWatermark
9604
+ : null,
9605
+ initial_window: this._initialWindow,
9606
+ needs_refill: needsRefill,
9607
+ });
9608
+ if (!needsRefill) {
9596
9609
  return;
9597
9610
  }
9598
9611
  const delta = this._initialWindow;
9599
9612
  this._flowCtrl.addCredits(flowId, delta);
9613
+ logger$$.debug('maybe_emit_credit_emit', {
9614
+ connector_id: this._connectorFlowId,
9615
+ flow_id: flowId,
9616
+ trace_id: traceId ?? null,
9617
+ emitted_credits: delta,
9618
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
9619
+ });
9600
9620
  const ackEnv = core.createFameEnvelope({
9601
9621
  ...(traceId && { traceId }),
9602
9622
  flowId,
@@ -9608,7 +9628,25 @@ class BaseAsyncConnector extends TaskSpawner {
9608
9628
  },
9609
9629
  flags: core.FlowFlags.ACK,
9610
9630
  });
9611
- await this.send(ackEnv);
9631
+ try {
9632
+ await this.send(ackEnv);
9633
+ logger$$.debug('maybe_emit_credit_sent', {
9634
+ connector_id: this._connectorFlowId,
9635
+ flow_id: flowId,
9636
+ trace_id: traceId ?? null,
9637
+ credits_acknowledged: delta,
9638
+ });
9639
+ }
9640
+ catch (error) {
9641
+ logger$$.error('maybe_emit_credit_send_failed', {
9642
+ connector_id: this._connectorFlowId,
9643
+ flow_id: flowId,
9644
+ trace_id: traceId ?? null,
9645
+ credits_attempted: delta,
9646
+ error: error instanceof Error ? error.message : String(error),
9647
+ });
9648
+ throw error;
9649
+ }
9612
9650
  }
9613
9651
  // ---------------------------------------------------------------------
9614
9652
  // Shutdown Management
@@ -19887,9 +19925,6 @@ class WebSocketConnector extends BaseAsyncConnector {
19887
19925
  // Browser WebSocket or Node.js ws client
19888
19926
  this._websocket.send(data);
19889
19927
  }
19890
- logger$H.debug('websocket_sent_bytes', {
19891
- byte_length: data.length,
19892
- });
19893
19928
  }
19894
19929
  catch (error) {
19895
19930
  // 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.957
16
+ // Generated from package.json version: 0.3.5-test.959
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.5-test.957';
21
+ const VERSION = '0.3.5-test.959';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9591,11 +9591,31 @@ class BaseAsyncConnector extends TaskSpawner {
9591
9591
  * Emit credit update if flow control needs refill
9592
9592
  */
9593
9593
  async _maybeEmitCredit(flowId, traceId) {
9594
- if (!this._flowCtrl.needsRefill(flowId)) {
9594
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
9595
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
9596
+ logger$$.debug('maybe_emit_credit_check', {
9597
+ connector_id: this._connectorFlowId,
9598
+ flow_id: flowId,
9599
+ trace_id: traceId ?? null,
9600
+ remaining_credits: remainingCredits,
9601
+ low_watermark: this._flowCtrl instanceof FlowController
9602
+ ? this._flowCtrl.lowWatermark
9603
+ : null,
9604
+ initial_window: this._initialWindow,
9605
+ needs_refill: needsRefill,
9606
+ });
9607
+ if (!needsRefill) {
9595
9608
  return;
9596
9609
  }
9597
9610
  const delta = this._initialWindow;
9598
9611
  this._flowCtrl.addCredits(flowId, delta);
9612
+ logger$$.debug('maybe_emit_credit_emit', {
9613
+ connector_id: this._connectorFlowId,
9614
+ flow_id: flowId,
9615
+ trace_id: traceId ?? null,
9616
+ emitted_credits: delta,
9617
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
9618
+ });
9599
9619
  const ackEnv = createFameEnvelope({
9600
9620
  ...(traceId && { traceId }),
9601
9621
  flowId,
@@ -9607,7 +9627,25 @@ class BaseAsyncConnector extends TaskSpawner {
9607
9627
  },
9608
9628
  flags: FlowFlags.ACK,
9609
9629
  });
9610
- await this.send(ackEnv);
9630
+ try {
9631
+ await this.send(ackEnv);
9632
+ logger$$.debug('maybe_emit_credit_sent', {
9633
+ connector_id: this._connectorFlowId,
9634
+ flow_id: flowId,
9635
+ trace_id: traceId ?? null,
9636
+ credits_acknowledged: delta,
9637
+ });
9638
+ }
9639
+ catch (error) {
9640
+ logger$$.error('maybe_emit_credit_send_failed', {
9641
+ connector_id: this._connectorFlowId,
9642
+ flow_id: flowId,
9643
+ trace_id: traceId ?? null,
9644
+ credits_attempted: delta,
9645
+ error: error instanceof Error ? error.message : String(error),
9646
+ });
9647
+ throw error;
9648
+ }
9611
9649
  }
9612
9650
  // ---------------------------------------------------------------------
9613
9651
  // Shutdown Management
@@ -19886,9 +19924,6 @@ class WebSocketConnector extends BaseAsyncConnector {
19886
19924
  // Browser WebSocket or Node.js ws client
19887
19925
  this._websocket.send(data);
19888
19926
  }
19889
- logger$H.debug('websocket_sent_bytes', {
19890
- byte_length: data.length,
19891
- });
19892
19927
  }
19893
19928
  catch (error) {
19894
19929
  // Handle WebSocket disconnection errors
@@ -2522,11 +2522,31 @@ class BaseAsyncConnector extends TaskSpawner {
2522
2522
  * Emit credit update if flow control needs refill
2523
2523
  */
2524
2524
  async _maybeEmitCredit(flowId, traceId) {
2525
- if (!this._flowCtrl.needsRefill(flowId)) {
2525
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
2526
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
2527
+ logger$1f.debug('maybe_emit_credit_check', {
2528
+ connector_id: this._connectorFlowId,
2529
+ flow_id: flowId,
2530
+ trace_id: traceId ?? null,
2531
+ remaining_credits: remainingCredits,
2532
+ low_watermark: this._flowCtrl instanceof FlowController
2533
+ ? this._flowCtrl.lowWatermark
2534
+ : null,
2535
+ initial_window: this._initialWindow,
2536
+ needs_refill: needsRefill,
2537
+ });
2538
+ if (!needsRefill) {
2526
2539
  return;
2527
2540
  }
2528
2541
  const delta = this._initialWindow;
2529
2542
  this._flowCtrl.addCredits(flowId, delta);
2543
+ logger$1f.debug('maybe_emit_credit_emit', {
2544
+ connector_id: this._connectorFlowId,
2545
+ flow_id: flowId,
2546
+ trace_id: traceId ?? null,
2547
+ emitted_credits: delta,
2548
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
2549
+ });
2530
2550
  const ackEnv = core.createFameEnvelope({
2531
2551
  ...(traceId && { traceId }),
2532
2552
  flowId,
@@ -2538,7 +2558,25 @@ class BaseAsyncConnector extends TaskSpawner {
2538
2558
  },
2539
2559
  flags: core.FlowFlags.ACK,
2540
2560
  });
2541
- await this.send(ackEnv);
2561
+ try {
2562
+ await this.send(ackEnv);
2563
+ logger$1f.debug('maybe_emit_credit_sent', {
2564
+ connector_id: this._connectorFlowId,
2565
+ flow_id: flowId,
2566
+ trace_id: traceId ?? null,
2567
+ credits_acknowledged: delta,
2568
+ });
2569
+ }
2570
+ catch (error) {
2571
+ logger$1f.error('maybe_emit_credit_send_failed', {
2572
+ connector_id: this._connectorFlowId,
2573
+ flow_id: flowId,
2574
+ trace_id: traceId ?? null,
2575
+ credits_attempted: delta,
2576
+ error: error instanceof Error ? error.message : String(error),
2577
+ });
2578
+ throw error;
2579
+ }
2542
2580
  }
2543
2581
  // ---------------------------------------------------------------------
2544
2582
  // Shutdown Management
@@ -2789,9 +2827,6 @@ class WebSocketConnector extends BaseAsyncConnector {
2789
2827
  // Browser WebSocket or Node.js ws client
2790
2828
  this._websocket.send(data);
2791
2829
  }
2792
- logger$1e.debug('websocket_sent_bytes', {
2793
- byte_length: data.length,
2794
- });
2795
2830
  }
2796
2831
  catch (error) {
2797
2832
  // Handle WebSocket disconnection errors
@@ -5528,12 +5563,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5528
5563
  }
5529
5564
 
5530
5565
  // This file is auto-generated during build - do not edit manually
5531
- // Generated from package.json version: 0.3.5-test.957
5566
+ // Generated from package.json version: 0.3.5-test.959
5532
5567
  /**
5533
5568
  * The package version, injected at build time.
5534
5569
  * @internal
5535
5570
  */
5536
- const VERSION = '0.3.5-test.957';
5571
+ const VERSION = '0.3.5-test.959';
5537
5572
 
5538
5573
  /**
5539
5574
  * Fame errors module - Fame protocol specific error classes
@@ -2521,11 +2521,31 @@ class BaseAsyncConnector extends TaskSpawner {
2521
2521
  * Emit credit update if flow control needs refill
2522
2522
  */
2523
2523
  async _maybeEmitCredit(flowId, traceId) {
2524
- if (!this._flowCtrl.needsRefill(flowId)) {
2524
+ const remainingCredits = this._flowCtrl.getCredits(flowId);
2525
+ const needsRefill = this._flowCtrl.needsRefill(flowId);
2526
+ logger$1f.debug('maybe_emit_credit_check', {
2527
+ connector_id: this._connectorFlowId,
2528
+ flow_id: flowId,
2529
+ trace_id: traceId ?? null,
2530
+ remaining_credits: remainingCredits,
2531
+ low_watermark: this._flowCtrl instanceof FlowController
2532
+ ? this._flowCtrl.lowWatermark
2533
+ : null,
2534
+ initial_window: this._initialWindow,
2535
+ needs_refill: needsRefill,
2536
+ });
2537
+ if (!needsRefill) {
2525
2538
  return;
2526
2539
  }
2527
2540
  const delta = this._initialWindow;
2528
2541
  this._flowCtrl.addCredits(flowId, delta);
2542
+ logger$1f.debug('maybe_emit_credit_emit', {
2543
+ connector_id: this._connectorFlowId,
2544
+ flow_id: flowId,
2545
+ trace_id: traceId ?? null,
2546
+ emitted_credits: delta,
2547
+ post_emit_balance: this._flowCtrl.getCredits(flowId),
2548
+ });
2529
2549
  const ackEnv = createFameEnvelope({
2530
2550
  ...(traceId && { traceId }),
2531
2551
  flowId,
@@ -2537,7 +2557,25 @@ class BaseAsyncConnector extends TaskSpawner {
2537
2557
  },
2538
2558
  flags: FlowFlags.ACK,
2539
2559
  });
2540
- await this.send(ackEnv);
2560
+ try {
2561
+ await this.send(ackEnv);
2562
+ logger$1f.debug('maybe_emit_credit_sent', {
2563
+ connector_id: this._connectorFlowId,
2564
+ flow_id: flowId,
2565
+ trace_id: traceId ?? null,
2566
+ credits_acknowledged: delta,
2567
+ });
2568
+ }
2569
+ catch (error) {
2570
+ logger$1f.error('maybe_emit_credit_send_failed', {
2571
+ connector_id: this._connectorFlowId,
2572
+ flow_id: flowId,
2573
+ trace_id: traceId ?? null,
2574
+ credits_attempted: delta,
2575
+ error: error instanceof Error ? error.message : String(error),
2576
+ });
2577
+ throw error;
2578
+ }
2541
2579
  }
2542
2580
  // ---------------------------------------------------------------------
2543
2581
  // Shutdown Management
@@ -2788,9 +2826,6 @@ class WebSocketConnector extends BaseAsyncConnector {
2788
2826
  // Browser WebSocket or Node.js ws client
2789
2827
  this._websocket.send(data);
2790
2828
  }
2791
- logger$1e.debug('websocket_sent_bytes', {
2792
- byte_length: data.length,
2793
- });
2794
2829
  }
2795
2830
  catch (error) {
2796
2831
  // Handle WebSocket disconnection errors
@@ -5527,12 +5562,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5527
5562
  }
5528
5563
 
5529
5564
  // This file is auto-generated during build - do not edit manually
5530
- // Generated from package.json version: 0.3.5-test.957
5565
+ // Generated from package.json version: 0.3.5-test.959
5531
5566
  /**
5532
5567
  * The package version, injected at build time.
5533
5568
  * @internal
5534
5569
  */
5535
- const VERSION = '0.3.5-test.957';
5570
+ const VERSION = '0.3.5-test.959';
5536
5571
 
5537
5572
  /**
5538
5573
  * Fame errors module - Fame protocol specific error classes
@@ -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.957";
5
+ export declare const VERSION = "0.3.5-test.959";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.957",
3
+ "version": "0.3.5-test.959",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",