@@ -8,14 +8,15 @@ import * as l10n from '@vscode/l10n';
88import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions' ;
99import type { ExtendedChatResponsePart } from 'vscode' ;
1010import { URI } from '../../../../util/vs/base/common/uri' ;
11- import { ChatRequestTurn2 , ChatResponseMarkdownPart , ChatResponseTurn2 , ChatToolInvocationPart , MarkdownString } from '../../../../vscodeTypes' ;
11+ import { ChatRequestTurn2 , ChatResponseMarkdownPart , ChatResponseThinkingProgressPart , ChatResponseTurn2 , ChatToolInvocationPart , MarkdownString } from '../../../../vscodeTypes' ;
1212
1313/**
1414 * CopilotCLI tool names
1515 */
16- const enum CopilotCLIToolNames {
16+ export const enum CopilotCLIToolNames {
1717 StrReplaceEditor = 'str_replace_editor' ,
18- Bash = 'bash'
18+ Bash = 'bash' ,
19+ Think = 'think'
1920}
2021
2122interface StrReplaceEditorArgs {
@@ -145,13 +146,22 @@ export function buildChatHistoryFromEvents(events: readonly SDKEvent[]): (ChatRe
145146 currentResponseParts . push ( toolInvocation ) ;
146147 }
147148 } else if ( event . type === 'tool_result' ) {
148- // Update the pending tool invocation with the result
149- if ( event . toolCallId ) {
150- const invocation = pendingToolInvocations . get ( event . toolCallId ) ;
151- if ( invocation ) {
152- invocation . isConfirmed = event . result . resultType !== 'rejected' && event . result . resultType !== 'denied' ;
153- invocation . isError = event . result . resultType === 'failure' ;
154- pendingToolInvocations . delete ( event . toolCallId ) ;
149+ if ( event . toolName === CopilotCLIToolNames . Think ) {
150+ const sessionLog = event . result . sessionLog ;
151+ if ( sessionLog && typeof sessionLog === 'string' ) {
152+ currentResponseParts . push (
153+ new ChatResponseThinkingProgressPart ( sessionLog )
154+ ) ;
155+ }
156+ } else {
157+ // Update the pending tool invocation with the result
158+ if ( event . toolCallId ) {
159+ const invocation = pendingToolInvocations . get ( event . toolCallId ) ;
160+ if ( invocation ) {
161+ invocation . isConfirmed = event . result . resultType !== 'rejected' && event . result . resultType !== 'denied' ;
162+ invocation . isError = event . result . resultType === 'failure' ;
163+ pendingToolInvocations . delete ( event . toolCallId ) ;
164+ }
155165 }
156166 }
157167 // Tool results themselves are not displayed - they update the invocation state
0 commit comments