openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
31 lines (30 loc) • 1.14 kB
JavaScript
import { a as resolveGlobalSingleton } from "./global-singleton-D7yf05nR.mjs";
//#region src/plugins/runtime/gateway-context-binding-owner.ts
const { getGatewayContextBindingSlot, prepareGatewayContextBindingOwner } = resolveGlobalSingleton(Symbol.for("openclaw.gatewayContextBindingOwner"), () => {
const e = Symbol("gatewayContextBindingOwner");
class GatewayContextBindingOwner {
#e;
constructor(e) {
this.#e = e;
Object.setPrototypeOf(this, null);
}
static read(e, t) {
return typeof e === "object" && e !== null && #e in e && e.#e === t ? e : void 0;
}
}
function readSlot(t) {
const n = Object.getOwnPropertyDescriptor(t, e)?.value;
return GatewayContextBindingOwner.read(n, t);
}
/** Reserve exact-owner storage before admission freezes the public context. */
function prepareOwner(t) {
if (!readSlot(t)) Object.defineProperty(t, e, { value: new GatewayContextBindingOwner(t) });
return t;
}
return {
getGatewayContextBindingSlot: readSlot,
prepareGatewayContextBindingOwner: prepareOwner
};
});
//#endregion
export { prepareGatewayContextBindingOwner as n, getGatewayContextBindingSlot as t };