@naylence/runtime 0.3.6-test.1 → 0.3.6-test.102

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.
@@ -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.6-test.001
101
+ // Generated from package.json version: 0.3.6-test.102
102
102
  /**
103
103
  * The package version, injected at build time.
104
104
  * @internal
105
105
  */
106
- const VERSION = '0.3.6-test.001';
106
+ const VERSION = '0.3.6-test.102';
107
107
 
108
108
  /**
109
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -12679,15 +12679,29 @@ class DefaultNodeAttachClient {
12679
12679
  constructor(options = {}) {
12680
12680
  this.buffer = [];
12681
12681
  this.inHandshake = false;
12682
+ this.expectedSystemId = null;
12682
12683
  this.timeoutMs = options.timeoutMs ?? 10000;
12683
12684
  this.attachmentKeyValidator = options.attachmentKeyValidator;
12684
12685
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
12685
12686
  }
12686
12687
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
12687
12688
  this.inHandshake = true;
12689
+ this.expectedSystemId = welcomeFrame.systemId;
12688
12690
  const interimHandler = async (envelope, context) => {
12689
12691
  if (this.inHandshake) {
12690
- this.buffer.push(envelope);
12692
+ // Filter: only buffer frames related to our systemId or frames without systemId info
12693
+ const frameSystemId = envelope.frame?.systemId;
12694
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
12695
+ this.buffer.push(envelope);
12696
+ }
12697
+ else {
12698
+ // Silently ignore frames from other agents during concurrent handshakes
12699
+ logger$W.debug('handshake_ignoring_frame_from_different_system', {
12700
+ frame_type: envelope.frame.type,
12701
+ frame_system_id: frameSystemId,
12702
+ expected_system_id: this.expectedSystemId,
12703
+ });
12704
+ }
12691
12705
  return null;
12692
12706
  }
12693
12707
  return finalHandler(envelope, context);
@@ -12814,6 +12828,7 @@ class DefaultNodeAttachClient {
12814
12828
  parent_id: ackFrame.targetSystemId,
12815
12829
  });
12816
12830
  this.inHandshake = false;
12831
+ this.expectedSystemId = null;
12817
12832
  await connector.replaceHandler(finalHandler);
12818
12833
  while (this.buffer.length > 0) {
12819
12834
  const bufferedEnvelope = this.buffer.shift();
@@ -12890,9 +12905,20 @@ class DefaultNodeAttachClient {
12890
12905
  if (envelope.frame.type === 'NodeAttachAck') {
12891
12906
  return envelope;
12892
12907
  }
12893
- logger$W.error('unexpected_frame_during_handshake', {
12894
- frame_type: envelope.frame.type,
12895
- });
12908
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
12909
+ // where multiple agents attach concurrently to the same channel
12910
+ if (envelope.frame.type === 'NodeAttach') {
12911
+ logger$W.debug('handshake_ignoring_concurrent_attach', {
12912
+ frame_type: envelope.frame.type,
12913
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
12914
+ });
12915
+ }
12916
+ else {
12917
+ // Other unexpected frames are still logged as errors
12918
+ logger$W.error('unexpected_frame_during_handshake', {
12919
+ frame_type: envelope.frame.type,
12920
+ });
12921
+ }
12896
12922
  }
12897
12923
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
12898
12924
  }
@@ -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.6-test.001
99
+ // Generated from package.json version: 0.3.6-test.102
100
100
  /**
101
101
  * The package version, injected at build time.
102
102
  * @internal
103
103
  */
104
- const VERSION = '0.3.6-test.001';
104
+ const VERSION = '0.3.6-test.102';
105
105
 
