UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 582 B
import{i as e}from"./transcript-global-singleton-DIJgobpU.mjs";import{AsyncLocalStorage as t}from"node:async_hooks";const n=e(Symbol.for(`openclaw.asyncContext`),()=>new t);var AsyncContext=class{constructor(e){this.key=e}getStore(){return n.getStore()?.[this.key]}run(e,t){let r=n.getStore(),i=r?.[this.key];if(Object.is(i,e))return t();let a={...r,[this.key]:e};n.enterWith(a);try{return t()}finally{let e=n.getStore();n.enterWith(e===a?r:{...e,[this.key]:i})}}exit(e){return this.run(void 0,e)}enterWith(e){n.enterWith({...n.getStore(),[this.key]:e})}};export{AsyncContext as t};