import { VSBuffer } from "../../../../base/common/buffer.js"; import { IMarkdownString } from "../../../../base/common/htmlContent.js"; import { IReader } from "../../../../base/common/observable.js"; import { URI } from "../../../../base/common/uri.js"; import { IChatResponseViewModel, IChatRequestViewModel } from "./model/chatViewModel.js"; import { IResponse } from "./model/chatModel.js"; import { IChatToolInvocation, IChatToolInvocationSerialized } from "./chatService/chatService.js"; import { IToolResultInputOutputDetails, ToolInputOutputBase } from "./tools/languageModelToolsService.js"; import { type IChatRequestVariableEntry } from "./attachments/chatVariableEntries.js"; import { coerceImageBuffer } from "./chatImageBuffer.js"; export { coerceImageBuffer }; export interface IChatExtractedImage { readonly id: string; readonly uri: URI; readonly name: string; readonly mimeType: string; readonly data?: VSBuffer; readonly source: string; readonly caption: string | IMarkdownString | undefined; /** Identifies the image in the image carousel when {@link uri} does not, see {@link getChatMarkdownImageId}. */ readonly carouselId?: string; } export interface IChatExtractedImageCollection { readonly id: string; readonly title: string; readonly images: IChatExtractedImage[]; } interface IChatToolOutputImage { readonly uri: URI; readonly name: string; readonly mimeType: string; readonly index: number; readonly base64Value?: string; readonly byteLength?: number; readonly audience?: ToolInputOutputBase["audience"]; } export declare function getToolResultImageResources(details: IToolResultInputOutputDetails | undefined, sessionResource: URI, toolCallId: string, name?: string): IChatToolOutputImage[]; /** Lists successful generated images without loading or decoding their bytes. */ export declare function getGeneratedImageResources(response: IResponse, sessionResource: URI, reader?: IReader): (IChatToolOutputImage & { readonly toolCallId: string; })[]; /** Embedded image names are presentation only; the tool and output index identify their bytes. */ export declare function getChatImageResourceComparisonKey(resource: URI): string; /** * Extract all images from a chat response's tool invocations, inline references, and Markdown. * Tool invocation images are extracted from output details and message URIs. * Inline reference images (file URIs) are read via the provided {@link readFile} callback. * Markdown images are resolved with {@link resolveImageUri} and loaded lazily. */ export declare function extractImagesFromChatResponse(response: IChatResponseViewModel, readFile: (uri: URI) => Promise, resolveImageUri?: (sessionResource: URI, href: string) => string): Promise; export declare function extractImagesFromToolInvocationOutputDetails(toolInvocation: IChatToolInvocation | IChatToolInvocationSerialized, sessionResource: URI): IChatExtractedImage[]; export declare function extractImagesFromToolInvocationMessages(toolInvocation: IChatToolInvocation | IChatToolInvocationSerialized, readFile: (uri: URI) => Promise): Promise; /** * Returns the file that a Markdown image in a chat response shows, or `undefined` when chat does * not show a file there. `source` is the image destination after `resolve` resolved it for the * response's session; like the Markdown renderer, it is then resolved against the Markdown's base * URI and mapped through its URIs. */ export declare function getChatMarkdownImageFile(markdown: IMarkdownString, source: string, resolve: (href: string) => string): URI | undefined; /** * Identifies a file image that a response's Markdown shows in the image carousel. The image shows the * file's current contents, unlike an attachment's earlier snapshot of the same file. */ export declare function getChatMarkdownImageId(responseId: string, resource: URI): string; /** * Extract images from a chat request's variable attachments (user-attached images). */ export declare function extractImagesFromChatRequest(request: IChatRequestViewModel): IChatExtractedImage[]; export declare function extractImagesFromChatVariables(variables: readonly IChatRequestVariableEntry[]): IChatExtractedImage[];