106
106
  /**
107
107
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -12677,15 +12677,29 @@ class DefaultNodeAttachClient {
12677
12677
  constructor(options = {}) {
12678
12678
  this.buffer = [];
12679
12679
  this.inHandshake = false;
12680
+ this.expectedSystemId = null;
12680
12681
  this.timeoutMs = options.timeoutMs ?? 10000;
12681
12682
  this.attachmentKeyValidator = options.attachmentKeyValidator;
12682
12683
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
12683
12684
  }
12684
12685
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
12685
12686
  this.inHandshake = true;
12687
+ this.expectedSystemId = welcomeFrame.systemId;
12686
12688
  const interimHandler = async (envelope, context) => {
12687
12689
  if (this.inHandshake) {
12688
- this.buffer.push(envelope);
12690
+ // Filter: only buffer frames related to our systemId or frames without systemId info
12691
+ const frameSystemId = envelope.frame?.systemId;
12692
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
12693
+ this.buffer.push(envelope);
12694
+ }
12695
+ else {
12696
+ // Silently ignore frames from other agents during concurrent handshakes
12697
+ logger$W.debug('handshake_ignoring_frame_from_different_system', {
12698
+ frame_type: envelope.frame.type,
12699
+ frame_system_id: frameSystemId,
12700
+ expected_system_id: this.expectedSystemId,
12701
+ });
12702
+ }
12689
12703
  return null;
12690
12704
  }
12691
12705
  return finalHandler(envelope, context);
@@ -12812,6 +12826,7 @@ class DefaultNodeAttachClient {
12812
12826
  parent_id: ackFrame.targetSystemId,
12813
12827
  });
12814
12828
  this.inHandshake = false;
12829
+ this.expectedSystemId = null;
12815
12830
  await connector.replaceHandler(finalHandler);
12816
12831
  while (this.buffer.length > 0) {
12817
12832
  const bufferedEnvelope = this.buffer.shift();
@@ -12888,9 +12903,20 @@ class DefaultNodeAttachClient {
12888
12903
  if (envelope.frame.type === 'NodeAttachAck') {
12889
12904
  return envelope;
12890
12905
  }
12891
- logger$W.error('unexpected_frame_during_handshake', {
12892
- frame_type: envelope.frame.type,
12893
- });
12906
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
12907
+ // where multiple agents attach concurrently to the same channel
12908
+ if (envelope.frame.type === 'NodeAttach') {
12909
+ logger$W.debug('handshake_ignoring_concurrent_attach', {
12910
+ frame_type: envelope.frame.type,
12911
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
12912
+ });
12913
+ }
12914
+ else {
12915
+ // Other unexpected frames are still logged as errors
12916
+ logger$W.error('unexpected_frame_during_handshake', {
12917
+ frame_type: envelope.frame.type,
12918
+ });
12919
+ }
12894
12920
  }
12895
12921
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
12896
12922
  }
@@ -11,15 +11,29 @@ class DefaultNodeAttachClient {
11
11
  constructor(options = {}) {
12
12
  this.buffer = [];
13
13
  this.inHandshake = false;
14
+ this.expectedSystemId = null;
14
15
  this.timeoutMs = options.timeoutMs ?? 10000;
15
16
  this.attachmentKeyValidator = options.attachmentKeyValidator;
16
17
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
17
18
  }
18
19
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
19
20
  this.inHandshake = true;
21
+ this.expectedSystemId = welcomeFrame.systemId;
20
22
  const interimHandler = async (envelope, context) => {
21
23
  if (this.inHandshake) {
22
- this.buffer.push(envelope);
24
+ // Filter: only buffer frames related to our systemId or frames without systemId info
25
+ const frameSystemId = envelope.frame?.systemId;
26
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
27
+ this.buffer.push(envelope);
28
+ }
29
+ else {
30
+ // Silently ignore frames from other agents during concurrent handshakes
31
+ logger.debug('handshake_ignoring_frame_from_different_system', {
32
+ frame_type: envelope.frame.type,
33
+ frame_system_id: frameSystemId,
34
+ expected_system_id: this.expectedSystemId,
35
+ });
36
+ }
23
37
  return null;
24
38
  }
25
39
  return finalHandler(envelope, context);
@@ -146,6 +160,7 @@ class DefaultNodeAttachClient {
146
160
  parent_id: ackFrame.targetSystemId,
147
161
  });
148
162
  this.inHandshake = false;
163
+ this.expectedSystemId = null;
149
164
  await connector.replaceHandler(finalHandler);
150
165
  while (this.buffer.length > 0) {
151
166
  const bufferedEnvelope = this.buffer.shift();
@@ -222,9 +237,20 @@ class DefaultNodeAttachClient {
222
237
  if (envelope.frame.type === 'NodeAttachAck') {
223
238
  return envelope;
224
239
  }
225
- logger.error('unexpected_frame_during_handshake', {
226
- frame_type: envelope.frame.type,
227
- });
240
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
241
+ // where multiple agents attach concurrently to the same channel
242
+ if (envelope.frame.type === 'NodeAttach') {
243
+ logger.debug('handshake_ignoring_concurrent_attach', {
244
+ frame_type: envelope.frame.type,
245
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
246
+ });
247
+ }
248
+ else {
249
+ // Other unexpected frames are still logged as errors
250
+ logger.error('unexpected_frame_during_handshake', {
251
+ frame_type: envelope.frame.type,
252
+ });
253
+ }
228
254
  }
229
255
  await (0, task_utils_js_1.delay)(HANDSHAKE_POLL_INTERVAL_MS);
230
256
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // This file is auto-generated during build - do not edit manually
3
- // Generated from package.json version: 0.3.6-test.001
3
+ // Generated from package.json version: 0.3.6-test.102
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.VERSION = void 0;
6
6
  /**
7
7
  * The package version, injected at build time.
8
8
  * @internal
9
9
  */
