@naylence/runtime 0.3.5-test.952 → 0.3.5-test.954

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 (38) hide show
  1. package/dist/browser/index.cjs +32 -464
  2. package/dist/browser/index.mjs +32 -464
  3. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +2 -14
  4. package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +1 -90
  5. package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +10 -76
  6. package/dist/cjs/naylence/fame/connector/inpage-connector-factory.js +0 -12
  7. package/dist/cjs/naylence/fame/connector/inpage-connector.js +1 -87
  8. package/dist/cjs/naylence/fame/connector/inpage-listener.js +2 -49
  9. package/dist/cjs/naylence/fame/grants/broadcast-channel-connection-grant.js +12 -23
  10. package/dist/cjs/naylence/fame/grants/inpage-connection-grant.js +0 -28
  11. package/dist/cjs/naylence/fame/node/upstream-session-manager.js +0 -6
  12. package/dist/cjs/version.js +2 -2
  13. package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +2 -14
  14. package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +1 -90
  15. package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +10 -76
  16. package/dist/esm/naylence/fame/connector/inpage-connector-factory.js +0 -12
  17. package/dist/esm/naylence/fame/connector/inpage-connector.js +1 -87
  18. package/dist/esm/naylence/fame/connector/inpage-listener.js +2 -49
  19. package/dist/esm/naylence/fame/grants/broadcast-channel-connection-grant.js +12 -23
  20. package/dist/esm/naylence/fame/grants/inpage-connection-grant.js +0 -28
  21. package/dist/esm/naylence/fame/node/upstream-session-manager.js +0 -6
  22. package/dist/esm/version.js +2 -2
  23. package/dist/node/index.cjs +32 -464
  24. package/dist/node/index.mjs +32 -464
  25. package/dist/node/node.cjs +32 -480
  26. package/dist/node/node.mjs +32 -480
  27. package/dist/types/naylence/fame/connector/broadcast-channel-connector-factory.d.ts +0 -2
  28. package/dist/types/naylence/fame/connector/broadcast-channel-connector.browser.d.ts +1 -4
  29. package/dist/types/naylence/fame/connector/inpage-connector-factory.d.ts +0 -2
  30. package/dist/types/naylence/fame/connector/inpage-connector.d.ts +0 -4
  31. package/dist/types/naylence/fame/connector/inpage-listener.d.ts +0 -1
  32. package/dist/types/naylence/fame/grants/broadcast-channel-connection-grant.d.ts +3 -6
  33. package/dist/types/naylence/fame/grants/inpage-connection-grant.d.ts +0 -8
  34. package/dist/types/version.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/dist/cjs/naylence/fame/connector/transport-frame.js +0 -100
  37. package/dist/esm/naylence/fame/connector/transport-frame.js +0 -93
  38. package/dist/types/naylence/fame/connector/transport-frame.d.ts +0 -56
@@ -96,12 +96,12 @@ installProcessEnvShim();
96
96
  // --- END ENV SHIM ---
97
97
 
98
98
  // This file is auto-generated during build - do not edit manually
99
- // Generated from package.json version: 0.3.5-test.952
99
+ // Generated from package.json version: 0.3.5-test.954
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.5-test.952';
104
+ const VERSION = '0.3.5-test.954';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -9816,84 +9816,6 @@ class BoundedAsyncQueue {
9816
9816
  }
9817
9817
  }
9818
9818
 
