UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.95 kB
import{i as e,r as t}from"./git-operation.worker-path-existence-Bpkbkop2.mjs";import{r as n}from"./git-operation.worker-path-guards-B73RPnzx.mjs";import{a as r}from"./git-operation.worker-home-dir-DUQkhCrS.mjs";import"./git-operation.worker-redact-CGAANVVf.mjs";import i from"node:fs";import a from"node:path";import"node:crypto";var SandboxStateOwnerRequiredError=class extends Error{constructor(e){super(`Sandbox workspace preparation cannot run alongside a foreign live owner of the selected state root, or when that ownership cannot be verified. Run this SDK call inside the owning Gateway plugin/runtime, or stop the Gateway through its service owner and wait for any embedded run to finish, then retry offline. Inspect openclaw gateway status; this call does not acquire ownership or route remotely.`,{cause:e}),this.code=`GATEWAY_STATE_OWNER_REQUIRED`,this.name=`SandboxStateOwnerRequiredError`}};function assertCanonicalPath(e,t){let r=process.platform===`win32`?n:String;if(r(t)!==r(e.canonicalPath))throw new SandboxStateOwnerRequiredError(/* @__PURE__ */ Error(`Sandbox state path changed while preparing an operation`))}function assertSandboxStateOwnerPathCurrent(t){assertCanonicalPath(t,e(t.path))}async function prepareSandboxStateOwnerPath(e){assertCanonicalPath(e,await t(e.path))}function canonicalizeWorkspacePath(e,t){let n=a.resolve(r(e)),o=t(n),s=/* @__PURE__ */ new Set;for(let e=0;e<40;e+=1){let e=[],r=n;for(;;){try{return t(a.join(i.realpathSync.native(r),...e.toReversed()))}catch{}try{if(i.lstatSync(r).isSymbolicLink()){let t=a.normalize(r);if(s.has(t))return o;s.add(t),n=a.resolve(a.dirname(r),i.readlinkSync(r),...e.toReversed());break}}catch{}let c=a.dirname(r);if(c===r)return o;e.push(a.basename(r)),r=c}}return o}async function canonicalizeWorkspacePathAsync(e,t){let n=a.resolve(r(e)),o=t(n),s=/* @__PURE__ */ new Set;for(let e=0;e<40;e+=1){let e=[],r=n;for(;;){try{return t(a.join(await i.promises.realpath(r),...e.toReversed()))}catch{}try{if((await i.promises.lstat(r)).isSymbolicLink()){let t=a.normalize(r);if(s.has(t))return o;s.add(t),n=a.resolve(a.dirname(r),await i.promises.readlink(r),...e.toReversed());break}}catch{}let c=a.dirname(r);if(c===r)return o;e.push(a.basename(r)),r=c}}return o}function resolveCanonicalWorkspacePath(e){return canonicalizeWorkspacePath(e,a.normalize)}async function resolveCanonicalWorkspacePathAsync(e){return canonicalizeWorkspacePathAsync(e,a.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}},WorktreeRepositoryError=class extends Error{constructor(e,t){super(e,t),this.name=`WorktreeRepositoryError`,this.reason=t?.reason}},WorktreeRemovalContentionError=class extends Error{constructor(e,t,n){super(t),this.kind=e,this.blockedByRun=n,this.name=`WorktreeRemovalContentionError`}},WorktreeRemovalLockError=class extends Error{constructor(e,t){super(t),this.kind=e,this.name=`WorktreeRemovalLockError`}},SessionWorktreeSourceChangedError=class extends Error{},SessionWorktreeLifecycleError=class extends Error{constructor(e,t){super(e),this.reason=t}};export{WorktreeRepositoryError as a,resolveCanonicalWorkspacePathAsync as c,prepareSandboxStateOwnerPath as d,WorktreeRemovalLockError as i,SandboxStateOwnerRequiredError as l,SessionWorktreeSourceChangedError as n,WorkspaceAliasRepointedError as o,WorktreeRemovalContentionError as r,resolveCanonicalWorkspacePath as s,SessionWorktreeLifecycleError as t,assertSandboxStateOwnerPathCurrent as u};