UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.56 kB
import"./transcript-number-coercion-D2B2TTt-.mjs";import{l as e,o as t,s as n,t as r}from"./transcript-state-dir-DEo0wD2Q.mjs";import i from"node:path";import a from"node:fs";import o from"node:os";function resolveIsNixMode(e=process.env){return e.OPENCLAW_NIX_MODE===`1`}resolveIsNixMode();function envHomedir(e){return()=>n(e,o.homedir)}function normalizePathForComparison(e){let t=i.resolve(e);try{return a.realpathSync.native(t)}catch{return t}}function resolveIncludeRoots(e=process.env,r=envHomedir(e)){let a=e.OPENCLAW_INCLUDE_ROOTS?.trim();if(!a)return[];let effectiveHomedir=()=>n(e,r),o=/* @__PURE__ */ new Set,s=[];for(let n of a.split(i.delimiter)){let r=n.trim();if(!r)continue;let a=i.resolve(t(r,{env:e,homedir:effectiveHomedir}));o.has(a)||(o.add(a),s.push(a))}return s}r();function resolveConfigPathCandidate(e=process.env,t=envHomedir(e)){return resolveConfigPath(e,void 0,t)}function resolveConfigPath(t=process.env,n,a=envHomedir(t)){let o=t.OPENCLAW_CONFIG_PATH?.trim();return o?e(o,t,a):i.join(n??r(t,a),`openclaw.json`)}resolveConfigPathCandidate();function resolveGatewayLockDir(e=r(),t=typeof process.getuid==`function`?process.getuid():void 0){return resolveGatewayLockDirForCanonicalStateDir(normalizePathForComparison(e),t)}function resolveGatewayLockDirForCanonicalStateDir(e,t=typeof process.getuid==`function`?process.getuid():void 0){let n=t==null?`openclaw`:`openclaw-${t}`;return i.join(e,`tmp`,n)}export{resolveIncludeRoots as i,resolveGatewayLockDir as n,resolveGatewayLockDirForCanonicalStateDir as r,resolveConfigPath as t};