UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

43 lines (42 loc) • 1.76 kB
import { r as isPathInside } from "./path-guards-TIjxtj6H.mjs"; import { n as executeExistingOpenClawStateRead } from "./openclaw-state-db-readonly-B6YHb1oF.mjs"; import { i as captureWorktreeRunEndContext } from "./run-end-lifecycle-CvtGWdnp.mjs"; import { d as readRegistryWorktree, t as captureWorktreeRegistryReadGuard } from "./registry-read-DAFI5cQY.mjs"; //#region src/gateway/worker-environments/local-workspace-review.ts /** Review consumes accepted source facts without reconciling or provisioning the workspace. */ 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) return; if (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 || 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 { baseCommit: i.base_commit, assertCurrent }; } //#endregion export { readLocalWorkspaceReviewBase };