openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
26 lines (25 loc) • 915 B
JavaScript
import { o as normalizeLowercaseStringOrEmpty } from "./string-coerce-CCIiB4H7.mjs";
import { r as theme } from "./theme-BOI0xyRZ.mjs";
//#region packages/terminal-core/src/health-style.ts
const HEALTH_STATUS_COLORS = [
["failed", "error"],
["degraded", "warn"],
["ok", "success"],
["linked", "success"],
["configured", "success"],
["not linked", "warn"],
["not configured", "muted"],
["unknown", "warn"]
];
/** Highlight known health status prefixes in a "label: detail" line. */
function styleHealthChannelLine(e, t) {
if (!t) return e;
const n = e.indexOf(":");
if (n === -1) return e;
const r = e.slice(n + 1).trimStart();
const i = normalizeLowercaseStringOrEmpty(r.slice(0, 14));
for (const [t, a] of HEALTH_STATUS_COLORS) if (i.startsWith(t)) return `${e.slice(0, n + 1)} ${theme[a](r.slice(0, t.length))}${r.slice(t.length)}`;
return e;
}
//#endregion
export { styleHealthChannelLine as t };