From 50b0dec9c4b2a2337729ebff497f385aa61b4dae Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 19 Aug 2025 01:20:11 -0700 Subject: [PATCH 001/155] feat: org policies for indexing and mcp --- core/config/ConfigHandler.ts | 2 ++ core/config/load.ts | 26 ++++++++------ core/config/profile/doLoadConfig.ts | 10 +++--- core/config/yaml/loadYaml.ts | 36 +++++++++++-------- core/context/mcp/MCPManagerSingleton.ts | 15 ++++++++ .../Lump/sections/SelectedSection.tsx | 7 ++++ gui/src/pages/config/UserSettingsForm.tsx | 3 ++ packages/config-yaml/src/schemas/policy.ts | 2 ++ 8 files changed, 72 insertions(+), 29 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 837bb2a39..2e7a65ca3 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -202,6 +202,8 @@ export class ConfigHandler { message: `Error loading Continue Hub assistants${e instanceof Error ? ":\n" + e.message : ""}`, }); } + } else { + PolicySingleton.getInstance().policy = null; } // Load local org if not signed in or hub orgs fail try { diff --git a/core/config/load.ts b/core/config/load.ts index dac5e2174..588b8f02b 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -62,6 +62,7 @@ import { } from "../util/paths"; import { localPathToUri } from "../util/pathToUri"; +import { PolicySingleton } from "../control-plane/PolicySingleton"; import { getToolsForIde } from "../tools"; import { resolveRelativePathInDir } from "../util/ideUtils"; import { getWorkspaceRcConfigs } from "./json/loadRcConfigs"; @@ -570,16 +571,21 @@ async function intermediateToFinalConfig({ // Trigger MCP server refreshes (Config is reloaded again once connected!) const mcpManager = MCPManagerSingleton.getInstance(); - mcpManager.setConnections( - (config.experimental?.modelContextProtocolServers ?? []).map( - (server, index) => ({ - id: `continue-mcp-server-${index + 1}`, - name: `MCP Server`, - ...server, - }), - ), - false, - ); + const orgPolicy = PolicySingleton.getInstance().policy; + if (orgPolicy?.policy?.allowMcpServers === false) { + await mcpManager.shutdown(); + } else { + mcpManager.setConnections( + (config.experimental?.modelContextProtocolServers ?? []).map( + (server, index) => ({ + id: `continue-mcp-server-${index + 1}`, + name: `MCP Server`, + ...server, + }), + ), + false, + ); + } // Handle experimental modelRole config values for apply and edit const inlineEditModel = getModelByRole(continueConfig, "inlineEdit")?.title; diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 040fd3b41..fda3cb8b8 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -335,12 +335,14 @@ export default async function doLoadConfig(options: { } } - if ( - PolicySingleton.getInstance().policy?.policy?.allowAnonymousTelemetry === - false - ) { + // Org policies + const policy = PolicySingleton.getInstance().policy?.policy; + if (policy?.allowAnonymousTelemetry === false) { newConfig.allowAnonymousTelemetry = false; } + if (policy?.allowCodebaseIndexing === false) { + newConfig.disableIndexing = true; + } // Setup telemetry only after (and if) we know it is enabled await Telemetry.setup( diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 6772a2d02..cdc4a6bef 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -35,6 +35,7 @@ import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; import { convertPromptBlockToSlashCommand } from "../../commands/slash/promptBlockSlashCommand"; import { slashCommandFromPromptFile } from "../../commands/slash/promptFileSlashCommand"; import { getControlPlaneEnvSync } from "../../control-plane/env"; +import { PolicySingleton } from "../../control-plane/PolicySingleton"; import { getToolsForIde } from "../../tools"; import { getCleanUriPath } from "../../util/uri"; import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants"; @@ -415,21 +416,26 @@ async function configYamlToContinueConfig(options: { // Trigger MCP server refreshes (Config is reloaded again once connected!) const mcpManager = MCPManagerSingleton.getInstance(); - mcpManager.setConnections( - (config.mcpServers ?? []).map((server) => ({ - id: server.name, - name: server.name, - sourceFile: server.sourceFile, - transport: { - type: "stdio", - args: [], - ...(server as any), // TODO: fix the types on mcpServers in config-yaml - }, - timeout: server.connectionTimeout, - })), - false, - { ide }, - ); + const orgPolicy = PolicySingleton.getInstance().policy; + if (orgPolicy?.policy?.allowMcpServers === false) { + await mcpManager.shutdown(); + } else { + mcpManager.setConnections( + (config.mcpServers ?? []).map((server) => ({ + id: server.name, + name: server.name, + sourceFile: server.sourceFile, + transport: { + type: "stdio", + args: [], + ...(server as any), // TODO: fix the types on mcpServers in config-yaml + }, + timeout: server.connectionTimeout, + })), + false, + { ide }, + ); + } return { config: continueConfig, errors: localErrors }; } diff --git a/core/context/mcp/MCPManagerSingleton.ts b/core/context/mcp/MCPManagerSingleton.ts index 22495bef4..c9dc41929 100644 --- a/core/context/mcp/MCPManagerSingleton.ts +++ b/core/context/mcp/MCPManagerSingleton.ts @@ -48,6 +48,21 @@ export class MCPManagerSingleton { this.connections.delete(id); } + async shutdown() { + if (this.connections.size > 0) { + await Promise.allSettled( + Array.from(this.connections.entries()).map(([id, connection]) => { + try { + connection.abortController.abort(); + void connection.client.close(); + } finally { + this.connections.delete(id); + } + }), + ); + } + } + setConnections( servers: MCPOptions[], forceRefresh: boolean, diff --git a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx index 29feb6680..f8e6a52e1 100644 --- a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx @@ -1,3 +1,5 @@ +import { useAppSelector } from "../../../../redux/hooks"; +import { selectCurrentOrg } from "../../../../redux/slices/profilesSlice"; import { useLump } from "../LumpContext"; import { ContextSection } from "./ContextSection"; import { ErrorSection } from "./errors/ErrorSection"; @@ -12,6 +14,8 @@ import { ToolPoliciesSection } from "./tool-policies/ToolPoliciesSection"; */ export function SelectedSection() { const { displayedSection } = useLump(); + const currentOrg = useAppSelector(selectCurrentOrg); + const hideMcp = currentOrg?.policy?.allowMcpServers === false; switch (displayedSection) { case "models": @@ -25,6 +29,9 @@ export function SelectedSection() { case "tools": return ; case "mcp": + if (hideMcp) { + return null; + } return ; case "error": return ; diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index a27e58230..f0f40cd4c 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -139,6 +139,8 @@ export function UserSettingsForm() { const disableTelemetryToggle = currentOrg?.policy?.allowAnonymousTelemetry === false; + const disableIndexingToggle = + currentOrg?.policy?.allowCodebaseIndexing === false; return (
@@ -243,6 +245,7 @@ export function UserSettingsForm() { handleUpdate({ disableIndexing: !disableIndexing, diff --git a/packages/config-yaml/src/schemas/policy.ts b/packages/config-yaml/src/schemas/policy.ts index c9b3d3a0b..54f6e12e4 100644 --- a/packages/config-yaml/src/schemas/policy.ts +++ b/packages/config-yaml/src/schemas/policy.ts @@ -3,6 +3,8 @@ import * as z from "zod"; export const policySchema = z.object({ allowAnonymousTelemetry: z.boolean().optional(), allowOtherOrgs: z.boolean().optional(), + allowCodebaseIndexing: z.boolean().optional(), + allowMcpServers: z.boolean().optional(), // allowLocalConfigFile: z.boolean().optional(), }); From f123818fa3c7de636a4e8dd79182e9a6551add88 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 20 Aug 2025 17:42:19 +0530 Subject: [PATCH 002/155] chore: remove ids from tooltips --- .../components/AcceptRejectDiffButtons.tsx | 50 +++-- .../AssistantAndOrgListbox/index.tsx | 12 +- .../AssistantAndOrgListbox/shared.tsx | 16 +- .../GenerateRuleDialog/GenerationScreen.tsx | 15 +- gui/src/components/InfoHover.tsx | 14 +- gui/src/components/ModeSelect/ModeSelect.tsx | 35 +--- .../components/OllamaModelDownload.tsx | 15 +- .../components/OnboardingCardLanding.tsx | 26 +-- .../StyledMarkdownPreview/FilenameLink.tsx | 11 +- .../StyledMarkdownPreview/MermaidBlock.tsx | 43 ++-- .../StepContainerPreToolbar/ApplyActions.tsx | 33 ++- .../StepContainerPreToolbar/CopyButton.tsx | 31 ++- .../CreateFileButton.tsx | 36 ++-- .../StepContainerPreToolbar/FileInfo.tsx | 27 +-- .../StepContainerPreToolbar/InsertButton.tsx | 17 +- .../ToolbarButtonWithTooltip.tsx | 15 +- .../StyledMarkdownPreview/SymbolLink.tsx | 16 +- .../StyledMarkdownPreview/index.tsx | 16 +- gui/src/components/dialogs/AddDocsDialog.tsx | 24 +-- .../gui/HeaderButtonWithToolTip.tsx | 16 +- gui/src/components/gui/Tooltip.tsx | 45 +++-- .../loaders/FreeTrialProgressBar.tsx | 27 +-- .../components/mainInput/ContextStatus.tsx | 84 ++++---- gui/src/components/mainInput/InputToolbar.tsx | 154 +++++++------- .../LumpToolbar/BlockSettingsTopToolbar.tsx | 40 ++-- .../Lump/sections/docs/StatusIndicator.tsx | 21 +- .../Lump/sections/mcp/MCPSection.tsx | 191 +++++++++--------- .../sections/tool-policies/ToolPolicyItem.tsx | 22 +- gui/src/pages/config/ModelRoleSelector.tsx | 4 - gui/src/pages/config/UserSettingsForm.tsx | 10 +- 30 files changed, 475 insertions(+), 591 deletions(-) diff --git a/gui/src/components/AcceptRejectDiffButtons.tsx b/gui/src/components/AcceptRejectDiffButtons.tsx index 621fbeead..6abdded6e 100644 --- a/gui/src/components/AcceptRejectDiffButtons.tsx +++ b/gui/src/components/AcceptRejectDiffButtons.tsx @@ -58,33 +58,31 @@ export default function AcceptRejectAllButtons({ className="flex flex-row items-center justify-evenly gap-3 px-3" data-testid="accept-reject-all-buttons" > - - + + + - - + + +
); } diff --git a/gui/src/components/AssistantAndOrgListbox/index.tsx b/gui/src/components/AssistantAndOrgListbox/index.tsx index e77bf5118..5500eafb7 100644 --- a/gui/src/components/AssistantAndOrgListbox/index.tsx +++ b/gui/src/components/AssistantAndOrgListbox/index.tsx @@ -125,12 +125,12 @@ export function AssistantAndOrgListbox() { {session?.AUTH_TYPE !== AuthType.OnPrem && session?.account.id} - - Logout + + + ) : ( ) ) : ( - <> + +
Errors
+ {JSON.stringify(errors, null, 2)} + + } + > - -
Errors
- {JSON.stringify(errors, null, 2)} -
- +
)} diff --git a/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx b/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx index 28831b15d..3868b5a3b 100644 --- a/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx +++ b/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx @@ -139,7 +139,6 @@ export function GenerationScreen({ }; const showNameSpinner = isGenerating && !formData.name && !isManualMode; - const tooltipId = "rule-type-tooltip"; return (
@@ -181,14 +180,12 @@ export function GenerationScreen({ - - + + +