UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.14 kB
import{Mt as e,Q as t}from"./sqlite-readonly-subsystem-C-VJT-xk.mjs";import{L as n,N as r}from"./sqlite-readonly-sqlite-readonly-location-CKoGOncu.mjs";import{Jn as i}from"./sqlite-readonly-node-sqlite-u3RAlsBE.mjs";import{f as a}from"./sqlite-readonly-worker-cpu-COshMrit.mjs";import{a as o}from"./sqlite-readonly-sqlite-worker-operation-admission-BBMq6s0g.mjs";const s=e(Symbol.for(`openclaw.stateSchemaMutationConflictError`),()=>class extends Error{constructor(e,t){super(`OpenClaw refused shared state schema mutation at ${e} because another Gateway owns that state directory. Stop that Gateway or perform the update through its managed restart path, then retry.`,{cause:t}),this.name=`StateSchemaMutationConflictError`}});function acquireSchemaMaintenanceLease({databasePath:e,busyTimeoutMs:i}){if(o(e))return;let c=t(e),l=n(c);if(l)l.assertCurrent();else try{return r(c,{busyTimeoutMs:i})}catch(e){throw e instanceof a?new s(c,e):e}}function withStateDatabaseSchemaMaintenance(e,t){let n=acquireSchemaMaintenanceLease(e);return n?i(n,`state schema mutation`,()=>n.run(t)):t()}export{withStateDatabaseSchemaMaintenance as n,s as t};