fix: count claude-code as configured when the CLI is installed

This commit is contained in:
Ivanko1608
2026-10-25 02:16:51 +04:00
parent 49181a1a8d
commit 43d7ec5577
2 changed files with 63 additions and 11 deletions
+9 -4
View File
@@ -43,6 +43,7 @@ import type {
} from "../core/contracts/models.ts";
import type { EffectiveModelSpec, EffectiveSlot } from "../core/settings-resolution.ts";
import { AUTH_PROVIDER_KEYS } from "../core/auth-keys.ts";
import { getClaudeBinary } from "../agent/claude-code/binary.ts";
import { CLAUDE_CODE_PROVIDER } from "../agent/claude-code/constants.ts";
import { BACKGROUND_MODEL_ROLES, MODEL_SLOTS, type BackgroundModelRole, type ModelSlotName, type ModelsSettings } from "../core/settings.ts";
@@ -135,15 +136,19 @@ export function catalogProviders(): CatalogProvider[] {
id: p.id,
envVar: p.envVar,
keyPresent: keyValue(p.envVar) !== undefined,
})).concat([{ id: "chatgpt", envVar: "", keyPresent: chatGPTConnected() }]).sort((a, b) => a.id.localeCompare(b.id));
}))
.concat([
{ id: "chatgpt", envVar: "", keyPresent: chatGPTConnected() },
{ id: CLAUDE_CODE_PROVIDER, envVar: "", keyPresent: getClaudeBinary() !== null },
])
.sort((a, b) => a.id.localeCompare(b.id));
}
/** The providers whose key is present — the picker federates exactly
* these (a keyless provider's models are unreachable by design; the
* Keys page is the discovery surface, same discipline as search), plus
* claude-code, which runs on the local CLI's subscription and takes no key. */
* Keys page is the discovery surface, same discipline as search). */
function keyedProviderIds(): Set<string> {
return new Set([...catalogProviders().filter((p) => p.keyPresent).map((p) => p.id), CLAUDE_CODE_PROVIDER]);
return new Set(catalogProviders().filter((p) => p.keyPresent).map((p) => p.id));
}
/** Project one catalog model to the client DTO. */