fix: per-provider health checks in /llm/providers and status display
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / package (pull_request) Has been cancelled

The /llm/providers endpoint now runs isAvailable() on each provider in
parallel and returns health status per provider. The status command shows
✓/✗ per provider based on actual availability, not just the fast tier.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-25 02:25:06 +00:00
parent 78a1dc9c8a
commit 39ca134201
2 changed files with 44 additions and 14 deletions

View File

@@ -17,6 +17,7 @@ const CLEAR_LINE = '\x1b[2K\r';
interface ProvidersInfo {
providers: string[];
tiers: { fast: string[]; heavy: string[] };
health: Record<string, boolean>;
}
export interface StatusCommandDeps {
@@ -234,13 +235,17 @@ export function createStatusCommand(deps?: Partial<StatusCommandDeps>): Command
clearInterval(interval);
if (providersInfo && (providersInfo.tiers.fast.length > 0 || providersInfo.tiers.heavy.length > 0)) {
// Tiered display
// Tiered display with per-provider health
write(`${CLEAR_LINE}`);
if (providersInfo.tiers.fast.length > 0) {
log(`LLM (fast): ${providersInfo.tiers.fast.join(', ')} ${GREEN}${RESET}`);
}
if (providersInfo.tiers.heavy.length > 0) {
log(`LLM (heavy): ${providersInfo.tiers.heavy.join(', ')} ${GREEN}${RESET}`);
for (const tier of ['fast', 'heavy'] as const) {
const names = providersInfo.tiers[tier];
if (names.length === 0) continue;
const label = tier === 'fast' ? 'LLM (fast): ' : 'LLM (heavy):';
const parts = names.map((n) => {
const ok = providersInfo.health[n];
return ok ? `${n} ${GREEN}${RESET}` : `${n} ${RED}${RESET}`;
});
log(`${label} ${parts.join(', ')}`);
}
} else {
// Legacy single provider display
@@ -258,11 +263,15 @@ export function createStatusCommand(deps?: Partial<StatusCommandDeps>): Command
const [llmStatus, models, providersInfo] = await Promise.all([llmPromise, modelsPromise, providersPromise]);
if (providersInfo && (providersInfo.tiers.fast.length > 0 || providersInfo.tiers.heavy.length > 0)) {
if (providersInfo.tiers.fast.length > 0) {
log(`LLM (fast): ${providersInfo.tiers.fast.join(', ')}`);
}
if (providersInfo.tiers.heavy.length > 0) {
log(`LLM (heavy): ${providersInfo.tiers.heavy.join(', ')}`);
for (const tier of ['fast', 'heavy'] as const) {
const names = providersInfo.tiers[tier];
if (names.length === 0) continue;
const label = tier === 'fast' ? 'LLM (fast): ' : 'LLM (heavy):';
const parts = names.map((n) => {
const ok = providersInfo.health[n];
return ok ? `${n}` : `${n}`;
});
log(`${label} ${parts.join(', ')}`);
}
} else {
if (llmStatus === 'ok' || llmStatus === 'ok (key stored)') {