UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.72 kB
import{a as e,t}from"./git-operation.worker-fs-safe-2XqdJR5K.mjs";import{n}from"./git-operation.worker-staged-inputs-DZiTgX91.mjs";import"./git-operation.worker-workspace-hash-memo-CMIph4rA.mjs";import"./git-operation.worker-workspace-manifest-DsRMcvMP.mjs";import{o as r,r as i}from"./git-operation.worker-workspace-manifest-comparison-E7MDmqwp.mjs";import"./git-operation.worker-workspace-reconcile-derived-paths-CuPCc3j9.mjs";import{i as a,removeEmptyWorkspaceDirectory as o}from"./git-operation.worker-workspace-reconcile-fs-2rlVLgX2.mjs";import s from"node:fs/promises";async function assertWorkspaceMatchesManifest(e){let t=await s.realpath(e.root),n=e.entries??[...i(e.manifest).values()],o=await a(t,n.map(e=>e.path));for(let e of n)if(!r(o.get(e.path),e))throw Error(`Gateway workspace changed after cloud dispatch: ${e.path}`)}async function applyWorkspaceDirectoryChanges(n){let r=await e(n.root,{mode:448,assertBeforeMutation:n.assertCurrent});for(let e of n.directories.retained)await r.mkdir(e);for(let e of n.directories.removed){let n;try{n=await r.stat(e)}catch(e){if(e instanceof t&&[`not-found`,`path-alias`].includes(e.code))continue;throw e}n.isDirectory&&await o(r,e)}}async function assertWorkspaceInputOwnership({root:t,stagedInputDirectories:r,candidates:i}){let a=await e(t),o=n(a),s=/* @__PURE__ */ new Set;for(let e of r)await a.exists(e)&&!await o(e)&&s.add(e);for(let{path:e,directory:t,changesMarker:n,isNew:r}of i)if(s.has(t)&&(n||r&&await a.exists(e)))throw Error(`Cloud input conflicts with an unowned Gateway directory: ${t}. Keep the project directory unchanged and reattach the input.`)}export{applyWorkspaceDirectoryChanges,assertWorkspaceInputOwnership,assertWorkspaceMatchesManifest};