UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.24 kB
import{i as resolveGlobalMap}from"./global-singleton-DolL9xGt.mjs";import{o as resolveRuntimeProcessEntrypointUrl}from"./runtime-process-url-DJ272Tuo.mjs";import{n as captureRuntimeWorkerSource}from"./runtime-worker-generation-0fwjR0Cv.mjs";import{t as WorkerTaskPool}from"./worker-task-pool-Bg54sSAN.mjs"; //!src/infra/exec-realpath-worker.ts async function resolveExecRealpathInWorker(e,t){const n=await resolveRealpathInWorker({path:e,mode:t});if(n===void 0)throw new Error(`Exec path could not be resolved under the filesystem policy`);return n}function resolveOrdinaryRealpathInWorker(e,t){return resolveRealpathInWorker({path:e,mode:t,ordinary:true})}async function resolveRealpathInWorker(e){const t=captureRuntimeWorkerSource(resolveRuntimeProcessEntrypointUrl(`execRealpath`));const n=resolveGlobalMap(Symbol.for(`openclaw.execRealpathPools`),async e=>{await Promise.all([...e.values()].map(e=>e.close()));e.clear()});const r=t.moduleUrl.href;let i=n.get(r);if(!i||i.isClosed){i=new WorkerTaskPool({workerUrl:t.moduleUrl,workerClass:`singleton`});n.set(r,i);const e=i;t.runtimeGeneration?.retain(i,async()=>{await e.close();n.delete(r)})}return i.run(e,{})}export{resolveOrdinaryRealpathInWorker as n,resolveExecRealpathInWorker as t};