import { CancellationToken } from "../../../../../../base/common/cancellation.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { SessionModelInfo } from "../../../../../../platform/agentHost/common/state/sessionState.js"; import { ILanguageModelChatMetadataAndIdentifier, ILanguageModelChatProvider } from "../../../common/languageModels.js"; import { ILanguageModelsService } from "../../../common/languageModels.service.js"; /** * Returns whether an agent host provider exposes a synthetic "Auto" model to * fall back to. * * Today only the Copilot CLI harness exposes an Auto selection and can run * without an explicit model, so it shows "Auto" rather than a "No models * available" state when no models are listed. Other harnesses (Claude, * Codex, …) require an explicit model. * * `provider` is the underlying agent provider id (e.g. `'copilotcli'`, * `'claude'`, `'codex'`), not the `agent-host-` session type. * * TODO: hoist this capability onto the agent host protocol (e.g. a * `supportsAutoModel?: boolean` on `IAgentDescriptor` / `AgentInfo`) so each * agent declares its own value instead of this allow-list living in core. */ export declare function agentHostProviderSupportsAutoModel(provider: string): boolean; /** * Read-only view of the workbench model catalogue an agent host's models are enriched from. * * Narrowed to the reads {@link AgentHostLanguageModelProvider} performs (all plain lookups into * already-registered models, so none of them re-enter a provider) plus the change signal, both so * the dependency stays obviously side-effect free and so tests can supply a small fake. */ export type IAgentHostModelCatalogue = Pick; /** * Exposes models available from the agent host process as selectable * language models in the chat model picker. Models are provided from * root state (via {@link AgentInfo.models}) rather than via RPC. */ export declare class AgentHostLanguageModelProvider extends Disposable implements ILanguageModelChatProvider { private readonly _sessionType; private readonly _vendor; private readonly _catalogue?; private readonly _onDidChange; readonly onDidChange: import("../../../../../../base/common/event.js").Event; private readonly _promotionChange; private _models; /** Whether {@link updateModels} was called, whose first call publishes even an empty list so the vendor resolves. */ private _receivedModels; private _additionalModels; constructor(_sessionType: string, _vendor: string, _catalogue?: IAgentHostModelCatalogue | undefined); /** * Called by {@link AgentHostContribution} when models change in root state. */ updateModels(models: readonly SessionModelInfo[]): void; private _schedulePromotionChange; private static readonly _maxPromotionWaitMs; /** A running promotion's discount when it covers every tier Auto offers. */ private static _wholeModelPromotionDiscount; /** Adds service-discovered models, missing Copilot pricing and matching Cloud tier labels without changing host capabilities or policy. */ updateAdditionalModels(models: readonly SessionModelInfo[]): void; provideLanguageModelChatInfo(_options: unknown, _token: CancellationToken): Promise; /** * The picker detail and description of a model that routes across others: Auto advertises its * discount, and HydraFusion that it is a research preview. Other models have neither. */ private _routingPresentationFor; /** * The workbench catalogue entry describing the same model, when one is known. * * A host driving the Copilot SDK advertises no billing and, where the SDK omits them, no token * limits — so the CAPI-backed Copilot catalogue fills the gaps. * * Matching by raw model id does not prove the two describe the same offering — they can differ * by entitlement, policy, rollout or billing route — so this is restricted to models billed * through Copilot and only ever fills fields the host left absent. * * The token-limit half is a shim: those are native protocol fields, and a host that populates * them makes the fallback dead. The billing half is not. Pricing is deliberately kept off the * agent host protocol as operator-sensitive, so a client that wants to show it has to source it * itself. Removing this join therefore means dropping pricing for these models, which is a * product decision rather than a cleanup. */ private _catalogueEntryFor; /** Adapts host configuration, enriching only display text from matching Cloud tiers or missing effort labels. */ private _toLanguageModelConfigurationSchema; private static _cloudContextTierLabels; /** Adds the provider's unavailable tiers as disabled entries; enabled tiers missing from `enum` stay out. */ private static _withUnavailableAutoTiers; /** Config keys whose enum values are reasoning-effort levels, whatever the producer named them. */ private static readonly _reasoningEffortKeys; /** * Localized labels and descriptions for a reasoning-effort enum whose producer supplied none. * * A host that derives its schema from an upstream SDK advertises the accepted effort values * without display text, because it has none the SDK did not give it — the Copilot agent host * inside a cloud sandbox does exactly that. Deriving the text here keeps the picker from * rendering raw values like `xhigh`, and matches what the agents that build their schema * locally already emit. * * Only synthesized when every enum value is a string, since labels align with `enum` by index * and a partial list would mislabel the rest. * * No `default` is synthesized: schema defaults are merged into the configuration that is sent * (see `resolveModelConfiguration`), so inventing one would send an explicit effort where the * host expects the value omitted and the backend to choose. */ private static _reasoningEffortDisplay; private static _groupForConfigKey; /** * Derives the picker group id for a model — the vendor its models are bucketed * under. A producer may pin the group id explicitly in `_meta` (e.g. Claude * stamps its transport vendor — `copilot`/`anthropic` — there while keeping * `provider` as the `claude` routing owner); that wins. Otherwise BYOK models * are surfaced by the agent host under the `vendor/[group/]id` selection id (see * `synthesizeByokSessionConfig`), so their upstream vendor is the id prefix; native * harness models have no prefix and group under their `provider` (the harness, * e.g. `copilotcli`). The picker resolves the display name from the vendor * registry — no name mapping lives here. */ private _modelGroupFor; sendChatRequest(): Promise; provideTokenCount(): Promise; }