From 88e3fbbc98dc2171ef530beea844c767475ecc23 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Thu, 10 Apr 2025 10:33:02 +0200 Subject: [PATCH 01/16] Sort models alphabetically in Chat view Signed-off-by: Fred Bricon --- gui/src/components/modelSelection/ModelSelect.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 8191af54b..e7dc1fbf5 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -131,8 +131,9 @@ function ModelSelect() { // Sort so that options without an API key are at the end useEffect(() => { - const enabledOptions = options.filter((option) => option.apiKey !== ""); - const disabledOptions = options.filter((option) => option.apiKey === ""); + const alphaSort = options.sort((a, b) => a.title.localeCompare(b.title)); + const enabledOptions = alphaSort.filter((option) => option.apiKey !== ""); + const disabledOptions = alphaSort.filter((option) => option.apiKey === ""); const sorted = [...enabledOptions, ...disabledOptions]; From 41269e0e151e4f68ed956dda1893660ac9c54e79 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Thu, 10 Apr 2025 10:59:37 +0200 Subject: [PATCH 02/16] Sort models alphabetically in Models section Signed-off-by: Fred Bricon --- gui/src/pages/config/ModelRoleSelector.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index e3464a6f2..a4606ad89 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -108,7 +108,7 @@ const ModelRoleSelector = ({ style={{ borderRadius: defaultBorderRadius }} className="min-w-40" > - {models.map((option, idx) => { + {[...models].sort((a,b)=>a.title.localeCompare(b.title)).map((option, idx) => { const showMissingApiKeyMsg = option.configurationStatus === LLMConfigurationStatuses.MISSING_API_KEY; From ef514575eb8c04ae8d5148c7afdf3a0dea0bac9d Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 11:45:02 -0400 Subject: [PATCH 03/16] Provide model name for tokens counting Although Continue now uses the Llama tokenizer for most models, it's still important to provide the model name to the countTokens function. This ensures flexibility in case we introduce more specialized tokenizers for different models in the future. --- core/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index 68aa605ac..c331e7273 100644 --- a/core/core.ts +++ b/core/core.ts @@ -709,7 +709,7 @@ export class Core { throw new Error("No chat model selected"); } - const tokens = countTokens(item.content); + const tokens = countTokens(item.content, llm.model); if (tokens > llm.contextLength - llm.completionOptions!.maxTokens!) { return true; From a53ce41d914a3b4e0a796711ddfbb05096ca5740 Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 11:58:13 -0400 Subject: [PATCH 04/16] Fix typo in error dialog Fixed typo from "connot" to "cannot" --- gui/src/components/mainInput/AtMentionDropdown/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/AtMentionDropdown/index.tsx b/gui/src/components/mainInput/AtMentionDropdown/index.tsx index 9d5a10bec..41df0112e 100644 --- a/gui/src/components/mainInput/AtMentionDropdown/index.tsx +++ b/gui/src/components/mainInput/AtMentionDropdown/index.tsx @@ -251,7 +251,7 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => { modal: true, detail: fileSize > 0 - ? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and connot be processed by the model` + ? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and cannot be processed by the model` : `'${item.title}' could not be loaded. Please check if the file exists and has the correct permissions.`, }, ); From 73c0c206820ffc6465f75c84f2b3326a5675426b Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 12:03:49 -0400 Subject: [PATCH 05/16] Delete redundant calling of loadConfig Config has already been gathered at the top of this function, so we can directly use this config instead of calling loadConfig again. --- core/core.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/core.ts b/core/core.ts index c331e7273..bb11ac5ed 100644 --- a/core/core.ts +++ b/core/core.ts @@ -702,8 +702,7 @@ export class Core { return false; } - const llm = (await this.configHandler.loadConfig()).config - ?.selectedModelByRole.chat; + const llm = config?.selectedModelByRole.chat; if (!llm) { throw new Error("No chat model selected"); From 4e15497fe7344eb822f08694a1f23cc1ace1ffa7 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 15 Apr 2025 20:27:43 +0530 Subject: [PATCH 06/16] collapse customize page sidebar items by default --- docs/sidebars.js | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sidebars.js b/docs/sidebars.js index 20a47be93..2fecc448c 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -68,7 +68,6 @@ const sidebars = { { type: "category", label: "Model providers", - collapsed: false, link: { slug: "/customize/model-providers", type: "generated-index", From fb7a145c1caedeedac00673103e2f035618c8338 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 16:07:57 -0700 Subject: [PATCH 07/16] notch tooltips --- extensions/vscode/package-lock.json | 4 +- .../Lump/BlockSettingsTopToolbar.tsx | 136 +++++++++++------- .../mainInput/Lump/sections/MCPSection.tsx | 5 - .../mainInput/Lump/sections/RulesSection.tsx | 4 + .../Lump/sections/SelectedSection.tsx | 4 +- .../sections/{ => errors}/ErrorSection.tsx | 2 +- .../sections/errors/ErrorsSectionTooltip.tsx | 14 ++ .../Lump/sections/mcp/MCPSection.tsx | 5 + .../Lump/sections/mcp/MCPTooltip.tsx | 18 +++ .../ToolPoliciesSectionTooltip.tsx | 16 +++ gui/src/redux/selectors/selectActiveTools.ts | 22 +++ gui/src/redux/slices/sessionSlice.ts | 4 - gui/src/redux/slices/uiSlice.ts | 13 +- gui/src/redux/thunks/streamNormalInput.ts | 31 ++-- 14 files changed, 193 insertions(+), 85 deletions(-) delete mode 100644 gui/src/components/mainInput/Lump/sections/MCPSection.tsx rename gui/src/components/mainInput/Lump/sections/{ => errors}/ErrorSection.tsx (95%) create mode 100644 gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx create mode 100644 gui/src/redux/selectors/selectActiveTools.ts diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 7cf0b9dd7..805cd2d4a 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.24", + "version": "1.1.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.24", + "version": "1.1.25", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index 2ec82b660..00d00a8c7 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -9,15 +9,21 @@ import { Squares2X2Icon, WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; +import { ReactNode } from "react"; import { vscBadgeForeground } from "../.."; import { useAppSelector } from "../../../redux/hooks"; import { fontSize } from "../../../util"; +import { ToolTip } from "../../gui/Tooltip"; import AssistantSelect from "../../modelSelection/platform/AssistantSelect"; import HoverItem from "../InputToolbar/HoverItem"; import { useLump } from "./LumpContext"; +import { ErrorsSectionTooltip } from "./sections/errors/ErrorsSectionTooltip"; +import { McpSectionTooltip } from "./sections/mcp/MCPTooltip"; +import { ToolsSectionTooltip } from "./sections/tool-policies/ToolPoliciesSectionTooltip"; interface BlockSettingsToolbarIcon { - tooltip: string; + title: string; + tooltip: ReactNode; icon: React.ComponentType; itemCount?: number; onClick: () => void; @@ -27,18 +33,39 @@ interface BlockSettingsToolbarIcon { interface Section { id: string; - tooltip: string; + title: string; + tooltip: ReactNode; icon: React.ComponentType; } const sections: Section[] = [ - { id: "models", tooltip: "Models", icon: CubeIcon }, - { id: "rules", tooltip: "Rules", icon: PencilIcon }, - { id: "docs", tooltip: "Docs", icon: BookOpenIcon }, - { id: "prompts", tooltip: "Prompts", icon: ChatBubbleLeftIcon }, - { id: "tools", tooltip: "Tools", icon: WrenchScrewdriverIcon }, - { id: "mcp", tooltip: "MCP", icon: Squares2X2Icon }, - { id: "error", tooltip: "Errors", icon: ExclamationTriangleIcon }, + { id: "models", title: "Models", tooltip: "Models", icon: CubeIcon }, + { id: "rules", title: "Rules", tooltip: "Rules", icon: PencilIcon }, + { id: "docs", title: "Docs", tooltip: "Docs", icon: BookOpenIcon }, + { + id: "prompts", + title: "Prompts", + tooltip: "Prompts", + icon: ChatBubbleLeftIcon, + }, + { + id: "tools", + title: "Tools", + tooltip: , + icon: WrenchScrewdriverIcon, + }, + { + id: "mcp", + title: "MCP", + tooltip: , + icon: Squares2X2Icon, + }, + { + id: "error", + title: "Errors", + tooltip: , + icon: ExclamationTriangleIcon, + }, ]; function BlockSettingsToolbarIcon( @@ -46,53 +73,60 @@ function BlockSettingsToolbarIcon( ) { const isErrorSection = props.sectionId === "error"; + const id = `block-settings-toolbar-icon-${props.sectionId}`; return ( - -
{ - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - props.onClick(); - } - }} - className={`${ - props.isSelected - ? isErrorSection - ? "bg-red-600" - : "bg-badge" - : undefined - } relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`} + <> + -
-
+ + + {props.tooltip} + + ); } @@ -129,6 +163,7 @@ export function BlockSettingsTopToolbar() { tooltip={ isToolbarExpanded ? "Collapse sections" : "Expand sections" } + title="" isSelected={false} onClick={handleEllipsisClick} /> @@ -142,6 +177,7 @@ export function BlockSettingsTopToolbar() { sectionId={section.id} icon={section.icon} tooltip={section.tooltip} + title={section.title} isSelected={selectedSection === section.id} onClick={() => setSelectedSection( diff --git a/gui/src/components/mainInput/Lump/sections/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/MCPSection.tsx deleted file mode 100644 index b365dca34..000000000 --- a/gui/src/components/mainInput/Lump/sections/MCPSection.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import MCPServersPreview from "../../../../pages/config/MCPServersPreview"; - -export function MCPSection() { - return ; -} diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 0fae7611e..d6129eef8 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -209,3 +209,7 @@ export function RulesSection() { ); } + +export function RulesSectionToolTip() { + return "rules"; +} diff --git a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx index 85f72078f..f7fca7a35 100644 --- a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx @@ -1,8 +1,8 @@ import { useLump } from "../LumpContext"; import { ContextSection } from "./ContextSection"; import DocsSection from "./docs/DocsSection"; -import { ErrorSection } from "./ErrorSection"; -import { MCPSection } from "./MCPSection"; +import { ErrorSection } from "./errors/ErrorSection"; +import { MCPSection } from "./mcp/MCPSection"; import { ModelsSection } from "./ModelsSection"; import { PromptsSection } from "./PromptsSection"; import { RulesSection } from "./RulesSection"; diff --git a/gui/src/components/mainInput/Lump/sections/ErrorSection.tsx b/gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx similarity index 95% rename from gui/src/components/mainInput/Lump/sections/ErrorSection.tsx rename to gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx index d4d01141c..dbd72de65 100644 --- a/gui/src/components/mainInput/Lump/sections/ErrorSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx @@ -2,7 +2,7 @@ import { ExclamationCircleIcon, ExclamationTriangleIcon, } from "@heroicons/react/24/outline"; -import { useAppSelector } from "../../../../redux/hooks"; +import { useAppSelector } from "../../../../../redux/hooks"; export function ErrorSection() { const configError = useAppSelector((state) => state.config.configError); diff --git a/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx b/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx new file mode 100644 index 000000000..fd2199ede --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx @@ -0,0 +1,14 @@ +import { useAppSelector } from "../../../../../redux/hooks"; + +export const ErrorsSectionTooltip = () => { + const configError = useAppSelector((store) => store.config.configError); + + const numErrors = configError?.length ?? 0; + const plural = numErrors > 1 ? "s" : ""; + + return ( +
+ {`${numErrors} Config Error${plural}`} +
+ ); +}; diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx new file mode 100644 index 000000000..9c2f888eb --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -0,0 +1,5 @@ +import MCPServersPreview from "../../../../../pages/config/MCPServersPreview"; + +export function MCPSection() { + return ; +} diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx new file mode 100644 index 000000000..b06528fdb --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx @@ -0,0 +1,18 @@ +import { useAppSelector } from "../../../../../redux/hooks"; + +export const McpSectionTooltip = () => { + const mcpServers = useAppSelector( + (store) => store.config.config.mcpServerStatuses, + ); + + const numServers = mcpServers.length; + const numActiveServers = mcpServers.filter( + (server) => server.status === "connected", + ).length; + + return ( +
+ {`MCP Servers (${numActiveServers}/${numServers} active)`} +
+ ); +}; diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx new file mode 100644 index 000000000..7e3334b1a --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx @@ -0,0 +1,16 @@ +import { useAppSelector } from "../../../../../redux/hooks"; +import { selectActiveTools } from "../../../../../redux/selectors/selectActiveTools"; + +export const ToolsSectionTooltip = () => { + const tools = useAppSelector((store) => store.config.config.tools); + const activeTools = useAppSelector(selectActiveTools); + + const numTools = tools.length; + const numActiveTools = activeTools.length; + + return ( +
+ {`Tools (${numActiveTools}/${numTools} active)`} +
+ ); +}; diff --git a/gui/src/redux/selectors/selectActiveTools.ts b/gui/src/redux/selectors/selectActiveTools.ts new file mode 100644 index 000000000..bae3426e0 --- /dev/null +++ b/gui/src/redux/selectors/selectActiveTools.ts @@ -0,0 +1,22 @@ +import { createSelector } from "@reduxjs/toolkit"; +import { Tool } from "core"; +import { RootState } from "../store"; + +export const selectActiveTools = createSelector( + [ + (store: RootState) => store.session.mode, + (store: RootState) => store.config.config.tools, + (store: RootState) => store.ui.toolSettings, + (store: RootState) => store.ui.toolGroupSettings, + ], + (mode, tools, policies, groupPolicies): Tool[] => { + if (mode !== "agent") { + return []; + } + return tools.filter( + (tool) => + policies[tool.function.name] !== "disabled" && + groupPolicies[tool.group] !== "exclude", + ); + }, +); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 002b809db..6adbabcf7 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -768,9 +768,6 @@ export const sessionSlice = createSlice({ selectHasCodeToEdit: (state) => { return state.codeToEdit.length > 0; }, - selectUseTools: (state) => { - return state.mode === "agent"; - }, }, extraReducers: (builder) => { addPassthroughCases(builder, [streamResponseThunk]); @@ -852,7 +849,6 @@ export const { selectCurrentMode, selectIsSingleRangeEditOrInsertion, selectHasCodeToEdit, - selectUseTools, } = sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index 7cc964cd6..2fb5f4759 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -7,12 +7,15 @@ import { } from "../../components/OnboardingCard"; import { getLocalStorage, LocalStorageKey } from "../../util/localStorage"; -type ToolSetting = +export type ToolPolicy = | "allowedWithPermission" | "allowedWithoutPermission" | "disabled"; -type ToolGroupSetting = "include" | "exclude"; +export type ToolGroupPolicy = "include" | "exclude"; + +export type ToolPolicies = { [toolName: string]: ToolPolicy }; +export type ToolGroupPolicies = { [toolGroupName: string]: ToolGroupPolicy }; type UIState = { showDialog: boolean; @@ -22,12 +25,12 @@ type UIState = { isExploreDialogOpen: boolean; hasDismissedExploreDialog: boolean; shouldAddFileForEditing: boolean; - toolSettings: { [toolName: string]: ToolSetting }; - toolGroupSettings: { [toolGroupName: string]: ToolGroupSetting }; + toolSettings: ToolPolicies; + toolGroupSettings: ToolGroupPolicies; ttsActive: boolean; }; -export const DEFAULT_TOOL_SETTING: ToolSetting = "allowedWithPermission"; +export const DEFAULT_TOOL_SETTING: ToolPolicy = "allowedWithPermission"; export const uiSlice = createSlice({ name: "ui", diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 819ec79ee..43e431271 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,13 +1,13 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; -import { ChatMessage } from "core"; +import { ChatMessage, LLMFullCompletionOptions } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { ToCoreProtocol } from "core/protocol"; +import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; import { abortStream, addPromptCompletionPair, - selectUseTools, setToolGenerated, streamUpdate, } from "../slices/sessionSlice"; @@ -31,27 +31,24 @@ export const streamNormalInput = createAsyncThunk< const state = getState(); const selectedChatModel = selectSelectedChatModel(state); - const toolSettings = state.ui.toolSettings; - const toolGroupSettings = state.ui.toolGroupSettings; const streamAborter = state.session.streamAborter; - const useTools = selectUseTools(state); if (!selectedChatModel) { throw new Error("Default model not defined"); } - const includeTools = useTools && modelSupportsTools(selectedChatModel); + + let completionOptions: LLMFullCompletionOptions = {}; + const activeTools = selectActiveTools(state); + const toolsSupported = modelSupportsTools(selectedChatModel); + if (toolsSupported && activeTools.length > 0) { + completionOptions = { + tools: activeTools, + }; + } // Send request const gen = extra.ideMessenger.llmStreamChat( { - completionOptions: includeTools - ? { - tools: state.config.config.tools.filter( - (tool) => - toolSettings[tool.function.name] !== "disabled" && - toolGroupSettings[tool.group] !== "exclude", - ), - } - : {}, + completionOptions, title: selectedChatModel.title, messages, legacySlashCommandData, @@ -105,7 +102,9 @@ export const streamNormalInput = createAsyncThunk< } // If it's a tool call that is automatically accepted, we should call it - const toolCallState = selectCurrentToolCall(getState()); + const newState = getState(); + const toolSettings = newState.ui.toolSettings; + const toolCallState = selectCurrentToolCall(newState); if (toolCallState) { dispatch( setToolGenerated({ From 8f2337c08d27133ed67ade17b54fa679ac5afaaf Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 16:07:57 -0700 Subject: [PATCH 08/16] notch tooltips Co-authored-by: uinstinct <61635505+uinstinct@users.noreply.github.com> --- extensions/vscode/package-lock.json | 4 +- .../Lump/BlockSettingsTopToolbar.tsx | 136 +++++++++++------- .../mainInput/Lump/sections/MCPSection.tsx | 5 - .../mainInput/Lump/sections/RulesSection.tsx | 4 + .../Lump/sections/SelectedSection.tsx | 4 +- .../sections/{ => errors}/ErrorSection.tsx | 2 +- .../sections/errors/ErrorsSectionTooltip.tsx | 14 ++ .../Lump/sections/mcp/MCPSection.tsx | 5 + .../Lump/sections/mcp/MCPTooltip.tsx | 18 +++ .../ToolPoliciesSectionTooltip.tsx | 16 +++ gui/src/redux/selectors/selectActiveTools.ts | 22 +++ gui/src/redux/slices/sessionSlice.ts | 4 - gui/src/redux/slices/uiSlice.ts | 13 +- gui/src/redux/thunks/streamNormalInput.ts | 31 ++-- 14 files changed, 193 insertions(+), 85 deletions(-) delete mode 100644 gui/src/components/mainInput/Lump/sections/MCPSection.tsx rename gui/src/components/mainInput/Lump/sections/{ => errors}/ErrorSection.tsx (95%) create mode 100644 gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx create mode 100644 gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx create mode 100644 gui/src/redux/selectors/selectActiveTools.ts diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 7cf0b9dd7..805cd2d4a 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.24", + "version": "1.1.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.24", + "version": "1.1.25", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index 2ec82b660..00d00a8c7 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -9,15 +9,21 @@ import { Squares2X2Icon, WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; +import { ReactNode } from "react"; import { vscBadgeForeground } from "../.."; import { useAppSelector } from "../../../redux/hooks"; import { fontSize } from "../../../util"; +import { ToolTip } from "../../gui/Tooltip"; import AssistantSelect from "../../modelSelection/platform/AssistantSelect"; import HoverItem from "../InputToolbar/HoverItem"; import { useLump } from "./LumpContext"; +import { ErrorsSectionTooltip } from "./sections/errors/ErrorsSectionTooltip"; +import { McpSectionTooltip } from "./sections/mcp/MCPTooltip"; +import { ToolsSectionTooltip } from "./sections/tool-policies/ToolPoliciesSectionTooltip"; interface BlockSettingsToolbarIcon { - tooltip: string; + title: string; + tooltip: ReactNode; icon: React.ComponentType; itemCount?: number; onClick: () => void; @@ -27,18 +33,39 @@ interface BlockSettingsToolbarIcon { interface Section { id: string; - tooltip: string; + title: string; + tooltip: ReactNode; icon: React.ComponentType; } const sections: Section[] = [ - { id: "models", tooltip: "Models", icon: CubeIcon }, - { id: "rules", tooltip: "Rules", icon: PencilIcon }, - { id: "docs", tooltip: "Docs", icon: BookOpenIcon }, - { id: "prompts", tooltip: "Prompts", icon: ChatBubbleLeftIcon }, - { id: "tools", tooltip: "Tools", icon: WrenchScrewdriverIcon }, - { id: "mcp", tooltip: "MCP", icon: Squares2X2Icon }, - { id: "error", tooltip: "Errors", icon: ExclamationTriangleIcon }, + { id: "models", title: "Models", tooltip: "Models", icon: CubeIcon }, + { id: "rules", title: "Rules", tooltip: "Rules", icon: PencilIcon }, + { id: "docs", title: "Docs", tooltip: "Docs", icon: BookOpenIcon }, + { + id: "prompts", + title: "Prompts", + tooltip: "Prompts", + icon: ChatBubbleLeftIcon, + }, + { + id: "tools", + title: "Tools", + tooltip: , + icon: WrenchScrewdriverIcon, + }, + { + id: "mcp", + title: "MCP", + tooltip: , + icon: Squares2X2Icon, + }, + { + id: "error", + title: "Errors", + tooltip: , + icon: ExclamationTriangleIcon, + }, ]; function BlockSettingsToolbarIcon( @@ -46,53 +73,60 @@ function BlockSettingsToolbarIcon( ) { const isErrorSection = props.sectionId === "error"; + const id = `block-settings-toolbar-icon-${props.sectionId}`; return ( - -
{ - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - props.onClick(); - } - }} - className={`${ - props.isSelected - ? isErrorSection - ? "bg-red-600" - : "bg-badge" - : undefined - } relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`} + <> + -
-
+ + + {props.tooltip} + + ); } @@ -129,6 +163,7 @@ export function BlockSettingsTopToolbar() { tooltip={ isToolbarExpanded ? "Collapse sections" : "Expand sections" } + title="" isSelected={false} onClick={handleEllipsisClick} /> @@ -142,6 +177,7 @@ export function BlockSettingsTopToolbar() { sectionId={section.id} icon={section.icon} tooltip={section.tooltip} + title={section.title} isSelected={selectedSection === section.id} onClick={() => setSelectedSection( diff --git a/gui/src/components/mainInput/Lump/sections/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/MCPSection.tsx deleted file mode 100644 index b365dca34..000000000 --- a/gui/src/components/mainInput/Lump/sections/MCPSection.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import MCPServersPreview from "../../../../pages/config/MCPServersPreview"; - -export function MCPSection() { - return ; -} diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 0fae7611e..d6129eef8 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -209,3 +209,7 @@ export function RulesSection() { ); } + +export function RulesSectionToolTip() { + return "rules"; +} diff --git a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx index 85f72078f..f7fca7a35 100644 --- a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx @@ -1,8 +1,8 @@ import { useLump } from "../LumpContext"; import { ContextSection } from "./ContextSection"; import DocsSection from "./docs/DocsSection"; -import { ErrorSection } from "./ErrorSection"; -import { MCPSection } from "./MCPSection"; +import { ErrorSection } from "./errors/ErrorSection"; +import { MCPSection } from "./mcp/MCPSection"; import { ModelsSection } from "./ModelsSection"; import { PromptsSection } from "./PromptsSection"; import { RulesSection } from "./RulesSection"; diff --git a/gui/src/components/mainInput/Lump/sections/ErrorSection.tsx b/gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx similarity index 95% rename from gui/src/components/mainInput/Lump/sections/ErrorSection.tsx rename to gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx index d4d01141c..dbd72de65 100644 --- a/gui/src/components/mainInput/Lump/sections/ErrorSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/errors/ErrorSection.tsx @@ -2,7 +2,7 @@ import { ExclamationCircleIcon, ExclamationTriangleIcon, } from "@heroicons/react/24/outline"; -import { useAppSelector } from "../../../../redux/hooks"; +import { useAppSelector } from "../../../../../redux/hooks"; export function ErrorSection() { const configError = useAppSelector((state) => state.config.configError); diff --git a/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx b/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx new file mode 100644 index 000000000..fd2199ede --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/errors/ErrorsSectionTooltip.tsx @@ -0,0 +1,14 @@ +import { useAppSelector } from "../../../../../redux/hooks"; + +export const ErrorsSectionTooltip = () => { + const configError = useAppSelector((store) => store.config.configError); + + const numErrors = configError?.length ?? 0; + const plural = numErrors > 1 ? "s" : ""; + + return ( +
+ {`${numErrors} Config Error${plural}`} +
+ ); +}; diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx new file mode 100644 index 000000000..9c2f888eb --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -0,0 +1,5 @@ +import MCPServersPreview from "../../../../../pages/config/MCPServersPreview"; + +export function MCPSection() { + return ; +} diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx new file mode 100644 index 000000000..b06528fdb --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPTooltip.tsx @@ -0,0 +1,18 @@ +import { useAppSelector } from "../../../../../redux/hooks"; + +export const McpSectionTooltip = () => { + const mcpServers = useAppSelector( + (store) => store.config.config.mcpServerStatuses, + ); + + const numServers = mcpServers.length; + const numActiveServers = mcpServers.filter( + (server) => server.status === "connected", + ).length; + + return ( +
+ {`MCP Servers (${numActiveServers}/${numServers} active)`} +
+ ); +}; diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx new file mode 100644 index 000000000..7e3334b1a --- /dev/null +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSectionTooltip.tsx @@ -0,0 +1,16 @@ +import { useAppSelector } from "../../../../../redux/hooks"; +import { selectActiveTools } from "../../../../../redux/selectors/selectActiveTools"; + +export const ToolsSectionTooltip = () => { + const tools = useAppSelector((store) => store.config.config.tools); + const activeTools = useAppSelector(selectActiveTools); + + const numTools = tools.length; + const numActiveTools = activeTools.length; + + return ( +
+ {`Tools (${numActiveTools}/${numTools} active)`} +
+ ); +}; diff --git a/gui/src/redux/selectors/selectActiveTools.ts b/gui/src/redux/selectors/selectActiveTools.ts new file mode 100644 index 000000000..bae3426e0 --- /dev/null +++ b/gui/src/redux/selectors/selectActiveTools.ts @@ -0,0 +1,22 @@ +import { createSelector } from "@reduxjs/toolkit"; +import { Tool } from "core"; +import { RootState } from "../store"; + +export const selectActiveTools = createSelector( + [ + (store: RootState) => store.session.mode, + (store: RootState) => store.config.config.tools, + (store: RootState) => store.ui.toolSettings, + (store: RootState) => store.ui.toolGroupSettings, + ], + (mode, tools, policies, groupPolicies): Tool[] => { + if (mode !== "agent") { + return []; + } + return tools.filter( + (tool) => + policies[tool.function.name] !== "disabled" && + groupPolicies[tool.group] !== "exclude", + ); + }, +); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 002b809db..6adbabcf7 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -768,9 +768,6 @@ export const sessionSlice = createSlice({ selectHasCodeToEdit: (state) => { return state.codeToEdit.length > 0; }, - selectUseTools: (state) => { - return state.mode === "agent"; - }, }, extraReducers: (builder) => { addPassthroughCases(builder, [streamResponseThunk]); @@ -852,7 +849,6 @@ export const { selectCurrentMode, selectIsSingleRangeEditOrInsertion, selectHasCodeToEdit, - selectUseTools, } = sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index 7cc964cd6..2fb5f4759 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -7,12 +7,15 @@ import { } from "../../components/OnboardingCard"; import { getLocalStorage, LocalStorageKey } from "../../util/localStorage"; -type ToolSetting = +export type ToolPolicy = | "allowedWithPermission" | "allowedWithoutPermission" | "disabled"; -type ToolGroupSetting = "include" | "exclude"; +export type ToolGroupPolicy = "include" | "exclude"; + +export type ToolPolicies = { [toolName: string]: ToolPolicy }; +export type ToolGroupPolicies = { [toolGroupName: string]: ToolGroupPolicy }; type UIState = { showDialog: boolean; @@ -22,12 +25,12 @@ type UIState = { isExploreDialogOpen: boolean; hasDismissedExploreDialog: boolean; shouldAddFileForEditing: boolean; - toolSettings: { [toolName: string]: ToolSetting }; - toolGroupSettings: { [toolGroupName: string]: ToolGroupSetting }; + toolSettings: ToolPolicies; + toolGroupSettings: ToolGroupPolicies; ttsActive: boolean; }; -export const DEFAULT_TOOL_SETTING: ToolSetting = "allowedWithPermission"; +export const DEFAULT_TOOL_SETTING: ToolPolicy = "allowedWithPermission"; export const uiSlice = createSlice({ name: "ui", diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 819ec79ee..43e431271 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,13 +1,13 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; -import { ChatMessage } from "core"; +import { ChatMessage, LLMFullCompletionOptions } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { ToCoreProtocol } from "core/protocol"; +import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; import { abortStream, addPromptCompletionPair, - selectUseTools, setToolGenerated, streamUpdate, } from "../slices/sessionSlice"; @@ -31,27 +31,24 @@ export const streamNormalInput = createAsyncThunk< const state = getState(); const selectedChatModel = selectSelectedChatModel(state); - const toolSettings = state.ui.toolSettings; - const toolGroupSettings = state.ui.toolGroupSettings; const streamAborter = state.session.streamAborter; - const useTools = selectUseTools(state); if (!selectedChatModel) { throw new Error("Default model not defined"); } - const includeTools = useTools && modelSupportsTools(selectedChatModel); + + let completionOptions: LLMFullCompletionOptions = {}; + const activeTools = selectActiveTools(state); + const toolsSupported = modelSupportsTools(selectedChatModel); + if (toolsSupported && activeTools.length > 0) { + completionOptions = { + tools: activeTools, + }; + } // Send request const gen = extra.ideMessenger.llmStreamChat( { - completionOptions: includeTools - ? { - tools: state.config.config.tools.filter( - (tool) => - toolSettings[tool.function.name] !== "disabled" && - toolGroupSettings[tool.group] !== "exclude", - ), - } - : {}, + completionOptions, title: selectedChatModel.title, messages, legacySlashCommandData, @@ -105,7 +102,9 @@ export const streamNormalInput = createAsyncThunk< } // If it's a tool call that is automatically accepted, we should call it - const toolCallState = selectCurrentToolCall(getState()); + const newState = getState(); + const toolSettings = newState.ui.toolSettings; + const toolCallState = selectCurrentToolCall(newState); if (toolCallState) { dispatch( setToolGenerated({ From effcaeaefeef2633bebef8dce101cf5ee6bac836 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 16:21:44 -0700 Subject: [PATCH 09/16] rearrange/cleanup --- .../mainInput/Lump/sections/RulesSection.tsx | 4 - .../Lump/sections/SelectedSection.tsx | 2 +- .../Lump/sections/mcp/MCPSection.tsx | 190 +++++++++++++++++- gui/src/pages/config/MCPServersPreview.tsx | 189 ----------------- 4 files changed, 188 insertions(+), 197 deletions(-) delete mode 100644 gui/src/pages/config/MCPServersPreview.tsx diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index d6129eef8..0fae7611e 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -209,7 +209,3 @@ export function RulesSection() { ); } - -export function RulesSectionToolTip() { - return "rules"; -} diff --git a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx index f7fca7a35..ad07a86d6 100644 --- a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx @@ -2,7 +2,7 @@ import { useLump } from "../LumpContext"; import { ContextSection } from "./ContextSection"; import DocsSection from "./docs/DocsSection"; import { ErrorSection } from "./errors/ErrorSection"; -import { MCPSection } from "./mcp/MCPSection"; +import MCPSection from "./mcp/MCPSection"; import { ModelsSection } from "./ModelsSection"; import { PromptsSection } from "./PromptsSection"; import { RulesSection } from "./RulesSection"; diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 9c2f888eb..07ec23c56 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -1,5 +1,189 @@ -import MCPServersPreview from "../../../../../pages/config/MCPServersPreview"; +import { ConfigYaml, parseConfigYaml } from "@continuedev/config-yaml"; +import { + ArrowPathIcon, + CircleStackIcon, + CommandLineIcon, + InformationCircleIcon, + WrenchScrewdriverIcon, +} from "@heroicons/react/24/outline"; +import { MCPServerStatus } from "core"; +import { useContext, useMemo } from "react"; +import { useAuth } from "../../../../../context/Auth"; +import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; +import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; +import { updateConfig } from "../../../../../redux/slices/configSlice"; +import { fontSize } from "../../../../../util"; +import { ToolTip } from "../../../../gui/Tooltip"; +import EditBlockButton from "../../EditBlockButton"; +import { ExploreBlocksButton } from "../ExploreBlocksButton"; -export function MCPSection() { - return ; +interface MCPServerStatusProps { + server: MCPServerStatus; + serverFromYaml?: NonNullable[number]; } +function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { + const ideMessenger = useContext(IdeMessengerContext); + const config = useAppSelector((store) => store.config.config); + const dispatch = useAppDispatch(); + const toolsTooltipId = `${server.id}-tools`; + const promptsTooltipId = `${server.id}-prompts`; + const resourcesTooltipId = `${server.id}-resources`; + const errorsTooltipId = `${server.id}-errors`; + + async function onRefresh() { + // optimistic config update + dispatch( + updateConfig({ + ...config, + mcpServerStatuses: config.mcpServerStatuses.map((s) => + s.id === server.id + ? { + ...s, + status: "connecting", + } + : s, + ), + }), + ); + ideMessenger.post("mcp/reloadServer", { + id: server.id, + }); + } + + return ( +
+
+ {/* Name and Status */} + {server.name} + + {/* Error indicator if any */} + {server.errors.length ? ( + <> + + + {server.errors.map((error, idx) => ( + {error} + ))} + + + ) : null} + + {/* Tools, Prompts, Resources with counts */} +
+
+ + {server.tools.length} + + {server.tools.map((tool, idx) => ( + {tool.name} + ))} + {server.tools.length === 0 && ( + No tools + )} + +
+
+ + {server.prompts.length} + + {server.prompts.map((prompt, idx) => ( + {prompt.name} + ))} + {server.prompts.length === 0 && ( + No prompts + )} + +
+
+ + {server.resources.length} + + {server.resources.map((resource, idx) => ( + {resource.name} + ))} + {server.resources.length === 0 && ( + No resources + )} + +
+
+
+ + {/* Refresh button */} +
+ +
+ +
+ +
+
+
+ ); +} + +function MCPSection() { + const servers = useAppSelector( + (store) => store.config.config.mcpServerStatuses, + ); + const { selectedProfile } = useAuth(); + + const mergedBlocks = useMemo(() => { + const parsed = selectedProfile?.rawYaml + ? parseConfigYaml(selectedProfile?.rawYaml ?? "") + : undefined; + return (servers ?? []).map((doc, index) => ({ + block: doc, + blockFromYaml: parsed?.mcpServers?.[index], + })); + }, [servers, selectedProfile]); + + return ( +
+
+ {mergedBlocks.map(({ block, blockFromYaml }, idx) => ( + + ))} +
+ +
+ ); +} + +export default MCPSection; diff --git a/gui/src/pages/config/MCPServersPreview.tsx b/gui/src/pages/config/MCPServersPreview.tsx deleted file mode 100644 index f1ca7b5af..000000000 --- a/gui/src/pages/config/MCPServersPreview.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import { ConfigYaml, parseConfigYaml } from "@continuedev/config-yaml"; -import { - ArrowPathIcon, - CircleStackIcon, - CommandLineIcon, - InformationCircleIcon, - WrenchScrewdriverIcon, -} from "@heroicons/react/24/outline"; -import { MCPServerStatus } from "core"; -import { useContext, useMemo } from "react"; -import { ToolTip } from "../../components/gui/Tooltip"; -import EditBlockButton from "../../components/mainInput/Lump/EditBlockButton"; -import { ExploreBlocksButton } from "../../components/mainInput/Lump/sections/ExploreBlocksButton"; -import { useAuth } from "../../context/Auth"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { updateConfig } from "../../redux/slices/configSlice"; -import { fontSize } from "../../util"; - -interface MCPServerStatusProps { - server: MCPServerStatus; - serverFromYaml?: NonNullable[number]; -} -function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { - const ideMessenger = useContext(IdeMessengerContext); - const config = useAppSelector((store) => store.config.config); - const dispatch = useAppDispatch(); - const toolsTooltipId = `${server.id}-tools`; - const promptsTooltipId = `${server.id}-prompts`; - const resourcesTooltipId = `${server.id}-resources`; - const errorsTooltipId = `${server.id}-errors`; - - async function onRefresh() { - // optimistic config update - dispatch( - updateConfig({ - ...config, - mcpServerStatuses: config.mcpServerStatuses.map((s) => - s.id === server.id - ? { - ...s, - status: "connecting", - } - : s, - ), - }), - ); - ideMessenger.post("mcp/reloadServer", { - id: server.id, - }); - } - - return ( -
-
- {/* Name and Status */} - {server.name} - - {/* Error indicator if any */} - {server.errors.length ? ( - <> - - - {server.errors.map((error, idx) => ( - {error} - ))} - - - ) : null} - - {/* Tools, Prompts, Resources with counts */} -
-
- - {server.tools.length} - - {server.tools.map((tool, idx) => ( - {tool.name} - ))} - {server.tools.length === 0 && ( - No tools - )} - -
-
- - {server.prompts.length} - - {server.prompts.map((prompt, idx) => ( - {prompt.name} - ))} - {server.prompts.length === 0 && ( - No prompts - )} - -
-
- - {server.resources.length} - - {server.resources.map((resource, idx) => ( - {resource.name} - ))} - {server.resources.length === 0 && ( - No resources - )} - -
-
-
- - {/* Refresh button */} -
- -
- -
- -
-
-
- ); -} - -function MCPServersPreview() { - const servers = useAppSelector( - (store) => store.config.config.mcpServerStatuses, - ); - const { selectedProfile } = useAuth(); - - const mergedBlocks = useMemo(() => { - const parsed = selectedProfile?.rawYaml - ? parseConfigYaml(selectedProfile?.rawYaml ?? "") - : undefined; - return (servers ?? []).map((doc, index) => ({ - block: doc, - blockFromYaml: parsed?.mcpServers?.[index], - })); - }, [servers, selectedProfile]); - - return ( -
-
- {mergedBlocks.map(({ block, blockFromYaml }, idx) => ( - - ))} -
- -
- ); -} - -export default MCPServersPreview; From 3101127df60752d83e1c4278e47210f287a25b03 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:40:13 -0700 Subject: [PATCH 10/16] fix args bugs, iterate on lazy description --- core/tools/definitions/editFile.ts | 9 +++++---- .../gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 2 +- gui/src/util/clientTools/editImpl.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index 6ee5cee6b..b6739bbbe 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -3,7 +3,7 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; export interface EditToolArgs { filepath: string; - new_contents: string; + changes: string; } export const editFileTool: Tool = { @@ -20,16 +20,17 @@ export const editFileTool: Tool = { "Use this tool to edit an existing file. If you don't know the contents of the file, read it first.", parameters: { type: "object", - required: ["filepath", "new_contents"], + required: ["filepath", "changes"], properties: { filepath: { type: "string", description: "The path of the file to edit, relative to the root of the workspace.", }, - new_contents: { + changes: { type: "string", - description: "The new file contents", + description: + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", }, }, }, diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index d9906794e..2ce148016 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -25,7 +25,7 @@ function FunctionSpecificToolCallDiv({ return ( ); diff --git a/gui/src/util/clientTools/editImpl.ts b/gui/src/util/clientTools/editImpl.ts index 2a6d3e1d4..3e5271228 100644 --- a/gui/src/util/clientTools/editImpl.ts +++ b/gui/src/util/clientTools/editImpl.ts @@ -19,7 +19,7 @@ export const editToolImpl: ClientToolImpl = async ( } const apply = await extras.ideMessenger.request("applyToFile", { streamId: extras.activeToolStreamId, - text: args.new_contents, + text: args.changes, toolCallId, filepath: firstUriMatch, }); From 63bffa948fcb07a3d172f1f32623a94f80312235 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:43:33 -0700 Subject: [PATCH 11/16] lazy edit file tool --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 2 +- gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 304dcb4c7..04da12cc9 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -6,7 +6,7 @@ import { useAppSelector } from "../../../redux/hooks"; type EditToolCallProps = { relativeFilePath: string; - newContents: string; + changes: string; toolCallId?: string; }; diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index 2ce148016..02759dd18 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -25,7 +25,7 @@ function FunctionSpecificToolCallDiv({ return ( ); From a1bbd2d45ab8cbe0492afcc7ef2758f4ea5b3533 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:44:39 -0700 Subject: [PATCH 12/16] iteration on edit file lazy tool --- core/tools/definitions/editFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index b6739bbbe..9e2d60219 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -30,7 +30,7 @@ export const editFileTool: Tool = { changes: { type: "string", description: - "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", }, }, }, From 4b407e542938c4fca24ed1cd763baa2cd3a9a6b3 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:50:29 -0700 Subject: [PATCH 13/16] fix broken change --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 04da12cc9..a298325b5 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -11,7 +11,7 @@ type EditToolCallProps = { }; export function EditFile(props: EditToolCallProps) { - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.newContents ?? ""}\n\`\`\``; + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes ?? ""}\n\`\`\``; const isStreaming = useAppSelector((state) => state.session.isStreaming); const states = useAppSelector((store) => store.session.codeBlockApplyStates); From 9cac35da1ec131f23b0e30a234c190e34df483dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 09:44:52 +0000 Subject: [PATCH 14/16] Bump JetBrains/qodana-action from 2024.3.2 to 2025.1.0 Bumps [JetBrains/qodana-action](https://github.com/jetbrains/qodana-action) from 2024.3.2 to 2025.1.0. - [Release notes](https://github.com/jetbrains/qodana-action/releases) - [Commits](https://github.com/jetbrains/qodana-action/compare/v2024.3.2...v2025.1.0) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-version: 2025.1.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 629fa97b7..9f20b8131 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -481,7 +481,7 @@ jobs: # Run Qodana inspections - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2024.3.2 + uses: JetBrains/qodana-action@v2025.1.0 with: cache-default-branch-only: true From 56da944dd5c661821fd964e08d69a641a3977515 Mon Sep 17 00:00:00 2001 From: Instinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 25 Apr 2025 20:24:27 +0530 Subject: [PATCH 15/16] docs: minor typo fix --- docs/docs/customize/model-roles/chat.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/customize/model-roles/chat.mdx b/docs/docs/customize/model-roles/chat.mdx index 781ce37d9..7761114d2 100644 --- a/docs/docs/customize/model-roles/chat.mdx +++ b/docs/docs/customize/model-roles/chat.mdx @@ -18,7 +18,7 @@ In Continue, these models are used for normal [Chat](../../chat/how-to-use-it.md For the best overall Chat experience, you will want to use a 400B+ parameter model or one of the frontier models. -### Claude Sonnet 3.5 from Anthropic +### Claude Sonnet 3.7 from Anthropic Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-providers/top-level/anthropic.mdx). From 1d2bfcd4b2ad7c3afef97348c55a1c668610ea07 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 25 Apr 2025 15:23:10 -0700 Subject: [PATCH 16/16] fix: listbox z-index issue --- extensions/vscode/package-lock.json | 4 ++-- gui/src/components/ui/Listbox.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 805cd2d4a..22390e25e 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.25", + "version": "1.1.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.25", + "version": "1.1.26", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/ui/Listbox.tsx b/gui/src/components/ui/Listbox.tsx index ed2e077bf..1659a06b6 100644 --- a/gui/src/components/ui/Listbox.tsx +++ b/gui/src/components/ui/Listbox.tsx @@ -53,7 +53,7 @@ const ListboxOptions = React.forwardRef( border: `1px solid ${vscCommandCenterInactiveBorder}`, fontSize, borderRadius: defaultBorderRadius, - zIndex: 1000, + zIndex: 200000, ...props.style, }} />