Path: blob/main/src/vs/workbench/contrib/chat/common/chat.ts
3296 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*--------------------------------------------------------------------------------------------*/45import type { IChatTerminalToolInvocationData, ILegacyChatTerminalToolInvocationData } from './chatService.js';6import { ChatModeKind } from './constants.js';78export function checkModeOption(mode: ChatModeKind, option: boolean | ((mode: ChatModeKind) => boolean) | undefined): boolean | undefined {9if (option === undefined) {10return undefined;11}12if (typeof option === 'function') {13return option(mode);14}15return option;16}1718/**19* @deprecated This is the old API shape, we should support this for a while before removing it so20* we don't break existing chats21*/22export function migrateLegacyTerminalToolSpecificData(data: IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData): IChatTerminalToolInvocationData {23if ('command' in data) {24data = {25kind: 'terminal',26commandLine: {27original: data.command,28toolEdited: undefined,29userEdited: undefined30},31language: data.language32} satisfies IChatTerminalToolInvocationData;33}34return data;35}363738