@naylence/runtime 0.3.5-test.933 → 0.3.5-test.934

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.933
101
+ // Generated from package.json version: 0.3.5-test.934
102
102
  /**
103
103
  * The package version, injected at build time.
104
104
  * @internal
105
105
  */
106
- const VERSION = '0.3.5-test.933';
106
+ const VERSION = '0.3.5-test.934';
107
107
 
108
108
  /**
109
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9270,6 +9270,10 @@ class BaseAsyncConnector extends TaskSpawner {
9270
9270
  * Stop the connector gracefully
9271
9271
  */
9272
9272
  async stop() {
9273
+ logger$$.debug('stopping_connector', {
9274
+ current_state: this._state,
9275
+ connector_id: this._connectorFlowId,
9276
+ });
9273
9277
  if (!core.ConnectorStateUtils.canStop(this._state)) {
9274
9278
  logger$$.debug('connector_stop_already_stopped', {
9275
9279
  current_state: this._state,
@@ -9282,6 +9286,10 @@ class BaseAsyncConnector extends TaskSpawner {
9282
9286
  if (this._lastError) {
9283
9287
  throw this._lastError;
9284
9288
  }
9289
+ logger$$.debug('connector_stopped', {
9290
+ current_state: this._state,
9291
+ connector_id: this._connectorFlowId,
9292
+ });
9285
9293
  }
9286
9294
  /**
9287
9295
  * Close the connector with optional code and reason
@@ -9612,8 +9620,21 @@ class BaseAsyncConnector extends TaskSpawner {
9612
9620
  */
9613
9621
  async _shutdown(code, reason, gracePeriod, exc) {
9614
9622
  if (this._closed) {
9623
+ logger$$.debug('shutdown_already_closed', {
9624
+ connector_id: this._connectorFlowId,
9625
+ current_state: this._state,
9626
+ });
9615
9627
  return;
9616
9628
  }
9629
+ logger$$.info('connector_shutdown_starting', {
9630
+ connector_id: this._connectorFlowId,
9631
+ connector_type: this.constructor.name,
9632
+ code,
9633
+ reason,
9634
+ current_state: this._state,
9635
+ has_error: !!exc,
9636
+ timestamp: new Date().toISOString(),
9637
+ });
9617
9638
  this._closed = true;
9618
9639
  this._closeCode = code;
9619
9640
  this._closeReason = reason;
@@ -9635,16 +9656,39 @@ class BaseAsyncConnector extends TaskSpawner {
9635
9656
  this._sendPromiseResolve = undefined;
9636
9657
  }
9637
9658
  // Close transport
9659
+ logger$$.info('connector_closing_transport', {
9660
+ connector_id: this._connectorFlowId,
9661
+ connector_type: this.constructor.name,
9662
+ timestamp: new Date().toISOString(),
9663
+ });
9638
9664
  await this._transportClose(code, reason);
9665
+ logger$$.info('connector_transport_closed', {
9666
+ connector_id: this._connectorFlowId,
9667
+ connector_type: this.constructor.name,
9668
+ timestamp: new Date().toISOString(),
9669
+ });
9639
9670
  // Shutdown spawned tasks
9671
+ logger$$.info('connector_shutting_down_tasks', {
9672
+ connector_id: this._connectorFlowId,
9673
+ connector_type: this.constructor.name,
9674
+ grace_period_ms: effectiveGracePeriod * 1000,
9675
+ join_timeout_ms: this._shutdownJoinTimeout,
9676
+ timestamp: new Date().toISOString(),
9677
+ });
9640
9678
  try {
9641
9679
  await this.shutdownTasks({
9642
9680
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
9643
9681
  joinTimeout: this._shutdownJoinTimeout,
9644
9682
  });
9683
+ logger$$.info('connector_tasks_shutdown_complete', {
9684
+ connector_id: this._connectorFlowId,
9685
+ connector_type: this.constructor.name,
9686
+ timestamp: new Date().toISOString(),
9687
+ });
9645
9688
  }
9646
9689
  catch (error) {
9647
9690
  logger$$.warning('task_shutdown_error', {
9691
+ connector_id: this._connectorFlowId,
9648
9692
  error: error instanceof Error ? error.message : String(error),
9649
9693
  });
9650
9694
  }
@@ -9656,6 +9700,12 @@ class BaseAsyncConnector extends TaskSpawner {
9656
9700
  if (this._closeResolver) {
9657
9701
  this._closeResolver();
9658
9702
  }
9703
+ logger$$.info('connector_shutdown_complete', {
9704
+ connector_id: this._connectorFlowId,
9705
+ connector_type: this.constructor.name,
9706
+ final_state: this._state,
9707
+ timestamp: new Date().toISOString(),
9708
+ });
9659
9709
  }
9660
9710
  /**
9661
9711
  * Close the underlying transport
@@ -9791,12 +9841,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9791
9841
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
9792
9842
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
9793
9843
  this.channel = new BroadcastChannel(this.channelName);
9794
- logger$_.debug('broadcast_channel_connector_initialized', {
9844
+ logger$_.info('broadcast_channel_connector_created', {
9795
9845
  channel: this.channelName,
9796
9846
  connector_id: this.connectorId,
9797
9847
  inbox_capacity: preferredCapacity,
9848
+ timestamp: new Date().toISOString(),
9798
9849
  });
9799
9850
  this.onMsg = (event) => {
9851
+ // Guard: Don't process if listener was unregistered
9852
+ if (!this.listenerRegistered) {
9853
+ logger$_.warning('broadcast_channel_message_after_unregister', {
9854
+ channel: this.channelName,
9855
+ connector_id: this.connectorId,
9856
+ timestamp: new Date().toISOString(),
9857
+ });
9858
+ return;
9859
+ }
9800
9860
  const message = event.data;
9801
9861
  logger$_.debug('broadcast_channel_raw_event', {
9802
9862
  channel: this.channelName,
@@ -9923,16 +9983,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9923
9983
  return await this.inbox.dequeue();
9924
9984
  }
9925
9985
  async _transportClose(code, reason) {
9986
+ logger$_.info('broadcast_channel_transport_closing', {
9987
+ channel: this.channelName,
9988
+ connector_id: this.connectorId,
9989
+ code,
9990
+ reason,
9991
+ listener_registered: this.listenerRegistered,
9992
+ timestamp: new Date().toISOString(),
9993
+ });
9926
9994
  if (this.listenerRegistered) {
9995
+ logger$_.info('broadcast_channel_removing_listener', {
9996
+ channel: this.channelName,
9997
+ connector_id: this.connectorId,
9998
+ timestamp: new Date().toISOString(),
9999
+ });
9927
10000
  this.channel.removeEventListener('message', this.onMsg);
9928
10001
  this.listenerRegistered = false;
10002
+ logger$_.info('broadcast_channel_listener_removed', {
10003
+ channel: this.channelName,
10004
+ connector_id: this.connectorId,
10005
+ timestamp: new Date().toISOString(),
10006
+ });
9929
10007
  }
9930
10008
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
9931
10009
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
9932
10010
  this.visibilityChangeListenerRegistered = false;
9933
10011
  this.visibilityChangeHandler = undefined;
9934
10012
  }
10013
+ logger$_.info('broadcast_channel_closing', {
10014
+ channel: this.channelName,
10015
+ connector_id: this.connectorId,
10016
+ timestamp: new Date().toISOString(),
10017
+ });
9935
10018
  this.channel.close();
10019
+ logger$_.info('broadcast_channel_closed', {
10020
+ channel: this.channelName,
10021
+ connector_id: this.connectorId,
10022
+ timestamp: new Date().toISOString(),
10023
+ });
9936
10024
  const closeCode = typeof code === 'number' ? code : 1000;
9937
10025
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
9938
10026
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -10580,7 +10668,22 @@ class UpstreamSessionManager extends TaskSpawner {
10580
10668
  this.currentStopSubtasks = null;
10581
10669
  await Promise.allSettled(tasks.map((task) => task.promise));
10582
10670
  if (this.connector) {
10583
- await this.connector.stop().catch(() => undefined);
10671
+ logger$Z.info('upstream_stopping_old_connector', {
10672
+ connect_epoch: this.connectEpoch,
10673
+ target_system_id: this.targetSystemId,
10674
+ timestamp: new Date().toISOString(),
10675
+ });
10676
+ await this.connector.stop().catch((err) => {
10677
+ logger$Z.warning('upstream_connector_stop_error', {
10678
+ connect_epoch: this.connectEpoch,
10679
+ error: err instanceof Error ? err.message : String(err),
10680
+ });
10681
+ });
10682
+ logger$Z.info('upstream_old_connector_stopped', {
10683
+ connect_epoch: this.connectEpoch,
10684
+ target_system_id: this.targetSystemId,
10685
+ timestamp: new Date().toISOString(),
10686
+ });
10584
10687
  this.connector = null;
10585
10688
  }
10586
10689
  }
@@ -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.933
99
+ // Generated from package.json version: 0.3.5-test.934
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.5-test.933';
104
+ const VERSION = '0.3.5-test.934';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9268,6 +9268,10 @@ class BaseAsyncConnector extends TaskSpawner {
9268
9268
  * Stop the connector gracefully
9269
9269
  */
9270
9270
  async stop() {
9271
+ logger$$.debug('stopping_connector', {
9272
+ current_state: this._state,
9273
+ connector_id: this._connectorFlowId,
9274
+ });
9271
9275
  if (!ConnectorStateUtils.canStop(this._state)) {
9272
9276
  logger$$.debug('connector_stop_already_stopped', {
9273
9277
  current_state: this._state,
@@ -9280,6 +9284,10 @@ class BaseAsyncConnector extends TaskSpawner {
9280
9284
  if (this._lastError) {
9281
9285
  throw this._lastError;
9282
9286
  }
9287
+ logger$$.debug('connector_stopped', {
9288
+ current_state: this._state,
9289
+ connector_id: this._connectorFlowId,
9290
+ });
9283
9291
  }
9284
9292
  /**
9285
9293
  * Close the connector with optional code and reason
@@ -9610,8 +9618,21 @@ class BaseAsyncConnector extends TaskSpawner {
9610
9618
  */
9611
9619
  async _shutdown(code, reason, gracePeriod, exc) {
9612
9620
  if (this._closed) {
9621
+ logger$$.debug('shutdown_already_closed', {
9622
+ connector_id: this._connectorFlowId,
9623
+ current_state: this._state,
9624
+ });
9613
9625
  return;
9614
9626
  }
9627
+ logger$$.info('connector_shutdown_starting', {
9628
+ connector_id: this._connectorFlowId,
9629
+ connector_type: this.constructor.name,
9630
+ code,
9631
+ reason,
9632
+ current_state: this._state,
9633
+ has_error: !!exc,
9634
+ timestamp: new Date().toISOString(),
9635
+ });
9615
9636
  this._closed = true;
9616
9637
  this._closeCode = code;
9617
9638
  this._closeReason = reason;
@@ -9633,16 +9654,39 @@ class BaseAsyncConnector extends TaskSpawner {
9633
9654
  this._sendPromiseResolve = undefined;
9634
9655
  }
9635
9656
  // Close transport
9657
+ logger$$.info('connector_closing_transport', {
9658
+ connector_id: this._connectorFlowId,
9659
+ connector_type: this.constructor.name,
9660
+ timestamp: new Date().toISOString(),
9661
+ });
9636
9662
  await this._transportClose(code, reason);
9663
+ logger$$.info('connector_transport_closed', {
9664
+ connector_id: this._connectorFlowId,
9665
+ connector_type: this.constructor.name,
9666
+ timestamp: new Date().toISOString(),
9667
+ });
9637
9668
  // Shutdown spawned tasks
9669
+ logger$$.info('connector_shutting_down_tasks', {
9670
+ connector_id: this._connectorFlowId,
9671
+ connector_type: this.constructor.name,
9672
+ grace_period_ms: effectiveGracePeriod * 1000,
9673
+ join_timeout_ms: this._shutdownJoinTimeout,
9674
+ timestamp: new Date().toISOString(),
9675
+ });
9638
9676
  try {
9639
9677
  await this.shutdownTasks({
9640
9678
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
9641
9679
  joinTimeout: this._shutdownJoinTimeout,
9642
9680
  });
9681
+ logger$$.info('connector_tasks_shutdown_complete', {
9682
+ connector_id: this._connectorFlowId,
9683
+ connector_type: this.constructor.name,
9684
+ timestamp: new Date().toISOString(),
9685
+ });
9643
9686
  }
9644
9687
  catch (error) {
9645
9688
  logger$$.warning('task_shutdown_error', {
9689
+ connector_id: this._connectorFlowId,
9646
9690
  error: error instanceof Error ? error.message : String(error),
9647
9691
  });
9648
9692
  }
@@ -9654,6 +9698,12 @@ class BaseAsyncConnector extends TaskSpawner {
9654
9698
  if (this._closeResolver) {
9655
9699
  this._closeResolver();
9656
9700
  }
9701
+ logger$$.info('connector_shutdown_complete', {
9702
+ connector_id: this._connectorFlowId,
9703
+ connector_type: this.constructor.name,
9704
+ final_state: this._state,
9705
+ timestamp: new Date().toISOString(),
9706
+ });
9657
9707
  }
9658
9708
  /**
9659
9709
  * Close the underlying transport
@@ -9789,12 +9839,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9789
9839
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
9790
9840
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
9791
9841
  this.channel = new BroadcastChannel(this.channelName);
9792
- logger$_.debug('broadcast_channel_connector_initialized', {
9842
+ logger$_.info('broadcast_channel_connector_created', {
9793
9843
  channel: this.channelName,
9794
9844
  connector_id: this.connectorId,
9795
9845
  inbox_capacity: preferredCapacity,
9846
+ timestamp: new Date().toISOString(),
9796
9847
  });
9797
9848
  this.onMsg = (event) => {
9849
+ // Guard: Don't process if listener was unregistered
9850
+ if (!this.listenerRegistered) {
9851
+ logger$_.warning('broadcast_channel_message_after_unregister', {
9852
+ channel: this.channelName,
9853
+ connector_id: this.connectorId,
9854
+ timestamp: new Date().toISOString(),
9855
+ });
9856
+ return;
9857
+ }
9798
9858
  const message = event.data;
9799
9859
  logger$_.debug('broadcast_channel_raw_event', {
9800
9860
  channel: this.channelName,
@@ -9921,16 +9981,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9921
9981
  return await this.inbox.dequeue();
9922
9982
  }
9923
9983
  async _transportClose(code, reason) {
9984
+ logger$_.info('broadcast_channel_transport_closing', {
9985
+ channel: this.channelName,
9986
+ connector_id: this.connectorId,
9987
+ code,
9988
+ reason,
9989
+ listener_registered: this.listenerRegistered,
9990
+ timestamp: new Date().toISOString(),
9991
+ });
9924
9992
  if (this.listenerRegistered) {
9993
+ logger$_.info('broadcast_channel_removing_listener', {
9994
+ channel: this.channelName,
9995
+ connector_id: this.connectorId,
9996
+ timestamp: new Date().toISOString(),
9997
+ });
9925
9998
  this.channel.removeEventListener('message', this.onMsg);
9926
9999
  this.listenerRegistered = false;
10000
+ logger$_.info('broadcast_channel_listener_removed', {
10001
+ channel: this.channelName,
10002
+ connector_id: this.connectorId,
10003
+ timestamp: new Date().toISOString(),
10004
+ });
9927
10005
  }
9928
10006
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
9929
10007
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
9930
10008
  this.visibilityChangeListenerRegistered = false;
9931
10009
  this.visibilityChangeHandler = undefined;
9932
10010
  }
10011
+ logger$_.info('broadcast_channel_closing', {
10012
+ channel: this.channelName,
10013
+ connector_id: this.connectorId,
10014
+ timestamp: new Date().toISOString(),
10015
+ });
9933
10016
  this.channel.close();
10017
+ logger$_.info('broadcast_channel_closed', {
10018
+ channel: this.channelName,
10019
+ connector_id: this.connectorId,
10020
+ timestamp: new Date().toISOString(),
10021
+ });
9934
10022
  const closeCode = typeof code === 'number' ? code : 1000;
9935
10023
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
9936
10024
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -10578,7 +10666,22 @@ class UpstreamSessionManager extends TaskSpawner {
10578
10666
  this.currentStopSubtasks = null;
10579
10667
  await Promise.allSettled(tasks.map((task) => task.promise));
10580
10668
  if (this.connector) {
10581
- await this.connector.stop().catch(() => undefined);
10669
+ logger$Z.info('upstream_stopping_old_connector', {
10670
+ connect_epoch: this.connectEpoch,
10671
+ target_system_id: this.targetSystemId,
10672
+ timestamp: new Date().toISOString(),
10673
+ });
10674
+ await this.connector.stop().catch((err) => {
10675
+ logger$Z.warning('upstream_connector_stop_error', {
10676
+ connect_epoch: this.connectEpoch,
10677
+ error: err instanceof Error ? err.message : String(err),
10678
+ });
10679
+ });
10680
+ logger$Z.info('upstream_old_connector_stopped', {
10681
+ connect_epoch: this.connectEpoch,
10682
+ target_system_id: this.targetSystemId,
10683
+ timestamp: new Date().toISOString(),
10684
+ });
10582
10685
  this.connector = null;
10583
10686
  }
10584
10687
  }
@@ -148,6 +148,10 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
148
148
  * Stop the connector gracefully
149
149
  */
150
150
  async stop() {
151
+ logger.debug('stopping_connector', {
152
+ current_state: this._state,
153
+ connector_id: this._connectorFlowId,
154
+ });
151
155
  if (!core_1.ConnectorStateUtils.canStop(this._state)) {
152
156
  logger.debug('connector_stop_already_stopped', {
153
157
  current_state: this._state,
@@ -160,6 +164,10 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
160
164
  if (this._lastError) {
161
165
  throw this._lastError;
162
166
  }
167
+ logger.debug('connector_stopped', {
168
+ current_state: this._state,
169
+ connector_id: this._connectorFlowId,
170
+ });
163
171
  }
164
172
  /**
165
173
  * Close the connector with optional code and reason
@@ -490,8 +498,21 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
490
498
  */
491
499
  async _shutdown(code, reason, gracePeriod, exc) {
492
500
  if (this._closed) {
501
+ logger.debug('shutdown_already_closed', {
502
+ connector_id: this._connectorFlowId,
503
+ current_state: this._state,
504
+ });
493
505
  return;
494
506
  }
507
+ logger.info('connector_shutdown_starting', {
508
+ connector_id: this._connectorFlowId,
509
+ connector_type: this.constructor.name,
510
+ code,
511
+ reason,
512
+ current_state: this._state,
513
+ has_error: !!exc,
514
+ timestamp: new Date().toISOString(),
515
+ });
495
516
  this._closed = true;
496
517
  this._closeCode = code;
497
518
  this._closeReason = reason;
@@ -513,16 +534,39 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
513
534
  this._sendPromiseResolve = undefined;
514
535
  }
515
536
  // Close transport
537
+ logger.info('connector_closing_transport', {
538
+ connector_id: this._connectorFlowId,
539
+ connector_type: this.constructor.name,
540
+ timestamp: new Date().toISOString(),
541
+ });
516
542
  await this._transportClose(code, reason);
543
+ logger.info('connector_transport_closed', {
544
+ connector_id: this._connectorFlowId,
545
+ connector_type: this.constructor.name,
546
+ timestamp: new Date().toISOString(),
547
+ });
517
548
  // Shutdown spawned tasks
549
+ logger.info('connector_shutting_down_tasks', {
550
+ connector_id: this._connectorFlowId,
551
+ connector_type: this.constructor.name,
552
+ grace_period_ms: effectiveGracePeriod * 1000,
553
+ join_timeout_ms: this._shutdownJoinTimeout,
554
+ timestamp: new Date().toISOString(),
555
+ });
518
556
  try {
519
557
  await this.shutdownTasks({
520
558
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
521
559
  joinTimeout: this._shutdownJoinTimeout,
522
560
  });
561
+ logger.info('connector_tasks_shutdown_complete', {
562
+ connector_id: this._connectorFlowId,
563
+ connector_type: this.constructor.name,
564
+ timestamp: new Date().toISOString(),
565
+ });
523
566
  }
524
567
  catch (error) {
525
568
  logger.warning('task_shutdown_error', {
569
+ connector_id: this._connectorFlowId,
526
570
  error: error instanceof Error ? error.message : String(error),
527
571
  });
528
572
  }
@@ -534,6 +578,12 @@ class BaseAsyncConnector extends task_spawner_js_1.TaskSpawner {
534
578
  if (this._closeResolver) {
535
579
  this._closeResolver();
536
580
  }
581
+ logger.info('connector_shutdown_complete', {
582
+ connector_id: this._connectorFlowId,
583
+ connector_type: this.constructor.name,
584
+ final_state: this._state,
585
+ timestamp: new Date().toISOString(),
586
+ });
537
587
  }
538
588
  /**
539
589
  * Close the underlying transport
@@ -70,12 +70,22 @@ class BroadcastChannelConnector extends base_async_connector_js_1.BaseAsyncConne
70
70
  this.inbox = new bounded_async_queue_js_1.BoundedAsyncQueue(preferredCapacity);
71
71
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
72
72
  this.channel = new BroadcastChannel(this.channelName);
73
- logger.debug('broadcast_channel_connector_initialized', {
73
+ logger.info('broadcast_channel_connector_created', {
74
74
  channel: this.channelName,
75
75
  connector_id: this.connectorId,
76
76
  inbox_capacity: preferredCapacity,
77
+ timestamp: new Date().toISOString(),
77
78
  });
78
79
  this.onMsg = (event) => {
80
+ // Guard: Don't process if listener was unregistered
81
+ if (!this.listenerRegistered) {
82
+ logger.warning('broadcast_channel_message_after_unregister', {
83
+ channel: this.channelName,
84
+ connector_id: this.connectorId,
85
+ timestamp: new Date().toISOString(),
86
+ });
87
+ return;
88
+ }
79
89
  const message = event.data;
80
90
  logger.debug('broadcast_channel_raw_event', {
81
91
  channel: this.channelName,
@@ -202,16 +212,44 @@ class BroadcastChannelConnector extends base_async_connector_js_1.BaseAsyncConne
202
212
  return await this.inbox.dequeue();
203
213
  }
204
214
  async _transportClose(code, reason) {
215
+ logger.info('broadcast_channel_transport_closing', {
216
+ channel: this.channelName,
217
+ connector_id: this.connectorId,
218
+ code,
219
+ reason,
220
+ listener_registered: this.listenerRegistered,
221
+ timestamp: new Date().toISOString(),
222
+ });
205
223
  if (this.listenerRegistered) {
224
+ logger.info('broadcast_channel_removing_listener', {
225
+ channel: this.channelName,
226
+ connector_id: this.connectorId,
227
+ timestamp: new Date().toISOString(),
228
+ });
206
229
  this.channel.removeEventListener('message', this.onMsg);
207
230
  this.listenerRegistered = false;
231
+ logger.info('broadcast_channel_listener_removed', {
232
+ channel: this.channelName,
233
+ connector_id: this.connectorId,
234
+ timestamp: new Date().toISOString(),
235
+ });
208
236
  }
209
237
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
210
238
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
211
239
  this.visibilityChangeListenerRegistered = false;
212
240
  this.visibilityChangeHandler = undefined;
213
241
  }
242
+ logger.info('broadcast_channel_closing', {
243
+ channel: this.channelName,
244
+ connector_id: this.connectorId,
245
+ timestamp: new Date().toISOString(),
246
+ });
214
247
  this.channel.close();
248
+ logger.info('broadcast_channel_closed', {
249
+ channel: this.channelName,
250
+ connector_id: this.connectorId,
251
+ timestamp: new Date().toISOString(),
252
+ });
215
253
  const closeCode = typeof code === 'number' ? code : 1000;
216
254
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
217
255
  const shutdownError = new errors_js_1.FameTransportClose(closeReason, closeCode);
@@ -387,7 +387,22 @@ class UpstreamSessionManager extends task_spawner_js_1.TaskSpawner {
387
387
  this.currentStopSubtasks = null;
388
388
  await Promise.allSettled(tasks.map((task) => task.promise));
389
389
  if (this.connector) {
390
- await this.connector.stop().catch(() => undefined);
390
+ logger.info('upstream_stopping_old_connector', {
391
+ connect_epoch: this.connectEpoch,
392
+ target_system_id: this.targetSystemId,
393
+ timestamp: new Date().toISOString(),
394
+ });
395
+ await this.connector.stop().catch((err) => {
396
+ logger.warning('upstream_connector_stop_error', {
397
+ connect_epoch: this.connectEpoch,
398
+ error: err instanceof Error ? err.message : String(err),
399
+ });
400
+ });
401
+ logger.info('upstream_old_connector_stopped', {
402
+ connect_epoch: this.connectEpoch,
403
+ target_system_id: this.targetSystemId,
404
+ timestamp: new Date().toISOString(),
405
+ });
391
406
  this.connector = null;
392
407
  }
393
408
  }
@@ -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.933
3
+ // Generated from package.json version: 0.3.5-test.934
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.933';
10
+ exports.VERSION = '0.3.5-test.934';