fix: table auth probe output
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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 ?? "-";
|
|
||||||
runtime.log(
|
|
||||||
`- ${theme.heading(provider)}${colorize(
|
|
||||||
rich,
|
|
||||||
theme.muted,
|
|
||||||
modelLabel ? ` (model: ${modelLabel})` : "",
|
|
||||||
)}`,
|
|
||||||
);
|
|
||||||
for (const result of results) {
|
|
||||||
const status = colorize(rich, statusColor(result.status), result.status);
|
const status = colorize(rich, statusColor(result.status), result.status);
|
||||||
const latency = formatProbeLatency(result.latencyMs);
|
const latency = formatProbeLatency(result.latencyMs);
|
||||||
const mode = result.mode ? ` (${result.mode})` : "";
|
const detail = result.error ? colorize(rich, theme.muted, result.error) : "";
|
||||||
const detail = result.error ? colorize(rich, theme.muted, ` - ${result.error}`) : "";
|
const modelLabel = result.model ?? `${result.provider}/-`;
|
||||||
|
const modeLabel = result.mode ? ` ${colorize(rich, theme.muted, `(${result.mode})`)}` : "";
|
||||||
|
const profile = `${colorize(rich, theme.accent, result.label)}${modeLabel}`;
|
||||||
|
const statusLabel = `${status}${colorize(rich, theme.muted, ` · ${latency}`)}`;
|
||||||
|
return {
|
||||||
|
Model: colorize(rich, theme.heading, modelLabel),
|
||||||
|
Profile: profile,
|
||||||
|
Status: statusLabel,
|
||||||
|
Detail: detail,
|
||||||
|
};
|
||||||
|
});
|
||||||
runtime.log(
|
runtime.log(
|
||||||
` - ${colorize(rich, theme.accent, result.label)}${mode} ${status} ${colorize(
|
renderTable({
|
||||||
rich,
|
width: tableWidth,
|
||||||
theme.muted,
|
columns: [
|
||||||
latency,
|
{ key: "Model", header: "Model", minWidth: 18 },
|
||||||
)}${detail}`,
|
{ 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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user