UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

21 lines (20 loc) • 649 B
//#region src/shared/current-read-authority.ts /** Begin private preparation in the same synchronous frame as the refreshed authority. */ async function withCurrentReadAuthority(e, t) { const read = () => { e?.assertCurrent?.(); return t(); }; return await (e?.withCurrent ? e.withCurrent(read) : read()); } /** Keep the first failure while joining every preparation already started by the caller. */ async function settleCurrentReadPreparations(e) { try { return await Promise.all(e); } catch (t) { await Promise.allSettled(e); throw t; } } //#endregion export { withCurrentReadAuthority as n, settleCurrentReadPreparations as t };