@@ -9,6 +9,7 @@ import * as vscode from "vscode"
99import simpleGit from "simple-git"
1010
1111import { ApiConfiguration , ApiProvider , ModelInfo } 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"
@@ -313,11 +314,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
313314
314315 public async initClineWithTask ( task ?: string , images ?: string [ ] ) {
315316 await this . clearTask ( )
317+
316318 const {
317319 apiConfiguration,
318320 customModePrompts,
319- diffEnabled,
321+ diffEnabled : enableDiff ,
320322 enableCheckpoints,
323+ checkpointStorage,
321324 fuzzyMatchThreshold,
322325 mode,
323326 customInstructions : globalInstructions ,
@@ -331,8 +334,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
331334 provider : this ,
332335 apiConfiguration,
333336 customInstructions : effectiveInstructions ,
334- enableDiff : diffEnabled ,
337+ enableDiff,
335338 enableCheckpoints,
339+ checkpointStorage,
336340 fuzzyMatchThreshold,
337341 task,
338342 images,
@@ -346,8 +350,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
346350 const {
347351 apiConfiguration,
348352 customModePrompts,
349- diffEnabled,
353+ diffEnabled : enableDiff ,
350354 enableCheckpoints,
355+ checkpointStorage,
351356 fuzzyMatchThreshold,
352357 mode,
353358 customInstructions : globalInstructions ,
@@ -357,12 +362,17 @@ export class ClineProvider implements vscode.WebviewViewProvider {
357362 const modePrompt = customModePrompts ?. [ mode ] as PromptComponent
358363 const effectiveInstructions = [ globalInstructions , modePrompt ?. customInstructions ] . filter ( Boolean ) . join ( "\n\n" )
359364
365+ // TODO: The `checkpointStorage` value should be derived from the
366+ // task data on disk; the current setting could be different than
367+ // the setting at the time the task was created.
368+
360369 this . cline = new Cline ( {
361370 provider : this ,
362371 apiConfiguration,
363372 customInstructions : effectiveInstructions ,
364- enableDiff : diffEnabled ,
373+ enableDiff,
365374 enableCheckpoints,
375+ checkpointStorage,
366376 fuzzyMatchThreshold,
367377 historyItem,
368378 experiments,
@@ -1022,6 +1032,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
10221032 await this . updateGlobalState ( "enableCheckpoints" , enableCheckpoints )
10231033 await this . postStateToWebview ( )
10241034 break
1035+ case "checkpointStorage" :
1036+ console . log ( `[ClineProvider] checkpointStorage: ${ message . text } ` )
1037+ const checkpointStorage = message . text ?? "task"
1038+ await this . updateGlobalState ( "checkpointStorage" , checkpointStorage )
1039+ await this . postStateToWebview ( )
1040+ break
10251041 case "browserViewportSize" :
10261042 const browserViewportSize = message . text ?? "900x600"
10271043 await this . updateGlobalState ( "browserViewportSize" , browserViewportSize )
@@ -1947,21 +1963,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19471963 await fs . unlink ( legacyMessagesFilePath )
19481964 }
19491965
1950- const { enableCheckpoints } = await this . getState ( )
1951- const baseDir = vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 )
1952-
1953- // Delete checkpoints branch.
1954- if ( enableCheckpoints && baseDir ) {
1955- const branchSummary = await simpleGit ( baseDir )
1956- . branch ( [ "-D" , `roo-code-checkpoints-${ id } ` ] )
1957- . catch ( ( ) => undefined )
1958-
1959- if ( branchSummary ) {
1960- console . log ( `[deleteTaskWithId${ id } ] deleted checkpoints branch` )
1961- }
1962- }
1963-
1964- // Delete checkpoints directory
1966+ // Delete checkpoints directory.
1967+ // TODO: Also delete the workspace branch if it exists.
19651968 const checkpointsDir = path . join ( taskDirPath , "checkpoints" )
19661969
19671970 if ( await fileExistsAtPath ( checkpointsDir ) ) {
@@ -2008,6 +2011,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
20082011 soundEnabled,
20092012 diffEnabled,
20102013 enableCheckpoints,
2014+ checkpointStorage,
20112015 taskHistory,
20122016 soundVolume,
20132017 browserViewportSize,
@@ -2058,6 +2062,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
20582062 soundEnabled : soundEnabled ?? false ,
20592063 diffEnabled : diffEnabled ?? true ,
20602064 enableCheckpoints : enableCheckpoints ?? true ,
2065+ checkpointStorage : checkpointStorage ?? "task" ,
20612066 shouldShowAnnouncement : lastShownAnnouncementId !== this . latestAnnouncementId ,
20622067 allowedCommands,
20632068 soundVolume : soundVolume ?? 0.5 ,
@@ -2191,6 +2196,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21912196 soundEnabled ,
21922197 diffEnabled ,
21932198 enableCheckpoints ,
2199+ checkpointStorage ,
21942200 soundVolume ,
21952201 browserViewportSize ,
21962202 fuzzyMatchThreshold ,
@@ -2278,6 +2284,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
22782284 this . getGlobalState ( "soundEnabled" ) as Promise < boolean | undefined > ,
22792285 this . getGlobalState ( "diffEnabled" ) as Promise < boolean | undefined > ,
22802286 this . getGlobalState ( "enableCheckpoints" ) as Promise < boolean | undefined > ,
2287+ this . getGlobalState ( "checkpointStorage" ) as Promise < CheckpointStorage | undefined > ,
22812288 this . getGlobalState ( "soundVolume" ) as Promise < number | undefined > ,
22822289 this . getGlobalState ( "browserViewportSize" ) as Promise < string | undefined > ,
22832290 this . getGlobalState ( "fuzzyMatchThreshold" ) as Promise < number | undefined > ,
@@ -2395,6 +2402,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
23952402 soundEnabled : soundEnabled ?? false ,
23962403 diffEnabled : diffEnabled ?? true ,
23972404 enableCheckpoints : enableCheckpoints ?? true ,
2405+ checkpointStorage : checkpointStorage ?? "task" ,
23982406 soundVolume,
23992407 browserViewportSize : browserViewportSize ?? "900x600" ,
24002408 screenshotQuality : screenshotQuality ?? 75 ,
0 commit comments