diff --git a/.eslintrc.shared.json b/.eslintrc.shared.json new file mode 100644 index 000000000..f4b9c4c78 --- /dev/null +++ b/.eslintrc.shared.json @@ -0,0 +1,36 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint", "import"], + "rules": { + "@typescript-eslint/semi": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-throw-literal": "warn", + "semi": "off", + "import/order": [ + "warn", + { + "groups": [ + "builtin", + "external", + "internal", + "parent", + "sibling", + "index", + "object", + "type" + ], + "alphabetize": { + "order": "asc", + "caseInsensitive": true + }, + "newlines-between": "always" + } + ] + }, + "ignorePatterns": ["out", "dist", "**/*.d.ts"] +} diff --git a/.idea/modules.xml b/.idea/modules.xml index 0a26ef9e0..ba5b279fb 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,9 +2,7 @@ - - - + \ No newline at end of file diff --git a/.idea/modules/continue-intellij-extension.iml b/.idea/modules/continue-intellij-extension.iml new file mode 100644 index 000000000..713a88bca --- /dev/null +++ b/.idea/modules/continue-intellij-extension.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/Continue.xml b/.idea/scopes/Continue.xml index dce173a74..3b28a76b1 100644 --- a/.idea/scopes/Continue.xml +++ b/.idea/scopes/Continue.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index e895a880b..a2450e67c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -137,24 +137,5 @@ "NODE_OPTIONS": "--experimental-vm-modules" } } - // { - // "name": "[openai-adapters] Jest Test Debugger, Current Open File", - // "type": "node", - // "request": "launch", - // "runtimeArgs": [ - // "--inspect-brk", - // "${workspaceRoot}/packages/openai-adapters/node_modules/jest/bin/jest.js", - // "--runInBand", - // "--config", - // "${workspaceRoot}/packages/openai-adapters/jest.config.mjs", - // "${relativeFile}" - // ], - // "cwd": "${workspaceRoot}/packages/openai-adapters", - // "console": "integratedTerminal", - // "internalConsoleOptions": "neverOpen", - // "env": { - // "NODE_OPTIONS": "--experimental-vm-modules" - // } - // } ] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d813a18a2..d1ca16637 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -200,10 +200,9 @@ Continue has support for more than a dozen different LLM "providers", making it While any model that works with a supported provider can be used with Continue, we keep a list of recommended models that can be automatically configured from the UI or `config.json`. The following files should be updated when adding a model: - [config_schema.json](./extensions/vscode/config_schema.json) - This is the JSON Schema definition that is used to validate `config.json`. You'll notice a number of rules defined in "definitions.ModelDescription.allOf". Here is where you write rules that can specify something like "for the provider 'anthropic', only models 'claude-2' and 'claude-instant-1' are allowed. Look through all of these rules and make sure that your model is included for providers that support it. -- [modelData.ts](./gui/src/util/modelData.ts) - This file defines that information that is shown in the model selection UI in the side bar. To add a new model: - 1. create a `ModelPackage` object, following the lead of the many examples near the top of the file - 2. add the `ModelPackage` to the `MODEL_INFO` array if you would like it to be displayed in the "Models" tab - 3. if you would like it to be displayed as an option under any of the providers, go to the `PROVIDER_INFO` object and add it to the `packages` array for each provider that you want it to be displayed under. If it is an OS model that should be valid for most providers offering OS models, you might just be able to add it to the `osModels` array as shorthand. +- [AddNewModel page](./gui/src/pages/AddNewModel) - This directory defines which model options are shown in the side bar model selection UI. To add a new model: + 1. Add a `ModelPackage` entry for the model into [configs/models.ts](./gui/src/pages/AddNewModel/configs/models.ts), following the lead of the many examples near the top of the file + 2. Add the model within its provider's array to [AddNewModel.tsx](./gui/src/pages/AddNewModel/AddNewModel.tsx) (add provider if needed) - [index.d.ts](./core/index.d.ts) - This file defines the TypeScript types used throughout Continue. You'll find a `ModelName` type. Be sure to add the name of your model to this. - LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models). - [Prompt Templates](./core/llm/index.ts) - In this file you'll find the `autodetectTemplateType` function. Make sure that for the model name you just added, this function returns the correct template type. This is assuming that the chat template for that model is already built in Continue. If not, you will have to add the template type and corresponding edit and chat templates. diff --git a/binary/package-lock.json b/binary/package-lock.json index e4844b8ed..0d67a4725 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -47,12 +47,11 @@ "@aws-sdk/client-bedrock-runtime": "^3.620.1", "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", - "@continuedev/config-types": "^1.0.10", + "@continuedev/config-types": "^1.0.13", "@continuedev/llm-info": "^1.0.2", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", @@ -124,7 +123,6 @@ "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", - "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", diff --git a/core/.eslintrc.json b/core/.eslintrc.json index 04097f4db..ce1bc2575 100644 --- a/core/.eslintrc.json +++ b/core/.eslintrc.json @@ -1,21 +1,12 @@ { "root": true, - "parser": "@typescript-eslint/parser", + "extends": ["../.eslintrc.shared.json"], "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", "project": "./tsconfig.json" }, - "plugins": ["@typescript-eslint", "import"], "rules": { "quotes": ["warn", "double", {}], "@typescript-eslint/naming-convention": "off", - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "off", "@typescript-eslint/no-floating-promises": "warn" - }, - "ignorePatterns": ["out", "dist", "**/*.d.ts"] + } } diff --git a/core/autocomplete/cache.ts b/core/autocomplete/cache.ts index 5005480bf..4886feb23 100644 --- a/core/autocomplete/cache.ts +++ b/core/autocomplete/cache.ts @@ -8,11 +8,7 @@ export class AutocompleteLruCache { private static capacity = 1000; private mutex = new Mutex(); - db: DatabaseConnection; - - constructor(db: DatabaseConnection) { - this.db = db; - } + constructor(private db: DatabaseConnection) {} static async get(): Promise { const db = await open({ diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index bc826f934..216286fcc 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -128,14 +128,6 @@ function formatExternalSnippet( return lines.join("\n"); } -let shownGptClaudeWarning = false; -const nonAutocompleteModels = [ - // "gpt", - // "claude", - "mistral", - "instruct", -]; - export type GetLspDefinitionsFunction = ( filepath: string, contents: string, @@ -268,7 +260,10 @@ export class CompletionProvider { const workspaceDirs = await this.ide.getWorkspaceDirs(); let filepath = input.filepath; for (const workspaceDir of workspaceDirs) { - if (filepath.startsWith(workspaceDir)) { + const relativePath = path.relative(workspaceDir, filepath); + const relativePathBase = relativePath.split(path.sep).at(0); + const isInWorkspace = !path.isAbsolute(relativePath) && relativePathBase !== ".."; + if (isInWorkspace) { filepath = path.relative(workspaceDir, filepath); break; } @@ -388,11 +383,23 @@ export class CompletionProvider { // Wait 10 seconds, then assume it wasn't accepted outcome.accepted = false; logDevData("autocomplete", outcome); - const { prompt, completion, ...restOfOutcome } = outcome; + const { prompt, completion, prefix, suffix, ...restOfOutcome } = outcome; void Telemetry.capture( "autocomplete", { - ...restOfOutcome, + accepted: restOfOutcome.accepted, + cacheHit: restOfOutcome.cacheHit, + completionId: restOfOutcome.completionId, + completionOptions: restOfOutcome.completionOptions, + debounceDelay: restOfOutcome.debounceDelay, + fileExtension: restOfOutcome.filepath.split(".")?.slice(-1)[0], + maxPromptTokens: restOfOutcome.maxPromptTokens, + modelName: restOfOutcome.modelName, + modelProvider: restOfOutcome.modelProvider, + multilineCompletions: restOfOutcome.multilineCompletions, + time: restOfOutcome.time, + useRecentlyEdited: restOfOutcome.useRecentlyEdited, + useRootPathContext: restOfOutcome.useRootPathContext, }, true, ); @@ -473,18 +480,6 @@ export class CompletionProvider { llm.model = TRIAL_FIM_MODEL; } - if ( - !shownGptClaudeWarning && - nonAutocompleteModels.some((model) => llm.model.includes(model)) && - !llm.model.toLowerCase().includes("deepseek") && - !llm.model.toLowerCase().includes("codestral") - ) { - shownGptClaudeWarning = true; - throw new Error( - `Warning: ${llm.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/features/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, - ); - } - // Prompt let fullPrefix = getRangeInString(fileContents, { @@ -494,11 +489,10 @@ export class CompletionProvider { if (input.injectDetails) { const lines = fullPrefix.split("\n"); - fullPrefix = `${lines.slice(0, -1).join("\n")}\n${ - lang.singleLineComment - } ${input.injectDetails - .split("\n") - .join(`\n${lang.singleLineComment} `)}\n${lines[lines.length - 1]}`; + fullPrefix = `${lines.slice(0, -1).join("\n")}\n${lang.singleLineComment + } ${input.injectDetails + .split("\n") + .join(`\n${lang.singleLineComment} `)}\n${lines[lines.length - 1]}`; } const fullSuffix = getRangeInString(fileContents, { @@ -519,17 +513,17 @@ export class CompletionProvider { let extrasSnippets = options.useOtherFiles ? ((await Promise.race([ - this.getDefinitionsFromLsp( - filepath, - fullPrefix + fullSuffix, - fullPrefix.length, - this.ide, - lang, - ), - new Promise((resolve) => { - setTimeout(() => resolve([]), 100); - }), - ])) as AutocompleteSnippet[]) + this.getDefinitionsFromLsp( + filepath, + fullPrefix + fullSuffix, + fullPrefix.length, + this.ide, + lang, + ), + new Promise((resolve) => { + setTimeout(() => resolve([]), 100); + }), + ])) as AutocompleteSnippet[]) : []; const workspaceDirs = await this.ide.getWorkspaceDirs(); @@ -568,8 +562,8 @@ export class CompletionProvider { completionOptions, compilePrefixSuffix = undefined, } = options.template - ? { template: options.template, completionOptions: {} } - : getTemplateForModel(llm.model); + ? { template: options.template, completionOptions: {} } + : getTemplateForModel(llm.model); let prompt: string; const filename = getBasename(filepath); @@ -666,14 +660,14 @@ export class CompletionProvider { () => llm.supportsFim() ? llm.streamFim(prefix, suffix, { - ...completionOptions, - stop, - }) + ...completionOptions, + stop, + }) : llm.streamComplete(prompt, { - ...completionOptions, - raw: true, - stop, - }), + ...completionOptions, + raw: true, + stop, + }), multiline, ); diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index c39fb2dc0..aafafa67e 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -95,10 +95,10 @@ export async function getPromptParts( } let filePrefix = fullFileContentsList - .slice(curStartLine, maxStartLine) + .slice(curStartLine, maxStartLine - 1) .join("\n"); let fileSuffix = fullFileContentsList - .slice(minEndLine, curEndLine - 1) + .slice(minEndLine, curEndLine + 1) .join("\n"); if (rif.contents.length > 0) { diff --git a/core/config/validation.ts b/core/config/validation.ts index 9da86c6ef..5a5f44eaf 100644 --- a/core/config/validation.ts +++ b/core/config/validation.ts @@ -1,4 +1,4 @@ -import { SerializedContinueConfig } from "../"; +import { ModelDescription, SerializedContinueConfig } from "../"; import { Telemetry } from "../util/posthog"; export interface ConfigValidationError { @@ -14,7 +14,7 @@ export interface ConfigValidationError { export function validateConfig(config: SerializedContinueConfig) { const errors: ConfigValidationError[] = []; - // Validate models + // Validate chat models if (!Array.isArray(config.models) || config.models.length === 0) { errors.push({ fatal: true, @@ -37,6 +37,36 @@ export function validateConfig(config: SerializedContinueConfig) { }); } + // Validate tab autocomplete model(s) + if (config.tabAutocompleteModel) { + function validateTabAutocompleteModel(modelDescription: ModelDescription) { + const modelName = modelDescription.model.toLowerCase(); + const nonAutocompleteModels = [ + // "gpt", + // "claude", + "mistral", + "instruct", + ]; + + if ( + nonAutocompleteModels.some((m) => modelName.includes(m)) && + !modelName.includes("deepseek") && + !modelName.includes("codestral") + ) { + errors.push({ + fatal: false, + message: `${modelDescription.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/features/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, + }); + } + } + + if (Array.isArray(config.tabAutocompleteModel)) { + config.tabAutocompleteModel.forEach(validateTabAutocompleteModel); + } else { + validateTabAutocompleteModel(config.tabAutocompleteModel); + } + } + // Validate slashCommands if (config.slashCommands) { if (!Array.isArray(config.slashCommands)) { diff --git a/core/context/providers/CustomContextProvider.ts b/core/context/providers/CustomContextProvider.ts index ac14dc9f4..f87a4554f 100644 --- a/core/context/providers/CustomContextProvider.ts +++ b/core/context/providers/CustomContextProvider.ts @@ -8,10 +8,7 @@ import type { } from "../../"; class CustomContextProviderClass implements IContextProvider { - custom: CustomContextProvider; - constructor(custom: CustomContextProvider) { - this.custom = custom; - } + constructor(private custom: CustomContextProvider) {} get description(): ContextProviderDescription { return { diff --git a/core/context/providers/FileContextProvider.ts b/core/context/providers/FileContextProvider.ts index d1ac2d6e2..26fb9dc73 100644 --- a/core/context/providers/FileContextProvider.ts +++ b/core/context/providers/FileContextProvider.ts @@ -1,3 +1,4 @@ +import { BaseContextProvider } from "../"; import { ContextItem, ContextProviderDescription, @@ -11,7 +12,6 @@ import { getUniqueFilePath, groupByLastNPathParts, } from "../../util/"; -import { BaseContextProvider } from "../"; const MAX_SUBMENU_ITEMS = 10_000; @@ -21,7 +21,6 @@ class FileContextProvider extends BaseContextProvider { displayTitle: "Files", description: "Type to search", type: "submenu", - dependsOnIndexing: true, }; async getContextItems( diff --git a/core/context/providers/FileTreeContextProvider.ts b/core/context/providers/FileTreeContextProvider.ts index 5b5d99fed..52af97823 100644 --- a/core/context/providers/FileTreeContextProvider.ts +++ b/core/context/providers/FileTreeContextProvider.ts @@ -34,7 +34,6 @@ class FileTreeContextProvider extends BaseContextProvider { description: "Attach a representation of the file tree", type: "normal", renderInlineAs: "", - dependsOnIndexing: true, }; async getContextItems( diff --git a/core/context/providers/RepoMapContextProvider.ts b/core/context/providers/RepoMapContextProvider.ts index 6aefe0301..183ff3cb6 100644 --- a/core/context/providers/RepoMapContextProvider.ts +++ b/core/context/providers/RepoMapContextProvider.ts @@ -7,9 +7,9 @@ import { LoadSubmenuItemsArgs, } from "../../"; import { - groupByLastNPathParts, getBasename, getUniqueFilePath, + groupByLastNPathParts, } from "../../util"; import generateRepoMap from "../../util/generateRepoMap"; @@ -25,7 +25,6 @@ class RepoMapContextProvider extends BaseContextProvider { displayTitle: "Repository Map", description: "Select a folder", type: "submenu", - dependsOnIndexing: true, }; async getContextItems( diff --git a/core/indexing/chunk/ChunkCodebaseIndex.ts b/core/indexing/chunk/ChunkCodebaseIndex.ts index cdf91f359..e2d316d67 100644 --- a/core/indexing/chunk/ChunkCodebaseIndex.ts +++ b/core/indexing/chunk/ChunkCodebaseIndex.ts @@ -23,9 +23,7 @@ export class ChunkCodebaseIndex implements CodebaseIndex { private readonly pathSep: string, private readonly continueServerClient: IContinueServerClient, private readonly maxChunkSize: number, - ) { - this.readFile = readFile; - } + ) {} async *update( tag: IndexTag, diff --git a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts index bf3bcac88..a5cfce6c4 100644 --- a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts +++ b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts @@ -6,11 +6,14 @@ import { fromIni } from "@aws-sdk/credential-providers"; import { EmbeddingsProviderName, EmbedOptions, FetchFunction } from "../../index.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; +interface ModelConfig { + formatPayload: (text: string) => any; + extractEmbeddings: (responseBody: any) => number[][]; +} + class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { - static providerName: EmbeddingsProviderName = "bedrock"; - - static defaultOptions: Partial | undefined = { + static defaultOptions: Partial = { model: "amazon.titan-embed-text-v2:0", region: "us-east-1" }; @@ -18,6 +21,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { constructor(options: EmbedOptions, fetch: FetchFunction) { super(options, fetch); + this.options.model = this.options.model || BedrockEmbeddingsProvider.defaultOptions.model!; if (!options.apiBase) { options.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } @@ -29,7 +33,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { } } - async embed(chunks: string[]) { + async embed(chunks: string[]): Promise { const credentials = await this._getCredentials(); const client = new BedrockRuntimeClient({ region: this.options.region, @@ -43,41 +47,64 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { return ( await Promise.all( chunks.map(async (chunk) => { - const input = this._generateInvokeModelCommandInput(chunk, this.options); + const input = this._generateInvokeModelCommandInput(chunk); const command = new InvokeModelCommand(input); const response = await client.send(command); - if (response.body) { const responseBody = JSON.parse(new TextDecoder().decode(response.body)); - return [responseBody.embedding]; + return this._extractEmbeddings(responseBody); } + return []; }), ) ).flat(); } - private _generateInvokeModelCommandInput( - prompt: string, - options: EmbedOptions, - ): any { - const payload = { - "inputText": prompt, - "dimensions": 512, - "normalize": true - }; + private _generateInvokeModelCommandInput(text: string): any { + const modelConfig = this._getModelConfig(); + const payload = modelConfig.formatPayload(text); return { body: JSON.stringify(payload), modelId: this.options.model, - accept: "application/json", - contentType: "application/json" + accept: "*/*", + contentType: "application/json", }; } + private _extractEmbeddings(responseBody: any): number[][] { + const modelConfig = this._getModelConfig(); + return modelConfig.extractEmbeddings(responseBody); + } + + private _getModelConfig() { + const modelConfigs: { [key: string]: ModelConfig } = { + 'cohere': { + formatPayload: (text: string) => ({ + texts: [text], + input_type: "search_document", + truncate: "END", + }), + extractEmbeddings: (responseBody: any) => responseBody.embeddings || [], + }, + 'amazon.titan-embed': { + formatPayload: (text: string) => ({ + inputText: text, + }), + extractEmbeddings: (responseBody: any) => responseBody.embedding ? [responseBody.embedding] : [], + }, + }; + + const modelPrefix = Object.keys(modelConfigs).find(prefix => this.options.model!.startsWith(prefix)); + if (!modelPrefix) { + throw new Error(`Unsupported model: ${this.options.model}`); + } + return modelConfigs[modelPrefix]; + } + private async _getCredentials() { try { - return await - fromIni({ + return await fromIni({ profile: this.profile, ignoreCache: true })(); @@ -88,7 +115,6 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { return await fromIni()(); } } - } export default BedrockEmbeddingsProvider; diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 0b2714f1d..06b8cac51 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -1,4 +1,7 @@ import ignore from "ignore"; +import path from "path"; +import os from "os"; +import fs from "fs"; export const DEFAULT_IGNORE_FILETYPES = [ "*.DS_Store", @@ -114,3 +117,18 @@ export function gitIgArrayFromFile(file: string) { .map((l) => l.trim()) // Remove whitespace .filter((l) => !/^#|^$/.test(l)); // Remove empty lines } + +export const GLOBAL_CONTINUEIGNORE_PATH = path.join(os.homedir(), ".continue", ".continueignore"); + +export const getGlobalContinueIgArray = () => { + try { + const contents = fs.readFileSync(GLOBAL_CONTINUEIGNORE_PATH, "utf8"); + return gitIgArrayFromFile(contents); + } catch (error) { + // If the file doesn't exist, that's okay + if (error instanceof Error && ("code" in error) && error.code === "ENOENT") { + return []; + } + throw error; + } +}; \ No newline at end of file diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index 51cbdb646..cf59899f1 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -416,11 +416,9 @@ export async function getComputeDeleteAddRemove( export class GlobalCacheCodeBaseIndex implements CodebaseIndex { relativeExpectedTime: number = 1; - private db: DatabaseConnection; - constructor(db: DatabaseConnection) { - this.db = db; - } + constructor(private db: DatabaseConnection) {} + artifactId = "globalCache"; static async create(): Promise { diff --git a/core/indexing/walkDir.ts b/core/indexing/walkDir.ts index eeeb064d0..44f785ab4 100644 --- a/core/indexing/walkDir.ts +++ b/core/indexing/walkDir.ts @@ -6,6 +6,7 @@ import { DEFAULT_IGNORE_FILETYPES, defaultIgnoreDir, defaultIgnoreFile, + getGlobalContinueIgArray, gitIgArrayFromFile, } from "./ignore.js"; @@ -38,15 +39,13 @@ type IgnoreContext = { }; class DFSWalker { - private readonly path: string; - private readonly ide: IDE; - private readonly options: WalkerOptions; private readonly ignoreFileNames: Set; - constructor(path: string, ide: IDE, options: WalkerOptions) { - this.path = path; - this.ide = ide; - this.options = options; + constructor( + private readonly path: string, + private readonly ide: IDE, + private readonly options: WalkerOptions, + ) { this.ignoreFileNames = new Set(options.ignoreFiles); } @@ -85,6 +84,7 @@ class DFSWalker { } private newRootWalkContext(): WalkContext { + const globalIgnoreFile = getGlobalContinueIgArray(); return { walkableEntry: { relPath: "", @@ -94,7 +94,7 @@ class DFSWalker { }, ignoreContexts: [ { - ignore: ignore().add(defaultIgnoreDir).add(defaultIgnoreFile), + ignore: ignore().add(defaultIgnoreDir).add(defaultIgnoreFile).add(globalIgnoreFile), dirname: "", }, ], @@ -128,10 +128,7 @@ class DFSWalker { ignore: ignore().add(patterns), dirname: curDir.walkableEntry.relPath, }; - return [ - ...curDir.ignoreContexts, - newIgnoreContext - ]; + return [...curDir.ignoreContexts, newIgnoreContext]; } private async loadIgnoreFiles(entries: WalkableEntry[]): Promise { @@ -147,7 +144,10 @@ class DFSWalker { return this.ignoreFileNames.has(p); } - private shouldInclude(walkableEntry: WalkableEntry, ignoreContexts: IgnoreContext[]) { + private shouldInclude( + walkableEntry: WalkableEntry, + ignoreContexts: IgnoreContext[], + ) { if (this.entryIsSymlink(walkableEntry.entry)) { // If called from the root, a symlink either links to a real file in this repository, // and therefore will be walked OR it linksto something outside of the repository and diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 485b87015..c143fa412 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -111,7 +111,15 @@ class Bedrock extends BaseLLM { maxTokens: options.maxTokens, temperature: options.temperature, topP: options.topP, - stopSequences: options.stop?.filter((stop) => stop.trim() !== ""), + // TODO: The current approach selects the first 4 items from the list to comply with Bedrock's requirement + // of having at most 4 stop sequences, as per the AWS documentation: + // https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_InferenceConfiguration.html + // However, it might be better to implement a strategy that dynamically selects the most appropriate stop sequences + // based on the context. + // TODO: Additionally, consider implementing a global exception handler for the providers to give users clearer feedback. + // For example, differentiate between client-side errors (4XX status codes) and server-side issues (5XX status codes), + // providing meaningful error messages to improve the user experience. + stopSequences: options.stop?.filter((stop) => stop.trim() !== "").slice(0, 4), }, }; } diff --git a/core/package-lock.json b/core/package-lock.json index 58eec1b51..9e3937c64 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -17,7 +17,6 @@ "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", @@ -89,7 +88,6 @@ "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", - "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", @@ -4969,7 +4967,8 @@ "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "peer": true }, "node_modules/@types/long": { "version": "4.0.2", @@ -5224,6 +5223,7 @@ "version": "7.10.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.10.0.tgz", "integrity": "sha512-2EjZMA0LUW5V5tGQiaa2Gys+nKdfrn2xiTIBLR4fxmPmVSvgPcKNW+AE/ln9k0A4zDUti0J/GZXMDupQoI+e1w==", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "7.10.0", "@typescript-eslint/types": "7.10.0", @@ -5645,6 +5645,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "is-array-buffer": "^3.0.4" @@ -5660,6 +5661,7 @@ "version": "3.1.8", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -5692,6 +5694,7 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -5711,6 +5714,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5728,6 +5732,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5745,6 +5750,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "call-bind": "^1.0.5", @@ -5806,6 +5812,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "peer": true, "dependencies": { "possible-typed-array-names": "^1.0.0" }, @@ -6901,6 +6908,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -6917,6 +6925,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -6933,6 +6942,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -7396,6 +7406,7 @@ "version": "1.23.3", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", @@ -7485,6 +7496,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "peer": true, "dependencies": { "get-intrinsic": "^1.2.4", "has-tostringtag": "^1.0.2", @@ -7498,6 +7510,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "peer": true, "dependencies": { "hasown": "^2.0.0" } @@ -7506,6 +7519,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "peer": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -7690,6 +7704,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "peer": true, "dependencies": { "debug": "^3.2.7", "is-core-module": "^2.13.0", @@ -7700,6 +7715,7 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -7708,6 +7724,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", + "peer": true, "dependencies": { "debug": "^3.2.7" }, @@ -7724,6 +7741,7 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -7732,6 +7750,7 @@ "version": "2.29.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "peer": true, "dependencies": { "array-includes": "^3.1.7", "array.prototype.findlastindex": "^1.2.3", @@ -7762,6 +7781,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7771,6 +7791,7 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -7779,6 +7800,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "peer": true, "dependencies": { "esutils": "^2.0.2" }, @@ -7790,6 +7812,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -7801,6 +7824,7 @@ "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "peer": true, "bin": { "semver": "bin/semver.js" } @@ -8258,6 +8282,7 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "peer": true, "dependencies": { "is-callable": "^1.1.3" } @@ -8413,6 +8438,7 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -8430,6 +8456,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8593,6 +8620,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "es-errors": "^1.3.0", @@ -8708,6 +8736,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "peer": true, "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" @@ -8904,6 +8933,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8961,6 +8991,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "peer": true, "dependencies": { "has-symbols": "^1.0.3" }, @@ -9209,6 +9240,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "peer": true, "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.0", @@ -9234,6 +9266,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1" @@ -9254,6 +9287,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "peer": true, "dependencies": { "has-bigints": "^1.0.1" }, @@ -9265,6 +9299,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -9280,6 +9315,7 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "peer": true, "engines": { "node": ">= 0.4" }, @@ -9302,6 +9338,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "peer": true, "dependencies": { "is-typed-array": "^1.1.13" }, @@ -9316,6 +9353,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -9377,6 +9415,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "peer": true, "engines": { "node": ">= 0.4" }, @@ -9396,6 +9435,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -9428,6 +9468,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -9443,6 +9484,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "peer": true, "dependencies": { "call-bind": "^1.0.7" }, @@ -9468,6 +9510,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -9482,6 +9525,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "peer": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -9496,6 +9540,7 @@ "version": "1.1.13", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "peer": true, "dependencies": { "which-typed-array": "^1.1.14" }, @@ -9515,6 +9560,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.2" }, @@ -9525,7 +9571,8 @@ "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "peer": true }, "node_modules/isexe": { "version": "2.0.0", @@ -11569,6 +11616,7 @@ "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -11615,6 +11663,7 @@ "version": "2.0.8", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -11632,6 +11681,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -11645,6 +11695,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -12294,6 +12345,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "peer": true, "engines": { "node": ">= 0.4" } @@ -12869,6 +12921,7 @@ "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "define-properties": "^1.2.1", @@ -13142,6 +13195,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "get-intrinsic": "^1.2.4", @@ -13178,6 +13232,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -13248,6 +13303,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "peer": true, "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -13303,6 +13359,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -13724,6 +13781,7 @@ "version": "1.2.9", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -13741,6 +13799,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -13754,6 +13813,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -14184,6 +14244,7 @@ "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "peer": true, "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.2", @@ -14195,6 +14256,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "peer": true, "dependencies": { "minimist": "^1.2.0" }, @@ -14206,6 +14268,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "peer": true, "engines": { "node": ">=4" } @@ -14266,6 +14329,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -14279,6 +14343,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", @@ -14297,6 +14362,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "peer": true, "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", @@ -14316,6 +14382,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "peer": true, "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", @@ -14374,6 +14441,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", @@ -14720,6 +14788,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "peer": true, "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", @@ -14735,6 +14804,7 @@ "version": "1.1.15", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "peer": true, "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", diff --git a/core/package.json b/core/package.json index bdda48184..ed489d1f2 100644 --- a/core/package.json +++ b/core/package.json @@ -32,7 +32,6 @@ "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", - "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", @@ -49,7 +48,6 @@ "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", diff --git a/core/util/generateRepoMap.ts b/core/util/generateRepoMap.ts index 785a62c41..fb4be85d7 100644 --- a/core/util/generateRepoMap.ts +++ b/core/util/generateRepoMap.ts @@ -12,9 +12,6 @@ export interface RepoMapOptions { } class RepoMapGenerator { - private llm: ILLM; - private ide: IDE; - private options: RepoMapOptions; private maxRepoMapTokens: number; private repoMapPath: string = getRepoMapFilePath(); @@ -32,10 +29,11 @@ class RepoMapGenerator { "this map contains the name of the file, and the signature for any " + "classes, methods, or functions in the file.\n\n"; - constructor(llm: ILLM, ide: IDE, options: RepoMapOptions) { - this.llm = llm; - this.ide = ide; - this.options = options; + constructor( + private llm: ILLM, + private ide: IDE, + private options: RepoMapOptions, + ) { this.maxRepoMapTokens = llm.contextLength * this.REPO_MAX_CONTEXT_LENGTH_RATIO; } diff --git a/docs/docs/customize/deep-dives/codebase.md b/docs/docs/customize/deep-dives/codebase.md index 8b757a11f..5acf4e857 100644 --- a/docs/docs/customize/deep-dives/codebase.md +++ b/docs/docs/customize/deep-dives/codebase.md @@ -67,6 +67,8 @@ Whether to use re-ranking, which will allow initial selection of `nRetrieve` res Continue respects `.gitignore` files in order to determine which files should not be indexed. If you'd like to exclude additional files, you can add them to a `.continueignore` file, which follows the exact same rules as `.gitignore`. +Continue also supports a **global** `.continueignore` file that will be respected for all workspaces, which can be created at `~/.continue/.continueignore`. + If you want to see exactly what files Continue has indexed, the metadata is stored in `~/.continue/index/index.sqlite`. You can use a tool like [DB Browser for SQLite](https://sqlitebrowser.org/) to view the `tag_catalog` table within this file. If you need to force a refresh of the index, reload the VS Code window with `cmd/ctrl + shift + p` + "Reload Window". diff --git a/docs/docs/customize/model-providers/top-level/azure.md b/docs/docs/customize/model-providers/top-level/azure.md index 814a056ea..adb390538 100644 --- a/docs/docs/customize/model-providers/top-level/azure.md +++ b/docs/docs/customize/model-providers/top-level/azure.md @@ -3,6 +3,14 @@ title: Azure OpenAI slug: ../azure --- +Azure OpenAI is a cloud-based service that provides access to OpenAI's models, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure OpenAI resource in the [Azure portal](https://portal.azure.com). + +:::info + +For details on model setup, see [General model configuration](#general-model-configuration). + +::: + ## Chat model We recommend configuring **GPT-4o** as your chat model. diff --git a/docs/docs/customize/model-providers/top-level/bedrock.md b/docs/docs/customize/model-providers/top-level/bedrock.md index 14cc70211..8d46c5ad9 100644 --- a/docs/docs/customize/model-providers/top-level/bedrock.md +++ b/docs/docs/customize/model-providers/top-level/bedrock.md @@ -3,6 +3,8 @@ title: Amazon Bedrock slug: ../bedrock --- +Amazon Bedrock is a fully managed service on AWS that provides access to foundation models from various AI companies through a single API. + ## Chat model We recommend configuring **Claude 3.5 Sonnet** as your chat model. diff --git a/docs/docs/customize/model-providers/top-level/ollama.md b/docs/docs/customize/model-providers/top-level/ollama.md index 7a6a0776a..ae97d30c3 100644 --- a/docs/docs/customize/model-providers/top-level/ollama.md +++ b/docs/docs/customize/model-providers/top-level/ollama.md @@ -3,6 +3,8 @@ title: Ollama slug: ../ollama --- +Ollama is an open-source tool that allows to run large language models (LLMs) locally on their own computers. To use Ollama, you can install it [here](https://ollama.ai/download) and download the model you want to run with the `ollama run` command. + ## Chat model We recommend configuring **Llama3.1 8B** as your chat model. diff --git a/extensions/intellij/.run/Run Continue.run.xml b/extensions/intellij/.run/Run Continue.run.xml index 32ba73bb9..cc705773b 100644 --- a/extensions/intellij/.run/Run Continue.run.xml +++ b/extensions/intellij/.run/Run Continue.run.xml @@ -1,7 +1,8 @@ - + + diff --git a/extensions/intellij/.run/Start Dev Server (core).run.xml b/extensions/intellij/.run/Start Dev Server (core).run.xml new file mode 100644 index 000000000..e7fe0ccac --- /dev/null +++ b/extensions/intellij/.run/Start Dev Server (core).run.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/extensions/intellij/.run/Tail Dev Logs.run.xml b/extensions/intellij/.run/Tail Dev Logs.run.xml deleted file mode 100644 index 5685b4fd8..000000000 --- a/extensions/intellij/.run/Tail Dev Logs.run.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - \ No newline at end of file diff --git a/extensions/intellij/CONTRIBUTING.md b/extensions/intellij/CONTRIBUTING.md index a08430c3b..7dd776055 100644 --- a/extensions/intellij/CONTRIBUTING.md +++ b/extensions/intellij/CONTRIBUTING.md @@ -1,6 +1,7 @@ # Contributing to Continue (JetBrains extension) -This file is for contribution guidelines specific to the JetBrains extension. See the root [`CONTRIBUTING.md`](../../CONTRIBUTING.md) for general contribution guidelines. +This file is for contribution guidelines specific to the JetBrains extension. See the root [ +`CONTRIBUTING.md`](../../CONTRIBUTING.md) for general contribution guidelines. ## Table of Contents @@ -12,7 +13,8 @@ This file is for contribution guidelines specific to the JetBrains extension. Se - [Install all dependencies](#install-all-dependencies) - [Misc](#misc) - [Development Workflow](#development-workflow) - - [Running the extension](#running-the-extension) + - [Running the extension in debug mode](#running-the-extension-in-debug-mode) + - [Accessing files in the `.continue` directory](#accessing-files-in-the-continue-directory) - [Reloading changes](#reloading-changes) - [Setting breakpoints](#setting-breakpoints) - [Available Gradle tasks](#available-gradle-tasks) @@ -57,22 +59,18 @@ This project requires Node.js version 20.11.0 (LTS) or higher. You have two opti ## Development Workflow -Because the `gui` and `core` are written in TypeScript, our development workflow is built around the assumption that you -have VS Code installed. +### Running the extension in debug mode -### Running the extension +Select the `Run Continue` task in the top right corner of the IDE and then select the "Debug" option. -- Open the project in VS Code and star the `Core binary` task -- Switch back to Intellij and select the "Run Continue" configuration in the top-right corner of the IDE -- Click the "Debug" button - - The first time running this will install the IDE version specified by the `platformVersion` property in [ - `./run/Run Extension.run.xml`](./.run/Run%20Extension.run.xml). This will take a moment as the installation size - can be close to 1GB. +![run-extension-screenshot](../../media/run-continue-intellij.png) -![run-extension-screenshot](../../media/run-intellij-extension.png)\ +This should open a new instance on IntelliJ with the extension installed. -This should open a new instance on IntelliJ with the extension installed and connected via TCP to the server started -through the `Core binary` task. +### Accessing files in the `.continue` directory + +When running the `Start Dev Server (core)` task, we set the location of your Continue directory to `./binary/.continue`. This is to +allow for changes to your `config.json` and other files during development, without affecting your actual configuration. ### Reloading changes @@ -80,13 +78,13 @@ through the `Core binary` task. _Run | Debugging Actions | Reload Changed Classes`_ - This will often fail on new imports, schema changes etc. In that case, you need to stop and restart the extension - `gui`: Changes will be reloaded automatically -- `core`: Run `npm run build` from the `binary` directory and restart the `Core binary` task in VS Code +- `core`: Run `npm run build` from the `binary` directory (requires restarting the `Start Dev Server (core)` task) ### Setting breakpoints - `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 VS Code (requires restarting the _Core Binary_ task) +- `core`: Breakpoints can be set in Intellij (requires restarting the `Start Dev Server (core)` task) ### Available Gradle tasks @@ -111,7 +109,8 @@ verifyPluginConfiguration - Checks if Java and Kotlin compilers configuration me - Unix: `./gradlew buildPlugin` - Windows: `./gradlew.bat buildPlugin` -This will generate a .zip file in `./build/distributions` with the version defined in [`./gradle.properties`](./gradle.properties) +This will generate a .zip file in `./build/distributions` with the version defined in [ +`./gradle.properties`](./gradle.properties) #### Testing the packaged extension diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index 572fe74b6..640fa05c1 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -2,7 +2,10 @@ com.github.continuedev.continueintellijextension Continue - continue-dev + continue-dev + + GitHub]]> + com.intellij.modules.platform com.intellij.modules.json diff --git a/extensions/vscode/.eslintrc.json b/extensions/vscode/.eslintrc.json index 5dfecab7e..c25ccff20 100644 --- a/extensions/vscode/.eslintrc.json +++ b/extensions/vscode/.eslintrc.json @@ -1,18 +1,10 @@ { "root": true, - "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" + "project": "./tsconfig.json" }, - "plugins": ["@typescript-eslint"], + "extends": ["../../.eslintrc.shared.json"], "rules": { - "@typescript-eslint/naming-convention": "warn", - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "off" - }, - "ignorePatterns": ["out", "dist", "**/*.d.ts"] + "@typescript-eslint/naming-convention": "warn" + } } diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 4c137be21..ab1d53f6e 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.220", + "version": "0.9.223", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.220", + "version": "0.9.223", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -71,7 +71,6 @@ "@types/vscode": "1.70", "@types/ws": "^8.5.4", "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", "@vscode/vsce": "^2.22.0", "cargo-cp-artifact": "^0.1", "esbuild": "0.17.19", @@ -103,7 +102,6 @@ "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", @@ -175,7 +173,6 @@ "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", - "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", @@ -2152,6 +2149,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 2d7a5af4f..6d8ff01c8 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.221", + "version": "0.9.223", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -539,7 +539,6 @@ "@types/vscode": "1.70", "@types/ws": "^8.5.4", "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", "@vscode/vsce": "^2.22.0", "cargo-cp-artifact": "^0.1", "esbuild": "0.17.19", diff --git a/extensions/vscode/src/diff/vertical/decorations.ts b/extensions/vscode/src/diff/vertical/decorations.ts index 276145207..5d3ae7525 100644 --- a/extensions/vscode/src/diff/vertical/decorations.ts +++ b/extensions/vscode/src/diff/vertical/decorations.ts @@ -36,16 +36,10 @@ export const belowIndexDecorationType = }); export class DecorationTypeRangeManager { - private decorationType: vscode.TextEditorDecorationType; - private editor: vscode.TextEditor; - constructor( - decorationType: vscode.TextEditorDecorationType, - editor: vscode.TextEditor, - ) { - this.decorationType = decorationType; - this.editor = editor; - } + private decorationType: vscode.TextEditorDecorationType, + private editor: vscode.TextEditor, + ) {} private ranges: vscode.Range[] = []; diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 125bf065d..d04e7a386 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -17,9 +17,6 @@ export interface VerticalDiffHandlerOptions { } export class VerticalDiffHandler implements vscode.Disposable { - private editor: vscode.TextEditor; - private startLine: number; - private endLine: number; private currentLineIndex: number; private cancelled = false; @@ -31,12 +28,10 @@ export class VerticalDiffHandler implements vscode.Disposable { private newLinesAdded = 0; - public options: VerticalDiffHandlerOptions; - constructor( - startLine: number, - endLine: number, - editor: vscode.TextEditor, + private startLine: number, + private endLine: number, + private editor: vscode.TextEditor, private readonly editorToVerticalDiffCodeLens: Map< string, VerticalDiffCodeLens[] @@ -46,18 +41,15 @@ export class VerticalDiffHandler implements vscode.Disposable { accept: boolean, ) => void, private readonly refreshCodeLens: () => void, - options: VerticalDiffHandlerOptions, + public options: VerticalDiffHandlerOptions, ) { this.currentLineIndex = startLine; - this.startLine = startLine; - this.endLine = endLine; - this.editor = editor; - this.options = options; this.redDecorationManager = new DecorationTypeRangeManager( redDecorationType, this.editor, ); + this.greenDecorationManager = new DecorationTypeRangeManager( greenDecorationType, this.editor, diff --git a/extensions/vscode/src/lang-server/codeLens/providers/DiffViewerCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/DiffViewerCodeLensProvider.ts index 405df9a24..b67db0e52 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/DiffViewerCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/DiffViewerCodeLensProvider.ts @@ -4,11 +4,7 @@ import { DiffManager, DIFF_DIRECTORY } from "../../../diff/horizontal"; import { getMetaKeyLabel } from "../../../util/util"; export class DiffViewerCodeLensProvider implements vscode.CodeLensProvider { - diffManager: DiffManager; - - constructor(diffManager: DiffManager) { - this.diffManager = diffManager; - } + constructor(private diffManager: DiffManager) {} public provideCodeLenses( document: vscode.TextDocument, diff --git a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts index 5f6748b61..08decb215 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts @@ -62,13 +62,7 @@ export class QuickActionsCodeLensProvider implements vscode.CodeLensProvider { vscode.SymbolKind.Constructor, ]; - customQuickActionsConfig?: QuickActionConfig[]; - - constructor(customQuickActionsConfigs?: QuickActionConfig[]) { - if (customQuickActionsConfigs) { - this.customQuickActionsConfig = customQuickActionsConfigs; - } - } + constructor(private customQuickActionsConfigs?: QuickActionConfig[]) {} getCustomCommands( range: vscode.Range, @@ -145,8 +139,8 @@ export class QuickActionsCodeLensProvider implements vscode.CodeLensProvider { const symbols = await this.getTopLevelAndChildrenSymbols(document.uri); return symbols.flatMap(({ range }) => { - const commands: vscode.Command[] = !!this.customQuickActionsConfig - ? this.getCustomCommands(range, this.customQuickActionsConfig) + const commands: vscode.Command[] = !!this.customQuickActionsConfigs + ? this.getCustomCommands(range, this.customQuickActionsConfigs) : this.getDefaultCommand(range); return commands.map((command) => new vscode.CodeLens(range, command)); diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 0cc11a0ad..1116ed67f 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -319,9 +319,8 @@ export class QuickEdit { return isSelectionEmpty ? `Edit ${fileName}` - : `Edit ${fileName}:${start.line}${ - end.line > start.line ? `-${end.line}` : "" - }`; + : `Edit ${fileName}:${start.line}${end.line > start.line ? `-${end.line}` : "" + }`; }; private async _streamEditWithInputAndContext( @@ -385,7 +384,7 @@ export class QuickEdit { const modelTitle = await this.getCurModelTitle(); if (!modelTitle) { - this.ide.showToast("info", "Please configure a model to use Quick Edit"); + this.ide.showToast("error", "Please configure a model to use Quick Edit"); return { label: undefined, value: undefined }; } diff --git a/extensions/vscode/src/terminal/terminalEmulator.ts b/extensions/vscode/src/terminal/terminalEmulator.ts index d76823da6..b2a7a99a9 100644 --- a/extensions/vscode/src/terminal/terminalEmulator.ts +++ b/extensions/vscode/src/terminal/terminalEmulator.ts @@ -129,7 +129,6 @@ export class CapturedTerminal { private readonly writeEmitter: vscode.EventEmitter; private splitByCommandsBuffer = ""; - private readonly onCommandOutput: ((output: string) => void) | undefined; splitByCommandsListener(data: string) { // Split the output by commands so it can be sent to Continue Server @@ -164,10 +163,8 @@ export class CapturedTerminal { constructor( options: { name: string } & Partial, - onCommandOutput?: (output: string) => void, + private readonly onCommandOutput?: (output: string) => void, ) { - this.onCommandOutput = onCommandOutput; - // this.shellCmd = "bash"; // getDefaultShell(); this.shellCmd = getDefaultShell(); diff --git a/extensions/vscode/src/util/loadAutocompleteModel.ts b/extensions/vscode/src/util/loadAutocompleteModel.ts index 4437c11d1..9b86c7751 100644 --- a/extensions/vscode/src/util/loadAutocompleteModel.ts +++ b/extensions/vscode/src/util/loadAutocompleteModel.ts @@ -13,11 +13,7 @@ export class TabAutocompleteModel { private shownOllamaWarning = false; private shownDeepseekWarning = false; - private configHandler: ConfigHandler; - - constructor(configHandler: ConfigHandler) { - this.configHandler = configHandler; - } + constructor(private configHandler: ConfigHandler) {} clearLlm() { this._llm = undefined; diff --git a/gui/package-lock.json b/gui/package-lock.json index 25a992592..ef9f8cda9 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -104,7 +104,6 @@ "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", @@ -176,7 +175,6 @@ "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", - "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", diff --git a/gui/src/components/History/HistoryTableRow.tsx b/gui/src/components/History/HistoryTableRow.tsx index ca140c8ab..76c241d63 100644 --- a/gui/src/components/History/HistoryTableRow.tsx +++ b/gui/src/components/History/HistoryTableRow.tsx @@ -56,10 +56,10 @@ export function HistoryTableRow({ onMouseLeave={() => setHovered(false)} >
{ // Save current session - saveSession(); + await saveSession(); await loadSession(session.sessionId); navigate("/"); }} @@ -113,7 +113,7 @@ export function HistoryTableRow({ { - deleteSession(session.sessionId); + await deleteSession(session.sessionId); onDelete(session.sessionId); }} > diff --git a/gui/src/components/OnboardingCard/components/JetBrainsFetchGitHubTokenDialog.tsx b/gui/src/components/OnboardingCard/components/JetBrainsFetchGitHubTokenDialog.tsx index 38d1b526b..cc20e77d7 100644 --- a/gui/src/components/OnboardingCard/components/JetBrainsFetchGitHubTokenDialog.tsx +++ b/gui/src/components/OnboardingCard/components/JetBrainsFetchGitHubTokenDialog.tsx @@ -36,8 +36,8 @@ function JetBrainsFetchGitHubTokenDialog({ return (
-

Sign in with GitHub

-

+

Sign in with GitHub

+

Continue will request read access to your GitHub email so that we can prevent abuse of the free trial. If you prefer not to sign in, you can use Continue with your own API keys or local model. diff --git a/gui/src/components/mainInput/TutorialCard.tsx b/gui/src/components/mainInput/TutorialCard.tsx index cd5be630b..3a424e257 100644 --- a/gui/src/components/mainInput/TutorialCard.tsx +++ b/gui/src/components/mainInput/TutorialCard.tsx @@ -52,10 +52,10 @@ export function TutorialCard({ onClose }: TutorialCardProps) {

    {!isJetBrains() && (
  • - + ideMessenger.request( "vscode/openMoveRightMarkdown", @@ -70,32 +70,33 @@ export function TutorialCard({ onClose }: TutorialCardProps) {
  • )}
  • - + Highlight code and press {getMetaKeyLabel() + "I"} to quickly make natural language edits
  • - + Highlight code and press {getMetaKeyLabel() + "L"} to add it to the chat window
  • - + Click the gear icon in the bottom right to configure Continue
  • - + + ideMessenger.post("openUrl", "https://docs.continue.dev") + } > Read our documentation {" "} diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index 451be0e16..629463943 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -1,5 +1,9 @@ import { Transition } from "@headlessui/react"; -import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline"; +import { + CheckIcon, + ChevronUpDownIcon, + CubeIcon, +} from "@heroicons/react/24/outline"; import { Dispatch, Fragment, SetStateAction } from "react"; import { Listbox } from "@headlessui/react"; import styled from "styled-components"; @@ -111,7 +115,7 @@ function ModelSelectionListbox({ }: ModelSelectionListboxProps) { return ( -
    +
    {window.vscMediaUrl && selectedProvider.icon && ( @@ -141,25 +145,30 @@ function ModelSelectionListbox({ {({ selected }) => ( <> - {window.vscMediaUrl && option.icon && ( - + {option.title === "Autodetect" ? ( + + ) : ( + window.vscMediaUrl && + option.icon && ( + + ) )} {option.title} - {selected ? ( + {selected && ( - ) : null} + )} )} diff --git a/gui/src/forms/AddModelForm.tsx b/gui/src/forms/AddModelForm.tsx index e045ca13e..861333517 100644 --- a/gui/src/forms/AddModelForm.tsx +++ b/gui/src/forms/AddModelForm.tsx @@ -20,6 +20,11 @@ interface QuickModelSetupProps { hideFreeTrialLimitMessage?: boolean; } +const MODEL_PROVIDERS_URL = + "https://docs.continue.dev/customize/model-providers"; +const CODESTRAL_URL = "https://console.mistral.ai/codestral"; +const CONTINUE_SETUP_URL = "https://docs.continue.dev/setup/overview"; + function AddModelForm({ onDone, hideFreeTrialLimitMessage, @@ -39,7 +44,7 @@ function AddModelForm({ const selectedProviderApiKeyUrl = selectedModel.params.model.startsWith( "codestral", ) - ? "https://console.mistral.ai/codestral" + ? CODESTRAL_URL : selectedProvider.apiKeyUrl; function isDisabled() { @@ -97,23 +102,16 @@ function AddModelForm({ return (
    -
    -

    Add Chat model

    +
    +

    Add Chat model

    {!hideFreeTrialLimitMessage && hasPassedFTL() && ( -

    +

    You've reached the free trial limit of {FREE_TRIAL_LIMIT_REQUESTS}{" "} free inputs. To keep using Continue, you can either use your own API key, or use a local LLM. To read more about the options, see our{" "} - ideMessenger.post( - "openUrl", - "https://docs.continue.dev/setup/overview", - ) - } + onClick={() => ideMessenger.post("openUrl", CONTINUE_SETUP_URL)} > documentation @@ -121,7 +119,7 @@ function AddModelForm({

    )} -
    +
    !["freetrial", "openai-aiohttp"].includes(key), ) .map(([, provider]) => provider)} - > + /> Don't see your provider?{" "} + ideMessenger.post("openUrl", MODEL_PROVIDERS_URL) + } > Click here {" "} @@ -148,12 +147,12 @@ function AddModelForm({ {selectedProvider.downloadUrl && (
    -
    {selectedModel.params.model.startsWith("codestral") && (
    -

    Codestral API key

    +

    Codestral API key

    Note that codestral requires a different API key from other Mistral models @@ -189,7 +188,7 @@ function AddModelForm({ {selectedProvider.apiKeyUrl && (

    <> -
    )} - + {selectedProvider.collectInputFor && selectedProvider.collectInputFor .filter( @@ -225,7 +225,7 @@ function AddModelForm({ .map((field) => (
    <> -