import { VSBuffer } from "../../../../base/common/buffer.js";
import { CancellationToken } from "../../../../base/common/cancellation.js";
import { Event } from "../../../../base/common/event.js";
import { TypeFromJsonSchema } from "../../../../base/common/jsonSchema.js";
import { IDisposable } from "../../../../base/common/lifecycle.js";
import { ThemeIcon } from "../../../../base/common/themables.js";
import { URI } from "../../../../base/common/uri.js";
import { IConfigurationService } from "../../../../platform/configuration/common/configuration.service.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 { IStorageService } from "../../../../platform/storage/common/storage.service.js";
import { IChatEntitlementService } from "../../../services/chat/common/chatEntitlementService.service.js";
import { IExtensionService } from "../../../services/extensions/common/extensions.service.js";
import { ILanguageModelsService } from "./languageModels.service.js";
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 ILanguageModelChatMetadata {
    readonly extension: ExtensionIdentifier;
    readonly name: string;
    readonly id: string;
    readonly vendor: string;
    readonly version: string;
    readonly tooltip?: string;
    readonly detail?: string;
    readonly family: string;
    readonly maxInputTokens: number;
    readonly maxOutputTokens: number;
    readonly isDefault?: boolean;
    readonly isUserSelectable?: boolean;
    readonly statusIcon?: ThemeIcon;
    readonly modelPickerCategory: {
        label: string;
        order: number;
    } | undefined;
    readonly auth?: {
        readonly providerLabel: string;
        readonly accountLabel?: string;
    };
    readonly capabilities?: {
        readonly vision?: boolean;
        readonly toolCalling?: boolean;
        readonly agentMode?: boolean;
        readonly editTools?: ReadonlyArray<string>;
    };
}
export declare namespace ILanguageModelChatMetadata {
    function suitableForAgentMode(metadata: ILanguageModelChatMetadata): boolean;
    function asQualifiedName(metadata: ILanguageModelChatMetadata): string;
    function matchesQualifiedName(name: string, metadata: ILanguageModelChatMetadata): boolean;
}
export interface ILanguageModelChatResponse {
    stream: AsyncIterable<IChatResponsePart | IChatResponsePart[]>;
    result: Promise<any>;
}
export interface ILanguageModelChatProvider {
    readonly onDidChange: Event<void>;
    provideLanguageModelChatInfo(options: {
        silent: boolean;
    }, token: CancellationToken): Promise<ILanguageModelChatMetadataAndIdentifier[]>;
    sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier, options: {
        [name: string]: any;
    }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
    provideTokenCount(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
}
export interface ILanguageModelChat {
    metadata: ILanguageModelChatMetadata;
    sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier, options: {
        [name: string]: any;
    }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
    provideTokenCount(message: string | IChatMessage, token: CancellationToken): Promise<number>;
}
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 interface ILanguageModelChatMetadataAndIdentifier {
    metadata: ILanguageModelChatMetadata;
    identifier: string;
}
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 managementCommand: {
            readonly type: "string";
            readonly description: string;
        };
        readonly when: {
            readonly type: "string";
            readonly description: string;
        };
    };
};
export type IUserFriendlyLanguageModel = TypeFromJsonSchema<typeof languageModelChatProviderType>;
export declare const languageModelChatProviderExtensionPoint: import("../../../services/extensions/common/extensionsRegistry.js").IExtensionPoint<{
    readonly vendor: string;
    readonly displayName: string;
    readonly managementCommand: string | undefined;
    readonly when: string | undefined;
} | {
    readonly vendor: string;
    readonly displayName: string;
    readonly managementCommand: string | undefined;
    readonly when: string | undefined;
}[]>;
export declare class LanguageModelsService implements ILanguageModelsService {
    private readonly _extensionService;
    private readonly _logService;
    private readonly _storageService;
    private readonly _configurationService;
    private readonly _chatEntitlementService;
    readonly _serviceBrand: undefined;
    private readonly _store;
    private readonly _providers;
    private readonly _modelCache;
    private readonly _vendors;
    private readonly _resolveLMSequencer;
    private _modelPickerUserPreferences;
    private readonly _hasUserSelectableModels;
    private readonly _contextKeyService;
    private readonly _onLanguageModelChange;
    readonly onDidChangeLanguageModels: Event<string>;
    constructor(_extensionService: IExtensionService, _logService: ILogService, _storageService: IStorageService, _contextKeyService: IContextKeyService, _configurationService: IConfigurationService, _chatEntitlementService: IChatEntitlementService);
    private _hasStoredModelForVendor;
    dispose(): void;
    updateModelPickerPreference(modelIdentifier: string, showInModelPicker: boolean): void;
    getVendors(): IUserFriendlyLanguageModel[];
    getLanguageModelIds(): string[];
    lookupLanguageModel(modelIdentifier: string): ILanguageModelChatMetadata | undefined;
    private _clearModelCache;
    private _resolveLanguageModels;
    selectLanguageModels(selector: ILanguageModelChatSelector, allowPromptingUser?: boolean): Promise<string[]>;
    registerLanguageModelProvider(vendor: string, provider: ILanguageModelChatProvider): IDisposable;
    sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: {
        [name: string]: any;
    }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
    computeTokenLength(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
}
export {};
