mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Merge remote-tracking branch 'origin/main' into aws-profile-support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
import delay from "delay"
|
||||
import axios from "axios"
|
||||
import fs from "fs/promises"
|
||||
import os from "os"
|
||||
@@ -10,15 +11,24 @@ import { downloadTask } from "../../integrations/misc/export-markdown"
|
||||
import { openFile, openImage } from "../../integrations/misc/open-file"
|
||||
import { selectImages } from "../../integrations/misc/process-images"
|
||||
import { getTheme } from "../../integrations/theme/getTheme"
|
||||
import { getDiffStrategy } from "../diff/DiffStrategy"
|
||||
import WorkspaceTracker from "../../integrations/workspace/WorkspaceTracker"
|
||||
import { McpHub } from "../../services/mcp/McpHub"
|
||||
import { ApiConfiguration, ApiProvider, ModelInfo } from "../../shared/api"
|
||||
import { findLast } from "../../shared/array"
|
||||
import { ApiConfigMeta, ExtensionMessage } from "../../shared/ExtensionMessage"
|
||||
import { HistoryItem } from "../../shared/HistoryItem"
|
||||
import { WebviewMessage, PromptMode } from "../../shared/WebviewMessage"
|
||||
import { defaultModeSlug, defaultPrompts } from "../../shared/modes"
|
||||
import { SYSTEM_PROMPT, addCustomInstructions } from "../prompts/system"
|
||||
import { WebviewMessage } from "../../shared/WebviewMessage"
|
||||
import {
|
||||
Mode,
|
||||
modes,
|
||||
CustomModePrompts,
|
||||
PromptComponent,
|
||||
ModeConfig,
|
||||
defaultModeSlug,
|
||||
getModeBySlug,
|
||||
} from "../../shared/modes"
|
||||
import { SYSTEM_PROMPT } from "../prompts/system"
|
||||
import { fileExistsAtPath } from "../../utils/fs"
|
||||
import { Cline } from "../Cline"
|
||||
import { openMention } from "../mentions"
|
||||
@@ -26,10 +36,13 @@ import { getNonce } from "./getNonce"
|
||||
import { getUri } from "./getUri"
|
||||
import { playSound, setSoundEnabled, setSoundVolume } from "../../utils/sound"
|
||||
import { checkExistKey } from "../../shared/checkExistApiConfig"
|
||||
import { enhancePrompt } from "../../utils/enhance-prompt"
|
||||
import { singleCompletionHandler } from "../../utils/single-completion-handler"
|
||||
import { getCommitInfo, searchCommits, getWorkingState } from "../../utils/git"
|
||||
import { ConfigManager } from "../config/ConfigManager"
|
||||
import { Mode, modes, CustomPrompts, PromptComponent, enhance } from "../../shared/modes"
|
||||
import { CustomModesManager } from "../config/CustomModesManager"
|
||||
import { CustomSupportPrompts, supportPrompt } from "../../shared/support-prompt"
|
||||
|
||||
import { ACTION_NAMES } from "../CodeActionProvider"
|
||||
|
||||
/*
|
||||
https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/default/weather-webview/src/providers/WeatherViewProvider.ts
|
||||
@@ -69,6 +82,8 @@ type GlobalStateKey =
|
||||
| "taskHistory"
|
||||
| "openAiBaseUrl"
|
||||
| "openAiModelId"
|
||||
| "openAiCustomModelInfo"
|
||||
| "openAiUseAzure"
|
||||
| "ollamaModelId"
|
||||
| "ollamaBaseUrl"
|
||||
| "lmStudioModelId"
|
||||
@@ -98,10 +113,12 @@ type GlobalStateKey =
|
||||
| "vsCodeLmModelSelector"
|
||||
| "mode"
|
||||
| "modeApiConfigs"
|
||||
| "customPrompts"
|
||||
| "customModePrompts"
|
||||
| "customSupportPrompts"
|
||||
| "enhancementApiConfigId"
|
||||
| "experimentalDiffStrategy"
|
||||
| "autoApprovalEnabled"
|
||||
| "customModes" // Array of custom modes
|
||||
|
||||
export const GlobalFileNames = {
|
||||
apiConversationHistory: "api_conversation_history.json",
|
||||
@@ -120,8 +137,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
private cline?: Cline
|
||||
private workspaceTracker?: WorkspaceTracker
|
||||
mcpHub?: McpHub
|
||||
private latestAnnouncementId = "jan-13-2025-custom-prompt" // update to some unique identifier when we add a new announcement
|
||||
private latestAnnouncementId = "jan-21-2025-custom-modes" // update to some unique identifier when we add a new announcement
|
||||
configManager: ConfigManager
|
||||
customModesManager: CustomModesManager
|
||||
|
||||
constructor(
|
||||
readonly context: vscode.ExtensionContext,
|
||||
@@ -132,6 +150,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.workspaceTracker = new WorkspaceTracker(this)
|
||||
this.mcpHub = new McpHub(this)
|
||||
this.configManager = new ConfigManager(this.context)
|
||||
this.customModesManager = new CustomModesManager(this.context, async () => {
|
||||
await this.postStateToWebview()
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -157,6 +178,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.workspaceTracker = undefined
|
||||
this.mcpHub?.dispose()
|
||||
this.mcpHub = undefined
|
||||
this.customModesManager?.dispose()
|
||||
this.outputChannel.appendLine("Disposed all disposables")
|
||||
ClineProvider.activeInstances.delete(this)
|
||||
}
|
||||
@@ -165,6 +187,32 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
return findLast(Array.from(this.activeInstances), (instance) => instance.view?.visible === true)
|
||||
}
|
||||
|
||||
public static async handleCodeAction(
|
||||
promptType: keyof typeof ACTION_NAMES,
|
||||
params: Record<string, string | any[]>,
|
||||
): Promise<void> {
|
||||
let visibleProvider = ClineProvider.getVisibleInstance()
|
||||
|
||||
// If no visible provider, try to show the sidebar view
|
||||
if (!visibleProvider) {
|
||||
await vscode.commands.executeCommand("roo-cline.SidebarProvider.focus")
|
||||
// Wait briefly for the view to become visible
|
||||
await delay(100)
|
||||
visibleProvider = ClineProvider.getVisibleInstance()
|
||||
}
|
||||
|
||||
// If still no visible provider, return
|
||||
if (!visibleProvider) {
|
||||
return
|
||||
}
|
||||
|
||||
const { customSupportPrompts } = await visibleProvider.getState()
|
||||
|
||||
const prompt = supportPrompt.create(promptType, params, customSupportPrompts)
|
||||
|
||||
await visibleProvider.initClineWithTask(prompt)
|
||||
}
|
||||
|
||||
resolveWebviewView(
|
||||
webviewView: vscode.WebviewView | vscode.WebviewPanel,
|
||||
//context: vscode.WebviewViewResolveContext<unknown>, used to recreate a deallocated webview, but we don't need this since we use retainContextWhenHidden
|
||||
@@ -251,7 +299,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
await this.clearTask()
|
||||
const {
|
||||
apiConfiguration,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
diffEnabled,
|
||||
fuzzyMatchThreshold,
|
||||
mode,
|
||||
@@ -259,9 +307,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
experimentalDiffStrategy,
|
||||
} = await this.getState()
|
||||
|
||||
const modePrompt = customPrompts?.[mode]
|
||||
const modeInstructions = typeof modePrompt === "object" ? modePrompt.customInstructions : undefined
|
||||
const effectiveInstructions = [globalInstructions, modeInstructions].filter(Boolean).join("\n\n")
|
||||
const modePrompt = customModePrompts?.[mode] as PromptComponent
|
||||
const effectiveInstructions = [globalInstructions, modePrompt?.customInstructions].filter(Boolean).join("\n\n")
|
||||
|
||||
this.cline = new Cline(
|
||||
this,
|
||||
@@ -280,7 +327,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
await this.clearTask()
|
||||
const {
|
||||
apiConfiguration,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
diffEnabled,
|
||||
fuzzyMatchThreshold,
|
||||
mode,
|
||||
@@ -288,9 +335,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
experimentalDiffStrategy,
|
||||
} = await this.getState()
|
||||
|
||||
const modePrompt = customPrompts?.[mode]
|
||||
const modeInstructions = typeof modePrompt === "object" ? modePrompt.customInstructions : undefined
|
||||
const effectiveInstructions = [globalInstructions, modeInstructions].filter(Boolean).join("\n\n")
|
||||
const modePrompt = customModePrompts?.[mode] as PromptComponent
|
||||
const effectiveInstructions = [globalInstructions, modePrompt?.customInstructions].filter(Boolean).join("\n\n")
|
||||
|
||||
this.cline = new Cline(
|
||||
this,
|
||||
@@ -379,7 +425,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src ${webview.cspSource}; style-src ${webview.cspSource} 'unsafe-inline'; img-src ${webview.cspSource} data:; script-src 'nonce-${nonce}';">
|
||||
<link rel="stylesheet" type="text/css" href="${stylesUri}">
|
||||
<link href="${codiconsUri}" rel="stylesheet" />
|
||||
<title>Cline</title>
|
||||
<title>Roo Code</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
@@ -401,6 +447,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
async (message: WebviewMessage) => {
|
||||
switch (message.type) {
|
||||
case "webviewDidLaunch":
|
||||
// Load custom modes first
|
||||
const customModes = await this.customModesManager.getCustomModes()
|
||||
await this.updateGlobalState("customModes", customModes)
|
||||
|
||||
this.postStateToWebview()
|
||||
this.workspaceTracker?.initializeFilePaths() // don't await
|
||||
getTheme().then((theme) =>
|
||||
@@ -638,6 +688,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
break
|
||||
}
|
||||
case "openCustomModesSettings": {
|
||||
const customModesFilePath = await this.customModesManager.getCustomModesFilePath()
|
||||
if (customModesFilePath) {
|
||||
openFile(customModesFilePath)
|
||||
}
|
||||
break
|
||||
}
|
||||
case "restartMcpServer": {
|
||||
try {
|
||||
await this.mcpHub?.restartConnection(message.text!)
|
||||
@@ -757,47 +814,65 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
|
||||
await this.postStateToWebview()
|
||||
break
|
||||
case "updateEnhancedPrompt":
|
||||
const existingPrompts = (await this.getGlobalState("customPrompts")) || {}
|
||||
case "updateSupportPrompt":
|
||||
try {
|
||||
if (Object.keys(message?.values ?? {}).length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
const updatedPrompts = {
|
||||
...existingPrompts,
|
||||
enhance: message.text,
|
||||
const existingPrompts = (await this.getGlobalState("customSupportPrompts")) || {}
|
||||
|
||||
const updatedPrompts = {
|
||||
...existingPrompts,
|
||||
...message.values,
|
||||
}
|
||||
|
||||
await this.updateGlobalState("customSupportPrompts", updatedPrompts)
|
||||
await this.postStateToWebview()
|
||||
} catch (error) {
|
||||
console.error("Error update support prompt:", error)
|
||||
vscode.window.showErrorMessage("Failed to update support prompt")
|
||||
}
|
||||
break
|
||||
case "resetSupportPrompt":
|
||||
try {
|
||||
if (!message?.text) {
|
||||
return
|
||||
}
|
||||
|
||||
await this.updateGlobalState("customPrompts", updatedPrompts)
|
||||
const existingPrompts = ((await this.getGlobalState("customSupportPrompts")) ||
|
||||
{}) as Record<string, any>
|
||||
|
||||
// Get current state and explicitly include customPrompts
|
||||
const currentState = await this.getState()
|
||||
const updatedPrompts = {
|
||||
...existingPrompts,
|
||||
}
|
||||
|
||||
const stateWithPrompts = {
|
||||
...currentState,
|
||||
customPrompts: updatedPrompts,
|
||||
updatedPrompts[message.text] = undefined
|
||||
|
||||
await this.updateGlobalState("customSupportPrompts", updatedPrompts)
|
||||
await this.postStateToWebview()
|
||||
} catch (error) {
|
||||
console.error("Error reset support prompt:", error)
|
||||
vscode.window.showErrorMessage("Failed to reset support prompt")
|
||||
}
|
||||
|
||||
// Post state with prompts
|
||||
this.view?.webview.postMessage({
|
||||
type: "state",
|
||||
state: stateWithPrompts,
|
||||
})
|
||||
break
|
||||
case "updatePrompt":
|
||||
if (message.promptMode && message.customPrompt !== undefined) {
|
||||
const existingPrompts = (await this.getGlobalState("customPrompts")) || {}
|
||||
const existingPrompts = (await this.getGlobalState("customModePrompts")) || {}
|
||||
|
||||
const updatedPrompts = {
|
||||
...existingPrompts,
|
||||
[message.promptMode]: message.customPrompt,
|
||||
}
|
||||
|
||||
await this.updateGlobalState("customPrompts", updatedPrompts)
|
||||
await this.updateGlobalState("customModePrompts", updatedPrompts)
|
||||
|
||||
// Get current state and explicitly include customPrompts
|
||||
// Get current state and explicitly include customModePrompts
|
||||
const currentState = await this.getState()
|
||||
|
||||
const stateWithPrompts = {
|
||||
...currentState,
|
||||
customPrompts: updatedPrompts,
|
||||
customModePrompts: updatedPrompts,
|
||||
}
|
||||
|
||||
// Post state with prompts
|
||||
@@ -907,8 +982,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
case "enhancePrompt":
|
||||
if (message.text) {
|
||||
try {
|
||||
const { apiConfiguration, customPrompts, listApiConfigMeta, enhancementApiConfigId } =
|
||||
await this.getState()
|
||||
const {
|
||||
apiConfiguration,
|
||||
customSupportPrompts,
|
||||
listApiConfigMeta,
|
||||
enhancementApiConfigId,
|
||||
} = await this.getState()
|
||||
|
||||
// Try to get enhancement config first, fall back to current config
|
||||
let configToUse: ApiConfiguration = apiConfiguration
|
||||
@@ -922,17 +1001,17 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
const getEnhancePrompt = (value: string | PromptComponent | undefined): string => {
|
||||
if (typeof value === "string") {
|
||||
return value
|
||||
}
|
||||
return enhance.prompt // Use the constant from modes.ts which we know is a string
|
||||
}
|
||||
const enhancedPrompt = await enhancePrompt(
|
||||
const enhancedPrompt = await singleCompletionHandler(
|
||||
configToUse,
|
||||
message.text,
|
||||
getEnhancePrompt(customPrompts?.enhance),
|
||||
supportPrompt.create(
|
||||
"ENHANCE",
|
||||
{
|
||||
userInput: message.text,
|
||||
},
|
||||
customSupportPrompts,
|
||||
),
|
||||
)
|
||||
|
||||
await this.postMessageToWebview({
|
||||
type: "enhancedPrompt",
|
||||
text: enhancedPrompt,
|
||||
@@ -950,36 +1029,46 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
try {
|
||||
const {
|
||||
apiConfiguration,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
customInstructions,
|
||||
preferredLanguage,
|
||||
browserViewportSize,
|
||||
diffEnabled,
|
||||
mcpEnabled,
|
||||
fuzzyMatchThreshold,
|
||||
experimentalDiffStrategy,
|
||||
} = await this.getState()
|
||||
|
||||
// Create diffStrategy based on current model and settings
|
||||
const diffStrategy = getDiffStrategy(
|
||||
apiConfiguration.apiModelId || apiConfiguration.openRouterModelId || "",
|
||||
fuzzyMatchThreshold,
|
||||
experimentalDiffStrategy,
|
||||
)
|
||||
const cwd =
|
||||
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) || ""
|
||||
|
||||
const mode = message.mode ?? defaultModeSlug
|
||||
const instructions = await addCustomInstructions(
|
||||
{ customInstructions, customPrompts, preferredLanguage },
|
||||
cwd,
|
||||
mode,
|
||||
)
|
||||
const customModes = await this.customModesManager.getCustomModes()
|
||||
|
||||
const systemPrompt = await SYSTEM_PROMPT(
|
||||
this.context,
|
||||
cwd,
|
||||
apiConfiguration.openRouterModelInfo?.supportsComputerUse ?? false,
|
||||
mcpEnabled ? this.mcpHub : undefined,
|
||||
undefined,
|
||||
diffStrategy,
|
||||
browserViewportSize ?? "900x600",
|
||||
mode,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
customModes,
|
||||
customInstructions,
|
||||
preferredLanguage,
|
||||
diffEnabled,
|
||||
)
|
||||
const fullPrompt = instructions ? `${systemPrompt}${instructions}` : systemPrompt
|
||||
|
||||
await this.postMessageToWebview({
|
||||
type: "systemPrompt",
|
||||
text: fullPrompt,
|
||||
text: systemPrompt,
|
||||
mode: message.mode,
|
||||
})
|
||||
} catch (error) {
|
||||
@@ -1117,6 +1206,34 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
await this.cline.updateDiffStrategy(message.bool ?? false)
|
||||
}
|
||||
await this.postStateToWebview()
|
||||
break
|
||||
case "updateCustomMode":
|
||||
if (message.modeConfig) {
|
||||
await this.customModesManager.updateCustomMode(message.modeConfig.slug, message.modeConfig)
|
||||
// Update state after saving the mode
|
||||
const customModes = await this.customModesManager.getCustomModes()
|
||||
await this.updateGlobalState("customModes", customModes)
|
||||
await this.updateGlobalState("mode", message.modeConfig.slug)
|
||||
await this.postStateToWebview()
|
||||
}
|
||||
break
|
||||
case "deleteCustomMode":
|
||||
if (message.slug) {
|
||||
const answer = await vscode.window.showInformationMessage(
|
||||
"Are you sure you want to delete this custom mode?",
|
||||
{ modal: true },
|
||||
"Yes",
|
||||
)
|
||||
|
||||
if (answer !== "Yes") {
|
||||
break
|
||||
}
|
||||
|
||||
await this.customModesManager.deleteCustomMode(message.slug)
|
||||
// Switch back to default mode after deletion
|
||||
await this.updateGlobalState("mode", defaultModeSlug)
|
||||
await this.postStateToWebview()
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
@@ -1156,6 +1273,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
openAiBaseUrl,
|
||||
openAiApiKey,
|
||||
openAiModelId,
|
||||
openAiCustomModelInfo,
|
||||
openAiUseAzure,
|
||||
ollamaModelId,
|
||||
ollamaBaseUrl,
|
||||
lmStudioModelId,
|
||||
@@ -1191,6 +1310,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
await this.updateGlobalState("openAiBaseUrl", openAiBaseUrl)
|
||||
await this.storeSecret("openAiApiKey", openAiApiKey)
|
||||
await this.updateGlobalState("openAiModelId", openAiModelId)
|
||||
await this.updateGlobalState("openAiCustomModelInfo", openAiCustomModelInfo)
|
||||
await this.updateGlobalState("openAiUseAzure", openAiUseAzure)
|
||||
await this.updateGlobalState("ollamaModelId", ollamaModelId)
|
||||
await this.updateGlobalState("ollamaBaseUrl", ollamaBaseUrl)
|
||||
await this.updateGlobalState("lmStudioModelId", lmStudioModelId)
|
||||
@@ -1690,7 +1811,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
currentApiConfigName,
|
||||
listApiConfigMeta,
|
||||
mode,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
customSupportPrompts,
|
||||
enhancementApiConfigId,
|
||||
experimentalDiffStrategy,
|
||||
autoApprovalEnabled,
|
||||
@@ -1729,10 +1851,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
currentApiConfigName: currentApiConfigName ?? "default",
|
||||
listApiConfigMeta: listApiConfigMeta ?? [],
|
||||
mode: mode ?? defaultModeSlug,
|
||||
customPrompts: customPrompts ?? {},
|
||||
customModePrompts: customModePrompts ?? {},
|
||||
customSupportPrompts: customSupportPrompts ?? {},
|
||||
enhancementApiConfigId,
|
||||
experimentalDiffStrategy: experimentalDiffStrategy ?? false,
|
||||
autoApprovalEnabled: autoApprovalEnabled ?? false,
|
||||
customModes: await this.customModesManager.getCustomModes(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1808,6 +1932,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
openAiBaseUrl,
|
||||
openAiApiKey,
|
||||
openAiModelId,
|
||||
openAiCustomModelInfo,
|
||||
openAiUseAzure,
|
||||
ollamaModelId,
|
||||
ollamaBaseUrl,
|
||||
lmStudioModelId,
|
||||
@@ -1848,10 +1974,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
vsCodeLmModelSelector,
|
||||
mode,
|
||||
modeApiConfigs,
|
||||
customPrompts,
|
||||
customModePrompts,
|
||||
customSupportPrompts,
|
||||
enhancementApiConfigId,
|
||||
experimentalDiffStrategy,
|
||||
autoApprovalEnabled,
|
||||
customModes,
|
||||
] = await Promise.all([
|
||||
this.getGlobalState("apiProvider") as Promise<ApiProvider | undefined>,
|
||||
this.getGlobalState("apiModelId") as Promise<string | undefined>,
|
||||
@@ -1872,6 +2000,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.getGlobalState("openAiBaseUrl") as Promise<string | undefined>,
|
||||
this.getSecret("openAiApiKey") as Promise<string | undefined>,
|
||||
this.getGlobalState("openAiModelId") as Promise<string | undefined>,
|
||||
this.getGlobalState("openAiCustomModelInfo") as Promise<ModelInfo | undefined>,
|
||||
this.getGlobalState("openAiUseAzure") as Promise<boolean | undefined>,
|
||||
this.getGlobalState("ollamaModelId") as Promise<string | undefined>,
|
||||
this.getGlobalState("ollamaBaseUrl") as Promise<string | undefined>,
|
||||
this.getGlobalState("lmStudioModelId") as Promise<string | undefined>,
|
||||
@@ -1912,10 +2042,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.getGlobalState("vsCodeLmModelSelector") as Promise<vscode.LanguageModelChatSelector | undefined>,
|
||||
this.getGlobalState("mode") as Promise<Mode | undefined>,
|
||||
this.getGlobalState("modeApiConfigs") as Promise<Record<Mode, string> | undefined>,
|
||||
this.getGlobalState("customPrompts") as Promise<CustomPrompts | undefined>,
|
||||
this.getGlobalState("customModePrompts") as Promise<CustomModePrompts | undefined>,
|
||||
this.getGlobalState("customSupportPrompts") as Promise<CustomSupportPrompts | undefined>,
|
||||
this.getGlobalState("enhancementApiConfigId") as Promise<string | undefined>,
|
||||
this.getGlobalState("experimentalDiffStrategy") as Promise<boolean | undefined>,
|
||||
this.getGlobalState("autoApprovalEnabled") as Promise<boolean | undefined>,
|
||||
this.customModesManager.getCustomModes(),
|
||||
])
|
||||
|
||||
let apiProvider: ApiProvider
|
||||
@@ -1953,6 +2085,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
openAiBaseUrl,
|
||||
openAiApiKey,
|
||||
openAiModelId,
|
||||
openAiCustomModelInfo,
|
||||
openAiUseAzure,
|
||||
ollamaModelId,
|
||||
ollamaBaseUrl,
|
||||
lmStudioModelId,
|
||||
@@ -2022,10 +2156,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
currentApiConfigName: currentApiConfigName ?? "default",
|
||||
listApiConfigMeta: listApiConfigMeta ?? [],
|
||||
modeApiConfigs: modeApiConfigs ?? ({} as Record<Mode, string>),
|
||||
customPrompts: customPrompts ?? {},
|
||||
customModePrompts: customModePrompts ?? {},
|
||||
customSupportPrompts: customSupportPrompts ?? {},
|
||||
enhancementApiConfigId,
|
||||
experimentalDiffStrategy: experimentalDiffStrategy ?? false,
|
||||
autoApprovalEnabled: autoApprovalEnabled ?? false,
|
||||
customModes,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2119,6 +2255,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
await this.storeSecret(key, undefined)
|
||||
}
|
||||
await this.configManager.resetAllConfigs()
|
||||
await this.customModesManager.resetCustomModes()
|
||||
if (this.cline) {
|
||||
this.cline.abortTask()
|
||||
this.cline = undefined
|
||||
|
||||
Reference in New Issue
Block a user