44 *--------------------------------------------------------------------------------------------*/
55
66import * as dom from '../../../../../../base/browser/dom.js' ;
7- import { MarkdownString } from '../../../../../../base/common/htmlContent.js' ;
7+ import { MarkdownString , type IMarkdownString } from '../../../../../../base/common/htmlContent.js' ;
88import { thenIfNotDisposed } from '../../../../../../base/common/lifecycle.js' ;
99import { Schemas } from '../../../../../../base/common/network.js' ;
1010import { URI } from '../../../../../../base/common/uri.js' ;
@@ -18,13 +18,14 @@ import { IInstantiationService } from '../../../../../../platform/instantiation/
1818import { IKeybindingService } from '../../../../../../platform/keybinding/common/keybinding.js' ;
1919import { ChatContextKeys } from '../../../common/chatContextKeys.js' ;
2020import { IChatToolInvocation , type IChatTerminalToolInvocationData } from '../../../common/chatService.js' ;
21+ import type { CodeBlockModelCollection } from '../../../common/codeBlockModelCollection.js' ;
2122import { CancelChatActionId } from '../../actions/chatExecuteActions.js' ;
2223import { AcceptToolConfirmationActionId } from '../../actions/chatToolActions.js' ;
2324import { IChatCodeBlockInfo , IChatWidgetService } from '../../chat.js' ;
2425import { ICodeBlockRenderOptions } from '../../codeBlockPart.js' ;
2526import { ChatCustomConfirmationWidget , IChatConfirmationButton } from '../chatConfirmationWidget.js' ;
2627import { IChatContentPartRenderContext } from '../chatContentParts.js' ;
27- import { EditorPool } from '../chatMarkdownContentPart.js' ;
28+ import { ChatMarkdownContentPart , EditorPool } from '../chatMarkdownContentPart.js' ;
2829import { BaseChatToolInvocationSubPart } from './chatToolInvocationSubPart.js' ;
2930
3031export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSubPart {
@@ -38,6 +39,7 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
3839 private readonly renderer : MarkdownRenderer ,
3940 private readonly editorPool : EditorPool ,
4041 private readonly currentWidthDelegate : ( ) => number ,
42+ private readonly codeBlockModelCollection : CodeBlockModelCollection ,
4143 private readonly codeBlockStartIndex : number ,
4244 @IInstantiationService private readonly instantiationService : IInstantiationService ,
4345 @IKeybindingService keybindingService : IKeybindingService ,
@@ -52,8 +54,7 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
5254 throw new Error ( 'Confirmation messages are missing' ) ;
5355 }
5456
55- const title = toolInvocation . confirmationMessages . title ;
56- const message = toolInvocation . confirmationMessages . message ;
57+ const { title, message, disclaimer } = toolInvocation . confirmationMessages ;
5758 const continueLabel = localize ( 'continue' , "Continue" ) ;
5859 const continueKeybinding = keybindingService . lookupKeybinding ( AcceptToolConfirmationActionId ) ?. getLabel ( ) ;
5960 const continueTooltip = continueKeybinding ? `${ continueLabel } (${ continueKeybinding } )` : continueLabel ;
@@ -136,6 +137,10 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
136137 this . context . container ,
137138 ) ) ;
138139
140+ if ( disclaimer ) {
141+ this . _appendMarkdownPart ( element , disclaimer , codeBlockRenderOptions ) ;
142+ }
143+
139144 ChatContextKeys . Editing . hasToolConfirmation . bindTo ( this . contextKeyService ) . set ( true ) ;
140145 this . _register ( confirmWidget . onDidClick ( button => {
141146 toolInvocation . confirmed . complete ( button . data ) ;
@@ -155,4 +160,22 @@ export class TerminalConfirmationWidgetSubPart extends BaseChatToolInvocationSub
155160 path : generateUuid ( ) ,
156161 } ) ;
157162 }
163+
164+ private _appendMarkdownPart ( container : HTMLElement , message : string | IMarkdownString , codeBlockRenderOptions : ICodeBlockRenderOptions ) {
165+ const part = this . _register ( this . instantiationService . createInstance ( ChatMarkdownContentPart , {
166+ kind : 'markdownContent' ,
167+ content : typeof message === 'string' ? new MarkdownString ( ) . appendText ( message ) : message
168+ } ,
169+ this . context ,
170+ this . editorPool ,
171+ false ,
172+ this . codeBlockStartIndex ,
173+ this . renderer ,
174+ this . currentWidthDelegate ( ) ,
175+ this . codeBlockModelCollection ,
176+ { codeBlockRenderOptions }
177+ ) ) ;
178+ dom . append ( container , part . domNode ) ;
179+ this . _register ( part . onDidChangeHeight ( ( ) => this . _onDidChangeHeight . fire ( ) ) ) ;
180+ }
158181}
0 commit comments