UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

23 lines (22 loc) 1.15 kB
import { a as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-BCMYlsDI.js"; import { n as dispatchGatewayMethodInProcessRaw } from "./server-plugin-in-process-dispatch-DYlW9gzA.js"; import "./server-plugins-BMUM-t60.js"; //#region src/plugin-sdk/gateway-method-runtime.ts /** * Dispatch a Gateway control-plane method from an authenticated plugin request scope. */ async function dispatchGatewayMethod(method, params, options) { const scope = getPluginRuntimeGatewayRequestScope(); if (scope?.gatewayMethodDispatchAllowed !== true) { const pluginLabel = scope?.pluginId ? ` for plugin "${scope.pluginId}"` : ""; throw new Error(`Gateway method dispatch is reserved for plugin HTTP routes that declare contracts.gatewayMethodDispatch: ["authenticated-request"]${pluginLabel}.`); } return await dispatchGatewayMethodInProcessRaw(method, params, { disableSyntheticClient: true, requireScopedClient: true, ...options?.expectFinal !== void 0 ? { expectFinal: options.expectFinal } : {}, ...options?.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {} }); } //#endregion export { dispatchGatewayMethod as t };