From cd1ff2ad25f5f9ff357831aba776dad6b23f7d87 Mon Sep 17 00:00:00 2001
From: Ara
Date: Thu, 15 May 2025 20:54:16 +0400
Subject: [PATCH] Refactor reasoning effort option and checkpoint handling
(#3454)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
• Replace "o3MiniReasoningEffort" with "reasoningEffort" in API providers
• Remove deprecated configuration properties from package.json
• Guard checkpoint tracker initialization and saving using the enableCheckpoints flag
Co-authored-by: Cline Evaluation
---
.changeset/nine-spiders-kneel.md | 5 +
package.json | 38 +------
src/api/providers/cline.ts | 2 +-
src/api/providers/openai-native.ts | 3 +-
src/api/providers/openai.ts | 2 +-
src/api/providers/openrouter.ts | 2 +-
src/api/providers/requesty.ts | 2 +-
src/api/transform/openrouter-stream.ts | 4 +-
src/core/controller/index.ts | 20 ++++
src/core/storage/state-keys.ts | 2 +
src/core/storage/state.ts | 44 ++++++--
src/core/task/index.ts | 101 +++++++++++++-----
.../checkpoints/CheckpointTracker-old.ts | 10 +-
.../checkpoints/CheckpointTracker.ts | 12 ++-
src/shared/ChatSettings.ts | 8 ++
src/shared/ExtensionMessage.ts | 1 +
src/shared/WebviewMessage.ts | 2 +
src/shared/api.ts | 1 -
.../settings/FeatureSettingsSection.tsx | 75 +++++++++++++
.../settings/PreferredLanguageSetting.tsx | 53 +++++++++
.../src/components/settings/SettingsView.tsx | 31 ++++--
.../src/context/ExtensionStateContext.tsx | 33 +++++-
22 files changed, 355 insertions(+), 96 deletions(-)
create mode 100644 .changeset/nine-spiders-kneel.md
create mode 100644 webview-ui/src/components/settings/FeatureSettingsSection.tsx
create mode 100644 webview-ui/src/components/settings/PreferredLanguageSetting.tsx
diff --git a/.changeset/nine-spiders-kneel.md b/.changeset/nine-spiders-kneel.md
new file mode 100644
index 00000000..67e0507d
--- /dev/null
+++ b/.changeset/nine-spiders-kneel.md
@@ -0,0 +1,5 @@
+---
+"claude-dev": patch
+---
+
+Finishing the migration of Vscode Advanced settings to Settings Webview
diff --git a/package.json b/package.json
index 89d037c1..0c688ec9 100644
--- a/package.json
+++ b/package.json
@@ -236,43 +236,7 @@
},
"configuration": {
"title": "Cline",
- "properties": {
- "cline.enableCheckpoints": {
- "type": "boolean",
- "default": true,
- "description": "Enables extension to save checkpoints of workspace throughout the task. Uses git under the hood which may not work well with large workspaces."
- },
- "cline.preferredLanguage": {
- "type": "string",
- "enum": [
- "English",
- "Arabic - العربية",
- "Portuguese - Português (Brasil)",
- "Czech - Čeština",
- "French - Français",
- "German - Deutsch",
- "Hindi - हिन्दी",
- "Hungarian - Magyar",
- "Italian - Italiano",
- "Japanese - 日本語",
- "Korean - 한국어",
- "Polish - Polski",
- "Portuguese - Português (Portugal)",
- "Russian - Русский",
- "Simplified Chinese - 简体中文",
- "Spanish - Español",
- "Traditional Chinese - 繁體中文",
- "Turkish - Türkçe"
- ],
- "default": "English",
- "description": "The language that Cline should use for communication."
- },
- "cline.mcpMarketplace.enabled": {
- "type": "boolean",
- "default": true,
- "description": "Controls whether the MCP Marketplace is enabled."
- }
- }
+ "properties": {}
}
},
"scripts": {
diff --git a/src/api/providers/cline.ts b/src/api/providers/cline.ts
index 729c7401..8ad69edf 100644
--- a/src/api/providers/cline.ts
+++ b/src/api/providers/cline.ts
@@ -33,7 +33,7 @@ export class ClineHandler implements ApiHandler {
systemPrompt,
messages,
this.getModel(),
- this.options.o3MiniReasoningEffort,
+ this.options.reasoningEffort,
this.options.thinkingBudgetTokens,
this.options.openRouterProviderSorting,
)
diff --git a/src/api/providers/openai-native.ts b/src/api/providers/openai-native.ts
index ff879c20..d1429944 100644
--- a/src/api/providers/openai-native.ts
+++ b/src/api/providers/openai-native.ts
@@ -66,8 +66,9 @@ export class OpenAiNativeHandler implements ApiHandler {
messages: [{ role: "developer", content: systemPrompt }, ...convertToOpenAiMessages(messages)],
stream: true,
stream_options: { include_usage: true },
- reasoning_effort: (this.options.o3MiniReasoningEffort as ChatCompletionReasoningEffort) || "medium",
+ reasoning_effort: (this.options.reasoningEffort as ChatCompletionReasoningEffort) || "medium",
})
+
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta
if (delta?.content) {
diff --git a/src/api/providers/openai.ts b/src/api/providers/openai.ts
index 59c93234..98c117ee 100644
--- a/src/api/providers/openai.ts
+++ b/src/api/providers/openai.ts
@@ -65,7 +65,7 @@ export class OpenAiHandler implements ApiHandler {
if (isReasoningModelFamily) {
openAiMessages = [{ role: "developer", content: systemPrompt }, ...convertToOpenAiMessages(messages)]
temperature = undefined // does not support temperature
- reasoningEffort = (this.options.o3MiniReasoningEffort as ChatCompletionReasoningEffort) || "medium"
+ reasoningEffort = (this.options.reasoningEffort as ChatCompletionReasoningEffort) || "medium"
}
const stream = await this.client.chat.completions.create({
diff --git a/src/api/providers/openrouter.ts b/src/api/providers/openrouter.ts
index 47159e77..1fec496d 100644
--- a/src/api/providers/openrouter.ts
+++ b/src/api/providers/openrouter.ts
@@ -35,7 +35,7 @@ export class OpenRouterHandler implements ApiHandler {
systemPrompt,
messages,
this.getModel(),
- this.options.o3MiniReasoningEffort,
+ this.options.reasoningEffort,
this.options.thinkingBudgetTokens,
this.options.openRouterProviderSorting,
)
diff --git a/src/api/providers/requesty.ts b/src/api/providers/requesty.ts
index 22c0a478..4175526b 100644
--- a/src/api/providers/requesty.ts
+++ b/src/api/providers/requesty.ts
@@ -32,7 +32,7 @@ export class RequestyHandler implements ApiHandler {
...convertToOpenAiMessages(messages),
]
- const reasoningEffort = this.options.o3MiniReasoningEffort || "medium"
+ const reasoningEffort = this.options.reasoningEffort || "medium"
const reasoning = { reasoning_effort: reasoningEffort }
const reasoningArgs = model.id.startsWith("openai/o") ? reasoning : {}
diff --git a/src/api/transform/openrouter-stream.ts b/src/api/transform/openrouter-stream.ts
index 02eec599..e3887752 100644
--- a/src/api/transform/openrouter-stream.ts
+++ b/src/api/transform/openrouter-stream.ts
@@ -9,7 +9,7 @@ export async function createOpenRouterStream(
systemPrompt: string,
messages: Anthropic.Messages.MessageParam[],
model: { id: string; info: ModelInfo },
- o3MiniReasoningEffort?: string,
+ reasoningEffort?: string,
thinkingBudgetTokens?: number,
openRouterProviderSorting?: string,
) {
@@ -144,7 +144,7 @@ export async function createOpenRouterStream(
stream_options: { include_usage: true },
transforms: shouldApplyMiddleOutTransform ? ["middle-out"] : undefined,
include_reasoning: true,
- ...(model.id.startsWith("openai/o") ? { reasoning_effort: o3MiniReasoningEffort || "medium" } : {}),
+ ...(model.id.startsWith("openai/o") ? { reasoning_effort: reasoningEffort || "medium" } : {}),
...(reasoning ? { reasoning } : {}),
...(openRouterProviderSorting ? { provider: { sort: openRouterProviderSorting } } : {}),
})
diff --git a/src/core/controller/index.ts b/src/core/controller/index.ts
index 5c08c132..16c7e8f7 100644
--- a/src/core/controller/index.ts
+++ b/src/core/controller/index.ts
@@ -145,6 +145,7 @@ export class Controller {
browserSettings,
chatSettings,
shellIntegrationTimeout,
+ enableCheckpointsSetting,
} = await getAllExtensionState(this.context)
if (autoApprovalSettings) {
@@ -168,6 +169,7 @@ export class Controller {
browserSettings,
chatSettings,
shellIntegrationTimeout,
+ enableCheckpointsSetting ?? true,
customInstructions,
task,
images,
@@ -563,6 +565,22 @@ export class Controller {
// plan act setting
await updateGlobalState(this.context, "planActSeparateModelsSetting", message.planActSeparateModelsSetting)
+ if (typeof message.enableCheckpointsSetting === "boolean") {
+ await updateGlobalState(this.context, "enableCheckpointsSetting", message.enableCheckpointsSetting)
+ }
+
+ if (typeof message.mcpMarketplaceEnabled === "boolean") {
+ await updateGlobalState(this.context, "mcpMarketplaceEnabled", message.mcpMarketplaceEnabled)
+ }
+
+ // chat settings (including preferredLanguage and openAIReasoningEffort)
+ if (message.chatSettings) {
+ await updateGlobalState(this.context, "chatSettings", message.chatSettings)
+ if (this.task) {
+ this.task.chatSettings = message.chatSettings
+ }
+ }
+
// after settings are updated, post state to webview
await this.postStateToWebview()
@@ -1332,6 +1350,7 @@ export class Controller {
mcpMarketplaceEnabled,
telemetrySetting,
planActSeparateModelsSetting,
+ enableCheckpointsSetting,
globalClineRulesToggles,
shellIntegrationTimeout,
} = await getAllExtensionState(this.context)
@@ -1366,6 +1385,7 @@ export class Controller {
mcpMarketplaceEnabled,
telemetrySetting,
planActSeparateModelsSetting,
+ enableCheckpointsSetting: enableCheckpointsSetting ?? true,
vscMachineId: vscode.env.machineId,
globalClineRulesToggles: globalClineRulesToggles || {},
localClineRulesToggles: localClineRulesToggles || {},
diff --git a/src/core/storage/state-keys.ts b/src/core/storage/state-keys.ts
index dc4a0942..c722013d 100644
--- a/src/core/storage/state-keys.ts
+++ b/src/core/storage/state-keys.ts
@@ -83,6 +83,8 @@ export type GlobalStateKey =
| "thinkingBudgetTokens"
| "reasoningEffort"
| "planActSeparateModelsSetting"
+ | "enableCheckpointsSetting"
+ | "mcpMarketplaceEnabled"
| "favoritedModelIds"
| "requestTimeoutMs"
| "shellIntegrationTimeout"
diff --git a/src/core/storage/state.ts b/src/core/storage/state.ts
index f70c82c9..7f988d1f 100644
--- a/src/core/storage/state.ts
+++ b/src/core/storage/state.ts
@@ -1,5 +1,5 @@
import * as vscode from "vscode"
-import { DEFAULT_CHAT_SETTINGS } from "@shared/ChatSettings"
+import { DEFAULT_CHAT_SETTINGS, OpenAIReasoningEffort } from "@shared/ChatSettings"
import { DEFAULT_BROWSER_SETTINGS } from "@shared/BrowserSettings"
import { DEFAULT_AUTO_APPROVAL_SETTINGS } from "@shared/AutoApprovalSettings"
import { GlobalStateKey, SecretKey } from "./state-keys"
@@ -51,6 +51,29 @@ export async function getWorkspaceState(context: vscode.ExtensionContext, key: s
return await context.workspaceState.get(key)
}
+async function migrateMcpMarketplaceEnableSetting(mcpMarketplaceEnabledRaw: boolean | undefined): Promise {
+ const config = vscode.workspace.getConfiguration("cline")
+ const mcpMarketplaceEnabled = config.get("mcpMarketplace.enabled")
+ if (mcpMarketplaceEnabled !== undefined) {
+ // Remove from VSCode configuration
+ await config.update("mcpMarketplace.enabled", undefined, true)
+
+ return !mcpMarketplaceEnabled
+ }
+ return mcpMarketplaceEnabledRaw ?? true
+}
+
+async function migrateEnableCheckpointsSetting(enableCheckpointsSettingRaw: boolean | undefined): Promise {
+ const config = vscode.workspace.getConfiguration("cline")
+ const enableCheckpoints = config.get("enableCheckpoints")
+ if (enableCheckpoints !== undefined) {
+ // Remove from VSCode configuration
+ await config.update("enableCheckpoints", undefined, true)
+ return enableCheckpoints
+ }
+ return enableCheckpointsSettingRaw ?? true
+}
+
export async function getAllExtensionState(context: vscode.ExtensionContext) {
const [
storedApiProvider,
@@ -136,6 +159,8 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
globalClineRulesToggles,
requestTimeoutMs,
shellIntegrationTimeout,
+ enableCheckpointsSettingRaw,
+ mcpMarketplaceEnabledRaw,
] = await Promise.all([
getGlobalState(context, "apiProvider") as Promise,
getGlobalState(context, "apiModelId") as Promise,
@@ -220,6 +245,9 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
getGlobalState(context, "globalClineRulesToggles") as Promise,
getGlobalState(context, "requestTimeoutMs") as Promise,
getGlobalState(context, "shellIntegrationTimeout") as Promise,
+ getGlobalState(context, "enableCheckpointsSetting") as Promise,
+ getGlobalState(context, "mcpMarketplaceEnabled") as Promise,
+ fetch,
])
let apiProvider: ApiProvider
@@ -238,9 +266,8 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
const localClineRulesToggles = (await getWorkspaceState(context, "localClineRulesToggles")) as ClineRulesToggles
- const o3MiniReasoningEffort = vscode.workspace.getConfiguration("cline.modelSettings.o3Mini").get("reasoningEffort", "medium")
-
- const mcpMarketplaceEnabled = vscode.workspace.getConfiguration("cline").get("mcpMarketplace.enabled", true)
+ const mcpMarketplaceEnabled = await migrateMcpMarketplaceEnableSetting(mcpMarketplaceEnabledRaw)
+ const enableCheckpointsSetting = await migrateEnableCheckpointsSetting(enableCheckpointsSettingRaw)
// Plan/Act separate models setting is a boolean indicating whether the user wants to use different models for plan and act. Existing users expect this to be enabled, while we want new users to opt in to this being disabled by default.
// On win11 state sometimes initializes as empty string instead of undefined
@@ -309,7 +336,6 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
openRouterModelInfo,
openRouterProviderSorting,
vsCodeLmModelSelector,
- o3MiniReasoningEffort,
thinkingBudgetTokens,
reasoningEffort,
liteLlmBaseUrl,
@@ -335,7 +361,10 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
globalClineRulesToggles: globalClineRulesToggles || {},
localClineRulesToggles: localClineRulesToggles || {},
browserSettings: { ...DEFAULT_BROWSER_SETTINGS, ...browserSettings }, // this will ensure that older versions of browserSettings (e.g. before remoteBrowserEnabled was added) are merged with the default values (false for remoteBrowserEnabled)
- chatSettings: chatSettings || DEFAULT_CHAT_SETTINGS,
+ chatSettings: {
+ ...DEFAULT_CHAT_SETTINGS, // Apply defaults first
+ ...(chatSettings || {}), // Spread fetched chatSettings, which includes preferredLanguage, and openAIReasoningEffort
+ },
userInfo,
previousModeApiProvider,
previousModeModelId,
@@ -345,9 +374,10 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
previousModeReasoningEffort,
previousModeAwsBedrockCustomSelected,
previousModeAwsBedrockCustomModelBaseId,
- mcpMarketplaceEnabled,
+ mcpMarketplaceEnabled: mcpMarketplaceEnabled,
telemetrySetting: telemetrySetting || "unset",
planActSeparateModelsSetting,
+ enableCheckpointsSetting: enableCheckpointsSetting,
shellIntegrationTimeout: shellIntegrationTimeout || 4000,
}
}
diff --git a/src/core/task/index.ts b/src/core/task/index.ts
index 52403deb..9e875db8 100644
--- a/src/core/task/index.ts
+++ b/src/core/task/index.ts
@@ -167,6 +167,7 @@ export class Task {
private didAlreadyUseTool = false
private didCompleteReadingStream = false
private didAutomaticallyRetryFailedApiRequest = false
+ private enableCheckpoints: boolean
constructor(
context: vscode.ExtensionContext,
@@ -182,6 +183,7 @@ export class Task {
browserSettings: BrowserSettings,
chatSettings: ChatSettings,
shellIntegrationTimeout: number,
+ enableCheckpointsSetting: boolean,
customInstructions?: string,
task?: string,
images?: string[],
@@ -207,6 +209,7 @@ export class Task {
this.autoApprovalSettings = autoApprovalSettings
this.browserSettings = browserSettings
this.chatSettings = chatSettings
+ this.enableCheckpoints = enableCheckpointsSetting
// Initialize taskId first
if (historyItem) {
@@ -222,11 +225,19 @@ export class Task {
// Initialize file context tracker
this.fileContextTracker = new FileContextTracker(context, this.taskId)
this.modelContextTracker = new ModelContextTracker(context, this.taskId)
- // Now that taskId is initialized, we can build the API handler
- this.api = buildApiHandler({
+
+ // Prepare effective API configuration
+ let effectiveApiConfiguration: ApiConfiguration = {
...apiConfiguration,
taskId: this.taskId,
- })
+ }
+
+ if (apiConfiguration.apiProvider === "openai" || apiConfiguration.apiProvider === "openai-native") {
+ effectiveApiConfiguration.reasoningEffort = chatSettings.openAIReasoningEffort
+ }
+
+ // Now that taskId is initialized, we can build the API handler
+ this.api = buildApiHandler(effectiveApiConfiguration)
// Set taskId on browserSession for telemetry tracking
this.browserSession.setTaskId(this.taskId)
@@ -342,9 +353,19 @@ export class Task {
break
case "taskAndWorkspace":
case "workspace":
+ if (!this.enableCheckpoints) {
+ vscode.window.showErrorMessage("Checkpoints are disabled in settings.")
+ didWorkspaceRestoreFail = true
+ break
+ }
+
if (!this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
try {
- this.checkpointTracker = await CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath)
+ this.checkpointTracker = await CheckpointTracker.create(
+ this.taskId,
+ this.context.globalStorageUri.fsPath,
+ this.enableCheckpoints,
+ )
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "Unknown error"
console.error("Failed to initialize checkpoint tracker:", errorMessage)
@@ -451,6 +472,11 @@ export class Task {
const relinquishButton = () => {
this.postMessageToWebview({ type: "relinquishControl" })
}
+ if (!this.enableCheckpoints) {
+ vscode.window.showInformationMessage("Checkpoints are disabled in settings. Cannot show diff.")
+ relinquishButton()
+ return
+ }
console.log("presentMultifileDiff", messageTs)
const messageIndex = this.clineMessages.findIndex((m) => m.ts === messageTs)
@@ -468,9 +494,13 @@ export class Task {
}
// TODO: handle if this is called from outside original workspace, in which case we need to show user error message we can't show diff outside of workspace?
- if (!this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
+ if (!this.checkpointTracker && this.enableCheckpoints && !this.checkpointTrackerErrorMessage) {
try {
- this.checkpointTracker = await CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath)
+ this.checkpointTracker = await CheckpointTracker.create(
+ this.taskId,
+ this.context.globalStorageUri.fsPath,
+ this.enableCheckpoints,
+ )
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "Unknown error"
console.error("Failed to initialize checkpoint tracker:", errorMessage)
@@ -568,6 +598,8 @@ export class Task {
}
async doesLatestTaskCompletionHaveNewChanges() {
+ if (!this.enableCheckpoints) return false
+
const messageIndex = findLastIndex(this.clineMessages, (m) => m.say === "completion_result")
const message = this.clineMessages[messageIndex]
if (!message) {
@@ -580,9 +612,13 @@ export class Task {
return false
}
- if (!this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
+ if (this.enableCheckpoints && !this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
try {
- this.checkpointTracker = await CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath)
+ this.checkpointTracker = await CheckpointTracker.create(
+ this.taskId,
+ this.context.globalStorageUri.fsPath,
+ this.enableCheckpoints,
+ )
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "Unknown error"
console.error("Failed to initialize checkpoint tracker:", errorMessage)
@@ -1081,6 +1117,10 @@ export class Task {
// Checkpoints
async saveCheckpoint(isAttemptCompletionMessage: boolean = false) {
+ if (!this.enableCheckpoints) {
+ // If checkpoints are disabled, do nothing.
+ return
+ }
// Set isCheckpointCheckedOut to false for all checkpoint_created messages
this.clineMessages.forEach((message) => {
if (message.say === "checkpoint_created") {
@@ -1448,7 +1488,7 @@ export class Task {
*/
private async migrateDisableBrowserToolSetting(): Promise {
const config = vscode.workspace.getConfiguration("cline")
- const disableBrowserTool = vscode.workspace.getConfiguration("cline").get("disableBrowserTool")
+ const disableBrowserTool = config.get("disableBrowserTool")
if (disableBrowserTool !== undefined) {
this.browserSettings.disableToolUse = disableBrowserTool
@@ -1457,6 +1497,16 @@ export class Task {
}
}
+ private async migratePreferredLanguageToolSetting(): Promise {
+ const config = vscode.workspace.getConfiguration("cline")
+ const preferredLanguage = config.get("preferredLanguage")
+ if (preferredLanguage !== undefined) {
+ this.chatSettings.preferredLanguage = preferredLanguage
+ // Remove from VSCode configuration
+ await config.update("preferredLanguage", undefined, true)
+ }
+ }
+
async *attemptApiRequest(previousApiReqIndex: number): ApiStream {
// Wait for MCP servers to be connected before generating system prompt
await pWaitFor(() => this.mcpHub.isConnecting !== true, { timeout: 10_000 }).catch(() => {
@@ -1473,9 +1523,8 @@ export class Task {
let systemPrompt = await SYSTEM_PROMPT(cwd, supportsBrowserUse, this.mcpHub, this.browserSettings)
let settingsCustomInstructions = this.customInstructions?.trim()
- const preferredLanguage = getLanguageKey(
- vscode.workspace.getConfiguration("cline").get("preferredLanguage"),
- )
+ await this.migratePreferredLanguageToolSetting()
+ const preferredLanguage = getLanguageKey(this.chatSettings.preferredLanguage as LanguageDisplay)
const preferredLanguageInstructions =
preferredLanguage && preferredLanguage !== DEFAULT_LANGUAGE_SETTINGS
? `# Preferred Language\n\nSpeak in ${preferredLanguage}.`
@@ -3670,17 +3719,11 @@ export class Task {
}),
)
- if (isFirstRequest) {
- await this.say("checkpoint_created") // no hash since we need to wait for CheckpointTracker to be initialized
- }
-
- // use this opportunity to initialize the checkpoint tracker (can be expensive to initialize in the constructor)
- // FIXME: right now we're letting users init checkpoints for old tasks, but this could be a problem if opening a task in the wrong workspace
- // isNewTask &&
- if (!this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
+ // Initialize checkpoint tracker first if enabled and it's the first request
+ if (isFirstRequest && this.enableCheckpoints && !this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
try {
this.checkpointTracker = await pTimeout(
- CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath),
+ CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath, this.enableCheckpoints),
{
milliseconds: 15_000,
message:
@@ -3694,14 +3737,22 @@ export class Task {
}
}
- // Now that checkpoint tracker is initialized, update the dummy checkpoint_created message with the commit hash. (This is necessary since we use the API request loading as an opportunity to initialize the checkpoint tracker, which can take some time)
- if (isFirstRequest) {
- const commitHash = await this.checkpointTracker?.commit()
+ // Now, if it's the first request AND checkpoints are enabled AND tracker was successfully initialized,
+ // then say "checkpoint_created" and perform the commit.
+ if (isFirstRequest && this.enableCheckpoints && this.checkpointTracker) {
+ await this.say("checkpoint_created") // Now this is conditional
+ const commitHash = await this.checkpointTracker.commit() // Actual commit
const lastCheckpointMessage = findLast(this.clineMessages, (m) => m.say === "checkpoint_created")
if (lastCheckpointMessage) {
lastCheckpointMessage.lastCheckpointHash = commitHash
- await this.saveClineMessagesAndUpdateHistory()
+ // saveClineMessagesAndUpdateHistory will be called later after API response,
+ // so no need to call it here unless this is the only modification to this message.
+ // For now, assuming it's handled later.
}
+ } else if (isFirstRequest && this.enableCheckpoints && !this.checkpointTracker && this.checkpointTrackerErrorMessage) {
+ // Checkpoints are enabled, but tracker failed to initialize.
+ // checkpointTrackerErrorMessage is already set and will be part of the state.
+ // No explicit UI message here, error message will be in ExtensionState.
}
const [parsedUserContent, environmentDetails, clinerulesError] = await this.loadContext(userContent, includeFileDetails)
diff --git a/src/integrations/checkpoints/CheckpointTracker-old.ts b/src/integrations/checkpoints/CheckpointTracker-old.ts
index 0c1ceaf9..cab89b88 100644
--- a/src/integrations/checkpoints/CheckpointTracker-old.ts
+++ b/src/integrations/checkpoints/CheckpointTracker-old.ts
@@ -21,15 +21,17 @@ class CheckpointTracker {
this.cwd = cwd
}
- public static async create(taskId: string, provider?: ClineProvider): Promise {
+ public static async create(
+ taskId: string,
+ enableCheckpointsSetting: boolean,
+ provider?: ClineProvider,
+ ): Promise {
try {
if (!provider) {
throw new Error("Provider is required to create a checkpoint tracker")
}
- // Check if checkpoints are disabled in VS Code settings
- const enableCheckpoints = vscode.workspace.getConfiguration("cline").get("enableCheckpoints") ?? true
- if (!enableCheckpoints) {
+ if (!enableCheckpointsSetting) {
return undefined // Don't create tracker when disabled
}
diff --git a/src/integrations/checkpoints/CheckpointTracker.ts b/src/integrations/checkpoints/CheckpointTracker.ts
index 814647c8..cf96065a 100644
--- a/src/integrations/checkpoints/CheckpointTracker.ts
+++ b/src/integrations/checkpoints/CheckpointTracker.ts
@@ -90,7 +90,11 @@ class CheckpointTracker {
* Configuration:
* - Respects 'cline.enableCheckpoints' VS Code setting
*/
- public static async create(taskId: string, globalStoragePath: string | undefined): Promise {
+ public static async create(
+ taskId: string,
+ globalStoragePath: string | undefined,
+ enableCheckpointsSetting: boolean,
+ ): Promise {
if (!globalStoragePath) {
throw new Error("Global storage path is required to create a checkpoint tracker")
}
@@ -98,9 +102,9 @@ class CheckpointTracker {
console.info(`Creating new CheckpointTracker for task ${taskId}`)
const startTime = performance.now()
- // Check if checkpoints are disabled in VS Code settings
- const enableCheckpoints = vscode.workspace.getConfiguration("cline").get("enableCheckpoints") ?? true
- if (!enableCheckpoints) {
+ // Check if checkpoints are disabled by setting
+ if (!enableCheckpointsSetting) {
+ console.info(`Checkpoints disabled by setting for task ${taskId}`)
return undefined // Don't create tracker when disabled
}
diff --git a/src/shared/ChatSettings.ts b/src/shared/ChatSettings.ts
index 1632082d..ffab9873 100644
--- a/src/shared/ChatSettings.ts
+++ b/src/shared/ChatSettings.ts
@@ -1,7 +1,15 @@
+export type OpenAIReasoningEffort = "low" | "medium" | "high"
+
export interface ChatSettings {
mode: "plan" | "act"
+ preferredLanguage?: string
+ openAIReasoningEffort?: OpenAIReasoningEffort
}
+export type PartialChatSettings = Partial
+
export const DEFAULT_CHAT_SETTINGS: ChatSettings = {
mode: "act",
+ preferredLanguage: "English",
+ openAIReasoningEffort: "medium",
}
diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts
index 1daef43f..2752f207 100644
--- a/src/shared/ExtensionMessage.ts
+++ b/src/shared/ExtensionMessage.ts
@@ -126,6 +126,7 @@ export interface ExtensionState {
customInstructions?: string
mcpMarketplaceEnabled?: boolean
planActSeparateModelsSetting: boolean
+ enableCheckpointsSetting?: boolean
platform: Platform
shouldShowAnnouncement: boolean
taskHistory: HistoryItem[]
diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts
index fcb025f2..993f3a07 100644
--- a/src/shared/WebviewMessage.ts
+++ b/src/shared/WebviewMessage.ts
@@ -90,6 +90,8 @@ export interface WebviewMessage {
// For openInBrowser
url?: string
planActSeparateModelsSetting?: boolean
+ enableCheckpointsSetting?: boolean
+ mcpMarketplaceEnabled?: boolean
telemetrySetting?: TelemetrySetting
customInstructionsSetting?: string
// For task feedback
diff --git a/src/shared/api.ts b/src/shared/api.ts
index c10f740c..f39b7b36 100644
--- a/src/shared/api.ts
+++ b/src/shared/api.ts
@@ -80,7 +80,6 @@ export interface ApiHandlerOptions {
mistralApiKey?: string
azureApiVersion?: string
vsCodeLmModelSelector?: LanguageModelChatSelector
- o3MiniReasoningEffort?: string
qwenApiLine?: string
asksageApiUrl?: string
asksageApiKey?: string
diff --git a/webview-ui/src/components/settings/FeatureSettingsSection.tsx b/webview-ui/src/components/settings/FeatureSettingsSection.tsx
new file mode 100644
index 00000000..1acae1aa
--- /dev/null
+++ b/webview-ui/src/components/settings/FeatureSettingsSection.tsx
@@ -0,0 +1,75 @@
+import { VSCodeCheckbox, VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
+import { useExtensionState } from "@/context/ExtensionStateContext"
+import { memo } from "react"
+import { OpenAIReasoningEffort } from "@shared/ChatSettings"
+
+const FeatureSettingsSection = () => {
+ const {
+ enableCheckpointsSetting,
+ setEnableCheckpointsSetting,
+ mcpMarketplaceEnabled,
+ setMcpMarketplaceEnabled,
+ chatSettings,
+ setChatSettings,
+ } = useExtensionState()
+
+ return (
+
+
Feature Settings
+
+
{
+ const checked = e.target.checked === true
+ setEnableCheckpointsSetting(checked)
+ }}>
+ Enable Checkpoints
+
+
+ Enables extension to save checkpoints of workspace throughout the task. Uses git under the hood which may not
+ work well with large workspaces.
+
+
+
+
{
+ const checked = e.target.checked === true
+ setMcpMarketplaceEnabled(checked)
+ }}>
+ Enable MCP Marketplace
+
+
+ Enables the MCP Marketplace tab for discovering and installing MCP servers.
+
+
+
+
+ OpenAI Reasoning Effort
+
+
{
+ const newValue = e.target.currentValue as OpenAIReasoningEffort
+ setChatSettings({
+ ...chatSettings,
+ openAIReasoningEffort: newValue,
+ })
+ }}
+ className="w-full">
+ Low
+ Medium
+ High
+
+
+ Reasoning effort for the OpenAI family of models(applies to all OpenAI model providers)
+
+
+
+ )
+}
+
+export default memo(FeatureSettingsSection)
diff --git a/webview-ui/src/components/settings/PreferredLanguageSetting.tsx b/webview-ui/src/components/settings/PreferredLanguageSetting.tsx
new file mode 100644
index 00000000..c1719158
--- /dev/null
+++ b/webview-ui/src/components/settings/PreferredLanguageSetting.tsx
@@ -0,0 +1,53 @@
+import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
+import React from "react"
+import { ChatSettings } from "@shared/ChatSettings"
+
+interface PreferredLanguageSettingProps {
+ chatSettings: ChatSettings
+ setChatSettings: (settings: ChatSettings) => void
+}
+
+const PreferredLanguageSetting: React.FC = ({ chatSettings, setChatSettings }) => {
+ return (
+
+
+ Preferred Language
+
+
{
+ const newLanguage = e.target.value
+ setChatSettings({
+ ...chatSettings,
+ preferredLanguage: newLanguage,
+ }) // This constructs a full ChatSettings object
+ }}
+ style={{ width: "100%" }}>
+ English
+ Arabic - العربية
+ Portuguese - Português (Brasil)
+ Czech - Čeština
+ French - Français
+ German - Deutsch
+ Hindi - हिन्दी
+ Hungarian - Magyar
+ Italian - Italiano
+ Japanese - 日本語
+ Korean - 한국어
+ Polish - Polski
+ Portuguese - Português (Portugal)
+ Russian - Русский
+ Simplified Chinese - 简体中文
+ Spanish - Español
+ Traditional Chinese - 繁體中文
+ Turkish - Türkçe
+
+
+ The language that Cline should use for communication.
+
+
+ )
+}
+
+export default React.memo(PreferredLanguageSetting)
diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx
index f5b9f78a..5c25dca1 100644
--- a/webview-ui/src/components/settings/SettingsView.tsx
+++ b/webview-ui/src/components/settings/SettingsView.tsx
@@ -1,5 +1,14 @@
-import { VSCodeButton, VSCodeCheckbox, VSCodeLink, VSCodeTextArea } from "@vscode/webview-ui-toolkit/react"
+import {
+ VSCodeButton,
+ VSCodeCheckbox,
+ VSCodeDropdown,
+ VSCodeLink,
+ VSCodeOption,
+ VSCodeTextArea,
+} from "@vscode/webview-ui-toolkit/react"
import { memo, useCallback, useEffect, useState } from "react"
+import PreferredLanguageSetting from "./PreferredLanguageSetting" // Added import
+import { OpenAIReasoningEffort } from "@shared/ChatSettings"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { validateApiConfiguration, validateModelId } from "@/utils/validate"
import { vscode } from "@/utils/vscode"
@@ -8,6 +17,7 @@ import ApiOptions from "./ApiOptions"
import { TabButton } from "../mcp/configuration/McpConfigurationView"
import { useEvent } from "react-use"
import { ExtensionMessage } from "@shared/ExtensionMessage"
+import FeatureSettingsSection from "./FeatureSettingsSection"
import BrowserSettingsSection from "./BrowserSettingsSection"
import TerminalSettingsSection from "./TerminalSettingsSection"
import { FEATURE_FLAGS } from "@shared/services/feature-flags/feature-flags"
@@ -27,8 +37,11 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
telemetrySetting,
setTelemetrySetting,
chatSettings,
+ setChatSettings,
planActSeparateModelsSetting,
setPlanActSeparateModelsSetting,
+ enableCheckpointsSetting,
+ mcpMarketplaceEnabled,
} = useExtensionState()
const [apiErrorMessage, setApiErrorMessage] = useState(undefined)
const [modelIdErrorMessage, setModelIdErrorMessage] = useState(undefined)
@@ -67,6 +80,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
planActSeparateModelsSetting,
customInstructionsSetting: customInstructions,
telemetrySetting,
+ enableCheckpointsSetting,
+ mcpMarketplaceEnabled,
apiConfiguration: apiConfigurationToSubmit,
})
@@ -198,6 +213,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
+ {chatSettings && }
+
{
+ {/* Feature Settings Section */}
+
+
{/* Browser Settings Section */}
{/* Terminal Settings Section */}
-
- vscode.postMessage({ type: "openExtensionSettings" })}
- className="mt-0 mr-0 mb-4 ml-0">
-
- Advanced Settings
-
-
-
{IS_DEV && (
<>
Debug
diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx
index a5154de5..cf23c895 100644
--- a/webview-ui/src/context/ExtensionStateContext.tsx
+++ b/webview-ui/src/context/ExtensionStateContext.tsx
@@ -17,7 +17,7 @@ import { McpMarketplaceCatalog, McpServer, McpViewTab } from "../../../src/share
import { convertTextMateToHljs } from "../utils/textMateToHljs"
import { vscode } from "../utils/vscode"
import { DEFAULT_BROWSER_SETTINGS } from "@shared/BrowserSettings"
-import { DEFAULT_CHAT_SETTINGS } from "@shared/ChatSettings"
+import { ChatSettings, DEFAULT_CHAT_SETTINGS } from "@shared/ChatSettings"
import { TelemetrySetting } from "@shared/TelemetrySetting"
interface ExtensionStateContextType extends ExtensionState {
@@ -41,7 +41,10 @@ interface ExtensionStateContextType extends ExtensionState {
setTelemetrySetting: (value: TelemetrySetting) => void
setShowAnnouncement: (value: boolean) => void
setPlanActSeparateModelsSetting: (value: boolean) => void
+ setEnableCheckpointsSetting: (value: boolean) => void
+ setMcpMarketplaceEnabled: (value: boolean) => void
setShellIntegrationTimeout: (value: number) => void
+ setChatSettings: (value: ChatSettings) => void
setMcpServers: (value: McpServer[]) => void
// Navigation
@@ -70,6 +73,7 @@ export const ExtensionStateContextProvider: React.FC<{
telemetrySetting: "unset",
vscMachineId: "",
planActSeparateModelsSetting: true,
+ enableCheckpointsSetting: true,
globalClineRulesToggles: {},
localClineRulesToggles: {},
localCursorRulesToggles: {},
@@ -268,6 +272,7 @@ export const ExtensionStateContextProvider: React.FC<{
localClineRulesToggles: state.localClineRulesToggles || {},
localCursorRulesToggles: state.localCursorRulesToggles || {},
localWindsurfRulesToggles: state.localWindsurfRulesToggles || {},
+ enableCheckpointsSetting: state.enableCheckpointsSetting,
setApiConfiguration: (value) =>
setState((prevState) => ({
...prevState,
@@ -288,6 +293,16 @@ export const ExtensionStateContextProvider: React.FC<{
...prevState,
planActSeparateModelsSetting: value,
})),
+ setEnableCheckpointsSetting: (value) =>
+ setState((prevState) => ({
+ ...prevState,
+ enableCheckpointsSetting: value,
+ })),
+ setMcpMarketplaceEnabled: (value) =>
+ setState((prevState) => ({
+ ...prevState,
+ mcpMarketplaceEnabled: value,
+ })),
setShowAnnouncement: (value) =>
setState((prevState) => ({
...prevState,
@@ -300,6 +315,22 @@ export const ExtensionStateContextProvider: React.FC<{
})),
setMcpServers: (mcpServers: McpServer[]) => setMcpServers(mcpServers),
setShowMcp,
+ setChatSettings: (value) => {
+ setState((prevState) => ({
+ ...prevState,
+ chatSettings: value,
+ }))
+ vscode.postMessage({
+ type: "updateSettings",
+ chatSettings: value,
+ apiConfiguration: state.apiConfiguration,
+ customInstructionsSetting: state.customInstructions,
+ telemetrySetting: state.telemetrySetting,
+ planActSeparateModelsSetting: state.planActSeparateModelsSetting,
+ enableCheckpointsSetting: state.enableCheckpointsSetting,
+ mcpMarketplaceEnabled: state.mcpMarketplaceEnabled,
+ })
+ },
setMcpTab,
}