@naylence/runtime 0.3.6 → 0.3.9

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.
Files changed (82) hide show
  1. package/dist/browser/index.cjs +262 -172
  2. package/dist/browser/index.mjs +261 -173
  3. package/dist/cjs/_env-shim.js +3 -1
  4. package/dist/cjs/naylence/fame/config/extended-fame-config.js +2 -1
  5. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
  6. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
  7. package/dist/cjs/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
  8. package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +11 -7
  9. package/dist/cjs/naylence/fame/connector/index.js +2 -1
  10. package/dist/cjs/naylence/fame/connector/inpage-connector-factory.js +2 -1
  11. package/dist/cjs/naylence/fame/connector/inpage-connector.js +13 -6
  12. package/dist/cjs/naylence/fame/connector/inpage-listener-factory.js +4 -4
  13. package/dist/cjs/naylence/fame/connector/inpage-listener.js +5 -2
  14. package/dist/cjs/naylence/fame/delivery/default-delivery-tracker.js +4 -62
  15. package/dist/cjs/naylence/fame/fabric/fabric-registry.js +41 -0
  16. package/dist/cjs/naylence/fame/fabric/in-process-fame-fabric.js +3 -0
  17. package/dist/cjs/naylence/fame/fabric/index.js +3 -1
  18. package/dist/cjs/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
  19. package/dist/cjs/naylence/fame/grants/inpage-connection-grant.js +4 -2
  20. package/dist/cjs/naylence/fame/http/oauth2-token-router.js +9 -9
  21. package/dist/cjs/naylence/fame/node/admission/default-node-attach-client.js +34 -5
  22. package/dist/cjs/naylence/fame/node/upstream-session-manager.js +40 -8
  23. package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
  24. package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
  25. package/dist/cjs/naylence/fame/security/default-security-manager.js +2 -1
  26. package/dist/cjs/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +2 -2
  27. package/dist/cjs/naylence/fame/security/trust-store/trust-store-provider-factory.js +2 -2
  28. package/dist/cjs/naylence/fame/util/index.js +3 -1
  29. package/dist/cjs/node.js +4 -1
  30. package/dist/cjs/runtime-isomorphic.js +4 -1
  31. package/dist/cjs/version.js +2 -2
  32. package/dist/esm/_env-shim.js +3 -1
  33. package/dist/esm/browser.js +2 -2
  34. package/dist/esm/naylence/fame/config/extended-fame-config.js +2 -1
  35. package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
  36. package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
  37. package/dist/esm/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
  38. package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +11 -7
  39. package/dist/esm/naylence/fame/connector/index.js +2 -2
  40. package/dist/esm/naylence/fame/connector/inpage-connector-factory.js +2 -1
  41. package/dist/esm/naylence/fame/connector/inpage-connector.js +13 -6
  42. package/dist/esm/naylence/fame/connector/inpage-listener-factory.js +4 -4
  43. package/dist/esm/naylence/fame/connector/inpage-listener.js +5 -2
  44. package/dist/esm/naylence/fame/delivery/default-delivery-tracker.js +4 -62
  45. package/dist/esm/naylence/fame/fabric/fabric-registry.js +37 -0
  46. package/dist/esm/naylence/fame/fabric/in-process-fame-fabric.js +3 -0
  47. package/dist/esm/naylence/fame/fabric/index.js +1 -0
  48. package/dist/esm/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
  49. package/dist/esm/naylence/fame/grants/inpage-connection-grant.js +4 -2
  50. package/dist/esm/naylence/fame/http/oauth2-token-router.js +9 -9
  51. package/dist/esm/naylence/fame/node/admission/default-node-attach-client.js +34 -5
  52. package/dist/esm/naylence/fame/node/upstream-session-manager.js +40 -8
  53. package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
  54. package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
  55. package/dist/esm/naylence/fame/security/default-security-manager.js +2 -1
  56. package/dist/esm/naylence/fame/security/index.js +1 -1
  57. package/dist/esm/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +3 -3
  58. package/dist/esm/naylence/fame/security/trust-store/trust-store-provider-factory.js +3 -3
  59. package/dist/esm/naylence/fame/util/index.js +1 -0
  60. package/dist/esm/node.js +2 -1
  61. package/dist/esm/runtime-isomorphic.js +2 -0
  62. package/dist/esm/version.js +2 -2
  63. package/dist/node/index.cjs +259 -171
  64. package/dist/node/index.mjs +258 -172
  65. package/dist/node/node.cjs +225 -136
  66. package/dist/node/node.mjs +223 -137
  67. package/dist/types/browser.d.ts +2 -2
  68. package/dist/types/naylence/fame/connector/broadcast-channel-connector-factory.d.ts +1 -0
  69. package/dist/types/naylence/fame/connector/index.d.ts +3 -3
  70. package/dist/types/naylence/fame/delivery/default-delivery-tracker.d.ts +0 -6
  71. package/dist/types/naylence/fame/fabric/fabric-registry.d.ts +29 -0
  72. package/dist/types/naylence/fame/fabric/index.d.ts +1 -0
  73. package/dist/types/naylence/fame/node/admission/default-node-attach-client.d.ts +1 -0
  74. package/dist/types/naylence/fame/security/index.d.ts +1 -1
  75. package/dist/types/naylence/fame/security/trust-store/noop-trust-store-provider-factory.d.ts +3 -3
  76. package/dist/types/naylence/fame/security/trust-store/trust-store-provider-factory.d.ts +4 -4
  77. package/dist/types/naylence/fame/security/trust-store/trust-store-provider.d.ts +5 -5
  78. package/dist/types/naylence/fame/util/index.d.ts +1 -0
  79. package/dist/types/node.d.ts +2 -1
  80. package/dist/types/runtime-isomorphic.d.ts +1 -0
  81. package/dist/types/version.d.ts +1 -1
  82. package/package.json +1 -1
@@ -5563,12 +5563,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5563
5563
  }
5564
5564
 
5565
5565
  // This file is auto-generated during build - do not edit manually
