openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.51 kB
JavaScript
import{t as e}from"./fs-safe-copy.worker-fs-safe-env-Cjb-nj65.mjs";import{readFileSync as t}from"node:fs";import{serialize as n}from"node:v8";import{parentPort as r}from"node:worker_threads";import{configureFsSafeNative as i,getFsSafeNativeConfig as a}from"@openclaw/fs-safe/config";import{copyTree as o,createCloneSource as s,probeTreeClone as c,readCloneFileMetadata as l}from"@openclaw/fs-safe/copy";import{inspectDarwinAcl as u}from"@openclaw/fs-safe/permissions";function failure(e){return{type:`failed`,message:e instanceof Error?e.message:String(e),...e instanceof Error&&`code`in e&&typeof e.code==`string`?{code:e.code}:{}}}if(e(),r){let e=a(),{serveWorkerTasks:t}=await import(`./fs-safe-copy.worker-worker-task-server-DpWzCy-E.mjs`);i(e),t(async e=>{let t=e;try{switch(t.type){case`probe`:return{type:`probe`,backend:c(t.parent),nativeMode:a().mode};case`acl`:return{type:`acl`,acl:u(t.path)};case`metadata`:return{type:`metadata`,entries:await l(t.paths)};default:throw Error(`Unknown native worktree read operation`)}}catch(e){return failure(e)}})}else{let e=new AbortController,abort=()=>e.abort();process.on(`SIGTERM`,abort);let r;try{let n=JSON.parse(t(0,`utf8`));switch(n.type){case`create`:await s(n.destination,{signal:e.signal});break;case`copy`:await o(n.source,n.destination,{clone:`always`,signal:e.signal});break;default:throw Error(`Unknown native worktree operation`)}r={type:`written`}}catch(e){r=failure(e)}finally{process.off(`SIGTERM`,abort)}process.stdout.write(n(r))}export{};