10
- exports.VERSION = '0.3.6-test.001';
10
+ exports.VERSION = '0.3.6-test.102';
@@ -8,15 +8,29 @@ export class DefaultNodeAttachClient {
8
8
  constructor(options = {}) {
9
9
  this.buffer = [];
10
10
  this.inHandshake = false;
11
+ this.expectedSystemId = null;
11
12
  this.timeoutMs = options.timeoutMs ?? 10000;
12
13
  this.attachmentKeyValidator = options.attachmentKeyValidator;
13
14
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
14
15
  }
15
16
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
16
17
  this.inHandshake = true;
18
+ this.expectedSystemId = welcomeFrame.systemId;
17
19
  const interimHandler = async (envelope, context) => {
18
20
  if (this.inHandshake) {
19
- this.buffer.push(envelope);
21
+ // Filter: only buffer frames related to our systemId or frames without systemId info
22
+ const frameSystemId = envelope.frame?.systemId;
23
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
24
+ this.buffer.push(envelope);
25
+ }
26
+ else {
27
+ // Silently ignore frames from other agents during concurrent handshakes
28
+ logger.debug('handshake_ignoring_frame_from_different_system', {
29
+ frame_type: envelope.frame.type,
30
+ frame_system_id: frameSystemId,
31
+ expected_system_id: this.expectedSystemId,
32
+ });
33
+ }
20
34
  return null;
21
35
  }
22
36
  return finalHandler(envelope, context);
@@ -143,6 +157,7 @@ export class DefaultNodeAttachClient {
143
157
  parent_id: ackFrame.targetSystemId,
144
158
  });
145
159
  this.inHandshake = false;
160
+ this.expectedSystemId = null;
146
161
  await connector.replaceHandler(finalHandler);
147
162
  while (this.buffer.length > 0) {
148
163
  const bufferedEnvelope = this.buffer.shift();
@@ -219,9 +234,20 @@ export class DefaultNodeAttachClient {
219
234
  if (envelope.frame.type === 'NodeAttachAck') {
220
235
  return envelope;
221
236
  }
222
- logger.error('unexpected_frame_during_handshake', {
223
- frame_type: envelope.frame.type,
224
- });
237
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
238
+ // where multiple agents attach concurrently to the same channel
239
+ if (envelope.frame.type === 'NodeAttach') {
240
+ logger.debug('handshake_ignoring_concurrent_attach', {
241
+ frame_type: envelope.frame.type,
242
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
243
+ });
244
+ }
245
+ else {
246
+ // Other unexpected frames are still logged as errors
247
+ logger.error('unexpected_frame_during_handshake', {
248
+ frame_type: envelope.frame.type,
249
+ });
250
+ }
225
251
  }
226
252
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
227
253
  }
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated during build - do not edit manually
2
- // Generated from package.json version: 0.3.6-test.001
2
+ // Generated from package.json version: 0.3.6-test.102
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.6-test.001';
7
+ export const VERSION = '0.3.6-test.102';
@@ -14,12 +14,12 @@ var fastify = require('fastify');
14
14
  var websocketPlugin = require('@fastify/websocket');
15
15
 
16
16
  // This file is auto-generated during build - do not edit manually
17
- // Generated from package.json version: 0.3.6-test.001
17
+ // Generated from package.json version: 0.3.6-test.102
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.6-test.001';
22
+ const VERSION = '0.3.6-test.102';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -12595,15 +12595,29 @@ class DefaultNodeAttachClient {
12595
12595
  constructor(options = {}) {
12596
12596
  this.buffer = [];
12597
12597
  this.inHandshake = false;
12598
+ this.expectedSystemId = null;
12598
12599
  this.timeoutMs = options.timeoutMs ?? 10000;
12599
12600
  this.attachmentKeyValidator = options.attachmentKeyValidator;
12600
12601
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
12601
12602
  }
12602
12603
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
12603
12604
  this.inHandshake = true;
12605
+ this.expectedSystemId = welcomeFrame.systemId;
12604
12606
  const interimHandler = async (envelope, context) => {
12605
12607
  if (this.inHandshake) {
12606
- this.buffer.push(envelope);
12608
+ // Filter: only buffer frames related to our systemId or frames without systemId info
12609
+ const frameSystemId = envelope.frame?.systemId;
12610
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
12611
+ this.buffer.push(envelope);
12612
+ }
12613
+ else {
12614
+ // Silently ignore frames from other agents during concurrent handshakes
12615
+ logger$W.debug('handshake_ignoring_frame_from_different_system', {
12616
+ frame_type: envelope.frame.type,
12617
+ frame_system_id: frameSystemId,
12618
+ expected_system_id: this.expectedSystemId,
12619
+ });
12620
+ }
12607
12621
  return null;
12608
12622
  }
12609
12623
  return finalHandler(envelope, context);
@@ -12730,6 +12744,7 @@ class DefaultNodeAttachClient {
12730
12744
  parent_id: ackFrame.targetSystemId,
12731
12745
  });
12732
12746
  this.inHandshake = false;
12747
+ this.expectedSystemId = null;
12733
12748
  await connector.replaceHandler(finalHandler);
12734
12749
  while (this.buffer.length > 0) {
12735
12750
  const bufferedEnvelope = this.buffer.shift();
@@ -12806,9 +12821,20 @@ class DefaultNodeAttachClient {
12806
12821
  if (envelope.frame.type === 'NodeAttachAck') {
12807
12822
  return envelope;
12808
12823
  }
12809
- logger$W.error('unexpected_frame_during_handshake', {
12810
- frame_type: envelope.frame.type,
12811
- });
12824
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
12825
+ // where multiple agents attach concurrently to the same channel
12826
+ if (envelope.frame.type === 'NodeAttach') {
12827
+ logger$W.debug('handshake_ignoring_concurrent_attach', {
12828
+ frame_type: envelope.frame.type,
12829
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
12830
+ });
12831
+ }
12832
+ else {
12833
+ // Other unexpected frames are still logged as errors
12834
+ logger$W.error('unexpected_frame_during_handshake', {
12835
+ frame_type: envelope.frame.type,
12836
+ });
12837
+ }
12812
12838
  }
12813
12839
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
12814
12840
  }
@@ -13,12 +13,12 @@ import fastify from 'fastify';
13
13
  import websocketPlugin from '@fastify/websocket';
14
14
 
15
15
  // This file is auto-generated during build - do not edit manually
16
- // Generated from package.json version: 0.3.6-test.001
16
+ // Generated from package.json version: 0.3.6-test.102
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.6-test.001';
21
+ const VERSION = '0.3.6-test.102';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -12594,15 +12594,29 @@ class DefaultNodeAttachClient {
12594
12594
  constructor(options = {}) {
12595
12595
  this.buffer = [];
12596
12596
  this.inHandshake = false;
12597
+ this.expectedSystemId = null;
12597
12598
  this.timeoutMs = options.timeoutMs ?? 10000;
12598
12599
  this.attachmentKeyValidator = options.attachmentKeyValidator;
12599
12600
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
12600
12601
  }
12601
12602
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
12602
12603
  this.inHandshake = true;
12604
+ this.expectedSystemId = welcomeFrame.systemId;
12603
12605
  const interimHandler = async (envelope, context) => {
12604
12606
  if (this.inHandshake) {
12605
- this.buffer.push(envelope);
12607
+ // Filter: only buffer frames related to our systemId or frames without systemId info
12608
+ const frameSystemId = envelope.frame?.systemId;
12609
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
12610
+ this.buffer.push(envelope);
12611
+ }
12612
+ else {
12613
+ // Silently ignore frames from other agents during concurrent handshakes
12614
+ logger$W.debug('handshake_ignoring_frame_from_different_system', {
12615
+ frame_type: envelope.frame.type,
12616
+ frame_system_id: frameSystemId,
12617
+ expected_system_id: this.expectedSystemId,
12618
+ });
12619
+ }
12606
12620
  return null;
12607
12621
  }
12608
12622
  return finalHandler(envelope, context);
@@ -12729,6 +12743,7 @@ class DefaultNodeAttachClient {
12729
12743
  parent_id: ackFrame.targetSystemId,
12730
12744
  });
12731
12745
  this.inHandshake = false;
12746
+ this.expectedSystemId = null;
12732
12747
  await connector.replaceHandler(finalHandler);
12733
12748
  while (this.buffer.length > 0) {
12734
12749
  const bufferedEnvelope = this.buffer.shift();
@@ -12805,9 +12820,20 @@ class DefaultNodeAttachClient {
12805
12820
  if (envelope.frame.type === 'NodeAttachAck') {
12806
12821
  return envelope;
12807
12822
  }
12808
- logger$W.error('unexpected_frame_during_handshake', {
12809
- frame_type: envelope.frame.type,
12810
- });
12823
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
12824
+ // where multiple agents attach concurrently to the same channel
12825
+ if (envelope.frame.type === 'NodeAttach') {
12826
+ logger$W.debug('handshake_ignoring_concurrent_attach', {
12827
+ frame_type: envelope.frame.type,
12828
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
12829
+ });
12830
+ }
12831
+ else {
12832
+ // Other unexpected frames are still logged as errors
12833
+ logger$W.error('unexpected_frame_during_handshake', {
12834
+ frame_type: envelope.frame.type,
12835
+ });
12836
+ }
12811
12837
  }
12812
12838
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
12813
12839
  }
@@ -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-test.001
5566
+ // Generated from package.json version: 0.3.6-test.102
5567
5567
  /**
5568
5568
  * The package version, injected at build time.
5569
5569
  * @internal
5570
5570
  */
5571
- const VERSION = '0.3.6-test.001';
5571
+ const VERSION = '0.3.6-test.102';
5572
5572
 
5573
5573
  /**
5574
5574
  * Fame errors module - Fame protocol specific error classes
@@ -14287,15 +14287,29 @@ class DefaultNodeAttachClient {
14287
14287
  constructor(options = {}) {
14288
14288
  this.buffer = [];
14289
14289
  this.inHandshake = false;
14290
+ this.expectedSystemId = null;
14290
14291
  this.timeoutMs = options.timeoutMs ?? 10000;
14291
14292
  this.attachmentKeyValidator = options.attachmentKeyValidator;
14292
14293
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
14293
14294
  }
14294
14295
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
14295
14296
  this.inHandshake = true;
14297
+ this.expectedSystemId = welcomeFrame.systemId;
14296
14298
  const interimHandler = async (envelope, context) => {
14297
14299
  if (this.inHandshake) {
14298
- this.buffer.push(envelope);
14300
+ // Filter: only buffer frames related to our systemId or frames without systemId info
14301
+ const frameSystemId = envelope.frame?.systemId;
14302
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
14303
+ this.buffer.push(envelope);
14304
+ }
14305
+ else {
14306
+ // Silently ignore frames from other agents during concurrent handshakes
14307
+ logger$Y.debug('handshake_ignoring_frame_from_different_system', {
14308
+ frame_type: envelope.frame.type,
14309
+ frame_system_id: frameSystemId,
14310
+ expected_system_id: this.expectedSystemId,
14311
+ });
14312
+ }
14299
14313
  return null;
14300
14314
  }
14301
14315
  return finalHandler(envelope, context);
@@ -14422,6 +14436,7 @@ class DefaultNodeAttachClient {
14422
14436
  parent_id: ackFrame.targetSystemId,
14423
14437
  });
14424
14438
  this.inHandshake = false;
14439
+ this.expectedSystemId = null;
14425
14440
  await connector.replaceHandler(finalHandler);
14426
14441
  while (this.buffer.length > 0) {
14427
14442
  const bufferedEnvelope = this.buffer.shift();
@@ -14498,9 +14513,20 @@ class DefaultNodeAttachClient {
14498
14513
  if (envelope.frame.type === 'NodeAttachAck') {
14499
14514
  return envelope;
14500
14515
  }
14501
- logger$Y.error('unexpected_frame_during_handshake', {
14502
- frame_type: envelope.frame.type,
14503
- });
14516
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
14517
+ // where multiple agents attach concurrently to the same channel
14518
+ if (envelope.frame.type === 'NodeAttach') {
14519
+ logger$Y.debug('handshake_ignoring_concurrent_attach', {
14520
+ frame_type: envelope.frame.type,
14521
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
14522
+ });
14523
+ }
14524
+ else {
14525
+ // Other unexpected frames are still logged as errors
14526
+ logger$Y.error('unexpected_frame_during_handshake', {
14527
+ frame_type: envelope.frame.type,
14528
+ });
14529
+ }
14504
14530
  }
14505
14531
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
14506
14532
  }
@@ -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.6-test.001
5565
+ // Generated from package.json version: 0.3.6-test.102
5566
5566
  /**
5567
5567
  * The package version, injected at build time.
5568
5568
  * @internal
5569
5569
  */
