diff --git a/core/config/load.ts b/core/config/load.ts
index 3636b4bf8..5abb3fd5e 100644
--- a/core/config/load.ts
+++ b/core/config/load.ts
@@ -539,18 +539,21 @@ async function intermediateToFinalConfig(
// Apply MCP if specified
const mcpManager = MCPManagerSingleton.getInstance();
if (config.experimental?.modelContextProtocolServers) {
- await Promise.all(
+ const abortController = new AbortController();
+ const mcpConnectionTimeout = setTimeout(
+ () => abortController.abort(),
+ 4000,
+ );
+
+ await Promise.allSettled(
config.experimental.modelContextProtocolServers?.map(
async (server, index) => {
- const mcpId = index.toString();
- const mcpConnection = mcpManager.createConnection(mcpId, server);
- if (!mcpConnection) {
- return;
- }
-
- const abortController = new AbortController();
-
try {
+ const mcpId = index.toString();
+ const mcpConnection = mcpManager.createConnection(mcpId, server);
+ if (!mcpConnection) {
+ return;
+ }
const mcpError = await mcpConnection.modifyConfig(
continueConfig,
mcpId,
@@ -561,14 +564,21 @@ async function intermediateToFinalConfig(
if (mcpError) {
errors.push(mcpError);
}
- } catch (e: any) {
+ } catch (e) {
+ let errorMessage = "Failed to load MCP server";
+ if (e instanceof Error) {
+ if (e.name === "AbortError") {
+ errorMessage += ": connection timed out";
+ } else {
+ errorMessage += ": " + e.message;
+ }
+ }
errors.push({
fatal: false,
- message: `Failed to load MCP server: ${e.message}`,
+ message: errorMessage,
});
- if (e.name !== "AbortError") {
- throw e;
- }
+ } finally {
+ clearTimeout(mcpConnectionTimeout);
}
},
) || [],
diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts
index 352f2349f..b0cabac3b 100644
--- a/core/config/yaml/loadYaml.ts
+++ b/core/config/yaml/loadYaml.ts
@@ -331,27 +331,27 @@ async function configYamlToContinueConfig(
// Apply MCP if specified
const mcpManager = MCPManagerSingleton.getInstance();
- await Promise.all(
+ await Promise.allSettled(
config.mcpServers?.map(async (server) => {
- const mcpId = server.name;
- const mcpConnection = mcpManager.createConnection(mcpId, {
- transport: {
- type: "stdio",
- args: [],
- ...server,
- },
- });
- if (!mcpConnection) {
- return;
- }
-
const abortController = new AbortController();
const mcpConnectionTimeout = setTimeout(
() => abortController.abort(),
- 5000,
+ 4000,
);
try {
+ const mcpId = server.name;
+ const mcpConnection = mcpManager.createConnection(mcpId, {
+ transport: {
+ type: "stdio",
+ args: [],
+ ...server,
+ },
+ });
+ if (!mcpConnection) {
+ return;
+ }
+
const mcpError = await mcpConnection.modifyConfig(
continueConfig,
mcpId,
@@ -362,16 +362,22 @@ async function configYamlToContinueConfig(
if (mcpError) {
errors.push(mcpError);
}
- } catch (e: any) {
+ } catch (e) {
+ let errorMessage = `Failed to load MCP server ${server.name}`;
+ if (e instanceof Error) {
+ if (e.name === "AbortError") {
+ errorMessage += ": connection timed out";
+ } else {
+ errorMessage += ": " + e.message;
+ }
+ }
errors.push({
fatal: false,
- message: `Failed to load MCP server: ${e.message}`,
+ message: errorMessage,
});
- if (e.name !== "AbortError") {
- throw e;
- }
+ } finally {
+ clearTimeout(mcpConnectionTimeout);
}
- clearTimeout(mcpConnectionTimeout);
}) ?? [],
);
diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts
index 0e4533ceb..a80a4a72b 100644
--- a/core/llm/constructMessages.ts
+++ b/core/llm/constructMessages.ts
@@ -8,15 +8,18 @@ import { normalizeToMessageParts } from "../util/messageContent";
import { modelSupportsTools } from "./autodetect";
-const TOOL_USE_RULES = `When using tools, follow the following guidelines:
-- Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.`;
+const TOOL_USE_RULES = `
+ When using tools, follow the following guidelines:
+ - Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.
+`;
function constructSystemPrompt(
modelDescription: ModelDescription,
useTools: boolean,
): string | null {
- let systemMessage =
- "Always include the language and file name in the info string when you write code blocks, for example '```python file.py'.";
+ let systemMessage = `
+ Always include the language and file name in the info string when you write code blocks. If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py'.
+`;
if (useTools && modelSupportsTools(modelDescription)) {
systemMessage += "\n\n" + TOOL_USE_RULES;
}
diff --git a/core/llm/index.ts b/core/llm/index.ts
index 64e13c51d..21048d5f8 100644
--- a/core/llm/index.ts
+++ b/core/llm/index.ts
@@ -821,6 +821,7 @@ export abstract class BaseLLM implements ILLM {
for await (const chunk of stream) {
const result = fromChatCompletionChunk(chunk);
if (result) {
+ completion += result.content;
yield result;
}
if (!citations && (chunk as any).citations && Array.isArray((chunk as any).citations)) {
diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties
index 8553d3528..0082111d3 100644
--- a/extensions/intellij/gradle.properties
+++ b/extensions/intellij/gradle.properties
@@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
pluginName=continue-intellij-extension
pluginRepositoryUrl=https://github.com/continuedev/continue
# SemVer format -> https://semver.org
-pluginVersion=1.0.2
+pluginVersion=1.0.3
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=223
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json
index 942724cda..f1f3e76b2 100644
--- a/extensions/vscode/package.json
+++ b/extensions/vscode/package.json
@@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
- "version": "1.1.8",
+ "version": "1.1.9",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
diff --git a/gui/package-lock.json b/gui/package-lock.json
index bb4989bc2..583c83642 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -231,11 +231,13 @@
}
},
"node_modules/@babel/code-frame": {
- "version": "7.24.7",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
- "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==",
+ "version": "7.26.2",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
+ "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
+ "license": "MIT",
"dependencies": {
- "@babel/highlight": "^7.24.7",
+ "@babel/helper-validator-identifier": "^7.25.9",
+ "js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
},
"engines": {
@@ -407,17 +409,19 @@
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.24.8",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz",
- "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==",
+ "version": "7.25.9",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
+ "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
- "version": "7.24.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz",
- "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==",
+ "version": "7.25.9",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
+ "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
@@ -432,38 +436,26 @@
}
},
"node_modules/@babel/helpers": {
- "version": "7.25.6",
- "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.6.tgz",
- "integrity": "sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q==",
+ "version": "7.26.10",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz",
+ "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==",
+ "license": "MIT",
"peer": true,
"dependencies": {
- "@babel/template": "^7.25.0",
- "@babel/types": "^7.25.6"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/highlight": {
- "version": "7.24.7",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz",
- "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.24.7",
- "chalk": "^2.4.2",
- "js-tokens": "^4.0.0",
- "picocolors": "^1.0.0"
+ "@babel/template": "^7.26.9",
+ "@babel/types": "^7.26.10"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/parser": {
- "version": "7.25.6",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz",
- "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==",
+ "version": "7.26.10",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz",
+ "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==",
+ "license": "MIT",
"dependencies": {
- "@babel/types": "^7.25.6"
+ "@babel/types": "^7.26.10"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -487,9 +479,10 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.25.6",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz",
- "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==",
+ "version": "7.26.10",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz",
+ "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==",
+ "license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
@@ -498,13 +491,14 @@
}
},
"node_modules/@babel/template": {
- "version": "7.25.0",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz",
- "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==",
+ "version": "7.26.9",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz",
+ "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==",
+ "license": "MIT",
"dependencies": {
- "@babel/code-frame": "^7.24.7",
- "@babel/parser": "^7.25.0",
- "@babel/types": "^7.25.0"
+ "@babel/code-frame": "^7.26.2",
+ "@babel/parser": "^7.26.9",
+ "@babel/types": "^7.26.9"
},
"engines": {
"node": ">=6.9.0"
@@ -528,13 +522,13 @@
}
},
"node_modules/@babel/types": {
- "version": "7.25.6",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz",
- "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==",
+ "version": "7.26.10",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz",
+ "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==",
+ "license": "MIT",
"dependencies": {
- "@babel/helper-string-parser": "^7.24.8",
- "@babel/helper-validator-identifier": "^7.24.7",
- "to-fast-properties": "^2.0.0"
+ "@babel/helper-string-parser": "^7.25.9",
+ "@babel/helper-validator-identifier": "^7.25.9"
},
"engines": {
"node": ">=6.9.0"
@@ -3509,17 +3503,6 @@
"node": ">=8"
}
},
- "node_modules/ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
- "dependencies": {
- "color-convert": "^1.9.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
@@ -4197,27 +4180,6 @@
"node": ">=12"
}
},
- "node_modules/chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
- "dependencies": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/chalk/node_modules/escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
- "engines": {
- "node": ">=0.8.0"
- }
- },
"node_modules/character-entities": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
@@ -4309,19 +4271,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
- "dependencies": {
- "color-name": "1.1.3"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
- },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -11634,14 +11583,6 @@
"integrity": "sha512-bu9oCYYWC1iRjx+3UnAjqCsfrWNZV1ghNQf49b3w5xE8J/tNShHTzp5syWJfwGH+pxUgTTLUnzHnfuydW7wmbg==",
"dev": true
},
- "node_modules/to-fast-properties": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
- "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
diff --git a/gui/src/redux/thunks/callTool.ts b/gui/src/redux/thunks/callTool.ts
index 0bd367587..1202f22bf 100644
--- a/gui/src/redux/thunks/callTool.ts
+++ b/gui/src/redux/thunks/callTool.ts
@@ -2,6 +2,7 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import {
acceptToolCall,
+ cancelToolCall,
setCalling,
setToolCallOutput,
} from "../slices/sessionSlice";
@@ -47,9 +48,22 @@ export const callTool = createAsyncThunk(
);
unwrapResult(response);
} else {
- throw new Error(
- `Failed to call tool ${toolCallState.toolCall.function.name}: ${result.error}`,
+ dispatch(cancelToolCall());
+
+ const output = await dispatch(
+ streamResponseAfterToolCall({
+ toolCallId: toolCallState.toolCallId,
+ toolOutput: [
+ {
+ name: "Tool Call Failed",
+ description: "Tool Call Failed",
+ content: `The tool call failed with the message:\n\n${result.error}\n\nPlease try something else or request further instructions.`,
+ hidden: true,
+ },
+ ],
+ }),
);
+ unwrapResult(output);
}
},
);
diff --git a/gui/src/redux/thunks/cancelTool.ts b/gui/src/redux/thunks/cancelTool.ts
index 89c4e8e12..d46195674 100644
--- a/gui/src/redux/thunks/cancelTool.ts
+++ b/gui/src/redux/thunks/cancelTool.ts
@@ -1,4 +1,4 @@
-import { createAsyncThunk } from "@reduxjs/toolkit";
+import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import { cancelToolCall } from "../slices/sessionSlice";
import { ThunkApiType } from "../store";
@@ -20,7 +20,7 @@ export const cancelTool = createAsyncThunk(
dispatch(cancelToolCall());
- dispatch(
+ const output = await dispatch(
streamResponseAfterToolCall({
toolCallId: toolCallState.toolCallId,
toolOutput: [
@@ -34,5 +34,6 @@ export const cancelTool = createAsyncThunk(
],
}),
);
+ unwrapResult(output);
},
);