UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

19 lines (18 loc) 1.35 kB
import { i as resolveGlobalSingleton } from "./global-singleton-Dc_stLtU.js"; import { o as withPluginMetadataSnapshotScope } from "./current-plugin-metadata-snapshot-CmSX4G3W.js"; import { t as createEmptyPluginRegistry } from "./registry-empty-55wlVNzO.js"; import { f as withPluginRuntimeRegistryScope } from "./gateway-request-scope-BCMYlsDI.js"; import { AsyncLocalStorage } from "node:async_hooks"; //#region src/plugins/runtime/generation-scope.ts const pluginRuntimeGenerationRegistryScope = resolveGlobalSingleton(Symbol.for("openclaw.pluginRuntimeGenerationRegistryScope"), () => new AsyncLocalStorage()); /** Carries one prepared plugin generation through all nested runtime lookups. */ function withPluginRuntimeGenerationScope(generation, run) { const pluginRegistry = generation.pluginRegistry ?? createEmptyPluginRegistry(); return withPluginMetadataSnapshotScope(generation.metadataSnapshot, () => pluginRuntimeGenerationRegistryScope.run(pluginRegistry, () => withPluginRuntimeRegistryScope(pluginRegistry, run)), { trustConfigIdentity: true }); } /** Exact registry owned by the prepared generation, when one is active. */ function getPluginRuntimeGenerationRegistry() { return pluginRuntimeGenerationRegistryScope.getStore(); } //#endregion export { withPluginRuntimeGenerationScope as n, getPluginRuntimeGenerationRegistry as t };