openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 890 B
JavaScript
import{l as respondApprovalStorageUnavailable}from"./approval-shared-D5K52j8A.mjs";import{t as captureWorkerTurnLiveEventOwner}from"./worker-turn-run-owner-BULxK-W4.mjs";
//!src/gateway/server-methods/approval-registration.ts
function captureApprovalWorkerOwner(e){const t=e?.delegatedAuthority;return t?.kind===`worker`?captureWorkerTurnLiveEventOwner({sessionId:t.turnClaim.sessionId,turnClaim:t.turnClaim}):void 0}async function registerPendingApprovalRecord(e){try{const t=await e.manager.register(e.record,e.timeoutMs);if(e.workerOwner&&e.manager.isPending(e.record)){const n=e.workerOwner.beginApprovalWait(e.record.expiresAtMs,()=>e.manager.isPending(e.record));if(n)t.decision.then(()=>n.close(),()=>n.close())}return t}catch(t){respondApprovalStorageUnavailable({...e,operation:`request`,error:t});return}}export{registerPendingApprovalRecord as n,captureApprovalWorkerOwner as t};