@@ -28,13 +28,23 @@ import { IChatContentPartRenderContext } from '../chatContentParts.js';
2828import { ChatMarkdownContentPart , EditorPool } from '../chatMarkdownContentPart.js' ;
2929import { BaseChatToolInvocationSubPart } from './chatToolInvocationSubPart.js' ;
3030
31+ /**
32+ * @deprecated This is the old API shape, we should support this for a while before removing it so
33+ * we don't break existing chats
34+ */
35+ interface ILegacyChatTerminalToolInvocationData {
36+ kind : 'terminal' ;
37+ command : string ;
38+ language : string ;
39+ }
40+
3141export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSubPart {
3242 public readonly domNode : HTMLElement ;
3343 public readonly codeblocks : IChatCodeBlockInfo [ ] = [ ] ;
3444
3545 constructor (
3646 toolInvocation : IChatToolInvocation ,
37- terminalData : IChatTerminalToolInvocationData ,
47+ terminalData : IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData ,
3848 private readonly context : IChatContentPartRenderContext ,
3949 private readonly renderer : MarkdownRenderer ,
4050 private readonly editorPool : EditorPool ,
@@ -54,6 +64,19 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
5464 throw new Error ( 'Confirmation messages are missing' ) ;
5565 }
5666
67+ // Migrate forward the old tool data format
68+ if ( 'command' in terminalData ) {
69+ terminalData = {
70+ kind : 'terminal' ,
71+ commandLine : {
72+ original : terminalData . command ,
73+ toolEdited : undefined ,
74+ userEdited : undefined
75+ } ,
76+ language : terminalData . language
77+ } satisfies IChatTerminalToolInvocationData ;
78+ }
79+
5780 const { title, message, disclaimer } = toolInvocation . confirmationMessages ;
5881 const continueLabel = localize ( 'continue' , "Continue" ) ;
5982 const continueKeybinding = keybindingService . lookupKeybinding ( AcceptToolConfirmationActionId ) ?. getLabel ( ) ;
0 commit comments