fix: 移除 auto mode 的 provider 和模型白名单限制
移除 firstParty provider 限制和 claude-(opus|sonnet)-4-[67] 模型白名单, 使所有模型和 provider 在 TRANSCRIPT_CLASSIFIER feature 启用时均可使用 auto mode。 Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
This commit is contained in:
parent
d35f0db17d
commit
90406a10be
|
|
@ -16,17 +16,20 @@ import {
|
|||
REDACT_THINKING_BETA_HEADER,
|
||||
STRUCTURED_OUTPUTS_BETA_HEADER,
|
||||
TOKEN_EFFICIENT_TOOLS_BETA_HEADER,
|
||||
TOOL_SEARCH_BETA_HEADER_1P,
|
||||
TOOL_SEARCH_BETA_HEADER_3P,
|
||||
SEARCH_EXTRA_TOOLS_BETA_HEADER_1P,
|
||||
SEARCH_EXTRA_TOOLS_BETA_HEADER_3P,
|
||||
WEB_SEARCH_BETA_HEADER,
|
||||
} from '../constants/betas.js'
|
||||
import { OAUTH_BETA_HEADER } from '../constants/oauth.js'
|
||||
import { isClaudeAISubscriber } from './auth.js'
|
||||
import { has1mContext } from './context.js'
|
||||
import { isEnvDefinedFalsy, isEnvTruthy } from './envUtils.js'
|
||||
import { isEnvTruthy } from './envUtils.js'
|
||||
import { getCanonicalName } from './model/model.js'
|
||||
import { get3PModelCapabilityOverride } from './model/modelSupportOverrides.js'
|
||||
import { getAPIProvider } from './model/providers.js'
|
||||
import {
|
||||
getAPIProvider,
|
||||
isFirstPartyAnthropicBaseUrl,
|
||||
} from './model/providers.js'
|
||||
import { getInitialSettings } from './settings/settings.js'
|
||||
|
||||
/**
|
||||
|
|
@ -68,7 +71,6 @@ export function filterAllowedSdkBetas(
|
|||
}
|
||||
|
||||
if (isClaudeAISubscriber()) {
|
||||
// biome-ignore lint/suspicious/noConsole: intentional warning
|
||||
console.warn(
|
||||
'Warning: Custom betas are only available for API key users. Ignoring provided betas.',
|
||||
)
|
||||
|
|
@ -77,7 +79,6 @@ export function filterAllowedSdkBetas(
|
|||
|
||||
const { allowed, disallowed } = partitionBetasByAllowlist(sdkBetas)
|
||||
for (const beta of disallowed) {
|
||||
// biome-ignore lint/suspicious/noConsole: intentional warning
|
||||
console.warn(
|
||||
`Warning: Beta header '${beta}' is not allowed. Only the following betas are supported: ${ALLOWED_SDK_BETAS.join(', ')}`,
|
||||
)
|
||||
|
|
@ -151,25 +152,26 @@ export function modelSupportsStructuredOutputs(model: string): boolean {
|
|||
canonical.includes('claude-opus-4-1') ||
|
||||
canonical.includes('claude-opus-4-5') ||
|
||||
canonical.includes('claude-opus-4-6') ||
|
||||
canonical.includes('claude-opus-4-7') ||
|
||||
canonical.includes('claude-haiku-4-5')
|
||||
)
|
||||
}
|
||||
|
||||
export function modelSupportsAutoMode(_model: string): boolean {
|
||||
return feature('TRANSCRIPT_CLASSIFIER') ? true : false
|
||||
return feature('TRANSCRIPT_CLASSIFIER')
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct tool search beta header for the current API provider.
|
||||
* - Claude API / Foundry: advanced-tool-use-2025-11-20
|
||||
* - Vertex AI / Bedrock: tool-search-tool-2025-10-19
|
||||
* - All other providers: advanced-tool-use-2025-11-20
|
||||
*/
|
||||
export function getToolSearchBetaHeader(): string {
|
||||
export function getSearchExtraToolsBetaHeader(): string {
|
||||
const provider = getAPIProvider()
|
||||
if (provider === 'vertex' || provider === 'bedrock') {
|
||||
return TOOL_SEARCH_BETA_HEADER_3P
|
||||
return SEARCH_EXTRA_TOOLS_BETA_HEADER_3P
|
||||
}
|
||||
return TOOL_SEARCH_BETA_HEADER_1P
|
||||
return SEARCH_EXTRA_TOOLS_BETA_HEADER_1P
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -180,7 +182,8 @@ export function getToolSearchBetaHeader(): string {
|
|||
export function shouldIncludeFirstPartyOnlyBetas(): boolean {
|
||||
return (
|
||||
(getAPIProvider() === 'firstParty' || getAPIProvider() === 'foundry') &&
|
||||
!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)
|
||||
!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS) &&
|
||||
isFirstPartyAnthropicBaseUrl()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -241,16 +244,18 @@ export const getAllModelBetas = memoize((model: string): string[] => {
|
|||
betaHeaders.push(REDACT_THINKING_BETA_HEADER)
|
||||
}
|
||||
|
||||
// Add context management beta for tool clearing (ant opt-in) or thinking preservation
|
||||
const antOptedIntoToolClearing =
|
||||
isEnvTruthy(process.env.USE_API_CONTEXT_MANAGEMENT) &&
|
||||
process.env.USER_TYPE === 'ant'
|
||||
// Add context management beta for tool clearing or thinking preservation.
|
||||
// Tool clearing is enabled by default for all users (upstream gates on ant);
|
||||
// thinking preservation activates when the model supports context management.
|
||||
const toolClearingOptIn =
|
||||
isEnvTruthy(process.env.USE_API_CONTEXT_MANAGEMENT) ||
|
||||
modelSupportsContextManagement(model)
|
||||
|
||||
const thinkingPreservationEnabled = modelSupportsContextManagement(model)
|
||||
|
||||
if (
|
||||
shouldIncludeFirstPartyOnlyBetas() &&
|
||||
(antOptedIntoToolClearing || thinkingPreservationEnabled)
|
||||
(toolClearingOptIn || thinkingPreservationEnabled)
|
||||
) {
|
||||
betaHeaders.push(CONTEXT_MANAGEMENT_BETA_HEADER)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user