@naylence/runtime 0.3.5-test.936 → 0.3.5-test.938
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.
- package/dist/browser/index.cjs +52 -18
- package/dist/browser/index.mjs +52 -18
- package/dist/cjs/naylence/fame/connector/base-async-connector.js +6 -6
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +30 -8
- package/dist/cjs/naylence/fame/node/upstream-session-manager.js +14 -2
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/base-async-connector.js +6 -6
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +30 -8
- package/dist/esm/naylence/fame/node/upstream-session-manager.js +14 -2
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +52 -18
- package/dist/node/index.mjs +52 -18
- package/dist/node/node.cjs +52 -18
- package/dist/node/node.mjs +52 -18
- package/dist/types/naylence/fame/connector/broadcast-channel-connector.browser.d.ts +5 -1
- package/dist/types/naylence/fame/node/upstream-session-manager.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.cjs
CHANGED
|
@@ -2514,7 +2514,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2514
2514
|
});
|
|
2515
2515
|
return;
|
|
2516
2516
|
}
|
|
2517
|
-
logger$1f.
|
|
2517
|
+
logger$1f.debug('connector_shutdown_starting', {
|
|
2518
2518
|
connector_id: this._connectorFlowId,
|
|
2519
2519
|
connector_type: this.constructor.name,
|
|
2520
2520
|
code,
|
|
@@ -2544,19 +2544,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2544
2544
|
this._sendPromiseResolve = undefined;
|
|
2545
2545
|
}
|
|
2546
2546
|
// Close transport
|
|
2547
|
-
logger$1f.
|
|
2547
|
+
logger$1f.debug('connector_closing_transport', {
|
|
2548
2548
|
connector_id: this._connectorFlowId,
|
|
2549
2549
|
connector_type: this.constructor.name,
|
|
2550
2550
|
timestamp: new Date().toISOString(),
|
|
2551
2551
|
});
|
|
2552
2552
|
await this._transportClose(code, reason);
|
|
2553
|
-
logger$1f.
|
|
2553
|
+
logger$1f.debug('connector_transport_closed', {
|
|
2554
2554
|
connector_id: this._connectorFlowId,
|
|
2555
2555
|
connector_type: this.constructor.name,
|
|
2556
2556
|
timestamp: new Date().toISOString(),
|
|
2557
2557
|
});
|
|
2558
2558
|
// Shutdown spawned tasks
|
|
2559
|
-
logger$1f.
|
|
2559
|
+
logger$1f.debug('connector_shutting_down_tasks', {
|
|
2560
2560
|
connector_id: this._connectorFlowId,
|
|
2561
2561
|
connector_type: this.constructor.name,
|
|
2562
2562
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -2568,7 +2568,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2568
2568
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
2569
2569
|
joinTimeout: this._shutdownJoinTimeout,
|
|
2570
2570
|
});
|
|
2571
|
-
logger$1f.
|
|
2571
|
+
logger$1f.debug('connector_tasks_shutdown_complete', {
|
|
2572
2572
|
connector_id: this._connectorFlowId,
|
|
2573
2573
|
connector_type: this.constructor.name,
|
|
2574
2574
|
timestamp: new Date().toISOString(),
|
|
@@ -2588,7 +2588,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2588
2588
|
if (this._closeResolver) {
|
|
2589
2589
|
this._closeResolver();
|
|
2590
2590
|
}
|
|
2591
|
-
logger$1f.
|
|
2591
|
+
logger$1f.debug('connector_shutdown_complete', {
|
|
2592
2592
|
connector_id: this._connectorFlowId,
|
|
2593
2593
|
connector_type: this.constructor.name,
|
|
2594
2594
|
final_state: this._state,
|
|
@@ -5478,12 +5478,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5478
5478
|
}
|
|
5479
5479
|
|
|
5480
5480
|
// This file is auto-generated during build - do not edit manually
|
|
5481
|
-
// Generated from package.json version: 0.3.5-test.
|
|
5481
|
+
// Generated from package.json version: 0.3.5-test.938
|
|
5482
5482
|
/**
|
|
5483
5483
|
* The package version, injected at build time.
|
|
5484
5484
|
* @internal
|
|
5485
5485
|
*/
|
|
5486
|
-
const VERSION = '0.3.5-test.
|
|
5486
|
+
const VERSION = '0.3.5-test.938';
|
|
5487
5487
|
|
|
5488
5488
|
/**
|
|
5489
5489
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11536,7 +11536,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11536
11536
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
11537
11537
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
11538
11538
|
this.channel = new BroadcastChannel(this.channelName);
|
|
11539
|
-
logger$10.
|
|
11539
|
+
logger$10.debug('broadcast_channel_connector_created', {
|
|
11540
11540
|
channel: this.channelName,
|
|
11541
11541
|
connector_id: this.connectorId,
|
|
11542
11542
|
inbox_capacity: preferredCapacity,
|
|
@@ -11617,7 +11617,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11617
11617
|
// Setup visibility change monitoring
|
|
11618
11618
|
this.visibilityChangeHandler = () => {
|
|
11619
11619
|
const isHidden = document.hidden;
|
|
11620
|
-
logger$10.
|
|
11620
|
+
logger$10.debug('broadcast_channel_visibility_changed', {
|
|
11621
11621
|
channel: this.channelName,
|
|
11622
11622
|
connector_id: this.connectorId,
|
|
11623
11623
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -11647,7 +11647,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11647
11647
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11648
11648
|
this.visibilityChangeListenerRegistered = true;
|
|
11649
11649
|
// Log initial state
|
|
11650
|
-
logger$10.
|
|
11650
|
+
logger$10.debug('broadcast_channel_initial_visibility', {
|
|
11651
11651
|
channel: this.channelName,
|
|
11652
11652
|
connector_id: this.connectorId,
|
|
11653
11653
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -11697,7 +11697,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11697
11697
|
return await this.inbox.dequeue();
|
|
11698
11698
|
}
|
|
11699
11699
|
async _transportClose(code, reason) {
|
|
11700
|
-
logger$10.
|
|
11700
|
+
logger$10.debug('broadcast_channel_transport_closing', {
|
|
11701
11701
|
channel: this.channelName,
|
|
11702
11702
|
connector_id: this.connectorId,
|
|
11703
11703
|
code,
|
|
@@ -11706,14 +11706,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11706
11706
|
timestamp: new Date().toISOString(),
|
|
11707
11707
|
});
|
|
11708
11708
|
if (this.listenerRegistered) {
|
|
11709
|
-
logger$10.
|
|
11709
|
+
logger$10.debug('broadcast_channel_removing_listener', {
|
|
11710
11710
|
channel: this.channelName,
|
|
11711
11711
|
connector_id: this.connectorId,
|
|
11712
11712
|
timestamp: new Date().toISOString(),
|
|
11713
11713
|
});
|
|
11714
11714
|
this.channel.removeEventListener('message', this.onMsg);
|
|
11715
11715
|
this.listenerRegistered = false;
|
|
11716
|
-
logger$10.
|
|
11716
|
+
logger$10.debug('broadcast_channel_listener_removed', {
|
|
11717
11717
|
channel: this.channelName,
|
|
11718
11718
|
connector_id: this.connectorId,
|
|
11719
11719
|
timestamp: new Date().toISOString(),
|
|
@@ -11724,13 +11724,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11724
11724
|
this.visibilityChangeListenerRegistered = false;
|
|
11725
11725
|
this.visibilityChangeHandler = undefined;
|
|
11726
11726
|
}
|
|
11727
|
-
logger$10.
|
|
11727
|
+
logger$10.debug('broadcast_channel_closing', {
|
|
11728
11728
|
channel: this.channelName,
|
|
11729
11729
|
connector_id: this.connectorId,
|
|
11730
11730
|
timestamp: new Date().toISOString(),
|
|
11731
11731
|
});
|
|
11732
11732
|
this.channel.close();
|
|
11733
|
-
logger$10.
|
|
11733
|
+
logger$10.debug('broadcast_channel_closed', {
|
|
11734
11734
|
channel: this.channelName,
|
|
11735
11735
|
connector_id: this.connectorId,
|
|
11736
11736
|
timestamp: new Date().toISOString(),
|
|
@@ -11821,6 +11821,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11821
11821
|
}
|
|
11822
11822
|
return undefined;
|
|
11823
11823
|
}
|
|
11824
|
+
/**
|
|
11825
|
+
* Override start() to check initial visibility state
|
|
11826
|
+
*/
|
|
11827
|
+
async start(inboundHandler) {
|
|
11828
|
+
await super.start(inboundHandler);
|
|
11829
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
11830
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
11831
|
+
logger$10.debug('broadcast_channel_start_in_hidden_tab', {
|
|
11832
|
+
channel: this.channelName,
|
|
11833
|
+
connector_id: this.connectorId,
|
|
11834
|
+
timestamp: new Date().toISOString(),
|
|
11835
|
+
});
|
|
11836
|
+
// Immediately pause if tab is hidden at start time
|
|
11837
|
+
await this.pause().catch((err) => {
|
|
11838
|
+
logger$10.warning('broadcast_channel_initial_pause_failed', {
|
|
11839
|
+
channel: this.channelName,
|
|
11840
|
+
connector_id: this.connectorId,
|
|
11841
|
+
error: err instanceof Error ? err.message : String(err),
|
|
11842
|
+
});
|
|
11843
|
+
});
|
|
11844
|
+
}
|
|
11845
|
+
}
|
|
11824
11846
|
_trimSeenAcks(now) {
|
|
11825
11847
|
while (this.seenAckOrder.length > 0) {
|
|
11826
11848
|
const candidate = this.seenAckOrder[0];
|
|
@@ -12062,6 +12084,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12062
12084
|
this.lastHeartbeatAckTime = null;
|
|
12063
12085
|
this.lastSeenEpoch = null;
|
|
12064
12086
|
this.hadSuccessfulAttach = false;
|
|
12087
|
+
this.lastConnectorState = null;
|
|
12065
12088
|
this.connectEpoch = 0;
|
|
12066
12089
|
const options = normalizeOptions$k(optionsInput);
|
|
12067
12090
|
this.node = options.node;
|
|
@@ -12486,15 +12509,26 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12486
12509
|
if (stopEvt.isSet() || signal?.aborted) {
|
|
12487
12510
|
break;
|
|
12488
12511
|
}
|
|
12512
|
+
const currentState = connector.state;
|
|
12513
|
+
const previousState = this.lastConnectorState;
|
|
12514
|
+
this.lastConnectorState = currentState;
|
|
12489
12515
|
// Skip heartbeat if connector is paused (e.g., tab is hidden)
|
|
12490
12516
|
// Keep ack time current so we don't timeout immediately after resuming
|
|
12491
|
-
if (
|
|
12517
|
+
if (currentState === core.ConnectorState.PAUSED) {
|
|
12492
12518
|
logger$$.debug('skipping_heartbeat_connector_paused', {
|
|
12493
|
-
connector_state:
|
|
12519
|
+
connector_state: currentState,
|
|
12494
12520
|
});
|
|
12495
12521
|
this.lastHeartbeatAckTime = Date.now();
|
|
12496
12522
|
continue;
|
|
12497
12523
|
}
|
|
12524
|
+
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
12525
|
+
if (previousState === core.ConnectorState.PAUSED && currentState === core.ConnectorState.STARTED) {
|
|
12526
|
+
logger$$.debug('connector_just_resumed_resetting_ack_time', {
|
|
12527
|
+
previous_state: previousState,
|
|
12528
|
+
current_state: currentState,
|
|
12529
|
+
});
|
|
12530
|
+
this.lastHeartbeatAckTime = Date.now();
|
|
12531
|
+
}
|
|
12498
12532
|
const envelope = await this.makeHeartbeatEnvelope();
|
|
12499
12533
|
logger$$.debug('sending_heartbeat', {
|
|
12500
12534
|
hb_corr_id: envelope.corrId,
|
package/dist/node/node.mjs
CHANGED
|
@@ -2513,7 +2513,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2513
2513
|
});
|
|
2514
2514
|
return;
|
|
2515
2515
|
}
|
|
2516
|
-
logger$1f.
|
|
2516
|
+
logger$1f.debug('connector_shutdown_starting', {
|
|
2517
2517
|
connector_id: this._connectorFlowId,
|
|
2518
2518
|
connector_type: this.constructor.name,
|
|
2519
2519
|
code,
|
|
@@ -2543,19 +2543,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2543
2543
|
this._sendPromiseResolve = undefined;
|
|
2544
2544
|
}
|
|
2545
2545
|
// Close transport
|
|
2546
|
-
logger$1f.
|
|
2546
|
+
logger$1f.debug('connector_closing_transport', {
|
|
2547
2547
|
connector_id: this._connectorFlowId,
|
|
2548
2548
|
connector_type: this.constructor.name,
|
|
2549
2549
|
timestamp: new Date().toISOString(),
|
|
2550
2550
|
});
|
|
2551
2551
|
await this._transportClose(code, reason);
|
|
2552
|
-
logger$1f.
|
|
2552
|
+
logger$1f.debug('connector_transport_closed', {
|
|
2553
2553
|
connector_id: this._connectorFlowId,
|
|
2554
2554
|
connector_type: this.constructor.name,
|
|
2555
2555
|
timestamp: new Date().toISOString(),
|
|
2556
2556
|
});
|
|
2557
2557
|
// Shutdown spawned tasks
|
|
2558
|
-
logger$1f.
|
|
2558
|
+
logger$1f.debug('connector_shutting_down_tasks', {
|
|
2559
2559
|
connector_id: this._connectorFlowId,
|
|
2560
2560
|
connector_type: this.constructor.name,
|
|
2561
2561
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -2567,7 +2567,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2567
2567
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
2568
2568
|
joinTimeout: this._shutdownJoinTimeout,
|
|
2569
2569
|
});
|
|
2570
|
-
logger$1f.
|
|
2570
|
+
logger$1f.debug('connector_tasks_shutdown_complete', {
|
|
2571
2571
|
connector_id: this._connectorFlowId,
|
|
2572
2572
|
connector_type: this.constructor.name,
|
|
2573
2573
|
timestamp: new Date().toISOString(),
|
|
@@ -2587,7 +2587,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2587
2587
|
if (this._closeResolver) {
|
|
2588
2588
|
this._closeResolver();
|
|
2589
2589
|
}
|
|
2590
|
-
logger$1f.
|
|
2590
|
+
logger$1f.debug('connector_shutdown_complete', {
|
|
2591
2591
|
connector_id: this._connectorFlowId,
|
|
2592
2592
|
connector_type: this.constructor.name,
|
|
2593
2593
|
final_state: this._state,
|
|
@@ -5477,12 +5477,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5477
5477
|
}
|
|
5478
5478
|
|
|
5479
5479
|
// This file is auto-generated during build - do not edit manually
|
|
5480
|
-
// Generated from package.json version: 0.3.5-test.
|
|
5480
|
+
// Generated from package.json version: 0.3.5-test.938
|
|
5481
5481
|
/**
|
|
5482
5482
|
* The package version, injected at build time.
|
|
5483
5483
|
* @internal
|
|
5484
5484
|
*/
|
|
5485
|
-
const VERSION = '0.3.5-test.
|
|
5485
|
+
const VERSION = '0.3.5-test.938';
|
|
5486
5486
|
|
|
5487
5487
|
/**
|
|
5488
5488
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11535,7 +11535,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11535
11535
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
11536
11536
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
11537
11537
|
this.channel = new BroadcastChannel(this.channelName);
|
|
11538
|
-
logger$10.
|
|
11538
|
+
logger$10.debug('broadcast_channel_connector_created', {
|
|
11539
11539
|
channel: this.channelName,
|
|
11540
11540
|
connector_id: this.connectorId,
|
|
11541
11541
|
inbox_capacity: preferredCapacity,
|
|
@@ -11616,7 +11616,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11616
11616
|
// Setup visibility change monitoring
|
|
11617
11617
|
this.visibilityChangeHandler = () => {
|
|
11618
11618
|
const isHidden = document.hidden;
|
|
11619
|
-
logger$10.
|
|
11619
|
+
logger$10.debug('broadcast_channel_visibility_changed', {
|
|
11620
11620
|
channel: this.channelName,
|
|
11621
11621
|
connector_id: this.connectorId,
|
|
11622
11622
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -11646,7 +11646,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11646
11646
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11647
11647
|
this.visibilityChangeListenerRegistered = true;
|
|
11648
11648
|
// Log initial state
|
|
11649
|
-
logger$10.
|
|
11649
|
+
logger$10.debug('broadcast_channel_initial_visibility', {
|
|
11650
11650
|
channel: this.channelName,
|
|
11651
11651
|
connector_id: this.connectorId,
|
|
11652
11652
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -11696,7 +11696,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11696
11696
|
return await this.inbox.dequeue();
|
|
11697
11697
|
}
|
|
11698
11698
|
async _transportClose(code, reason) {
|
|
11699
|
-
logger$10.
|
|
11699
|
+
logger$10.debug('broadcast_channel_transport_closing', {
|
|
11700
11700
|
channel: this.channelName,
|
|
11701
11701
|
connector_id: this.connectorId,
|
|
11702
11702
|
code,
|
|
@@ -11705,14 +11705,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11705
11705
|
timestamp: new Date().toISOString(),
|
|
11706
11706
|
});
|
|
11707
11707
|
if (this.listenerRegistered) {
|
|
11708
|
-
logger$10.
|
|
11708
|
+
logger$10.debug('broadcast_channel_removing_listener', {
|
|
11709
11709
|
channel: this.channelName,
|
|
11710
11710
|
connector_id: this.connectorId,
|
|
11711
11711
|
timestamp: new Date().toISOString(),
|
|
11712
11712
|
});
|
|
11713
11713
|
this.channel.removeEventListener('message', this.onMsg);
|
|
11714
11714
|
this.listenerRegistered = false;
|
|
11715
|
-
logger$10.
|
|
11715
|
+
logger$10.debug('broadcast_channel_listener_removed', {
|
|
11716
11716
|
channel: this.channelName,
|
|
11717
11717
|
connector_id: this.connectorId,
|
|
11718
11718
|
timestamp: new Date().toISOString(),
|
|
@@ -11723,13 +11723,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11723
11723
|
this.visibilityChangeListenerRegistered = false;
|
|
11724
11724
|
this.visibilityChangeHandler = undefined;
|
|
11725
11725
|
}
|
|
11726
|
-
logger$10.
|
|
11726
|
+
logger$10.debug('broadcast_channel_closing', {
|
|
11727
11727
|
channel: this.channelName,
|
|
11728
11728
|
connector_id: this.connectorId,
|
|
11729
11729
|
timestamp: new Date().toISOString(),
|
|
11730
11730
|
});
|
|
11731
11731
|
this.channel.close();
|
|
11732
|
-
logger$10.
|
|
11732
|
+
logger$10.debug('broadcast_channel_closed', {
|
|
11733
11733
|
channel: this.channelName,
|
|
11734
11734
|
connector_id: this.connectorId,
|
|
11735
11735
|
timestamp: new Date().toISOString(),
|
|
@@ -11820,6 +11820,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11820
11820
|
}
|
|
11821
11821
|
return undefined;
|
|
11822
11822
|
}
|
|
11823
|
+
/**
|
|
11824
|
+
* Override start() to check initial visibility state
|
|
11825
|
+
*/
|
|
11826
|
+
async start(inboundHandler) {
|
|
11827
|
+
await super.start(inboundHandler);
|
|
11828
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
11829
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
11830
|
+
logger$10.debug('broadcast_channel_start_in_hidden_tab', {
|
|
11831
|
+
channel: this.channelName,
|
|
11832
|
+
connector_id: this.connectorId,
|
|
11833
|
+
timestamp: new Date().toISOString(),
|
|
11834
|
+
});
|
|
11835
|
+
// Immediately pause if tab is hidden at start time
|
|
11836
|
+
await this.pause().catch((err) => {
|
|
11837
|
+
logger$10.warning('broadcast_channel_initial_pause_failed', {
|
|
11838
|
+
channel: this.channelName,
|
|
11839
|
+
connector_id: this.connectorId,
|
|
11840
|
+
error: err instanceof Error ? err.message : String(err),
|
|
11841
|
+
});
|
|
11842
|
+
});
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11823
11845
|
_trimSeenAcks(now) {
|
|
11824
11846
|
while (this.seenAckOrder.length > 0) {
|
|
11825
11847
|
const candidate = this.seenAckOrder[0];
|
|
@@ -12061,6 +12083,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12061
12083
|
this.lastHeartbeatAckTime = null;
|
|
12062
12084
|
this.lastSeenEpoch = null;
|
|
12063
12085
|
this.hadSuccessfulAttach = false;
|
|
12086
|
+
this.lastConnectorState = null;
|
|
12064
12087
|
this.connectEpoch = 0;
|
|
12065
12088
|
const options = normalizeOptions$k(optionsInput);
|
|
12066
12089
|
this.node = options.node;
|
|
@@ -12485,15 +12508,26 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12485
12508
|
if (stopEvt.isSet() || signal?.aborted) {
|
|
12486
12509
|
break;
|
|
12487
12510
|
}
|
|
12511
|
+
const currentState = connector.state;
|
|
12512
|
+
const previousState = this.lastConnectorState;
|
|
12513
|
+
this.lastConnectorState = currentState;
|
|
12488
12514
|
// Skip heartbeat if connector is paused (e.g., tab is hidden)
|
|
12489
12515
|
// Keep ack time current so we don't timeout immediately after resuming
|
|
12490
|
-
if (
|
|
12516
|
+
if (currentState === ConnectorState.PAUSED) {
|
|
12491
12517
|
logger$$.debug('skipping_heartbeat_connector_paused', {
|
|
12492
|
-
connector_state:
|
|
12518
|
+
connector_state: currentState,
|
|
12493
12519
|
});
|
|
12494
12520
|
this.lastHeartbeatAckTime = Date.now();
|
|
12495
12521
|
continue;
|
|
12496
12522
|
}
|
|
12523
|
+
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
12524
|
+
if (previousState === ConnectorState.PAUSED && currentState === ConnectorState.STARTED) {
|
|
12525
|
+
logger$$.debug('connector_just_resumed_resetting_ack_time', {
|
|
12526
|
+
previous_state: previousState,
|
|
12527
|
+
current_state: currentState,
|
|
12528
|
+
});
|
|
12529
|
+
this.lastHeartbeatAckTime = Date.now();
|
|
12530
|
+
}
|
|
12497
12531
|
const envelope = await this.makeHeartbeatEnvelope();
|
|
12498
12532
|
logger$$.debug('sending_heartbeat', {
|
|
12499
12533
|
hb_corr_id: envelope.corrId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAsyncConnector, type BaseAsyncConnectorConfig } from './base-async-connector.js';
|
|
2
2
|
import type { ConnectorConfig } from './connector-config.js';
|
|
3
|
-
import type { FameEnvelope, FameChannelMessage } from '@naylence/core';
|
|
3
|
+
import type { FameEnvelope, FameChannelMessage, FameEnvelopeHandler } from '@naylence/core';
|
|
4
4
|
export declare const BROADCAST_CHANNEL_CONNECTOR_TYPE: "broadcast-channel-connector";
|
|
5
5
|
export interface BroadcastChannelConnectorConfig extends ConnectorConfig {
|
|
6
6
|
type: typeof BROADCAST_CHANNEL_CONNECTOR_TYPE;
|
|
@@ -35,6 +35,10 @@ export declare class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
35
35
|
private _checkDuplicateAck;
|
|
36
36
|
private _extractEnvelopeFromInboxItem;
|
|
37
37
|
private _extractSenderIdFromInboxItem;
|
|
38
|
+
/**
|
|
39
|
+
* Override start() to check initial visibility state
|
|
40
|
+
*/
|
|
41
|
+
start(inboundHandler: FameEnvelopeHandler): Promise<void>;
|
|
38
42
|
private _trimSeenAcks;
|
|
39
43
|
private _extractAckDedupKey;
|
|
40
44
|
}
|
|
@@ -65,6 +65,7 @@ export declare class UpstreamSessionManager extends TaskSpawner implements Sessi
|
|
|
65
65
|
private lastHeartbeatAckTime;
|
|
66
66
|
private lastSeenEpoch;
|
|
67
67
|
private hadSuccessfulAttach;
|
|
68
|
+
private lastConnectorState;
|
|
68
69
|
private connectEpoch;
|
|
69
70
|
constructor(optionsInput: UpstreamSessionManagerOptionsInput);
|
|
70
71
|
get systemId(): string | null;
|
package/dist/types/version.d.ts
CHANGED