UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.51 kB
import{n as executeExistingOpenClawStateRead}from"./openclaw-state-db-readonly-Cd5_cxBs.mjs";import{r as captureOpenClawStateWorkerContext}from"./openclaw-state-worker-context-Dx8YjqO2.mjs";import{d as readRegistryWorktree}from"./registry-read-mqD__iTh.mjs";import{s as withSettledLocalWorkspace}from"./local-workspace-projection-DBuPISyh.mjs"; //!src/gateway/worker-environments/local-workspace-settlement.ts async function withSettledLocalWorkspaceProjectionPath(e,t){const n=captureOpenClawStateWorkerContext({path:e.databasePath,env:e.env});const r=await executeExistingOpenClawStateRead({path:n.admission.databasePath,env:n.environment},{type:`localWorkspace.byProjectionPath`,input:{projectionPath:e.projectionPath}},{context:n,current:true});e.assertCurrent?.();if(!r){if(e.requireProjection)throw new Error(`Managed sandbox projection is missing; preserve its stopped custody.`);return await t()}if(!r.ok||r.type!==`localWorkspace.byProjectionPath`)throw new Error(`Unexpected local workspace projection lookup.`);if(!r.projection){if(e.requireProjection)throw new Error(`Managed sandbox projection is missing; preserve its stopped custody.`);return await t()}const i=await readRegistryWorktree(n,r.projection.worktree_id);e.assertCurrent?.();if(!i)throw new Error(`Managed sandbox workspace lost its canonical owner; preserve its stopped custody.`);return await withSettledLocalWorkspace({worktree:i,env:n.environment,assertCurrent:e.assertCurrent},t)}export{withSettledLocalWorkspaceProjectionPath};