Skip to content

Commit 427ba0e

Browse files
committed
Merge branch 'main' into dallin/mcp-history
2 parents 4ddbcab + 5eb993f commit 427ba0e

File tree

88 files changed

+1948
-1804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1948
-1804
lines changed

CONTRIBUTING.md

-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
- [Writing Context Providers](#writing-context-providers)
2727
- [Adding an LLM Provider](#adding-an-llm-provider)
2828
- [Adding Models](#adding-models)
29-
- [Adding Pre-indexed Documentation](#adding-pre-indexed-documentation)
3029
- [📐 Continue Architecture](#-continue-architecture)
3130
- [Continue VS Code Extension](#continue-vs-code-extension)
3231
- [Continue JetBrains Extension](#continue-jetbrains-extension)
@@ -212,10 +211,6 @@ While any model that works with a supported provider can be used with Continue,
212211
- LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models).
213212
- [Prompt Templates](./core/llm/index.ts) - In this file you'll find the `autodetectTemplateType` function. Make sure that for the model name you just added, this function returns the correct template type. This is assuming that the chat template for that model is already built in Continue. If not, you will have to add the template type and corresponding edit and chat templates.
214213

215-
### Adding Pre-indexed Documentation
216-
217-
Continue's @docs context provider lets you easily reference entire documentation sites and then uses embeddings to add the most relevant pages to context. To make the experience as smooth as possible, we pre-index many of the most popular documentation sites. If you'd like to add new documentation to this list, just add an object to the list in [preIndexedDocs.ts](./core/indexing/docs/preIndexedDocs.ts). `startUrl` is where the crawler will start and `rootUrl` will filter out any pages not on that site and under the path of `rootUrl`.
218-
219214
## 📐 Continue Architecture
220215

221216
Continue consists of 2 parts that are split so that it can be extended to work in other IDEs as easily as possible:

binary/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
243243
fs.mkdirSync(targetDir, { recursive: true });
244244
console.log(`[info] Building ${target}...`);
245245
execCmdSync(
246-
`npx pkg --no-bytecode --public-packages "*" --public pkgJson/${target} --out-path ${targetDir}`,
246+
`npx pkg --no-bytecode --public-packages "*" --public --compress GZip pkgJson/${target} --out-path ${targetDir}`,
247247
);
248248

249249
// Download and unzip prebuilt sqlite3 binary for the target

core/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"eqeqeq": "error",
1515
"complexity": ["error", { "max": 38 }],
1616
"max-lines-per-function": ["error", { "max": 996 }],
17-
"max-statements": ["error", { "max": 112 }],
17+
"max-statements": ["error", { "max": 114 }],
1818
"max-depth": ["error", { "max": 6 }],
1919
"max-nested-callbacks": ["error", { "max": 4 }],
2020
"max-params": ["error", { "max": 11 }]

core/config/ConfigHandler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ export class ConfigHandler {
199199
this.ide,
200200
this.ideSettingsPromise,
201201
this.writeLog,
202-
this.reloadConfig.bind(this),
203202
assistant.rawYaml,
203+
selectedOrgId,
204204
);
205205

206206
return new ProfileLifecycleManager(profileLoader, this.ide);

core/config/profile/ControlPlaneProfileLoader.ts

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
7171
undefined,
7272
this.workspaceId,
7373
undefined,
74+
null,
7475
);
7576
}
7677

core/config/profile/LocalProfileLoader.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default class LocalProfileLoader implements IProfileLoader {
6565
undefined,
6666
this.description.id,
6767
this.overrideAssistantFile?.path,
68+
null,
6869
);
6970

7071
this.description.errors = result.errors;

core/config/profile/PlatformProfileLoader.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export default class PlatformProfileLoader implements IProfileLoader {
3131
private readonly ide: IDE,
3232
private ideSettingsPromise: Promise<IdeSettings>,
3333
private writeLog: (message: string) => Promise<void>,
34-
private readonly onReload: () => void,
3534
readonly description: ProfileDescription,
35+
private readonly orgScopeId: string | null,
3636
) {}
3737

3838
static async create(
@@ -45,8 +45,8 @@ export default class PlatformProfileLoader implements IProfileLoader {
4545
ide: IDE,
4646
ideSettingsPromise: Promise<IdeSettings>,
4747
writeLog: (message: string) => Promise<void>,
48-
onReload: () => void,
4948
rawYaml: string,
49+
orgScopeId: string | null,
5050
): Promise<PlatformProfileLoader> {
5151
const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
5252

@@ -75,8 +75,8 @@ export default class PlatformProfileLoader implements IProfileLoader {
7575
ide,
7676
ideSettingsPromise,
7777
writeLog,
78-
onReload,
7978
description,
79+
orgScopeId,
8080
);
8181
}
8282

@@ -102,6 +102,7 @@ export default class PlatformProfileLoader implements IProfileLoader {
102102
},
103103
this.description.id,
104104
undefined,
105+
this.orgScopeId,
105106
);
106107

107108
return {

core/config/profile/doLoadConfig.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default async function doLoadConfig(
4545
platformConfigMetadata: PlatformConfigMetadata | undefined,
4646
profileId: string,
4747
overrideConfigYamlByPath: string | undefined,
48+
orgScopeId: string | null,
4849
): Promise<ConfigResult<ContinueConfig>> {
4950
const workspaceConfigs = await getWorkspaceConfigs(ide);
5051
const ideInfo = await ide.getIdeInfo();
@@ -70,7 +71,6 @@ export default async function doLoadConfig(
7071
if (overrideConfigYaml || fs.existsSync(configYamlPath)) {
7172
const result = await loadContinueConfigFromYaml(
7273
ide,
73-
workspaceConfigs.map((c) => JSON.stringify(c)),
7474
ideSettings,
7575
ideInfo,
7676
uniqueId,
@@ -80,6 +80,7 @@ export default async function doLoadConfig(
8080
platformConfigMetadata,
8181
controlPlaneClient,
8282
configYamlPath,
83+
orgScopeId,
8384
);
8485
newConfig = result.config;
8586
errors = result.errors;

core/config/yaml/loadYaml.ts

+39-17
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,31 @@ import { getSystemPromptDotFile } from "../getSystemPromptDotFile";
4141
import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
4242
import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
4343

44+
import { getControlPlaneEnvSync } from "../../control-plane/env";
4445
import { llmsFromModelConfig } from "./models";
4546

4647
export class LocalPlatformClient implements PlatformClient {
48+
constructor(
49+
private orgScopeId: string | null,
50+
private readonly client: ControlPlaneClient,
51+
) {}
52+
4753
async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> {
48-
return fqsns.map((fqsn) => {
49-
return undefined;
50-
});
54+
if (fqsns.length === 0) {
55+
return [];
56+
}
57+
58+
const response = await this.client.resolveFQSNs(fqsns, this.orgScopeId);
59+
return response;
5160
}
5261
}
5362

5463
async function loadConfigYaml(
55-
workspaceConfigs: string[],
5664
rawYaml: string,
5765
overrideConfigYaml: AssistantUnrolled | undefined,
58-
ide: IDE,
5966
controlPlaneClient: ControlPlaneClient,
67+
orgScopeId: string | null,
68+
ideSettings: IdeSettings,
6069
): Promise<ConfigResult<AssistantUnrolled>> {
6170
let config =
6271
overrideConfigYaml ??
@@ -68,12 +77,18 @@ async function loadConfigYaml(
6877
versionSlug: "",
6978
},
7079
rawYaml,
71-
new RegistryClient(),
80+
new RegistryClient(
81+
await controlPlaneClient.getAccessToken(),
82+
getControlPlaneEnvSync(
83+
ideSettings.continueTestEnvironment,
84+
ideSettings.enableControlServerBeta,
85+
).CONTROL_PLANE_URL,
86+
),
7287
{
7388
currentUserSlug: "",
7489
onPremProxyUrl: null,
75-
orgScopeId: null,
76-
platformClient: new LocalPlatformClient(),
90+
orgScopeId,
91+
platformClient: new LocalPlatformClient(orgScopeId, controlPlaneClient),
7792
renderSecrets: true,
7893
},
7994
));
@@ -206,7 +221,6 @@ async function configYamlToContinueConfig(
206221
continueConfig.systemMessage,
207222
);
208223

209-
//
210224
if (modelsArrayRoles.some((role) => model.roles?.includes(role))) {
211225
continueConfig.models.push(...llms);
212226
}
@@ -244,7 +258,10 @@ async function configYamlToContinueConfig(
244258
} else {
245259
continueConfig.modelsByRole.embed.push(
246260
new embeddingsProviderClass(
247-
options,
261+
{
262+
...options,
263+
title: options.name,
264+
},
248265
(url: string | URL, init: any) =>
249266
fetchwithRequestOptions(url, init, {
250267
...options.requestOptions,
@@ -265,10 +282,15 @@ async function configYamlToContinueConfig(
265282
const rerankerClass = AllRerankers[provider];
266283
if (rerankerClass) {
267284
continueConfig.modelsByRole.rerank.push(
268-
new rerankerClass(options, (url: string | URL, init: any) =>
269-
fetchwithRequestOptions(url, init, {
270-
...options.requestOptions,
271-
}),
285+
new rerankerClass(
286+
{
287+
...options,
288+
title: options.name,
289+
},
290+
(url: string | URL, init: any) =>
291+
fetchwithRequestOptions(url, init, {
292+
...options.requestOptions,
293+
}),
272294
),
273295
);
274296
} else {
@@ -387,7 +409,6 @@ async function configYamlToContinueConfig(
387409

388410
export async function loadContinueConfigFromYaml(
389411
ide: IDE,
390-
workspaceConfigs: string[],
391412
ideSettings: IdeSettings,
392413
ideInfo: IdeInfo,
393414
uniqueId: string,
@@ -397,6 +418,7 @@ export async function loadContinueConfigFromYaml(
397418
platformConfigMetadata: PlatformConfigMetadata | undefined,
398419
controlPlaneClient: ControlPlaneClient,
399420
configYamlPath: string | undefined,
421+
orgScopeId: string | null,
400422
): Promise<ConfigResult<ContinueConfig>> {
401423
const rawYaml =
402424
overrideConfigYaml === undefined
@@ -407,11 +429,11 @@ export async function loadContinueConfigFromYaml(
407429
: "";
408430

409431
const configYamlResult = await loadConfigYaml(
410-
workspaceConfigs,
411432
rawYaml,
412433
overrideConfigYaml,
413-
ide,
414434
controlPlaneClient,
435+
orgScopeId,
436+
ideSettings,
415437
);
416438

417439
if (!configYamlResult.config || configYamlResult.configLoadInterrupted) {

core/context/providers/DocsContextProvider.ts

+9-45
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
LoadSubmenuItemsArgs,
1010
} from "../..";
1111
import DocsService from "../../indexing/docs/DocsService";
12-
import preIndexedDocs from "../../indexing/docs/preIndexedDocs";
1312

1413
import { INSTRUCTIONS_BASE_ITEM } from "./utils";
1514

@@ -64,23 +63,12 @@ class DocsContextProvider extends BaseContextProvider {
6463
return chunksCopy;
6564
}
6665

67-
private _sortByPreIndexedDocs(
66+
private _sortAlphabetically(
6867
submenuItems: ContextSubmenuItem[],
6968
): ContextSubmenuItem[] {
70-
// Sort submenuItems such that the objects with titles which don't occur in configs occur first, and alphabetized
69+
// Sort submenu items alphabetically by title
7170
return submenuItems.sort((a, b) => {
72-
const aTitleInConfigs = a.metadata?.preIndexed ?? false;
73-
const bTitleInConfigs = b.metadata?.preIndexed ?? false;
74-
75-
// Primary criterion: Items not in configs come first
76-
if (!aTitleInConfigs && bTitleInConfigs) {
77-
return -1;
78-
} else if (aTitleInConfigs && !bTitleInConfigs) {
79-
return 1;
80-
} else {
81-
// Secondary criterion: Alphabetical order when both items are in the same category
82-
return a.title.toString().localeCompare(b.title.toString());
83-
}
71+
return a.title.toString().localeCompare(b.title.toString());
8472
});
8573
}
8674

@@ -165,46 +153,22 @@ class DocsContextProvider extends BaseContextProvider {
165153
}
166154
await docsService.isInitialized;
167155

168-
// Create map of docs url -> submenu item
169-
const submenuItemsMap = new Map<string, ContextSubmenuItem>();
156+
// Create an array to hold submenu items
157+
const submenuItems: ContextSubmenuItem[] = [];
170158

171-
// Add custom docs from config
159+
// Get all indexed docs from the database
172160
const docs = (await docsService.listMetadata()) ?? [];
173161
for (const { startUrl, title, favicon } of docs) {
174-
submenuItemsMap.set(startUrl, {
162+
submenuItems.push({
175163
title,
176164
id: startUrl,
177165
description: new URL(startUrl).hostname,
178166
icon: favicon,
179167
});
180168
}
181169

182-
// Add pre-indexed docs if supported
183-
const canUsePreindexedDocs = await docsService.canUsePreindexedDocs();
184-
if (canUsePreindexedDocs) {
185-
for (const { startUrl, title } of Object.values(preIndexedDocs)) {
186-
// Skip if overridden in config
187-
if (docs.find((d) => d.startUrl === startUrl)) {
188-
continue;
189-
}
190-
submenuItemsMap.set(startUrl, {
191-
title,
192-
id: startUrl,
193-
description: new URL(startUrl).hostname,
194-
metadata: {
195-
preIndexed: true,
196-
},
197-
});
198-
}
199-
}
200-
201-
// Create array and sort if pre-indexed is supported
202-
const submenuItems = Array.from(submenuItemsMap.values());
203-
if (canUsePreindexedDocs) {
204-
return this._sortByPreIndexedDocs(submenuItems);
205-
}
206-
207-
return submenuItems;
170+
// Sort alphabetically
171+
return this._sortAlphabetically(submenuItems);
208172
}
209173
}
210174

core/control-plane/client.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
FQSN,
66
FullSlug,
77
SecretResult,
8+
SecretType,
89
} from "@continuedev/config-yaml";
910
import fetch, { RequestInit, Response } from "node-fetch";
1011

@@ -46,7 +47,14 @@ export class ControlPlaneClient {
4647
): Promise<(SecretResult | undefined)[]> {
4748
const userId = await this.userId;
4849
if (!userId) {
49-
throw new Error("No user id");
50+
return fqsns.map((fqsn) => ({
51+
found: false,
52+
fqsn,
53+
secretLocation: {
54+
secretName: fqsn.secretName,
55+
secretType: SecretType.NotFound,
56+
},
57+
}));
5058
}
5159

5260
const resp = await this.request("ide/sync-secrets", {

core/index.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,13 @@ export interface SiteIndexingConfig {
236236
maxDepth?: number;
237237
faviconUrl?: string;
238238
useLocalCrawling?: boolean;
239-
rootUrl?: string; // Currently only used by preindexed docs
240239
}
241240

242241
export interface DocsIndexingDetails {
243242
startUrl: string;
244243
config: SiteIndexingConfig;
245244
indexingStatus: IndexingStatus | undefined;
246245
chunks: Chunk[];
247-
isPreIndexedDoc: boolean;
248246
}
249247

250248
export interface IContextProvider {

0 commit comments

Comments
 (0)