@@ -9,6 +9,7 @@ import * as vscode from "vscode"
99import simpleGit from "simple-git"
1010
1111import { ApiConfiguration , ApiProvider , ModelInfo , API_CONFIG_KEYS } from "../../shared/api"
12+ import { CheckpointStorage } from "../../shared/checkpoints"
1213import { findLast } from "../../shared/array"
1314import { CustomSupportPrompts , supportPrompt } from "../../shared/support-prompt"
1415import { GlobalFileNames } from "../../shared/globalFileNames"
@@ -316,11 +317,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
316317
317318 public async initClineWithTask ( task ?: string , images ?: string [ ] ) {
318319 await this . clearTask ( )
320+
319321 const {
320322 apiConfiguration,
321323 customModePrompts,
322- diffEnabled,
324+ diffEnabled : enableDiff ,
323325 enableCheckpoints,
326+ checkpointStorage,
324327 fuzzyMatchThreshold,
325328 mode,
326329 customInstructions : globalInstructions ,
@@ -334,8 +337,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
334337 provider : this ,
335338 apiConfiguration,
336339 customInstructions : effectiveInstructions ,
337- enableDiff : diffEnabled ,
340+ enableDiff,
338341 enableCheckpoints,
342+ checkpointStorage,
339343 fuzzyMatchThreshold,
340344 task,
341345 images,
@@ -349,8 +353,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
349353 const {
350354 apiConfiguration,
351355 customModePrompts,
352- diffEnabled,
356+ diffEnabled : enableDiff ,
353357 enableCheckpoints,
358+ checkpointStorage,
354359 fuzzyMatchThreshold,
355360 mode,
356361 customInstructions : globalInstructions ,
@@ -360,12 +365,17 @@ export class ClineProvider implements vscode.WebviewViewProvider {
360365 const modePrompt = customModePrompts ?. [ mode ] as PromptComponent
361366 const effectiveInstructions = [ globalInstructions , modePrompt ?. customInstructions ] . filter ( Boolean ) . join ( "\n\n" )
362367
368+ // TODO: The `checkpointStorage` value should be derived from the
369+ // task data on disk; the current setting could be different than
370+ // the setting at the time the task was created.
371+
363372 this . cline = new Cline ( {
364373 provider : this ,
365374 apiConfiguration,
366375 customInstructions : effectiveInstructions ,
367- enableDiff : diffEnabled ,
376+ enableDiff,
368377 enableCheckpoints,
378+ checkpointStorage,
369379 fuzzyMatchThreshold,
370380 historyItem,
371381 experiments,
@@ -1035,6 +1045,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
10351045 await this . updateGlobalState ( "enableCheckpoints" , enableCheckpoints )
10361046 await this . postStateToWebview ( )
10371047 break
1048+ case "checkpointStorage" :
1049+ console . log ( `[ClineProvider] checkpointStorage: ${ message . text } ` )
1050+ const checkpointStorage = message . text ?? "task"
1051+ await this . updateGlobalState ( "checkpointStorage" , checkpointStorage )
1052+ await this . postStateToWebview ( )
1053+ break
10381054 case "browserViewportSize" :
10391055 const browserViewportSize = message . text ?? "900x600"
10401056 await this . updateGlobalState ( "browserViewportSize" , browserViewportSize )
@@ -1875,21 +1891,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
18751891 await fs . unlink ( legacyMessagesFilePath )
18761892 }
18771893
1878- const { enableCheckpoints } = await this . getState ( )
1879- const baseDir = vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 )
1880-
1881- // Delete checkpoints branch.
1882- if ( enableCheckpoints && baseDir ) {
1883- const branchSummary = await simpleGit ( baseDir )
1884- . branch ( [ "-D" , `roo-code-checkpoints-${ id } ` ] )
1885- . catch ( ( ) => undefined )
1886-
1887- if ( branchSummary ) {
1888- console . log ( `[deleteTaskWithId${ id } ] deleted checkpoints branch` )
1889- }
1890- }
1891-
1892- // Delete checkpoints directory
1894+ // Delete checkpoints directory.
1895+ // TODO: Also delete the workspace branch if it exists.
18931896 const checkpointsDir = path . join ( taskDirPath , "checkpoints" )
18941897
18951898 if ( await fileExistsAtPath ( checkpointsDir ) ) {
@@ -1936,6 +1939,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19361939 soundEnabled,
19371940 diffEnabled,
19381941 enableCheckpoints,
1942+ checkpointStorage,
19391943 taskHistory,
19401944 soundVolume,
19411945 browserViewportSize,
@@ -1986,6 +1990,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19861990 soundEnabled : soundEnabled ?? false ,
19871991 diffEnabled : diffEnabled ?? true ,
19881992 enableCheckpoints : enableCheckpoints ?? true ,
1993+ checkpointStorage : checkpointStorage ?? "task" ,
19891994 shouldShowAnnouncement : lastShownAnnouncementId !== this . latestAnnouncementId ,
19901995 allowedCommands,
19911996 soundVolume : soundVolume ?? 0.5 ,
@@ -2140,6 +2145,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21402145 soundEnabled : stateValues . soundEnabled ?? false ,
21412146 diffEnabled : stateValues . diffEnabled ?? true ,
21422147 enableCheckpoints : stateValues . enableCheckpoints ?? false ,
2148+ checkpointStorage : stateValues . checkpointStorage ?? "task" ,
21432149 soundVolume : stateValues . soundVolume ,
21442150 browserViewportSize : stateValues . browserViewportSize ?? "900x600" ,
21452151 screenshotQuality : stateValues . screenshotQuality ?? 75 ,
0 commit comments