UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.64 kB
import{r as isPathInside}from"./path-guards-DGttsOJI.mjs";import{n as executeExistingOpenClawStateRead}from"./openclaw-state-db-readonly-Cd5_cxBs.mjs";import{i as captureWorktreeRunEndContext}from"./run-end-lifecycle-mk2iX8J8.mjs";import{d as readRegistryWorktree,t as captureWorktreeRegistryReadGuard}from"./registry-read-mqD__iTh.mjs"; //!src/gateway/worker-environments/local-workspace-review.ts async function readLocalWorkspaceReviewBase(e){const t=e.entry.worktree;if(!t)return;e.assertCurrent();const n=captureWorktreeRunEndContext(process.env);const r=await executeExistingOpenClawStateRead({path:n.admission.databasePath,env:n.environment},{type:`localWorkspace.reviewBase`,input:{id:t.id}},{context:n,current:true,live:true});e.assertCurrent();const i=r?.row;if(i&&(i.worktree_id!==t.id||i.agent_id!==e.agentId||i.session_key!==e.sessionKey||i.session_id!==e.entry.sessionId))throw new Error(`Local workspace review binding belongs to another session incarnation`);const a=captureWorktreeRegistryReadGuard(n,`lifecycle`);const o=await readRegistryWorktree(n,t.id);const s=a(o);const assertCurrent=()=>{e.assertCurrent();s()};assertCurrent();if(!o||o.removedAt!==void 0)throw new Error(`This session's worktree was removed by cleanup or deletion. Use Restore in Settings > Worktrees (worktrees.restore), or start a new session. Worktree: ${t.id}.`);if(o.ownerKind!==`session`||o.ownerId!==e.sessionKey||o.repoRoot!==t.repoRoot||o.branch!==t.branch||!isPathInside(o.path,e.cwd))throw new Error(`Local workspace review owner changed`);return i?{baseCommit:i.base_commit,assertCurrent}:void 0}export{readLocalWorkspaceReviewBase};