MCPcopy
hub / github.com/codeaashu/claude-code / getMergedBetas

Function getMergedBetas

src/utils/betas.ts:397–428  ·  view source on GitHub ↗
(
  model: string,
  options?: { isAgenticQuery?: boolean },
)

Source from the content-addressed store, hash-verified

395 * non-agentic calls (compaction, classifiers, token estimation) don't need them.
396 */
397export function getMergedBetas(
398 model: string,
399 options?: { isAgenticQuery?: boolean },
400): string[] {
401 const baseBetas = [...getModelBetas(model)]
402
403 // Agentic queries always need claude-code and cli-internal beta headers.
404 // For non-Haiku models these are already in baseBetas; for Haiku they're
405 // excluded by getAllModelBetas() since non-agentic Haiku calls don't need them.
406 if (options?.isAgenticQuery) {
407 if (!baseBetas.includes(CLAUDE_CODE_20250219_BETA_HEADER)) {
408 baseBetas.push(CLAUDE_CODE_20250219_BETA_HEADER)
409 }
410 if (
411 process.env.USER_TYPE === 'ant' &&
412 process.env.CLAUDE_CODE_ENTRYPOINT === 'cli' &&
413 CLI_INTERNAL_BETA_HEADER &&
414 !baseBetas.includes(CLI_INTERNAL_BETA_HEADER)
415 ) {
416 baseBetas.push(CLI_INTERNAL_BETA_HEADER)
417 }
418 }
419
420 const sdkBetas = getSdkBetas()
421
422 if (!sdkBetas || sdkBetas.length === 0) {
423 return baseBetas
424 }
425
426 // Merge SDK betas without duplicates (already filtered by filterAllowedSdkBetas)
427 return [...baseBetas, ...sdkBetas.filter(b => !baseBetas.includes(b))]
428}
429
430export function clearBetasCaches(): void {
431 getAllModelBetas.cache?.clear?.()

Callers 2

queryModelFunction · 0.85

Calls 2

getSdkBetasFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected