@naylence/runtime 0.3.6 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +262 -172
- package/dist/browser/index.mjs +261 -173
- package/dist/cjs/_env-shim.js +3 -1
- package/dist/cjs/naylence/fame/config/extended-fame-config.js +2 -1
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +11 -7
- package/dist/cjs/naylence/fame/connector/index.js +2 -1
- package/dist/cjs/naylence/fame/connector/inpage-connector-factory.js +2 -1
- package/dist/cjs/naylence/fame/connector/inpage-connector.js +13 -6
- package/dist/cjs/naylence/fame/connector/inpage-listener-factory.js +4 -4
- package/dist/cjs/naylence/fame/connector/inpage-listener.js +5 -2
- package/dist/cjs/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/cjs/naylence/fame/fabric/fabric-registry.js +41 -0
- package/dist/cjs/naylence/fame/fabric/in-process-fame-fabric.js +3 -0
- package/dist/cjs/naylence/fame/fabric/index.js +3 -1
- package/dist/cjs/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
- package/dist/cjs/naylence/fame/grants/inpage-connection-grant.js +4 -2
- package/dist/cjs/naylence/fame/http/oauth2-token-router.js +9 -9
- package/dist/cjs/naylence/fame/node/admission/default-node-attach-client.js +34 -5
- package/dist/cjs/naylence/fame/node/upstream-session-manager.js +40 -8
- package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
- package/dist/cjs/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
- package/dist/cjs/naylence/fame/security/default-security-manager.js +2 -1
- package/dist/cjs/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +2 -2
- package/dist/cjs/naylence/fame/security/trust-store/trust-store-provider-factory.js +2 -2
- package/dist/cjs/naylence/fame/util/index.js +3 -1
- package/dist/cjs/node.js +4 -1
- package/dist/cjs/runtime-isomorphic.js +4 -1
- package/dist/cjs/version.js +2 -2
- package/dist/esm/_env-shim.js +3 -1
- package/dist/esm/browser.js +2 -2
- package/dist/esm/naylence/fame/config/extended-fame-config.js +2 -1
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +12 -4
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +14 -6
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener-factory.js +3 -1
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +11 -7
- package/dist/esm/naylence/fame/connector/index.js +2 -2
- package/dist/esm/naylence/fame/connector/inpage-connector-factory.js +2 -1
- package/dist/esm/naylence/fame/connector/inpage-connector.js +13 -6
- package/dist/esm/naylence/fame/connector/inpage-listener-factory.js +4 -4
- package/dist/esm/naylence/fame/connector/inpage-listener.js +5 -2
- package/dist/esm/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/esm/naylence/fame/fabric/fabric-registry.js +37 -0
- package/dist/esm/naylence/fame/fabric/in-process-fame-fabric.js +3 -0
- package/dist/esm/naylence/fame/fabric/index.js +1 -0
- package/dist/esm/naylence/fame/grants/broadcast-channel-connection-grant.js +6 -3
- package/dist/esm/naylence/fame/grants/inpage-connection-grant.js +4 -2
- package/dist/esm/naylence/fame/http/oauth2-token-router.js +9 -9
- package/dist/esm/naylence/fame/node/admission/default-node-attach-client.js +34 -5
- package/dist/esm/naylence/fame/node/upstream-session-manager.js +40 -8
- package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider-factory.js +10 -6
- package/dist/esm/naylence/fame/security/auth/oauth2-pkce-token-provider.js +1 -2
- package/dist/esm/naylence/fame/security/default-security-manager.js +2 -1
- package/dist/esm/naylence/fame/security/index.js +1 -1
- package/dist/esm/naylence/fame/security/trust-store/noop-trust-store-provider-factory.js +3 -3
- package/dist/esm/naylence/fame/security/trust-store/trust-store-provider-factory.js +3 -3
- package/dist/esm/naylence/fame/util/index.js +1 -0
- package/dist/esm/node.js +2 -1
- package/dist/esm/runtime-isomorphic.js +2 -0
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +259 -171
- package/dist/node/index.mjs +258 -172
- package/dist/node/node.cjs +225 -136
- package/dist/node/node.mjs +223 -137
- package/dist/types/browser.d.ts +2 -2
- package/dist/types/naylence/fame/connector/broadcast-channel-connector-factory.d.ts +1 -0
- package/dist/types/naylence/fame/connector/index.d.ts +3 -3
- package/dist/types/naylence/fame/delivery/default-delivery-tracker.d.ts +0 -6
- package/dist/types/naylence/fame/fabric/fabric-registry.d.ts +29 -0
- package/dist/types/naylence/fame/fabric/index.d.ts +1 -0
- package/dist/types/naylence/fame/node/admission/default-node-attach-client.d.ts +1 -0
- package/dist/types/naylence/fame/security/index.d.ts +1 -1
- package/dist/types/naylence/fame/security/trust-store/noop-trust-store-provider-factory.d.ts +3 -3
- package/dist/types/naylence/fame/security/trust-store/trust-store-provider-factory.d.ts +4 -4
- package/dist/types/naylence/fame/security/trust-store/trust-store-provider.d.ts +5 -5
- package/dist/types/naylence/fame/util/index.d.ts +1 -0
- package/dist/types/node.d.ts +2 -1
- package/dist/types/runtime-isomorphic.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -30,7 +30,9 @@ function installProcessEnvShim() {
|
|
|
30
30
|
if (g.__ENV__ && typeof g.__ENV__ === 'object')
|
|
31
31
|
Object.assign(out, g.__ENV__);
|
|
32
32
|
try {
|
|
33
|
-
//
|
|
33
|
+
// import.meta is only available in ESM builds
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
// @ts-ignore
|
|
34
36
|
const ie = (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== 'undefined' && undefined) || undefined;
|
|
35
37
|
if (ie && typeof ie === 'object')
|
|
36
38
|
Object.assign(out, ie);
|
|
@@ -98,12 +100,12 @@ installProcessEnvShim();
|
|
|
98
100
|
// --- END ENV SHIM ---
|
|
99
101
|
|
|
100
102
|
// This file is auto-generated during build - do not edit manually
|
|
101
|
-
// Generated from package.json version: 0.3.
|
|
103
|
+
// Generated from package.json version: 0.3.9
|
|
102
104
|
/**
|
|
103
105
|
* The package version, injected at build time.
|
|
104
106
|
* @internal
|
|
105
107
|
*/
|
|
106
|
-
const VERSION = '0.3.
|
|
108
|
+
const VERSION = '0.3.9';
|
|
107
109
|
|
|
108
110
|
/**
|
|
109
111
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -2332,6 +2334,50 @@ function validateKeyCorrelationTtlSec(ttlSec) {
|
|
|
2332
2334
|
});
|
|
2333
2335
|
}
|
|
2334
2336
|
|
|
2337
|
+
function isModuleNotFoundError(error) {
|
|
2338
|
+
if (!(error instanceof Error)) {
|
|
2339
|
+
return false;
|
|
2340
|
+
}
|
|
2341
|
+
const message = error.message || '';
|
|
2342
|
+
if (message.includes('Cannot find module') ||
|
|
2343
|
+
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
2344
|
+
message.includes('MODULE_NOT_FOUND')) {
|
|
2345
|
+
return true;
|
|
2346
|
+
}
|
|
2347
|
+
const code = error.code;
|
|
2348
|
+
if (typeof code === 'string') {
|
|
2349
|
+
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
2350
|
+
}
|
|
2351
|
+
return false;
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
2355
|
+
*/
|
|
2356
|
+
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
2357
|
+
const options = typeof dependencyNameOrOptions === 'string'
|
|
2358
|
+
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
2359
|
+
: dependencyNameOrOptions;
|
|
2360
|
+
const dependencyName = options.dependencyName;
|
|
2361
|
+
try {
|
|
2362
|
+
return await loader();
|
|
2363
|
+
}
|
|
2364
|
+
catch (error) {
|
|
2365
|
+
if (isModuleNotFoundError(error)) {
|
|
2366
|
+
const message = options.helpMessage ??
|
|
2367
|
+
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
2368
|
+
const enrichedError = new Error(message);
|
|
2369
|
+
try {
|
|
2370
|
+
enrichedError.cause = error;
|
|
2371
|
+
}
|
|
2372
|
+
catch {
|
|
2373
|
+
// Ignore environments that do not support attaching a cause.
|
|
2374
|
+
}
|
|
2375
|
+
throw enrichedError;
|
|
2376
|
+
}
|
|
2377
|
+
throw error;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2335
2381
|
/**
|
|
2336
2382
|
* flow_controller.ts - credit window management with cooperative back-pressure.
|
|
2337
2383
|
*
|
|
@@ -3536,50 +3582,6 @@ function normalizeSecretSource(value) {
|
|
|
3536
3582
|
return SecretSource.normalize(value);
|
|
3537
3583
|
}
|
|
3538
3584
|
|
|
3539
|
-
function isModuleNotFoundError(error) {
|
|
3540
|
-
if (!(error instanceof Error)) {
|
|
3541
|
-
return false;
|
|
3542
|
-
}
|
|
3543
|
-
const message = error.message || '';
|
|
3544
|
-
if (message.includes('Cannot find module') ||
|
|
3545
|
-
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
3546
|
-
message.includes('MODULE_NOT_FOUND')) {
|
|
3547
|
-
return true;
|
|
3548
|
-
}
|
|
3549
|
-
const code = error.code;
|
|
3550
|
-
if (typeof code === 'string') {
|
|
3551
|
-
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
3552
|
-
}
|
|
3553
|
-
return false;
|
|
3554
|
-
}
|
|
3555
|
-
/**
|
|
3556
|
-
* Wraps a dynamic import loader and enriches "module not found" failures with an actionable error message.
|
|
3557
|
-
*/
|
|
3558
|
-
async function safeImport(loader, dependencyNameOrOptions, maybeOptions) {
|
|
3559
|
-
const options = typeof dependencyNameOrOptions === 'string'
|
|
3560
|
-
? { dependencyName: dependencyNameOrOptions, ...(maybeOptions ?? {}) }
|
|
3561
|
-
: dependencyNameOrOptions;
|
|
3562
|
-
const dependencyName = options.dependencyName;
|
|
3563
|
-
try {
|
|
3564
|
-
return await loader();
|
|
3565
|
-
}
|
|
3566
|
-
catch (error) {
|
|
3567
|
-
if (isModuleNotFoundError(error)) {
|
|
3568
|
-
const message = options.helpMessage ??
|
|
3569
|
-
`Missing optional dependency "${dependencyName}". Install it to enable this feature.`;
|
|
3570
|
-
const enrichedError = new Error(message);
|
|
3571
|
-
try {
|
|
3572
|
-
enrichedError.cause = error;
|
|
3573
|
-
}
|
|
3574
|
-
catch {
|
|
3575
|
-
// Ignore environments that do not support attaching a cause.
|
|
3576
|
-
}
|
|
3577
|
-
throw enrichedError;
|
|
3578
|
-
}
|
|
3579
|
-
throw error;
|
|
3580
|
-
}
|
|
3581
|
-
}
|
|
3582
|
-
|
|
3583
3585
|
const indexedDBConfigSchema = zod.z
|
|
3584
3586
|
.object({
|
|
3585
3587
|
type: zod.z
|
|
@@ -7175,9 +7177,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7175
7177
|
this.ackDoneSince = new Map();
|
|
7176
7178
|
this.replyDoneSince = new Map();
|
|
7177
7179
|
this.pendingAckDispatches = new Set();
|
|
7178
|
-
this.recentlyHandled = new Map();
|
|
7179
|
-
this.recentlyHandledOrder = [];
|
|
7180
|
-
this.recentlyHandledTtlMs = 60000;
|
|
7181
7180
|
this.isPreparingToStop = false;
|
|
7182
7181
|
this.shutdownRequestedAtMs = null;
|
|
7183
7182
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -7399,22 +7398,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7399
7398
|
}
|
|
7400
7399
|
}
|
|
7401
7400
|
else {
|
|
7402
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
7403
|
-
if (wasRecentlyHandled) {
|
|
7404
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
7405
|
-
envp_id: envelope.id,
|
|
7406
|
-
});
|
|
7407
|
-
return new TrackedEnvelope({
|
|
7408
|
-
timeoutAtMs: 0,
|
|
7409
|
-
overallTimeoutAtMs: 0,
|
|
7410
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
7411
|
-
createdAtMs: Date.now(),
|
|
7412
|
-
status: EnvelopeStatus.HANDLED,
|
|
7413
|
-
mailboxType: MailboxType.INBOX,
|
|
7414
|
-
originalEnvelope: envelope,
|
|
7415
|
-
serviceName: inboxName,
|
|
7416
|
-
});
|
|
7417
|
-
}
|
|
7418
7401
|
tracked = new TrackedEnvelope({
|
|
7419
7402
|
timeoutAtMs: 0,
|
|
7420
7403
|
overallTimeoutAtMs: 0,
|
|
@@ -7436,12 +7419,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7436
7419
|
async onEnvelopeHandled(envelope) {
|
|
7437
7420
|
const inbox = this.ensureInbox();
|
|
7438
7421
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
7422
|
+
// Delete the envelope from inbox to prevent growth
|
|
7439
7423
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7440
|
-
await this.lock.runExclusive(async () => {
|
|
7441
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
7442
|
-
});
|
|
7443
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
7444
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
7445
7424
|
}
|
|
7446
7425
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
7447
7426
|
const inbox = this.ensureInbox();
|
|
@@ -7656,9 +7635,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7656
7635
|
});
|
|
7657
7636
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
7658
7637
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7638
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
7639
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
7640
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
7662
7641
|
for (const handler of this.eventHandlers) {
|
|
7663
7642
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7664
7643
|
}
|
|
@@ -7808,8 +7787,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7808
7787
|
}
|
|
7809
7788
|
this.streamDone.clear();
|
|
7810
7789
|
this.correlationToEnvelope.clear();
|
|
7811
|
-
this.recentlyHandled.clear();
|
|
7812
|
-
this.recentlyHandledOrder.length = 0;
|
|
7813
7790
|
return values;
|
|
7814
7791
|
});
|
|
7815
7792
|
for (const timer of timers) {
|
|
@@ -8391,39 +8368,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8391
8368
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
8392
8369
|
}
|
|
8393
8370
|
}
|
|
8394
|
-
markRecentlyHandled(envelopeId) {
|
|
8395
|
-
const now = Date.now();
|
|
8396
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
8397
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
8398
|
-
this.trimRecentlyHandled(now);
|
|
8399
|
-
}
|
|
8400
|
-
wasRecentlyHandled(envelopeId) {
|
|
8401
|
-
const now = Date.now();
|
|
8402
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
8403
|
-
if (timestamp === undefined) {
|
|
8404
|
-
return false;
|
|
8405
|
-
}
|
|
8406
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
8407
|
-
this.recentlyHandled.delete(envelopeId);
|
|
8408
|
-
return false;
|
|
8409
|
-
}
|
|
8410
|
-
return true;
|
|
8411
|
-
}
|
|
8412
|
-
trimRecentlyHandled(now) {
|
|
8413
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
8414
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
8415
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
8416
|
-
if (timestamp === undefined) {
|
|
8417
|
-
this.recentlyHandledOrder.shift();
|
|
8418
|
-
continue;
|
|
8419
|
-
}
|
|
8420
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
8421
|
-
break;
|
|
8422
|
-
}
|
|
8423
|
-
this.recentlyHandled.delete(candidate);
|
|
8424
|
-
this.recentlyHandledOrder.shift();
|
|
8425
|
-
}
|
|
8426
|
-
}
|
|
8427
8371
|
getShutdownRetryDeferDelay(nowMs) {
|
|
8428
8372
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
8429
8373
|
return null;
|
|
@@ -9917,7 +9861,8 @@ const ensureBroadcastEnvironment = () => {
|
|
|
9917
9861
|
};
|
|
9918
9862
|
let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
9919
9863
|
static generateConnectorId() {
|
|
9920
|
-
const globalCrypto = globalThis
|
|
9864
|
+
const globalCrypto = globalThis
|
|
9865
|
+
.crypto;
|
|
9921
9866
|
if (globalCrypto?.randomUUID) {
|
|
9922
9867
|
return globalCrypto.randomUUID();
|
|
9923
9868
|
}
|
|
@@ -9972,7 +9917,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9972
9917
|
this.listenerRegistered = false;
|
|
9973
9918
|
this.visibilityChangeListenerRegistered = false;
|
|
9974
9919
|
this.channelName =
|
|
9975
|
-
typeof config.channelName === 'string' &&
|
|
9920
|
+
typeof config.channelName === 'string' &&
|
|
9921
|
+
config.channelName.trim().length > 0
|
|
9976
9922
|
? config.channelName.trim()
|
|
9977
9923
|
: DEFAULT_CHANNEL$7;
|
|
9978
9924
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -9996,6 +9942,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9996
9942
|
local_node_id: this.localNodeId,
|
|
9997
9943
|
target_node_id: this.targetNodeId ?? null,
|
|
9998
9944
|
inbox_capacity: preferredCapacity,
|
|
9945
|
+
passive: config.passive ?? false,
|
|
9999
9946
|
timestamp: new Date().toISOString(),
|
|
10000
9947
|
});
|
|
10001
9948
|
this.onMsg = (event) => {
|
|
@@ -10013,7 +9960,8 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10013
9960
|
channel: this.channelName,
|
|
10014
9961
|
connector_id: this.connectorId,
|
|
10015
9962
|
message_type: message && typeof message === 'object'
|
|
10016
|
-
? message.constructor
|
|
9963
|
+
? (message.constructor
|
|
9964
|
+
?.name ?? typeof message)
|
|
10017
9965
|
: typeof message,
|
|
10018
9966
|
has_sender_id: Boolean(message?.senderId),
|
|
10019
9967
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -10243,7 +10191,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10243
10191
|
timestamp: new Date().toISOString(),
|
|
10244
10192
|
});
|
|
10245
10193
|
}
|
|
10246
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
10194
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
10195
|
+
this.visibilityChangeHandler &&
|
|
10196
|
+
typeof document !== 'undefined') {
|
|
10247
10197
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
10248
10198
|
this.visibilityChangeListenerRegistered = false;
|
|
10249
10199
|
this.visibilityChangeHandler = undefined;
|
|
@@ -10271,7 +10221,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10271
10221
|
return rawOrEnvelope;
|
|
10272
10222
|
}
|
|
10273
10223
|
_isWildcardTarget() {
|
|
10274
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
10224
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
10275
10225
|
}
|
|
10276
10226
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
10277
10227
|
if (this._isWildcardTarget()) {
|
|
@@ -10291,7 +10241,9 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10291
10241
|
return true;
|
|
10292
10242
|
}
|
|
10293
10243
|
const expectedSender = this.targetNodeId;
|
|
10294
|
-
if (expectedSender &&
|
|
10244
|
+
if (expectedSender &&
|
|
10245
|
+
expectedSender !== '*' &&
|
|
10246
|
+
senderNodeId !== expectedSender) {
|
|
10295
10247
|
logger$_.debug('broadcast_channel_message_rejected', {
|
|
10296
10248
|
channel: this.channelName,
|
|
10297
10249
|
connector_id: this.connectorId,
|
|
@@ -10510,14 +10462,16 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10510
10462
|
type,
|
|
10511
10463
|
purpose,
|
|
10512
10464
|
};
|
|
10513
|
-
const channelValue = candidate.channelName ??
|
|
10465
|
+
const channelValue = candidate.channelName ??
|
|
10466
|
+
candidate['channel_name'];
|
|
10514
10467
|
if (channelValue !== undefined) {
|
|
10515
10468
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
10516
10469
|
throw new TypeError('BroadcastChannelConnectionGrant "channelName" must be a non-empty string when provided');
|
|
10517
10470
|
}
|
|
10518
10471
|
result.channelName = channelValue.trim();
|
|
10519
10472
|
}
|
|
10520
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
10473
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
10474
|
+
candidate['inbox_capacity'];
|
|
10521
10475
|
if (inboxValue !== undefined) {
|
|
10522
10476
|
if (typeof inboxValue !== 'number' ||
|
|
10523
10477
|
!Number.isFinite(inboxValue) ||
|
|
@@ -10526,7 +10480,8 @@ function normalizeBroadcastChannelConnectionGrant(candidate) {
|
|
|
10526
10480
|
}
|
|
10527
10481
|
result.inboxCapacity = Math.floor(inboxValue);
|
|
10528
10482
|
}
|
|
10529
|
-
const windowValue = candidate.initialWindow ??
|
|
10483
|
+
const windowValue = candidate.initialWindow ??
|
|
10484
|
+
candidate['initial_window'];
|
|
10530
10485
|
if (windowValue !== undefined) {
|
|
10531
10486
|
if (typeof windowValue !== 'number' ||
|
|
10532
10487
|
!Number.isFinite(windowValue) ||
|
|
@@ -10863,25 +10818,56 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
10863
10818
|
await connector.start(this.wrappedHandler);
|
|
10864
10819
|
this.connector = connector;
|
|
10865
10820
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
10821
|
+
logger$Z.debug('callback_grants_before_augmentation', {
|
|
10822
|
+
count: callbackGrants.length,
|
|
10823
|
+
types: callbackGrants.map((g) => g.type),
|
|
10824
|
+
});
|
|
10825
|
+
// Check if we should create a broadcast callback grant before processing connection grants
|
|
10826
|
+
// This prevents adding duplicate broadcast grants
|
|
10827
|
+
const shouldAddBroadcastGrant = this.shouldAdvertiseBroadcastGrant(grant, callbackGrants);
|
|
10828
|
+
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
10829
|
+
? this.createBroadcastCallbackGrant(grant)
|
|
10830
|
+
: null;
|
|
10831
|
+
logger$Z.debug('broadcast_callback_grant_check', {
|
|
10832
|
+
should_add: shouldAddBroadcastGrant,
|
|
10833
|
+
grant_created: !!broadcastCallbackGrant,
|
|
10834
|
+
});
|
|
10866
10835
|
// Include admission client's connection grants as callback grants
|
|
10867
10836
|
// This ensures DirectAdmissionClient grants are available for grant selection
|
|
10868
|
-
if (welcome.frame.connectionGrants &&
|
|
10837
|
+
if (welcome.frame.connectionGrants &&
|
|
10838
|
+
Array.isArray(welcome.frame.connectionGrants)) {
|
|
10869
10839
|
for (const grant of welcome.frame.connectionGrants) {
|
|
10870
10840
|
if (grant && typeof grant === 'object') {
|
|
10871
10841
|
// Avoid duplicates by checking if grant already exists
|
|
10872
|
-
const isDuplicate = callbackGrants.some(existing => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10842
|
+
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
10873
10843
|
if (!isDuplicate) {
|
|
10874
10844
|
callbackGrants.push(grant);
|
|
10845
|
+
logger$Z.debug('added_connection_grant_as_callback', {
|
|
10846
|
+
type: grant.type,
|
|
10847
|
+
});
|
|
10848
|
+
}
|
|
10849
|
+
else {
|
|
10850
|
+
logger$Z.debug('skipped_duplicate_connection_grant', {
|
|
10851
|
+
type: grant.type,
|
|
10852
|
+
});
|
|
10875
10853
|
}
|
|
10876
10854
|
}
|
|
10877
10855
|
}
|
|
10878
10856
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10857
|
+
// Add broadcast grant after connection grants to ensure we don't duplicate
|
|
10858
|
+
// any broadcast grants that may have been in connectionGrants
|
|
10859
|
+
if (broadcastCallbackGrant &&
|
|
10860
|
+
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
10861
|
+
callbackGrants.push(broadcastCallbackGrant);
|
|
10862
|
+
logger$Z.debug('added_broadcast_callback_grant');
|
|
10863
|
+
}
|
|
10864
|
+
else if (broadcastCallbackGrant) {
|
|
10865
|
+
logger$Z.debug('skipped_duplicate_broadcast_callback_grant');
|
|
10884
10866
|
}
|
|
10867
|
+
logger$Z.debug('callback_grants_after_augmentation', {
|
|
10868
|
+
count: callbackGrants.length,
|
|
10869
|
+
types: callbackGrants.map((g) => g.type),
|
|
10870
|
+
});
|
|
10885
10871
|
const attachInfo = await this.attachClient.attach(this.node, this.outboundOriginType, connector, welcome.frame, this.wrappedHandler, this.getKeys() ?? undefined, callbackGrants);
|
|
10886
10872
|
this.targetSystemId = attachInfo.targetSystemId ?? null;
|
|
10887
10873
|
if (this.targetSystemId) {
|
|
@@ -11122,7 +11108,8 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
11122
11108
|
continue;
|
|
11123
11109
|
}
|
|
11124
11110
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
11125
|
-
if (previousState === core.ConnectorState.PAUSED &&
|
|
11111
|
+
if (previousState === core.ConnectorState.PAUSED &&
|
|
11112
|
+
currentState === core.ConnectorState.STARTED) {
|
|
11126
11113
|
logger$Z.debug('connector_just_resumed_resetting_ack_time', {
|
|
11127
11114
|
previous_state: previousState,
|
|
11128
11115
|
current_state: currentState,
|
|
@@ -12679,15 +12666,30 @@ class DefaultNodeAttachClient {
|
|
|
12679
12666
|
constructor(options = {}) {
|
|
12680
12667
|
this.buffer = [];
|
|
12681
12668
|
this.inHandshake = false;
|
|
12669
|
+
this.expectedSystemId = null;
|
|
12682
12670
|
this.timeoutMs = options.timeoutMs ?? 10000;
|
|
12683
12671
|
this.attachmentKeyValidator = options.attachmentKeyValidator;
|
|
12684
12672
|
this.replicaStickinessManager = options.replicaStickinessManager ?? null;
|
|
12685
12673
|
}
|
|
12686
12674
|
async attach(node, originType, connector, welcomeFrame, finalHandler, keys, callbackGrants) {
|
|
12687
12675
|
this.inHandshake = true;
|
|
12676
|
+
this.expectedSystemId = welcomeFrame.systemId;
|
|
12688
12677
|
const interimHandler = async (envelope, context) => {
|
|
12689
12678
|
if (this.inHandshake) {
|
|
12690
|
-
|
|
12679
|
+
// Filter: only buffer frames related to our systemId or frames without systemId info
|
|
12680
|
+
const frameSystemId = envelope.frame
|
|
12681
|
+
?.systemId;
|
|
12682
|
+
if (!frameSystemId || frameSystemId === this.expectedSystemId) {
|
|
12683
|
+
this.buffer.push(envelope);
|
|
12684
|
+
}
|
|
12685
|
+
else {
|
|
12686
|
+
// Silently ignore frames from other agents during concurrent handshakes
|
|
12687
|
+
logger$W.debug('handshake_ignoring_frame_from_different_system', {
|
|
12688
|
+
frame_type: envelope.frame.type,
|
|
12689
|
+
frame_system_id: frameSystemId,
|
|
12690
|
+
expected_system_id: this.expectedSystemId,
|
|
12691
|
+
});
|
|
12692
|
+
}
|
|
12691
12693
|
return null;
|
|
12692
12694
|
}
|
|
12693
12695
|
return finalHandler(envelope, context);
|
|
@@ -12814,6 +12816,7 @@ class DefaultNodeAttachClient {
|
|
|
12814
12816
|
parent_id: ackFrame.targetSystemId,
|
|
12815
12817
|
});
|
|
12816
12818
|
this.inHandshake = false;
|
|
12819
|
+
this.expectedSystemId = null;
|
|
12817
12820
|
await connector.replaceHandler(finalHandler);
|
|
12818
12821
|
while (this.buffer.length > 0) {
|
|
12819
12822
|
const bufferedEnvelope = this.buffer.shift();
|
|
@@ -12871,7 +12874,8 @@ class DefaultNodeAttachClient {
|
|
|
12871
12874
|
const deadline = Date.now() + this.timeoutMs;
|
|
12872
12875
|
while (Date.now() < deadline) {
|
|
12873
12876
|
// Allow both STARTED and PAUSED states (PAUSED = tab hidden but connection alive)
|
|
12874
|
-
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12877
|
+
if (connector.state !== core.ConnectorState.STARTED &&
|
|
12878
|
+
connector.state !== core.ConnectorState.PAUSED) {
|
|
12875
12879
|
let errorMessage = 'Connector closed while waiting for NodeAttachAck';
|
|
12876
12880
|
if (connector.closeCode !== undefined) {
|
|
12877
12881
|
errorMessage += ` (code=${connector.closeCode}`;
|
|
@@ -12890,9 +12894,21 @@ class DefaultNodeAttachClient {
|
|
|
12890
12894
|
if (envelope.frame.type === 'NodeAttachAck') {
|
|
12891
12895
|
return envelope;
|
|
12892
12896
|
}
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12897
|
+
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
12898
|
+
// where multiple agents attach concurrently to the same channel
|
|
12899
|
+
if (envelope.frame.type === 'NodeAttach') {
|
|
12900
|
+
logger$W.debug('handshake_ignoring_concurrent_attach', {
|
|
12901
|
+
frame_type: envelope.frame.type,
|
|
12902
|
+
frame_system_id: envelope.frame?.systemId ??
|
|
12903
|
+
'unknown',
|
|
12904
|
+
});
|
|
12905
|
+
}
|
|
12906
|
+
else {
|
|
12907
|
+
// Other unexpected frames are still logged as errors
|
|
12908
|
+
logger$W.error('unexpected_frame_during_handshake', {
|
|
12909
|
+
frame_type: envelope.frame.type,
|
|
12910
|
+
});
|
|
12911
|
+
}
|
|
12896
12912
|
}
|
|
12897
12913
|
await delay(HANDSHAKE_POLL_INTERVAL_MS);
|
|
12898
12914
|
}
|
|
@@ -13611,7 +13627,8 @@ function createFsShim() {
|
|
|
13611
13627
|
else if (options &&
|
|
13612
13628
|
typeof options === 'object' &&
|
|
13613
13629
|
'encoding' in options &&
|
|
13614
|
-
typeof options.encoding ===
|
|
13630
|
+
typeof options.encoding ===
|
|
13631
|
+
'string') {
|
|
13615
13632
|
encoding = options.encoding;
|
|
13616
13633
|
}
|
|
13617
13634
|
const data = fsBinding.readFileUtf8(pathOrDescriptor, 0);
|
|
@@ -20544,7 +20561,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20544
20561
|
this.listenerRegistered = false;
|
|
20545
20562
|
this.visibilityChangeListenerRegistered = false;
|
|
20546
20563
|
this.channelName =
|
|
20547
|
-
typeof config.channelName === 'string' &&
|
|
20564
|
+
typeof config.channelName === 'string' &&
|
|
20565
|
+
config.channelName.trim().length > 0
|
|
20548
20566
|
? config.channelName.trim()
|
|
20549
20567
|
: DEFAULT_CHANNEL$6;
|
|
20550
20568
|
const preferredCapacity = typeof config.inboxCapacity === 'number' &&
|
|
@@ -20583,7 +20601,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20583
20601
|
channel: this.channelName,
|
|
20584
20602
|
connector_id: this.connectorId,
|
|
20585
20603
|
message_type: message && typeof message === 'object'
|
|
20586
|
-
? message.constructor
|
|
20604
|
+
? (message.constructor
|
|
20605
|
+
?.name ?? typeof message)
|
|
20587
20606
|
: typeof message,
|
|
20588
20607
|
has_sender_id: Boolean(message?.senderId),
|
|
20589
20608
|
has_sender_node_id: Boolean(message?.senderNodeId),
|
|
@@ -20592,7 +20611,8 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20592
20611
|
return;
|
|
20593
20612
|
}
|
|
20594
20613
|
const busMessage = message;
|
|
20595
|
-
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20614
|
+
const senderId = typeof busMessage.senderId === 'string' &&
|
|
20615
|
+
busMessage.senderId.length > 0
|
|
20596
20616
|
? busMessage.senderId
|
|
20597
20617
|
: null;
|
|
20598
20618
|
const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
@@ -20843,7 +20863,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20843
20863
|
timestamp: new Date().toISOString(),
|
|
20844
20864
|
});
|
|
20845
20865
|
}
|
|
20846
|
-
if (this.visibilityChangeListenerRegistered &&
|
|
20866
|
+
if (this.visibilityChangeListenerRegistered &&
|
|
20867
|
+
this.visibilityChangeHandler &&
|
|
20868
|
+
typeof document !== 'undefined') {
|
|
20847
20869
|
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
20848
20870
|
this.visibilityChangeListenerRegistered = false;
|
|
20849
20871
|
this.visibilityChangeHandler = undefined;
|
|
@@ -20860,7 +20882,7 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20860
20882
|
return rawOrEnvelope;
|
|
20861
20883
|
}
|
|
20862
20884
|
_isWildcardTarget() {
|
|
20863
|
-
return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
|
|
20885
|
+
return (this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined');
|
|
20864
20886
|
}
|
|
20865
20887
|
_shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
|
|
20866
20888
|
if (this._isWildcardTarget()) {
|
|
@@ -20880,7 +20902,9 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20880
20902
|
return true;
|
|
20881
20903
|
}
|
|
20882
20904
|
const expectedSender = this.targetNodeId;
|
|
20883
|
-
if (expectedSender &&
|
|
20905
|
+
if (expectedSender &&
|
|
20906
|
+
expectedSender !== '*' &&
|
|
20907
|
+
senderNodeId !== expectedSender) {
|
|
20884
20908
|
logger$G.debug('inpage_message_rejected', {
|
|
20885
20909
|
channel: this.channelName,
|
|
20886
20910
|
connector_id: this.connectorId,
|
|
@@ -21300,8 +21324,8 @@ class CertificateManagerFactory extends factory.AbstractResourceFactory {
|
|
|
21300
21324
|
}
|
|
21301
21325
|
}
|
|
21302
21326
|
|
|
21303
|
-
const DEFAULT_UNCONFIGURED_MESSAGE =
|
|
21304
|
-
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE =
|
|
21327
|
+
const DEFAULT_UNCONFIGURED_MESSAGE = 'Trust store is not configured. Set FAME_CA_CERTS to a PEM value, a file path, a data URI, or an HTTPS bundle URL.';
|
|
21328
|
+
const TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = 'TrustStoreProviderFactory';
|
|
21305
21329
|
class TrustStoreProviderFactory extends factory.AbstractResourceFactory {
|
|
21306
21330
|
createUnconfiguredProvider(reason) {
|
|
21307
21331
|
return new NoopTrustStoreProvider(reason ?? DEFAULT_UNCONFIGURED_MESSAGE);
|
|
@@ -25029,7 +25053,8 @@ class DefaultSecurityManager {
|
|
|
25029
25053
|
const hasSignature = Boolean(envelope.sec?.sig);
|
|
25030
25054
|
if (!hasSignature) {
|
|
25031
25055
|
const nodeSid = node.sid;
|
|
25032
|
-
const envelopeSid = envelope
|
|
25056
|
+
const envelopeSid = envelope
|
|
25057
|
+
.sid;
|
|
25033
25058
|
const isLocalUnsignedSelfEnvelope = localContext.originType === core.DeliveryOriginType.LOCAL &&
|
|
25034
25059
|
typeof nodeSid === 'string' &&
|
|
25035
25060
|
nodeSid.length > 0 &&
|
|
@@ -28309,14 +28334,16 @@ function normalizeInPageConnectionGrant(candidate) {
|
|
|
28309
28334
|
type,
|
|
28310
28335
|
purpose,
|
|
28311
28336
|
};
|
|
28312
|
-
const channelValue = candidate.channelName ??
|
|
28337
|
+
const channelValue = candidate.channelName ??
|
|
28338
|
+
candidate['channel_name'];
|
|
28313
28339
|
if (channelValue !== undefined) {
|
|
28314
28340
|
if (typeof channelValue !== 'string' || channelValue.trim().length === 0) {
|
|
28315
28341
|
throw new TypeError('InPageConnectionGrant "channelName" must be a non-empty string when provided');
|
|
28316
28342
|
}
|
|
28317
28343
|
result.channelName = channelValue.trim();
|
|
28318
28344
|
}
|
|
28319
|
-
const inboxValue = candidate.inboxCapacity ??
|
|
28345
|
+
const inboxValue = candidate.inboxCapacity ??
|
|
28346
|
+
candidate['inbox_capacity'];
|
|
28320
28347
|
if (inboxValue !== undefined) {
|
|
28321
28348
|
if (typeof inboxValue !== 'number' ||
|
|
28322
28349
|
!Number.isFinite(inboxValue) ||
|
|
@@ -28832,6 +28859,44 @@ function normalizeRouterOptions(options) {
|
|
|
28832
28859
|
return { welcomeService, prefix };
|
|
28833
28860
|
}
|
|
28834
28861
|
|
|
28862
|
+
/**
|
|
28863
|
+
* Fabric Registry
|
|
28864
|
+
*
|
|
28865
|
+
* Provides a mapping from nodes to their associated fabrics.
|
|
28866
|
+
* This allows agents to retrieve the fabric they were registered on
|
|
28867
|
+
* without relying on the global fabric stack.
|
|
28868
|
+
*/
|
|
28869
|
+
/**
|
|
28870
|
+
* WeakMap to store the node-to-fabric mapping.
|
|
28871
|
+
* Using WeakMap ensures that nodes can be garbage collected
|
|
28872
|
+
* when no longer referenced elsewhere.
|
|
28873
|
+
*/
|
|
28874
|
+
const nodeToFabric = new WeakMap();
|
|
28875
|
+
/**
|
|
28876
|
+
* @internal
|
|
28877
|
+
* Associates a node with its fabric. This should only be called
|
|
28878
|
+
* by fabric implementations when they create or adopt a node.
|
|
28879
|
+
*
|
|
28880
|
+
* @param node - The node to associate
|
|
28881
|
+
* @param fabric - The fabric that owns the node
|
|
28882
|
+
*/
|
|
28883
|
+
function _setFabricForNode(node, fabric) {
|
|
28884
|
+
nodeToFabric.set(node, fabric);
|
|
28885
|
+
}
|
|
28886
|
+
/**
|
|
28887
|
+
* Retrieves the fabric associated with a node.
|
|
28888
|
+
*
|
|
28889
|
+
* This is useful for agents that need to access the fabric they
|
|
28890
|
+
* were registered on, particularly in environments where multiple
|
|
28891
|
+
* fabrics exist (e.g., React with multiple FabricProviders).
|
|
28892
|
+
*
|
|
28893
|
+
* @param node - The node to look up
|
|
28894
|
+
* @returns The fabric associated with the node, or undefined if not found
|
|
28895
|
+
*/
|
|
28896
|
+
function getFabricForNode(node) {
|
|
28897
|
+
return nodeToFabric.get(node);
|
|
28898
|
+
}
|
|
28899
|
+
|
|
28835
28900
|
/**
|
|
28836
28901
|
* Browser-friendly entry point for Naylence Runtime.
|
|
28837
28902
|
*
|
|
@@ -28944,7 +29009,8 @@ class InPageConnectorFactory extends ConnectorFactory {
|
|
|
28944
29009
|
const normalized = this._normalizeConfig(config);
|
|
28945
29010
|
const options = (factoryArgs[0] ?? {});
|
|
28946
29011
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
28947
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29012
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29013
|
+
normalizedLocalNodeFromConfig;
|
|
28948
29014
|
if (!localNodeId) {
|
|
28949
29015
|
throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
|
|
28950
29016
|
}
|
|
@@ -29120,10 +29186,12 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29120
29186
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
29121
29187
|
};
|
|
29122
29188
|
const channelCandidate = record.channelName ?? record['channel_name'];
|
|
29123
|
-
if (typeof channelCandidate === 'string' &&
|
|
29189
|
+
if (typeof channelCandidate === 'string' &&
|
|
29190
|
+
channelCandidate.trim().length > 0) {
|
|
29124
29191
|
config.channelName = channelCandidate.trim();
|
|
29125
29192
|
}
|
|
29126
|
-
const inboxCandidate = record.inboxCapacity ??
|
|
29193
|
+
const inboxCandidate = record.inboxCapacity ??
|
|
29194
|
+
record['inbox_capacity'];
|
|
29127
29195
|
if (typeof inboxCandidate === 'number' &&
|
|
29128
29196
|
Number.isFinite(inboxCandidate) &&
|
|
29129
29197
|
inboxCandidate > 0) {
|
|
@@ -29147,9 +29215,11 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29147
29215
|
throw new Error('BroadcastChannelConnectorFactory requires a configuration');
|
|
29148
29216
|
}
|
|
29149
29217
|
const normalized = this._normalizeConfig(config);
|
|
29150
|
-
const options = (factoryArgs[0] ??
|
|
29218
|
+
const options = (factoryArgs[0] ??
|
|
29219
|
+
{});
|
|
29151
29220
|
const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
|
|
29152
|
-
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29221
|
+
const localNodeId = this._normalizeNodeId(options.localNodeId) ??
|
|
29222
|
+
normalizedLocalNodeFromConfig;
|
|
29153
29223
|
if (!localNodeId) {
|
|
29154
29224
|
throw new Error('BroadcastChannelConnectorFactory requires a localNodeId from config or create() options');
|
|
29155
29225
|
}
|
|
@@ -29174,6 +29244,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29174
29244
|
inboxCapacity,
|
|
29175
29245
|
localNodeId,
|
|
29176
29246
|
initialTargetNodeId: resolvedTarget,
|
|
29247
|
+
passive: normalized.passive,
|
|
29177
29248
|
};
|
|
29178
29249
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
29179
29250
|
if (options.authorization) {
|
|
@@ -29212,6 +29283,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
29212
29283
|
if (normalizedLocalNodeId) {
|
|
29213
29284
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
29214
29285
|
}
|
|
29286
|
+
if (typeof candidate.passive === 'boolean') {
|
|
29287
|
+
normalized.passive = candidate.passive;
|
|
29288
|
+
}
|
|
29215
29289
|
if (typeof candidate.flowControl === 'boolean') {
|
|
29216
29290
|
normalized.flowControl = candidate.flowControl;
|
|
29217
29291
|
}
|
|
@@ -29637,7 +29711,9 @@ class InPageListener extends TransportListener {
|
|
|
29637
29711
|
typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
|
|
29638
29712
|
? channelCandidate.trim()
|
|
29639
29713
|
: DEFAULT_CHANNEL$3;
|
|
29640
|
-
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
29714
|
+
const normalizedCapacity = typeof inboxCandidate === 'number' &&
|
|
29715
|
+
Number.isFinite(inboxCandidate) &&
|
|
29716
|
+
inboxCandidate > 0
|
|
29641
29717
|
? Math.floor(inboxCandidate)
|
|
29642
29718
|
: DEFAULT_INBOX_CAPACITY$3;
|
|
29643
29719
|
this._inboxCapacity = normalizedCapacity;
|
|
@@ -29912,7 +29988,8 @@ class InPageListener extends TransportListener {
|
|
|
29912
29988
|
if (grant.type === INPAGE_CONNECTION_GRANT_TYPE) {
|
|
29913
29989
|
return inPageGrantToConnectorConfig(grant);
|
|
29914
29990
|
}
|
|
29915
|
-
if (typeof grant
|
|
29991
|
+
if (typeof grant
|
|
29992
|
+
?.toConnectorConfig === 'function') {
|
|
29916
29993
|
return grant.toConnectorConfig();
|
|
29917
29994
|
}
|
|
29918
29995
|
throw new Error(`Unsupported grant type: ${grant.type}`);
|
|
@@ -30066,7 +30143,9 @@ function normalizeConfig$r(config) {
|
|
|
30066
30143
|
: DEFAULT_CHANNEL$2;
|
|
30067
30144
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30068
30145
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY$2;
|
|
30069
|
-
if (typeof rawInbox === 'number' &&
|
|
30146
|
+
if (typeof rawInbox === 'number' &&
|
|
30147
|
+
Number.isFinite(rawInbox) &&
|
|
30148
|
+
rawInbox > 0) {
|
|
30070
30149
|
inboxCapacity = Math.floor(rawInbox);
|
|
30071
30150
|
}
|
|
30072
30151
|
else if (typeof rawInbox === 'string') {
|
|
@@ -30094,9 +30173,7 @@ class InPageListenerFactory extends TransportListenerFactory {
|
|
|
30094
30173
|
}
|
|
30095
30174
|
async create(config, ...factoryArgs) {
|
|
30096
30175
|
const normalized = normalizeConfig$r(config);
|
|
30097
|
-
const [{ InPageListener }] = await Promise.all([
|
|
30098
|
-
getInPageListenerModule(),
|
|
30099
|
-
]);
|
|
30176
|
+
const [{ InPageListener }] = await Promise.all([getInPageListenerModule()]);
|
|
30100
30177
|
return new InPageListener({
|
|
30101
30178
|
channelName: normalized.channelName,
|
|
30102
30179
|
inboxCapacity: normalized.inboxCapacity,
|
|
@@ -30114,9 +30191,7 @@ var inpageListenerFactory = /*#__PURE__*/Object.freeze({
|
|
|
30114
30191
|
const logger$o = getLogger('naylence.fame.connector.broadcast_channel_listener');
|
|
30115
30192
|
const DEFAULT_CHANNEL$1 = 'naylence-fabric';
|
|
30116
30193
|
const DEFAULT_INBOX_CAPACITY$1 = 2048;
|
|
30117
|
-
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK |
|
|
30118
|
-
core.FameResponseType.REPLY |
|
|
30119
|
-
core.FameResponseType.STREAM;
|
|
30194
|
+
const RESPONSE_TYPE_MASK = core.FameResponseType.ACK | core.FameResponseType.REPLY | core.FameResponseType.STREAM;
|
|
30120
30195
|
const isBrowserEnvironment$1 = () => typeof window !== 'undefined' &&
|
|
30121
30196
|
typeof BroadcastChannel !== 'undefined' &&
|
|
30122
30197
|
typeof MessageEvent !== 'undefined';
|
|
@@ -30330,9 +30405,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30330
30405
|
return null;
|
|
30331
30406
|
}
|
|
30332
30407
|
})();
|
|
30333
|
-
if (error instanceof zod.ZodError &&
|
|
30334
|
-
decoded &&
|
|
30335
|
-
decoded.length > 0) {
|
|
30408
|
+
if (error instanceof zod.ZodError && decoded && decoded.length > 0) {
|
|
30336
30409
|
try {
|
|
30337
30410
|
const reparsed = JSON.parse(decoded);
|
|
30338
30411
|
const candidate = reparsed.rtype;
|
|
@@ -30555,11 +30628,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30555
30628
|
? Math.floor(initialWindowCandidate)
|
|
30556
30629
|
: undefined;
|
|
30557
30630
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
30631
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
30632
|
+
logger$o.debug('broadcast_channel_listener_building_connector_config', {
|
|
30633
|
+
system_id: systemId,
|
|
30634
|
+
channel_name: channelName,
|
|
30635
|
+
passive,
|
|
30636
|
+
has_base_config: !!baseConfig,
|
|
30637
|
+
passive_candidate: passiveCandidate,
|
|
30638
|
+
});
|
|
30558
30639
|
return {
|
|
30559
30640
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
30560
30641
|
channelName,
|
|
30561
30642
|
inboxCapacity,
|
|
30562
|
-
passive
|
|
30643
|
+
passive,
|
|
30563
30644
|
initialWindow,
|
|
30564
30645
|
localNodeId,
|
|
30565
30646
|
initialTargetNodeId,
|
|
@@ -30672,7 +30753,9 @@ function normalizeConfig$q(config) {
|
|
|
30672
30753
|
: DEFAULT_CHANNEL;
|
|
30673
30754
|
const rawInbox = record.inboxCapacity ?? record['inbox_capacity'];
|
|
30674
30755
|
let inboxCapacity = DEFAULT_INBOX_CAPACITY;
|
|
30675
|
-
if (typeof rawInbox === 'number' &&
|
|
30756
|
+
if (typeof rawInbox === 'number' &&
|
|
30757
|
+
Number.isFinite(rawInbox) &&
|
|
30758
|
+
rawInbox > 0) {
|
|
30676
30759
|
inboxCapacity = Math.floor(rawInbox);
|
|
30677
30760
|
}
|
|
30678
30761
|
else if (typeof rawInbox === 'string') {
|
|
@@ -32021,6 +32104,8 @@ class InProcessFameFabric extends core.FameFabric {
|
|
|
32021
32104
|
this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
|
|
32022
32105
|
this._ownsNode = true;
|
|
32023
32106
|
}
|
|
32107
|
+
// Register this fabric in the registry so agents can look it up
|
|
32108
|
+
_setFabricForNode(this._currentNode, this);
|
|
32024
32109
|
if (this._ownsNode && !this._nodeStarted) {
|
|
32025
32110
|
await this.getRequiredNode().start();
|
|
32026
32111
|
this._nodeStarted = true;
|
|
@@ -34162,19 +34247,23 @@ function normalizeConfig$a(config) {
|
|
|
34162
34247
|
normalized.clientSecretConfig = normalizeSecretSource(clientSecretSource);
|
|
34163
34248
|
}
|
|
34164
34249
|
const audienceCandidate = candidate.audience ?? candidate.aud;
|
|
34165
|
-
if (typeof audienceCandidate === 'string' &&
|
|
34250
|
+
if (typeof audienceCandidate === 'string' &&
|
|
34251
|
+
audienceCandidate.trim().length > 0) {
|
|
34166
34252
|
normalized.audience = audienceCandidate.trim();
|
|
34167
34253
|
}
|
|
34168
34254
|
const codeChallengeMethod = candidate.codeChallengeMethod ?? candidate.code_challenge_method;
|
|
34169
|
-
if (typeof codeChallengeMethod === 'string' &&
|
|
34255
|
+
if (typeof codeChallengeMethod === 'string' &&
|
|
34256
|
+
codeChallengeMethod.trim().length > 0) {
|
|
34170
34257
|
normalized.codeChallengeMethod = codeChallengeMethod.trim();
|
|
34171
34258
|
}
|
|
34172
34259
|
const codeVerifierLength = candidate.codeVerifierLength ?? candidate.code_verifier_length;
|
|
34173
|
-
if (typeof codeVerifierLength === 'number' &&
|
|
34260
|
+
if (typeof codeVerifierLength === 'number' &&
|
|
34261
|
+
Number.isFinite(codeVerifierLength)) {
|
|
34174
34262
|
normalized.codeVerifierLength = codeVerifierLength;
|
|
34175
34263
|
}
|
|
34176
34264
|
const clockSkewSeconds = candidate.clockSkewSeconds ?? candidate.clock_skew_seconds;
|
|
34177
|
-
if (typeof clockSkewSeconds === 'number' &&
|
|
34265
|
+
if (typeof clockSkewSeconds === 'number' &&
|
|
34266
|
+
Number.isFinite(clockSkewSeconds)) {
|
|
34178
34267
|
normalized.clockSkewSeconds = clockSkewSeconds;
|
|
34179
34268
|
}
|
|
34180
34269
|
const loginHintParam = candidate.loginHintParam ?? candidate.login_hint_param;
|
|
@@ -34219,8 +34308,8 @@ class OAuth2PkceTokenProviderFactory extends TokenProviderFactory {
|
|
|
34219
34308
|
options.audience = normalized.audience;
|
|
34220
34309
|
}
|
|
34221
34310
|
if (normalized.codeChallengeMethod) {
|
|
34222
|
-
options.codeChallengeMethod =
|
|
34223
|
-
.toUpperCase();
|
|
34311
|
+
options.codeChallengeMethod =
|
|
34312
|
+
normalized.codeChallengeMethod.toUpperCase();
|
|
34224
34313
|
}
|
|
34225
34314
|
if (normalized.codeVerifierLength) {
|
|
34226
34315
|
options.codeVerifierLength = normalized.codeVerifierLength;
|
|
@@ -35977,14 +36066,14 @@ var eddsaEnvelopeVerifierFactory = /*#__PURE__*/Object.freeze({
|
|
|
35977
36066
|
|
|
35978
36067
|
const FACTORY_META$d = {
|
|
35979
36068
|
base: TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE,
|
|
35980
|
-
key:
|
|
36069
|
+
key: 'NoopTrustStoreProvider',
|
|
35981
36070
|
isDefault: true,
|
|
35982
36071
|
priority: 10,
|
|
35983
36072
|
};
|
|
35984
36073
|
class NoopTrustStoreProviderFactory extends TrustStoreProviderFactory {
|
|
35985
36074
|
constructor() {
|
|
35986
36075
|
super(...arguments);
|
|
35987
|
-
this.type =
|
|
36076
|
+
this.type = 'NoopTrustStoreProvider';
|
|
35988
36077
|
this.isDefault = true;
|
|
35989
36078
|
this.priority = 10;
|
|
35990
36079
|
}
|
|
@@ -39378,8 +39467,7 @@ function normalizeOptions$2(raw) {
|
|
|
39378
39467
|
const scopes = normalizeScopes(camel.scopes) ??
|
|
39379
39468
|
normalizeScopes(snake.scopes ?? snake.scope) ??
|
|
39380
39469
|
DEFAULT_SCOPES.slice();
|
|
39381
|
-
const audience = coerceString(camel.audience) ??
|
|
39382
|
-
coerceString(snake.audience ?? snake.aud);
|
|
39470
|
+
const audience = coerceString(camel.audience) ?? coerceString(snake.audience ?? snake.aud);
|
|
39383
39471
|
const fetchImpl = (camel.fetchImpl ?? snake.fetch_impl);
|
|
39384
39472
|
const clockSkewSeconds = coerceNumber(camel.clockSkewSeconds) ??
|
|
39385
39473
|
coerceNumber(snake.clock_skew_seconds) ??
|
|
@@ -41095,6 +41183,7 @@ exports.formatTimestamp = formatTimestamp;
|
|
|
41095
41183
|
exports.formatTimestampForConsole = formatTimestampForConsole$1;
|
|
41096
41184
|
exports.frameDigest = frameDigest;
|
|
41097
41185
|
exports.getCurrentEnvelope = getCurrentEnvelope;
|
|
41186
|
+
exports.getFabricForNode = getFabricForNode;
|
|
41098
41187
|
exports.getFameRoot = getFameRoot;
|
|
41099
41188
|
exports.getKeyProvider = getKeyProvider;
|
|
41100
41189
|
exports.getKeyStore = getKeyStore;
|
|
@@ -41161,6 +41250,7 @@ exports.registerRuntimeFactories = registerRuntimeFactories;
|
|
|
41161
41250
|
exports.requireCryptoSupport = requireCryptoSupport;
|
|
41162
41251
|
exports.retryWithBackoff = retryWithBackoff;
|
|
41163
41252
|
exports.safeColor = safeColor;
|
|
41253
|
+
exports.safeImport = safeImport;
|
|
41164
41254
|
exports.sealedDecrypt = sealedDecrypt;
|
|
41165
41255
|
exports.sealedEncrypt = sealedEncrypt;
|
|
41166
41256
|
exports.secureDigest = secureDigest;
|