UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.36 kB
import{a as e}from"./fs-safe-copy.worker-home-dir-CeEbrKea.mjs";import"./fs-safe-copy.worker-utils-C58aD3xL.mjs";import t from"node:fs";import n from"node:path";import"node:crypto";function canonicalizeWorkspacePath(r,i){let a=n.resolve(e(r)),o=i(a),s=/* @__PURE__ */ new Set;for(let e=0;e<40;e+=1){let e=[],r=a;for(;;){try{return i(n.join(t.realpathSync.native(r),...e.toReversed()))}catch{}try{if(t.lstatSync(r).isSymbolicLink()){let i=n.normalize(r);if(s.has(i))return o;s.add(i),a=n.resolve(n.dirname(r),t.readlinkSync(r),...e.toReversed());break}}catch{}let c=n.dirname(r);if(c===r)return o;e.push(n.basename(r)),r=c}}return o}function resolveCanonicalWorkspacePath(e){return canonicalizeWorkspacePath(e,n.normalize)}var WorkspaceAliasRepointedError=class extends Error{constructor(e){super(`workspace path alias points to a different current target: ${e.aliasPath} now resolves to ${e.currentWorkspacePath}, but its stored workspace state belongs to ${e.storedWorkspacePath}. Run \`openclaw doctor --fix\` and confirm the move, or use \`openclaw doctor --fix --force\`.`),this.code=`WORKSPACE_ALIAS_REPOINTED`,this.name=`WorkspaceAliasRepointedError`,this.aliasPath=e.aliasPath,this.storedWorkspacePath=e.storedWorkspacePath,this.currentWorkspacePath=e.currentWorkspacePath}};export{resolveCanonicalWorkspacePath as n,WorkspaceAliasRepointedError as t};