@naylence/runtime 0.3.5-test.964 → 0.3.5-test.966

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.
@@ -5562,12 +5562,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5562
5562
  }
5563
5563
 
5564
5564
  // This file is auto-generated during build - do not edit manually
5565
- // Generated from package.json version: 0.3.5-test.964
5565
+ // Generated from package.json version: 0.3.5-test.966
5566
5566
  /**
5567
5567
  * The package version, injected at build time.
5568
5568
  * @internal
5569
5569
  */
5570
- const VERSION = '0.3.5-test.964';
5570
+ const VERSION = '0.3.5-test.966';
5571
5571
 
5572
5572
  /**
5573
5573
  * Fame errors module - Fame protocol specific error classes
@@ -11622,11 +11622,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11622
11622
  ensureBroadcastEnvironment();
11623
11623
  super(baseConfig);
11624
11624
  this.listenerRegistered = false;
11625
- this.seenAckKeys = new Map();
11626
- this.seenAckOrder = [];
11627
- this.ackDedupTtlMs = 30000;
11628
- this.ackDedupMaxEntries = 4096;
11629
- this.textDecoder = new TextDecoder();
11630
11625
  this.visibilityChangeListenerRegistered = false;
11631
11626
  this.channelName =
11632
11627
  typeof config.channelName === 'string' && config.channelName.trim().length > 0
@@ -11718,9 +11713,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11718
11713
  connector_id: this.connectorId,
11719
11714
  payload_length: payload.byteLength,
11720
11715
  });
11721
- if (this._shouldSkipDuplicateAck(senderNodeId, payload)) {
11722
- return;
11723
- }
11724
11716
  try {
11725
11717
  if (typeof this.inbox.tryEnqueue === 'function') {
11726
11718
  const accepted = this.inbox.tryEnqueue(payload);
@@ -11824,9 +11816,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11824
11816
  }
11825
11817
  async pushToReceive(rawOrEnvelope) {
11826
11818
  const item = this._normalizeInboxItem(rawOrEnvelope);
11827
- if (this._shouldSkipDuplicateAckFromInboxItem(item)) {
11828
- return;
11829
- }
11830
11819
  try {
11831
11820
  if (typeof this.inbox.tryEnqueue === 'function') {
11832
11821
  const accepted = this.inbox.tryEnqueue(item);
@@ -11926,8 +11915,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11926
11915
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
11927
11916
  const shutdownError = new FameTransportClose(closeReason, closeCode);
11928
11917
  this.inbox.drain(shutdownError);
11929
- this.seenAckKeys.clear();
11930
- this.seenAckOrder.length = 0;
11931
11918
  }
11932
11919
  _normalizeInboxItem(rawOrEnvelope) {
11933
11920
  if (rawOrEnvelope instanceof Uint8Array) {
@@ -12004,125 +11991,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
12004
11991
  ...extra,
12005
11992
  });
12006
11993
  }
12007
- _shouldSkipDuplicateAck(senderId, payload) {
12008
- const dedupKey = this._extractAckDedupKey(payload);
12009
- if (!dedupKey) {
12010
- return false;
12011
- }
12012
- const normalizedSenderId = typeof senderId === 'string' && senderId.length > 0
12013
- ? senderId
12014
- : undefined;
12015
- if (normalizedSenderId && normalizedSenderId !== this.localNodeId) {
12016
- logger$10.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
12017
- channel: this.channelName,
12018
- connector_id: this.connectorId,
12019
- sender_id: normalizedSenderId,
12020
- dedup_key: dedupKey,
12021
- source: 'listener',
12022
- });
12023
- return false;
12024
- }
12025
- logger$10.debug('broadcast_channel_duplicate_ack_check', {
12026
- channel: this.channelName,
12027
- connector_id: this.connectorId,
12028
- sender_id: normalizedSenderId ?? null,
12029
- dedup_key: dedupKey,
12030
- source: 'listener',
12031
- cache_entries: this.seenAckKeys.size,
12032
- });
12033
- return this._checkDuplicateAck(dedupKey, normalizedSenderId);
12034
- }
12035
- _shouldSkipDuplicateAckFromInboxItem(item) {
12036
- if (item instanceof Uint8Array) {
12037
- return this._shouldSkipDuplicateAck(undefined, item);
12038
- }
12039
- const envelope = this._extractEnvelopeFromInboxItem(item);
12040
- if (!envelope) {
12041
- return false;
12042
- }
12043
- const frame = envelope.frame;
12044
- if (!frame || frame.type !== 'DeliveryAck') {
12045
- return false;
12046
- }
12047
- const refId = typeof frame.refId === 'string' && frame.refId.length > 0
12048
- ? frame.refId
12049
- : null;
12050
- const dedupKey = refId ?? envelope.id ?? null;
12051
- if (!dedupKey) {
12052
- return false;
12053
- }
12054
- const senderId = this._extractSenderIdFromInboxItem(item);
12055
- if (senderId && senderId !== this.localNodeId) {
12056
- logger$10.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
12057
- channel: this.channelName,
12058
- connector_id: this.connectorId,
12059
- sender_id: senderId,
12060
- dedup_key: dedupKey,
12061
- source: 'inbox_item',
12062
- });
12063
- return false;
12064
- }
12065
- logger$10.debug('broadcast_channel_duplicate_ack_check', {
12066
- channel: this.channelName,
12067
- connector_id: this.connectorId,
12068
- sender_id: senderId ?? null,
12069
- dedup_key: dedupKey,
12070
- source: 'inbox_item',
12071
- cache_entries: this.seenAckKeys.size,
12072
- });
12073
- return this._checkDuplicateAck(dedupKey, senderId);
12074
- }
12075
- _checkDuplicateAck(dedupKey, senderId) {
12076
- const now = Date.now();
12077
- const lastSeen = this.seenAckKeys.get(dedupKey);
12078
- if (lastSeen && now - lastSeen < this.ackDedupTtlMs) {
12079
- logger$10.debug('broadcast_channel_duplicate_ack_suppressed', {
12080
- channel: this.channelName,
12081
- connector_id: this.connectorId,
12082
- sender_id: senderId ?? null,
12083
- dedup_key: dedupKey,
12084
- age_ms: now - lastSeen,
12085
- ttl_ms: this.ackDedupTtlMs,
12086
- cache_entries: this.seenAckKeys.size,
12087
- });
12088
- return true;
12089
- }
12090
- this.seenAckKeys.set(dedupKey, now);
12091
- this.seenAckOrder.push(dedupKey);
12092
- logger$10.debug('broadcast_channel_duplicate_ack_recorded', {
12093
- channel: this.channelName,
12094
- connector_id: this.connectorId,
12095
- sender_id: senderId ?? null,
12096
- dedup_key: dedupKey,
12097
- cache_entries: this.seenAckKeys.size,
12098
- });
12099
- this._trimSeenAcks(now);
12100
- return false;
12101
- }
12102
- _extractEnvelopeFromInboxItem(item) {
12103
- if (!item || typeof item !== 'object') {
12104
- return null;
12105
- }
12106
- if ('envelope' in item) {
12107
- return item.envelope;
12108
- }
12109
- if ('frame' in item) {
12110
- return item;
12111
- }
12112
- return null;
12113
- }
12114
- _extractSenderIdFromInboxItem(item) {
12115
- if (!item || typeof item !== 'object') {
12116
- return undefined;
12117
- }
12118
- if ('context' in item) {
12119
- const context = item.context;
12120
- if (context && typeof context.fromSystemId === 'string') {
12121
- return context.fromSystemId;
12122
- }
12123
- }
12124
- return undefined;
12125
- }
12126
11994
  /**
12127
11995
  * Override start() to check initial visibility state
12128
11996
  */
