@@ -27,6 +27,7 @@ export class PseudoStopStartResponseProcessor implements IResponseProcessor {
2727 private stagedDeltasToApply : IResponseDelta [ ] = [ ] ;
2828 private currentStartStop : StartStopMapping | undefined = undefined ;
2929 private nonReportedDeltas : IResponseDelta [ ] = [ ] ;
30+ private thinkingActive : boolean = false ;
3031
3132 constructor (
3233 private readonly stopStartMappings : readonly StartStopMapping [ ] ,
@@ -47,6 +48,17 @@ export class PseudoStopStartResponseProcessor implements IResponseProcessor {
4748 }
4849
4950 protected applyDeltaToProgress ( delta : IResponseDelta , progress : ChatResponseStream ) {
51+ if ( delta . thinking ) {
52+ // Don't send parts that are only encrypted content
53+ if ( ! isEncryptedThinkingDelta ( delta . thinking ) || delta . thinking . text ) {
54+ progress . thinkingProgress ( delta . thinking ) ;
55+ this . thinkingActive = true ;
56+ }
57+ } else if ( this . thinkingActive ) {
58+ progress . thinkingProgress ( { id : '' , text : '' , metadata : { vscode_reasoning_done : true } } ) ;
59+ this . thinkingActive = false ;
60+ }
61+
5062 reportCitations ( delta , progress ) ;
5163
5264 const vulnerabilities : ChatVulnerability [ ] | undefined = delta . codeVulnAnnotations ?. map ( a => ( { title : a . details . type , description : a . details . description } ) ) ;
@@ -59,13 +71,6 @@ export class PseudoStopStartResponseProcessor implements IResponseProcessor {
5971 if ( delta . beginToolCalls ?. length ) {
6072 progress . prepareToolInvocation ( getContributedToolName ( delta . beginToolCalls [ 0 ] . name ) ) ;
6173 }
62-
63- if ( delta . thinking ) {
64- // Don't send parts that are only encrypted content
65- if ( ! isEncryptedThinkingDelta ( delta . thinking ) || delta . thinking . text ) {
66- progress . thinkingProgress ( delta . thinking ) ;
67- }
68- }
6974 }
7075
7176 /**
@@ -155,6 +160,7 @@ export class PseudoStopStartResponseProcessor implements IResponseProcessor {
155160 this . stagedDeltasToApply = [ ] ;
156161 this . currentStartStop = undefined ;
157162 this . nonReportedDeltas = [ ] ;
163+ this . thinkingActive = false ;
158164 if ( delta . retryReason === 'network_error' ) {
159165 progress . clearToPreviousToolInvocation ( ChatResponseClearToPreviousToolInvocationReason . NoReason ) ;
160166 } else if ( delta . retryReason === FilterReason . Copyright ) {
0 commit comments