File tree Expand file tree Collapse file tree 5 files changed +23
-8
lines changed
server/aws-lsp-codewhisperer/src/language-server/agenticChat Expand file tree Collapse file tree 5 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -514,7 +514,12 @@ export const createMynahUi = (
514514 chatResult . additionalMessages . forEach ( am => {
515515 const chatItem : ChatItem = {
516516 messageId : am . messageId ,
517- type : am . type === 'tool' ? ChatItemType . ANSWER : ChatItemType . ANSWER_STREAM ,
517+ type :
518+ am . type === 'tool'
519+ ? ChatItemType . ANSWER
520+ : am . type === 'directive'
521+ ? ChatItemType . DIRECTIVE
522+ : ChatItemType . ANSWER_STREAM ,
518523 ...prepareChatItemFromMessage ( am ) ,
519524 }
520525
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ import { FsReadParams } from './tools/fsRead'
100100import { ListDirectoryParams } from './tools/listDirectory'
101101import { FsWrite , FsWriteParams , getDiffChanges } from './tools/fsWrite'
102102import { ExecuteBash , ExecuteBashOutput , ExecuteBashParams } from './tools/executeBash'
103- import { InvokeOutput } from './tools/toolShared'
103+ import { ExplanatoryParams , InvokeOutput } from './tools/toolShared'
104104
105105type ChatHandlers = Omit <
106106 LspHandlers < Chat > ,
@@ -469,6 +469,14 @@ export class AgenticChatController implements ChatHandlers {
469469 let needsConfirmation
470470
471471 try {
472+ const { explanation } = toolUse . input as unknown as ExplanatoryParams
473+ if ( explanation ) {
474+ await chatResultStream . writeResultBlock ( {
475+ type : 'directive' ,
476+ messageId : toolUse . toolUseId + '_explanation' ,
477+ body : explanation ,
478+ } )
479+ }
472480 switch ( toolUse . name ) {
473481 case 'fsRead' :
474482 case 'listDirectory' :
Original file line number Diff line number Diff line change 11// Port from VSC https://github.com/aws/aws-toolkit-vscode/blob/741c2c481bcf0dca2d9554e32dc91d8514b1b1d1/packages/core/src/codewhispererChat/tools/executeBash.ts#L134
22
3- import { CommandValidation , InvokeOutput } from './toolShared'
3+ import { CommandValidation , ExplanatoryParams , InvokeOutput } from './toolShared'
44import { split } from 'shlex'
55import { Logging } from '@aws/language-server-runtimes/server-interface'
66import { processUtils , workspaceUtils } from '@aws/lsp-core'
@@ -108,10 +108,9 @@ export const lineCount: number = 1024
108108export const destructiveCommandWarningMessage = '⚠️ WARNING: Destructive command detected:\n\n'
109109export const mutateCommandWarningMessage = 'Mutation command:\n\n'
110110
111- export interface ExecuteBashParams {
111+ export interface ExecuteBashParams extends ExplanatoryParams {
112112 command : string
113113 cwd ?: string
114- explanation ?: string
115114}
116115
117116interface TimestampedChunk {
Original file line number Diff line number Diff line change 1- import { InvokeOutput } from './toolShared'
1+ import { ExplanatoryParams , InvokeOutput } from './toolShared'
22import { Features } from '@aws/language-server-runtimes/server-interface/server'
33import { sanitize } from '@aws/lsp-core/out/util/path'
44import { Change , diffLines } from 'diff'
55
66// Port of https://github.com/aws/aws-toolkit-vscode/blob/16aa8768834f41ae512522473a6a962bb96abe51/packages/core/src/codewhispererChat/tools/fsWrite.ts#L42
77
8- interface BaseParams {
8+ interface BaseParams extends ExplanatoryParams {
99 path : string
10- explanation ?: string
1110}
1211
1312export interface CreateParams extends BaseParams {
Original file line number Diff line number Diff line change @@ -27,3 +27,7 @@ export interface CommandValidation {
2727 requiresAcceptance : boolean
2828 warning ?: string
2929}
30+
31+ export interface ExplanatoryParams {
32+ explanation ?: string
33+ }
You can’t perform that action at this time.
0 commit comments