Merge branch 'main' into fix/gemini-tool-calling-mcp

This commit is contained in:
Dallin Romney 2025-01-30 10:24:42 -08:00 • committed by GitHub
commit 5a17bacf04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 1441 additions and 553 deletions

View file

@ -1,7 +1,7 @@
name: PR checks
on:
pull_request:
pull_request_target:
branches:
- main
paths:
@ -22,10 +22,22 @@ on:
- ".github/workflows/**"
jobs:
validate-pr:
runs-on: ubuntu-latest
environment: tests-requiring-secrets
steps:
- uses: actions/checkout@v4
install-root:
needs: validate-pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# This is important - it switches from the base repo to the fork
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -45,6 +57,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -70,8 +86,13 @@ jobs:
core-checks:
needs: install-core
runs-on: ubuntu-latest
environment: tests-requiring-secrets
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -97,10 +118,14 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
install-gui:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -132,6 +157,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -158,10 +187,14 @@ jobs:
npx tsc --noEmit
binary-checks:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -194,10 +227,14 @@ jobs:
npx tsc --noEmit
install-vscode:
needs: [ install-root, install-core ]
needs: [install-root, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -231,6 +268,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -262,6 +303,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -283,11 +328,14 @@ jobs:
vscode-get-test-file-matrix:
runs-on: ubuntu-latest
needs: [ install-root, install-vscode ]
needs: [install-root, install-vscode]
outputs:
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Cache node modules
uses: actions/cache@v3
@ -312,9 +360,13 @@ jobs:
vscode-package-extension:
runs-on: ubuntu-latest
needs: [ install-vscode, install-core ]
needs: [install-vscode, install-core]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -344,9 +396,13 @@ jobs:
vscode-download-e2e-dependencies:
runs-on: ubuntu-latest
needs: [ install-vscode, install-core ]
needs: [install-vscode, install-core]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -386,13 +442,19 @@ jobs:
install-core,
]
runs-on: ubuntu-latest
# Tests requiring secrets need approval from maintainers
environment: tests-requiring-secrets
strategy:
fail-fast: false
matrix:
test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }}
command: [ "e2e:ci:run", "e2e:ci:run-yaml" ]
command: ["e2e:ci:run", "e2e:ci:run-yaml"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -451,10 +513,14 @@ jobs:
path: extensions/vscode/e2e/storage/screenshots
gui-tests:
needs: [ install-gui, install-core ]
needs: [install-gui, install-core]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
@ -482,10 +548,13 @@ jobs:
npm test
jetbrains-tests:
needs: [ install-root, core-checks ]
needs: [install-root, core-checks]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/cache@v4
with:
@ -578,4 +647,35 @@ jobs:
with:
name: jb-failure-report
path: |
${{ github.workspace }}/extensions/intellij/build/reports
${{ github.workspace }}/extensions/intellij/build/reports
# GitHub does not have a way of requiring that all checks pass (you must manually select each job)
# This action at least lets us manage the list of required tests via source control
# so that creators of new jobs can add them to this list
require-all-checks-to-pass:
if: always()
runs-on: ubuntu-latest
needs:
- install-root
- install-core
- core-checks
- install-gui
- gui-checks
- binary-checks
- install-vscode
- vscode-checks
- core-tests
- vscode-get-test-file-matrix
- vscode-package-extension
- vscode-download-e2e-dependencies
- vscode-e2e-tests
- gui-tests
- jetbrains-tests
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-failures:
allowed-skips:
jobs: ${{ toJSON(needs) }}

View file

@ -49,7 +49,7 @@ If you find a bug, please [create an issue](https://github.com/continuedev/conti
## ✨ Suggest Enhancements
Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are
Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are:
- Create an issue
@ -192,7 +192,7 @@ Continue has support for more than a dozen different LLM "providers", making it
1. Create a new file in the `core/llm/llms` directory. The name of the file should be the name of the provider, and it should export a class that extends `BaseLLM`. This class should contain the following minimal implementation. We recommend viewing pre-existing providers for more details. The [LlamaCpp Provider](./core/llm/llms/LlamaCpp.ts) is a good simple example.
- `providerName` - the identifier for your provider
- `providerName` - the identifier for your provider.
- At least one of `_streamComplete` or `_streamChat` - This is the function that makes the request to the API and returns the streamed response. You only need to implement one because Continue can automatically convert between "chat" and "raw completion".
2. Add your provider to the `LLMs` array in [core/llm/llms/index.ts](./core/llm/llms/index.ts).

View file

@ -16,7 +16,11 @@ import Ollama from "../llm/llms/Ollama.js";
import { GlobalContext } from "../util/GlobalContext.js";
import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js";
import { ConfigResult, ConfigYaml, FullSlug } from "@continuedev/config-yaml";
import {
AssistantUnrolled,
ConfigResult,
FullSlug,
} from "@continuedev/config-yaml";
import * as YAML from "yaml";
import { getControlPlaneEnv, useHub } from "../control-plane/env.js";
import { localPathToUri } from "../util/pathToUri.js";
@ -107,7 +111,7 @@ export class ConfigHandler {
}
} else {
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
await this.ide.openUrl(`${env.APP_URL}${openProfileId}`);
await this.ide.openUrl(`${env.APP_URL}platform/${openProfileId}`);
}
}
@ -118,7 +122,7 @@ export class ConfigHandler {
.then(async (assistants) => {
const hubProfiles = await Promise.all(
assistants.map(async (assistant) => {
let renderedConfig: ConfigYaml | undefined = undefined;
let renderedConfig: AssistantUnrolled | undefined = undefined;
if (assistant.configResult.config) {
renderedConfig = await clientRenderHelper(
YAML.stringify(assistant.configResult.config),

View file

@ -1,4 +1,4 @@
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js";
import { ControlPlaneClient } from "../../control-plane/client.js";
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
@ -24,7 +24,7 @@ export default class PlatformProfileLoader implements IProfileLoader {
description: ProfileDescription;
constructor(
private configResult: ConfigResult<ConfigYaml>,
private configResult: ConfigResult<AssistantUnrolled>,
private readonly ownerSlug: string,
private readonly packageSlug: string,
versionSlug: string,

View file

@ -1,9 +1,9 @@
import fs from "fs";
import {
AssistantUnrolled,
ConfigResult,
ConfigValidationError,
ConfigYaml,
} from "@continuedev/config-yaml";
import {
ContinueConfig,
@ -30,7 +30,7 @@ export default async function doLoadConfig(
controlPlaneClient: ControlPlaneClient,
writeLog: (message: string) => Promise<void>,
overrideConfigJson: SerializedContinueConfig | undefined,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
platformConfigMetadata: PlatformConfigMetadata | undefined,
workspaceId?: string,
): Promise<ConfigResult<ContinueConfig>> {

View file

@ -1,11 +1,11 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
import { SerializedContinueConfig } from "../..";
export function convertConfigJsonToConfigYaml(
configJson: SerializedContinueConfig,
): ConfigYaml {
): AssistantUnrolled {
return {
name: "Local Config",
version: "1.0.0",
@ -24,8 +24,8 @@ export function convertConfigJsonToConfigYaml(
// rerankModels
],
context: configJson.contextProviders?.map((provider) => ({
uses: provider.name,
with: provider.params,
provider: provider.name,
params: provider.params,
})),
};
}

View file

@ -1,14 +1,14 @@
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
// TODO
export const defaultConfigYaml: ConfigYaml = {
export const defaultConfigYaml: AssistantUnrolled = {
models: [],
context: [],
name: "Local Config",
version: "1.0.0",
};
export const defaultConfigYamlJetBrains: ConfigYaml = {
export const defaultConfigYamlJetBrains: AssistantUnrolled = {
models: [],
context: [],
name: "Local Config",

View file

@ -1,8 +1,8 @@
import fs from "node:fs";
import {
AssistantUnrolled,
ConfigResult,
ConfigYaml,
validateConfigYaml,
} from "@continuedev/config-yaml";
import { fetchwithRequestOptions } from "@continuedev/fetch";
@ -40,10 +40,10 @@ import { llmsFromModelConfig } from "./models";
async function loadConfigYaml(
workspaceConfigs: string[],
rawYaml: string,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
ide: IDE,
controlPlaneClient: ControlPlaneClient,
): Promise<ConfigResult<ConfigYaml>> {
): Promise<ConfigResult<AssistantUnrolled>> {
let config =
overrideConfigYaml ??
(await clientRenderHelper(rawYaml, ide, controlPlaneClient));
@ -86,7 +86,7 @@ async function slashCommandsFromV1PromptFiles(
}
async function configYamlToContinueConfig(
config: ConfigYaml,
config: AssistantUnrolled,
ide: IDE,
ideSettings: IdeSettings,
uniqueId: string,
@ -181,7 +181,8 @@ async function configYamlToContinueConfig(
// Context providers
const codebaseContextParams: IContextProvider[] =
(config.context || []).find((cp) => cp.uses === "codebase")?.with || {};
(config.context || []).find((cp) => cp.provider === "codebase")?.params ||
{};
const DEFAULT_CONTEXT_PROVIDERS = [
new FileContextProvider({}),
new CodebaseContextProvider(codebaseContextParams),
@ -194,14 +195,14 @@ async function configYamlToContinueConfig(
continueConfig.contextProviders = (config.context
?.map((context) => {
const cls = contextProviderClassFromName(context.uses) as any;
const cls = contextProviderClassFromName(context.provider) as any;
if (!cls) {
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) {
console.warn(`Unknown context provider ${context.uses}`);
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.provider)) {
console.warn(`Unknown context provider ${context.provider}`);
}
return undefined;
}
const instance: IContextProvider = new cls(context.with ?? {});
const instance: IContextProvider = new cls(context.params ?? {});
return instance;
})
.filter((p) => !!p) ?? []) as IContextProvider[];
@ -296,7 +297,7 @@ export async function loadContinueConfigFromYaml(
uniqueId: string,
writeLog: (log: string) => Promise<void>,
workOsAccessToken: string | undefined,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
platformConfigMetadata: PlatformConfigMetadata | undefined,
controlPlaneClient: ControlPlaneClient,
): Promise<ConfigResult<ContinueConfig>> {

View file

@ -20,6 +20,10 @@ class DocsContextProvider extends BaseContextProvider {
displayTitle: "Docs",
description: "Type to search docs",
type: "submenu",
// Todo: consider a different renderInline so that when multiple docs are referenced in one message,
// Or the doc has an odd name unrelated to the content
// The name of the doc itself doesn't skew the embedding results
// renderInlineAs: "<docs-context-provider>",
};
constructor(options: any) {
@ -82,6 +86,7 @@ class DocsContextProvider extends BaseContextProvider {
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
const nRetrieve = this.options?.nRetrieve ?? DocsContextProvider.nRetrieve;
const useReranking = this.options?.useReranking ?? true;
// Get docs service
@ -96,7 +101,7 @@ class DocsContextProvider extends BaseContextProvider {
let chunks = await docsService.retrieveChunksFromQuery(
extras.fullInput, // confusing: fullInput = the query, query = startUrl in this case
query,
this.options?.nRetrieve ?? DocsContextProvider.nRetrieve,
nRetrieve,
);
if (!chunks?.length) {
return [];

View file

@ -22,7 +22,7 @@ export interface IContinueServerClient {
connected: boolean;
url: URL | undefined;
getUserToken(): string | undefined;
getConfig(): Promise<{ configJson: string; configJs: string }>;
getConfig(): Promise<{ configJson: string }>;
getFromIndexCache<T extends ArtifactType>(
keys: string[],
artifactId: T,

View file

@ -30,7 +30,7 @@ export class ContinueServerClient implements IContinueServerClient {
return this.url !== undefined && this.userToken !== undefined;
}
public async getConfig(): Promise<{ configJson: string; configJs: string }> {
public async getConfig(): Promise<{ configJson: string }> {
const userToken = await this.userToken;
const response = await fetch(new URL("sync", this.url).href, {
method: "GET",

View file

@ -1,10 +1,10 @@
import { ConfigJson } from "@continuedev/config-types";
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
import fetch, { RequestInit, Response } from "node-fetch";
import { IdeSettings, ModelDescription } from "../index.js";
import {
AssistantUnrolled,
ConfigResult,
FQSN,
FullSlug,
@ -109,7 +109,7 @@ export class ControlPlaneClient {
public async listAssistants(): Promise<
{
configResult: ConfigResult<ConfigYaml>;
configResult: ConfigResult<AssistantUnrolled>;
ownerSlug: string;
packageSlug: string;
iconUrl: string;

View file

@ -863,6 +863,9 @@ export class Core {
on("docs/initStatuses", async (msg) => {
void this.docsService.initStatuses();
});
on("docs/getDetails", async (msg) => {
return await this.docsService.getDetails(msg.data.startUrl);
});
//
on("didChangeSelectedProfile", (msg) => {

16
core/index.d.ts vendored
View file

@ -229,6 +229,14 @@ export interface SiteIndexingConfig {
rootUrl?: string; // Currently only used by preindexed docs
}
export interface DocsIndexingDetails {
startUrl: string;
config: SiteIndexingConfig;
indexingStatus: IndexingStatus | undefined;
chunks: Chunk[];
isPreIndexedDoc: boolean;
}
export interface IContextProvider {
get description(): ContextProviderDescription;
@ -425,6 +433,13 @@ interface ToolCallState {
output?: ContextItem[];
}
interface Reasoning {
active: boolean;
text: string;
startAt: number;
endAt?: number;
}
export interface ChatHistoryItem {
message: ChatMessage;
contextItems: ContextItemWithId[];
@ -435,6 +450,7 @@ export interface ChatHistoryItem {
isGatheringContext?: boolean;
checkpoint?: Checkpoint;
isBeforeCheckpoint?: boolean;
reasoning?: Reasoning;
}
export interface LLMFullCompletionOptions extends BaseCompletionOptions {

View file

@ -5,6 +5,7 @@ import lancedb, { Connection } from "vectordb";
import {
Chunk,
ContinueConfig,
DocsIndexingDetails,
IDE,
IdeInfo,
ILLM,
@ -31,7 +32,6 @@ import {
markdownPageToArticleWithChunks,
} from "./article";
import DocsCrawler, { DocsCrawlerType, PageData } from "./crawlers/DocsCrawler";
import { ConfigResult } from "@continuedev/config-yaml";
import { runLanceMigrations, runSqliteMigrations } from "./migrations";
import {
downloadFromS3,
@ -40,6 +40,7 @@ import {
SiteIndexingResults,
} from "./preIndexed";
import preIndexedDocs from "./preIndexedDocs";
import { ConfigResult } from "@continuedev/config-yaml";
// Purposefully lowercase because lancedb converts
export interface LanceDbDocsRow {
@ -327,7 +328,7 @@ export default class DocsService {
}
// Returns true if startUrl has been indexed with current embeddingsProvider
async hasMetadata(startUrl: string): Promise<Promise<boolean>> {
async hasMetadata(startUrl: string): Promise<boolean> {
const db = await this.getOrCreateSqliteDb();
const title = await db.get(
`SELECT title FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`,
@ -695,6 +696,64 @@ export default class DocsService {
return await this.retrieveChunks(startUrl, vector, nRetrieve, isPreindexed);
}
private lanceDBRowToChunk(row: LanceDbDocsRow): Chunk {
return {
digest: row.path,
filepath: row.path,
startLine: row.startline,
endLine: row.endline,
index: 0,
content: row.content,
otherMetadata: {
title: row.title,
},
};
}
async getDetails(startUrl: string): Promise<DocsIndexingDetails> {
const db = await this.getOrCreateSqliteDb();
try {
const { isPreindexed, provider } =
await this.getEmbeddingsProvider(startUrl);
const preIndexedDoc = preIndexedDocs[startUrl];
const isPreIndexedDoc = !!preIndexedDoc;
const result = await db.get(
`SELECT startUrl, title, favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`,
startUrl,
provider.embeddingId,
);
if (!result) {
throw new Error(`${startUrl} not found in sqlite`);
}
const siteIndexingConfig: SiteIndexingConfig = {
startUrl,
faviconUrl: result.favicon,
title: result.title,
};
const table = await this.getOrCreateLanceTable({
initializationVector: [],
startUrl,
});
const rows = (await table
.filter(`starturl = '${startUrl}'`)
.limit(1000)
.execute()) as LanceDbDocsRow[];
return {
startUrl,
config: siteIndexingConfig,
indexingStatus: this.statuses.get(startUrl),
chunks: rows.map(this.lanceDBRowToChunk),
isPreIndexedDoc,
};
} catch (e) {
console.warn("Error getting details", e);
throw e;
}
}
// This is split into its own function so that it can be recursive
// in the case of fetching preindexed docs from s3
async retrieveChunks(
@ -732,17 +791,7 @@ export default class DocsService {
return await this.retrieveChunks(startUrl, vector, nRetrieve, true, true);
}
return docs.map((doc) => ({
digest: doc.path,
filepath: doc.path,
startLine: doc.startline,
endLine: doc.endline,
index: 0,
content: doc.content,
otherMetadata: {
title: doc.title,
},
}));
return docs.map(this.lanceDBRowToChunk);
}
// SQLITE DB
@ -798,7 +847,7 @@ export default class DocsService {
private async syncDocs(
oldConfig: ContinueConfig | undefined,
newConfig: ContinueConfig,
reindex: boolean,
forceReindex: boolean,
) {
try {
this.isSyncing = true;
@ -838,20 +887,25 @@ export default class DocsService {
) {
changedDocs.push(doc);
} else {
// if get's here, not changed, no update needed, mark as complete
this.handleStatusUpdate({
type: "docs",
id: doc.startUrl,
embeddingsProviderId: this.config.embeddingsProvider.embeddingId,
isReindexing: false,
title: doc.title,
debugInfo: "Config sync: not changed",
icon: doc.faviconUrl,
url: doc.startUrl,
progress: 1,
description: "Complete",
status: "complete",
});
if (forceReindex) {
changedDocs.push(doc);
} else {
// if get's here, not changed, no update needed, mark as complete
this.handleStatusUpdate({
type: "docs",
id: doc.startUrl,
embeddingsProviderId:
this.config.embeddingsProvider.embeddingId,
isReindexing: false,
title: doc.title,
debugInfo: "Config sync: not changed",
icon: doc.faviconUrl,
url: doc.startUrl,
progress: 1,
description: "Complete",
status: "complete",
});
}
}
} else {
const currentStatus = this.statuses.get(doc.startUrl);

View file

@ -399,10 +399,10 @@ function compileChatMessages(
if (
(systemMessage && systemMessage.trim() !== "") ||
msgs?.[0].role === "system"
msgs?.[0]?.role === "system"
) {
let content = "";
if (msgs?.[0].role === "system") {
if (msgs?.[0]?.role === "system") {
content = renderChatMessage(msgs?.[0]);
}
if (systemMessage && systemMessage.trim() !== "") {

View file

@ -460,9 +460,11 @@ export abstract class BaseLLM implements ILLM {
`${toolCall.function?.name}(${toolCall.function?.arguments})`,
)
.join("\n");
} else if ("content" in msg && Array.isArray(msg.content)) {
const content = renderChatMessage(msg);
msg.content = content;
} else if ("content" in msg) {
if (Array.isArray(msg.content)) {
msg.content = renderChatMessage(msg);
}
contentToShow = msg.content;
}
formatted += `<${msg.role}>\n${contentToShow}\n\n`;

View file

@ -10,19 +10,16 @@ class Groq extends OpenAI {
maxStopWords: number | undefined = 4;
private static modelConversion: { [key: string]: string } = {
"llama2-70b": "llama2-70b-4096",
"mistral-8x7b": "mixtral-8x7b-32768",
gemma: "gemma-7b-it",
gemma2: "gemma2-9b-it",
"llama3-8b": "llama3-8b-8192",
"llama3-70b": "llama3-70b-8192",
"llama3.1-8b": "llama-3.1-8b-instant",
"llama3.1-70b": "llama-3.1-70b-versatile",
"llama3.1-405b": "llama-3.1-405b-reasoning",
"llama3.2-1b": "llama-3.2-1b-preview",
"llama3.2-3b": "llama-3.2-3b-preview",
"llama3.2-11b": "llama-3.2-11b-vision-preview",
"llama3.2-90b": "llama-3.2-90b-vision-preview",
"llama3.3-70b": "llama-3.3-70b-versatile",
};
protected _convertModelName(model: string): string {
return Groq.modelConversion[model] ?? model;

View file

@ -13,7 +13,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.16",
"@continuedev/config-yaml": "^1.0.23",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -3038,9 +3038,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.16.tgz",
"integrity": "sha512-r3dzTvL8aQ5RrzM+FX6fF+U12/crU4wpPXgDcDloSsxiOQfu3k/shLCbNzFPW57XhLUQAmUJYSZsJbIvYrNPNA==",
"version": "1.0.23",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz",
"integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.16",
"@continuedev/config-yaml": "^1.0.23",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -7,6 +7,7 @@ import type {
ContextProviderWithParams,
ContextSubmenuItem,
DiffLine,
DocsIndexingDetails,
FileSymbolMap,
IdeSettings,
LLMFullCompletionOptions,
@ -180,7 +181,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
"indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
"docs/getSuggestedDocs": [undefined, void];
"docs/initStatuses": [undefined, void];
"docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
addAutocompleteModel: [{ model: ModelDescription }, void];
"profiles/switch": [{ id: string }, undefined];

View file

@ -52,6 +52,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
"indexing/setPaused",
"docs/getSuggestedDocs",
"docs/initStatuses",
"docs/getDetails",
//
"completeOnboarding",
"addAutocompleteModel",

View file

@ -129,7 +129,8 @@ If your local machine can run an 8B parameter model, then we recommend running L
{
"title": "Llama 3.1 8B",
"provider": "ollama",
"model": "llama3.1:8b"
"model": "llama3.1:8b",
"apiBase": "http://localhost:11434"
}
]
```
@ -158,7 +159,8 @@ If your local machine can run a 16B parameter model, then we recommend running D
{
"title": "DeepSeek Coder 2 16B",
"provider": "ollama",
"model": "deepseek-coder-v2:16b"
"model": "deepseek-coder-v2:16b",
"apiBase": "http://localhost:11434"
}
]
```

View file

@ -58,16 +58,17 @@ This is just another object like the ones in the `"models"` array of `config.jso
This object allows you to customize the behavior of tab-autocomplete. The available options are shown below, and you can find their default values [here](https://github.com/continuedev/continue/blob/fbeb2e4fe15d4b434a30a136f74b672485c852d9/core/util/parameters.ts).
- `disable`: Disable autocomplete (can also be done from IDE settings)
- `disable`: Disable autocomplete (can also be done from IDE settings) (default: `false`)
- `template`: An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables. (String)
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean)
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)
- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number)
- `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number)
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number)
- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto".
- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes.
- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete.
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean) (default: `true`)
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number) (default: `1024`)
- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number) (default: `0.3`)
- `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number) (default: `0.2`)
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number) (default: `350`)
- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". (default: `auto`)
- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. (default: `true`)
- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete. (default: `[]`)
- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`).
### Full example

View file

@ -41,9 +41,9 @@ We recommend configuring **Claude 3.5 Sonnet** as your chat model.
## Autocomplete model
Bedrock currently does not offer any autocomplete models.
Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolisde](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future.
[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers.
In the meantime, you can view a list of autocomplete model providers [here](../../model-types/autocomplete.md).
## Embeddings model

View file

@ -83,16 +83,16 @@ Specifies options for tab autocompletion behavior.
**Properties:**
- `disable`: If `true`, disables tab autocomplete (default: `false`).
- `useFileSuffix`: If `true`, includes file suffix in the prompt.
- `maxPromptTokens`: Maximum number of tokens for the prompt.
- `debounceDelay`: Delay (in ms) before triggering autocomplete.
- `maxSuffixPercentage`: Maximum percentage of prompt for suffix.
- `prefixPercentage`: Percentage of input for prefix.
- `useFileSuffix`: If `true`, includes file suffix in the prompt (default: `true`).
- `maxPromptTokens`: Maximum number of tokens for the prompt (default: `1024`).
- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`).
- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`).
- `prefixPercentage`: Percentage of input for prefix (default: `0.3`).
- `template`: Template string for autocomplete, using Mustache templating. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables.
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`).
- `useCache`: If `true`, caches completions.
- `onlyMyCode`: If `true`, only includes code within the repository.
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled.
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`) (default: `auto`).
- `useCache`: If `true`, caches completions (default: `true`).
- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`).
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled (default: `[]`).
Example

View file

@ -151,8 +151,8 @@ Note that the `repoMapFileSelection` experimental model role has been deprecated
The JSON `contextProviders` field is replaced by the YAML `context` array.
- JSON `name` maps to `uses`
- JSON `params` map to `with`
- JSON `name` maps to `provider`
- JSON `params` map to `params`
**Before**
@ -181,14 +181,14 @@ The JSON `contextProviders` field is replaced by the YAML `context` array.
```yaml title="config.yaml"
context:
- uses: docs
- provider: docs
- uses: codebase
with:
- provider: codebase
params:
nRetrieve: 30
nFinal: 3
- uses: diff
- params: diff
```
### System Message
@ -337,7 +337,7 @@ The following top-level fields from `config.json` have been deprecated. Most UI-
- `customCommands`
- `disableSessionTitles`
- `experimental`
- `allowAnonymousTelemetry` (moved to user/IDE level)
- `allowAnonymousTelemetry` (automatically migrated to IDE settings)
- `ui` (moved to user/IDE level)
- `userToken`
- `disableIndexing` (moved to user/IDE level)

View file

@ -6,7 +6,7 @@ keywords: [config, yaml, configuration, customize, customization]
# Config YAML Reference
<!-- TODO - data and packages sections -->
<!-- TODO - data section -->
Continue can be configured using a YAML file `config.yaml` which for local configuration can be placed in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`)
@ -23,7 +23,6 @@ Config YAML does not work alongside `config.json` - it replaces it. View the **[
The top-level properties in the `config.yaml` configuration file are:
- [`name`](#name) (**required**)
<!-- - [`packages`](#packages) -->
- [`version`](#version) (**required**)
- [`models`](#models)
- [`context`](#context)
@ -120,22 +119,22 @@ More information about usage/params for each context provider can be found [here
**Properties:**
- `uses` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`).
- `with`: Optional parameters to configure the context provider's behavior.
- `provider` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`).
- `params`: Optional parameters to configure the context provider's behavior.
**Example:**
```yaml title="config.yaml"
context:
- uses: files
- uses: code
- uses: codebase
with:
- provider: files
- provider: code
- provider: codebase
params:
nFinal: 10
- uses: docs
- uses: diff
- uses: folder
- uses: terminal
- provider: docs
- provider: diff
- provider: folder
- provider: terminal
```
---
@ -301,12 +300,12 @@ prompts:
Please write a complete suite of unit tests for this function. You should use the Jest testing framework. The tests should cover all possible edge cases and should be as thorough as possible. You should also include a description of each test case.
context:
- uses: diff
- uses: file
- uses: codebase
- uses: code
- uses: docs
with:
- provider: diff
- provider: file
- provider: codebase
- provider: code
- provider: docs
params:
startUrl: https://docs.example.com/introduction
maxDepth: 3

View file

@ -83,16 +83,16 @@ Specifies options for tab autocompletion behavior.
**Properties:**
- `disable`: If `true`, disables tab autocomplete (default: `false`).
- `useFileSuffix`: If `true`, includes file suffix in the prompt.
- `maxPromptTokens`: Maximum number of tokens for the prompt.
- `debounceDelay`: Delay (in ms) before triggering autocomplete.
- `maxSuffixPercentage`: Maximum percentage of prompt for suffix.
- `prefixPercentage`: Percentage of input for prefix.
- `useFileSuffix`: If `true`, includes file suffix in the prompt (default: `true`).
- `maxPromptTokens`: Maximum number of tokens for the prompt (default: `1024`).
- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`).
- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`).
- `prefixPercentage`: Percentage of input for prefix (default: `0.3`).
- `template`: Template string for autocomplete, using Mustache templating.
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`).
- `useCache`: If `true`, caches completions.
- `onlyMyCode`: If `true`, only includes code within the repository.
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled.
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`) (default: `auto`).
- `useCache`: If `true`, caches completions (default: `true`).
- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`).
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled (default: `[]`).
Example

View file

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDE Logs" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="mkdir -p ./extensions/.continue-debug/logs &amp;&amp; touch ./extensions/.continue-debug/logs/prompt.log &amp;&amp; tail -f ./extensions/intellij/build/idea-sandbox/system/log/idea.log" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="mkdir -p ./extensions/.continue-debug/logs &amp;&amp; touch ./extensions/.continue-debug/logs/prompt.log &amp;&amp; tail -f ./extensions/.continue-debug/logs/prompt.log" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="false" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View file

@ -2,6 +2,7 @@
<configuration default="false" name="Run Continue" type="CompoundRunConfigurationType">
<toRun name="Run Extension" type="GradleRunConfiguration" />
<toRun name="Start Core Dev Server" type="NodeJSConfigurationType" />
<toRun name="IDE Logs" type="ShConfigurationType" />
<toRun name="Prompt Logs" type="ShConfigurationType" />
<toRun name="Start GUI Dev Server" type="ShConfigurationType" />
<method v="2" />

View file

@ -90,10 +90,7 @@ allow for changes to your `config.json` and other files during development, with
### Viewing logs
When using the `Run Continue` task, we automatically run a script that outputs logs into the "Prompt Logs" terminal tab.
Alternatively, you can view logs for a particular IDE instance by selecting `Help` -> `Open Log in Editor` in the window
toolbar.
When using the `Run Continue` task, we automatically tail both prompt logs and IDE logs.
### Reloading changes
@ -109,7 +106,9 @@ toolbar.
- `extensions/intellij`: Breakpoints can be set in Intellij
- `gui`: You'll need to set explicit `debugger` statements in the source code, or through the browser dev tools
- `core`: Breakpoints can be set in Intellij (requires restarting the `Start Core Dev Server` task
- `core`: Breakpoints can be set in Intellij (requires restarting the `Start Core Dev Server` task)
- If you have Community Edition installed, you won't be able to use breakpoints in IntelliJ. Instead, you can start
the `Core Binary` task in VS Code and set breakpoints in that IDE.
### Available Gradle tasks

View file

@ -54,8 +54,22 @@ class IdeProtocolClient(
val messageType = message.messageType
val dataElement = message.data
// A couple oddball messages respond directly to GUI, expect a different message format
// e.g. jetbrains/isOSREnabled
fun respondToWebview(content: Any) {
respond(mutableMapOf(
"done" to true,
"status" to "success",
"content" to content
))
}
try {
when (messageType) {
"toggleDevTools" -> {
continuePluginService.continuePluginWindow?.browser?.browser?.openDevtools()
}
"showTutorial" -> {
showTutorial(project)
}
@ -63,12 +77,12 @@ class IdeProtocolClient(
"jetbrains/isOSREnabled" -> {
val isOSREnabled =
ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR
respond(isOSREnabled)
respondToWebview(isOSREnabled)
}
"jetbrains/getColors" -> {
val colors = GetTheme().getTheme();
respond(colors)
respondToWebview(colors)
}
"jetbrains/onLoad" -> {
@ -78,7 +92,7 @@ class IdeProtocolClient(
"vscMachineId" to getMachineUniqueID(),
"vscMediaUrl" to "http://continue",
)
respond(jsonData)
respondToWebview(jsonData)
}
"getIdeSettings" -> {

View file

@ -69,8 +69,8 @@ models:
- apply
context:
- uses: docs
- uses: diff
- uses: url
- uses: folder
- uses: terminal
- provider: docs
- provider: diff
- provider: url
- provider: folder
- provider: terminal

View file

@ -1,19 +1,15 @@
import { expect } from "chai";
import {
EditorView,
WebView,
WebDriver,
Key,
VSBrowser,
InputBox,
TextEditor,
Workbench,
CodeLens,
} from "vscode-extension-tester";
import { EditActions } from "../actions/Edit.actions";
import { GlobalActions } from "../actions/Global.actions";
import { GUIActions } from "../actions/GUI.actions";
import { DEFAULT_TIMEOUT } from "../constants";
import { EditSelectors } from "../selectors/Edit.selectors";
import { GUISelectors } from "../selectors/GUI.selectors";
import { TestUtils } from "../TestUtils";
@ -58,9 +54,27 @@ describe("Edit Test", () => {
afterEach(async function () {
this.timeout(DEFAULT_TIMEOUT.XL);
await editor.clearText();
({ view } = await GUIActions.switchToReactIframe());
const tipTapEditor = await GUISelectors.getMessageInputFieldAtIndex(
view,
0,
);
await tipTapEditor.clear();
});
async function getCodeLensWithRetry(editor: TextEditor, text: string) {
let codeLens: CodeLens | undefined;
await TestUtils.waitForSuccess(async () => {
codeLens = await editor.getCodeLens(text);
expect(codeLens).to.not.be.undefined;
}, DEFAULT_TIMEOUT.SM);
return codeLens;
}
it("Accepts an Edit in the GUI", async () => {
({ view } = await GUIActions.switchToReactIframe());
@ -68,14 +82,14 @@ describe("Edit Test", () => {
await view.switchBack();
const editorText = await editor.getText();
await TestUtils.waitForSuccess(async () => {
const editorText = await editor.getText();
await TestUtils.waitForSuccess(
async () =>
expect(
!editorText.includes(originalEditorText) &&
editorText.includes(llmResponse),
DEFAULT_TIMEOUT.SM,
);
editorText.includes(llmResponse),
).to.be.true;
}, DEFAULT_TIMEOUT.SM);
}).timeout(DEFAULT_TIMEOUT.XL);
it("Rejects an Edit in the GUI", async () => {
@ -85,41 +99,41 @@ describe("Edit Test", () => {
await view.switchBack();
const editorText = await editor.getText();
await TestUtils.waitForSuccess(async () => {
const editorText = await editor.getText();
await TestUtils.waitForSuccess(
async () =>
expect(
editorText.includes(originalEditorText) &&
!editorText.includes(llmResponse),
DEFAULT_TIMEOUT.SM,
);
!editorText.includes(llmResponse),
).to.be.true;
}, DEFAULT_TIMEOUT.SM);
}).timeout(DEFAULT_TIMEOUT.XL);
it("Accepts an Edit using CodeLens buttons", async () => {
const acceptCodeLens = await editor.getCodeLens("Accept");
await acceptCodeLens?.click();
const editorText = await editor.getText();
await TestUtils.waitForSuccess(async () => {
const editorText = await editor.getText();
await TestUtils.waitForSuccess(
async () =>
expect(
!editorText.includes(originalEditorText) &&
editorText.includes(llmResponse),
DEFAULT_TIMEOUT.SM,
);
editorText.includes(llmResponse),
).to.be.true;
}, DEFAULT_TIMEOUT.SM);
}).timeout(DEFAULT_TIMEOUT.XL);
it("Rejects an Edit using CodeLens buttons", async () => {
const rejectCodeLens = await editor.getCodeLens("Reject");
it.only("Rejects an Edit using CodeLens buttons", async () => {
const rejectCodeLens = await getCodeLensWithRetry(editor, "Reject");
await rejectCodeLens?.click();
const editorText = await editor.getText();
await TestUtils.waitForSuccess(async () => {
const editorText = await editor.getText();
await TestUtils.waitForSuccess(
async () =>
!editorText.includes(originalEditorText) &&
editorText.includes(llmResponse),
DEFAULT_TIMEOUT.SM,
);
expect(
editorText.includes(originalEditorText) &&
!editorText.includes(llmResponse),
).to.be.true;
}, DEFAULT_TIMEOUT.SM);
}).timeout(DEFAULT_TIMEOUT.XL);
});

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.254",
"version": "0.9.255",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.254",
"version": "0.9.255",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
@ -106,7 +106,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.16",
"@continuedev/config-yaml": "^1.0.23",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.255",
"version": "0.9.258",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@ -96,16 +96,10 @@
"default": false,
"markdownDescription": "Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar."
},
"continue.continueTestEnvironment": {
"type": "string",
"enum": [
"none",
"production",
"test",
"local"
],
"default": "none",
"description": "Continue test environment"
"continue.enableContinueHub": {
"type": "boolean",
"default": false,
"description": "Enable Continue Hub (internal)"
},
"continue.showInlineTip": {
"type": "boolean",
@ -540,12 +534,12 @@
{
"command": "continue.signInToControlPlane",
"group": "navigation@5",
"when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && !continue.isSignedInToControlPlane"
"when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && !continue.isSignedInToControlPlane"
},
{
"command": "continue.openAccountDialog",
"group": "navigation@5",
"when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && continue.isSignedInToControlPlane"
"when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && continue.isSignedInToControlPlane"
},
{
"command": "continue.openMorePage",

View file

@ -636,9 +636,9 @@ class VsCodeIde implements IDE {
"enableContinueForTeams",
false,
),
continueTestEnvironment: settings.get<
IdeSettings["continueTestEnvironment"]
>("continueTestEnvironment", "none"),
continueTestEnvironment: settings.get<boolean>("enableContinueHub")
? "production"
: "none",
pauseCodebaseIndexOnStart: settings.get<boolean>(
"pauseCodebaseIndexOnStart",
false,

View file

@ -1,6 +1,6 @@
import fs from "fs";
import { IContextProvider, IdeSettings } from "core";
import { IContextProvider } from "core";
import { ConfigHandler } from "core/config/ConfigHandler";
import { EXTENSION_NAME, getControlPlaneEnv } from "core/control-plane/env";
import { Core } from "core/core";
@ -375,9 +375,9 @@ export class VsCodeExtension {
void this.core.invoke("didChangeActiveTextEditor", { filepath });
});
const originalValue = vscode.workspace
const enableContinueHub = vscode.workspace
.getConfiguration(EXTENSION_NAME)
.get<IdeSettings["continueTestEnvironment"]>("continueTestEnvironment");
.get<boolean>("enableContinueHub");
vscode.workspace.onDidChangeConfiguration(async (event) => {
if (event.affectsConfiguration(EXTENSION_NAME)) {
const settings = this.ide.getIdeSettingsSync();
@ -386,7 +386,11 @@ export class VsCodeExtension {
settings,
});
if (settings.continueTestEnvironment !== originalValue) {
if (
enableContinueHub
? settings.continueTestEnvironment !== "production"
: settings.continueTestEnvironment === "production"
) {
await vscode.commands.executeCommand("workbench.action.reloadWindow");
}
}

View file

@ -20,17 +20,15 @@ import {
workspace,
} from "vscode";
import { IdeSettings } from "core";
import { PromiseAdapter, promiseFromEvent } from "./promiseUtils";
import { SecretStorage } from "./SecretStorage";
const AUTH_NAME = "Continue";
const controlPlaneEnv = getControlPlaneEnvSync(
workspace
.getConfiguration(EXTENSION_NAME)
.get<IdeSettings["continueTestEnvironment"]>("continueTestEnvironment") ??
"none",
workspace.getConfiguration(EXTENSION_NAME).get<boolean>("enableContinueHub")
? "production"
: "none",
);
const SESSIONS_SECRET_KEY = `${controlPlaneEnv.AUTH_TYPE}.sessions`;

View file

@ -2,10 +2,7 @@ import * as fs from "fs";
import { ContinueServerClient } from "core/continueServer/stubs/client";
import { EXTENSION_NAME } from "core/control-plane/env";
import {
getConfigJsPathForRemote,
getConfigJsonPathForRemote,
} from "core/util/paths";
import { getConfigJsonPathForRemote } from "core/util/paths";
import * as vscode from "vscode";
import { CONTINUE_WORKSPACE_KEY } from "../util/workspaceConfig";
@ -126,16 +123,12 @@ export class RemoteConfigSync {
remoteConfigServerUrl.toString(),
userToken,
);
const { configJson, configJs } = await client.getConfig();
const { configJson } = await client.getConfig();
fs.writeFileSync(
getConfigJsonPathForRemote(remoteConfigServerUrl),
configJson,
);
fs.writeFileSync(
getConfigJsPathForRemote(remoteConfigServerUrl),
configJs,
);
this.triggerReloadConfig();
} catch (e) {
vscode.window.showWarningMessage(`Failed to sync remote config: ${e}`);

10
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.15",
"@continuedev/config-yaml": "^1.0.23",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -108,7 +108,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.16",
"@continuedev/config-yaml": "^1.0.23",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -556,9 +556,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.15",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.15.tgz",
"integrity": "sha512-00c1pz+FqAVEWLo8t71OJzm1KBAAJCXqIjd917Vy8lr7xO0Eoj42lo2GFlVRnqQ0hQvhFQ0s9onHhRag/phHZA==",
"version": "1.0.23",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz",
"integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.15",
"@continuedev/config-yaml": "^1.0.23",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -0,0 +1,138 @@
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
import { ChatHistoryItem } from "core";
import { stripImages } from "core/util/messageContent";
import { useEffect, useState } from "react";
import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
vscBackground,
vscQuickInputBackground,
} from "..";
import { getFontSize } from "../../util";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
interface ReasoningProps {
item: ChatHistoryItem;
index: number;
isLast: boolean;
}
const SpoilerButton = styled.div`
margin: 8px 6px 16px 6px;
background-color: ${vscBackground};
width: fit-content;
font-size: ${getFontSize() - 2}px;
border: 0.5px solid ${lightGray};
border-radius: ${defaultBorderRadius};
padding: 4px 8px;
color: ${lightGray};
cursor: pointer;
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.1),
0 1px 3px rgba(0, 0, 0, 0.08);
transition: box-shadow 0.3s ease;
&:hover {
box-shadow:
0 6px 8px rgba(0, 0, 0, 0.15),
0 3px 6px rgba(0, 0, 0, 0.1);
}
`;
const ButtonContent = styled.div`
display: flex;
align-items: center;
gap: 6px;
`;
const ContentDiv = styled.div<{ fontSize?: number }>`
margin: 4px;
padding: 4px;
padding-bottom: 8px;
font-size: ${getFontSize()}px;
overflow: hidden;
border-left: 4px solid ${lightGray};
border-radius: ${defaultBorderRadius};
background-color: ${vscQuickInputBackground};
`;
const ThinkingText = styled.span`
position: relative;
padding-right: 12px;
&:after {
content: "...";
position: absolute;
animation: ellipsis 1s steps(4, end) infinite;
width: 0px;
display: inline-block;
overflow: hidden;
}
@keyframes ellipsis {
0%,
100% {
width: 0px;
}
33% {
width: 8px;
}
66% {
width: 16px;
}
90% {
width: 24px;
}
}
`;
export default function Reasoning(props: ReasoningProps) {
const [open, setOpen] = useState(false);
const [reasoningTime, setReasoningTime] = useState("");
const isThinking = !props.item.reasoning?.endAt;
useEffect(() => {
if (!props.item.reasoning) return;
if (!props.item.reasoning?.endAt) return;
const startAt = props.item.reasoning?.startAt || Date.now();
const endAt = props.item.reasoning?.endAt || Date.now();
const diff = endAt - startAt;
const diffString = `${(diff / 1000).toFixed(1)}s`;
setReasoningTime(diffString);
}, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]);
if (!props.item.reasoning?.text) {
return null;
}
return (
<>
<SpoilerButton onClick={() => setOpen(!open)}>
<ButtonContent>
{isThinking ? (
<ThinkingText>Thinking</ThinkingText>
) : (
`Thought for ${reasoningTime}`
)}
{open ? (
<ChevronUpIcon className="h-3 w-3" />
) : (
<ChevronDownIcon className="h-3 w-3" />
)}
</ButtonContent>
</SpoilerButton>
{open && (
<ContentDiv>
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.reasoning.text)}
itemIndex={props.index}
useParentBackgroundColor
/>
</ContentDiv>
)}
</>
);
}

View file

@ -11,6 +11,7 @@ import { getFontSize } from "../../util";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
import ResponseActions from "./ResponseActions";
import ThinkingIndicator from "./ThinkingIndicator";
import Reasoning from "./Reasoning";
interface StepContainerProps {
item: ChatHistoryItem;
@ -90,11 +91,15 @@ export default function StepContainer(props: StepContainerProps) {
{renderChatMessage(props.item.message)}
</pre>
) : (
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.message.content)}
itemIndex={props.index}
/>
<>
<Reasoning {...props}/>
<StyledMarkdownPreview
isRenderingInStepContainer
source={stripImages(props.item.message.content)}
itemIndex={props.index}
/>
</>
)}
{props.isLast && <ThinkingIndicator historyItem={props.item} />}
</ContentDiv>

View file

@ -0,0 +1,176 @@
import {
CheckIcon,
InformationCircleIcon,
PencilIcon,
PlusIcon,
} from "@heroicons/react/24/outline";
import {
DocsIndexingDetails,
IndexingStatus,
PackageDocsResult,
SiteIndexingConfig,
} from "core";
import preIndexedDocs from "core/indexing/docs/preIndexedDocs";
import { usePostHog } from "posthog-js/react";
import {
useCallback,
useContext,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react";
import { useDispatch } from "react-redux";
import { Input, SecondaryButton } from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useAppSelector } from "../../redux/hooks";
import { updateConfig } from "../../redux/slices/configSlice";
import { updateIndexingStatus } from "../../redux/slices/indexingSlice";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import FileIcon from "../FileIcon";
import { ToolTip } from "../gui/Tooltip";
import DocsIndexingPeeks from "../indexing/DocsIndexingPeeks";
import { Tooltip } from "react-tooltip";
interface DocsDetailsDialogProps {
startUrl: string;
}
function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) {
const config = useAppSelector((store) => store.config.config);
const posthog = usePostHog();
const dispatch = useDispatch();
const ideMessenger = useContext(IdeMessengerContext);
const closeDialog = () => {
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
};
const [isLoading, setIsLoading] = useState(false);
const [isError, setIsError] = useState(false);
const [data, setData] = useState<DocsIndexingDetails | undefined>(undefined);
const fetchData = useCallback(async () => {
setIsLoading(true);
setIsError(false);
try {
const response = await ideMessenger.request("docs/getDetails", {
startUrl,
});
if (response.status === "error") {
throw new Error(response.error);
}
setData(response.content);
} catch (error) {
setIsError(true);
} finally {
setIsLoading(false);
}
}, []);
useEffect(() => {
fetchData();
}, []);
let comp = <div>Loading...</div>;
if (!isLoading) {
if (isError) {
comp = (
<div>
<div>Error fetching docs details</div>
<SecondaryButton onClick={fetchData}>Try again</SecondaryButton>
</div>
);
}
if (data) {
comp = (
<div className="flex flex-col gap-0.5">
<p className="m-0 mt-2 p-0 text-stone-500">{`Title: ${data.config.title}`}</p>
<p className="m-0 p-0 text-stone-500">{`Pre-indexed doc: ${data.isPreIndexedDoc}`}</p>
{!data.chunks?.length ? (
<div>No article chunks</div>
) : (
<div className="relative mt-2 h-[300px] overflow-auto">
<table className="w-full border-collapse">
<thead className="bg-vsc-background sticky top-0 text-left">
<tr>
<th className="py-1">Filepath</th>
<th>Content</th>
</tr>
</thead>
<tbody className="h-20 overflow-y-scroll">
{data.chunks.map((chunk, i) => {
const contentToolTipId = `docs-content-peek-${i}`;
const urlToolTipId = `docs-url-peek-${i}`;
return (
<>
<tr key={i} className="">
<td
className="cursor-pointer px-1"
data-tooltip-id={urlToolTipId}
data-tooltip-delay-show={500}
>
<span className="truncate-start max-w-[200px]">
{chunk.filepath}
</span>
</td>
<td
className="cursor-pointer px-1"
data-tooltip-id={contentToolTipId}
data-tooltip-delay-show={500}
>
<span className="lines lines-1">
{chunk.content}
</span>
</td>
</tr>
<Tooltip
id={urlToolTipId}
place="top"
className="max-w-full"
>
{chunk.filepath}
</Tooltip>
<Tooltip
id={contentToolTipId}
place="top"
className="max-h-[300px] max-w-[170px] overflow-y-auto"
>
{chunk.content}
</Tooltip>
</>
);
})}
</tbody>
</table>
</div>
)}
</div>
);
}
}
return (
<div className="px-2 py-4 sm:px-4">
<h3>Docs index</h3>
<p
className="m-0 mt-1 cursor-pointer p-0 text-stone-500 hover:underline"
onClick={(e) => {
e.stopPropagation();
ideMessenger.post("openUrl", startUrl);
}}
>
{startUrl}
</p>
{comp}
<div className="flex flex-row justify-end">
<SecondaryButton onClick={closeDialog}>Close</SecondaryButton>
</div>
</div>
);
}
export default DocsDetailsDialog;

View file

@ -6,6 +6,7 @@ import {
ArrowTopRightOnSquareIcon,
CheckCircleIcon,
ExclamationTriangleIcon,
EyeIcon,
PauseCircleIcon,
TrashIcon,
} from "@heroicons/react/24/outline";
@ -13,6 +14,7 @@ import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { updateIndexingStatus } from "../../redux/slices/indexingSlice";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import ConfirmationDialog from "../dialogs/ConfirmationDialog";
import DocsDetailsDialog from "./DocsDetailsDialog";
interface IndexingStatusViewerProps {
docConfig: SiteIndexingConfig;
@ -175,24 +177,40 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) {
pending: "",
}[status?.status]}
</span>
{status?.description === "Github rate limit exceeded" ? (
<span
className="lines lines-1 cursor-pointer text-right text-xs text-stone-500 underline"
onClick={() =>
ideMessenger.post(
"openUrl",
"https://docs.continue.dev/customize/deep-dives/docs#github",
)
}
>
{status.description}
</span>
) : (
<span className="lines lines-1 text-right text-xs text-stone-500">
{status?.description}
</span>
)}
<div className="flex flex-row items-center gap-1">
{status?.description === "Github rate limit exceeded" ? (
<span
className="lines lines-1 cursor-pointer text-right text-xs text-stone-500 underline"
onClick={() =>
ideMessenger.post(
"openUrl",
"https://docs.continue.dev/customize/deep-dives/docs#github",
)
}
>
{status.description}
</span>
) : (
<span className="lines lines-1 text-right text-xs text-stone-500">
{status?.description}
</span>
)}
{status?.status === "complete" ? (
<EyeIcon
className="h-4 w-4 cursor-pointer text-stone-500"
onClick={() => {
dispatch(setShowDialog(true));
dispatch(
setDialogMessage(
<DocsDetailsDialog startUrl={docConfig.startUrl} />,
),
);
}}
>
Add Docs
</EyeIcon>
) : null}
</div>
</div>
</div>
);

View file

@ -89,7 +89,7 @@ export const AddCodeToEdit = Node.create<MentionOptions>({
default: null,
parseHTML: (element) => element.getAttribute("data-renderInlineAs"),
renderHTML: (attributes) => {
if (!attributes.renderInlineAs) {
if (typeof attributes.renderInlineAs !== "string") {
return {};
}

View file

@ -116,7 +116,7 @@ export const Mention = Node.create<MentionOptions>({
default: null,
parseHTML: (element) => element.getAttribute("data-renderInlineAs"),
renderHTML: (attributes) => {
if (!attributes.renderInlineAs) {
if (typeof attributes.renderInlineAs !== "string") {
return {};
}

View file

@ -155,7 +155,6 @@ const ItemDiv = styled.div`
text-align: left;
width: 100%;
color: ${vscForeground};
cursor: pointer;
&.is-selected {
background-color: ${vscListActiveBackground};
@ -203,6 +202,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
const [querySubmenuItem, setQuerySubmenuItem] = useState<
ComboBoxItem | undefined
>(undefined);
const [loadingSubmenuItem, setLoadingSubmenuItem] = useState<
ComboBoxItem | undefined
>(undefined);
const [allItems, setAllItems] = useState<ComboBoxItem[]>([]);
@ -245,8 +247,8 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
description: "Create a new .prompt file",
});
}
setAllItems(items);
setLoadingSubmenuItem(items.find((item) => item.id === "loading"));
setAllItems(items.filter((item) => item.id !== "loading"));
}, [subMenuTitle, props.items, props.editor]);
const queryInputRef = useRef<HTMLTextAreaElement>(null);
@ -403,78 +405,98 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
) : (
<>
{subMenuTitle && <ItemDiv className="mb-2">{subMenuTitle}</ItemDiv>}
{allItems.length ? (
allItems.map((item, index) => (
<ItemDiv
as="button"
ref={(el) => (itemRefs.current[index] = el)}
className={`item ${
index === selectedIndex ? "is-selected" : ""
}`}
key={index}
onClick={() => selectItem(index)}
onMouseEnter={() => setSelectedIndex(index)}
data-testid="context-provider-dropdown-item"
>
<span className="flex w-full items-center justify-between">
<div className="flex items-center justify-center">
{showFileIconForItem(item) && (
<FileIcon
height="20px"
width="20px"
filename={item.description}
/>
)}
{!showFileIconForItem(item) && (
<>
<DropdownIcon item={item} className="mr-2" />
</>
)}
<span title={item.id}>{item.title}</span>
{" "}
</div>
<span
style={{
color: lightGray,
float: "right",
textAlign: "right",
opacity: index !== selectedIndex ? 0 : 1,
minWidth: "30px",
}}
className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap"
>
{item.description}
{item.type === "contextProvider" &&
item.contextProvider?.type === "submenu" && (
<ArrowRightIcon
className="ml-2 flex-shrink-0"
width="1.2em"
height="1.2em"
/>
)}
{item.subActions?.map((subAction) => {
const Icon = getIconFromDropdownItem(
subAction.icon,
"action",
);
return (
<HeaderButtonWithToolTip
onClick={(e) => {
subAction.action(item);
e.stopPropagation();
e.preventDefault();
props.onClose();
}}
text={undefined}
>
<Icon width="1.2em" height="1.2em" />
</HeaderButtonWithToolTip>
);
})}
</span>
{loadingSubmenuItem && (
<ItemDiv>
<span className="flex w-full items-center justify-between">
<div className="flex items-center justify-center">
<DropdownIcon item={loadingSubmenuItem} className="mr-2" />
<span>{loadingSubmenuItem.title}</span>
{" "}
</div>
<span
style={{
color: lightGray,
float: "right",
textAlign: "right",
minWidth: "30px",
}}
className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap text-xs"
>
{loadingSubmenuItem.description}
</span>
</ItemDiv>
))
</span>
</ItemDiv>
)}
{allItems.length ? (
allItems.map((item, index) => {
const isSelected = index === selectedIndex;
return (
<ItemDiv
as="button"
ref={(el) => (itemRefs.current[index] = el)}
className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`}
key={index}
onClick={() => selectItem(index)}
onMouseEnter={() => setSelectedIndex(index)}
data-testid="context-provider-dropdown-item"
>
<span className="flex w-full items-center justify-between">
<div className="flex items-center justify-center">
{showFileIconForItem(item) ? (
<FileIcon
height="20px"
width="20px"
filename={item.description}
/>
) : (
<DropdownIcon item={item} className="mr-2" />
)}
<span title={item.id}>{item.title}</span>
{" "}
</div>
<span
style={{
color: lightGray,
float: "right",
textAlign: "right",
opacity: isSelected ? 1 : 0,
minWidth: "30px",
}}
className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap text-xs"
>
{item.description}
{item.type === "contextProvider" &&
item.contextProvider?.type === "submenu" && (
<ArrowRightIcon
className="ml-2 flex-shrink-0"
width="1.2em"
height="1.2em"
/>
)}
{item.subActions?.map((subAction) => {
const Icon = getIconFromDropdownItem(
subAction.icon,
"action",
);
return (
<HeaderButtonWithToolTip
onClick={(e) => {
subAction.action(item);
e.stopPropagation();
e.preventDefault();
props.onClose();
}}
text={undefined}
>
<Icon width="1.2em" height="1.2em" />
</HeaderButtonWithToolTip>
);
})}
</span>
</span>
</ItemDiv>
);
})
) : (
<ItemDiv className="item">No results</ItemDiv>
)}

View file

@ -53,7 +53,6 @@ async function resolveEditorContent({
for (const p of editorState.content) {
if (p.type === "paragraph") {
const [text, ctxItems, foundSlashCommand] = resolveParagraph(p);
// Only take the first slash command\
if (foundSlashCommand && typeof slashCommand === "undefined") {
slashCommand = foundSlashCommand;
@ -240,7 +239,7 @@ function resolveParagraph(
export function hasSlashCommandOrContextProvider(
editorState: JSONContent,
): boolean {
if (!editorState.content) {
if (!editorState?.content) {
return false;
}

View file

@ -34,6 +34,7 @@ import { remarkTables } from "./utils/remarkTables";
const StyledMarkdown = styled.div<{
fontSize?: number;
whiteSpace: string;
bgColor: string;
}>`
pre {
white-space: ${(props) => props.whiteSpace};
@ -63,7 +64,7 @@ const StyledMarkdown = styled.div<{
color: #f78383;
}
background-color: ${vscBackground};
background-color: ${(props) => props.bgColor};
font-family:
var(--vscode-font-family),
system-ui,
@ -104,6 +105,7 @@ interface StyledMarkdownPreviewProps {
isRenderingInStepContainer?: boolean; // Currently only used to control the rendering of codeblocks
scrollLocked?: boolean;
itemIndex?: number;
useParentBackgroundColor?: boolean;
}
const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-";
@ -332,7 +334,11 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const uiConfig = useAppSelector(selectUIConfig);
const codeWrapState = uiConfig?.codeWrap ? "pre-wrap" : "pre";
return (
<StyledMarkdown fontSize={getFontSize()} whiteSpace={codeWrapState}>
<StyledMarkdown
fontSize={getFontSize()}
whiteSpace={codeWrapState}
bgColor={props.useParentBackgroundColor ? "" : vscBackground}
>
{reactContent}
</StyledMarkdown>
);

View file

@ -332,7 +332,9 @@ function ModelSelect() {
$showabove={showAbove}
className="z-50 max-w-[90vw]"
>
<div className={`max-h-[${MAX_HEIGHT_PX}px]`}>
<div
className={`max-h-[${MAX_HEIGHT_PX}px] no-scrollbar overflow-y-scroll`}
>
{sortedOptions.map((option, idx) => (
<ModelOption
option={option}
@ -345,6 +347,8 @@ function ModelSelect() {
</div>
<div className="mt-auto">
<Divider className="!my-0" />
{selectedProfileId === "local" && (
<>
<StyledListboxOption

View file

@ -116,7 +116,10 @@ export const SubmenuContextProvidersProvider = ({
};
}, [ideMessenger]);
const providersLoading = useRef(new Set<string>()).current;
const providersLoading = useRef(new Set<ContextProviderName>()).current;
const abortControllers = useRef(
new Map<ContextProviderName, AbortController>(),
).current;
const getSubmenuContextItems = useCallback(
(
@ -217,94 +220,116 @@ export const SubmenuContextProvidersProvider = ({
);
const loadSubmenuItems = useCallback(
(providers: "dependsOnIndexing" | "all" | ContextProviderName[]) => {
submenuContextProviders.forEach(
async (description: ContextProviderDescription) => {
try {
if (providersLoading.has(description.title)) {
return;
}
providersLoading.add(description.title);
async (providers: "dependsOnIndexing" | "all" | ContextProviderName[]) => {
await Promise.allSettled(
submenuContextProviders.map(
async (description: ContextProviderDescription) => {
const controller = new AbortController();
try {
const refreshProvider =
providers === "all"
? true
: providers === "dependsOnIndexing"
? description.dependsOnIndexing
: providers.includes(description.title);
const refreshProvider =
providers === "all"
? true
: providers === "dependsOnIndexing"
? description.dependsOnIndexing
: providers.includes(description.title);
if (!refreshProvider) {
if (providers === "dependsOnIndexing") {
console.debug(
`Skipping ${description.title} provider due to disabled indexing`,
);
}
return;
}
if (!refreshProvider) {
return;
}
if (description.dependsOnIndexing && disableIndexing) {
console.debug(
`Skipping ${description.title} provider due to disabled indexing`,
// Submenu loading requests cancel existing requests
abortControllers.get(description.title)?.abort();
abortControllers.set(description.title, controller);
providersLoading.add(description.title);
console.log(
`Refreshing items for ${description.title} submenu provider`,
);
const result = await ideMessenger.request(
"context/loadSubmenuItems",
{
title: description.title,
},
);
return;
}
const result = await ideMessenger.request(
"context/loadSubmenuItems",
{
title: description.title,
},
);
if (result.status === "error") {
throw new Error(result.error);
}
const submenuItems = result.content;
const providerTitle = description.title;
// IMPORTANT - the controller only prevents invalid loading state
// But does not cancel using data from the request
// Could uncomment this to truly cancel the request
// if (controller.signal.aborted) {
// return console.debug(
// `${description.title} provider loading aborted`,
// );
// }
const itemsWithProvider = submenuItems.map((item) => ({
...item,
providerTitle,
}));
if (result.status === "error") {
throw new Error(result.error);
}
const submenuItems = result.content;
const providerTitle = description.title;
const minisearch = new MiniSearch<ContextSubmenuItemWithProvider>({
fields: ["title", "description"],
storeFields: ["id", "title", "description", "providerTitle"],
});
minisearch.addAll(
submenuItems.map((item) => ({ ...item, providerTitle })),
);
setMinisearches((prev) => ({
...prev,
[providerTitle]: minisearch,
}));
if (providerTitle === "file") {
setFallbackResults((prev) => ({
...prev,
file: deduplicateArray(
[...lastOpenFilesRef.current, ...(prev.file ?? [])],
(a, b) => a.id === b.id,
),
const itemsWithProvider = submenuItems.map((item) => ({
...item,
providerTitle,
}));
} else {
setFallbackResults((prev) => ({
const minisearch = new MiniSearch<ContextSubmenuItemWithProvider>(
{
fields: ["title", "description"],
storeFields: ["id", "title", "description", "providerTitle"],
},
);
minisearch.addAll(
submenuItems.map((item) => ({ ...item, providerTitle })),
);
setMinisearches((prev) => ({
...prev,
[providerTitle]: itemsWithProvider,
[providerTitle]: minisearch,
}));
if (providerTitle === "file") {
setFallbackResults((prev) => ({
...prev,
file: deduplicateArray(
[...lastOpenFilesRef.current, ...(prev.file ?? [])],
(a, b) => a.id === b.id,
),
}));
} else {
setFallbackResults((prev) => ({
...prev,
[providerTitle]: itemsWithProvider,
}));
}
} catch (error) {
console.error(
`Error loading items for ${description.title}:`,
error,
);
console.error(
"Error details:",
JSON.stringify(error, Object.getOwnPropertyNames(error)),
);
} finally {
if (!controller.signal.aborted) {
providersLoading.delete(description.title);
}
}
} catch (error) {
console.error(
`Error loading items for ${description.title}:`,
error,
);
console.error(
"Error details:",
JSON.stringify(error, Object.getOwnPropertyNames(error)),
);
} finally {
providersLoading.delete(description.title);
}
},
},
),
);
},
[submenuContextProviders, disableIndexing, providersLoading],
[
submenuContextProviders,
disableIndexing,
providersLoading,
abortControllers,
],
);
useWebviewListener(
@ -318,14 +343,13 @@ export const SubmenuContextProvidersProvider = ({
// Reload all submenu items on the initial config load
// TODO - could refresh on any change
const initialLoad = useRef(false);
const config = useAppSelector((store) => store.config.config);
useEffect(() => {
if (!config?.contextProviders?.length || initialLoad.current) {
if (!submenuContextProviders.length || initialLoad.current) {
return;
}
void loadSubmenuItems("all");
initialLoad.current = true;
}, [loadSubmenuItems, config, initialLoad]);
}, [loadSubmenuItems, submenuContextProviders, initialLoad]);
return (
<SubmenuContextProvidersContext.Provider

View file

@ -92,3 +92,13 @@ body {
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.truncate-start {
display: inline-block;
vertical-align: middle;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
direction: rtl;
width: 100%;
}

View file

@ -362,9 +362,26 @@ export const sessionSlice = createSlice({
} else {
// Add to the existing message
if (message.content) {
// Note this only works because new message above
// was already rendered from parts to string
lastMessage.content += renderChatMessage(message);
const messageContent = renderChatMessage(message);
if (messageContent.includes("<think>")) {
lastItem.reasoning = {
startAt: Date.now(),
active: true,
text: messageContent.replace("<think>", "").trim(),
}
} else if (lastItem.reasoning?.active && messageContent.includes("</think>")) {
const [reasoningEnd, answerStart] = messageContent.split("</think>");
lastItem.reasoning.text += reasoningEnd.trimEnd();
lastItem.reasoning.active = false;
lastItem.reasoning.endAt = Date.now();
lastMessage.content += answerStart.trimStart();
} else if (lastItem.reasoning?.active) {
lastItem.reasoning.text += messageContent;
} else {
// Note this only works because new message above
// was already rendered from parts to string
lastMessage.content += messageContent;
}
} else if (
message.role === "assistant" &&
message.toolCalls?.[0] &&

View file

@ -36,6 +36,7 @@ const saveSubsetFilters = [
createFilter("editModeState", []),
createFilter("config", ["defaultModelTitle"]),
createFilter("ui", ["toolSettings", "useTools"]),
createFilter("indexing", []),
];
const migrations: MigrationManifest = {

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.16",
"version": "1.0.23",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -3,6 +3,7 @@ export * from "./interfaces/index.js";
export * from "./interfaces/SecretResult.js";
export * from "./interfaces/slugs.js";
export * from "./load/clientRender.js";
export * from "./load/getBlockType.js";
export * from "./load/merge.js";
export * from "./load/proxySecretResolution.js";
export * from "./load/unroll.js";

View file

@ -4,6 +4,7 @@ export enum SecretType {
User = "user",
Package = "package",
Organization = "organization",
NotFound = "not_found",
}
export interface OrgSecretLocation {
@ -24,18 +25,34 @@ export interface UserSecretLocation {
secretName: string;
}
/**
* If not found in user/package/org secrets, then there's a chance it's in
* - the on-prem proxy
* - models add-on
* - free trial
*/
export interface NotFoundSecretLocation {
secretType: SecretType.NotFound;
secretName: string;
}
export type SecretLocation =
| OrgSecretLocation
| PackageSecretLocation
| UserSecretLocation;
| UserSecretLocation
| NotFoundSecretLocation;
export function encodeSecretLocation(secretLocation: SecretLocation): string {
if (secretLocation.secretType === SecretType.Organization) {
return `${SecretType.Organization}:${secretLocation.orgSlug}/${secretLocation.secretName}`;
} else if (secretLocation.secretType === SecretType.User) {
return `${SecretType.User}:${secretLocation.userSlug}/${secretLocation.secretName}`;
} else {
} else if (secretLocation.secretType === SecretType.Package) {
return `${SecretType.Package}:${encodePackageSlug(secretLocation.packageSlug)}/${secretLocation.secretName}`;
} else if (secretLocation.secretType === SecretType.NotFound) {
return `${SecretType.NotFound}:${secretLocation.secretName}`;
} else {
throw new Error(`Invalid secret type: ${secretLocation}`);
}
}
@ -63,6 +80,11 @@ export function decodeSecretLocation(secretLocation: string): SecretLocation {
packageSlug: { ownerSlug: parts[0], packageSlug: parts[1] },
secretName,
};
case SecretType.NotFound:
return {
secretType: SecretType.NotFound,
secretName,
};
default:
throw new Error(`Invalid secret type: ${secretType}`);
}
@ -70,6 +92,7 @@ export function decodeSecretLocation(secretLocation: string): SecretLocation {
export interface NotFoundSecretResult {
found: false;
secretLocation: NotFoundSecretLocation;
fqsn: FQSN;
}

View file

@ -69,7 +69,7 @@ export async function resolveFQSN(
secretLocation,
value: secret,
};
} else {
} else if (secretLocation.secretType !== SecretType.NotFound) {
return {
found: true,
fqsn,
@ -81,6 +81,10 @@ export async function resolveFQSN(
return {
found: false,
secretLocation: {
secretName: fqsn.secretName,
secretType: SecretType.NotFound,
},
fqsn,
};
}

View file

@ -5,18 +5,18 @@ import {
SecretLocation,
} from "../interfaces/SecretResult.js";
import { decodeFQSN, encodeFQSN, FQSN } from "../interfaces/slugs.js";
import { ConfigYaml } from "../schemas/index.js";
import { AssistantUnrolled } from "../schemas/index.js";
import {
fillTemplateVariables,
getTemplateVariables,
parseConfigYaml,
parseAssistantUnrolled,
} from "./unroll.js";
export async function clientRender(
unrolledConfigContent: string,
secretStore: SecretStore,
platformClient?: PlatformClient,
): Promise<ConfigYaml> {
): Promise<AssistantUnrolled> {
// 1. First we need to get a list of all the FQSNs that are required to render the config
const secrets = getTemplateVariables(unrolledConfigContent);
@ -45,14 +45,6 @@ export async function clientRender(
continue;
}
if (!secretResult.found) {
// When a secret isn't found anywhere, we keep it templated as just the secret name
// in case it can be found in the on-prem proxy's env
secretsTemplateData["secrets." + encodeFQSN(secretResult.fqsn)] =
`\${{ secrets.${secretResult.fqsn.secretName} }}`;
continue;
}
if ("value" in secretResult) {
secretStore.set(secretResult.fqsn.secretName, secretResult.value);
}
@ -71,7 +63,7 @@ export async function clientRender(
);
// 6. The rendered YAML is parsed and validated again
const parsedYaml = parseConfigYaml(renderedYaml);
const parsedYaml = parseAssistantUnrolled(renderedYaml);
// 7. We update any of the items with the proxy version if there are un-rendered secrets
const finalConfig = useProxyForUnrenderedSecrets(parsedYaml);
@ -102,7 +94,9 @@ function getUnrenderedSecretLocation(
return undefined;
}
function useProxyForUnrenderedSecrets(config: ConfigYaml): ConfigYaml {
function useProxyForUnrenderedSecrets(
config: AssistantUnrolled,
): AssistantUnrolled {
if (config.models) {
for (let i = 0; i < config.models.length; i++) {
const apiKeyLocation = getUnrenderedSecretLocation(

View file

@ -0,0 +1,32 @@
import { ConfigYaml } from "../schemas/index.js";
export type BlockType =
| "models"
| "context"
| "docs"
| "tools"
| "mcpServers"
| "data"
| "rules"
| "prompts";
export function getBlockType(block: ConfigYaml): BlockType {
if (block.context?.length) {
return "context";
} else if (block.models?.length) {
return "models";
} else if (block.docs?.length) {
return "docs";
} else if (block.tools?.length) {
return "tools";
} else if (block.mcpServers?.length) {
return "mcpServers";
} else if (block.data?.length) {
return "data";
} else if (block.rules?.length) {
return "rules";
} else if (block.prompts?.length) {
return "prompts";
} else {
throw new Error("Unknown block type");
}
}

View file

@ -1,12 +1,19 @@
import * as YAML from "yaml";
import { Registry } from "../interfaces/index.js";
import {
PackageSlug,
decodeFullSlug,
encodePackageSlug,
FullSlug,
PackageSlug,
} from "../interfaces/slugs.js";
import { ConfigYaml, configYamlSchema } from "../schemas/index.js";
import { mergePackages } from "./merge.js";
import {
AssistantUnrolled,
assistantUnrolledSchema,
Block,
blockSchema,
ConfigYaml,
configYamlSchema,
} from "../schemas/index.js";
export function parseConfigYaml(configYaml: string): ConfigYaml {
try {
@ -14,7 +21,28 @@ export function parseConfigYaml(configYaml: string): ConfigYaml {
const result = configYamlSchema.parse(parsed);
return result;
} catch (e: any) {
throw new Error(`Failed to parse config yaml: ${e.message}`);
console.log(configYaml);
throw new Error(`Failed to parse rolled assistant: ${e.message}`);
}
}
export function parseAssistantUnrolled(configYaml: string): AssistantUnrolled {
try {
const parsed = YAML.parse(configYaml);
const result = assistantUnrolledSchema.parse(parsed);
return result;
} catch (e: any) {
throw new Error(`Failed to parse unrolled assistant: ${e.message}`);
}
}
export function parseBlock(configYaml: string): Block {
try {
const parsed = YAML.parse(configYaml);
const result = blockSchema.parse(parsed);
return result;
} catch (e: any) {
throw new Error(`Failed to parse block: ${e.message}`);
}
}
@ -43,29 +71,8 @@ export function fillTemplateVariables(
});
}
export async function unrollImportedPackage(
pkgImport: NonNullable<ConfigYaml["packages"]>[number],
parentPackages: PackageSlug[],
registry: Registry,
): Promise<ConfigYaml> {
const { uses, with: params } = pkgImport;
const fullSlug = decodeFullSlug(uses);
// Request the content from the registry
const rawContent = await registry.getContent(fullSlug);
// Convert the raw YAML to unrolled config
return await unrollPackageFromContent(
rawContent,
params,
parentPackages,
registry,
);
}
export interface TemplateData {
params: Record<string, string> | undefined;
inputs: Record<string, string> | undefined;
secrets: Record<string, string> | undefined;
continue: {};
}
@ -75,9 +82,9 @@ function flattenTemplateData(
): Record<string, string> {
const flattened: Record<string, string> = {};
if (templateData.params) {
for (const [key, value] of Object.entries(templateData.params)) {
flattened[`params.${key}`] = value;
if (templateData.inputs) {
for (const [key, value] of Object.entries(templateData.inputs)) {
flattened[`inputs.${key}`] = value;
}
}
if (templateData.secrets) {
@ -116,57 +123,159 @@ function extractFQSNMap(
return secretToFQSNMap(secrets, parentPackages);
}
export async function unrollPackageFromContent(
rawContent: string,
params: Record<string, string> | undefined,
packagePath: PackageSlug[],
export async function unrollAssistant(
fullSlug: string,
registry: Registry,
): Promise<ConfigYaml> {
// Collect template data
): Promise<AssistantUnrolled> {
const assistantSlug = decodeFullSlug(fullSlug);
// Request the content from the registry
const rawContent = await registry.getContent(assistantSlug);
return unrollAssistantFromContent(assistantSlug, rawContent, registry);
}
export async function unrollAssistantFromContent(
assistantSlug: FullSlug,
rawYaml: string,
registry: Registry,
): Promise<AssistantUnrolled> {
// Convert the raw YAML to unrolled config
const templateData: TemplateData = {
// params are passed from the parent package
params: params,
// no inputs to an assistant
inputs: {},
// at this stage, secrets are mapped to a (still templated) FQSN
secrets: extractFQSNMap(rawContent, packagePath),
secrets: extractFQSNMap(rawYaml, [assistantSlug]),
// Built-in variables
continue: {},
};
// Render the template
const templatedYaml = fillTemplateVariables(
rawContent,
rawYaml,
flattenTemplateData(templateData),
);
// Parse string to Zod-validated YAML
let parsedYaml = parseConfigYaml(templatedYaml);
const unrolledChildPackages = await Promise.all(
parsedYaml.packages?.map((pkg) => {
const pkgSlug = decodeFullSlug(pkg.uses);
return unrollImportedPackage(pkg, [...packagePath, pkgSlug], registry);
}) ?? [],
// Unroll blocks
const unrolledAssistant = await unrollBlocks(
parsedYaml,
assistantSlug,
registry,
);
delete parsedYaml.packages;
for (const childPkg of unrolledChildPackages) {
parsedYaml = mergePackages(parsedYaml, childPkg);
return unrolledAssistant;
}
export async function unrollBlocks(
assistant: ConfigYaml,
assistantFullSlug: FullSlug,
registry: Registry,
): Promise<AssistantUnrolled> {
const unrolledAssistant: AssistantUnrolled = {
name: assistant.name,
version: assistant.version,
};
const sections: (keyof Omit<ConfigYaml, "name" | "version" | "rules">)[] = [
"models",
"context",
"data",
"tools",
"mcpServers",
"prompts",
"docs",
];
// For each section, replace "uses/with" blocks with the real thing
for (const section of sections) {
if (assistant[section]) {
const sectionBlocks: any[] = [];
for (const unrolledBlock of assistant[section]) {
// "uses/with" block
if ("uses" in unrolledBlock) {
const blockConfigYaml = await resolveBlock(
decodeFullSlug(unrolledBlock.uses),
unrolledBlock.with,
assistantFullSlug,
registry,
);
const block = blockConfigYaml[section]?.[0];
if (block) {
sectionBlocks.push(
mergeOverrides(block, unrolledBlock.override ?? {}),
);
}
} else {
// Normal block
sectionBlocks.push(unrolledBlock);
}
}
unrolledAssistant[section] = sectionBlocks;
}
}
// Rules are a bit different because they're just strings, so handle separately
if (assistant.rules) {
const rules: string[] = [];
for (const rule of assistant.rules) {
if (typeof rule === "string") {
rules.push(rule);
} else {
const blockConfigYaml = await resolveBlock(
decodeFullSlug(rule.uses),
rule.with,
assistantFullSlug,
registry,
);
const block = blockConfigYaml.rules?.[0];
if (block) {
rules.push(block);
}
}
}
unrolledAssistant.rules = rules;
}
return unrolledAssistant;
}
export async function resolveBlock(
fullSlug: FullSlug,
inputs: Record<string, string> | undefined,
parentFullSlug: FullSlug,
registry: Registry,
): Promise<AssistantUnrolled> {
// Retrieve block raw yaml
const rawYaml = await registry.getContent(fullSlug);
// Render template variables
const templateData: TemplateData = {
inputs,
secrets: extractFQSNMap(rawYaml, [parentFullSlug, fullSlug]),
continue: {},
};
const templatedYaml = fillTemplateVariables(
rawYaml,
flattenTemplateData(templateData),
);
const parsedYaml = parseBlock(templatedYaml);
return parsedYaml;
}
/**
* Loading an assistant is equivalent to loading a package without params
*/
export async function unrollAssistant(
fullSlug: string,
registry: Registry,
): Promise<ConfigYaml> {
const packageSlug = decodeFullSlug(fullSlug);
return await unrollImportedPackage(
{
uses: fullSlug,
},
[packageSlug],
registry,
);
export function mergeOverrides<T extends Record<string, any>>(
block: T,
overrides: Partial<T>,
): T {
for (const key in overrides) {
if (overrides.hasOwnProperty(key)) {
block[key] = overrides[key]!;
}
}
return block;
}

View file

@ -1,25 +1,21 @@
import * as z from "zod";
import { modelSchema } from "./models.js";
const packageSchema = z.object({
uses: z.string(),
with: z.any().optional(),
});
import { modelSchema, partialModelSchema } from "./models.js";
export const dataSchema = z.object({
provider: z.string(),
destination: z.string(),
levels: z.string().optional(),
});
export const contextSchema = z.object({
uses: z.string(),
with: z.any().optional(),
provider: z.string(),
params: z.any().optional(),
});
const toolSchema = z.object({
name: z.string(),
description: z.string(),
url: z.string(),
apiKey: z.string().optional(),
run: z.string(),
params: z.any().optional(),
});
const mcpServerSchema = z.object({
@ -42,10 +38,55 @@ const docSchema = z.object({
faviconUrl: z.string().optional(),
});
export const blockItemWrapperSchema = <T extends z.AnyZodObject>(schema: T) =>
z.object({
uses: z.string(),
with: z.record(z.string()).optional(),
override: schema.partial().optional(),
});
export const blockOrSchema = <T extends z.AnyZodObject>(schema: T) =>
z.union([schema, blockItemWrapperSchema(schema)]);
export const configYamlSchema = z.object({
name: z.string(),
version: z.string(),
packages: z.array(packageSchema).optional(),
models: z
.array(
z.union([
modelSchema,
z.object({
uses: z.string(),
with: z.record(z.string()).optional(),
override: partialModelSchema.optional(),
}),
]),
)
.optional(),
context: z.array(blockOrSchema(contextSchema)).optional(),
data: z.array(blockOrSchema(dataSchema)).optional(),
tools: z.array(blockOrSchema(toolSchema)).optional(),
mcpServers: z.array(blockOrSchema(mcpServerSchema)).optional(),
rules: z
.array(
z.union([
z.string(),
z.object({
uses: z.string(),
with: z.record(z.string()).optional(),
}),
]),
)
.optional(),
prompts: z.array(blockOrSchema(promptSchema)).optional(),
docs: z.array(blockOrSchema(docSchema)).optional(),
});
export type ConfigYaml = z.infer<typeof configYamlSchema>;
export const assistantUnrolledSchema = z.object({
name: z.string(),
version: z.string(),
models: z.array(modelSchema).optional(),
context: z.array(contextSchema).optional(),
data: z.array(dataSchema).optional(),
@ -56,10 +97,24 @@ export const configYamlSchema = z.object({
docs: z.array(docSchema).optional(),
});
export type ConfigYaml = z.infer<typeof configYamlSchema>;
export type AssistantUnrolled = z.infer<typeof assistantUnrolledSchema>;
export const unrolledConfigYamlSchema = configYamlSchema.omit({
packages: true,
});
export const blockSchema = z
.object({
name: z.string(),
version: z.string(),
})
.and(
z.union([
z.object({ models: z.array(modelSchema).length(1) }),
z.object({ context: z.array(contextSchema).length(1) }),
z.object({ data: z.array(dataSchema).length(1) }),
z.object({ tools: z.array(toolSchema).length(1) }),
z.object({ mcpServers: z.array(mcpServerSchema).length(1) }),
z.object({ rules: z.array(z.string()).length(1) }),
z.object({ prompts: z.array(promptSchema).length(1) }),
z.object({ docs: z.array(docSchema).length(1) }),
]),
);
export type UnrolledConfigYaml = z.infer<typeof unrolledConfigYamlSchema>;
export type Block = z.infer<typeof blockSchema>;

View file

@ -64,4 +64,20 @@ export const modelSchema = z.union([
}),
]);
export const partialModelSchema = z.union([
z
.object({
...baseModelFields,
provider: z.literal("continue-proxy"),
apiKeyLocation: z.string(),
})
.partial(),
z
.object({
...baseModelFields,
provider: z.string().refine((val) => val !== "continue-proxy"),
})
.partial(),
]);
export type ModelConfig = z.infer<typeof modelSchema>;

View file

@ -28,6 +28,9 @@ export function validateConfigYaml(
}
config.models?.forEach((model) => {
if ("uses" in model) {
return;
}
// Max tokens not too close to context length
if (
model.defaultCompletionOptions?.contextLength &&

View file

@ -29,7 +29,7 @@ describe("E2E Scenarios", () => {
const packageSecrets: Record<string, string> = {
"test-org/assistant/ANTHROPIC_API_KEY": "sk-ant",
"test-org/models/GEMINI_API_KEY": "gemini-api-key",
"test-org/gemini/GEMINI_API_KEY": "gemini-api-key",
};
const proxyEnvSecrets: Record<string, string> = {
@ -100,22 +100,24 @@ describe("E2E Scenarios", () => {
);
// Test that packages were correctly unrolled and params replaced
expect(unrolledConfig.models?.length).toBe(4);
expect(unrolledConfig.models?.length).toBe(3);
expect(unrolledConfig.models?.[0].apiKey).toBe(
"${{ secrets.test-org/assistant/OPENAI_API_KEY }}",
);
expect(unrolledConfig.models?.[1].apiKey).toBe("sk-456");
expect(unrolledConfig.models?.[2].apiKey).toBe(
"${{ secrets.test-org/assistant/test-org/models/ANTHROPIC_API_KEY }}",
expect(unrolledConfig.models?.[1].apiKey).toBe(
"${{ secrets.test-org/assistant/test-org/gemini/GEMINI_API_KEY }}",
);
expect(unrolledConfig.models?.[3].apiKey).toBe(
"${{ secrets.test-org/assistant/test-org/models/GEMINI_API_KEY }}",
expect(unrolledConfig.models?.[2].apiKey).toBe(
"${{ secrets.test-org/assistant/ANTHROPIC_API_KEY }}",
);
expect(unrolledConfig.rules?.length).toBe(3);
expect(unrolledConfig.rules?.length).toBe(2);
expect(unrolledConfig.docs?.[0].startUrl).toBe(
"https://docs.python.org/release/3.13.1",
);
expect(unrolledConfig.docs?.[0].rootUrl).toBe(
"https://docs.python.org/release/3.13.1",
);
const clientRendered = await clientRender(
YAML.stringify(unrolledConfig),
@ -126,19 +128,18 @@ describe("E2E Scenarios", () => {
// Test that user secrets were injected and others were changed to use proxy
const anthropicSecretLocation =
"package:test-org/assistant/ANTHROPIC_API_KEY";
const geminiSecretLocation = "package:test-org/models/GEMINI_API_KEY";
const geminiSecretLocation = "package:test-org/gemini/GEMINI_API_KEY";
expect(clientRendered.models?.[0].apiKey).toBe("sk-123");
expect(clientRendered.models?.[1].apiKey).toBe("sk-456");
expect(clientRendered.models?.[1].provider).toBe("continue-proxy");
expect((clientRendered.models?.[1] as any).apiKeyLocation).toBe(
geminiSecretLocation,
);
expect(clientRendered.models?.[1].apiKey).toBeUndefined();
expect(clientRendered.models?.[2].provider).toBe("continue-proxy");
expect((clientRendered.models?.[2] as any).apiKeyLocation).toBe(
anthropicSecretLocation,
);
expect(clientRendered.models?.[2].apiKey).toBeUndefined();
expect(clientRendered.models?.[3].provider).toBe("continue-proxy");
expect((clientRendered.models?.[3] as any).apiKeyLocation).toBe(
geminiSecretLocation,
);
expect(clientRendered.models?.[3].apiKey).toBeUndefined();
// Test that proxy can correctly resolve secrets
const decodedAnthropicSecretLocation = decodeSecretLocation(

View file

@ -1,12 +1,14 @@
name: Assistant
version: 0.0.1
packages:
- uses: test-org/models
docs:
- uses: test-org/docs
with:
version: 3.13.1
rules:
- uses: test-org/rules
- Use KaTeX for math
models:
- name: gpt-5
@ -14,5 +16,13 @@ models:
model: gpt-5
apiKey: ${{ secrets.OPENAI_API_KEY }}
rules:
- Use KaTeX for math
- uses: test-org/gemini
override:
contextLength: 500000
defaultCompletionOptions:
topP: 1.0
apiBase: https://example.com
- uses: test-org/claude35sonnet
with:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

View file

@ -0,0 +1,8 @@
name: Claude 3.5 sonnet latest
version: 0.0.1
models:
- name: claude-3-5-sonnet-latest
provider: anthropic
model: claude-3-5-sonnet-latest
apiKey: ${{ inputs.ANTHROPIC_API_KEY }}

View file

@ -3,5 +3,5 @@ version: 0.0.1
docs:
- name: Python
startUrl: https://docs.python.org/release/${{ params.version }}
rootUrl: https://docs.python.org/release/${{ params.version }}
startUrl: https://docs.python.org/release/${{ inputs.version }}
rootUrl: https://docs.python.org/release/${{ inputs.version }}

View file

@ -0,0 +1,11 @@
name: Gemini
version: 0.0.1
models:
- name: gemini
provider: gemini
model: gemini
apiKey: ${{ secrets.GEMINI_API_KEY }}
defaultCompletionOptions:
temperature: 0.7
contextLength: 1000000

View file

@ -1,18 +0,0 @@
name: Models
version: 0.0.1
models:
- name: gpt-4
provider: openai
model: gpt-4
apiKey: sk-456
- name: claude-3-5-sonnet-latest
provider: anthropic
model: claude-3-5-sonnet-latest
apiKey: ${{ secrets.ANTHROPIC_API_KEY }}
- name: gemini
provider: gemini
model: gemini
apiKey: ${{ secrets.GEMINI_API_KEY }}

View file

@ -3,4 +3,3 @@ version: 0.0.1
rules:
- Be kind
- Be concise