Files
orcs-code/src/utils/model/antModels.ts
Anandan 2f162af60c Reduce internal-only labeling noise in source comments (#355)
This pass rewrites comment-only ANT-ONLY markers to neutral internal-only
language across the source tree without changing runtime strings, flags,
commands, or protocol identifiers. The goal is to lower obvious internal
prose leakage while keeping the diff mechanically safe and easy to review.

Constraint: Phase B is limited to comments/prose only; runtime strings and user-facing labels remain deferred
Rejected: Broad search-and-replace across strings and command descriptions | too risky for a prose-only pass
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Remaining ANT-ONLY hits are mostly runtime/user-facing strings and should be handled separately from comment cleanup
Tested: bun run build
Tested: bun run smoke
Tested: bun run verify:privacy
Tested: bun run test:provider
Tested: bun run test:provider-recommendation
Not-tested: Full repo typecheck (upstream baseline remains noisy)

Co-authored-by: anandh8x <test@example.com>
2026-04-04 23:26:14 +05:30

65 lines
1.8 KiB
TypeScript

import { getFeatureValue_CACHED_MAY_BE_STALE } from 'src/services/analytics/growthbook.js'
import type { EffortLevel } from '../effort.js'
export type AntModel = {
alias: string
model: string
label: string
description?: string
defaultEffortValue?: number
defaultEffortLevel?: EffortLevel
contextWindow?: number
defaultMaxTokens?: number
upperMaxTokensLimit?: number
/** Model defaults to adaptive thinking and rejects `thinking: { type: 'disabled' }`. */
alwaysOnThinking?: boolean
}
export type AntModelSwitchCalloutConfig = {
modelAlias?: string
description: string
version: string
}
export type AntModelOverrideConfig = {
defaultModel?: string
defaultModelEffortLevel?: EffortLevel
defaultSystemPromptSuffix?: string
antModels?: AntModel[]
switchCallout?: AntModelSwitchCalloutConfig
}
// @[MODEL LAUNCH]: Update tengu_ant_model_override with new internal-only models
// @[MODEL LAUNCH]: Add the codename to scripts/excluded-strings.txt to prevent it from leaking to external builds.
export function getAntModelOverrideConfig(): AntModelOverrideConfig | null {
if (process.env.USER_TYPE !== 'ant') {
return null
}
return getFeatureValue_CACHED_MAY_BE_STALE<AntModelOverrideConfig | null>(
'tengu_ant_model_override',
null,
)
}
export function getAntModels(): AntModel[] {
if (process.env.USER_TYPE !== 'ant') {
return []
}
return getAntModelOverrideConfig()?.antModels ?? []
}
export function resolveAntModel(
model: string | undefined,
): AntModel | undefined {
if (process.env.USER_TYPE !== 'ant') {
return undefined
}
if (model === undefined) {
return undefined
}
const lower = model.toLowerCase()
return getAntModels().find(
m => m.alias === model || lower.includes(m.model.toLowerCase()),
)
}