openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
4 lines • 3.33 kB
JavaScript
import{i as resolveDoctorWorkspaceDir,n as noteDoctorRepairResult}from"./doctor-health-contribution-utils-DsM0Tsf-.mjs";import{a as recordDoctorHealthWarnings,o as renderStructuredHealthFindings}from"./doctor-health-contribution-CiqEIP_B.mjs";import{r as isHealthCheckEnabledByDefault}from"./health-checks-bdwCtNe-.mjs";
//!src/flows/doctor-health-contribution-core.ts
function reportDoctorRepairResult(e,t,n){e.cfg=t.config;renderStructuredHealthFindings(e,n);recordDoctorHealthWarnings(e,n,t.warnings);noteDoctorRepairResult(t)}function createDoctorHealthCheckContext(e,t){return{runtime:e.runtime,cfg:e.cfg,configPath:e.configPath,...t,agentDatabaseRefusals:e.agentDatabaseRefusals,...e.runWithPluginMetadataSnapshot?{runWithPluginMetadataSnapshot:e.runWithPluginMetadataSnapshot}:{}}}async function runStructuredHealthRepairs(e,t){if(!e.prompter.shouldRepair)return;const{registerBundledHealthChecks:n}=await import(`./bundled-health-checks-BqAz6lgJ.mjs`);const{listExtensionHealthChecksForDoctor:r}=await import(`./health-check-registry-_RKw6pZM.mjs`);const{runDoctorHealthRepairs:i}=await import(`./doctor-repair-flow-D6UAtxyU.mjs`);const a=resolveDoctorWorkspaceDir(e.cfg,e.env);const o=n({cfg:e.cfg,cwd:a,env:e.env});const s=r(await t(),o).filter(isHealthCheckEnabledByDefault);const c=await i(createDoctorHealthCheckContext(e,{mode:`fix`,env:e.env,cwd:a}),{checks:s,progress:e.options.json!==true});reportDoctorRepairResult(e,c,[...o,...c.remainingFindings])}async function runCoreContributionHealth(e,t){if(t.length===0)return;const{CORE_HEALTH_CHECKS:n}=await import(`./doctor-core-checks-C1FYawyt.mjs`);const{runDoctorHealthRepairs:r}=await import(`./doctor-repair-flow-D6UAtxyU.mjs`);const i=new Set(t);const a=n.filter(e=>i.has(e.id));if(a.length===0)return;const o=resolveDoctorWorkspaceDir(e.cfg,e.env);const s=!e.prompter.shouldRepair;const c=await r(createDoctorHealthCheckContext(e,{mode:`fix`,cwd:o,dryRun:s}),{checks:a,dryRun:s,progress:e.options.json!==true});reportDoctorRepairResult(e,c,s?c.findings:c.remainingFindings)}async function runCoreHealthFindingNote(e,t,n){const{CORE_HEALTH_CHECKS:r}=await import(`./doctor-core-checks-C1FYawyt.mjs`);await renderHealthFindingNote(e,r.find(e=>e.id===t),n)}async function runBundledHealthFindingNote(e,t){const{registerBundledHealthChecks:n}=await import(`./bundled-health-checks-BqAz6lgJ.mjs`);const{getHealthCheck:r}=await import(`./health-check-registry-_RKw6pZM.mjs`);n({cfg:e.cfg,cwd:resolveDoctorWorkspaceDir(e.cfg,e.env),env:e.env});await renderHealthFindingNote(e,r(t))}async function renderHealthFindingNote(e,t,n){if(!t)return;const r=await t.detect(createDoctorHealthCheckContext(e,{mode:`doctor`,cwd:resolveDoctorWorkspaceDir(e.cfg,e.env),allowExecSecretRefs:e.options.allowExec===true}));if(r.length===0)return;recordDoctorHealthWarnings(e,r);renderStructuredHealthFindings(e,r);const i=r.filter(e=>e.severity===`info`);if(n?.infoNoteTitle&&i.length>0){const{note:e}=await import(`./terminal-core/note.js`);e(i.map(e=>e.fixHint?`- ${e.message}\n ${e.fixHint}`:`- ${e.message}`).join(`
`),n.infoNoteTitle)}if(r.some(e=>e.severity!==`info`&&e.category!==`recommended`&&e.category!==`historical`))e.healthOk=false}export{runStructuredHealthRepairs as i,runCoreContributionHealth as n,runCoreHealthFindingNote as r,runBundledHealthFindingNote as t};