UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 2.88 kB
import{t as formatCliCommand}from"./command-format-D7KhNLP0.mjs";import{d as isConfiguredPluginPathDiagnosticCode,p as PLUGIN_AVAILABILITY_POLICY}from"./discovery-Bo4UPPd9.mjs";import{r as createUpdateFailureFact}from"./update-failure-facts-Bwgg6oY-.mjs";import{t as isUpdateDoctorRun}from"./doctor-health-contribution-utils-DsM0Tsf-.mjs";import{o as renderStructuredHealthFindings}from"./doctor-health-contribution-CiqEIP_B.mjs"; //!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 \`${formatCliCommand(`openclaw doctor --fix`)}\` to migrate or remove retired keys. If no migration applies, find the active config with \`${formatCliCommand(`openclaw config file`)}\`, correct or remove the reported setting manually, and 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-C_CDW6O2.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(` `))||`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}`}))]}}}export{runFinalConfigValidationHealth as i,configValidationIssuesToHealthFindings as n,configValidationWarningsToHealthFindings as r,FINAL_CONFIG_VALIDATION_CHECK_ID as t};