fix: isUsing3PServices 检查所有非 Anthropic provider (#1235)

原实现仅检查 Bedrock/Vertex/Foundry,遗漏了 OpenAI、Gemini、Grok
三个通过 CLAUDE_CODE_USE_* 环境变量切换的第三方 provider。

这导致:
- 命令可用性判定中 OpenAI/Gemini/Grok 用户被错误识别为 console 用户
  (/fast、/install-github-app 两个 Anthropic 专有命令误显示)
- auth status 显示中这些用户被误报为"未登录"

Co-authored-by: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
This commit is contained in:
Cepvor
2026-05-17 07:29:14 +08:00
committed by GitHub
parent 5157b09743
commit 48a19b8a0d

View File

@@ -1724,12 +1724,29 @@ export function getSubscriptionName(): string {
}
}
/** Check if using third-party services (Bedrock or Vertex or Foundry) */
/**
* Check if using third-party services (non-Anthropic providers).
*
* This function gates several behaviours that should only apply when the user
* is NOT calling the first-party Anthropic API directly:
* - auth status display (authStatus handler)
* - command visibility (login/logout shown for non-3P)
* - command availability checks (meetsAvailabilityRequirement)
*
* KEEP IN SYNC with providers.ts — when a new CLAUDE_CODE_USE_* env var is
* added to getAPIProvider(), the corresponding check MUST be added here.
* Providers whose selection is controlled purely via settings.modelType
* (rather than env vars) are NOT covered by this function and may need
* separate handling in the call sites above.
*/
export function isUsing3PServices(): boolean {
return !!(
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY)
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_GEMINI) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_GROK)
)
}