@@ -1704,6 +1704,8 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17041704 taskDirPath : string
17051705 apiConversationHistoryFilePath : string
17061706 uiMessagesFilePath : string
1707+ contextHistoryFilePath : string
1708+ taskMetadataFilePath : string
17071709 apiConversationHistory : Anthropic . MessageParam [ ]
17081710 } > {
17091711 const history = ( ( await getGlobalState ( this . context , "taskHistory" ) ) as HistoryItem [ ] | undefined ) || [ ]
@@ -1712,6 +1714,8 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17121714 const taskDirPath = path . join ( this . context . globalStorageUri . fsPath , "tasks" , id )
17131715 const apiConversationHistoryFilePath = path . join ( taskDirPath , GlobalFileNames . apiConversationHistory )
17141716 const uiMessagesFilePath = path . join ( taskDirPath , GlobalFileNames . uiMessages )
1717+ const contextHistoryFilePath = path . join ( taskDirPath , GlobalFileNames . contextHistory )
1718+ const taskMetadataFilePath = path . join ( taskDirPath , GlobalFileNames . taskMetadata )
17151719 const fileExists = await fileExistsAtPath ( apiConversationHistoryFilePath )
17161720 if ( fileExists ) {
17171721 const apiConversationHistory = JSON . parse ( await fs . readFile ( apiConversationHistoryFilePath , "utf8" ) )
@@ -1720,6 +1724,8 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17201724 taskDirPath,
17211725 apiConversationHistoryFilePath,
17221726 uiMessagesFilePath,
1727+ contextHistoryFilePath,
1728+ taskMetadataFilePath,
17231729 apiConversationHistory,
17241730 }
17251731 }
@@ -1791,22 +1797,28 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17911797 console . debug ( "cleared task" )
17921798 }
17931799
1794- const { taskDirPath, apiConversationHistoryFilePath, uiMessagesFilePath } = await this . getTaskWithId ( id )
1795-
1800+ const {
1801+ taskDirPath,
1802+ apiConversationHistoryFilePath,
1803+ uiMessagesFilePath,
1804+ contextHistoryFilePath,
1805+ taskMetadataFilePath,
1806+ } = await this . getTaskWithId ( id )
1807+ const legacyMessagesFilePath = path . join ( taskDirPath , "claude_messages.json" )
17961808 const updatedTaskHistory = await this . deleteTaskFromState ( id )
17971809
17981810 // Delete the task files
1799- const apiConversationHistoryFileExists = await fileExistsAtPath ( apiConversationHistoryFilePath )
1800- if ( apiConversationHistoryFileExists ) {
1801- await fs . unlink ( apiConversationHistoryFilePath )
1802- }
1803- const uiMessagesFileExists = await fileExistsAtPath ( uiMessagesFilePath )
1804- if ( uiMessagesFileExists ) {
1805- await fs . unlink ( uiMessagesFilePath )
1806- }
1807- const legacyMessagesFilePath = path . join ( taskDirPath , "claude_messages.json" )
1808- if ( await fileExistsAtPath ( legacyMessagesFilePath ) ) {
1809- await fs . unlink ( legacyMessagesFilePath )
1811+ for ( const filePath of [
1812+ apiConversationHistoryFilePath ,
1813+ uiMessagesFilePath ,
1814+ contextHistoryFilePath ,
1815+ taskMetadataFilePath ,
1816+ legacyMessagesFilePath ,
1817+ ] ) {
1818+ const fileExists = await fileExistsAtPath ( filePath )
1819+ if ( fileExists ) {
1820+ await fs . unlink ( filePath )
1821+ }
18101822 }
18111823
18121824 await fs . rmdir ( taskDirPath ) // succeeds if the dir is empty
0 commit comments