@@ -39,9 +39,9 @@ import { LspController } from '../../../../amazonq/lsp/lspController'
3939import { extractCodeBlockLanguage } from '../../../../shared/markdown'
4040import { extractAuthFollowUp } from '../../../../amazonq/util/authUtils'
4141import { helpMessage } from '../../../../amazonq/webview/ui/texts/constants'
42- import { ChatItemButton , ChatItemFormItem , MynahUIDataModel } from '@aws/mynah-ui'
42+ import { ChatItemButton , ChatItemFormItem , MynahIconsType , MynahUIDataModel } from '@aws/mynah-ui'
4343import { ChatHistoryManager } from '../../../storages/chatHistory'
44- import { ToolUtils } from '../../../tools/toolUtils'
44+ import { ToolType , ToolUtils } from '../../../tools/toolUtils'
4545import { ChatStream } from '../../../tools/chatStream'
4646
4747export type StaticTextResponseType = 'quick-action-help' | 'onboarding-help' | 'transform' | 'help'
@@ -217,13 +217,7 @@ export class Messenger {
217217 if ( 'type' in tool ) {
218218 const requiresAcceptance = ToolUtils . requiresAcceptance ( tool )
219219
220- const chatStream = new ChatStream (
221- this ,
222- tabID ,
223- triggerID ,
224- toolUse . toolUseId ,
225- requiresAcceptance
226- )
220+ const chatStream = new ChatStream ( this , tabID , triggerID , toolUse , requiresAcceptance )
227221 ToolUtils . queueDescription ( tool , chatStream )
228222
229223 if ( ! requiresAcceptance ) {
@@ -432,15 +426,16 @@ export class Messenger {
432426 message : string ,
433427 tabID : string ,
434428 triggerID : string ,
435- toolUseId : string | undefined ,
429+ toolUse : ToolUse | undefined ,
436430 requiresAcceptance = false
437431 ) {
438432 const buttons : ChatItemButton [ ] = [ ]
439433 if ( requiresAcceptance ) {
440434 buttons . push ( {
435+ icon : 'play' as MynahIconsType ,
441436 id : 'confirm-tool-use' ,
442- text : 'Confirm ' ,
443- position : 'outside ' ,
437+ status : 'clear ' ,
438+ text : 'Run ' ,
444439 } )
445440 }
446441
@@ -453,12 +448,25 @@ export class Messenger {
453448 followUpsHeader : undefined ,
454449 relatedSuggestions : undefined ,
455450 triggerID,
456- messageID : toolUseId ?? `tool-output` ,
451+ messageID : toolUse ?. toolUseId ?? `tool-output` ,
457452 userIntent : undefined ,
458453 codeBlockLanguage : undefined ,
459454 contextList : undefined ,
460455 canBeVoted : false ,
461- buttons,
456+ buttons : toolUse ?. name === ToolType . ExecuteBash ? undefined : buttons ,
457+ fullWidth : true ,
458+ header :
459+ toolUse ?. name === ToolType . ExecuteBash
460+ ? {
461+ icon : 'code-block' as MynahIconsType ,
462+ body : 'Terminal command' ,
463+ buttons : buttons ,
464+ }
465+ : undefined ,
466+ codeBlockActions :
467+ // eslint-disable-next-line unicorn/no-null
468+ toolUse ?. name === ToolType . ExecuteBash ? { 'insert-to-cursor' : null , copy : null } : undefined ,
469+ padding : toolUse ?. name === ToolType . ExecuteBash ? true : false ,
462470 } ,
463471 tabID
464472 )
0 commit comments