import { IPolicyData } from "../../../../base/common/defaultAccount.js"; import { IProductConfiguration } from "../../../../base/common/product.js"; import { IManagedSettingsCompatibilityError } from "../../../../platform/defaultAccount/common/defaultAccount.js"; /** * A single MCP server matcher entry in the `allowedMcpServers` / `deniedMcpServers` managed * settings, identifying a server by exactly one strategy: name, remote URL pattern, or local * command invocation. */ export type IManagedMcpServerMatcher = { readonly serverName: string; } | { readonly serverUrl: string; } | { readonly serverCommand: readonly string[]; }; /** * Response shape from the Copilot `/copilot_internal/managed_settings` endpoint. * The endpoint returns `.github/copilot/settings.json` content from the * enterprise's source org. An empty response (`{}`) is success and means * "no policy file present". * * Unknown keys are accepted via the index signature so the client is * forward-compatible with future additions to the registry schema. * * Exported for unit-testing the {@link adaptManagedSettings} shape transformation. */ export interface IManagedSettingsResponse { readonly permissions?: { readonly disableBypassPermissionsMode?: string; readonly allow?: readonly string[]; readonly ask?: readonly string[]; readonly deny?: readonly string[]; /** * Legacy location for the default chat model. Retained for deployments authored against * the original schema; the top-level {@link IManagedSettingsResponse.model} wins when both * are present. */ readonly model?: string; }; /** * Default chat model (`auto`, a model family name, or a full model id). Canonical top-level * location in the current schema; supersedes the legacy nested `permissions.model`. */ readonly model?: string; readonly enabledPlugins?: Record; readonly extraKnownMarketplaces?: Record; readonly strictKnownMarketplaces?: readonly unknown[]; readonly allowedMcpServers?: ReadonlyArray; readonly deniedMcpServers?: ReadonlyArray; readonly strictPluginOnlyCustomization?: boolean; readonly allowManagedMcpServersOnly?: boolean; readonly allowManagedHooksOnly?: boolean; readonly forceRemoteSettingsRefresh?: boolean; readonly telemetry?: { readonly enabled?: boolean; readonly endpoint?: string; readonly protocol?: "grpc" | "http/protobuf" | "http/json"; readonly captureContent?: boolean; readonly capture?: { readonly identity?: boolean; }; readonly lockCaptureContent?: boolean; readonly serviceName?: string; readonly resourceAttributes?: Record; readonly headers?: Record; readonly filePath?: string; }; /** Any unknown keys in the response are accepted for forward compatibility. */ readonly [key: string]: unknown; } /** * Append the client identity to a `managed_settings` request URL, naming the implementations that * parse and enforce the response so the service can fail closed when they are too old to honor a * setting it would otherwise deliver. `copilot_runtime_version` is present only when a runtime is * bundled. * * Existing query parameters are preserved, and the URL is returned unchanged when it cannot be * parsed so a malformed `managedSettingsUrl` cannot turn into a thrown request. The identity * travels in the query string because neither header channel reaches the service; see the PR and * ADR for that rationale. */ export declare function appendManagedSettingsClientIdentity(url: string, product: Pick): string; export declare function parseManagedSettingsCompatibilityError(response: unknown): IManagedSettingsCompatibilityError | undefined; /** * Adapt the `managed_settings` API response into the `managedSettings` slice of * {@link IPolicyData} that the policy framework consumes. This is a thin wrapper * around {@link normalizeManagedSettings} — the single normalization path shared * by all delivery channels (server API, file-based, native MDM) — so downstream * projection and policy `value()` callbacks behave identically regardless of source. * * Exported for unit-testing the shape transformation independently of network I/O. */ export declare function adaptManagedSettings(response: IManagedSettingsResponse, onWarn?: (msg: string) => void): Partial;