@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.
@@ -144,6 +144,10 @@ export class BaseAsyncConnector extends TaskSpawner {
144
144
  * Stop the connector gracefully
145
145
  */
146
146
  async stop() {
147
+ logger.debug('stopping_connector', {
148
+ current_state: this._state,
149
+ connector_id: this._connectorFlowId,
150
+ });
147
151
  if (!ConnectorStateUtils.canStop(this._state)) {
148
152
  logger.debug('connector_stop_already_stopped', {
149
153
  current_state: this._state,
@@ -156,6 +160,10 @@ export class BaseAsyncConnector extends TaskSpawner {
156
160
  if (this._lastError) {
157
161
  throw this._lastError;
158
162
  }
163
+ logger.debug('connector_stopped', {
164
+ current_state: this._state,
165
+ connector_id: this._connectorFlowId,
166
+ });
159
167
  }
160
168
  /**
161
169
  * Close the connector with optional code and reason
@@ -486,8 +494,21 @@ export class BaseAsyncConnector extends TaskSpawner {
486
494
  */
487
495
  async _shutdown(code, reason, gracePeriod, exc) {
488
496
  if (this._closed) {
497
+ logger.debug('shutdown_already_closed', {
498
+ connector_id: this._connectorFlowId,
499
+ current_state: this._state,
500
+ });
489
501
  return;
490
502
  }
503
+ logger.info('connector_shutdown_starting', {
504
+ connector_id: this._connectorFlowId,
505
+ connector_type: this.constructor.name,
506
+ code,
507
+ reason,
508
+ current_state: this._state,
509
+ has_error: !!exc,
510
+ timestamp: new Date().toISOString(),
511
+ });
491
512
  this._closed = true;
492
513
  this._closeCode = code;
493
514
  this._closeReason = reason;
@@ -509,16 +530,39 @@ export class BaseAsyncConnector extends TaskSpawner {
509
530
  this._sendPromiseResolve = undefined;
510
531
  }
511
532
  // Close transport
533
+ logger.info('connector_closing_transport', {
534
+ connector_id: this._connectorFlowId,
535
+ connector_type: this.constructor.name,
536
+ timestamp: new Date().toISOString(),
537
+ });
512
538
  await this._transportClose(code, reason);
539
+ logger.info('connector_transport_closed', {
540
+ connector_id: this._connectorFlowId,
541
+ connector_type: this.constructor.name,
542
+ timestamp: new Date().toISOString(),
543
+ });
513
544
  // Shutdown spawned tasks
545
+ logger.info('connector_shutting_down_tasks', {
546
+ connector_id: this._connectorFlowId,
547
+ connector_type: this.constructor.name,
548
+ grace_period_ms: effectiveGracePeriod * 1000,
549
+ join_timeout_ms: this._shutdownJoinTimeout,
550
+ timestamp: new Date().toISOString(),
551
+ });
514
552
  try {
515
553
  await this.shutdownTasks({
516
554
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
517
555
  joinTimeout: this._shutdownJoinTimeout,
518
556
  });
557
+ logger.info('connector_tasks_shutdown_complete', {
558
+ connector_id: this._connectorFlowId,
559
+ connector_type: this.constructor.name,
560
+ timestamp: new Date().toISOString(),
561
+ });
519
562
  }
520
563
  catch (error) {
521
564
  logger.warning('task_shutdown_error', {
565
+ connector_id: this._connectorFlowId,
522
566
  error: error instanceof Error ? error.message : String(error),
523
567
  });
524
568
  }
@@ -530,6 +574,12 @@ export class BaseAsyncConnector extends TaskSpawner {
530
574
  if (this._closeResolver) {
531
575
  this._closeResolver();
532
576
  }
577
+ logger.info('connector_shutdown_complete', {
578
+ connector_id: this._connectorFlowId,
579
+ connector_type: this.constructor.name,
580
+ final_state: this._state,
581
+ timestamp: new Date().toISOString(),
582
+ });
533
583
  }
534
584
  /**
535
585
  * Close the underlying transport
@@ -67,12 +67,22 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
67
67
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
68
68
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
69
69
  this.channel = new BroadcastChannel(this.channelName);
70
- logger.debug('broadcast_channel_connector_initialized', {
70
+ logger.info('broadcast_channel_connector_created', {
71
71
  channel: this.channelName,
72
72
  connector_id: this.connectorId,
73
73
  inbox_capacity: preferredCapacity,
74
+ timestamp: new Date().toISOString(),
74
75
  });
75
76
  this.onMsg = (event) => {
77
+ // Guard: Don't process if listener was unregistered
78
+ if (!this.listenerRegistered) {
79
+ logger.warning('broadcast_channel_message_after_unregister', {
80
+ channel: this.channelName,
81
+ connector_id: this.connectorId,
82
+ timestamp: new Date().toISOString(),
83
+ });
84
+ return;
85
+ }
76
86
  const message = event.data;
77
87
  logger.debug('broadcast_channel_raw_event', {
78
88
  channel: this.channelName,
@@ -199,16 +209,44 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
199
209
  return await this.inbox.dequeue();
200
210
  }
201
211
  async _transportClose(code, reason) {
212
+ logger.info('broadcast_channel_transport_closing', {
213
+ channel: this.channelName,
214
+ connector_id: this.connectorId,
215
+ code,
216
+ reason,
217
+ listener_registered: this.listenerRegistered,
218
+ timestamp: new Date().toISOString(),
219
+ });
202
220
  if (this.listenerRegistered) {
221
+ logger.info('broadcast_channel_removing_listener', {
222
+ channel: this.channelName,
223
+ connector_id: this.connectorId,
224
+ timestamp: new Date().toISOString(),
225
+ });
203
226
  this.channel.removeEventListener('message', this.onMsg);
204
227
  this.listenerRegistered = false;
228
+ logger.info('broadcast_channel_listener_removed', {
229
+ channel: this.channelName,
230
+ connector_id: this.connectorId,
231
+ timestamp: new Date().toISOString(),
232
+ });
205
233
  }
206
234
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
207
235
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
208
236
  this.visibilityChangeListenerRegistered = false;
209
237
  this.visibilityChangeHandler = undefined;
210
238
  }
239
+ logger.info('broadcast_channel_closing', {
240
+ channel: this.channelName,
241
+ connector_id: this.connectorId,
242
+ timestamp: new Date().toISOString(),
243
+ });
211
244
  this.channel.close();
245
+ logger.info('broadcast_channel_closed', {
246
+ channel: this.channelName,
247
+ connector_id: this.connectorId,
248
+ timestamp: new Date().toISOString(),
249
+ });
212
250
  const closeCode = typeof code === 'number' ? code : 1000;
213
251
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
214
252
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -384,7 +384,22 @@ export class UpstreamSessionManager extends TaskSpawner {
384
384
  this.currentStopSubtasks = null;
385
385
  await Promise.allSettled(tasks.map((task) => task.promise));
386
386
  if (this.connector) {
387
- await this.connector.stop().catch(() => undefined);
387
+ logger.info('upstream_stopping_old_connector', {
388
+ connect_epoch: this.connectEpoch,
389
+ target_system_id: this.targetSystemId,
390
+ timestamp: new Date().toISOString(),
391
+ });
392
+ await this.connector.stop().catch((err) => {
393
+ logger.warning('upstream_connector_stop_error', {
394
+ connect_epoch: this.connectEpoch,
395
+ error: err instanceof Error ? err.message : String(err),
396
+ });
397
+ });
398
+ logger.info('upstream_old_connector_stopped', {
399
+ connect_epoch: this.connectEpoch,
400
+ target_system_id: this.targetSystemId,
401
+ timestamp: new Date().toISOString(),
402
+ });
388
403
  this.connector = null;
389
404
  }
390
405
  }
@@ -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.933
2
+ // Generated from package.json version: 0.3.5-test.934
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.5-test.933';
7
+ export const VERSION = '0.3.5-test.934';
@@ -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.933
17
+ // Generated from package.json version: 0.3.5-test.934
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.5-test.933';
22
+ const VERSION = '0.3.5-test.934';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9186,6 +9186,10 @@ class BaseAsyncConnector extends TaskSpawner {
9186
9186
  * Stop the connector gracefully
9187
9187
  */
9188
9188
  async stop() {
9189
+ logger$$.debug('stopping_connector', {
9190
+ current_state: this._state,
9191
+ connector_id: this._connectorFlowId,
9192
+ });
9189
9193
  if (!core.ConnectorStateUtils.canStop(this._state)) {
9190
9194
  logger$$.debug('connector_stop_already_stopped', {
9191
9195
  current_state: this._state,
@@ -9198,6 +9202,10 @@ class BaseAsyncConnector extends TaskSpawner {
9198
9202
  if (this._lastError) {
9199
9203
  throw this._lastError;
9200
9204
  }
9205
+ logger$$.debug('connector_stopped', {
9206
+ current_state: this._state,
9207
+ connector_id: this._connectorFlowId,
9208
+ });
9201
9209
  }
9202
9210
  /**
9203
9211
  * Close the connector with optional code and reason
@@ -9528,8 +9536,21 @@ class BaseAsyncConnector extends TaskSpawner {
9528
9536
  */
9529
9537
  async _shutdown(code, reason, gracePeriod, exc) {
9530
9538
  if (this._closed) {
9539
+ logger$$.debug('shutdown_already_closed', {
9540
+ connector_id: this._connectorFlowId,
9541
+ current_state: this._state,
9542
+ });
9531
9543
  return;
9532
9544
  }
9545
+ logger$$.info('connector_shutdown_starting', {
9546
+ connector_id: this._connectorFlowId,
9547
+ connector_type: this.constructor.name,
9548
+ code,
9549
+ reason,
9550
+ current_state: this._state,
9551
+ has_error: !!exc,
9552
+ timestamp: new Date().toISOString(),
9553
+ });
9533
9554
  this._closed = true;
9534
9555
  this._closeCode = code;
9535
9556
  this._closeReason = reason;
@@ -9551,16 +9572,39 @@ class BaseAsyncConnector extends TaskSpawner {
9551
9572
  this._sendPromiseResolve = undefined;
9552
9573
  }
9553
9574
  // Close transport
9575
+ logger$$.info('connector_closing_transport', {
9576
+ connector_id: this._connectorFlowId,
9577
+ connector_type: this.constructor.name,
9578
+ timestamp: new Date().toISOString(),
9579
+ });
9554
9580
  await this._transportClose(code, reason);
9581
+ logger$$.info('connector_transport_closed', {
9582
+ connector_id: this._connectorFlowId,
9583
+ connector_type: this.constructor.name,
9584
+ timestamp: new Date().toISOString(),
9585
+ });
9555
9586
  // Shutdown spawned tasks
9587
+ logger$$.info('connector_shutting_down_tasks', {
9588
+ connector_id: this._connectorFlowId,
9589
+ connector_type: this.constructor.name,
9590
+ grace_period_ms: effectiveGracePeriod * 1000,
9591
+ join_timeout_ms: this._shutdownJoinTimeout,
9592
+ timestamp: new Date().toISOString(),
9593
+ });
9556
9594
  try {
9557
9595
  await this.shutdownTasks({
9558
9596
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
9559
9597
  joinTimeout: this._shutdownJoinTimeout,
9560
9598
  });
9599
+ logger$$.info('connector_tasks_shutdown_complete', {
9600
+ connector_id: this._connectorFlowId,
9601
+ connector_type: this.constructor.name,
9602
+ timestamp: new Date().toISOString(),
9603
+ });
9561
9604
  }
9562
9605
  catch (error) {
9563
9606
  logger$$.warning('task_shutdown_error', {
9607
+ connector_id: this._connectorFlowId,
9564
9608
  error: error instanceof Error ? error.message : String(error),
9565
9609
  });
9566
9610
  }
@@ -9572,6 +9616,12 @@ class BaseAsyncConnector extends TaskSpawner {
9572
9616
  if (this._closeResolver) {
9573
9617
  this._closeResolver();
9574
9618
  }
9619
+ logger$$.info('connector_shutdown_complete', {
9620
+ connector_id: this._connectorFlowId,
9621
+ connector_type: this.constructor.name,
9622
+ final_state: this._state,
9623
+ timestamp: new Date().toISOString(),
9624
+ });
9575
9625
  }
9576
9626
  /**
9577
9627
  * Close the underlying transport
@@ -9707,12 +9757,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9707
9757
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
9708
9758
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
9709
9759
  this.channel = new BroadcastChannel(this.channelName);
9710
- logger$_.debug('broadcast_channel_connector_initialized', {
9760
+ logger$_.info('broadcast_channel_connector_created', {
9711
9761
  channel: this.channelName,
9712
9762
  connector_id: this.connectorId,
9713
9763
  inbox_capacity: preferredCapacity,
9764
+ timestamp: new Date().toISOString(),
9714
9765
  });
9715
9766
  this.onMsg = (event) => {
9767
+ // Guard: Don't process if listener was unregistered
9768
+ if (!this.listenerRegistered) {
9769
+ logger$_.warning('broadcast_channel_message_after_unregister', {
9770
+ channel: this.channelName,
9771
+ connector_id: this.connectorId,
9772
+ timestamp: new Date().toISOString(),
9773
+ });
9774
+ return;
9775
+ }
9716
9776
  const message = event.data;
9717
9777
  logger$_.debug('broadcast_channel_raw_event', {
9718
9778
  channel: this.channelName,
@@ -9839,16 +9899,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9839
9899
  return await this.inbox.dequeue();
9840
9900
  }
9841
9901
  async _transportClose(code, reason) {
9902
+ logger$_.info('broadcast_channel_transport_closing', {
9903
+ channel: this.channelName,
9904
+ connector_id: this.connectorId,
9905
+ code,
9906
+ reason,
9907
+ listener_registered: this.listenerRegistered,
9908
+ timestamp: new Date().toISOString(),
9909
+ });
9842
9910
  if (this.listenerRegistered) {
9911
+ logger$_.info('broadcast_channel_removing_listener', {
9912
+ channel: this.channelName,
9913
+ connector_id: this.connectorId,
9914
+ timestamp: new Date().toISOString(),
9915
+ });
9843
9916
  this.channel.removeEventListener('message', this.onMsg);
9844
9917
  this.listenerRegistered = false;
9918
+ logger$_.info('broadcast_channel_listener_removed', {
9919
+ channel: this.channelName,
9920
+ connector_id: this.connectorId,
9921
+ timestamp: new Date().toISOString(),
9922
+ });
9845
9923
  }
9846
9924
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
9847
9925
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
9848
9926
  this.visibilityChangeListenerRegistered = false;
9849
9927
  this.visibilityChangeHandler = undefined;
9850
9928
  }
9929
+ logger$_.info('broadcast_channel_closing', {
9930
+ channel: this.channelName,
9931
+ connector_id: this.connectorId,
9932
+ timestamp: new Date().toISOString(),
9933
+ });
9851
9934
  this.channel.close();
9935
+ logger$_.info('broadcast_channel_closed', {
9936
+ channel: this.channelName,
9937
+ connector_id: this.connectorId,
9938
+ timestamp: new Date().toISOString(),
9939
+ });
9852
9940
  const closeCode = typeof code === 'number' ? code : 1000;
9853
9941
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
9854
9942
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -10496,7 +10584,22 @@ class UpstreamSessionManager extends TaskSpawner {
10496
10584
  this.currentStopSubtasks = null;
10497
10585
  await Promise.allSettled(tasks.map((task) => task.promise));
10498
10586
  if (this.connector) {
10499
- await this.connector.stop().catch(() => undefined);
10587
+ logger$Z.info('upstream_stopping_old_connector', {
10588
+ connect_epoch: this.connectEpoch,
10589
+ target_system_id: this.targetSystemId,
10590
+ timestamp: new Date().toISOString(),
10591
+ });
10592
+ await this.connector.stop().catch((err) => {
10593
+ logger$Z.warning('upstream_connector_stop_error', {
10594
+ connect_epoch: this.connectEpoch,
10595
+ error: err instanceof Error ? err.message : String(err),
10596
+ });
10597
+ });
10598
+ logger$Z.info('upstream_old_connector_stopped', {
10599
+ connect_epoch: this.connectEpoch,
10600
+ target_system_id: this.targetSystemId,
10601
+ timestamp: new Date().toISOString(),
10602
+ });
10500
10603
  this.connector = null;
10501
10604
  }
10502
10605
  }
@@ -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.933
16
+ // Generated from package.json version: 0.3.5-test.934
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.5-test.933';
21
+ const VERSION = '0.3.5-test.934';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9185,6 +9185,10 @@ class BaseAsyncConnector extends TaskSpawner {
9185
9185
  * Stop the connector gracefully
9186
9186
  */
9187
9187
  async stop() {
9188
+ logger$$.debug('stopping_connector', {
9189
+ current_state: this._state,
9190
+ connector_id: this._connectorFlowId,
9191
+ });
9188
9192
  if (!ConnectorStateUtils.canStop(this._state)) {
9189
9193
  logger$$.debug('connector_stop_already_stopped', {
9190
9194
  current_state: this._state,
@@ -9197,6 +9201,10 @@ class BaseAsyncConnector extends TaskSpawner {
9197
9201
  if (this._lastError) {
9198
9202
  throw this._lastError;
9199
9203
  }
9204
+ logger$$.debug('connector_stopped', {
9205
+ current_state: this._state,
9206
+ connector_id: this._connectorFlowId,
9207
+ });
9200
9208
  }
9201
9209
  /**
9202
9210
  * Close the connector with optional code and reason
@@ -9527,8 +9535,21 @@ class BaseAsyncConnector extends TaskSpawner {
9527
9535
  */
9528
9536
  async _shutdown(code, reason, gracePeriod, exc) {
9529
9537
  if (this._closed) {
9538
+ logger$$.debug('shutdown_already_closed', {
9539
+ connector_id: this._connectorFlowId,
9540
+ current_state: this._state,
9541
+ });
9530
9542
  return;
9531
9543
  }
9544
+ logger$$.info('connector_shutdown_starting', {
9545
+ connector_id: this._connectorFlowId,
9546
+ connector_type: this.constructor.name,
9547
+ code,
9548
+ reason,
9549
+ current_state: this._state,
9550
+ has_error: !!exc,
9551
+ timestamp: new Date().toISOString(),
9552
+ });
9532
9553
  this._closed = true;
9533
9554
  this._closeCode = code;
9534
9555
  this._closeReason = reason;
@@ -9550,16 +9571,39 @@ class BaseAsyncConnector extends TaskSpawner {
9550
9571
  this._sendPromiseResolve = undefined;
9551
9572
  }
9552
9573
  // Close transport
9574
+ logger$$.info('connector_closing_transport', {
9575
+ connector_id: this._connectorFlowId,
9576
+ connector_type: this.constructor.name,
9577
+ timestamp: new Date().toISOString(),
9578
+ });
9553
9579
  await this._transportClose(code, reason);
9580
+ logger$$.info('connector_transport_closed', {
9581
+ connector_id: this._connectorFlowId,
9582
+ connector_type: this.constructor.name,
9583
+ timestamp: new Date().toISOString(),
9584
+ });
9554
9585
  // Shutdown spawned tasks
9586
+ logger$$.info('connector_shutting_down_tasks', {
9587
+ connector_id: this._connectorFlowId,
9588
+ connector_type: this.constructor.name,
9589
+ grace_period_ms: effectiveGracePeriod * 1000,
9590
+ join_timeout_ms: this._shutdownJoinTimeout,
9591
+ timestamp: new Date().toISOString(),
9592
+ });
9555
9593
  try {
9556
9594
  await this.shutdownTasks({
9557
9595
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
9558
9596
  joinTimeout: this._shutdownJoinTimeout,
9559
9597
  });
9598
+ logger$$.info('connector_tasks_shutdown_complete', {
9599
+ connector_id: this._connectorFlowId,
9600
+ connector_type: this.constructor.name,
9601
+ timestamp: new Date().toISOString(),
9602
+ });
9560
9603
  }
9561
9604
  catch (error) {
9562
9605
  logger$$.warning('task_shutdown_error', {
9606
+ connector_id: this._connectorFlowId,
9563
9607
  error: error instanceof Error ? error.message : String(error),
9564
9608
  });
9565
9609
  }
@@ -9571,6 +9615,12 @@ class BaseAsyncConnector extends TaskSpawner {
9571
9615
  if (this._closeResolver) {
9572
9616
  this._closeResolver();
9573
9617
  }
9618
+ logger$$.info('connector_shutdown_complete', {
9619
+ connector_id: this._connectorFlowId,
9620
+ connector_type: this.constructor.name,
9621
+ final_state: this._state,
9622
+ timestamp: new Date().toISOString(),
9623
+ });
9574
9624
  }
9575
9625
  /**
9576
9626
  * Close the underlying transport
@@ -9706,12 +9756,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9706
9756
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
9707
9757
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
9708
9758
  this.channel = new BroadcastChannel(this.channelName);
9709
- logger$_.debug('broadcast_channel_connector_initialized', {
9759
+ logger$_.info('broadcast_channel_connector_created', {
9710
9760
  channel: this.channelName,
9711
9761
  connector_id: this.connectorId,
9712
9762
  inbox_capacity: preferredCapacity,
9763
+ timestamp: new Date().toISOString(),
9713
9764
  });
9714
9765
  this.onMsg = (event) => {
9766
+ // Guard: Don't process if listener was unregistered
9767
+ if (!this.listenerRegistered) {
9768
+ logger$_.warning('broadcast_channel_message_after_unregister', {
9769
+ channel: this.channelName,
9770
+ connector_id: this.connectorId,
9771
+ timestamp: new Date().toISOString(),
9772
+ });
9773
+ return;
9774
+ }
9715
9775
  const message = event.data;
9716
9776
  logger$_.debug('broadcast_channel_raw_event', {
9717
9777
  channel: this.channelName,
@@ -9838,16 +9898,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9838
9898
  return await this.inbox.dequeue();
9839
9899
  }
9840
9900
  async _transportClose(code, reason) {
9901
+ logger$_.info('broadcast_channel_transport_closing', {
9902
+ channel: this.channelName,
9903
+ connector_id: this.connectorId,
9904
+ code,
9905
+ reason,
9906
+ listener_registered: this.listenerRegistered,
9907
+ timestamp: new Date().toISOString(),
9908
+ });
9841
9909
  if (this.listenerRegistered) {
9910
+ logger$_.info('broadcast_channel_removing_listener', {
9911
+ channel: this.channelName,
9912
+ connector_id: this.connectorId,
9913
+ timestamp: new Date().toISOString(),
9914
+ });
9842
9915
  this.channel.removeEventListener('message', this.onMsg);
9843
9916
  this.listenerRegistered = false;
9917
+ logger$_.info('broadcast_channel_listener_removed', {
9918
+ channel: this.channelName,
9919
+ connector_id: this.connectorId,
9920
+ timestamp: new Date().toISOString(),
9921
+ });
9844
9922
  }
9845
9923
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
9846
9924
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
9847
9925
  this.visibilityChangeListenerRegistered = false;
9848
9926
  this.visibilityChangeHandler = undefined;
9849
9927
  }
9928
+ logger$_.info('broadcast_channel_closing', {
9929
+ channel: this.channelName,
9930
+ connector_id: this.connectorId,
9931
+ timestamp: new Date().toISOString(),
9932
+ });
9850
9933
  this.channel.close();
9934
+ logger$_.info('broadcast_channel_closed', {
9935
+ channel: this.channelName,
9936
+ connector_id: this.connectorId,
9937
+ timestamp: new Date().toISOString(),
9938
+ });
9851
9939
  const closeCode = typeof code === 'number' ? code : 1000;
9852
9940
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
9853
9941
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -10495,7 +10583,22 @@ class UpstreamSessionManager extends TaskSpawner {
10495
10583
  this.currentStopSubtasks = null;
10496
10584
  await Promise.allSettled(tasks.map((task) => task.promise));
10497
10585
  if (this.connector) {
10498
- await this.connector.stop().catch(() => undefined);
10586
+ logger$Z.info('upstream_stopping_old_connector', {
10587
+ connect_epoch: this.connectEpoch,
10588
+ target_system_id: this.targetSystemId,
10589
+ timestamp: new Date().toISOString(),
10590
+ });
10591
+ await this.connector.stop().catch((err) => {
10592
+ logger$Z.warning('upstream_connector_stop_error', {
10593
+ connect_epoch: this.connectEpoch,
10594
+ error: err instanceof Error ? err.message : String(err),
10595
+ });
10596
+ });
10597
+ logger$Z.info('upstream_old_connector_stopped', {
10598
+ connect_epoch: this.connectEpoch,
10599
+ target_system_id: this.targetSystemId,
10600
+ timestamp: new Date().toISOString(),
10601
+ });
10499
10602
  this.connector = null;
10500
10603
  }
10501
10604
  }