Path: blob/main/src/vscode-dts/vscode.proposed.chatOutputRenderer.d.ts
3290 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45declare module 'vscode' {67/**8* Data returned from a tool.9*10* This is an opaque binary blob that can be rendered by a {@link ChatOutputRenderer}.11*/12export interface ToolResultDataOutput {13/**14* The MIME type of the data.15*/16mime: string;1718/**19* The contents of the data.20*/21value: Uint8Array;22}2324export interface ExtendedLanguageModelToolResult2 extends ExtendedLanguageModelToolResult {25// Temporary to allow `toolResultDetails` to return a ToolResultDataOutput26// TODO: Should this live here? Or should we be able to mark each `content` items as user/lm specific?27// TODO: Should we allow multiple per tool result?28toolResultDetails2?: Array<Uri | Location> | ToolResultDataOutput;29}3031/**32* The data to be rendered by a {@link ChatOutputRenderer}.33*/34export interface ChatOutputDataItem {35/**36* The MIME type of the data.37*/38readonly mime: string;3940/**41* The contents of the data.42*/43readonly value: Uint8Array;44}4546export interface ChatOutputRenderer {47/**48* Given an output, render it into the provided webview.49*50* TODO: Figure out what to pass as context? Probably at least basic info such as chat location.51*52* @param data The data to render.53* @param webview The webview to render the data into.54* @param token A cancellation token that is cancelled if we no longer care about the rendering before this55* call completes.56*57* @returns A promise that resolves when the webview has been initialized and is ready to be presented to the user.58*/59renderChatOutput(data: ChatOutputDataItem, webview: Webview, ctx: {}, token: CancellationToken): Thenable<void>;60}6162export namespace chat {63/**64* Registers a new renderer for a given mime type.65*66* Note: To use this API, you should also add a contribution point in your extension's67* package.json:68*69* ```json70* "contributes": {71* "chatOutputRenderer": [72* {73* "viewType": "myExt.myChatOutputRenderer",74* "mimeTypes": ["application/your-mime-type"]75* }76* ]77* }78* ```79*80* @param viewType Unique identifier for the renderer. This should match the `viewType` in your contribution point.81* @param renderer The renderer to register.82*/83export function registerChatOutputRenderer(viewType: string, renderer: ChatOutputRenderer): Disposable;84}85}868788