|
| 1 | +/** Collects and renders gateway health for channels, agents, plugins, and sessions. */ |
1 | 2 | import { resolveTimerTimeoutMs } from "@openclaw/normalization-core/number-coercion"; |
2 | 3 | import { asNullableRecord } from "@openclaw/normalization-core/record-coerce"; |
3 | 4 | import { styleHealthChannelLine } from "../../packages/terminal-core/src/health-style.js"; |
@@ -101,6 +102,8 @@ const buildNonSensitiveProbeFailure = ( |
101 | 102 | return undefined; |
102 | 103 | } |
103 | 104 |
|
| 105 | + // Preserve the actionable Full Disk Access failure while stripping the local |
| 106 | + // username path before health leaves the gateway. |
104 | 107 | const error = redactIMessageProbeErrorMessage(record.error); |
105 | 108 | if ( |
106 | 109 | !/\bimsg\b/i.test(error) || |
@@ -155,6 +158,7 @@ function formatEventLoopHealthLine(summary: HealthSummary): string | null { |
155 | 158 | }`; |
156 | 159 | } |
157 | 160 |
|
| 161 | +/** Formats optional model-pricing cache degradation for text health output. */ |
158 | 162 | export function formatModelPricingHealthLine(summary: HealthSummary): string | null { |
159 | 163 | const modelPricing = summary.modelPricing; |
160 | 164 | if (!modelPricing || modelPricing.state === "disabled") { |
@@ -184,6 +188,7 @@ function buildContextEngineHealthSummary(): ContextEngineHealthSummary | undefin |
184 | 188 | return quarantined.length > 0 ? { quarantined } : undefined; |
185 | 189 | } |
186 | 190 |
|
| 191 | +/** Formats context engine quarantine state for text health output. */ |
187 | 192 | export function formatContextEngineHealthLine(summary: HealthSummary): string | null { |
188 | 193 | const quarantined = summary.contextEngines?.quarantined ?? []; |
189 | 194 | if (quarantined.length === 0) { |
@@ -403,6 +408,7 @@ async function resolveHealthAccountContext(params: { |
403 | 408 | }; |
404 | 409 | } |
405 | 410 |
|
| 411 | +/** Builds the gateway-side health snapshot for channels, agents, plugins, and sessions. */ |
406 | 412 | export async function getHealthSnapshot(params?: { |
407 | 413 | timeoutMs?: number; |
408 | 414 | probe?: boolean; |
@@ -471,6 +477,8 @@ export async function getHealthSnapshot(params?: { |
471 | 477 | ), |
472 | 478 | ), |
473 | 479 | ); |
| 480 | + // Probe preferred/default/bound accounts first, but include all configured |
| 481 | + // accounts so verbose health can explain account-specific failures. |
474 | 482 | debugHealth("channel", { |
475 | 483 | id: plugin.id, |
476 | 484 | accountIds, |
@@ -623,6 +631,7 @@ export async function getHealthSnapshot(params?: { |
623 | 631 | return summary; |
624 | 632 | } |
625 | 633 |
|
| 634 | +/** Runs the `openclaw health` command against the gateway and renders JSON or text. */ |
626 | 635 | export async function healthCommand( |
627 | 636 | opts: { |
628 | 637 | json?: boolean; |
|
0 commit comments