From 4ddd2755996012677c15069648158bd4334fa3dd Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 27 May 2025 13:12:01 -0700 Subject: [PATCH] fix: spread tool degs --- core/config/load.ts | 2 +- core/config/profile/doLoadConfig.ts | 26 +++++--------------------- core/config/yaml/loadYaml.ts | 2 +- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index e2f3d71c3..6f63374e5 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -529,7 +529,7 @@ async function intermediateToFinalConfig({ const continueConfig: ContinueConfig = { ...config, contextProviders, - tools: baseToolDefinitions, + tools: [...baseToolDefinitions], mcpServerStatuses: [], slashCommands: config.slashCommands ?? [], modelsByRole: { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 2a66398b7..cfaa38ffa 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -194,7 +194,11 @@ export default async function doLoadConfig(options: { } } - newConfig.tools.push(...getConfigDependentTools(newConfig)); + newConfig.tools.push( + ...getConfigDependentToolDefinitions({ + rules: newConfig.rules, + }), + ); // Detect duplicate tool names const counts: Record = {}; @@ -313,23 +317,3 @@ async function getWorkspaceConfigs(ide: IDE): Promise { return workspaceConfigs; } - -/** - * Returns a list of tools that depend on the configuration. - * @param {ContinueConfig} config - The configuration object. - * @returns {Tool[]} Array of tools - * @todo Why is `doLoadConfig` getting called multiple times causing us to have duplicates here unless we filter - */ -function getConfigDependentTools(config: ContinueConfig): Tool[] { - const configDependentTools = getConfigDependentToolDefinitions({ - rules: config.rules, - }); - - return configDependentTools.filter( - (configTool) => - !config.tools.some( - (existingTool) => - existingTool.function.name === configTool.function.name, - ), - ); -} diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 24a60f855..daeecf57e 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -193,7 +193,7 @@ async function configYamlToContinueConfig(options: { const continueConfig: ContinueConfig = { slashCommands: [], - tools: baseToolDefinitions, + tools: [...baseToolDefinitions], mcpServerStatuses: [], contextProviders: [], modelsByRole: {