Skip to content

Commit

Permalink
Merge branch 'main' into pe/jb-integration-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Erichsen authored Dec 11, 2024
2 parents 9f88c97 + 4c8f2cd commit 8274519
Show file tree
Hide file tree
Showing 86 changed files with 8,461 additions and 5,926 deletions.
6 changes: 6 additions & 0 deletions .changes/extensions/vscode/0.8.62.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.8.62 - 2024-12-10
### Added
* Tool use
* Support for Model Context Protocol
### Fixed
* hotfix: context providers no longer hidden when not in edit mode
4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241129-164631.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241129-164644.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"vscode-extension:continue-ui:build",
// // To bundle the code the same way we do for publishing
"vscode-extension:esbuild",
// To ensure extension.js is regenerated even if
// vscode-extension:esbuild was already running in background
"vscode-extension:esbuild-notify",
// Start the React app that is used in the extension
"gui:dev"
],
Expand All @@ -36,6 +39,13 @@
"isDefault": true
}
},
{
"label": "vscode-extension:esbuild-notify",
"dependsOn": ["vscode-extension:esbuild"],
"type": "npm",
"script": "esbuild-notify",
"path": "extensions/vscode"
},
{
"label": "vscode-extension:esbuild",
"dependsOn": ["vscode-extension:continue-ui:build"],
Expand Down
7 changes: 5 additions & 2 deletions core/commands/slash/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ async function getEntriesFilteredByIgnore(dir: string, ide: IDE) {
ig = ig.add(igPatterns);
}

const filteredEntries = entries.filter((entry) => !ig.ignores(entry.name));
const filteredEntries = entries.filter((entry) => {
const name = entry.isDirectory() ? `${entry.name}/` : entry.name;
return !ig.ignores(name);
});

return filteredEntries;
}
Expand Down Expand Up @@ -117,7 +120,7 @@ async function gatherProjectContext(

function createOnboardingPrompt(context: string): string {
return `
As a helpful AI assistant, your task is to onboard a new developer to this project.
As a helpful AI assistant, your task is to onboard a new developer to this project.
Use the following context about the project structure, READMEs, and dependency files to create a comprehensive overview:
${context}
Expand Down
59 changes: 41 additions & 18 deletions core/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
IdeSettings,
IdeType,
ILLM,
LLMOptions,
ModelDescription,
RerankerDescription,
SerializedContinueConfig,
Expand All @@ -31,7 +32,7 @@ import {
slashFromCustomCommand,
} from "../commands/index.js";
import { AllRerankers } from "../context/allRerankers";
import MCPConnectionSingleton from "../context/mcp";
import { MCPManagerSingleton } from "../context/mcp";
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider";
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider";
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
Expand Down Expand Up @@ -454,8 +455,12 @@ async function intermediateToFinalConfig(
) {
config.embeddingsProvider = new embeddingsProviderClass();
} else {
const llmOptions: LLMOptions = {
...options,
model: options.model ?? "UNSPECIFIED"
};
config.embeddingsProvider = new embeddingsProviderClass(
options,
llmOptions,
(url: string | URL, init: any) =>
fetchwithRequestOptions(url, init, {
...config.requestOptions,
Expand Down Expand Up @@ -483,7 +488,11 @@ async function intermediateToFinalConfig(
config.reranker = new LLMReranker(llm);
}
} else if (rerankerClass) {
config.reranker = new rerankerClass(params);
const llmOptions: LLMOptions = {
...params,
model: "rerank-2",
};
config.reranker = new rerankerClass(llmOptions);
}
}

Expand All @@ -498,22 +507,36 @@ async function intermediateToFinalConfig(
};

// Apply MCP if specified
if (config.experimental?.modelContextProtocolServer) {
const mcpConnection = await MCPConnectionSingleton.getInstance(
config.experimental.modelContextProtocolServer,
);
continueConfig = await Promise.race<ContinueConfig>([
mcpConnection.modifyConfig(continueConfig),
new Promise((_, reject) =>
setTimeout(
() => reject(new Error("MCP connection timed out after 2000ms")),
const mcpManager = MCPManagerSingleton.getInstance();
if (config.experimental?.modelContextProtocolServers) {
config.experimental.modelContextProtocolServers?.forEach(
async (server, index) => {
const mcpId = index.toString();
const mcpConnection = mcpManager.createConnection(mcpId, server);
if (!mcpConnection) {
return;
}

const abortController = new AbortController();
const mcpConnectionTimeout = setTimeout(
() => abortController.abort(),
2000,
),
),
]).catch((error) => {
console.warn("MCP connection error:", error);
return continueConfig; // Return original config if timeout occurs
});
);

try {
await mcpConnection.modifyConfig(
continueConfig,
mcpId,
abortController.signal,
);
} catch (e: any) {
if (e.name !== "AbortError") {
throw e;
}
}
clearTimeout(mcpConnectionTimeout);
},
);
}

return continueConfig;
Expand Down
55 changes: 41 additions & 14 deletions core/config/profile/doLoadConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import fs from "fs";

import {
ContinueConfig,
ContinueRcJson,
Expand All @@ -10,9 +12,12 @@ import { ControlPlaneClient } from "../../control-plane/client.js";
import { controlPlaneEnv } from "../../control-plane/env.js";
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
import { getConfigYamlPath } from "../../util/paths";
import { Telemetry } from "../../util/posthog";
import { TTS } from "../../util/tts";
import { ConfigResult, loadFullConfigNode } from "../load";
import { ConfigValidationError } from "../validation";
import { loadContinueConfigFromYaml } from "../yaml/loadYaml";

export default async function doLoadConfig(
ide: IDE,
Expand All @@ -28,20 +33,42 @@ export default async function doLoadConfig(
const ideSettings = await ideSettingsPromise;
const workOsAccessToken = await controlPlaneClient.getAccessToken();

let {
config: newConfig,
errors,
configLoadInterrupted,
} = await loadFullConfigNode(
ide,
workspaceConfigs,
ideSettings,
ideInfo.ideType,
uniqueId,
writeLog,
workOsAccessToken,
overrideConfigJson,
);
const configYamlPath = getConfigYamlPath(ideInfo.ideType);

let newConfig: ContinueConfig | undefined;
let errors: ConfigValidationError[] | undefined;
let configLoadInterrupted = false;

if (fs.existsSync(configYamlPath)) {
const result = await loadContinueConfigFromYaml(
ide,
workspaceConfigs.map((c) => JSON.stringify(c)),
ideSettings,
ideInfo.ideType,
uniqueId,
writeLog,
workOsAccessToken,
undefined,
// overrideConfigYaml, TODO
);
newConfig = result.config;
errors = result.errors;
configLoadInterrupted = result.configLoadInterrupted;
} else {
const result = await loadFullConfigNode(
ide,
workspaceConfigs,
ideSettings,
ideInfo.ideType,
uniqueId,
writeLog,
workOsAccessToken,
overrideConfigJson,
);
newConfig = result.config;
errors = result.errors;
configLoadInterrupted = result.configLoadInterrupted;
}

if (configLoadInterrupted || !newConfig) {
return { errors, config: newConfig, configLoadInterrupted: true };
Expand Down
4 changes: 3 additions & 1 deletion core/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,8 @@ declare global {
| "sambanova"
| "nvidia"
| "nebius"
| "siliconflow";
| "siliconflow"
| "scaleway";
export type ModelName =
| "AUTODETECT"
Expand Down Expand Up @@ -663,6 +664,7 @@ declare global {
| "gemma2-2b-it"
| "gemma2-9b-it"
| "olmo-7b"
| "qwen25-coder-32b"
// Anthropic
| "claude-3-5-sonnet-latest"
| "claude-3-5-sonnet-20240620"
Expand Down
30 changes: 30 additions & 0 deletions core/config/yaml/convertFromJson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";

import { SerializedContinueConfig } from "../..";

export function convertConfigJsonToConfigYaml(
configJson: SerializedContinueConfig,
): ConfigYaml {
return {
name: "Local Config",
models: [
...configJson.models.map(
(model): ModelConfig => ({
model: model.model,
name: model.title,
// defaultCompletionOptions: model.completionOptions,
provider: model.provider,
roles: ["chat"],
}),
),
// ... tabAutocompleteModels
// embeddingsModels
// rerankModels
],
context: configJson.contextProviders?.map((provider) => ({
uses: provider.name,
with: provider.params,
})),
};
}
14 changes: 14 additions & 0 deletions core/config/yaml/default.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";

// TODO
export const defaultConfigYaml: ConfigYaml = {
models: [],
context: [],
name: "Local Config",
};

export const defaultConfigYamlJetBrains: ConfigYaml = {
models: [],
context: [],
name: "Local Config",
};
Loading

0 comments on commit 8274519

Please sign in to comment.