@@ -27,13 +27,23 @@ import { IChatContentPartRenderContext } from '../chatContentParts.js';
27
27
import { EditorPool } from '../chatMarkdownContentPart.js' ;
28
28
import { BaseChatToolInvocationSubPart } from './chatToolInvocationSubPart.js' ;
29
29
30
+ /**
31
+ * @deprecated This is the old API shape, we should support this for a while before removing it so
32
+ * we don't break existing chats
33
+ */
34
+ interface ILegacyChatTerminalToolInvocationData {
35
+ kind : 'terminal' ;
36
+ command : string ;
37
+ language : string ;
38
+ }
39
+
30
40
export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSubPart {
31
41
public readonly domNode : HTMLElement ;
32
42
public readonly codeblocks : IChatCodeBlockInfo [ ] = [ ] ;
33
43
34
44
constructor (
35
45
toolInvocation : IChatToolInvocation ,
36
- terminalData : IChatTerminalToolInvocationData ,
46
+ terminalData : IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData ,
37
47
private readonly context : IChatContentPartRenderContext ,
38
48
private readonly renderer : MarkdownRenderer ,
39
49
private readonly editorPool : EditorPool ,
@@ -52,6 +62,19 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
52
62
throw new Error ( 'Confirmation messages are missing' ) ;
53
63
}
54
64
65
+ // Migrate forward the old tool data format
66
+ if ( 'command' in terminalData ) {
67
+ terminalData = {
68
+ kind : 'terminal' ,
69
+ commandLine : {
70
+ original : terminalData . command ,
71
+ toolEdited : undefined ,
72
+ userEdited : undefined
73
+ } ,
74
+ language : terminalData . language
75
+ } satisfies IChatTerminalToolInvocationData ;
76
+ }
77
+
55
78
const title = toolInvocation . confirmationMessages . title ;
56
79
const message = toolInvocation . confirmationMessages . message ;
57
80
const continueLabel = localize ( 'continue' , "Continue" ) ;
0 commit comments