UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

39 lines (38 loc) • 1.95 kB
import { n as probeSqlite, t as isSqliteWalResetSafeVersion } from "./node-sqlite-capabilities-DSS2XxGc.mjs"; import { d as isSupportedOpenClawNodeVersion, i as SUPPORTED_NODE_VERSION_RANGE } from "./node-version-CYJ7qOPD.mjs"; //#region node-sqlite.mjs const capabilityCacheKey = Symbol.for("openclaw.sqliteCapabilities"); function unavailableSqliteCapabilities(e) { return { available: false, version: null, text: false, blob: false, json: false, error: e instanceof Error ? e.message : String(e) }; } function probeCurrentSqlite() { try { const e = process.getBuiltinModule?.("node:sqlite")?.DatabaseSync; if (typeof e !== "function") return unavailableSqliteCapabilities(/* @__PURE__ */ new Error("node:sqlite is unavailable")); return probeSqlite(e); } catch (e) { return unavailableSqliteCapabilities(e); } } function detectCurrentSqliteCapabilities() { globalThis[capabilityCacheKey] ??= Promise.resolve().then(probeCurrentSqlite); return Promise.resolve(globalThis[capabilityCacheKey]); } function nodeRuntimeFailure(e, t) { const n = `Node ${e ?? "unknown"}`; if (!t.available) return `${n}: node:sqlite is unavailable; use 24.16+/26.1+ or a build with the fix.`; if (!t.text && !t.error) return `${n}: node:sqlite truncates TEXT at embedded NUL (nodejs/node#61954); use 24.16+/26.1+ or a build with the fix`; if (t.error || !t.text || !t.blob || !t.json) return `${n}: node:sqlite NUL round-trip capability check failed; use 24.16+/26.1+ or a build with the fix.`; if (!t.version || !isSqliteWalResetSafeVersion(t.version)) return `${n}: SQLite ${t.version ?? "unknown"} is not WAL-reset-safe; use SQLite 3.51.3+, 3.50.7+, or 3.44.6+ on its patched release line.`; if (!isSupportedOpenClawNodeVersion(e)) return `${n}: openclaw requires Node ${SUPPORTED_NODE_VERSION_RANGE.replace(" || ", ", or ")}.`; return null; } //#endregion export { nodeRuntimeFailure as n, detectCurrentSqliteCapabilities as t };