UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.42 kB
import{l as resolveGatewayLockPaths,n as GatewayLockError,s as readLockPayload,u as resolveGatewayOwnerStatus}from"./gateway-lock-CQoO1usb.mjs";import path from"node:path";import os from"node:os"; //!src/infra/gateway-lock-legacy.ts 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,databasePath:path.join(resolveGatewayLockPaths(e).stateDir,`state`,`openclaw.sqlite`)});return a===`dead`?void 0:{pid:i.pid,state:a,path:r}}async function assertLegacyGatewayStoppedForMaintenance(e){const t=await readLegacyGatewayLockIdentity(e);if(t){const n=t.path===resolveGatewayLockPaths(e).configLockPath?`Stop that process before retrying.`:`If that process has stopped on this host and in every container sharing this directory, remove that file as the Gateway service account.`;throw new GatewayLockError(`Legacy Gateway lock ${t.path} still has a live or unverified owner (PID ${t.pid}). ${n}`)}}export{readLegacyGatewayLockIdentity as n,assertLegacyGatewayStoppedForMaintenance as t};