@@ -77,7 +77,8 @@ export interface IChatRequestModel {
7777 readonly response ?: IChatResponseModel ;
7878 readonly editedFileEvents ?: IChatAgentEditedFileEvent [ ] ;
7979 shouldBeRemovedOnSend : IChatRequestDisablement | undefined ;
80- shouldBeBlocked : boolean ;
80+ readonly shouldBeBlocked : IObservable < boolean > ;
81+ setShouldBeBlocked ( value : boolean ) : void ;
8182 readonly modelId ?: string ;
8283 readonly userSelectedTools ?: UserSelectedTools ;
8384}
@@ -215,7 +216,7 @@ export interface IChatResponseModel {
215216 readonly isPendingConfirmation : IObservable < { startedWaitingAt : number ; detail ?: string } | undefined > ;
216217 readonly isInProgress : IObservable < boolean > ;
217218 readonly shouldBeRemovedOnSend : IChatRequestDisablement | undefined ;
218- shouldBeBlocked : boolean ;
219+ readonly shouldBeBlocked : IObservable < boolean > ;
219220 readonly isCompleteAddedRequest : boolean ;
220221 /** A stale response is one that has been persisted and rehydrated, so e.g. Commands that have their arguments stored in the EH are gone. */
221222 readonly isStale : boolean ;
@@ -290,7 +291,14 @@ export class ChatRequestModel implements IChatRequestModel {
290291 public readonly modeInfo ?: IChatRequestModeInfo ;
291292 public readonly userSelectedTools ?: UserSelectedTools ;
292293
293- public shouldBeBlocked : boolean = false ;
294+ private readonly _shouldBeBlocked = observableValue < boolean > ( this , false ) ;
295+ public get shouldBeBlocked ( ) : IObservable < boolean > {
296+ return this . _shouldBeBlocked ;
297+ }
298+
299+ public setShouldBeBlocked ( value : boolean ) : void {
300+ this . _shouldBeBlocked . set ( value , undefined ) ;
301+ }
294302
295303 private _session : ChatModel ;
296304 private readonly _attempt : number ;
@@ -811,13 +819,13 @@ export class ChatResponseModel extends Disposable implements IChatResponseModel
811819 private _result ?: IChatAgentResult ;
812820 private _shouldBeRemovedOnSend : IChatRequestDisablement | undefined ;
813821 public readonly isCompleteAddedRequest : boolean ;
814- private _shouldBeBlocked : boolean = false ;
822+ private readonly _shouldBeBlocked = observableValue < boolean > ( this , false ) ;
815823 private readonly _timestamp : number ;
816824 private _timeSpentWaitingAccumulator : number ;
817825
818826 public confirmationAdjustedTimestamp : IObservable < number > ;
819827
820- public get shouldBeBlocked ( ) {
828+ public get shouldBeBlocked ( ) : IObservable < boolean > {
821829 return this . _shouldBeBlocked ;
822830 }
823831
@@ -980,7 +988,7 @@ export class ChatResponseModel extends Disposable implements IChatResponseModel
980988 this . _followups = params . followups ? [ ...params . followups ] : undefined ;
981989 this . isCompleteAddedRequest = params . isCompleteAddedRequest ?? false ;
982990 this . _shouldBeRemovedOnSend = params . shouldBeRemovedOnSend ;
983- this . _shouldBeBlocked = params . shouldBeBlocked ?? false ;
991+ this . _shouldBeBlocked . set ( params . shouldBeBlocked ?? false , undefined ) ;
984992
985993 // If we are creating a response with some existing content, consider it stale
986994 this . _isStale = Array . isArray ( params . responseContent ) && ( params . responseContent . length !== 0 || isMarkdownString ( params . responseContent ) && params . responseContent . value . length !== 0 ) ;
@@ -1028,11 +1036,7 @@ export class ChatResponseModel extends Disposable implements IChatResponseModel
10281036 this . _register ( this . _session . onDidChange ( ( e ) => {
10291037 if ( e . kind === 'setCheckpoint' ) {
10301038 const isDisabled = e . disabledResponseIds . has ( this . id ) ;
1031- const didChange = this . _shouldBeBlocked === isDisabled ;
1032- this . _shouldBeBlocked = isDisabled ;
1033- if ( didChange ) {
1034- this . _onDidChange . fire ( defaultChatResponseModelChangeReason ) ;
1035- }
1039+ this . _shouldBeBlocked . set ( isDisabled , undefined ) ;
10361040 }
10371041 } ) ) ;
10381042
@@ -1948,7 +1952,7 @@ export class ChatModel extends Disposable implements IChatModel {
19481952 followups : raw . followups ,
19491953 restoredId : raw . responseId ,
19501954 timeSpentWaiting : raw . timeSpentWaiting ,
1951- shouldBeBlocked : request . shouldBeBlocked ,
1955+ shouldBeBlocked : request . shouldBeBlocked . get ( ) ,
19521956 codeBlockInfos : raw . responseMarkdownInfo ?. map < ICodeBlockInfo > ( info => ( { suggestionId : info . suggestionId } ) ) ,
19531957 } ) ;
19541958 request . response . shouldBeRemovedOnSend = raw . isHidden ? { requestId : raw . requestId } : raw . shouldBeRemovedOnSend ;
@@ -1994,7 +1998,7 @@ export class ChatModel extends Disposable implements IChatModel {
19941998
19951999 resetCheckpoint ( ) : void {
19962000 for ( const request of this . _requests ) {
1997- request . shouldBeBlocked = false ;
2001+ request . setShouldBeBlocked ( false ) ;
19982002 }
19992003 }
20002004
@@ -2006,7 +2010,7 @@ export class ChatModel extends Disposable implements IChatModel {
20062010 if ( request . id === requestId ) {
20072011 checkpointIndex = index ;
20082012 checkpoint = request ;
2009- request . shouldBeBlocked = true ;
2013+ request . setShouldBeBlocked ( true ) ;
20102014 }
20112015 } ) ;
20122016
@@ -2020,15 +2024,15 @@ export class ChatModel extends Disposable implements IChatModel {
20202024 for ( let i = this . _requests . length - 1 ; i >= 0 ; i -= 1 ) {
20212025 const request = this . _requests [ i ] ;
20222026 if ( this . _checkpoint && ! checkpoint ) {
2023- request . shouldBeBlocked = false ;
2027+ request . setShouldBeBlocked ( false ) ;
20242028 } else if ( checkpoint && i >= checkpointIndex ) {
2025- request . shouldBeBlocked = true ;
2029+ request . setShouldBeBlocked ( true ) ;
20262030 disabledRequestIds . add ( request . id ) ;
20272031 if ( request . response ) {
20282032 disabledResponseIds . add ( request . response . id ) ;
20292033 }
20302034 } else if ( checkpoint && i < checkpointIndex ) {
2031- request . shouldBeBlocked = false ;
2035+ request . setShouldBeBlocked ( false ) ;
20322036 }
20332037 }
20342038
0 commit comments