UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

84 lines (83 loc) • 3.32 kB
import { i as resolveDoctorWorkspaceDir, n as noteDoctorRepairResult } from "./doctor-health-contribution-utils-vPLdl3Wb.mjs"; import { a as recordDoctorHealthWarnings, o as renderStructuredHealthFindings } from "./doctor-health-contribution-t31v9kPi.mjs"; import { r as isHealthCheckEnabledByDefault } from "./health-checks-BFk2VaFq.mjs"; //#region 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-BJWxOv9V.mjs"); const { listExtensionHealthChecksForDoctor: r } = await import("./health-check-registry-PKGPYcim.mjs"); const { runDoctorHealthRepairs: i } = await import("./doctor-repair-flow-C7dpUUxf.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-5nniaFZH.mjs"); const { runDoctorHealthRepairs: r } = await import("./doctor-repair-flow-C7dpUUxf.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-5nniaFZH.mjs"); const i = r.find((e) => e.id === t); if (!i) return; const a = await i.detect(createDoctorHealthCheckContext(e, { mode: "doctor", cwd: resolveDoctorWorkspaceDir(e.cfg, e.env), allowExecSecretRefs: e.options.allowExec === true })); if (a.length === 0) return; recordDoctorHealthWarnings(e, a); renderStructuredHealthFindings(e, a); const o = a.filter((e) => e.severity === "info"); if (n?.infoNoteTitle && o.length > 0) { const { note: e } = await import("./terminal-core/note.js"); e(o.map((e) => e.fixHint ? `- ${e.message}\n ${e.fixHint}` : `- ${e.message}`).join("\n"), n.infoNoteTitle); } if (a.some((e) => e.severity !== "info" && e.category !== "recommended" && e.category !== "historical")) e.healthOk = false; } //#endregion export { runCoreHealthFindingNote as n, runStructuredHealthRepairs as r, runCoreContributionHealth as t };