openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
46 lines (45 loc) • 1.44 kB
JavaScript
//#region src/infra/doctor-progress.ts
const CORE_PHASES = [
"doctor.startup",
"doctor.maintenance-admission",
"doctor.archive-preparation",
"doctor.maintenance.begin",
"doctor.state-preflight",
"doctor.database-preflight",
"doctor.schema-admission",
"doctor.state-database-repair",
"doctor.state-schema",
"doctor.config-flow",
"doctor.database-migrations",
"doctor.heartbeat-migration-backups",
"doctor.contributions",
"doctor.external-config",
"doctor.maintenance-ready",
"doctor.sqlite-nocow",
"doctor.sqlite-reclamation",
"doctor.retained-runtimes",
"doctor.maintenance.finish",
"doctor.maintenance.release",
"Update schema admission",
"Update schema rehearsal",
"Agent deletion journal",
"Database preflight",
"UI protocol",
"Source install",
"CLI launcher",
"Plugin runtime links",
"Config repairs",
"Preserve original state"
];
function formatDoctorProgressPhase(e) {
return e.replace(/^doctor\./u, "").replaceAll(/[.-]/gu, " ");
}
const CORE_LABELS = new Set(CORE_PHASES.map(formatDoctorProgressPhase));
/** Reconstruct only bounded core facts, never arbitrary child diagnostic text. */
function parseDoctorProgressLine(e) {
if (e.length > 128) return;
const t = /^Doctor: ([A-Za-z ]+)( \(\d{1,10}s elapsed\))?$/u.exec(e);
return t?.[1] && CORE_LABELS.has(t[1]) ? `Doctor: ${t[1]}${t[2] ?? ""}` : void 0;
}
//#endregion
export { parseDoctorProgressLine as n, formatDoctorProgressPhase as t };