9819
- /**
9820
- * Transport frame layer for multiplexing logical links on physical channels.
9821
- *
9822
- * This lightweight framing layer wraps raw FAME payloads to enable multiple
9823
- * logical connections over a single physical channel (BroadcastChannel or InPage bus).
9824
- *
9825
- * The transport frame does NOT modify FAME envelopes - it only wraps the raw
9826
- * Uint8Array payload at the connector level.
9827
- */
9828
- /**
9829
- * Transport frame version for future compatibility
9830
- */
9831
- const TRANSPORT_FRAME_VERSION = 1;
9832
- /**
9833
- * Wrap a raw payload in a transport frame
9834
- *
9835
- * @param payload - Raw FAME envelope bytes
9836
- * @param srcNodeId - Local node ID (this connector)
9837
- * @param dstNodeId - Remote node ID (target connector)
9838
- * @returns Transport frame ready for transmission
9839
- */
9840
- function wrapTransportFrame(payload, srcNodeId, dstNodeId) {
9841
- return {
9842
- v: TRANSPORT_FRAME_VERSION,
9843
- src: srcNodeId,
9844
- dst: dstNodeId,
9845
- payload,
9846
- };
9847
- }
9848
- /**
9849
- * Serialize a transport frame for transmission over the bus
9850
- *
9851
- * @param frame - Transport frame to serialize
9852
- * @returns Serialized frame data ready for postMessage/dispatchEvent
9853
- */
9854
- function serializeTransportFrame(frame) {
9855
- // Convert Uint8Array to regular array for JSON serialization
9856
- const serializable = {
9857
- v: frame.v,
9858
- src: frame.src,
9859
- dst: frame.dst,
9860
- payload: Array.from(frame.payload),
9861
- };
9862
- return serializable;
9863
- }
9864
- /**
9865
- * Unwrap a transport frame (pure deserializer - no filtering)
9866
- *
9867
- * @param raw - Raw data from the bus
9868
- * @returns Unwrapped frame with payload as Uint8Array, or null if invalid structure
9869
- */
9870
- function unwrapTransportFrame(raw) {
9871
- // Validate basic structure
9872
- if (!raw || typeof raw !== 'object') {
9873
- return null;
9874
- }
9875
- const frame = raw;
9876
- // Check version
9877
- if (frame.v !== TRANSPORT_FRAME_VERSION) {
9878
- return null;
9879
- }
9880
- // Check src and dst
9881
- if (typeof frame.src !== 'string' || typeof frame.dst !== 'string') {
9882
- return null;
9883
- }
9884
- // Extract payload
9885
- if (!frame.payload || !Array.isArray(frame.payload)) {
9886
- return null;
9887
- }
9888
- // Convert array back to Uint8Array and return full frame
9889
- return {
9890
- v: frame.v,
9891
- src: frame.src,
9892
- dst: frame.dst,
9893
- payload: Uint8Array.from(frame.payload),
9894
- };
9895
- }
9896
-
9897
9819
  const logger$_ = getLogger('naylence.fame.connector.broadcast_channel_connector');
9898
9820
  const BROADCAST_CHANNEL_CONNECTOR_TYPE = 'broadcast-channel-connector';
9899
9821
  const DEFAULT_CHANNEL$7 = 'naylence-fabric';
@@ -9959,20 +9881,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
9959
9881
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
9960
9882
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
9961
9883
  this.channel = new BroadcastChannel(this.channelName);
9962
- // Set local and remote node IDs (defaults to connector ID for backwards compatibility)
9963
- this.localNodeId =
9964
- typeof config.localNodeId === 'string' && config.localNodeId.trim().length > 0
9965
- ? config.localNodeId.trim()
9966
- : this.connectorId;
9967
- this.remoteNodeId =
9968
- typeof config.remoteNodeId === 'string' && config.remoteNodeId.trim().length > 0
9969
- ? config.remoteNodeId.trim()
9970
- : '*'; // Accept from any remote if not specified
9971
9884
  logger$_.debug('broadcast_channel_connector_created', {
9972
9885
  channel: this.channelName,
9973
9886
  connector_id: this.connectorId,
9974
- local_node_id: this.localNodeId,
9975
- remote_node_id: this.remoteNodeId,
9976
9887
  inbox_capacity: preferredCapacity,
9977
9888
  timestamp: new Date().toISOString(),
9978
9889
  });
@@ -10005,67 +9916,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
10005
9916
  if (busMessage.senderId === this.connectorId) {
10006
9917
  return;
10007
9918
  }
10008
- // Try to unwrap as transport frame
10009
- const frame = unwrapTransportFrame(busMessage.payload);
10010
- if (frame) {
10011
- // Apply connector's filtering policy: strict dst check, src accepts wildcard
10012
- const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
10013
- const dstMatches = frame.dst === this.localNodeId;
10014
- if (dstMatches && srcMatches) {
10015
- // Successfully received and filtered transport frame
10016
- logger$_.debug('broadcast_channel_transport_frame_received', {
10017
- channel: this.channelName,
10018
- sender_id: busMessage.senderId,
10019
- connector_id: this.connectorId,
10020
- local_node_id: this.localNodeId,
10021
- remote_node_id: this.remoteNodeId,
10022
- frame_src: frame.src,
10023
- frame_dst: frame.dst,
10024
- payload_length: frame.payload.byteLength,
10025
- });
10026
- const unwrapped = frame.payload;
10027
- if (this._shouldSkipDuplicateAck(busMessage.senderId, unwrapped)) {
10028
- return;
10029
- }
10030
- try {
10031
- if (typeof this.inbox.tryEnqueue === 'function') {
10032
- const accepted = this.inbox.tryEnqueue(unwrapped);
10033
- if (accepted) {
10034
- return;
10035
- }
10036
- }
10037
- this.inbox.enqueue(unwrapped);
10038
- }
10039
- catch (error) {
10040
- if (error instanceof QueueFullError) {
10041
- logger$_.warning('broadcast_channel_receive_queue_full', {
10042
- channel: this.channelName,
10043
- });
10044
- }
10045
- else {
10046
- logger$_.error('broadcast_channel_receive_error', {
10047
- channel: this.channelName,
10048
- error: error instanceof Error ? error.message : String(error),
10049
- });
10050
- }
10051
- }
10052
- return;
10053
- }
10054
- else {
10055
- // Frame filtered out by addressing rules
10056
- logger$_.debug('broadcast_channel_transport_frame_filtered', {
10057
- channel: this.channelName,
10058
- connector_id: this.connectorId,
10059
- local_node_id: this.localNodeId,
10060
- remote_node_id: this.remoteNodeId,
10061
- frame_src: frame.src,
10062
- frame_dst: frame.dst,
10063
- reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
10064
- });
10065
- return;
10066
- }
10067
- }
10068
- // Fall back to legacy format (no transport frame)
10069
9919
  const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
10070
9920
  if (!payload) {
10071
9921
  logger$_.debug('broadcast_channel_payload_rejected', {
@@ -10204,26 +10054,10 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
10204
10054
  logger$_.debug('broadcast_channel_message_sending', {
10205
10055
  channel: this.channelName,
10206
10056
  sender_id: this.connectorId,
10207
- local_node_id: this.localNodeId,
10208
- remote_node_id: this.remoteNodeId,
10209
- });
10210
- // Only use transport framing if both localNodeId and remoteNodeId are explicitly set
10211
- // (not using default values). This ensures backwards compatibility.
10212
- const useTransportFrame = this.localNodeId !== this.connectorId ||
10213
- this.remoteNodeId !== '*';
10214
- let payload;
10215
- if (useTransportFrame) {
10216
- // Wrap payload in transport frame
10217
- const frame = wrapTransportFrame(data, this.localNodeId, this.remoteNodeId);
10218
- payload = serializeTransportFrame(frame);
10219
- }
10220
- else {
10221
- // Legacy format: send raw payload
10222
- payload = data;
10223
- }
10057
+ });
10224
10058
  this.channel.postMessage({
10225
10059
  senderId: this.connectorId,
10226
- payload,
10060
+ payload: data,
10227
10061
  });
10228
10062
  }
10229
10063
  async _transportReceive() {
@@ -10516,12 +10350,9 @@ function isBroadcastChannelConnectionGrant(candidate) {
10516
10350
  record.inboxCapacity <= 0)) {
10517
10351
  return false;
10518
10352
  }
10519
- if (record.localNodeId !== undefined &&
10520
- (typeof record.localNodeId !== 'string' || record.localNodeId.length === 0)) {
10521
- return false;
10522
- }
10523
- if (record.remoteNodeId !== undefined &&
10524
- (typeof record.remoteNodeId !== 'string' || record.remoteNodeId.length === 0)) {
10353
+ if (record.initialWindow !== undefined &&
10354
+ (!Number.isFinite(record.initialWindow) ||
10355
+ record.initialWindow <= 0)) {
10525
10356
  return false;
10526
10357
  }
10527
10358
  return true;
@@ -10557,19 +10388,14 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
10557
10388
  }
10558
10389
  result.inboxCapacity = Math.floor(inboxValue);
10559
10390
  }
