UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.1 kB
import{E as e}from"./transcript-worker-cpu-DTToyx8O.mjs";import{st as t}from"./transcript-sqlite-database-admission-Cro6ZHgY.mjs";import{i as n,t as r}from"./transcript-session-sqlite-target-paths-qm0GE1oO.mjs";import{w as i}from"./session-transcript.worker.js";import{l as a,r as o}from"./transcript-runtime-worker-url-D1R86-Xb.mjs";import{bt as s}from"./transcript-openclaw-state-db-cache-DY0tZ0IC.mjs";import{T as c,t as l}from"./transcript-worker-task-pool-xHbAfEur.mjs";import{a as u,t as d}from"./transcript-worker-pool-sizing-Bbr_YJuw.mjs";import"./transcript-session-transcript-read-fence-CgDWkLBX.mjs";import"./transcript-error-DihQfa_k.mjs";import{a as f,c as p,n as m,o as h,r as g,s as _,t as v}from"./transcript-session-transcript-worker-resources-C4zrwjX6.mjs";import y from"node:path";function createSessionTranscriptReadPool(n,r=!1){let i=_(`Session transcript read`,i=>new l({workerUrl:o(a.sessionTranscript),prepareWorker:()=>(t(),{options:{workerData:{databaseEngineSelection:e()}}}),workerOptions:{resourceLimits:p},maxWorkers:n,sharedCompute:r,onRotationComplete:i}));return{async run(e,t,n){let r=/* @__PURE__ */ new Set;g(i),i.pending++,h();try{for(let e of n.storePaths){let t=v(e);r.has(t)||(r.add(t),t.pending++)}return await s(n.admissionPaths,()=>i.pool.run(()=>{if([...r].some(e=>e.revoked))throw new c(`Session transcript database read was revoked`,`unavailable`);i.native=!0;for(let e of r)e.nativeLanes.add(i);return e},t),n.families)}finally{for(let e of r)e.pending--;i.pending--,f(),m(i)}}}}const b=createSessionTranscriptReadPool(d);createSessionTranscriptReadPool(u(`singleton`),!0);async function resolveSessionSqliteTargetInWorker(e,t){t?.throwIfAborted();let a=n(e.storePath),o=i(await b.run({kind:`sqlite-target`,...e},{inputBytes:JSON.stringify(e).length*2,timeoutMs:6e4,signal:t},{storePaths:[e.storePath],admissionPaths:r(e.storePath),families:a.agentId||a.shared?[]:[y.dirname(a.path)]}));if(!(`target`in o))throw Error(`Session context worker returned context instead of a database target`);return o.target}export{resolveSessionSqliteTargetInWorker};