UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.41 kB
import{t as e}from"./fs-safe-copy.worker-errno-CsW5NI8i.mjs";import"./fs-safe-copy.worker-utils-C58aD3xL.mjs";import{n as t,t as n}from"./fs-safe-copy.worker-workspace-state-identity-D0mApcp7.mjs";import r from"node:fs";import"node:path";import{isDeepStrictEqual as i}from"node:util";function rootFact(e){return e&&{dev:e.dev,ino:e.ino,mode:e.mode,isDirectory:e.isDirectory()}}function ignoreMissing(t){if(!e(t,`ENOENT`)&&!e(t,`ENOTDIR`))throw t}function captureObservation(e,n){let i=t(e),a=[rootFact(r.lstatSync(e,{bigint:!0,throwIfNoEntry:!1})),rootFact(r.statSync(e,{bigint:!0,throwIfNoEntry:!1}))],o=[];if(n)try{o=r.readdirSync(e).toSorted()}catch(e){ignoreMissing(e)}return{workspaceDir:e,canonical:i,root:a,names:n?o:void 0}}function assertObservation(e,t){let r=e.workspaceDir;if(t.canonical!==e.canonical)throw new n({aliasPath:r,storedWorkspacePath:e.canonical,currentWorkspacePath:t.canonical});if(e.root.some((e,n)=>e!==void 0&&(e.dev!==t.root[n]?.dev||e.ino!==t.root[n]?.ino||e.mode!==t.root[n]?.mode))||e.root[1]===void 0&&t.root[1]&&!t.root[1].isDirectory||!i(t.names,e.names))throw Error(`Workspace filesystem changed while preparing state for ${r}; retry workspace setup.`);for(let n=0;n<e.root.length;n++)e.root[n]??=t.root[n]}function assertWorkspaceFilesystemEvidence(e){assertObservation(e,captureObservation(e.workspaceDir,e.names!==void 0))}export{assertWorkspaceFilesystemEvidence as t};