UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

60 lines (59 loc) • 3.09 kB
import { a as isConfiguredPluginPathDiagnosticCode, l as PLUGIN_AVAILABILITY_POLICY } from "./discovery-availability-DtlJ7XvT.mjs"; import { r as createUpdateFailureFact } from "./update-failure-facts-Bk_Ty8lS.mjs"; import { t as isUpdateDoctorRun } from "./doctor-health-contribution-utils-vPLdl3Wb.mjs"; import { o as renderStructuredHealthFindings } from "./doctor-health-contribution-t31v9kPi.mjs"; //#region src/flows/doctor-config-validation-findings.ts const FINAL_CONFIG_VALIDATION_CHECK_ID = "core/doctor/final-config-validation"; function configValidationIssuesToHealthFindings(e) { return e.map((e) => ({ checkId: FINAL_CONFIG_VALIDATION_CHECK_ID, severity: "error", message: e.message, path: e.path || "<root>", requirement: "valid-config", fixHint: e.fixHint ?? "Run `openclaw doctor --fix` to migrate or remove retired keys. If no migration applies, correct the value or use `openclaw config unset <key>` with the rejected key path, then rerun Doctor." })); } function configValidationWarningsToHealthFindings(e) { return e.filter((e) => isConfiguredPluginPathDiagnosticCode(e.code) && e.path === "plugins.load.paths").map((e) => ({ checkId: FINAL_CONFIG_VALIDATION_CHECK_ID, severity: PLUGIN_AVAILABILITY_POLICY.severity, target: PLUGIN_AVAILABILITY_POLICY.state, requirement: e.code, source: e.source, errorCode: e.errorCode, message: e.message, path: e.path, fixHint: e.fixHint ?? PLUGIN_AVAILABILITY_POLICY.repairCommand })); } async function runFinalConfigValidationHealth(e) { const { readConfigFileSnapshot: t } = await import("./config/config.js"); const { readDeferredPluginMigrationsAsync: n } = await import("./deferred-plugin-migrations-D0dr-2ek.mjs"); const r = await n({ env: e.env ?? process.env }); const i = await t({ skipPluginValidation: isUpdateDoctorRun(e.env ?? process.env), preservedLegacyRootKeys: e.configResult.preservedLegacyRootKeys, deferredPluginMigrations: r }); const a = [...i.exists && !i.valid ? configValidationIssuesToHealthFindings(i.issues) : [], ...(e.configResult.stateMigrationStepReceipts ?? []).filter((e) => e.requiredness === "required" && e.outcome === "deferred").map((e) => ({ checkId: `core/doctor/${e.id}`, severity: "error", requirement: "required-migration-deferred", message: (e.refusal?.message ?? e.warnings.join("\n")) || `Required migration ${e.id} was deferred.`, fixHint: "Resolve the reported blocker, then rerun `openclaw doctor --fix` before restarting the Gateway." }))]; if (a.length > 0) { renderStructuredHealthFindings(e, a); e.postInstallDoctorResult = { status: "error", failureFacts: [...e.postInstallDoctorResult?.failureFacts ?? [], ...a.map((e) => createUpdateFailureFact({ check: e.checkId, code: e.requirement ?? "doctor-repair-blocked", message: `${e.path ? `${e.path}: ` : ""}${e.message} ${e.fixHint}` }))] }; } } //#endregion export { runFinalConfigValidationHealth as i, configValidationIssuesToHealthFindings as n, configValidationWarningsToHealthFindings as r, FINAL_CONFIG_VALIDATION_CHECK_ID as t };