5566
- // Generated from package.json version: 0.3.6
5566
+ // Generated from package.json version: 0.3.9
5567
5567
  /**
5568
5568
  * The package version, injected at build time.
5569
5569
  * @internal
5570
5570
  */
5571
- const VERSION = '0.3.6';
5571
+ const VERSION = '0.3.9';
5572
5572
 
5573
5573
  /**
5574
5574
  * Fame errors module - Fame protocol specific error classes
@@ -9727,9 +9727,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
9727
9727
  this.ackDoneSince = new Map();
9728
9728
  this.replyDoneSince = new Map();
9729
9729
  this.pendingAckDispatches = new Set();
9730
- this.recentlyHandled = new Map();
9731
- this.recentlyHandledOrder = [];
9732
- this.recentlyHandledTtlMs = 60000;
9733
9730
  this.isPreparingToStop = false;
9734
9731
  this.shutdownRequestedAtMs = null;
9735
9732
  this.shutdownRetryGraceMs = 1000;
@@ -9965,22 +9962,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
9965
9962
  }
9966
9963
  }
9967
9964
  else {
9968
- const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
9969
- if (wasRecentlyHandled) {
9970
- logger$12.debug('tracker_duplicate_envelope_recently_handled', {
9971
- envp_id: envelope.id,
9972
- });
9973
- return new TrackedEnvelope({
9974
- timeoutAtMs: 0,
9975
- overallTimeoutAtMs: 0,
9976
- expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
9977
- createdAtMs: Date.now(),
9978
- status: EnvelopeStatus.HANDLED,
9979
- mailboxType: MailboxType.INBOX,
9980
- originalEnvelope: envelope,
9981
- serviceName: inboxName,
9982
- });
9983
- }
9984
9965
  tracked = new TrackedEnvelope({
9985
9966
  timeoutAtMs: 0,
9986
9967
  overallTimeoutAtMs: 0,
@@ -10002,12 +9983,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
10002
9983
  async onEnvelopeHandled(envelope) {
10003
9984
  const inbox = this.ensureInbox();
10004
9985
  envelope.status = EnvelopeStatus.HANDLED;
9986
+ // Delete the envelope from inbox to prevent growth
10005
9987
  await inbox.delete(envelope.originalEnvelope.id);
10006
- await this.lock.runExclusive(async () => {
10007
- this.markRecentlyHandled(envelope.originalEnvelope.id);
10008
- });
10009
- // Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
10010
- // await inbox.set(envelope.originalEnvelope.id, envelope);
10011
9988
  }
10012
9989
  async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
10013
9990
  void context;
@@ -10226,9 +10203,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
10226
10203
  });
10227
10204
  await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
10228
10205
  await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
10229
- if (envelope.rtype && Boolean(envelope.rtype & core.FameResponseType.ACK)) {
10230
- await this.sendAck(envelope);
10231
- }
10206
+ // Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
10207
+ // when the reply envelope is first delivered. No need to send it again here.
10208
+ // Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
10232
10209
  for (const handler of this.eventHandlers) {
10233
10210
  await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
10234
10211
  }
@@ -10378,8 +10355,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
10378
10355
  }
10379
10356
  this.streamDone.clear();
10380
10357
  this.correlationToEnvelope.clear();
10381
- this.recentlyHandled.clear();
10382
- this.recentlyHandledOrder.length = 0;
10383
10358
  return values;
10384
10359
  });
10385
10360
  for (const timer of timers) {
@@ -10961,39 +10936,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
10961
10936
  this.pendingAckDispatches.delete(ackDispatch);
10962
10937
  }
10963
10938
  }
10964
- markRecentlyHandled(envelopeId) {
10965
- const now = Date.now();
10966
- this.recentlyHandled.set(envelopeId, now);
10967
- this.recentlyHandledOrder.push(envelopeId);
10968
- this.trimRecentlyHandled(now);
10969
- }
10970
- wasRecentlyHandled(envelopeId) {
10971
- const now = Date.now();
10972
- const timestamp = this.recentlyHandled.get(envelopeId);
10973
- if (timestamp === undefined) {
10974
- return false;
10975
- }
10976
- if (now - timestamp > this.recentlyHandledTtlMs) {
10977
- this.recentlyHandled.delete(envelopeId);
10978
- return false;
10979
- }
10980
- return true;
10981
- }
10982
- trimRecentlyHandled(now) {
10983
- while (this.recentlyHandledOrder.length > 0) {
10984
- const candidate = this.recentlyHandledOrder[0];
10985
- const timestamp = this.recentlyHandled.get(candidate);
10986
- if (timestamp === undefined) {
10987
- this.recentlyHandledOrder.shift();
10988
- continue;
10989
- }
10990
- if (now - timestamp <= this.recentlyHandledTtlMs) {
10991
- break;
10992
- }
10993
- this.recentlyHandled.delete(candidate);
10994
- this.recentlyHandledOrder.shift();
10995
- }
10996
- }
10997
10939
  getShutdownRetryDeferDelay(nowMs) {
10998
10940
  if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
10999
10941
  return null;
@@ -11570,7 +11512,8 @@ const ensureBroadcastEnvironment = () => {
11570
11512
  };
11571
11513
  let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAsyncConnector {
11572
11514
  static generateConnectorId() {
11573
- const globalCrypto = globalThis.crypto;
11515
+ const globalCrypto = globalThis
11516
+ .crypto;
11574
11517
  if (globalCrypto?.randomUUID) {
11575
11518
  return globalCrypto.randomUUID();
11576
11519
  }
@@ -11625,7 +11568,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11625
11568
  this.listenerRegistered = false;
11626
11569
  this.visibilityChangeListenerRegistered = false;
11627
11570
  this.channelName =
11628
- typeof config.channelName === 'string' && config.channelName.trim().length > 0
11571
+ typeof config.channelName === 'string' &&
11572
+ config.channelName.trim().length > 0
11629
11573
  ? config.channelName.trim()
11630
11574
  : DEFAULT_CHANNEL$7;
11631
11575
  const preferredCapacity = typeof config.inboxCapacity === 'number' &&
@@ -11649,6 +11593,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11649
11593
  local_node_id: this.localNodeId,
11650
11594
  target_node_id: this.targetNodeId ?? null,
11651
11595
  inbox_capacity: preferredCapacity,
11596
+ passive: config.passive ?? false,
11652
11597
  timestamp: new Date().toISOString(),
11653
11598
  });
11654
11599
  this.onMsg = (event) => {
@@ -11666,7 +11611,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11666
11611
  channel: this.channelName,
11667
11612
  connector_id: this.connectorId,
11668
11613
  message_type: message && typeof message === 'object'
11669
- ? message.constructor?.name ?? typeof message
11614
+ ? (message.constructor
11615
+ ?.name ?? typeof message)
11670
11616
  : typeof message,
11671
11617
  has_sender_id: Boolean(message?.senderId),
11672
11618
  has_sender_node_id: Boolean(message?.senderNodeId),
@@ -11896,7 +11842,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11896
11842
  timestamp: new Date().toISOString(),
11897
11843
  });
11898
11844
  }
11899
- if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
11845
+ if (this.visibilityChangeListenerRegistered &&
11846
+ this.visibilityChangeHandler &&
11847
+ typeof document !== 'undefined') {
11900
11848
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
11901
11849
  this.visibilityChangeListenerRegistered = false;
11902
11850
  this.visibilityChangeHandler = undefined;
@@ -11924,7 +11872,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11924
11872
  return rawOrEnvelope;
11925
11873
  }
11926
11874
  _isWildcardTarget() {
11927
- return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
11875
+ return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
11928
11876
  }
11929
11877
  _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
11930
11878
  if (this._isWildcardTarget()) {
@@ -11944,7 +11892,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11944
11892
  return true;
11945
11893
  }
11946
11894
  const expectedSender = this.targetNodeId;
11947
- if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
11895
+ if (expectedSender &&
11896
+ expectedSender !== '*' &&
11897
+ senderNodeId !== expectedSender) {
11948
11898
  logger$10.debug('broadcast_channel_message_rejected', {
11949
11899
  channel: this.channelName,
11950
11900
  connector_id: this.connectorId,
@@ -12118,14 +12068,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
12118
12068
  type,
12119
12069
  purpose,
12120
12070
  };
12121
- const channelValue = candidate.channelName ?? candidate['channel_name'];
12071
+ const channelValue = candidate.channelName ??
12072
+ candidate['channel_name'];
12122
12073
  if (channelValue !== undefined) {
12123
12074
  if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
12124
12075
  throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
12125
12076
  }
12126
12077
  result.channelName = channelValue.trim();
12127
12078
  }
12128
- const inboxValue = candidate.inboxCapacity ?? candidate['inbox_capacity'];
12079
+ const inboxValue = candidate.inboxCapacity ??
12080
+ candidate['inbox_capacity'];
12129
12081
  if (inboxValue !== undefined) {
12130
12082
  if (typeof inboxValue !== 'number' ||
12131
12083
  !Number.isFinite(inboxValue) ||
@@ -12134,7 +12086,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
12134
12086
  }
12135
12087
  result.inboxCapacity = Math.floor(inboxValue);
12136
12088
  }
12137
- const windowValue = candidate.initialWindow ?? candidate['initial_window'];
12089
+ const windowValue = candidate.initialWindow ??
12090
+ candidate['initial_window'];
12138
12091
  if (windowValue !== undefined) {
12139
12092
  if (typeof windowValue !== 'number' ||
12140
12093
  !Number.isFinite(windowValue) ||
@@ -12471,25 +12424,56 @@ class UpstreamSessionManager extends TaskSpawner {
12471
12424
  await connector.start(this.wrappedHandler);
12472
12425
  this.connector = connector;
12473
12426
  const callbackGrants = this.node.gatherSupportedCallbackGrants();
12427
+ logger$$.debug('callback_grants_before_augmentation', {
12428
+ count: callbackGrants.length,
12429
+ types: callbackGrants.map((g) => g.type),
12430
+ });
12431
+ // Check if we should create a broadcast callback grant before processing connection grants
12432
+ // This prevents adding duplicate broadcast grants
12433
+ const shouldAddBroadcastGrant = this.shouldAdvertiseBroadcastGrant(grant, callbackGrants);
12434
+ const broadcastCallbackGrant = shouldAddBroadcastGrant
12435
+ ? this.createBroadcastCallbackGrant(grant)
12436
+ : null;
12437
+ logger$$.debug('broadcast_callback_grant_check', {
12438
+ should_add: shouldAddBroadcastGrant,
12439
+ grant_created: !!broadcastCallbackGrant,
12440
+ });
12474
12441
  // Include admission client's connection grants as callback grants
12475
12442
  // This ensures DirectAdmissionClient grants are available for grant selection
12476
- if (welcome.frame.connectionGrants && Array.isArray(welcome.frame.connectionGrants)) {
12443
+ if (welcome.frame.connectionGrants &&
12444
+ Array.isArray(welcome.frame.connectionGrants)) {
12477
12445
  for (const grant of welcome.frame.connectionGrants) {
12478
12446
  if (grant && typeof grant === 'object') {
12479
12447
  // Avoid duplicates by checking if grant already exists
12480
- const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
12448
+ const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
12481
12449
  if (!isDuplicate) {
12482
12450
  callbackGrants.push(grant);
12451
+ logger$$.debug('added_connection_grant_as_callback', {
12452
+ type: grant.type,
12453
+ });
12454
+ }
12455
+ else {
12456
+ logger$$.debug('skipped_duplicate_connection_grant', {
12457
+ type: grant.type,
12458
+ });
12483
12459
  }
12484
12460
  }
12485
12461
  }
12486
12462
  }
12487
- if (this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
12488
- const augmented = this.createBroadcastCallbackGrant(grant);
12489
- if (augmented) {
12490
- callbackGrants.push(augmented);
12491
- }
12463
+ // Add broadcast grant after connection grants to ensure we don't duplicate
12464
+ // any broadcast grants that may have been in connectionGrants
12465
+ if (broadcastCallbackGrant &&
12466
+ this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
12467
+ callbackGrants.push(broadcastCallbackGrant);
12468
+ logger$$.debug('added_broadcast_callback_grant');
12492
12469
  }
12470
+ else if (broadcastCallbackGrant) {
12471
+ logger$$.debug('skipped_duplicate_broadcast_callback_grant');
12472
+ }
12473
+ logger$$.debug('callback_grants_after_augmentation', {
12474
+ count: callbackGrants.length,
12475
+ types: callbackGrants.map((g) => g.type),
12476
+ });
12493
12477
  const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
12494
12478
  this.targetSystemId = attachInfo.targetSystemId ?? null;
12495
12479
  if (this.targetSystemId) {
@@ -12730,7 +12714,8 @@ class UpstreamSessionManager extends TaskSpawner {
12730
12714
  continue;
12731
12715
  }
12732
12716
  // Reset ack time if just resumed from pause (prevents immediate timeout)
12733
- if (previousState === core.ConnectorState.PAUSED && currentState === core.ConnectorState.STARTED) {
12717
+ if (previousState === core.ConnectorState.PAUSED &&
12718
+ currentState === core.ConnectorState.STARTED) {
12734
12719
  logger$$.debug('connector_just_resumed_resetting_ack_time', {
12735
12720
  previous_state: previousState,
12736
12721
  current_state: currentState,
@@ -14287,15 +14272,30 @@ class DefaultNodeAttachClient {
14287
14272
  constructor(options = {}) {
14288
14273
  this.buffer = [];
14289
14274
  this.inHandshake = false;
14275
+ this.expectedSystemId = null;
14290
14276
  this.timeoutMs = options.timeoutMs ?? 10000;
14291
14277
  this.attachmentKeyValidator = options.attachmentKeyValidator;
14292
14278
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
14293
14279
  }
14294
14280
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
14295
14281
  this.inHandshake = true;
14282
+ this.expectedSystemId = welcomeFrame.systemId;
14296
14283
  const interimHandler = async (envelope, context) => {
14297
14284
  if (this.inHandshake) {
14298
- this.buffer.push(envelope);
14285
+ // Filter: only buffer frames related to our systemId or frames without systemId info
14286
+ const frameSystemId = envelope.frame
14287
+ ?.systemId;
14288
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
14289
+ this.buffer.push(envelope);
14290
+ }
14291
+ else {
14292
+ // Silently ignore frames from other agents during concurrent handshakes
14293
+ logger$Y.debug('handshake_ignoring_frame_from_different_system', {
14294
+ frame_type: envelope.frame.type,
14295
+ frame_system_id: frameSystemId,
14296
+ expected_system_id: this.expectedSystemId,
14297
+ });
14298
+ }
14299
14299
  return null;
14300
14300
  }
14301
14301
  return finalHandler(envelope, context);
@@ -14422,6 +14422,7 @@ class DefaultNodeAttachClient {
14422
14422
  parent_id: ackFrame.targetSystemId,
14423
14423
  });
14424
14424
  this.inHandshake = false;
14425
+ this.expectedSystemId = null;
14425
14426
  await connector.replaceHandler(finalHandler);
14426
14427
  while (this.buffer.length > 0) {
14427
14428
  const bufferedEnvelope = this.buffer.shift();
@@ -14479,7 +14480,8 @@ class DefaultNodeAttachClient {
14479
14480
  const deadline = Date.now() + this.timeoutMs;
14480
14481
  while (Date.now() < deadline) {
14481
14482
  // Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
14482
- if (connector.state !== core.ConnectorState.STARTED && connector.state !== core.ConnectorState.PAUSED) {
14483
+ if (connector.state !== core.ConnectorState.STARTED &&
14484
+ connector.state !== core.ConnectorState.PAUSED) {
14483
14485
  let errorMessage = 'Connector closed while waiting for NodeAttachAck';
14484
14486
  if (connector.closeCode !== undefined) {
14485
14487
  errorMessage += ` (code=${connector.closeCode}`;
@@ -14498,9 +14500,21 @@ class DefaultNodeAttachClient {
14498
14500
  if (envelope.frame.type === 'NodeAttachAck') {
14499
14501
  return envelope;
14500
14502
  }
14501
- logger$Y.error('unexpected_frame_during_handshake', {
14502
- frame_type: envelope.frame.type,
14503
- });
14503
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
14504
+ // where multiple agents attach concurrently to the same channel
14505
+ if (envelope.frame.type === 'NodeAttach') {
14506
+ logger$Y.debug('handshake_ignoring_concurrent_attach', {
14507
+ frame_type: envelope.frame.type,
14508
+ frame_system_id: envelope.frame?.systemId ??
14509
+ 'unknown',
14510
+ });
14511
+ }
14512
+ else {
14513
+ // Other unexpected frames are still logged as errors
14514
+ logger$Y.error('unexpected_frame_during_handshake', {
14515
+ frame_type: envelope.frame.type,
14516
+ });
14517
+ }
14504
14518
  }
14505
14519
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
14506
14520
  }
@@ -15219,7 +15233,8 @@ function createFsShim() {
15219
15233
  else if (options &&
15220
15234
  typeof options === 'object' &&
15221
15235
  'encoding' in options &&
15222
- typeof options.encoding === 'string') {
15236
+ typeof options.encoding ===
15237
+ 'string') {
15223
15238
  encoding = options.encoding;
15224
15239
  }
15225
15240
  const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
@@ -21638,7 +21653,8 @@ class InPageConnector extends BaseAsyncConnector {
21638
21653
  this.listenerRegistered = false;
21639
21654
  this.visibilityChangeListenerRegistered = false;
21640
21655
  this.channelName =
21641
- typeof config.channelName === 'string' && config.channelName.trim().length > 0
21656
+ typeof config.channelName === 'string' &&
21657
+ config.channelName.trim().length > 0
21642
21658
  ? config.channelName.trim()
21643
21659
  : DEFAULT_CHANNEL$6;
21644
21660
  const preferredCapacity = typeof config.inboxCapacity === 'number' &&
@@ -21677,7 +21693,8 @@ class InPageConnector extends BaseAsyncConnector {
21677
21693
  channel: this.channelName,
21678
21694
  connector_id: this.connectorId,
21679
21695
  message_type: message && typeof message === 'object'
21680
- ? message.constructor?.name ?? typeof message
21696
+ ? (message.constructor
21697
+ ?.name ?? typeof message)
21681
21698
  : typeof message,
21682
21699
  has_sender_id: Boolean(message?.senderId),
21683
21700
  has_sender_node_id: Boolean(message?.senderNodeId),
@@ -21686,7 +21703,8 @@ class InPageConnector extends BaseAsyncConnector {
21686
21703
  return;
21687
21704
  }
21688
21705
  const busMessage = message;
21689
- const senderId = typeof busMessage.senderId === 'string' && busMessage.senderId.length > 0
21706
+ const senderId = typeof busMessage.senderId === 'string' &&
21707
+ busMessage.senderId.length > 0
21690
21708
  ? busMessage.senderId
21691
21709
  : null;
21692
21710
  const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
@@ -21937,7 +21955,9 @@ class InPageConnector extends BaseAsyncConnector {
21937
21955
  timestamp: new Date().toISOString(),
21938
21956
  });
21939
21957
  }
21940
- if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
21958
+ if (this.visibilityChangeListenerRegistered &&
21959
+ this.visibilityChangeHandler &&
21960
+ typeof document !== 'undefined') {
21941
21961
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
21942
21962
  this.visibilityChangeListenerRegistered = false;
21943
21963
  this.visibilityChangeHandler = undefined;
@@ -21954,7 +21974,7 @@ class InPageConnector extends BaseAsyncConnector {
21954
21974
  return rawOrEnvelope;
21955
21975
  }
21956
21976
  _isWildcardTarget() {
21957
- return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
21977
+ return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
21958
21978
  }
21959
21979
  _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
21960
21980
  if (this._isWildcardTarget()) {
@@ -21974,7 +21994,9 @@ class InPageConnector extends BaseAsyncConnector {
21974
21994
  return true;
21975
21995
  }
21976
21996
  const expectedSender = this.targetNodeId;
21977
- if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
21997
+ if (expectedSender &&
21998
+ expectedSender !== '*' &&
21999
+ senderNodeId !== expectedSender) {
21978
22000
  logger$J.debug('inpage_message_rejected', {
21979
22001
  channel: this.channelName,
21980
22002
  connector_id: this.connectorId,
@@ -22376,8 +22398,8 @@ class CertificateManagerFactory extends factory.AbstractResourceFactory {
22376
22398
  }
22377
22399
  }
22378
22400
 
22379
- const DEFAULT_UNCONFIGURED_MESSAGE = "Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.";
22380
- const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = "TrustStoreProviderFactory";
22401
+ const DEFAULT_UNCONFIGURED_MESSAGE = 'Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.';
22402
+ const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
22381
22403
  class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
22382
22404
  createUnconfiguredProvider(reason) {
22383
22405
  return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
@@ -26106,7 +26128,8 @@ class DefaultSecurityManager {
26106
26128
  const hasSignature = Boolean(envelope.sec?.sig);
26107
26129
  if (!hasSignature) {
26108
26130
  const nodeSid = node.sid;
26109
- const envelopeSid = envelope.sid;
26131
+ const envelopeSid = envelope
26132
+ .sid;
26110
26133
  const isLocalUnsignedSelfEnvelope = localContext.originType === core.DeliveryOriginType.LOCAL &&
26111
26134
  typeof nodeSid === 'string' &&
26112
26135
  nodeSid.length > 0 &&
@@ -29350,14 +29373,16 @@ function normalizeInPageConnectionGrant(candidate) {
29350
29373
  type,
29351
29374
  purpose,
29352
29375
  };
29353
- const channelValue = candidate.channelName ?? candidate['channel_name'];
29376
+ const channelValue = candidate.channelName ??
29377
+ candidate['channel_name'];
29354
29378
  if (channelValue !== undefined) {
29355
29379
  if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
29356
29380
  throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
29357
29381
  }
29358
29382
  result.channelName = channelValue.trim();
29359
29383
  }
29360
- const inboxValue = candidate.inboxCapacity ?? candidate['inbox_capacity'];
29384
+ const inboxValue = candidate.inboxCapacity ??
29385
+ candidate['inbox_capacity'];
29361
29386
  if (inboxValue !== undefined) {
29362
29387
  if (typeof inboxValue !== 'number' ||
29363
29388
  !Number.isFinite(inboxValue) ||
@@ -29873,6 +29898,44 @@ function normalizeRouterOptions(options) {
29873
29898
  return { welcomeService, prefix };
29874
29899
  }
29875
29900
 
29901
+ /**
29902
+ * Fabric Registry
29903
+ *
29904
+ * Provides a mapping from nodes to their associated fabrics.
29905
+ * This allows agents to retrieve the fabric they were registered on
29906
+ * without relying on the global fabric stack.
29907
+ */
29908
+ /**
29909
+ * WeakMap to store the node-to-fabric mapping.
29910
+ * Using WeakMap ensures that nodes can be garbage collected
29911
+ * when no longer referenced elsewhere.
29912
+ */
29913
+ const nodeToFabric = new WeakMap();
29914
+ /**
29915
+ * @internal
29916
+ * Associates a node with its fabric. This should only be called
29917
+ * by fabric implementations when they create or adopt a node.
29918
+ *
29919
+ * @param node - The node to associate
29920
+ * @param fabric - The fabric that owns the node
29921
+ */
29922
+ function _setFabricForNode(node, fabric) {
29923
+ nodeToFabric.set(node, fabric);
29924
+ }
29925
+ /**
29926
+ * Retrieves the fabric associated with a node.
29927
+ *
29928
+ * This is useful for agents that need to access the fabric they
29929
+ * were registered on, particularly in environments where multiple
29930
+ * fabrics exist (e.g., React with multiple FabricProviders).
29931
+ *
29932
+ * @param node - The node to look up
29933
+ * @returns The fabric associated with the node, or undefined if not found
29934
+ */
29935
+ function getFabricForNode(node) {
29936
+ return nodeToFabric.get(node);
29937
+ }
29938
+
29876
29939
  /**
29877
29940
  * Browser-friendly entry point for Naylence Runtime.
29878
29941
  *
@@ -30163,7 +30226,9 @@ function normalizeConfig$p(config) {
30163
30226
  : DEFAULT_CHANNEL$5;
30164
30227
  const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
30165
30228
  let inboxCapacity = DEFAULT_INBOX_CAPACITY$5;
30166
- if (typeof rawInbox === 'number' && Number.isFinite(rawInbox) && rawInbox > 0) {
30229
+ if (typeof rawInbox === 'number' &&
30230
+ Number.isFinite(rawInbox) &&
30231
+ rawInbox > 0) {
30167
30232
  inboxCapacity = Math.floor(rawInbox);
30168
30233
  }
30169
30234
  else if (typeof rawInbox === 'string') {
@@ -30191,9 +30256,7 @@ class InPageListenerFactory extends TransportListenerFactory {
30191
30256
  }
30192
30257
  async create(config, ...factoryArgs) {
30193
30258
  const normalized = normalizeConfig$p(config);
30194
- const [{ InPageListener }] = await Promise.all([
30195
- getInPageListenerModule(),
30196
- ]);
30259
+ const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
30197
30260
  void factoryArgs;
30198
30261
  return new InPageListener({
30199
30262
  channelName: normalized.channelName,
@@ -30226,7 +30289,9 @@ function normalizeConfig$o(config) {
30226
30289
  : DEFAULT_CHANNEL$4;
30227
30290
  const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
30228
30291
  let inboxCapacity = DEFAULT_INBOX_CAPACITY$4;
30229
- if (typeof rawInbox === 'number' && Number.isFinite(rawInbox) && rawInbox > 0) {
30292
+ if (typeof rawInbox === 'number' &&
30293
+ Number.isFinite(rawInbox) &&
30294
+ rawInbox > 0) {
30230
30295
  inboxCapacity = Math.floor(rawInbox);
30231
30296
  }
30232
30297
  else if (typeof rawInbox === 'string') {
@@ -30631,7 +30696,8 @@ class InPageConnectorFactory extends ConnectorFactory {
30631
30696
  const normalized = this._normalizeConfig(config);
30632
30697
  const options = (factoryArgs[0] ?? {});
30633
30698
  const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
30634
- const localNodeId = this._normalizeNodeId(options.localNodeId) ?? normalizedLocalNodeFromConfig;
30699
+ const localNodeId = this._normalizeNodeId(options.localNodeId) ??
30700
+ normalizedLocalNodeFromConfig;
30635
30701
  if (!localNodeId) {
30636
30702
  throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
30637
30703
  }
@@ -30807,10 +30873,12 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
30807
30873
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
30808
30874
  };
30809
30875
  const channelCandidate = record.channelName ?? record['channel_name'];
30810
- if (typeof channelCandidate === 'string' && channelCandidate.trim().length > 0) {
30876
+ if (typeof channelCandidate === 'string' &&
30877
+ channelCandidate.trim().length > 0) {
30811
30878
  config.channelName = channelCandidate.trim();
30812
30879
  }
30813
- const inboxCandidate = record.inboxCapacity ?? record['inbox_capacity'];
30880
+ const inboxCandidate = record.inboxCapacity ??
30881
+ record['inbox_capacity'];
30814
30882
  if (typeof inboxCandidate === 'number' &&
30815
30883
  Number.isFinite(inboxCandidate) &&
30816
30884
  inboxCandidate > 0) {
@@ -30834,9 +30902,11 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
30834
30902
  throw new Error('BroadcastChannelConnectorFactory requires a configuration');
30835
30903
  }
30836
30904
  const normalized = this._normalizeConfig(config);
30837
- const options = (factoryArgs[0] ?? {});
30905
+ const options = (factoryArgs[0] ??
30906
+ {});
30838
30907
  const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
30839
- const localNodeId = this._normalizeNodeId(options.localNodeId) ?? normalizedLocalNodeFromConfig;
30908
+ const localNodeId = this._normalizeNodeId(options.localNodeId) ??
30909
+ normalizedLocalNodeFromConfig;
30840
30910
  if (!localNodeId) {
30841
30911
  throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
30842
30912
  }
@@ -30861,6 +30931,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
30861
30931
  inboxCapacity,
30862
30932
  localNodeId,
30863
30933
  initialTargetNodeId: resolvedTarget,
30934
+ passive: normalized.passive,
30864
30935
  };
30865
30936
  const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
30866
30937
  if (options.authorization) {
@@ -30899,6 +30970,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
30899
30970
  if (normalizedLocalNodeId) {
30900
30971
  normalized.localNodeId = normalizedLocalNodeId;
30901
30972
  }
30973
+ if (typeof candidate.passive === 'boolean') {
30974
+ normalized.passive = candidate.passive;
30975
+ }
30902
30976
  if (typeof candidate.flowControl === 'boolean') {
30903
30977
  normalized.flowControl = candidate.flowControl;
30904
30978
  }
@@ -32440,7 +32514,9 @@ class InPageListener extends TransportListener {
32440
32514
  typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
32441
32515
  ? channelCandidate.trim()
32442
32516
  : DEFAULT_CHANNEL$1;
32443
- const normalizedCapacity = typeof inboxCandidate === 'number' && Number.isFinite(inboxCandidate) && inboxCandidate > 0
32517
+ const normalizedCapacity = typeof inboxCandidate === 'number' &&
32518
+ Number.isFinite(inboxCandidate) &&
32519
+ inboxCandidate > 0
32444
32520
  ? Math.floor(inboxCandidate)
32445
32521
  : DEFAULT_INBOX_CAPACITY$1;
32446
32522
  this._inboxCapacity = normalizedCapacity;
@@ -32715,7 +32791,8 @@ class InPageListener extends TransportListener {
32715
32791
  if (grant.type === INPAGE_CONNECTION_GRANT_TYPE) {
32716
32792
  return inPageGrantToConnectorConfig(grant);
32717
32793
  }
32718
- if (typeof grant?.toConnectorConfig === 'function') {
32794
+ if (typeof grant
32795
+ ?.toConnectorConfig === 'function') {
32719
32796
  return grant.toConnectorConfig();
32720
32797
  }
32721
32798
  throw new Error(`Unsupported grant type: ${grant.type}`);
@@ -32855,9 +32932,7 @@ var inpageListener = /*#__PURE__*/Object.freeze({
32855
32932
  const logger$n = getLogger('naylence.fame.connector.broadcast_channel_listener');
32856
32933
  const DEFAULT_CHANNEL = 'naylence-fabric';
32857
32934
  const DEFAULT_INBOX_CAPACITY = 2048;
32858
- const RESPONSE_TYPE_MASK = core.FameResponseType.ACK |
32859
- core.FameResponseType.REPLY |
32860
- core.FameResponseType.STREAM;
32935
+ const RESPONSE_TYPE_MASK = core.FameResponseType.ACK | core.FameResponseType.REPLY | core.FameResponseType.STREAM;
32861
32936
  const isBrowserEnvironment$1 = () => typeof window !== 'undefined' &&
32862
32937
  typeof BroadcastChannel !== 'undefined' &&
32863
32938
  typeof MessageEvent !== 'undefined';
@@ -33071,9 +33146,7 @@ class BroadcastChannelListener extends TransportListener {
33071
33146
  return null;
33072
33147
  }
33073
33148
  })();
