UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.5 kB
import{a as runtimeProcessExternalPackageEntrypoints,o as runtimeProcessGatewayEntrypointNames}from"./runtime-process-manifest-CUxW6j_V.mjs";import"./utils-Dlk0IYAa.mjs";import{l as pathExists}from"./fs-safe-Bxzu1j4h.mjs";import{i as resolveExternalPackageRuntimeEntrypointUrl}from"./runtime-process-url-DJ272Tuo.mjs";import{fileURLToPath}from"node:url";import path from"node:path"; //!src/daemon/gateway-entrypoint.ts const GATEWAY_DIST_ENTRYPOINT_BASENAMES=runtimeProcessGatewayEntrypointNames.map(e=>path.basename(runtimeProcessExternalPackageEntrypoints[e]));function isGatewayDistEntrypointPath(e){return/[/\\]dist[/\\].+\.(cjs|js|mjs)$/.test(e)}function buildGatewayInstallEntrypointCandidates(e){if(!e)return[];return runtimeProcessGatewayEntrypointNames.map(t=>fileURLToPath(resolveExternalPackageRuntimeEntrypointUrl(t,e)))}function buildGatewayDistEntrypointCandidates(...e){const t=new Set(e.filter(isGatewayDistEntrypointPath).map(path.dirname));return GATEWAY_DIST_ENTRYPOINT_BASENAMES.flatMap(e=>Array.from(t,t=>path.join(t,e)))}async function findFirstAccessibleGatewayEntrypoint(e,t=pathExists){for(const n of e)if(await t(n))return n}async function resolveGatewayInstallEntrypoint(e){return findFirstAccessibleGatewayEntrypoint(buildGatewayInstallEntrypointCandidates(e))}export{resolveGatewayInstallEntrypoint as a,isGatewayDistEntrypointPath as i,buildGatewayInstallEntrypointCandidates as n,findFirstAccessibleGatewayEntrypoint as r,buildGatewayDistEntrypointCandidates as t};