Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/importtype{ LanguageModelChat }from'vscode';import{ getCachedSha256Hash }from'../../../util/common/crypto';import{ ConfigKey, IConfigurationService }from'../../configuration/common/configurationService';importtype{ IChatEndpoint }from'../../networking/common/networking';constHIDDEN_MODEL_A_HASHES=['a99dd17dfee04155d863268596b7f6dd36d0a6531cd326348dbe7416142a21a3','6b0f165d0590bf8d508540a796b4fda77bf6a0a4ed4e8524d5451b1913100a95'];constHIDDEN_MODEL_B_HASHES=['1f48b3271e760c69ab2b17dcae5f5c661fa5b644c5976a8a99b23e05ae3cb6d6','ffc50c70661c227edf8daae6f8dbed2dd0645386c12d43bc7fc44da166e043bd'
family
modelId
configurationService IConfigurationService
IModelCapabilityOverride
map configurationServiceConfigKeyAdvancedModelCapabilityOverrides
mapmodelId
model LanguageModelChat IChatEndpoint
model modelid modelmodel
model LanguageModelChat IChatEndpoint
h modelfamily
h
model LanguageModelChat IChatEndpoint
h model model modelfamily
h
model LanguageModelChat IChatEndpoint
h modelfamily
h
model LanguageModelChat IChatEndpoint
h modelfamily
h
model LanguageModelChat IChatEndpoint
family_hash modelfamily
family_hash
model LanguageModelChat IChatEndpoint
h modelfamily
h
family prefix
family prefix family
model LanguageModelChat IChatEndpoint
h model model modelfamily
family model model modelfamily
family h
model LanguageModelChat IChatEndpoint
h model model modelfamily
family model model modelfamily
family h
model LanguageModelChat IChatEndpoint
family model model modelfamily
family
model LanguageModelChat IChatEndpoint
family model model modelfamily
family
model LanguageModelChat IChatEndpoint
matches value
normalized value
normalized normalized normalized
model
model
modelfamily model
model LanguageModelChat IChatEndpoint
ID_hash model
family_hash modelfamily
ID_hash family_hash
model LanguageModelChat IChatEndpoint
ID_hash model
family_hash modelfamily
ID_hash family_hash
model LanguageModelChat IChatEndpoint
ID_hash model
family_hash modelfamily
ID_hash family_hash
model LanguageModelChat IChatEndpoint
ID_hash model
family_hash modelfamily
ID_hash family_hash
model LanguageModelChat IChatEndpoint
ID_hash model
family_hash modelfamily
ID_hash family_hash
model LanguageModelChat IChatEndpoint
modelId model
ID_hash modelId
family_hash modelfamily
modelname modelfamily modelId ID_hash family_hash
model LanguageModelChat IChatEndpoint
family model model modelfamily
family
model LanguageModelChat IChatEndpoint
family model model modelfamily
family
modelFamily
modelFamily
modelFamily
modelFamily
model LanguageModelChat IChatEndpoint
model
modelfamily modelfamily
modelfamily
modelfamily
modelfamily
model
model
modelfamily
model
model
model
model LanguageModelChat IChatEndpoint
modelfamily modelfamily
modelfamily
modelfamily
modelfamily
modelfamily
model
model
model
model LanguageModelChat IChatEndpoint
model model model model model model model
model LanguageModelChat IChatEndpoint
model model model model model model model
model LanguageModelChat IChatEndpoint
model model model modelfamily model model model model model
model LanguageModelChat IChatEndpoint
modelfamily
model LanguageModelChat IChatEndpoint
model model
model LanguageModelChat IChatEndpoint
model LanguageModelChat IChatEndpoint
model model model
model LanguageModelChat IChatEndpoint
model
model LanguageModelChat IChatEndpoint
model
model model model
model LanguageModelChat IChatEndpoint
model model
model LanguageModelChat IChatEndpoint
model model model
model LanguageModelChat IChatEndpoint
modelfamily modelfamily
model LanguageModelChat IChatEndpoint
family model model modelfamily
family family
model LanguageModelChat IChatEndpoint
modelfamily
model LanguageModelChat IChatEndpoint
modelfamily
model LanguageModelChat IChatEndpoint
model
family model model modelfamily
family
model LanguageModelChat IChatEndpoint
model
family model model modelfamily
family family
model LanguageModelChat IChatEndpoint
model
family model model modelfamily
family family family
model LanguageModelChat IChatEndpoint
model
family model model modelfamily
family
model LanguageModelChat IChatEndpoint
model
family model model modelfamily
family
model PickIChatEndpoint
family modelfamily
family family modelmodelProvider
model IChatEndpoint responsesApiVerbosityEnabled
modelfamily modelfamily model responsesApiVerbosityEnabled
model LanguageModelChat IChatEndpoint
id model model model
family model model modelfamily
isGpt56Model model
s
n s
n n isGpt56Model
n
isPre45
n
n
n
n n
n n n
isPre45
id family
model LanguageModelChat IChatEndpoint
id model model model
family model model modelfamily
s s
normalizedId id
normalizedFamily family
normalizedId normalizedFamily
n
n
n
n
n
n
n
n
n
n
n
n
normalizedId normalizedFamily
/**
* Per-model capability override. Lets advanced users (and evals) alias an
* unknown/preview model id to a known production family for capability
* routing. Read once per endpoint in `ChatEndpoint`'s constructor from the
* `chat.modelCapabilityOverrides` setting; the aliased family flows through
* every family-prefix-based heuristic (Anthropic family detection, prompt
* resolver, multi-replace tools, tool search, context editing, extended
* cache TTL, memory, PDF support, …).
*
* The model id on the wire is unaffected; only our local capability layer
* sees the alias.
*/
export
interface
IModelCapabilityOverride
{
/**
* Alias the model's family for capability routing (e.g. set to
* `"claude-opus-4.7"` to make a preview model receive every Anthropic
* Claude Opus 4.7 capability).
*/
?
:
string
;
}
/**
* Returns the capability override (if any) for the given model id, read
* from the `chat.modelCapabilityOverrides` setting.
*/
export
function
getModelCapabilityOverride
(
:
string
,
:
,
)
:
|
undefined
{
const
=
.
getConfig
(
.
.
)
;
return
?.
[
]
;
}
export
function
getModelId
(
:
|
)
:
string
{
return
'id'
in
?
.
:
.
;
}
export
function
isHiddenModelA
(
:
|
)
{
const
=
getCachedSha256Hash
(
.
)
;
return
HIDDEN_MODEL_A_HASHES
.
includes
(
)
;
}
export
function
isHiddenModelB
(
:
|
|
string
)
{
const
=
getCachedSha256Hash
(
typeof
===
'string'
?
:
.
)
;
return
HIDDEN_MODEL_B_HASHES
.
includes
(
)
;
}
export
function
isHiddenModelE
(
:
|
)
{
const
=
getCachedSha256Hash
(
.
)
;
return
HIDDEN_MODEL_E_HASHES
.
includes
(
)
;
}
export
function
isHiddenModelF
(
:
|
)
{
const
=
getCachedSha256Hash
(
.
)
;
return
HIDDEN_MODEL_F_HASHES
.
includes
(
)
;
}
export
function
isHiddenFamilyH
(
:
|
)
{
const
=
getCachedSha256Hash
(
.
)
;
return
HIDDEN_FAMILY_H_HASHES
.
includes
(
)
;
}
export
function
isHiddenModelK
(
:
|
)
{
const
=
getCachedSha256Hash
(
.
)
;
return
===
HIDDEN_MODEL_K_HASH
;
}
function
matchesGptModelFamily
(
:
string
,
:
string
)
:
boolean
{
return
===
||
.
startsWith
(
`${prefix}-`
)
;
}
export
function
isGpt54
(
:
|
|
string
)
{
const
=
getCachedSha256Hash
(
typeof
===
'string'
?
:
.
)
;
const
=
typeof
===
'string'
?
:
.
;
return
matchesGptModelFamily
(
,
'gpt-5.4'
)
||
HIDDEN_MODEL_J_HASHES
.
includes
(
)
;
}
export
function
isGpt55
(
:
|
|
string
)
{
const
=
getCachedSha256Hash
(
typeof
===
'string'
?
:
.
)
;
const
=
typeof
===
'string'
?
:
.
;
return
matchesGptModelFamily
(
,
'gpt-5.5'
)
||
HIDDEN_MODEL_B_HASHES
.
includes
(
)
;
}
export
function
isGpt56
(
:
|
|
string
)
{
const
=
typeof
===
'string'
?
:
.
;
return
matchesGptModelFamily
(
,
'gpt-5.6'
)
;
}
export
function
isGpt53Codex
(
:
|
|
string
)
{
const
=
typeof
===
'string'
?
:
.
;
return
matchesGptModelFamily
(
,
'gpt-5.3-codex'
)
;
}
export
function
isKimiFamily
(
:
|
|
string
)
:
boolean
{
const
=
(
:
string
)
:
boolean
=>
{
const
=
.
toLowerCase
(
)
;
return
.
includes
(
'kimi-k2.6'
)
||
.
includes
(
'kimi-k2.7-code'
)
||
.
includes
(
'kimi-k3'
)
;
}
;
if
(
typeof
===
'string'
)
{
return
matches
(
)
;
}
return
matches
(
.
)
||
matches
(
getModelId
(
)
)
;
}
export
function
isVSCModelA
(
:
|
)
{
const
=
getCachedSha256Hash
(
getModelId
(
)
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
VSC_MODEL_HASHES_A
.
includes
(
)
||
VSC_MODEL_HASHES_A
.
includes
(
)
;
}
export
function
isVSCModelB
(
:
|
)
{
const
=
getCachedSha256Hash
(
getModelId
(
)
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
VSC_MODEL_HASHES_B
.
includes
(
)
||
VSC_MODEL_HASHES_B
.
includes
(
)
;
}
export
function
isVSCModelReplaceStringSet
(
:
|
)
{
const
=
getCachedSha256Hash
(
getModelId
(
)
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
VSC_MODEL_HASHES_EDIT_TOOL_SET
.
includes
(
)
||
VSC_MODEL_HASHES_EDIT_TOOL_SET
.
includes
(
)
;
}
export
function
isVSCModelC
(
:
|
)
{
const
=
getCachedSha256Hash
(
getModelId
(
)
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
VSC_MODEL_HASHES_C
.
includes
(
)
||
VSC_MODEL_HASHES_C
.
includes
(
)
;
}
export
function
isVSCModelD
(
:
|
)
{
const
=
getCachedSha256Hash
(
getModelId
(
)
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
VSC_MODEL_HASHES_D
.
includes
(
)
||
VSC_MODEL_HASHES_D
.
includes
(
)
;
}
export
function
isVSCModelE
(
:
|
)
{
const
=
getModelId
(
)
;
const
=
getCachedSha256Hash
(
)
;
const
=
getCachedSha256Hash
(
.
)
;
return
.
.
startsWith
(
'vscModelE'
)
||
.
.
startsWith
(
'vscModelE'
)
||
.
startsWith
(
'vscModelE'
)
||
VSC_MODEL_HASHES_E
.
includes
(
)
||
VSC_MODEL_HASHES_E
.
includes
(
)
;
}
export
function
isGpt52CodexFamily
(
:
|
|
string
)
:
boolean
{
const
=
typeof
===
'string'
?
:
.
;
return
===
'gpt-5.2-codex'
;
}
export
function
isGpt52Family
(
:
|
|
string
)
:
boolean
{
const
=
typeof
===
'string'
?
:
.
;
return
===
'gpt-5.2'
;
}
/**
* Returns whether the instructions should be given in a user message instead
* of a system message when talking to the model.
*/
export
function
modelPrefersInstructionsInUserMessage
(
:
string
)
{
return
.
includes
(
'claude-3.5-sonnet'
)
;
}
/**
* Returns whether the instructions should be presented after the history
* for the given model.
*/
export
function
modelPrefersInstructionsAfterHistory
(
:
string
)
{
return
.
includes
(
'claude-3.5-sonnet'
)
;
}
/**
* Model supports apply_patch as an edit tool.
*/
export
function
modelSupportsApplyPatch
(
:
|
)
:
boolean
{
// only using replace string as edit tool, disable apply_patch for VSC Models
if
(
isVSCModelReplaceStringSet
(
)
)
{
return
false
;
}
return
(
.
.
startsWith
(
'gpt'
)
&&
!
.
.
includes
(
'gpt-4o'
)
)
||
.
===
'o4-mini'
||
isGpt52CodexFamily
(
.
)
||
isGpt53Codex
(
.
)
||
isVSCModelA
(
)
||
isVSCModelB
(
)
||
isGpt52Family
(
.
)
||
isGpt54
(
)
||
isHiddenModelB
(
)
||
isGpt56
(
)
;
}
/**
* Model prefers JSON notebook representation.
*/
export
function
modelPrefersJsonNotebookRepresentation
(
:
|
)
:
boolean
{
return
(
.
.
startsWith
(
'gpt'
)
&&
!
.
.
includes
(
'gpt-4o'
)
)
||
.
===
'o4-mini'
||
isGpt52CodexFamily
(
.
)
||
isGpt53Codex
(
.
)
||
isGpt52Family
(
.
)
||
isGpt54
(
)
||
isHiddenModelB
(
)
||
isGpt56
(
)
;
}
/**
* Model supports replace_string_in_file as an edit tool.
*/
export
function
modelSupportsReplaceString
(
:
|
)
:
boolean
{
return
isGeminiFamily
(
)
||
isXAiFamily
(
)
||
modelSupportsMultiReplaceString
(
)
||
isHiddenModelF
(
)
||
isMinimaxFamily
(
)
||
isHiddenFamilyH
(
)
||
isKimiFamily
(
)
;
}
/**
* Model supports multi_replace_string_in_file as an edit tool.
*/
export
function
modelSupportsMultiReplaceString
(
:
|
)
:
boolean
{
return
isAnthropicFamily
(
)
||
isXAiFamily
(
)
||
isHiddenModelE
(
)
||
isVSCModelReplaceStringSet
(
)
||
isMinimaxFamily
(
)
||
isHiddenFamilyH
(
)
||
isKimiFamily
(
)
;
}
/**
* The model is capable of using replace_string_in_file exclusively,
* without needing insert_edit_into_file.
*/
export
function
modelCanUseReplaceStringExclusively
(
:
|
)
:
boolean
{
return
isAnthropicFamily
(
)
||
isXAiFamily
(
)
||
isHiddenModelE
(
)
||
.
.
toLowerCase
(
)
.
includes
(
'gemini-3'
)
||
isVSCModelReplaceStringSet
(
)
||
isHiddenModelF
(
)
||
isMinimaxFamily
(
)
||
isHiddenFamilyH
(
)
||
isKimiFamily
(
)
;
}
/**
* We should attempt to automatically heal incorrect edits the model may emit.
* @note whether this is respected is currently controlled via EXP
*/
export
function
modelShouldUseReplaceStringHealing
(
:
|
)
{
return
.
.
includes
(
'gemini-2'
)
;
}
/**
* The model can accept image urls as the `image_url` parameter in mcp tool results.
*/
export
function
modelCanUseMcpResultImageURL
(
:
|
)
:
boolean
{
return
!
isAnthropicFamily
(
)
&&
!
isHiddenModelE
(
)
;
}
/**
* The model can accept image urls as the `image_url` parameter in requests.
*/
export
function
modelCanUseImageURL
(
:
|
)
:
boolean
{
return
true
;
}
/**
* The model supports native PDF document processing via document content parts.
*/
export
function
modelSupportsPDFDocuments
(
:
|
)
:
boolean
{
return
isAnthropicFamily
(
)
||
isGpt5PlusFamily
(
)
||
isGpt56
(
)
;
}
/**
* The model supports explicit prompt cache breakpoints via the OpenAI
* Responses API (`prompt_cache_breakpoint`). Scoped to OpenAI (GPT) models
* only, since this is an OpenAI-specific Responses API feature.
*/
export
function
modelSupportCacheBreakPoints
(
:
|
)
:
boolean
{
return
isGpt56
(
)
;
}
/**
* The model is capable of using apply_patch as an edit tool exclusively,
* without needing insert_edit_into_file.
*/
export
function
modelCanUseApplyPatchExclusively
(
:
|
)
:
boolean
{
// only using replace string as edit tool, disable apply_patch for VSC Models
if
(
isVSCModelReplaceStringSet
(
)
)
{
return
false
;
}
return
isGpt5PlusFamily
(
)
||
isVSCModelA
(
)
||
isVSCModelB
(
)
;
}
/**
* Whether, when replace_string and insert_edit tools are both available,
* verbiage should be added in the system prompt directing the model to prefer
* replace_string.
*/
export
function
modelNeedsStrongReplaceStringHint
(
:
|
)
:
boolean
{
return
isGeminiFamily
(
)
||
isHiddenModelF
(
)
;
}
/**
* Model can take the simple, modern apply_patch instructions.
*/
export
function
modelSupportsSimplifiedApplyPatchInstructions
(
:
|
)
:
boolean
{
return
isGpt5PlusFamily
(
)
||
isVSCModelA
(
)
||
isVSCModelB
(
)
;
}
export
function
isAnthropicFamily
(
:
|
)
:
boolean
{
return
.
.
startsWith
(
'claude'
)
||
.
.
startsWith
(
'Anthropic'
)
;
}
export
function
isGeminiFamily
(
:
|
|
string
)
:
boolean
{
const
=
typeof
===
'string'
?
:
.
;
return
.
toLowerCase
(
)
.
startsWith
(
'gemini'
)
||
getCachedSha256Hash
(
)
===
HIDDEN_MODEL_K_HASH
;
}
export
function
isMinimaxFamily
(
:
|
)
:
boolean
{
return
.
.
toLowerCase
(
)
.
includes
(
'minimax'
)
;
}
export
function
isXAiFamily
(
:
|
)
:
boolean
{
return
.
.
startsWith
(
'grok'
)
;
}
export
function
isGpt5PlusFamily
(
:
|
|
string
|
undefined
)
:
boolean
{
if
(
!
)
{
return
false
;
}
const
=
typeof
===
'string'
?
:
.
;
return
!
!
.
startsWith
(
'gpt-5'
)
;
}
/**
* Matches gpt-5-codex, gpt-5.1-codex, gpt-5.1-codex-mini, and any future models in this general family
*/
export
function
isGptCodexFamily
(
:
|
|
string
|
undefined
)
:
boolean
{
if
(
!
)
{
return
false
;
}
const
=
typeof
===
'string'
?
:
.
;
return
(
!
!
.
startsWith
(
'gpt-'
)
&&
.
includes
(
'-codex'
)
)
;
}
/**
* GPT-5, -mini, -codex, not 5.1+
*/
export
function
isGpt5Family
(
:
|
|
string
|
undefined
)
:
boolean
{
if
(
!
)
{
return
false
;
}
const
=
typeof
===
'string'
?
:
.
;
return
===
'gpt-5'
||
===
'gpt-5-mini'
||
===
'gpt-5-codex'
;
}
export
function
isGptFamily
(
:
|
|
string
|
undefined
)
:
boolean
{
if
(
!
)
{
return
false
;
}
const
=
typeof
===
'string'
?
:
.
;
return
!
!
.
startsWith
(
'gpt-'
)
;
}
/**
* GPT-5.1 and its suffixed variants, not later minor versions.
*/
export
function
isGpt51Family
(
:
|
|
string
|
undefined
)
:
boolean
{
if
(
!
)
{
return
false
;
}
const
=
typeof
===
'string'
?
:
.
;
return
matchesGptModelFamily
(
,
'gpt-5.1'
)
;
}
/**
* Identifies OpenAI models for prompt routing, not API or tool capabilities.
* OpenAI-compatible transports alone do not identify the model's provider.
*/
export
function
isOpenAIModel
(
:
<
,
'family'
|
'modelProvider'
>
)
:
boolean
{
const
=
.
.
toLowerCase
(
)
;
return
isGptFamily
(
)
||
===
'openai'
||
.
.
toLowerCase
(
)
===
'openai'
;
}
/**
* This takes a sync shortcut and should only be called when a model hash would have already been computed while rendering the prompt.
*/
export
function
getVerbosityForModelSync
(
:
,
?
:
boolean
)
:
'low'
|
'medium'
|
'high'
|
undefined
{
if
(
.
===
'gpt-5.1'
||
.
===
'gpt-5-mini'
||
(
isGpt56
(
)
&&
)
)
{
return
'low'
;
}
return
undefined
;
}
/**
* Tool search is supported by:
* - Current-generation Claude models (4.5 and newer, including Haiku 4.5), so
* new and future Claude models are picked up automatically. The pre-4.5
* generations are denied explicitly.
* - OpenAI gpt-5.4 and gpt-5.5 (via Responses API client-side tool search)
*
* Accepts either an id string, a {@link LanguageModelChat}, or an
* {@link IChatEndpoint} — when given an endpoint/chat the model **family**
* is also checked, so a per-model family override (see
* {@link IModelCapabilityOverride}) lights this up automatically.
*/
export
function
modelSupportsToolSearch
(
:
|
|
string
)
:
boolean
{
const
=
typeof
===
'string'
?
:
getModelId
(
)
;
const
=
typeof
===
'string'
?
:
.
;
const
:
boolean
=
isGpt56
(
)
;
const
matches
=
(
:
string
)
=>
{
const
=
.
toLowerCase
(
)
.
replace
(
/\./g
,
'-'
)
;
// OpenAI models with client-side tool search.
if
(
===
'gpt-5-4'
||
===
'gpt-5-5'
||
)
{
return
true
;
}
if
(
!
.
startsWith
(
'claude'
)
)
{
return
false
;
}
// Pre-4.5 Claude generations are unsupported; everything newer
// (including future families) is allowed automatically. The `-4-2`
// prefixes also catch the datestamped 4.0 bases (e.g.
// `claude-sonnet-4-20250514`, which normalizes to `...-4-2...`).
const
=
.
startsWith
(
'claude-1'
)
||
.
startsWith
(
'claude-2'
)
||
.
startsWith
(
'claude-3'
)
||
===
'claude-sonnet-4'
||
.
startsWith
(
'claude-sonnet-4-2'
)
||
===
'claude-opus-4'
||
.
startsWith
(
'claude-opus-4-1'
)
||
.
startsWith
(
'claude-opus-4-2'
)
;
return
!
;
}
;
return
matches
(
)
||
matches
(
)
;
}
/**
* Context editing is supported by:
* - Claude Fable 5
* - Claude Haiku 4.5
* - Claude Sonnet 4 / 4.5 / 4.6
* - Claude Opus 4 / 4.1 / 4.5 / 4.6 / 4.7 / 4.8
*
* Accepts either an id string, a {@link LanguageModelChat}, or an
* {@link IChatEndpoint} — when given an endpoint/chat the model **family**
* is also checked, so a per-model family override (see
* {@link IModelCapabilityOverride}) lights this up automatically.
*
* Provider-agnostic: add additional model prefixes here as other providers
* adopt context editing.
*/
export
function
modelSupportsContextEditing
(
:
|
|
string
)
:
boolean
{
const
=
typeof
===
'string'
?
:
getModelId
(
)
;
const
=
typeof
===
'string'
?
:
.
;
const
normalize
=
(
:
string
)
=>
.
toLowerCase
(
)
.
replace
(
/\./g
,
'-'
)
;
const
=
normalize
(
)
;
const
=
normalize
(
)
;
// The 1M context variant doesn't need context editing. Check id and family
// up-front so an override or normalization can't accidentally re-enable it.