openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 2.52 kB
JavaScript
import{pt as e}from"./openclaw-state-read-map-size-DJbMcZYM.mjs";import{v as t}from"./openclaw-state-read-home-dir-BQZX1pD2.mjs";import{t as n}from"./openclaw-state-read-promise-like-3qqJObCs.mjs";var SqliteSnapshotCleanupError=class extends Error{},SqliteSnapshotDirectoryBusyError=class extends SqliteSnapshotCleanupError{constructor(...e){super(...e),this.name=`SqliteSnapshotDirectoryBusyError`}};function classifyRetiredSqliteSnapshotRemovalError(t,n){let r=e(n);return n instanceof Error&&`syscall`in n&&(n.syscall===`rmdir`||n.syscall===`unlink`)&&(r===`EBUSY`||r===`ENOTEMPTY`)?new SqliteSnapshotDirectoryBusyError(`SQLite retired snapshot directory removal is busy: ${t}`,{cause:n}):n}var OpenClawStateOwnershipError=class extends Error{},OpenClawStateOwnershipMetadataError=class extends OpenClawStateOwnershipError{constructor(e,t){super(`OpenClaw shared state ownership metadata is invalid at ${e}: ${t}. Repair it with OPENCLAW_SUPERVISOR_MODE=external openclaw database ownership claim --manager <manager-id>.`),this.databasePath=e,this.name=`OpenClawStateOwnershipMetadataError`}},OpenClawStateExternalOwnershipError=class extends OpenClawStateOwnershipError{constructor(e,t){super(`OpenClaw shared state database ${e} is externally supervised by ${t}. Use that external supervisor with OPENCLAW_SUPERVISOR_MODE=external for writable operations.`),this.databasePath=e,this.managerId=t,this.name=`OpenClawStateExternalOwnershipError`}};const r=t(Symbol.for(`openclaw.sqliteCoordinatorError`),()=>class extends Error{constructor(e,t){super(e),this.cause=t,this.name=`SqliteCoordinatorError`}});function createSqliteLifecycleAggregateError(e,t,n){return AggregateError(e,t,{cause:n})}function throwSqliteLifecycleErrors(e,t){if(e.length===1)throw e[0];if(e.length>1)throw createSqliteLifecycleAggregateError(e,t,e[0])}function runWithSqliteCleanup(e,t,i){let a;try{if(a=i(),n(a))throw new r(`${t} must remain synchronous`)}catch(n){try{e.release()}catch(e){throw createSqliteLifecycleAggregateError([n,e],`${t} and resource release both failed`,n)}throw n}try{e.release()}catch(e){throw new r(`${t} completed, but releasing its resource failed`,e)}return a}export{SqliteSnapshotCleanupError as a,createSqliteLifecycleAggregateError as c,r as i,runWithSqliteCleanup as l,OpenClawStateOwnershipError as n,SqliteSnapshotDirectoryBusyError as o,OpenClawStateOwnershipMetadataError as r,classifyRetiredSqliteSnapshotRemovalError as s,OpenClawStateExternalOwnershipError as t,throwSqliteLifecycleErrors as u};