openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.14 kB
JavaScript
import{o as resolveGlobalSingleton}from"./global-singleton-DolL9xGt.mjs";import{t as runInDetachedAsyncContext}from"./detached-async-context-DLLuWsxc.mjs";
//!src/infra/gateway-native-worker-recovery.ts
const nativeWorkerRecovery=resolveGlobalSingleton(Symbol.for(`openclaw.gatewayNativeWorkerRecovery`),()=>({}));const reportGatewayRuntimeRecoveryOnly=e=>({status:`report-only`,reason:`Automatic runtime recovery is report-only: ${e}`});function requestGatewayNativeWorkerRecovery(e){const t=nativeWorkerRecovery.request;if(!t)return Promise.resolve(reportGatewayRuntimeRecoveryOnly(`no Gateway process lifecycle owns recovery.`));return runInDetachedAsyncContext(()=>Promise.resolve().then(()=>t(e)).catch(()=>reportGatewayRuntimeRecoveryOnly(`service or restart preparation failed. Inspect the native worker and restart through the service owner.`)))}function registerGatewayNativeWorkerRecovery(e){nativeWorkerRecovery.request=e;return()=>{if(nativeWorkerRecovery.request===e)nativeWorkerRecovery.request=void 0}}export{reportGatewayRuntimeRecoveryOnly as n,requestGatewayNativeWorkerRecovery as r,registerGatewayNativeWorkerRecovery as t};