Это 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.
*--------------------------------------------------------------------------------------------*/import{ localize }from'../../../nls.js';import{ structuralEquals }from'../../../base/common/equals.js';import{ ConfigurationTarget,typeIConfigurationService,typeIConfigurationValue}from'../../configuration/common/configuration.js';import{ ChatExternalSessionsMode,DEFAULT_EDIT_AUTO_APPROVE_PATTERNS,typeChatEditAutoApprovePatterns}from'../../chat/common/chatSettings.js';importtype{ IMcpServerConfiguration }from'../../mcp/common/mcpPlatformTypes.js';import{ TelemetryConfiguration, TelemetryLevel
telemetryLevelToAgentHostValue
SessionConfigKey
SessionConfigPropertySchema SessionConfigSchema
JsonRpcErrorCodes ProtocolError
protocol SessionConfigPropertySchema
value value
value path value
protocol SessionConfigPropertySchema ISchemaProperty
assertFn protocol
assertValid value path value value path
validate value value
value
protocol validate assertValid
Record ISchemaProperty
SchemaValue
definition
SessionConfigSchema
values SchemaValues Record
key value value SchemaValue
key value value SchemaValue
values defaults
definition ISchema
definition
SessionConfigSchema
properties Record SessionConfigPropertySchema
key Objectdefinition
propertieskey definitionkeyprotocol
type properties
values
raw values Record
key Objectdefinition
value rawkey
value
prop ISchemaProperty definitionkey
propvalue key
raw
key value value SchemaValue
prop definitionkey
prop propvalue
key value value SchemaValue
prop ISchemaProperty definitionkey
prop
JsonRpcErrorCodesInvalidParams
narrowed ISchemaProperty prop
narrowedvalue key
values defaults
result Record
raw values
key Objectdefinition
prop definitionkey
candidate rawkey
candidate propcandidate
resultkey candidate
Objectprototypedefaults key
resultkey defaults Record key
result
value path
schema SessionConfigPropertySchema AssertValidator
schematype schemaproperties
propAsserts Record AssertValidator
key Objectschemaproperties
propAssertskey schemapropertieskey SessionConfigPropertySchema
required schemarequired
value path
value value value
path value
obj value Record
key ObjectpropAsserts
childPath path key
objkey
requiredkey
JsonRpcErrorCodesInvalidParams
propAssertskeyobjkey childPath
schematype schemaitems
itemAssert schemaitems SessionConfigPropertySchema
value path
value
path value
i i valuelength i
valuei
schema
schema SessionConfigPropertySchema AssertValidator
enumDynamic schemaenumDynamic
value path
schematype
value path value
value path value
value path value
value path value
value value value path value
schemaenum enumDynamic schemaenumvalue
JsonRpcErrorCodesInvalidParams
path expected value ProtocolError
JsonRpcErrorCodesInvalidParams
parent key
parent key
value
value
value
allow
deny
permissionsProperty
type
title
description
properties
allow
type
title
items
type
title
deny
type
title
items
type
title
allow deny
sessionMutable
platformSessionSchema
SessionConfigKeyAutoApprove
type
title
description
enumLabels
enumDescriptions
sessionMutable
SessionConfigKeyPermissions permissionsProperty
SessionConfigKeyMode
type
title
description
enumLabels
enumDescriptions
sessionMutable
config
config configSessionConfigKeyAutoApprove
config
migrated Record config
migratedSessionConfigKeyMode
migratedSessionConfigKeyMode satisfies SessionMode
migratedSessionConfigKeyAutoApprove satisfies AutoApproveLevel
migrated
AgentHostTelemetryLevelConfigKey
AgentHostEditTelemetryEnabledConfigKey
AgentHostDisableRepoInfoTelemetryConfigKey
AgentHostSessionSyncEnabledConfigKey
AgentHostByokModelsEnabledConfigKey
AgentHostCodexEnabledConfigKey
AgentHostEditAutoApprovePatternsConfigKey
AgentHostTerminalAutoApproveEnabledConfigKey
AgentHostGlobalAutoApproveEnabledConfigKey
AgentHostAutoApprovePolicyRestrictedConfigKey
AgentHostAutoReplyEnabledConfigKey
AgentHostAutoReplyAnswer
AgentHostSystemProxyEnabledConfigKey
AgentHostGitHubMcpServerEnabledConfigKey
AgentHostProxyConfigKey
Proxy
ProxyKerberosServicePrincipal
NoProxy
agentHostProxyConfigDefinition
AgentHostProxyConfigKeyProxy
type
title
description
AgentHostProxyConfigKeyProxyKerberosServicePrincipal
type
title
description
AgentHostProxyConfigKeyNoProxy
type
title
description
items type title
agentHostProxyConfigSchema agentHostProxyConfigDefinition
AgentHostActiveAgentTitleGenerationConfigKey
AgentHostMarkdownPlanRichLinksEnabledConfigKey
AgentHostArtifactToolsConfigKey
AgentHostMigrateLegacyCopilotCliEnabledConfigKey
AgentHostShowExternalSessionsConfigKey
ChatExternalSessionsMode AgentHostExternalSessionsMode
AgentHostCopilotMultiRootEnabledConfigKey
AgentHostClaudeMultiRootEnabledConfigKey
AgentHostCodexMultiRootEnabledConfigKey
AgentHostTerminalAutoApproveRulesConfigKey
approve
matchCommandLine
IAgentHostTerminalAutoApproveRule
Record AgentHostTerminalAutoApproveRuleValue
configurationService IConfigurationService AgentHostTerminalAutoApproveRules
config configurationService
configInspectValue configurationService
ignoreDefaults configurationService
config configInspectValue ignoreDefaults
config AgentHostTerminalAutoApproveRules configInspectValue IConfigurationValueReadonlyAgentHostTerminalAutoApproveRules ignoreDefaults AgentHostTerminalAutoApproveRules
config
rules AgentHostTerminalAutoApproveRules
key value Objectconfig
ignoreDefaults key value configInspectValue
ruleskey value
rules
key value AgentHostTerminalAutoApproveRuleValue configInspectValue IConfigurationValueReadonlyAgentHostTerminalAutoApproveRules
defaultValue configInspectValuedefaultvalue
isDefaultRule defaultValue key value
isDefaultRule
sourceTarget key value configInspectValue
sourceTarget ConfigurationTarget
key value AgentHostTerminalAutoApproveRuleValue configInspectValue IConfigurationValueReadonlyAgentHostTerminalAutoApproveRules ConfigurationTarget
configInspectValueworkspaceFolderValue key value
ConfigurationTarget
configInspectValueworkspaceValue key value
ConfigurationTarget
configInspectValueuserRemoteValue key value
ConfigurationTarget
configInspectValueuserLocalValue key value
ConfigurationTarget
configInspectValueuserValue key value
ConfigurationTarget
configInspectValueapplicationValue key value
ConfigurationTarget
ConfigurationTarget
config ReadonlyAgentHostTerminalAutoApproveRules key value AgentHostTerminalAutoApproveRuleValue
config Objectprototypeconfig key configkey value
AgentHostMcpServersConfigKey
Record IMcpServerConfiguration
telemetryLevel TelemetryLevel TelemetryConfiguration
telemetryLevel
value TelemetryLevel
value
TelemetryConfiguration
TelemetryLevel
TelemetryConfiguration
TelemetryLevel
TelemetryConfiguration
TelemetryLevel
TelemetryConfiguration
TelemetryLevel
mcpServerConfigProperties Record SessionConfigPropertySchema
type
type
title
description
command
type
title
description
args
type
title
description
items type title
env
type
title
description
cwd
type
title
description
url
type
title
description
headers
type
title
description
mcpServersValueProperties Record SessionConfigPropertySchema
type
title
description
properties mcpServerConfigProperties
platformRootSchema
agentHostProxyConfigDefinition
SessionConfigKeyPermissions permissionsProperty
AgentHostDisableRepoInfoTelemetryConfigKey
type
title
description
AgentHostTelemetryLevelConfigKey
type
title
description
TelemetryConfiguration TelemetryConfiguration TelemetryConfiguration TelemetryConfiguration
TelemetryConfiguration
AgentHostEditTelemetryEnabledConfigKey
type
title
description
AgentHostSessionSyncEnabledConfigKey
type
title
description
AgentHostByokModelsEnabledConfigKey
type
title
description
AgentHostCodexEnabledConfigKey
type
title
description
AgentHostTerminalAutoApproveEnabledConfigKey
type
title
description
AgentHostGlobalAutoApproveEnabledConfigKey
type
title
description
AgentHostAutoApprovePolicyRestrictedConfigKey
type
title
readOnly
AgentHostAutoReplyEnabledConfigKey
type
title
description
AgentHostSystemProxyEnabledConfigKey
type
title
description
AgentHostGitHubMcpServerEnabledConfigKey
type
title
description
AgentHostActiveAgentTitleGenerationConfigKey
type
title
description
AgentHostMarkdownPlanRichLinksEnabledConfigKey
type
title
description
AgentHostArtifactToolsConfigKey
type
title
description
AgentHostMigrateLegacyCopilotCliEnabledConfigKey
type
title
description
AgentHostShowExternalSessionsConfigKey
type
title
description
ChatExternalSessionsModeNone ChatExternalSessionsModeRecent ChatExternalSessionsModeLast24Hours ChatExternalSessionsModeLast7Days ChatExternalSessionsModeLast30Days
enumDescriptions
ChatExternalSessionsModeNone
AgentHostCopilotMultiRootEnabledConfigKey
type
title
description
AgentHostClaudeMultiRootEnabledConfigKey
type
title
description
AgentHostCodexMultiRootEnabledConfigKey
type
title
description
AgentHostEditAutoApprovePatternsConfigKey
type
title
description
AgentHostTerminalAutoApproveRulesConfigKey
type
title
description
AgentHostMcpServersConfigKey
type
title
description
properties mcpServersValueProperties
clientOwnedApprovalRootConfigKeys ReadonlySet
SessionConfigKeyPermissions
AgentHostGlobalAutoApproveEnabledConfigKey
AgentHostAutoApprovePolicyRestrictedConfigKey
AgentHostTerminalAutoApproveEnabledConfigKey
AgentHostTerminalAutoApproveRulesConfigKey
AgentHostEditAutoApprovePatternsConfigKey
AgentHostAutoReplyEnabledConfigKey
/**
* A schema property with a phantom TypeScript type and a precomputed
* runtime validator.
*
* The `<T>` type parameter is the developer's assertion about the
* property's runtime shape; the validator derived from `protocol`
* (`type`, `enum`, `items`, `properties`, `required`) enforces it at
* runtime.
*/
export
interface
ISchemaProperty<T>
{
readonly
:
;
/**
* Returns `true` iff `value` conforms to {@link protocol}. Narrows
* the type to `T` for callers. The boolean form is preferred for
* control flow; use {@link assertValid} when you want a descriptive
* error for the offending path.
*/
validate
(
:
unknown
)
:
is
T
;
/**
* Throws a {@link ProtocolError} with `JsonRpcErrorCodes.InvalidParams`
* describing the offending path (e.g. `'permissions.allow[2]'`) when
* `value` does not conform to {@link protocol}. Otherwise returns and
* narrows the type to `T`.
*
* @parampath Dotted path prefix to embed in error messages. Defaults
* to empty (the value itself).
*/
assertValid
(
:
unknown
,
?
:
string
)
:
asserts
is
T
;
}
/**
* Defines a strongly-typed schema property whose runtime validator is
* derived from the supplied JSON-schema descriptor.
*/
/**
* A bundle of named schema properties plus helpers for serializing to the
* protocol shape, validating a values bag at write sites, and validating
* a single key at read sites.
*/
export
interface
ISchema<Dextends SchemaDefinition>
{
readonly
:
D
;
/** Returns the protocol-serializable schema for this bundle. */
toProtocol
(
)
:
;
/**
* Validates each known key in `values` against its schema and returns
* a new plain record. Throws a {@link ProtocolError} with a path like
* `'permissions.allow[2]'` when any supplied value fails validation.
* Unknown keys are passed through untouched for forward-compatibility.
*/
values
(
:
<
D
>
)
:
<
string
,
unknown
>
;
/**
* Returns `true` iff `value` validates against the schema for `key`.
* Unknown keys return `false`.
*/
validate<KextendskeyofD&string>
(
:
K
,
:
unknown
)
:
is
<
D
[
K
]
>
;
/**
* Throws a {@link ProtocolError} describing the offending path when
* `value` does not validate against the schema for `key`, or when
* `key` is not defined in the schema.
*/
assertValid<KextendskeyofD&string>
(
:
K
,
:
unknown
)
:
asserts
is
<
D
[
K
]
>
;
/**
* Returns a fully-typed values bag by validating each key of the
* schema against `values` and falling back to the default when
* the incoming value is missing or fails validation.
*
* Semantics: for every key declared in the schema `definition`:
* - if `values[key]` validates, it is kept;
* - else if `key` is present in `defaults`, the default is used;
* - else the key is omitted from the result.
*
* This means callers MAY supply defaults for only a subset of the
* schema — keys not present in `defaults` are simply left unset
* when the incoming value is missing or invalid. This is useful
* when some properties (e.g. per-session `permissions`) should be
* inherited from a higher scope rather than materialized on every
* new session.
*
* Intended for sanitizing untrusted input at protocol boundaries
* (e.g. `resolveSessionConfig`). Keys that fail validation are
* silently replaced with their default or dropped; use
* {@link values} or {@link assertValid} when you want a descriptive
* {@link ProtocolError} instead.
*/
/**
* A validator that throws a {@link ProtocolError} annotated with the
* offending path when `value` does not conform, or returns normally
* when it does.
*/
type
AssertValidator
=
(
:
unknown
,
:
string
)
=>
void
;
function
buildAssert
(
:
)
:
{
if
(
.
===
'object'
&&
.
)
{
const
:
<
string
,
>
=
{
}
;
for
(
const
of
.
keys
(
.
)
)
{
[
]
=
buildAssert
(
.
[
]
as
)
;
}
const
=
new
Set
(
.
??
[
]
)
;
return
(
,
)
=>
{
if
(
typeof
!==
'object'
||
===
null
||
Array
.
isArray
(
)
)
{
throw
invalidParams
(
,
'object'
,
)
;
}
const
=
as
<
string
,
unknown
>
;
for
(
const
of
.
keys
(
)
)
{
const
=
joinPath
(
,
)
;
if
(
[
]
===
undefined
)
{
if
(
.
has
(
)
)
{
throw
new
ProtocolError
(
.
,
`Missing required property at '${childPath}'`
)
;
}
continue
;
}
[
]
(
[
]
,
)
;
}
}
;
}
if
(
.
===
'array'
&&
.
)
{
const
=
buildAssert
(
.
as
)
;
return
(
,
)
=>
{
if
(
!
Array
.
isArray
(
)
)
{
throw
invalidParams
(
,
'array'
,
)
;
}
for
(
let
=
0
;
<
.
;
++
)
{
itemAssert
(
[
]
,
`${path}[${i}]`
)
;
}
}
;
}
return
buildPrimitiveAssert
(
)
;
}
function
buildPrimitiveAssert
(
:
)
:
{
const
=
.
===
true
;
return
(
,
)
=>
{
switch
(
.
)
{
case
'string'
:
if
(
typeof
!==
'string'
)
{
throw
invalidParams
(
,
'string'
,
)
;
}
break
;
case
'number'
:
if
(
typeof
!==
'number'
)
{
throw
invalidParams
(
,
'number'
,
)
;
}
break
;
case
'boolean'
:
if
(
typeof
!==
'boolean'
)
{
throw
invalidParams
(
,
'boolean'
,
)
;
}
break
;
case
'array'
:
if
(
!
Array
.
isArray
(
)
)
{
throw
invalidParams
(
,
'array'
,
)
;
}
break
;
case
'object'
:
if
(
typeof
!==
'object'
||
===
null
||
Array
.
isArray
(
)
)
{
throw
invalidParams
(
,
'object'
,
)
;
}
break
;
}
if
(
.
&&
!
&&
!
.
.
includes
(
as
string
)
)
{
throw
new
ProtocolError
(
.
,
`Invalid value at '${path ||'<root>'}': ${safeStringify(value)} is not one of [${schema.enum.map(v =>JSON.stringify(v)).join(', ')}]`
)
;
}
}
;
}
function
invalidParams
(
:
string
,
:
string
,
:
unknown
)
:
{
return
new
ProtocolError
(
.
,
`Invalid value at '${path ||'<root>'}': expected ${expected}, got ${safeStringify(value)}`
"Per-tool session permissions. Updated automatically when approving a tool \"in this Session\"."
)
,
:
{
:
{
:
'array'
,
:
localize
(
'agentHost.sessionConfig.permissions.allow'
,
"Allowed tools"
)
,
:
{
:
'string'
,
:
localize
(
'agentHost.sessionConfig.permissions.toolName'
,
"Tool name"
)
,
}
,
}
,
:
{
:
'array'
,
:
localize
(
'agentHost.sessionConfig.permissions.deny'
,
"Denied tools"
)
,
:
{
:
'string'
,
:
localize
(
'agentHost.sessionConfig.permissions.toolName'
,
"Tool name"
)
,
}
,
}
,
}
,
default
:
{
:
[
]
,
:
[
]
}
,
:
true
,
}
)
;
/**
* Session-config properties owned by the platform itself — i.e. consumed
* by the agent host rather than by any particular agent.
*
* Agents extend this schema by spreading `platformSessionSchema.definition`
* into their own {@link createSchema} call together with any
* provider-specific properties.
*/
/**
* Rewrites a legacy `autoApprove='autopilot'` config value — used before
* Autopilot moved from the `autoApprove` axis onto the orthogonal `mode`
* axis — into the current two-axis shape:
*
* - `autoApprove='autopilot'` + `mode='plan'` → `mode='plan'`, `autoApprove='default'`
* (legacy `plan` took precedence over autopilot when resolving the SDK mode).
* - `autoApprove='autopilot'` + any other mode → `mode='autopilot'`, `autoApprove='default'`.
*
* Returns a shallow copy with the migration applied, or the original
* reference unchanged when no legacy value is present. Safe to call on
* `undefined`.
*
* Without this, a session persisted (or a "remembered" picker value seeded)
* with `autoApprove='autopilot'` would fail the new schema's enum validation
* and silently fall back to `default`, downgrading the session from
* autonomous Autopilot to manual per-tool confirmation.
*/
/**
* Root (agent host) config properties owned by the platform itself.
*
* Root config acts as the baseline that applies to every session:
*
* - {@link SessionConfigKey.Permissions} — host-wide allow/deny lists
* unioned with each session's own permissions when evaluating tool
* auto-approval. See `SessionPermissionManager` for the evaluation
* rules.
*/
export
const
=
'telemetryLevel'
;
/** Whether Agent Host edit attribution telemetry is enabled. */
/** VS Code setting forwarded into {@link AgentHostDisableRepoInfoTelemetryConfigKey}. */
export
const
DISABLE_REPO_INFO_TELEMETRY_SETTING_ID
=
'chat.advanced.debug.disableRepoInfoTelemetry'
;
/**
* Root config key forwarded from the renderer when VS Code's
* `chat.sessionSync.enabled` setting changes. Controls the `remote` flag
* passed to the copilot-sdk `CopilotClientOptions`.
*/
export
const
=
'sessionSyncEnabled'
;
/** Whether extension-provided BYOK models are enabled. */
export
const
=
'byokModelsEnabled'
;
/**
* Root config key forwarded from the renderer carrying the experiment-aware
* value of `chat.agentHost.codexAgent.enabled`. The host registers the Codex
* provider when this is `true`; disabling requires an agent host restart.
*/
/**
* Root config key forwarded from the renderer when VS Code's
* `chat.tools.terminal.enableAutoApprove` setting changes. Controls whether
* agent-host shell permission checks may apply terminal auto-approve rules.
*/
export
const
=
'terminalAutoApproveEnabled'
;
/**
* The VS Code setting ID for terminal auto approve enablement. Defined here so
* renderer-side agent-host clients can forward it without importing from
* workbench terminal contributions.
*/
export
const
TERMINAL_AUTO_APPROVE_ENABLED_SETTING_ID
=
'chat.tools.terminal.enableAutoApprove'
;
/** The VS Code setting ID for global auto approve enablement. */
export
const
GLOBAL_AUTO_APPROVE_SETTING_ID
=
'chat.tools.global.autoApprove'
;
/** The VS Code setting ID for per-tool auto-approval eligibility. */
export
const
ELIGIBLE_FOR_AUTO_APPROVAL_SETTING_ID
=
'chat.tools.eligibleForAutoApproval'
;
/**
* Root config key forwarded from the renderer when VS Code's
* `chat.tools.global.autoApprove` setting changes. When `true`, the global
* auto-approve ("approve everything") setting is enabled and the agent host
* treats every tool call as auto-approved — equivalent to a session running
* with Allow all.
*/
/**
* Root config key forwarded from the renderer when VS Code's `chat.autoReply`
* setting changes. When `true`, the agent host auto-answers `ask_user`
* questions instead of blocking on the user — the user is treated as
* unavailable and the agent is told to use its best judgment, mirroring the
* behavior of `autopilot` mode.
*/
export
const
=
'autoReplyEnabled'
;
export
const
=
'The user is not available to answer your question. Choose a pragmatic option best aligned with the context of the request.'
;
/** Root config key forwarded from the renderer for automatic OS system proxy discovery. */
export
const
=
'systemProxyEnabled'
;
/** Root config key forwarded from the renderer for the GitHub MCP server. */
export
const
=
'githubMcpServerEnabled'
;
/**
* Independently synchronized proxy settings retain their VS Code `http.*`
* names, matching other flat namespaced root keys such as `agentMerge.*`.
*/
export
const
=
{
:
'http.proxy'
,
:
'http.proxyKerberosServicePrincipal'
,
:
'http.noProxy'
,
}
as
const
;
const
=
{
[
.
]
:
schemaProperty<string>
(
{
:
'string'
,
:
localize
(
'agentHost.config.httpProxy.title'
,
"HTTP Proxy"
)
,
:
localize
(
'agentHost.config.httpProxy.description'
,
"The proxy URL used by network requests from the Agent Host."
// sessions as adoptable agent-host sessions, and opening one adopts it in place. Experimental; off.
export
const
=
'migrateLegacyCopilotCliEnabled'
;
export
const
=
'showExternalSessions'
;
export
{
as
}
;
/**
* Root config key forwarded from the renderer that gates multiple-working-directory
* support for the Copilot provider. When `true`, the Copilot provider advertises
* the `multipleWorkingDirectories` capability. Mirrors the hidden
* `chat.agentHost.copilotAgent.multiRootEnabled` VS Code setting.
*/
export
const
=
'copilotMultiRootEnabled'
;
/**
* Root config key forwarded from the renderer that gates multiple-working-directory
* support for the Claude provider. When `true`, the Claude provider advertises
* the `multipleWorkingDirectories` capability. Mirrors the hidden
* `chat.agentHost.claudeAgent.multiRootEnabled` VS Code setting.
*/
export
const
=
'claudeMultiRootEnabled'
;
/** Root config key forwarded from the renderer that gates Codex multiple-working-directory support. */
export
const
=
'codexMultiRootEnabled'
;
/**
* Root config key forwarded from the renderer when VS Code's
* `chat.tools.terminal.autoApprove` setting changes. Holds the effective
* terminal auto-approve rule object for agent-host shell permission checks.
*/
export
const
=
'terminalAutoApproveRules'
;
export
interface
IAgentHostTerminalAutoApproveRule
{
readonly
:
boolean
;
readonly
?
:
boolean
;
}
export
type
AgentHostTerminalAutoApproveRuleValue
=
boolean
|
null
|
;
export
type
AgentHostTerminalAutoApproveRules
=
<
string
,
>
;
/**
* The VS Code setting IDs for terminal auto approve rules. Defined here so
* renderer-side agent-host clients can forward them without importing from
* workbench terminal contributions.
*/
/**
* Root config key holding agent-host-level MCP server definitions.
*
* The value is a map of server name → {@link IMcpServerConfiguration}
* (the same `servers` shape used by `mcp.json`). These servers are
* exposed to every session created by the host, merged with any
* plugin-provided MCP servers when launching the copilot-sdk client.
*/
export
const
=
'mcpServers'
;
/**
* Map of server name → MCP server configuration, as stored in the
* {@link AgentHostMcpServersConfigKey} root config value.
*/
export
type
AgentHostMcpServers
=
<
string
,
>
;
export
function
telemetryLevelToAgentHostConfigValue
(
:
)
:
{
return
telemetryLevelToAgentHostValue
(
)
;
}
export
function
agentHostConfigValueToTelemetryLevel
(
:
unknown
)
:
|
undefined
{
switch
(
)
{
case
.
OFF
:
return
.
NONE
;
case
.
CRASH
:
return
.
CRASH
;
case
.
ERROR
:
return
.
ERROR
;
case
.
ON
:
return
.
USAGE
;
default
:
return
undefined
;
}
}
/**
* Field descriptors for a single MCP server entry, shared by the stdio and
* http shapes. The agent-host config schema has no `oneOf`, so both variants'
* fields are described together; `type` selects which fields apply
* (`stdio` uses `command`/`args`/`env`/`cwd`, `http` uses `url`/`headers`).
*/
const
:
<
string
,
>
=
{
:
{
:
'string'
,
:
localize
(
'agentHost.config.mcpServers.type.title'
,
"Server Type"
)
,
:
localize
(
'agentHost.config.mcpServers.type.description'
,
"The transport used to reach the server: `stdio` for a local command, `http` for a remote endpoint."
)
,
enum
:
[
'stdio'
,
'http'
]
,
}
,
:
{
:
'string'
,
:
localize
(
'agentHost.config.mcpServers.command.title'
,
"Command"
)
,
:
localize
(
'agentHost.config.mcpServers.command.description'
,
"For `stdio` servers, the executable to spawn."
)
,
}
,
:
{
:
'array'
,
:
localize
(
'agentHost.config.mcpServers.args.title'
,
"Arguments"
)
,
:
localize
(
'agentHost.config.mcpServers.args.description'
,
"For `stdio` servers, the arguments passed to the command."
)
,
:
{
:
'string'
,
:
localize
(
'agentHost.config.mcpServers.arg.title'
,
"Argument"
)
}
,
}
,
:
{
:
'object'
,
:
localize
(
'agentHost.config.mcpServers.env.title'
,
"Environment"
)
,
:
localize
(
'agentHost.config.mcpServers.env.description'
,
"For `stdio` servers, environment variables set on the spawned process."
)
,
}
,
:
{
:
'string'
,
:
localize
(
'agentHost.config.mcpServers.cwd.title'
,
"Working Directory"
)
,
:
localize
(
'agentHost.config.mcpServers.cwd.description'
,
"For `stdio` servers, the working directory the command runs in."
)
,
}
,
:
{
:
'string'
,
:
localize
(
'agentHost.config.mcpServers.url.title'
,
"URL"
)
,
:
localize
(
'agentHost.config.mcpServers.url.description'
,
"For `http` servers, the endpoint URL of the MCP server."
)
,
}
,
:
{
:
'object'
,
:
localize
(
'agentHost.config.mcpServers.headers.title'
,
"Headers"
)
,
:
localize
(
'agentHost.config.mcpServers.headers.description'
,
"For `http` servers, HTTP headers sent with every request."
)
,
}
,
}
;
/**
* Documents the value shape of the {@link AgentHostMcpServersConfigKey} map.
*
* The config value is a map of server name → server config. The schema
* language has no `additionalProperties`, so the per-entry shape is attached
* under a placeholder key (`<serverName>`) rather than at the map level —
* this keeps the field descriptions discoverable without the runtime
* validator mistaking a real server named e.g. `command` for the `command`
* field. Real entries (keyed by actual server names) are passed through.
*/
const
:
<
string
,
>
=
{
'<serverName>'
:
{
:
'object'
,
:
localize
(
'agentHost.config.mcpServers.entry.title'
,
"MCP Server"
)
,
:
localize
(
'agentHost.config.mcpServers.entry.description'
,
"A single MCP server entry. The property key is the server name."
"Whether VS Code's global auto-approve setting is enabled. When `true`, every tool call is auto-approved, equivalent to a session using Allow all."
)
,
default
:
false
,
}
)
,
[
]
:
schemaProperty<boolean>
(
{
:
'boolean'
,
:
localize
(
'agentHost.config.autoApprovePolicyRestricted'
,
"Auto Approve Policy Restricted"
)
,
default
:
false
,
:
true
,
}
)
,
[
]
:
schemaProperty<boolean>
(
{
:
'boolean'
,
:
localize
(
'agentHost.config.autoReplyEnabled.title'
,
"Auto Reply"
)
,
:
localize
(
'agentHost.config.autoReplyEnabled.description'
,
"Whether VS Code's auto-reply setting is enabled. When `true`, `ask_user` questions are auto-answered instead of blocking on the user, mirroring autopilot mode."
)
,
default
:
false
,
}
)
,
[
]
:
schemaProperty<boolean>
(
{
:
'boolean'
,
:
localize
(
'agentHost.config.systemProxyEnabled.title'
,
"System Proxy Discovery"
)
,
:
localize
(
'agentHost.config.systemProxyEnabled.description'
,
"Whether Copilot sessions automatically discover and use the operating system's proxy configuration."
"Controls whether sessions created outside the Agent Host are included in the session catalog."
)
,
enum
:
[
.
,
.
,
.
,
.
,
.
]
,
:
[
localize
(
'agentHost.config.showExternalSessions.none'
,
"Do not show external sessions."
)
,
localize
(
'agentHost.config.showExternalSessions.recent'
,
"Show up to the 2 most recent external sessions updated in the last 7 days. Once at least 2 local sessions exist, external sessions older than the second-newest local session are hidden."
"Terminal auto-approve rules forwarded by the connected client for agent-host shell permission checks."
)
,
default
:
{
}
,
}
)
,
[
]
:
schemaProperty<AgentHostMcpServers>
(
{
:
'object'
,
:
localize
(
'agentHost.config.mcpServers.title'
,
"MCP Servers"
)
,
:
localize
(
'agentHost.config.mcpServers.description'
,
"Agent-host-level MCP servers exposed to every session, keyed by server name. Each value is a server configuration (see `<serverName>`)."
)
,
:
,
default
:
{
}
,
}
)
,
}
)
;
/**
* Root config keys the connected client re-pushes on every connect and
* reconnect, and which gate permission prompts or policy restrictions.
*
* These must NOT be restored from `agent-host-config.json` on startup. Their
* persisted value is a snapshot of one client's settings, so reviving it would
* re-grant approvals that a user, workspace, or policy tightened while the host
* was stopped. Falling back to the schema default until the client republishes
* is the fail-safe direction.
*/