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