UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

25 lines (24 loc) • 1.2 kB
import { a as resolveGlobalSingleton } from "./global-singleton-0m-JziJW.mjs"; //#region src/state/openclaw-state-db-failure.ts const failurePaths = resolveGlobalSingleton(Symbol.for("openclaw.stateDatabaseFailurePaths"), () => /* @__PURE__ */ new WeakMap()); /** Preserve the terminal admission owner's path through worker error transport. */ function markOpenClawStateDatabaseFailure(error, pathname) { failurePaths.set(error, pathname); } function readOpenClawStateDatabaseFailurePath(error) { return failurePaths.get(error); } /** Cleanup aggregates must retain the original refusal without attributing unrelated errors. */ function findOpenClawStateDatabaseFailure(error, pathname) { const pending = [error]; const seen = /* @__PURE__ */ new Set(); for (const current of pending) { if (!(current instanceof Error) || seen.has(current)) continue; seen.add(current); if (failurePaths.get(current) === pathname) return current; pending.push(current.cause); if (current instanceof AggregateError) pending.push(...current.errors); } } //#endregion export { markOpenClawStateDatabaseFailure as n, readOpenClawStateDatabaseFailurePath as r, findOpenClawStateDatabaseFailure as t };