@@ -28,13 +28,23 @@ import { IChatContentPartRenderContext } from '../chatContentParts.js';
28
28
import { ChatMarkdownContentPart , EditorPool } from '../chatMarkdownContentPart.js' ;
29
29
import { BaseChatToolInvocationSubPart } from './chatToolInvocationSubPart.js' ;
30
30
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
+
31
41
export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSubPart {
32
42
public readonly domNode : HTMLElement ;
33
43
public readonly codeblocks : IChatCodeBlockInfo [ ] = [ ] ;
34
44
35
45
constructor (
36
46
toolInvocation : IChatToolInvocation ,
37
- terminalData : IChatTerminalToolInvocationData ,
47
+ terminalData : IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData ,
38
48
private readonly context : IChatContentPartRenderContext ,
39
49
private readonly renderer : MarkdownRenderer ,
40
50
private readonly editorPool : EditorPool ,
@@ -54,6 +64,19 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
54
64
throw new Error ( 'Confirmation messages are missing' ) ;
55
65
}
56
66
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
+
57
80
const { title, message, disclaimer } = toolInvocation . confirmationMessages ;
58
81
const continueLabel = localize ( 'continue' , "Continue" ) ;
59
82
const continueKeybinding = keybindingService . lookupKeybinding ( AcceptToolConfirmationActionId ) ?. getLabel ( ) ;
0 commit comments