5570
- const VERSION = '0.3.6-test.001';
5570
+ const VERSION = '0.3.6-test.102';
5571
5571
 
5572
5572
  /**
5573
5573
  * Fame errors module - Fame protocol specific error classes
@@ -14286,15 +14286,29 @@ class DefaultNodeAttachClient {
14286
14286
  constructor(options = {}) {
14287
14287
  this.buffer = [];
14288
14288
  this.inHandshake = false;
14289
+ this.expectedSystemId = null;
14289
14290
  this.timeoutMs = options.timeoutMs ?? 10000;
14290
14291
  this.attachmentKeyValidator = options.attachmentKeyValidator;
14291
14292
  this.replicaStickinessManager = options.replicaStickinessManager ?? null;
14292
14293
  }
14293
14294
  async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
14294
14295
  this.inHandshake = true;
14296
+ this.expectedSystemId = welcomeFrame.systemId;
14295
14297
  const interimHandler = async (envelope, context) => {
14296
14298
  if (this.inHandshake) {
14297
- this.buffer.push(envelope);
14299
+ // Filter: only buffer frames related to our systemId or frames without systemId info
14300
+ const frameSystemId = envelope.frame?.systemId;
14301
+ if (!frameSystemId || frameSystemId === this.expectedSystemId) {
14302
+ this.buffer.push(envelope);
14303
+ }
14304
+ else {
14305
+ // Silently ignore frames from other agents during concurrent handshakes
14306
+ logger$Y.debug('handshake_ignoring_frame_from_different_system', {
14307
+ frame_type: envelope.frame.type,
14308
+ frame_system_id: frameSystemId,
14309
+ expected_system_id: this.expectedSystemId,
14310
+ });
14311
+ }
14298
14312
  return null;
14299
14313
  }
14300
14314
  return finalHandler(envelope, context);
@@ -14421,6 +14435,7 @@ class DefaultNodeAttachClient {
14421
14435
  parent_id: ackFrame.targetSystemId,
14422
14436
  });
14423
14437
  this.inHandshake = false;
14438
+ this.expectedSystemId = null;
14424
14439
  await connector.replaceHandler(finalHandler);
14425
14440
  while (this.buffer.length > 0) {
14426
14441
  const bufferedEnvelope = this.buffer.shift();
@@ -14497,9 +14512,20 @@ class DefaultNodeAttachClient {
14497
14512
  if (envelope.frame.type === 'NodeAttachAck') {
14498
14513
  return envelope;
14499
14514
  }
14500
- logger$Y.error('unexpected_frame_during_handshake', {
14501
- frame_type: envelope.frame.type,
14502
- });
14515
+ // NodeAttach frames during handshake are expected in multi-agent scenarios
14516
+ // where multiple agents attach concurrently to the same channel
14517
+ if (envelope.frame.type === 'NodeAttach') {
14518
+ logger$Y.debug('handshake_ignoring_concurrent_attach', {
14519
+ frame_type: envelope.frame.type,
14520
+ frame_system_id: envelope.frame?.systemId ?? 'unknown',
14521
+ });
14522
+ }
14523
+ else {
14524
+ // Other unexpected frames are still logged as errors
14525
+ logger$Y.error('unexpected_frame_during_handshake', {
14526
+ frame_type: envelope.frame.type,
14527
+ });
14528
+ }
14503
14529
  }
14504
14530
  await delay(HANDSHAKE_POLL_INTERVAL_MS);
14505
14531
  }
@@ -14,6 +14,7 @@ export declare class DefaultNodeAttachClient implements NodeAttachClient {
14
14
  private readonly replicaStickinessManager;
15
15
  private readonly buffer;
16
16
  private inHandshake;
17
+ private expectedSystemId;
17
18
  constructor(options?: DefaultNodeAttachClientOptions);
18
19
  attach(node: NodeLike, originType: DeliveryOriginType, connector: FameConnector, welcomeFrame: NodeWelcomeFrame, finalHandler: FameEnvelopeHandler, keys?: Array<Record<string, unknown>>, callbackGrants?: Array<Record<string, unknown>>): Promise<AttachInfo>;
19
20
  private awaitAck;
@@ -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.6-test.001";
5
+ export declare const VERSION = "0.3.6-test.102";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.6-test.001",
3
+ "version": "0.3.6-test.102",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",