fix: table auth probe output

This commit is contained in:
Peter Steinberger
2026-01-24 00:11:01 +00:00
parent 438e782f81
commit da3f2b4898
2 changed files with 31 additions and 25 deletions

View File

@@ -18,6 +18,7 @@ Docs: https://docs.clawd.bot
- CLI: skip usage lines in `clawdbot models status` when provider usage is unavailable. - CLI: skip usage lines in `clawdbot models status` when provider usage is unavailable.
- CLI: suppress diagnostic session/run noise during auth probes. - CLI: suppress diagnostic session/run noise during auth probes.
- CLI: hide auth probe timeout warnings from embedded runs. - CLI: hide auth probe timeout warnings from embedded runs.
- CLI: render auth probe results as a table in `clawdbot models status`.
- Linux: include env-configured user bin roots in systemd PATH and align PATH audits. (#1512) Thanks @robbyczgw-cla. - Linux: include env-configured user bin roots in systemd PATH and align PATH audits. (#1512) Thanks @robbyczgw-cla.
- TUI: render Gateway slash-command replies as system output (for example, `/context`). - TUI: render Gateway slash-command replies as system output (for example, `/context`).
- Media: preserve PNG alpha when possible; fall back to JPEG when still over size cap. (#1491) Thanks @robbyczgw-cla. - Media: preserve PNG alpha when possible; fall back to JPEG when still over size cap. (#1491) Thanks @robbyczgw-cla.

View File

@@ -28,6 +28,7 @@ import {
} from "../../infra/provider-usage.js"; } from "../../infra/provider-usage.js";
import type { RuntimeEnv } from "../../runtime.js"; import type { RuntimeEnv } from "../../runtime.js";
import { colorize, theme } from "../../terminal/theme.js"; import { colorize, theme } from "../../terminal/theme.js";
import { renderTable } from "../../terminal/table.js";
import { formatCliCommand } from "../../cli/command-format.js"; import { formatCliCommand } from "../../cli/command-format.js";
import { shortenHomePath } from "../../utils.js"; import { shortenHomePath } from "../../utils.js";
import { resolveProviderAuthOverview } from "./list.auth-overview.js"; import { resolveProviderAuthOverview } from "./list.auth-overview.js";
@@ -35,7 +36,6 @@ import { isRich } from "./list.format.js";
import { import {
describeProbeSummary, describeProbeSummary,
formatProbeLatency, formatProbeLatency,
groupProbeResults,
runAuthProbes, runAuthProbes,
sortProbeResults, sortProbeResults,
type AuthProbeSummary, type AuthProbeSummary,
@@ -571,7 +571,8 @@ export async function modelsStatusCommand(
if (probeSummary.results.length === 0) { if (probeSummary.results.length === 0) {
runtime.log(colorize(rich, theme.muted, "- none")); runtime.log(colorize(rich, theme.muted, "- none"));
} else { } else {
const grouped = groupProbeResults(sortProbeResults(probeSummary.results)); const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1);
const sorted = sortProbeResults(probeSummary.results);
const statusColor = (status: string) => { const statusColor = (status: string) => {
if (status === "ok") return theme.success; if (status === "ok") return theme.success;
if (status === "rate_limit") return theme.warn; if (status === "rate_limit") return theme.warn;
@@ -580,29 +581,33 @@ export async function modelsStatusCommand(
if (status === "no_model") return theme.muted; if (status === "no_model") return theme.muted;
return theme.muted; return theme.muted;
}; };
for (const [provider, results] of grouped) { const rows = sorted.map((result) => {
const modelLabel = results.find((r) => r.model)?.model ?? "-"; const status = colorize(rich, statusColor(result.status), result.status);
runtime.log( const latency = formatProbeLatency(result.latencyMs);
`- ${theme.heading(provider)}${colorize( const detail = result.error ? colorize(rich, theme.muted, result.error) : "";
rich, const modelLabel = result.model ?? `${result.provider}/-`;
theme.muted, const modeLabel = result.mode ? ` ${colorize(rich, theme.muted, `(${result.mode})`)}` : "";
modelLabel ? ` (model: ${modelLabel})` : "", const profile = `${colorize(rich, theme.accent, result.label)}${modeLabel}`;
)}`, const statusLabel = `${status}${colorize(rich, theme.muted, ` · ${latency}`)}`;
); return {
for (const result of results) { Model: colorize(rich, theme.heading, modelLabel),
const status = colorize(rich, statusColor(result.status), result.status); Profile: profile,
const latency = formatProbeLatency(result.latencyMs); Status: statusLabel,
const mode = result.mode ? ` (${result.mode})` : ""; Detail: detail,
const detail = result.error ? colorize(rich, theme.muted, ` - ${result.error}`) : ""; };
runtime.log( });
` - ${colorize(rich, theme.accent, result.label)}${mode} ${status} ${colorize( runtime.log(
rich, renderTable({
theme.muted, width: tableWidth,
latency, columns: [
)}${detail}`, { key: "Model", header: "Model", minWidth: 18 },
); { key: "Profile", header: "Profile", minWidth: 24 },
} { key: "Status", header: "Status", minWidth: 12 },
} { key: "Detail", header: "Detail", minWidth: 16, flex: true },
],
rows,
}).trimEnd(),
);
runtime.log(colorize(rich, theme.muted, describeProbeSummary(probeSummary))); runtime.log(colorize(rich, theme.muted, describeProbeSummary(probeSummary)));
} }
} }