openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
24 lines (23 loc) • 720 B
JavaScript
import { g as resolveAdmittedRunActiveAssertion } from "./admitted-run-context-D3Jvk_f_.mjs";
//#region src/audit/execution-owner-binding.ts
/** Adds one exact owner write after admission resolves, never inside the admission callback. */
function withPostAdmissionExecutionOwnerBinding(e, t) {
let n;
return Object.freeze({
...e,
admit: async (r, i) => {
const a = await e.admit(r, i);
const o = resolveAdmittedRunActiveAssertion(a);
if (!o) throw new Error("prepared execution authority closed during owner binding");
n ??= Promise.resolve().then(() => {
o();
return t(a);
});
await n;
o();
return a;
}
});
}
//#endregion
export { withPostAdmissionExecutionOwnerBinding as t };