openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
18 lines (17 loc) • 761 B
JavaScript
import { u as getActivePluginRegistry } from "./runtime-BL4wZfTq.js";
import { a as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-BCMYlsDI.js";
//#region src/channels/plugins/registry-loader.ts
/**
* Creates a lazy loader that resolves one value from the authoritative channel registry.
*/
function createChannelRegistryLoader(resolveValue) {
return async (id) => {
const resolveFromRegistry = (registry) => {
const pluginEntry = registry?.channels.find((entry) => entry.plugin.id === id);
return pluginEntry ? resolveValue(pluginEntry) : void 0;
};
return resolveFromRegistry(getPluginRuntimeGatewayRequestScope()?.pluginRegistry ?? getActivePluginRegistry());
};
}
//#endregion
export { createChannelRegistryLoader as t };