import { ChatExternalSessionsMode, type IChatSensitiveEditLocation } from "../../chat/common/chatSettings.js"; import type { IMcpServerConfiguration } from "../../mcp/common/mcpPlatformTypes.js"; import { TelemetryConfiguration, TelemetryLevel } from "../../telemetry/common/telemetry.js"; import { type SessionSandboxEnabled } from "./sessionConfigKeys.js"; import type { IShellInitScript } from "@codingame/monaco-vscode-chat-service-override/vscode/vs/platform/agentHost/common/shellInitScript"; import type { SessionConfigPropertySchema, SessionConfigSchema } from "./state/protocol/commands.js"; /** * A schema property with a phantom TypeScript type and a precomputed * runtime validator. * * The `` 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 { readonly protocol: SessionConfigPropertySchema; /** * 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(value: unknown): value 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`. * * @param path Dotted path prefix to embed in error messages. Defaults * to empty (the value itself). */ assertValid(value: unknown, path?: string): asserts value is T; } /** * Defines a strongly-typed schema property whose runtime validator is * derived from the supplied JSON-schema descriptor. */ export declare function schemaProperty(protocol: SessionConfigPropertySchema): ISchemaProperty; export type SchemaDefinition = Record>; export type SchemaValue

= P extends ISchemaProperty ? T : never; export type SchemaValues = { [K in keyof D]?: SchemaValue; }; /** * 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 { readonly definition: D; /** Returns the protocol-serializable schema for this bundle. */ toProtocol(): SessionConfigSchema; /** * 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(values: SchemaValues): Record; /** * Returns `true` iff `value` validates against the schema for `key`. * Unknown keys return `false`. */ validate(key: K, value: unknown): value is SchemaValue; /** * 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(key: K, value: unknown): asserts value is SchemaValue; /** * 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. */ validateOrDefault; }>>(values: { [K in keyof T]?: unknown; } | undefined, defaults: T): T; } export declare function createSchema(definition: D): ISchema; export type AutoApproveLevel = "default" | "assisted" | "autoApprove"; export type SessionMode = "interactive" | "plan" | "autopilot"; /** Additive permission lists with deny-before-ask-before-allow precedence. */ export interface IPermissionsValue { readonly allow: readonly string[]; readonly deny: readonly string[]; readonly ask?: readonly string[]; } /** * 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. */ export declare const platformSessionSchema: ISchema<{ sandboxEnabled: ISchemaProperty; autoApprove: ISchemaProperty; permissions: ISchemaProperty; mode: ISchemaProperty; shellInitScripts: ISchemaProperty; sensitiveEditLocations: ISchemaProperty; }>; /** * 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. */ export declare function migrateLegacyAutopilotConfig | undefined>(config: T): T; /** * 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 declare const AgentHostTelemetryLevelConfigKey = "telemetryLevel"; /** Whether Agent Host edit attribution telemetry is enabled. */ export declare const AgentHostEditTelemetryEnabledConfigKey = "editTelemetryEnabled"; /** Legacy Copilot Chat debug switch that disables `request.repoInfo` collection. */ export declare const AgentHostDisableRepoInfoTelemetryConfigKey = "disableRepoInfoTelemetry"; /** VS Code setting forwarded into {@link AgentHostDisableRepoInfoTelemetryConfigKey}. */ export declare const DISABLE_REPO_INFO_TELEMETRY_SETTING_ID = "chat.advanced.debug.disableRepoInfoTelemetry"; /** Whether extension-provided BYOK models are enabled. */ export declare const AgentHostByokModelsEnabledConfigKey = "byokModelsEnabled"; /** Shared default for the root config and mirrored workbench setting. */ export declare const AgentHostByokModelsEnabledDefault = true; /** * Root config key mirrored from `chat.utilitySmallModel`: a `${vendor}/${id}` * model that overrides the default model for host utility flows such as title * and pull request generation. Empty uses the default behavior. */ export declare const AgentHostUtilitySmallModelConfigKey = "utilitySmallModel"; /** * Root config key mirrored from `chat.byokUtilityModelDefault`: the default * utility model when the chat's selected main agent model is BYOK. */ export declare const AgentHostByokUtilityModelDefaultConfigKey = "byokUtilityModelDefault"; /** Values of {@link AgentHostByokUtilityModelDefaultConfigKey}; keep in sync with `BYOKUtilityModelDefault` in the chat contribution. */ export declare const AgentHostByokUtilityModelDefaults: readonly [ "none", "mainAgent", "copilot" ]; export type AgentHostByokUtilityModelDefault = typeof AgentHostByokUtilityModelDefaults[number]; /** * 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. */ export declare const AgentHostCodexEnabledConfigKey = "codexAgentEnabled"; /** Root config key carrying the effective edit auto-approve patterns. */ export declare const AgentHostEditAutoApprovePatternsConfigKey = "editAutoApprovePatterns"; /** * 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 declare const AgentHostTerminalAutoApproveEnabledConfigKey = "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 declare const TERMINAL_AUTO_APPROVE_ENABLED_SETTING_ID = "chat.tools.terminal.enableAutoApprove"; /** The VS Code setting ID for global auto approve enablement. */ export declare const GLOBAL_AUTO_APPROVE_SETTING_ID = "chat.tools.global.autoApprove"; /** The VS Code setting ID for per-tool auto-approval eligibility. */ export declare 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. */ export declare const AgentHostGlobalAutoApproveEnabledConfigKey = "globalAutoApproveEnabled"; /** Whether managed policy forbids elevated session auto-approval modes. */ export declare const AgentHostAutoApprovePolicyRestrictedConfigKey = "autoApprovePolicyRestricted"; /** * 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 declare const AgentHostAutoReplyEnabledConfigKey = "autoReplyEnabled"; export declare const AgentHostAutoReplyAnswer = "The user is not available to answer your question. Choose a pragmatic option best aligned with the context of the request."; export declare const AgentHostWorkspaceTrustConfigKey = "workspaceTrust"; export interface IAgentHostWorkspaceTrust { readonly enabled: boolean; readonly trustedUris: readonly string[]; } /** Root config key forwarded from the renderer for automatic OS system proxy discovery. */ export declare const AgentHostSystemProxyEnabledConfigKey = "systemProxyEnabled"; /** Root config key forwarded from the renderer for the GitHub MCP server. */ export declare const AgentHostGitHubMcpServerEnabledConfigKey = "githubMcpServerEnabled"; /** Root config key forwarded from the renderer for GitHub's Computer Use plugin. */ export declare const AgentHostComputerUseEnabledConfigKey = "computerUseEnabled"; /** Root config key forwarded from the renderer for cached MCP tool routing. */ export declare const AgentHostMcpToolRoutingEnabledConfigKey = "mcpToolRoutingEnabled"; /** Host-persisted server identities explicitly approved for MCP sampling in all sessions. */ export declare const AgentHostMcpSamplingAllowedServersConfigKey = "mcpSamplingAllowedServers"; /** Root config key forwarded from the renderer for Copilot connector discovery. */ export declare const AgentHostMcpConnectorsEnabledConfigKey = "mcpConnectorsEnabled"; /** * Independently synchronized proxy settings retain their VS Code `http.*` * names, matching other flat namespaced root keys such as `agentMerge.*`. */ export declare const AgentHostProxyConfigKey: { readonly Proxy: "http.proxy"; readonly ProxyKerberosServicePrincipal: "http.proxyKerberosServicePrincipal"; readonly NoProxy: "http.noProxy"; }; export declare const agentHostProxyConfigSchema: ISchema<{ "http.proxy": ISchemaProperty; "http.proxyKerberosServicePrincipal": ISchemaProperty; "http.noProxy": ISchemaProperty; }>; /** Root config key selecting the automatic title generation strategy for new sessions. */ export declare const AgentHostTitleGenerationConfigKey = "titleGeneration"; /** Legacy boolean root config keys, still read for clients that predate {@link AgentHostTitleGenerationConfigKey}. */ export declare const AgentHostActiveAgentTitleGenerationConfigKey = "activeAgentTitleGeneration"; export declare const AgentHostDeferredTitleGenerationConfigKey = "deferredTitleGeneration"; /** * Strategies selectable for new sessions: * - `utility`: a utility model names chats immediately. * - `activeAgent`: the active agent names chats through `rename_chat`. * - `agentReview`: the host seeds a title and refines it with a utility model after the first * response, and a soft reminder lets the active agent rename the chat when that title no longer fits. */ export declare const AgentHostTitleGenerationStrategies: readonly [ "utility", "activeAgent", "agentReview" ]; export type AgentHostSelectableTitleGenerationStrategy = typeof AgentHostTitleGenerationStrategies[number]; /** `deferred` is `agentReview` without the reminder; it is kept for existing sessions and the legacy boolean key. */ export type AgentHostTitleGenerationStrategy = AgentHostSelectableTitleGenerationStrategy | "deferred"; /** Root config key controlling rich-link guidance for Markdown plan documents. */ export declare const AgentHostMarkdownPlanRichLinksEnabledConfigKey = "markdownPlanRichLinksEnabled"; /** Root config key controlling the initial workspace file-name snapshot in Copilot chats. */ export declare const AgentHostWorkspaceSnapshotEnabledConfigKey = "workspaceSnapshotEnabled"; /** Root config key controlling agent session creation, messaging, and recursion limits. */ export declare const AgentHostAgentOrchestrationLimitsConfigKey = "agentOrchestrationLimits"; export type AgentHostAgentOrchestrationLimits = "on" | "off"; /** Root config key forwarded from the renderer for the artifact tools and their instruction. */ export declare const AgentHostArtifactToolsConfigKey = "artifactTools"; export declare const AgentHostArtifactIntegrationsConfigKey = "artifactIntegrations"; export declare const AgentHostGitHubArtifactIgnoredChecksConfigKey = "githubArtifactMarkReadyIgnoredChecks"; /** Root config key controlling Canvas extensions in Copilot sessions. */ export declare const AgentHostCanvasesEnabledConfigKey = "canvasesEnabled"; export declare const AgentHostAhpJsonlLoggingEnabledConfigKey = "ahpJsonlLoggingEnabled"; /** Root config key controlling automatic pull request association for the checked-out branch. */ export declare const AgentHostAutoAttachPullRequestsConfigKey = "autoAttachPullRequests"; /** * Root config key forwarded from the renderer's * `chat.agentHost.experimental.overlapProviderPreparation` setting. When * `true`, a provider that implements `IAgentChats.prepareTurn` prepares its * session while the turn-start checkpoint is captured, instead of after it. */ export declare const AgentHostOverlapProviderPreparationConfigKey = "overlapProviderPreparation"; /** * Root config key forwarded from the renderer's * `chat.agentHost.experimental.prewarmSessions` setting. When `true`, a new * Copilot draft starts its SDK session and MCP servers before the first send. */ export declare const AgentHostPrewarmSessionsConfigKey = "prewarmSessions"; export declare const AgentHostMigrateLegacyCopilotCliEnabledConfigKey = "migrateLegacyCopilotCliEnabled"; export declare const AgentHostShowExternalSessionsConfigKey = "showExternalSessions"; export { ChatExternalSessionsMode as AgentHostExternalSessionsMode }; /** Root config key controlling automatic archival of inactive sessions with merged pull requests. */ export declare const AgentHostAutoArchiveMergedSessionsAfterDaysConfigKey = "autoArchiveMergedSessionsAfterDays"; /** Root config key controlling permanent deletion of automatically archived sessions with merged pull requests. */ export declare const AgentHostAutoDeleteArchivedMergedSessionsAfterDaysConfigKey = "autoDeleteArchivedMergedSessionsAfterDays"; /** Root config key disabling implicit terminal auto-approval defaults without changing explicit permissions. */ export declare const AgentHostTerminalIgnoreDefaultAutoApproveRulesConfigKey = "terminalIgnoreDefaultAutoApproveRules"; /** A VS Code terminal rule consumed by legacy managed-settings policy translation. */ export interface IAgentHostTerminalAutoApproveRule { readonly approve: boolean; readonly matchCommandLine?: boolean; } /** A VS Code terminal rule value, including null overrides. */ export type AgentHostTerminalAutoApproveRuleValue = boolean | null | IAgentHostTerminalAutoApproveRule; /** VS Code terminal rules used by legacy managed-settings policy translation. */ export type AgentHostTerminalAutoApproveRules = Record; /** * The VS Code setting IDs for terminal auto approve rules. Defined here so * renderer-side agent-host clients can read them without importing from * workbench terminal contributions. */ export declare const TERMINAL_AUTO_APPROVE_SETTING_ID = "chat.tools.terminal.autoApprove"; export declare const TERMINAL_IGNORE_DEFAULT_AUTO_APPROVE_RULES_SETTING_ID = "chat.tools.terminal.ignoreDefaultAutoApproveRules"; /** VS Code URL auto-approve setting ID, shared with renderer-side clients without a workbench dependency. */ export declare const URL_AUTO_APPROVE_SETTING_ID = "chat.tools.urls.autoApprove"; /** * 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 declare const AgentHostMcpServersConfigKey = "mcpServers"; /** * Map of server name → MCP server configuration, as stored in the * {@link AgentHostMcpServersConfigKey} root config value. */ export type AgentHostMcpServers = Record; export declare function telemetryLevelToAgentHostConfigValue(telemetryLevel: TelemetryLevel): TelemetryConfiguration; export declare function agentHostConfigValueToTelemetryLevel(value: unknown): TelemetryLevel | undefined; export declare const platformRootSchema: ISchema<{ "http.proxy": ISchemaProperty; "http.proxyKerberosServicePrincipal": ISchemaProperty; "http.noProxy": ISchemaProperty; ahpJsonlLoggingEnabled: ISchemaProperty; permissions: ISchemaProperty; disableRepoInfoTelemetry: ISchemaProperty; telemetryLevel: ISchemaProperty; editTelemetryEnabled: ISchemaProperty; byokModelsEnabled: ISchemaProperty; utilitySmallModel: ISchemaProperty; byokUtilityModelDefault: ISchemaProperty<"copilot" | "mainAgent" | "none">; codexAgentEnabled: ISchemaProperty; terminalAutoApproveEnabled: ISchemaProperty; globalAutoApproveEnabled: ISchemaProperty; autoApprovePolicyRestricted: ISchemaProperty; workspaceTrust: ISchemaProperty; autoReplyEnabled: ISchemaProperty; systemProxyEnabled: ISchemaProperty; githubMcpServerEnabled: ISchemaProperty; computerUseEnabled: ISchemaProperty; mcpToolRoutingEnabled: ISchemaProperty; mcpSamplingAllowedServers: ISchemaProperty; activeAgentTitleGeneration: ISchemaProperty; deferredTitleGeneration: ISchemaProperty; titleGeneration: ISchemaProperty<"activeAgent" | "agentReview" | "utility">; mcpConnectorsEnabled: ISchemaProperty; markdownPlanRichLinksEnabled: ISchemaProperty; workspaceSnapshotEnabled: ISchemaProperty; agentOrchestrationLimits: ISchemaProperty; artifactTools: ISchemaProperty; artifactIntegrations: ISchemaProperty; githubArtifactMarkReadyIgnoredChecks: ISchemaProperty; canvasesEnabled: ISchemaProperty; autoAttachPullRequests: ISchemaProperty; overlapProviderPreparation: ISchemaProperty; prewarmSessions: ISchemaProperty; migrateLegacyCopilotCliEnabled: ISchemaProperty; showExternalSessions: ISchemaProperty; autoArchiveMergedSessionsAfterDays: ISchemaProperty; autoDeleteArchivedMergedSessionsAfterDays: ISchemaProperty; editAutoApprovePatterns: ISchemaProperty>>; terminalIgnoreDefaultAutoApproveRules: ISchemaProperty; mcpServers: ISchemaProperty; }>; /** * 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. */ export declare const clientOwnedApprovalRootConfigKeys: ReadonlySet;