UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

27 lines (26 loc) • 1.31 kB
import { c as readLockPayload, d as resolveGatewayOwnerStatus, n as GatewayLockError, u as resolveGatewayLockPaths } from "./gateway-lock-IYOwJQai.mjs"; import path from "node:path"; import os from "node:os"; //#region src/infra/gateway-lock-legacy.ts /** Published 2026.6.33 Gateways predate state-local locks and SQLite coordinators. */ async function readLegacyGatewayLockIdentity(e) { const t = process.getuid?.(); const n = path.join(os.tmpdir(), t === void 0 ? "openclaw" : `openclaw-${t}`); const { configLockPath: r } = resolveGatewayLockPaths(e, n); const i = await readLockPayload(r, true).catch((e) => { throw new GatewayLockError(`Legacy Gateway lock could not be read at ${r}; inspect that file as the Gateway service account before retrying maintenance.`, e); }); if (!i) return; const a = await resolveGatewayOwnerStatus(i.pid, i, process.platform, { lockPath: r }); return a === "dead" ? void 0 : { pid: i.pid, state: a, path: r }; } async function assertLegacyGatewayStoppedForMaintenance(e) { const t = await readLegacyGatewayLockIdentity(e); if (t) throw new GatewayLockError(`Legacy Gateway lock ${t.path} still has a live or unverified owner (PID ${t.pid}).`); } //#endregion export { readLegacyGatewayLockIdentity as n, assertLegacyGatewayStoppedForMaintenance as t };