-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Checkpoint storage setting + settings view redesign #1379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import * as vscode from "vscode" | |
| import simpleGit from "simple-git" | ||
|
|
||
| import { ApiConfiguration, ApiProvider, ModelInfo } from "../../shared/api" | ||
| import { CheckpointStorage } from "../../shared/checkpoints" | ||
| import { findLast } from "../../shared/array" | ||
| import { CustomSupportPrompts, supportPrompt } from "../../shared/support-prompt" | ||
| import { GlobalFileNames } from "../../shared/globalFileNames" | ||
|
|
@@ -313,11 +314,13 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
|
|
||
| public async initClineWithTask(task?: string, images?: string[]) { | ||
| await this.clearTask() | ||
|
|
||
| const { | ||
| apiConfiguration, | ||
| customModePrompts, | ||
| diffEnabled, | ||
| diffEnabled: enableDiff, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| fuzzyMatchThreshold, | ||
| mode, | ||
| customInstructions: globalInstructions, | ||
|
|
@@ -331,8 +334,9 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| provider: this, | ||
| apiConfiguration, | ||
| customInstructions: effectiveInstructions, | ||
| enableDiff: diffEnabled, | ||
| enableDiff, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| fuzzyMatchThreshold, | ||
| task, | ||
| images, | ||
|
|
@@ -346,8 +350,9 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| const { | ||
| apiConfiguration, | ||
| customModePrompts, | ||
| diffEnabled, | ||
| diffEnabled: enableDiff, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| fuzzyMatchThreshold, | ||
| mode, | ||
| customInstructions: globalInstructions, | ||
|
|
@@ -357,12 +362,17 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| const modePrompt = customModePrompts?.[mode] as PromptComponent | ||
| const effectiveInstructions = [globalInstructions, modePrompt?.customInstructions].filter(Boolean).join("\n\n") | ||
|
|
||
| // TODO: The `checkpointStorage` value should be derived from the | ||
| // task data on disk; the current setting could be different than | ||
| // the setting at the time the task was created. | ||
|
|
||
| this.cline = new Cline({ | ||
| provider: this, | ||
| apiConfiguration, | ||
| customInstructions: effectiveInstructions, | ||
| enableDiff: diffEnabled, | ||
| enableDiff, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| fuzzyMatchThreshold, | ||
| historyItem, | ||
| experiments, | ||
|
|
@@ -1022,6 +1032,12 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| await this.updateGlobalState("enableCheckpoints", enableCheckpoints) | ||
| await this.postStateToWebview() | ||
| break | ||
| case "checkpointStorage": | ||
| console.log(`[ClineProvider] checkpointStorage: ${message.text}`) | ||
| const checkpointStorage = message.text ?? "task" | ||
| await this.updateGlobalState("checkpointStorage", checkpointStorage) | ||
| await this.postStateToWebview() | ||
| break | ||
| case "browserViewportSize": | ||
| const browserViewportSize = message.text ?? "900x600" | ||
| await this.updateGlobalState("browserViewportSize", browserViewportSize) | ||
|
|
@@ -1947,21 +1963,8 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| await fs.unlink(legacyMessagesFilePath) | ||
| } | ||
|
|
||
| const { enableCheckpoints } = await this.getState() | ||
| const baseDir = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) | ||
|
|
||
| // Delete checkpoints branch. | ||
| if (enableCheckpoints && baseDir) { | ||
| const branchSummary = await simpleGit(baseDir) | ||
|
||
| .branch(["-D", `roo-code-checkpoints-${id}`]) | ||
| .catch(() => undefined) | ||
|
|
||
| if (branchSummary) { | ||
| console.log(`[deleteTaskWithId${id}] deleted checkpoints branch`) | ||
| } | ||
| } | ||
|
|
||
| // Delete checkpoints directory | ||
| // Delete checkpoints directory. | ||
| // TODO: Also delete the workspace branch if it exists. | ||
| const checkpointsDir = path.join(taskDirPath, "checkpoints") | ||
|
|
||
| if (await fileExistsAtPath(checkpointsDir)) { | ||
|
|
@@ -2008,6 +2011,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| soundEnabled, | ||
| diffEnabled, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| taskHistory, | ||
| soundVolume, | ||
| browserViewportSize, | ||
|
|
@@ -2058,6 +2062,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| soundEnabled: soundEnabled ?? false, | ||
| diffEnabled: diffEnabled ?? true, | ||
| enableCheckpoints: enableCheckpoints ?? true, | ||
| checkpointStorage: checkpointStorage ?? "task", | ||
| shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId, | ||
| allowedCommands, | ||
| soundVolume: soundVolume ?? 0.5, | ||
|
|
@@ -2191,6 +2196,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| soundEnabled, | ||
| diffEnabled, | ||
| enableCheckpoints, | ||
| checkpointStorage, | ||
| soundVolume, | ||
| browserViewportSize, | ||
| fuzzyMatchThreshold, | ||
|
|
@@ -2278,6 +2284,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| this.getGlobalState("soundEnabled") as Promise<boolean | undefined>, | ||
| this.getGlobalState("diffEnabled") as Promise<boolean | undefined>, | ||
| this.getGlobalState("enableCheckpoints") as Promise<boolean | undefined>, | ||
| this.getGlobalState("checkpointStorage") as Promise<CheckpointStorage | undefined>, | ||
| this.getGlobalState("soundVolume") as Promise<number | undefined>, | ||
| this.getGlobalState("browserViewportSize") as Promise<string | undefined>, | ||
| this.getGlobalState("fuzzyMatchThreshold") as Promise<number | undefined>, | ||
|
|
@@ -2395,6 +2402,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { | |
| soundEnabled: soundEnabled ?? false, | ||
| diffEnabled: diffEnabled ?? true, | ||
| enableCheckpoints: enableCheckpoints ?? true, | ||
| checkpointStorage: checkpointStorage ?? "task", | ||
| soundVolume, | ||
| browserViewportSize: browserViewportSize ?? "900x600", | ||
| screenshotQuality: screenshotQuality ?? 75, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export type CheckpointStorage = "task" | "workspace" | ||
|
|
||
| export const isCheckpointStorage = (value: string): value is CheckpointStorage => { | ||
| return value === "task" || value === "workspace" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on this as a follow-up.