openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
15 lines (14 loc) • 802 B
JavaScript
import { a as resolveGlobalSingleton } from "./global-singleton-D7yf05nR.mjs";
import { AsyncLocalStorage } from "node:async_hooks";
//#region src/infra/approval-gateway-runtime-context.ts
const approvalGatewayRuntimeScope = resolveGlobalSingleton(Symbol.for("openclaw.approvalGatewayRuntimeScope"), () => new AsyncLocalStorage());
/** Runs one channel account task with its owning Gateway approval principal. */
function withGatewayNativeApprovalRuntime(e, t) {
return e ? approvalGatewayRuntimeScope.run(e, t) : t();
}
/** Returns the Gateway approval principal for the current channel account task. */
function getGatewayNativeApprovalRuntime() {
return approvalGatewayRuntimeScope.getStore();
}
//#endregion
export { withGatewayNativeApprovalRuntime as n, getGatewayNativeApprovalRuntime as t };