UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.07 kB
import{r as e}from"./openclaw-state-read-semver-CqfGj9gv.mjs";import{R as t}from"./openclaw-state-read-read-open-flags-CtNL1rJs.mjs";import{n}from"./openclaw-state-read-fs-safe-CpAHBauR.mjs";import{j as r}from"./openclaw-state-read-workspace-path-exclusions-Cjo9Lmns.mjs";import"./openclaw-state-read-workspace-manifest-B5vKGqPY.mjs";import{d as i,o as a}from"./openclaw-state-read-workspace-reconcile-fs-D0L5ne7X.mjs";import{o,r as s}from"./openclaw-state-read-workspace-manifest-comparison-BsGOV5Ve.mjs";import"./openclaw-state-read-workspace-reconcile-derived-paths-vX7802kb.mjs";import c from"node:fs/promises";var l=/* @__PURE__ */ e({MAX_RECONCILIATION_FILE_BYTES:()=>MAX_RECONCILIATION_FILE_BYTES,MAX_RECONCILIATION_TOTAL_BYTES:()=>MAX_RECONCILIATION_TOTAL_BYTES,applyWorkspaceDirectoryChanges:()=>applyWorkspaceDirectoryChanges,assertWorkspaceInputOwnership:()=>assertWorkspaceInputOwnership,assertWorkspaceMatchesManifest:()=>assertWorkspaceMatchesManifest});async function assertWorkspaceMatchesManifest(e){let t=await c.realpath(e.root),n=e.entries??[...s(e.manifest).values()],r=await i(t,n.map(e=>e.path));for(let e of n)if(!o(r.get(e.path),e))throw Error(`Gateway workspace changed after cloud dispatch: ${e.path}`)}async function applyWorkspaceDirectoryChanges(e){let r=await n(e.root,{mode:448,assertBeforeMutation:e.assertCurrent});for(let t of e.directories.retained)await r.mkdir(t);for(let n of e.directories.removed){let e;try{e=await r.stat(n)}catch(e){if(e instanceof t&&[`not-found`,`path-alias`].includes(e.code))continue;throw e}e.isDirectory&&await a(r,n)}}async function assertWorkspaceInputOwnership({root:e,stagedInputDirectories:t,candidates:i}){let a=await n(e),o=r(a),s=/* @__PURE__ */ new Set;for(let e of t)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{l as n,assertWorkspaceMatchesManifest as t};