Skip to content

Commit 48a19b8

Browse files
Evsdrgdeepseek-v4-pro[1m]
andauthored
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>
1 parent 5157b09 commit 48a19b8

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/utils/auth.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,12 +1724,29 @@ export function getSubscriptionName(): string {
17241724
}
17251725
}
17261726

1727-
/** Check if using third-party services (Bedrock or Vertex or Foundry) */
1727+
/**
1728+
* Check if using third-party services (non-Anthropic providers).
1729+
*
1730+
* This function gates several behaviours that should only apply when the user
1731+
* is NOT calling the first-party Anthropic API directly:
1732+
* - auth status display (authStatus handler)
1733+
* - command visibility (login/logout shown for non-3P)
1734+
* - command availability checks (meetsAvailabilityRequirement)
1735+
*
1736+
* KEEP IN SYNC with providers.ts — when a new CLAUDE_CODE_USE_* env var is
1737+
* added to getAPIProvider(), the corresponding check MUST be added here.
1738+
* Providers whose selection is controlled purely via settings.modelType
1739+
* (rather than env vars) are NOT covered by this function and may need
1740+
* separate handling in the call sites above.
1741+
*/
17281742
export function isUsing3PServices(): boolean {
17291743
return !!(
17301744
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
17311745
isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ||
1732-
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY)
1746+
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ||
1747+
isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) ||
1748+
isEnvTruthy(process.env.CLAUDE_CODE_USE_GEMINI) ||
1749+
isEnvTruthy(process.env.CLAUDE_CODE_USE_GROK)
17331750
)
17341751
}
17351752

0 commit comments

Comments
 (0)