10560
- const localNodeIdValue = candidate.localNodeId ?? candidate['local_node_id'];
10561
- if (localNodeIdValue !== undefined) {
10562
- if (typeof localNodeIdValue !== 'string' || localNodeIdValue.trim().length === 0) {
10563
- throw new TypeError('BroadcastChannelConnectionGrant "localNodeId" must be a non-empty string when provided');
10564
- }
10565
- result.localNodeId = localNodeIdValue.trim();
10566
- }
10567
- const remoteNodeIdValue = candidate.remoteNodeId ?? candidate['remote_node_id'];
10568
- if (remoteNodeIdValue !== undefined) {
10569
- if (typeof remoteNodeIdValue !== 'string' || remoteNodeIdValue.trim().length === 0) {
10570
- throw new TypeError('BroadcastChannelConnectionGrant "remoteNodeId" must be a non-empty string when provided');
10391
+ const windowValue = candidate.initialWindow ?? candidate['initial_window'];
10392
+ if (windowValue !== undefined) {
10393
+ if (typeof windowValue !== 'number' ||
10394
+ !Number.isFinite(windowValue) ||
10395
+ windowValue <= 0) {
10396
+ throw new TypeError('BroadcastChannelConnectionGrant "initialWindow" must be a positive number when provided');
10571
10397
  }
10572
- result.remoteNodeId = remoteNodeIdValue.trim();
10398
+ result.initialWindow = Math.floor(windowValue);
10573
10399
  }
10574
10400
  return result;
10575
10401
  }
@@ -10584,11 +10410,8 @@ function broadcastChannelGrantToConnectorConfig(grant) {
10584
10410
  if (normalized.inboxCapacity !== undefined) {
10585
10411
  config.inboxCapacity = normalized.inboxCapacity;
10586
10412
  }
10587
- if (normalized.localNodeId) {
10588
- config.localNodeId = normalized.localNodeId;
10589
- }
10590
- if (normalized.remoteNodeId) {
10591
- config.remoteNodeId = normalized.remoteNodeId;
10413
+ if (normalized.initialWindow !== undefined) {
10414
+ config.initialWindow = normalized.initialWindow;
10592
10415
  }
10593
10416
  return config;
10594
10417
  }
@@ -10880,12 +10703,6 @@ class UpstreamSessionManager extends TaskSpawner {
10880
10703
  cryptoProvider.prepareForAttach(welcome.frame.systemId, welcome.frame.assignedPath, welcome.frame.acceptedLogicals ?? []);
10881
10704
  }
10882
10705
  await this.onWelcome(welcome.frame);
10883
- // Inject node ID into grant for transport frame multiplexing
10884
- // This ensures localNodeId matches the node's systemId for proper frame filtering
10885
- grant.localNodeId = welcome.frame.systemId;
10886
- if (welcome.frame.targetSystemId) {
10887
- grant.remoteNodeId = welcome.frame.targetSystemId;
10888
- }
10889
10706
  const connector = await ConnectorFactory.createConnector(grant, {
10890
10707
  systemId: welcome.frame.systemId,
10891
10708
  });
@@ -20542,20 +20359,9 @@ class InPageConnector extends BaseAsyncConnector {
20542
20359
  : DEFAULT_INBOX_CAPACITY$6;
20543
20360
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
20544
20361
  this.connectorId = InPageConnector.generateConnectorId();
20545
- // Set local and remote node IDs (defaults to connector ID for backwards compatibility)
20546
- this.localNodeId =
20547
- typeof config.localNodeId === 'string' && config.localNodeId.trim().length > 0
20548
- ? config.localNodeId.trim()
20549
- : this.connectorId;
20550
- this.remoteNodeId =
20551
- typeof config.remoteNodeId === 'string' && config.remoteNodeId.trim().length > 0
20552
- ? config.remoteNodeId.trim()
20553
- : '*'; // Accept from any remote if not specified
20554
20362
  logger$G.debug('inpage_connector_initialized', {
20555
20363
  channel: this.channelName,
20556
20364
  connector_id: this.connectorId,
20557
- local_node_id: this.localNodeId,
20558
- remote_node_id: this.remoteNodeId,
20559
20365
  });
20560
20366
  this.onMsg = (event) => {
20561
20367
  const messageEvent = event;
@@ -20589,64 +20395,6 @@ class InPageConnector extends BaseAsyncConnector {
20589
20395
  if (busMessage.senderId === this.connectorId) {
20590
20396
  return;
20591
20397
  }
20592
- // Try to unwrap as transport frame
20593
- const frame = unwrapTransportFrame(busMessage.payload);
20594
- if (frame) {
20595
- // Apply connector's filtering policy: strict dst check, src accepts wildcard
20596
- const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
20597
- const dstMatches = frame.dst === this.localNodeId;
20598
- if (dstMatches && srcMatches) {
20599
- // Successfully received and filtered transport frame
20600
- logger$G.debug('inpage_transport_frame_received', {
20601
- channel: this.channelName,
20602
- sender_id: busMessage.senderId,
20603
- connector_id: this.connectorId,
20604
- local_node_id: this.localNodeId,
20605
- remote_node_id: this.remoteNodeId,
20606
- frame_src: frame.src,
20607
- frame_dst: frame.dst,
20608
- payload_length: frame.payload.byteLength,
20609
- });
20610
- const unwrapped = frame.payload;
20611
- try {
20612
- if (typeof this.inbox.tryEnqueue === 'function') {
20613
- const accepted = this.inbox.tryEnqueue(unwrapped);
20614
- if (accepted) {
20615
- return;
20616
- }
20617
- }
20618
- this.inbox.enqueue(unwrapped);
20619
- }
20620
- catch (error) {
20621
- if (error instanceof QueueFullError) {
20622
- logger$G.warning('inpage_receive_queue_full', {
20623
- channel: this.channelName,
20624
- });
20625
- }
20626
- else {
20627
- logger$G.error('inpage_receive_error', {
20628
- channel: this.channelName,
20629
- error: error instanceof Error ? error.message : String(error),
20630
- });
20631
- }
20632
- }
20633
- return;
20634
- }
20635
- else {
20636
- // Frame filtered out by addressing rules
20637
- logger$G.debug('inpage_transport_frame_filtered', {
20638
- channel: this.channelName,
20639
- connector_id: this.connectorId,
20640
- local_node_id: this.localNodeId,
20641
- remote_node_id: this.remoteNodeId,
20642
- frame_src: frame.src,
20643
- frame_dst: frame.dst,
20644
- reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
20645
- });
20646
- return;
20647
- }
20648
- }
20649
- // Fall back to legacy format (no transport frame)
20650
20398
  const payload = InPageConnector.coercePayload(busMessage.payload);
20651
20399
  if (!payload) {
20652
20400
  logger$G.debug('inpage_payload_rejected', {
@@ -20805,27 +20553,11 @@ class InPageConnector extends BaseAsyncConnector {
20805
20553
  logger$G.debug('inpage_message_sending', {
20806
20554
  channel: this.channelName,
20807
20555
  sender_id: this.connectorId,
20808
- local_node_id: this.localNodeId,
20809
- remote_node_id: this.remoteNodeId,
20810
- });
20811
- // Only use transport framing if both localNodeId and remoteNodeId are explicitly set
20812
- // (not using default values). This ensures backwards compatibility.
20813
- const useTransportFrame = this.localNodeId !== this.connectorId ||
20814
- this.remoteNodeId !== '*';
20815
- let payload;
20816
- if (useTransportFrame) {
20817
- // Wrap payload in transport frame
20818
- const frame = wrapTransportFrame(data, this.localNodeId, this.remoteNodeId);
20819
- payload = serializeTransportFrame(frame);
20820
- }
20821
- else {
20822
- // Legacy format: send raw payload
20823
- payload = data;
20824
- }
20556
+ });
20825
20557
  const event = new MessageEvent(this.channelName, {
20826
20558
  data: {
20827
20559
  senderId: this.connectorId,
20828
- payload,
20560
+ payload: data,
20829
20561
  },
20830
20562
  });
20831
20563
  getSharedBus$1().dispatchEvent(event);
@@ -28190,14 +27922,6 @@ function isInPageConnectionGrant(candidate) {
28190
27922
  record.inboxCapacity <= 0)) {
28191
27923
  return false;
28192
27924
  }
28193
- if (record.localNodeId !== undefined &&
28194
- (typeof record.localNodeId !== 'string' || record.localNodeId.length === 0)) {
28195
- return false;
28196
- }
28197
- if (record.remoteNodeId !== undefined &&
28198
- (typeof record.remoteNodeId !== 'string' || record.remoteNodeId.length === 0)) {
28199
- return false;
28200
- }
28201
27925
  return true;
28202
27926
  }
28203
27927
  function normalizeInPageConnectionGrant(candidate) {
@@ -28231,20 +27955,6 @@ function normalizeInPageConnectionGrant(candidate) {
28231
27955
  }
28232
27956
  result.inboxCapacity = Math.floor(inboxValue);
28233
27957
  }
28234
- const localNodeIdValue = candidate.localNodeId ?? candidate['local_node_id'];
28235
- if (localNodeIdValue !== undefined) {
28236
- if (typeof localNodeIdValue !== 'string' || localNodeIdValue.trim().length === 0) {
28237
- throw new TypeError('InPageConnectionGrant "localNodeId" must be a non-empty string when provided');
28238
- }
28239
- result.localNodeId = localNodeIdValue.trim();
28240
- }
28241
- const remoteNodeIdValue = candidate.remoteNodeId ?? candidate['remote_node_id'];
28242
- if (remoteNodeIdValue !== undefined) {
28243
- if (typeof remoteNodeIdValue !== 'string' || remoteNodeIdValue.trim().length === 0) {
28244
- throw new TypeError('InPageConnectionGrant "remoteNodeId" must be a non-empty string when provided');
28245
- }
28246
- result.remoteNodeId = remoteNodeIdValue.trim();
28247
- }
28248
27958
  return result;
28249
27959
  }
28250
27960
  function inPageGrantToConnectorConfig(grant) {
@@ -28258,12 +27968,6 @@ function inPageGrantToConnectorConfig(grant) {
28258
27968
  if (normalized.inboxCapacity !== undefined) {
28259
27969
  config.inboxCapacity = normalized.inboxCapacity;
28260
27970
  }
28261
- if (normalized.localNodeId) {
28262
- config.localNodeId = normalized.localNodeId;
28263
- }
28264
- if (normalized.remoteNodeId) {
28265
- config.remoteNodeId = normalized.remoteNodeId;
28266
- }
28267
27971
  return config;
28268
27972
  }
28269
27973
 
@@ -28885,8 +28589,6 @@ class InPageConnectorFactory extends ConnectorFactory {
28885
28589
  type: INPAGE_CONNECTOR_TYPE,
28886
28590
  channelName,
28887
28591
  inboxCapacity,
28888
- localNodeId: normalized.localNodeId,
28889
- remoteNodeId: normalized.remoteNodeId,
28890
28592
  };
28891
28593
  const connector = new InPageConnector(connectorConfig, baseConfig);
28892
28594
  if (options.authorization) {
@@ -28955,16 +28657,6 @@ class InPageConnectorFactory extends ConnectorFactory {
28955
28657
  if (candidate.authorizationContext !== undefined) {
28956
28658
  normalized.authorizationContext = candidate.authorizationContext;
28957
28659
  }
28958
- // Handle localNodeId
28959
- const localNodeId = candidate.localNodeId ?? candidate['local_node_id'];
28960
- if (typeof localNodeId === 'string' && localNodeId.trim().length > 0) {
28961
- normalized.localNodeId = localNodeId.trim();
28962
- }
28963
- // Handle remoteNodeId
28964
- const remoteNodeId = candidate.remoteNodeId ?? candidate['remote_node_id'];
28965
- if (typeof remoteNodeId === 'string' && remoteNodeId.trim().length > 0) {
28966
- normalized.remoteNodeId = remoteNodeId.trim();
28967
- }
28968
28660
  normalized.channelName = normalized.channelName ?? DEFAULT_CHANNEL$5;
28969
28661
  normalized.inboxCapacity =
28970
28662
  normalized.inboxCapacity ?? DEFAULT_INBOX_CAPACITY$5;
@@ -29015,8 +28707,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
29015
28707
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
29016
28708
  channelName: connectorConfig.channelName,
29017
28709
  inboxCapacity: connectorConfig.inboxCapacity,
29018
- localNodeId: connectorConfig.localNodeId,
29019
- remoteNodeId: connectorConfig.remoteNodeId,
28710
+ initialWindow: connectorConfig.initialWindow,
29020
28711
  };
29021
28712
  }
29022
28713
  const config = {
@@ -29041,6 +28732,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
29041
28732
  purpose: 'connection',
29042
28733
  channelName: normalizedConfig.channelName,
29043
28734
  inboxCapacity: normalizedConfig.inboxCapacity,
28735
+ initialWindow: normalizedConfig.initialWindow,
29044
28736
  });
29045
28737
  return grant;
29046
28738
  }
@@ -29066,8 +28758,6 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
29066
28758
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
29067
28759
  channelName,
29068
28760
  inboxCapacity,
29069
- localNodeId: normalized.localNodeId,
29070
- remoteNodeId: normalized.remoteNodeId,
29071
28761
  };
29072
28762
  const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
29073
28763
  if (options.authorization) {
@@ -29129,16 +28819,6 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
29129
28819
  if (candidate.authorizationContext !== undefined) {
29130
28820
  normalized.authorizationContext = candidate.authorizationContext;
29131
28821
  }
29132
- // Handle localNodeId
29133
- const localNodeId = candidate.localNodeId ?? candidate['local_node_id'];
29134
- if (typeof localNodeId === 'string' && localNodeId.trim().length > 0) {
29135
- normalized.localNodeId = localNodeId.trim();
29136
- }
29137
- // Handle remoteNodeId
29138
- const remoteNodeId = candidate.remoteNodeId ?? candidate['remote_node_id'];
29139
- if (typeof remoteNodeId === 'string' && remoteNodeId.trim().length > 0) {
29140
- normalized.remoteNodeId = remoteNodeId.trim();
29141
- }
29142
28822
  normalized.channelName = normalized.channelName ?? DEFAULT_CHANNEL$4;
29143
28823
  normalized.inboxCapacity =
29144
28824
  normalized.inboxCapacity ?? DEFAULT_INBOX_CAPACITY$4;
@@ -29507,7 +29187,6 @@ class InPageListener extends TransportListener {
29507
29187
  this._busHandler = null;
29508
29188
  this._senderRegistry = new Map();
29509
29189
  this._systemToSender = new Map();
29510
- this._flowIdToSender = new Map();
29511
29190
  this._pendingAttachments = new Map();
29512
29191
  ensureBrowserEnvironment$1();
29513
29192
  const channelCandidate = options?.channelName;
@@ -29574,7 +29253,6 @@ class InPageListener extends TransportListener {
29574
29253
  this._unregisterBusListener();
29575
29254
  this._senderRegistry.clear();
29576
29255
  this._systemToSender.clear();
29577
- this._flowIdToSender.clear();
29578
29256
  this._pendingAttachments.clear();
29579
29257
  logger$p.debug('inpage_listener_stopped', {
29580
29258
  channel: this._channelName,
@@ -29628,25 +29306,10 @@ class InPageListener extends TransportListener {
29628
29306
  await this._handleAttachFrame(senderId, envelope);
29629
29307
  return;
29630
29308
  }
29631
- // Try to find connector by sender ID first
29632
- let entry = this._senderRegistry.get(senderId);
29633
- // If not found and we have a flowId, try to route based on flow
29634
- if (!entry && envelope.flowId) {
29635
- const originalSenderId = this._flowIdToSender.get(envelope.flowId);
29636
- if (originalSenderId) {
29637
- entry = this._senderRegistry.get(originalSenderId);
29638
- logger$p.debug('inpage_listener_routed_by_flow_id', {
29639
- sender_id: senderId,
29640
- original_sender_id: originalSenderId,
29641
- flow_id: envelope.flowId,
29642
- frame_type: envelope.frame?.type ?? 'unknown',
29643
- });
29644
- }
29645
- }
29309
+ const entry = this._senderRegistry.get(senderId);
29646
29310
  if (!entry) {
29647
29311
  logger$p.debug('inpage_listener_no_connector_for_sender', {
29648
29312
  sender_id: senderId,
29649
- flow_id: envelope.flowId,
29650
29313
  frame_type: envelope.frame?.type ?? 'unknown',
29651
29314
  });
29652
29315
  return;
@@ -29723,15 +29386,6 @@ class InPageListener extends TransportListener {
29723
29386
  }
29724
29387
  this._senderRegistry.set(senderId, entry);
29725
29388
  this._systemToSender.set(entry.systemId, senderId);
29726
- // Track the flowId if present so we can route responses back
29727
- if (envelope.flowId) {
29728
- this._flowIdToSender.set(envelope.flowId, senderId);
29729
- logger$p.debug('inpage_listener_registered_flow_id', {
29730
- sender_id: senderId,
29731
- system_id: entry.systemId,
29732
- flow_id: envelope.flowId,
29733
- });
29734
- }
29735
29389
  await this._deliverEnvelope(entry, envelope);
29736
29390
  }
29737
29391
  async _createConnectorForAttach(params) {
@@ -29779,7 +29433,7 @@ class InPageListener extends TransportListener {
29779
29433
  origin_type: originType,
29780
29434
  connector_type: connector.constructor?.name ?? 'unknown',
29781
29435
  });
29782
- return { connector, systemId, originType, senderId: params.senderId };
29436
+ return { connector, systemId, originType };
29783
29437
  }
29784
29438
  catch (error) {
29785
29439
  logger$p.error('inpage_listener_connector_creation_failed', {
@@ -29833,12 +29487,6 @@ class InPageListener extends TransportListener {
29833
29487
  if (this._systemToSender.get(systemId) === senderId) {
29834
29488
  this._systemToSender.delete(systemId);
29835
29489
  }
29836
- // Clean up flowId mappings for this sender
29837
- for (const [flowId, sid] of this._flowIdToSender.entries()) {
29838
- if (sid === senderId) {
29839
- this._flowIdToSender.delete(flowId);
29840
- }
29841
- }
29842
29490
  })
29843
29491
  .catch((error) => {
29844
29492
  logger$p.debug('inpage_listener_wait_until_closed_failed', {
@@ -29850,24 +29498,9 @@ class InPageListener extends TransportListener {
29850
29498
  if (this._systemToSender.get(systemId) === senderId) {
29851
29499
  this._systemToSender.delete(systemId);
29852
29500
  }
29853
- // Clean up flowId mappings for this sender
29854
- for (const [flowId, sid] of this._flowIdToSender.entries()) {
29855
- if (sid === senderId) {
29856
- this._flowIdToSender.delete(flowId);
29857
- }
29858
- }
29859
29501
  });
29860
29502
  }
29861
29503
  async _deliverEnvelope(entry, envelope) {
29862
- // Track flowId for routing responses back
29863
- if (envelope.flowId && !this._flowIdToSender.has(envelope.flowId)) {
29864
- this._flowIdToSender.set(envelope.flowId, entry.senderId);
29865
- logger$p.debug('inpage_listener_registered_flow_id_on_delivery', {
29866
- sender_id: entry.senderId,
29867
- system_id: entry.systemId,
29868
- flow_id: envelope.flowId,
29869
- });
29870
- }
29871
29504
  const message = this._buildChannelMessage({
29872
29505
  envelope,
29873
29506
  connector: entry.connector,
@@ -30108,18 +29741,13 @@ class BroadcastChannelListener extends TransportListener {
30108
29741
  });
30109
29742
  }
30110
29743
  asCallbackGrant() {
30111
- const grant = {
29744
+ return this.withLegacySnakeCaseKeys({
30112
29745
  type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30113
29746
  connectorType: BROADCAST_CHANNEL_CONNECTOR_TYPE,
30114
29747
  connectionGrantType: BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE,
30115
29748
  channelName: this._channelName,
30116
29749
  inboxCapacity: this._inboxCapacity,
30117
- };
30118
- // Include localNodeId for transport frame multiplexing if node is available
30119
- if (this._routingNode) {
30120
- grant.localNodeId = this._routingNode.id;
30121
- }
30122
- return this.withLegacySnakeCaseKeys(grant);
29750
+ });
30123
29751
  }
30124
29752
  _registerChannelListener() {
30125
29753
  if (this._channelHandler) {
@@ -30179,54 +29807,23 @@ class BroadcastChannelListener extends TransportListener {
30179
29807
  if (typeof senderId !== 'string' || senderId.length === 0) {
30180
29808
  return null;
30181
29809
  }
30182
- // Check if payload is a transport frame object first
30183
- let envelopePayload = null;
30184
- if (this._routingNode && record.payload && typeof record.payload === 'object') {
30185
- // Try to unwrap as transport frame
30186
- const frame = unwrapTransportFrame(record.payload);
30187
- if (frame) {
30188
- // Apply listener's filtering policy: accept frames addressed to us OR with wildcard destination
30189
- // Wildcard is needed because downstream nodes don't know the sentinel's ID during initial attach
30190
- const isAddressedToUs = frame.dst === this._routingNode.id || frame.dst === '*';
30191
- if (isAddressedToUs) {
30192
- envelopePayload = frame.payload;
30193
- logger$o.debug('broadcast_channel_listener_unwrapped_transport_frame', {
30194
- sender_id: senderId,
30195
- src: frame.src,
30196
- dst: frame.dst,
30197
- });
30198
- }
30199
- else {
30200
- // Frame addressed to a different node, ignore it
30201
- logger$o.debug('broadcast_channel_listener_ignored_frame_wrong_destination', {
30202
- sender_id: senderId,
30203
- dst: frame.dst,
30204
- expected: this._routingNode.id,
30205
- });
30206
- return null;
30207
- }
30208
- }
30209
- }
30210
- // If not a transport frame, try to coerce as legacy format
30211
- if (!envelopePayload) {
30212
- envelopePayload = coercePayload(record.payload);
30213
- if (!envelopePayload) {
30214
- logger$o.debug('broadcast_channel_listener_ignored_event_without_payload', {
30215
- sender_id: senderId,
30216
- });
30217
- return null;
30218
- }
29810
+ const payload = coercePayload(record.payload);
29811
+ if (!payload) {
29812
+ logger$o.debug('broadcast_channel_listener_ignored_event_without_payload', {
29813
+ sender_id: senderId,
29814
+ });
29815
+ return null;
30219
29816
  }
30220
29817
  let envelope;
30221
29818
  try {
30222
- const decoded = new TextDecoder().decode(envelopePayload);
29819
+ const decoded = new TextDecoder().decode(payload);
30223
29820
  const parsed = JSON.parse(decoded);
30224
29821
  envelope = deserializeEnvelope(parsed);
30225
29822
  }
30226
29823
  catch (error) {
30227
29824
  const decoded = (() => {
30228
29825
  try {
30229
- return new TextDecoder().decode(envelopePayload);
29826
+ return new TextDecoder().decode(payload);
30230
29827
  }
30231
29828
  catch {
30232
29829
  return null;
@@ -30346,20 +29943,6 @@ class BroadcastChannelListener extends TransportListener {
30346
29943
  inboxCapacity: this._inboxCapacity,
30347
29944
  };
30348
29945
  }
30349
- // Automatically configure transport frame multiplexing:
30350
- // Use node IDs (not connector IDs) for node-to-node targeting
30351
- const broadcastConfig = connectorConfig;
30352
- // Always force localNodeId to be this listener's node ID
30353
- // This ensures the sentinel sets localNodeId=sentinel, not the child's ID
30354
- broadcastConfig.localNodeId = routingNode.id;
30355
- // Always force remoteNodeId to be the attaching child's system ID
30356
- broadcastConfig.remoteNodeId = systemId;
30357
- logger$o.debug('broadcast_channel_listener_configured_node_ids', {
30358
- sender_id: params.senderId,
30359
- system_id: systemId,
30360
- local_node_id: broadcastConfig.localNodeId,
30361
- remote_node_id: broadcastConfig.remoteNodeId,
30362
- });
30363
29946
  try {
30364
29947
  const connector = await routingNode.createOriginConnector({
30365
29948
  originType,
@@ -30429,21 +30012,6 @@ class BroadcastChannelListener extends TransportListener {
30429
30012
  inboxCandidate > 0) {
30430
30013
  config.inboxCapacity = Math.floor(inboxCandidate);
30431
30014
  }
30432
- // Extract transport frame multiplexing node IDs
30433
- const localNodeIdCandidate = candidate.localNodeId ?? candidate['local_node_id'];
30434
- if (typeof localNodeIdCandidate === 'string' && localNodeIdCandidate.trim().length > 0) {
30435
- config.localNodeId = localNodeIdCandidate.trim();
30436
- logger$o.debug('broadcast_channel_listener_extracted_local_node_id', {
30437
- local_node_id: config.localNodeId,
30438
- });
30439
- }
30440
- const remoteNodeIdCandidate = candidate.remoteNodeId ?? candidate['remote_node_id'];
30441
- if (typeof remoteNodeIdCandidate === 'string' && remoteNodeIdCandidate.trim().length > 0) {
30442
- config.remoteNodeId = remoteNodeIdCandidate.trim();
30443
- logger$o.debug('broadcast_channel_listener_extracted_remote_node_id', {
30444
- remote_node_id: config.remoteNodeId,
30445
- });
30446
- }
30447
30015
  return config;
30448
30016
  }
30449
30017
  _monitorConnectorLifecycle(senderId, systemId, connector) {