openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 942 B
JavaScript
import{i as e}from"./transcript-global-singleton-DIJgobpU.mjs";import{w as t}from"./transcript-sqlite-post-commit-B_pko32i.mjs";import{threadId as n}from"node:worker_threads";const r=e(Symbol.for(`openclaw.databaseProcessRole`),()=>({}));function getDatabaseProcessRole(){return r.role}let i=0;function withEngineStoreAdmission(e){i+=1;try{let n=e();if(t(n))throw Error(`Database engine admission must remain synchronous`);return n}finally{--i}}function assertEngineStoreExecutionAllowed(){if(n===0&&i===0&&r.role!==`cli-oneshot`)throw Error(`PostgreSQL connections must run in a worker; only synchronous admission, migrations, and CLI one-shots may run on the main thread`)}const a=18e5;function resolveAgentDatabaseIdleHandleTtlMs(){return getDatabaseProcessRole()===`cli-oneshot`?3e4:a}export{withEngineStoreAdmission as a,getDatabaseProcessRole as i,resolveAgentDatabaseIdleHandleTtlMs as n,assertEngineStoreExecutionAllowed as r,a as t};