import { VSBuffer } from "../../../../base/common/buffer.js"; import { CancellationToken } from "../../../../base/common/cancellation.js"; import { IStringDictionary } from "../../../../base/common/collections.js"; import { Event } from "../../../../base/common/event.js"; import { IJSONSchema, TypeFromJsonSchema } from "../../../../base/common/jsonSchema.js"; import { IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import Severity from "../../../../base/common/severity.js"; import { ThemeIcon } from "../../../../base/common/themables.js"; import { IAction } from "../../../../base/common/actions.js"; import { URI } from "../../../../base/common/uri.js"; import { IContextKeyService } from "../../../../platform/contextkey/common/contextkey.service.js"; import { ExtensionIdentifier } from "../../../../platform/extensions/common/extensions.js"; import { ILogService } from "../../../../platform/log/common/log.service.js"; import { INotificationService } from "../../../../platform/notification/common/notification.service.js"; import { IOpenerService } from "../../../../platform/opener/common/opener.service.js"; import { IProductService } from "../../../../platform/product/common/productService.service.js"; import { IRequestService } from "../../../../platform/request/common/request.service.js"; import { IQuickInputService } from "../../../../platform/quickinput/common/quickInput.service.js"; import { ISecretStorageService } from "../../../../platform/secrets/common/secrets.service.js"; import { IStorageService } from "../../../../platform/storage/common/storage.service.js"; import { ITelemetryService } from "../../../../platform/telemetry/common/telemetry.service.js"; import { TelemetryTrustedValue } from "../../../../platform/telemetry/common/telemetryUtils.js"; import { IExtensionService } from "../../../services/extensions/common/extensions.service.js"; import { ChatAgentLocation } from "./constants.js"; import { ILanguageModelsProviderGroup } from "./languageModelsConfiguration.js"; import { ILanguageModelsConfigurationService } from "./languageModelsConfiguration.service.js"; import { ILanguageModelsService } from "./languageModels.service.js"; /** * Vendor id used for the built-in GitHub Copilot language model provider. Treated as the default * vendor across the chat stack (see `ILanguageModelProviderDescriptor.isDefault`). */ export declare const COPILOT_VENDOR_ID = "copilot"; /** Whether a missing model is conclusively absent from a vendor's live model list. Empty Copilot results remain transient while token-backed discovery completes. */ export declare function isLanguageModelVendorAbsenceConclusive(vendor: string, hasLiveModels: boolean, hasResolved: boolean): boolean; /** * Bucket reported for any non-Copilot provider that is not an in-built BYOK provider, i.e. a model * contributed by a third-party extension. We never report the third-party vendor id directly to avoid * logging potentially identifying values. */ export declare const THIRD_PARTY_PROVIDER_TELEMETRY_NAME = "3p-extension"; /** * Normalizes a non-Copilot model vendor into a non-identifying provider name suitable for telemetry: * the in-built BYOK vendor id (e.g. `openai`, `ollama`) when contributed by the built-in Copilot * extensions, or {@link THIRD_PARTY_PROVIDER_TELEMETRY_NAME} otherwise. Returns `undefined` for the * first-party Copilot vendor (or no vendor) so callers skip logging first-party usage. */ export declare function getByokProviderTelemetryName(vendor: string | undefined, extension: ExtensionIdentifier | undefined): string | undefined; export declare enum ChatMessageRole { System = 0, User = 1, Assistant = 2 } export declare enum LanguageModelPartAudience { Assistant = 0, User = 1, Extension = 2 } export interface IChatMessageTextPart { type: "text"; value: string; audience?: LanguageModelPartAudience[]; } export interface IChatMessageImagePart { type: "image_url"; value: IChatImageURLPart; } export interface IChatMessageThinkingPart { type: "thinking"; value: string | string[]; id?: string; metadata?: { readonly [key: string]: any; }; } export interface IChatMessageDataPart { type: "data"; mimeType: string; data: VSBuffer; audience?: LanguageModelPartAudience[]; } export interface IChatImageURLPart { /** * The image's MIME type (e.g., "image/png", "image/jpeg"). */ mimeType: ChatImageMimeType; /** * The raw binary data of the image, encoded as a Uint8Array. Note: do not use base64 encoding. Maximum image size is 5MB. */ data: VSBuffer; } /** * Enum for supported image MIME types. */ export declare enum ChatImageMimeType { PNG = "image/png", JPEG = "image/jpeg", GIF = "image/gif", WEBP = "image/webp", BMP = "image/bmp" } /** * Specifies the detail level of the image. */ export declare enum ImageDetailLevel { Low = "low", High = "high" } export interface IChatMessageToolResultPart { type: "tool_result"; toolCallId: string; value: (IChatResponseTextPart | IChatResponsePromptTsxPart | IChatResponseDataPart)[]; isError?: boolean; } export type IChatMessagePart = IChatMessageTextPart | IChatMessageToolResultPart | IChatResponseToolUsePart | IChatMessageImagePart | IChatMessageDataPart | IChatMessageThinkingPart; export interface IChatMessage { readonly name?: string | undefined; readonly role: ChatMessageRole; readonly content: IChatMessagePart[]; } export interface IChatResponseTextPart { type: "text"; value: string; audience?: LanguageModelPartAudience[]; } export interface IChatResponsePromptTsxPart { type: "prompt_tsx"; value: unknown; } export interface IChatResponseDataPart { type: "data"; mimeType: string; data: VSBuffer; audience?: LanguageModelPartAudience[]; } export interface IChatResponseToolUsePart { type: "tool_use"; name: string; toolCallId: string; parameters: any; } export interface IChatResponseThinkingPart { type: "thinking"; value: string | string[]; id?: string; metadata?: { readonly [key: string]: any; }; } export interface IChatResponsePullRequestPart { type: "pullRequest"; uri: URI; title: string; description: string; author: string; linkTag: string; } export type IChatResponsePart = IChatResponseTextPart | IChatResponseToolUsePart | IChatResponseDataPart | IChatResponseThinkingPart; export type IExtendedChatResponsePart = IChatResponsePullRequestPart; export interface ILanguageModelConfigurationSchema extends IJSONSchema { properties?: { [key: string]: IJSONSchema & { /** When set to `'navigation'`, the property is shown as a primary action in the model picker. */ group?: string; /** Labels for enum values. If provided, these are shown instead of the raw enum values. */ enumItemLabels?: string[]; /** Enum values shown but not selectable, parallel to `enum`; `enumDescriptions` says why. */ enumItemDisabled?: boolean[]; /** When `true`, the property is displayed but cannot be modified by the user. */ readOnly?: boolean; }; }; } export interface IAutoModelTierPromotion { readonly id: string; readonly message?: string; readonly discountPercent: number; readonly tierIds: readonly string[]; readonly startsAt?: string; readonly endsAt?: string; } export interface ILanguageModelChatMetadata { /** Host-advertised options whose defaults are not explicit user choices. */ readonly configurationDefaultKeys?: readonly string[]; readonly managedModelDefaults?: { readonly model: boolean; readonly keys: readonly string[]; }; readonly extension: ExtensionIdentifier; readonly name: string; readonly id: string; readonly vendor: string; readonly version: string; readonly tooltip?: string; readonly detail?: string; /** * Auto's advertised discount, as a whole-number percentage. Set only by the agent host's * Auto model, whose {@link tooltip} then omits the discount so the picker can describe it * alongside Auto's routing tiers. Extension-provided Auto models describe their discount * in {@link tooltip} instead. */ readonly autoModelDiscountPercent?: number; /** Whether the agent host presents its Auto model as Copilot Fusion. */ readonly autoModelFusion?: boolean; /** * The tier the agent host runs Copilot Fusion at for editor and terminal inline chat, whatever * effort level is selected, so inline chat offers none. Absent when the host pins no tier there. */ readonly autoModelFusionInlineChatTier?: string; /** Set only on the agent host's Auto model presented as Fusion. */ readonly autoModelTierPromotions?: readonly IAutoModelTierPromotion[]; /** Auto's tiers come from the provider, which may hide some, including HydraFusion ones. */ readonly autoModelProviderTiers?: boolean; readonly multiplierNumeric?: number; readonly isBYOK?: boolean; readonly pricing?: string; readonly inputCost?: number; readonly cacheCost?: number; readonly cacheWriteCost?: number; readonly outputCost?: number; readonly longContextInputCost?: number; readonly longContextCacheCost?: number; readonly longContextCacheWriteCost?: number; readonly longContextOutputCost?: number; readonly priceCategory?: string; readonly category?: string; readonly family: string; readonly maxInputTokens: number; readonly maxOutputTokens: number; /** The total context window, independent of the input and output token limits. */ readonly maxContextWindowTokens?: number; readonly isDefaultForLocation: { [K in ChatAgentLocation]?: boolean; }; readonly isUserSelectable?: boolean; readonly statusIcon?: ThemeIcon; readonly auth?: { readonly providerLabel: string; readonly accountLabel?: string; }; readonly capabilities?: { readonly vision?: boolean; readonly toolCalling?: boolean; readonly agentMode?: boolean; readonly editTools?: ReadonlyArray; readonly apiType?: "chatCompletions" | "responses" | "messages"; readonly adaptiveThinking?: boolean; }; /** * When set, this model is only shown in the model picker for the specified chat session type. * Models with this property are excluded from the general model picker and only appear * when the user is in a session matching this type. */ readonly targetChatSessionType?: string; /** * Optional grouping hint for the model picker. When set, the picker buckets this model * under a sub-group within its vendor, identified by this vendor id — e.g. agent-host models, * which all share one vendor, grouped by their upstream provider — instead of a single * vendor-wide bucket. The display name is resolved from the vendor registry * ({@link ILanguageModelsService.getVendors}), the same source used for every other vendor. * Presentation-only; it does not affect model selection or routing. */ readonly modelGroup?: { readonly id: string; /** * Identifies a trusted source presentation owned by this model's vendor. * Source ids are resolved together with {@link ILanguageModelChatMetadata.vendor}, * so another vendor cannot claim the same presentation by reusing the id. */ readonly sourceId?: string; }; /** * For an agent-host copy of an extension-provided BYOK model, the identifier the * original model is registered under in the renderer's LM service * (`toModelIdentifier(vendor, group, id)` — `//` or `/`). * This is exactly the id the "Manage Models" view keys visibility by; it is carried * across the agent-host bridge and surfaced here so the model picker can honour the * model's visibility toggle. Absent for native agent-host models and non-agent-host * models. */ readonly byokModelIdentifier?: string; /** * An optional JSON schema describing the per-model configuration options. * Used to validate user-provided per-model configuration in `chatLanguageModels.json`. */ readonly configurationSchema?: ILanguageModelConfigurationSchema; /** * Optional warning text to display in the model picker hover as a warning banner. * The keys are warning categories (e.g. "data_retention") and the values are markdown strings. */ readonly warningText?: IStringDictionary; /** * Optional informational text to display in the model picker hover as an info banner. * The keys are info categories (e.g. "model_relocated") and the values are markdown strings. * Unlike {@link warningText}, these are neutral notices and never signal a problem with the model. */ readonly infoText?: IStringDictionary; /** * Optional promotional information for this model. A positive `discountPercent` * surfaces the full promotional UI; `0` is a message-only promo that features the * model without a price change; a negative value is malformed and is ignored. * `endsAt` is optional — open-ended promos omit it and render no end date. * `showBanner` is optional — the promo is banner-eligible unless it is `false`. */ readonly promo?: { readonly id: string; readonly discountPercent: number; readonly endsAt?: string; readonly message: string; readonly showBanner?: boolean; }; } /** * Uses the declared context window, falling back to input/output budgets for legacy providers. * A configured input limit can reduce the effective window, but never exceed the declared maximum. */ export declare function getModelContextWindowTotal(metadata: ILanguageModelChatMetadata, inputTokenLimit?: number): number; export declare namespace ILanguageModelChatMetadata { function suitableForAgentMode(metadata: ILanguageModelChatMetadata): boolean; function asQualifiedName(metadata: ILanguageModelChatMetadata): string; function matchesQualifiedName(name: string, metadata: ILanguageModelChatMetadata): boolean; function hasPromoDiscount(metadata: ILanguageModelChatMetadata): metadata is ILanguageModelChatMetadata & { readonly promo: NonNullable; }; /** Whether the model has a promo message to surface, including message-only (0%) promos. */ function hasPromoMessage(metadata: ILanguageModelChatMetadata): metadata is ILanguageModelChatMetadata & { readonly promo: NonNullable; }; /** * Whether the model's promo may also be surfaced as a banner above the chat input. * Promos are banner-eligible by default; `showBanner: false` keeps them in the model picker only. */ function hasPromoBanner(metadata: ILanguageModelChatMetadata): metadata is ILanguageModelChatMetadata & { readonly promo: NonNullable; }; /** The localized "Ends {date}." sentence, or `undefined` for a missing or unparsable end date. */ function getPromoEndsAtLabel(endsAt: string | undefined): string | undefined; function isAutoTierPromotionActive(promotion: IAutoModelTierPromotion, now: number): boolean; /** The active promotion with the largest discount. */ function getAutoTierPromotion(metadata: ILanguageModelChatMetadata, tier: unknown, now?: number): IAutoModelTierPromotion | undefined; function getAutoTierDiscountPercent(metadata: ILanguageModelChatMetadata, tier: unknown, now?: number): number | undefined; /** * Documentation link explaining how Auto model selection works. * NOTE: Also defined in extensions/copilot/src/extension/conversation/common/languageModelAccess.ts — keep in sync. */ const autoModelSelectionDocsUrl = "https://docs.github.com/en/copilot/concepts/models/auto-model-selection"; /** Where Copilot Fusion's description links for more about it. */ const fusionDocsUrl = "https://aka.ms/vscode-copilot-fusion"; /** * Builds the shared description shown for the Auto model, rendered as Markdown * with a "Learn More" link. The discount is described separately by * {@link getAutoModelDiscountDescription}. */ function getAutoModelDescription(fusion?: boolean): string; /** Copilot Fusion's one-sentence description, as plain text without its "Learn more" link. */ function getFusionSummary(): string; /** * Describes Auto's discount, naming the tier it applies to when known. * * @param discountPercent Whole-number percentage (e.g. `10` for 10%). * @param tierLabel The label of Auto's selected tier, e.g. "Efficiency". */ function getAutoModelDiscountDescription(discountPercent: number, tierLabel?: string): string; /** * The "Manage Models" identifier that an agent-host copy of an extension-provided * BYOK model is toggled under, or `undefined` when the model is not such a copy. * * Agent-host BYOK models make a round trip that rewrites their id (the node agent host * re-advertises the extension model under the agent-host vendor). Their original LM * service identifier — `toModelIdentifier(vendor, group, id)`, i.e. `//` * or `/`, which is what the Manage Models view stores when hiding the model — * is carried across the bridge and surfaced on {@link ILanguageModelChatMetadata.byokModelIdentifier}. * This returns it, so callers can match the copy against the user's visibility toggles. * * Returns `undefined` for models that are not agent-host BYOK copies (native harness * models and non-agent-host models), which are matched by their own identifier instead. */ function getAgentHostByokManageModelsIdentifier(metadata: ILanguageModelChatMetadata): string | undefined; } export interface ILanguageModelChatResponse { stream: AsyncIterable; result: Promise; } export declare function getTextResponseFromStream(response: ILanguageModelChatResponse): Promise; export interface ILanguageModelChatProvider { readonly onDidChange: Event; provideLanguageModelChatInfo(options: ILanguageModelChatInfoOptions, token: CancellationToken): Promise; sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier | undefined, options: ILanguageModelChatRequestOptions, token: CancellationToken): Promise; provideTokenCount(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise; } export interface ILanguageModelChat { metadata: ILanguageModelChatMetadata; sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier | undefined, options: ILanguageModelChatRequestOptions, token: CancellationToken): Promise; provideTokenCount(message: string | IChatMessage, token: CancellationToken): Promise; } export interface ILanguageModelChatSelector { readonly name?: string; readonly id?: string; readonly vendor?: string; readonly version?: string; readonly family?: string; readonly tokens?: number; readonly extension?: ExtensionIdentifier; } export declare function isILanguageModelChatSelector(value: unknown): value is ILanguageModelChatSelector; export interface ILanguageModelChatMetadataAndIdentifier { metadata: ILanguageModelChatMetadata; identifier: string; } export interface ILanguageModelChatInfoOptions { readonly group?: string; readonly silent: boolean; readonly configuration?: IStringDictionary; } export interface ILanguageModelChatRequestOptions { readonly modelOptions?: IStringDictionary; readonly configuration?: IStringDictionary; readonly includeEncryptedThinking?: boolean; readonly [name: string]: any; } export interface ILanguageModelsGroup { readonly group?: ILanguageModelsProviderGroup; readonly modelIdentifiers: string[]; readonly status?: { readonly message: string; readonly severity: Severity; }; } /** Read/write access to model-specific configuration, globally or within one conversation. */ export interface IModelConfigurationAccess { getModelConfiguration(modelId: string): IStringDictionary | undefined; /** Effective schema for this scope, including provider or managed startup defaults. */ getModelConfigurationSchema?(modelId: string): ILanguageModelConfigurationSchema | undefined; setModelConfiguration(modelId: string, values: IStringDictionary): Promise; /** Applies values in this scope without persisting them or reporting them as a selection. */ presentModelConfiguration?(modelId: string, values: IStringDictionary): void; getModelConfigurationActions(modelId: string): IAction[]; /** * Configuration changes within this scope, once per update with the models it changed, so an update covering * many models (such as a chat's snapshot) notifies once. Global access uses `onDidChangeLanguageModels`. */ readonly onDidChange?: Event; } /** Where a pin change was made, for telemetry. */ export interface IModelPinTelemetryContext { /** The model picker open the change was made in. */ readonly pickerSessionId: string; } export declare function getLanguageModelProviderDisplayName(languageModelsService: ILanguageModelsService, vendor: string): string; /** The icon a language model chat provider declared, if any. */ export declare function getLanguageModelProviderIcon(languageModelsService: ILanguageModelsService, vendor: string): LanguageModelProviderIcon | undefined; export declare function getLanguageModelDisplayNameWithProvider(model: ILanguageModelChatMetadataAndIdentifier, languageModelsService: ILanguageModelsService): string; export interface IModelControlEntry { readonly label: string; readonly featured?: boolean; /** * Keeps the model out of the shortlist the picker leads with, even when it is the * newest of its line. For a line that has been replaced by another rather than by a * newer version of itself, which no rule can work out on its own. */ readonly demoted?: boolean; readonly minVSCodeVersion?: string; readonly exists: boolean; } export interface IModelsControlManifest { readonly free: IStringDictionary; readonly paid: IStringDictionary; } declare const languageModelChatProviderType: { readonly type: "object"; readonly required: [ "vendor", "displayName" ]; readonly properties: { readonly vendor: { readonly type: "string"; readonly description: string; }; readonly displayName: { readonly type: "string"; readonly description: string; }; readonly configuration: { readonly type: "object"; readonly description: string; readonly anyOf: [ { readonly $ref: "http://json-schema.org/draft-07/schema#"; }, { readonly properties: { readonly properties: { readonly type: "object"; readonly additionalProperties: { readonly $ref: "http://json-schema.org/draft-07/schema#"; readonly properties: { readonly secret: { readonly type: "boolean"; readonly description: string; }; }; }; }; readonly additionalProperties: { readonly $ref: "http://json-schema.org/draft-07/schema#"; readonly properties: { readonly secret: { readonly type: "boolean"; readonly description: string; }; }; }; }; } ]; }; readonly managementCommand: { readonly type: "string"; readonly description: string; readonly deprecated: true; readonly deprecationMessage: string; }; readonly icon: { readonly markdownDescription: string; readonly anyOf: [ { readonly type: "string"; }, { readonly type: "object"; readonly properties: { readonly light: { readonly description: string; readonly type: "string"; }; readonly dark: { readonly description: string; readonly type: "string"; }; }; readonly required: [ "light", "dark" ]; } ]; }; readonly deprecation: { readonly type: "object"; readonly description: string; readonly properties: { readonly link: { readonly type: "string"; readonly description: string; }; }; }; readonly when: { readonly type: "string"; readonly description: string; }; }; }; /** A `languageModelChatProviders` entry as written in an extension's `package.json`. */ type ILanguageModelChatProviderContribution = TypeFromJsonSchema; /** The icon of a language model chat provider: a theme icon, or images for light and dark themes. */ export type LanguageModelProviderIcon = ThemeIcon | { readonly light: URI; readonly dark: URI; }; export type IUserFriendlyLanguageModel = Omit & { /** * Marks a provider as deprecated. The Manage Models view renders a link * (pointing to a replacement, e.g. a `vscode:extension/.` URI) * next to the provider name. Optional so existing provider descriptors are unaffected. */ readonly deprecation?: { readonly link?: string; }; /** The provider's icon, with any image paths already resolved against the contributing extension. */ readonly icon?: LanguageModelProviderIcon; }; /** * Resolves a contributed provider icon the way `languageModelTools` and `commands` do: a * `$(name)` reference becomes a theme icon and anything else is a path relative to the * contributing extension. Returns `undefined` for a malformed value, or for a path that * leaves the extension's folder. */ export declare function resolveLanguageModelProviderIcon(icon: ILanguageModelChatProviderContribution["icon"], extensionLocation: URI): LanguageModelProviderIcon | undefined; export interface ILanguageModelProviderDescriptor extends IUserFriendlyLanguageModel { readonly isDefault: boolean; } /** * Resolves a provider `deprecation.link` for opening inside the current build. Contributions point * at the replacement extension with a stable `vscode:extension/` URI, but the URL service only * routes URIs whose scheme matches this build's `urlProtocol` (e.g. `code-oss`, `vscode-insiders`). * The `vscode:` scheme is therefore rewritten to the current protocol so the extensions URL handler * opens the extension; without this the opener falls back to treating the URI as a (non-existent) * file resource and fails. Other schemes (http(s), command) are returned unchanged. */ export declare function resolveProviderDeprecationLink(link: string, urlProtocol: string | undefined): URI; export declare const languageModelChatProviderExtensionPoint: import("../../../services/extensions/common/extensionsRegistry.js").IExtensionPoint<{ readonly vendor: string; readonly displayName: string; readonly configuration: undefined; readonly managementCommand: string | undefined; readonly icon: string | { readonly light: string; readonly dark: string; } | undefined; readonly deprecation: { readonly link: string | undefined; } | undefined; readonly when: string | undefined; }[] | { readonly vendor: string; readonly displayName: string; readonly configuration: undefined; readonly managementCommand: string | undefined; readonly icon: string | { readonly light: string; readonly dark: string; } | undefined; readonly deprecation: { readonly link: string | undefined; } | undefined; readonly when: string | undefined; }>; /** Returns a known, client-resolved Auto tier suitable for edit attribution. */ export declare function getAutoModelTier(modelId: string | undefined, autoTier: string | undefined): "balance" | "efficiency" | "fast" | "intelligence" | undefined; /** The provider-agnostic model id of the Auto meta-model. */ export declare const AUTO_RAW_MODEL_ID = "auto"; /** * Whether the user brought this model themselves rather than getting it from the * built-in provider. * * This follows the provider group, the same thing the picker names a model's source by, * rather than the BYOK flags: a host that forwards the built-in provider's models sets * those flags on every model it relays, which would file the whole catalogue under the * user's own models. */ export declare function isUserProvidedModel(model: ILanguageModelChatMetadataAndIdentifier, languageModelsService: ILanguageModelsService): boolean; /** * A model's identifier for telemetry. Only built-in models are reported, wherever they * are relayed from; models the user brought, and unknown ones, report as "unknown". */ export declare function getTelemetryModelIdentifier(model: ILanguageModelChatMetadataAndIdentifier | undefined, languageModelsService: ILanguageModelsService): string | TelemetryTrustedValue; export declare function isAutoLanguageModel(model: ILanguageModelChatMetadataAndIdentifier | undefined): boolean; /** * Whether a model can be hidden from the picker. The default provider's `Auto` and * agent-host BYOK copies have no row in Manage Language Models, so hiding them would * be permanent. `metadata` is undefined before models resolve, hence the id check. */ export declare function canHideModel(identifier: string, metadata: ILanguageModelChatMetadata | undefined): boolean; /** * Builds the per-model configuration submenu actions from a model's * {@link ILanguageModelConfigurationSchema}. The current value is read from * `currentConfig` and selections are routed through `setValue`, allowing the * caller to decide whether changes apply globally or to a per-editor override. */ export declare function createModelConfigurationActions(schema: ILanguageModelConfigurationSchema | undefined, currentConfig: IStringDictionary, setValue: (key: string, value: unknown) => void): IAction[]; export declare class LanguageModelsService implements ILanguageModelsService { private readonly _extensionService; private readonly _logService; private readonly _storageService; private readonly _contextKeyService; private readonly _languageModelsConfigurationService; private readonly _quickInputService; private readonly _secretStorageService; private readonly _productService; private readonly _requestService; private readonly _notificationService; private readonly _openerService; private readonly _telemetryService; private static SECRET_KEY_PREFIX; private static SECRET_INPUT; readonly _serviceBrand: undefined; private readonly _store; private readonly _providers; private readonly _vendors; /** Parsed `when` clauses of {@link _vendors}, by their source text, since {@link getVendors} is read for every model. */ private readonly _vendorWhenClauses; /** Vendors for which a deprecation notice has already been shown this session. */ private readonly _deprecationNoticeShownVendors; private readonly _onDidChangeLanguageModelVendors; readonly onDidChangeLanguageModelVendors: Event; private readonly _modelsGroups; private readonly _modelCache; private readonly _resolveLMSequencer; /** * The resolution each vendor has queued but not started. Requests made meanwhile join it rather * than queue another, e.g. `selectChatModels` calls that each re-resolve every vendor. */ private readonly _queuedResolutions; private readonly _modelConfigurations; private readonly _hasUserSelectableModels; private readonly _hasNonCopilotUserSelectableModels; private readonly _onLanguageModelChange; readonly onDidChangeLanguageModels: Event; private _recentlyUsedModelIds; private _pinnedModelIds; private _hiddenModelIds; private readonly _onDidChangeModelsControlManifest; readonly onDidChangeModelsControlManifest: Event; private readonly _onDidChangePinnedModels; readonly onDidChangePinnedModels: Event; private readonly _onDidChangeModelVisibility; readonly onDidChangeModelVisibility: Event; private _modelsControlManifest; private _modelsControlRawResponse; private _chatControlUrl; private _chatControlDisposed; private readonly _restrictedChatParticipants; readonly restrictedChatParticipants: IObservable<{ [name: string]: string[]; }>; constructor(_extensionService: IExtensionService, _logService: ILogService, _storageService: IStorageService, _contextKeyService: IContextKeyService, _languageModelsConfigurationService: ILanguageModelsConfigurationService, _quickInputService: IQuickInputService, _secretStorageService: ISecretStorageService, _productService: IProductService, _requestService: IRequestService, _notificationService: INotificationService, _openerService: IOpenerService, _telemetryService: ITelemetryService); deltaLanguageModelChatProviderDescriptors(added: IUserFriendlyLanguageModel[], removed: IUserFriendlyLanguageModel[]): void; private _onDidChangeLanguageModelGroups; getVendors(): ILanguageModelProviderDescriptor[]; getLanguageModelIds(): string[]; lookupLanguageModel(modelIdentifier: string): ILanguageModelChatMetadata | undefined; lookupLanguageModelByQualifiedName(referenceName: string): ILanguageModelChatMetadataAndIdentifier | undefined; private _resolveAllLanguageModels; private _hasGroupStructureChanged; getLanguageModelGroups(vendor: string): ILanguageModelsGroup[]; hasResolvedVendor(vendor: string): boolean; selectLanguageModels(selector: ILanguageModelChatSelector): Promise; registerLanguageModelProvider(vendor: string, provider: ILanguageModelChatProvider): IDisposable; sendChatRequest(modelId: string, from: ExtensionIdentifier | undefined, messages: IChatMessage[], options: ILanguageModelChatRequestOptions, token: CancellationToken): Promise; /** * When a chat request is made against a deprecated provider (one that contributes a * `deprecation.link`), prompt the user once per session to install the replacement * extension. The notification can be dismissed, and offers a "Don't Show Again" choice that * is persisted across sessions via the notification service's `neverShowAgain` support. */ private _maybeShowProviderDeprecationNotice; /** * Reports which in-built BYOK provider (or third-party extension) backs a model request. First-party * Copilot models are intentionally not reported here (see {@link getByokProviderTelemetryName}). */ private _logProviderUsageTelemetry; private _resolveModelConfigurationWithDefaults; computeTokenLength(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise; getModelConfiguration(modelId: string, includeDefaults?: boolean): IStringDictionary | undefined; setModelConfiguration(modelId: string, values: IStringDictionary): Promise; getModelConfigurationActions(modelId: string): IAction[]; configureLanguageModelsProviderGroup(vendorId: string, providerGroupName?: string): Promise; renameLanguageModelsProviderGroup(vendorId: string, providerGroupName: string): Promise; updateLanguageModelsProviderGroupApiKey(vendorId: string, providerGroupName: string): Promise; addLanguageModelsProviderGroupModel(vendorId: string, providerGroupName: string): Promise; openLanguageModelsProviderGroupSettings(vendorId: string, providerGroupName: string): Promise; configureModel(modelId: string): Promise; private _getModelConfigurationSnippet; addLanguageModelsProviderGroup(name: string, vendorId: string, configuration: IStringDictionary | undefined): Promise; removeLanguageModelsProviderGroup(vendorId: string, providerGroupName: string): Promise; private requireConfiguring; private getSnippetForFirstUnconfiguredProperty; private getSnippetForProperty; private getSnippetForArrayItem; private getDefaultSnippetBodyText; private promptForName; private promptForConfiguration; private promptForValue; private canPromptForProperty; private getDescriptionPlaintext; private promptForArray; private promptForEnum; private promptForInput; private encodeSecretKey; private decodeSecretKey; private _clearModelCache; private _clearModelConfigurations; private _resolveConfiguration; private _resolveLanguageModelProviderGroup; private _deleteSecretsInConfiguration; migrateLanguageModelsProviderGroup(languageModelsProviderGroup: ILanguageModelsProviderGroup): Promise; private _readRecentlyUsedModels; private _saveRecentlyUsedModels; getRecentlyUsedModelIds(): string[]; addToRecentlyUsedList(modelIdentifier: string): void; clearRecentlyUsedList(): void; private _readPinnedModels; private _savePinnedModels; getPinnedModelIds(): string[]; pinModel(modelIdentifier: string, telemetry?: IModelPinTelemetryContext): void; unpinModel(modelIdentifier: string, telemetry?: IModelPinTelemetryContext): void; private _logPinChange; isModelPinned(modelIdentifier: string): boolean; private _getGroupNameForVendor; private _getModelIdsInGroup; private _readVisibility; private _saveVisibility; isGroupHidden(vendor: string, groupName: string): boolean; isModelHidden(modelIdentifier: string): boolean; setGroupHidden(vendor: string, groupName: string, hidden: boolean): void; setModelHidden(modelIdentifier: string, hidden: boolean): void; setModelsHidden(modelIdentifiers: readonly string[], hidden: boolean): void; getHiddenModelIds(): string[]; getModelsControlManifest(): IModelsControlManifest; private _setModelsControlManifest; private _refreshModelsControlManifest; private _initChatControlData; private _refreshChatControlData; private _fetchChatControlData; dispose(): void; } export {};