UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 754 B
import{i as e}from"./transcript-global-singleton-DIJgobpU.mjs";import{setTimeout as t}from"node:timers/promises";const n=e(Symbol.for(`openclaw.pluginSharedStateAdmission`),()=>({}));function getPluginSharedStateResourceHost(){return n.resolveHost?.()}function runPluginSharedStateWork(e){let t=getPluginSharedStateResourceHost();return t?t.trackSharedStateWork(e):e()}async function acquireWithWait(e){let n=e.now??performance.now.bind(performance),r=e.pollIntervalMs;for(;;)try{return await e.acquire()}catch(i){let a=e.shouldRetry(i);if(!a)throw i;let o=e.deadlineMs-n();if(o<=0)throw i;await(e.sleep??t)(Math.min(a===!0?r:a.delayMs,o)),r=Math.min(r*2,e.maxPollIntervalMs??e.pollIntervalMs)}}export{runPluginSharedStateWork as n,acquireWithWait as t};