UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 3.2 kB
import{n as isNodeRuntime}from"./runtime-binary-DNstBs1K.mjs";import{c as formatNodeSecurityWarning,r as SUPPORTED_NODE_VERSIONS,u as formatUnsupportedNodeVersionMessage}from"./node-version-EaZf6kHy.mjs";import{n as nodeRuntimeFailure}from"./node-sqlite-C4eK3Aj_.mjs";import{n as resolveOpenClawPackageRoot}from"./openclaw-root-DP80HYD2.mjs";import{o as isDefaultInstallIdentity}from"./paths-D_FOvGon.mjs";import{c as summarizeGatewayServiceLayout}from"./service-layout-Daz63_6Y.mjs";import{n as readInstallOwner,t as formatInstallOwnerMessage}from"./install-owner-BPkbFuTm.mjs";import{n as detectRuntime}from"./runtime-guard-BJxH-79F.mjs";import{o as resolveNodeRuntimeInfo}from"./runtime-paths-BOio2Rt6.mjs";import{n as resolveGatewayService}from"./service-Bz63n2ee.mjs"; //!src/commands/node-runtime-diagnostics.ts const CHECK_ID=`core/doctor/node-runtime`;async function collectNodeRuntimeFindings(e=process.env){const t=[];const n=await detectRuntime();if(n.kind===`node`&&n.sqliteProbe){const e=nodeRuntimeFailure(n.version,n.sqliteProbe);const r=e?null:formatNodeSecurityWarning(n.version);if(e||r){const i=await readInstallOwner(await resolveOpenClawPackageRoot({moduleUrl:import.meta.url,argv1:process.argv[1]}));t.push({checkId:CHECK_ID,severity:e?`error`:`warning`,source:`cli`,message:e??`SECURITY WARNING: ${r}`,requirement:e?SUPPORTED_NODE_VERSIONS:`recommended Node security patches`,target:n.execPath??void 0,fixHint:i?formatInstallOwnerMessage(i):e?formatUnsupportedNodeVersionMessage(n.version):`Upgrade the Node.js runtime to the recommended security patch level. Compatible older Node remains usable.`})}}if(!isDefaultInstallIdentity(e))return t;try{const n=await resolveGatewayService().readCommand(e,{timeoutMs:5e3});const r=n?.programArguments[0];if(r&&isNodeRuntime(r)){const i=await resolveNodeRuntimeInfo(r,{...e,...n.environment});if(i.status===`probe-failed`)throw i.error;const a=i.status===`supported`?formatNodeSecurityWarning(i.version):null;if(i.status===`unsupported`||a){const e=await summarizeGatewayServiceLayout(n);const r=await readInstallOwner(e?.packageRootReal??e?.packageRoot??null);t.push({checkId:CHECK_ID,severity:`warning`,source:`gateway-service`,message:a?`SECURITY WARNING: Recorded Gateway service runtime: ${a}`:`Gateway service Node ${i.version??`unknown`} is unsupported. Required: ${SUPPORTED_NODE_VERSIONS}.`,requirement:a?`recommended Node security patches`:SUPPORTED_NODE_VERSIONS,fixHint:r?formatInstallOwnerMessage(r):a?`Upgrade the service Node.js runtime, then refresh the managed Gateway runtime selection and restart it. Compatible older Node remains usable.`:[...i.capabilityError?[i.capabilityError]:[],formatUnsupportedNodeVersionMessage(i.version),"After switching Node, refresh a managed Gateway with `openclaw gateway install --force`; for an externally managed service, have its deployment owner update the launcher."].join(` `)})}}}catch{t.push({checkId:CHECK_ID,severity:`warning`,source:`gateway-service`,message:`The recorded Gateway service Node runtime could not be inspected.`,fixHint:"Run `openclaw gateway status --deep` and check access to its recorded executable."})}return t}export{collectNodeRuntimeFindings as t};