UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

26 lines (25 loc) • 1.02 kB
import { o as normalizeLowercaseStringOrEmpty } from "./string-coerce-1VuiLaaR.mjs"; import { r as theme } from "./theme-DzaUZY4q.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(line, rich) { if (!rich) return line; const colon = line.indexOf(":"); if (colon === -1) return line; const detail = line.slice(colon + 1).trimStart(); const normalized = normalizeLowercaseStringOrEmpty(detail.slice(0, 14)); for (const [prefix, color] of HEALTH_STATUS_COLORS) if (normalized.startsWith(prefix)) return `${line.slice(0, colon + 1)} ${theme[color](detail.slice(0, prefix.length))}${detail.slice(prefix.length)}`; return line; } //#endregion export { styleHealthChannelLine as t };