openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 962 B
JavaScript
import{Bt as e,Ht as t,Kt as n,Wt as r,cn as i}from"./sqlite-readonly-runtime-process-manifest-CLhsN5hb.mjs";import a from"node:path";import o from"node:fs";import"node:fs/promises";function assertAbsolutePathInput(t){if(!t)throw new i(`invalid-path`,`path is required`);if(t.includes(`\0`))throw new i(`invalid-path`,`path must not contain NUL bytes`);if(e(t),!a.isAbsolute(t))throw new i(`invalid-path`,`path must be absolute`);let n=a.normalize(t);return e(n),n}async function findExistingAncestor(n){e(n);let i=r(n);for(e(i);;){try{return o.lstatSync(t(i)),i}catch(e){if(e.code!==`ENOENT`)throw e}let e=a.dirname(i);if(e===i)return null;i=e}}async function canonicalPathFromExistingAncestor(i){e(i);let o=await findExistingAncestor(i);if(!o){let t=r(i);return e(t),t}let s=o,c;try{c=n.native(t(o))}catch{}c!==void 0&&(e(c),s=c);let l=a.relative(o,i),u=l?a.join(s,l):s;return e(u),u}export{canonicalPathFromExistingAncestor as n,assertAbsolutePathInput as t};