diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 5808c675c..29e0a38a7 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -81,11 +81,16 @@ export async function constructAutocompletePrompt( // Find external snippets const snippets: AutocompleteSnippet[] = []; - const treePath = await getTreePathAtCursor( - filepath, - fullPrefix + fullSuffix, - fullPrefix.length - ); + let treePath; + try { + treePath = await getTreePathAtCursor( + filepath, + fullPrefix + fullSuffix, + fullPrefix.length + ); + } catch (e) { + console.error("Failed to parse AST", e); + } // Get function def when inside call expression if (treePath) { diff --git a/core/autocomplete/languages.ts b/core/autocomplete/languages.ts index 5bdc94da3..0571aec3b 100644 --- a/core/autocomplete/languages.ts +++ b/core/autocomplete/languages.ts @@ -15,7 +15,7 @@ export const Typescript = { export const Python = { stopWords: ["def", "class"], comment: "#", - endOfLine: [""], + endOfLine: [], }; // Java diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index 07a231bce..bc8a238fd 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -1,4 +1,5 @@ import { distance } from "fastest-levenshtein"; +import { DiffLine } from ".."; import { LineStream } from "../diff/util"; export async function* streamWithNewLines(stream: LineStream): LineStream { @@ -37,3 +38,163 @@ export async function* stopAtSimilarLine( yield nextLine; } } + +function shouldRemoveLineBeforeStart(line: string): boolean { + return ( + line.trimStart().startsWith("```") || + line.trim() === "[CODE]" || + line.trim() === "" + ); +} + +function shouldChangeLineAndStop(line: string): string | undefined { + if (line.trimStart() === "```") { + return line; + } + + if (line.includes("[/CODE]")) { + return line.split("[/CODE]")[0].trimEnd(); + } + + return undefined; +} + +export async function* filterCodeBlockLines(rawLines: LineStream): LineStream { + let seenValidLine = false; + + let waitingToSeeIfLineIsLast = undefined; + + for await (const line of rawLines) { + // Filter out starting ``` + if (!seenValidLine) { + if (shouldRemoveLineBeforeStart(line)) { + continue; + } else { + seenValidLine = true; + } + } + + // Filter out ending ``` + if (typeof waitingToSeeIfLineIsLast !== "undefined") { + yield waitingToSeeIfLineIsLast; + waitingToSeeIfLineIsLast = undefined; + } + + const changedEndLine = shouldChangeLineAndStop(line); + if (typeof changedEndLine === "string") { + yield changedEndLine; + return; + } + + if (line === "```") { + waitingToSeeIfLineIsLast = line; + } else { + yield line; + } + } +} + +function isEnglishFirstLine(line: string) { + line = line.trim().toLowerCase(); + if (line.endsWith(":") && !line.trimStart().startsWith("def")) { + return true; + } + if ( + line.startsWith("here is") || + line.startsWith("sure, here") || + line.startsWith("sure thing") || + line.startsWith("sure!") + ) { + return true; + } + + return false; +} + +export async function* filterEnglishLinesAtStart(lines: LineStream) { + let i = 0; + let wasEnglishFirstLine = false; + for await (let line of lines) { + if (i === 0) { + if (isEnglishFirstLine(line)) { + wasEnglishFirstLine = true; + i++; + continue; + } + } else if (i === 1 && wasEnglishFirstLine && line.trim() === "") { + i++; + continue; + } + i++; + yield line; + } +} + +function isEnglishPostExplanation(line: string): boolean { + const lower = line.toLowerCase(); + return ( + lower.startsWith("explanation:") || + lower.startsWith("here is") || + lower.startsWith("here's how") || + lower.startsWith("the above") + ); +} + +export async function* filterEnglishLinesAtEnd(lines: LineStream) { + let finishedCodeBlock = false; + for await (let line of lines) { + if (line.trim() === "```") { + finishedCodeBlock = true; + } + if (finishedCodeBlock && isEnglishPostExplanation(line)) { + break; + } + yield line; + } +} + +export async function* fixCodeLlamaFirstLineIndentation(lines: LineStream) { + let isFirstLine = true; + for await (let line of lines) { + if (isFirstLine && line.startsWith(" ")) { + yield line.slice(2); + isFirstLine = false; + } else { + yield line; + } + } +} + +function isUselessLine(line: string): boolean { + const trimmed = line.trim().toLowerCase(); + return trimmed === "" || trimmed === "```" || trimmed.startsWith("// end"); +} + +export async function* filterLeadingAndTrailingNewLineInsertion( + diffLines: AsyncGenerator +): AsyncGenerator { + let isFirst = true; + let buffer: DiffLine[] = []; + for await (let diffLine of diffLines) { + let isBlankLineInsertion = + diffLine.type === "new" && isUselessLine(diffLine.line); + if (isFirst && isBlankLineInsertion) { + isFirst = false; + continue; + } + isFirst = false; + + if (isBlankLineInsertion) { + buffer.push(diffLine); + } else { + if (diffLine.type === "old") { + buffer = []; + } else { + while (buffer.length > 0) { + yield buffer.shift()!; + } + } + yield diffLine; + } + } +} diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index 015cd1b8f..2b959b61a 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -45,10 +45,11 @@ The last line is incomplete, and you should provide the rest of that line. If th }; export function getTemplateForModel(model: string): AutocompleteTemplate { - const lowerCaseModel = model.toLowerCase() + const lowerCaseModel = model.toLowerCase(); if ( lowerCaseModel.includes("starcoder") || lowerCaseModel.includes("star-coder") || + lowerCaseModel.includes("starchat") || lowerCaseModel.includes("stable") ) { return stableCodeFimTemplate; diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index e20cc922b..9ebdb39c4 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -1,4 +1,12 @@ import { ContextItemWithId, ILLM, SlashCommand } from "../.."; +import { + filterCodeBlockLines, + filterEnglishLinesAtEnd, + filterEnglishLinesAtStart, + fixCodeLlamaFirstLineIndentation, + streamWithNewLines, +} from "../../autocomplete/lineStream"; +import { streamLines } from "../../diff/util"; import { stripImages } from "../../llm/countTokens"; import { dedentAndGetCommonWhitespace, renderPromptTemplate } from "../../util"; import { @@ -221,6 +229,15 @@ const EditSlashCommand: SlashCommand = { return; } + // Strip unecessary parts of the input (the fact that you have to do this is suboptimal, should be refactored away) + input = input.replace( + `\`\`\`${contextItemToEdit.name}\n${contextItemToEdit.content}\n\`\`\`\n`, + "" + ); + if (input.startsWith("/edit")) { + input = input.replace("/edit", "").trimStart(); + } + const rif: RangeInFileWithContents = contextItemToRangeInFileWithContents(contextItemToEdit); @@ -240,18 +257,17 @@ const EditSlashCommand: SlashCommand = { let prompt = compilePrompt(filePrefix, contents, fileSuffix, input); let fullFileContentsLines = fullFileContents.split("\n"); + let fullPrefixLines = fullFileContentsLines.slice( + 0, + Math.max(0, rif.range.start.line - 1) + ); + let fullSuffixLines = fullFileContentsLines.slice(rif.range.end.line); let linesToDisplay: string[] = []; async function sendDiffUpdate(lines: string[], final: boolean = false) { let completion = lines.join("\n"); - let fullPrefixLines = fullFileContentsLines.slice( - 0, - rif.range.start.line - ); - let fullSuffixLines = fullFileContentsLines.slice(rif.range.end.line); - // Don't do this at the very end, just show the inserted code if (final) { linesToDisplay = []; @@ -449,10 +465,19 @@ const EditSlashCommand: SlashCommand = { messages = rendered; } - generator = llm.streamComplete(rendered as string, { + const completion = llm.streamComplete(rendered as string, { maxTokens: Math.min(maxTokens, Math.floor(llm.contextLength / 2), 4096), raw: true, }); + let lineStream = streamLines(completion); + + lineStream = filterEnglishLinesAtStart(lineStream); + + lineStream = filterEnglishLinesAtEnd(filterCodeBlockLines(lineStream)); + + generator = streamWithNewLines( + fixCodeLlamaFirstLineIndentation(lineStream) + ); } else { async function* gen() { for await (let chunk of llm.streamChat(messages, { @@ -470,7 +495,6 @@ const EditSlashCommand: SlashCommand = { generator = gen(); } - let lastTaskTime = Date.now(); for await (let chunk of generator) { // Stop early if it is repeating the fileSuffix or the step was deleted if (repeatingFileSuffix) { @@ -508,7 +532,7 @@ const EditSlashCommand: SlashCommand = { else if ( (linesOfPrefixCopied > 0 || completionLinesCovered === 0) && linesOfPrefixCopied < filePrefix.split("\n").length && - chunkLines[i] === fullFileContentsLines[linesOfPrefixCopied] + chunkLines[i] === fullPrefixLines[linesOfPrefixCopied] ) { // This is a sketchy way of stopping it from repeating the filePrefix. Is a bug if output happens to have a matching line linesOfPrefixCopied += 1; @@ -533,17 +557,13 @@ const EditSlashCommand: SlashCommand = { currentLineInFile += 1; } - // Debounce the diff updates, last in only out for each period - if (lastTaskTime === null || Date.now() - lastTaskTime > 150) { - lastTaskTime = Date.now(); - await sendDiffUpdate( - lines.concat([ - unfinishedLine?.startsWith("<") - ? commonWhitespace - : commonWhitespace + unfinishedLine, - ]) - ); - } + await sendDiffUpdate( + lines.concat([ + unfinishedLine?.startsWith("<") + ? commonWhitespace + : commonWhitespace + unfinishedLine, + ]) + ); } // Add the unfinished line diff --git a/core/commands/slash/verticalEdit.ts b/core/commands/slash/verticalEdit.ts index 7cd0ba4d9..387f818a2 100644 --- a/core/commands/slash/verticalEdit.ts +++ b/core/commands/slash/verticalEdit.ts @@ -1,6 +1,13 @@ import { ContextItemWithId, DiffLine, ILLM, SlashCommand } from "../.."; +import { + filterCodeBlockLines, + filterEnglishLinesAtEnd, + filterEnglishLinesAtStart, + filterLeadingAndTrailingNewLineInsertion, + fixCodeLlamaFirstLineIndentation, +} from "../../autocomplete/lineStream"; import { streamDiff } from "../../diff/streamDiff"; -import { LineStream, streamLines } from "../../diff/util"; +import { streamLines } from "../../diff/util"; import { stripImages } from "../../llm/countTokens"; import { gptEditPrompt } from "../../llm/templates/edit"; import { @@ -13,61 +20,6 @@ import { contextItemToRangeInFileWithContents, } from "../util"; -function shouldRemoveLineBeforeStart(line: string): boolean { - return ( - line.trimStart().startsWith("```") || - line.trim() === "[CODE]" || - line.trim() === "" - ); -} - -function shouldChangeLineAndStop(line: string): string | undefined { - if (line.trimStart() === "```") { - return line; - } - - if (line.includes("[/CODE]")) { - return line.split("[/CODE]")[0].trimEnd(); - } - - return undefined; -} - -async function* filterCodeBlockLines(rawLines: LineStream): LineStream { - let seenValidLine = false; - - let waitingToSeeIfLineIsLast = undefined; - - for await (const line of rawLines) { - // Filter out starting ``` - if (!seenValidLine) { - if (shouldRemoveLineBeforeStart(line)) { - continue; - } else { - seenValidLine = true; - } - } - - // Filter out ending ``` - if (typeof waitingToSeeIfLineIsLast !== "undefined") { - yield waitingToSeeIfLineIsLast; - waitingToSeeIfLineIsLast = undefined; - } - - const changedEndLine = shouldChangeLineAndStop(line); - if (typeof changedEndLine === "string") { - yield changedEndLine; - return; - } - - if (line === "```") { - waitingToSeeIfLineIsLast = line; - } else { - yield line; - } - } -} - function constructPrompt( codeToEdit: string, llm: ILLM, @@ -97,88 +49,10 @@ async function* addIndentation( } } -function isEnglishFirstLine(line: string) { - line = line.trim().toLowerCase(); - if (line.endsWith(":") && !line.trimStart().startsWith("def")) { - return true; - } - if ( - line.startsWith("here is") || - line.startsWith("sure, here") || - line.startsWith("sure thing") || - line.startsWith("sure!") - ) { - return true; - } - - return false; -} - -async function* filterEnglishLines(lines: LineStream) { - let i = 0; - let wasEnglishFirstLine = false; - for await (let line of lines) { - if (i === 0) { - if (isEnglishFirstLine(line)) { - wasEnglishFirstLine = true; - i++; - continue; - } - } else if (i === 1 && wasEnglishFirstLine && line.trim() === "") { - i++; - continue; - } - i++; - yield line; - } -} - -async function* fixCodeLlamaFirstLineIndentation(lines: LineStream) { - let isFirstLine = true; - for await (let line of lines) { - if (isFirstLine && line.startsWith(" ")) { - yield line.slice(2); - isFirstLine = false; - } else { - yield line; - } - } -} - function modelIsInept(model: string): boolean { return !(model.includes("gpt") || model.includes("claude")); } -async function* filterLeadingAndTrailingNewLineInsertion( - diffLines: AsyncGenerator -): AsyncGenerator { - let isFirst = true; - let buffer: DiffLine[] = []; - for await (let diffLine of diffLines) { - let isBlankLineInsertion = - diffLine.type === "new" && - (diffLine.line.trim() === "" || diffLine.line.trim() === "```"); - if (isFirst && isBlankLineInsertion) { - isFirst = false; - continue; - } - isFirst = false; - - if (isBlankLineInsertion) { - buffer.push(diffLine); - } else { - if (diffLine.type === "old") { - buffer = []; - } else { - while (buffer.length > 0) { - yield buffer.shift()!; - } - } - yield diffLine; - } - } -} - export async function* streamDiffLines( oldCode: string, llm: ILLM, @@ -193,18 +67,16 @@ export async function* streamDiffLines( const prompt = constructPrompt(oldCode, llm, input, language); const inept = modelIsInept(llm.model); - console.log("Prompt:\n\n", prompt); - const completion = llm.streamComplete(prompt); let lines = streamLines(completion); if (inept) { - lines = filterEnglishLines(lines); + lines = filterEnglishLinesAtStart(lines); } lines = filterCodeBlockLines(lines); if (inept) { - lines = fixCodeLlamaFirstLineIndentation(lines); + lines = filterEnglishLinesAtEnd(fixCodeLlamaFirstLineIndentation(lines)); } let diffLines = streamDiff(oldLines, lines); diff --git a/core/config/load.ts b/core/config/load.ts index a26d2c2c6..34e7150ad 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -5,6 +5,7 @@ import { ContextProviderDescription, ContextProviderWithParams, ContinueConfig, + ContinueRcJson, CustomContextProvider, CustomLLM, EmbeddingsProviderDescription, @@ -36,7 +37,7 @@ import { } from "../util/paths"; function loadSerializedConfig( - workspaceConfigs: Partial[] + workspaceConfigs: ContinueRcJson[] ): SerializedContinueConfig { const configPath = getConfigJsonPath(); let contents = fs.readFileSync(configPath, "utf8"); @@ -116,7 +117,7 @@ function loadSerializedConfig( }); for (const workspaceConfig of workspaceConfigs) { - config = mergeJson(config, workspaceConfig); + config = mergeJson(config, workspaceConfig, workspaceConfig.mergeBehavior); } return config; @@ -164,19 +165,64 @@ async function intermediateToFinalConfig( ): Promise { const models: BaseLLM[] = []; for (const desc of config.models) { - let llm: BaseLLM | undefined; if (isModelDescription(desc)) { - llm = await llmFromDescription( + const llm = await llmFromDescription( desc, readFile, config.completionOptions, config.systemMessage ); + if (!llm) continue; + + if (llm.model === "AUTODETECT") { + try { + const modelNames = await llm.listModels(); + const detectedModels = await Promise.all( + modelNames.map(async (modelName) => { + return await llmFromDescription( + { + ...desc, + model: modelName, + title: llm.title + " - " + modelName, + }, + readFile, + config.completionOptions, + config.systemMessage + ); + }) + ); + models.push( + ...(detectedModels.filter( + (x) => typeof x !== "undefined" + ) as BaseLLM[]) + ); + } catch (e) { + console.warn("Error listing models: ", e); + } + } else { + models.push(llm); + } } else { - llm = new CustomLLMClass(desc); + const llm = new CustomLLMClass(desc); + if (llm.model === "AUTODETECT") { + try { + const modelNames = await llm.listModels(); + const models = modelNames.map( + (modelName) => + new CustomLLMClass({ + ...desc, + options: { ...desc.options, model: modelName }, + }) + ); + + models.push(...models); + } catch (e) { + console.warn("Error listing models: ", e); + } + } else { + models.push(llm); + } } - if (!llm) continue; - models.push(llm); } let autocompleteLlm: BaseLLM | undefined = undefined; @@ -308,7 +354,7 @@ async function buildConfigTs(browser: boolean) { async function loadFullConfigNode( readFile: (filepath: string) => Promise, - workspaceConfigs: Partial[] + workspaceConfigs: ContinueRcJson[] ): Promise { let serialized = loadSerializedConfig(workspaceConfigs); let intermediate = serializedToIntermediateConfig(serialized); diff --git a/core/context/providers/CodeHighlightsContextProvider.ts b/core/context/providers/CodeHighlightsContextProvider.ts index 0a1c149d7..b67ef57c5 100644 --- a/core/context/providers/CodeHighlightsContextProvider.ts +++ b/core/context/providers/CodeHighlightsContextProvider.ts @@ -6,7 +6,10 @@ import { } from "../.."; import { getBasename } from "../../util"; -const highlighterPromise = import("llm-code-highlighter/dist/index.continue"); +import { getHighlightsThatFit, ILLMContextSizer } from "llm-code-highlighter/dist/index.continue"; +import { countTokens } from "../../llm/countTokens"; + +const HIGHLIGHTS_TOKEN_BUDGET = 2000; class CodeHighlightsContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { @@ -32,10 +35,13 @@ class CodeHighlightsContextProvider extends BaseContextProvider { }; }) ); - const topPercentile = 0.5; - const highlighter = await highlighterPromise; - const repoMap = await highlighter.getRepoHighlights( - topPercentile, + const contextSizer = { + fits(content: string): boolean { + return countTokens(content, "") < HIGHLIGHTS_TOKEN_BUDGET; + } + } as ILLMContextSizer + const repoMap = await getHighlightsThatFit( + contextSizer, [], allFiles .filter((file) => file.content.length > 0) diff --git a/core/context/providers/CodeOutlineContextProvider.ts b/core/context/providers/CodeOutlineContextProvider.ts new file mode 100644 index 000000000..7c9e300a4 --- /dev/null +++ b/core/context/providers/CodeOutlineContextProvider.ts @@ -0,0 +1,57 @@ +import { BaseContextProvider } from ".."; +import { + ContextItem, + ContextProviderDescription, + ContextProviderExtras, +} from "../.."; +import { getBasename } from "../../util"; + +import { getFileOutlineHighlights } from "llm-code-highlighter/dist/index.continue"; + +class CodeOutlineContextProvider extends BaseContextProvider { + static description: ContextProviderDescription = { + title: "outline", + displayTitle: "Outline", + description: "Definition lines only (from open files)", + type: "normal", + }; + + async getContextItems( + query: string, + extras: ContextProviderExtras + ): Promise { + const ide = extras.ide; + const openFiles = await ide.getOpenFiles(); + const allFiles: { name: string; absPath: string; content: string }[] = + await Promise.all( + openFiles.map(async (filepath: string) => { + return { + name: getBasename(filepath), + absPath: filepath, + content: `${await ide.readFile(filepath)}`, + }; + }) + ); + const outlines = await getFileOutlineHighlights( + allFiles + .filter((file) => file.content.length > 0) + .map((file) => { + return { + relPath: file.name, + code: file.content, + }; + }) + ); + return [ + { + content: outlines ? outlines : "", + name: "Code Outline", + description: "Definition lines only (from open files)", + }, + ]; + } + + async load(): Promise {} +} + +export default CodeOutlineContextProvider; diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index df047b20b..e335a8363 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -1,7 +1,8 @@ import { BaseContextProvider } from ".."; import { ContextProviderName } from "../.."; import CodebaseContextProvider from "./CodebaseContextProvider"; -// import CodeHighlightsContextProvider from "./CodeHighlightsContextProvider"; +import CodeHighlightsContextProvider from "./CodeHighlightsContextProvider"; +import CodeOutlineContextProvider from "./CodeOutlineContextProvider"; import DiffContextProvider from "./DiffContextProvider"; import DocsContextProvider from "./DocsContextProvider"; import FileTreeContextProvider from "./FileTreeContextProvider"; @@ -29,7 +30,8 @@ const Providers: (typeof BaseContextProvider)[] = [ ProblemsContextProvider, FolderContextProvider, DocsContextProvider, - // CodeHighlightsContextProvider, + CodeHighlightsContextProvider, + CodeOutlineContextProvider, ]; export function contextProviderClassFromName( diff --git a/core/diff/util.ts b/core/diff/util.ts index ce9a33d66..9a41b18b8 100644 --- a/core/diff/util.ts +++ b/core/diff/util.ts @@ -66,11 +66,9 @@ export async function* streamLines( buffer = lines.pop() ?? ""; for (const line of lines) { yield line; - console.log(line); } } if (buffer.length > 0) { yield buffer; - console.log(buffer); } } diff --git a/core/ide/messaging.ts b/core/ide/messaging.ts index f8876a363..6b7cc639a 100644 --- a/core/ide/messaging.ts +++ b/core/ide/messaging.ts @@ -10,7 +10,7 @@ declare const vscode: any; function _postToIde(type: string, data: any) { if (typeof vscode === "undefined") { if (localStorage.getItem("ide") === "jetbrains") { - if ((window as any).postIntellijMessage === undefined) { + if (window.postIntellijMessage === undefined) { console.log( "Unable to send message: postIntellijMessage is undefined. ", type, @@ -18,7 +18,7 @@ function _postToIde(type: string, data: any) { ); throw new Error("postIntellijMessage is undefined"); } - (window as any).postIntellijMessage?.(type, data); + window.postIntellijMessage?.(type, data); return; } else { console.log("Unable to send message: vscode is undefined. ", type, data); @@ -85,7 +85,7 @@ export async function* ideStreamRequest( done = true; returnVal = event.data.message.data; } else { - buffer += event.data.message.content; + buffer += event.data.message.content || ""; } } }; @@ -100,6 +100,8 @@ export async function* ideStreamRequest( const chunk = buffer.slice(index); index = buffer.length; yield chunk; + } else { + yield undefined; } await new Promise((resolve) => setTimeout(resolve, 50)); } @@ -131,7 +133,9 @@ export async function* llmStreamChat( let next = await gen.next(); while (!next.done) { - yield { role: "user", content: next.value }; + if (next.value) { + yield { role: "user", content: next.value }; + } next = await gen.next(); } return { prompt: next.value?.prompt, completion: next.value?.completion }; diff --git a/core/index.d.ts b/core/index.d.ts index 17fac7448..1a1407d52 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1,5 +1,24 @@ import { BrowserSerializedContinueConfig } from "./config/load"; +declare global { + interface Window { + ide?: "vscode"; + windowId: string; + serverUrl: string; + vscMachineId: string; + vscMediaUrl: string; + fullColorTheme?: { + rules?: { + token?: string; + foreground?: string; + }[]; + }; + colorThemeName?: string; + workspacePaths?: string[]; + postIntellijMessage?: (type: string, data: any) => void; + } +} + export interface ChunkWithoutID { content: string; startLine: number; @@ -68,6 +87,8 @@ export interface ILLM extends LLMOptions { countTokens(text: string): number; supportsImages(): boolean; + + listModels(): Promise; } export type ContextProviderType = "normal" | "query" | "submenu"; @@ -264,6 +285,9 @@ export interface CustomLLMWithOptionals { options: CompletionOptions, fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise ) => AsyncGenerator; + listModels?: ( + fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise + ) => Promise; } /** @@ -429,6 +453,7 @@ type ModelProvider = | "flowise"; export type ModelName = + | "AUTODETECT" // OpenAI | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k" @@ -553,6 +578,7 @@ export interface TabAutocompleteOptions { maxSuffixPercentage: number; prefixPercentage: number; template?: string; + disableMultiLineCompletions?: boolean; } export interface SerializedContinueConfig { @@ -571,6 +597,12 @@ export interface SerializedContinueConfig { tabAutocompleteOptions?: Partial; } +export type ConfigMergeType = "merge" | "overwrite"; + +export type ContinueRcJson = Partial & { + mergeBehavior: ConfigMergeType; +}; + export interface Config { /** If set to true, Continue will collect anonymous usage data to improve the product. If set to false, we will collect nothing. Read here to learn more: https://continue.dev/docs/telemetry */ allowAnonymousTelemetry?: boolean; diff --git a/core/indexing/docs/crawl.ts b/core/indexing/docs/crawl.ts index 0152005f2..1f6fce52d 100644 --- a/core/indexing/docs/crawl.ts +++ b/core/indexing/docs/crawl.ts @@ -7,7 +7,6 @@ const IGNORE_PATHS_ENDING_IN = [ "favicon.ico", "robots.txt", ".rst.txt", - "index.html", // So as not to duplicate with "/" // ReadTheDocs "genindex", "py-modindex", diff --git a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts index c2c698586..7916bb691 100644 --- a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts +++ b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts @@ -27,7 +27,11 @@ class OllamaEmbeddingsProvider extends BaseEmbeddingsProvider { } embed(chunks: string[]) { - return Promise.all(chunks.map((chunk) => embedOne(chunk, this.options))); + const results: any = []; + for (const chunk of chunks) { + results.push(embedOne(chunk, this.options)); + } + return results; } } diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 1c8c54bcb..0b8454540 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -19,6 +19,7 @@ const CONTEXT_LENGTH_FOR_MODEL: { [name: string]: number } = { "gpt-4-turbo-preview": 128_000, "gpt-4-vision": 128_000, "gpt-4-0125-preview": 128_000, + "gpt-4-1106-preview": 128_000, }; const TOKEN_BUFFER_FOR_SAFETY = 350; diff --git a/core/llm/index.ts b/core/llm/index.ts index 0a406d992..e29a80dfe 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -12,6 +12,7 @@ import { TemplateType, } from ".."; import mergeJson from "../util/merge"; +import { Telemetry } from "../util/posthog"; import { autodetectPromptTemplates, autodetectTemplateFunction, @@ -123,6 +124,10 @@ export abstract class BaseLLM implements ILLM { this.projectId = options.projectId; } + listModels(): Promise { + return Promise.resolve([]); + } + private _compileChatMessages( options: CompletionOptions, messages: ChatMessage[], @@ -187,12 +192,16 @@ ${prompt}`; private _logTokensGenerated(model: string, completion: string) { let tokens = this.countTokens(completion); - // TODO - // posthogLogger.captureEvent("tokens_generated", { - // model: model, - // tokens: tokens, - // model_class: this.constructor.name, - // }); + Telemetry.capture("tokens_generated", { + model: model, + provider: this.providerName, + tokens: tokens, + }); + Telemetry.capture("tokensGenerated", { + model: model, + provider: this.providerName, + tokens: tokens, + }); } _fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise = @@ -430,6 +439,6 @@ ${prompt}`; if (typeof window === "undefined") { return true; } - return (window as any)?.ide !== "vscode"; + return window?.ide !== "vscode"; } } diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index 13cec060f..c9e1b770e 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -87,6 +87,16 @@ class FreeTrial extends BaseLLM { }; } } + + async listModels(): Promise { + return [ + "gpt-3.5-turbo", + "gpt-4", + "gemini-pro", + "gpt-4-vision-preview", + "codellama-70b", + ]; + } } export default FreeTrial; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index a4e90026e..7ec3df69c 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -18,8 +18,12 @@ class Ollama extends BaseLLM { constructor(options: LLMOptions) { super(options); + if (options.model === "AUTODETECT") { + return; + } this.fetch(`${this.apiBase}/api/show`, { method: "POST", + headers: {}, body: JSON.stringify({ name: this._getModel() }), }).then(async (response) => { if (response.status !== 200) { diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index ff2f1f664..7804b0ca5 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -21,7 +21,24 @@ const NON_CHAT_MODELS = [ "ada", ]; +const CHAT_ONLY_MODELS = [ + "gpt-3.5-turbo", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-16k", + "gpt-4", + "gpt-35-turbo-16k", + "gpt-35-turbo-0613", + "gpt-35-turbo", + "gpt-4-32k", + "gpt-4-turbo-preview", + "gpt-4-vision", + "gpt-4-0125-preview", + "gpt-4-1106-preview", +]; + class OpenAI extends BaseLLM { + public useLegacyCompletionsEndpoint = false; + static providerName: ModelProvider = "openai"; static defaultOptions: Partial = { apiBase: "https://api.openai.com/v1", @@ -74,9 +91,12 @@ class OpenAI extends BaseLLM { return completion; } - private _getCompletionUrl() { + + private _getEndpoint( + endpoint: "/chat/completions" | "/completions" | "/models" + ) { if (this.apiType === "azure") { - return `${this.apiBase}/openai/deployments/${this.engine}/completions?api-version=${this.apiVersion}`; + return `${this.apiBase}/openai/deployments/${this.engine}${endpoint}?api-version=${this.apiVersion}`; } else { let url = this.apiBase; if (!url) { @@ -88,7 +108,7 @@ class OpenAI extends BaseLLM { url = url.slice(0, -1); } - return url + "/completions"; + return url + endpoint; } } @@ -112,7 +132,7 @@ class OpenAI extends BaseLLM { args.prompt = prompt; delete args.messages; - const response = await this.fetch(this._getCompletionUrl(), { + const response = await this.fetch(this._getEndpoint("/completions"), { method: "POST", headers: { "Content-Type": "application/json", @@ -132,29 +152,15 @@ class OpenAI extends BaseLLM { } } - private _getChatUrl() { - if (this.apiType === "azure") { - return `${this.apiBase}/openai/deployments/${this.engine}/chat/completions?api-version=${this.apiVersion}`; - } else { - let url = this.apiBase; - if (!url) { - throw new Error( - "No API base URL provided. Please set the 'apiBase' option in config.json" - ); - } - if (url.endsWith("/")) { - url = url.slice(0, -1); - } - - return url + "/chat/completions"; - } - } - protected async *_streamChat( messages: ChatMessage[], options: CompletionOptions ): AsyncGenerator { - if (NON_CHAT_MODELS.includes(options.model)) { + if ( + !CHAT_ONLY_MODELS.includes(options.model) && + (NON_CHAT_MODELS.includes(options.model) || + this.useLegacyCompletionsEndpoint) + ) { for await (const content of this._legacystreamComplete( stripImages(messages[messages.length - 1]?.content || ""), options @@ -176,7 +182,7 @@ class OpenAI extends BaseLLM { ...m, content: m.content === "" ? " " : m.content, })) as any; - const response = await this.fetch(this._getChatUrl(), { + const response = await this.fetch(this._getEndpoint("/chat/completions"), { method: "POST", headers: { "Content-Type": "application/json", @@ -192,6 +198,19 @@ class OpenAI extends BaseLLM { } } } + + async listModels(): Promise { + const response = await this.fetch(this._getEndpoint("/models"), { + method: "GET", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "api-key": this.apiKey || "", // For Azure + }, + }); + + const data = await response.json(); + return data.data.map((m: any) => m.id); + } } export default OpenAI; diff --git a/core/llm/llms/Replicate.ts b/core/llm/llms/Replicate.ts index cafe25088..2efb6e8ae 100644 --- a/core/llm/llms/Replicate.ts +++ b/core/llm/llms/Replicate.ts @@ -1,27 +1,21 @@ import ReplicateClient from "replicate"; import { BaseLLM } from ".."; -import { - ChatMessage, - CompletionOptions, - LLMOptions, - ModelProvider, -} from "../.."; -import { stripImages } from "../countTokens"; +import { CompletionOptions, LLMOptions, ModelProvider } from "../.."; class Replicate extends BaseLLM { private static MODEL_IDS: { [name: string]: `${string}/${string}:${string}`; } = { "codellama-7b": - "meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e", + "meta/codellama-7b-instruct:aac3ab196f8a75729aab9368cd45ea6ad3fc793b6cda93b1ded17299df369332", "codellama-13b": - "meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7", + "meta/codellama-13b-instruct:a5e2d67630195a09b96932f5fa541fe64069c97d40cd0b69cdd91919987d0e7f", "codellama-34b": - "meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e", - "llama2-7b": - "meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e", - "llama2-13b": - "meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d", + "meta/codellama-34b-instruct:eeb928567781f4e90d2aba57a51baef235de53f907c214a4ab42adabf5bb9736", + "codellama-70b": + "meta/codellama-70b-instruct:a279116fe47a0f65701a8817188601e2fe8f4b9e04a518789655ea7b995851bf", + "llama2-7b": "meta/llama-2-7b-chat" as any, + "llama2-13b": "meta/llama-2-13b-chat" as any, "zephyr-7b": "nateraw/zephyr-7b-beta:b79f33de5c6c4e34087d44eaea4a9d98ce5d3f3a09522f7328eea0685003a931", "mistral-7b": @@ -69,18 +63,23 @@ class Replicate extends BaseLLM { prompt: string, options: CompletionOptions ): AsyncGenerator { - yield await this._complete(prompt, options); + const [model, args] = this._convertArgs(options, prompt); + for await (const event of this._replicate.stream(model, args)) { + if (event.event === "output") { + yield event.data; + } + } } - protected async *_streamChat( - messages: ChatMessage[], - options: CompletionOptions - ): AsyncGenerator { - const resp = await this.complete( - stripImages(messages[0]?.content || ""), - options - ); - } + // protected async *_streamChat( + // messages: ChatMessage[], + // options: CompletionOptions + // ): AsyncGenerator { + // const resp = await this.complete( + // stripImages(messages[0]?.content || ""), + // options + // ); + // } } export default Replicate; diff --git a/core/package-lock.json b/core/package-lock.json index 394c301d1..6ea8b6f89 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -17,11 +17,13 @@ "fastest-levenshtein": "^1.0.16", "handlebars": "^4.7.8", "js-tiktoken": "^1.0.8", - "llm-code-highlighter": "^0.0.3", + "llm-code-highlighter": "^0.0.9", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", + "ollama": "^0.4.6", "openai": "^4.20.1", - "replicate": "^0.23.0", + "posthog-node": "^3.6.2", + "replicate": "^0.26.0", "socket.io-client": "^4.7.3", "sqlite": "^5.1.1", "sqlite3": "^5.1.7", @@ -4770,9 +4772,9 @@ "dev": true }, "node_modules/llm-code-highlighter": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.3.tgz", - "integrity": "sha512-l/R+m6ngXRTYxzoCzqpBk5TiSVpS4Ek9fKx/PIy25HV6XDbCC6iOfVITPPSTGkh7NlI+tN5vWjdqUfN3YW+HwQ==", + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.9.tgz", + "integrity": "sha512-zBOOf7bv8c+H+ib9F+QSMLRxsKE64Y5+f9QQEGXwN4g4V8tdaTQHCXaHopAYMV73hJKt3hWqSOjVnfgGxk9npw==", "dependencies": { "graphology": "^0.25.4", "graphology-metrics": "^2.2.0", @@ -5413,6 +5415,14 @@ "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==" }, + "node_modules/ollama": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/ollama/-/ollama-0.4.6.tgz", + "integrity": "sha512-/Im2atcM9hAxOgEi7mc5pG2G+MeN4jFo1bubfCzAd8bZT6nQ3he5tr+jypGufau9+WQKY0MHhTajqKTNfnlZQA==", + "dependencies": { + "whatwg-fetch": "^3.6.20" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5717,6 +5727,18 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/posthog-node": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz", + "integrity": "sha512-tVIaShR3SxBx17AlAUS86jQTweKuJIFRedBB504fCz7YPnXJTYSrVcUHn5IINE2wu4jUQimQK6ihQr90Djrdrg==", + "dependencies": { + "axios": "^1.6.2", + "rusha": "^0.8.14" + }, + "engines": { + "node": ">=15.0.0" + } + }, "node_modules/prebuild-install": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", @@ -5799,6 +5821,15 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "optional": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -5941,14 +5972,57 @@ } }, "node_modules/replicate": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/replicate/-/replicate-0.23.0.tgz", - "integrity": "sha512-mR9cb4aDXWDAn7/GUMlOL3Jc7rnUys/AG6+R9Cum0xyU3e72a/o8NJ71pgQ6mCXZnEL5iWp/i6AD8Cgh8TA/bw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/replicate/-/replicate-0.26.0.tgz", + "integrity": "sha512-BR7zI/pJp11IuCZZ38hdJVZ07ZCfe6b3tbPuUpRIbt76sVKoGtQhn4Cp2H6/r6qU1fOO6dHadl2VKK4Y0j9Lkg==", "engines": { "git": ">=2.11.0", "node": ">=18.0.0", "npm": ">=7.19.0", "yarn": ">=1.7.0" + }, + "optionalDependencies": { + "readable-stream": ">=4.0.0" + } + }, + "node_modules/replicate/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "optional": true, + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/replicate/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "optional": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/require-directory": { @@ -6031,6 +6105,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rusha": { + "version": "0.8.14", + "resolved": "https://registry.npmjs.org/rusha/-/rusha-0.8.14.tgz", + "integrity": "sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA==" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -6912,6 +6991,11 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", diff --git a/core/package.json b/core/package.json index 50e0fdf21..dfb3e6f34 100644 --- a/core/package.json +++ b/core/package.json @@ -26,11 +26,13 @@ "fastest-levenshtein": "^1.0.16", "handlebars": "^4.7.8", "js-tiktoken": "^1.0.8", - "llm-code-highlighter": "^0.0.3", + "llm-code-highlighter": "^0.0.9", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", + "ollama": "^0.4.6", "openai": "^4.20.1", - "replicate": "^0.23.0", + "posthog-node": "^3.6.2", + "replicate": "^0.26.0", "socket.io-client": "^4.7.3", "sqlite": "^5.1.1", "sqlite3": "^5.1.7", diff --git a/core/util/index.ts b/core/util/index.ts index 06cce249c..80ef2e5c8 100644 --- a/core/util/index.ts +++ b/core/util/index.ts @@ -37,7 +37,7 @@ export function proxyFetch(url: string, init?: RequestInit): Promise { if (!(url.startsWith("http://") || url.startsWith("https://"))) { // Relative URL - const fullUrl = `${(window as any).vscMediaUrl}/${url}`; + const fullUrl = `${window.vscMediaUrl}/${url}`; return (window as any)._fetch(fullUrl, init); } diff --git a/core/util/merge.ts b/core/util/merge.ts index 1d30fe58a..f65c047a1 100644 --- a/core/util/merge.ts +++ b/core/util/merge.ts @@ -1,13 +1,19 @@ +import { ConfigMergeType } from ".."; + type JsonObject = { [key: string]: any }; -export function mergeJson(first: JsonObject, second: JsonObject): any { +export function mergeJson( + first: JsonObject, + second: JsonObject, + mergeBehavior?: ConfigMergeType +): any { first = { ...first }; try { for (var key in second) { let secondValue = second[key]; - if (!(key in first)) { + if (!(key in first) || mergeBehavior === "overwrite") { // New value first[key] = secondValue; continue; @@ -19,7 +25,7 @@ export function mergeJson(first: JsonObject, second: JsonObject): any { first[key] = [...firstValue, ...secondValue]; } else if (typeof secondValue === "object") { // Object - first[key] = mergeJson(firstValue, secondValue); + first[key] = mergeJson(firstValue, secondValue, mergeBehavior); } else { // Other (boolean, number, string) first[key] = secondValue; diff --git a/core/util/posthog.ts b/core/util/posthog.ts new file mode 100644 index 000000000..99bd3905d --- /dev/null +++ b/core/util/posthog.ts @@ -0,0 +1,33 @@ +export class Telemetry { + // Set to undefined whenever telemetry is disabled + static client: any = undefined; + static uniqueId: string = "NOT_UNIQUE"; + + static async capture(event: string, properties: any) { + Telemetry.client?.capture({ + distinctId: Telemetry.uniqueId, + event, + properties, + }); + } + + static shutdownPosthogClient() { + Telemetry.client?.shutdown(); + } + + static async setup(allow: boolean, uniqueId: string) { + if (!allow) { + Telemetry.client = undefined; + } else { + if (!Telemetry.client) { + const { PostHog } = await import("posthog-node"); + Telemetry.client = new PostHog( + "phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", + { + host: "https://app.posthog.com", + } + ); + } + } + } +} diff --git a/core/yarn.lock b/core/yarn.lock index 247947ed2..295c042b7 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -1079,7 +1079,7 @@ asynckit@^0.4.0: resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@^1.4.0: +axios@^1.4.0, axios@^1.6.2: version "1.6.5" resolved "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz" integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg== @@ -1246,6 +1246,14 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + cacache@^15.2.0: version "15.3.0" resolved "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz" @@ -2126,7 +2134,7 @@ iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -2695,10 +2703,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -llm-code-highlighter@^0.0.3: - version "0.0.3" - resolved "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.3.tgz" - integrity sha512-l/R+m6ngXRTYxzoCzqpBk5TiSVpS4Ek9fKx/PIy25HV6XDbCC6iOfVITPPSTGkh7NlI+tN5vWjdqUfN3YW+HwQ== +llm-code-highlighter@^0.0.9: + version "0.0.9" + resolved "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.9.tgz" + integrity sha512-zBOOf7bv8c+H+ib9F+QSMLRxsKE64Y5+f9QQEGXwN4g4V8tdaTQHCXaHopAYMV73hJKt3hWqSOjVnfgGxk9npw== dependencies: graphology "^0.25.4" graphology-metrics "^2.2.0" @@ -3070,6 +3078,13 @@ obliterator@^2.0.1, obliterator@^2.0.2: resolved "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== +ollama@^0.4.6: + version "0.4.6" + resolved "https://registry.npmjs.org/ollama/-/ollama-0.4.6.tgz" + integrity sha512-/Im2atcM9hAxOgEi7mc5pG2G+MeN4jFo1bubfCzAd8bZT6nQ3he5tr+jypGufau9+WQKY0MHhTajqKTNfnlZQA== + dependencies: + whatwg-fetch "^3.6.20" + once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" @@ -3242,6 +3257,14 @@ platform@^1.3.6: resolved "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz" integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg== +posthog-node@^3.6.2: + version "3.6.2" + resolved "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz" + integrity sha512-tVIaShR3SxBx17AlAUS86jQTweKuJIFRedBB504fCz7YPnXJTYSrVcUHn5IINE2wu4jUQimQK6ihQr90Djrdrg== + dependencies: + axios "^1.6.2" + rusha "^0.8.14" + prebuild-install@^7.1.1: version "7.1.1" resolved "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz" @@ -3269,6 +3292,11 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: ansi-styles "^5.0.0" react-is "^18.0.0" +process@^0.11.10: + version "0.11.10" + resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz" @@ -3356,15 +3384,28 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@>=4.0.0: + version "4.5.2" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz" + integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== + dependencies: + abort-controller "^3.0.0" + buffer "^6.0.3" + events "^3.3.0" + process "^0.11.10" + string_decoder "^1.3.0" + repeat-string@^1.5.4: version "1.6.1" resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== -replicate@^0.23.0: - version "0.23.0" - resolved "https://registry.npmjs.org/replicate/-/replicate-0.23.0.tgz" - integrity sha512-mR9cb4aDXWDAn7/GUMlOL3Jc7rnUys/AG6+R9Cum0xyU3e72a/o8NJ71pgQ6mCXZnEL5iWp/i6AD8Cgh8TA/bw== +replicate@^0.26.0: + version "0.26.0" + resolved "https://registry.npmjs.org/replicate/-/replicate-0.26.0.tgz" + integrity sha512-BR7zI/pJp11IuCZZ38hdJVZ07ZCfe6b3tbPuUpRIbt76sVKoGtQhn4Cp2H6/r6qU1fOO6dHadl2VKK4Y0j9Lkg== + optionalDependencies: + readable-stream ">=4.0.0" require-directory@^2.1.1: version "2.1.1" @@ -3409,6 +3450,11 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rusha@^0.8.14: + version "0.8.14" + resolved "https://registry.npmjs.org/rusha/-/rusha-0.8.14.tgz" + integrity sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA== + safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" @@ -3614,7 +3660,7 @@ streamx@^2.15.0: fast-fifo "^1.1.0" queue-tick "^1.0.1" -string_decoder@^1.1.1: +string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== @@ -3941,6 +3987,11 @@ webidl-conversions@^3.0.0: resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +whatwg-fetch@^3.6.20: + version "3.6.20" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz" + integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index 621be56b6..d976eac8e 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -112,6 +112,22 @@ Type '@issue' to reference the conversation in a GitHub issue. Make sure to incl } ``` +### Code Outline + +Type '@outline' to reference the outline of all currently open files. The outline of a files consists of only the function and class definitions in the file. Supported file extensions are '.js', '.mjs', '.go', '.c', '.cc', '.cs', '.cpp', '.el', '.ex', '.elm', '.java', '.ml', '.php', '.ql', '.rb', '.rs', '.ts' + +```json +{ "name": "outline" } +``` + +### Code Highlights + +Type '@highlights' to reference the 'highlights' from all currently open files. The highlights are computed using Paul Gauthier's so-called ['repomap'](https://aider.chat/docs/repomap.html) technique in [Aider Chat](https://github.com/paul-gauthier/aider). Supported file extensions are the same as for '@Outline' (behind the scenes, we use the corresponding tree-sitter grammars for language parsing). + +```json +{ "name": "highlights" } +``` + ### Requesting Context Providers Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new ContextProvider. diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 3fd875ee8..746737b6a 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1,6 +1,6 @@ { "title": "config.json", - "$ref": "#/definitions/continuedev__core__config__serialized_config__SerializedContinueConfig", + "$ref": "#/definitions/SerializedContinueConfig", "definitions": { "BaseCompletionOptions": { "title": "BaseCompletionOptions", @@ -335,7 +335,9 @@ "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", - "gpt-4-turbo-preview" + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "AUTODETECT" ] } } @@ -388,7 +390,8 @@ "phind-codellama-34b", "gemini-pro", "gpt-4-vision-preview", - "codellama-70b" + "codellama-70b", + "AUTODETECT" ] } } @@ -441,7 +444,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "AUTODETECT" ] }, { "type": "string" } @@ -622,7 +626,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "AUTODETECT" ] }, { "type": "string" } @@ -982,7 +987,9 @@ "folder", "issue", "docs", - "tree" + "tree", + "highlights", + "outline" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -998,7 +1005,9 @@ "Retrieve important pages from a documentation website, as determined by similarity search", "Index and retrieve the contents of any documentation site, using embeddings to find important snippets", "Display a file tree of the current workspace", - "Include a repo map showing important code objects" + "Include a repo map showing important code objects", + "Displays important snippets of code from the currently open files", + "Displays definition lines from the currently open files" ], "type": "string" }, @@ -1164,7 +1173,7 @@ ], "required": ["name"] }, - "continuedev__core__config__serialized_config__SerializedContinueConfig": { + "SerializedContinueConfig": { "title": "config.json", "type": "object", "properties": { @@ -1350,6 +1359,10 @@ "template": { "type": "string", "description": "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." + }, + "disableMultiLineCompletions": { + "type": "boolean", + "description": "If set to true, Continue will only complete a single line at a time." } }, "required": [] diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index 1230ee60e..dccb3fd0a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -178,7 +178,7 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { val workspacePaths = if (project.basePath != null) arrayOf(project.basePath) else emptyList() - continuePluginService.worksapcePaths = workspacePaths as Array + continuePluginService.workspacePaths = workspacePaths as Array } EditorFactory.getInstance().eventMulticaster.addSelectionListener( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt index 7e944a97a..ddfdb9d52 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt @@ -20,7 +20,7 @@ class ContinuePluginService(project: Project) : Disposable, DumbAware { var continuePluginWindow: ContinuePluginToolWindowFactory.ContinuePluginWindow? = null var ideProtocolClient: IdeProtocolClient? = null - var worksapcePaths: Array? = null + var workspacePaths: Array? = null var windowId: String = UUID.randomUUID().toString() override fun dispose() { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt index 8f83decf7..1f5104174 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt @@ -123,7 +123,7 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware { val jsonData = mutableMapOf( "type" to "onLoad", "windowId" to continuePluginService.windowId, - "workspacePaths" to continuePluginService.worksapcePaths, + "workspacePaths" to continuePluginService.workspacePaths, "vscMachineId" to getMachineUniqueID(), "vscMediaUrl" to "http://continue", ) diff --git a/extensions/vscode/.continueignore b/extensions/vscode/.continueignore index 27949aaf3..bdb320509 100644 --- a/extensions/vscode/.continueignore +++ b/extensions/vscode/.continueignore @@ -1 +1,2 @@ -media \ No newline at end of file +media +textmate-syntaxes \ No newline at end of file diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 3fd875ee8..746737b6a 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1,6 +1,6 @@ { "title": "config.json", - "$ref": "#/definitions/continuedev__core__config__serialized_config__SerializedContinueConfig", + "$ref": "#/definitions/SerializedContinueConfig", "definitions": { "BaseCompletionOptions": { "title": "BaseCompletionOptions", @@ -335,7 +335,9 @@ "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", - "gpt-4-turbo-preview" + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "AUTODETECT" ] } } @@ -388,7 +390,8 @@ "phind-codellama-34b", "gemini-pro", "gpt-4-vision-preview", - "codellama-70b" + "codellama-70b", + "AUTODETECT" ] } } @@ -441,7 +444,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "AUTODETECT" ] }, { "type": "string" } @@ -622,7 +626,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "AUTODETECT" ] }, { "type": "string" } @@ -982,7 +987,9 @@ "folder", "issue", "docs", - "tree" + "tree", + "highlights", + "outline" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -998,7 +1005,9 @@ "Retrieve important pages from a documentation website, as determined by similarity search", "Index and retrieve the contents of any documentation site, using embeddings to find important snippets", "Display a file tree of the current workspace", - "Include a repo map showing important code objects" + "Include a repo map showing important code objects", + "Displays important snippets of code from the currently open files", + "Displays definition lines from the currently open files" ], "type": "string" }, @@ -1164,7 +1173,7 @@ ], "required": ["name"] }, - "continuedev__core__config__serialized_config__SerializedContinueConfig": { + "SerializedContinueConfig": { "title": "config.json", "type": "object", "properties": { @@ -1350,6 +1359,10 @@ "template": { "type": "string", "description": "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." + }, + "disableMultiLineCompletions": { + "type": "boolean", + "description": "If set to true, Continue will only complete a single line at a time." } }, "required": [] diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json new file mode 100644 index 000000000..ea2a834e5 --- /dev/null +++ b/extensions/vscode/continue_rc_schema.json @@ -0,0 +1,1572 @@ +{ + "title": "config.json", + "$ref": "#/definitions/SerializedContinueConfig", + "definitions": { + "BaseCompletionOptions": { + "title": "BaseCompletionOptions", + "type": "object", + "properties": { + "temperature": { + "title": "Temperature", + "description": "The temperature of the completion.", + "type": "number" + }, + "topP": { + "title": "Top P", + "description": "The topP of the completion.", + "type": "number" + }, + "topK": { + "title": "Top K", + "description": "The topK of the completion.", + "type": "integer" + }, + "presencePenalty": { + "title": "Presence Penalty", + "description": "The presence penalty Aof the completion.", + "type": "number" + }, + "frequencePenalty": { + "title": "Frequency Penalty", + "description": "The frequency penalty of the completion.", + "type": "number" + }, + "mirostat": { + "title": "Mirostat", + "description": "Enable Mirostat sampling, controlling perplexity during text generation (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0). Only available for Ollama, LM Studio, and llama.cpp providers", + "type": "number" + }, + "stop": { + "title": "Stop", + "description": "The stop tokens of the completion.", + "type": "array", + "items": { + "type": "string" + } + }, + "maxTokens": { + "title": "Max Tokens", + "description": "The maximum number of tokens to generate.", + "default": 600, + "type": "integer" + } + } + }, + "RequestOptions": { + "title": "RequestOptions", + "type": "object", + "properties": { + "timeout": { + "title": "Timeout", + "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", + "default": 7200, + "type": "integer" + }, + "verifySsl": { + "title": "Verify Ssl", + "description": "Whether to verify SSL certificates for requests.", + "type": "boolean" + }, + "caBundlePath": { + "title": "Ca Bundle Path", + "description": "Path to a custom CA bundle to use when making the HTTP request", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "proxy": { + "title": "Proxy", + "description": "Proxy URL to use when making the HTTP request", + "type": "string" + }, + "headers": { + "title": "Headers", + "description": "Headers to use when making the HTTP request", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ModelDescription": { + "title": "ModelDescription", + "type": "object", + "properties": { + "title": { + "title": "Title", + "description": "The title you wish to give your model.", + "type": "string" + }, + "provider": { + "title": "Provider", + "description": "The provider of the model. This is used to determine the type of model, and how to interact with it.", + "enum": [ + "openai", + "free-trial", + "anthropic", + "together", + "ollama", + "huggingface-tgi", + "huggingface-inference-api", + "llama.cpp", + "replicate", + "google-palm", + "lmstudio", + "llamafile", + "mistral", + "deepinfra", + "flowise" + ], + "markdownEnumDescriptions": [ + "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/openai)", + "### Free Trial\nNew users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.py where it says `apiKey=\"\"` or select another model provider.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/freetrial)", + "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/anthropicllm)", + "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/togetherllm)", + "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/ollama)", + "### Huggingface TGI\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfacetgi)", + "### Huggingface Inference API\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfaceinferenceapi)", + "### Llama.cpp\nllama.cpp comes with a [built-in server](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#llamacppexampleserver) that can be run from source. To do this:\n\n1. Clone the repository with `git clone https://github.com/ggerganov/llama.cpp`.\n2. `cd llama.cpp`\n3. Run `make` to build the server.\n4. Download the model you'd like to use and place it in the `llama.cpp/models` directory (the best place to find models is [The Bloke on HuggingFace](https://huggingface.co/TheBloke))\n5. Run the llama.cpp server with the command below (replacing with the model you downloaded):\n\n```shell\n.\\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models/codellama-7b-instruct.Q8_0.gguf\n```\n\nAfter it's up and running, you can start using Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/llamacpp)", + "### Replicate\nReplicate is a hosted service that makes it easy to run ML models. To get started with Replicate:\n1. Obtain an API key from [here](https://replicate.com)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/replicatellm)", + "### Google PALM\nTo get started with Google Makersuite, obtain your API key from [here](https://makersuite.google.com) and paste it below.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/googlepalmapi)", + "### LMStudio\nLMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/lmstudio)", + "### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/llamafile)", + "### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)", + "### DeepInfra\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/deepinfra)" + ], + "type": "string" + }, + "model": { + "title": "Model", + "description": "The name of the model. Used to autodetect prompt template.", + "type": "string" + }, + "apiKey": { + "title": "Api Key", + "description": "OpenAI, Anthropic, Together, or other API key", + "type": "string" + }, + "apiBase": { + "title": "Api Base", + "description": "The base URL of the LLM API.", + "type": "string" + }, + "contextLength": { + "title": "Context Length", + "description": "The maximum context length of the LLM in tokens, as counted by countTokens.", + "default": 2048, + "type": "integer" + }, + "template": { + "title": "Template", + "description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here. Choose none if you are using vLLM or another server that automatically handles prompting.", + "enum": [ + "llama2", + "alpaca", + "zephyr", + "phind", + "anthropic", + "chatml", + "none", + "deepseek", + "openchat", + "xwin-coder", + "neural-chat", + "codellama-70b" + ], + "type": "string" + }, + "promptTemplates": { + "title": "Prompt Templates", + "markdownDescription": "A mapping of prompt template name ('edit' is currently the only one used in Continue) to a string giving the prompt template. See [here](https://continue.dev/docs/model-setup/configuration#customizing-the-edit-prompt) for an example.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "completionOptions": { + "title": "Completion Options", + "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", + "default": { + "temperature": null, + "topP": null, + "topK": null, + "presencePenalty": null, + "frequencyPenalty": null, + "stop": null, + "maxTokens": 600 + }, + "allOf": [ + { + "$ref": "#/definitions/BaseCompletionOptions" + } + ] + }, + "systemMessage": { + "title": "System Message", + "description": "A system message that will always be followed by the LLM", + "type": "string" + }, + "requestOptions": { + "title": "Request Options", + "description": "Options for the HTTP request to the LLM.", + "default": { + "timeout": 7200, + "verifySsl": null, + "caBundlePath": null, + "proxy": null, + "headers": null + }, + "allOf": [ + { + "$ref": "#/definitions/RequestOptions" + } + ] + }, + "apiType": { + "title": "Api Type", + "markdownDescription": "OpenAI API type, either `openai` or `azure`", + "enum": [ + "openai", + "azure" + ] + }, + "apiVersion": { + "title": "Api Version", + "description": "Azure OpenAI API version (e.g. 2023-07-01-preview)", + "type": "string" + }, + "engine": { + "title": "Engine", + "description": "Azure OpenAI engine", + "type": "string" + } + }, + "required": [ + "title", + "provider", + "model" + ], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "type": "str" + } + }, + "not": { + "required": [ + "provider" + ] + } + }, + "then": { + "properties": { + "model": { + "description": "Choose a provider first, then model options will be shown here." + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "openai", + "anthropic", + "google-palm", + "huggingface-inference-api", + "replicate", + "together" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "required": [ + "apiKey" + ] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "huggingface-tgi" + ] + } + } + }, + "then": { + "required": [ + "apiBase" + ] + }, + "required": [ + "provider" + ] + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "openai" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "engine": { + "type": "string" + }, + "apiType": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "openai" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "enum": [ + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-4", + "gpt-3.5-turbo-0613", + "gpt-4-32k", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "AUTODETECT" + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "replicate" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "codellama-7b", + "codellama-13b", + "codellama-34b", + "llama2-7b", + "llama2-13b" + ] + }, + { + "type": "string" + } + ] + }, + "markdownDescription": "Select a pre-defined option, or find an exact model ID from Replicate [here](https://replicate.com/collections/streaming-language-models)." + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "free-trial" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "enum": [ + "gpt-3.5-turbo", + "gpt-4", + "phind-codellama-34b", + "gemini-pro", + "gpt-4-vision-preview", + "codellama-70b", + "AUTODETECT" + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "openai" + ] + }, + "apiType": { + "not": { + "const": "azure" + } + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-4", + "gpt-3.5-turbo-0613", + "gpt-4-32k", + "gpt-4-turbo-preview", + "gpt-4-vision-preview", + "mistral-7b", + "mistral-8x7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "phind-codellama-34b", + "wizardcoder-7b", + "wizardcoder-13b", + "wizardcoder-34b", + "zephyr-7b", + "codeup-13b", + "deepseek-7b", + "deepseek-33b", + "neural-chat-7b", + "deepseek-1b", + "stable-code-3b", + "starcoder-1b", + "starcoder-3b", + "AUTODETECT" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "anthropic" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "claude-2", + "claude-instant-1" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "google-palm" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "enum": [ + "chat-bison-001", + "gemini-pro" + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "together" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "mistral-7b", + "mistral-8x7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "phind-codellama-34b" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option, or find an exact model string from Together AI [here](https://docs.together.ai/docs/inference-models)." + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "deepinfra" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "markdownDescription": "Find the model name you want to use from DeepInfra [here](https://deepinfra.com/models?type=text-generation)." + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "huggingface-tgi", + "huggingface-inference-api", + "llama.cpp", + "text-gen-webui", + "llamafile" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "mistral-7b", + "mistral-8x7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "phind-codellama-34b", + "wizardcoder-7b", + "wizardcoder-13b", + "wizardcoder-34b", + "zephyr-7b", + "codeup-13b", + "deepseek-7b", + "deepseek-33b", + "neural-chat-7b", + "deepseek-1b", + "stable-code-3b", + "starcoder-1b", + "starcoder-3b" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "ollama" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "mistral-7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "phi-2", + "phind-codellama-34b", + "wizardcoder-7b", + "wizardcoder-13b", + "wizardcoder-34b", + "zephyr-7b", + "codeup-13b", + "deepseek-7b", + "deepseek-33b", + "neural-chat-7b", + "deepseek-1b", + "stable-code-3b", + "starcoder-1b", + "starcoder-3b", + "AUTODETECT" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option, or find the exact model tag for an Ollama model [here](https://ollama.ai/library)." + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "mistral" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "enum": [ + "mistral-tiny", + "mistral-small", + "mistral-medium" + ] + } + } + } + }, + { + "if": { + "properties": { + "apiType": { + "const": "azure" + } + }, + "required": [ + "apiType" + ] + }, + "then": { + "required": [ + "engine", + "apiVersion", + "apiBase" + ] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "openai" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "useLegacyCompletionsEndpoint": { + "type": "boolean" + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "const": "llamafile" + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "llamafileCommand": { + "type": "string" + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "text-gen-webui" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "streamingUrl": { + "type": "string" + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "flowise" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "timeout": { + "title": "Timeout", + "description": "Set the timeout for each request to Flowise. If you are running a local version of Flowise it might takes a while to respond, you might want to set this to avoid timeouts.", + "default": 5000, + "type": "integer" + }, + "additionalHeaders": { + "description": "A list of additional headers", + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "title": "Key", + "description": "Header key", + "type": "string" + }, + "value": { + "title": "Value", + "description": "Header value", + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "additionalFlowiseConfiguration": { + "description": "A list of additional properties to be sent along `overrideConfig`", + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "title": "Key", + "description": "Configuration Property key", + "type": "string" + }, + "value": { + "title": "Value", + "description": "Configuration Property value" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "model": { + "anyOf": [ + { + "enum": [ + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-4", + "gpt-3.5-turbo-0613", + "gpt-4-32k", + "gpt-4-turbo-preview", + "gpt-4-vision-preview", + "mistral-7b", + "mistral-8x7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "phind-codellama-34b", + "wizardcoder-7b", + "wizardcoder-13b", + "wizardcoder-34b", + "zephyr-7b", + "codeup-13b", + "deepseek-7b", + "deepseek-33b", + "claude-2", + "chat-bison-001", + "gemini-pro", + "mistral-tiny", + "mistral-small", + "mistral-medium", + "deepseek-1b", + "stable-code-3b", + "starcoder-1b", + "starcoder-3b" + ] + }, + { + "type": "string" + } + ] + } + } + } + } + ] + }, + "ModelRoles": { + "title": "ModelRoles", + "type": "object", + "properties": { + "default": { + "title": "Default", + "description": "The default model. If other model roles are not set, they will fall back to default.", + "type": "string" + }, + "chat": { + "title": "Chat", + "description": "The model to use for chat. If not set, will fall back to default.", + "type": "string" + }, + "edit": { + "title": "Edit", + "description": "The model to use for editing. If not set, will fall back to default.", + "type": "string" + }, + "summarize": { + "title": "Summarize", + "description": "The model to use for summarization. If not set, will fall back to default.", + "type": "string" + } + }, + "required": [ + "default" + ] + }, + "SlashCommand": { + "title": "SlashCommand", + "type": "object", + "properties": { + "name": { + "title": "Name", + "anyOf": [ + { + "enum": [ + "issue", + "share", + "so", + "cmd", + "edit", + "comment", + "http", + "commit" + ], + "type": "string", + "markdownEnumDescriptions": [ + "Generate a link to a drafted GitHub issue", + "Export the current chat session to markdown", + "Reference StackOverflow to answer the question", + "Generate a terminal command and paste it into the terminal", + "Edit the highlighted code with given instructions", + "Add comments to the highlighted code", + "Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", + "Generate a commit message for the current changes" + ] + }, + { + "type": "string" + } + ] + }, + "description": { + "title": "Description", + "type": "string" + }, + "step": { + "title": "Step", + "description": "This property is no longer required and has no effect. To use a built-in slash command, instead set the 'name' property to one of the pre-configured options.", + "type": "string" + }, + "params": { + "title": "Params", + "default": {}, + "type": "object" + } + }, + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": [ + "issue" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "repositoryUrl": { + "type": "string", + "description": "Enter the URL of the GitHub repository for which you want to generate the issue." + } + }, + "required": [ + "repositoryUrl" + ] + } + }, + "required": [ + "params" + ] + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "edit" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "recap": { + "type": "boolean", + "markdownDescription": "If recap is set to `true`, Continue will generate a summary of the changes after making the edit." + }, + "tokenLimit": { + "type": "integer", + "markdownDescription": "By default, Continue doesn't let you edit extremely large ranges (beyond 1,200 tokens), because the LLM is unlikely to succeed. But if you would like to override this limit with the understanding of possible failure you may do so here." + } + } + } + } + } + } + ], + "required": [ + "name", + "description" + ] + }, + "CustomCommand": { + "title": "CustomCommand", + "type": "object", + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "prompt": { + "title": "Prompt", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + } + }, + "required": [ + "name", + "prompt", + "description" + ] + }, + "ContextProviderWithParams": { + "title": "ContextProviderWithParams", + "type": "object", + "properties": { + "name": { + "title": "Name", + "anyOf": [ + { + "enum": [ + "diff", + "terminal", + "open", + "google", + "search", + "http", + "codebase", + "problems", + "folder", + "issue", + "docs", + "tree", + "highlights", + "outline" + ], + "markdownEnumDescriptions": [ + "Reference the contents of the current changes as given by `git diff`", + "Reference the contents of the terminal", + "Reference the contents of all open or pinned files.", + "Enter a search phrase and include the Google search results as context", + "Reference the results of a ripgrep search in your codebase", + "Write a custom context provider at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", + "Use embeddings to automatically find relevant files from throughout the codebase", + "Reference all linting errors and warnings in the currently open file", + "Include important files from a folder in the prompt, as determined by similarity search", + "Reference GitHub issues from a repository", + "Retrieve important pages from a documentation website, as determined by similarity search", + "Index and retrieve the contents of any documentation site, using embeddings to find important snippets", + "Display a file tree of the current workspace", + "Include a repo map showing important code objects", + "Displays important snippets of code from the currently open files", + "Displays definition lines from the currently open files" + ], + "type": "string" + }, + { + "type": "string" + } + ] + }, + "params": { + "title": "Params", + "default": {}, + "type": "object" + } + }, + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": [ + "google" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "serperApiKey": { + "type": "string", + "description": "Your API key for https://serper.dev in order to get Google search results" + } + }, + "required": [ + "serperApiKey" + ] + } + }, + "required": [ + "params" + ] + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "open" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "onlyPinned": { + "type": "boolean", + "description": "If set to true, only 'pinned' files will be included.", + "default": false + } + } + } + } + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "issue" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "githubToken": { + "type": "string", + "description": "Your GitHub token to access the GitHub API. Required for private repositories." + }, + "repos": { + "type": "array", + "description": "A list of repositories to search for issues", + "items": { + "type": "object", + "properties": { + "owner": { + "type": "string", + "description": "The owner of the repository" + }, + "repo": { + "type": "string", + "description": "The name of the repository" + }, + "type": { + "type": "string", + "description": "The type of issues to search for", + "enum": [ + "open", + "closed", + "all" + ] + } + }, + "required": [ + "owner", + "repo" + ] + } + } + }, + "required": [ + "repos" + ] + } + }, + "required": [ + "params" + ] + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "http" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "url": { + "type": "string", + "description": "The HTTP endpoint of your context provider server." + } + }, + "required": [ + "url" + ] + } + }, + "required": [ + "params" + ] + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "codebase", + "folder" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "nRetrieve": { + "title": "N Retrieve", + "description": "Number of results to initially retrieve from vector database", + "default": 50, + "type": "integer" + }, + "nFinal": { + "title": "N Final", + "description": "Final number of results to use after re-ranking", + "default": 10, + "type": "integer" + }, + "useReranking": { + "title": "Use Reranking", + "description": "Whether to use re-ranking, which will allow initial selection of nRetrieve results, then will use an LLM to select the top nFinal results. Disabling re-ranking will give faster, but less accurate, results.", + "default": true, + "type": "boolean" + } + } + } + } + } + } + ], + "required": [ + "name" + ] + }, + "SerializedContinueConfig": { + "title": "config.json", + "type": "object", + "properties": { + "allowAnonymousTelemetry": { + "title": "Allow Anonymous Telemetry", + "markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data.", + "default": true, + "type": "boolean" + }, + "models": { + "title": "Models", + "default": [ + { + "title": "GPT-4 (trial)", + "provider": "free-trial", + "model": "gpt-4", + "apiKey": "" + } + ], + "type": "array", + "items": { + "$ref": "#/definitions/ModelDescription" + } + }, + "systemMessage": { + "title": "System Message", + "description": "A system message that will always be followed by the LLM", + "type": "string" + }, + "completionOptions": { + "title": "Completion Options", + "description": "Default options for completion. These will be overriden by any options set for a specific model.", + "default": { + "temperature": null, + "topP": null, + "topK": null, + "presencePenalty": null, + "frequencyPenalty": null, + "stop": null, + "maxTokens": 600 + }, + "allOf": [ + { + "$ref": "#/definitions/BaseCompletionOptions" + } + ] + }, + "slashCommands": { + "title": "Slash Commands", + "description": "An array of slash commands that let you map custom Steps to a shortcut.", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/SlashCommand" + } + }, + "customCommands": { + "title": "Custom Commands", + "description": "An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter / in the text input, it will act as a shortcut to the prompt.", + "default": [ + { + "name": "test", + "prompt": "Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.", + "description": "This is an example custom command. Use /config to edit it and create more" + } + ], + "type": "array", + "items": { + "$ref": "#/definitions/CustomCommand" + } + }, + "contextProviders": { + "title": "Context Providers", + "description": "A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/ContextProviderWithParams" + } + }, + "userToken": { + "title": "User Token", + "description": "An optional token to identify the user.", + "type": "string" + }, + "dataServerUrl": { + "title": "Data Server Url", + "description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.", + "default": "https://us-west1-autodebug.cloudfunctions.net", + "type": "string" + }, + "disableSummaries": { + "title": "Disable Summaries", + "markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.", + "default": false, + "type": "boolean" + }, + "disableIndexing": { + "title": "Disable Indexing", + "markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.", + "default": false, + "type": "boolean" + }, + "disableSessionTitles": { + "title": "Disable Session Titles", + "markdownDescription": "If set to `true`, Continue will not make extra requests to the LLM to generate a summary title of each session.", + "default": false, + "type": "boolean" + }, + "embeddingsProvider": { + "title": "Embeddings Provider", + "description": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser.", + "type": "object", + "properties": { + "provider": { + "enum": [ + "transformers.js", + "ollama", + "openai" + ] + }, + "model": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "apiBase": { + "type": "string" + } + }, + "required": [ + "provider" + ], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "enum": [ + "ollama" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "required": [ + "model" + ] + } + } + ] + }, + "tabAutocompleteModel": { + "title": "Tab Autocomplete Model", + "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using deepseek-coder:1.3b-base on a local Ollama instance.", + "default": { + "title": "Tab Autocomplete Model", + "provider": "ollama", + "model": "deepseek-coder:1.3b-base" + }, + "$ref": "#/definitions/ModelDescription" + }, + "tabAutocompleteOptions": { + "title": "TabAutocompleteOptions", + "type": "object", + "properties": { + "useCopyBuffer": { + "type": "boolean", + "description": "Determines whether the copy buffer will be considered when contructing the prompt." + }, + "useSuffix": { + "type": "boolean", + "description": "Determines whether to use the file suffix in the prompt." + }, + "maxPromptTokens": { + "type": "number", + "description": "The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context." + }, + "debounceDelay": { + "type": "number", + "description": "The delay in milliseconds before triggering autocomplete after a keystroke." + }, + "maxSuffixPercentage": { + "type": "number", + "description": "The maximum percentage of the prompt that can be dedicated to the suffix." + }, + "prefixPercentage": { + "type": "number", + "description": "The percentage of the input that should be dedicated to the prefix." + }, + "template": { + "type": "string", + "description": "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." + }, + "disableMultiLineCompletions": { + "type": "boolean", + "description": "If set to true, Continue will only complete a single line at a time." + } + }, + "required": [] + }, + "mergeBehavior": { + "type": "string", + "enum": [ + "merge", + "overwrite" + ], + "default": "merge", + "title": "Merge behavior", + "markdownDescription": "If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json." + } + } + } + } +} \ No newline at end of file diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index d169a5480..d28e20af7 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.8.12", + "version": "0.9.63", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.8.12", + "version": "0.9.63", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -14,6 +14,7 @@ "@types/jest": "^29.5.11", "@types/node-fetch": "^2.6.11", "@vscode/ripgrep": "^1.15.9", + "@vscode/test-electron": "^2.3.9", "axios": "^1.2.5", "core": "file:../../core", "cors": "^2.8.5", @@ -30,6 +31,7 @@ "https-proxy-agent": "^7.0.2", "ignore": "^5.3.0", "jest": "^29.7.0", + "mocha": "^10.3.0", "monaco-editor": "^0.45.0", "monaco-vscode-textmate-theme-converter": "^0.1.7", "ncp": "^2.0.0", @@ -46,7 +48,8 @@ "uuidv4": "^6.2.13", "vectordb": "^0.4.3", "vscode-languageclient": "^8.0.2", - "ws": "^8.13.0" + "ws": "^8.13.0", + "yarn": "^1.22.21" }, "devDependencies": { "@nestjs/common": "^8.4.7", @@ -62,7 +65,6 @@ "@types/ws": "^8.5.4", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", - "@vscode/test-electron": "^2.2.0", "@vscode/vsce": "^2.22.0", "cargo-cp-artifact": "^0.1", "esbuild": "^0.17.19", @@ -91,11 +93,13 @@ "fastest-levenshtein": "^1.0.16", "handlebars": "^4.7.8", "js-tiktoken": "^1.0.8", - "llm-code-highlighter": "^0.0.3", + "llm-code-highlighter": "^0.0.9", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", + "ollama": "^0.4.6", "openai": "^4.20.1", - "replicate": "^0.23.0", + "posthog-node": "^3.6.2", + "replicate": "^0.26.0", "socket.io-client": "^4.7.3", "sqlite": "^5.1.1", "sqlite3": "^5.1.7", @@ -1467,6 +1471,11 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, "node_modules/@istanbuljs/schema": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", @@ -1846,9 +1855,9 @@ "dev": true }, "node_modules/@lancedb/vectordb-darwin-arm64": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.8.tgz", - "integrity": "sha512-FpnJaw7KmNdD/FtOw9AcmPL5P+L04AcnfPj9ZyEjN8iCwB/qaOGYgdfBv+EbEtfHIsqA12q/1BRduu9KdB6BIA==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.9.tgz", + "integrity": "sha512-u56TXU0hvdLbknGwC7Ebza3/CUFeCTkoCy/sC6h0FtOGya+NV7jraAeXEwDzoZbfW08VYYxnp3TsCcpNU9lpTA==", "cpu": [ "arm64" ], @@ -1858,9 +1867,9 @@ ] }, "node_modules/@lancedb/vectordb-darwin-x64": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.8.tgz", - "integrity": "sha512-RafOEYyZIgphp8wPGuVLFaTc8aAqo0NCO1LQMx0mB0xV96vrdo0Mooivs+dYN3RFfSHtTKPw9O1Jc957Vp1TLg==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.9.tgz", + "integrity": "sha512-8BvRj4cgR2isbzoYl/srSWw7lmquVhqR9nw48AWWvkRBc/RPnBVFa5RdvUu7o+nLkNyRGPG8RzUFyIhd0WCDMw==", "cpu": [ "x64" ], @@ -1870,9 +1879,9 @@ ] }, "node_modules/@lancedb/vectordb-linux-arm64-gnu": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.8.tgz", - "integrity": "sha512-WlbYNfj4+v1hBHUluF+hnlG/A0ZaQFdXBTGDfHQniL11o+n3emWm4ujP5nSAoQHXjSH9DaOTGr/N4Mc9Xe+luw==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.9.tgz", + "integrity": "sha512-RcEDTm5heB0zjcZZGDIKqDPod4WIFmWttYZa2IsRNucWyf1IKhaOAK3oXJiQsYZ+ipRDH2384tmLxe03vhvjCQ==", "cpu": [ "arm64" ], @@ -1882,9 +1891,9 @@ ] }, "node_modules/@lancedb/vectordb-linux-x64-gnu": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.8.tgz", - "integrity": "sha512-z+qFJrDqnNEv4JcwYDyt51PHmWjuM/XaOlSjpBnyyuUImeY+QcwctMuyXt8+Q4zhuqQR1AhLKrMwCU+YmMfk5g==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.9.tgz", + "integrity": "sha512-HbvSym1WXgTTDb+gfEaD9R/x+NbI6PWM8PrqFaAXkhm2Zzi/eL9eHBl2vgTyYFbzUvucTYnHZzT8a8FzCuvW0A==", "cpu": [ "x64" ], @@ -1894,9 +1903,9 @@ ] }, "node_modules/@lancedb/vectordb-win32-x64-msvc": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.8.tgz", - "integrity": "sha512-VjUryVvEA04r0j4lU9pJy84cmjuQm1GhBzbPc8kwbn5voT4A6BPglrlNsU0Zc+j8Fbjyvauzw2lMEcMsF4F0rw==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.9.tgz", + "integrity": "sha512-owf2aLI5kawMmfJZl+MN4I19JSIe3j4+aW1TFbV3S4nT3oFiYs44kQAuyBqbvwVz7oQ97aVJONewssaFxCsYpA==", "cpu": [ "x64" ], @@ -2360,7 +2369,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, "engines": { "node": ">= 6" } @@ -2628,9 +2636,9 @@ "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { - "version": "16.18.79", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.79.tgz", - "integrity": "sha512-Qd7jdLR5zmnIyMhfDrfPqN5tUCvreVpP3Qrf2oSM+F7SNzlb/MwHISGUkdFHtevfkPJ3iAGyeQI/jsbh9EStgQ==" + "version": "16.18.80", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.80.tgz", + "integrity": "sha512-vFxJ1Iyl7A0+xB0uW1r1v504yItKZLdqg/VZELUZ4H02U0bXAgBisSQ8Erf0DMruNFz9ggoiEv6T8Ll9bTg8Jw==" }, "node_modules/@types/node-fetch": { "version": "2.6.11", @@ -2670,9 +2678,9 @@ "devOptional": true }, "node_modules/@types/react": { - "version": "18.2.54", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.54.tgz", - "integrity": "sha512-039k+vrVJymDoe2y+HLk3O3oI3sa+C8KNjuDKofqrIJK26ramnqLNj9VJTaxAzFGMvpW/79HrrAJapHzpQ9fGQ==", + "version": "18.2.55", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz", + "integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -2680,9 +2688,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.2.18", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.18.tgz", - "integrity": "sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw==", + "version": "18.2.19", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz", + "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==", "devOptional": true, "dependencies": { "@types/react": "*" @@ -2728,9 +2736,9 @@ "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "node_modules/@types/send": { @@ -3017,7 +3025,6 @@ "version": "2.3.9", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.9.tgz", "integrity": "sha512-z3eiChaCQXMqBnk2aHHSEkobmC2VRalFQN0ApOAtydL172zXGxTwGrRtviT5HnUB+Q+G3vtEYFtuQkYqBzYgMA==", - "dev": true, "dependencies": { "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", @@ -3032,7 +3039,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, "dependencies": { "debug": "4" }, @@ -3044,7 +3050,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, "dependencies": { "@tootallnate/once": "1", "agent-base": "6", @@ -3058,7 +3063,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -3295,6 +3299,14 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "engines": { + "node": ">=6" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -3430,8 +3442,7 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/array-back": { "version": "3.1.0", @@ -3763,6 +3774,11 @@ "node": ">=8" } }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, "node_modules/browserslist": { "version": "4.22.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", @@ -4002,9 +4018,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001584", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", - "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==", + "version": "1.0.30001587", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", + "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", "funding": [ { "type": "opencollective", @@ -4575,15 +4591,6 @@ "node": ">=10" } }, - "node_modules/concurrently/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/consola": { "version": "2.15.3", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", @@ -4651,8 +4658,7 @@ "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/cors": { "version": "2.8.5", @@ -4804,6 +4810,17 @@ } } }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/decode-named-character-reference": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", @@ -4897,17 +4914,20 @@ } }, "node_modules/define-data-property": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.2.tgz", - "integrity": "sha512-SRtsSqsDbgpJBbW3pABMCOt6rQyeM8s8RiyeSN8jYG8sYmt/kGJejbydttUsnDs1tadr19tvhT4ShwMyoqAm4g==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.3.tgz", + "integrity": "sha512-h3GBouC+RPtNX2N0hHVLo2ZwPYurq8mLmXpOLTsw71gr7lHt5VaI4vVkDUNOfiWmm48JEXe3VM7PmLX45AMmmg==", "dependencies": { "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.2", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/delayed-stream": { @@ -4970,9 +4990,9 @@ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, "node_modules/diff": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "engines": { "node": ">=0.3.1" } @@ -5107,15 +5127,20 @@ "safer-buffer": "^2.1.0" } }, + "node_modules/ecc-jsbn/node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.657", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.657.tgz", - "integrity": "sha512-On2ymeleg6QbRuDk7wNgDdXtNqlJLM2w4Agx1D/RiTmItiL+a9oq5p7HUa2ZtkAtGBe/kil2dq/7rPfkbe0r5w==" + "version": "1.4.666", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.666.tgz", + "integrity": "sha512-q4lkcbQrUdlzWCUOxk6fwEza6bNCfV12oi4AJph5UibguD1aTfL4uD0nuzFv9hbPANXQMuUS0MxPSHQ1gqq5dg==" }, "node_modules/emittery": { "version": "0.13.1", @@ -5353,7 +5378,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, "engines": { "node": ">=10" }, @@ -5952,7 +5976,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -5992,6 +6015,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -6534,9 +6565,9 @@ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" }, "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", + "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", "dependencies": { "function-bind": "^1.1.2" }, @@ -6553,6 +6584,14 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "bin": { + "he": "bin/he" + } + }, "node_modules/highlight.js": { "version": "11.9.0", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz", @@ -6655,9 +6694,9 @@ } }, "node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.1.tgz", + "integrity": "sha512-My1KCEPs6A0hb4qCVzYp8iEvA8j8YqcvXLZZH8C9OFuTYpYjHE7N2dtG3mRl1HMD4+VGXpF3XcDVcxGBT7yDZQ==", "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -6716,9 +6755,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.3.tgz", + "integrity": "sha512-kCnwztfX0KZJSLOBrcL0emLeFako55NWMovvyPP2AjsghNk9RB1yjSI+jVumPHYZsNXegNoqupSW9IY3afSH8w==", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -6784,8 +6823,7 @@ "node_modules/immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "dev": true + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" }, "node_modules/immer": { "version": "9.0.21", @@ -6926,10 +6964,17 @@ "node": ">=8" } }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } }, "node_modules/ipaddr.js": { "version": "1.9.1", @@ -7118,8 +7163,7 @@ "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/isexe": { "version": "2.0.0", @@ -7800,7 +7844,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -7809,9 +7852,9 @@ } }, "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" }, "node_modules/jsesc": { "version": "2.5.2", @@ -7986,7 +8029,6 @@ "version": "3.10.1", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", - "dev": true, "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", @@ -8046,7 +8088,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", - "dev": true, "dependencies": { "immediate": "~3.0.5" } @@ -8077,7 +8118,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -9011,6 +9051,140 @@ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", "dev": true }, + "node_modules/mocha": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", + "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "8.1.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mocha/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/monaco-editor": { "version": "0.45.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.45.0.tgz", @@ -9541,7 +9715,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -9616,8 +9789,7 @@ "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "node_modules/parent-module": { "version": "1.0.1", @@ -9889,9 +10061,9 @@ } }, "node_modules/postcss": { - "version": "8.4.34", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.34.tgz", - "integrity": "sha512-4eLTO36woPSocqZ1zIrFD2K1v6wH7pY1uBh0JIM2KKfrVtGvPFiAku6aNOP0W1Wr9qwnaCsF0Z+CrVnryB2A8Q==", + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", "funding": [ { "type": "opencollective", @@ -10027,9 +10199,9 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "node_modules/posthog-node": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.1.tgz", - "integrity": "sha512-nvuZngDjzbQ2L2NqaBRWONuQeA3Dv+A8qXGMlOnM3/x07tGUrNYItgrLQH8wCntx75/PUlKq3ftxyQqNprGZjA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz", + "integrity": "sha512-tVIaShR3SxBx17AlAUS86jQTweKuJIFRedBB504fCz7YPnXJTYSrVcUHn5IINE2wu4jUQimQK6ihQr90Djrdrg==", "dependencies": { "axios": "^1.6.2", "rusha": "^0.8.14" @@ -10142,8 +10314,7 @@ "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "node_modules/promise-inflight": { "version": "1.0.1", @@ -10307,6 +10478,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -10494,7 +10673,6 @@ "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -10508,8 +10686,7 @@ "node_modules/readable-stream/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "node_modules/readdirp": { "version": "3.6.0", @@ -11001,6 +11178,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/serve-static": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", @@ -11021,13 +11206,14 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", + "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", "dependencies": { - "define-data-property": "^1.1.1", + "define-data-property": "^1.1.2", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", + "get-intrinsic": "^1.2.3", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.1" }, @@ -11038,8 +11224,7 @@ "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" }, "node_modules/setprototypeof": { "version": "1.2.0", @@ -11066,13 +11251,17 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz", + "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -11177,15 +11366,15 @@ } }, "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.3.tgz", + "integrity": "sha512-vfuYK48HXCTFD03G/1/zkIls3Ebr2YNa4qU9gHDZdblHLiqhJrJGkY3+0Nx0JpN9qBhJbVObc1CNciT1bIZJxw==", "dependencies": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, @@ -11254,9 +11443,9 @@ "dev": true }, "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==" }, "node_modules/sshpk": { "version": "1.18.0", @@ -11282,6 +11471,11 @@ "node": ">=0.10.0" } }, + "node_modules/sshpk/node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, "node_modules/ssri": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", @@ -12149,9 +12343,9 @@ "dev": true }, "node_modules/undici": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.6.1.tgz", - "integrity": "sha512-J0GaEp0ztu/grIE2Uq57AbK6TRb+bWbOlxu0POCzhFKA6LKbwSAev+hDQaQcgUUA9CPs8Ky+cauzTHnQrtAQEA==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.6.2.tgz", + "integrity": "sha512-vSqvUE5skSxQJ5sztTZ/CdeJb1Wq0Hf44hlYMciqHghvz+K88U0l7D6u1VsndoFgskDcnU+nG3gYmMzJVzd9Qg==", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -12426,9 +12620,9 @@ } }, "node_modules/vectordb": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.8.tgz", - "integrity": "sha512-UnxMRhmMfjDoGzIcBMd4oISBYE60UtHXyiSbzWbvYwko6CPqQ6pc3FzpXer2qsfvEVqlNXQX+hDeMZ6gf2mtdQ==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.9.tgz", + "integrity": "sha512-BZ69hVqhxcaxYfdtqpUCjU9IeP/L1CxAYrylzoWxDBYFe9E78JTJdZc6jzQDWBdSGnlE5ZMbGwbP6kPxBHunTA==", "cpu": [ "x64", "arm64" @@ -12445,11 +12639,11 @@ "axios": "^1.4.0" }, "optionalDependencies": { - "@lancedb/vectordb-darwin-arm64": "0.4.8", - "@lancedb/vectordb-darwin-x64": "0.4.8", - "@lancedb/vectordb-linux-arm64-gnu": "0.4.8", - "@lancedb/vectordb-linux-x64-gnu": "0.4.8", - "@lancedb/vectordb-win32-x64-msvc": "0.4.8" + "@lancedb/vectordb-darwin-arm64": "0.4.9", + "@lancedb/vectordb-darwin-x64": "0.4.9", + "@lancedb/vectordb-linux-arm64-gnu": "0.4.9", + "@lancedb/vectordb-linux-x64-gnu": "0.4.9", + "@lancedb/vectordb-win32-x64-msvc": "0.4.9" } }, "node_modules/verror": { @@ -13228,6 +13422,11 @@ "node": ">=12.17" } }, + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==" + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -13405,6 +13604,47 @@ } }, "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", @@ -13412,6 +13652,19 @@ "node": ">=12" } }, + "node_modules/yarn": { + "version": "1.22.21", + "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.21.tgz", + "integrity": "sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg==", + "hasInstallScript": true, + "bin": { + "yarn": "bin/yarn.js", + "yarnpkg": "bin/yarn.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 4cf52877a..16971cc67 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.8.12", + "version": "0.9.63", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -65,7 +65,7 @@ "continue.enableTabAutocomplete": { "type": "boolean", "default": false, - "markdownDescription": "Enable Continue's experimental tab autocomplete feature. Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Tab Autocomplete](https://continue.dev/docs/walkthroughs/tab-autocomplete)" + "markdownDescription": "Enable Continue's experimental tab autocomplete feature (pre-release only). Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Tab Autocomplete](https://continue.dev/docs/walkthroughs/tab-autocomplete)" } } }, @@ -198,6 +198,12 @@ "mac": "shift+cmd+backspace", "key": "shift+ctrl+backspace" }, + { + "command": "continue.rejectDiff", + "mac": "cmd+z", + "key": "ctrl+z", + "when": "continue.streamingDiff" + }, { "command": "continue.quickEdit", "mac": "cmd+shift+l", @@ -397,7 +403,7 @@ }, { "fileMatch": ".continuerc.json", - "url": "./config_schema.json" + "url": "./continue_rc_schema.json" } ] }, @@ -433,7 +439,6 @@ "@types/ws": "^8.5.4", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", - "@vscode/test-electron": "^2.2.0", "@vscode/vsce": "^2.22.0", "cargo-cp-artifact": "^0.1", "esbuild": "^0.17.19", @@ -452,6 +457,7 @@ "@types/jest": "^29.5.11", "@types/node-fetch": "^2.6.11", "@vscode/ripgrep": "^1.15.9", + "@vscode/test-electron": "^2.3.9", "axios": "^1.2.5", "core": "file:../../core", "cors": "^2.8.5", @@ -468,6 +474,7 @@ "https-proxy-agent": "^7.0.2", "ignore": "^5.3.0", "jest": "^29.7.0", + "mocha": "^10.3.0", "monaco-editor": "^0.45.0", "monaco-vscode-textmate-theme-converter": "^0.1.7", "ncp": "^2.0.0", @@ -484,6 +491,7 @@ "uuidv4": "^6.2.13", "vectordb": "^0.4.3", "vscode-languageclient": "^8.0.2", - "ws": "^8.13.0" + "ws": "^8.13.0", + "yarn": "^1.22.21" } } diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 5e4308692..4db78c7cb 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -18,6 +18,17 @@ if (args[2] === "--target") { "config_schema.json", path.join("..", "..", "docs", "static", "schemas", "config.json") ); + // Modify and copy for .continuerc.json + const schema = JSON.parse(fs.readFileSync("config_schema.json", "utf8")); + schema.definitions.SerializedContinueConfig.properties.mergeBehavior = { + type: "string", + enum: ["merge", "overwrite"], + default: "merge", + title: "Merge behavior", + markdownDescription: + "If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json.", + }; + fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2)); if (!process.cwd().endsWith("vscode")) { // This is sometimes run from root dir instead (e.g. in VS Code tasks) diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index fe6c80773..488cbed00 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -1,4 +1,5 @@ import { getTsConfigPath, migrate } from "core/util/paths"; +import { Telemetry } from "core/util/posthog"; import * as fs from "fs"; import path from "path"; import { v4 } from "uuid"; @@ -13,6 +14,7 @@ import { setupStatusBar, } from "../lang-server/completionProvider"; import { vsCodeIndexCodebase } from "../util/indexCodebase"; +import { getExtensionVersion } from "../util/util"; import { getExtensionUri } from "../util/vscode"; import { setupInlineTips } from "./inlineTips"; @@ -147,38 +149,11 @@ export async function activateExtension(context: vscode.ExtensionContext) { // }); // })(); - try { - // Add icon theme for .continueignore - const iconTheme = vscode.workspace - .getConfiguration("workbench") - .get("iconTheme"); - - let found = false; - for (let i = vscode.extensions.all.length - 1; i >= 0; i--) { - if (found) { - break; - } - const extension = vscode.extensions.all[i]; - if (extension.packageJSON?.contributes?.iconThemes?.length > 0) { - for (const theme of extension.packageJSON.contributes.iconThemes) { - if (theme.id === iconTheme) { - const themePath = path.join(extension.extensionPath, theme.path); - const themeJson = JSON.parse(fs.readFileSync(themePath).toString()); - themeJson.iconDefinitions["_f_continue"] = { - fontCharacter: "⚙️", - fontColor: "#fff", - }; - themeJson.fileNames[".continueignore"] = "_f_continue"; - themeJson.fileNames[".continuerc.json"] = "_f_continue"; - themeJson.fileNames["config.json"] = "_f_continue"; - fs.writeFileSync(themePath, JSON.stringify(themeJson)); - found = true; - break; - } - } - } - } - } catch (e) { - console.log("Error adding .continueignore file icon: ", e); + // Load Continue configuration + if (!context.globalState.get("hasBeenInstalled")) { + context.globalState.update("hasBeenInstalled", true); + Telemetry.capture("install", { + extensionVersion: getExtensionVersion(), + }); } } diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 38cb8852a..a8484c105 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -11,7 +11,9 @@ import { streamEdit, verticalPerLineDiffManager, } from "./diff/verticalPerLine/manager"; +import { VsCodeIde } from "./ideProtocol"; import { AutocompleteOutcome } from "./lang-server/completionProvider"; +import { configHandler, llmFromTitle } from "./loadConfig"; function addHighlightedCodeToContext(edit: boolean) { const editor = vscode.window.activeTextEditor; @@ -152,14 +154,84 @@ const commandsMap: { [command: string]: (...args: any) => any } = { }, "continue.quickEdit": async () => { const selectionEmpty = vscode.window.activeTextEditor?.selection.isEmpty; - const text = await vscode.window.showInputBox({ + + let text = await vscode.window.showInputBox({ placeHolder: selectionEmpty - ? "Describe the code you want to generate" - : "Describe how to edit the highlighted code", + ? "Describe the code you want to generate (or press enter to add context first)" + : "Describe how to edit the highlighted code (or press enter to add context first)", title: "Continue Quick Edit", }); - if (text) { + + if (text === undefined) { + return; + } + + if (text.length > 0) { await streamEdit(text); + } else { + // Pick context first + const quickPickItems: Promise = configHandler + .loadConfig() + .then((config) => { + return ( + config.contextProviders + ?.filter((provider) => provider.description.type === "normal") + .map((provider) => { + return { + label: provider.description.displayTitle, + description: provider.description.title, + detail: provider.description.description, + }; + }) || [] + ); + }); + + const selectedProviders = await vscode.window.showQuickPick( + quickPickItems, + { + title: "Add Context", + canPickMany: true, + } + ); + + let text = await vscode.window.showInputBox({ + placeHolder: selectionEmpty + ? "Describe the code you want to generate (or press enter to add context first)" + : "Describe how to edit the highlighted code (or press enter to add context first)", + title: "Continue Quick Edit", + }); + if (text) { + const llm = await llmFromTitle(); + const config = await configHandler.loadConfig(); + const context = ( + await Promise.all( + selectedProviders?.map((providerTitle) => { + const provider = config.contextProviders?.find( + (provider) => + provider.description.title === providerTitle.description + ); + if (!provider) { + return []; + } + + return provider.getContextItems("", { + embeddingsProvider: config.embeddingsProvider, + ide: new VsCodeIde(), + llm, + fullInput: text || "", + selectedCode: [], + }); + }) || [] + ) + ).flat(); + + text = + context.map((item) => item.content).join("\n\n") + + "\n\n---\n\n" + + text; + + await streamEdit(text); + } } }, "continue.writeCommentsForCode": async () => { diff --git a/extensions/vscode/src/debugPanel.ts b/extensions/vscode/src/debugPanel.ts index 2b06b7e7f..a4c189701 100644 --- a/extensions/vscode/src/debugPanel.ts +++ b/extensions/vscode/src/debugPanel.ts @@ -525,9 +525,11 @@ export function getSidebarContent( }); }, })) { - if (update) { - respond({ content: update }); + if (abortedMessageIds.has(data.messageId)) { + abortedMessageIds.delete(data.messageId); + break; } + respond({ content: update }); } respond({ done: true }); break; @@ -639,6 +641,14 @@ export function getSidebarContent( break; } const document = editor.document; + + if (document.getText().trim() === "") { + editor.edit((editBuilder) => { + editBuilder.insert(document.positionAt(0), data.text); + }); + return; + } + const start = new vscode.Position(0, 0); const end = new vscode.Position( document.lineCount - 1, diff --git a/extensions/vscode/src/diff/horizontal.ts b/extensions/vscode/src/diff/horizontal.ts index d9c89bdd8..b782658af 100644 --- a/extensions/vscode/src/diff/horizontal.ts +++ b/extensions/vscode/src/diff/horizontal.ts @@ -102,14 +102,6 @@ class DiffManager { const rightUri = uriFromFilePath(newFilepath); const leftUri = uriFromFilePath(originalFilepath); const title = "Continue Diff"; - console.log( - "Opening diff window with ", - leftUri, - rightUri, - title, - newFilepath, - originalFilepath - ); vscode.commands.executeCommand("vscode.diff", leftUri, rightUri, title); const editor = vscode.window.activeTextEditor; diff --git a/extensions/vscode/src/diff/verticalPerLine/handler.ts b/extensions/vscode/src/diff/verticalPerLine/handler.ts index 9ed45928c..b6e60e3db 100644 --- a/extensions/vscode/src/diff/verticalPerLine/handler.ts +++ b/extensions/vscode/src/diff/verticalPerLine/handler.ts @@ -19,13 +19,27 @@ export class VerticalPerLineDiffHandler { private currentLineIndex: number; private cancelled: boolean = false; + public get range(): vscode.Range { + const startLine = Math.min(this.startLine, this.endLine); + const endLine = Math.max(this.startLine, this.endLine); + return new vscode.Range(startLine, 0, endLine, Number.MAX_SAFE_INTEGER); + } + private newLinesAdded: number = 0; - constructor(startLine: number, endLine: number, editor: vscode.TextEditor) { + public input?: string; + + constructor( + startLine: number, + endLine: number, + editor: vscode.TextEditor, + input?: string + ) { this.currentLineIndex = startLine; this.startLine = startLine; this.endLine = endLine; this.editor = editor; + this.input = input; this.redDecorationManager = new DecorationTypeRangeManager( redDecorationType, @@ -161,6 +175,11 @@ export class VerticalPerLineDiffHandler { } clear(accept: boolean) { + vscode.commands.executeCommand( + "setContext", + "continue.streamingDiff", + false + ); const rangesToDelete = accept ? this.redDecorationManager.getRanges() : this.greenDecorationManager.getRanges(); diff --git a/extensions/vscode/src/diff/verticalPerLine/manager.ts b/extensions/vscode/src/diff/verticalPerLine/manager.ts index a85b58100..f42d42e9a 100644 --- a/extensions/vscode/src/diff/verticalPerLine/manager.ts +++ b/extensions/vscode/src/diff/verticalPerLine/manager.ts @@ -11,7 +11,8 @@ class VerticalPerLineDiffManager { createVerticalPerLineDiffHandler( filepath: string, startLine: number, - endLine: number + endLine: number, + input: string ) { if (this.filepathToEditorMap.has(filepath)) { this.filepathToEditorMap.get(filepath)?.clear(false); @@ -22,7 +23,8 @@ class VerticalPerLineDiffManager { const handler = new VerticalPerLineDiffHandler( startLine, endLine, - editor + editor, + input ); this.filepathToEditorMap.set(filepath, handler); return handler; @@ -87,50 +89,57 @@ export async function streamEdit(input: string) { const startLine = editor.selection.start.line; const endLine = editor.selection.end.line; + const existingHandler = + verticalPerLineDiffManager.getHandlerForFile(filepath); + existingHandler?.clear(false); + await new Promise((resolve) => { + setTimeout(resolve, 200); + }); const diffHandler = verticalPerLineDiffManager.createVerticalPerLineDiffHandler( filepath, - startLine, - endLine + existingHandler?.range.start.line ?? startLine, + existingHandler?.range.end.line ?? endLine, + input ); + if (!diffHandler) { + return; + } - if (diffHandler) { - const selectedRange = new vscode.Range( + const selectedRange = + existingHandler?.range ?? + new vscode.Range( editor.selection.start.with(undefined, 0), editor.selection.end.with(undefined, Number.MAX_SAFE_INTEGER) ); - const rangeContent = editor.document.getText(selectedRange); - const llm = await llmFromTitle(); + const rangeContent = editor.document.getText(selectedRange); + const llm = await llmFromTitle(); - // Unselect the range - editor.selection = new vscode.Selection( - editor.selection.active, - editor.selection.active - ); + // Unselect the range + editor.selection = new vscode.Selection( + editor.selection.active, + editor.selection.active + ); - vscode.commands.executeCommand( - "setContext", - "continue.streamingDiff", - true - ); + vscode.commands.executeCommand("setContext", "continue.streamingDiff", true); - try { - await diffHandler.run( - streamDiffLines( - rangeContent, - llm, - input, - getMarkdownLanguageTagForFile(filepath) - ) - ); - } finally { - vscode.commands.executeCommand( - "setContext", - "continue.streamingDiff", - false + if (existingHandler?.input) { + if (existingHandler.input.startsWith("Original request: ")) { + existingHandler.input = existingHandler.input.substring( + "Original request: ".length ); } + input = `Original request: ${existingHandler.input}\nUpdated request: ${input}`; } + + await diffHandler.run( + streamDiffLines( + rangeContent, + llm, + input, + getMarkdownLanguageTagForFile(filepath) + ) + ); } export interface VerticalDiffCodeLens { diff --git a/extensions/vscode/src/extension.ts b/extensions/vscode/src/extension.ts index 725d09480..a4cc680c3 100644 --- a/extensions/vscode/src/extension.ts +++ b/extensions/vscode/src/extension.ts @@ -2,33 +2,11 @@ * This is the entry point for the extension. */ +import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; import { getExtensionVersion } from "./util/util"; -import { getUniqueId } from "./util/vscode"; - -let client: any = undefined; -export async function capture(args: any) { - if (!client) { - const { PostHog } = await import("posthog-node"); - client = new PostHog("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { - host: "https://app.posthog.com", - }); - } - client.capture(args); -} async function dynamicImportAndActivate(context: vscode.ExtensionContext) { - if (!context.globalState.get("hasBeenInstalled")) { - context.globalState.update("hasBeenInstalled", true); - capture({ - distinctId: getUniqueId(), - event: "install", - properties: { - extensionVersion: getExtensionVersion(), - }, - }); - } - const { activateExtension } = await import("./activation/activate"); try { await activateExtension(context); @@ -56,13 +34,9 @@ export function activate(context: vscode.ExtensionContext) { } export function deactivate() { - capture({ - distinctId: getUniqueId(), - event: "deactivate", - properties: { - extensionVersion: getExtensionVersion(), - }, + Telemetry.capture("deactivate", { + extensionVersion: getExtensionVersion(), }); - client?.shutdown(); + Telemetry.shutdownPosthogClient(); } diff --git a/extensions/vscode/src/lang-server/codeLens.ts b/extensions/vscode/src/lang-server/codeLens.ts index 46331654f..04915b777 100644 --- a/extensions/vscode/src/lang-server/codeLens.ts +++ b/extensions/vscode/src/lang-server/codeLens.ts @@ -41,7 +41,7 @@ class VerticalPerLineCodeLensProvider implements vscode.CodeLensProvider { if (codeLenses.length === 2) { codeLenses.push( new vscode.CodeLens(range, { - title: `(${getMetaKeyLabel()}⇧↩/${getMetaKeyLabel()}⇧⌫ to accept/reject all)`, + title: `(${getMetaKeyLabel()}⇧↩/${getMetaKeyLabel()}⇧⌫ to accept/reject all, ${getMetaKeyLabel()}⇧L to retry)`, command: "", }) ); diff --git a/extensions/vscode/src/lang-server/completionProvider.ts b/extensions/vscode/src/lang-server/completionProvider.ts index c63635cac..515bbb9f2 100644 --- a/extensions/vscode/src/lang-server/completionProvider.ts +++ b/extensions/vscode/src/lang-server/completionProvider.ts @@ -13,6 +13,7 @@ import { import { DEFAULT_AUTOCOMPLETE_OPTS } from "core/autocomplete/parameters"; import { getTemplateForModel } from "core/autocomplete/templates"; import { streamLines } from "core/diff/util"; +import OpenAI from "core/llm/llms/OpenAI"; import Handlebars from "handlebars"; import { v4 as uuidv4 } from "uuid"; import * as vscode from "vscode"; @@ -253,6 +254,9 @@ async function getTabCompletion( try { // Model const llm = await TabAutocompleteModel.get(); + if (llm instanceof OpenAI) { + llm.useLegacyCompletionsEndpoint = true; + } if (!llm) return; // Prompt @@ -300,17 +304,21 @@ async function getTabCompletion( setupStatusBar(true, true); // Try to reuse pending requests if what the user typed matches start of completion + let stop = [ + ...(completionOptions?.stop || []), + "\n\n", + "```", + ...lang.stopWords, + ]; + if (options.disableMultiLineCompletions) { + stop.unshift("\n"); + } let generator = GeneratorReuseManager.getGenerator(prefix, () => llm.streamComplete(prompt, { ...completionOptions, temperature: 0, raw: true, - stop: [ - ...(completionOptions?.stop || []), - "\n\n", - "```", - ...lang.stopWords, - ], + stop, }) ); diff --git a/extensions/vscode/src/loadConfig.ts b/extensions/vscode/src/loadConfig.ts index 7d0eb4289..4f2ddc502 100644 --- a/extensions/vscode/src/loadConfig.ts +++ b/extensions/vscode/src/loadConfig.ts @@ -1,4 +1,4 @@ -import { ContinueConfig, ILLM, SerializedContinueConfig } from "core"; +import { ContinueConfig, ContinueRcJson, ILLM } from "core"; import defaultConfig from "core/config/default"; import { finalToBrowserConfig, @@ -8,6 +8,7 @@ import { } from "core/config/load"; import Ollama from "core/llm/llms/Ollama"; import { getConfigJsonPath } from "core/util/paths"; +import { Telemetry } from "core/util/posthog"; import { http, https } from "follow-redirects"; import * as fs from "fs"; import { HttpProxyAgent } from "http-proxy-agent"; @@ -16,6 +17,7 @@ import fetch from "node-fetch"; import * as vscode from "vscode"; import { ideProtocolClient } from "./activation/activate"; import { debugPanelWebview, webviewRequest } from "./debugPanel"; +import { getUniqueId } from "./util/vscode"; const tls = require("tls"); const outputChannel = vscode.window.createOutputChannel( @@ -33,7 +35,7 @@ class VsCodeConfigHandler { private async _getWorkspaceConfigs() { const workspaceDirs = vscode.workspace.workspaceFolders?.map((folder) => folder.uri) || []; - const configs: Partial[] = []; + const configs: ContinueRcJson[] = []; for (const workspaceDir of workspaceDirs) { const files = await vscode.workspace.fs.readDirectory(workspaceDir); for (const [filename, type] of files) { @@ -53,7 +55,7 @@ class VsCodeConfigHandler { if (this.savedConfig) { return this.savedConfig; } - let workspaceConfigs: any[] = []; + let workspaceConfigs: ContinueRcJson[] = []; try { workspaceConfigs = await this._getWorkspaceConfigs(); } catch (e) { @@ -71,6 +73,12 @@ class VsCodeConfigHandler { const browserConfig = finalToBrowserConfig(this.savedConfig); debugPanelWebview?.postMessage({ type: "configUpdate", browserConfig }); + // Setup telemetry only after (and if) we know it is enabled + await Telemetry.setup( + this.savedConfig.allowAnonymousTelemetry ?? true, + getUniqueId() + ); + return this.savedConfig; } catch (e) { vscode.window diff --git a/extensions/vscode/src/util/traverseDirectory.ts b/extensions/vscode/src/util/traverseDirectory.ts index 2aa964280..a1bc63d95 100644 --- a/extensions/vscode/src/util/traverseDirectory.ts +++ b/extensions/vscode/src/util/traverseDirectory.ts @@ -49,6 +49,8 @@ const DEFAULT_IGNORE_FILETYPES = [ "*.webm", "*.jar", "*.onnx", + "*.parquet", + "*.pqt", ]; export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); const DEFAULT_IGNORE_DIRS = [ diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 9a1bcbe1f..4d470fefc 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -696,10 +696,10 @@ resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz" integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== -"@lancedb/vectordb-darwin-arm64@*", "@lancedb/vectordb-darwin-arm64@0.4.8": - version "0.4.8" - resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.8.tgz" - integrity sha512-FpnJaw7KmNdD/FtOw9AcmPL5P+L04AcnfPj9ZyEjN8iCwB/qaOGYgdfBv+EbEtfHIsqA12q/1BRduu9KdB6BIA== +"@lancedb/vectordb-darwin-arm64@*", "@lancedb/vectordb-darwin-arm64@0.4.9": + version "0.4.9" + resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.9.tgz" + integrity sha512-u56TXU0hvdLbknGwC7Ebza3/CUFeCTkoCy/sC6h0FtOGya+NV7jraAeXEwDzoZbfW08VYYxnp3TsCcpNU9lpTA== "@lukeed/csprng@^1.0.0": version "1.1.0" @@ -1128,9 +1128,9 @@ form-data "^4.0.0" "@types/node@*", "@types/node@>= 14", "@types/node@16.x": - version "16.18.79" - resolved "https://registry.npmjs.org/@types/node/-/node-16.18.79.tgz" - integrity sha512-Qd7jdLR5zmnIyMhfDrfPqN5tUCvreVpP3Qrf2oSM+F7SNzlb/MwHISGUkdFHtevfkPJ3iAGyeQI/jsbh9EStgQ== + version "16.18.80" + resolved "https://registry.npmjs.org/@types/node/-/node-16.18.80.tgz" + integrity sha512-vFxJ1Iyl7A0+xB0uW1r1v504yItKZLdqg/VZELUZ4H02U0bXAgBisSQ8Erf0DMruNFz9ggoiEv6T8Ll9bTg8Jw== "@types/node@20.3.0": version "20.3.0" @@ -1163,16 +1163,16 @@ integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== "@types/react-dom@^16.8 || ^17.0 || ^18.0", "@types/react-dom@^18.2.4": - version "18.2.18" - resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.18.tgz" - integrity sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw== + version "18.2.19" + resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz" + integrity sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA== dependencies: "@types/react" "*" "@types/react@*", "@types/react@^16.8 || ^17.0 || ^18.0", "@types/react@^18.0.28", "@types/react@>=16": - version "18.2.54" - resolved "https://registry.npmjs.org/@types/react/-/react-18.2.54.tgz" - integrity sha512-039k+vrVJymDoe2y+HLk3O3oI3sa+C8KNjuDKofqrIJK26ramnqLNj9VJTaxAzFGMvpW/79HrrAJapHzpQ9fGQ== + version "18.2.55" + resolved "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz" + integrity sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -1201,9 +1201,9 @@ integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A== "@types/semver@^7.3.12": - version "7.5.6" - resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz" - integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== + version "7.5.7" + resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz" + integrity sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg== "@types/send@*": version "0.17.4" @@ -1369,7 +1369,7 @@ proxy-from-env "^1.1.0" yauzl "^2.9.2" -"@vscode/test-electron@^2.2.0": +"@vscode/test-electron@^2.3.9": version "2.3.9" resolved "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.9.tgz" integrity sha512-z3eiChaCQXMqBnk2aHHSEkobmC2VRalFQN0ApOAtydL172zXGxTwGrRtviT5HnUB+Q+G3vtEYFtuQkYqBzYgMA== @@ -1485,6 +1485,11 @@ ajv@^6.12.3, ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" @@ -1812,6 +1817,11 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + browserslist@^4.22.2, "browserslist@>= 4.21.0": version "4.22.3" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz" @@ -1894,7 +1904,7 @@ cacheable-request@^7.0.2: normalize-url "^6.0.1" responselike "^2.0.0" -call-bind@^1.0.0: +call-bind@^1.0.6: version "1.0.6" resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.6.tgz" integrity sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg== @@ -1924,15 +1934,20 @@ camelcase@^5.3.1: resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + camelcase@^6.2.0: version "6.3.0" resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001580: - version "1.0.30001584" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz" - integrity sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ== + version "1.0.30001587" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz" + integrity sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA== cargo-cp-artifact@^0.1: version "0.1.8" @@ -2008,7 +2023,7 @@ cheerio@^1.0.0-rc.9: parse5 "^7.0.0" parse5-htmlparser2-tree-adapter "^7.0.0" -chokidar@^3.5.3: +chokidar@^3.5.3, chokidar@3.5.3: version "3.5.3" resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -2304,11 +2319,13 @@ core-util-is@1.0.2: fastest-levenshtein "^1.0.16" handlebars "^4.7.8" js-tiktoken "^1.0.8" - llm-code-highlighter "^0.0.3" + llm-code-highlighter "^0.0.9" node-fetch "^3.3.2" node-html-markdown "^1.3.0" + ollama "^0.4.6" openai "^4.20.1" - replicate "^0.23.0" + posthog-node "^3.6.2" + replicate "^0.26.0" socket.io-client "^4.7.3" sqlite "^5.1.1" sqlite3 "^5.1.7" @@ -2400,7 +2417,7 @@ date-fns@^2.16.1: dependencies: "@babel/runtime" "^7.21.0" -debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2, debug@4: +debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2, debug@4, debug@4.3.4: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -2414,6 +2431,11 @@ debug@2.6.9: dependencies: ms "2.0.0" +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + decode-named-character-reference@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz" @@ -2460,13 +2482,13 @@ defer-to-connect@^2.0.0: resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== -define-data-property@^1.1.1: - version "1.1.2" - resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.2.tgz" - integrity sha512-SRtsSqsDbgpJBbW3pABMCOt6rQyeM8s8RiyeSN8jYG8sYmt/kGJejbydttUsnDs1tadr19tvhT4ShwMyoqAm4g== +define-data-property@^1.1.2: + version "1.1.3" + resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.3.tgz" + integrity sha512-h3GBouC+RPtNX2N0hHVLo2ZwPYurq8mLmXpOLTsw71gr7lHt5VaI4vVkDUNOfiWmm48JEXe3VM7PmLX45AMmmg== dependencies: es-errors "^1.3.0" - get-intrinsic "^1.2.2" + get-intrinsic "^1.2.4" gopd "^1.0.1" has-property-descriptors "^1.0.1" @@ -2515,10 +2537,10 @@ diff-sequences@^29.6.3: resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -diff@^5.0.0: - version "5.1.0" - resolved "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz" - integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw== +diff@^5.0.0, diff@5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== dir-glob@^3.0.1: version "3.0.1" @@ -2606,9 +2628,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.4.648: - version "1.4.657" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.657.tgz" - integrity sha512-On2ymeleg6QbRuDk7wNgDdXtNqlJLM2w4Agx1D/RiTmItiL+a9oq5p7HUa2ZtkAtGBe/kil2dq/7rPfkbe0r5w== + version "1.4.666" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.666.tgz" + integrity sha512-q4lkcbQrUdlzWCUOxk6fwEza6bNCfV12oi4AJph5UibguD1aTfL4uD0nuzFv9hbPANXQMuUS0MxPSHQ1gqq5dg== emittery@^0.13.1: version "0.13.1" @@ -2809,7 +2831,7 @@ escape-string-regexp@^2.0.0: resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^4.0.0: +escape-string-regexp@^4.0.0, escape-string-regexp@4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -3171,7 +3193,7 @@ find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-up@^5.0.0: +find-up@^5.0.0, find-up@5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -3207,6 +3229,11 @@ flat-cache@^3.0.4: keyv "^4.5.3" rimraf "^3.0.2" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatbuffers@23.5.26: version "23.5.26" resolved "https://registry.npmjs.org/flatbuffers/-/flatbuffers-23.5.26.tgz" @@ -3348,7 +3375,7 @@ get-caller-file@^2.0.5: resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3: +get-intrinsic@^1.1.3, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: version "1.2.4" resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz" integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== @@ -3491,7 +3518,7 @@ glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.1, glob@^8.0.3: +glob@^8.0.1, glob@^8.0.3, glob@8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -3630,9 +3657,9 @@ has-unicode@^2.0.1: integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== hasown@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz" - integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + version "2.0.1" + resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz" + integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== dependencies: function-bind "^1.1.2" @@ -3641,6 +3668,11 @@ hast-util-whitespace@^2.0.0: resolved "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz" integrity sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng== +he@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + highlight.js@^11.7.0: version "11.9.0" resolved "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz" @@ -3720,9 +3752,9 @@ http-proxy-agent@^5.0.0: debug "4" http-proxy-agent@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz" - integrity sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ== + version "7.0.1" + resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.1.tgz" + integrity sha512-My1KCEPs6A0hb4qCVzYp8iEvA8j8YqcvXLZZH8C9OFuTYpYjHE7N2dtG3mRl1HMD4+VGXpF3XcDVcxGBT7yDZQ== dependencies: agent-base "^7.1.0" debug "^4.3.4" @@ -3773,9 +3805,9 @@ https-proxy-agent@^5.0.0: debug "4" https-proxy-agent@^7.0.2: - version "7.0.2" - resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz" - integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA== + version "7.0.3" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.3.tgz" + integrity sha512-kCnwztfX0KZJSLOBrcL0emLeFako55NWMovvyPP2AjsghNk9RB1yjSI+jVumPHYZsNXegNoqupSW9IY3afSH8w== dependencies: agent-base "^7.0.2" debug "4" @@ -3906,10 +3938,13 @@ inquirer@8.2.6: through "^2.3.6" wrap-ansi "^6.0.1" -ip@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz" - integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== +ip-address@^9.0.5: + version "9.0.5" + resolved "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz" + integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== + dependencies: + jsbn "1.1.0" + sprintf-js "^1.1.3" ipaddr.js@1.9.1: version "1.9.1" @@ -3989,6 +4024,11 @@ is-path-inside@^3.0.3: resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-obj@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz" @@ -4477,7 +4517,7 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^4.1.0: +js-yaml@^4.1.0, js-yaml@4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -4489,6 +4529,11 @@ jsbn@~0.1.0: resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz" + integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== + jsesc@^2.5.1: version "2.5.2" resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" @@ -4696,7 +4741,7 @@ lodash@^4.17.21, lodash@4.17.21: resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@^4.1.0: +log-symbols@^4.1.0, log-symbols@4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -5148,6 +5193,13 @@ minimatch@^9.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" @@ -5227,6 +5279,32 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mocha@^10.3.0: + version "10.3.0" + resolved "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz" + integrity sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg== + dependencies: + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.3" + debug "4.3.4" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "8.1.0" + he "1.2.0" + js-yaml "4.1.0" + log-symbols "4.1.0" + minimatch "5.0.1" + ms "2.1.3" + serialize-javascript "6.0.0" + strip-json-comments "3.1.1" + supports-color "8.1.1" + workerpool "6.2.1" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + monaco-editor@^0.45.0: version "0.45.0" resolved "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.45.0.tgz" @@ -5443,7 +5521,7 @@ object-hash@^3.0.0: resolved "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.9.0: +object-inspect@^1.13.1: version "1.13.1" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz" integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== @@ -5747,18 +5825,18 @@ postcss-value-parser@^4.0.0: integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== postcss@^8.0.0, postcss@^8.2.14, postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.27, postcss@>=8.0.9: - version "8.4.34" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.34.tgz" - integrity sha512-4eLTO36woPSocqZ1zIrFD2K1v6wH7pY1uBh0JIM2KKfrVtGvPFiAku6aNOP0W1Wr9qwnaCsF0Z+CrVnryB2A8Q== + version "8.4.35" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz" + integrity sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA== dependencies: nanoid "^3.3.7" picocolors "^1.0.0" source-map-js "^1.0.2" posthog-node@^3.1.2: - version "3.6.1" - resolved "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.1.tgz" - integrity sha512-nvuZngDjzbQ2L2NqaBRWONuQeA3Dv+A8qXGMlOnM3/x07tGUrNYItgrLQH8wCntx75/PUlKq3ftxyQqNprGZjA== + version "3.6.2" + resolved "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz" + integrity sha512-tVIaShR3SxBx17AlAUS86jQTweKuJIFRedBB504fCz7YPnXJTYSrVcUHn5IINE2wu4jUQimQK6ihQr90Djrdrg== dependencies: axios "^1.6.2" rusha "^0.8.14" @@ -5915,6 +5993,13 @@ quick-lru@^5.1.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + range-parser@~1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" @@ -6295,7 +6380,7 @@ sade@^1.7.3: dependencies: mri "^1.1.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@5.2.1: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@5.2.1: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -6368,6 +6453,13 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" +serialize-javascript@6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz" + integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== + dependencies: + randombytes "^2.1.0" + serve-static@1.15.0: version "1.15.0" resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz" @@ -6384,13 +6476,14 @@ set-blocking@^2.0.0: integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== set-function-length@^1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz" - integrity sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w== + version "1.2.1" + resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz" + integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== dependencies: - define-data-property "^1.1.1" + define-data-property "^1.1.2" + es-errors "^1.3.0" function-bind "^1.1.2" - get-intrinsic "^1.2.2" + get-intrinsic "^1.2.3" gopd "^1.0.1" has-property-descriptors "^1.0.1" @@ -6417,13 +6510,14 @@ shebang-regex@^3.0.0: integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + version "1.0.5" + resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz" + integrity sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ== dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" + call-bind "^1.0.6" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" @@ -6492,11 +6586,11 @@ socks-proxy-agent@^7.0.0: socks "^2.6.2" socks@^2.6.2: - version "2.7.1" - resolved "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz" - integrity sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ== + version "2.7.3" + resolved "https://registry.npmjs.org/socks/-/socks-2.7.3.tgz" + integrity sha512-vfuYK48HXCTFD03G/1/zkIls3Ebr2YNa4qU9gHDZdblHLiqhJrJGkY3+0Nx0JpN9qBhJbVObc1CNciT1bIZJxw== dependencies: - ip "^2.0.0" + ip-address "^9.0.5" smart-buffer "^4.2.0" source-map-js@^1.0.2: @@ -6527,6 +6621,11 @@ spawn-command@^0.0.2-1: resolved "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz" integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg== +sprintf-js@^1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz" + integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" @@ -6651,7 +6750,7 @@ strip-final-newline@^2.0.0: resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1, strip-json-comments@3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -6709,6 +6808,13 @@ supports-color@^8.1.0: dependencies: has-flag "^4.0.0" +supports-color@8.1.1: + version "8.1.1" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" @@ -7042,9 +7148,9 @@ underscore@^1.12.1: integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== undici@^6.2.0: - version "6.6.1" - resolved "https://registry.npmjs.org/undici/-/undici-6.6.1.tgz" - integrity sha512-J0GaEp0ztu/grIE2Uq57AbK6TRb+bWbOlxu0POCzhFKA6LKbwSAev+hDQaQcgUUA9CPs8Ky+cauzTHnQrtAQEA== + version "6.6.2" + resolved "https://registry.npmjs.org/undici/-/undici-6.6.2.tgz" + integrity sha512-vSqvUE5skSxQJ5sztTZ/CdeJb1Wq0Hf44hlYMciqHghvz+K88U0l7D6u1VsndoFgskDcnU+nG3gYmMzJVzd9Qg== dependencies: "@fastify/busboy" "^2.0.0" @@ -7211,20 +7317,20 @@ vary@^1, vary@~1.1.2: integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== vectordb@^0.4.3: - version "0.4.8" - resolved "https://registry.npmjs.org/vectordb/-/vectordb-0.4.8.tgz" - integrity sha512-UnxMRhmMfjDoGzIcBMd4oISBYE60UtHXyiSbzWbvYwko6CPqQ6pc3FzpXer2qsfvEVqlNXQX+hDeMZ6gf2mtdQ== + version "0.4.9" + resolved "https://registry.npmjs.org/vectordb/-/vectordb-0.4.9.tgz" + integrity sha512-BZ69hVqhxcaxYfdtqpUCjU9IeP/L1CxAYrylzoWxDBYFe9E78JTJdZc6jzQDWBdSGnlE5ZMbGwbP6kPxBHunTA== dependencies: "@apache-arrow/ts" "^14.0.2" "@neon-rs/load" "^0.0.74" apache-arrow "^14.0.2" axios "^1.4.0" optionalDependencies: - "@lancedb/vectordb-darwin-arm64" "0.4.8" - "@lancedb/vectordb-darwin-x64" "0.4.8" - "@lancedb/vectordb-linux-arm64-gnu" "0.4.8" - "@lancedb/vectordb-linux-x64-gnu" "0.4.8" - "@lancedb/vectordb-win32-x64-msvc" "0.4.8" + "@lancedb/vectordb-darwin-arm64" "0.4.9" + "@lancedb/vectordb-darwin-x64" "0.4.9" + "@lancedb/vectordb-linux-arm64-gnu" "0.4.9" + "@lancedb/vectordb-linux-x64-gnu" "0.4.9" + "@lancedb/vectordb-win32-x64-msvc" "0.4.9" verror@1.10.0: version "1.10.0" @@ -7373,6 +7479,11 @@ wordwrapjs@^5.1.0: resolved "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz" integrity sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg== +workerpool@6.2.1: + version "6.2.1" + resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz" + integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" @@ -7478,16 +7589,26 @@ yaml@^2.3.4: resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz" integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== +yargs-parser@^20.2.2, yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + yargs@^16.2.0: version "16.2.0" resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" @@ -7514,6 +7635,24 @@ yargs@^17.0.1, yargs@^17.3.1: y18n "^5.0.5" yargs-parser "^21.1.1" +yargs@16.2.0: + version "16.2.0" + resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yarn@^1.22.21: + version "1.22.21" + resolved "https://registry.npmjs.org/yarn/-/yarn-1.22.21.tgz" + integrity sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg== + yauzl@^2.3.1, yauzl@^2.9.2: version "2.10.0" resolved "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz" diff --git a/gui/package-lock.json b/gui/package-lock.json index 08c1df33d..f1f681629 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -81,11 +81,13 @@ "fastest-levenshtein": "^1.0.16", "handlebars": "^4.7.8", "js-tiktoken": "^1.0.8", - "llm-code-highlighter": "^0.0.3", + "llm-code-highlighter": "^0.0.9", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", + "ollama": "^0.4.6", "openai": "^4.20.1", - "replicate": "^0.23.0", + "posthog-node": "^3.6.2", + "replicate": "^0.26.0", "socket.io-client": "^4.7.3", "sqlite": "^5.1.1", "sqlite3": "^5.1.7", diff --git a/gui/src/components/loaders/Loader.tsx b/gui/src/components/loaders/Loader.tsx index 1b0b838f2..4009a8ee6 100644 --- a/gui/src/components/loaders/Loader.tsx +++ b/gui/src/components/loaders/Loader.tsx @@ -24,7 +24,7 @@ const FlashingDiv = styled.div` `; function Loader(props: { size?: string }) { - const vscMediaUrl = (window as any).vscMediaUrl; + const vscMediaUrl = window.vscMediaUrl; return ( {vscMediaUrl ? ( diff --git a/gui/src/components/mainInput/ContinueButton.tsx b/gui/src/components/mainInput/ContinueButton.tsx index e865f7df6..b550aec48 100644 --- a/gui/src/components/mainInput/ContinueButton.tsx +++ b/gui/src/components/mainInput/ContinueButton.tsx @@ -43,8 +43,6 @@ function ContinueButton(props: { disabled: boolean; showStop: boolean; }) { - const vscMediaUrl = (window as any).vscMediaUrl; - const [buttonColor, setButtonColor] = useState( localStorage.getItem("continueButtonColor") ); @@ -80,8 +78,8 @@ function ContinueButton(props: { ) : ( <> - {vscMediaUrl ? ( - + {window.vscMediaUrl ? ( + ) : ( )} diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 15c31a564..38c9f4e72 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux"; import styled, { keyframes } from "styled-components"; import { defaultBorderRadius, vscBackground } from ".."; import { selectSlashCommands } from "../../redux/selectors"; -import { newSession } from "../../redux/slices/stateSlice"; +import { newSession, setMessageAtIndex } from "../../redux/slices/stateSlice"; import { RootStore } from "../../redux/store"; import ContextItemsPeek from "./ContextItemsPeek"; import TipTapEditor from "./TipTapEditor"; @@ -72,9 +72,14 @@ function ContinueInputBox(props: ContinueInputBoxProps) { useEffect(() => { const listener = (e) => { - if (e.data.type === "newSessionWithPrompt") { + if (e.data.type === "newSessionWithPrompt" && props.isMainInput) { dispatch(newSession()); - setEditorState(e.data.prompt); + dispatch( + setMessageAtIndex({ + message: { role: "user", content: e.data.prompt }, + index: 0, + }) + ); } }; diff --git a/gui/src/components/markdown/CodeSnippetPreview.tsx b/gui/src/components/markdown/CodeSnippetPreview.tsx index 5116cc9b0..46a50c2bf 100644 --- a/gui/src/components/markdown/CodeSnippetPreview.tsx +++ b/gui/src/components/markdown/CodeSnippetPreview.tsx @@ -152,7 +152,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) { diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 27108d35e..dea1c331a 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -50,7 +50,7 @@ const StyledMarkdown = styled.div<{ } code:not(pre > code) { - font-family: monospace; + font-family: var(--vscode-editor-font-family); color: #f78383; } diff --git a/gui/src/components/modelSelection/ModelCard.tsx b/gui/src/components/modelSelection/ModelCard.tsx index 271c51748..a66ff0114 100644 --- a/gui/src/components/modelSelection/ModelCard.tsx +++ b/gui/src/components/modelSelection/ModelCard.tsx @@ -88,8 +88,6 @@ interface ModelCardProps { } function ModelCard(props: ModelCardProps) { - const vscMediaUrl = (window as any).vscMediaUrl; - const [dimensionChoices, setDimensionChoices] = useState( props.dimensions?.map((d) => Object.keys(d.options)[0]) || [] ); @@ -129,9 +127,9 @@ function ModelCard(props: ModelCardProps) { } >
- {vscMediaUrl && props.icon && ( + {window.vscMediaUrl && props.icon && ( @@ -235,9 +233,9 @@ function ModelCard(props: ModelCardProps) { setSelectedProvider(option); }} > - {vscMediaUrl && info.icon && ( + {window.vscMediaUrl && info.icon && ( )} diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 1d164ea6f..25a7adcc7 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -121,9 +121,10 @@ const StyledListboxOptions = styled(Listbox.Options)` position: absolute; bottom: calc(100% - 16px); max-width: 100%; + max-height: 80vh; border-radius: ${defaultBorderRadius}; - overflow: hidden; + overflow: scroll; `; const StyledListboxOption = styled(Listbox.Option)<{ selected: boolean }>` diff --git a/gui/src/hooks/CustomPostHogProvider.tsx b/gui/src/hooks/CustomPostHogProvider.tsx index 9b97bad75..75aec5cc6 100644 --- a/gui/src/hooks/CustomPostHogProvider.tsx +++ b/gui/src/hooks/CustomPostHogProvider.tsx @@ -17,7 +17,7 @@ const CustomPostHogProvider = ({ children }: PropsWithChildren) => { api_host: "https://app.posthog.com", disable_session_recording: true, }); - posthog.identify((window as any).vscMachineId); + posthog.identify(window.vscMachineId); posthog.opt_in_capturing(); setClient(client); } else { diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index 7f1191ceb..2e75cabfc 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -100,18 +100,25 @@ function useChatHandler(dispatch: Dispatch) { input: string, historyIndex: number ) { + const abortController = new AbortController(); + const cancelToken = abortController.signal; const modelTitle = defaultModel.title; - for await (const update of ideStreamRequest("runNodeJsSlashCommand", { - input, - history: messages, - modelTitle, - slashCommandName: slashCommand.name, - contextItems, - params: slashCommand.params, - historyIndex, - })) { + for await (const update of ideStreamRequest( + "runNodeJsSlashCommand", + { + input, + history: messages, + modelTitle, + slashCommandName: slashCommand.name, + contextItems, + params: slashCommand.params, + historyIndex, + }, + cancelToken + )) { if (!activeRef.current) { + abortController.abort(); break; } if (typeof update === "string") { @@ -130,6 +137,7 @@ function useChatHandler(dispatch: Dispatch) { // Resolve context providers and construct new history const [contextItems, content] = await resolveEditorContent(editorState); + console.log(contextItems, content); const message: ChatMessage = { role: "user", content, diff --git a/gui/src/hooks/useHistory.tsx b/gui/src/hooks/useHistory.tsx index 486070bf0..1628fd55d 100644 --- a/gui/src/hooks/useHistory.tsx +++ b/gui/src/hooks/useHistory.tsx @@ -70,7 +70,7 @@ function useHistory(dispatch: Dispatch) { history: stateCopy.history, title: title, sessionId: stateCopy.sessionId, - workspaceDirectory: (window as any).workspacePaths?.[0] || "", + workspaceDirectory: window.workspacePaths?.[0] || "", }; return await ideRequest("saveSession", sessionInfo); } diff --git a/gui/src/hooks/useNavigationListener.tsx b/gui/src/hooks/useNavigationListener.tsx new file mode 100644 index 000000000..cd5e1ffb1 --- /dev/null +++ b/gui/src/hooks/useNavigationListener.tsx @@ -0,0 +1,42 @@ +import { useEffect } from 'react'; +import { useNavigate, useLocation } from 'react-router-dom'; + +const openGUITypes = [ + "highlightedCode", + "newSessionWithPrompt", + "focusContinueInput", + "focusContinueInputWithoutClear", + "newSession", +]; + +export const useNavigationListener = () => { + const navigate = useNavigate(); + const location = useLocation(); + + useEffect(() => { + const listener = (e) => { + if(openGUITypes.includes(e.data.type)) { + + navigate("/"); + setTimeout(() => { + window.postMessage(e.data, "*"); + }, 200); + } + + if(e.data.type === "viewHistory") { + // Toggle the history page / main page + if (location.pathname === "/history") { + navigate("/"); + } else { + navigate("/history"); + } + } + }; + + window.addEventListener("message", listener); + + return () => { + window.removeEventListener("message", listener); + }; + }, [navigate]); +} diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index b91a9bf4a..434461879 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -44,11 +44,11 @@ function useSetup(dispatch: Dispatch) { const eventListener = (event: any) => { switch (event.data.type) { case "onLoad": - (window as any).windowId = event.data.windowId; - (window as any).serverUrl = event.data.serverUrl; - (window as any).workspacePaths = event.data.workspacePaths; - (window as any).vscMachineId = event.data.vscMachineId; - (window as any).vscMediaUrl = event.data.vscMediaUrl; + window.windowId = event.data.windowId; + window.serverUrl = event.data.serverUrl; + window.workspacePaths = event.data.workspacePaths; + window.vscMachineId = event.data.vscMachineId; + window.vscMediaUrl = event.data.vscMediaUrl; dispatch(setVscMachineId(event.data.vscMachineId)); // dispatch(setVscMediaUrl(event.data.vscMediaUrl)); diff --git a/gui/src/hooks/useVscTheme.ts b/gui/src/hooks/useVscTheme.ts index 6b1e86ea0..26703fd6e 100644 --- a/gui/src/hooks/useVscTheme.ts +++ b/gui/src/hooks/useVscTheme.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; -const hljsToTextMate = { +const hljsToTextMate: Record = { ".hljs-comment": ["comment"], ".hljs-tag": ["tag"], @@ -51,7 +51,9 @@ const hljsToTextMate = { ".hljs-params": ["variable", "operator", "number"], }; -function constructTheme(tmTheme: any): any { +function constructTheme( + tmTheme: typeof window.fullColorTheme +): Record { const rules = tmTheme["rules"] || []; const tokenToForeground = {}; @@ -78,13 +80,13 @@ function constructTheme(tmTheme: any): any { export function useVscTheme() { const [theme, setTheme] = useState( - constructTheme((window as any).fullColorTheme || {}) + constructTheme(window.fullColorTheme || {}) ); useEffect(() => { const listener = (e) => { if (e.data.type === "setTheme") { - (window as any).fullColorTheme = e.data.theme; + window.fullColorTheme = e.data.theme; setTheme(constructTheme(e.data.theme)); } }; diff --git a/gui/src/main.tsx b/gui/src/main.tsx index 9e46b8109..60d748b37 100644 --- a/gui/src/main.tsx +++ b/gui/src/main.tsx @@ -9,7 +9,7 @@ import "./index.css"; import { persistor, store } from "./redux/store"; (async () => { - const onigPath = (window as any).vscMediaUrl + "/onigasm.wasm"; + const onigPath = window.vscMediaUrl + "/onigasm.wasm"; const resp = await fetch(onigPath); const onigWasm = await resp.arrayBuffer(); await loadWASM(onigWasm); diff --git a/gui/src/pages/help.tsx b/gui/src/pages/help.tsx index 3beb2c715..0c8dfe845 100644 --- a/gui/src/pages/help.tsx +++ b/gui/src/pages/help.tsx @@ -4,6 +4,9 @@ import { useNavigate } from "react-router-dom"; import styled from "styled-components"; import { Button, lightGray, vscBackground, vscForeground } from "../components"; import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts"; +import { useNavigationListener } from "../hooks/useNavigationListener"; + + const IconDiv = styled.div<{ backgroundColor?: string }>` display: flex; @@ -32,6 +35,7 @@ const TutorialButton = styled(Button)` `; function HelpPage() { + useNavigationListener(); const navigate = useNavigate(); return ( diff --git a/gui/src/pages/history.tsx b/gui/src/pages/history.tsx index 9dc2dbabc..06b1f0f84 100644 --- a/gui/src/pages/history.tsx +++ b/gui/src/pages/history.tsx @@ -9,6 +9,7 @@ import HeaderButtonWithText from "../components/HeaderButtonWithText"; import useHistory from "../hooks/useHistory"; import { newSession } from "../redux/slices/stateSlice"; import { getFontSize } from "../util"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const Tr = styled.tr` &:hover { @@ -63,8 +64,8 @@ function TableRow({ }) { const dispatch = useDispatch(); const navigate = useNavigate(); - const apiUrl = (window as any).serverUrl; - const workspacePaths = (window as any).workspacePaths || [""]; + const apiUrl = window.serverUrl; + const workspacePaths = window.workspacePaths || [""]; const [hovered, setHovered] = useState(false); const { saveSession, deleteSession, loadSession } = useHistory(dispatch); @@ -125,13 +126,15 @@ function lastPartOfPath(path: string): string { } function History() { + useNavigationListener(); const navigate = useNavigate(); + const [sessions, setSessions] = useState([]); const [filteredAndSortedSessions, setFilteredAndSortedSessions] = useState< SessionInfo[] >([]); - const apiUrl = (window as any).serverUrl; - const workspacePaths = (window as any).workspacePaths || []; + const apiUrl = window.serverUrl; + const workspacePaths = window.workspacePaths || []; const deleteSessionInUI = async (sessionId: string) => { setSessions((prev) => diff --git a/gui/src/pages/modelconfig.tsx b/gui/src/pages/modelconfig.tsx index 40c9d3961..8c53afd22 100644 --- a/gui/src/pages/modelconfig.tsx +++ b/gui/src/pages/modelconfig.tsx @@ -22,6 +22,7 @@ import { PROVIDER_INFO, updatedObj, } from "../util/modelData"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const GridDiv = styled.div` display: grid; @@ -57,6 +58,7 @@ export const CustomModelButton = styled.div<{ disabled: boolean }>` `; function ModelConfig() { + useNavigationListener(); const formMethods = useForm(); const { modelName } = useParams(); @@ -70,7 +72,6 @@ function ModelConfig() { const dispatch = useDispatch(); const navigate = useNavigate(); - const vscMediaUrl = (window as any).vscMediaUrl; const disableModelCards = useCallback(() => { return ( @@ -108,9 +109,9 @@ function ModelConfig() {
- {vscMediaUrl && modelInfo?.icon && ( + {window.vscMediaUrl && modelInfo?.icon && ( diff --git a/gui/src/pages/models.tsx b/gui/src/pages/models.tsx index cf79e4fda..782a42984 100644 --- a/gui/src/pages/models.tsx +++ b/gui/src/pages/models.tsx @@ -13,6 +13,7 @@ import { setDefaultModel } from "../redux/slices/stateSlice"; import { addModel } from "../util/ide"; import { MODEL_INFO, PROVIDER_INFO } from "../util/modelData"; import { CustomModelButton } from "./modelconfig"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const IntroDiv = styled.div` padding: 8px 12px; @@ -33,6 +34,7 @@ const GridDiv = styled.div` function Models() { const navigate = useNavigate(); const dispatch = useDispatch(); + useNavigationListener(); const [providersSelected, setProvidersSelected] = React.useState(true); diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts index 8f317f4ca..d04bdda72 100644 --- a/gui/src/redux/slices/configSlice.ts +++ b/gui/src/redux/slices/configSlice.ts @@ -1,12 +1,10 @@ import { createSlice } from "@reduxjs/toolkit"; import { RootStore } from "../store"; -const windowAny: any = window; - export const configSlice = createSlice({ name: "config", initialState: { - vscMachineId: windowAny.vscMachineId || undefined, + vscMachineId: window.vscMachineId || undefined, } as RootStore["config"], reducers: { setVscMachineId: ( diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index d98541af7..b66cdcbaf 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -8,6 +8,7 @@ import { PersistedSessionInfo, } from "core"; import { BrowserSerializedContinueConfig } from "core/config/load"; +import { stripImages } from "core/llm/countTokens"; import { v4 } from "uuid"; import { RootStore } from "../store"; @@ -274,6 +275,22 @@ export const stateSlice = createSlice({ }; } ) => { + if (payload.index >= state.history.length) { + state.history.push({ + message: payload.message, + editorState: { + type: "doc", + content: stripImages(payload.message.content) + .split("\n") + .map((line) => ({ + type: "paragraph", + content: line === "" ? [] : [{ type: "text", text: line }], + })), + }, + contextItems: [], + }); + return; + } state.history[payload.index].message = payload.message; state.history[payload.index].contextItems = payload.contextItems || []; }, diff --git a/gui/src/util/ide.ts b/gui/src/util/ide.ts index 5f8fd4393..2918c8b08 100644 --- a/gui/src/util/ide.ts +++ b/gui/src/util/ide.ts @@ -5,7 +5,7 @@ declare const vscode: any; function _postToIde(type: string, data: any) { if (typeof vscode === "undefined") { if (localStorage.getItem("ide") === "jetbrains") { - if ((window as any).postIntellijMessage === undefined) { + if (window.postIntellijMessage === undefined) { console.log( "Unable to send message: postIntellijMessage is undefined. ", type, @@ -13,7 +13,7 @@ function _postToIde(type: string, data: any) { ); throw new Error("postIntellijMessage is undefined"); } - (window as any).postIntellijMessage?.(type, data); + window.postIntellijMessage?.(type, data); return; } else { console.log("Unable to send message: vscode is undefined. ", type, data); diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index 68795ea53..658fbda5a 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -433,7 +433,7 @@ const deepseek: ModelPackage = { model: "deepseek-33b", title: "DeepSeek-33b", }, - } + }, }, ], providerOptions: ["ollama", "lmstudio", "llamacpp"], @@ -552,6 +552,16 @@ const chatBison: ModelPackage = { icon: "google-palm.png", }; +const AUTODETECT: ModelPackage = { + title: "Autodetect", + description: + "Automatically populate the model list by calling the /models endpoint of the server", + params: { + model: "AUTODETECT", + } as any, + providerOptions: [], +}; + export const MODEL_INFO: ModelPackage[] = [ gpt4, gpt35turbo, @@ -579,7 +589,19 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { "Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.", icon: "openai.png", tags: [ModelProviderTag["Requires API Key"]], - packages: [gpt4, gpt35turbo, gpt4turbo, gpt4vision], + packages: [ + gpt4, + gpt35turbo, + gpt4turbo, + gpt4vision, + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "OpenAI", + }, + }, + ], collectInputFor: [ { inputType: CollectInputType.text, @@ -636,7 +658,16 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { 'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.', icon: "ollama.png", tags: [ModelProviderTag["Local"], ModelProviderTag["Open-Source"]], - packages: osModels, + packages: [ + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "Ollama", + }, + }, + ...osModels, + ], collectInputFor: [ ...completionParamsInputs, { ...apiBaseInput, defaultValue: "http://localhost:11434" }, @@ -724,7 +755,16 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { params: { apiBase: "http://localhost:1234/v1", }, - packages: osModels, + packages: [ + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "LM Studio", + }, + }, + ...osModels, + ], collectInputFor: [...completionParamsInputs], }, replicate: { @@ -830,7 +870,16 @@ After it's up and running, you can start using Continue.`, ], icon: "openai.png", tags: [ModelProviderTag.Local, ModelProviderTag["Open-Source"]], - packages: osModels, + packages: [ + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "OpenAI", + }, + }, + ...osModels, + ], }, freetrial: { title: "Continue limited free trial", @@ -849,6 +898,13 @@ After it's up and running, you can start using Continue.`, { ...gpt4vision, title: "GPT-4 Vision (trial)" }, { ...phindCodeLlama, title: "Phind CodeLlama (trial)" }, { ...gemini, title: "Gemini Pro (trial)" }, + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "Free Trial", + }, + }, ], collectInputFor: [...completionParamsInputs], },