openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 4.14 kB
JavaScript
import{vt as e}from"./openclaw-state-read-sqlite-database-admission-Ck6VG7rE.mjs";import"./openclaw-state-read-openclaw-state-db-cache-BVY8IYkn.mjs";import"./openclaw-state-read-openclaw-state-db.paths-CFemYLpA.mjs";import"./openclaw-state-read-openclaw-state-db-async-lifecycle-B_Y330HB.mjs";import"./openclaw-state-read-openclaw-state-db-contract-DiFTYPe3.mjs";import"./openclaw-state-read-gateway-lock-payload-C9huNHFz.mjs";import"./openclaw-state-read-pid-alive-_-Y1IvGj.mjs";import"./openclaw-state-read-sqlite-post-commit-CEHMNIsB.mjs";import"./openclaw-state-read-gateway-state-owner-BJTFuTQ0.mjs";import"./openclaw-state-read-json-coercion-DgTIp8OM.mjs";import{a as t,i as n}from"./openclaw-state-read-kysely-sync-DQyYiAw5.mjs";import{t as r}from"./openclaw-state-read-sqlite-schema-sql-BnVx4b5A.mjs";import{a as i}from"./openclaw-state-read-sqlite-schema-facts-DxLfPKu-.mjs";import"./openclaw-state-read-sqlite-worker-operation-admission-DTfv_SKu.mjs";import{o as a}from"./openclaw-state-read-openclaw-state-db-schema-helpers-BkqUYEFY.mjs";import"./openclaw-state-read-sqlite-snapshot-staging-owner-B9a1YbDW.mjs";import"./openclaw-state-read-openclaw-state-db-DnrW7QY9.mjs";import"./openclaw-state-read-errors-BhOrSl8J.mjs";import"./openclaw-state-read-openclaw-state-db-readonly-CDG18cNK.mjs";import"./openclaw-state-read-sqlite-handle-lifecycle-DQ13SM2U.mjs";import"./openclaw-state-read.worker.js";import"./openclaw-state-read-openclaw-state-feature-schema-BPVIIoAx.mjs";import"./openclaw-state-read-pending-slots.worker-CsspSCq6.mjs";import"./openclaw-state-read-registry-read.kernel-Mu3y8MTg.mjs";import"./openclaw-state-read-run-lease-owner-fmiThuBE.mjs";import"./openclaw-state-read-workspace-state-guard-lmfygG7O.mjs";import"./openclaw-state-read-backoff-DDprjZZH.mjs";import"./openclaw-state-read-openclaw-state-db-existing-write-BFFt_1Yy.mjs";import"./openclaw-state-read-local-workspace-cas-ZEBQPaPC.mjs";import{n as o,r as s}from"./openclaw-state-read-local-workspace-publication-C0wBpRSB.mjs";import"node:os";import"node:util";import"node:timers/promises";[`schema_meta`,`state_leases`].map(t=>r(e,t,{endMarker:`) STRICT;`,errorMessage:`Existing lease schema is unavailable.`})).join(`
`);const c=`local_workspace_projections`,query=e=>t(e);function readLocalWorkspaceProjectionInDatabase(e,t){let r=a(e,c)?n(e,query(e).selectFrom(c).selectAll().where(`worktree_id`,`=`,t)):void 0;if(!r)return;let i;return r.checkpoint_json?.startsWith(`{"kind":"rejected",`)&&(i=JSON.parse(r.checkpoint_json)),{...r,...r.source_paths_digest?{source_paths_json:o(e,r.source_paths_digest)}:{},...i?{checkpoint_json:i.checkpoint,rejectedResult:{ref:i.ref,reason:i.reason,manifestRef:i.manifestRef}}:{}}}function hasLocalWorkspaceProjectionInDatabase(e,t){return a(e,c)&&n(e,query(e).selectFrom(c).select(`worktree_id`).where(`worktree_id`,`=`,t))!==void 0}function readLocalWorkspaceProjectionByPathInDatabase(e,t){if(!i(e))throw Error(`Local workspace lookup requires admitted schema facts.`);return a(e,c)?n(e,query(e).selectFrom(c).select([`worktree_id`,`agent_id`,`session_key`,`session_id`,`lifecycle_revision`]).where(`projection_path`,`=`,t))??null:null}const l={"localWorkspace.readBacking":(e,t)=>({type:`localWorkspace.readBacking`,row:a(t,c)?n(t,query(t).selectFrom(c).select([`session_key`,`projection_path`,`baseline_ref`]).where(`worktree_id`,`=`,e.id)):void 0}),"localWorkspace.sweepCandidates":(e,t)=>({type:`localWorkspace.sweepCandidates`,candidates:s(t,e.epoch)}),"localWorkspace.reviewBase":(e,t)=>({type:`localWorkspace.reviewBase`,row:a(t,c)?n(t,query(t).selectFrom(c).select([`worktree_id`,`agent_id`,`session_key`,`session_id`,`base_commit`]).where(`worktree_id`,`=`,e.id)):void 0}),"localWorkspace.byProjectionPath":(e,t)=>({type:`localWorkspace.byProjectionPath`,projection:readLocalWorkspaceProjectionByPathInDatabase(t,e.projectionPath)}),"localWorkspace.exists":(e,t)=>({type:`localWorkspace.exists`,exists:hasLocalWorkspaceProjectionInDatabase(t,e.id)}),"localWorkspace.get":(e,t)=>({type:`localWorkspace.get`,row:readLocalWorkspaceProjectionInDatabase(t,e.id)})};export{l as localWorkspaceReadOperations};