UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

51 lines (50 loc) • 1.88 kB
import { t as runChannelPluginStartupMaintenance } from "./lifecycle-startup-CFpRSV5C.mjs"; import { n as resolveDoctorChannelPreviewConfig } from "./preview-warnings-DehCK0fh.mjs"; //#region src/flows/doctor-startup-channel-maintenance.ts const CHANNEL_PREVIEW_WARNINGS_CHECK_ID = "core/doctor/channel-preview-warnings"; function normalizeWarningMessage(e) { return e.replace(/^-\s*/, "").trim(); } function warningPath(e) { return e.match(/^\s*-?\s*(channels\.[^\s:]+)/)?.[1]; } /** Collect read-only channel doctor preview warnings as structured findings. */ async function collectChannelPreviewWarningHealthFindings(e) { const { collectChannelDoctorPreviewWarnings: t } = await import("./channel-doctor-DfTS1VvV.mjs"); const n = "openclaw doctor --fix"; return (await t({ cfg: (await resolveDoctorChannelPreviewConfig({ cfg: e.cfg, env: process.env, allowExec: e.allowExec })).cfg, doctorFixCommand: n, env: process.env })).map((e) => { const t = warningPath(e); return Object.assign({ checkId: CHANNEL_PREVIEW_WARNINGS_CHECK_ID, severity: "warning", message: normalizeWarningMessage(e) }, t ? { path: t } : {}, { requirement: "Configured channels should not emit doctor preview warnings.", fixHint: `Run \`${n}\` if the channel warning recommends repair, or update the affected channel config manually.` }); }); } /** Runs channel plugin startup maintenance when doctor fix mode explicitly permits repairs. */ async function maybeRunDoctorStartupChannelMaintenance(e) { if (!e.shouldRepair) return; await runChannelPluginStartupMaintenance({ cfg: e.cfg, env: process.env, log: { info: (t) => e.runtime.log(t), warn: (t) => e.runtime.error(t) }, trigger: "doctor-fix", logPrefix: "doctor" }); } //#endregion export { collectChannelPreviewWarningHealthFindings, maybeRunDoctorStartupChannelMaintenance };