openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
25 lines (24 loc) • 1.24 kB
JavaScript
import { o as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-BvvDhs5D.mjs";
import { n as dispatchGatewayMethodInProcessRaw } from "./server-plugin-in-process-dispatch-B-bx4bU2.mjs";
import "./server-plugins-Bxu9wLOt.mjs";
//#region src/plugin-sdk/gateway-method-runtime.ts
/**
* Dispatch a Gateway control-plane method from an authenticated plugin request scope.
*/
async function dispatchGatewayMethod(e, t, n) {
const r = getPluginRuntimeGatewayRequestScope();
if (r?.gatewayMethodDispatchAllowed !== true) {
const e = r?.pluginId ? ` for plugin "${r.pluginId}"` : "";
throw new Error(`Gateway method dispatch is reserved for authenticated plugin HTTP routes or RPC handlers that declare contracts.gatewayMethodDispatch: ["authenticated-request"]${e}.`);
}
return await dispatchGatewayMethodInProcessRaw(e, t, {
disableSyntheticClient: true,
requireScopedClient: true,
...r.signal ? { signal: r.signal } : {},
...r.hasCurrentClientAuthority ? { hasCurrentClientAuthority: r.hasCurrentClientAuthority } : {},
...n?.expectFinal !== void 0 ? { expectFinal: n.expectFinal } : {},
...n?.timeoutMs !== void 0 ? { timeoutMs: n.timeoutMs } : {}
});
}
//#endregion
export { dispatchGatewayMethod as t };