UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

78 lines (77 loc) • 3.83 kB
import { n as isNodeRuntime } from "./runtime-binary-QwVVJ9cA.mjs"; import { l as formatUnsupportedNodeVersionMessage, r as SUPPORTED_NODE_VERSIONS, s as formatNodeSecurityWarning } from "./node-version-CYJ7qOPD.mjs"; import { n as nodeRuntimeFailure } from "./node-sqlite-rcZh3Q1F.mjs"; import { o as isDefaultInstallIdentity } from "./paths-DAcAg5aV.mjs"; import { n as resolveOpenClawPackageRoot } from "./openclaw-root-C-ayo09z.mjs"; import { l as summarizeGatewayServiceLayout } from "./service-layout-C5OySMEw.mjs"; import { n as readInstallOwner, t as formatInstallOwnerMessage } from "./install-owner-DDPQXcjQ.mjs"; import { n as detectRuntime } from "./runtime-guard-BiEisZ4L.mjs"; import { o as resolveNodeRuntimeInfo } from "./runtime-paths-xW9-a89Z.mjs"; import { n as resolveGatewayService } from "./service-hQiIzcTo.mjs"; //#region src/commands/node-runtime-diagnostics.ts /** Read-only Node findings shared by Doctor and status commands. */ const CHECK_ID = "core/doctor/node-runtime"; /** Inspect the CLI and recorded service without starting or repairing the service. */ 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("\n") }); } } } 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; } //#endregion export { collectNodeRuntimeFindings as t };