UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 3.95 kB
import{ct as e}from"./openclaw-state-read-sqlite-database-admission-CrkztOzk.mjs";import"./openclaw-state-read-openclaw-state-db-cache-DyomEqgV.mjs";import"./openclaw-state-read-sqlite-post-commit-CsXPYVOo.mjs";import"./openclaw-state-read-openclaw-state-db.paths-7XLpcdiq.mjs";import"./openclaw-state-read-runtime-worker-generation-DIZIqsAo.mjs";import"./openclaw-state-read-openclaw-state-db-contract-vqwNsqc6.mjs";import"./openclaw-state-read-gateway-lock-payload-BrJys_8Q.mjs";import"./openclaw-state-read-pid-alive-C5QrpWWk.mjs";import"./openclaw-state-read-sqlite-wal-write-admission-BvF6tHCz.mjs";import"./openclaw-state-read-json-coercion-CAL-_nfN.mjs";import{t}from"./openclaw-state-read-sqlite-schema-sql-BnVx4b5A.mjs";import{a as n}from"./openclaw-state-read-sqlite-schema-facts-Dtolu7-X.mjs";import"./openclaw-state-read-sqlite-worker-operation-admission-DdAi_0af.mjs";import{a as r,i}from"./openclaw-state-read-kysely-sync-Bcu0Qb7F.mjs";import{o as a}from"./openclaw-state-read-openclaw-state-db-schema-helpers-QFZd8aJI.mjs";import{a as o}from"./openclaw-state-read-sqlite-transaction-Bt-IwVhZ.mjs";import"./openclaw-state-read-sqlite-snapshot-staging-owner-DKlm1W_1.mjs";import"./openclaw-state-read-openclaw-state-db-B3dGXm7m.mjs";import"./openclaw-state-read-sqlite-handle-lifecycle-uqyIC6ii.mjs";import"./openclaw-state-read-lazy-promise-CGYd8Q_0.mjs";import"./openclaw-state-read-openclaw-state-db-legacy-backfills-CP_449sp.mjs";import"./openclaw-state-read.worker.js";import"./openclaw-state-read-openclaw-state-db-readonly-Bv32Owin.mjs";import"./openclaw-state-read-pending-slots.worker-D9Qt1uQb.mjs";import"./openclaw-state-read-registry-read.kernel-DMLhSU5E.mjs";import"./openclaw-state-read-run-lease-owner-yHigBNsQ.mjs";import"./openclaw-state-read-openclaw-state-feature-schema-BaBHFVL8.mjs";import"./openclaw-state-read-backoff-B79CSFak.mjs";import"./openclaw-state-read-openclaw-state-db-existing-write-DIIKgnZX.mjs";import{n as s,t as c}from"./openclaw-state-read-local-workspace-cas.kernel-pgAY88fc.mjs";import"node:os";import"node:util";import"node:timers/promises";[`schema_meta`,`state_leases`].map(n=>t(e,n,{endMarker:`) STRICT;`,errorMessage:`Existing lease schema is unavailable.`})).join(` `);const l=`local_workspace_projections`,query=e=>r(e);function readLocalWorkspaceProjectionInDatabase(e,t){let n=a(e,l)?i(e,query(e).selectFrom(l).selectAll().where(`worktree_id`,`=`,t)):void 0;return n?.source_paths_digest?{...n,source_paths_json:c(e,n.source_paths_digest)}:n}function hasLocalWorkspaceProjectionInDatabase(e,t){return a(e,l)&&i(e,query(e).selectFrom(l).select(`worktree_id`).where(`worktree_id`,`=`,t))!==void 0}function readLocalWorkspaceProjectionByPathInDatabase(e,t){if(!n(e))throw Error(`Local workspace lookup requires admitted schema facts.`);return a(e,l)?i(e,query(e).selectFrom(l).select([`worktree_id`,`agent_id`,`session_key`,`session_id`,`lifecycle_revision`]).where(`projection_path`,`=`,t))??null:null}const u={"localWorkspace.readBacking":(e,t)=>({type:`localWorkspace.readBacking`,row:a(t,l)?i(t,query(t).selectFrom(l).select([`session_key`,`projection_path`,`baseline_ref`]).where(`worktree_id`,`=`,e.id)):void 0}),"localWorkspace.sweepCandidates":(e,t)=>({type:`localWorkspace.sweepCandidates`,candidates:o(t,()=>s(t,e.epoch))}),"localWorkspace.reviewBase":(e,t)=>({type:`localWorkspace.reviewBase`,row:a(t,l)?i(t,query(t).selectFrom(l).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{u as localWorkspaceReadOperations};