@@ -12176,47 +12044,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
12176
12044
  target_mode: 'wildcard',
12177
12045
  });
12178
12046
  }
12179
- _trimSeenAcks(now) {
12180
- while (this.seenAckOrder.length > 0) {
12181
- const candidate = this.seenAckOrder[0];
12182
- const timestamp = this.seenAckKeys.get(candidate);
12183
- if (timestamp === undefined) {
12184
- this.seenAckOrder.shift();
12185
- continue;
12186
- }
12187
- if (this.seenAckKeys.size > this.ackDedupMaxEntries ||
12188
- now - timestamp > this.ackDedupTtlMs) {
12189
- this.seenAckKeys.delete(candidate);
12190
- this.seenAckOrder.shift();
12191
- continue;
12192
- }
12193
- break;
12194
- }
12195
- }
12196
- _extractAckDedupKey(payload) {
12197
- try {
12198
- const decoded = this.textDecoder.decode(payload);
12199
- const parsed = JSON.parse(decoded);
12200
- const envelopeId = typeof parsed?.id === 'string' ? parsed.id : null;
12201
- const frameType = parsed?.frame?.type;
12202
- if (typeof frameType !== 'string' || frameType !== 'DeliveryAck') {
12203
- return null;
12204
- }
12205
- const refId = parsed.frame?.refId;
12206
- if (typeof refId === 'string' && refId.length > 0) {
12207
- return refId;
12208
- }
12209
- return envelopeId;
12210
- }
12211
- catch (error) {
12212
- logger$10.debug('broadcast_channel_ack_dedup_parse_failed', {
12213
- channel: this.channelName,
12214
- connector_id: this.connectorId,
12215
- error: error instanceof Error ? error.message : String(error),
12216
- });
12217
- return null;
12218
- }
12219
- }
12220
12047
  };