33074
- if (error instanceof zod.ZodError &&
33075
- decoded &&
33076
- decoded.length > 0) {
33149
+ if (error instanceof zod.ZodError && decoded && decoded.length > 0) {
33077
33150
  try {
33078
33151
  const reparsed = JSON.parse(decoded);
33079
33152
  const candidate = reparsed.rtype;
@@ -33296,11 +33369,19 @@ class BroadcastChannelListener extends TransportListener {
33296
33369
  ? Math.floor(initialWindowCandidate)
33297
33370
  : undefined;
33298
33371
  const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
33372
+ const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
33373
+ logger$n.debug('broadcast_channel_listener_building_connector_config', {
33374
+ system_id: systemId,
33375
+ channel_name: channelName,
33376
+ passive,
33377
+ has_base_config: !!baseConfig,
33378
+ passive_candidate: passiveCandidate,
33379
+ });
33299
33380
  return {
33300
33381
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
33301
33382
  channelName,
33302
33383
  inboxCapacity,
33303
- passive: typeof passiveCandidate === 'boolean' ? passiveCandidate : true,
33384
+ passive,
33304
33385
  initialWindow,
33305
33386
  localNodeId,
33306
33387
  initialTargetNodeId,
@@ -33489,6 +33570,8 @@ class InProcessFameFabric extends core.FameFabric {
33489
33570
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
33490
33571
  this._ownsNode = true;
33491
33572
  }
33573
+ // Register this fabric in the registry so agents can look it up
33574
+ _setFabricForNode(this._currentNode, this);
33492
33575
  if (this._ownsNode && !this._nodeStarted) {
33493
33576
  await this.getRequiredNode().start();
33494
33577
  this._nodeStarted = true;
@@ -34170,7 +34253,9 @@ function parseCookies(cookieHeader) {
34170
34253
  if (!cookieHeader) {
34171
34254
  return {};
34172
34255
  }
34173
- return cookieHeader.split(';').reduce((acc, entry) => {
34256
+ return cookieHeader
34257
+ .split(';')
34258
+ .reduce((acc, entry) => {
34174
34259
  const [rawName, ...rawValueParts] = entry.split('=');
34175
34260
  const name = rawName?.trim();
34176
34261
  if (!name) {
@@ -34318,10 +34403,7 @@ function setNoCacheHeaders(res) {
34318
34403
  res.set('Pragma', 'no-cache');
34319
34404
  }
34320
34405
  function respondInvalidClient(res) {
34321
- res
34322
- .status(401)
34323
- .set('WWW-Authenticate', 'Basic')
34324
- .json({
34406
+ res.status(401).set('WWW-Authenticate', 'Basic').json({
34325
34407
  error: 'invalid_client',
34326
34408
  error_description: 'Invalid client credentials',
34327
34409
  });
@@ -34358,10 +34440,10 @@ function createOAuth2TokenRouter(options) {
34358
34440
  DEFAULT_JWT_ALGORITHM$1;
34359
34441
  const allowedScopes = getAllowedScopes$1(configAllowedScopes);
34360
34442
  const resolvedTokenTtlSec = tokenTtlSec ?? 3600;
34361
- const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ??
34362
- (configEnablePkce ?? true);
34443
+ const enablePkce = coerceBoolean(process.env[ENV_VAR_ENABLE_PKCE]) ?? configEnablePkce ?? true;
34363
34444
  const allowPublicClients = coerceBoolean(process.env[ENV_VAR_ALLOW_PUBLIC_CLIENTS]) ??
34364
- (configAllowPublicClients ?? true);
34445
+ configAllowPublicClients ??
34446
+ true;
34365
34447
  const authorizationCodeTtlSec = ensurePositiveInteger(coerceNumber$1(process.env[ENV_VAR_AUTHORIZATION_CODE_TTL]) ??
34366
34448
  configAuthorizationCodeTtlSec) ?? DEFAULT_AUTHORIZATION_CODE_TTL_SEC;
34367
34449
  const devLoginExplicitlyEnabled = coerceBoolean(process.env[ENV_VAR_ENABLE_DEV_LOGIN]) ??
@@ -34376,7 +34458,8 @@ function createOAuth2TokenRouter(options) {
34376
34458
  configDevLoginCookieName ??
34377
34459
  DEFAULT_SESSION_COOKIE_NAME;
34378
34460
  const devLoginSecureCookie = coerceBoolean(process.env[ENV_VAR_SESSION_SECURE_COOKIE]) ??
34379
- (configDevLoginSecureCookie ?? false);
34461
+ configDevLoginSecureCookie ??
34462
+ false;
34380
34463
  const devLoginTitle = coerceString$2(process.env[ENV_VAR_LOGIN_TITLE]) ??
34381
34464
  configDevLoginTitle ??
34382
34465
  DEFAULT_LOGIN_TITLE;
@@ -37443,19 +37526,23 @@ function normalizeConfig$a(config) {
37443
37526
  normalized.clientSecretConfig = normalizeSecretSource(clientSecretSource);
37444
37527
  }
37445
37528
  const audienceCandidate = candidate.audience ?? candidate.aud;
37446
- if (typeof audienceCandidate === 'string' && audienceCandidate.trim().length > 0) {
37529
+ if (typeof audienceCandidate === 'string' &&
37530
+ audienceCandidate.trim().length > 0) {
37447
37531
  normalized.audience = audienceCandidate.trim();
37448
37532
  }
37449
37533
  const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
37450
- if (typeof codeChallengeMethod === 'string' && codeChallengeMethod.trim().length > 0) {
37534
+ if (typeof codeChallengeMethod === 'string' &&
37535
+ codeChallengeMethod.trim().length > 0) {
37451
37536
  normalized.codeChallengeMethod = codeChallengeMethod.trim();
37452
37537
  }
37453
37538
  const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
37454
- if (typeof codeVerifierLength === 'number' && Number.isFinite(codeVerifierLength)) {
37539
+ if (typeof codeVerifierLength === 'number' &&
37540
+ Number.isFinite(codeVerifierLength)) {
37455
37541
  normalized.codeVerifierLength = codeVerifierLength;
37456
37542
  }
37457
37543
  const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
37458
- if (typeof clockSkewSeconds === 'number' && Number.isFinite(clockSkewSeconds)) {
37544
+ if (typeof clockSkewSeconds === 'number' &&
37545
+ Number.isFinite(clockSkewSeconds)) {
37459
37546
  normalized.clockSkewSeconds = clockSkewSeconds;
37460
37547
  }
37461
37548
  const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
@@ -37500,8 +37587,8 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
37500
37587
  options.audience = normalized.audience;
37501
37588
  }
37502
37589
  if (normalized.codeChallengeMethod) {
37503
- options.codeChallengeMethod = normalized.codeChallengeMethod
37504
- .toUpperCase();
37590
+ options.codeChallengeMethod =
37591
+ normalized.codeChallengeMethod.toUpperCase();
37505
37592
  }
37506
37593
  if (normalized.codeVerifierLength) {
37507
37594
  options.codeVerifierLength = normalized.codeVerifierLength;
@@ -39259,14 +39346,14 @@ var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
39259
39346
 
39260
39347
  const FACTORY_META$d = {
39261
39348
  base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
39262
- key: "NoopTrustStoreProvider",
39349
+ key: 'NoopTrustStoreProvider',
39263
39350
  isDefault: true,
39264
39351
  priority: 10,
39265
39352
  };
39266
39353
  class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
39267
39354
  constructor() {
39268
39355
  super(...arguments);
39269
- this.type = "NoopTrustStoreProvider";
39356
+ this.type = 'NoopTrustStoreProvider';
39270
39357
  this.isDefault = true;
39271
39358
  this.priority = 10;
39272
39359
  }
@@ -41504,8 +41591,7 @@ function normalizeOptions$2(raw) {
41504
41591
  const scopes = normalizeScopes(camel.scopes) ??
41505
41592
  normalizeScopes(snake.scopes ?? snake.scope) ??
41506
41593
  DEFAULT_SCOPES.slice();
41507
- const audience = coerceString(camel.audience) ??
41508
- coerceString(snake.audience ?? snake.aud);
41594
+ const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
41509
41595
  const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
41510
41596
  const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
41511
41597
  coerceNumber(snake.clock_skew_seconds) ??
@@ -43167,6 +43253,7 @@ exports.TokenIssuerFactory = TokenIssuerFactory;
43167
43253
  exports.TokenProviderFactory = TokenProviderFactory;
43168
43254
  exports.TokenVerifierFactory = TokenVerifierFactory;
43169
43255
  exports.TransportListener = TransportListener;
43256
+ exports.TransportListenerFactory = TransportListenerFactory;
43170
43257
  exports.TransportProvisionerFactory = TransportProvisionerFactory;
43171
43258
  exports.TrustStoreProviderFactory = TrustStoreProviderFactory;
43172
43259
  exports.TtlValidationError = TtlValidationError;
@@ -43232,6 +43319,7 @@ exports.formatTimestamp = formatTimestamp;
43232
43319
  exports.formatTimestampForConsole = formatTimestampForConsole$1;
43233
43320
  exports.frameDigest = frameDigest;
43234
43321
  exports.getCurrentEnvelope = getCurrentEnvelope;
43322
+ exports.getFabricForNode = getFabricForNode;
43235
43323
  exports.getFameRoot = getFameRoot;
43236
43324
  exports.getHttpListenerInstance = getHttpListenerInstance;
43237
43325
  exports.getInPageListenerInstance = getInPageListenerInstance;
@@ -43303,6 +43391,7 @@ exports.requireCryptoSupport = requireCryptoSupport;
43303
43391
  exports.retryWithBackoff = retryWithBackoff;
43304
43392
  exports.runOAuth2Server = main;
43305
43393
  exports.safeColor = safeColor;
43394
+ exports.safeImport = safeImport;
43306
43395
  exports.sealedDecrypt = sealedDecrypt;
43307
43396
  exports.sealedEncrypt = sealedEncrypt;
43308
43397
  exports.secureDigest = secureDigest;