@naylence/runtime 0.3.7 → 0.3.10

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.
@@ -31,6 +31,7 @@ function installProcessEnvShim() {
31
31
  Object.assign(out, g.__ENV__);
32
32
  try {
33
33
  // import.meta is only available in ESM builds
34
+ // prettier-ignore
34
35
  // @ts-ignore
35
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;
36
37
  if (ie && typeof ie === 'object')
@@ -99,12 +100,12 @@ installProcessEnvShim();
99
100
  // --- END ENV SHIM ---
100
101
 
101
102
  // This file is auto-generated during build - do not edit manually
102
- // Generated from package.json version: 0.3.7
103
+ // Generated from package.json version: 0.3.10
103
104
  /**
104
105
  * The package version, injected at build time.
105
106
  * @internal
106
107
  */
107
- const VERSION = '0.3.7';
108
+ const VERSION = '0.3.10';
108
109
 
109
110
  /**
110
111
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -4537,13 +4538,18 @@ class NodeEnvelopeFactory {
4537
4538
  this.sidFn = sidFn;
4538
4539
  }
4539
4540
  createEnvelope(options) {
4540
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4541
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4541
4542
  const optionsRecord = isPlainRecord$8(options)
4542
4543
  ? options
4543
4544
  : {};
4544
4545
  validateFrame(frame);
4545
4546
  const sidValue = this.sidFn();
4546
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4547
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4548
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
4549
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
4550
+ typeof sidInput === 'string') {
4551
+ sanitizedSid = sidInput.trim();
4552
+ }
4547
4553
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
4548
4554
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
4549
4555
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -28858,6 +28864,44 @@ function normalizeRouterOptions(options) {
28858
28864
  return { welcomeService, prefix };
28859
28865
  }
28860
28866
 
28867
+ /**
28868
+ * Fabric Registry
28869
+ *
28870
+ * Provides a mapping from nodes to their associated fabrics.
28871
+ * This allows agents to retrieve the fabric they were registered on
28872
+ * without relying on the global fabric stack.
28873
+ */
28874
+ /**
28875
+ * WeakMap to store the node-to-fabric mapping.
28876
+ * Using WeakMap ensures that nodes can be garbage collected
28877
+ * when no longer referenced elsewhere.
28878
+ */
28879
+ const nodeToFabric = new WeakMap();
28880
+ /**
28881
+ * @internal
28882
+ * Associates a node with its fabric. This should only be called
28883
+ * by fabric implementations when they create or adopt a node.
28884
+ *
28885
+ * @param node - The node to associate
28886
+ * @param fabric - The fabric that owns the node
28887
+ */
28888
+ function _setFabricForNode(node, fabric) {
28889
+ nodeToFabric.set(node, fabric);
28890
+ }
28891
+ /**
28892
+ * Retrieves the fabric associated with a node.
28893
+ *
28894
+ * This is useful for agents that need to access the fabric they
28895
+ * were registered on, particularly in environments where multiple
28896
+ * fabrics exist (e.g., React with multiple FabricProviders).
28897
+ *
28898
+ * @param node - The node to look up
28899
+ * @returns The fabric associated with the node, or undefined if not found
28900
+ */
28901
+ function getFabricForNode(node) {
28902
+ return nodeToFabric.get(node);
28903
+ }
28904
+
28861
28905
  /**
28862
28906
  * Browser-friendly entry point for Naylence Runtime.
28863
28907
  *
@@ -32065,6 +32109,8 @@ class InProcessFameFabric extends core.FameFabric {
32065
32109
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
32066
32110
  this._ownsNode = true;
32067
32111
  }
32112
+ // Register this fabric in the registry so agents can look it up
32113
+ _setFabricForNode(this._currentNode, this);
32068
32114
  if (this._ownsNode && !this._nodeStarted) {
32069
32115
  await this.getRequiredNode().start();
32070
32116
  this._nodeStarted = true;
@@ -41142,6 +41188,7 @@ exports.formatTimestamp = formatTimestamp;
41142
41188
  exports.formatTimestampForConsole = formatTimestampForConsole$1;
41143
41189
  exports.frameDigest = frameDigest;
41144
41190
  exports.getCurrentEnvelope = getCurrentEnvelope;
41191
+ exports.getFabricForNode = getFabricForNode;
41145
41192
  exports.getFameRoot = getFameRoot;
41146
41193
  exports.getKeyProvider = getKeyProvider;
41147
41194
  exports.getKeyStore = getKeyStore;
@@ -29,6 +29,7 @@ function installProcessEnvShim() {
29
29
  Object.assign(out, g.__ENV__);
30
30
  try {
31
31
  // import.meta is only available in ESM builds
32
+ // prettier-ignore
32
33
  // @ts-ignore
33
34
  const ie = (typeof import.meta !== 'undefined' && import.meta.env) || undefined;
34
35
  if (ie && typeof ie === 'object')
@@ -97,12 +98,12 @@ installProcessEnvShim();
97
98
  // --- END ENV SHIM ---
98
99
 
99
100
  // This file is auto-generated during build - do not edit manually
100
- // Generated from package.json version: 0.3.7
101
+ // Generated from package.json version: 0.3.10
101
102
  /**
102
103
  * The package version, injected at build time.
103
104
  * @internal
104
105
  */
105
- const VERSION = '0.3.7';
106
+ const VERSION = '0.3.10';
106
107
 
107
108
  /**
108
109
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -4535,13 +4536,18 @@ class NodeEnvelopeFactory {
4535
4536
  this.sidFn = sidFn;
4536
4537
  }
4537
4538
  createEnvelope(options) {
4538
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4539
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4539
4540
  const optionsRecord = isPlainRecord$8(options)
4540
4541
  ? options
4541
4542
  : {};
4542
4543
  validateFrame(frame);
4543
4544
  const sidValue = this.sidFn();
4544
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4545
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4546
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
4547
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
4548
+ typeof sidInput === 'string') {
4549
+ sanitizedSid = sidInput.trim();
4550
+ }
4545
4551
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
4546
4552
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
4547
4553
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -28856,6 +28862,44 @@ function normalizeRouterOptions(options) {
28856
28862
  return { welcomeService, prefix };
28857
28863
  }
28858
28864
 
28865
+ /**
28866
+ * Fabric Registry
28867
+ *
28868
+ * Provides a mapping from nodes to their associated fabrics.
28869
+ * This allows agents to retrieve the fabric they were registered on
28870
+ * without relying on the global fabric stack.
28871
+ */
28872
+ /**
28873
+ * WeakMap to store the node-to-fabric mapping.
28874
+ * Using WeakMap ensures that nodes can be garbage collected
28875
+ * when no longer referenced elsewhere.
28876
+ */
28877
+ const nodeToFabric = new WeakMap();
28878
+ /**
28879
+ * @internal
28880
+ * Associates a node with its fabric. This should only be called
28881
+ * by fabric implementations when they create or adopt a node.
28882
+ *
28883
+ * @param node - The node to associate
28884
+ * @param fabric - The fabric that owns the node
28885
+ */
28886
+ function _setFabricForNode(node, fabric) {
28887
+ nodeToFabric.set(node, fabric);
28888
+ }
28889
+ /**
28890
+ * Retrieves the fabric associated with a node.
28891
+ *
28892
+ * This is useful for agents that need to access the fabric they
28893
+ * were registered on, particularly in environments where multiple
28894
+ * fabrics exist (e.g., React with multiple FabricProviders).
28895
+ *
28896
+ * @param node - The node to look up
28897
+ * @returns The fabric associated with the node, or undefined if not found
28898
+ */
28899
+ function getFabricForNode(node) {
28900
+ return nodeToFabric.get(node);
28901
+ }
28902
+
28859
28903
  /**
28860
28904
  * Browser-friendly entry point for Naylence Runtime.
28861
28905
  *
@@ -32063,6 +32107,8 @@ class InProcessFameFabric extends FameFabric {
32063
32107
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
32064
32108
  this._ownsNode = true;
32065
32109
  }
32110
+ // Register this fabric in the registry so agents can look it up
32111
+ _setFabricForNode(this._currentNode, this);
32066
32112
  if (this._ownsNode && !this._nodeStarted) {
32067
32113
  await this.getRequiredNode().start();
32068
32114
  this._nodeStarted = true;
@@ -40916,4 +40962,4 @@ var websocketTransportProvisioner = /*#__PURE__*/Object.freeze({
40916
40962
  WebSocketTransportProvisionerFactory: WebSocketTransportProvisionerFactory
40917
40963
  });
40918
40964
 
40919
- export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, FACTORY_META$Z as BROADCAST_CHANNEL_CONNECTOR_FACTORY_META, BROADCAST_CHANNEL_CONNECTOR_TYPE, FACTORY_META$X as BROADCAST_CHANNEL_LISTENER_FACTORY_META, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BroadcastChannelConnector, BroadcastChannelConnectorFactory, BroadcastChannelListener, BroadcastChannelListenerFactory, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, FACTORY_META$_ as INPAGE_CONNECTOR_FACTORY_META, INPAGE_CONNECTOR_TYPE, FACTORY_META$Y as INPAGE_LISTENER_FACTORY_META, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageConnectorFactory, InPageListener, InPageListenerFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
40965
+ export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, FACTORY_META$Z as BROADCAST_CHANNEL_CONNECTOR_FACTORY_META, BROADCAST_CHANNEL_CONNECTOR_TYPE, FACTORY_META$X as BROADCAST_CHANNEL_LISTENER_FACTORY_META, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BroadcastChannelConnector, BroadcastChannelConnectorFactory, BroadcastChannelListener, BroadcastChannelListenerFactory, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, FACTORY_META$_ as INPAGE_CONNECTOR_FACTORY_META, INPAGE_CONNECTOR_TYPE, FACTORY_META$Y as INPAGE_LISTENER_FACTORY_META, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageConnectorFactory, InPageListener, InPageListenerFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
@@ -18,6 +18,7 @@ function installProcessEnvShim() {
18
18
  Object.assign(out, g.__ENV__);
19
19
  try {
20
20
  // import.meta is only available in ESM builds
21
+ // prettier-ignore
21
22
  // @ts-ignore
22
23
  const ie = (typeof import.meta !== 'undefined' && import.meta.env) || undefined;
23
24
  if (ie && typeof ie === 'object')
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Fabric Registry
4
+ *
5
+ * Provides a mapping from nodes to their associated fabrics.
6
+ * This allows agents to retrieve the fabric they were registered on
7
+ * without relying on the global fabric stack.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports._setFabricForNode = _setFabricForNode;
11
+ exports.getFabricForNode = getFabricForNode;
12
+ /**
13
+ * WeakMap to store the node-to-fabric mapping.
14
+ * Using WeakMap ensures that nodes can be garbage collected
15
+ * when no longer referenced elsewhere.
16
+ */
17
+ const nodeToFabric = new WeakMap();
18
+ /**
19
+ * @internal
20
+ * Associates a node with its fabric. This should only be called
21
+ * by fabric implementations when they create or adopt a node.
22
+ *
23
+ * @param node - The node to associate
24
+ * @param fabric - The fabric that owns the node
25
+ */
26
+ function _setFabricForNode(node, fabric) {
27
+ nodeToFabric.set(node, fabric);
28
+ }
29
+ /**
30
+ * Retrieves the fabric associated with a node.
31
+ *
32
+ * This is useful for agents that need to access the fabric they
33
+ * were registered on, particularly in environments where multiple
34
+ * fabrics exist (e.g., React with multiple FabricProviders).
35
+ *
36
+ * @param node - The node to look up
37
+ * @returns The fabric associated with the node, or undefined if not found
38
+ */
39
+ function getFabricForNode(node) {
40
+ return nodeToFabric.get(node);
41
+ }
@@ -8,6 +8,7 @@ const util_js_1 = require("../util/util.js");
8
8
  const runtime_version_js_1 = require("../util/runtime-version.js");
9
9
  const sink_service_js_1 = require("../service/sink-service.js");
10
10
  const extended_fame_config_base_js_1 = require("../config/extended-fame-config-base.js");
11
+ const fabric_registry_js_1 = require("./fabric-registry.js");
11
12
  const logger = (0, logging_js_1.getLogger)('naylence.fame.fabric.in_process');
12
13
  function normalizeNodeConfig(config) {
13
14
  if (config && typeof config === 'object' && !Array.isArray(config)) {
@@ -69,6 +70,8 @@ class InProcessFameFabric extends core_1.FameFabric {
69
70
  this._currentNode = await node_like_factory_js_1.NodeLikeFactory.createNode(nodeConfig);
70
71
  this._ownsNode = true;
71
72
  }
73
+ // Register this fabric in the registry so agents can look it up
74
+ (0, fabric_registry_js_1._setFabricForNode)(this._currentNode, this);
72
75
  if (this._ownsNode && !this._nodeStarted) {
73
76
  await this.getRequiredNode().start();
74
77
  this._nodeStarted = true;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FAME_FABRIC_FACTORY_BASE_TYPE = exports.InProcessFameFabricFactory = exports.InProcessFameFabric = void 0;
3
+ exports.getFabricForNode = exports.FAME_FABRIC_FACTORY_BASE_TYPE = exports.InProcessFameFabricFactory = exports.InProcessFameFabric = void 0;
4
4
  var in_process_fame_fabric_js_1 = require("./in-process-fame-fabric.js");
5
5
  Object.defineProperty(exports, "InProcessFameFabric", { enumerable: true, get: function () { return in_process_fame_fabric_js_1.InProcessFameFabric; } });
6
6
  var in_process_fame_fabric_factory_js_1 = require("./in-process-fame-fabric-factory.js");
7
7
  Object.defineProperty(exports, "InProcessFameFabricFactory", { enumerable: true, get: function () { return in_process_fame_fabric_factory_js_1.InProcessFameFabricFactory; } });
8
8
  Object.defineProperty(exports, "FAME_FABRIC_FACTORY_BASE_TYPE", { enumerable: true, get: function () { return in_process_fame_fabric_factory_js_1.FAME_FABRIC_FACTORY_BASE_TYPE; } });
9
+ var fabric_registry_js_1 = require("./fabric-registry.js");
10
+ Object.defineProperty(exports, "getFabricForNode", { enumerable: true, get: function () { return fabric_registry_js_1.getFabricForNode; } });
@@ -8,13 +8,18 @@ class NodeEnvelopeFactory {
8
8
  this.sidFn = sidFn;
9
9
  }
10
10
  createEnvelope(options) {
11
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
11
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
12
12
  const optionsRecord = isPlainRecord(options)
13
13
  ? options
14
14
  : {};
15
15
  validateFrame(frame);
16
16
  const sidValue = this.sidFn();
17
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
17
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
18
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
19
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
20
+ typeof sidInput === 'string') {
21
+ sanitizedSid = sidInput.trim();
22
+ }
18
23
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
19
24
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
20
25
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -8,7 +8,7 @@
8
8
  * expect access to the Node.js standard library.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.__runtimePluginLoader = exports.ensureRuntimeFactoriesRegistered = exports.registerRuntimeFactories = exports.registerDefaultFactories = exports.isRegisterable = exports.operation = exports.RpcMixin = exports.createRpcProxy = exports.RpcProxy = exports.INPAGE_CONNECTOR_TYPE = exports.InPageConnector = exports._NoopFlowController = exports.WebSocketState = exports.WebSocketConnector = exports.createResource = exports.ConnectorFactory = exports.createConnectorConfig = exports.isConnectorConfig = exports.ConnectorConfigDefaults = exports.BaseAsyncConnector = exports.VERSION = void 0;
11
+ exports.__runtimePluginLoader = exports.getFabricForNode = exports.ensureRuntimeFactoriesRegistered = exports.registerRuntimeFactories = exports.registerDefaultFactories = exports.isRegisterable = exports.operation = exports.RpcMixin = exports.createRpcProxy = exports.RpcProxy = exports.INPAGE_CONNECTOR_TYPE = exports.InPageConnector = exports._NoopFlowController = exports.WebSocketState = exports.WebSocketConnector = exports.createResource = exports.ConnectorFactory = exports.createConnectorConfig = exports.isConnectorConfig = exports.ConnectorConfigDefaults = exports.BaseAsyncConnector = exports.VERSION = void 0;
12
12
  const tslib_1 = require("tslib");
13
13
  // Re-export everything from naylence-core for protocol primitives
14
14
  tslib_1.__exportStar(require("@naylence/core"), exports);
@@ -69,6 +69,9 @@ tslib_1.__exportStar(require("./naylence/fame/placement/node-placement-strategy-
69
69
  tslib_1.__exportStar(require("./naylence/fame/transport/transport-provisioner.js"), exports);
70
70
  // Welcome service (isomorphic)
71
71
  tslib_1.__exportStar(require("./naylence/fame/welcome/index.js"), exports);
72
+ // Fabric registry (for looking up fabric from node)
73
+ var fabric_registry_js_1 = require("./naylence/fame/fabric/fabric-registry.js");
74
+ Object.defineProperty(exports, "getFabricForNode", { enumerable: true, get: function () { return fabric_registry_js_1.getFabricForNode; } });
72
75
  const runtimePluginModulePromise = Promise.resolve().then(() => tslib_1.__importStar(require('./plugin.js')));
73
76
  const globalScope = globalThis;
74
77
  const FACTORY_MODULE_PREFIX = '@naylence/runtime/naylence/fame/';
@@ -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.7
3
+ // Generated from package.json version: 0.3.10
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.7';
10
+ exports.VERSION = '0.3.10';
@@ -15,6 +15,7 @@ export function installProcessEnvShim() {
15
15
  Object.assign(out, g.__ENV__);
16
16
  try {
17
17
  // import.meta is only available in ESM builds
18
+ // prettier-ignore
18
19
  // @ts-ignore
19
20
  const ie = (typeof import.meta !== 'undefined' && import.meta.env) || undefined;
20
21
  if (ie && typeof ie === 'object')
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Fabric Registry
3
+ *
4
+ * Provides a mapping from nodes to their associated fabrics.
5
+ * This allows agents to retrieve the fabric they were registered on
6
+ * without relying on the global fabric stack.
7
+ */
8
+ /**
9
+ * WeakMap to store the node-to-fabric mapping.
10
+ * Using WeakMap ensures that nodes can be garbage collected
11
+ * when no longer referenced elsewhere.
12
+ */
13
+ const nodeToFabric = new WeakMap();
14
+ /**
15
+ * @internal
16
+ * Associates a node with its fabric. This should only be called
17
+ * by fabric implementations when they create or adopt a node.
18
+ *
19
+ * @param node - The node to associate
20
+ * @param fabric - The fabric that owns the node
21
+ */
22
+ export function _setFabricForNode(node, fabric) {
23
+ nodeToFabric.set(node, fabric);
24
+ }
25
+ /**
26
+ * Retrieves the fabric associated with a node.
27
+ *
28
+ * This is useful for agents that need to access the fabric they
29
+ * were registered on, particularly in environments where multiple
30
+ * fabrics exist (e.g., React with multiple FabricProviders).
31
+ *
32
+ * @param node - The node to look up
33
+ * @returns The fabric associated with the node, or undefined if not found
34
+ */
35
+ export function getFabricForNode(node) {
36
+ return nodeToFabric.get(node);
37
+ }
@@ -5,6 +5,7 @@ import { decodeFameDataPayload, withLegacySnakeCaseKeys, } from '../util/util.js
5
5
  import { resolveRuntimeVersion } from '../util/runtime-version.js';
6
6
  import { isSinkService } from '../service/sink-service.js';
7
7
  import { normalizeExtendedFameConfig, } from '../config/extended-fame-config-base.js';
8
+ import { _setFabricForNode } from './fabric-registry.js';
8
9
  const logger = getLogger('naylence.fame.fabric.in_process');
9
10
  function normalizeNodeConfig(config) {
10
11
  if (config && typeof config === 'object' && !Array.isArray(config)) {
@@ -66,6 +67,8 @@ export class InProcessFameFabric extends FameFabric {
66
67
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
67
68
  this._ownsNode = true;
68
69
  }
70
+ // Register this fabric in the registry so agents can look it up
71
+ _setFabricForNode(this._currentNode, this);
69
72
  if (this._ownsNode && !this._nodeStarted) {
70
73
  await this.getRequiredNode().start();
71
74
  this._nodeStarted = true;
@@ -1,2 +1,3 @@
1
1
  export { InProcessFameFabric } from './in-process-fame-fabric.js';
2
2
  export { InProcessFameFabricFactory, FAME_FABRIC_FACTORY_BASE_TYPE, } from './in-process-fame-fabric-factory.js';
3
+ export { getFabricForNode } from './fabric-registry.js';
@@ -5,13 +5,18 @@ export class NodeEnvelopeFactory {
5
5
  this.sidFn = sidFn;
6
6
  }
7
7
  createEnvelope(options) {
8
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
8
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
9
9
  const optionsRecord = isPlainRecord(options)
10
10
  ? options
11
11
  : {};
12
12
  validateFrame(frame);
13
13
  const sidValue = this.sidFn();
14
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
14
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
15
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
16
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
17
+ typeof sidInput === 'string') {
18
+ sanitizedSid = sidInput.trim();
19
+ }
15
20
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
16
21
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
17
22
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -45,6 +45,8 @@ export * from './naylence/fame/placement/node-placement-strategy-factory.js';
45
45
  export * from './naylence/fame/transport/transport-provisioner.js';
46
46
  // Welcome service (isomorphic)
47
47
  export * from './naylence/fame/welcome/index.js';
48
+ // Fabric registry (for looking up fabric from node)
49
+ export { getFabricForNode } from './naylence/fame/fabric/fabric-registry.js';
48
50
  const runtimePluginModulePromise = import('./plugin.js');
49
51
  const globalScope = globalThis;
50
52
  const FACTORY_MODULE_PREFIX = '@naylence/runtime/naylence/fame/';
@@ -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.7
2
+ // Generated from package.json version: 0.3.10
3
3
  /**
4
4
  * The package version, injected at build time.
5
5
  * @internal
6
6
  */
7
- export const VERSION = '0.3.7';
7
+ export const VERSION = '0.3.10';
@@ -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.7
17
+ // Generated from package.json version: 0.3.10
18
18
  /**
19
19
  * The package version, injected at build time.
20
20
  * @internal
21
21
  */
22
- const VERSION = '0.3.7';
22
+ const VERSION = '0.3.10';
23
23
 
24
24
  /**
25
25
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -4452,13 +4452,18 @@ class NodeEnvelopeFactory {
4452
4452
  this.sidFn = sidFn;
4453
4453
  }
4454
4454
  createEnvelope(options) {
4455
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4455
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4456
4456
  const optionsRecord = isPlainRecord$8(options)
4457
4457
  ? options
4458
4458
  : {};
4459
4459
  validateFrame(frame);
4460
4460
  const sidValue = this.sidFn();
4461
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4461
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4462
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
4463
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
4464
+ typeof sidInput === 'string') {
4465
+ sanitizedSid = sidInput.trim();
4466
+ }
4462
4467
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
4463
4468
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
4464
4469
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -28773,6 +28778,44 @@ function normalizeRouterOptions(options) {
28773
28778
  return { welcomeService, prefix };
28774
28779
  }
28775
28780
 
28781
+ /**
28782
+ * Fabric Registry
28783
+ *
28784
+ * Provides a mapping from nodes to their associated fabrics.
28785
+ * This allows agents to retrieve the fabric they were registered on
28786
+ * without relying on the global fabric stack.
28787
+ */
28788
+ /**
28789
+ * WeakMap to store the node-to-fabric mapping.
28790
+ * Using WeakMap ensures that nodes can be garbage collected
28791
+ * when no longer referenced elsewhere.
28792
+ */
28793
+ const nodeToFabric = new WeakMap();
28794
+ /**
28795
+ * @internal
28796
+ * Associates a node with its fabric. This should only be called
28797
+ * by fabric implementations when they create or adopt a node.
28798
+ *
28799
+ * @param node - The node to associate
28800
+ * @param fabric - The fabric that owns the node
28801
+ */
28802
+ function _setFabricForNode(node, fabric) {
28803
+ nodeToFabric.set(node, fabric);
28804
+ }
28805
+ /**
28806
+ * Retrieves the fabric associated with a node.
28807
+ *
28808
+ * This is useful for agents that need to access the fabric they
28809
+ * were registered on, particularly in environments where multiple
28810
+ * fabrics exist (e.g., React with multiple FabricProviders).
28811
+ *
28812
+ * @param node - The node to look up
28813
+ * @returns The fabric associated with the node, or undefined if not found
28814
+ */
28815
+ function getFabricForNode(node) {
28816
+ return nodeToFabric.get(node);
28817
+ }
28818
+
28776
28819
  /**
28777
28820
  * Browser-friendly entry point for Naylence Runtime.
28778
28821
  *
@@ -30653,6 +30696,8 @@ class InProcessFameFabric extends core.FameFabric {
30653
30696
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
30654
30697
  this._ownsNode = true;
30655
30698
  }
30699
+ // Register this fabric in the registry so agents can look it up
30700
+ _setFabricForNode(this._currentNode, this);
30656
30701
  if (this._ownsNode && !this._nodeStarted) {
30657
30702
  await this.getRequiredNode().start();
30658
30703
  this._nodeStarted = true;
@@ -41043,6 +41088,7 @@ exports.formatTimestamp = formatTimestamp;
41043
41088
  exports.formatTimestampForConsole = formatTimestampForConsole$1;
41044
41089
  exports.frameDigest = frameDigest;
41045
41090
  exports.getCurrentEnvelope = getCurrentEnvelope;
41091
+ exports.getFabricForNode = getFabricForNode;
41046
41092
  exports.getFameRoot = getFameRoot;
41047
41093
  exports.getKeyProvider = getKeyProvider;
41048
41094
  exports.getKeyStore = getKeyStore;
@@ -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.7
16
+ // Generated from package.json version: 0.3.10
17
17
  /**
18
18
  * The package version, injected at build time.
19
19
  * @internal
20
20
  */
21
- const VERSION = '0.3.7';
21
+ const VERSION = '0.3.10';
22
22
 
23
23
  /**
24
24
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -4451,13 +4451,18 @@ class NodeEnvelopeFactory {
4451
4451
  this.sidFn = sidFn;
4452
4452
  }
4453
4453
  createEnvelope(options) {
4454
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4454
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
4455
4455
  const optionsRecord = isPlainRecord$8(options)
4456
4456
  ? options
4457
4457
  : {};
4458
4458
  validateFrame(frame);
4459
4459
  const sidValue = this.sidFn();
4460
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4460
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
4461
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
4462
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
4463
+ typeof sidInput === 'string') {
4464
+ sanitizedSid = sidInput.trim();
4465
+ }
4461
4466
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
4462
4467
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
4463
4468
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -28772,6 +28777,44 @@ function normalizeRouterOptions(options) {
28772
28777
  return { welcomeService, prefix };
28773
28778
  }
28774
28779
 
28780
+ /**
28781
+ * Fabric Registry
28782
+ *
28783
+ * Provides a mapping from nodes to their associated fabrics.
28784
+ * This allows agents to retrieve the fabric they were registered on
28785
+ * without relying on the global fabric stack.
28786
+ */
28787
+ /**
28788
+ * WeakMap to store the node-to-fabric mapping.
28789
+ * Using WeakMap ensures that nodes can be garbage collected
28790
+ * when no longer referenced elsewhere.
28791
+ */
28792
+ const nodeToFabric = new WeakMap();
28793
+ /**
28794
+ * @internal
28795
+ * Associates a node with its fabric. This should only be called
28796
+ * by fabric implementations when they create or adopt a node.
28797
+ *
28798
+ * @param node - The node to associate
28799
+ * @param fabric - The fabric that owns the node
28800
+ */
28801
+ function _setFabricForNode(node, fabric) {
28802
+ nodeToFabric.set(node, fabric);
28803
+ }
28804
+ /**
28805
+ * Retrieves the fabric associated with a node.
28806
+ *
28807
+ * This is useful for agents that need to access the fabric they
28808
+ * were registered on, particularly in environments where multiple
28809
+ * fabrics exist (e.g., React with multiple FabricProviders).
28810
+ *
28811
+ * @param node - The node to look up
28812
+ * @returns The fabric associated with the node, or undefined if not found
28813
+ */
28814
+ function getFabricForNode(node) {
28815
+ return nodeToFabric.get(node);
28816
+ }
28817
+
28775
28818
  /**
28776
28819
  * Browser-friendly entry point for Naylence Runtime.
28777
28820
  *
@@ -30652,6 +30695,8 @@ class InProcessFameFabric extends FameFabric {
30652
30695
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
30653
30696
  this._ownsNode = true;
30654
30697
  }
30698
+ // Register this fabric in the registry so agents can look it up
30699
+ _setFabricForNode(this._currentNode, this);
30655
30700
  if (this._ownsNode && !this._nodeStarted) {
30656
30701
  await this.getRequiredNode().start();
30657
30702
  this._nodeStarted = true;
@@ -40830,4 +40875,4 @@ var websocketTransportProvisioner = /*#__PURE__*/Object.freeze({
40830
40875
  WebSocketTransportProvisionerFactory: WebSocketTransportProvisionerFactory
40831
40876
  });
40832
40877
 
40833
- export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
40878
+ export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$$ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$1 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$10 as FACTORY_META, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createLogicalUri, createNodeDeliveryContext, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getKeyProvider, getKeyStore, getLogger, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
@@ -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.7
5566
+ // Generated from package.json version: 0.3.10
5567
5567
  /**
5568
5568
  * The package version, injected at build time.
5569
5569
  * @internal
5570
5570
  */
5571
- const VERSION = '0.3.7';
5571
+ const VERSION = '0.3.10';
5572
5572
 
5573
5573
  /**
5574
5574
  * Fame errors module - Fame protocol specific error classes
@@ -7088,13 +7088,18 @@ class NodeEnvelopeFactory {
7088
7088
  this.sidFn = sidFn;
7089
7089
  }
7090
7090
  createEnvelope(options) {
7091
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
7091
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
7092
7092
  const optionsRecord = isPlainRecord$8(options)
7093
7093
  ? options
7094
7094
  : {};
7095
7095
  validateFrame(frame);
7096
7096
  const sidValue = this.sidFn();
7097
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
7097
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
7098
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
7099
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
7100
+ typeof sidInput === 'string') {
7101
+ sanitizedSid = sidInput.trim();
7102
+ }
7098
7103
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
7099
7104
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
7100
7105
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -29898,6 +29903,44 @@ function normalizeRouterOptions(options) {
29898
29903
  return { welcomeService, prefix };
29899
29904
  }
29900
29905
 
29906
+ /**
29907
+ * Fabric Registry
29908
+ *
29909
+ * Provides a mapping from nodes to their associated fabrics.
29910
+ * This allows agents to retrieve the fabric they were registered on
29911
+ * without relying on the global fabric stack.
29912
+ */
29913
+ /**
29914
+ * WeakMap to store the node-to-fabric mapping.
29915
+ * Using WeakMap ensures that nodes can be garbage collected
29916
+ * when no longer referenced elsewhere.
29917
+ */
29918
+ const nodeToFabric = new WeakMap();
29919
+ /**
29920
+ * @internal
29921
+ * Associates a node with its fabric. This should only be called
29922
+ * by fabric implementations when they create or adopt a node.
29923
+ *
29924
+ * @param node - The node to associate
29925
+ * @param fabric - The fabric that owns the node
29926
+ */
29927
+ function _setFabricForNode(node, fabric) {
29928
+ nodeToFabric.set(node, fabric);
29929
+ }
29930
+ /**
29931
+ * Retrieves the fabric associated with a node.
29932
+ *
29933
+ * This is useful for agents that need to access the fabric they
29934
+ * were registered on, particularly in environments where multiple
29935
+ * fabrics exist (e.g., React with multiple FabricProviders).
29936
+ *
29937
+ * @param node - The node to look up
29938
+ * @returns The fabric associated with the node, or undefined if not found
29939
+ */
29940
+ function getFabricForNode(node) {
29941
+ return nodeToFabric.get(node);
29942
+ }
29943
+
29901
29944
  /**
29902
29945
  * Browser-friendly entry point for Naylence Runtime.
29903
29946
  *
@@ -33532,6 +33575,8 @@ class InProcessFameFabric extends core.FameFabric {
33532
33575
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
33533
33576
  this._ownsNode = true;
33534
33577
  }
33578
+ // Register this fabric in the registry so agents can look it up
33579
+ _setFabricForNode(this._currentNode, this);
33535
33580
  if (this._ownsNode && !this._nodeStarted) {
33536
33581
  await this.getRequiredNode().start();
33537
33582
  this._nodeStarted = true;
@@ -43279,6 +43324,7 @@ exports.formatTimestamp = formatTimestamp;
43279
43324
  exports.formatTimestampForConsole = formatTimestampForConsole$1;
43280
43325
  exports.frameDigest = frameDigest;
43281
43326
  exports.getCurrentEnvelope = getCurrentEnvelope;
43327
+ exports.getFabricForNode = getFabricForNode;
43282
43328
  exports.getFameRoot = getFameRoot;
43283
43329
  exports.getHttpListenerInstance = getHttpListenerInstance;
43284
43330
  exports.getInPageListenerInstance = getInPageListenerInstance;
@@ -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.7
5565
+ // Generated from package.json version: 0.3.10
5566
5566
  /**
5567
5567
  * The package version, injected at build time.
5568
5568
  * @internal
5569
5569
  */
5570
- const VERSION = '0.3.7';
5570
+ const VERSION = '0.3.10';
5571
5571
 
5572
5572
  /**
5573
5573
  * Fame errors module - Fame protocol specific error classes
@@ -7087,13 +7087,18 @@ class NodeEnvelopeFactory {
7087
7087
  this.sidFn = sidFn;
7088
7088
  }
7089
7089
  createEnvelope(options) {
7090
- const { frame, id, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
7090
+ const { frame, id, sid, traceId, to, capabilities, replyTo, flowId, windowId, flags, timestamp, corrId, responseType, } = options;
7091
7091
  const optionsRecord = isPlainRecord$8(options)
7092
7092
  ? options
7093
7093
  : {};
7094
7094
  validateFrame(frame);
7095
7095
  const sidValue = this.sidFn();
7096
- const sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
7096
+ let sanitizedSid = typeof sidValue === 'string' ? sidValue.trim() : sidValue;
7097
+ const sidInput = pickAlias(sid ?? null, optionsRecord, 'sid', 'source_id');
7098
+ if ((!sanitizedSid || sanitizedSid.length === 0) &&
7099
+ typeof sidInput === 'string') {
7100
+ sanitizedSid = sidInput.trim();
7101
+ }
7097
7102
  const idInput = pickAlias(id ?? null, optionsRecord, 'envelope_id');
7098
7103
  const traceIdInput = pickAlias(traceId ?? null, optionsRecord, 'trace_id');
7099
7104
  const toInput = pickAlias(to ?? null, optionsRecord, 'to', 'recipient', 'target', 'address');
@@ -29897,6 +29902,44 @@ function normalizeRouterOptions(options) {
29897
29902
  return { welcomeService, prefix };
29898
29903
  }
29899
29904
 
29905
+ /**
29906
+ * Fabric Registry
29907
+ *
29908
+ * Provides a mapping from nodes to their associated fabrics.
29909
+ * This allows agents to retrieve the fabric they were registered on
29910
+ * without relying on the global fabric stack.
29911
+ */
29912
+ /**
29913
+ * WeakMap to store the node-to-fabric mapping.
29914
+ * Using WeakMap ensures that nodes can be garbage collected
29915
+ * when no longer referenced elsewhere.
29916
+ */
29917
+ const nodeToFabric = new WeakMap();
29918
+ /**
29919
+ * @internal
29920
+ * Associates a node with its fabric. This should only be called
29921
+ * by fabric implementations when they create or adopt a node.
29922
+ *
29923
+ * @param node - The node to associate
29924
+ * @param fabric - The fabric that owns the node
29925
+ */
29926
+ function _setFabricForNode(node, fabric) {
29927
+ nodeToFabric.set(node, fabric);
29928
+ }
29929
+ /**
29930
+ * Retrieves the fabric associated with a node.
29931
+ *
29932
+ * This is useful for agents that need to access the fabric they
29933
+ * were registered on, particularly in environments where multiple
29934
+ * fabrics exist (e.g., React with multiple FabricProviders).
29935
+ *
29936
+ * @param node - The node to look up
29937
+ * @returns The fabric associated with the node, or undefined if not found
29938
+ */
29939
+ function getFabricForNode(node) {
29940
+ return nodeToFabric.get(node);
29941
+ }
29942
+
29900
29943
  /**
29901
29944
  * Browser-friendly entry point for Naylence Runtime.
29902
29945
  *
@@ -33531,6 +33574,8 @@ class InProcessFameFabric extends FameFabric {
33531
33574
  this._currentNode = await NodeLikeFactory.createNode(nodeConfig);
33532
33575
  this._ownsNode = true;
33533
33576
  }
33577
+ // Register this fabric in the registry so agents can look it up
33578
+ _setFabricForNode(this._currentNode, this);
33534
33579
  if (this._ownsNode && !this._nodeStarted) {
33535
33580
  await this.getRequiredNode().start();
33536
33581
  this._nodeStarted = true;
@@ -43048,4 +43093,4 @@ var websocketTransportProvisioner = /*#__PURE__*/Object.freeze({
43048
43093
  WebSocketTransportProvisionerFactory: WebSocketTransportProvisionerFactory
43049
43094
  });
43050
43095
 
43051
- export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultHttpServer, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM$2 as ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$2 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FAME_FABRIC_FACTORY_BASE_TYPE, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, HttpListener, HttpStatelessConnector, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageListener, InProcessFameFabric, InProcessFameFabricFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, QueueFullError, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, SQLiteKeyValueStore, SQLiteStorageProvider, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_LISTENER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportListener, TransportListenerFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketListener, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createJwksRouter, createLogicalUri, createNodeDeliveryContext, createApp as createOAuth2ServerApp, createOAuth2TokenRouter, createOpenIDConfigurationRouter, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFameRoot, getHttpListenerInstance, getInPageListenerInstance, getKeyProvider, getKeyStore, getLogger, getWebsocketListenerInstance, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeExtendedFameConfig, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, main as runOAuth2Server, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
43096
+ export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultHttpServer, DefaultKeyManager, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM$2 as ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$2 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FAME_FABRIC_FACTORY_BASE_TYPE, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, HttpListener, HttpStatelessConnector, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageListener, InProcessFameFabric, InProcessFameFabricFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, QueueFullError, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, SQLiteKeyValueStore, SQLiteStorageProvider, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_LISTENER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenVerifierFactory, TransportListener, TransportListenerFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketListener, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createJwksRouter, createLogicalUri, createNodeDeliveryContext, createApp as createOAuth2ServerApp, createOAuth2TokenRouter, createOpenIDConfigurationRouter, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getHttpListenerInstance, getInPageListenerInstance, getKeyProvider, getKeyStore, getLogger, getWebsocketListenerInstance, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeExtendedFameConfig, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, main as runOAuth2Server, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Fabric Registry
3
+ *
4
+ * Provides a mapping from nodes to their associated fabrics.
5
+ * This allows agents to retrieve the fabric they were registered on
6
+ * without relying on the global fabric stack.
7
+ */
8
+ import type { FameFabric } from '@naylence/core';
9
+ import type { NodeLike } from '../node/node-like.js';
10
+ /**
11
+ * @internal
12
+ * Associates a node with its fabric. This should only be called
13
+ * by fabric implementations when they create or adopt a node.
14
+ *
15
+ * @param node - The node to associate
16
+ * @param fabric - The fabric that owns the node
17
+ */
18
+ export declare function _setFabricForNode(node: NodeLike, fabric: FameFabric): void;
19
+ /**
20
+ * Retrieves the fabric associated with a node.
21
+ *
22
+ * This is useful for agents that need to access the fabric they
23
+ * were registered on, particularly in environments where multiple
24
+ * fabrics exist (e.g., React with multiple FabricProviders).
25
+ *
26
+ * @param node - The node to look up
27
+ * @returns The fabric associated with the node, or undefined if not found
28
+ */
29
+ export declare function getFabricForNode(node: NodeLike): FameFabric | undefined;
@@ -1,2 +1,3 @@
1
1
  export { InProcessFameFabric } from './in-process-fame-fabric.js';
2
2
  export { InProcessFameFabricFactory, FAME_FABRIC_FACTORY_BASE_TYPE, } from './in-process-fame-fabric-factory.js';
3
+ export { getFabricForNode } from './fabric-registry.js';
@@ -6,6 +6,7 @@ export declare class NodeEnvelopeFactory implements EnvelopeFactory {
6
6
  createEnvelope(options: {
7
7
  frame: AllFramesUnion;
8
8
  id?: string;
9
+ sid?: string | null;
9
10
  traceId?: string;
10
11
  to?: FameEnvelope['to'] | string | null;
11
12
  capabilities?: string[] | null;
@@ -33,5 +33,6 @@ export * from './naylence/fame/placement/node-placement-strategy.js';
33
33
  export * from './naylence/fame/placement/node-placement-strategy-factory.js';
34
34
  export * from './naylence/fame/transport/transport-provisioner.js';
35
35
  export * from './naylence/fame/welcome/index.js';
36
+ export { getFabricForNode } from './naylence/fame/fabric/fabric-registry.js';
36
37
  type PluginModuleLoader = (specifier: string) => Promise<Record<string, unknown>>;
37
38
  export declare const __runtimePluginLoader: PluginModuleLoader;
@@ -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.7";
5
+ export declare const VERSION = "0.3.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.7",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",