12221
12048
 
12222
12049
  const BROADCAST_CHANNEL_CONNECTOR_TYPE = 'broadcast-channel-connector';
@@ -33192,8 +33019,7 @@ class BroadcastChannelListener extends TransportListener {
33192
33019
  if (!this._routingNode) {
33193
33020
  throw new Error('BroadcastChannelListener requires routing node context');
33194
33021
  }
33195
- const normalized = this._normalizeNodeId(this._routingNode.sid) ??
33196
- this._normalizeNodeId(this._routingNode.id);
33022
+ const normalized = this._normalizeNodeId(this._routingNode.id);
33197
33023
  if (!normalized) {
33198
33024
  throw new Error('BroadcastChannelListener requires routing node with a stable identifier');
33199
33025
  }
@@ -22,11 +22,6 @@ export declare class BroadcastChannelConnector extends BaseAsyncConnector {
22
22
  private targetNodeId?;
23
23
  private readonly onMsg;
24
24
  private readonly channel;
25
- private readonly seenAckKeys;
26
- private readonly seenAckOrder;
27
- private readonly ackDedupTtlMs;
28
- private readonly ackDedupMaxEntries;
29
- private readonly textDecoder;
30
25
  private visibilityChangeListenerRegistered;
31
26
  private visibilityChangeHandler?;
32
27
  private static generateConnectorId;
@@ -43,18 +38,11 @@ export declare class BroadcastChannelConnector extends BaseAsyncConnector {
43
38
  private _shouldAcceptMessageFromBus;
44
39
  private _describeInboxItem;
45
40
  private logInboxSnapshot;
46
- private _shouldSkipDuplicateAck;
47
- private _shouldSkipDuplicateAckFromInboxItem;
48
- private _checkDuplicateAck;
49
- private _extractEnvelopeFromInboxItem;
50
- private _extractSenderIdFromInboxItem;
51
41
  /**
52
42
  * Override start() to check initial visibility state
53
43
  */
54
44
  start(inboundHandler: FameEnvelopeHandler): Promise<void>;
55
45
  setTargetNodeId(nodeId: string): void;
56
46
  setWildcardTarget(): void;
57
- private _trimSeenAcks;
58
- private _extractAckDedupKey;
59
47
  }
60
48
  export {};
@@ -2,4 +2,4 @@
2
2
  * The package version, injected at build time.
3
3
  * @internal
4
4
  */
5
- export declare const VERSION = "0.3.5-test.964";
5
+ export declare const VERSION = "0.3.5-test.966";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.964",
3
+ "version": "0.3.5-test.966",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",