@@ -174,87 +174,98 @@ export const restore_checkpoint = async (params: {
174174 if ( loaded_history . length > 0 ) {
175175 params . prompt_view_provider . response_history = loaded_history
176176 params . prompt_view_provider . update_response_history ( )
177- } else if ( params . checkpoint . trigger !== 'before-code-reviewed' ) {
177+ } else if (
178+ params . checkpoint . trigger !== 'before-code-reviewed' &&
179+ params . checkpoint . trigger !== 'before-agentic-search'
180+ ) {
178181 params . prompt_view_provider . response_history = [ ]
179182 params . prompt_view_provider . update_response_history ( )
180183 }
181184
182- let loaded_completed_tasks : string [ ] | undefined
183- try {
184- const completed_tasks_file_path = vscode . Uri . joinPath (
185- vscode . Uri . file ( checkpoint_dir_path ) ,
186- 'completed-tasks.json'
187- )
188- const completed_tasks_data = await vscode . workspace . fs . readFile (
189- completed_tasks_file_path
190- )
191- loaded_completed_tasks = JSON . parse (
192- new TextDecoder ( ) . decode ( completed_tasks_data )
193- )
194- } catch {
195- // Ignore
196- }
197-
198- if ( loaded_completed_tasks !== undefined ) {
199- params . prompt_view_provider . completed_tasks = loaded_completed_tasks
200- await params . extension_context . workspaceState . update (
201- COMPLETED_TASKS_STATE_KEY ,
202- loaded_completed_tasks
203- )
204- params . prompt_view_provider . send_message ( {
205- command : 'COMPLETED_TASKS' ,
206- completed_tasks : loaded_completed_tasks
207- } )
208- } else if ( params . checkpoint . trigger !== 'temporary' ) {
209- params . prompt_view_provider . completed_tasks = [ ]
210- await params . extension_context . workspaceState . update (
211- COMPLETED_TASKS_STATE_KEY ,
212- [ ]
213- )
214- params . prompt_view_provider . send_message ( {
215- command : 'COMPLETED_TASKS' ,
216- completed_tasks : [ ]
217- } )
218- }
219-
220- const active_file = open_files . find ( ( f ) => f . isActive )
221-
222- for ( const file of open_files ) {
223- if ( active_file && file === active_file ) {
224- continue
225- }
185+ if ( params . checkpoint . trigger !== 'before-agentic-search' ) {
186+ let loaded_completed_tasks : string [ ] | undefined
226187 try {
227- await vscode . workspace . fs . stat ( file . uri )
228- const doc = await vscode . workspace . openTextDocument ( file . uri )
229- await vscode . window . showTextDocument ( doc , {
230- viewColumn : file . viewColumn ,
231- preserveFocus : true ,
232- preview : false
233- } )
188+ const completed_tasks_file_path = vscode . Uri . joinPath (
189+ vscode . Uri . file ( checkpoint_dir_path ) ,
190+ 'completed-tasks.json'
191+ )
192+ const completed_tasks_data = await vscode . workspace . fs . readFile (
193+ completed_tasks_file_path
194+ )
195+ loaded_completed_tasks = JSON . parse (
196+ new TextDecoder ( ) . decode ( completed_tasks_data )
197+ )
234198 } catch {
235199 // Ignore
236200 }
237- }
238201
239- if ( active_file ) {
240- try {
241- await vscode . workspace . fs . stat ( active_file . uri )
242- const doc = await vscode . workspace . openTextDocument ( active_file . uri )
243- await vscode . window . showTextDocument ( doc , {
244- viewColumn : active_file . viewColumn ,
245- preserveFocus : false ,
246- preview : false
202+ if ( loaded_completed_tasks !== undefined ) {
203+ params . prompt_view_provider . completed_tasks = loaded_completed_tasks
204+ await params . extension_context . workspaceState . update (
205+ COMPLETED_TASKS_STATE_KEY ,
206+ loaded_completed_tasks
207+ )
208+ params . prompt_view_provider . send_message ( {
209+ command : 'COMPLETED_TASKS' ,
210+ completed_tasks : loaded_completed_tasks
211+ } )
212+ } else if ( params . checkpoint . trigger !== 'temporary' ) {
213+ params . prompt_view_provider . completed_tasks = [ ]
214+ await params . extension_context . workspaceState . update (
215+ COMPLETED_TASKS_STATE_KEY ,
216+ [ ]
217+ )
218+ params . prompt_view_provider . send_message ( {
219+ command : 'COMPLETED_TASKS' ,
220+ completed_tasks : [ ]
247221 } )
248- } catch {
249- // Ignore
250222 }
251223 }
252224
253- await params . extension_context . workspaceState . update (
254- CONTEXT_SELECTED_PATHS_STATE_KEY ,
255- params . checkpoint . selected_files
256- )
257- params . workspace_provider . load_selected_files_state ( )
225+ if ( params . checkpoint . trigger !== 'before-agentic-search' ) {
226+ const active_file = open_files . find ( ( f ) => f . isActive )
227+
228+ for ( const file of open_files ) {
229+ if ( active_file && file === active_file ) {
230+ continue
231+ }
232+ try {
233+ await vscode . workspace . fs . stat ( file . uri )
234+ const doc = await vscode . workspace . openTextDocument ( file . uri )
235+ await vscode . window . showTextDocument ( doc , {
236+ viewColumn : file . viewColumn ,
237+ preserveFocus : true ,
238+ preview : false
239+ } )
240+ } catch {
241+ // Ignore
242+ }
243+ }
244+
245+ if ( active_file ) {
246+ try {
247+ await vscode . workspace . fs . stat ( active_file . uri )
248+ const doc = await vscode . workspace . openTextDocument (
249+ active_file . uri
250+ )
251+ await vscode . window . showTextDocument ( doc , {
252+ viewColumn : active_file . viewColumn ,
253+ preserveFocus : false ,
254+ preview : false
255+ } )
256+ } catch {
257+ // Ignore
258+ }
259+ }
260+ }
261+
262+ if ( params . checkpoint . trigger !== 'before-agentic-search' ) {
263+ await params . extension_context . workspaceState . update (
264+ CONTEXT_SELECTED_PATHS_STATE_KEY ,
265+ params . checkpoint . selected_files
266+ )
267+ params . workspace_provider . load_selected_files_state ( )
268+ }
258269
259270 params . prompt_view_provider . send_token_count ( )
260271
@@ -270,8 +281,7 @@ export const restore_checkpoint = async (params: {
270281 ) {
271282 const item_to_review = loaded_history . find (
272283 ( item ) =>
273- item . created_at ==
274- params . checkpoint . code_review_item_created_at
284+ item . created_at == params . checkpoint . code_review_item_created_at
275285 )
276286 if ( item_to_review ) {
277287 apply_response ( {
0 commit comments