UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.81 kB
import"./plugin-preparation-cli-invocation-CQPKFT_h.mjs";import{n as e}from"./plugin-preparation-runtime-process-bootstrap.generated-BKfT41K0.mjs";import{t}from"./plugin-preparation-runtime-binary-Dgxk5ZBN.mjs";import n from"node:path";import{fileURLToPath as r,pathToFileURL as i}from"node:url";import{readRootJsonObjectSync as a}from"@openclaw/fs-safe/json";function resolveRuntimeWorkerUrl(t){if(t.root!==void 0)return i(n.join(t.root,`dist`,t.distWorkerPath));let o=r(t.currentModuleUrl),s=e(o);if(s!==void 0){let e=t.distWorkerPath;if(t.package){let r=n.resolve(s,`..`),i=a({rootDir:r,relativePath:`package.json`,boundaryLabel:`runtime worker package`,rejectHardlinks:!1});if(!i.ok)throw Error(`Cannot resolve runtime worker package: ${r}/package.json`);i.value.name===t.package.name&&(e=t.package.distWorkerPath)}return i(n.join(s,e))}let c=t.sourceExtension??(n.extname(o)||`.js`);return new URL(`./${t.sourceWorkerName}${c}`,t.currentModuleUrl)}function isBunTargetRuntime(e){return e===process.execPath?!!process.versions.bun:t(e)}function resolveRuntimeArgs(e=process.execPath){return isBunTargetRuntime(e)?[`--no-install`]:[]}function runtimeNeedsTypeScriptLoader(e,t=process.execPath){return/\.[cm]?ts$/.test(e)&&!isBunTargetRuntime(t)}function resolveRuntimeWorkerArgv(e,t=process.execPath){let n=r(e);return runtimeNeedsTypeScriptLoader(n,t)?[`--import`,import.meta.resolve(`tsx`),n]:[...resolveRuntimeArgs(t),n]}function resolveRuntimeWorkerThreadExecArgv(e,t=process.execPath){return typeof SEALED_RUNTIME_BUILD==`boolean`&&SEALED_RUNTIME_BUILD?[]:e.protocol===`file:`&&runtimeNeedsTypeScriptLoader(r(e),t)?[`--import`,import.meta.resolve(`tsx/esm`)]:[]}export{runtimeNeedsTypeScriptLoader as i,resolveRuntimeWorkerThreadExecArgv as n,resolveRuntimeWorkerUrl as r,resolveRuntimeWorkerArgv as t};