From 6c63aeb5dc0b4eede7508cb448545d90757ee21c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 14 Jun 2024 09:11:01 -0700 Subject: [PATCH 001/252] allow setting apiBase for bedrock provider --- core/llm/llms/Bedrock.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index de3055189..04af2b7c2 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -38,7 +38,9 @@ class Bedrock extends BaseLLM { constructor(options: LLMOptions) { super(options); - this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; + if (!options.apiBase) { + this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; + } } private _convertModelName(model: string): string { From 3a96050e3da0c54ed046fab7997e53f47f367eb3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 14 Jun 2024 15:45:25 -0700 Subject: [PATCH 002/252] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20better=20linking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/vscode/src/ideProtocol.ts | 15 ++-- gui/src/components/markdown/LinkableCode.tsx | 87 ++++++++++++++++---- 2 files changed, 75 insertions(+), 27 deletions(-) diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index a9181e8cd..80f3e5e8a 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -365,15 +365,12 @@ class VsCodeIde implements IDE { new vscode.Position(startLine, 0), new vscode.Position(endLine, 0), ); - openEditorAndRevealRange(filepath, range).then(() => { - // TODO: Highlight lines - // this.ideUtils.highlightCode( - // { - // filepath, - // range, - // }, - // "#fff1" - // ); + openEditorAndRevealRange(filepath, range).then((editor) => { + // Select the lines + editor.selection = new vscode.Selection( + new vscode.Position(startLine, 0), + new vscode.Position(endLine, 0), + ); }); } diff --git a/gui/src/components/markdown/LinkableCode.tsx b/gui/src/components/markdown/LinkableCode.tsx index 8f323a003..24c85426d 100644 --- a/gui/src/components/markdown/LinkableCode.tsx +++ b/gui/src/components/markdown/LinkableCode.tsx @@ -1,3 +1,4 @@ +import { RangeInFile } from "core"; import { useContext, useEffect, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; @@ -24,14 +25,13 @@ function LinkableCode(props: any) { const [linkingDone, setLinkingDone] = useState(false); const [isLink, setIsLink] = useState(false); - const [filepath, setFilepath] = useState(""); - const [line, setLine] = useState(0); + const [rif, setRif] = useState(undefined); useEffect(() => { if (linkingDone) return; setLinkingDone(true); - // Get filename from props.children + // Get content of the code tag let content: string | undefined = undefined; if (typeof props.children === "string") { content = props.children; @@ -44,7 +44,7 @@ function LinkableCode(props: any) { } if (!content) return; - // Check if this is a real file + // Match filepath with context items const contextItemFileMatch = contextItems.find( (item) => ["file", "codebase", "folder"].includes(item.id.providerTitle) && @@ -58,38 +58,89 @@ function LinkableCode(props: any) { .split(" (")[1] .split(")")[0] .split("-"); - setFilepath(contextItemFileMatch.description.split(" (")[0]); - setLine(parseInt(startLine)); + const filepath = contextItemFileMatch.description.split(" (")[0]; + setRif({ + filepath, + range: { + start: { + line: 0, + character: 0, + }, + end: { + line: 0, + character: 0, + }, + }, + }); + return; } else { - setFilepath(contextItemFileMatch.description.split(" (")[0]); - setLine(0); + // If no line number, just open the file + setRif({ + filepath: contextItemFileMatch.description.split(" (")[0], + range: { + start: { + line: 0, + character: 0, + }, + end: { + line: 0, + character: 0, + }, + }, + }); + return; } } - if (content.length > 6) { + // Try to match the content with a line in a file + if (content.length > 8) { const contextItemContentMatch = contextItems.find( (item) => ["file", "codebase", "folder"].includes(item.id.providerTitle) && item.content.includes(content), ); if (contextItemContentMatch) { + const line = contextItemContentMatch.content + .split("\n") + .slice(1) // code block fence + .findIndex((line) => line.includes(content)); + + const [filepath, rest] = + contextItemContentMatch.description.split(" ("); + const [startLine, endLine] = rest.split(")")[0]?.split("-") || [ + "0", + "0", + ]; + const start = parseInt(startLine); + const end = parseInt(endLine); + setIsLink(true); - setFilepath(contextItemContentMatch.description.split(" (")[0]); - setLine( - contextItemContentMatch.content - .split("\n") - .findIndex((line) => line.includes(content)) + 1, - ); + setRif({ + filepath, + range: { + start: { + line: start + line, + character: 0, + }, + end: { + line: start + line + 1, + character: 0, + }, + }, + }); + + console.log("MATCH: ", content, contextItemContentMatch, line); } } }, [linkingDone, contextItems]); const onClick = () => { if (!isLink) return; + if (!rif) return; ideMessenger.post("showLines", { - filepath, - startLine: line, - endLine: line + 1, + filepath: rif.filepath, + startLine: rif.range.start.line, + endLine: rif.range.end.line, }); }; From 5a7083ba544fdc1b7f38ebfd3d12666b74055295 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 14 Jun 2024 16:30:34 -0700 Subject: [PATCH 003/252] =?UTF-8?q?=E2=9C=A8=20new=20prompt=20file=20actio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config/load.ts | 11 +++- core/config/promptFile.ts | 57 +++++++++++++++++++ core/core.ts | 7 +++ core/protocol/core.ts | 1 + core/protocol/passThrough.ts | 1 + .../toolWindow/ContinueBrowser.kt | 1 + gui/src/components/mainInput/TipTapEditor.tsx | 1 + gui/src/components/mainInput/getSuggestion.ts | 21 ++++++- 8 files changed, 96 insertions(+), 4 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 8dd708b7e..0745614d7 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -54,7 +54,11 @@ import { defaultSlashCommandsJetBrains, defaultSlashCommandsVscode, } from "./default.js"; -import { getPromptFiles, slashCommandFromPromptFile } from "./promptFile.js"; +import { + DEFAULT_PROMPTS_FOLDER, + getPromptFiles, + slashCommandFromPromptFile, +} from "./promptFile.js"; const { execSync } = require("child_process"); function resolveSerializedConfig(filepath: string): SerializedContinueConfig { @@ -171,7 +175,10 @@ async function serializedToIntermediateConfig( promptFiles = ( await Promise.all( workspaceDirs.map((dir) => - getPromptFiles(ide, path.join(dir, promptFolder ?? ".prompts")), + getPromptFiles( + ide, + path.join(dir, promptFolder ?? DEFAULT_PROMPTS_FOLDER), + ), ), ) ) diff --git a/core/config/promptFile.ts b/core/config/promptFile.ts index 9fa66c892..e537dd4d5 100644 --- a/core/config/promptFile.ts +++ b/core/config/promptFile.ts @@ -1,9 +1,12 @@ +import path from "path"; import * as YAML from "yaml"; import type { IDE, SlashCommand } from ".."; import { stripImages } from "../llm/countTokens.js"; import { renderTemplatedString } from "../llm/llms/index.js"; import { getBasename } from "../util/index.js"; +export const DEFAULT_PROMPTS_FOLDER = ".prompts"; + export async function getPromptFiles( ide: IDE, dir: string, @@ -21,6 +24,60 @@ export async function getPromptFiles( } } +const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file +# It is used to define and reuse prompts within Continue +# Continue will automatically create a slash command for each prompt in the .prompts folder +# To learn more, see the full .prompt file reference: https://docs.continue.dev/walkthroughs/prompt-files +temperature: 0.0 +--- +{{{ diff }}} + +Give me feedback on the above changes. For each file, you should output a markdown section including the following: +- If you found any problems, an h3 like "❌ " +- If you didn't find any problems, an h3 like "✅ " +- If you found any problems, add below a bullet point description of what you found, including a minimal code snippet explaining how to fix it +- If you didn't find any problems, you don't need to add anything else + +Here is an example. The example is surrounded in backticks, but your response should not be: + +\`\`\` +### ✅ + +### ❌ + + +\`\`\` + +You should look primarily for the following types of issues, and only mention other problems if they are highly pressing. + +- console.logs that have been left after debugging +- repeated code +- algorithmic errors that could fail under edge cases +- something that could be refactored + +Make sure to review ALL files that were changed, do not skip any. +`; + +export async function createNewPromptFile( + ide: IDE, + promptPath: string | undefined, +): Promise { + const workspaceDirs = await ide.getWorkspaceDirs(); + if (workspaceDirs.length === 0) { + throw new Error( + "No workspace directories found. Make sure you've opened a folder in your IDE.", + ); + } + const promptFilePath = path.join( + workspaceDirs[0], + promptPath ?? DEFAULT_PROMPTS_FOLDER, + "new-prompt-file.prompt", + ); + + await ide.writeFile(promptFilePath, DEFAULT_PROMPT_FILE); + await ide.openFile(promptFilePath); +} + export function slashCommandFromPromptFile( path: string, content: string, diff --git a/core/core.ts b/core/core.ts index 8aa577251..5bc049255 100644 --- a/core/core.ts +++ b/core/core.ts @@ -14,6 +14,7 @@ import { setupLocalMode, setupOptimizedExistingUserMode, } from "./config/onboarding.js"; +import { createNewPromptFile } from "./config/promptFile"; import { addModel, addOpenAIKey, deleteModel } from "./config/util.js"; import { ContinueServerClient } from "./continueServer/stubs/client.js"; import { indexDocs } from "./indexing/docs/index.js"; @@ -190,6 +191,12 @@ export class Core { deleteModel(msg.data.title); this.configHandler.reloadConfig(); }); + on("config/newPromptFile", async (msg) => { + createNewPromptFile( + this.ide, + (await this.config()).experimental?.promptPath, + ); + }); on("config/reload", (msg) => { this.configHandler.reloadConfig(); return this.configHandler.getSerializedConfig(); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 977e4edcd..995c6a961 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -45,6 +45,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { { model: SerializedContinueConfig["models"][number] }, void, ]; + "config/newPromptFile": [undefined, void]; "config/ideSettingsUpdate": [IdeSettings, void]; "config/getBrowserSerialized": [undefined, BrowserSerializedContinueConfig]; "config/deleteModel": [{ title: string }, void]; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 441659823..9e22bda32 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -16,6 +16,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "devdata/log", "config/addOpenAiKey", "config/addModel", + "config/newPromptFile", "config/ideSettingsUpdate", "config/getBrowserSerialized", "config/deleteModel", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index 159e8471f..e230658fa 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -48,6 +48,7 @@ class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false "config/ideSettingsUpdate", "config/getBrowserSerialized", "config/deleteModel", + "config/newPromptFile", "config/reload", "context/getContextItems", "context/loadSubmenuItems", diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 19dea7770..04e3f8c62 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -374,6 +374,7 @@ function TipTapEditor(props: TipTapEditorProps) { availableSlashCommandsRef, onClose, onOpen, + ideMessenger, ), renderText: (props) => { return props.node.attrs.label; diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index 5e7dd605b..7fb953b10 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -161,10 +161,26 @@ export function getCommandSuggestion( availableSlashCommandsRef: MutableRefObject, onClose: () => void, onOpen: () => void, + ideMessenger: IIdeMessenger, ) { const items = async ({ query }) => { + const options = [ + ...availableSlashCommandsRef.current, + { + title: "Build a custom prompt", + description: "Build a custom prompt", + type: "action", + id: "createPromptFile", + label: "Create Prompt File", + action: () => { + console.log("I", ideMessenger.request); + ideMessenger.request("config/newPromptFile", undefined); + }, + name: "Create Prompt File", + }, + ]; return ( - availableSlashCommandsRef.current?.filter((slashCommand) => { + options.filter((slashCommand) => { const sc = slashCommand.title.substring(1).toLowerCase(); const iv = query.toLowerCase(); return sc.startsWith(iv); @@ -175,7 +191,8 @@ export function getCommandSuggestion( id: provider.title, title: provider.title, label: provider.title, - type: "slashCommand" as ComboBoxItemType, + type: (provider.type ?? "slashCommand") as ComboBoxItemType, + action: provider.action, })); }; return getSuggestion(items, undefined, onClose, onOpen); From f97573e77ee3f7073142ceca9da30a7de07562d0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 16 Jun 2024 19:15:22 -0700 Subject: [PATCH 004/252] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20strip=20=20from=20GPT-4=20completion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/autocomplete/completionProvider.ts | 2 ++ core/autocomplete/lineStream.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 3590a2383..873515bf5 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -38,6 +38,7 @@ import { AutocompleteLanguageInfo } from "./languages.js"; import { avoidPathLine, noTopLevelKeywordsMidline, + skipPrefixes, stopAtLines, stopAtRepeatingLines, stopAtSimilarLine, @@ -407,6 +408,7 @@ export async function getTabCompletion( lineGenerator = stopAtLines(lineGenerator, fullStop); lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop); lineGenerator = avoidPathLine(lineGenerator, lang.singleLineComment); + lineGenerator = skipPrefixes(lineGenerator); lineGenerator = noTopLevelKeywordsMidline( lineGenerator, lang.topLevelKeywords, diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index 3f552e5f5..14d4c4ab7 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -121,6 +121,22 @@ export async function* stopAtLines( } } +const PREFIXES_TO_SKIP = [""]; +export async function* skipPrefixes(lines: LineStream): LineStream { + let isFirstLine = true; + for await (const line of lines) { + if (isFirstLine) { + const match = PREFIXES_TO_SKIP.find((prefix) => line.startsWith(prefix)); + if (match) { + yield line.slice(match.length); + continue; + } + isFirstLine = false; + } + yield line; + } +} + const LINES_TO_SKIP = [""]; export async function* skipLines(stream: LineStream): LineStream { From c8709c299fc9d3e37cd87745ff67c8add4e80eab Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 17 Jun 2024 17:34:45 -0700 Subject: [PATCH 005/252] continue proxy FIM support --- core/llm/llms/Mistral.ts | 40 +--------------------------- core/llm/llms/OpenAI.ts | 32 ++++++++++++++++++++++ core/llm/llms/stubs/ContinueProxy.ts | 4 +++ 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/core/llm/llms/Mistral.ts b/core/llm/llms/Mistral.ts index d05615db8..fee8fadac 100644 --- a/core/llm/llms/Mistral.ts +++ b/core/llm/llms/Mistral.ts @@ -1,10 +1,4 @@ -import { - ChatMessage, - CompletionOptions, - LLMOptions, - ModelProvider, -} from "../../index.js"; -import { streamSse } from "../stream.js"; +import { ChatMessage, LLMOptions, ModelProvider } from "../../index.js"; import { gptEditPrompt } from "../templates/edit.js"; import OpenAI from "./OpenAI.js"; @@ -47,38 +41,6 @@ class Mistral extends OpenAI { supportsFim(): boolean { return true; } - - async *_streamFim( - prefix: string, - suffix: string, - options: CompletionOptions, - ): AsyncGenerator { - const endpoint = new URL("fim/completions", this.apiBase); - const resp = await this.fetch(endpoint, { - method: "POST", - body: JSON.stringify({ - model: options.model, - prompt: prefix, - suffix, - max_tokens: options.maxTokens, - temperature: options.temperature, - top_p: options.topP, - frequency_penalty: options.frequencyPenalty, - presence_penalty: options.presencePenalty, - stop: options.stop, - stream: true, - }), - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "x-api-key": this.apiKey ?? "", - Authorization: `Bearer ${this.apiKey}`, - }, - }); - for await (const chunk of streamSse(resp)) { - yield chunk.choices[0].delta.content; - } - } } export default Mistral; diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index d05c3315c..08b728f2f 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -226,6 +226,38 @@ class OpenAI extends BaseLLM { } } + async *_streamFim( + prefix: string, + suffix: string, + options: CompletionOptions, + ): AsyncGenerator { + const endpoint = new URL("fim/completions", this.apiBase); + const resp = await this.fetch(endpoint, { + method: "POST", + body: JSON.stringify({ + model: options.model, + prompt: prefix, + suffix, + max_tokens: options.maxTokens, + temperature: options.temperature, + top_p: options.topP, + frequency_penalty: options.frequencyPenalty, + presence_penalty: options.presencePenalty, + stop: options.stop, + stream: true, + }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "x-api-key": this.apiKey ?? "", + Authorization: `Bearer ${this.apiKey}`, + }, + }); + for await (const chunk of streamSse(resp)) { + yield chunk.choices[0].delta.content; + } + } + async listModels(): Promise { const response = await this.fetch(this._getEndpoint("models"), { method: "GET", diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 8db6b4518..f23ea35cc 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -6,6 +6,10 @@ class ContinueProxy extends OpenAI { static defaultOptions: Partial = { apiBase: "http://localhost:3000/proxy/v1", }; + + supportsFim(): boolean { + return true; + } } export default ContinueProxy; From 82f032912456501df6c045642ff0a2635d39fe39 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 19 Jun 2024 10:11:15 -0700 Subject: [PATCH 006/252] warn user if potentially dangerous command is generated --- core/commands/slash/cmd.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/commands/slash/cmd.ts b/core/commands/slash/cmd.ts index 797bd9826..c171384bd 100644 --- a/core/commands/slash/cmd.ts +++ b/core/commands/slash/cmd.ts @@ -2,6 +2,14 @@ import { streamLines } from "../../diff/util.js"; import { SlashCommand } from "../../index.js"; import { removeQuotesAndEscapes } from "../../util/index.js"; +function commandIsPotentiallyDangerous(command: string) { + return ( + command.includes("rm -rf") || + command.includes("sudo") || + command.includes("cd / ") + ); +} + const GenerateTerminalCommand: SlashCommand = { name: "cmd", description: "Generate a shell command", @@ -35,8 +43,12 @@ Please write a shell command that will do what the user requested. Your output s break; } - await ide.runCommand(cmd); yield `Generated shell command: ${cmd}`; + if (commandIsPotentiallyDangerous(cmd)) { + yield "\n\nWarning: This command may be potentially dangerous. Please double-check before pasting it in your terminal."; + } else { + await ide.runCommand(cmd); + } }, }; From 07f682e7fdc91a9d9ab3bb6dc02c4761d1984db3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 19 Jun 2024 11:37:41 -0700 Subject: [PATCH 007/252] tab autocomplete docs --- docs/docs/walkthroughs/tab-autocomplete.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/walkthroughs/tab-autocomplete.md b/docs/docs/walkthroughs/tab-autocomplete.md index 4790808d9..959384f72 100644 --- a/docs/docs/walkthroughs/tab-autocomplete.md +++ b/docs/docs/walkthroughs/tab-autocomplete.md @@ -89,7 +89,7 @@ This is just another object like the ones in the `"models"` array of `config.jso ### `tabAutocompleteOptions` -This object allows you to customize the behavior of tab-autocomplete. The available options are: +This object allows you to customize the behavior of tab-autocomplete. The available options are shown below, and you can find their default values [here](https://github.com/continuedev/continue/blob/fbeb2e4fe15d4b434a30a136f74b672485c852d9/core/util/parameters.ts). - `disable`: Disable autocomplete (can also be done from IDE settings) - `template`: An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables. (String) From a6ff923ddecab7d3fecad58d9e56d88614d244c4 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 20 Jun 2024 15:16:12 -0500 Subject: [PATCH 008/252] docs: update PR template (#1531) --- .github/pull_request_template.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 83dbcefd8..4bb4e6de4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,4 +4,5 @@ ## Checklist -- [ ] The base branch of this PR is `preview`, rather than `main` +- [ ] The base branch of this PR is `dev`, rather than `main` +- [ ] The relevant docs, if any, have been updated or created From 5876649991ae87aa5f04f746ad4b55ff4d6b3c59 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 20 Jun 2024 16:50:10 -0500 Subject: [PATCH 009/252] chore: add docs to install script (#1533) --- .vscode/tasks.json | 10 + docs/package-lock.json | 1350 +++++++++++++-------------- docs/package.json | 6 +- extensions/vscode/package-lock.json | 4 +- extensions/vscode/package.json | 2 +- scripts/install-dependencies.ps1 | 3 + scripts/install-dependencies.sh | 13 +- 7 files changed, 662 insertions(+), 726 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 19992f866..e1fa3e1b3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -154,6 +154,16 @@ "options": { "cwd": "binary" } + }, + { + "label": "docs:start", + "type": "shell", + "command": "npm", + "args": ["run", "start"], + "problemMatcher": [], + "options": { + "cwd": "docs" + } } ] } diff --git a/docs/package-lock.json b/docs/package-lock.json index c1cba2aef..68e4cd8fa 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -8,9 +8,9 @@ "name": "continue-docs", "version": "0.0.0", "dependencies": { - "@docusaurus/core": "^3.2.1", - "@docusaurus/plugin-client-redirects": "^3.2.1", - "@docusaurus/preset-classic": "^3.2.1", + "@docusaurus/core": "^3.4.0", + "@docusaurus/plugin-client-redirects": "^3.4.0", + "@docusaurus/preset-classic": "^3.4.0", "@mdx-js/react": "^3.0.0", "clsx": "^2.1.0", "docusaurus-json-schema-plugin": "^1.11.0", @@ -548,9 +548,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz", + "integrity": "sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg==", "engines": { "node": ">=6.9.0" } @@ -1625,11 +1625,11 @@ } }, "node_modules/@babel/plugin-transform-react-constant-elements": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.23.3.tgz", - "integrity": "sha512-zP0QKq/p6O42OL94udMgSfKXyse4RyJ0JqbQ34zDAONWjyrEsghYEyTSK5FIpmXmCpB55SHokL1cRRKHv8L2Qw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.24.7.tgz", + "integrity": "sha512-7LidzZfUXyfZ8/buRW6qIIHBY8wAZ1OrY9c/wTr8YhZ6vMPo+Uc/CVFLYY1spZrEQlD4w5u8wjqk5NQ3OVqQKA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -2181,9 +2181,9 @@ } }, "node_modules/@docusaurus/core": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/core/-/core-3.2.1.tgz", - "integrity": "sha512-ZeMAqNvy0eBv2dThEeMuNzzuu+4thqMQakhxsgT5s02A8LqRcdkg+rbcnuNqUIpekQ4GRx3+M5nj0ODJhBXo9w==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/core/-/core-3.4.0.tgz", + "integrity": "sha512-g+0wwmN2UJsBqy2fQRQ6fhXruoEa62JDeEa5d8IdTJlMoaDaEDfHh7WjwGRn4opuTQWpjAwP/fbcgyHKlE+64w==", "dependencies": { "@babel/core": "^7.23.3", "@babel/generator": "^7.23.3", @@ -2195,14 +2195,12 @@ "@babel/runtime": "^7.22.6", "@babel/runtime-corejs3": "^7.22.6", "@babel/traverse": "^7.22.8", - "@docusaurus/cssnano-preset": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/react-loadable": "5.5.2", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", - "@svgr/webpack": "^6.5.1", + "@docusaurus/cssnano-preset": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "autoprefixer": "^10.4.14", "babel-loader": "^9.1.3", "babel-plugin-dynamic-import-node": "^2.3.3", @@ -2216,8 +2214,8 @@ "copy-webpack-plugin": "^11.0.0", "core-js": "^3.31.1", "css-loader": "^6.8.1", - "css-minimizer-webpack-plugin": "^4.2.2", - "cssnano": "^5.1.15", + "css-minimizer-webpack-plugin": "^5.0.1", + "cssnano": "^6.1.2", "del": "^6.1.1", "detect-port": "^1.5.1", "escape-html": "^1.0.3", @@ -2237,7 +2235,7 @@ "prompts": "^2.4.2", "react-dev-utils": "^12.0.1", "react-helmet-async": "^1.3.0", - "react-loadable": "npm:@docusaurus/react-loadable@5.5.2", + "react-loadable": "npm:@docusaurus/react-loadable@6.0.0", "react-loadable-ssr-addon-v5-slorber": "^1.0.1", "react-router": "^5.3.4", "react-router-config": "^5.1.1", @@ -2268,13 +2266,13 @@ } }, "node_modules/@docusaurus/cssnano-preset": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-3.2.1.tgz", - "integrity": "sha512-wTL9KuSSbMJjKrfu385HZEzAoamUsbKqwscAQByZw4k6Ja/RWpqgVvt/CbAC+aYEH6inLzOt+MjuRwMOrD3VBA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-3.4.0.tgz", + "integrity": "sha512-qwLFSz6v/pZHy/UP32IrprmH5ORce86BGtN0eBtG75PpzQJAzp9gefspox+s8IEOr0oZKuQ/nhzZ3xwyc3jYJQ==", "dependencies": { - "cssnano-preset-advanced": "^5.3.10", - "postcss": "^8.4.26", - "postcss-sort-media-queries": "^4.4.1", + "cssnano-preset-advanced": "^6.1.2", + "postcss": "^8.4.38", + "postcss-sort-media-queries": "^5.2.0", "tslib": "^2.6.0" }, "engines": { @@ -2282,9 +2280,9 @@ } }, "node_modules/@docusaurus/logger": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/logger/-/logger-3.2.1.tgz", - "integrity": "sha512-0voOKJCn9RaM3np6soqEfo7SsVvf2C+CDTWhW+H/1AyBhybASpExtDEz+7ECck9TwPzFQ5tt+I3zVugUJbJWDg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/logger/-/logger-3.4.0.tgz", + "integrity": "sha512-bZwkX+9SJ8lB9kVRkXw+xvHYSMGG4bpYHKGXeXFvyVc79NMeeBSGgzd4TQLHH+DYeOJoCdl8flrFJVxlZ0wo/Q==", "dependencies": { "chalk": "^4.1.2", "tslib": "^2.6.0" @@ -2294,13 +2292,13 @@ } }, "node_modules/@docusaurus/mdx-loader": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/mdx-loader/-/mdx-loader-3.2.1.tgz", - "integrity": "sha512-Fs8tXhXKZjNkdGaOy1xSLXSwfjCMT73J3Zfrju2U16uGedRFRjgK0ojpK5tiC7TnunsL3tOFgp1BSMBRflX9gw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/mdx-loader/-/mdx-loader-3.4.0.tgz", + "integrity": "sha512-kSSbrrk4nTjf4d+wtBA9H+FGauf2gCax89kV8SUSJu3qaTdSIKdWERlngsiHaCFgZ7laTJ8a67UFf+xlFPtuTw==", "dependencies": { - "@docusaurus/logger": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/logger": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "@mdx-js/mdx": "^3.0.0", "@slorber/remark-comment": "^1.0.0", "escape-html": "^1.0.3", @@ -2332,18 +2330,17 @@ } }, "node_modules/@docusaurus/module-type-aliases": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.2.1.tgz", - "integrity": "sha512-FyViV5TqhL1vsM7eh29nJ5NtbRE6Ra6LP1PDcPvhwPSlA7eiWGRKAn3jWwMUcmjkos5SYY+sr0/feCdbM3eQHQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.4.0.tgz", + "integrity": "sha512-A1AyS8WF5Bkjnb8s+guTDuYmUiwJzNrtchebBHpc0gz0PyHJNMaybUlSrmJjHVcGrya0LKI4YcR3lBDQfXRYLw==", "dependencies": { - "@docusaurus/react-loadable": "5.5.2", - "@docusaurus/types": "3.2.1", + "@docusaurus/types": "3.4.0", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", "@types/react-router-dom": "*", "react-helmet-async": "*", - "react-loadable": "npm:@docusaurus/react-loadable@5.5.2" + "react-loadable": "npm:@docusaurus/react-loadable@6.0.0" }, "peerDependencies": { "react": "*", @@ -2351,15 +2348,15 @@ } }, "node_modules/@docusaurus/plugin-client-redirects": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-3.2.1.tgz", - "integrity": "sha512-GgzuqwbqNQSP5s/ouUrOQFuHI8m4Rn8a5CHuWkwpqj+5lbQMsABcvsoiWjrH9M00CzN48q+slSbJy7rtHjn7zg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-3.4.0.tgz", + "integrity": "sha512-Pr8kyh/+OsmYCvdZhc60jy/FnrY6flD2TEAhl4rJxeVFxnvvRgEhoaIVX8q9MuJmaQoh6frPk94pjs7/6YgBDQ==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "eta": "^2.2.0", "fs-extra": "^11.1.1", "lodash": "^4.17.21", @@ -2374,17 +2371,17 @@ } }, "node_modules/@docusaurus/plugin-content-blog": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.2.1.tgz", - "integrity": "sha512-lOx0JfhlGZoZu6pEJfeEpSISZR5dQbJGGvb42IP13G5YThNHhG9R9uoWuo4IOimPqBC7sHThdLA3VLevk61Fsw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.4.0.tgz", + "integrity": "sha512-vv6ZAj78ibR5Jh7XBUT4ndIjmlAxkijM3Sx5MAAzC1gyv0vupDQNhzuFg1USQmQVj3P5I6bquk12etPV3LJ+Xw==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "cheerio": "^1.0.0-rc.12", "feed": "^4.2.2", "fs-extra": "^11.1.1", @@ -2405,18 +2402,18 @@ } }, "node_modules/@docusaurus/plugin-content-docs": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.2.1.tgz", - "integrity": "sha512-GHe5b/lCskAR8QVbfWAfPAApvRZgqk7FN3sOHgjCtjzQACZxkHmq6QqyqZ8Jp45V7lVck4wt2Xw2IzBJ7Cz3bA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.4.0.tgz", + "integrity": "sha512-HkUCZffhBo7ocYheD9oZvMcDloRnGhBMOZRyVcAQRFmZPmNqSyISlXA1tQCIxW+r478fty97XXAGjNYzBjpCsg==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/module-type-aliases": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/module-type-aliases": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "@types/react-router-config": "^5.0.7", "combine-promises": "^1.1.0", "fs-extra": "^11.1.1", @@ -2435,15 +2432,15 @@ } }, "node_modules/@docusaurus/plugin-content-pages": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.2.1.tgz", - "integrity": "sha512-TOqVfMVTAHqWNEGM94Drz+PUpHDbwFy6ucHFgyTx9zJY7wPNSG5EN+rd/mU7OvAi26qpOn2o9xTdUmb28QLjEQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.4.0.tgz", + "integrity": "sha512-h2+VN/0JjpR8fIkDEAoadNjfR3oLzB+v1qSXbIAKjQ46JAHx3X22n9nqS+BWSQnTnp1AjkjSvZyJMekmcwxzxg==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "fs-extra": "^11.1.1", "tslib": "^2.6.0", "webpack": "^5.88.1" @@ -2457,13 +2454,13 @@ } }, "node_modules/@docusaurus/plugin-debug": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-debug/-/plugin-debug-3.2.1.tgz", - "integrity": "sha512-AMKq8NuUKf2sRpN1m/sIbqbRbnmk+rSA+8mNU1LNxEl9BW9F/Gng8m9HKlzeyMPrf5XidzS1jqkuTLDJ6KIrFw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-debug/-/plugin-debug-3.4.0.tgz", + "integrity": "sha512-uV7FDUNXGyDSD3PwUaf5YijX91T5/H9SX4ErEcshzwgzWwBtK37nUWPU3ZLJfeTavX3fycTOqk9TglpOLaWkCg==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", "fs-extra": "^11.1.1", "react-json-view-lite": "^1.2.0", "tslib": "^2.6.0" @@ -2477,13 +2474,13 @@ } }, "node_modules/@docusaurus/plugin-google-analytics": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.2.1.tgz", - "integrity": "sha512-/rJ+9u+Px0eTCiF4TNcNtj3kHf8cp6K1HCwOTdbsSlz6Xn21syZYcy+f1VM9wF6HrvUkXUcbM5TDCvg2IRL6bQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.4.0.tgz", + "integrity": "sha512-mCArluxEGi3cmYHqsgpGGt3IyLCrFBxPsxNZ56Mpur0xSlInnIHoeLDH7FvVVcPJRPSQ9/MfRqLsainRw+BojA==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "tslib": "^2.6.0" }, "engines": { @@ -2495,13 +2492,13 @@ } }, "node_modules/@docusaurus/plugin-google-gtag": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.2.1.tgz", - "integrity": "sha512-XtuJnlMvYfppeVdUyKiDIJAa/gTJKCQU92z8CLZZ9ibJdgVjFOLS10s0hIC0eL5z0U2u2loJz2rZ63HOkNHbBA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.4.0.tgz", + "integrity": "sha512-Dsgg6PLAqzZw5wZ4QjUYc8Z2KqJqXxHxq3vIoyoBWiLEEfigIs7wHR+oiWUQy3Zk9MIk6JTYj7tMoQU0Jm3nqA==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "@types/gtag.js": "^0.0.12", "tslib": "^2.6.0" }, @@ -2514,13 +2511,13 @@ } }, "node_modules/@docusaurus/plugin-google-tag-manager": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.2.1.tgz", - "integrity": "sha512-wiS/kE0Ny5pnjTxVCs8ljRnkL1RVMj59t6jmSsgEX7piDOoaXSMIUaoIt9ogS/v132uO0xEsxHstkRUZHQyPcQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.4.0.tgz", + "integrity": "sha512-O9tX1BTwxIhgXpOLpFDueYA9DWk69WCbDRrjYoMQtFHSkTyE7RhNgyjSPREUWJb9i+YUg3OrsvrBYRl64FCPCQ==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "tslib": "^2.6.0" }, "engines": { @@ -2532,16 +2529,16 @@ } }, "node_modules/@docusaurus/plugin-sitemap": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.2.1.tgz", - "integrity": "sha512-uWZ7AxzdeaQSTCwD2yZtOiEm9zyKU+wqCmi/Sf25kQQqqFSBZUStXfaQ8OHP9cecnw893ZpZ811rPhB/wfujJw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.4.0.tgz", + "integrity": "sha512-+0VDvx9SmNrFNgwPoeoCha+tRoAjopwT0+pYO1xAbyLcewXSemq+eLxEa46Q1/aoOaJQ0qqHELuQM7iS2gp33Q==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "fs-extra": "^11.1.1", "sitemap": "^7.1.1", "tslib": "^2.6.0" @@ -2555,23 +2552,23 @@ } }, "node_modules/@docusaurus/preset-classic": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/preset-classic/-/preset-classic-3.2.1.tgz", - "integrity": "sha512-E3OHSmttpEBcSMhfPBq3EJMBxZBM01W1rnaCUTXy9EHvkmB5AwgTfW1PwGAybPAX579ntE03R+2zmXdizWfKnQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/preset-classic/-/preset-classic-3.4.0.tgz", + "integrity": "sha512-Ohj6KB7siKqZaQhNJVMBBUzT3Nnp6eTKqO+FXO3qu/n1hJl3YLwVKTWBg28LF7MWrKu46UuYavwMRxud0VyqHg==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/plugin-content-blog": "3.2.1", - "@docusaurus/plugin-content-docs": "3.2.1", - "@docusaurus/plugin-content-pages": "3.2.1", - "@docusaurus/plugin-debug": "3.2.1", - "@docusaurus/plugin-google-analytics": "3.2.1", - "@docusaurus/plugin-google-gtag": "3.2.1", - "@docusaurus/plugin-google-tag-manager": "3.2.1", - "@docusaurus/plugin-sitemap": "3.2.1", - "@docusaurus/theme-classic": "3.2.1", - "@docusaurus/theme-common": "3.2.1", - "@docusaurus/theme-search-algolia": "3.2.1", - "@docusaurus/types": "3.2.1" + "@docusaurus/core": "3.4.0", + "@docusaurus/plugin-content-blog": "3.4.0", + "@docusaurus/plugin-content-docs": "3.4.0", + "@docusaurus/plugin-content-pages": "3.4.0", + "@docusaurus/plugin-debug": "3.4.0", + "@docusaurus/plugin-google-analytics": "3.4.0", + "@docusaurus/plugin-google-gtag": "3.4.0", + "@docusaurus/plugin-google-tag-manager": "3.4.0", + "@docusaurus/plugin-sitemap": "3.4.0", + "@docusaurus/theme-classic": "3.4.0", + "@docusaurus/theme-common": "3.4.0", + "@docusaurus/theme-search-algolia": "3.4.0", + "@docusaurus/types": "3.4.0" }, "engines": { "node": ">=18.0" @@ -2581,35 +2578,23 @@ "react-dom": "^18.0.0" } }, - "node_modules/@docusaurus/react-loadable": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz", - "integrity": "sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==", - "dependencies": { - "@types/react": "*", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": "*" - } - }, "node_modules/@docusaurus/theme-classic": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-classic/-/theme-classic-3.2.1.tgz", - "integrity": "sha512-+vSbnQyoWjc6vRZi4vJO2dBU02wqzynsai15KK+FANZudrYaBHtkbLZAQhgmxzBGVpxzi87gRohlMm+5D8f4tA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-classic/-/theme-classic-3.4.0.tgz", + "integrity": "sha512-0IPtmxsBYv2adr1GnZRdMkEQt1YW6tpzrUPj02YxNpvJ5+ju4E13J5tB4nfdaen/tfR1hmpSPlTFPvTf4kwy8Q==", "dependencies": { - "@docusaurus/core": "3.2.1", - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/module-type-aliases": "3.2.1", - "@docusaurus/plugin-content-blog": "3.2.1", - "@docusaurus/plugin-content-docs": "3.2.1", - "@docusaurus/plugin-content-pages": "3.2.1", - "@docusaurus/theme-common": "3.2.1", - "@docusaurus/theme-translations": "3.2.1", - "@docusaurus/types": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/module-type-aliases": "3.4.0", + "@docusaurus/plugin-content-blog": "3.4.0", + "@docusaurus/plugin-content-docs": "3.4.0", + "@docusaurus/plugin-content-pages": "3.4.0", + "@docusaurus/theme-common": "3.4.0", + "@docusaurus/theme-translations": "3.4.0", + "@docusaurus/types": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", "copy-text-to-clipboard": "^3.2.0", @@ -2633,17 +2618,17 @@ } }, "node_modules/@docusaurus/theme-common": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.2.1.tgz", - "integrity": "sha512-d+adiD7L9xv6EvfaAwUqdKf4orsM3jqgeqAM+HAjgL/Ux0GkVVnfKr+tsoe+4ow4rHe6NUt+nkkW8/K8dKdilA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.4.0.tgz", + "integrity": "sha512-0A27alXuv7ZdCg28oPE8nH/Iz73/IUejVaCazqu9elS4ypjiLhK3KfzdSQBnL/g7YfHSlymZKdiOHEo8fJ0qMA==", "dependencies": { - "@docusaurus/mdx-loader": "3.2.1", - "@docusaurus/module-type-aliases": "3.2.1", - "@docusaurus/plugin-content-blog": "3.2.1", - "@docusaurus/plugin-content-docs": "3.2.1", - "@docusaurus/plugin-content-pages": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", + "@docusaurus/mdx-loader": "3.4.0", + "@docusaurus/module-type-aliases": "3.4.0", + "@docusaurus/plugin-content-blog": "3.4.0", + "@docusaurus/plugin-content-docs": "3.4.0", + "@docusaurus/plugin-content-pages": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", @@ -2662,18 +2647,18 @@ } }, "node_modules/@docusaurus/theme-search-algolia": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.2.1.tgz", - "integrity": "sha512-bzhCrpyXBXzeydNUH83II2akvFEGfhsNTPPWsk5N7e+odgQCQwoHhcF+2qILbQXjaoZ6B3c48hrvkyCpeyqGHw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.4.0.tgz", + "integrity": "sha512-aiHFx7OCw4Wck1z6IoShVdUWIjntC8FHCw9c5dR8r3q4Ynh+zkS8y2eFFunN/DL6RXPzpnvKCg3vhLQYJDmT9Q==", "dependencies": { "@docsearch/react": "^3.5.2", - "@docusaurus/core": "3.2.1", - "@docusaurus/logger": "3.2.1", - "@docusaurus/plugin-content-docs": "3.2.1", - "@docusaurus/theme-common": "3.2.1", - "@docusaurus/theme-translations": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-validation": "3.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/logger": "3.4.0", + "@docusaurus/plugin-content-docs": "3.4.0", + "@docusaurus/theme-common": "3.4.0", + "@docusaurus/theme-translations": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-validation": "3.4.0", "algoliasearch": "^4.18.0", "algoliasearch-helper": "^3.13.3", "clsx": "^2.0.0", @@ -2692,9 +2677,9 @@ } }, "node_modules/@docusaurus/theme-translations": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.2.1.tgz", - "integrity": "sha512-jAUMkIkFfY+OAhJhv6mV8zlwY6J4AQxJPTgLdR2l+Otof9+QdJjHNh/ifVEu9q0lp3oSPlJj9l05AaP7Ref+cg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.4.0.tgz", + "integrity": "sha512-zSxCSpmQCCdQU5Q4CnX/ID8CSUUI3fvmq4hU/GNP/XoAWtXo9SAVnM3TzpU8Gb//H3WCsT8mJcTfyOk3d9ftNg==", "dependencies": { "fs-extra": "^11.1.1", "tslib": "^2.6.0" @@ -2704,9 +2689,9 @@ } }, "node_modules/@docusaurus/types": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.2.1.tgz", - "integrity": "sha512-n/toxBzL2oxTtRTOFiGKsHypzn/Pm+sXyw+VSk1UbqbXQiHOwHwts55bpKwbcUgA530Is6kix3ELiFOv9GAMfw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.4.0.tgz", + "integrity": "sha512-4jcDO8kXi5Cf9TcyikB/yKmz14f2RZ2qTRerbHAsS+5InE9ZgSLBNLsewtFTcTOXSVcbU3FoGOzcNWAmU1TR0A==", "dependencies": { "@mdx-js/mdx": "^3.0.0", "@types/history": "^4.7.11", @@ -2724,13 +2709,13 @@ } }, "node_modules/@docusaurus/utils": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.2.1.tgz", - "integrity": "sha512-DPkIS/EPc+pGAV798PUXgNzJFM3HJouoQXgr0KDZuJVz1EkWbDLOcQwLIz8Qx7liI9ddfkN/TXTRQdsTPZNakw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.4.0.tgz", + "integrity": "sha512-fRwnu3L3nnWaXOgs88BVBmG1yGjcQqZNHG+vInhEa2Sz2oQB+ZjbEMO5Rh9ePFpZ0YDiDUhpaVjwmS+AU2F14g==", "dependencies": { - "@docusaurus/logger": "3.2.1", - "@docusaurus/utils-common": "3.2.1", - "@svgr/webpack": "^6.5.1", + "@docusaurus/logger": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "@svgr/webpack": "^8.1.0", "escape-string-regexp": "^4.0.0", "file-loader": "^6.2.0", "fs-extra": "^11.1.1", @@ -2746,6 +2731,7 @@ "shelljs": "^0.8.5", "tslib": "^2.6.0", "url-loader": "^4.1.1", + "utility-types": "^3.10.0", "webpack": "^5.88.1" }, "engines": { @@ -2761,9 +2747,9 @@ } }, "node_modules/@docusaurus/utils-common": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.2.1.tgz", - "integrity": "sha512-N5vadULnRLiqX2QfTjVEU3u5vo6RG2EZTdyXvJdzDOdrLCGIZAfnf/VkssinFZ922sVfaFfQ4FnStdhn5TWdVg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.4.0.tgz", + "integrity": "sha512-NVx54Wr4rCEKsjOH5QEVvxIqVvm+9kh7q8aYTU5WzUU9/Hctd6aTrcZ3G0Id4zYJ+AeaG5K5qHA4CY5Kcm2iyQ==", "dependencies": { "tslib": "^2.6.0" }, @@ -2780,15 +2766,17 @@ } }, "node_modules/@docusaurus/utils-validation": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.2.1.tgz", - "integrity": "sha512-+x7IR9hNMXi62L1YAglwd0s95fR7+EtirjTxSN4kahYRWGqOi3jlQl1EV0az/yTEvKbxVvOPcdYicGu9dk4LJw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.4.0.tgz", + "integrity": "sha512-hYQ9fM+AXYVTWxJOT1EuNaRnrR2WGpRdLDQG07O8UOpsvCPWUVOeo26Rbm0JWY2sGLfzAb+tvJ62yF+8F+TV0g==", "dependencies": { - "@docusaurus/logger": "3.2.1", - "@docusaurus/utils": "3.2.1", - "@docusaurus/utils-common": "3.2.1", + "@docusaurus/logger": "3.4.0", + "@docusaurus/utils": "3.4.0", + "@docusaurus/utils-common": "3.4.0", + "fs-extra": "^11.2.0", "joi": "^17.9.2", "js-yaml": "^4.1.0", + "lodash": "^4.17.21", "tslib": "^2.6.0" }, "engines": { @@ -3125,11 +3113,11 @@ } }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz", - "integrity": "sha512-9PYGcXrAxitycIjRmZB+Q0JaN07GZIWaTBIGQzfaZv+qr1n8X1XUEJ5rZ/vx6OVD9RRYlrNnXWExQXcmZeD/BQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", + "integrity": "sha512-b9MIk7yhdS1pMCZM8VeNfUlSKVRhsHZNMl5O9SfaX0l0t5wjdgu4IDzGB8bpnGBBOjGST3rRFVsaaEtI4W6f7g==", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3170,11 +3158,11 @@ } }, "node_modules/@svgr/babel-plugin-replace-jsx-attribute-value": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-6.5.1.tgz", - "integrity": "sha512-8DPaVVE3fd5JKuIC29dqyMB54sA6mfgki2H2+swh+zNJoynC8pMPzOkidqHOSc6Wj032fhl8Z0TVn1GiPpAiJg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-8.0.0.tgz", + "integrity": "sha512-KVQ+PtIjb1BuYT3ht8M5KbzWBhdAjjUPdlMtpuw/VjT8coTrItWX6Qafl9+ji831JaJcu6PJNKCV0bp01lBNzQ==", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3185,11 +3173,11 @@ } }, "node_modules/@svgr/babel-plugin-svg-dynamic-title": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-6.5.1.tgz", - "integrity": "sha512-FwOEi0Il72iAzlkaHrlemVurgSQRDFbk0OC8dSvD5fSBPHltNh7JtLsxmZUhjYBZo2PpcU/RJvvi6Q0l7O7ogw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-8.0.0.tgz", + "integrity": "sha512-omNiKqwjNmOQJ2v6ge4SErBbkooV2aAWwaPFs2vUY7p7GhVkzRkJ00kILXQvRhA6miHnNpXv7MRnnSjdRjK8og==", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3200,11 +3188,11 @@ } }, "node_modules/@svgr/babel-plugin-svg-em-dimensions": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-6.5.1.tgz", - "integrity": "sha512-gWGsiwjb4tw+ITOJ86ndY/DZZ6cuXMNE/SjcDRg+HLuCmwpcjOktwRF9WgAiycTqJD/QXqL2f8IzE2Rzh7aVXA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-8.0.0.tgz", + "integrity": "sha512-mURHYnu6Iw3UBTbhGwE/vsngtCIbHE43xCRK7kCw4t01xyGqb2Pd+WXekRRoFOBIY29ZoOhUCTEweDMdrjfi9g==", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3215,11 +3203,11 @@ } }, "node_modules/@svgr/babel-plugin-transform-react-native-svg": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-6.5.1.tgz", - "integrity": "sha512-2jT3nTayyYP7kI6aGutkyfJ7UMGtuguD72OjeGLwVNyfPRBD8zQthlvL+fAbAKk5n9ZNcvFkp/b1lZ7VsYqVJg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-8.1.0.tgz", + "integrity": "sha512-Tx8T58CHo+7nwJ+EhUwx3LfdNSG9R2OKfaIXXs5soiy5HtgoAEkDay9LIimLOcG8dJQH1wPZp/cnAv6S9CrR1Q==", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3230,9 +3218,9 @@ } }, "node_modules/@svgr/babel-plugin-transform-svg-component": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-6.5.1.tgz", - "integrity": "sha512-a1p6LF5Jt33O3rZoVRBqdxL350oge54iZWHNI6LJB5tQ7EelvD/Mb1mfBiZNAan0dt4i3VArkFRjA4iObuNykQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-8.0.0.tgz", + "integrity": "sha512-DFx8xa3cZXTdb/k3kfPeaixecQLgKh5NVBMwD0AQxOzcZawK4oo1Jh9LbrcACUivsCA7TLG8eeWgrDXjTMhRmw==", "engines": { "node": ">=12" }, @@ -3245,21 +3233,21 @@ } }, "node_modules/@svgr/babel-preset": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/babel-preset/-/babel-preset-6.5.1.tgz", - "integrity": "sha512-6127fvO/FF2oi5EzSQOAjo1LE3OtNVh11R+/8FXa+mHx1ptAaS4cknIjnUA7e6j6fwGGJ17NzaTJFUwOV2zwCw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-preset/-/babel-preset-8.1.0.tgz", + "integrity": "sha512-7EYDbHE7MxHpv4sxvnVPngw5fuR6pw79SkcrILHJ/iMpuKySNCl5W1qcwPEpU+LgyRXOaAFgH0KhwD18wwg6ug==", "dependencies": { - "@svgr/babel-plugin-add-jsx-attribute": "^6.5.1", - "@svgr/babel-plugin-remove-jsx-attribute": "*", - "@svgr/babel-plugin-remove-jsx-empty-expression": "*", - "@svgr/babel-plugin-replace-jsx-attribute-value": "^6.5.1", - "@svgr/babel-plugin-svg-dynamic-title": "^6.5.1", - "@svgr/babel-plugin-svg-em-dimensions": "^6.5.1", - "@svgr/babel-plugin-transform-react-native-svg": "^6.5.1", - "@svgr/babel-plugin-transform-svg-component": "^6.5.1" + "@svgr/babel-plugin-add-jsx-attribute": "8.0.0", + "@svgr/babel-plugin-remove-jsx-attribute": "8.0.0", + "@svgr/babel-plugin-remove-jsx-empty-expression": "8.0.0", + "@svgr/babel-plugin-replace-jsx-attribute-value": "8.0.0", + "@svgr/babel-plugin-svg-dynamic-title": "8.0.0", + "@svgr/babel-plugin-svg-em-dimensions": "8.0.0", + "@svgr/babel-plugin-transform-react-native-svg": "8.1.0", + "@svgr/babel-plugin-transform-svg-component": "8.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3270,18 +3258,18 @@ } }, "node_modules/@svgr/core": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/core/-/core-6.5.1.tgz", - "integrity": "sha512-/xdLSWxK5QkqG524ONSjvg3V/FkNyCv538OIBdQqPNaAta3AsXj/Bd2FbvR87yMbXO2hFSWiAe/Q6IkVPDw+mw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/core/-/core-8.1.0.tgz", + "integrity": "sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==", "dependencies": { - "@babel/core": "^7.19.6", - "@svgr/babel-preset": "^6.5.1", - "@svgr/plugin-jsx": "^6.5.1", + "@babel/core": "^7.21.3", + "@svgr/babel-preset": "8.1.0", "camelcase": "^6.2.0", - "cosmiconfig": "^7.0.1" + "cosmiconfig": "^8.1.3", + "snake-case": "^3.0.4" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3289,15 +3277,15 @@ } }, "node_modules/@svgr/hast-util-to-babel-ast": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-6.5.1.tgz", - "integrity": "sha512-1hnUxxjd83EAxbL4a0JDJoD3Dao3hmjvyvyEV8PzWmLK3B9m9NPlW7GKjFyoWE8nM7HnXzPcmmSyOW8yOddSXw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-8.0.0.tgz", + "integrity": "sha512-EbDKwO9GpfWP4jN9sGdYwPBU0kdomaPIL2Eu4YwmgP+sJeXT+L7bMwJUBnhzfH8Q2qMBqZ4fJwpCyYsAN3mt2Q==", "dependencies": { - "@babel/types": "^7.20.0", + "@babel/types": "^7.21.3", "entities": "^4.4.0" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3305,37 +3293,37 @@ } }, "node_modules/@svgr/plugin-jsx": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-6.5.1.tgz", - "integrity": "sha512-+UdQxI3jgtSjCykNSlEMuy1jSRQlGC7pqBCPvkG/2dATdWo082zHTTK3uhnAju2/6XpE6B5mZ3z4Z8Ns01S8Gw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-8.1.0.tgz", + "integrity": "sha512-0xiIyBsLlr8quN+WyuxooNW9RJ0Dpr8uOnH/xrCVO8GLUcwHISwj1AG0k+LFzteTkAA0GbX0kj9q6Dk70PTiPA==", "dependencies": { - "@babel/core": "^7.19.6", - "@svgr/babel-preset": "^6.5.1", - "@svgr/hast-util-to-babel-ast": "^6.5.1", + "@babel/core": "^7.21.3", + "@svgr/babel-preset": "8.1.0", + "@svgr/hast-util-to-babel-ast": "8.0.0", "svg-parser": "^2.0.4" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", "url": "https://github.com/sponsors/gregberge" }, "peerDependencies": { - "@svgr/core": "^6.0.0" + "@svgr/core": "*" } }, "node_modules/@svgr/plugin-svgo": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/plugin-svgo/-/plugin-svgo-6.5.1.tgz", - "integrity": "sha512-omvZKf8ixP9z6GWgwbtmP9qQMPX4ODXi+wzbVZgomNFsUIlHA1sf4fThdwTWSsZGgvGAG6yE+b/F5gWUkcZ/iQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/plugin-svgo/-/plugin-svgo-8.1.0.tgz", + "integrity": "sha512-Ywtl837OGO9pTLIN/onoWLmDQ4zFUycI1g76vuKGEz6evR/ZTJlJuz3G/fIkb6OVBJ2g0o6CGJzaEjfmEo3AHA==", "dependencies": { - "cosmiconfig": "^7.0.1", - "deepmerge": "^4.2.2", - "svgo": "^2.8.0" + "cosmiconfig": "^8.1.3", + "deepmerge": "^4.3.1", + "svgo": "^3.0.2" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -3346,21 +3334,21 @@ } }, "node_modules/@svgr/webpack": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-6.5.1.tgz", - "integrity": "sha512-cQ/AsnBkXPkEK8cLbv4Dm7JGXq2XrumKnL1dRpJD9rIO2fTIlJI9a1uCciYG1F2aUsox/hJQyNGbt3soDxSRkA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-8.1.0.tgz", + "integrity": "sha512-LnhVjMWyMQV9ZmeEy26maJk+8HTIbd59cH4F2MJ439k9DqejRisfFNGAPvRYlKETuh9LrImlS8aKsBgKjMA8WA==", "dependencies": { - "@babel/core": "^7.19.6", - "@babel/plugin-transform-react-constant-elements": "^7.18.12", - "@babel/preset-env": "^7.19.4", + "@babel/core": "^7.21.3", + "@babel/plugin-transform-react-constant-elements": "^7.21.3", + "@babel/preset-env": "^7.20.2", "@babel/preset-react": "^7.18.6", - "@babel/preset-typescript": "^7.18.6", - "@svgr/core": "^6.5.1", - "@svgr/plugin-jsx": "^6.5.1", - "@svgr/plugin-svgo": "^6.5.1" + "@babel/preset-typescript": "^7.21.0", + "@svgr/core": "8.1.0", + "@svgr/plugin-jsx": "8.1.0", + "@svgr/plugin-svgo": "8.1.0" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { "type": "github", @@ -4040,9 +4028,9 @@ } }, "node_modules/algoliasearch-helper": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.18.0.tgz", - "integrity": "sha512-ZXvA8r6VG46V343jnIE7Tei8Xr0/9N8YhD27joC0BKxeogQyvNu7O37i510wA7FnrDjoa/tFhK90WUaBlkaqnw==", + "version": "3.22.1", + "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.22.1.tgz", + "integrity": "sha512-fSxJ4YreH4kOME9CnKazbAn2tK/rvBoV37ETd6nTt4j7QfkcnW+c+F22WfuE9Q/sRpvOMnUwU/BXAVEiwW7p/w==", "dependencies": { "@algolia/events": "^4.0.1" }, @@ -5128,18 +5116,28 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/cross-spawn": { @@ -5181,11 +5179,11 @@ } }, "node_modules/css-declaration-sorter": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", - "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-7.2.0.tgz", + "integrity": "sha512-h70rUM+3PNFuaBDTLe8wF/cdWu+dOZmb7pJt8Z2sedYbAcQVQV/tEchueg3GWxwqS0cxtbxmaHEdkNACqcvsow==", "engines": { - "node": "^10 || ^12 || >=14" + "node": "^14 || ^16 || >=18" }, "peerDependencies": { "postcss": "^8.0.9" @@ -5217,16 +5215,16 @@ } }, "node_modules/css-minimizer-webpack-plugin": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-4.2.2.tgz", - "integrity": "sha512-s3Of/4jKfw1Hj9CxEO1E5oXhQAxlayuHO2y/ML+C6I9sQ7FdzfEV6QgMLN3vI+qFsjJGIAFLKtQK7t8BOXAIyA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-5.0.1.tgz", + "integrity": "sha512-3caImjKFQkS+ws1TGcFn0V1HyDJFq1Euy589JlD6/3rV2kj+w7r5G9WDMgSHvpvXHNZ2calVypZWuEDQd9wfLg==", "dependencies": { - "cssnano": "^5.1.8", - "jest-worker": "^29.1.2", - "postcss": "^8.4.17", - "schema-utils": "^4.0.0", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1" + "@jridgewell/trace-mapping": "^0.3.18", + "cssnano": "^6.0.1", + "jest-worker": "^29.4.3", + "postcss": "^8.4.24", + "schema-utils": "^4.0.1", + "serialize-javascript": "^6.0.1" }, "engines": { "node": ">= 14.15.0" @@ -5259,14 +5257,6 @@ } } }, - "node_modules/css-minimizer-webpack-plugin/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/css-select": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", @@ -5283,23 +5273,15 @@ } }, "node_modules/css-tree": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", "dependencies": { - "mdn-data": "2.0.14", - "source-map": "^0.6.1" + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/css-tree/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, "node_modules/css-what": { @@ -5325,108 +5307,128 @@ } }, "node_modules/cssnano": { - "version": "5.1.15", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.15.tgz", - "integrity": "sha512-j+BKgDcLDQA+eDifLx0EO4XSA56b7uut3BQFH+wbSaSTuGLuiyTa/wbRYthUXX8LC9mLg+WWKe8h+qJuwTAbHw==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.1.2.tgz", + "integrity": "sha512-rYk5UeX7VAM/u0lNqewCdasdtPK81CgX8wJFLEIXHbV2oldWRgJAsZrdhRXkV1NJzA2g850KiFm9mMU2HxNxMA==", "dependencies": { - "cssnano-preset-default": "^5.2.14", - "lilconfig": "^2.0.3", - "yaml": "^1.10.2" + "cssnano-preset-default": "^6.1.2", + "lilconfig": "^3.1.1" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/cssnano" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-preset-advanced": { - "version": "5.3.10", - "resolved": "https://registry.npmjs.org/cssnano-preset-advanced/-/cssnano-preset-advanced-5.3.10.tgz", - "integrity": "sha512-fnYJyCS9jgMU+cmHO1rPSPf9axbQyD7iUhLO5Df6O4G+fKIOMps+ZbU0PdGFejFBBZ3Pftf18fn1eG7MAPUSWQ==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/cssnano-preset-advanced/-/cssnano-preset-advanced-6.1.2.tgz", + "integrity": "sha512-Nhao7eD8ph2DoHolEzQs5CfRpiEP0xa1HBdnFZ82kvqdmbwVBUr2r1QuQ4t1pi+D1ZpqpcO4T+wy/7RxzJ/WPQ==", "dependencies": { - "autoprefixer": "^10.4.12", - "cssnano-preset-default": "^5.2.14", - "postcss-discard-unused": "^5.1.0", - "postcss-merge-idents": "^5.1.1", - "postcss-reduce-idents": "^5.2.0", - "postcss-zindex": "^5.1.0" + "autoprefixer": "^10.4.19", + "browserslist": "^4.23.0", + "cssnano-preset-default": "^6.1.2", + "postcss-discard-unused": "^6.0.5", + "postcss-merge-idents": "^6.0.3", + "postcss-reduce-idents": "^6.0.3", + "postcss-zindex": "^6.0.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-preset-default": { - "version": "5.2.14", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz", - "integrity": "sha512-t0SFesj/ZV2OTylqQVOrFgEh5uanxbO6ZAdeCrNsUQ6fVuXwYTxJPNAGvGTxHbD68ldIJNec7PyYZDBrfDQ+6A==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.1.2.tgz", + "integrity": "sha512-1C0C+eNaeN8OcHQa193aRgYexyJtU8XwbdieEjClw+J9d94E41LwT6ivKH0WT+fYwYWB0Zp3I3IZ7tI/BbUbrg==", "dependencies": { - "css-declaration-sorter": "^6.3.1", - "cssnano-utils": "^3.1.0", - "postcss-calc": "^8.2.3", - "postcss-colormin": "^5.3.1", - "postcss-convert-values": "^5.1.3", - "postcss-discard-comments": "^5.1.2", - "postcss-discard-duplicates": "^5.1.0", - "postcss-discard-empty": "^5.1.1", - "postcss-discard-overridden": "^5.1.0", - "postcss-merge-longhand": "^5.1.7", - "postcss-merge-rules": "^5.1.4", - "postcss-minify-font-values": "^5.1.0", - "postcss-minify-gradients": "^5.1.1", - "postcss-minify-params": "^5.1.4", - "postcss-minify-selectors": "^5.2.1", - "postcss-normalize-charset": "^5.1.0", - "postcss-normalize-display-values": "^5.1.0", - "postcss-normalize-positions": "^5.1.1", - "postcss-normalize-repeat-style": "^5.1.1", - "postcss-normalize-string": "^5.1.0", - "postcss-normalize-timing-functions": "^5.1.0", - "postcss-normalize-unicode": "^5.1.1", - "postcss-normalize-url": "^5.1.0", - "postcss-normalize-whitespace": "^5.1.1", - "postcss-ordered-values": "^5.1.3", - "postcss-reduce-initial": "^5.1.2", - "postcss-reduce-transforms": "^5.1.0", - "postcss-svgo": "^5.1.0", - "postcss-unique-selectors": "^5.1.1" + "browserslist": "^4.23.0", + "css-declaration-sorter": "^7.2.0", + "cssnano-utils": "^4.0.2", + "postcss-calc": "^9.0.1", + "postcss-colormin": "^6.1.0", + "postcss-convert-values": "^6.1.0", + "postcss-discard-comments": "^6.0.2", + "postcss-discard-duplicates": "^6.0.3", + "postcss-discard-empty": "^6.0.3", + "postcss-discard-overridden": "^6.0.2", + "postcss-merge-longhand": "^6.0.5", + "postcss-merge-rules": "^6.1.1", + "postcss-minify-font-values": "^6.1.0", + "postcss-minify-gradients": "^6.0.3", + "postcss-minify-params": "^6.1.0", + "postcss-minify-selectors": "^6.0.4", + "postcss-normalize-charset": "^6.0.2", + "postcss-normalize-display-values": "^6.0.2", + "postcss-normalize-positions": "^6.0.2", + "postcss-normalize-repeat-style": "^6.0.2", + "postcss-normalize-string": "^6.0.2", + "postcss-normalize-timing-functions": "^6.0.2", + "postcss-normalize-unicode": "^6.1.0", + "postcss-normalize-url": "^6.0.2", + "postcss-normalize-whitespace": "^6.0.2", + "postcss-ordered-values": "^6.0.2", + "postcss-reduce-initial": "^6.1.0", + "postcss-reduce-transforms": "^6.0.2", + "postcss-svgo": "^6.0.3", + "postcss-unique-selectors": "^6.0.4" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", - "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.2.tgz", + "integrity": "sha512-ZR1jHg+wZ8o4c3zqf1SIUSTIvm/9mU343FMR6Obe/unskbvpGhZOo1J6d/r8D1pzkRQYuwbcH3hToOuoA2G7oQ==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/csso": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", "dependencies": { - "css-tree": "^1.1.2" + "css-tree": "~2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" } }, + "node_modules/csso/node_modules/css-tree": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dependencies": { + "mdn-data": "2.0.28", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/csso/node_modules/mdn-data": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==" + }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -8120,11 +8122,14 @@ } }, "node_modules/lilconfig": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", - "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", "engines": { - "node": ">=10" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" } }, "node_modules/lines-and-columns": { @@ -8633,9 +8638,9 @@ } }, "node_modules/mdn-data": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==" + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==" }, "node_modules/media-typer": { "version": "0.3.0", @@ -10580,17 +10585,6 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -11080,9 +11074,9 @@ } }, "node_modules/postcss": { - "version": "8.4.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", - "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", "funding": [ { "type": "opencollective", @@ -11100,112 +11094,115 @@ "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "source-map-js": "^1.2.0" }, "engines": { "node": "^10 || ^12 || >=14" } }, "node_modules/postcss-calc": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-8.2.4.tgz", - "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-9.0.1.tgz", + "integrity": "sha512-TipgjGyzP5QzEhsOZUaIkeO5mKeMFpebWzRogWG/ysonUlnHcq5aJe0jOjpfzUU8PeSaBQnrE8ehR0QA5vs8PQ==", "dependencies": { - "postcss-selector-parser": "^6.0.9", + "postcss-selector-parser": "^6.0.11", "postcss-value-parser": "^4.2.0" }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, "peerDependencies": { "postcss": "^8.2.2" } }, "node_modules/postcss-colormin": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-5.3.1.tgz", - "integrity": "sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.1.0.tgz", + "integrity": "sha512-x9yX7DOxeMAR+BgGVnNSAxmAj98NX/YxEMNFP+SDCEeNLb2r3i6Hh1ksMsnW8Ub5SLCpbescQqn9YEbE9554Sw==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.23.0", "caniuse-api": "^3.0.0", - "colord": "^2.9.1", + "colord": "^2.9.3", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-convert-values": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.3.tgz", - "integrity": "sha512-82pC1xkJZtcJEfiLw6UXnXVXScgtBrjlO5CBmuDQc+dlb88ZYheFsjTn40+zBVi3DkfF7iezO0nJUPLcJK3pvA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.1.0.tgz", + "integrity": "sha512-zx8IwP/ts9WvUM6NkVSkiU902QZL1bwPhaVaLynPtCsOTqp+ZKbNi+s6XJg3rfqpKGA/oc7Oxk5t8pOQJcwl/w==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.23.0", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-comments": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", - "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.2.tgz", + "integrity": "sha512-65w/uIqhSBBfQmYnG92FO1mWZjJ4GL5b8atm5Yw2UgrwD7HiNiSSNwJor1eCFGzUgYnN/iIknhNRVqjrrpuglw==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-duplicates": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", - "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.3.tgz", + "integrity": "sha512-+JA0DCvc5XvFAxwx6f/e68gQu/7Z9ud584VLmcgto28eB8FqSFZwtrLwB5Kcp70eIoWP/HXqz4wpo8rD8gpsTw==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-empty": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", - "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.3.tgz", + "integrity": "sha512-znyno9cHKQsK6PtxL5D19Fj9uwSzC2mB74cpT66fhgOadEUPyXFkbgwm5tvc3bt3NAy8ltE5MrghxovZRVnOjQ==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-overridden": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", - "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.2.tgz", + "integrity": "sha512-j87xzI4LUggC5zND7KdjsI25APtyMuynXZSujByMaav2roV6OZX+8AaCUcZSWqckZpjAjRyFDdpqybgjFO0HJQ==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-unused": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-5.1.0.tgz", - "integrity": "sha512-KwLWymI9hbwXmJa0dkrzpRbSJEh0vVUd7r8t0yOGPcfKzyJJxFM8kLyC5Ev9avji6nY95pOp1W6HqIrfT+0VGw==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-6.0.5.tgz", + "integrity": "sha512-wHalBlRHkaNnNwfC8z+ppX57VhvS+HWgjW508esjdaEYr3Mx7Gnn2xA4R/CKf5+Z9S5qsqC+Uzh4ueENWwCVUA==", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.16" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-loader": { @@ -11229,136 +11226,111 @@ "webpack": "^5.0.0" } }, - "node_modules/postcss-loader/node_modules/cosmiconfig": { - "version": "8.3.6", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", - "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", - "dependencies": { - "import-fresh": "^3.3.0", - "js-yaml": "^4.1.0", - "parse-json": "^5.2.0", - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/d-fischer" - }, - "peerDependencies": { - "typescript": ">=4.9.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/postcss-merge-idents": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-5.1.1.tgz", - "integrity": "sha512-pCijL1TREiCoog5nQp7wUe+TUonA2tC2sQ54UGeMmryK3UFGIYKqDyjnqd6RcuI4znFn9hWSLNN8xKE/vWcUQw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-6.0.3.tgz", + "integrity": "sha512-1oIoAsODUs6IHQZkLQGO15uGEbK3EAl5wi9SS8hs45VgsxQfMnxvt+L+zIr7ifZFIH14cfAeVe2uCTa+SPRa3g==", "dependencies": { - "cssnano-utils": "^3.1.0", + "cssnano-utils": "^4.0.2", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-merge-longhand": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.7.tgz", - "integrity": "sha512-YCI9gZB+PLNskrK0BB3/2OzPnGhPkBEwmwhfYk1ilBHYVAZB7/tkTHFBAnCrvBBOmeYyMYw3DMjT55SyxMBzjQ==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.5.tgz", + "integrity": "sha512-5LOiordeTfi64QhICp07nzzuTDjNSO8g5Ksdibt44d+uvIIAE1oZdRn8y/W5ZtYgRH/lnLDlvi9F8btZcVzu3w==", "dependencies": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^5.1.1" + "stylehacks": "^6.1.1" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-merge-rules": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.4.tgz", - "integrity": "sha512-0R2IuYpgU93y9lhVbO/OylTtKMVcHb67zjWIfCiKR9rWL3GUk1677LAqD/BcHizukdZEjT8Ru3oHRoAYoJy44g==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.1.1.tgz", + "integrity": "sha512-KOdWF0gju31AQPZiD+2Ar9Qjowz1LTChSjFFbS+e2sFgc4uHOp3ZvVX4sNeTlk0w2O31ecFGgrFzhO0RSWbWwQ==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.23.0", "caniuse-api": "^3.0.0", - "cssnano-utils": "^3.1.0", - "postcss-selector-parser": "^6.0.5" + "cssnano-utils": "^4.0.2", + "postcss-selector-parser": "^6.0.16" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-font-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", - "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.1.0.tgz", + "integrity": "sha512-gklfI/n+9rTh8nYaSJXlCo3nOKqMNkxuGpTn/Qm0gstL3ywTr9/WRKznE+oy6fvfolH6dF+QM4nCo8yPLdvGJg==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-gradients": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", - "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.3.tgz", + "integrity": "sha512-4KXAHrYlzF0Rr7uc4VrfwDJ2ajrtNEpNEuLxFgwkhFZ56/7gaE4Nr49nLsQDZyUe+ds+kEhf+YAUolJiYXF8+Q==", "dependencies": { - "colord": "^2.9.1", - "cssnano-utils": "^3.1.0", + "colord": "^2.9.3", + "cssnano-utils": "^4.0.2", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-params": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.4.tgz", - "integrity": "sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.1.0.tgz", + "integrity": "sha512-bmSKnDtyyE8ujHQK0RQJDIKhQ20Jq1LYiez54WiaOoBtcSuflfK3Nm596LvbtlFcpipMjgClQGyGr7GAs+H1uA==", "dependencies": { - "browserslist": "^4.21.4", - "cssnano-utils": "^3.1.0", + "browserslist": "^4.23.0", + "cssnano-utils": "^4.0.2", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-selectors": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", - "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.4.tgz", + "integrity": "sha512-L8dZSwNLgK7pjTto9PzWRoMbnLq5vsZSTu8+j1P/2GB8qdtGQfn+K1uSvFgYvgh83cbyxT5m43ZZhUMTJDSClQ==", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.16" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-modules-extract-imports": { @@ -11417,192 +11389,191 @@ } }, "node_modules/postcss-normalize-charset": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", - "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.2.tgz", + "integrity": "sha512-a8N9czmdnrjPHa3DeFlwqst5eaL5W8jYu3EBbTTkI5FHkfMhFZh1EGbku6jhHhIzTA6tquI2P42NtZ59M/H/kQ==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-display-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", - "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.2.tgz", + "integrity": "sha512-8H04Mxsb82ON/aAkPeq8kcBbAtI5Q2a64X/mnRRfPXBq7XeogoQvReqxEfc0B4WPq1KimjezNC8flUtC3Qz6jg==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-positions": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-5.1.1.tgz", - "integrity": "sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.2.tgz", + "integrity": "sha512-/JFzI441OAB9O7VnLA+RtSNZvQ0NCFZDOtp6QPFo1iIyawyXg0YI3CYM9HBy1WvwCRHnPep/BvI1+dGPKoXx/Q==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-repeat-style": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz", - "integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.2.tgz", + "integrity": "sha512-YdCgsfHkJ2jEXwR4RR3Tm/iOxSfdRt7jplS6XRh9Js9PyCR/aka/FCb6TuHT2U8gQubbm/mPmF6L7FY9d79VwQ==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-string": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", - "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.2.tgz", + "integrity": "sha512-vQZIivlxlfqqMp4L9PZsFE4YUkWniziKjQWUtsxUiVsSSPelQydwS8Wwcuw0+83ZjPWNTl02oxlIvXsmmG+CiQ==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-timing-functions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", - "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.2.tgz", + "integrity": "sha512-a+YrtMox4TBtId/AEwbA03VcJgtyW4dGBizPl7e88cTFULYsprgHWTbfyjSLyHeBcK/Q9JhXkt2ZXiwaVHoMzA==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-unicode": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.1.tgz", - "integrity": "sha512-qnCL5jzkNUmKVhZoENp1mJiGNPcsJCs1aaRmURmeJGES23Z/ajaln+EPTD+rBeNkSryI+2WTdW+lwcVdOikrpA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.1.0.tgz", + "integrity": "sha512-QVC5TQHsVj33otj8/JD869Ndr5Xcc/+fwRh4HAsFsAeygQQXm+0PySrKbr/8tkDKzW+EVT3QkqZMfFrGiossDg==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.23.0", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", - "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.2.tgz", + "integrity": "sha512-kVNcWhCeKAzZ8B4pv/DnrU1wNh458zBNp8dh4y5hhxih5RZQ12QWMuQrDgPRw3LRl8mN9vOVfHl7uhvHYMoXsQ==", "dependencies": { - "normalize-url": "^6.0.1", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-whitespace": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", - "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.2.tgz", + "integrity": "sha512-sXZ2Nj1icbJOKmdjXVT9pnyHQKiSAyuNQHSgRCUgThn2388Y9cGVDR+E9J9iAYbSbLHI+UUwLVl1Wzco/zgv0Q==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-ordered-values": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-5.1.3.tgz", - "integrity": "sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.2.tgz", + "integrity": "sha512-VRZSOB+JU32RsEAQrO94QPkClGPKJEL/Z9PCBImXMhIeK5KAYo6slP/hBYlLgrCjFxyqvn5VC81tycFEDBLG1Q==", "dependencies": { - "cssnano-utils": "^3.1.0", + "cssnano-utils": "^4.0.2", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-idents": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-5.2.0.tgz", - "integrity": "sha512-BTrLjICoSB6gxbc58D5mdBK8OhXRDqud/zodYfdSi52qvDHdMwk+9kB9xsM8yJThH/sZU5A6QVSmMmaN001gIg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-6.0.3.tgz", + "integrity": "sha512-G3yCqZDpsNPoQgbDUy3T0E6hqOQ5xigUtBQyrmq3tn2GxlyiL0yyl7H+T8ulQR6kOcHJ9t7/9H4/R2tv8tJbMA==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-initial": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.2.tgz", - "integrity": "sha512-dE/y2XRaqAi6OvjzD22pjTUQ8eOfc6m/natGHgKFBK9DxFmIm69YmaRVQrGgFlEfc1HePIurY0TmDeROK05rIg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.1.0.tgz", + "integrity": "sha512-RarLgBK/CrL1qZags04oKbVbrrVK2wcxhvta3GCxrZO4zveibqbRPmm2VI8sSgCXwoUHEliRSbOfpR0b/VIoiw==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.23.0", "caniuse-api": "^3.0.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-transforms": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", - "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.2.tgz", + "integrity": "sha512-sB+Ya++3Xj1WaT9+5LOOdirAxP7dJZms3GRcYheSPi1PiTMigsxHAdkrbItHxwYHr4kt1zL7mmcHstgMYT+aiA==", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-selector-parser": { - "version": "6.0.15", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", - "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.0.tgz", + "integrity": "sha512-UMz42UD0UY0EApS0ZL9o1XnLhSTtvvvLe5Dc2H2O56fvRZi+KulDyf5ctDhhtYJBGKStV2FL1fy6253cmLgqVQ==", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -11612,46 +11583,46 @@ } }, "node_modules/postcss-sort-media-queries": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/postcss-sort-media-queries/-/postcss-sort-media-queries-4.4.1.tgz", - "integrity": "sha512-QDESFzDDGKgpiIh4GYXsSy6sek2yAwQx1JASl5AxBtU1Lq2JfKBljIPNdil989NcSKRQX1ToiaKphImtBuhXWw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/postcss-sort-media-queries/-/postcss-sort-media-queries-5.2.0.tgz", + "integrity": "sha512-AZ5fDMLD8SldlAYlvi8NIqo0+Z8xnXU2ia0jxmuhxAU+Lqt9K+AlmLNJ/zWEnE9x+Zx3qL3+1K20ATgNOr3fAA==", "dependencies": { - "sort-css-media-queries": "2.1.0" + "sort-css-media-queries": "2.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.0.0" }, "peerDependencies": { - "postcss": "^8.4.16" + "postcss": "^8.4.23" } }, "node_modules/postcss-svgo": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-5.1.0.tgz", - "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.3.tgz", + "integrity": "sha512-dlrahRmxP22bX6iKEjOM+c8/1p+81asjKT+V5lrgOH944ryx/OHpclnIbGsKVd3uWOXFLYJwCVf0eEkJGvO96g==", "dependencies": { "postcss-value-parser": "^4.2.0", - "svgo": "^2.7.0" + "svgo": "^3.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >= 18" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-unique-selectors": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", - "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.4.tgz", + "integrity": "sha512-K38OCaIrO8+PzpArzkLKB42dSARtC2tmG6PvD4b1o1Q2E9Os8jzfWFfSy/rixsHwohtsDdFtAWGjFVFUdwYaMg==", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.16" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-value-parser": { @@ -11660,14 +11631,14 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "node_modules/postcss-zindex": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-5.1.0.tgz", - "integrity": "sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-6.0.2.tgz", + "integrity": "sha512-5BxW9l1evPB/4ZIc+2GobEBoKC+h8gPGCMi+jxsYvd2x0mjq7wazk6DrP71pStqxE9Foxh5TVnonbWpFZzXaYg==", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/pretty-error": { @@ -12072,9 +12043,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/react-json-view-lite": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/react-json-view-lite/-/react-json-view-lite-1.3.0.tgz", - "integrity": "sha512-aN1biKC5v4DQkmQBlZjuMFR09MKZGMPtIg+cut8zEeg2HXd6gl2gRy0n4HMacHf0dznQgo0SVXN7eT8zV3hEuQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/react-json-view-lite/-/react-json-view-lite-1.4.0.tgz", + "integrity": "sha512-wh6F6uJyYAmQ4fK0e8dSQMEWuvTs2Wr3el3sLD9bambX1+pSWUVXIz1RFaoy3TI1mZ0FqdpKq9YgbgTTgyrmXA==", "engines": { "node": ">=14" }, @@ -12084,12 +12055,11 @@ }, "node_modules/react-loadable": { "name": "@docusaurus/react-loadable", - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz", - "integrity": "sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-6.0.0.tgz", + "integrity": "sha512-YMMxTUQV/QFSnbgrP3tjDzLHRg7vsbMn8e9HAa8o/1iXoiomo48b7sk/kkmWEuWNDPJVlKSJRB6Y2fHqdJk+SQ==", "dependencies": { - "@types/react": "*", - "prop-types": "^15.6.2" + "@types/react": "*" }, "peerDependencies": { "react": "*" @@ -12751,9 +12721,9 @@ } }, "node_modules/search-insights": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.13.0.tgz", - "integrity": "sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.14.0.tgz", + "integrity": "sha512-OLN6MsPMCghDOqlCtsIsYgtsC0pnwVTyT9Mu6A3ewOj1DxvzZF6COrn2g86E/c05xbktB0XN04m/t1Z+n+fTGw==", "peer": true }, "node_modules/section-matter": { @@ -13106,9 +13076,9 @@ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" }, "node_modules/sitemap": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-7.1.1.tgz", - "integrity": "sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-7.1.2.tgz", + "integrity": "sha512-ARCqzHJ0p4gWt+j7NlU5eDlIO9+Rkr/JhPFZKKQ1l5GCus7rJH4UdrlVAh0xC/gDS/Qir2UMxqYNHtsKr2rpCw==", "dependencies": { "@types/node": "^17.0.5", "@types/sax": "^1.2.1", @@ -13147,6 +13117,15 @@ "node": ">=8" } }, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/sockjs": { "version": "0.3.24", "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", @@ -13158,9 +13137,9 @@ } }, "node_modules/sort-css-media-queries": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sort-css-media-queries/-/sort-css-media-queries-2.1.0.tgz", - "integrity": "sha512-IeWvo8NkNiY2vVYdPa27MCQiR0MN0M80johAYFVxWWXQ44KU84WNxjslwBHmc/7ZL2ccwkM7/e6S5aiKZXm7jA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/sort-css-media-queries/-/sort-css-media-queries-2.2.0.tgz", + "integrity": "sha512-0xtkGhWCC9MGt/EzgnvbbbKhqWjl1+/rncmhTh5qCpbYguXh6S/qwePfv/JQ8jePXXmqingylxoC49pCkSPIbA==", "engines": { "node": ">= 6.3.0" } @@ -13174,9 +13153,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "engines": { "node": ">=0.10.0" } @@ -13251,12 +13230,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility" - }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -13392,18 +13365,18 @@ } }, "node_modules/stylehacks": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.1.tgz", - "integrity": "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.1.1.tgz", + "integrity": "sha512-gSTTEQ670cJNoaeIp9KX6lZmm8LJ3jPB5yJmX8Zq/wQxOsAFXV3qjWzHas3YYk1qesuVIyYWWUpZ0vSE/dTSGg==", "dependencies": { - "browserslist": "^4.21.4", - "postcss-selector-parser": "^6.0.4" + "browserslist": "^4.23.0", + "postcss-selector-parser": "^6.0.16" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/supports-color": { @@ -13434,23 +13407,27 @@ "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==" }, "node_modules/svgo": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", + "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", - "css-select": "^4.1.3", - "css-tree": "^1.1.3", - "csso": "^4.2.0", - "picocolors": "^1.0.0", - "stable": "^0.1.8" + "css-select": "^5.1.0", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", + "csso": "^5.0.5", + "picocolors": "^1.0.0" }, "bin": { "svgo": "bin/svgo" }, "engines": { - "node": ">=10.13.0" + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" } }, "node_modules/svgo/node_modules/commander": { @@ -13461,69 +13438,6 @@ "node": ">= 10" } }, - "node_modules/svgo/node_modules/css-select": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.0.1", - "domhandler": "^4.3.1", - "domutils": "^2.8.0", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/svgo/node_modules/dom-serializer": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/svgo/node_modules/domhandler": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/svgo/node_modules/domutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/svgo/node_modules/entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", diff --git a/docs/package.json b/docs/package.json index c23deeea9..a3ae7a2d3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -15,9 +15,9 @@ "write-heading-ids": "docusaurus write-heading-ids" }, "dependencies": { - "@docusaurus/core": "^3.2.1", - "@docusaurus/plugin-client-redirects": "^3.2.1", - "@docusaurus/preset-classic": "^3.2.1", + "@docusaurus/core": "^3.4.0", + "@docusaurus/plugin-client-redirects": "^3.4.0", + "@docusaurus/preset-classic": "^3.4.0", "@mdx-js/react": "^3.0.0", "clsx": "^2.1.0", "docusaurus-json-schema-plugin": "^1.11.0", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 701eaf3bb..4f1d7b967 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.163", + "version": "0.9.165", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.163", + "version": "0.9.165", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index a1b72944f..4c8e46a09 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.9.163", + "version": "0.9.165", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/scripts/install-dependencies.ps1 b/scripts/install-dependencies.ps1 index 956489aa5..710ac3724 100644 --- a/scripts/install-dependencies.ps1 +++ b/scripts/install-dependencies.ps1 @@ -82,4 +82,7 @@ npm run build Pop-Location +Write-Output "`nInstalling docs dependencies..." -ForegroundColor White +Push-Location docs +npm install diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 0da8b69d2..6fe6e1fce 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -4,10 +4,12 @@ # - Run Task -> Install Dependencies # - Debug -> Extension set -e + echo "Installing Core extension dependencies..." pushd core npm install npm link + popd echo "Installing GUI extension dependencies..." @@ -15,11 +17,12 @@ pushd gui npm install npm link @continuedev/core npm run build + popd + # VSCode Extension (will also package GUI) echo "Installing VSCode extension dependencies..." pushd extensions/vscode - # This does way too many things inline but is the common denominator between many of the scripts npm install npm link @continuedev/core @@ -31,4 +34,10 @@ popd echo "Installing binary dependencies..." pushd binary npm install -npm run build \ No newline at end of file +npm run build + +popd + +echo "Installing docs dependencies..." +pushd docs +npm install From 6fdad553b6ac7f64c1bb23617dbe313e16174a56 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 20 Jun 2024 18:35:18 -0500 Subject: [PATCH 010/252] fix(extensions): schema for db ctx provider (#1534) * fix(extensions): schema for db ctx provider * fix: invalid enum --- docs/static/schemas/config.json | 101 ++++++++------- .../src/main/resources/config_schema.json | 101 ++++++++------- extensions/vscode/config_schema.json | 108 ++++++++-------- extensions/vscode/continue_rc_schema.json | 115 ++++++++++-------- 4 files changed, 230 insertions(+), 195 deletions(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index ba9304c8e..6428abfed 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1318,7 +1318,8 @@ "code", "system", "currentFile", - "url" + "url", + "database" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1341,7 +1342,8 @@ "Reference specific functions and classes from throughout your codebase", "Reference your operating system and cpu", "Reference the contents of the currently active file", - "Reference the contents of a page at a URL" + "Reference the contents of a page at a URL", + "Reference table schemas" ], "type": "string" }, @@ -1457,56 +1459,63 @@ } }, "then": { - "connections": { - "type": "array", - "description": "A list of database connections", - "items": { - "type": "object", + "properties": { + "params": { "properties": { - "name": { - "type": "string", - "description": "A unique name for this database connection" - }, - "connection_type": { - "type": "string", - "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] - }, - "connection": { - "type": "object", - "properties": { - "user": { - "type": "string", - "description": "The database user name" + "connections": { + "type": "array", + "description": "A list of database connections", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A unique name for this database connection" + }, + "connection_type": { + "type": "string", + "description": "The type of database (e.g., 'postgres', 'mysql')", + "enum": ["postgres", "mysql", "sqlite"] + }, + "connection": { + "type": "object", + "properties": { + "user": { + "type": "string", + "description": "The database user name" + }, + "host": { + "type": "string", + "description": "The host address of the database server" + }, + "database": { + "type": "string", + "description": "The name of the database to connect to" + }, + "password": { + "type": "string", + "description": "The password for the database user" + }, + "port": { + "type": "integer", + "description": "The port number to connect to at the host" + }, + "filename": { + "type": "string", + "description": "File location for simple file DB's" + } + }, + "required": [] + } }, - "host": { - "type": "string", - "description": "The host address of the database server" - }, - "database": { - "type": "string", - "description": "The name of the database to connect to" - }, - "password": { - "type": "string", - "description": "The password for the database user" - }, - "port": { - "type": "integer", - "description": "The port number to connect to at the host" - }, - "filename": { - "type": "string", - "description": "File location for simple file DB's" - } - }, - "required": [] + "required": ["name", "connection_type", "connection"] + } } }, - "required": ["name", "type", "connection"] + "required": ["connections"] } }, - "required": ["connections"] + "required": ["params"] } }, { diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index ba9304c8e..6428abfed 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1318,7 +1318,8 @@ "code", "system", "currentFile", - "url" + "url", + "database" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1341,7 +1342,8 @@ "Reference specific functions and classes from throughout your codebase", "Reference your operating system and cpu", "Reference the contents of the currently active file", - "Reference the contents of a page at a URL" + "Reference the contents of a page at a URL", + "Reference table schemas" ], "type": "string" }, @@ -1457,56 +1459,63 @@ } }, "then": { - "connections": { - "type": "array", - "description": "A list of database connections", - "items": { - "type": "object", + "properties": { + "params": { "properties": { - "name": { - "type": "string", - "description": "A unique name for this database connection" - }, - "connection_type": { - "type": "string", - "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] - }, - "connection": { - "type": "object", - "properties": { - "user": { - "type": "string", - "description": "The database user name" + "connections": { + "type": "array", + "description": "A list of database connections", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A unique name for this database connection" + }, + "connection_type": { + "type": "string", + "description": "The type of database (e.g., 'postgres', 'mysql')", + "enum": ["postgres", "mysql", "sqlite"] + }, + "connection": { + "type": "object", + "properties": { + "user": { + "type": "string", + "description": "The database user name" + }, + "host": { + "type": "string", + "description": "The host address of the database server" + }, + "database": { + "type": "string", + "description": "The name of the database to connect to" + }, + "password": { + "type": "string", + "description": "The password for the database user" + }, + "port": { + "type": "integer", + "description": "The port number to connect to at the host" + }, + "filename": { + "type": "string", + "description": "File location for simple file DB's" + } + }, + "required": [] + } }, - "host": { - "type": "string", - "description": "The host address of the database server" - }, - "database": { - "type": "string", - "description": "The name of the database to connect to" - }, - "password": { - "type": "string", - "description": "The password for the database user" - }, - "port": { - "type": "integer", - "description": "The port number to connect to at the host" - }, - "filename": { - "type": "string", - "description": "File location for simple file DB's" - } - }, - "required": [] + "required": ["name", "connection_type", "connection"] + } } }, - "required": ["name", "type", "connection"] + "required": ["connections"] } }, - "required": ["connections"] + "required": ["params"] } }, { diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index ba9304c8e..dbb658fa1 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1316,13 +1316,14 @@ "outline", "postgres", "code", - "system", "currentFile", - "url" + "url", + "database" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", "Reference the contents of the terminal", + "Reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread", "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", @@ -1332,16 +1333,14 @@ "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 important highlighted sections from your code", "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", "References Postgres table schema and sample rows", "Reference specific functions and classes from throughout your codebase", - "Reference your operating system and cpu", "Reference the contents of the currently active file", - "Reference the contents of a page at a URL" + "Reference the contents of a page at a URL", + "Reference table schemas" ], "type": "string" }, @@ -1457,56 +1456,63 @@ } }, "then": { - "connections": { - "type": "array", - "description": "A list of database connections", - "items": { - "type": "object", + "properties": { + "params": { "properties": { - "name": { - "type": "string", - "description": "A unique name for this database connection" - }, - "connection_type": { - "type": "string", - "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] - }, - "connection": { - "type": "object", - "properties": { - "user": { - "type": "string", - "description": "The database user name" + "connections": { + "type": "array", + "description": "A list of database connections", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A unique name for this database connection" + }, + "connection_type": { + "type": "string", + "description": "The type of database (e.g., 'postgres', 'mysql')", + "enum": ["postgres", "mysql", "sqlite"] + }, + "connection": { + "type": "object", + "properties": { + "user": { + "type": "string", + "description": "The database user name" + }, + "host": { + "type": "string", + "description": "The host address of the database server" + }, + "database": { + "type": "string", + "description": "The name of the database to connect to" + }, + "password": { + "type": "string", + "description": "The password for the database user" + }, + "port": { + "type": "integer", + "description": "The port number to connect to at the host" + }, + "filename": { + "type": "string", + "description": "File location for simple file DB's" + } + }, + "required": [] + } }, - "host": { - "type": "string", - "description": "The host address of the database server" - }, - "database": { - "type": "string", - "description": "The name of the database to connect to" - }, - "password": { - "type": "string", - "description": "The password for the database user" - }, - "port": { - "type": "integer", - "description": "The port number to connect to at the host" - }, - "filename": { - "type": "string", - "description": "File location for simple file DB's" - } - }, - "required": [] + "required": ["name", "connection_type", "connection"] + } } }, - "required": ["name", "type", "connection"] + "required": ["connections"] } }, - "required": ["connections"] + "required": ["params"] } }, { diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 9b0f6fc9f..23ed8e9c6 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1461,7 +1461,8 @@ "code", "system", "currentFile", - "url" + "url", + "database" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1484,7 +1485,8 @@ "Reference specific functions and classes from throughout your codebase", "Reference your operating system and cpu", "Reference the contents of the currently active file", - "Reference the contents of a page at a URL" + "Reference the contents of a page at a URL", + "Reference table schemas" ], "type": "string" }, @@ -1623,65 +1625,74 @@ } }, "then": { - "connections": { - "type": "array", - "description": "A list of database connections", - "items": { - "type": "object", + "properties": { + "params": { "properties": { - "name": { - "type": "string", - "description": "A unique name for this database connection" - }, - "connection_type": { - "type": "string", - "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": [ - "postgres", - "mysql", - "sqlite" - ] - }, - "connection": { - "type": "object", - "properties": { - "user": { - "type": "string", - "description": "The database user name" + "connections": { + "type": "array", + "description": "A list of database connections", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A unique name for this database connection" + }, + "connection_type": { + "type": "string", + "description": "The type of database (e.g., 'postgres', 'mysql')", + "enum": [ + "postgres", + "mysql", + "sqlite" + ] + }, + "connection": { + "type": "object", + "properties": { + "user": { + "type": "string", + "description": "The database user name" + }, + "host": { + "type": "string", + "description": "The host address of the database server" + }, + "database": { + "type": "string", + "description": "The name of the database to connect to" + }, + "password": { + "type": "string", + "description": "The password for the database user" + }, + "port": { + "type": "integer", + "description": "The port number to connect to at the host" + }, + "filename": { + "type": "string", + "description": "File location for simple file DB's" + } + }, + "required": [] + } }, - "host": { - "type": "string", - "description": "The host address of the database server" - }, - "database": { - "type": "string", - "description": "The name of the database to connect to" - }, - "password": { - "type": "string", - "description": "The password for the database user" - }, - "port": { - "type": "integer", - "description": "The port number to connect to at the host" - }, - "filename": { - "type": "string", - "description": "File location for simple file DB's" - } - }, - "required": [] + "required": [ + "name", + "connection_type", + "connection" + ] + } } }, "required": [ - "name", - "type", - "connection" + "connections" ] } }, "required": [ - "connections" + "params" ] } }, From b402b91e7588ae5ce2d9712a786922355474ba6b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 20 Jun 2024 17:27:06 -0700 Subject: [PATCH 011/252] prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..b497624cc --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +extensions/vscode/continue_rc_schema.json \ No newline at end of file From 2ed4ff67c97c2acb027c891f598074926a98e207 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 20 Jun 2024 19:28:10 -0500 Subject: [PATCH 012/252] docs: add docs and schema for "OS" provider (#1536) --- core/context/providers/OSContextProvider.ts | 13 +- docs/docs/customization/context-providers.md | 8 + extensions/vscode/config_schema.json | 6 +- extensions/vscode/continue_rc_schema.json | 508 +++++-------------- 4 files changed, 139 insertions(+), 396 deletions(-) diff --git a/core/context/providers/OSContextProvider.ts b/core/context/providers/OSContextProvider.ts index 316b6c24d..5f06e5f3d 100644 --- a/core/context/providers/OSContextProvider.ts +++ b/core/context/providers/OSContextProvider.ts @@ -1,6 +1,3 @@ -//os.platform() -//os.arch() - import os from "os"; import { ContextItem, @@ -11,9 +8,9 @@ import { BaseContextProvider } from "../index.js"; class OSContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { - title: "OS", - displayTitle: "OS", - description: "OS and CPU Information.", + title: "os", + displayTitle: "Operating System", + description: "Operating system and CPU Information.", type: "normal", }; @@ -25,9 +22,9 @@ class OSContextProvider extends BaseContextProvider { const platform = os.platform(); return [ { - description: "Your OS and CPU", + description: "Your operating system and CPU", content: `I am running ${platform} on ${cpu}.`, - name: "OS", + name: "os", }, ]; } diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index fcb61b6d1..fae39432f 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -288,6 +288,14 @@ Type `@locals` to reference the contents of the local variables with top n level } ``` +### Operating System + +Type `@os` to reference the architecture and platform of your current operating system. + +```json +{ "name": "os" } +``` + ### 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/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index dbb658fa1..66fdf453e 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1318,7 +1318,8 @@ "code", "currentFile", "url", - "database" + "database", + "os" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1340,7 +1341,8 @@ "Reference specific functions and classes from throughout your codebase", "Reference the contents of the currently active file", "Reference the contents of a page at a URL", - "Reference table schemas" + "Reference table schemas", + "Operating system and CPU Information" ], "type": "string" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 23ed8e9c6..04c1a41aa 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -279,10 +279,7 @@ "apiType": { "title": "Api Type", "markdownDescription": "OpenAI API type, either `openai` or `azure`", - "enum": [ - "openai", - "azure" - ] + "enum": ["openai", "azure"] }, "apiVersion": { "title": "Api Version", @@ -295,11 +292,7 @@ "type": "string" } }, - "required": [ - "title", - "provider", - "model" - ], + "required": ["title", "provider", "model"], "allOf": [ { "if": { @@ -309,9 +302,7 @@ } }, "not": { - "required": [ - "provider" - ] + "required": ["provider"] } }, "then": { @@ -338,48 +329,33 @@ ] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "apiKey" - ] + "required": ["apiKey"] } }, { "if": { "properties": { "provider": { - "enum": [ - "huggingface-tgi", - "huggingface-inference-api" - ] + "enum": ["huggingface-tgi", "huggingface-inference-api"] } } }, "then": { - "required": [ - "apiBase" - ] + "required": ["apiBase"] }, - "required": [ - "provider" - ] + "required": ["provider"] }, { "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -399,14 +375,10 @@ "if": { "properties": { "provider": { - "enum": [ - "cloudflare" - ] + "enum": ["cloudflare"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -464,14 +436,10 @@ "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -502,14 +470,10 @@ "if": { "properties": { "provider": { - "enum": [ - "replicate" - ] + "enum": ["replicate"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -539,14 +503,10 @@ "if": { "properties": { "provider": { - "enum": [ - "free-trial" - ] + "enum": ["free-trial"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -571,9 +531,7 @@ "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] }, "apiType": { "not": { @@ -581,9 +539,7 @@ } } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -641,14 +597,10 @@ "if": { "properties": { "provider": { - "enum": [ - "anthropic" - ] + "enum": ["anthropic"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -676,22 +628,15 @@ "if": { "properties": { "provider": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { "model": { - "enum": [ - "command-r", - "command-r-plus" - ] + "enum": ["command-r", "command-r-plus"] } } } @@ -700,14 +645,10 @@ "if": { "properties": { "provider": { - "enum": [ - "bedrock" - ] + "enum": ["bedrock"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -732,14 +673,10 @@ "if": { "properties": { "provider": { - "enum": [ - "gemini" - ] + "enum": ["gemini"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -760,14 +697,10 @@ "if": { "properties": { "provider": { - "enum": [ - "together" - ] + "enum": ["together"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -801,14 +734,10 @@ "if": { "properties": { "provider": { - "enum": [ - "deepinfra" - ] + "enum": ["deepinfra"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -831,9 +760,7 @@ ] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -879,14 +806,10 @@ "if": { "properties": { "provider": { - "enum": [ - "ollama" - ] + "enum": ["ollama"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -934,14 +857,10 @@ "if": { "properties": { "provider": { - "enum": [ - "mistral" - ] + "enum": ["mistral"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -962,22 +881,15 @@ "if": { "properties": { "provider": { - "enum": [ - "deepseek" - ] + "enum": ["deepseek"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { "model": { - "enum": [ - "deepseek-chat", - "deepseek-coder" - ] + "enum": ["deepseek-chat", "deepseek-coder"] } } } @@ -986,14 +898,10 @@ "if": { "properties": { "provider": { - "enum": [ - "groq" - ] + "enum": ["groq"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1014,21 +922,15 @@ "if": { "properties": { "provider": { - "enum": [ - "fireworks" - ] + "enum": ["fireworks"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { "model": { - "enum": [ - "starcoder-7b" - ] + "enum": ["starcoder-7b"] } } } @@ -1040,30 +942,20 @@ "const": "azure" } }, - "required": [ - "apiType" - ] + "required": ["apiType"] }, "then": { - "required": [ - "engine", - "apiVersion", - "apiBase" - ] + "required": ["engine", "apiVersion", "apiBase"] } }, { "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1080,9 +972,7 @@ "const": "llamafile" } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1096,14 +986,10 @@ "if": { "properties": { "provider": { - "enum": [ - "text-gen-webui" - ] + "enum": ["text-gen-webui"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1117,14 +1003,10 @@ "if": { "properties": { "provider": { - "enum": [ - "flowise" - ] + "enum": ["flowise"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1151,10 +1033,7 @@ "type": "string" } }, - "required": [ - "key", - "value" - ] + "required": ["key", "value"] } }, "additionalFlowiseConfiguration": { @@ -1173,10 +1052,7 @@ "description": "Configuration Property value" } }, - "required": [ - "key", - "value" - ] + "required": ["key", "value"] } }, "model": { @@ -1268,9 +1144,7 @@ "type": "string" } }, - "required": [ - "default" - ] + "required": ["default"] }, "SlashCommand": { "title": "SlashCommand", @@ -1329,9 +1203,7 @@ "if": { "properties": { "name": { - "enum": [ - "issue" - ] + "enum": ["issue"] } } }, @@ -1344,23 +1216,17 @@ "description": "Enter the URL of the GitHub repository for which you want to generate the issue." } }, - "required": [ - "repositoryUrl" - ] + "required": ["repositoryUrl"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "edit" - ] + "enum": ["edit"] } } }, @@ -1385,9 +1251,7 @@ "if": { "properties": { "name": { - "enum": [ - "share" - ] + "enum": ["share"] } } }, @@ -1405,10 +1269,7 @@ } } ], - "required": [ - "name", - "description" - ] + "required": ["name", "description"] }, "CustomCommand": { "title": "CustomCommand", @@ -1427,11 +1288,7 @@ "type": "string" } }, - "required": [ - "name", - "prompt", - "description" - ] + "required": ["name", "prompt", "description"] }, "ContextProviderWithParams": { "title": "ContextProviderWithParams", @@ -1459,14 +1316,15 @@ "outline", "postgres", "code", - "system", "currentFile", "url", - "database" + "database", + "os" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", "Reference the contents of the terminal", + "Reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread", "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", @@ -1476,17 +1334,15 @@ "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 important highlighted sections from your code", "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", "References Postgres table schema and sample rows", "Reference specific functions and classes from throughout your codebase", - "Reference your operating system and cpu", "Reference the contents of the currently active file", "Reference the contents of a page at a URL", - "Reference table schemas" + "Reference table schemas", + "Operating system and CPU Information" ], "type": "string" }, @@ -1506,9 +1362,7 @@ "if": { "properties": { "name": { - "enum": [ - "google" - ] + "enum": ["google"] } } }, @@ -1521,23 +1375,17 @@ "description": "Your API key for https://serper.dev in order to get Google search results" } }, - "required": [ - "serperApiKey" - ] + "required": ["serperApiKey"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "open" - ] + "enum": ["open"] } } }, @@ -1559,9 +1407,7 @@ "if": { "properties": { "name": { - "enum": [ - "issue" - ] + "enum": ["issue"] } } }, @@ -1590,37 +1436,24 @@ "type": { "type": "string", "description": "The type of issues to search for", - "enum": [ - "open", - "closed", - "all" - ] + "enum": ["open", "closed", "all"] } }, - "required": [ - "owner", - "repo" - ] + "required": ["owner", "repo"] } } }, - "required": [ - "repos" - ] + "required": ["repos"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "database" - ] + "enum": ["database"] } } }, @@ -1641,11 +1474,7 @@ "connection_type": { "type": "string", "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": [ - "postgres", - "mysql", - "sqlite" - ] + "enum": ["postgres", "mysql", "sqlite"] }, "connection": { "type": "object", @@ -1678,31 +1507,21 @@ "required": [] } }, - "required": [ - "name", - "connection_type", - "connection" - ] + "required": ["name", "connection_type", "connection"] } } }, - "required": [ - "connections" - ] + "required": ["connections"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "gitlab-mr" - ] + "enum": ["gitlab-mr"] } } }, @@ -1723,23 +1542,17 @@ "description": "If you have code selected, filters out comments that aren't related to the selection." } }, - "required": [ - "token" - ] + "required": ["token"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "jira" - ] + "enum": ["jira"] } } }, @@ -1785,24 +1598,17 @@ ] } }, - "required": [ - "domain", - "token" - ] + "required": ["domain", "token"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "http" - ] + "enum": ["http"] } } }, @@ -1815,24 +1621,17 @@ "description": "The HTTP endpoint of your context provider server." } }, - "required": [ - "url" - ] + "required": ["url"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "codebase", - "folder" - ] + "enum": ["codebase", "folder"] } } }, @@ -1867,9 +1666,7 @@ "if": { "properties": { "name": { - "enum": [ - "postgres" - ] + "enum": ["postgres"] } } }, @@ -1921,19 +1718,11 @@ } } }, - "required": [ - "host", - "port", - "user", - "password", - "database" - ] + "required": ["host", "port", "user", "password", "database"] } } ], - "required": [ - "name" - ] + "required": ["name"] }, "SerializedContinueConfig": { "title": "config.json", @@ -2085,46 +1874,32 @@ "$ref": "#/definitions/RequestOptions" } }, - "required": [ - "provider" - ], + "required": ["provider"], "allOf": [ { "if": { "properties": { "provider": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "apiKey" - ] + "required": ["apiKey"] } }, { "if": { "properties": { "provider": { - "enum": [ - "gemini" - ] + "enum": ["gemini"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } ] @@ -2135,33 +1910,22 @@ "type": "object", "properties": { "name": { - "enum": [ - "cohere", - "voyage", - "llm", - "free-trial" - ] + "enum": ["cohere", "voyage", "llm", "free-trial"] }, "params": { "type": "object" } }, - "required": [ - "name" - ], + "required": ["name"], "allOf": [ { "if": { "properties": { "name": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2183,9 +1947,7 @@ "type": "string" } }, - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } } @@ -2194,14 +1956,10 @@ "if": { "properties": { "name": { - "enum": [ - "llm" - ] + "enum": ["llm"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2212,9 +1970,7 @@ "type": "string" } }, - "required": [ - "modelTitle" - ] + "required": ["modelTitle"] } } } @@ -2223,14 +1979,10 @@ "if": { "properties": { "name": { - "enum": [ - "voyage" - ] + "enum": ["voyage"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2241,14 +1993,10 @@ "type": "string" }, "model": { - "enum": [ - "rerank-lite-1" - ] + "enum": ["rerank-lite-1"] } }, - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } } @@ -2314,11 +2062,7 @@ "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." }, "multilineCompletions": { - "enum": [ - "always", - "never", - "auto" - ], + "enum": ["always", "never", "auto"], "description": "If set to true, Continue will only complete a single line at a time." }, "useCache": { @@ -2347,10 +2091,7 @@ "type": "object", "properties": { "codeBlockToolbarPosition": { - "enum": [ - "top", - "bottom" - ], + "enum": ["top", "bottom"], "default": "top", "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." }, @@ -2367,9 +2108,7 @@ "defaultContext": { "type": "array", "items": { - "enum": [ - "activeFile" - ] + "enum": ["activeFile"] } }, "modelRoles": { @@ -2412,10 +2151,7 @@ }, "mergeBehavior": { "type": "string", - "enum": [ - "merge", - "overwrite" - ], + "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." @@ -2423,4 +2159,4 @@ } } } -} \ No newline at end of file +} From 20bf1bd670389de83ecb7186b8f15e20f746981a Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:08:25 -0700 Subject: [PATCH 013/252] tests (#1501) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 👷 CI for jetbrains * default working dir * changelog * build binaries * binary testing setup * idesettings * core binary testing * run binary tests in ci * remove unused targets * needs build * console.log bin contents * fix ci * fix win32 binary download * test * no linux arm64 * macos latest * macos-12 * binary permissions * upload logs * fix * upload full folder as binary artifact * test * test macos only * set full execute permissions * copy sqlite binary * cd * it worked! * build again in test job * debug * remove timeout * info * log * log2 * more logs * catch * fewer logs * test all platforms * test downloaded artifact * needs build * updates * build * false * release * add tag and upload binaryes * change tag name * proper artifact upload * jest updates * ✅ generate a few unit tests with Continue * fix imports related to IdeSettings * run tsc on PRs * remove shareSession command (unused) * update release process * update plugin version * don't show ghost text when jetbrains completion visible * run jetbrains ci in main --- .github/workflows/jetbrains-build.yaml | 448 +++ .github/workflows/jetbrains-release.yaml | 142 + .github/workflows/preview.yaml | 6 + .github/workflows/ts-check.yaml | 89 + .prompts/test.prompt | 19 + .vscode/launch.json | 3 +- binary/jest.config.js | 23 + binary/package-lock.json | 3494 ++++++++++++++++- binary/package.json | 5 +- binary/src/IpcMessenger.ts | 233 +- binary/src/TcpMessenger.ts | 5 + binary/src/index.ts | 1 + binary/test/binary.test.ts | 136 + binary/tsconfig.json | 5 +- core/autocomplete/lineStream.ts | 2 + core/autocomplete/templates.ts | 11 +- core/config/handler.ts | 5 +- core/config/load.ts | 3 +- core/core.ts | 1 + core/index.d.ts | 7 + core/jest.config.js | 23 +- core/llm/index.ts | 23 +- core/llm/llms/Ollama.ts | 21 +- core/llm/llms/index.ts | 2 +- core/package-lock.json | 2 +- core/package.json | 4 +- core/protocol/core.ts | 2 +- core/protocol/ide.ts | 2 +- core/protocol/ideWebview.ts | 6 - core/test/diff.test.ts | 2 +- core/test/llm.test.ts | 13 +- .../util/dedentAndGetCommonWhitespace.test.ts | 76 + core/test/util/getLastNPathParts.test.ts | 51 + core/test/util/lcs.test.ts | 40 + core/test/util/merge.test.ts | 100 + .../test/util/ranges/getRangeInString.test.ts | 105 + core/test/util/ranges/intersection.test.ts | 123 + core/test/util/ranges/maxMinPosition.test.ts | 70 + core/test/util/ranges/union.test.ts | 92 + core/util/devdataSqlite.ts | 4 +- core/util/fetchWithOptions.ts | 4 +- core/util/filesystem.ts | 22 +- core/util/index.ts | 26 +- core/util/messageIde.ts | 4 + core/util/paths.ts | 6 +- core/util/reverseMessageIde.ts | 191 + extensions/intellij/build.gradle.kts | 2 +- extensions/intellij/gradle.properties | 2 +- .../AutocompleteEditorListener.kt | 2 +- .../AutocompleteLookupListener.kt | 48 + .../autocomplete/AutocompleteService.kt | 18 + .../src/main/resources/META-INF/plugin.xml | 3 + extensions/vscode/package-lock.json | 2 +- extensions/vscode/package.json | 6 - extensions/vscode/src/commands.ts | 3 - .../vscode/src/extension/vscodeExtension.ts | 2 +- extensions/vscode/src/ideProtocol.ts | 8 +- gui/package-lock.json | 2 +- 58 files changed, 5568 insertions(+), 182 deletions(-) create mode 100644 .github/workflows/jetbrains-build.yaml create mode 100644 .github/workflows/jetbrains-release.yaml create mode 100644 .github/workflows/ts-check.yaml create mode 100644 .prompts/test.prompt create mode 100644 binary/jest.config.js create mode 100644 binary/test/binary.test.ts create mode 100644 core/test/util/dedentAndGetCommonWhitespace.test.ts create mode 100644 core/test/util/getLastNPathParts.test.ts create mode 100644 core/test/util/lcs.test.ts create mode 100644 core/test/util/merge.test.ts create mode 100644 core/test/util/ranges/getRangeInString.test.ts create mode 100644 core/test/util/ranges/intersection.test.ts create mode 100644 core/test/util/ranges/maxMinPosition.test.ts create mode 100644 core/test/util/ranges/union.test.ts create mode 100644 core/util/reverseMessageIde.ts create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteLookupListener.kt diff --git a/.github/workflows/jetbrains-build.yaml b/.github/workflows/jetbrains-build.yaml new file mode 100644 index 000000000..570196005 --- /dev/null +++ b/.github/workflows/jetbrains-build.yaml @@ -0,0 +1,448 @@ +# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: +# - Validate Gradle Wrapper. +# - Run 'test' and 'verifyPlugin' tasks. +# - Run Qodana inspections. +# - Run the 'buildPlugin' task and prepare artifact for further tests. +# - Run the 'runPluginVerifier' task. +# - Create a draft release. +# +# The workflow is triggered on push and pull_request events. +# +# GitHub Actions reference: https://help.github.com/en/actions +# +## JBIJPPTPL + +name: Build +on: + # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests) + push: + branches: [preview, main] + # Trigger the workflow on any pull request + # pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +defaults: + run: + working-directory: ./extensions/intellij + +jobs: + # Prepare environment and build the plugin + build: + name: Build + runs-on: ubuntu-latest + outputs: + version: ${{ steps.properties.outputs.version }} + changelog: ${{ steps.properties.outputs.changelog }} + pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Validate wrapper + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + CHANGELOG="" + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT + + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + + # Setup Node.js + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + # Cache node_modules + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + # npm install core + - name: Install core node_modules + run: | + cd ../../core + npm ci + + # npm install binary + - name: Install core node_modules + run: | + cd ../../binary + npm ci + + # Build binaries + - name: Install core node_modules + run: | + cd ../../binary + npm run build + + # Build plugin + - name: Build plugin + run: ./gradlew buildPlugin + + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + shell: bash + run: | + cd ${{ github.workspace }}/extensions/intellij/build/distributions + FILENAME=`ls *.zip` + unzip "$FILENAME" -d content + + echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT + + # Store already-built plugin as an artifact for downloading + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./extensions/intellij/build/distributions/content/*/* + + # Upload binaries as artifacts + - name: Upload artifact (darwin-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-arm64 + path: ./binary/bin/darwin-arm64/ + + - name: Upload artifact (darwin-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-x64 + path: ./binary/bin/darwin-x64/ + + - name: Upload artifact (win32-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-win32-x64 + path: ./binary/bin/win32-x64/ + + - name: Upload artifact (linux-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-arm64 + path: ./binary/bin/linux-arm64/ + + - name: Upload artifact (linux-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-x64 + path: ./binary/bin/linux-x64/ + + test-binaries: + needs: build + strategy: + matrix: + include: + - os: windows-latest + platform: win32 + arch: x64 + npm_config_arch: x64 + - os: ubuntu-latest + platform: linux + arch: x64 + npm_config_arch: x64 + # arm64 not actually supported by GitHub + # - os: ubuntu-latest + # platform: linux + # arch: arm64 + # npm_config_arch: arm64 + - os: macos-12 + platform: darwin + arch: x64 + npm_config_arch: x64 + - os: macos-latest + platform: darwin + arch: arm64 + npm_config_arch: arm64 + runs-on: ${{ matrix.os }} + steps: + # 1. Check-out repository + - name: Check-out repository + uses: actions/checkout@v4 + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + - name: Install Core Dependencies + run: | + cd ../../core + npm ci + + - name: Install Binary Dependencies + run: | + cd ../../binary + npm ci + + # Download the binary artifact + - name: Download binary artifact + uses: actions/download-artifact@v4 + with: + name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} + path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ + + # Set execute permissions for the binary (non-Windows) + - name: Set execute permissions + run: | + cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} + chmod +x continue-binary + chmod +x node_sqlite3.node + chmod +x index.node + chmod +x esbuild + if: ${{ matrix.platform }} != 'win32' + + - name: Copy node_sqlite3.node to necessary location + run: | + cd ../../binary + mkdir build + cp ./bin/${{ matrix.platform }}-${{ matrix.arch }}/node_sqlite3.node ./build/node_sqlite3.node + + # Run tests for binary + - name: Run binary tests + run: | + cd ../../binary + npm run test + + - name: Upload logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} + path: binary/.continue/logs/core.log + + # Run tests and upload a code coverage report + test: + name: Test + needs: [build] + runs-on: ubuntu-latest + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Run tests + - name: Run Tests + run: ./gradlew check + + # Collect Tests Result of failed tests + - name: Collect Tests Result + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: tests-result + path: ${{ github.workspace }}/extensions/intellij/build/reports/tests + + # Upload the Kover report to CodeCov + # - name: Upload Code Coverage Report + # uses: codecov/codecov-action@v4 + # with: + # files: ${{ github.workspace }}/build/reports/kover/report.xml + + # Run Qodana inspections and provide report + inspectCode: + if: false + name: Inspect code + needs: [build] + runs-on: ubuntu-latest + permissions: + contents: write + checks: write + pull-requests: write + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Run Qodana inspections + - name: Qodana - Code Inspection + uses: JetBrains/qodana-action@v2024.1.5 + with: + cache-default-branch-only: true + + # Run plugin structure verification along with IntelliJ Plugin Verifier + verify: + name: Verify plugin + needs: [build] + runs-on: ubuntu-latest + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v4 + with: + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides + key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} + + # Run Verify Plugin task and IntelliJ Plugin Verifier tool + - name: Run Plugin Verification tasks + run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + + # Collect Plugin Verifier Result + - name: Collect Plugin Verifier Result + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: pluginVerifier-result + path: ${{ github.workspace }}/build/reports/pluginVerifier + + # Prepare a draft release for GitHub Releases page for the manual verification + # If accepted and published, release workflow would be triggered + releaseDraft: + name: Release draft + if: github.event_name != 'pull_request' + needs: [build, test, test-binaries, verify] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + - name: Set up Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Tag the repository + id: tag + run: | + # See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names + TAG=v${{ needs.build.outputs.version }}-jetbrains + echo "$TAG" + echo "tag=$TAG" >> $GITHUB_OUTPUT + git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA} + git push origin $TAG + + # Remove old release drafts by using the curl request for the available releases with a draft flag + - name: Remove Old Release Drafts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api repos/{owner}/{repo}/releases \ + --jq '.[] | select(.draft == true) | .id' \ + | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} + + # Create a new release draft which is not publicly visible and requires manual acceptance + - name: Create Release Draft + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ steps.tag.outputs.tag }}" \ + --draft \ + --title "v${{ needs.build.outputs.version }}-jetbrains" \ + --notes "$(cat << 'EOM' + ${{ needs.build.outputs.changelog }} + EOM + )" + + # Download the Gradle build artifact + - name: Download Gradle build artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.filename }} + path: ./artifacts diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml new file mode 100644 index 000000000..8b4fec404 --- /dev/null +++ b/.github/workflows/jetbrains-release.yaml @@ -0,0 +1,142 @@ +# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow. +# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. +# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. + +name: Release +on: + release: + types: [prereleased, released] + +defaults: + run: + working-directory: ./extensions/intellij + +jobs: + # Prepare and publish the plugin to JetBrains Marketplace repository + release: + name: Publish Plugin + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' + ${{ github.event.release.body }} + EOM + )" + + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Setup Node.js + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + # Cache node_modules + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + # npm install core + - name: Install core node_modules + run: | + cd ../../core + npm ci + + # npm install binary + - name: Install core node_modules + run: | + cd ../../binary + npm ci + + # Build binaries + - name: Install core node_modules + run: | + cd ../../binary + npm run build + + # Update Unreleased section with the current release note + - name: Patch Changelog + if: ${{ steps.properties.outputs.changelog != '' }} + env: + CHANGELOG: ${{ steps.properties.outputs.changelog }} + run: | + ./gradlew patchChangelog --release-note="$CHANGELOG" + + # Publish the plugin to JetBrains Marketplace + - name: Publish Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + run: ./gradlew publishPlugin + + # Upload artifact as a release asset + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + + # Create a pull request + - name: Create Pull Request + if: ${{ steps.properties.outputs.changelog != '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ github.event.release.tag_name }}" + BRANCH="changelog-update-$VERSION" + LABEL="release changelog" + + git config user.email "action@github.com" + git config user.name "GitHub Action" + + git checkout -b $BRANCH + git commit -am "Changelog update - $VERSION" + git push --set-upstream origin $BRANCH + + gh label create "$LABEL" \ + --description "Pull requests with release changelog update" \ + --force \ + || true + + gh pr create \ + --title "Changelog update - \`$VERSION\`" \ + --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ + --label "$LABEL" \ + --head $BRANCH diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index cfbc9b8bf..95e426f6f 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -90,6 +90,12 @@ jobs: cd core npm ci + # 2.25 Run core tests + - name: Run core tests + run: | + cd core + npm run test + # 2.5. Pre package - name: Set var for environment info shell: pwsh diff --git a/.github/workflows/ts-check.yaml b/.github/workflows/ts-check.yaml new file mode 100644 index 000000000..f0baf029d --- /dev/null +++ b/.github/workflows/ts-check.yaml @@ -0,0 +1,89 @@ +name: TypeScript Check + +on: + pull_request: + branches: + - main + - preview + +jobs: + tsc-check: + runs-on: ubuntu-latest + + steps: + # 1. Check-out repository + - name: Check-out repository + uses: actions/checkout@v4 + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache extension node_modules + uses: actions/cache@v3 + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache gui node_modules + uses: actions/cache@v3 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + - name: Install extension Dependencies + run: | + cd extensions/vscode + npm ci + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Install gui Dependencies + run: | + cd gui + npm ci + + - name: Install Core Dependencies + run: | + cd core + npm ci + + - name: Install Binary Dependencies + run: | + cd binary + npm ci + + - name: tsc core + run: | + cd core + npx tsc + + - name: tsc extensions/vscode + run: | + cd extensions/vscode + npx tsc + + - name: tsc binary + run: | + cd binary + npx tsc + + - name: tsc gui + run: | + cd gui + npx tsc diff --git a/.prompts/test.prompt b/.prompts/test.prompt new file mode 100644 index 000000000..e2f5d8662 --- /dev/null +++ b/.prompts/test.prompt @@ -0,0 +1,19 @@ +temperature: 0.5 +maxTokens: 4096 +name: jest +description: Write Jest unit tests +--- + +You are an expert programmer + + +{{{ input }}} + +Write unit tests for the above selected code, following each of these instructions: +- Use `jest` +- Properly set up and tear down +- Include important edge cases +- The tests should be complete and sophisticated +- Give the tests just as chat output, don't edit any file +- Don't explain how to set up `jest` +- Write a single code block, making sure to label with the language being used (e.g. "```typscript") \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index f11b70528..c9085a951 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,8 @@ "internalConsoleOptions": "openOnSessionStart", "cwd": "${workspaceFolder}/binary", "env": { - "CONTINUE_DEVELOPMENT": "true" + "CONTINUE_DEVELOPMENT": "true", + "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/binary/.continue" } }, { diff --git a/binary/jest.config.js b/binary/jest.config.js new file mode 100644 index 000000000..e5d833a48 --- /dev/null +++ b/binary/jest.config.js @@ -0,0 +1,23 @@ +module.exports = { + roots: ["/test"], + transform: { + "^.+\\.ts?$": [ + "ts-jest", + { + useESM: true, + }, + ], + "^.+\\.js$": [ + "babel-jest", + { + presets: [["@babel/preset-env", { targets: { node: "current" } }]], + }, + ], + }, + moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", ".d.ts"], + extensionsToTreatAsEsm: [".ts", ".d.ts"], + // Remove or comment out the moduleNameMapper configuration + moduleNameMapper: { + "^(.*)\\.js$": "$1", + }, +}; diff --git a/binary/package-lock.json b/binary/package-lock.json index 00a81d0a9..4ed57c259 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -28,11 +28,14 @@ "devDependencies": { "@biomejs/biome": "1.6.4", "@types/follow-redirects": "^1.14.4", + "@types/jest": "^29.5.12", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", "esbuild": "0.19.11", + "jest": "^29.7.0", "pkg": "^5.8.1", "rimraf": "^5.0.7", + "ts-jest": "^29.1.4", "typescript": "^5.3.3" } }, @@ -133,6 +136,19 @@ "node": ">=12.17" } }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@apache-arrow/ts": { "version": "14.0.2", "resolved": "https://registry.npmjs.org/@apache-arrow/ts/-/ts-14.0.2.tgz", @@ -151,6 +167,108 @@ "tslib": "^2.5.3" } }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.7.tgz", + "integrity": "sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.7.tgz", + "integrity": "sha512-nykK+LEK86ahTkX/3TgauT0ikKoNCfKHEaZYTUVupJdTLzGNvrblu4u6fa7DhZONAltdf8e662t/abY8idrd/g==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.7", + "@babel/helper-compilation-targets": "^7.24.7", + "@babel/helper-module-transforms": "^7.24.7", + "@babel/helpers": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/template": "^7.24.7", + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/@babel/generator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz", + "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core/node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/core/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/generator": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", @@ -165,24 +283,367 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.7.tgz", + "integrity": "sha512-ctSdRHBi20qWOfy27RUb4Fhp07KSJ3sXcuSvTrXrc4aG8NSYDo1ici3Vhg9bg69y5bj0Mr1lh0aeEgTvc12rMg==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.24.7", + "@babel/helper-validator-option": "^7.24.7", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", + "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", + "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", + "dev": true, + "dependencies": { + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", + "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.7.tgz", + "integrity": "sha512-1fuJEwIrp+97rM4RWdO+qrRsZlAeL1lQJoPqtCYWv0NL115XM93hIH4CSRln2w52SqvmY5hqdtauB6QFCDiZNQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz", + "integrity": "sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", + "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", - "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", + "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", - "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/helper-validator-option": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz", + "integrity": "sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.7.tgz", + "integrity": "sha512-NlmJJtvcw72yRJRcnCmGvSi+3jDEg8qFu3z0AFoymmzLx5ERVWyzd9kVXr7Th9/8yIJi2Zc6av4Tqz3wFs8QWg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/parser": { "version": "7.18.4", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", @@ -195,6 +656,285 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", + "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", + "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template/node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz", + "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.7", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-hoist-variables": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/generator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz", + "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/types": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", @@ -209,6 +949,12 @@ "node": ">=6.9.0" } }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, "node_modules/@biomejs/biome": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.6.4.tgz", @@ -749,6 +1495,394 @@ "node": ">=12" } }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/core/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/reporters/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/reporters/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@jest/reporters/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@jest/reporters/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@jest/reporters/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -1050,6 +2184,111 @@ "node": ">=14" } }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__core/node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@types/babel__core/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/babel__traverse/node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@types/command-line-args": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", @@ -1071,6 +2310,49 @@ "@types/node": "*" } }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.12", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", + "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, "node_modules/@types/node": { "version": "20.3.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz", @@ -1082,12 +2364,33 @@ "integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA==", "peer": true }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true + }, "node_modules/@types/uuid": { "version": "9.0.8", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", "dev": true }, + "node_modules/@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true + }, "node_modules/@vercel/ncc": { "version": "0.38.1", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", @@ -1109,6 +2412,21 @@ "node": ">= 6.0.0" } }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -1135,6 +2453,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/apache-arrow": { "version": "14.0.2", "resolved": "https://registry.npmjs.org/apache-arrow/-/apache-arrow-14.0.2.tgz", @@ -1156,6 +2487,15 @@ "arrow2csv": "bin/arrow2csv.js" } }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, "node_modules/array-back": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", @@ -1198,6 +2538,122 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1284,6 +2740,59 @@ "node": ">=8" } }, + "node_modules/browserslist": { + "version": "4.23.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", + "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001629", + "electron-to-chromium": "^1.4.796", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.16" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -1308,6 +2817,50 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001634", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001634.tgz", + "integrity": "sha512-fbBYXQ9q3+yp1q1gBk86tOFs4pyn/yxFm5ZNP18OXJDfA3txImOY9PhfxVggZ4vRHDqoU8NrKU81eN0OtzOgRA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1338,12 +2891,42 @@ "url": "https://github.com/chalk/chalk-template?sponsor=1" } }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz", + "integrity": "sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q==", + "dev": true + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -1413,6 +2996,22 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1496,6 +3095,18 @@ "node": ">=18" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "node_modules/core": { "resolved": "../core", "link": true @@ -1506,6 +3117,27 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1560,6 +3192,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -1569,6 +3215,15 @@ "node": ">=4.0.0" } }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -1591,6 +3246,24 @@ "node": ">=8" } }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -1609,6 +3282,24 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, + "node_modules/electron-to-chromium": { + "version": "1.4.803", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.803.tgz", + "integrity": "sha512-61H9mLzGOCLLVsnLiRzCbc63uldP0AniRYPV3hbGVtONA1pI7qSGILdbofR7A8TMbOypDocEAjH/e+9k1QIe3g==", + "dev": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -1624,6 +3315,15 @@ "once": "^1.4.0" } }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/esbuild": { "version": "0.19.11", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", @@ -1671,6 +3371,66 @@ "node": ">=6" } }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/expand-template": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", @@ -1680,6 +3440,22 @@ "node": ">=6" } }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -1696,6 +3472,12 @@ "node": ">=8.6.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", @@ -1705,6 +3487,15 @@ "reusify": "^1.0.4" } }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -1757,6 +3548,19 @@ "node": ">=4.0.0" } }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/flatbuffers": { "version": "23.5.26", "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-23.5.26.tgz", @@ -1853,6 +3657,26 @@ "node": ">=10" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -1862,6 +3686,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1871,6 +3704,27 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -1911,6 +3765,15 @@ "node": ">= 6" } }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -1966,6 +3829,12 @@ "node": ">= 0.4" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -1979,6 +3848,15 @@ "node": ">= 6" } }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -2008,6 +3886,45 @@ "node": ">= 4" } }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2036,6 +3953,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, "node_modules/is-core-module": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", @@ -2071,6 +3994,15 @@ "node": ">=8" } }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -2092,6 +4024,18 @@ "node": ">=0.12.0" } }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2104,6 +4048,99 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz", + "integrity": "sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jackspeak": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", @@ -2122,6 +4159,777 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-cli/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-cli/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/jest-cli/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/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==", + "dev": true, + "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/jest-cli/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-cli/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==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-config/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/jest-config/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jest-config/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jest-config/node_modules/strip-json-comments": { + "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==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/jest-runtime/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jest-runtime/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/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==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -2143,6 +4951,24 @@ "node": ">=0.8" } }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -2155,6 +4981,42 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/lodash.assignwith": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz", @@ -2167,6 +5029,12 @@ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "peer": true }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, "node_modules/lru-cache": { "version": "10.2.2", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", @@ -2209,6 +5077,27 @@ "node": ">=4" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2250,6 +5139,15 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", @@ -2351,6 +5249,12 @@ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", "dev": true }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/ncp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", @@ -2420,6 +5324,39 @@ "node": ">= 6.13.0" } }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2428,6 +5365,21 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-is-promise": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", @@ -2437,6 +5389,57 @@ "node": ">=8" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/pad-left": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz", @@ -2449,6 +5452,42 @@ "node": ">=0.10.0" } }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -2489,6 +5528,12 @@ "node": ">=8" } }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -2509,6 +5554,15 @@ "node": ">=4" } }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/pkg": { "version": "5.8.1", "resolved": "https://registry.npmjs.org/pkg/-/pkg-5.8.1.tgz", @@ -2542,6 +5596,18 @@ } } }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/pkg-fetch": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/pkg-fetch/-/pkg-fetch-3.4.2.tgz", @@ -2619,6 +5685,32 @@ "node": ">=10" } }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -2634,6 +5726,19 @@ "node": ">=0.4.0" } }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -2649,6 +5754,22 @@ "once": "^1.3.1" } }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -2684,6 +5805,12 @@ "rc": "cli.js" } }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -2734,6 +5861,36 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/resolve/node_modules/is-core-module": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", @@ -2898,6 +6055,12 @@ "simple-concat": "^1.0.0" } }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -2907,6 +6070,25 @@ "node": ">=8" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -2918,6 +6100,24 @@ "node": "*" } }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/stream-meter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz", @@ -2945,6 +6145,40 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-length/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -3041,6 +6275,24 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -3163,11 +6415,74 @@ "node": ">= 6" } }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -3195,6 +6510,62 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, + "node_modules/ts-jest": { + "version": "29.1.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.4.tgz", + "integrity": "sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/transform": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/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==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -3213,6 +6584,27 @@ "node": "*" } }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/typescript": { "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", @@ -3249,6 +6641,36 @@ "node": ">= 10.0.0" } }, + "node_modules/update-browserslist-db": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz", + "integrity": "sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.2", + "picocolors": "^1.0.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -3267,6 +6689,20 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, "node_modules/vectordb": { "version": "0.4.20", "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.20.tgz", @@ -3296,6 +6732,15 @@ "apache-arrow": "^14.0.2" } }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, "node_modules/web-streams-polyfill": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", @@ -3470,6 +6915,25 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -3479,6 +6943,12 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -3546,6 +7016,18 @@ "engines": { "node": ">=8" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/binary/package.json b/binary/package.json index 3f1a24308..774993a9f 100644 --- a/binary/package.json +++ b/binary/package.json @@ -20,7 +20,7 @@ "outputPath": "bin" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "jest", "build": "node build.js", "build:old": "ncc build src/index.ts -o out && pkg .", "build:dev": "tsc", @@ -31,11 +31,14 @@ "devDependencies": { "@biomejs/biome": "1.6.4", "@types/follow-redirects": "^1.14.4", + "@types/jest": "^29.5.12", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", "esbuild": "0.19.11", + "jest": "^29.7.0", "pkg": "^5.8.1", "rimraf": "^5.0.7", + "ts-jest": "^29.1.4", "typescript": "^5.3.3" }, "dependencies": { diff --git a/binary/src/IpcMessenger.ts b/binary/src/IpcMessenger.ts index 9c06fcb1b..c8640f513 100644 --- a/binary/src/IpcMessenger.ts +++ b/binary/src/IpcMessenger.ts @@ -1,43 +1,22 @@ -import { IProtocol } from "core/protocol"; +import { IProtocol } from "core/protocol/index.js"; import { IMessenger, type Message } from "core/util/messenger"; +import { ChildProcessWithoutNullStreams } from "node:child_process"; import * as fs from "node:fs"; +import net from "node:net"; import { v4 as uuidv4 } from "uuid"; -export class IpcMessenger< +class IPCMessengerBase< ToProtocol extends IProtocol, FromProtocol extends IProtocol, > implements IMessenger { + _sendMsg(message: Message) { + throw new Error("Not implemented"); + } + typeListeners = new Map any)[]>(); idListeners = new Map any>(); - constructor() { - process.stdin.on("data", (data) => { - this._handleData(data); - }); - process.stdout.on("close", () => { - fs.writeFileSync("./error.log", `${new Date().toISOString()}\n`); - console.log("[info] Exiting Continue core..."); - process.exit(1); - }); - process.stdin.on("close", () => { - fs.writeFileSync("./error.log", `${new Date().toISOString()}\n`); - console.log("[info] Exiting Continue core..."); - process.exit(1); - }); - } - - private _onErrorHandlers: ((error: Error) => void)[] = []; - - onError(handler: (error: Error) => void) { - this._onErrorHandlers.push(handler); - } - - mock(data: any) { - const d = JSON.stringify(data); - this._handleData(Buffer.from(d)); - } - private _handleLine(line: string) { try { const msg: Message = JSON.parse(line); @@ -83,7 +62,7 @@ export class IpcMessenger< } private _unfinishedLine: string | undefined = undefined; - private _handleData(data: Buffer) { + protected _handleData(data: Buffer) { const d = data.toString(); const lines = d.split(/\r\n/).filter((line) => line.trim() !== ""); if (lines.length === 0) { @@ -100,41 +79,10 @@ export class IpcMessenger< lines.forEach((line) => this._handleLine(line)); } - send( - messageType: T, - data: FromProtocol[T][0], - messageId?: string, - ): string { - messageId = messageId ?? uuidv4(); - const msg: Message = { - messageType: messageType as string, - data, - messageId, - }; - // process.send?.(data); - process.stdout?.write(JSON.stringify(msg) + "\r\n"); - return messageId; - } + private _onErrorHandlers: ((error: Error) => void)[] = []; - on( - messageType: T, - handler: (message: Message) => ToProtocol[T][1], - ): void { - if (!this.typeListeners.has(messageType)) { - this.typeListeners.set(messageType, []); - } - this.typeListeners.get(messageType)?.push(handler); - } - - invoke( - messageType: T, - data: ToProtocol[T][0], - ): ToProtocol[T][1] { - return this.typeListeners.get(messageType)?.[0]?.({ - messageId: uuidv4(), - messageType: messageType as string, - data, - }); + onError(handler: (error: Error) => void) { + this._onErrorHandlers.push(handler); } request( @@ -151,4 +99,161 @@ export class IpcMessenger< this.send(messageType, data, messageId); }); } + + mock(data: any) { + const d = JSON.stringify(data); + this._handleData(Buffer.from(d)); + } + + send( + messageType: T, + data: FromProtocol[T][0], + messageId?: string, + ): string { + messageId = messageId ?? uuidv4(); + const msg: Message = { + messageType: messageType as string, + data, + messageId, + }; + this._sendMsg(msg); + return messageId; + } + + invoke( + messageType: T, + data: ToProtocol[T][0], + ): ToProtocol[T][1] { + return this.typeListeners.get(messageType)?.[0]?.({ + messageId: uuidv4(), + messageType: messageType as string, + data, + }); + } + + on( + messageType: T, + handler: ( + message: Message, + ) => Promise | ToProtocol[T][1], + ): void { + if (!this.typeListeners.has(messageType)) { + this.typeListeners.set(messageType, []); + } + this.typeListeners.get(messageType)?.push(handler); + } +} + +export class IpcMessenger< + ToProtocol extends IProtocol, + FromProtocol extends IProtocol, + > + extends IPCMessengerBase + implements IMessenger +{ + constructor() { + super(); + console.log("Setup"); + process.stdin.on("data", (data) => { + // console.log("[info] Received data: ", data.toString()); + this._handleData(data); + }); + process.stdout.on("close", () => { + fs.writeFileSync("./error.log", `${new Date().toISOString()}\n`); + console.log("[info] Exiting Continue core..."); + process.exit(1); + }); + process.stdin.on("close", () => { + fs.writeFileSync("./error.log", `${new Date().toISOString()}\n`); + console.log("[info] Exiting Continue core..."); + process.exit(1); + }); + } + _sendMsg(msg: Message) { + // console.log("[info] Sending message: ", msg); + const d = JSON.stringify(msg); + process.stdout?.write(d + "\r\n"); + } +} + +export class CoreBinaryMessenger< + ToProtocol extends IProtocol, + FromProtocol extends IProtocol, + > + extends IPCMessengerBase + implements IMessenger +{ + private errorHandler: (error: Error) => void = () => {}; + private messageHandlers: Map< + keyof ToProtocol, + (message: Message) => Promise | any + > = new Map(); + + constructor(private readonly subprocess: ChildProcessWithoutNullStreams) { + super(); + console.log("Setup"); + this.subprocess.stdout.on("data", (data) => { + console.log("[info] Received data from core:", data.toString() + "\n"); + this._handleData(data); + }); + this.subprocess.stdout.on("close", () => { + console.log("[info] Continue core exited"); + }); + this.subprocess.stdin.on("close", () => { + console.log("[info] Continue core exited"); + }); + } + + _sendMsg(msg: Message) { + console.log("[info] Sending message to core:", msg); + const d = JSON.stringify(msg); + this.subprocess.stdin.write(d + "\r\n"); + } +} + +export class CoreBinaryTcpMessenger< + ToProtocol extends IProtocol, + FromProtocol extends IProtocol, + > + extends IPCMessengerBase + implements IMessenger +{ + private port: number = 3000; + private socket: net.Socket | null = null; + + typeListeners = new Map any)[]>(); + idListeners = new Map any>(); + + constructor() { + super(); + const socket = net.createConnection(this.port, "localhost"); + + this.socket = socket; + socket.on("data", (data: Buffer) => { + // console.log("[info] Received data from core:", data.toString() + "\n"); + this._handleData(data); + }); + + socket.on("end", () => { + console.log("Disconnected from server"); + }); + + socket.on("error", (err: any) => { + console.error("Client error:", err); + }); + } + + close() { + this.socket?.end(); + } + + _sendMsg(msg: Message) { + if (this.socket) { + // console.log("[info] Sending message to core:", msg); + const d = JSON.stringify(msg); + this.socket.write(d + "\r\n"); + } else { + console.error("Socket is not connected"); + } + } } diff --git a/binary/src/TcpMessenger.ts b/binary/src/TcpMessenger.ts index 544a24128..c306af44b 100644 --- a/binary/src/TcpMessenger.ts +++ b/binary/src/TcpMessenger.ts @@ -17,6 +17,11 @@ export class TcpMessenger< constructor() { const server = net.createServer((socket) => { this.socket = socket; + + socket.on("connect", () => { + console.log("Connected to server"); + }); + socket.on("data", (data: Buffer) => { this._handleData(data); }); diff --git a/binary/src/index.ts b/binary/src/index.ts index a4496e64d..04be5de5a 100644 --- a/binary/src/index.ts +++ b/binary/src/index.ts @@ -35,6 +35,7 @@ program.action(async () => { const core = new Core(messenger, ide, async (text) => { fs.appendFileSync(promptLogsPath, text + "\n\n"); }); + console.log("Core started"); } catch (e) { fs.writeFileSync("./error.log", `${new Date().toISOString()} ${e}\n`); console.log("Error: ", e); diff --git a/binary/test/binary.test.ts b/binary/test/binary.test.ts new file mode 100644 index 000000000..87549e155 --- /dev/null +++ b/binary/test/binary.test.ts @@ -0,0 +1,136 @@ +import { FromIdeProtocol, ToIdeProtocol } from "core/protocol/index.js"; +import FileSystemIde from "core/util/filesystem"; +import { IMessenger } from "core/util/messenger"; +import { ReverseMessageIde } from "core/util/reverseMessageIde"; +import fs from "fs"; +import { ChildProcessWithoutNullStreams, spawn } from "node:child_process"; +import path from "path"; +import { + CoreBinaryMessenger, + CoreBinaryTcpMessenger, +} from "../src/IpcMessenger"; + +// jest.setTimeout(100_000); + +const USE_TCP = false; + +function autodetectPlatformAndArch() { + const platform = { + aix: "linux", + darwin: "darwin", + freebsd: "linux", + linux: "linux", + openbsd: "linux", + sunos: "linux", + win32: "win32", + android: "linux", + cygwin: "win32", + netbsd: "linux", + haiku: "linux", + }[process.platform]; + const arch = { + arm: "arm64", + arm64: "arm64", + ia32: "x64", + loong64: "arm64", + mips: "arm64", + mipsel: "arm64", + ppc: "x64", + ppc64: "x64", + riscv64: "arm64", + s390: "x64", + s390x: "x64", + x64: "x64", + }[process.arch]; + return [platform, arch]; +} + +const CONTINUE_GLOBAL_DIR = path.join(__dirname, "..", ".continue"); + +describe("Test Suite", () => { + let messenger: IMessenger; + let subprocess: ChildProcessWithoutNullStreams; + + beforeAll(async () => { + const [platform, arch] = autodetectPlatformAndArch(); + const binaryPath = path.join( + __dirname, + "..", + "bin", + `${platform}-${arch}`, + `continue-binary${platform === "win32" ? ".exe" : ""}`, + ); + expect(fs.existsSync(binaryPath)).toBe(true); + + if (USE_TCP) { + messenger = new CoreBinaryTcpMessenger(); + } else { + subprocess = spawn(binaryPath, { + env: { ...process.env, CONTINUE_GLOBAL_DIR }, + }); + messenger = new CoreBinaryMessenger( + subprocess, + ); + } + + const ide = new FileSystemIde(); + const reverseIde = new ReverseMessageIde(messenger.on.bind(messenger), ide); + + // Wait for core to set itself up + await new Promise((resolve) => setTimeout(resolve, 1000)); + }); + + afterAll(async () => { + // Wait for the subprocess to exit + if (USE_TCP) { + ( + messenger as CoreBinaryTcpMessenger + ).close(); + } else { + subprocess.kill(); + await new Promise((resolve) => subprocess.on("close", resolve)); + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + }); + + it("should respond to ping with pong", async () => { + const resp = await messenger.request("ping", "ping"); + expect(resp).toBe("pong"); + }); + + it("should create .continue directory at the specified location with expected files", async () => { + expect(fs.existsSync(CONTINUE_GLOBAL_DIR)).toBe(true); + + // Many of the files are only created when trying to load the config + const config = await messenger.request( + "config/getBrowserSerialized", + undefined, + ); + + const expectedFiles = [ + "config.json", + "config.ts", + "package.json", + "logs/core.log", + "index/autocompleteCache.sqlite", + "out/config.js", + "types/core/index.d.ts", + ]; + + for (const file of expectedFiles) { + const filePath = path.join(CONTINUE_GLOBAL_DIR, file); + expect(fs.existsSync(filePath)).toBe(true); + } + }); + + it("should properly edit config", async () => { + const config = await messenger.request( + "config/getBrowserSerialized", + undefined, + ); + expect(config).toHaveProperty("models"); + expect(config).toHaveProperty("embeddingsProvider"); + expect(config).toHaveProperty("contextProviders"); + expect(config).toHaveProperty("slashCommands"); + }); +}); diff --git a/binary/tsconfig.json b/binary/tsconfig.json index 94fbda91f..351115f59 100644 --- a/binary/tsconfig.json +++ b/binary/tsconfig.json @@ -13,7 +13,8 @@ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUnusedParameters": true, /* Report errors on unused parameters. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Enable importing .json files */ + "resolveJsonModule": true /* Enable importing .json files */, + "types": ["jest"] }, - "include": ["src/**/*"] + "include": ["src/**/*", "test/**/*"] } diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index 14d4c4ab7..674f0d46e 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -218,6 +218,8 @@ function isEnglishFirstLine(line: string) { line.startsWith("sure thing") || line.startsWith("sure!") || line.startsWith("to fill") || + line.startsWith("certainly") || + line.startsWith("of course") || line.startsWith("the code should") ) { return true; diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index 7ce321b45..46c60ca6b 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -28,7 +28,13 @@ interface AutocompleteTemplate { const stableCodeFimTemplate: AutocompleteTemplate = { template: "{{{prefix}}}{{{suffix}}}", completionOptions: { - stop: ["", "", "", "<|endoftext|>"], + stop: [ + "", + "", + "", + "<|endoftext|>", + "", + ], }, }; @@ -277,7 +283,8 @@ export function getTemplateForModel(model: string): AutocompleteTemplate { lowerCaseModel.includes("starchat") || lowerCaseModel.includes("octocoder") || lowerCaseModel.includes("stable") || - lowerCaseModel.includes("codeqwen") + lowerCaseModel.includes("codeqwen") || + lowerCaseModel.includes("qwen") ) { return stableCodeFimTemplate; } diff --git a/core/config/handler.ts b/core/config/handler.ts index 0cc12a765..0fd2c0503 100644 --- a/core/config/handler.ts +++ b/core/config/handler.ts @@ -4,9 +4,9 @@ import { ContinueRcJson, IContextProvider, IDE, + IdeSettings, ILLM, } from "../index.js"; -import { IdeSettings } from "../protocol/ideWebview.js"; import { Telemetry } from "../util/posthog.js"; import { finalToBrowserConfig, loadFullConfigNode } from "./load.js"; @@ -72,11 +72,12 @@ export class ConfigHandler { const ideInfo = await this.ide.getIdeInfo(); const uniqueId = await this.ide.getUniqueId(); + const ideSettings = await this.ideSettingsPromise; const newConfig = await loadFullConfigNode( this.ide, workspaceConfigs, - await this.ideSettingsPromise, + ideSettings, ideInfo.ideType, uniqueId, this.writeLog, diff --git a/core/config/load.ts b/core/config/load.ts index 0745614d7..1a6c2929a 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -21,6 +21,7 @@ import { EmbeddingsProviderDescription, IContextProvider, IDE, + IdeSettings, IdeType, ModelDescription, Reranker, @@ -34,7 +35,7 @@ import { BaseLLM } from "../llm/index.js"; import CustomLLMClass from "../llm/llms/CustomLLM.js"; import FreeTrial from "../llm/llms/FreeTrial.js"; import { llmFromDescription } from "../llm/llms/index.js"; -import { IdeSettings } from "../protocol/ideWebview.js"; + import { fetchwithRequestOptions } from "../util/fetchWithOptions.js"; import { copyOf } from "../util/index.js"; import mergeJson from "../util/merge.js"; diff --git a/core/core.ts b/core/core.ts index 5bc049255..d78a6fb21 100644 --- a/core/core.ts +++ b/core/core.ts @@ -196,6 +196,7 @@ export class Core { this.ide, (await this.config()).experimental?.promptPath, ); + this.configHandler.reloadConfig(); }); on("config/reload", (msg) => { this.configHandler.reloadConfig(); diff --git a/core/index.d.ts b/core/index.d.ts index 406e82d27..6ad9c10e9 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -402,8 +402,15 @@ export enum FileType { SymbolicLink = 64, } +export interface IdeSettings { + remoteConfigServerUrl: string | undefined; + remoteConfigSyncPeriod: number; + userToken: string; +} + export interface IDE { getIdeInfo(): Promise; + getIdeSettings(): Promise; getDiff(): Promise; isTelemetryEnabled(): Promise; getUniqueId(): Promise; diff --git a/core/jest.config.js b/core/jest.config.js index 9791e7fe6..1dfa0e681 100644 --- a/core/jest.config.js +++ b/core/jest.config.js @@ -1,23 +1,12 @@ export default { - roots: [""], transform: { - "^.+\\.ts?$": [ - "ts-jest", - { - useESM: true, - }, - ], - "^.+\\.js$": [ - "babel-jest", - { - presets: [["@babel/preset-env", { targets: { node: "current" } }]], - }, - ], + "\\.[jt]sx?$": ["ts-jest", { useESM: true }], }, - moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], - extensionsToTreatAsEsm: [".ts"], - // Remove or comment out the moduleNameMapper configuration + moduleNameMapper: { - "^(.*)\\.js$": "$1", + "(.+)\\.js": "$1", }, + extensionsToTreatAsEsm: [".ts"], + preset: "ts-jest/presets/default-esm", + testTimeout: 10000, }; diff --git a/core/llm/index.ts b/core/llm/index.ts index 2a372e887..728bdeef4 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -293,17 +293,20 @@ ${prompt}`; return resp; } catch (e: any) { - console.warn( - `${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`, - ); - - if ( - e.code === "ECONNREFUSED" && - e.message.includes("http://127.0.0.1:11434") - ) { - throw new Error( - "Failed to connect to local Ollama instance. To start Ollama, first download it at https://ollama.ai.", + // Errors to ignore + if (!e.message.includes("/api/show")) { + console.warn( + `${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`, ); + + if ( + e.code === "ECONNREFUSED" && + e.message.includes("http://127.0.0.1:11434") + ) { + throw new Error( + "Failed to connect to local Ollama instance. To start Ollama, first download it at https://ollama.ai.", + ); + } } throw new Error(e.message); } diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 8789e80d4..c6d6acdb6 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -21,14 +21,15 @@ class Ollama extends BaseLLM { if (options.model === "AUTODETECT") { return; } - try { - this.fetch(this.getEndpoint("api/show"), { - method: "POST", - headers: { - Authorization: `Bearer ${this.apiKey}`, - }, - body: JSON.stringify({ name: this._getModel() }), - }).then(async (response) => { + + this.fetch(this.getEndpoint("api/show"), { + method: "POST", + headers: { + Authorization: `Bearer ${this.apiKey}`, + }, + body: JSON.stringify({ name: this._getModel() }), + }) + .then(async (response) => { if (response.status !== 200) { // console.warn( // "Error calling Ollama /api/show endpoint: ", @@ -67,8 +68,10 @@ class Ollama extends BaseLLM { } } } + }) + .catch((e) => { + // console.warn("Error calling the Ollama /api/show endpoint: ", e); }); - } catch (e) {} } private _getModel() { diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 4fbf29d8b..ea871bd12 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -2,11 +2,11 @@ import Handlebars from "handlebars"; import { v4 as uuidv4 } from "uuid"; import { BaseCompletionOptions, + IdeSettings, ILLM, LLMOptions, ModelDescription, } from "../../index.js"; -import { IdeSettings } from "../../protocol/ideWebview.js"; import { DEFAULT_MAX_TOKENS } from "../constants.js"; import { BaseLLM } from "../index.js"; import Anthropic from "./Anthropic.js"; diff --git a/core/package-lock.json b/core/package-lock.json index 49a52ecb4..e4587f56b 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -26,7 +26,7 @@ "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", "handlebars": "^4.7.8", diff --git a/core/package.json b/core/package.json index f93a00116..fd34477ef 100644 --- a/core/package.json +++ b/core/package.json @@ -3,7 +3,7 @@ "version": "1.0.13", "description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js server. It is written in TypeScript and contains much of the functionality that was previously inside of the legacy Continue Python Server.", "scripts": { - "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest ./test", + "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest", "build:npm": "tsc -p ./tsconfig.npm.json", "lint": "eslint . --ext ts", "lint:fix": "eslint . --ext ts --fix" @@ -46,7 +46,7 @@ "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", "handlebars": "^4.7.8", diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 995c6a961..be0f80d55 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -4,6 +4,7 @@ import type { ContextItemWithId, ContextSubmenuItem, DiffLine, + IdeSettings, LLMFullCompletionOptions, MessageContent, ModelDescription, @@ -14,7 +15,6 @@ import type { SiteIndexingConfig, } from ".."; import type { AutocompleteInput } from "../autocomplete/completionProvider"; -import type { IdeSettings } from "./ideWebview"; export type ProtocolGeneratorType = AsyncGenerator<{ done?: boolean; diff --git a/core/protocol/ide.ts b/core/protocol/ide.ts index db44053c4..ab32f52aa 100644 --- a/core/protocol/ide.ts +++ b/core/protocol/ide.ts @@ -3,12 +3,12 @@ import type { DiffLine, FileType, IdeInfo, + IdeSettings, IndexTag, Problem, Range, Thread, } from ".."; -import type { IdeSettings } from "./ideWebview"; export type ToIdeFromWebviewOrCoreProtocol = { // Methods from IDE type diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 3683d9ec0..4aac41735 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -3,12 +3,6 @@ import type { RangeInFileWithContents } from "../commands/util"; import { ToIdeFromWebviewOrCoreProtocol } from "./ide.js"; import { ToWebviewFromIdeOrCoreProtocol } from "./webview.js"; -export interface IdeSettings { - remoteConfigServerUrl: string | undefined; - remoteConfigSyncPeriod: number; - userToken: string; -} - export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { onLoad: [ undefined, diff --git a/core/test/diff.test.ts b/core/test/diff.test.ts index 93a46842f..8bbd2cd25 100644 --- a/core/test/diff.test.ts +++ b/core/test/diff.test.ts @@ -102,7 +102,7 @@ async function* generateLines(lines: string[]): AsyncGenerator { } } -describe("streamDiff", () => { +describe.skip("streamDiff", () => { for (let i = 0; i < oldCode.length; i++) { test(`outputs valid diff #${i}`, async () => { const oldLines = oldCode[i].split("\n"); diff --git a/core/test/llm.test.ts b/core/test/llm.test.ts index 6e5303873..2583acddd 100644 --- a/core/test/llm.test.ts +++ b/core/test/llm.test.ts @@ -2,8 +2,9 @@ import * as dotenv from "dotenv"; import { CompletionOptions } from "../index.js"; import { BaseLLM } from "../llm/index.js"; +import OpenAI from "../llm/llms/OpenAI.js"; -jest.setTimeout(100_000); +// jest.setTimeout(100_000); dotenv.config(); @@ -61,17 +62,17 @@ describe("LLM", () => { // testLLM( // new FreeTrial({ // model: "gpt-3.5-turbo", - // }) + // }), // ); // testLLM( // new Anthropic({ // model: "claude-2", // apiKey: process.env.ANTHROPIC_API_KEY, - // }) - // ); - // testLLM( - // new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-3.5-turbo" }) + // }), // ); + testLLM( + new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-3.5-turbo" }), + ); // TODO: Fix Replicate // testLLM( // new Replicate({ diff --git a/core/test/util/dedentAndGetCommonWhitespace.test.ts b/core/test/util/dedentAndGetCommonWhitespace.test.ts new file mode 100644 index 000000000..5f3c6a4be --- /dev/null +++ b/core/test/util/dedentAndGetCommonWhitespace.test.ts @@ -0,0 +1,76 @@ +// File generated by Continue +import { dedentAndGetCommonWhitespace } from "../../util"; + +describe("dedentAndGetCommonWhitespace", () => { + let originalString: string; + + beforeEach(() => { + // Setup any global variables or states if needed + originalString = " line1\n line2\n line3"; + }); + + afterEach(() => { + // Tear down any changes to global variables or states if needed + originalString = ""; + }); + + test("should dedent and return common whitespace for a simple case", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", " "]); + }); + + test("should handle empty string", () => { + const input = ""; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["", ""]); + }); + + test("should handle string with only whitespace", () => { + const input = " "; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["", ""]); + }); + + test("should handle string with mixed whitespace and content", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([" line1\nline2\n line3", " "]); + }); + + test("should handle string with no common leading whitespace", () => { + const input = "line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([input, ""]); + }); + + test("should handle string with empty lines", () => { + const input = " line1\n\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\n\nline3", " "]); + }); + + test("should handle string with only empty lines", () => { + const input = "\n\n"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["\n\n", ""]); + }); + + test("should handle string with tabs as whitespace", () => { + const input = "\tline1\n\tline2\n\tline3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", "\t"]); + }); + + test("should handle string with mixed tabs and spaces", () => { + const input = "\t line1\n\t line2\n\t line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", "\t "]); + }); + + test("should handle string with different leading whitespace lengths", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([" line1\nline2\n line3", " "]); + }); +}); diff --git a/core/test/util/getLastNPathParts.test.ts b/core/test/util/getLastNPathParts.test.ts new file mode 100644 index 000000000..ba72b4520 --- /dev/null +++ b/core/test/util/getLastNPathParts.test.ts @@ -0,0 +1,51 @@ +// File generated by Continue +import { getLastNPathParts } from "../../util"; + +describe("getLastNPathParts", () => { + const SEP_REGEX = /[\\/]+/; + + beforeAll(() => { + // Setup code if needed + }); + + afterAll(() => { + // Teardown code if needed + }); + + test("returns the last N parts of a filepath with forward slashes", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 2)).toBe("project/file.txt"); + }); + + test("returns the last N parts of a filepath with backward slashes", () => { + const filepath = "C:\\home\\user\\documents\\project\\file.txt"; + expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); + }); + + test("returns the last part if N is 1", () => { + const filepath = "/home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 1)).toBe("file.txt"); + }); + + test("returns the entire path if N is greater than the number of parts", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 10)).toBe( + "home/user/documents/project/file.txt", + ); + }); + + test("returns an empty string if N is 0", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 0)).toBe(""); + }); + + test("handles paths with mixed forward and backward slashes", () => { + const filepath = "home\\user/documents\\project/file.txt"; + expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); + }); + + test("handles edge case with empty filepath", () => { + const filepath = ""; + expect(getLastNPathParts(filepath, 2)).toBe(""); + }); +}); diff --git a/core/test/util/lcs.test.ts b/core/test/util/lcs.test.ts new file mode 100644 index 000000000..da10cdf90 --- /dev/null +++ b/core/test/util/lcs.test.ts @@ -0,0 +1,40 @@ +// This file is generated by Continue +import { longestCommonSubsequence } from "../../util/lcs"; + +describe("longestCommonSubsequence", () => { + beforeAll(() => { + // Setup if needed + }); + + afterAll(() => { + // Teardown if needed + }); + + test("should return the longest common subsequence for non-empty strings", () => { + expect(longestCommonSubsequence("abcde", "ace")).toBe("ace"); + expect(longestCommonSubsequence("abc", "abc")).toBe("abc"); + expect(longestCommonSubsequence("abc", "def")).toBe(""); + }); + + test("should handle cases where one or both strings are empty", () => { + expect(longestCommonSubsequence("", "abc")).toBe(""); + expect(longestCommonSubsequence("abc", "")).toBe(""); + expect(longestCommonSubsequence("", "")).toBe(""); + }); + + test("should handle cases with no common subsequence", () => { + expect(longestCommonSubsequence("abc", "def")).toBe(""); + expect(longestCommonSubsequence("xyz", "abc")).toBe(""); + }); + + test("should handle cases with special characters", () => { + expect(longestCommonSubsequence("a!@#b$c", "!@#$")).toBe("!@#$"); + expect(longestCommonSubsequence("a!@#b$c", "xyz")).toBe(""); + }); + + test("should handle long strings efficiently", () => { + const str1 = "a".repeat(1000) + "b".repeat(1000); + const str2 = "a".repeat(1000) + "c".repeat(1000); + expect(longestCommonSubsequence(str1, str2)).toBe("a".repeat(1000)); + }); +}); diff --git a/core/test/util/merge.test.ts b/core/test/util/merge.test.ts new file mode 100644 index 000000000..a39a5bc30 --- /dev/null +++ b/core/test/util/merge.test.ts @@ -0,0 +1,100 @@ +// File generated by Continue +import { mergeJson } from "../../util/merge"; + +describe("mergeJson", () => { + it("should merge two simple JSON objects", () => { + const first = { a: 1, b: 2 }; + const second = { b: 3, c: 4 }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: 1, b: 3, c: 4 }); + }); + + it('should overwrite values when mergeBehavior is "overwrite"', () => { + const first = { a: 1, b: 2 }; + const second = { b: 3, c: 4 }; + const result = mergeJson(first, second, "overwrite"); + expect(result).toEqual({ a: 1, b: 3, c: 4 }); + }); + + it("should merge nested objects", () => { + const first = { a: { b: 1 } }; + const second = { a: { c: 2 } }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: { b: 1, c: 2 } }); + }); + + it("should merge arrays without mergeKeys", () => { + const first = { a: [1, 2] }; + const second = { a: [3, 4] }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: [1, 2, 3, 4] }); + }); + + it("should merge arrays with mergeKeys", () => { + const first = { + a: [ + { id: 1, value: "first" }, + { id: 2, value: "second" }, + ], + }; + const second = { + a: [ + { id: 2, value: "updated" }, + { id: 3, value: "third" }, + ], + }; + const mergeKeys = { + a: (item1: any, item2: any) => item1.id === item2.id, + }; + const result = mergeJson(first, second, undefined, mergeKeys); + expect(result).toEqual({ + a: [ + { id: 1, value: "first" }, + { id: 2, value: "updated" }, + { id: 3, value: "third" }, + ], + }); + }); + + it("should handle non-object values correctly", () => { + const first = { a: 1, b: "string", c: true }; + const second = { a: 2, b: "new string", c: false }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: 2, b: "new string", c: false }); + }); + + it("should handle null and undefined values correctly", () => { + const first = { a: 1, b: null }; + const second = { b: 2, c: undefined }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: 1, b: 2, c: undefined }); + }); + + it("should handle empty objects", () => { + const first = {}; + const second = { a: 1 }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: 1 }); + }); + + it("should handle empty second object", () => { + const first = { a: 1 }; + const second = {}; + const result = mergeJson(first, second); + expect(result).toEqual({ a: 1 }); + }); + + it("should handle errors gracefully", () => { + const first = { a: 1 }; + const second = { b: () => {} }; // Functions are not serializable in JSON + const result = mergeJson(first, second); + expect(result).toEqual({ a: 1, b: expect.any(Function) }); + }); + + it("should merge deeply nested objects", () => { + const first = { a: { b: { c: 1 } } }; + const second = { a: { b: { d: 2 } } }; + const result = mergeJson(first, second); + expect(result).toEqual({ a: { b: { c: 1, d: 2 } } }); + }); +}); diff --git a/core/test/util/ranges/getRangeInString.test.ts b/core/test/util/ranges/getRangeInString.test.ts new file mode 100644 index 000000000..e0a4df67a --- /dev/null +++ b/core/test/util/ranges/getRangeInString.test.ts @@ -0,0 +1,105 @@ +// This file is generated by Continue + +import { getRangeInString } from "../../../util/ranges"; + +describe.skip("getRangeInString", () => { + let content: string; + + beforeEach(() => { + content = `Line 1 +Line 2 +Line 3 +Line 4 +Line 5`; + }); + + afterEach(() => { + content = ""; + }); + + test("should return substring within the same line", () => { + const range = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 4 }, + }; + expect(getRangeInString(content, range)).toBe("Line"); + }); + + test("should return substring spanning multiple lines", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 3, character: 3 }, + }; + const expected = `ne 2 +Line 3 +Line 4`; + expect(getRangeInString(content, range)).toBe(expected); + }); + + test("should handle range that starts and ends at the same character", () => { + const range = { + start: { line: 2, character: 0 }, + end: { line: 2, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe("L"); + }); + + test("should handle range that spans entire content", () => { + const range = { + start: { line: 0, character: 0 }, + end: { line: 4, character: 5 }, + }; + expect(getRangeInString(content, range)).toBe(content); + }); + + test("should handle range that spans to the end of the last line", () => { + const range = { + start: { line: 3, character: 2 }, + end: { line: 4, character: 5 }, + }; + const expected = `ne 4 +Line 5`; + expect(getRangeInString(content, range)).toBe(expected); + }); + + test("should handle empty content", () => { + content = ""; + const range = { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle invalid range (start line > end line)", () => { + const range = { + start: { line: 3, character: 0 }, + end: { line: 2, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle invalid range (start character > end character on same line)", () => { + const range = { + start: { line: 1, character: 5 }, + end: { line: 1, character: 2 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle range that starts and ends at the same line but different characters", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 1, character: 6 }, + }; + expect(getRangeInString(content, range)).toBe("ne 2"); + }); + + test("should handle range that starts and ends at the same line and same characters", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 1, character: 2 }, + }; + expect(getRangeInString(content, range)).toBe("n"); + }); +}); diff --git a/core/test/util/ranges/intersection.test.ts b/core/test/util/ranges/intersection.test.ts new file mode 100644 index 000000000..397dbc1a8 --- /dev/null +++ b/core/test/util/ranges/intersection.test.ts @@ -0,0 +1,123 @@ +// This file is generated by Continue + +import { intersection } from "../../../util/ranges"; + +interface Position { + line: number; + character: number; +} + +interface Range { + start: Position; + end: Position; +} + +describe("intersection", () => { + let rangeA: Range; + let rangeB: Range; + + beforeEach(() => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 3, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 2 }, + end: { line: 4, character: 0 }, + }; + }); + + test("returns correct intersection for overlapping ranges", () => { + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 2 }, + end: { line: 3, character: 5 }, + }); + }); + + test("returns null for non-overlapping ranges", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 2, character: 0 }, + }; + + rangeB = { + start: { line: 3, character: 0 }, + end: { line: 4, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toBeNull(); + }); + + // TODO + test.skip("returns correct intersection for single line overlap", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 5 }, + }; + + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 2, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 3 }, + end: { line: 1, character: 5 }, + }); + }); + + test("returns null for single line non-overlapping ranges", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 2 }, + }; + + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 1, character: 5 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toBeNull(); + }); + + test("returns correct intersection when one range is fully within another", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 4, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 2 }, + end: { line: 3, character: 3 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 2 }, + end: { line: 3, character: 3 }, + }); + }); + + test("returns correct intersection when ranges touch at the edge", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 2, character: 0 }, + }; + + rangeB = { + start: { line: 2, character: 0 }, + end: { line: 3, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 0 }, + end: { line: 2, character: 0 }, + }); + }); +}); diff --git a/core/test/util/ranges/maxMinPosition.test.ts b/core/test/util/ranges/maxMinPosition.test.ts new file mode 100644 index 000000000..0468df1cd --- /dev/null +++ b/core/test/util/ranges/maxMinPosition.test.ts @@ -0,0 +1,70 @@ +import { maxPosition, minPosition } from "../../../util/ranges"; + +// This file is generated by Continue +interface Position { + line: number; + character: number; +} + +describe("Position comparison functions", () => { + let pos1: Position; + let pos2: Position; + let pos3: Position; + let pos4: Position; + + beforeAll(() => { + // Setup: Initializing positions + pos1 = { line: 1, character: 5 }; + pos2 = { line: 2, character: 3 }; + pos3 = { line: 1, character: 7 }; + pos4 = { line: 2, character: 3 }; // Same as pos2 to test equality + }); + + describe("maxPosition", () => { + it("should return the position with the greater line number", () => { + expect(maxPosition(pos1, pos2)).toEqual(pos2); + }); + + it("should return the position with the greater character number when lines are equal", () => { + expect(maxPosition(pos1, pos3)).toEqual(pos3); + }); + + it("should return the first position when both positions are equal", () => { + expect(maxPosition(pos2, pos4)).toEqual(pos2); + }); + + it("should handle positions with negative line numbers", () => { + const posNegative = { line: -1, character: 0 }; + expect(maxPosition(posNegative, pos1)).toEqual(pos1); + }); + + it("should handle positions with negative character numbers", () => { + const posNegativeChar = { line: 1, character: -1 }; + expect(maxPosition(posNegativeChar, pos1)).toEqual(pos1); + }); + }); + + describe("minPosition", () => { + it("should return the position with the lesser line number", () => { + expect(minPosition(pos1, pos2)).toEqual(pos1); + }); + + it("should return the position with the lesser character number when lines are equal", () => { + expect(minPosition(pos1, pos3)).toEqual(pos1); + }); + + it("should return the first position when both positions are equal", () => { + expect(minPosition(pos2, pos4)).toEqual(pos2); + }); + + it("should handle positions with negative line numbers", () => { + const posNegative = { line: -1, character: 0 }; + expect(minPosition(posNegative, pos1)).toEqual(posNegative); + }); + + it("should handle positions with negative character numbers", () => { + const posNegativeChar = { line: 1, character: -1 }; + expect(minPosition(posNegativeChar, pos1)).toEqual(posNegativeChar); + }); + }); +}); diff --git a/core/test/util/ranges/union.test.ts b/core/test/util/ranges/union.test.ts new file mode 100644 index 000000000..9d06a97b4 --- /dev/null +++ b/core/test/util/ranges/union.test.ts @@ -0,0 +1,92 @@ +import { union } from "../../../util/ranges"; + +// This file is generated by Continue +interface Position { + line: number; + character: number; +} + +interface Range { + start: Position; + end: Position; +} + +describe("union", () => { + let rangeA: Range; + let rangeB: Range; + + beforeEach(() => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 3, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 3 }, + end: { line: 4, character: 2 }, + }; + }); + + test("should return the union of two overlapping ranges", () => { + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 4, character: 2 }, + }); + }); + + test("should return the union when ranges are identical", () => { + const result = union(rangeA, rangeA); + expect(result).toEqual(rangeA); + }); + + test("should return the union when ranges do not overlap but are adjacent", () => { + rangeB = { + start: { line: 3, character: 5 }, + end: { line: 4, character: 2 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 4, character: 2 }, + }); + }); + + test("should return the union when one range is completely within the other", () => { + rangeB = { + start: { line: 2, character: 1 }, + end: { line: 2, character: 4 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual(rangeA); + }); + + test("should return the union when ranges do not overlap and are not adjacent", () => { + rangeB = { + start: { line: 4, character: 3 }, + end: { line: 5, character: 1 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 5, character: 1 }, + }); + }); + + // TODO + test.skip("should handle edge case where start and end lines are the same", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 5 }, + }; + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 1, character: 7 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 1, character: 7 }, + }); + }); +}); diff --git a/core/util/devdataSqlite.ts b/core/util/devdataSqlite.ts index 017169434..9724e9f21 100644 --- a/core/util/devdataSqlite.ts +++ b/core/util/devdataSqlite.ts @@ -1,4 +1,6 @@ import fs from "fs"; +import { open } from "sqlite"; +import sqlite3 from "sqlite3"; import { DatabaseConnection } from "../indexing/refreshIndex.js"; import { getDevDataSqlitePath } from "./paths.js"; @@ -72,8 +74,6 @@ export class DevDataSqliteDb { return DevDataSqliteDb.db; } - const { open } = require("sqlite"); - const sqlite3 = require("sqlite3"); DevDataSqliteDb.db = await open({ filename: devDataSqlitePath, driver: sqlite3.Database, diff --git a/core/util/fetchWithOptions.ts b/core/util/fetchWithOptions.ts index aa581b9d0..a2efe48af 100644 --- a/core/util/fetchWithOptions.ts +++ b/core/util/fetchWithOptions.ts @@ -1,4 +1,4 @@ -import { http, https } from "follow-redirects"; +import * as followRedirects from "follow-redirects"; import { HttpProxyAgent } from "http-proxy-agent"; import { globalAgent } from "https"; import { HttpsProxyAgent } from "https-proxy-agent"; @@ -7,6 +7,8 @@ import * as fs from "node:fs"; import tls from "node:tls"; import { RequestOptions } from "../index.js"; +const { http, https } = (followRedirects as any).default; + export function fetchwithRequestOptions( url_: URL | string, init?: RequestInit, diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index 25bdd3d70..20373eebd 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -4,15 +4,29 @@ import { FileType, IDE, IdeInfo, + IdeSettings, IndexTag, Problem, Range, Thread, -} from "../index.js"; +} from "../index.d.js"; import { getContinueGlobalPath } from "./paths.js"; class FileSystemIde implements IDE { + static workspaceDir = "/tmp/continue"; + + constructor() { + fs.mkdirSync(FileSystemIde.workspaceDir, { recursive: true }); + } + + async getIdeSettings(): Promise { + return { + remoteConfigServerUrl: undefined, + remoteConfigSyncPeriod: 60, + userToken: "", + }; + } async getGitHubAuthToken(): Promise { return undefined; } @@ -68,7 +82,7 @@ class FileSystemIde implements IDE { } isTelemetryEnabled(): Promise { - return Promise.resolve(false); + return Promise.resolve(true); } getUniqueId(): Promise { @@ -115,7 +129,7 @@ class FileSystemIde implements IDE { useGitIgnore?: boolean, ): Promise { return new Promise((resolve, reject) => { - fs.readdir("/tmp/continue", (err, files) => { + fs.readdir(FileSystemIde.workspaceDir, (err, files) => { if (err) { reject(err); } @@ -126,7 +140,7 @@ class FileSystemIde implements IDE { getWorkspaceDirs(): Promise { return new Promise((resolve, reject) => { - fs.mkdtemp("/tmp/continue", (err, folder) => { + fs.mkdtemp(FileSystemIde.workspaceDir, (err, folder) => { if (err) { reject(err); } diff --git a/core/util/index.ts b/core/util/index.ts index bcc7eda22..b1461ba74 100644 --- a/core/util/index.ts +++ b/core/util/index.ts @@ -27,29 +27,6 @@ export function removeQuotesAndEscapes(output: string): string { return output; } -export function proxyFetch(url: string, init?: RequestInit): Promise { - if (!(window as any)._fetch) { - throw new Error("Proxy fetch not initialized"); - } - - if (!(url.startsWith("http://") || url.startsWith("https://"))) { - // Relative URL - const fullUrl = `${window.vscMediaUrl}/${url}`; - return (window as any)._fetch(fullUrl, init); - } - - const proxyServerUrl = - (window as any).proxyServerUrl || "http://localhost:65433"; - - const headers = new Headers(init?.headers); - headers.append("x-continue-url", url); - - return (window as any)._fetch(proxyServerUrl, { - ...init, - headers, - }); -} - export function dedentAndGetCommonWhitespace(s: string): [string, string] { const lines = s.split("\n"); if (lines.length === 0 || (lines[0].trim() === "" && lines.length === 1)) { @@ -96,6 +73,9 @@ export function getBasename(filepath: string): string { } export function getLastNPathParts(filepath: string, n: number): string { + if (n <= 0) { + return ""; + } return filepath.split(SEP_REGEX).slice(-n).join("/"); } diff --git a/core/util/messageIde.ts b/core/util/messageIde.ts index b81045096..4523babba 100644 --- a/core/util/messageIde.ts +++ b/core/util/messageIde.ts @@ -3,6 +3,7 @@ import type { FileType, IDE, IdeInfo, + IdeSettings, IndexTag, Problem, Range, @@ -17,6 +18,9 @@ export class MessageIde implements IDE { data: ToIdeFromWebviewOrCoreProtocol[T][0], ) => Promise, ) {} + getIdeSettings(): Promise { + return this.request("getIdeSettings", undefined); + } getGitHubAuthToken(): Promise { return this.request("getGitHubAuthToken", undefined); } diff --git a/core/util/paths.ts b/core/util/paths.ts index 0c6cb6948..1cb76c47a 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -7,9 +7,13 @@ import { defaultConfig, defaultConfigJetBrains } from "../config/default.js"; import Types from "../config/types.js"; import { IdeType, SerializedContinueConfig } from "../index.js"; +dotenv.config(); +const CONTINUE_GLOBAL_DIR = + process.env.CONTINUE_GLOBAL_DIR ?? path.join(os.homedir(), ".continue"); + export function getContinueGlobalPath(): string { // This is ~/.continue on mac/linux - const continuePath = path.join(os.homedir(), ".continue"); + const continuePath = CONTINUE_GLOBAL_DIR; if (!fs.existsSync(continuePath)) { fs.mkdirSync(continuePath); } diff --git a/core/util/reverseMessageIde.ts b/core/util/reverseMessageIde.ts new file mode 100644 index 000000000..0ea2ce357 --- /dev/null +++ b/core/util/reverseMessageIde.ts @@ -0,0 +1,191 @@ +import { IDE } from ".."; +import { ToIdeFromWebviewOrCoreProtocol } from "../protocol/ide"; +import { Message } from "./messenger"; + +export class ReverseMessageIde { + private on( + messageType: T, + handler: ( + data: ToIdeFromWebviewOrCoreProtocol[T][0], + ) => + | Promise + | ToIdeFromWebviewOrCoreProtocol[T][1], + ): void { + this._on(messageType, (msg) => { + const data = msg.data; + const result = handler(data); + return result; + }); + } + + constructor( + private readonly _on: ( + messageType: T, + handler: ( + message: Message, + ) => + | Promise + | ToIdeFromWebviewOrCoreProtocol[T][1], + ) => void, + private readonly ide: IDE, + ) { + this.initializeListeners(); + } + + private initializeListeners() { + this.on("getGitHubAuthToken", () => { + return this.ide.getGitHubAuthToken(); + }); + + this.on("getLastModified", (data) => { + return this.ide.getLastModified(data.files); + }); + + this.on("getGitRootPath", (data) => { + return this.ide.getGitRootPath(data.dir); + }); + + this.on("listDir", (data) => { + return this.ide.listDir(data.dir); + }); + + this.on("infoPopup", (data) => { + return this.ide.infoPopup(data.message); + }); + + this.on("errorPopup", (data) => { + return this.ide.errorPopup(data.message); + }); + + this.on("getRepoName", (data) => { + return this.ide.getRepoName(data.dir); + }); + + this.on("getDebugLocals", (data) => { + return this.ide.getDebugLocals(data.threadIndex); + }); + + this.on("getTopLevelCallStackSources", (data) => { + return this.ide.getTopLevelCallStackSources( + data.threadIndex, + data.stackDepth, + ); + }); + + this.on("getAvailableThreads", () => { + return this.ide.getAvailableThreads(); + }); + + this.on("getTags", (data) => { + return this.ide.getTags(data); + }); + + this.on("getIdeInfo", () => { + return this.ide.getIdeInfo(); + }); + + this.on("readRangeInFile", (data) => { + return this.ide.readRangeInFile(data.filepath, data.range); + }); + + this.on("isTelemetryEnabled", () => { + return this.ide.isTelemetryEnabled(); + }); + + this.on("getUniqueId", () => { + return this.ide.getUniqueId(); + }); + + this.on("getWorkspaceConfigs", () => { + return this.ide.getWorkspaceConfigs(); + }); + + this.on("getIdeSettings", () => { + return this.ide.getIdeSettings(); + }); + + this.on("getDiff", () => { + return this.ide.getDiff(); + }); + + this.on("getTerminalContents", () => { + return this.ide.getTerminalContents(); + }); + + this.on("listWorkspaceContents", (data) => { + return this.ide.listWorkspaceContents(data.directory, data.useGitIgnore); + }); + + this.on("getWorkspaceDirs", () => { + return this.ide.getWorkspaceDirs(); + }); + + this.on("showLines", (data) => { + return this.ide.showLines(data.filepath, data.startLine, data.endLine); + }); + + this.on("listFolders", () => { + return this.ide.listFolders(); + }); + + this.on("getContinueDir", () => { + return this.ide.getContinueDir(); + }); + + this.on("writeFile", (data) => { + return this.ide.writeFile(data.path, data.contents); + }); + + this.on("showVirtualFile", (data) => { + return this.ide.showVirtualFile(data.name, data.content); + }); + + this.on("openFile", (data) => { + return this.ide.openFile(data.path); + }); + + this.on("runCommand", (data) => { + return this.ide.runCommand(data.command); + }); + + this.on("saveFile", (data) => { + return this.ide.saveFile(data.filepath); + }); + + this.on("readFile", (data) => { + return this.ide.readFile(data.filepath); + }); + + this.on("showDiff", (data) => { + return this.ide.showDiff(data.filepath, data.newContents, data.stepIndex); + }); + + this.on("getOpenFiles", () => { + return this.ide.getOpenFiles(); + }); + + this.on("getCurrentFile", () => { + return this.ide.getCurrentFile(); + }); + + this.on("getPinnedFiles", () => { + return this.ide.getPinnedFiles(); + }); + + this.on("getSearchResults", (data) => { + return this.ide.getSearchResults(data.query); + }); + + this.on("getProblems", (data) => { + return this.ide.getProblems(data.filepath); + }); + + this.on("subprocess", (data) => { + return this.ide.subprocess(data.command); + }); + + this.on("getBranch", (data) => { + return this.ide.getBranch(data.dir); + }); + } +} diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index d801ee4b4..e3eba0461 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -137,7 +137,7 @@ tasks { } publishPlugin { - dependsOn("patchChangelog") +// dependsOn("patchChangelog") token = environment("PUBLISH_TOKEN") // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 1ad2540f8..73defa15f 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.51 +pluginVersion = 0.0.52 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt index f0d37ea25..9320705f8 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt @@ -42,7 +42,7 @@ class AutocompleteEditorListener: EditorFactoryListener { override fun editorCreated(event: EditorFactoryEvent) { val editor = event.editor val project = editor.project ?: return - val editorManager = project.let { FileEditorManager.getInstance(it) } + val editorManager = project.let { FileEditorManager.getInstance(it) } ?: return val completionProvider = project.service() // Listen to changes to mouse position diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteLookupListener.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteLookupListener.kt new file mode 100644 index 000000000..a59169ea2 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteLookupListener.kt @@ -0,0 +1,48 @@ +package com.github.continuedev.continueintellijextension.autocomplete + +import com.intellij.codeInsight.lookup.impl.LookupImpl +import com.intellij.codeInsight.lookup.Lookup +import com.intellij.codeInsight.lookup.LookupEvent +import com.intellij.codeInsight.lookup.LookupListener +import com.intellij.codeInsight.lookup.LookupManagerListener +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.Service +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project +import java.util.concurrent.atomic.AtomicBoolean + +@Service(Service.Level.PROJECT) +class AutocompleteLookupListener(project: Project) : LookupManagerListener { + private val isLookupShown = AtomicBoolean(true) + + fun isLookupEmpty(): Boolean { + return isLookupShown.get() + } + + init { + project.messageBus.connect().subscribe(LookupManagerListener.TOPIC, this) + } + + override fun activeLookupChanged(oldLookup: Lookup?, newLookup: Lookup?) { + val newEditor = newLookup?.editor ?: return + if (newLookup is LookupImpl) { + newLookup.addLookupListener( + object : LookupListener { + override fun lookupShown(event: LookupEvent) { + super.lookupShown(event) + ApplicationManager.getApplication().invokeLater { + isLookupShown.set(false) + event.lookup.editor.project?.service()?.hideCompletions(newEditor) + } + } + + override fun lookupCanceled(event: LookupEvent) { + super.lookupCanceled(event) + ApplicationManager.getApplication().invokeLater { + isLookupShown.set(true) + } + } + }) + } + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt index 5c76ec3c7..6d3691ad6 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt @@ -25,6 +25,7 @@ data class PendingCompletion ( @Service(Service.Level.PROJECT) class AutocompleteService(private val project: Project) { var pendingCompletion: PendingCompletion? = null; + private val autocompleteLookupListener = project.service() fun triggerCompletion(editor: Editor) { val settings = @@ -79,6 +80,10 @@ class AutocompleteService(private val project: Project) { } private fun renderCompletion(editor: Editor, offset: Int, text: String) { + // Don't render completions when code completion dropdown is visible + if (!autocompleteLookupListener.isLookupEmpty()) { + return + } ApplicationManager.getApplication().invokeLater { WriteAction.run { val properties = InlayProperties() @@ -136,4 +141,17 @@ class AutocompleteService(private val project: Project) { } } } + + fun hideCompletions(editor: Editor) { + editor.inlayModel.getInlineElementsInRange(0, editor.document.textLength).forEach { + if (it.renderer is ContinueCustomElementRenderer) { + it.dispose() + } + } + editor.inlayModel.getBlockElementsInRange(0, editor.document.textLength).forEach { + if (it.renderer is ContinueMultilineCustomElementRenderer) { + it.dispose() + } + } + } } diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index dc1d5a03f..73f88efb9 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -19,6 +19,9 @@ + messages.MyBundle diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 4f1d7b967..6d0e21452 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -110,7 +110,7 @@ "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", "handlebars": "^4.7.8", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 4c8e46a09..17b9f38fa 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -172,12 +172,6 @@ "title": "Toggle Autocomplete Enabled", "group": "Continue" }, - { - "command": "continue.shareSession", - "category": "Continue", - "title": "Share Session", - "group": "Continue" - }, { "command": "continue.selectFilesAsContext", "category": "Continue", diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index b2bf277f8..5c3ae6fcf 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -403,9 +403,6 @@ const commandsMap: ( input: text, }); }, - "continue.shareSession": () => { - sidebar.sendMainUserInput("/share"); - }, "continue.selectRange": (startLine: number, endLine: number) => { if (!vscode.window.activeTextEditor) { return; diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index c5b390b45..739a047cb 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -47,7 +47,7 @@ export class VsCodeExtension { this.extensionContext = context; this.windowId = uuidv4(); - const ideSettings = this.ide.getIdeSettings(); + const ideSettings = this.ide.getIdeSettingsSync(); const { remoteConfigServerUrl } = ideSettings; // Dependencies of core diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index 80f3e5e8a..d584d0615 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -7,13 +7,13 @@ import type { FileType, IDE, IdeInfo, + IdeSettings, IndexTag, Problem, Thread, } from "core"; import { Range } from "core"; import { defaultIgnoreFile } from "core/indexing/ignore"; -import { IdeSettings } from "core/protocol/ideWebview"; import { editConfigJson, getConfigJsonPath, @@ -510,7 +510,7 @@ class VsCodeIde implements IDE { .map(([name, type]) => [path.join(dir, name), type]) as any; } - getIdeSettings(): IdeSettings { + getIdeSettingsSync(): IdeSettings { const settings = vscode.workspace.getConfiguration("continue"); const remoteConfigServerUrl = settings.get( "remoteConfigServerUrl", @@ -526,6 +526,10 @@ class VsCodeIde implements IDE { }; return ideSettings; } + + async getIdeSettings(): Promise { + return this.getIdeSettingsSync(); + } } export { VsCodeIde }; diff --git a/gui/package-lock.json b/gui/package-lock.json index dc9cee0f1..d652bc561 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -103,7 +103,7 @@ "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", "handlebars": "^4.7.8", From 027d15f44637e762ab017d25130c50b65f814711 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 07:58:56 -0700 Subject: [PATCH 014/252] check ts in dev --- .github/workflows/ts-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ts-check.yaml b/.github/workflows/ts-check.yaml index f0baf029d..1b069db35 100644 --- a/.github/workflows/ts-check.yaml +++ b/.github/workflows/ts-check.yaml @@ -5,6 +5,7 @@ on: branches: - main - preview + - dev jobs: tsc-check: From 8d7b7604cc155c974ab4459c8fd0d1306eff06eb Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 10:33:26 -0700 Subject: [PATCH 015/252] ignore .env --- .github/workflows/preview.yaml | 1 + core/indexing/ignore.ts | 1 + docs/static/schemas/config.json | 13 +- .../src/main/resources/config_schema.json | 13 +- extensions/vscode/continue_rc_schema.json | 495 ++++++++++++++---- 5 files changed, 393 insertions(+), 130 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 95e426f6f..c038ea7fb 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -216,6 +216,7 @@ jobs: # 3. Publish the extension to Open VSX Registry - name: Publish (Open VSX Registry) + continue-on-error: true run: | cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../alpine-x64/*.vsix ../../darwin-arm64/*.vsix ../../darwin-x64/*.vsix ../../linux-arm64/*.vsix ../../linux-armhf/*.vsix ../../linux-x64/*.vsix ../../win32-x64/*.vsix ../../win32-arm64/*.vsix diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 6d7e00e84..2fe5e2ca2 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -59,6 +59,7 @@ const DEFAULT_IGNORE_FILETYPES = [ "*.gcda", "*.gcno", "go.sum", + ".env", ]; export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); export const DEFAULT_IGNORE_DIRS = [ diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 6428abfed..66fdf453e 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1316,14 +1316,15 @@ "outline", "postgres", "code", - "system", "currentFile", "url", - "database" + "database", + "os" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", "Reference the contents of the terminal", + "Reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread", "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", @@ -1333,17 +1334,15 @@ "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 important highlighted sections from your code", "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", "References Postgres table schema and sample rows", "Reference specific functions and classes from throughout your codebase", - "Reference your operating system and cpu", "Reference the contents of the currently active file", "Reference the contents of a page at a URL", - "Reference table schemas" + "Reference table schemas", + "Operating system and CPU Information" ], "type": "string" }, diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 6428abfed..66fdf453e 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1316,14 +1316,15 @@ "outline", "postgres", "code", - "system", "currentFile", "url", - "database" + "database", + "os" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", "Reference the contents of the terminal", + "Reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread", "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", @@ -1333,17 +1334,15 @@ "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 important highlighted sections from your code", "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", "References Postgres table schema and sample rows", "Reference specific functions and classes from throughout your codebase", - "Reference your operating system and cpu", "Reference the contents of the currently active file", "Reference the contents of a page at a URL", - "Reference table schemas" + "Reference table schemas", + "Operating system and CPU Information" ], "type": "string" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 04c1a41aa..e4ac18216 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -279,7 +279,10 @@ "apiType": { "title": "Api Type", "markdownDescription": "OpenAI API type, either `openai` or `azure`", - "enum": ["openai", "azure"] + "enum": [ + "openai", + "azure" + ] }, "apiVersion": { "title": "Api Version", @@ -292,7 +295,11 @@ "type": "string" } }, - "required": ["title", "provider", "model"], + "required": [ + "title", + "provider", + "model" + ], "allOf": [ { "if": { @@ -302,7 +309,9 @@ } }, "not": { - "required": ["provider"] + "required": [ + "provider" + ] } }, "then": { @@ -329,33 +338,48 @@ ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { - "required": ["apiKey"] + "required": [ + "apiKey" + ] } }, { "if": { "properties": { "provider": { - "enum": ["huggingface-tgi", "huggingface-inference-api"] + "enum": [ + "huggingface-tgi", + "huggingface-inference-api" + ] } } }, "then": { - "required": ["apiBase"] + "required": [ + "apiBase" + ] }, - "required": ["provider"] + "required": [ + "provider" + ] }, { "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": [ + "openai" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -375,10 +399,14 @@ "if": { "properties": { "provider": { - "enum": ["cloudflare"] + "enum": [ + "cloudflare" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -436,10 +464,14 @@ "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": [ + "openai" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -470,10 +502,14 @@ "if": { "properties": { "provider": { - "enum": ["replicate"] + "enum": [ + "replicate" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -503,10 +539,14 @@ "if": { "properties": { "provider": { - "enum": ["free-trial"] + "enum": [ + "free-trial" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -531,7 +571,9 @@ "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": [ + "openai" + ] }, "apiType": { "not": { @@ -539,7 +581,9 @@ } } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -597,10 +641,14 @@ "if": { "properties": { "provider": { - "enum": ["anthropic"] + "enum": [ + "anthropic" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -628,15 +676,22 @@ "if": { "properties": { "provider": { - "enum": ["cohere"] + "enum": [ + "cohere" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { "model": { - "enum": ["command-r", "command-r-plus"] + "enum": [ + "command-r", + "command-r-plus" + ] } } } @@ -645,10 +700,14 @@ "if": { "properties": { "provider": { - "enum": ["bedrock"] + "enum": [ + "bedrock" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -673,10 +732,14 @@ "if": { "properties": { "provider": { - "enum": ["gemini"] + "enum": [ + "gemini" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -697,10 +760,14 @@ "if": { "properties": { "provider": { - "enum": ["together"] + "enum": [ + "together" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -734,10 +801,14 @@ "if": { "properties": { "provider": { - "enum": ["deepinfra"] + "enum": [ + "deepinfra" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -760,7 +831,9 @@ ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -806,10 +879,14 @@ "if": { "properties": { "provider": { - "enum": ["ollama"] + "enum": [ + "ollama" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -857,10 +934,14 @@ "if": { "properties": { "provider": { - "enum": ["mistral"] + "enum": [ + "mistral" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -881,15 +962,22 @@ "if": { "properties": { "provider": { - "enum": ["deepseek"] + "enum": [ + "deepseek" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { "model": { - "enum": ["deepseek-chat", "deepseek-coder"] + "enum": [ + "deepseek-chat", + "deepseek-coder" + ] } } } @@ -898,10 +986,14 @@ "if": { "properties": { "provider": { - "enum": ["groq"] + "enum": [ + "groq" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -922,15 +1014,21 @@ "if": { "properties": { "provider": { - "enum": ["fireworks"] + "enum": [ + "fireworks" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { "model": { - "enum": ["starcoder-7b"] + "enum": [ + "starcoder-7b" + ] } } } @@ -942,20 +1040,30 @@ "const": "azure" } }, - "required": ["apiType"] + "required": [ + "apiType" + ] }, "then": { - "required": ["engine", "apiVersion", "apiBase"] + "required": [ + "engine", + "apiVersion", + "apiBase" + ] } }, { "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": [ + "openai" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -972,7 +1080,9 @@ "const": "llamafile" } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -986,10 +1096,14 @@ "if": { "properties": { "provider": { - "enum": ["text-gen-webui"] + "enum": [ + "text-gen-webui" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -1003,10 +1117,14 @@ "if": { "properties": { "provider": { - "enum": ["flowise"] + "enum": [ + "flowise" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { "properties": { @@ -1033,7 +1151,10 @@ "type": "string" } }, - "required": ["key", "value"] + "required": [ + "key", + "value" + ] } }, "additionalFlowiseConfiguration": { @@ -1052,7 +1173,10 @@ "description": "Configuration Property value" } }, - "required": ["key", "value"] + "required": [ + "key", + "value" + ] } }, "model": { @@ -1144,7 +1268,9 @@ "type": "string" } }, - "required": ["default"] + "required": [ + "default" + ] }, "SlashCommand": { "title": "SlashCommand", @@ -1203,7 +1329,9 @@ "if": { "properties": { "name": { - "enum": ["issue"] + "enum": [ + "issue" + ] } } }, @@ -1216,17 +1344,23 @@ "description": "Enter the URL of the GitHub repository for which you want to generate the issue." } }, - "required": ["repositoryUrl"] + "required": [ + "repositoryUrl" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["edit"] + "enum": [ + "edit" + ] } } }, @@ -1251,7 +1385,9 @@ "if": { "properties": { "name": { - "enum": ["share"] + "enum": [ + "share" + ] } } }, @@ -1269,7 +1405,10 @@ } } ], - "required": ["name", "description"] + "required": [ + "name", + "description" + ] }, "CustomCommand": { "title": "CustomCommand", @@ -1288,7 +1427,11 @@ "type": "string" } }, - "required": ["name", "prompt", "description"] + "required": [ + "name", + "prompt", + "description" + ] }, "ContextProviderWithParams": { "title": "ContextProviderWithParams", @@ -1362,7 +1505,9 @@ "if": { "properties": { "name": { - "enum": ["google"] + "enum": [ + "google" + ] } } }, @@ -1375,17 +1520,23 @@ "description": "Your API key for https://serper.dev in order to get Google search results" } }, - "required": ["serperApiKey"] + "required": [ + "serperApiKey" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["open"] + "enum": [ + "open" + ] } } }, @@ -1407,7 +1558,9 @@ "if": { "properties": { "name": { - "enum": ["issue"] + "enum": [ + "issue" + ] } } }, @@ -1436,24 +1589,37 @@ "type": { "type": "string", "description": "The type of issues to search for", - "enum": ["open", "closed", "all"] + "enum": [ + "open", + "closed", + "all" + ] } }, - "required": ["owner", "repo"] + "required": [ + "owner", + "repo" + ] } } }, - "required": ["repos"] + "required": [ + "repos" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["database"] + "enum": [ + "database" + ] } } }, @@ -1474,7 +1640,11 @@ "connection_type": { "type": "string", "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": ["postgres", "mysql", "sqlite"] + "enum": [ + "postgres", + "mysql", + "sqlite" + ] }, "connection": { "type": "object", @@ -1507,21 +1677,31 @@ "required": [] } }, - "required": ["name", "connection_type", "connection"] + "required": [ + "name", + "connection_type", + "connection" + ] } } }, - "required": ["connections"] + "required": [ + "connections" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["gitlab-mr"] + "enum": [ + "gitlab-mr" + ] } } }, @@ -1542,17 +1722,23 @@ "description": "If you have code selected, filters out comments that aren't related to the selection." } }, - "required": ["token"] + "required": [ + "token" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["jira"] + "enum": [ + "jira" + ] } } }, @@ -1598,17 +1784,24 @@ ] } }, - "required": ["domain", "token"] + "required": [ + "domain", + "token" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["http"] + "enum": [ + "http" + ] } } }, @@ -1621,17 +1814,24 @@ "description": "The HTTP endpoint of your context provider server." } }, - "required": ["url"] + "required": [ + "url" + ] } }, - "required": ["params"] + "required": [ + "params" + ] } }, { "if": { "properties": { "name": { - "enum": ["codebase", "folder"] + "enum": [ + "codebase", + "folder" + ] } } }, @@ -1666,7 +1866,9 @@ "if": { "properties": { "name": { - "enum": ["postgres"] + "enum": [ + "postgres" + ] } } }, @@ -1718,11 +1920,19 @@ } } }, - "required": ["host", "port", "user", "password", "database"] + "required": [ + "host", + "port", + "user", + "password", + "database" + ] } } ], - "required": ["name"] + "required": [ + "name" + ] }, "SerializedContinueConfig": { "title": "config.json", @@ -1874,32 +2084,46 @@ "$ref": "#/definitions/RequestOptions" } }, - "required": ["provider"], + "required": [ + "provider" + ], "allOf": [ { "if": { "properties": { "provider": { - "enum": ["cohere"] + "enum": [ + "cohere" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { - "required": ["apiKey"] + "required": [ + "apiKey" + ] } }, { "if": { "properties": { "provider": { - "enum": ["gemini"] + "enum": [ + "gemini" + ] } }, - "required": ["provider"] + "required": [ + "provider" + ] }, "then": { - "required": ["apiKey"] + "required": [ + "apiKey" + ] } } ] @@ -1910,22 +2134,33 @@ "type": "object", "properties": { "name": { - "enum": ["cohere", "voyage", "llm", "free-trial"] + "enum": [ + "cohere", + "voyage", + "llm", + "free-trial" + ] }, "params": { "type": "object" } }, - "required": ["name"], + "required": [ + "name" + ], "allOf": [ { "if": { "properties": { "name": { - "enum": ["cohere"] + "enum": [ + "cohere" + ] } }, - "required": ["name"] + "required": [ + "name" + ] }, "then": { "properties": { @@ -1947,7 +2182,9 @@ "type": "string" } }, - "required": ["apiKey"] + "required": [ + "apiKey" + ] } } } @@ -1956,10 +2193,14 @@ "if": { "properties": { "name": { - "enum": ["llm"] + "enum": [ + "llm" + ] } }, - "required": ["name"] + "required": [ + "name" + ] }, "then": { "properties": { @@ -1970,7 +2211,9 @@ "type": "string" } }, - "required": ["modelTitle"] + "required": [ + "modelTitle" + ] } } } @@ -1979,10 +2222,14 @@ "if": { "properties": { "name": { - "enum": ["voyage"] + "enum": [ + "voyage" + ] } }, - "required": ["name"] + "required": [ + "name" + ] }, "then": { "properties": { @@ -1993,10 +2240,14 @@ "type": "string" }, "model": { - "enum": ["rerank-lite-1"] + "enum": [ + "rerank-lite-1" + ] } }, - "required": ["apiKey"] + "required": [ + "apiKey" + ] } } } @@ -2062,7 +2313,11 @@ "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." }, "multilineCompletions": { - "enum": ["always", "never", "auto"], + "enum": [ + "always", + "never", + "auto" + ], "description": "If set to true, Continue will only complete a single line at a time." }, "useCache": { @@ -2091,7 +2346,10 @@ "type": "object", "properties": { "codeBlockToolbarPosition": { - "enum": ["top", "bottom"], + "enum": [ + "top", + "bottom" + ], "default": "top", "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." }, @@ -2108,7 +2366,9 @@ "defaultContext": { "type": "array", "items": { - "enum": ["activeFile"] + "enum": [ + "activeFile" + ] } }, "modelRoles": { @@ -2151,7 +2411,10 @@ }, "mergeBehavior": { "type": "string", - "enum": ["merge", "overwrite"], + "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." @@ -2159,4 +2422,4 @@ } } } -} +} \ No newline at end of file From 24d02e8404bcd9158dee3737cfedc585d3152a19 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 11:04:44 -0700 Subject: [PATCH 016/252] =?UTF-8?q?=F0=9F=9A=91=20fix=20constant=20warning?= =?UTF-8?q?s=20when=20onboarding=20with=20Ollama?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index d78a6fb21..87af833f5 100644 --- a/core/core.ts +++ b/core/core.ts @@ -368,7 +368,13 @@ export class Core { return model.listModels(); } else { if (msg.data.title === "Ollama") { - return new Ollama({ model: "" }).listModels(); + try { + const models = await new Ollama({ model: "" }).listModels(); + return models; + } catch (e) { + console.warn(`Error listing Ollama models: ${e}`); + return undefined; + } } else { return undefined; } From 8a92f4312693549a1590e99c70152b843d59b119 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 21 Jun 2024 15:58:04 -0500 Subject: [PATCH 017/252] fix(gui): ctx rendering w/ renderInlineAs: "" (#1541) --- extensions/vscode/CONTRIBUTING.md | 4 ++-- gui/src/components/mainInput/resolveInput.ts | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/extensions/vscode/CONTRIBUTING.md b/extensions/vscode/CONTRIBUTING.md index ddeca6bcb..5cfbf3cb1 100644 --- a/extensions/vscode/CONTRIBUTING.md +++ b/extensions/vscode/CONTRIBUTING.md @@ -7,11 +7,11 @@ This is the Continue VS Code Extension. Its primary jobs are # How to run the extension -See [Environment Setup](../CONTRIBUTING.md#environment-setup) +See [Environment Setup](../../CONTRIBUTING.md#environment-setup) # How to run and debug tests -After following the setup in [Environment Setup](../CONTRIBUTING.md#environment-setup) you can run the `Extension (VSCode)` launch configuration in VS Code. +After following the setup in [Environment Setup](../../CONTRIBUTING.md#environment-setup) you can run the `Extension (VSCode)` launch configuration in VS Code. ## Notes diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index bb628f4ce..cabe66bd3 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -42,6 +42,9 @@ async function resolveEditorContent( if (foundSlashCommand && typeof slashCommand === "undefined") { slashCommand = foundSlashCommand; } + + contextItemAttrs.push(...ctxItems); + if (text === "") { continue; } @@ -51,11 +54,14 @@ async function resolveEditorContent( } else { parts.push({ type: "text", text }); } - contextItemAttrs.push(...ctxItems); } else if (p.type === "codeBlock") { if (!p.attrs.item.editing) { const text = - "```" + p.attrs.item.description + "\n" + p.attrs.item.content + "\n```"; + "```" + + p.attrs.item.description + + "\n" + + p.attrs.item.content + + "\n```"; if (parts[parts.length - 1]?.type === "text") { parts[parts.length - 1].text += "\n" + text; } else { @@ -96,7 +102,10 @@ async function resolveEditorContent( if (item.itemType === "file") { // This is a quick way to resolve @file references const basename = getBasename(item.id); - const relativeFilePath = getRelativePath(item.id, await ideMessenger.ide.getWorkspaceDirs()); + const relativeFilePath = getRelativePath( + item.id, + await ideMessenger.ide.getWorkspaceDirs(), + ); const rawContent = await ideMessenger.ide.readFile(item.id); const content = `\`\`\`${relativeFilePath}\n${rawContent}\n\`\`\`\n`; contextItemsText += content; From 851e825af63e8605894aa16a1a717fb052e6b82b Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:02:29 -0700 Subject: [PATCH 018/252] =?UTF-8?q?=E2=9C=A8=20use=20and=20cache=20imports?= =?UTF-8?q?=20for=20autocomplete=20(#1456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ use and cache imports for autocomplete * fix tsc --- binary/src/IpcIde.ts | 2 +- core/autocomplete/ImportDefinitionsService.ts | 81 +++ core/autocomplete/NearbyDefinitionsService.ts | 45 ++ core/autocomplete/completionProvider.ts | 688 +++++++++--------- core/autocomplete/constructPrompt.ts | 26 + core/index.d.ts | 12 + core/indexing/CodeSnippetsIndex.ts | 27 +- core/protocol/ide.ts | 4 + core/protocol/index.ts | 5 +- core/util/LruCache.ts | 30 + core/util/filesystem.ts | 9 + core/util/messageIde.ts | 14 + core/util/parameters.ts | 1 + core/util/treeSitter.ts | 34 +- extensions/vscode/scripts/prepackage.js | 2 +- extensions/vscode/src/autocomplete/lsp.ts | 4 +- extensions/vscode/src/ideProtocol.ts | 22 + .../{tree-sitter-c-tags.scm => c.scm} | 0 ...ee-sitter-c_sharp-tags.scm => c_sharp.scm} | 0 .../{tree-sitter-cpp-tags.scm => cpp.scm} | 0 .../{tree-sitter-elisp-tags.scm => elisp.scm} | 0 ...tree-sitter-elixir-tags.scm => elixir.scm} | 0 .../{tree-sitter-go-tags.scm => go.scm} | 0 .../{tree-sitter-java-tags.scm => java.scm} | 0 ...ter-javascript-tags.scm => javascript.scm} | 0 .../{tree-sitter-ocaml-tags.scm => ocaml.scm} | 0 .../{tree-sitter-php-tags.scm => php.scm} | 0 ...tree-sitter-python-tags.scm => python.scm} | 0 .../{tree-sitter-ql-tags.scm => ql.scm} | 0 .../{tree-sitter-ruby-tags.scm => ruby.scm} | 0 .../{tree-sitter-rust-tags.scm => rust.scm} | 0 ...ter-typescript-tags.scm => typescript.scm} | 0 .../tree-sitter/import-queries/typescript.scm | 9 + gui/src/context/IdeMessenger.ts | 2 +- 34 files changed, 639 insertions(+), 378 deletions(-) create mode 100644 core/autocomplete/ImportDefinitionsService.ts create mode 100644 core/autocomplete/NearbyDefinitionsService.ts create mode 100644 core/util/LruCache.ts rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-c-tags.scm => c.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-c_sharp-tags.scm => c_sharp.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-cpp-tags.scm => cpp.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-elisp-tags.scm => elisp.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-elixir-tags.scm => elixir.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-go-tags.scm => go.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-java-tags.scm => java.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-javascript-tags.scm => javascript.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-ocaml-tags.scm => ocaml.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-php-tags.scm => php.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-python-tags.scm => python.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-ql-tags.scm => ql.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-ruby-tags.scm => ruby.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-rust-tags.scm => rust.scm} (100%) rename extensions/vscode/tree-sitter/code-snippet-queries/{tree-sitter-typescript-tags.scm => typescript.scm} (100%) create mode 100644 extensions/vscode/tree-sitter/import-queries/typescript.scm diff --git a/binary/src/IpcIde.ts b/binary/src/IpcIde.ts index 2be3bd354..ee2649c36 100644 --- a/binary/src/IpcIde.ts +++ b/binary/src/IpcIde.ts @@ -3,6 +3,6 @@ import { MessageIde } from "core/util/messageIde"; export class IpcIde extends MessageIde { constructor(messenger: TODO) { - super(messenger.request.bind(messenger)); + super(messenger.request.bind(messenger), messenger.on.bind(messenger)); } } diff --git a/core/autocomplete/ImportDefinitionsService.ts b/core/autocomplete/ImportDefinitionsService.ts new file mode 100644 index 000000000..19287bf81 --- /dev/null +++ b/core/autocomplete/ImportDefinitionsService.ts @@ -0,0 +1,81 @@ +import { IDE } from ".."; +import { RangeInFileWithContents } from "../commands/util"; +import { PrecalculatedLruCache } from "../util/LruCache"; +import { + TSQueryType, + getParserForFile, + getQueryForFile, +} from "../util/treeSitter"; + +interface FileInfo { + imports: { [key: string]: RangeInFileWithContents[] }; +} + +export class ImportDefinitionsService { + static N = 10; + + private cache: PrecalculatedLruCache = + new PrecalculatedLruCache( + this._getFileInfo.bind(this), + ImportDefinitionsService.N, + ); + + constructor(private readonly ide: IDE) { + ide.onDidChangeActiveTextEditor((filepath) => { + this.cache.initKey(filepath); + }); + } + + get(filepath: string): FileInfo | undefined { + return this.cache.get(filepath); + } + + private async _getFileInfo(filepath: string): Promise { + const parser = await getParserForFile(filepath); + if (!parser) { + return { + imports: {}, + }; + } + const ast = parser.parse(await this.ide.readFile(filepath), undefined, { + includedRanges: [ + { + startIndex: 0, + endIndex: 10_000, + startPosition: { row: 0, column: 0 }, + endPosition: { row: 100, column: 0 }, + }, + ], + }); + const query = await getQueryForFile(filepath, TSQueryType.Imports); + if (!query) { + return { + imports: {}, + }; + } + + const matches = query?.matches(ast.rootNode); + + const fileInfo: FileInfo = { + imports: {}, + }; + for (const match of matches) { + const startPosition = match.captures[0].node.startPosition; + const defs = await this.ide.gotoDefinition({ + filepath, + position: { + line: startPosition.row, + character: startPosition.column, + }, + }); + fileInfo.imports[match.captures[0].node.text] = await Promise.all( + defs.map(async (def) => ({ + ...def, + contents: await this.ide.readRangeInFile(def.filepath, def.range), + })), + ); + } + + return fileInfo; + } +} diff --git a/core/autocomplete/NearbyDefinitionsService.ts b/core/autocomplete/NearbyDefinitionsService.ts new file mode 100644 index 000000000..79cd0af0a --- /dev/null +++ b/core/autocomplete/NearbyDefinitionsService.ts @@ -0,0 +1,45 @@ +import { IDE, Location } from ".."; +import { LANGUAGES } from "./languages"; +import { getSymbolsForSnippet } from "./ranking"; + +interface FileInfo { + filepath: string; +} + +export class NearbyDefinitionsService { + static N = 10; + + constructor(private readonly ide: IDE) {} + + async getDefinitionsForLine(filepath: string, line: number) { + const lineContent = await this.ide.readRangeInFile(filepath, { + start: { + line, + character: 0, + }, + end: { + line: line + 1, + character: 0, + }, + }); + + // Remove keywords + const lang = LANGUAGES[filepath.split(".").slice(-1)[0]]; + const symbols = Array.from(getSymbolsForSnippet(lineContent)) + .filter((s) => s.length > 0) + .filter((s) => !(lang && lang?.stopWords?.includes(s))); + + return Promise.all( + symbols.map((s) => { + const character = lineContent.indexOf(s); + const pos: Location = { + filepath, + position: { + line, + character, + }, + }; + }), + ); + } +} diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 873515bf5..f1cdfb165 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -1,5 +1,5 @@ -import Handlebars from "handlebars"; import ignore from "ignore"; +import OpenAI from "openai"; import path from "path"; import { v4 as uuidv4 } from "uuid"; import { RangeInFileWithContents } from "../commands/util.js"; @@ -14,7 +14,6 @@ import { Range, TabAutocompleteOptions, } from "../index.js"; -import OpenAI from "../llm/llms/OpenAI.js"; import { logDevData } from "../util/devdata.js"; import { getBasename, getLastNPathParts } from "../util/index.js"; import { @@ -23,6 +22,7 @@ import { } from "../util/parameters.js"; import { Telemetry } from "../util/posthog.js"; import { getRangeInString } from "../util/ranges.js"; +import { ImportDefinitionsService } from "./ImportDefinitionsService.js"; import { BracketMatchingService } from "./brackets.js"; import AutocompleteLruCache from "./cache.js"; import { @@ -138,342 +138,6 @@ export type GetLspDefinitionsFunction = ( lang: AutocompleteLanguageInfo, ) => Promise; -export async function getTabCompletion( - token: AbortSignal, - options: TabAutocompleteOptions, - llm: ILLM, - ide: IDE, - generatorReuseManager: GeneratorReuseManager, - input: AutocompleteInput, - getDefinitionsFromLsp: GetLspDefinitionsFunction, - bracketMatchingService: BracketMatchingService, -): Promise { - const startTime = Date.now(); - - const { - filepath, - pos, - recentlyEditedFiles, - recentlyEditedRanges, - clipboardText, - manuallyPassFileContents, - manuallyPassPrefix, - } = input; - const fileContents = - manuallyPassFileContents ?? (await ide.readFile(filepath)); - const fileLines = fileContents.split("\n"); - - // Filter - const lang = languageForFilepath(filepath); - const line = fileLines[pos.line] ?? ""; - for (const endOfLine of lang.endOfLine) { - if (line.endsWith(endOfLine) && pos.character >= line.length) { - return undefined; - } - } - - // Model - if (!llm) { - return; - } - if (llm instanceof OpenAI) { - llm.useLegacyCompletionsEndpoint = true; - } else if ( - llm.providerName === "free-trial" && - llm.model !== TRIAL_FIM_MODEL - ) { - llm.model = TRIAL_FIM_MODEL; - } - - if ( - !shownGptClaudeWarning && - nonAutocompleteModels.some((model) => llm.model.includes(model)) && - !llm.model.includes("deepseek") - ) { - shownGptClaudeWarning = true; - throw new Error( - `Warning: ${llm.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/walkthroughs/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, - ); - } - - // Prompt - let fullPrefix = - getRangeInString(fileContents, { - start: { line: 0, character: 0 }, - end: input.selectedCompletionInfo?.range.start ?? pos, - }) + (input.selectedCompletionInfo?.text ?? ""); - - if (input.injectDetails) { - const lines = fullPrefix.split("\n"); - fullPrefix = `${lines.slice(0, -1).join("\n")}\n${ - lang.singleLineComment - } ${input.injectDetails.split("\n").join(`\n${lang.singleLineComment} `)}\n${ - lines[lines.length - 1] - }`; - } - - const fullSuffix = getRangeInString(fileContents, { - start: pos, - end: { line: fileLines.length - 1, character: Number.MAX_SAFE_INTEGER }, - }); - - // First non-whitespace line below the cursor - let lineBelowCursor = ""; - let i = 1; - while ( - lineBelowCursor.trim() === "" && - pos.line + i <= fileLines.length - 1 - ) { - lineBelowCursor = fileLines[Math.min(pos.line + i, fileLines.length - 1)]; - i++; - } - - let extrasSnippets = options.useOtherFiles - ? ((await Promise.race([ - getDefinitionsFromLsp( - filepath, - fullPrefix + fullSuffix, - fullPrefix.length, - ide, - lang, - ), - new Promise((resolve) => { - setTimeout(() => resolve([]), 100); - }), - ])) as AutocompleteSnippet[]) - : []; - - const workspaceDirs = await ide.getWorkspaceDirs(); - if (options.onlyMyCode) { - extrasSnippets = extrasSnippets.filter((snippet) => { - return workspaceDirs.some((dir) => snippet.filepath.startsWith(dir)); - }); - } - - let { prefix, suffix, completeMultiline, snippets } = - await constructAutocompletePrompt( - filepath, - pos.line, - fullPrefix, - fullSuffix, - clipboardText, - lang, - options, - recentlyEditedRanges, - recentlyEditedFiles, - llm.model, - extrasSnippets, - ); - - // If prefix is manually passed - if (manuallyPassPrefix) { - prefix = manuallyPassPrefix; - suffix = ""; - } - - // Template prompt - const { - template, - completionOptions, - compilePrefixSuffix = undefined, - } = options.template - ? { template: options.template, completionOptions: {} } - : getTemplateForModel(llm.model); - - let prompt: string; - const filename = getBasename(filepath); - const reponame = getBasename(workspaceDirs[0] ?? "myproject"); - - // Some models have prompts that need two passes. This lets us pass the compiled prefix/suffix - // into either the 2nd template to generate a raw string, or to pass prefix, suffix to a FIM endpoint - if (compilePrefixSuffix) { - [prefix, suffix] = compilePrefixSuffix( - prefix, - suffix, - filepath, - reponame, - snippets, - ); - } - - if (typeof template === "string") { - const compiledTemplate = Handlebars.compile(template); - - // Format snippets as comments and prepend to prefix - const formattedSnippets = snippets - .map((snippet) => - formatExternalSnippet(snippet.filepath, snippet.contents, lang), - ) - .join("\n"); - if (formattedSnippets.length > 0) { - prefix = `${formattedSnippets}\n\n${prefix}`; - } else if (prefix.trim().length === 0 && suffix.trim().length === 0) { - // If it's an empty file, include the file name as a comment - prefix = `${lang.singleLineComment} ${getLastNPathParts(filepath, 2)}\n${prefix}`; - } - - prompt = compiledTemplate({ - prefix, - suffix, - filename, - reponame, - }); - } else { - // Let the template function format snippets - prompt = template(prefix, suffix, filepath, reponame, snippets); - } - - // Completion - let completion = ""; - - const cache = await autocompleteCache; - const cachedCompletion = options.useCache - ? await cache.get(prefix) - : undefined; - let cacheHit = false; - if (cachedCompletion) { - // Cache - cacheHit = true; - completion = cachedCompletion; - } else { - const stop = [ - ...(completionOptions?.stop || []), - ...multilineStops, - ...commonStops, - ...(llm.model.toLowerCase().includes("starcoder2") - ? STARCODER2_T_ARTIFACTS - : []), - ...(lang.stopWords ?? []), - ...lang.topLevelKeywords.map((word) => `\n${word}`), - ]; - - let langMultilineDecision = lang.useMultiline?.({ prefix, suffix }); - let multiline: boolean = false; - if (langMultilineDecision) { - multiline = langMultilineDecision; - } else { - multiline = - !input.selectedCompletionInfo && // Only ever single-line if using intellisense selected value - options.multilineCompletions !== "never" && - (options.multilineCompletions === "always" || completeMultiline); - } - - // Try to reuse pending requests if what the user typed matches start of completion - const generator = generatorReuseManager.getGenerator( - prefix, - () => - llm.supportsFim() - ? llm.streamFim(prefix, suffix, { - ...completionOptions, - stop, - }) - : llm.streamComplete(prompt, { - ...completionOptions, - raw: true, - stop, - }), - multiline, - ); - - // Full stop means to stop the LLM's generation, instead of just truncating the displayed completion - const fullStop = () => generatorReuseManager.currentGenerator?.cancel(); - - // LLM - let cancelled = false; - const generatorWithCancellation = async function* () { - for await (const update of generator) { - if (token.aborted) { - cancelled = true; - return; - } - yield update; - } - }; - let charGenerator = generatorWithCancellation(); - charGenerator = noFirstCharNewline(charGenerator); - charGenerator = onlyWhitespaceAfterEndOfLine( - charGenerator, - lang.endOfLine, - fullStop, - ); - charGenerator = bracketMatchingService.stopOnUnmatchedClosingBracket( - charGenerator, - prefix, - suffix, - filepath, - multiline, - ); - - let lineGenerator = streamLines(charGenerator); - lineGenerator = stopAtLines(lineGenerator, fullStop); - lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop); - lineGenerator = avoidPathLine(lineGenerator, lang.singleLineComment); - lineGenerator = skipPrefixes(lineGenerator); - lineGenerator = noTopLevelKeywordsMidline( - lineGenerator, - lang.topLevelKeywords, - fullStop, - ); - - for (const lineFilter of lang.lineFilters ?? []) { - lineGenerator = lineFilter({ lines: lineGenerator, fullStop }); - } - - lineGenerator = streamWithNewLines(lineGenerator); - - const finalGenerator = stopAtSimilarLine( - lineGenerator, - lineBelowCursor, - fullStop, - ); - - try { - for await (const update of finalGenerator) { - completion += update; - } - } catch (e: any) { - if (ERRORS_TO_IGNORE.some((err) => e.includes(err))) { - return undefined; - } - throw e; - } - - if (cancelled) { - return undefined; - } - - const processedCompletion = postprocessCompletion({ - completion, - prefix, - suffix, - llm, - }); - - if (!processedCompletion) { - return undefined; - } - completion = processedCompletion; - } - - const time = Date.now() - startTime; - return { - time, - completion, - prefix, - suffix, - prompt, - modelProvider: llm.providerName, - modelName: llm.model, - completionOptions, - cacheHit, - filepath: input.filepath, - completionId: input.completionId, - gitRepo: await ide.getRepoName(input.filepath), - uniqueId: await ide.getUniqueId(), - ...options, - }; -} - export class CompletionProvider { private static debounceTimeout: NodeJS.Timeout | undefined = undefined; private static debouncing = false; @@ -489,12 +153,15 @@ export class CompletionProvider { this.generatorReuseManager = new GeneratorReuseManager( this.onError.bind(this), ); + this.importDefinitionsService = new ImportDefinitionsService(this.ide); } + private importDefinitionsService: ImportDefinitionsService; private generatorReuseManager: GeneratorReuseManager; private autocompleteCache = AutocompleteLruCache.get(); public errorsShown: Set = new Set(); private bracketMatchingService = new BracketMatchingService(); + // private nearbyDefinitionsService = new NearbyDefinitionsService(); private onError(e: any) { console.warn("Error generating autocompletion: ", e); @@ -654,16 +321,7 @@ export class CompletionProvider { options.maxPromptTokens = 500; } - const outcome = await getTabCompletion( - token, - options, - llm, - this.ide, - this.generatorReuseManager, - input, - this.getDefinitionsFromLsp, - this.bracketMatchingService, - ); + const outcome = await this.getTabCompletion(token, options, llm, input); if (!outcome?.completion) { return undefined; @@ -735,4 +393,338 @@ export class CompletionProvider { displayedAt: now, }; } + + async getTabCompletion( + token: AbortSignal, + options: TabAutocompleteOptions, + llm: ILLM, + input: AutocompleteInput, + ): Promise { + const startTime = Date.now(); + + const { + filepath, + pos, + recentlyEditedFiles, + recentlyEditedRanges, + clipboardText, + manuallyPassFileContents, + manuallyPassPrefix, + } = input; + const fileContents = + manuallyPassFileContents ?? (await this.ide.readFile(filepath)); + const fileLines = fileContents.split("\n"); + + // Filter + const lang = languageForFilepath(filepath); + const line = fileLines[pos.line] ?? ""; + for (const endOfLine of lang.endOfLine) { + if (line.endsWith(endOfLine) && pos.character >= line.length) { + return undefined; + } + } + + // Model + if (!llm) { + return; + } + if (llm instanceof OpenAI) { + llm.useLegacyCompletionsEndpoint = true; + } else if ( + llm.providerName === "free-trial" && + llm.model !== TRIAL_FIM_MODEL + ) { + llm.model = TRIAL_FIM_MODEL; + } + + if ( + !shownGptClaudeWarning && + nonAutocompleteModels.some((model) => llm.model.includes(model)) && + !llm.model.includes("deepseek") + ) { + shownGptClaudeWarning = true; + throw new Error( + `Warning: ${llm.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/walkthroughs/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, + ); + } + + // Prompt + let fullPrefix = + getRangeInString(fileContents, { + start: { line: 0, character: 0 }, + end: input.selectedCompletionInfo?.range.start ?? pos, + }) + (input.selectedCompletionInfo?.text ?? ""); + + if (input.injectDetails) { + const lines = fullPrefix.split("\n"); + fullPrefix = `${lines.slice(0, -1).join("\n")}\n${ + lang.singleLineComment + } ${input.injectDetails.split("\n").join(`\n${lang.singleLineComment} `)}\n${ + lines[lines.length - 1] + }`; + } + + const fullSuffix = getRangeInString(fileContents, { + start: pos, + end: { line: fileLines.length - 1, character: Number.MAX_SAFE_INTEGER }, + }); + + // First non-whitespace line below the cursor + let lineBelowCursor = ""; + let i = 1; + while ( + lineBelowCursor.trim() === "" && + pos.line + i <= fileLines.length - 1 + ) { + lineBelowCursor = fileLines[Math.min(pos.line + i, fileLines.length - 1)]; + i++; + } + + let extrasSnippets = options.useOtherFiles + ? ((await Promise.race([ + this.getDefinitionsFromLsp( + filepath, + fullPrefix + fullSuffix, + fullPrefix.length, + this.ide, + lang, + ), + new Promise((resolve) => { + setTimeout(() => resolve([]), 100); + }), + ])) as AutocompleteSnippet[]) + : []; + + const workspaceDirs = await this.ide.getWorkspaceDirs(); + if (options.onlyMyCode) { + extrasSnippets = extrasSnippets.filter((snippet) => { + return workspaceDirs.some((dir) => snippet.filepath.startsWith(dir)); + }); + } + + let { prefix, suffix, completeMultiline, snippets } = + await constructAutocompletePrompt( + filepath, + pos.line, + fullPrefix, + fullSuffix, + clipboardText, + lang, + options, + recentlyEditedRanges, + recentlyEditedFiles, + llm.model, + extrasSnippets, + this.importDefinitionsService, + ); + + // If prefix is manually passed + if (manuallyPassPrefix) { + prefix = manuallyPassPrefix; + suffix = ""; + } + + // Template prompt + const { + template, + completionOptions, + compilePrefixSuffix = undefined, + } = options.template + ? { template: options.template, completionOptions: {} } + : getTemplateForModel(llm.model); + + let prompt: string; + const filename = getBasename(filepath); + const reponame = getBasename(workspaceDirs[0] ?? "myproject"); + + // Some models have prompts that need two passes. This lets us pass the compiled prefix/suffix + // into either the 2nd template to generate a raw string, or to pass prefix, suffix to a FIM endpoint + if (compilePrefixSuffix) { + [prefix, suffix] = compilePrefixSuffix( + prefix, + suffix, + filepath, + reponame, + snippets, + ); + } + + if (typeof template === "string") { + const compiledTemplate = Handlebars.compile(template); + + // Format snippets as comments and prepend to prefix + const formattedSnippets = snippets + .map((snippet) => + formatExternalSnippet(snippet.filepath, snippet.contents, lang), + ) + .join("\n"); + if (formattedSnippets.length > 0) { + prefix = `${formattedSnippets}\n\n${prefix}`; + } else if (prefix.trim().length === 0 && suffix.trim().length === 0) { + // If it's an empty file, include the file name as a comment + prefix = `${lang.singleLineComment} ${getLastNPathParts(filepath, 2)}\n${prefix}`; + } + + prompt = compiledTemplate({ + prefix, + suffix, + filename, + reponame, + }); + } else { + // Let the template function format snippets + prompt = template(prefix, suffix, filepath, reponame, snippets); + } + + // Completion + let completion = ""; + + const cache = await autocompleteCache; + const cachedCompletion = options.useCache + ? await cache.get(prefix) + : undefined; + let cacheHit = false; + if (cachedCompletion) { + // Cache + cacheHit = true; + completion = cachedCompletion; + } else { + const stop = [ + ...(completionOptions?.stop || []), + ...multilineStops, + ...commonStops, + ...(llm.model.toLowerCase().includes("starcoder2") + ? STARCODER2_T_ARTIFACTS + : []), + ...(lang.stopWords ?? []), + ...lang.topLevelKeywords.map((word) => `\n${word}`), + ]; + + let langMultilineDecision = lang.useMultiline?.({ prefix, suffix }); + let multiline: boolean = false; + if (langMultilineDecision) { + multiline = langMultilineDecision; + } else { + multiline = + !input.selectedCompletionInfo && // Only ever single-line if using intellisense selected value + options.multilineCompletions !== "never" && + (options.multilineCompletions === "always" || completeMultiline); + } + + // Try to reuse pending requests if what the user typed matches start of completion + const generator = this.generatorReuseManager.getGenerator( + prefix, + () => + llm.supportsFim() + ? llm.streamFim(prefix, suffix, { + ...completionOptions, + stop, + }) + : llm.streamComplete(prompt, { + ...completionOptions, + raw: true, + stop, + }), + multiline, + ); + + // Full stop means to stop the LLM's generation, instead of just truncating the displayed completion + const fullStop = () => + this.generatorReuseManager.currentGenerator?.cancel(); + + // LLM + let cancelled = false; + const generatorWithCancellation = async function* () { + for await (const update of generator) { + if (token.aborted) { + cancelled = true; + return; + } + yield update; + } + }; + let charGenerator = generatorWithCancellation(); + charGenerator = noFirstCharNewline(charGenerator); + charGenerator = onlyWhitespaceAfterEndOfLine( + charGenerator, + lang.endOfLine, + fullStop, + ); + charGenerator = this.bracketMatchingService.stopOnUnmatchedClosingBracket( + charGenerator, + prefix, + suffix, + filepath, + multiline, + ); + + let lineGenerator = streamLines(charGenerator); + lineGenerator = stopAtLines(lineGenerator, fullStop); + lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop); + lineGenerator = avoidPathLine(lineGenerator, lang.singleLineComment); + lineGenerator = skipPrefixes(lineGenerator); + lineGenerator = noTopLevelKeywordsMidline( + lineGenerator, + lang.topLevelKeywords, + fullStop, + ); + + for (const lineFilter of lang.lineFilters ?? []) { + lineGenerator = lineFilter({ lines: lineGenerator, fullStop }); + } + + lineGenerator = streamWithNewLines(lineGenerator); + + const finalGenerator = stopAtSimilarLine( + lineGenerator, + lineBelowCursor, + fullStop, + ); + + try { + for await (const update of finalGenerator) { + completion += update; + } + } catch (e: any) { + if (ERRORS_TO_IGNORE.some((err) => e.includes(err))) { + return undefined; + } + throw e; + } + + if (cancelled) { + return undefined; + } + + const processedCompletion = postprocessCompletion({ + completion, + prefix, + suffix, + llm, + }); + + if (!processedCompletion) { + return undefined; + } + completion = processedCompletion; + } + + const time = Date.now() - startTime; + return { + time, + completion, + prefix, + suffix, + prompt, + modelProvider: llm.providerName, + modelName: llm.model, + completionOptions, + cacheHit, + filepath: input.filepath, + completionId: input.completionId, + gitRepo: await this.ide.getRepoName(input.filepath), + uniqueId: await this.ide.getUniqueId(), + ...options, + }; + } } diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 6f97e75ac..78770a0d5 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -7,6 +7,7 @@ import { pruneLinesFromBottom, pruneLinesFromTop, } from "../llm/countTokens.js"; +import { ImportDefinitionsService } from "./ImportDefinitionsService.js"; import { getAst, getTreePathAtCursor } from "./ast.js"; import { AutocompleteLanguageInfo, @@ -15,6 +16,7 @@ import { } from "./languages.js"; import { fillPromptWithSnippets, + getSymbolsForSnippet, rankSnippets, removeRangeFromSnippets, type AutocompleteSnippet, @@ -124,6 +126,7 @@ export async function constructAutocompletePrompt( recentlyEditedFiles: RangeInFileWithContents[], modelName: string, extraSnippets: AutocompleteSnippet[], + importDefinitionsService: ImportDefinitionsService, ): Promise<{ prefix: string; suffix: string; @@ -189,6 +192,29 @@ export async function constructAutocompletePrompt( } } + // Use imports + if (options.useImports) { + const importSnippets = []; + const fileInfo = importDefinitionsService.get(filepath); + if (fileInfo) { + const { imports } = fileInfo; + // Look for imports of any symbols around the current range + const textAroundCursor = + fullPrefix.split("\n").slice(-5).join("\n") + + fullSuffix.split("\n").slice(0, 3).join("\n"); + const symbols = Array.from( + getSymbolsForSnippet(textAroundCursor), + ).filter((symbol) => !language.topLevelKeywords.includes(symbol)); + for (const symbol of symbols) { + const rifs = imports[symbol]; + if (rifs) { + importSnippets.push(...rifs); + } + } + } + snippets.push(...importSnippets); + } + // Filter out empty snippets and ones that are already in the prefix/suffix snippets = snippets .map((snippet) => ({ ...snippet })) diff --git a/core/index.d.ts b/core/index.d.ts index b5f40c322..658f5c980 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -201,6 +201,11 @@ export interface RangeInFile { range: Range; } +export interface Location { + filepath: string; + position: Position; +} + export interface FileWithContents { filepath: string; contents: string; @@ -462,6 +467,12 @@ export interface IDE { listDir(dir: string): Promise<[string, FileType][]>; getLastModified(files: string[]): Promise<{ [path: string]: number }>; getGitHubAuthToken(): Promise; + + // LSP + gotoDefinition(location: Location): Promise; + + // Callbacks + onDidChangeActiveTextEditor(callback: (filepath: string) => void): void; } // Slash Commands @@ -756,6 +767,7 @@ export interface TabAutocompleteOptions { useRecentlyEdited: boolean; recentLinePrefixMatchMinLength: number; disableInFiles?: string[]; + useImports?: boolean; } export interface ContinueUIConfig { diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 11a6a01bb..23dd5f535 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -1,5 +1,3 @@ -import fs from "node:fs"; -import path from "node:path"; import type { ChunkWithoutID, ContextItem, @@ -10,9 +8,9 @@ import type { } from "../index.js"; import { getBasename, getLastNPathParts } from "../util/index.js"; import { - getLanguageForFile, + TSQueryType, getParserForFile, - supportedLanguages, + getQueryForFile, } from "../util/treeSitter.js"; import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; import { @@ -46,35 +44,16 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { )`); } - private getQuerySource(filepath: string) { - const fullLangName = supportedLanguages[filepath.split(".").pop() ?? ""]; - const sourcePath = path.join( - __dirname, - "..", - "tree-sitter", - "code-snippet-queries", - `tree-sitter-${fullLangName}-tags.scm`, - ); - if (!fs.existsSync(sourcePath)) { - return ""; - } - return fs.readFileSync(sourcePath).toString(); - } - async getSnippetsInFile( filepath: string, contents: string, ): Promise<(ChunkWithoutID & { title: string })[]> { - const lang = await getLanguageForFile(filepath); - if (!lang) { - return []; - } const parser = await getParserForFile(filepath); if (!parser) { return []; } const ast = parser.parse(contents); - const query = lang?.query(this.getQuerySource(filepath)); + const query = await getQueryForFile(filepath, TSQueryType.CodeSnippets); const matches = query?.matches(ast.rootNode); return ( diff --git a/core/protocol/ide.ts b/core/protocol/ide.ts index ab32f52aa..31308ad4d 100644 --- a/core/protocol/ide.ts +++ b/core/protocol/ide.ts @@ -5,8 +5,10 @@ import type { IdeInfo, IdeSettings, IndexTag, + Location, Problem, Range, + RangeInFile, Thread, } from ".."; @@ -73,5 +75,7 @@ export type ToIdeFromWebviewOrCoreProtocol = { listDir: [{ dir: string }, [string, FileType][]]; getLastModified: [{ files: string[] }, { [path: string]: number }]; + gotoDefinition: [{ location: Location }, RangeInFile[]]; + getGitHubAuthToken: [undefined, string | undefined]; }; diff --git a/core/protocol/index.ts b/core/protocol/index.ts index 36c73e0b0..ac89c3b42 100644 --- a/core/protocol/index.ts +++ b/core/protocol/index.ts @@ -12,7 +12,10 @@ export type IProtocol = Record; // IDE export type ToIdeProtocol = ToIdeFromWebviewProtocol & ToIdeFromCoreProtocol; -export type FromIdeProtocol = ToWebviewFromIdeProtocol & ToCoreFromIdeProtocol; +export type FromIdeProtocol = ToWebviewFromIdeProtocol & + ToCoreFromIdeProtocol & { + didChangeActiveTextEditor: [{ filepath: string }, void]; + }; // Webview export type ToWebviewProtocol = ToWebviewFromIdeProtocol & diff --git a/core/util/LruCache.ts b/core/util/LruCache.ts new file mode 100644 index 000000000..f6d923fed --- /dev/null +++ b/core/util/LruCache.ts @@ -0,0 +1,30 @@ +export class PrecalculatedLruCache { + private items: [string, V][] = []; + constructor( + private readonly calculateValue: (key: string) => Promise, + private readonly N: number, + ) {} + + async initKey(key: string) { + // Maintain LRU + const index = this.items.findIndex((item) => item[0] === key); + + if (index < 0) { + // Calculate info for new file + const value: V = await this.calculateValue(key); + + this.items.push([key, value]); + if (this.items.length > this.N) { + this.items.shift(); + } + } else { + // Move to end of array, since it was recently used + const [item] = this.items.splice(index, 1); + this.items.push(item); + } + } + + get(key: string): V | undefined { + return this.items.find((item) => item[0] === key)?.[1]; + } +} diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index 20373eebd..9745d1628 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -6,8 +6,10 @@ import { IdeInfo, IdeSettings, IndexTag, + Location, Problem, Range, + RangeInFile, Thread, } from "../index.d.js"; @@ -20,6 +22,13 @@ class FileSystemIde implements IDE { fs.mkdirSync(FileSystemIde.workspaceDir, { recursive: true }); } + gotoDefinition(location: Location): Promise { + throw new Error("Method not implemented."); + } + onDidChangeActiveTextEditor(callback: (filepath: string) => void): void { + throw new Error("Method not implemented."); + } + async getIdeSettings(): Promise { return { remoteConfigServerUrl: undefined, diff --git a/core/util/messageIde.ts b/core/util/messageIde.ts index 4523babba..d74a0ebe4 100644 --- a/core/util/messageIde.ts +++ b/core/util/messageIde.ts @@ -5,11 +5,14 @@ import type { IdeInfo, IdeSettings, IndexTag, + Location, Problem, Range, + RangeInFile, Thread, } from "../index.js"; import { ToIdeFromWebviewOrCoreProtocol } from "../protocol/ide.js"; +import { FromIdeProtocol } from "../protocol/index.js"; export class MessageIde implements IDE { constructor( @@ -17,7 +20,18 @@ export class MessageIde implements IDE { messageType: T, data: ToIdeFromWebviewOrCoreProtocol[T][0], ) => Promise, + private readonly on: ( + messageType: T, + callback: (data: FromIdeProtocol[T][0]) => FromIdeProtocol[T][1], + ) => void, ) {} + async gotoDefinition(location: Location): Promise { + return this.request("gotoDefinition", { location }); + } + onDidChangeActiveTextEditor(callback: (filepath: string) => void): void { + this.on("didChangeActiveTextEditor", (data) => callback(data.filepath)); + } + getIdeSettings(): Promise { return this.request("getIdeSettings", undefined); } diff --git a/core/util/parameters.ts b/core/util/parameters.ts index 83b77046d..8909af6f4 100644 --- a/core/util/parameters.ts +++ b/core/util/parameters.ts @@ -19,6 +19,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { useRecentlyEdited: true, recentLinePrefixMatchMinLength: 7, disableInFiles: undefined, + useImports: true, }; export const COUNT_COMPLETION_REJECTED_AFTER = 10_000; diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 967f5d979..95a7a10ce 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -1,4 +1,5 @@ -import * as path from "path"; +import fs from "node:fs"; +import path from "node:path"; import Parser, { Language } from "web-tree-sitter"; export const supportedLanguages: { [key: string]: string } = { @@ -115,3 +116,34 @@ export async function getLanguageForFile( return undefined; } } + +export enum TSQueryType { + CodeSnippets = "code-snippet-queries", + Imports = "import-queries", +} + +export async function getQueryForFile( + filepath: string, + queryType: TSQueryType, +): Promise { + const language = await getLanguageForFile(filepath); + if (!language) { + return undefined; + } + + const fullLangName = supportedLanguages[filepath.split(".").pop() ?? ""]; + const sourcePath = path.join( + __dirname, + "..", + "tree-sitter", + queryType, + `${fullLangName}.scm`, + ); + if (!fs.existsSync(sourcePath)) { + return undefined; + } + const querySource = fs.readFileSync(sourcePath).toString(); + + const query = language.query(querySource); + return query; +} diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index d5a8b0c0d..71ff48e4e 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -470,7 +470,7 @@ const exe = os === "win32" ? ".exe" : ""; // Validate the all of the necessary files are present validateFilesPresent([ // Queries used to create the index for @code context provider - "tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm", + "tree-sitter/code-snippet-queries/c_sharp.scm", // Queries used for @outline and @highlights context providers "tag-qry/tree-sitter-c_sharp-tags.scm", diff --git a/extensions/vscode/src/autocomplete/lsp.ts b/extensions/vscode/src/autocomplete/lsp.ts index 02441e965..8ac365826 100644 --- a/extensions/vscode/src/autocomplete/lsp.ts +++ b/extensions/vscode/src/autocomplete/lsp.ts @@ -32,7 +32,9 @@ function gotoInputKey(input: GotoInput) { const MAX_CACHE_SIZE = 50; const gotoCache = new Map(); -async function executeGotoProvider(input: GotoInput): Promise { +export async function executeGotoProvider( + input: GotoInput, +): Promise { const cacheKey = gotoInputKey(input); const cached = gotoCache.get(cacheKey); if (cached) { diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index d584d0615..a608b1757 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -9,7 +9,9 @@ import type { IdeInfo, IdeSettings, IndexTag, + Location, Problem, + RangeInFile, Thread, } from "core"; import { Range } from "core"; @@ -20,6 +22,7 @@ import { getContinueGlobalPath, } from "core/util/paths"; import * as vscode from "vscode"; +import { executeGotoProvider } from "./autocomplete/lsp"; import { DiffManager } from "./diff/horizontal"; import { Repository } from "./otherExtensions/git"; import { VsCodeIdeUtils } from "./util/ideUtils"; @@ -41,6 +44,25 @@ class VsCodeIde implements IDE { this.ideUtils = new VsCodeIdeUtils(); } + async gotoDefinition(location: Location): Promise { + const result = await executeGotoProvider({ + uri: location.filepath, + line: location.position.line, + character: location.position.character, + name: "vscode.executeDefinitionProvider", + }); + + return result; + } + + onDidChangeActiveTextEditor(callback: (filepath: string) => void): void { + vscode.window.onDidChangeActiveTextEditor((editor) => { + if (editor) { + callback(editor.document.uri.fsPath); + } + }); + } + private authToken: string | undefined; private askedForAuth = false; diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-c-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/c.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-c-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/c.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/c_sharp.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/c_sharp.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-cpp-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/cpp.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-cpp-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/cpp.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-elisp-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/elisp.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-elisp-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/elisp.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-elixir-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/elixir.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-elixir-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/elixir.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-go-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/go.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-go-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/go.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-java-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/java.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-java-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/java.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-javascript-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/javascript.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-javascript-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/javascript.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ocaml-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/ocaml.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ocaml-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/ocaml.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-php-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/php.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-php-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/php.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-python-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/python.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-python-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/python.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ql-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/ql.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ql-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/ql.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ruby-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/ruby.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-ruby-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/ruby.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-rust-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/rust.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-rust-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/rust.scm diff --git a/extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-typescript-tags.scm b/extensions/vscode/tree-sitter/code-snippet-queries/typescript.scm similarity index 100% rename from extensions/vscode/tree-sitter/code-snippet-queries/tree-sitter-typescript-tags.scm rename to extensions/vscode/tree-sitter/code-snippet-queries/typescript.scm diff --git a/extensions/vscode/tree-sitter/import-queries/typescript.scm b/extensions/vscode/tree-sitter/import-queries/typescript.scm new file mode 100644 index 000000000..19a4d024a --- /dev/null +++ b/extensions/vscode/tree-sitter/import-queries/typescript.scm @@ -0,0 +1,9 @@ +(import_statement + (import_clause + (named_imports + (import_specifier + (identifier) @import)))) + +(import_statement + (import_clause + (identifier) @import )) \ No newline at end of file diff --git a/gui/src/context/IdeMessenger.ts b/gui/src/context/IdeMessenger.ts index 81d2201f9..7534d59b6 100644 --- a/gui/src/context/IdeMessenger.ts +++ b/gui/src/context/IdeMessenger.ts @@ -54,7 +54,7 @@ export class IdeMessenger implements IIdeMessenger { ide: IDE; constructor() { - this.ide = new MessageIde(this.request.bind(this)); + this.ide = new MessageIde(this.request.bind(this), () => {}); } private _postToIde(messageType: string, data: any, messageId?: string) { From 18c935eb852c958615c9db1c8281d4bb3eb5afd6 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 15:55:14 -0700 Subject: [PATCH 019/252] =?UTF-8?q?=F0=9F=90=9B=20fix=20regression=20in=20?= =?UTF-8?q?/edit=20slash=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/commands/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/commands/util.ts b/core/commands/util.ts index e0a6eca33..207b6c5ec 100644 --- a/core/commands/util.ts +++ b/core/commands/util.ts @@ -15,7 +15,7 @@ export function contextItemToRangeInFileWithContents( const lines = item.name.split("(")[1].split(")")[0].split("-"); const rif: RangeInFileWithContents = { - filepath: item.description.split(" (")[0], + filepath: item.id.itemId, range: { start: { line: Number.parseInt(lines[0]), From 37355ec1db07e7fca51b65944289f0b91a6ffffd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 21:59:38 -0700 Subject: [PATCH 020/252] organize autocomplete folder --- .../services/BracketMatchingService.ts | 134 +++++++ .../services/ImportDefinitionsService.ts | 81 ++++ .../services/NearbyDefinitionsService.ts | 45 +++ .../streamTransforms/charStream.ts | 41 ++ .../streamTransforms/lineStream.ts | 349 ++++++++++++++++++ 5 files changed, 650 insertions(+) create mode 100644 core/autocomplete/services/BracketMatchingService.ts create mode 100644 core/autocomplete/services/ImportDefinitionsService.ts create mode 100644 core/autocomplete/services/NearbyDefinitionsService.ts create mode 100644 core/autocomplete/streamTransforms/charStream.ts create mode 100644 core/autocomplete/streamTransforms/lineStream.ts diff --git a/core/autocomplete/services/BracketMatchingService.ts b/core/autocomplete/services/BracketMatchingService.ts new file mode 100644 index 000000000..63afdfd10 --- /dev/null +++ b/core/autocomplete/services/BracketMatchingService.ts @@ -0,0 +1,134 @@ +/** + * We follow the policy of only completing bracket pairs that we started + * But sometimes we started the pair in a previous autocomplete suggestion + */ +export class BracketMatchingService { + private openingBracketsFromLastCompletion: string[] = []; + private lastCompletionFile: string | undefined = undefined; + + static BRACKETS: { [key: string]: string } = { "(": ")", "{": "}", "[": "]" }; + static BRACKETS_REVERSE: { [key: string]: string } = { + ")": "(", + "}": "{", + "]": "[", + }; + + handleAcceptedCompletion(completion: string, filepath: string) { + this.openingBracketsFromLastCompletion = []; + const stack: string[] = []; + + for (let i = 0; i < completion.length; i++) { + const char = completion[i]; + if (Object.keys(BracketMatchingService.BRACKETS).includes(char)) { + // It's an opening bracket + stack.push(char); + } else if ( + Object.values(BracketMatchingService.BRACKETS).includes(char) + ) { + // It's a closing bracket + if ( + stack.length === 0 || + BracketMatchingService.BRACKETS[stack.pop()!] !== char + ) { + break; + } + } + } + + // Any remaining opening brackets in the stack are uncompleted + this.openingBracketsFromLastCompletion = stack; + this.lastCompletionFile = filepath; + } + + async *stopOnUnmatchedClosingBracket( + stream: AsyncGenerator, + prefix: string, + suffix: string, + filepath: string, + multiline: boolean, // Whether this is a multiline completion or not + ): AsyncGenerator { + let stack: string[] = []; + if (multiline) { + // Add opening brackets from the previous response + if (this.lastCompletionFile === filepath) { + stack = [...this.openingBracketsFromLastCompletion]; + } else { + this.lastCompletionFile = undefined; + } + } else { + // If single line completion, then allow completing bracket pairs that are + // started on the current line but not finished on the current line + if (!multiline) { + const currentLine = + (prefix.split("\n").pop() ?? "") + (suffix.split("\n")[0] ?? ""); + for (let i = 0; i < currentLine.length; i++) { + const char = currentLine[i]; + if (Object.keys(BracketMatchingService.BRACKETS).includes(char)) { + // It's an opening bracket + stack.push(char); + } else if ( + Object.values(BracketMatchingService.BRACKETS).includes(char) + ) { + // It's a closing bracket + if ( + stack.length === 0 || + BracketMatchingService.BRACKETS[stack.pop()!] !== char + ) { + break; + } + } + } + } + } + + // Add corresponding open brackets from suffix to stack + // because we overwrite them and the diff is displayed, and this allows something to be edited after that + for (let i = 0; i < suffix.length; i++) { + if (suffix[i] === " ") continue; + const openBracket = BracketMatchingService.BRACKETS_REVERSE[suffix[i]]; + if (!openBracket) break; + stack.unshift(openBracket); + } + + let all = ""; + let seenNonWhitespaceOrClosingBracket = false; + for await (let chunk of stream) { + // Allow closing brackets before any non-whitespace characters + if (!seenNonWhitespaceOrClosingBracket) { + const firstNonWhitespaceOrClosingBracketIndex = + chunk.search(/[^\s\)\}\]]/); + if (firstNonWhitespaceOrClosingBracketIndex !== -1) { + yield chunk.slice(0, firstNonWhitespaceOrClosingBracketIndex); + chunk = chunk.slice(firstNonWhitespaceOrClosingBracketIndex); + seenNonWhitespaceOrClosingBracket = true; + } else { + yield chunk; + continue; + } + } + + all += chunk; + const allLines = all.split("\n"); + for (let i = 0; i < chunk.length; i++) { + const char = chunk[i]; + if (Object.values(BracketMatchingService.BRACKETS).includes(char)) { + // It's a closing bracket + if ( + stack.length === 0 || + BracketMatchingService.BRACKETS[stack.pop()!] !== char + ) { + // If the stack is empty or the top of the stack doesn't match the current closing bracket + yield chunk.slice(0, i); + return; // Stop the generator if the closing bracket doesn't have a matching opening bracket in the stream + } + } else if ( + Object.keys(BracketMatchingService.BRACKETS).includes(char) + ) { + // It's an opening bracket + stack.push(char); + } + } + yield chunk; + } + } +} diff --git a/core/autocomplete/services/ImportDefinitionsService.ts b/core/autocomplete/services/ImportDefinitionsService.ts new file mode 100644 index 000000000..19287bf81 --- /dev/null +++ b/core/autocomplete/services/ImportDefinitionsService.ts @@ -0,0 +1,81 @@ +import { IDE } from ".."; +import { RangeInFileWithContents } from "../commands/util"; +import { PrecalculatedLruCache } from "../util/LruCache"; +import { + TSQueryType, + getParserForFile, + getQueryForFile, +} from "../util/treeSitter"; + +interface FileInfo { + imports: { [key: string]: RangeInFileWithContents[] }; +} + +export class ImportDefinitionsService { + static N = 10; + + private cache: PrecalculatedLruCache = + new PrecalculatedLruCache( + this._getFileInfo.bind(this), + ImportDefinitionsService.N, + ); + + constructor(private readonly ide: IDE) { + ide.onDidChangeActiveTextEditor((filepath) => { + this.cache.initKey(filepath); + }); + } + + get(filepath: string): FileInfo | undefined { + return this.cache.get(filepath); + } + + private async _getFileInfo(filepath: string): Promise { + const parser = await getParserForFile(filepath); + if (!parser) { + return { + imports: {}, + }; + } + const ast = parser.parse(await this.ide.readFile(filepath), undefined, { + includedRanges: [ + { + startIndex: 0, + endIndex: 10_000, + startPosition: { row: 0, column: 0 }, + endPosition: { row: 100, column: 0 }, + }, + ], + }); + const query = await getQueryForFile(filepath, TSQueryType.Imports); + if (!query) { + return { + imports: {}, + }; + } + + const matches = query?.matches(ast.rootNode); + + const fileInfo: FileInfo = { + imports: {}, + }; + for (const match of matches) { + const startPosition = match.captures[0].node.startPosition; + const defs = await this.ide.gotoDefinition({ + filepath, + position: { + line: startPosition.row, + character: startPosition.column, + }, + }); + fileInfo.imports[match.captures[0].node.text] = await Promise.all( + defs.map(async (def) => ({ + ...def, + contents: await this.ide.readRangeInFile(def.filepath, def.range), + })), + ); + } + + return fileInfo; + } +} diff --git a/core/autocomplete/services/NearbyDefinitionsService.ts b/core/autocomplete/services/NearbyDefinitionsService.ts new file mode 100644 index 000000000..12d6f7947 --- /dev/null +++ b/core/autocomplete/services/NearbyDefinitionsService.ts @@ -0,0 +1,45 @@ +import { IDE, Location } from "../.."; +import { LANGUAGES } from "../languages"; +import { getSymbolsForSnippet } from "../ranking"; + +interface FileInfo { + filepath: string; +} + +export class NearbyDefinitionsService { + static N = 10; + + constructor(private readonly ide: IDE) {} + + async getDefinitionsForLine(filepath: string, line: number) { + const lineContent = await this.ide.readRangeInFile(filepath, { + start: { + line, + character: 0, + }, + end: { + line: line + 1, + character: 0, + }, + }); + + // Remove keywords + const lang = LANGUAGES[filepath.split(".").slice(-1)[0]]; + const symbols = Array.from(getSymbolsForSnippet(lineContent)) + .filter((s) => s.length > 0) + .filter((s) => !(lang && lang?.stopWords?.includes(s))); + + return Promise.all( + symbols.map((s) => { + const character = lineContent.indexOf(s); + const pos: Location = { + filepath, + position: { + line, + character, + }, + }; + }), + ); + } +} diff --git a/core/autocomplete/streamTransforms/charStream.ts b/core/autocomplete/streamTransforms/charStream.ts new file mode 100644 index 000000000..39a1c6729 --- /dev/null +++ b/core/autocomplete/streamTransforms/charStream.ts @@ -0,0 +1,41 @@ +export async function* onlyWhitespaceAfterEndOfLine( + stream: AsyncGenerator, + endOfLine: string[], + fullStop: () => void, +): AsyncGenerator { + let pending = ""; + for await (let chunk of stream) { + chunk = pending + chunk; + pending = ""; + for (let i = 0; i < chunk.length - 1; i++) { + if ( + endOfLine.includes(chunk[i]) && + chunk[i + 1].trim() === chunk[i + 1] + ) { + yield chunk.slice(0, i + 1); + fullStop(); + return; + } + } + if (endOfLine.includes(chunk[chunk.length - 1])) { + pending = chunk[chunk.length - 1]; + yield chunk.slice(0, chunk.length - 1); + } else { + yield chunk; + } + } + yield pending; +} + +export async function* noFirstCharNewline(stream: AsyncGenerator) { + let first = true; + for await (const char of stream) { + if (first) { + first = false; + if (char.startsWith("\n") || char.startsWith("\r")) { + return; + } + } + yield char; + } +} diff --git a/core/autocomplete/streamTransforms/lineStream.ts b/core/autocomplete/streamTransforms/lineStream.ts new file mode 100644 index 000000000..268801994 --- /dev/null +++ b/core/autocomplete/streamTransforms/lineStream.ts @@ -0,0 +1,349 @@ +import { distance } from "fastest-levenshtein"; +import { LineStream } from "../../diff/util.js"; +import { DiffLine } from "../../index.js"; + +export type LineFilter = (args: { + lines: LineStream; + fullStop: () => void; +}) => LineStream; + +export async function* noTopLevelKeywordsMidline( + lines: LineStream, + topLevelKeywords: string[], + fullStop: () => void, +): LineStream { + for await (const line of lines) { + for (const keyword of topLevelKeywords) { + const indexOf = line.indexOf(`${keyword} `); + if (indexOf >= 0 && line.slice(indexOf - 1, indexOf).trim() !== "") { + yield line.slice(0, indexOf); + fullStop(); + break; + } + } + yield line; + } +} + +export async function* avoidPathLine( + stream: LineStream, + comment: string, +): LineStream { + // Snippets are inserted as comments with a line at the start '// Path: '. + // Sometimes the model with copy this pattern, which is unwanted + for await (const line of stream) { + // Also filter lines that are empty comments + if (line.startsWith(`${comment} Path: `) || line.trim() === comment) { + continue; + } + yield line; + } +} + +export async function* streamWithNewLines(stream: LineStream): LineStream { + let firstLine = true; + for await (const nextLine of stream) { + if (!firstLine) { + yield "\n"; + } + firstLine = false; + yield nextLine; + } +} + +const bracketEnding = [")", "]", "}", ";"]; +function isBracketEnding(line: string): boolean { + return line + .trim() + .split("") + .some((char) => bracketEnding.includes(char)); +} + +function commonPrefixLength(a: string, b: string): number { + let i = 0; + while (i < a.length && i < b.length && a[i] === b[i]) { + i++; + } + return i; +} + +export function lineIsRepeated(a: string, b: string): boolean { + if (a.length <= 4 || b.length <= 4) { + return false; + } + + const aTrim = a.trim(); + const bTrim = b.trim(); + return ( + commonPrefixLength(aTrim, bTrim) > 12 || + distance(aTrim, bTrim) / bTrim.length < 0.1 + ); +} + +export async function* stopAtSimilarLine( + stream: LineStream, + line: string, + fullStop: () => void, +): AsyncGenerator { + const trimmedLine = line.trim(); + const lineIsBracketEnding = isBracketEnding(trimmedLine); + for await (const nextLine of stream) { + if (nextLine === line) { + fullStop(); + break; + } + + if (lineIsBracketEnding && trimmedLine.trim() === nextLine.trim()) { + yield nextLine; + continue; + } + + if (lineIsRepeated(nextLine, trimmedLine)) { + fullStop(); + break; + } + yield nextLine; + } +} + +const LINES_TO_STOP_AT = ["# End of file.", " void, +): LineStream { + for await (const line of stream) { + if (LINES_TO_STOP_AT.some((stopAt) => line.trim().includes(stopAt))) { + fullStop(); + break; + } + yield line; + } +} + +const PREFIXES_TO_SKIP = [""]; +export async function* skipPrefixes(lines: LineStream): LineStream { + let isFirstLine = true; + for await (const line of lines) { + if (isFirstLine) { + const match = PREFIXES_TO_SKIP.find((prefix) => line.startsWith(prefix)); + if (match) { + yield line.slice(match.length); + continue; + } + isFirstLine = false; + } + yield line; + } +} + +const LINES_TO_SKIP = [""]; + +export async function* skipLines(stream: LineStream): LineStream { + for await (const line of stream) { + if (!LINES_TO_SKIP.some((skipAt) => line.startsWith(skipAt))) { + yield line; + } + } +} + +const LINES_TO_REMOVE_BEFORE_START = [ + "", + "[CODE]", + "", +]; + +function shouldRemoveLineBeforeStart(line: string): boolean { + return ( + line.trimStart().startsWith("```") || + LINES_TO_REMOVE_BEFORE_START.some((l) => line.trim() === l) + ); +} + +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; + } + 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.startsWith("```")) { + 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("here's") || + line.startsWith("sure, here") || + line.startsWith("sure thing") || + line.startsWith("sure!") || + line.startsWith("to fill") || + line.startsWith("certainly") || + line.startsWith("of course") || + line.startsWith("the code should") + ) { + return true; + } + + return false; +} + +export async function* filterEnglishLinesAtStart(lines: LineStream) { + let i = 0; + let wasEnglishFirstLine = false; + for await (const line of lines) { + if (i === 0 && line.trim() === "") { + continue; + } + 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 (const 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 (const 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 (const diffLine of diffLines) { + const 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; + } + } +} + +export async function* stopAtRepeatingLines( + lines: LineStream, + fullStop: () => void, +): LineStream { + const repeatedLines: string[] = []; + for await (const line of lines) { + if (repeatedLines.length === 0) { + repeatedLines.push(line); + } else if (repeatedLines.length < 3) { + if (repeatedLines[repeatedLines.length - 1] === line) { + repeatedLines.push(line); + } else { + while (repeatedLines.length > 0) { + yield repeatedLines.shift()!; + } + yield line; + } + } else { + yield repeatedLines[0]; + fullStop(); + return; + } + } + + while (repeatedLines.length > 0) { + yield repeatedLines.shift()!; + } +} From cf362627384e7f7ea6dcb48a4fe461f17daace52 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 21 Jun 2024 21:59:46 -0700 Subject: [PATCH 021/252] organize autocomplete folder --- core/autocomplete/ImportDefinitionsService.ts | 81 ---- core/autocomplete/NearbyDefinitionsService.ts | 45 --- core/autocomplete/brackets.ts | 134 ------- core/autocomplete/charStream.ts | 41 -- core/autocomplete/completionProvider.ts | 20 +- core/autocomplete/constructPrompt.ts | 2 +- core/autocomplete/languages.ts | 2 +- core/autocomplete/lineStream.ts | 349 ------------------ core/autocomplete/postprocessing.ts | 2 +- core/commands/slash/edit.ts | 4 +- core/util/verticalEdit.ts | 2 +- 11 files changed, 16 insertions(+), 666 deletions(-) delete mode 100644 core/autocomplete/ImportDefinitionsService.ts delete mode 100644 core/autocomplete/NearbyDefinitionsService.ts delete mode 100644 core/autocomplete/brackets.ts delete mode 100644 core/autocomplete/charStream.ts delete mode 100644 core/autocomplete/lineStream.ts diff --git a/core/autocomplete/ImportDefinitionsService.ts b/core/autocomplete/ImportDefinitionsService.ts deleted file mode 100644 index 19287bf81..000000000 --- a/core/autocomplete/ImportDefinitionsService.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { IDE } from ".."; -import { RangeInFileWithContents } from "../commands/util"; -import { PrecalculatedLruCache } from "../util/LruCache"; -import { - TSQueryType, - getParserForFile, - getQueryForFile, -} from "../util/treeSitter"; - -interface FileInfo { - imports: { [key: string]: RangeInFileWithContents[] }; -} - -export class ImportDefinitionsService { - static N = 10; - - private cache: PrecalculatedLruCache = - new PrecalculatedLruCache( - this._getFileInfo.bind(this), - ImportDefinitionsService.N, - ); - - constructor(private readonly ide: IDE) { - ide.onDidChangeActiveTextEditor((filepath) => { - this.cache.initKey(filepath); - }); - } - - get(filepath: string): FileInfo | undefined { - return this.cache.get(filepath); - } - - private async _getFileInfo(filepath: string): Promise { - const parser = await getParserForFile(filepath); - if (!parser) { - return { - imports: {}, - }; - } - const ast = parser.parse(await this.ide.readFile(filepath), undefined, { - includedRanges: [ - { - startIndex: 0, - endIndex: 10_000, - startPosition: { row: 0, column: 0 }, - endPosition: { row: 100, column: 0 }, - }, - ], - }); - const query = await getQueryForFile(filepath, TSQueryType.Imports); - if (!query) { - return { - imports: {}, - }; - } - - const matches = query?.matches(ast.rootNode); - - const fileInfo: FileInfo = { - imports: {}, - }; - for (const match of matches) { - const startPosition = match.captures[0].node.startPosition; - const defs = await this.ide.gotoDefinition({ - filepath, - position: { - line: startPosition.row, - character: startPosition.column, - }, - }); - fileInfo.imports[match.captures[0].node.text] = await Promise.all( - defs.map(async (def) => ({ - ...def, - contents: await this.ide.readRangeInFile(def.filepath, def.range), - })), - ); - } - - return fileInfo; - } -} diff --git a/core/autocomplete/NearbyDefinitionsService.ts b/core/autocomplete/NearbyDefinitionsService.ts deleted file mode 100644 index 79cd0af0a..000000000 --- a/core/autocomplete/NearbyDefinitionsService.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { IDE, Location } from ".."; -import { LANGUAGES } from "./languages"; -import { getSymbolsForSnippet } from "./ranking"; - -interface FileInfo { - filepath: string; -} - -export class NearbyDefinitionsService { - static N = 10; - - constructor(private readonly ide: IDE) {} - - async getDefinitionsForLine(filepath: string, line: number) { - const lineContent = await this.ide.readRangeInFile(filepath, { - start: { - line, - character: 0, - }, - end: { - line: line + 1, - character: 0, - }, - }); - - // Remove keywords - const lang = LANGUAGES[filepath.split(".").slice(-1)[0]]; - const symbols = Array.from(getSymbolsForSnippet(lineContent)) - .filter((s) => s.length > 0) - .filter((s) => !(lang && lang?.stopWords?.includes(s))); - - return Promise.all( - symbols.map((s) => { - const character = lineContent.indexOf(s); - const pos: Location = { - filepath, - position: { - line, - character, - }, - }; - }), - ); - } -} diff --git a/core/autocomplete/brackets.ts b/core/autocomplete/brackets.ts deleted file mode 100644 index 63afdfd10..000000000 --- a/core/autocomplete/brackets.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * We follow the policy of only completing bracket pairs that we started - * But sometimes we started the pair in a previous autocomplete suggestion - */ -export class BracketMatchingService { - private openingBracketsFromLastCompletion: string[] = []; - private lastCompletionFile: string | undefined = undefined; - - static BRACKETS: { [key: string]: string } = { "(": ")", "{": "}", "[": "]" }; - static BRACKETS_REVERSE: { [key: string]: string } = { - ")": "(", - "}": "{", - "]": "[", - }; - - handleAcceptedCompletion(completion: string, filepath: string) { - this.openingBracketsFromLastCompletion = []; - const stack: string[] = []; - - for (let i = 0; i < completion.length; i++) { - const char = completion[i]; - if (Object.keys(BracketMatchingService.BRACKETS).includes(char)) { - // It's an opening bracket - stack.push(char); - } else if ( - Object.values(BracketMatchingService.BRACKETS).includes(char) - ) { - // It's a closing bracket - if ( - stack.length === 0 || - BracketMatchingService.BRACKETS[stack.pop()!] !== char - ) { - break; - } - } - } - - // Any remaining opening brackets in the stack are uncompleted - this.openingBracketsFromLastCompletion = stack; - this.lastCompletionFile = filepath; - } - - async *stopOnUnmatchedClosingBracket( - stream: AsyncGenerator, - prefix: string, - suffix: string, - filepath: string, - multiline: boolean, // Whether this is a multiline completion or not - ): AsyncGenerator { - let stack: string[] = []; - if (multiline) { - // Add opening brackets from the previous response - if (this.lastCompletionFile === filepath) { - stack = [...this.openingBracketsFromLastCompletion]; - } else { - this.lastCompletionFile = undefined; - } - } else { - // If single line completion, then allow completing bracket pairs that are - // started on the current line but not finished on the current line - if (!multiline) { - const currentLine = - (prefix.split("\n").pop() ?? "") + (suffix.split("\n")[0] ?? ""); - for (let i = 0; i < currentLine.length; i++) { - const char = currentLine[i]; - if (Object.keys(BracketMatchingService.BRACKETS).includes(char)) { - // It's an opening bracket - stack.push(char); - } else if ( - Object.values(BracketMatchingService.BRACKETS).includes(char) - ) { - // It's a closing bracket - if ( - stack.length === 0 || - BracketMatchingService.BRACKETS[stack.pop()!] !== char - ) { - break; - } - } - } - } - } - - // Add corresponding open brackets from suffix to stack - // because we overwrite them and the diff is displayed, and this allows something to be edited after that - for (let i = 0; i < suffix.length; i++) { - if (suffix[i] === " ") continue; - const openBracket = BracketMatchingService.BRACKETS_REVERSE[suffix[i]]; - if (!openBracket) break; - stack.unshift(openBracket); - } - - let all = ""; - let seenNonWhitespaceOrClosingBracket = false; - for await (let chunk of stream) { - // Allow closing brackets before any non-whitespace characters - if (!seenNonWhitespaceOrClosingBracket) { - const firstNonWhitespaceOrClosingBracketIndex = - chunk.search(/[^\s\)\}\]]/); - if (firstNonWhitespaceOrClosingBracketIndex !== -1) { - yield chunk.slice(0, firstNonWhitespaceOrClosingBracketIndex); - chunk = chunk.slice(firstNonWhitespaceOrClosingBracketIndex); - seenNonWhitespaceOrClosingBracket = true; - } else { - yield chunk; - continue; - } - } - - all += chunk; - const allLines = all.split("\n"); - for (let i = 0; i < chunk.length; i++) { - const char = chunk[i]; - if (Object.values(BracketMatchingService.BRACKETS).includes(char)) { - // It's a closing bracket - if ( - stack.length === 0 || - BracketMatchingService.BRACKETS[stack.pop()!] !== char - ) { - // If the stack is empty or the top of the stack doesn't match the current closing bracket - yield chunk.slice(0, i); - return; // Stop the generator if the closing bracket doesn't have a matching opening bracket in the stream - } - } else if ( - Object.keys(BracketMatchingService.BRACKETS).includes(char) - ) { - // It's an opening bracket - stack.push(char); - } - } - yield chunk; - } - } -} diff --git a/core/autocomplete/charStream.ts b/core/autocomplete/charStream.ts deleted file mode 100644 index 39a1c6729..000000000 --- a/core/autocomplete/charStream.ts +++ /dev/null @@ -1,41 +0,0 @@ -export async function* onlyWhitespaceAfterEndOfLine( - stream: AsyncGenerator, - endOfLine: string[], - fullStop: () => void, -): AsyncGenerator { - let pending = ""; - for await (let chunk of stream) { - chunk = pending + chunk; - pending = ""; - for (let i = 0; i < chunk.length - 1; i++) { - if ( - endOfLine.includes(chunk[i]) && - chunk[i + 1].trim() === chunk[i + 1] - ) { - yield chunk.slice(0, i + 1); - fullStop(); - return; - } - } - if (endOfLine.includes(chunk[chunk.length - 1])) { - pending = chunk[chunk.length - 1]; - yield chunk.slice(0, chunk.length - 1); - } else { - yield chunk; - } - } - yield pending; -} - -export async function* noFirstCharNewline(stream: AsyncGenerator) { - let first = true; - for await (const char of stream) { - if (first) { - first = false; - if (char.startsWith("\n") || char.startsWith("\r")) { - return; - } - } - yield char; - } -} diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index f1cdfb165..260535d4b 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -22,19 +22,22 @@ import { } from "../util/parameters.js"; import { Telemetry } from "../util/posthog.js"; import { getRangeInString } from "../util/ranges.js"; -import { ImportDefinitionsService } from "./ImportDefinitionsService.js"; -import { BracketMatchingService } from "./brackets.js"; import AutocompleteLruCache from "./cache.js"; -import { - noFirstCharNewline, - onlyWhitespaceAfterEndOfLine, -} from "./charStream.js"; import { constructAutocompletePrompt, languageForFilepath, } from "./constructPrompt.js"; import { isOnlyPunctuationAndWhitespace } from "./filter.js"; import { AutocompleteLanguageInfo } from "./languages.js"; +import { postprocessCompletion } from "./postprocessing.js"; +import { AutocompleteSnippet } from "./ranking.js"; +import { RecentlyEditedRange } from "./recentlyEdited.js"; +import { BracketMatchingService } from "./services/BracketMatchingService.js"; +import { ImportDefinitionsService } from "./services/ImportDefinitionsService.js"; +import { + noFirstCharNewline, + onlyWhitespaceAfterEndOfLine, +} from "./streamTransforms/charStream.js"; import { avoidPathLine, noTopLevelKeywordsMidline, @@ -43,10 +46,7 @@ import { stopAtRepeatingLines, stopAtSimilarLine, streamWithNewLines, -} from "./lineStream.js"; -import { postprocessCompletion } from "./postprocessing.js"; -import { AutocompleteSnippet } from "./ranking.js"; -import { RecentlyEditedRange } from "./recentlyEdited.js"; +} from "./streamTransforms/lineStream.js"; import { getTemplateForModel } from "./templates.js"; import { GeneratorReuseManager } from "./util.js"; diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 78770a0d5..7e63375bb 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -7,7 +7,6 @@ import { pruneLinesFromBottom, pruneLinesFromTop, } from "../llm/countTokens.js"; -import { ImportDefinitionsService } from "./ImportDefinitionsService.js"; import { getAst, getTreePathAtCursor } from "./ast.js"; import { AutocompleteLanguageInfo, @@ -22,6 +21,7 @@ import { type AutocompleteSnippet, } from "./ranking.js"; import { RecentlyEditedRange, findMatchingRange } from "./recentlyEdited.js"; +import { ImportDefinitionsService } from "./services/ImportDefinitionsService.js"; export function languageForFilepath( filepath: string, diff --git a/core/autocomplete/languages.ts b/core/autocomplete/languages.ts index 3360c3a9b..0ab63e716 100644 --- a/core/autocomplete/languages.ts +++ b/core/autocomplete/languages.ts @@ -1,4 +1,4 @@ -import type { LineFilter } from "./lineStream"; +import type { LineFilter } from "./streamTransforms/lineStream"; export interface AutocompleteLanguageInfo { topLevelKeywords: string[]; diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts deleted file mode 100644 index 674f0d46e..000000000 --- a/core/autocomplete/lineStream.ts +++ /dev/null @@ -1,349 +0,0 @@ -import { distance } from "fastest-levenshtein"; -import { LineStream } from "../diff/util.js"; -import { DiffLine } from "../index.js"; - -export type LineFilter = (args: { - lines: LineStream; - fullStop: () => void; -}) => LineStream; - -export async function* noTopLevelKeywordsMidline( - lines: LineStream, - topLevelKeywords: string[], - fullStop: () => void, -): LineStream { - for await (const line of lines) { - for (const keyword of topLevelKeywords) { - const indexOf = line.indexOf(`${keyword} `); - if (indexOf >= 0 && line.slice(indexOf - 1, indexOf).trim() !== "") { - yield line.slice(0, indexOf); - fullStop(); - break; - } - } - yield line; - } -} - -export async function* avoidPathLine( - stream: LineStream, - comment: string, -): LineStream { - // Snippets are inserted as comments with a line at the start '// Path: '. - // Sometimes the model with copy this pattern, which is unwanted - for await (const line of stream) { - // Also filter lines that are empty comments - if (line.startsWith(`${comment} Path: `) || line.trim() === comment) { - continue; - } - yield line; - } -} - -export async function* streamWithNewLines(stream: LineStream): LineStream { - let firstLine = true; - for await (const nextLine of stream) { - if (!firstLine) { - yield "\n"; - } - firstLine = false; - yield nextLine; - } -} - -const bracketEnding = [")", "]", "}", ";"]; -function isBracketEnding(line: string): boolean { - return line - .trim() - .split("") - .some((char) => bracketEnding.includes(char)); -} - -function commonPrefixLength(a: string, b: string): number { - let i = 0; - while (i < a.length && i < b.length && a[i] === b[i]) { - i++; - } - return i; -} - -export function lineIsRepeated(a: string, b: string): boolean { - if (a.length <= 4 || b.length <= 4) { - return false; - } - - const aTrim = a.trim(); - const bTrim = b.trim(); - return ( - commonPrefixLength(aTrim, bTrim) > 12 || - distance(aTrim, bTrim) / bTrim.length < 0.1 - ); -} - -export async function* stopAtSimilarLine( - stream: LineStream, - line: string, - fullStop: () => void, -): AsyncGenerator { - const trimmedLine = line.trim(); - const lineIsBracketEnding = isBracketEnding(trimmedLine); - for await (const nextLine of stream) { - if (nextLine === line) { - fullStop(); - break; - } - - if (lineIsBracketEnding && trimmedLine.trim() === nextLine.trim()) { - yield nextLine; - continue; - } - - if (lineIsRepeated(nextLine, trimmedLine)) { - fullStop(); - break; - } - yield nextLine; - } -} - -const LINES_TO_STOP_AT = ["# End of file.", " void, -): LineStream { - for await (const line of stream) { - if (LINES_TO_STOP_AT.some((stopAt) => line.trim().includes(stopAt))) { - fullStop(); - break; - } - yield line; - } -} - -const PREFIXES_TO_SKIP = [""]; -export async function* skipPrefixes(lines: LineStream): LineStream { - let isFirstLine = true; - for await (const line of lines) { - if (isFirstLine) { - const match = PREFIXES_TO_SKIP.find((prefix) => line.startsWith(prefix)); - if (match) { - yield line.slice(match.length); - continue; - } - isFirstLine = false; - } - yield line; - } -} - -const LINES_TO_SKIP = [""]; - -export async function* skipLines(stream: LineStream): LineStream { - for await (const line of stream) { - if (!LINES_TO_SKIP.some((skipAt) => line.startsWith(skipAt))) { - yield line; - } - } -} - -const LINES_TO_REMOVE_BEFORE_START = [ - "", - "[CODE]", - "", -]; - -function shouldRemoveLineBeforeStart(line: string): boolean { - return ( - line.trimStart().startsWith("```") || - LINES_TO_REMOVE_BEFORE_START.some((l) => line.trim() === l) - ); -} - -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; - } - 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.startsWith("```")) { - 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("here's") || - line.startsWith("sure, here") || - line.startsWith("sure thing") || - line.startsWith("sure!") || - line.startsWith("to fill") || - line.startsWith("certainly") || - line.startsWith("of course") || - line.startsWith("the code should") - ) { - return true; - } - - return false; -} - -export async function* filterEnglishLinesAtStart(lines: LineStream) { - let i = 0; - let wasEnglishFirstLine = false; - for await (const line of lines) { - if (i === 0 && line.trim() === "") { - continue; - } - 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 (const 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 (const 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 (const diffLine of diffLines) { - const 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; - } - } -} - -export async function* stopAtRepeatingLines( - lines: LineStream, - fullStop: () => void, -): LineStream { - const repeatedLines: string[] = []; - for await (const line of lines) { - if (repeatedLines.length === 0) { - repeatedLines.push(line); - } else if (repeatedLines.length < 3) { - if (repeatedLines[repeatedLines.length - 1] === line) { - repeatedLines.push(line); - } else { - while (repeatedLines.length > 0) { - yield repeatedLines.shift()!; - } - yield line; - } - } else { - yield repeatedLines[0]; - fullStop(); - return; - } - } - - while (repeatedLines.length > 0) { - yield repeatedLines.shift()!; - } -} diff --git a/core/autocomplete/postprocessing.ts b/core/autocomplete/postprocessing.ts index 724c826f2..b6841aebc 100644 --- a/core/autocomplete/postprocessing.ts +++ b/core/autocomplete/postprocessing.ts @@ -1,6 +1,6 @@ import type { ILLM } from ".."; import { longestCommonSubsequence } from "../util/lcs"; -import { lineIsRepeated } from "./lineStream"; +import { lineIsRepeated } from "./streamTransforms/lineStream"; function rewritesLineAbove(completion: string, prefix: string): boolean { const lineAbove = prefix diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index af64b0933..a87ebea6e 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -5,7 +5,7 @@ import { fixCodeLlamaFirstLineIndentation, stopAtLines, streamWithNewLines, -} from "../../autocomplete/lineStream.js"; +} from "../../autocomplete/streamTransforms/lineStream.js"; import { streamLines } from "../../diff/util.js"; import { ContextItemWithId, ILLM, SlashCommand } from "../../index.js"; import { stripImages } from "../../llm/countTokens.js"; @@ -252,7 +252,7 @@ const EditSlashCommand: SlashCommand = { ); // if the above replace fails to find a match, the code will still be present // in the userInput. Replace it with input if available. - if (userInput.includes("\`\`\`") && (input !== "" || !input)) { + if (userInput.includes("```") && (input !== "" || !input)) { userInput = input; } diff --git a/core/util/verticalEdit.ts b/core/util/verticalEdit.ts index e018d1be4..913c38ddc 100644 --- a/core/util/verticalEdit.ts +++ b/core/util/verticalEdit.ts @@ -5,7 +5,7 @@ import { filterLeadingAndTrailingNewLineInsertion, skipLines, stopAtLines, -} from "../autocomplete/lineStream.js"; +} from "../autocomplete/streamTransforms/lineStream.js"; import { streamDiff } from "../diff/streamDiff.js"; import { streamLines } from "../diff/util.js"; import { From faffaf08c4081dca4653c3efbe8910bd4b5c6654 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 23 Jun 2024 10:08:50 -0700 Subject: [PATCH 022/252] working implementation with single ts query --- core/autocomplete/ast.ts | 4 +- core/autocomplete/completionProvider.ts | 7 ++ core/autocomplete/constructPrompt.ts | 42 ++++--- .../services/HierarchicalContextService.ts | 116 ++++++++++++++++++ .../services/ImportDefinitionsService.ts | 8 +- core/index.d.ts | 1 + core/package-lock.json | 21 +++- core/package.json | 1 + core/util/parameters.ts | 1 + core/util/treeSitter.ts | 2 + extensions/vscode/package-lock.json | 1 + extensions/vscode/src/activation/api.ts | 4 +- extensions/vscode/src/diff/horizontal.ts | 2 +- .../function_declaration/typescript.scm | 9 ++ gui/package-lock.json | 1 + 15 files changed, 189 insertions(+), 31 deletions(-) create mode 100644 core/autocomplete/services/HierarchicalContextService.ts create mode 100644 extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm diff --git a/core/autocomplete/ast.ts b/core/autocomplete/ast.ts index 933ae76c0..139b22dbf 100644 --- a/core/autocomplete/ast.ts +++ b/core/autocomplete/ast.ts @@ -2,6 +2,8 @@ import Parser from "web-tree-sitter"; import { RangeInFileWithContents } from "../commands/util.js"; import { getParserForFile } from "../util/treeSitter.js"; +export type AstPath = Parser.SyntaxNode[]; + export async function getAst( filepath: string, fileContents: string, @@ -23,7 +25,7 @@ export async function getAst( export async function getTreePathAtCursor( ast: Parser.Tree, cursorIndex: number, -): Promise { +): Promise { const path = [ast.rootNode]; while (path[path.length - 1].childCount > 0) { let foundChild = false; diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 260535d4b..6a2c994a1 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -33,6 +33,7 @@ import { postprocessCompletion } from "./postprocessing.js"; import { AutocompleteSnippet } from "./ranking.js"; import { RecentlyEditedRange } from "./recentlyEdited.js"; import { BracketMatchingService } from "./services/BracketMatchingService.js"; +import { HierarchicalContextService } from "./services/HierarchicalContextService.js"; import { ImportDefinitionsService } from "./services/ImportDefinitionsService.js"; import { noFirstCharNewline, @@ -154,9 +155,14 @@ export class CompletionProvider { this.onError.bind(this), ); this.importDefinitionsService = new ImportDefinitionsService(this.ide); + this.hierarchicalContextService = new HierarchicalContextService( + this.importDefinitionsService, + this.ide, + ); } private importDefinitionsService: ImportDefinitionsService; + private hierarchicalContextService: HierarchicalContextService; private generatorReuseManager: GeneratorReuseManager; private autocompleteCache = AutocompleteLruCache.get(); public errorsShown: Set = new Set(); @@ -516,6 +522,7 @@ export class CompletionProvider { llm.model, extrasSnippets, this.importDefinitionsService, + this.hierarchicalContextService, ); // If prefix is manually passed diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 7e63375bb..3c633218d 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -1,4 +1,3 @@ -import Parser from "web-tree-sitter"; import { RangeInFileWithContents } from "../commands/util.js"; import { TabAutocompleteOptions } from "../index.js"; @@ -7,7 +6,7 @@ import { pruneLinesFromBottom, pruneLinesFromTop, } from "../llm/countTokens.js"; -import { getAst, getTreePathAtCursor } from "./ast.js"; +import { AstPath, getAst, getTreePathAtCursor } from "./ast.js"; import { AutocompleteLanguageInfo, LANGUAGES, @@ -21,6 +20,7 @@ import { type AutocompleteSnippet, } from "./ranking.js"; import { RecentlyEditedRange, findMatchingRange } from "./recentlyEdited.js"; +import { HierarchicalContextService } from "./services/HierarchicalContextService.js"; import { ImportDefinitionsService } from "./services/ImportDefinitionsService.js"; export function languageForFilepath( @@ -32,7 +32,7 @@ export function languageForFilepath( const BLOCK_TYPES = ["body", "statement_block"]; function shouldCompleteMultilineAst( - treePath: Parser.SyntaxNode[], + treePath: AstPath, cursorLine: number, ): boolean { // If at the base of the file, do multiline @@ -63,7 +63,7 @@ function isMidlineCompletion(prefix: string, suffix: string): boolean { } async function shouldCompleteMultiline( - filepath: string, + treePath: AstPath | undefined, fullPrefix: string, fullSuffix: string, language: AutocompleteLanguageInfo, @@ -94,18 +94,6 @@ async function shouldCompleteMultiline( } // Use AST to determine whether to complete multiline - let treePath: Parser.SyntaxNode[] | undefined; - try { - const ast = await getAst(filepath, fullPrefix + fullSuffix); - if (!ast) { - return true; - } - - treePath = await getTreePathAtCursor(ast, fullPrefix.length); - } catch (e) { - console.error("Failed to parse AST", e); - } - let completeMultiline = false; if (treePath) { const cursorLine = fullPrefix.split("\n").length - 1; @@ -127,6 +115,7 @@ export async function constructAutocompletePrompt( modelName: string, extraSnippets: AutocompleteSnippet[], importDefinitionsService: ImportDefinitionsService, + hierarchicalContextService: HierarchicalContextService, ): Promise<{ prefix: string; suffix: string; @@ -145,6 +134,17 @@ export async function constructAutocompletePrompt( ); const suffix = pruneLinesFromBottom(fullSuffix, maxSuffixTokens, modelName); + // Calculate AST Path + let treePath: AstPath | undefined; + try { + const ast = await getAst(filepath, fullPrefix + fullSuffix); + if (ast) { + treePath = await getTreePathAtCursor(ast, fullPrefix.length); + } + } catch (e) { + console.error("Failed to parse AST", e); + } + // Find external snippets let snippets: AutocompleteSnippet[] = []; @@ -215,6 +215,14 @@ export async function constructAutocompletePrompt( snippets.push(...importSnippets); } + if (options.useHierarchicalContext && treePath) { + const ctx = await hierarchicalContextService.getContextForPath( + filepath, + treePath, + ); + snippets.push(...ctx); + } + // Filter out empty snippets and ones that are already in the prefix/suffix snippets = snippets .map((snippet) => ({ ...snippet })) @@ -269,7 +277,7 @@ export async function constructAutocompletePrompt( suffix, useFim: true, completeMultiline: await shouldCompleteMultiline( - filepath, + treePath, fullPrefix, fullSuffix, language, diff --git a/core/autocomplete/services/HierarchicalContextService.ts b/core/autocomplete/services/HierarchicalContextService.ts new file mode 100644 index 000000000..5424d1b25 --- /dev/null +++ b/core/autocomplete/services/HierarchicalContextService.ts @@ -0,0 +1,116 @@ +import { createHash } from "crypto"; +import { LRUCache } from "lru-cache"; +import Parser from "web-tree-sitter"; +import { IDE } from "../.."; +import { getQueryForFile, TSQueryType } from "../../util/treeSitter"; +import { AstPath } from "../ast"; +import { AutocompleteSnippet } from "../ranking"; +import { ImportDefinitionsService } from "./ImportDefinitionsService"; + +export class HierarchicalContextService { + private cache = new LRUCache({ + max: 100, + }); + + constructor( + private readonly importDefinitionsService: ImportDefinitionsService, + private readonly ide: IDE, + ) {} + + private static getNodeId(node: Parser.SyntaxNode): string { + return `${node.startIndex}`; + } + + private static TYPES_TO_USE = new Set(["program", "function_declaration"]); + + /** + * Key comes from hash of parent key and node type and node id. + */ + private static keyFromNode( + parentKey: string, + astNode: Parser.SyntaxNode, + ): string { + return createHash("sha256") + .update(parentKey) + .update(astNode.type) + .update(HierarchicalContextService.getNodeId(astNode)) + .digest("hex"); + } + + private async getSnippetsForNode( + filepath: string, + node: Parser.SyntaxNode, + ): Promise { + const snippets: AutocompleteSnippet[] = []; + + let query: Parser.Query | undefined; + switch (node.type) { + case "program": + this.importDefinitionsService.get(filepath); + break; + case "function_declaration": + query = await getQueryForFile( + filepath, + TSQueryType.FunctionDeclaration, + ); + break; + default: + break; + } + + if (!query) { + return snippets; + } + + await Promise.all( + query.matches(node).map(async (match) => { + const startPosition = match.captures[0].node.startPosition; + const endPosition = match.captures[0].node.endPosition; + const definitions = await this.ide.gotoDefinition({ + filepath, + position: { + line: endPosition.row, + character: endPosition.column, + }, + }); + const newSnippets = await Promise.all( + definitions.map(async (def) => ({ + ...def, + contents: await this.ide.readRangeInFile(def.filepath, def.range), + })), + ); + snippets.push(...newSnippets); + }), + ); + + return snippets; + } + + async getContextForPath( + filepath: string, + astPath: AstPath, + // cursorIndex: number, + ): Promise { + const snippets: AutocompleteSnippet[] = []; + + let parentKey = filepath; + for (const astNode of astPath.filter((node) => + HierarchicalContextService.TYPES_TO_USE.has(node.type), + )) { + const key = HierarchicalContextService.keyFromNode(parentKey, astNode); + + const foundInCache = this.cache.get(key); + const newSnippets = + foundInCache ?? (await this.getSnippetsForNode(filepath, astNode)); + snippets.push(...newSnippets); + + if (!foundInCache) { + this.cache.set(key, newSnippets); + } + + parentKey = key; + } + + return snippets; + } +} diff --git a/core/autocomplete/services/ImportDefinitionsService.ts b/core/autocomplete/services/ImportDefinitionsService.ts index 19287bf81..0df08f096 100644 --- a/core/autocomplete/services/ImportDefinitionsService.ts +++ b/core/autocomplete/services/ImportDefinitionsService.ts @@ -1,11 +1,11 @@ -import { IDE } from ".."; -import { RangeInFileWithContents } from "../commands/util"; -import { PrecalculatedLruCache } from "../util/LruCache"; +import { IDE } from "../.."; +import { RangeInFileWithContents } from "../../commands/util"; +import { PrecalculatedLruCache } from "../../util/LruCache"; import { TSQueryType, getParserForFile, getQueryForFile, -} from "../util/treeSitter"; +} from "../../util/treeSitter"; interface FileInfo { imports: { [key: string]: RangeInFileWithContents[] }; diff --git a/core/index.d.ts b/core/index.d.ts index 658f5c980..ef12570d5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -768,6 +768,7 @@ export interface TabAutocompleteOptions { recentLinePrefixMatchMinLength: number; disableInFiles?: string[]; useImports?: boolean; + useHierarchicalContext?: boolean; } export interface ContinueUIConfig { diff --git a/core/package-lock.json b/core/package-lock.json index e4587f56b..5b9ca2b15 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -37,6 +37,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", + "lru-cache": "^10.2.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", @@ -2027,6 +2028,15 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, "node_modules/@babel/helper-compilation-targets/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -10826,12 +10836,11 @@ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "engines": { + "node": "14 || >=16.14" } }, "node_modules/mac-ca": { diff --git a/core/package.json b/core/package.json index fd34477ef..b52c8818d 100644 --- a/core/package.json +++ b/core/package.json @@ -57,6 +57,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", + "lru-cache": "^10.2.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", diff --git a/core/util/parameters.ts b/core/util/parameters.ts index 8909af6f4..f64750255 100644 --- a/core/util/parameters.ts +++ b/core/util/parameters.ts @@ -20,6 +20,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { recentLinePrefixMatchMinLength: 7, disableInFiles: undefined, useImports: true, + useHierarchicalContext: true, }; export const COUNT_COMPLETION_REJECTED_AFTER = 10_000; diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 95a7a10ce..904f87e39 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -120,6 +120,8 @@ export async function getLanguageForFile( export enum TSQueryType { CodeSnippets = "code-snippet-queries", Imports = "import-queries", + // Used in HierarchicalContextService.ts + FunctionDeclaration = "hierarchical-context-queries/function_declaration", } export async function getQueryForFile( diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 6d0e21452..65b5fd37b 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -121,6 +121,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", + "lru-cache": "^10.2.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", diff --git a/extensions/vscode/src/activation/api.ts b/extensions/vscode/src/activation/api.ts index 03a814ae9..bc5f261e0 100644 --- a/extensions/vscode/src/activation/api.ts +++ b/extensions/vscode/src/activation/api.ts @@ -1,5 +1,5 @@ -import { VsCodeExtension } from "../extension/vscodeExtension"; import { IContextProvider } from "core"; +import { VsCodeExtension } from "../extension/vscodeExtension"; export class VsCodeContinueApi { constructor(private readonly vscodeExtension: VsCodeExtension) {} @@ -7,4 +7,4 @@ export class VsCodeContinueApi { registerCustomContextProvider(contextProvider: IContextProvider) { this.vscodeExtension.registerCustomContextProvider(contextProvider); } -} \ No newline at end of file +} diff --git a/extensions/vscode/src/diff/horizontal.ts b/extensions/vscode/src/diff/horizontal.ts index 870022457..da922cd50 100644 --- a/extensions/vscode/src/diff/horizontal.ts +++ b/extensions/vscode/src/diff/horizontal.ts @@ -1,7 +1,7 @@ +import { devDataPath } from "core/util/paths"; import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; -import { devDataPath } from "core/util/paths"; import * as vscode from "vscode"; import { getMetaKeyLabel, getPlatform } from "../util/util"; import { uriFromFilePath } from "../util/vscode"; diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm new file mode 100644 index 000000000..75cac3c55 --- /dev/null +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm @@ -0,0 +1,9 @@ +( + (function_declaration + (formal_parameters + (_ + (type_annotation) @a + ) + ) + ) +) \ No newline at end of file diff --git a/gui/package-lock.json b/gui/package-lock.json index d652bc561..e9952da27 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -114,6 +114,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", + "lru-cache": "^10.2.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", From 196992c6bd50bab1ee2f0e38b2a6888f64a04041 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 23 Jun 2024 10:22:04 -0700 Subject: [PATCH 023/252] method_definition --- core/autocomplete/services/HierarchicalContextService.ts | 9 ++++++++- core/util/treeSitter.ts | 1 + .../function_declaration/typescript.scm | 2 +- .../method_definition/typescript.scm | 9 +++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 extensions/vscode/tree-sitter/hierarchical-context-queries/method_definition/typescript.scm diff --git a/core/autocomplete/services/HierarchicalContextService.ts b/core/autocomplete/services/HierarchicalContextService.ts index 5424d1b25..c14ec9aca 100644 --- a/core/autocomplete/services/HierarchicalContextService.ts +++ b/core/autocomplete/services/HierarchicalContextService.ts @@ -21,7 +21,11 @@ export class HierarchicalContextService { return `${node.startIndex}`; } - private static TYPES_TO_USE = new Set(["program", "function_declaration"]); + private static TYPES_TO_USE = new Set([ + "program", + "function_declaration", + "method_definition", + ]); /** * Key comes from hash of parent key and node type and node id. @@ -54,6 +58,9 @@ export class HierarchicalContextService { TSQueryType.FunctionDeclaration, ); break; + case "method_definition": + query = await getQueryForFile(filepath, TSQueryType.MethodDefinition); + break; default: break; } diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 904f87e39..8b87a3713 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -122,6 +122,7 @@ export enum TSQueryType { Imports = "import-queries", // Used in HierarchicalContextService.ts FunctionDeclaration = "hierarchical-context-queries/function_declaration", + MethodDefinition = "hierarchical-context-queries/method_definition", } export async function getQueryForFile( diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm index 75cac3c55..c0d936f5e 100644 --- a/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_declaration/typescript.scm @@ -2,7 +2,7 @@ (function_declaration (formal_parameters (_ - (type_annotation) @a + (type_annotation) @type ) ) ) diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/method_definition/typescript.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/method_definition/typescript.scm new file mode 100644 index 000000000..10ee28346 --- /dev/null +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/method_definition/typescript.scm @@ -0,0 +1,9 @@ +( + (method_definition + (formal_parameters + (_ + (type_annotation) @type + ) + ) + ) +) \ No newline at end of file From 0d70cd742095cd1a7bc184870c6418b1da7db089 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 29 Jun 2024 20:40:01 -0700 Subject: [PATCH 024/252] hierarchical context support for more languages --- .../services/HierarchicalContextService.ts | 6 ++++++ core/util/treeSitter.ts | 2 ++ .../nested-folder/helloNested.py | 12 +++++++++++- .../function_definition/cpp.scm | 13 +++++++++++++ .../function_definition/python.scm | 17 +++++++++++++++++ .../method_declaration/java.scm | 13 +++++++++++++ .../vscode/tree-sitter/import-queries/cpp.scm | 9 +++++++++ .../vscode/tree-sitter/import-queries/java.scm | 3 +++ .../tree-sitter/import-queries/python.scm | 8 ++++++++ 9 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/cpp.scm create mode 100644 extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/python.scm create mode 100644 extensions/vscode/tree-sitter/hierarchical-context-queries/method_declaration/java.scm create mode 100644 extensions/vscode/tree-sitter/import-queries/cpp.scm create mode 100644 extensions/vscode/tree-sitter/import-queries/java.scm create mode 100644 extensions/vscode/tree-sitter/import-queries/python.scm diff --git a/core/autocomplete/services/HierarchicalContextService.ts b/core/autocomplete/services/HierarchicalContextService.ts index c14ec9aca..53f0ba4be 100644 --- a/core/autocomplete/services/HierarchicalContextService.ts +++ b/core/autocomplete/services/HierarchicalContextService.ts @@ -61,6 +61,12 @@ export class HierarchicalContextService { case "method_definition": query = await getQueryForFile(filepath, TSQueryType.MethodDefinition); break; + case "function_definition": + query = await getQueryForFile(filepath, TSQueryType.FunctionDefinition); + break; + case "method_declaration": + query = await getQueryForFile(filepath, TSQueryType.MethodDeclaration); + break; default: break; } diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 8b87a3713..df699b208 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -123,6 +123,8 @@ export enum TSQueryType { // Used in HierarchicalContextService.ts FunctionDeclaration = "hierarchical-context-queries/function_declaration", MethodDefinition = "hierarchical-context-queries/method_definition", + FunctionDefinition = "hierarchical-context-queries/function_definition", + MethodDeclaration = "hierarchical-context-queries/method_declaration", } export async function getQueryForFile( diff --git a/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py b/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py index 1912b9ffd..b43d5d8d6 100644 --- a/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py +++ b/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py @@ -1,5 +1,15 @@ -def main(): +from typing import List + +Vector = List[float] + + +def main(a: Vector): print("Hello Nested!") +class MyClass: + def test(a: Vector) -> Vector: + return a + + raise Exception("This is an error") diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/cpp.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/cpp.scm new file mode 100644 index 000000000..2610f5393 --- /dev/null +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/cpp.scm @@ -0,0 +1,13 @@ +(function_definition + (function_declarator + (parameter_list + (parameter_declaration + (type_identifier) @a + ) + ) + ) +) + +(function_definition + (type_identifier) @b +) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/python.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/python.scm new file mode 100644 index 000000000..864666a4a --- /dev/null +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/function_definition/python.scm @@ -0,0 +1,17 @@ +( + (function_definition + (parameters + (_ + (type) @a + (#not-match? @a "^(str|int|float|bool|list|dict|tuple)$") + ) + ) + ) +) + +( + (function_definition + (type) @b + (#not-match? @b "^(str|int|float|bool|list|dict|tuple)$") + ) +) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/hierarchical-context-queries/method_declaration/java.scm b/extensions/vscode/tree-sitter/hierarchical-context-queries/method_declaration/java.scm new file mode 100644 index 000000000..ff77555c7 --- /dev/null +++ b/extensions/vscode/tree-sitter/hierarchical-context-queries/method_declaration/java.scm @@ -0,0 +1,13 @@ +; Method parameters +(method_declaration + (formal_parameters + (formal_parameter + (type_identifier) @a + ) + ) +) + +; Return type +(method_declaration + (type_identifier) @b +) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/import-queries/cpp.scm b/extensions/vscode/tree-sitter/import-queries/cpp.scm new file mode 100644 index 000000000..c740cf762 --- /dev/null +++ b/extensions/vscode/tree-sitter/import-queries/cpp.scm @@ -0,0 +1,9 @@ +(using_declaration + (qualified_identifier + (identifier) @a)) + +(namespace_alias_definition + (nested_namespace_specifier) @b) + +(preproc_include + (system_lib_string) @c) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/import-queries/java.scm b/extensions/vscode/tree-sitter/import-queries/java.scm new file mode 100644 index 000000000..51920eda7 --- /dev/null +++ b/extensions/vscode/tree-sitter/import-queries/java.scm @@ -0,0 +1,3 @@ +(import_declaration + (scoped_identifier + (identifier) @import)) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/import-queries/python.scm b/extensions/vscode/tree-sitter/import-queries/python.scm new file mode 100644 index 000000000..dedaf23aa --- /dev/null +++ b/extensions/vscode/tree-sitter/import-queries/python.scm @@ -0,0 +1,8 @@ +(import_from_statement + (dotted_name) ; skip the first (this is the module) + (dotted_name + (identifier) @importa)) + +(import_statement + (dotted_name + (identifier) @importb )) \ No newline at end of file From 6350993007ce3f10bb200b2347e7234b2a35ff53 Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 19:37:32 -0400 Subject: [PATCH 025/252] rebase to dev --- core/config/types.ts | 3 +- .../providers/GreptileContextProvider.ts | 186 ++++++ core/context/providers/index.ts | 2 + core/index.d.ts | 1 + docs/docs/customization/context-providers.md | 580 ++++++++++++++++++ docs/static/schemas/config.json | 6 +- extensions/vscode/config_schema.json | 6 +- extensions/vscode/continue_rc_schema.json | 6 +- 8 files changed, 783 insertions(+), 7 deletions(-) create mode 100644 core/context/providers/GreptileContextProvider.ts create mode 100644 docs/docs/customization/context-providers.md diff --git a/core/config/types.ts b/core/config/types.ts index e69c312ab..4a329d7a4 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -547,7 +547,8 @@ declare global { | "docs" | "gitlab-mr" | "os" - | "currentFile"; + | "currentFile" + | "greptile; type TemplateType = | "llama2" diff --git a/core/context/providers/GreptileContextProvider.ts b/core/context/providers/GreptileContextProvider.ts new file mode 100644 index 000000000..dee597adc --- /dev/null +++ b/core/context/providers/GreptileContextProvider.ts @@ -0,0 +1,186 @@ +import { + ContextItem, + ContextProviderDescription, + ContextProviderExtras, + } from "../../index.js"; + import { BaseContextProvider } from "../index.js"; + import { execSync } from "child_process"; + import * as path from "path"; + import * as fs from "fs"; + + class GreptileContextProvider extends BaseContextProvider { + static description: ContextProviderDescription = { + title: "greptile", + displayTitle: "Greptile", + description: "Query Greptile for relevant code snippets", + type: "query", + }; + + async getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise { + const greptileToken = this.getGreptileToken(); + const githubToken = process.env.GITHUB_TOKEN; + + if (!greptileToken || !githubToken) { + throw new Error("Greptile token or GitHub token not found."); + } + + let absPath = await this.getWorkspaceDir(extras); + if (!absPath) { + throw new Error("Failed to determine the workspace directory."); + } + var remoteUrl = getRemoteUrl(absPath) + remoteUrl = getRemoteUrl(absPath); + const repoName = extractRepoName(remoteUrl); + const branch = getCurrentBranch(absPath); + const remoteType = getRemoteType(remoteUrl); + + if (!remoteType) { + throw new Error("Unable to determine remote type."); + } + + const options = { + method: 'POST', + headers: { + Authorization: `Bearer ${greptileToken}`, + 'X-GitHub-Token': githubToken, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + messages: [{ id: "", content: query, role: "user" }], + repositories: [{ + remote: remoteType, + branch: branch, + repository: repoName + }], + sessionId: extras.config.userToken || "default-session", + stream: false, + genius: true, + }), + }; + + // Log request details for debugging + console.log("Request URL: https://api.greptile.com/v2/query"); + console.log("Request Headers:", options.headers); + console.log("Request Body:", options.body); + + try { + const response = await extras.fetch('https://api.greptile.com/v2/query', options); + + // Log the raw response text for debugging + const rawText = await response.text(); + console.log("Raw response from Greptile:", rawText); + + // Check for HTTP errors + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + // Parse the response as JSON + const json = JSON.parse(rawText); + + return json.sources.map((source: any) => ({ + description: source.filepath, + content: `File: ${source.filepath}\nLines: ${source.linestart}-${source.lineend}\n\n${source.summary}`, + name: (source.filepath.split("/").pop() ?? "").split("\\").pop() ?? "", + })); + } catch (error) { + console.error("Error getting context items from Greptile:", error); + throw new Error(`Error getting context items from Greptile`); + } + } + + private getGreptileToken(): string | undefined { + return this.options.token || process.env.GREPTILE_AUTH_TOKEN; + } + + private async getWorkspaceDir(extras: ContextProviderExtras): Promise { + try { + const workspaceDirs = await extras.ide.getWorkspaceDirs(); + if (workspaceDirs && workspaceDirs.length > 0) { + return workspaceDirs[0]; + } else { + console.warn(`extras.ide.getWorkspaceDirs() returned undefined or empty array.`); + } + } catch (err) { + console.warn(`Failed to get workspace directories from extras.ide.getWorkspaceDirs():`); + } + + // Fallback to using Git commands + try { + const currentDir = process.cwd(); + if (this.isGitRepository(currentDir)) { + const workspaceDir = execSync('git rev-parse --show-toplevel').toString().trim(); + return workspaceDir; + } else { + console.warn(`Current directory is not a Git repository: ${currentDir}`); + return null; + } + } catch (err) { + console.warn(`Failed to get workspace directory using Git commands: `); + return null; + } + } + + private isGitRepository(dir: string): boolean { + try { + const gitDir = path.join(dir, '.git'); + return fs.existsSync(gitDir); + } catch (err) { + console.warn(`Failed to check if directory is a Git repository:`); + return false; + } + } + } + + // Helper functions + function getRemoteUrl(absPath: string): string { + try { + const remote = execSync(`git -C ${absPath} remote get-url origin`).toString().trim(); + return remote; + } catch (err) { + console.warn(`Failed to get remote URL`); + return ""; + } + } + + function getCurrentBranch(absPath: string): string { + try { + const branch = execSync(`git -C ${absPath} rev-parse --abbrev-ref HEAD`).toString().trim(); + return branch; + } catch (err) { + console.warn(`Failed to get current branch`); + return "master"; // Default to 'master' if the current branch cannot be determined + } + } + + function extractRepoName(remote: string): string { + if (remote.startsWith("http://") || remote.startsWith("https://")) { + const parts = remote.split("/"); + if (parts.length >= 2) { + return parts[parts.length - 2] + "/" + parts[parts.length - 1].replace(".git", ""); + } + } else if (remote.startsWith("git@")) { + const parts = remote.split(":"); + if (parts.length >= 2) { + return parts[1].replace(".git", ""); + } + } + return ""; + } + + function getRemoteType(remote: string): string { + if (remote.includes("github.com")) { + return "github"; + } else if (remote.includes("gitlab.com")) { + return "gitlab"; + } else if (remote.includes("azure.com")) { + return "azure"; + } + return ""; + } + + export default GreptileContextProvider; + \ No newline at end of file diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index 92cabb222..06683f181 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -22,6 +22,7 @@ import SearchContextProvider from "./SearchContextProvider"; import TerminalContextProvider from "./TerminalContextProvider"; import URLContextProvider from "./URLContextProvider"; import RepoMapContextProvider from "./RepoMapContextProvider"; +import GreptileContextProvider from "./GreptileContextProvider"; /** * Note: We are currently omitting the following providers due to bugs: @@ -53,6 +54,7 @@ const Providers: (typeof BaseContextProvider)[] = [ URLContextProvider, ContinueProxyContextProvider, RepoMapContextProvider, + GreptileContextProvider, ]; export function contextProviderClassFromName( diff --git a/core/index.d.ts b/core/index.d.ts index 0c7c9b521..8486f24ee 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -578,6 +578,7 @@ type ContextProviderName = | "gitlab-mr" | "os" | "currentFile" + | "greptile" | "outline" | "continue-proxy" | "highlights" diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md new file mode 100644 index 000000000..b806e2b63 --- /dev/null +++ b/docs/docs/customization/context-providers.md @@ -0,0 +1,580 @@ +--- +title: Context Providers +description: Type '@' to select content to the LLM as context +keywords: [context, "@", provider, LLM] +--- + +# Context Providers + +Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider. + +As an example, say you are working on solving a new GitHub Issue. You type '@issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input. + +![Context Items](/img/context-provider-example.png) + +## Built-in Context Providers + +To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list. + +### Files + +Type '@file' to reference any file in your current workspace. + +```json +{ "name": "file" } +``` + +### Code + +Type '@code' to reference specific functions or classes from throughout your project. + +```json +{ "name": "code" } +``` + +### Git Diff + +Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. + +```json +{ "name": "diff" } +``` + +### Terminal + +Type '@terminal' to reference the contents of your IDE's terminal. + +```json +{ "name": "terminal" } +``` + +### Documentation + +Type `@docs` to index and retrieve snippets from any documentation site. + +```json +{ "name": "docs" } +``` + +To learn more, visit [Talk To Your Docs](../features/talk-to-your-docs.md). + +### Open Files + +Type '@open' to reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. + +```json +{ "name": "open", "params": { "onlyPinned": true } } +``` + +### Codebase Retrieval + +Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../features/codebase-embeddings.md). + +```json +{ "name": "codebase" } +``` + +### Folders + +Type '@folder' to use the same retrieval mechanism as '@codebase', but only on a single folder. + +```json +{ "name": "folder" } +``` + +### Exact Search + +Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search. This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep). + +```json +{ "name": "search" } +``` + +### URL + +Type '@url' and input a URL, then Continue will convert it to a markdown document to pass to the model. + +```json +{ "name": "url" } +``` + +### File Tree + +Type '@tree' to reference the structure of your current workspace. The LLM will be able to see the nested directory structure of your project. + +```json +{ "name": "tree" } +``` + +### Google + +Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python. + +```json +{ + "name": "google", + "params": { "serperApiKey": "" } +} +``` + +Note: You can get an API key for free at [serper.dev](https://serper.dev). + +### GitHub Issues + +Type '@issue' to reference the conversation in a GitHub issue. Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited: + +```json +{ + "name": "issue", + "params": { + "repos": [ + { + "owner": "continuedev", + "repo": "continue" + } + ], + "githubToken": "ghp_xxx" + } +} +``` + +### GitLab Merge Request + +Type `@gitlab-mr` to reference an open MR for this branch on GitLab. + +#### Configuration + +You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. then add the following to your configuration: + +```json +{ + "name": "gitlab-mr", + "params": { + "token": "..." + } +} +``` + +#### Using Self-Hosted GitLab + +You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`. + +```json +{ + "name": "gitlab-mr", + "params": { + "token": "...", + "domain": "gitlab.example.com" + } +} +``` + +#### Filtering Comments + +If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`. + +### Jira Issues + +Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email. + +```json +{ + "name": "jira", + "params": { + "domain": "company.atlassian.net", + "token ": "ATATT..." + } +} +``` + +#### Jira Datacenter Support + +This context provider supports both Jira API version 2 and 3. It will use version 3 by default since +that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need +to set the API Version to 2 using the `apiVersion` property. + +```json + "params": { + "apiVersion": "2", + ... + } +``` + +#### Issue Query + +By default, the following query will be used to find issues: + +```jql +assignee = currentUser() AND resolution = Unresolved order by updated DESC +``` + +You can override this query by setting the `issueQuery` parameter. + + + + + +### PostgreSQL + +Type `@postgres` to reference the schema of a table, and some sample rows. A dropdown will appear, allowing you to select a specific table, or all tables. + +The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`. + +By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas. + +[Here is a short demo.](https://github.com/continuedev/continue/pull/859) + +```json +{ + "name": "postgres", + "params": { + "host": "localhost", + "port": 5436, + "user": "myuser", + "password": "catsarecool", + "database": "animals", + "schema": "public", + "sampleRows": 3 + } +} +``` + +### Database Tables + +Type `@database` to reference table schemas you can use the drop-down or start typeing table names based off of your configuration. Configuration supports multiple databases, allowing you to specify various connection details for PostgreSQL, MySQL, SQLite. Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type. + +```json +{ + "name": "database", + "params": { + "connections": [ + { + "name": "examplePostgres", + "connection_type": "postgres", + "connection": { + "user": "username", + "host": "localhost", + "database": "exampleDB", + "password": "yourPassword", + "port": 5432 + } + }, + { + "name": "exampleSqlite", + "connection_type": "sqlite", + "connection": { + "filename": "/path/to/your/sqlite/database.db" + } + } + ] + } +} +``` + +### Debugger: Local Variables + +Type `@locals` to reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread. A dropdown will appear, allowing you to select a specific thread to see the local variables in that thread. + +```json +{ + "name": "locals", + "params": { + "stackDepth": 3 + } +} +``` + +### Repository map + +Provides an overview of all files and the call signatures of top-level classes, functions, and methods. This helps the model better understand how a particular piece of code relates to the rest of the codebase. + +This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html). + +```json +{ + "name": "repo-map" +} +``` + +### Operating System + +Type `@os` to reference the architecture and platform of your current operating system. + +```json +{ "name": "os" } +``` + +### Greptile +Type @greptile to query your Greptile indexes. + ```json + {"name": "greptile"} + ``` + +### 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. + +## Building Your Own Context Provider + +### Introductory Example + +To write your own context provider, you just have to implement the `CustomContextProvider` +interface: + +```typescript +interface CustomContextProvider { + title: string; + displayTitle?: string; + description?: string; + renderInlineAs?: string; + type?: ContextProviderType; + getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise; + loadSubmenuItems?: ( + args: LoadSubmenuItemsArgs, + ) => Promise; +} +``` + +As an example, let's say you have a set of internal documents that have been indexed in a vector database. You've set up a simple REST API that allows internal users to query and get back relevant snippets. This context provider will send the query to this server and return the results from the vector database. The return type of `getContextItems` _must_ be an array of objects that have all of the following properties: + +- `name`: The name of the context item, which will be displayed as a title +- `description`: A longer description of the context item +- `content`: The actual content of the context item, which will be fed to the LLM as context + +```typescript title="~/.continue/config.ts" +const RagContextProvider: CustomContextProvider = { + title: "rag", + displayTitle: "RAG", + description: + "Retrieve snippets from our vector database of internal documents", + + getContextItems: async ( + query: string, + extras: ContextProviderExtras, + ): Promise => { + const response = await fetch("https://internal_rag_server.com/retrieve", { + method: "POST", + body: JSON.stringify({ query }), + }); + + const results = await response.json(); + + return results.map((result) => ({ + name: result.title, + description: result.title, + content: result.contents, + })); + }, +}; +``` + +It can then be added in `config.ts` like so: + +```typescript title="~/.continue/config.ts" +export function modifyConfig(config: Config): Config { + if (!config.contextProviders) { + config.contextProviders = []; + } + config.contextProviders.push(RagContextProvider); + return config; +} +``` + +No modification in `config.json` is necessary. + +### Custom Context Providers with Submenu or Query + +There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far. + +The **"query"** type is used when you want to display a text box to the user, and then use the contents of that text box to generate the context items. Built-in examples include ["search"](#exact-search) and ["google"](#google). This text is what gets passed to the "query" argument in `getContextItems`. To implement a "query" context provider, simply set `"type": "query"` in your custom context provider object. + +The **"submenu"** type is used when you want to display a list of searchable items in the dropdown. Built-in examples include ["issue"](#github-issues) and ["folder"](#folders). To implement a "submenu" context provider, set `"type": "submenu"` and implement the `loadSubmenuItems` and `getContextItems` functions. Here is an example that shows a list of all README files in the current workspace: + +```typescript title="~/.continue/config.ts" +const ReadMeContextProvider: CustomContextProvider = { + title: "readme", + displayTitle: "README", + description: "Reference README.md files in your workspace", + type: "submenu", + + getContextItems: async ( + query: string, + extras: ContextProviderExtras, + ): Promise => { + // 'query' is the filepath of the README selected from the dropdown + const content = await extras.ide.readFile(query); + return [ + { + name: getFolder(query), + description: getFolderAndBasename(query), + content, + }, + ]; + }, + + loadSubmenuItems: async ( + args: LoadSubmenuItemsArgs, + ): Promise => { + // Filter all workspace files for READMEs + const allFiles = await args.ide.listWorkspaceContents(); + const readmes = allFiles.filter((filepath) => + filepath.endsWith("README.md"), + ); + + // Return the items that will be shown in the dropdown + return readmes.map((filepath) => { + return { + id: filepath, + title: getFolder(filepath), + description: getFolderAndBasename(filepath), + }; + }); + }, +}; + +export function modifyConfig(config: Config): Config { + if (!config.contextProviders) { + config.contextProviders = []; + } + config.contextProviders.push(ReadMeContextProvider); + return config; +} + +function getFolder(path: string): string { + return path.split(/[\/\\]/g).slice(-2)[0]; +} + +function getFolderAndBasename(path: string): string { + return path + .split(/[\/\\]/g) + .slice(-2) + .join("/"); +} +``` + +The flow of information in the above example is as follows: + +1. The user types `@readme` and selects it from the dropdown, now displaying the submenu where they can search for any item returned by `loadSubmenuItems`. +2. The user selects one of the READMEs in the submenu, enters the rest of their input, and presses enter. +3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README. +4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt. + +### Importing outside modules + +To include outside Node modules in your config.ts, run `npm install ` from the `~/.continue` directory, and then import them in config.ts. + +Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.ts` and any dependencies into a single Javascript file. The exact configuration used can be found [here](https://github.com/continuedev/continue/blob/5c9874400e223bbc9786a8823614a2e501fbdaf7/extensions/vscode/src/ideProtocol.ts#L45-L52). + +### `CustomContextProvider` Reference + +- `title`: An identifier for the context provider +- `displayTitle` (optional): The title displayed in the dropdown +- `description` (optional): The longer description displayed in the dropdown when hovered +- `type` (optional): The type of context provider. Options are "normal", "query", and "submenu". Defaults to "normal". +- `renderInlineAs` (optional): The string that will be rendered inline at the top of the prompt. If no value is provided, the `displayTitle` will be used. An empty string can be provided to prevent rendering the default `displayTitle`. +- `getContextItems`: A function that returns the documents to include in the prompt. It should return a list of `ContextItem`s, and is given access to the following arguments: + - `extras.fullInput`: A string representing the user's full input to the text box. This can be used for example to generate an embedding to compare against a set of other embedded documents + - `extras.embeddingsProvider`: The embeddings provider has an `embed` function that will convert text (such as `fullInput`) to an embedding + - `extras.llm`: The current default LLM, which you can use to make completion requests + - `extras.ide`: An instance of the `IDE` class, which lets you gather various sources of information from the IDE, including the contents of the terminal, the list of open files, or any warnings in the currently open file. + - `query`: (not currently used) A string representing the query +- `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`. + +### Writing Context Providers in Other Languages + +If you'd like to write a context provider in a language other than TypeScript, you can use the "http" context provider to call a server that hosts your own code. Add the context provider to `config.json` like this: + +```json +{ + "name": "http", + "params": { + "url": "https://myserver.com/context-provider", + "title": "http", + "description": "Custom HTTP Context Provider", + "displayTitle": "My Custom Context" + } +} +``` + +Then, create a server that responds to requests as are made from [HttpContextProvider.ts](../../../core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](../../../core/context/providers/context_provider_server.py) for an example that uses FastAPI. + +### Extension API for VSCode + +Continue exposes an API for registering context providers from a 3rd party VSCode extension. This is useful if you have a VSCode extension that provides some additional context that you would like to use in Continue. To use this API, add the following to your `package.json`: + +```json +{ + "extensionDependencies": ["continue.continue"] +} +``` + +Or copy `~/.continue/type/core/index.d.ts` to your extension repository. + +Then, you can use the `registerCustomContextProvider` function to register your context provider. Your custom context provider must implement the `IContextProvider` interface. +Here is an example: + +```typescript +import * as vscode from "vscode"; + +class MyCustomProvider implements IContextProvider { + get description(): ContextProviderDescription { + return { + title: "custom", + displayTitle: "Custom", + description: "Custom description", + type: "normal", + }; + } + + async getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise { + return [ + { + name: "Custom", + description: "Custom description", + content: "Custom content", + }, + ]; + } + + async loadSubmenuItems( + args: LoadSubmenuItemsArgs, + ): Promise { + return []; + } +} + +// create an instance of your custom provider +const customProvider = new MyCustomProvider(); + +// get Continue extension using vscode API +const continueExt = vscode.extensions.getExtension("continue.continue"); + +// get the API from the extension +const continueApi = continueExt?.exports; + +// register your custom provider +continueApi?.registerCustomContextProvider(customProvider); +``` diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 45faeb06f..c2bf890e5 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1534,7 +1534,8 @@ "url", "database", "os", - "repo-map" + "repo-map", + "greptile" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1558,7 +1559,8 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights" + "Map of files in the repository with important code highlights", + "Query your greptile index of the current repo" ], "type": "string" }, diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index cbf47d4b4..ab2186d62 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1529,7 +1529,8 @@ "url", "database", "os", - "repo-map" + "repo-map", + "greptile" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1553,7 +1554,8 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights" + "Map of files in the repository with important code highlights", + "Query your greptile index of the current repo" ], "type": "string" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index c33df73c2..62797714b 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1700,7 +1700,8 @@ "url", "database", "os", - "repo-map" + "repo-map", + "greptile" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1724,7 +1725,8 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights" + "Map of files in the repository with important code highlights", + "Query your greptile index of the current repo" ], "type": "string" }, From 0d91dea826709b3c405d9bfc8e2888c1bca1aac4 Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 17:42:19 -0400 Subject: [PATCH 026/252] working draft --- docs/static/schemas/config.json | 100 ++++++++--------- .../src/main/resources/config_schema.json | 106 +++++++++--------- extensions/vscode/continue_rc_schema.json | 83 +++++++------- 3 files changed, 145 insertions(+), 144 deletions(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index c2bf890e5..ab2186d62 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -204,7 +204,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/together)", + "### 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://docs.continue.dev/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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -244,10 +244,10 @@ "type": "string" }, "region": { - "title": "Region", - "description": "The region where the model is hosted", - "type": "string" - }, + "title": "Region", + "description": "The region where the model is hosted", + "type": "string" + }, "profile": { "title": "Profile", "description": "The AWS security profile to use", @@ -414,9 +414,7 @@ "if": { "properties": { "provider": { - "enum": [ - "bedrockimport" - ] + "enum": ["bedrockimport"] } }, "required": ["provider"] @@ -526,7 +524,7 @@ "if": { "properties": { "provider": { - "enum": ["openai", "azure"] + "enum": ["openai"] } }, "required": ["provider"] @@ -710,13 +708,13 @@ "anyOf": [ { "enum": [ + "claude-2", + "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1", - "claude-2", - "claude-instant-1" + "claude-2.1" ] }, { @@ -759,7 +757,6 @@ "anyOf": [ { "enum": [ - "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -806,6 +803,7 @@ }, "model": { "enum": [ + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -946,33 +944,33 @@ "anyOf": [ { "enum": [ - "mistral:7b", - "llama2:7b", - "llama2:13b", - "codellama:7b", - "codellama:13b", - "codellama:34b", - "codellama:70b", - "llama3:8b", - "llama3:70b", - "llama3.1:8b", - "llama3.1:70b", - "llama3.1:405b", - "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", - "starcoder2:3b", + "mistral-7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "llama3-8b", + "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", + "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", + "starcoder2-3b", "AUTODETECT" ] }, @@ -1237,6 +1235,7 @@ "claude-2.1", "command-r", "command-r-plus", + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1316,11 +1315,7 @@ "model": { "anyOf": [ { - "enum": [ - "llama3.1-8b", - "llama3.1-70b", - "llama3.1-405b" - ] + "enum": ["llama3.1-8b", "llama3.1-70b", "llama3.1-405b"] }, { "type": "string" @@ -2483,16 +2478,13 @@ "type": "object", "properties": { "inlineEdit": { - "description": "The 'title' property of the model you wish to use for inline edits", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "applyCodeBlock": { - "description": "The 'title' property of the model you wish to use for applying code blocks", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "repoMapFileSelection": { - "description": "The 'title' property of the model you wish to use for repo map file selections", - "type": "string" + "$ref": "#/definitions/ModelTitle" } } }, @@ -2555,6 +2547,12 @@ } } } + }, + "ModelTitle": { + "type": "string", + "enum": { + "$data": "/models/title" + } } } } diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 45faeb06f..ab2186d62 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -204,7 +204,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/together)", + "### 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://docs.continue.dev/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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -244,10 +244,10 @@ "type": "string" }, "region": { - "title": "Region", - "description": "The region where the model is hosted", - "type": "string" - }, + "title": "Region", + "description": "The region where the model is hosted", + "type": "string" + }, "profile": { "title": "Profile", "description": "The AWS security profile to use", @@ -414,9 +414,7 @@ "if": { "properties": { "provider": { - "enum": [ - "bedrockimport" - ] + "enum": ["bedrockimport"] } }, "required": ["provider"] @@ -526,7 +524,7 @@ "if": { "properties": { "provider": { - "enum": ["openai", "azure"] + "enum": ["openai"] } }, "required": ["provider"] @@ -710,13 +708,13 @@ "anyOf": [ { "enum": [ + "claude-2", + "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1", - "claude-2", - "claude-instant-1" + "claude-2.1" ] }, { @@ -759,7 +757,6 @@ "anyOf": [ { "enum": [ - "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -806,6 +803,7 @@ }, "model": { "enum": [ + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -946,33 +944,33 @@ "anyOf": [ { "enum": [ - "mistral:7b", - "llama2:7b", - "llama2:13b", - "codellama:7b", - "codellama:13b", - "codellama:34b", - "codellama:70b", - "llama3:8b", - "llama3:70b", - "llama3.1:8b", - "llama3.1:70b", - "llama3.1:405b", - "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", - "starcoder2:3b", + "mistral-7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "llama3-8b", + "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", + "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", + "starcoder2-3b", "AUTODETECT" ] }, @@ -1237,6 +1235,7 @@ "claude-2.1", "command-r", "command-r-plus", + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1316,11 +1315,7 @@ "model": { "anyOf": [ { - "enum": [ - "llama3.1-8b", - "llama3.1-70b", - "llama3.1-405b" - ] + "enum": ["llama3.1-8b", "llama3.1-70b", "llama3.1-405b"] }, { "type": "string" @@ -1534,7 +1529,8 @@ "url", "database", "os", - "repo-map" + "repo-map", + "greptile" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1558,7 +1554,8 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights" + "Map of files in the repository with important code highlights", + "Query your greptile index of the current repo" ], "type": "string" }, @@ -2481,16 +2478,13 @@ "type": "object", "properties": { "inlineEdit": { - "description": "The 'title' property of the model you wish to use for inline edits", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "applyCodeBlock": { - "description": "The 'title' property of the model you wish to use for applying code blocks", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "repoMapFileSelection": { - "description": "The 'title' property of the model you wish to use for repo map file selections", - "type": "string" + "$ref": "#/definitions/ModelTitle" } } }, @@ -2553,6 +2547,12 @@ } } } + }, + "ModelTitle": { + "type": "string", + "enum": { + "$data": "/models/title" + } } } } diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 62797714b..d880fad45 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -207,7 +207,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/together)", + "### 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://docs.continue.dev/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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -562,8 +562,7 @@ "properties": { "provider": { "enum": [ - "openai", - "azure" + "openai" ] } }, @@ -766,13 +765,13 @@ "anyOf": [ { "enum": [ + "claude-2", + "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1", - "claude-2", - "claude-instant-1" + "claude-2.1" ] }, { @@ -826,7 +825,6 @@ "anyOf": [ { "enum": [ - "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -881,6 +879,7 @@ }, "model": { "enum": [ + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1035,33 +1034,33 @@ "anyOf": [ { "enum": [ - "mistral:7b", - "llama2:7b", - "llama2:13b", - "codellama:7b", - "codellama:13b", - "codellama:34b", - "codellama:70b", - "llama3:8b", - "llama3:70b", - "llama3.1:8b", - "llama3.1:70b", - "llama3.1:405b", - "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", - "starcoder2:3b", + "mistral-7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "codellama-70b", + "llama3-8b", + "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", + "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", + "starcoder2-3b", "AUTODETECT" ] }, @@ -1373,6 +1372,7 @@ "claude-2.1", "command-r", "command-r-plus", + "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -2784,16 +2784,13 @@ "type": "object", "properties": { "inlineEdit": { - "description": "The 'title' property of the model you wish to use for inline edits", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "applyCodeBlock": { - "description": "The 'title' property of the model you wish to use for applying code blocks", - "type": "string" + "$ref": "#/definitions/ModelTitle" }, "repoMapFileSelection": { - "description": "The 'title' property of the model you wish to use for repo map file selections", - "type": "string" + "$ref": "#/definitions/ModelTitle" } } }, @@ -2869,6 +2866,12 @@ "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." } } + }, + "ModelTitle": { + "type": "string", + "enum": { + "$data": "/models/title" + } } } } \ No newline at end of file From 0b789ae095a1f8bcc72dcea1e4de9d671ed518a8 Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 19:28:30 -0400 Subject: [PATCH 027/252] review --- core/context/providers/GreptileContextProvider.ts | 2 +- docs/docs/customization/context-providers.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/context/providers/GreptileContextProvider.ts b/core/context/providers/GreptileContextProvider.ts index dee597adc..5c8d5f3ea 100644 --- a/core/context/providers/GreptileContextProvider.ts +++ b/core/context/providers/GreptileContextProvider.ts @@ -12,7 +12,7 @@ import { static description: ContextProviderDescription = { title: "greptile", displayTitle: "Greptile", - description: "Query Greptile for relevant code snippets", + description: "Insert query to Greptile", type: "query", }; diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index b806e2b63..77efdd567 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -322,7 +322,8 @@ Type `@os` to reference the architecture and platform of your current operating ``` ### Greptile -Type @greptile to query your Greptile indexes. +Type @greptile to perform file retrieval using your greptile indices. +Enter your query to greptile in the popup text box. The currently active vscode project is automatically used as the repository of interest (this must be pre-indexed with greptile). ```json {"name": "greptile"} ``` From 2be4d76b6191023068bc686bedd1e5e489d71218 Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 20:12:22 -0400 Subject: [PATCH 028/252] remove rebase unwanted --- docs/docs/customization/context-providers.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index 77efdd567..b806e2b63 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -322,8 +322,7 @@ Type `@os` to reference the architecture and platform of your current operating ``` ### Greptile -Type @greptile to perform file retrieval using your greptile indices. -Enter your query to greptile in the popup text box. The currently active vscode project is automatically used as the repository of interest (this must be pre-indexed with greptile). +Type @greptile to query your Greptile indexes. ```json {"name": "greptile"} ``` From 4595b0006ddd39fa6fbe81c6945c0e5af82a7b1d Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 20:17:18 -0400 Subject: [PATCH 029/252] fix rebase --- docs/docs/customization/context-providers.md | 580 ------------------ docs/static/schemas/config.json | 106 ++-- .../src/main/resources/config_schema.json | 106 ++-- 3 files changed, 106 insertions(+), 686 deletions(-) delete mode 100644 docs/docs/customization/context-providers.md diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md deleted file mode 100644 index b806e2b63..000000000 --- a/docs/docs/customization/context-providers.md +++ /dev/null @@ -1,580 +0,0 @@ ---- -title: Context Providers -description: Type '@' to select content to the LLM as context -keywords: [context, "@", provider, LLM] ---- - -# Context Providers - -Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider. - -As an example, say you are working on solving a new GitHub Issue. You type '@issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input. - -![Context Items](/img/context-provider-example.png) - -## Built-in Context Providers - -To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list. - -### Files - -Type '@file' to reference any file in your current workspace. - -```json -{ "name": "file" } -``` - -### Code - -Type '@code' to reference specific functions or classes from throughout your project. - -```json -{ "name": "code" } -``` - -### Git Diff - -Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. - -```json -{ "name": "diff" } -``` - -### Terminal - -Type '@terminal' to reference the contents of your IDE's terminal. - -```json -{ "name": "terminal" } -``` - -### Documentation - -Type `@docs` to index and retrieve snippets from any documentation site. - -```json -{ "name": "docs" } -``` - -To learn more, visit [Talk To Your Docs](../features/talk-to-your-docs.md). - -### Open Files - -Type '@open' to reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. - -```json -{ "name": "open", "params": { "onlyPinned": true } } -``` - -### Codebase Retrieval - -Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../features/codebase-embeddings.md). - -```json -{ "name": "codebase" } -``` - -### Folders - -Type '@folder' to use the same retrieval mechanism as '@codebase', but only on a single folder. - -```json -{ "name": "folder" } -``` - -### Exact Search - -Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search. This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep). - -```json -{ "name": "search" } -``` - -### URL - -Type '@url' and input a URL, then Continue will convert it to a markdown document to pass to the model. - -```json -{ "name": "url" } -``` - -### File Tree - -Type '@tree' to reference the structure of your current workspace. The LLM will be able to see the nested directory structure of your project. - -```json -{ "name": "tree" } -``` - -### Google - -Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python. - -```json -{ - "name": "google", - "params": { "serperApiKey": "" } -} -``` - -Note: You can get an API key for free at [serper.dev](https://serper.dev). - -### GitHub Issues - -Type '@issue' to reference the conversation in a GitHub issue. Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited: - -```json -{ - "name": "issue", - "params": { - "repos": [ - { - "owner": "continuedev", - "repo": "continue" - } - ], - "githubToken": "ghp_xxx" - } -} -``` - -### GitLab Merge Request - -Type `@gitlab-mr` to reference an open MR for this branch on GitLab. - -#### Configuration - -You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. then add the following to your configuration: - -```json -{ - "name": "gitlab-mr", - "params": { - "token": "..." - } -} -``` - -#### Using Self-Hosted GitLab - -You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`. - -```json -{ - "name": "gitlab-mr", - "params": { - "token": "...", - "domain": "gitlab.example.com" - } -} -``` - -#### Filtering Comments - -If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`. - -### Jira Issues - -Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email. - -```json -{ - "name": "jira", - "params": { - "domain": "company.atlassian.net", - "token ": "ATATT..." - } -} -``` - -#### Jira Datacenter Support - -This context provider supports both Jira API version 2 and 3. It will use version 3 by default since -that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need -to set the API Version to 2 using the `apiVersion` property. - -```json - "params": { - "apiVersion": "2", - ... - } -``` - -#### Issue Query - -By default, the following query will be used to find issues: - -```jql -assignee = currentUser() AND resolution = Unresolved order by updated DESC -``` - -You can override this query by setting the `issueQuery` parameter. - - - - - -### PostgreSQL - -Type `@postgres` to reference the schema of a table, and some sample rows. A dropdown will appear, allowing you to select a specific table, or all tables. - -The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`. - -By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas. - -[Here is a short demo.](https://github.com/continuedev/continue/pull/859) - -```json -{ - "name": "postgres", - "params": { - "host": "localhost", - "port": 5436, - "user": "myuser", - "password": "catsarecool", - "database": "animals", - "schema": "public", - "sampleRows": 3 - } -} -``` - -### Database Tables - -Type `@database` to reference table schemas you can use the drop-down or start typeing table names based off of your configuration. Configuration supports multiple databases, allowing you to specify various connection details for PostgreSQL, MySQL, SQLite. Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type. - -```json -{ - "name": "database", - "params": { - "connections": [ - { - "name": "examplePostgres", - "connection_type": "postgres", - "connection": { - "user": "username", - "host": "localhost", - "database": "exampleDB", - "password": "yourPassword", - "port": 5432 - } - }, - { - "name": "exampleSqlite", - "connection_type": "sqlite", - "connection": { - "filename": "/path/to/your/sqlite/database.db" - } - } - ] - } -} -``` - -### Debugger: Local Variables - -Type `@locals` to reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread. A dropdown will appear, allowing you to select a specific thread to see the local variables in that thread. - -```json -{ - "name": "locals", - "params": { - "stackDepth": 3 - } -} -``` - -### Repository map - -Provides an overview of all files and the call signatures of top-level classes, functions, and methods. This helps the model better understand how a particular piece of code relates to the rest of the codebase. - -This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html). - -```json -{ - "name": "repo-map" -} -``` - -### Operating System - -Type `@os` to reference the architecture and platform of your current operating system. - -```json -{ "name": "os" } -``` - -### Greptile -Type @greptile to query your Greptile indexes. - ```json - {"name": "greptile"} - ``` - -### 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. - -## Building Your Own Context Provider - -### Introductory Example - -To write your own context provider, you just have to implement the `CustomContextProvider` -interface: - -```typescript -interface CustomContextProvider { - title: string; - displayTitle?: string; - description?: string; - renderInlineAs?: string; - type?: ContextProviderType; - getContextItems( - query: string, - extras: ContextProviderExtras, - ): Promise; - loadSubmenuItems?: ( - args: LoadSubmenuItemsArgs, - ) => Promise; -} -``` - -As an example, let's say you have a set of internal documents that have been indexed in a vector database. You've set up a simple REST API that allows internal users to query and get back relevant snippets. This context provider will send the query to this server and return the results from the vector database. The return type of `getContextItems` _must_ be an array of objects that have all of the following properties: - -- `name`: The name of the context item, which will be displayed as a title -- `description`: A longer description of the context item -- `content`: The actual content of the context item, which will be fed to the LLM as context - -```typescript title="~/.continue/config.ts" -const RagContextProvider: CustomContextProvider = { - title: "rag", - displayTitle: "RAG", - description: - "Retrieve snippets from our vector database of internal documents", - - getContextItems: async ( - query: string, - extras: ContextProviderExtras, - ): Promise => { - const response = await fetch("https://internal_rag_server.com/retrieve", { - method: "POST", - body: JSON.stringify({ query }), - }); - - const results = await response.json(); - - return results.map((result) => ({ - name: result.title, - description: result.title, - content: result.contents, - })); - }, -}; -``` - -It can then be added in `config.ts` like so: - -```typescript title="~/.continue/config.ts" -export function modifyConfig(config: Config): Config { - if (!config.contextProviders) { - config.contextProviders = []; - } - config.contextProviders.push(RagContextProvider); - return config; -} -``` - -No modification in `config.json` is necessary. - -### Custom Context Providers with Submenu or Query - -There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far. - -The **"query"** type is used when you want to display a text box to the user, and then use the contents of that text box to generate the context items. Built-in examples include ["search"](#exact-search) and ["google"](#google). This text is what gets passed to the "query" argument in `getContextItems`. To implement a "query" context provider, simply set `"type": "query"` in your custom context provider object. - -The **"submenu"** type is used when you want to display a list of searchable items in the dropdown. Built-in examples include ["issue"](#github-issues) and ["folder"](#folders). To implement a "submenu" context provider, set `"type": "submenu"` and implement the `loadSubmenuItems` and `getContextItems` functions. Here is an example that shows a list of all README files in the current workspace: - -```typescript title="~/.continue/config.ts" -const ReadMeContextProvider: CustomContextProvider = { - title: "readme", - displayTitle: "README", - description: "Reference README.md files in your workspace", - type: "submenu", - - getContextItems: async ( - query: string, - extras: ContextProviderExtras, - ): Promise => { - // 'query' is the filepath of the README selected from the dropdown - const content = await extras.ide.readFile(query); - return [ - { - name: getFolder(query), - description: getFolderAndBasename(query), - content, - }, - ]; - }, - - loadSubmenuItems: async ( - args: LoadSubmenuItemsArgs, - ): Promise => { - // Filter all workspace files for READMEs - const allFiles = await args.ide.listWorkspaceContents(); - const readmes = allFiles.filter((filepath) => - filepath.endsWith("README.md"), - ); - - // Return the items that will be shown in the dropdown - return readmes.map((filepath) => { - return { - id: filepath, - title: getFolder(filepath), - description: getFolderAndBasename(filepath), - }; - }); - }, -}; - -export function modifyConfig(config: Config): Config { - if (!config.contextProviders) { - config.contextProviders = []; - } - config.contextProviders.push(ReadMeContextProvider); - return config; -} - -function getFolder(path: string): string { - return path.split(/[\/\\]/g).slice(-2)[0]; -} - -function getFolderAndBasename(path: string): string { - return path - .split(/[\/\\]/g) - .slice(-2) - .join("/"); -} -``` - -The flow of information in the above example is as follows: - -1. The user types `@readme` and selects it from the dropdown, now displaying the submenu where they can search for any item returned by `loadSubmenuItems`. -2. The user selects one of the READMEs in the submenu, enters the rest of their input, and presses enter. -3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README. -4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt. - -### Importing outside modules - -To include outside Node modules in your config.ts, run `npm install ` from the `~/.continue` directory, and then import them in config.ts. - -Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.ts` and any dependencies into a single Javascript file. The exact configuration used can be found [here](https://github.com/continuedev/continue/blob/5c9874400e223bbc9786a8823614a2e501fbdaf7/extensions/vscode/src/ideProtocol.ts#L45-L52). - -### `CustomContextProvider` Reference - -- `title`: An identifier for the context provider -- `displayTitle` (optional): The title displayed in the dropdown -- `description` (optional): The longer description displayed in the dropdown when hovered -- `type` (optional): The type of context provider. Options are "normal", "query", and "submenu". Defaults to "normal". -- `renderInlineAs` (optional): The string that will be rendered inline at the top of the prompt. If no value is provided, the `displayTitle` will be used. An empty string can be provided to prevent rendering the default `displayTitle`. -- `getContextItems`: A function that returns the documents to include in the prompt. It should return a list of `ContextItem`s, and is given access to the following arguments: - - `extras.fullInput`: A string representing the user's full input to the text box. This can be used for example to generate an embedding to compare against a set of other embedded documents - - `extras.embeddingsProvider`: The embeddings provider has an `embed` function that will convert text (such as `fullInput`) to an embedding - - `extras.llm`: The current default LLM, which you can use to make completion requests - - `extras.ide`: An instance of the `IDE` class, which lets you gather various sources of information from the IDE, including the contents of the terminal, the list of open files, or any warnings in the currently open file. - - `query`: (not currently used) A string representing the query -- `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`. - -### Writing Context Providers in Other Languages - -If you'd like to write a context provider in a language other than TypeScript, you can use the "http" context provider to call a server that hosts your own code. Add the context provider to `config.json` like this: - -```json -{ - "name": "http", - "params": { - "url": "https://myserver.com/context-provider", - "title": "http", - "description": "Custom HTTP Context Provider", - "displayTitle": "My Custom Context" - } -} -``` - -Then, create a server that responds to requests as are made from [HttpContextProvider.ts](../../../core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](../../../core/context/providers/context_provider_server.py) for an example that uses FastAPI. - -### Extension API for VSCode - -Continue exposes an API for registering context providers from a 3rd party VSCode extension. This is useful if you have a VSCode extension that provides some additional context that you would like to use in Continue. To use this API, add the following to your `package.json`: - -```json -{ - "extensionDependencies": ["continue.continue"] -} -``` - -Or copy `~/.continue/type/core/index.d.ts` to your extension repository. - -Then, you can use the `registerCustomContextProvider` function to register your context provider. Your custom context provider must implement the `IContextProvider` interface. -Here is an example: - -```typescript -import * as vscode from "vscode"; - -class MyCustomProvider implements IContextProvider { - get description(): ContextProviderDescription { - return { - title: "custom", - displayTitle: "Custom", - description: "Custom description", - type: "normal", - }; - } - - async getContextItems( - query: string, - extras: ContextProviderExtras, - ): Promise { - return [ - { - name: "Custom", - description: "Custom description", - content: "Custom content", - }, - ]; - } - - async loadSubmenuItems( - args: LoadSubmenuItemsArgs, - ): Promise { - return []; - } -} - -// create an instance of your custom provider -const customProvider = new MyCustomProvider(); - -// get Continue extension using vscode API -const continueExt = vscode.extensions.getExtension("continue.continue"); - -// get the API from the extension -const continueApi = continueExt?.exports; - -// register your custom provider -continueApi?.registerCustomContextProvider(customProvider); -``` diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index ab2186d62..45faeb06f 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -204,7 +204,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/togetherllm)", + "### 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://docs.continue.dev/reference/Model%20Providers/together)", "### 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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -244,10 +244,10 @@ "type": "string" }, "region": { - "title": "Region", - "description": "The region where the model is hosted", - "type": "string" - }, + "title": "Region", + "description": "The region where the model is hosted", + "type": "string" + }, "profile": { "title": "Profile", "description": "The AWS security profile to use", @@ -414,7 +414,9 @@ "if": { "properties": { "provider": { - "enum": ["bedrockimport"] + "enum": [ + "bedrockimport" + ] } }, "required": ["provider"] @@ -524,7 +526,7 @@ "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": ["openai", "azure"] } }, "required": ["provider"] @@ -708,13 +710,13 @@ "anyOf": [ { "enum": [ - "claude-2", - "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1" + "claude-2.1", + "claude-2", + "claude-instant-1" ] }, { @@ -757,6 +759,7 @@ "anyOf": [ { "enum": [ + "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -803,7 +806,6 @@ }, "model": { "enum": [ - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -944,33 +946,33 @@ "anyOf": [ { "enum": [ - "mistral-7b", - "llama2-7b", - "llama2-13b", - "codellama-7b", - "codellama-13b", - "codellama-34b", - "codellama-70b", - "llama3-8b", - "llama3-70b", - "llama3.1-8b", - "llama3.1-70b", - "llama3.1-405b", - "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", - "starcoder2-3b", + "mistral:7b", + "llama2:7b", + "llama2:13b", + "codellama:7b", + "codellama:13b", + "codellama:34b", + "codellama:70b", + "llama3:8b", + "llama3:70b", + "llama3.1:8b", + "llama3.1:70b", + "llama3.1:405b", + "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", + "starcoder2:3b", "AUTODETECT" ] }, @@ -1235,7 +1237,6 @@ "claude-2.1", "command-r", "command-r-plus", - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1315,7 +1316,11 @@ "model": { "anyOf": [ { - "enum": ["llama3.1-8b", "llama3.1-70b", "llama3.1-405b"] + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] }, { "type": "string" @@ -1529,8 +1534,7 @@ "url", "database", "os", - "repo-map", - "greptile" + "repo-map" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1554,8 +1558,7 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights", - "Query your greptile index of the current repo" + "Map of files in the repository with important code highlights" ], "type": "string" }, @@ -2478,13 +2481,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2547,12 +2553,6 @@ } } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index ab2186d62..45faeb06f 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -204,7 +204,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/togetherllm)", + "### 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://docs.continue.dev/reference/Model%20Providers/together)", "### 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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -244,10 +244,10 @@ "type": "string" }, "region": { - "title": "Region", - "description": "The region where the model is hosted", - "type": "string" - }, + "title": "Region", + "description": "The region where the model is hosted", + "type": "string" + }, "profile": { "title": "Profile", "description": "The AWS security profile to use", @@ -414,7 +414,9 @@ "if": { "properties": { "provider": { - "enum": ["bedrockimport"] + "enum": [ + "bedrockimport" + ] } }, "required": ["provider"] @@ -524,7 +526,7 @@ "if": { "properties": { "provider": { - "enum": ["openai"] + "enum": ["openai", "azure"] } }, "required": ["provider"] @@ -708,13 +710,13 @@ "anyOf": [ { "enum": [ - "claude-2", - "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1" + "claude-2.1", + "claude-2", + "claude-instant-1" ] }, { @@ -757,6 +759,7 @@ "anyOf": [ { "enum": [ + "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -803,7 +806,6 @@ }, "model": { "enum": [ - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -944,33 +946,33 @@ "anyOf": [ { "enum": [ - "mistral-7b", - "llama2-7b", - "llama2-13b", - "codellama-7b", - "codellama-13b", - "codellama-34b", - "codellama-70b", - "llama3-8b", - "llama3-70b", - "llama3.1-8b", - "llama3.1-70b", - "llama3.1-405b", - "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", - "starcoder2-3b", + "mistral:7b", + "llama2:7b", + "llama2:13b", + "codellama:7b", + "codellama:13b", + "codellama:34b", + "codellama:70b", + "llama3:8b", + "llama3:70b", + "llama3.1:8b", + "llama3.1:70b", + "llama3.1:405b", + "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", + "starcoder2:3b", "AUTODETECT" ] }, @@ -1235,7 +1237,6 @@ "claude-2.1", "command-r", "command-r-plus", - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1315,7 +1316,11 @@ "model": { "anyOf": [ { - "enum": ["llama3.1-8b", "llama3.1-70b", "llama3.1-405b"] + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] }, { "type": "string" @@ -1529,8 +1534,7 @@ "url", "database", "os", - "repo-map", - "greptile" + "repo-map" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1554,8 +1558,7 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights", - "Query your greptile index of the current repo" + "Map of files in the repository with important code highlights" ], "type": "string" }, @@ -2478,13 +2481,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2547,12 +2553,6 @@ } } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } From 7afd26997e3ee835c8dd82535e2c0739adddacbf Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Sat, 14 Sep 2024 20:18:15 -0400 Subject: [PATCH 030/252] one more --- extensions/vscode/continue_rc_schema.json | 89 +++++++++++------------ 1 file changed, 42 insertions(+), 47 deletions(-) diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index d880fad45..c33df73c2 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -207,7 +207,7 @@ "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock)", "### Sagemaker\nSagemaker is AWS' machine learning platform.", - "### 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://docs.continue.dev/reference/Model%20Providers/togetherllm)", + "### 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://docs.continue.dev/reference/Model%20Providers/together)", "### 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 run `. 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.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", "### Huggingface Inference API\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfaceinferenceapi)", @@ -562,7 +562,8 @@ "properties": { "provider": { "enum": [ - "openai" + "openai", + "azure" ] } }, @@ -765,13 +766,13 @@ "anyOf": [ { "enum": [ - "claude-2", - "claude-instant-1", "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", - "claude-2.1" + "claude-2.1", + "claude-2", + "claude-instant-1" ] }, { @@ -825,6 +826,7 @@ "anyOf": [ { "enum": [ + "anthropic.claude-3-5-sonnet-20240620-v1:0", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "claude-2" @@ -879,7 +881,6 @@ }, "model": { "enum": [ - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1034,33 +1035,33 @@ "anyOf": [ { "enum": [ - "mistral-7b", - "llama2-7b", - "llama2-13b", - "codellama-7b", - "codellama-13b", - "codellama-34b", - "codellama-70b", - "llama3-8b", - "llama3-70b", - "llama3.1-8b", - "llama3.1-70b", - "llama3.1-405b", - "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", - "starcoder2-3b", + "mistral:7b", + "llama2:7b", + "llama2:13b", + "codellama:7b", + "codellama:13b", + "codellama:34b", + "codellama:70b", + "llama3:8b", + "llama3:70b", + "llama3.1:8b", + "llama3.1:70b", + "llama3.1:405b", + "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", + "starcoder2:3b", "AUTODETECT" ] }, @@ -1372,7 +1373,6 @@ "claude-2.1", "command-r", "command-r-plus", - "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", "gemini-1.5-pro", @@ -1700,8 +1700,7 @@ "url", "database", "os", - "repo-map", - "greptile" + "repo-map" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1725,8 +1724,7 @@ "Reference the contents of a page at a URL", "Reference table schemas", "Operating system and CPU Information", - "Map of files in the repository with important code highlights", - "Query your greptile index of the current repo" + "Map of files in the repository with important code highlights" ], "type": "string" }, @@ -2784,13 +2782,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2866,12 +2867,6 @@ "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." } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } \ No newline at end of file From 31a95fab2a6b56b1db71231483f599567a67a1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Bub=C3=A1n?= <43829749+Mahrkeenerh@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:42:09 +0200 Subject: [PATCH 031/252] Fix install link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1496503b1..597256325 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ ## Getting Started -Learn about how to install and use Continue in the docs [here](https://continue.dev/docs/getting-started) +Learn about how to install and use Continue in the docs [here](https://continue.dev/docs/getting-started/install) ## Contributing @@ -62,4 +62,4 @@ Check out the [contribution ideas board](https://github.com/orgs/continuedev/pro ## License -[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE) \ No newline at end of file +[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE) From 0529ae8e1e4f61d83f2a4c43c9b9d23a84192ec9 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 18 Sep 2024 16:08:52 -0700 Subject: [PATCH 032/252] fix: broken schema config --- docs/static/schemas/config.json | 15 ++++++--------- .../src/main/resources/config_schema.json | 15 ++++++--------- extensions/vscode/config_schema.json | 15 ++++++--------- extensions/vscode/continue_rc_schema.json | 15 ++++++--------- 4 files changed, 24 insertions(+), 36 deletions(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index cbf47d4b4..911278ebb 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -2476,13 +2476,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2545,12 +2548,6 @@ } } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index cbf47d4b4..911278ebb 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -2476,13 +2476,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2545,12 +2548,6 @@ } } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index cbf47d4b4..911278ebb 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -2476,13 +2476,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2545,12 +2548,6 @@ } } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 58453fc5c..101296fe6 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -2782,13 +2782,16 @@ "type": "object", "properties": { "inlineEdit": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for inline edits", + "type": "string" }, "applyCodeBlock": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for applying code blocks", + "type": "string" }, "repoMapFileSelection": { - "$ref": "#/definitions/ModelTitle" + "description": "The 'title' property of the model you wish to use for repo map file selections", + "type": "string" } } }, @@ -2864,12 +2867,6 @@ "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." } } - }, - "ModelTitle": { - "type": "string", - "enum": { - "$data": "/models/title" - } } } } \ No newline at end of file From 7e5cd9d69f5f33e562d31b51868e9d929872be2f Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 19 Sep 2024 14:49:55 -0700 Subject: [PATCH 033/252] Create auto-assign.yaml --- .github/workflows/auto-assign.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/auto-assign.yaml diff --git a/.github/workflows/auto-assign.yaml b/.github/workflows/auto-assign.yaml new file mode 100644 index 000000000..d252f52a2 --- /dev/null +++ b/.github/workflows/auto-assign.yaml @@ -0,0 +1,19 @@ +name: Issue assignment + +on: + issues: + types: [opened] + pull_request: + types: [opened] + +jobs: + auto-assign: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: "Auto-assign issue" + uses: pozil/auto-assign-issue@v2 + with: + assignees: sestinj,Patrick-Erichsen + numOfAssignee: 1 From 7705833adea0792d40dbe181dc22fc37d5ae72a1 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 19 Sep 2024 14:53:41 -0700 Subject: [PATCH 034/252] Update auto-assign.yaml --- .github/workflows/auto-assign.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-assign.yaml b/.github/workflows/auto-assign.yaml index d252f52a2..1dd452dae 100644 --- a/.github/workflows/auto-assign.yaml +++ b/.github/workflows/auto-assign.yaml @@ -15,5 +15,6 @@ jobs: - name: "Auto-assign issue" uses: pozil/auto-assign-issue@v2 with: + repo-token: ${{ secrets.CI_GITHUB_TOKEN }} assignees: sestinj,Patrick-Erichsen numOfAssignee: 1 From bccb178c8f84b4078e60c5c871d492802b6868cf Mon Sep 17 00:00:00 2001 From: Steve Rhoades Date: Sun, 22 Sep 2024 17:34:17 -0700 Subject: [PATCH 035/252] Fixes #2349 custom code rag instructions --- docs/docs/customize/tutorials/custom-code-rag.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/customize/tutorials/custom-code-rag.md b/docs/docs/customize/tutorials/custom-code-rag.md index 5ae55ebd4..993da23be 100644 --- a/docs/docs/customize/tutorials/custom-code-rag.md +++ b/docs/docs/customize/tutorials/custom-code-rag.md @@ -37,6 +37,7 @@ With LanceDB, we can do steps 2 and 3 simultaneously, as demonstrated [in their ```python from lancedb.pydantic import LanceModel, Vector from lancedb.embeddings import get_registry +from typing import List db = lancedb.connect("/tmp/db") func = get_registry().get("openai").create( @@ -48,7 +49,7 @@ func = get_registry().get("openai").create( class CodeChunks(LanceModel): filename: str text: str = func.SourceField() - vector: Vector(func.ndims()) = func.VectorField() + vector: List[float] = func.VectorField() table = db.create_table("code_chunks", schema=CodeChunks, mode="overwrite") table.add([ From 0387721222475af4aaf38ad329fad3fd43a76229 Mon Sep 17 00:00:00 2001 From: Steve Rhoades Date: Sun, 22 Sep 2024 17:34:17 -0700 Subject: [PATCH 036/252] Fixes #2349 correct documentation --- docs/docs/customize/tutorials/custom-code-rag.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/customize/tutorials/custom-code-rag.md b/docs/docs/customize/tutorials/custom-code-rag.md index 993da23be..6793a8277 100644 --- a/docs/docs/customize/tutorials/custom-code-rag.md +++ b/docs/docs/customize/tutorials/custom-code-rag.md @@ -37,7 +37,6 @@ With LanceDB, we can do steps 2 and 3 simultaneously, as demonstrated [in their ```python from lancedb.pydantic import LanceModel, Vector from lancedb.embeddings import get_registry -from typing import List db = lancedb.connect("/tmp/db") func = get_registry().get("openai").create( @@ -49,7 +48,8 @@ func = get_registry().get("openai").create( class CodeChunks(LanceModel): filename: str text: str = func.SourceField() - vector: List[float] = func.VectorField() + # 1536 is the embedding dimension of the `voyage-code-2` model. + vector: Vector(1536) = func.VectorField() table = db.create_table("code_chunks", schema=CodeChunks, mode="overwrite") table.add([ From fa3afd52e766c298a9bfa62c57e8a9b6e695b1d6 Mon Sep 17 00:00:00 2001 From: lolikung Date: Mon, 23 Sep 2024 14:56:07 +0800 Subject: [PATCH 037/252] fix: config-types "useSuffix" to "useFileSuffix" --- packages/config-types/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 822312969..14ff2b4bd 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -128,7 +128,7 @@ export type UiOptions = z.infer; export const tabAutocompleteOptionsSchema = z.object({ disable: z.boolean(), useCopyBuffer: z.boolean(), - useSuffix: z.boolean(), + useFileSuffix: z.boolean(), maxPromptTokens: z.number(), debounceDelay: z.number(), maxSuffixPercentage: z.number(), From 7f214adcbdca33ebb7270f721fd57eeeb0bac1e8 Mon Sep 17 00:00:00 2001 From: Shigma Date: Mon, 23 Sep 2024 18:02:31 +0800 Subject: [PATCH 038/252] fix: fix 100% indexing progress --- core/core.ts | 2 +- core/indexing/CodebaseIndexer.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/core.ts b/core/core.ts index f33ab17d4..3e5129a62 100644 --- a/core/core.ts +++ b/core/core.ts @@ -140,7 +140,7 @@ export class Core { // Respect pauseCodebaseIndexOnStart user settings if (ideSettings.pauseCodebaseIndexOnStart) { await this.messenger.request("indexProgress", { - progress: 100, + progress: 1, desc: "Initial Indexing Skipped", status: "paused", }); diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index bc53539f4..bf16b2a5d 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -249,10 +249,11 @@ export class CodebaseIndexer { } } yield { - progress: 100, + progress: 1, desc: "Indexing Complete", status: "done", }; + this.logProgress(beginTime, 0, 1); } private handleErrorAndGetProgressUpdate( From f3f46e4275c709663ac4b1b814c25e0201961f6e Mon Sep 17 00:00:00 2001 From: Steve Rhoades Date: Mon, 23 Sep 2024 09:54:55 -0700 Subject: [PATCH 039/252] Refactor HttpContextProvider to support an array of ContextItems from the response --- core/context/providers/HttpContextProvider.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/core/context/providers/HttpContextProvider.ts b/core/context/providers/HttpContextProvider.ts index a33bcb775..9e6aaa8c7 100644 --- a/core/context/providers/HttpContextProvider.ts +++ b/core/context/providers/HttpContextProvider.ts @@ -39,14 +39,15 @@ class HttpContextProvider extends BaseContextProvider { }), }); - const json: any = await response.json(); - return [ - { - description: json.description || "HTTP Context Item", - content: json.content || "", - name: json.name || this.options.title || "HTTP", - }, - ]; + const json = await response.json(); + + const createContextItem = (item: any) => ({ + description: item.description ?? "HTTP Context Item", + content: item.content ?? "", + name: item.name ?? this.options.title ?? "HTTP", + }); + + return Array.isArray(json) ? json.map(createContextItem) : [createContextItem(json)]; } } From c4281b275ab01a0925a0957ffdf32408ce52318a Mon Sep 17 00:00:00 2001 From: Steve Rhoades Date: Mon, 23 Sep 2024 10:11:25 -0700 Subject: [PATCH 040/252] add docs for http context provider --- docs/docs/customize/context-providers.md | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index daed6d63b..4891f85ec 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -435,6 +435,49 @@ Reference the architecture and platform of your current operating system. } ``` +### `@HTTP` + +The HttpContextProvider makes a POST request to the url passed in the configuration. The server must return 200 OK with a ContextItem object or an array of ContextItems. + +```json title="config.json" +{ + "contextProviders": [ + { + "name": "http", + "params": { + "url": "https://api.example.com/v1/users", + } + } + ] +} +``` + +The receiving URL should expect to receive the following parameters: +```json title="POST parameters" +{ + query: string, + fullInput: string +} +``` + +The response 200 OK should be a JSON object with the following structure: +```json title="Response" +[ + { + "name": "", + "description": "", + "content": "" + } +] + +// OR +{ + "name": "", + "description": "", + "content": "" +} +``` + ### 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 Context Provider. From 2376dafce325c87d87090e7cf995beffcb98d3b4 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 11:33:35 -0700 Subject: [PATCH 041/252] feat: improve prompt log formatting + detail --- core/llm/index.ts | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index ff950929e..fd36222c9 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -262,16 +262,29 @@ export abstract class BaseLLM implements ILLM { prompt: string, completionOptions: CompletionOptions, ): string { - const dict = { contextLength: this.contextLength, ...completionOptions }; - const settings = Object.entries(dict) - .map(([key, value]) => `${key}: ${value}`) - .join("\n"); - return `Settings: -${settings} + const completionOptionsLog = JSON.stringify( + { + contextLength: this.contextLength, + ...completionOptions, + }, + null, + 2, + ); -############################################ + let requestOptionsLog = ""; + if (this.requestOptions) { + requestOptionsLog = JSON.stringify(this.requestOptions, null, 2); + } -${prompt}`; + return ( + "##### Completion options #####\n" + + completionOptionsLog + + (requestOptionsLog + ? "\n\n##### Request options #####\n" + requestOptionsLog + : "") + + "\n\n##### Prompt #####\n" + + prompt + ); } private _logTokensGenerated( @@ -703,9 +716,6 @@ ${prompt}`; this.providerName, autodetectTemplateType(this.model), ); - if (!templateMessages) { - return rendered; - } return templateMessages(rendered); } return rendered; From 9f426035bcca9d8f628533a0183d2455644d48c2 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 11:54:42 -0700 Subject: [PATCH 042/252] Update context-providers.md --- docs/docs/customize/context-providers.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index daed6d63b..c186171f9 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -380,7 +380,13 @@ Reference table schemas from Sqlite, Postgres, and MySQL databases. } ``` -Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type. +Each connection should include a unique name, the `connection_type`, and the necessary connection parameters specific to each database type. + +Available connection types: + +- `postgres` +- `mysql` +- `sqlite` ### `@Locals` From 666f4648f97fc066cb28ab50b83e4d7f2bdea905 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 11:59:43 -0700 Subject: [PATCH 043/252] Update autodetect.ts --- core/llm/autodetect.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index e87e7417e..31eccfc8f 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -74,6 +74,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "sonnet", "opus", "haiku", + "pixtral", ]; function modelSupportsImages( From 1c6dbc8b617b26cd8994f1b56adccee0f944e5c1 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 23 Sep 2024 16:02:34 -0700 Subject: [PATCH 044/252] update tutorial file --- .prettierignore | 3 +- .../src/main/resources/continue_tutorial.py | 62 ++------ extensions/vscode/continue_tutorial.py | 76 ++------- .../providers/QuickActionsCodeLensProvider.ts | 6 +- .../providers/TutorialCodeLensProvider.ts | 144 ------------------ .../lang-server/codeLens/providers/index.ts | 2 +- .../codeLens/registerAllCodeLensProviders.ts | 8 +- 7 files changed, 37 insertions(+), 264 deletions(-) diff --git a/.prettierignore b/.prettierignore index fcb08552d..fbfae5c57 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ extensions/vscode/continue_rc_schema.json **/.continueignore -CHANGELOG.md \ No newline at end of file +CHANGELOG.md +**/continue_tutorial.py \ No newline at end of file diff --git a/extensions/intellij/src/main/resources/continue_tutorial.py b/extensions/intellij/src/main/resources/continue_tutorial.py index 87b5a7f45..e2a4d59e7 100644 --- a/extensions/intellij/src/main/resources/continue_tutorial.py +++ b/extensions/intellij/src/main/resources/continue_tutorial.py @@ -1,69 +1,33 @@ -""" -Welcome to Continue! +""" _________ _____ _____ + __ ____/______ _______ __ /____(_)_______ ____ _______ + _ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \ + / /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/ + \____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/ -_________ _____ _____ -__ ____/______ _______ __ /____(_)_______ ____ _______ -_ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \ -/ /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/ -\____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/ - -This is a 2 minute tutorial. - -It will walk you through two basic features: -1. Ask a question -2. Edit code + Chat, Edit, and Autocomplete tutorial """ -# region —————————————————————————— Part 1: Ask a question about code [⌘ J] —————————————————————————— +# ———————————————————— Chat [Cmd/Ctrl + J]: Ask "what sorting algorithm is this?" ———————————————————— - -"""Step 1: Highlight the function below""" - - -def mysterious_function(x): +def sorting_algorithm(x): for i in range(len(x)): for j in range(len(x) - 1): if x[j] > x[j + 1]: x[j], x[j + 1] = x[j + 1], x[j] - return x +# —————————————————— Edit [Cmd/Ctrl + I]: Tell Continue to "make this more readable" ————————————————— -"""Step 2: Use the keyboard shortcut [⌘ J] to -select the code and toggle the Continue input box""" - -"""Step 3: Ask a question and press enter""" -# e.g.) what does this function do? -# e.g.) what should I call this function? - -# endregion - - -# region ————————————————————————————————— Part 2: Edit code [⌘ I] ————————————————————————————————— - - -"""Step 1: Highlight this code""" - - -def bubble_sort(x): +def sorting_algorithm(x): for i in range(len(x)): for j in range(len(x) - 1): if x[j] > x[j + 1]: x[j], x[j + 1] = x[j + 1], x[j] - return x +# ——————————————— Autocomplete [Tab]: Place cursor after `:` below and press [Enter] ————————————————— -"""Step 2: Use the keyboard shortcut [⌘ I] to -select the code""" +# Basic assertion for sorting_algorithm: -"""Step 3: Type instructions to edit the code and press Enter""" -# e.g.) "optimize this function" -# e.g.) "edit write comments" -"""Step 4: Use keyboard shortcuts to -accept [⌥ ⇧ Y] or reject [⌥ ⇧ N] the edit""" - -# endregion - -# Ready to learn more? Check out the Continue documentation: https://docs.continue.dev \ No newline at end of file +"—————————————————— Learn more at https://docs.continue.dev/getting-started/overview ————————————————" \ No newline at end of file diff --git a/extensions/vscode/continue_tutorial.py b/extensions/vscode/continue_tutorial.py index fe52925cb..c10e5c209 100644 --- a/extensions/vscode/continue_tutorial.py +++ b/extensions/vscode/continue_tutorial.py @@ -1,79 +1,33 @@ -""" -_________ _____ _____ -__ ____/______ _______ __ /____(_)_______ ____ _______ -_ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \ -/ /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/ -\____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/ +""" _________ _____ _____ + __ ____/______ _______ __ /____(_)_______ ____ _______ + _ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \ + / /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/ + \____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/ -Welcome to Continue! This is a 2 minute tutorial. - -You can click the gray buttons, starting with "Highlight the function" to follow along. + Chat, Edit, and Autocomplete tutorial """ -# region —————————————————————————— Part 1: Ask a question about code [Cmd+L] —————————————————————————— +# ———————————————————— Chat [Cmd/Ctrl + L]: Ask "what sorting algorithm is this?" ———————————————————— - -"""Step 1: Highlight the function below""" - - -def mysterious_function(x): +def sorting_algorithm(x): for i in range(len(x)): for j in range(len(x) - 1): if x[j] > x[j + 1]: x[j], x[j + 1] = x[j + 1], x[j] - return x +# —————————————————— Edit [Cmd/Ctrl + I]: Tell Continue to "make this more readable" ————————————————— -"""Step 2: Use the keyboard shortcut [Cmd+L] to -select the code and toggle the Continue input box""" - -"""Step 3: Ask a question and press Enter""" - -# endregion - -# region ————————————————————————————————— Part 2: Edit code [Cmd+I] ————————————————————————————————— - - -"""Step 1: Highlight this code""" - - -def mysterious_function(x): - n = len(x) - for i in range(n): - swapped = False - for j in range(0, n - i - 1): +def sorting_algorithm(x): + for i in range(len(x)): + for j in range(len(x) - 1): if x[j] > x[j + 1]: x[j], x[j + 1] = x[j + 1], x[j] - swapped = True - if swapped == False: - break return x +# ——————————————— Autocomplete [Tab]: Place cursor after `:` below and press [Enter] ————————————————— -"""Step 2: Use the keyboard shortcut [Cmd+I] to edit""" - -"""Step 3: Type "" and press Enter""" - -"""Step 4: Use keyboard shortcuts to -accept [Cmd+Shift+Enter] or reject [Cmd+Shift+Backspace] the edit""" - -# endregion - -# region ———————————————————————————— Part 3: Debug automatically [Cmd+Shift+R] ———————————————————————————— +# Basic assertion for sorting_algorithm: -"""Step 1: Run this Python file (it should error!)""" - - -def print_sum(list_to_print): - print(sum(list_to_print)) - - -"""Step 2: Use the keyboard shortcut [Cmd+Shift+R] -to automatically debug the error""" -print_sum(["a", "b", "c"]) - -# endregion - -# Ready to learn more? Check out the Continue documentation: https://docs.continue.dev +"—————————————————— Learn more at https://docs.continue.dev/getting-started/overview ————————————————" \ No newline at end of file diff --git a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts index 8f0c8adfe..5f6748b61 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts @@ -6,7 +6,11 @@ import { CONTINUE_WORKSPACE_KEY, getContinueWorkspaceConfig, } from "../../../util/workspaceConfig"; -import { isTutorialFile } from "./TutorialCodeLensProvider"; + +const TUTORIAL_FILE_NAME = "continue_tutorial.py"; +function isTutorialFile(uri: vscode.Uri) { + return uri.fsPath.endsWith(TUTORIAL_FILE_NAME); +} export const ENABLE_QUICK_ACTIONS_KEY = "enableQuickActions"; diff --git a/extensions/vscode/src/lang-server/codeLens/providers/TutorialCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/TutorialCodeLensProvider.ts index 28948417f..139597f9c 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/TutorialCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/TutorialCodeLensProvider.ts @@ -1,146 +1,2 @@ -import * as os from "node:os"; -import path from "path"; -import * as vscode from "vscode"; -import { getPlatform } from "../../../util/util"; -import { getExtensionUri } from "../../../util/vscode"; -import { QuickEditShowParams } from "../../../quickEdit/QuickEditQuickPick"; -interface TutorialCodeLensItems { - lineIncludes: string; - commands: vscode.Command[]; -} -const TUTORIAL_FILE_NAME = "continue_tutorial.py"; - -const cmdCtrl = getPlatform() === "mac" ? "Cmd" : "Ctrl"; - -const actions: TutorialCodeLensItems[] = [ - { - lineIncludes: `Step 2: Use the keyboard shortcut [${cmdCtrl}+L]`, - commands: [ - { - title: `${cmdCtrl}+L`, - command: "continue.focusContinueInput", - }, - ], - }, - { - lineIncludes: "Step 3: Ask a question", - commands: [ - { - title: `"what does this code do?"`, - command: "continue.sendMainUserInput", - arguments: ["what does this code do?"], - }, - { - title: `"what is an alternative to this?"`, - command: "continue.sendMainUserInput", - arguments: ["what is an alternative to this?"], - }, - ], - }, - { - lineIncludes: `Step 2: Use the keyboard shortcut [${cmdCtrl}+I] to edit`, - commands: [ - { - title: `${cmdCtrl}+I`, - command: "continue.quickEdit", - arguments: [{ initialPrompt: "Add comments" } as QuickEditShowParams], - }, - ], - }, - { - lineIncludes: "Step 1: Run this Python file", - commands: [ - { - title: "Run the file", - command: "continue.sendToTerminal", - arguments: [ - `python "${path.join( - getExtensionUri().fsPath, - "continue_tutorial.py", - )}"\n`, - ], - }, - ], - }, - { - lineIncludes: "Step 2: Use the keyboard shortcut cmd/ctrl + shift + R", - commands: [ - { - title: "Debug the error", - command: "continue.debugTerminal", - }, - ], - }, - { - lineIncludes: `Step 2: Use the keyboard shortcut [${cmdCtrl}+Shift+R]`, - commands: [ - { - title: `${cmdCtrl}+Shift+R`, - command: "continue.debugTerminal", - }, - ], - }, -]; - -export function isTutorialFile(uri: vscode.Uri) { - return uri.fsPath.endsWith(TUTORIAL_FILE_NAME); -} - -export class TutorialCodeLensProvider implements vscode.CodeLensProvider { - public provideCodeLenses( - document: vscode.TextDocument, - _: vscode.CancellationToken, - ): vscode.CodeLens[] | Thenable { - const codeLenses: vscode.CodeLens[] = []; - - if (!isTutorialFile(document.uri)) { - return codeLenses; - } - - const lines = document.getText().split(os.EOL); - - for (const action of actions) { - const lineOfAction = lines.findIndex((line) => - line.includes(action.lineIncludes), - ); - - if (lineOfAction >= 0) { - const range = new vscode.Range(lineOfAction, 0, lineOfAction + 1, 0); - for (const command of action.commands) { - codeLenses.push(new vscode.CodeLens(range, command)); - } - } - } - - const lineOf11 = lines.findIndex((line) => - line.includes("Step 1: Highlight the function below"), - ); - if (lineOf11 >= 0) { - const range = new vscode.Range(lineOf11, 0, lineOf11 + 1, 0); - codeLenses.push( - new vscode.CodeLens(range, { - title: "Highlight the function", - command: "continue.selectRange", - arguments: [lineOf11 + 3, lineOf11 + 11], - }), - ); - } - const lineOf21 = lines.findIndex((line) => - line.includes("Step 1: Highlight this code"), - ); - if (lineOf21 >= 0) { - const range = new vscode.Range(lineOf21, 0, lineOf21 + 1, 0); - codeLenses.push( - new vscode.CodeLens(range, { - title: "Highlight the function", - command: "continue.selectRange", - arguments: [lineOf21 + 3, lineOf21 + 14], - }), - ); - } - - return codeLenses; - } -} diff --git a/extensions/vscode/src/lang-server/codeLens/providers/index.ts b/extensions/vscode/src/lang-server/codeLens/providers/index.ts index f5bdfc4d7..599d63145 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/index.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/index.ts @@ -2,5 +2,5 @@ export { ConfigPyCodeLensProvider } from "./ConfigPyCodeLensProvider"; export { DiffViewerCodeLensProvider } from "./DiffViewerCodeLensProvider"; export { QuickActionsCodeLensProvider } from "./QuickActionsCodeLensProvider"; export { SuggestionsCodeLensProvider } from "./SuggestionsCodeLensProvider"; -export { TutorialCodeLensProvider } from "./TutorialCodeLensProvider"; export { VerticalPerLineCodeLensProvider } from "./VerticalPerLineCodeLensProvider"; + diff --git a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts index 89066fbc8..cfaabde06 100644 --- a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts +++ b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts @@ -1,7 +1,7 @@ import { ContinueConfig } from "core"; import * as vscode from "vscode"; -import { VerticalDiffCodeLens } from "../../diff/verticalPerLine/manager"; import { DiffManager } from "../../diff/horizontal"; +import { VerticalDiffCodeLens } from "../../diff/verticalPerLine/manager"; import * as providers from "./providers"; import { getQuickActionsConfig, @@ -121,11 +121,6 @@ export function registerAllCodeLensProviders( new providers.ConfigPyCodeLensProvider(), ); - tutorialCodeLensDisposable = registerCodeLensProvider( - "*", - new providers.TutorialCodeLensProvider(), - ); - registerQuickActionsProvider(config, context); subscribeToVSCodeQuickActionsSettings(() => @@ -136,7 +131,6 @@ export function registerAllCodeLensProviders( context.subscriptions.push(suggestionsCodeLensDisposable); context.subscriptions.push(diffsCodeLensDisposable); context.subscriptions.push(configPyCodeLensDisposable); - context.subscriptions.push(tutorialCodeLensDisposable); return { verticalDiffCodeLens }; } From 870e18f34afb34bea305ade16722d16242c2b5d0 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 23 Sep 2024 16:03:16 -0700 Subject: [PATCH 045/252] update changelog for tutorial file --- .changes/unreleased/Changed-20240923-160251.yaml | 4 ++++ .changes/unreleased/Changed-20240923-160302.yaml | 4 ++++ extensions/intellij/CHANGELOG.md | 4 ++++ extensions/vscode/CHANGELOG.md | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 .changes/unreleased/Changed-20240923-160251.yaml create mode 100644 .changes/unreleased/Changed-20240923-160302.yaml diff --git a/.changes/unreleased/Changed-20240923-160251.yaml b/.changes/unreleased/Changed-20240923-160251.yaml new file mode 100644 index 000000000..5cef25bab --- /dev/null +++ b/.changes/unreleased/Changed-20240923-160251.yaml @@ -0,0 +1,4 @@ +project: extensions/intellij +kind: Changed +body: Updated tutorial file +time: 2024-09-23T16:02:51.918152-07:00 diff --git a/.changes/unreleased/Changed-20240923-160302.yaml b/.changes/unreleased/Changed-20240923-160302.yaml new file mode 100644 index 000000000..55cb8a77a --- /dev/null +++ b/.changes/unreleased/Changed-20240923-160302.yaml @@ -0,0 +1,4 @@ +project: extensions/vscode +kind: Changed +body: Updated tutorial file +time: 2024-09-23T16:03:02.944462-07:00 diff --git a/extensions/intellij/CHANGELOG.md b/extensions/intellij/CHANGELOG.md index 7ed8107f4..3483adeb9 100644 --- a/extensions/intellij/CHANGELOG.md +++ b/extensions/intellij/CHANGELOG.md @@ -5,6 +5,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +Pre-release Changes +### Changed +* Updated tutorial file + ## 0.0.69 - 2024-09-22 ### Added * Support for the "search" context provider diff --git a/extensions/vscode/CHANGELOG.md b/extensions/vscode/CHANGELOG.md index 95ea80d30..ffa85e2d1 100644 --- a/extensions/vscode/CHANGELOG.md +++ b/extensions/vscode/CHANGELOG.md @@ -6,6 +6,8 @@ and is generated by [Changie](https://github.com/miniscruff/changie). Pre-release Changes +### Changed +* Updated tutorial file ### Fixed * Continue for teams auth bug fix From f2328b5fe09be6936c3738ff9cba5f0e693f81c9 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 16:29:11 -0700 Subject: [PATCH 046/252] Update troubleshooting.md --- docs/docs/troubleshooting.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index 8852cf3f4..d3933f6f9 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -122,6 +122,10 @@ If you are having persistent errors with indexing, our recommendation is to rebu This can be accomplished using the following command: `Continue: Rebuild codebase index`. +### Android Studio - "Nothing to show" in Chat + +This can be fixed by selecting `Actions > Choose Boot runtime for the IDE` then selecting the latest version, and then restarting Android Studio. [See this thread](https://github.com/continuedev/continue/issues/2280#issuecomment-2365231567) for details. + ## Still having trouble? You can also join our Discord community [here](https://discord.gg/vapESyrFmJ) for additional support and discussions. Alternatively, you can create a GitHub issue [here](https://github.com/continuedev/continue/issues/new?assignees=&labels=bug&projects=&template=bug-report-%F0%9F%90%9B.md&title=), providing details of your problem, and we'll be able to help you out more quickly. From b32c36fb9b8d7f53cba302526e51524951643418 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 16:56:09 -0700 Subject: [PATCH 047/252] updated configs --- docs/static/schemas/config.json | 8 ++++++++ extensions/intellij/src/main/resources/config_schema.json | 7 +++++++ extensions/vscode/continue_rc_schema.json | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 911278ebb..176bbd295 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1044,6 +1044,7 @@ "llama2-70b", "mistral-8x7b", "gemma", + "gemma2", "llama3-8b", "llama3-70b", "llama3.1-8b", @@ -2114,6 +2115,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 5a20c6daf..176bbd295 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -2115,6 +2115,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 7a7e54764..8a1c0bca0 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -2356,6 +2356,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", From 5105645dedec92abd3fc613777f60fd2a638a0ab Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 18:25:56 -0700 Subject: [PATCH 048/252] fix: add new UI breakpoints --- .../OnboardingCard/OnboardingCard.tsx | 5 +- .../components/BestExperienceConfigForm.tsx | 10 +- .../components/OllamaCompletedStep.tsx | 2 +- .../components/OllamaModelDownload.tsx | 2 +- .../components/OllamaStatus.tsx | 4 +- .../components/OnboardingCardTabs.tsx | 85 +++++++++---- .../components/ProviderAlert.tsx | 2 +- .../OnboardingCard/tabs/OnboardingBestTab.tsx | 4 +- .../tabs/OnboardingQuickstartTab.tsx | 10 +- gui/src/components/gui/StepContainer.tsx | 6 +- gui/src/components/mainInput/InputToolbar.tsx | 24 ++-- .../components/modelSelection/ModelSelect.tsx | 118 +++++++++--------- gui/tailwind.config.cjs | 9 +- 13 files changed, 166 insertions(+), 115 deletions(-) diff --git a/gui/src/components/OnboardingCard/OnboardingCard.tsx b/gui/src/components/OnboardingCard/OnboardingCard.tsx index 251ff7b1c..aba23e14a 100644 --- a/gui/src/components/OnboardingCard/OnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/OnboardingCard.tsx @@ -9,7 +9,6 @@ import { useOnboardingCard } from "./hooks/useOnboardingCard"; const StyledCard = styled.div` margin: auto; border-radius: ${defaultBorderRadius}; - padding: 1rem 1.5rem; background-color: ${vscInputBackground}; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); @@ -43,13 +42,13 @@ export function OnboardingCard(props: OnboardingCardProps) { } return ( - + - +
{renderTabContent()}
diff --git a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx index ee061e1f9..f38fbaccd 100644 --- a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +++ b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx @@ -65,13 +65,13 @@ function BestExperienceConfigForm({
{chatModel.title}{" "} - by Anthropic + by Anthropic
@@ -99,13 +99,13 @@ function BestExperienceConfigForm({
{autocompleteModel.title}{" "} - by Mistral + by Mistral
@@ -129,7 +129,7 @@ function BestExperienceConfigForm({ -
+
diff --git a/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx b/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx index ee3eb942c..44c5c5caa 100644 --- a/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx @@ -7,7 +7,7 @@ interface OllamaCompletedStepProps { function OllamaCompletedStep({ text }: OllamaCompletedStepProps) { return (
-

{text}

+

{text}

); diff --git a/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx b/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx index 37831a70f..721807c6a 100644 --- a/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx @@ -35,7 +35,7 @@ function OllamaModelDownload({ ) : ( <> -

{command}

+

{command}

{tooltipPortalDiv && diff --git a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx index 9cc323ec6..39bd7978c 100644 --- a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx @@ -35,14 +35,14 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) { case OllamaConnectionStatuses.WaitingToDownload: return ( -

{downloadUrl}

+

{downloadUrl}

); case OllamaConnectionStatuses.Downloading: return (
-

+

Checking for connection to Ollama at http://localhost:11434

diff --git a/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx b/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx index 7e7fcdcee..d44524cb5 100644 --- a/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx +++ b/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx @@ -9,23 +9,39 @@ interface OnboardingCardTabsProps { export type TabTitle = "Quickstart" | "Best" | "Local"; -export const TabTitles: { [k in TabTitle]: { xs: string; default: string } } = { +export const TabTitles: { [k in TabTitle]: { md: string; default: string } } = { Quickstart: { - xs: "Quickstart", + md: "Quickstart", default: "Quickstart", }, Best: { - xs: "Best", + md: "Best", default: "Best experience", }, Local: { - xs: "Local", + md: "Local", default: "Local with Ollama", }, }; +const StyledSelect = styled.select` + width: 100%; + padding: 0.5rem; + background-color: transparent; + color: ${vscForeground}; + border: none; + border-bottom: 1px solid ${vscForeground}; + border-radius: 0; + font-size: 1rem; + cursor: pointer; + display: block; + + &:focus { + outline: none; + } +`; + const TabButton = styled.button<{ isActive: boolean }>` - padding: 1rem 1rem 0.5rem 1rem; margin-bottom: -1px; focus: outline-none; background: transparent; @@ -54,23 +70,48 @@ export function OnboardingCardTabs({ onTabClick, }: OnboardingCardTabsProps) { return ( - - {Object.entries(TabTitles).map(([tabType, titles]) => { - if (hasPassedFTL() && tabType === "Quickstart") { - return undefined; - } +
+
+ + {Object.entries(TabTitles).map(([tabType, titles]) => { + if (hasPassedFTL() && tabType === "Quickstart") { + return undefined; + } - return ( - onTabClick(tabType as TabTitle)} - > -

{titles.default}

-

{titles.xs}

-
- ); - })} -
+ return ( + onTabClick(tabType as TabTitle)} + > +

+ {titles.default} +

+

{titles.md}

+
+ ); + })} + +
+
+ onTabClick(e.target.value as TabTitle)} + > + {Object.entries(TabTitles).map(([tabType, titles]) => { + if (hasPassedFTL() && tabType === "Quickstart") { + return null; + } + + return ( + + ); + })} + +
+
); } diff --git a/gui/src/components/OnboardingCard/components/ProviderAlert.tsx b/gui/src/components/OnboardingCard/components/ProviderAlert.tsx index dd1e9f339..8c2c1ca6f 100644 --- a/gui/src/components/OnboardingCard/components/ProviderAlert.tsx +++ b/gui/src/components/OnboardingCard/components/ProviderAlert.tsx @@ -17,7 +17,7 @@ function ProviderAlert() { } return ( -
+

Prefer to use an different provider like OpenAI? diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx index 0f5e5f441..d5b372245 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx @@ -7,7 +7,9 @@ function OnboardingBestTab() { return (

- +
+ +
); diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx index f0eadf43b..ff77e18e8 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx @@ -3,18 +3,18 @@ import QuickStartSubmitButton from "../components/QuickStartSubmitButton"; function OnboardingQuickstartTab() { return ( -
-
-
+
+
+
-

+

Quickly get up and running using our API keys. After this trial, we'll help you set up your own models.

-

+

To prevent abuse, we'll ask you to sign in to GitHub.

diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 48f8cbc2a..9354a73b5 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -124,14 +124,14 @@ function StepContainer(props: StepContainerProps) { {(props.isLast || isHovered || typeof feedback !== "undefined") && !active && (
{props.modelTitle && ( - <> +
{props.modelTitle}
- +
)} {truncatedEarly && ( diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index a95a71502..907ff7fed 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -207,17 +207,19 @@ function InputToolbar(props: InputToolbarProps) { {getMetaKeyLabel()} ⏎ Use @codebase )} - { - props.onEnter({ - useCodebase: isMetaEquivalentKeyPressed(e), - noContext: useActiveFile ? e.altKey : !e.altKey, - }); - }} - > - ⏎ Enter - +
+ { + props.onEnter({ + useCodebase: isMetaEquivalentKeyPressed(e), + noContext: useActiveFile ? e.altKey : !e.altKey, + }); + }} + > + ⏎ Enter + +
diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 548d83537..cfa3a2fe1 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -304,65 +304,67 @@ function ModelSelect() { } return ( - { - if (val === defaultModel?.title) return; - dispatch(setDefaultModel({ title: val })); - await ideMessenger.request("update/modelChange", val); - }} - > -
- - - {modelSelectTitle(defaultModel) || "Select model"}{" "} - - - -
- {sortedOptions.map((option, idx) => ( - 1} - showMissingApiKeyMsg={option.apiKey === ""} - /> - ))} -
- -
- {selectedProfileId === "local" && ( - <> - {options.length > 0 && } - - -
- - Add Chat model -
-
- - )} - - - - - {getMetaKeyLabel()} + ' to toggle +
+ { + if (val === defaultModel?.title) return; + dispatch(setDefaultModel({ title: val })); + await ideMessenger.request("update/modelChange", val); + }} + > +
+ + + {modelSelectTitle(defaultModel) || "Select model"}{" "} + -
- -
- + + +
+ {sortedOptions.map((option, idx) => ( + 1} + showMissingApiKeyMsg={option.apiKey === ""} + /> + ))} +
+ +
+ {selectedProfileId === "local" && ( + <> + {options.length > 0 && } + + +
+ + Add Chat model +
+
+ + )} + + + + + {getMetaKeyLabel()} + ' to toggle + +
+
+
+ +
); } diff --git a/gui/tailwind.config.cjs b/gui/tailwind.config.cjs index 26c9495f5..ffea05a7d 100644 --- a/gui/tailwind.config.cjs +++ b/gui/tailwind.config.cjs @@ -9,8 +9,13 @@ module.exports = { ], theme: { screens: { - xs: "425px", - ...defaultTheme.screens, + xxs: "170px", // Smallest width for Primary Sidebar in VS Code + xs: "250px", // Default sidebar width in VS Code + sm: "320px", + md: "480px", + lg: "640px", // Tailwind's default 'sm' + xl: "768px", // Tailwind's default 'md' + "2xl": "1024px", // Tailwind's default 'lg' }, extend: { animation: { From 49261a611788784fe7f2b91630764dcfb4f6cf72 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 18:36:20 -0700 Subject: [PATCH 049/252] remove input toolbar on smallest breakpoint --- gui/src/components/mainInput/InputToolbar.tsx | 2 +- gui/src/components/mainInput/TipTapEditor.tsx | 1 + .../components/modelSelection/ModelSelect.tsx | 118 +++++++++--------- 3 files changed, 60 insertions(+), 61 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 907ff7fed..367741b27 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -28,7 +28,6 @@ import ModelSelect from "../modelSelection/ModelSelect"; const StyledDiv = styled.div<{ isHidden: boolean }>` padding: 4px 0; - display: flex; justify-content: space-between; gap: 1px; background-color: ${vscInputBackground}; @@ -110,6 +109,7 @@ function InputToolbar(props: InputToolbarProps) { isHidden={props.hidden} onClick={props.onClick} id="input-toolbar" + className="hidden xs:flex" > diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 2fc543907..a57d19bda 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -894,6 +894,7 @@ function TipTapEditor(props: TipTapEditorProps) { }); }} /> + {showDragOverMsg && modelSupportsImages( defaultModel.provider, diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index cfa3a2fe1..548d83537 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -304,67 +304,65 @@ function ModelSelect() { } return ( -
- { - if (val === defaultModel?.title) return; - dispatch(setDefaultModel({ title: val })); - await ideMessenger.request("update/modelChange", val); - }} - > -
- - - {modelSelectTitle(defaultModel) || "Select model"}{" "} -
+ +
+
); } From 423926e507a5c373b01246c99a844ae1da927499 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 23 Sep 2024 19:01:05 -0700 Subject: [PATCH 050/252] Update CodeBlockToolbar.tsx --- gui/src/components/markdown/CodeBlockToolbar.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index 5fdb5880c..417d33dbb 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -28,6 +28,7 @@ import FileIcon from "../FileIcon"; import ButtonWithTooltip from "../ButtonWithTooltip"; import { CopyButton as CopyButtonHeader } from "./CopyButton"; import { ToolbarButtonWithTooltip } from "./ToolbarButtonWithTooltip"; +import { getBasename } from "core/util"; const ToolbarDiv = styled.div` display: flex; @@ -217,11 +218,15 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { return (
- {props.filepath}{" "} +
+ + {getBasename(props.filepath)} + +
@@ -233,12 +238,12 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { {isCopied ? ( <> - Copied + Copied ) : ( <> - Copy + Copy )}
@@ -256,7 +261,7 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { style={{ color: lightGray }} > - Apply + Apply
) : ( From 1dc139a2062eec57582f1141c144f9958a11a28d Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 24 Sep 2024 00:35:54 -0700 Subject: [PATCH 051/252] improved redirect URL --- .../vscode/src/stubs/WorkOsAuthProvider.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index ce3af8ff7..df799c7d3 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -22,6 +22,10 @@ const CLIENT_ID = process.env.CONTROL_PLANE_ENV === "local" ? "client_01J0FW6XCPMJMQ3CG51RB4HBZQ" : "client_01J0FW6XN8N2XJAECF7NE0Y65J"; +const APP_URL = + process.env.CONTROL_PLANE_ENV === "local" + ? "http://localhost:3000" + : "https://app.continue.dev"; const SESSIONS_SECRET_KEY = `${AUTH_TYPE}.sessions`; class UriEventHandler extends EventEmitter implements UriHandler { @@ -122,12 +126,22 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { return this._sessionChangeEmitter.event; } - get redirectUri() { + get ideRedirectUri() { const publisher = this.context.extension.packageJSON.publisher; const name = this.context.extension.packageJSON.name; return `${env.uriScheme}://${publisher}.${name}`; } + get redirectUri() { + if (env.uriScheme === "vscode-insiders" || env.uriScheme === "vscode") { + // We redirect to a page that says "you can close this page", and that page finishes the redirect + const url = new URL(APP_URL); + url.pathname = `/auth/${env.uriScheme}-redirect`; + return url.toString(); + } + return this.ideRedirectUri; + } + async initialize() { this._sessions = await this.getSessions(); await this._refreshSessions(); From 8d1aeaca59d36a2365543704c6254c33d0c99e8f Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Tue, 24 Sep 2024 12:21:08 +0200 Subject: [PATCH 052/252] Anthropic prompt caching --- core/llm/llms/Anthropic.ts | 53 +++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 654d50805..4d4bfbca1 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -35,17 +35,36 @@ class Anthropic extends BaseLLM { } private _convertMessages(msgs: ChatMessage[]): any[] { - const messages = msgs - .filter((m) => m.role !== "system") - .map((message) => { + const filteredmessages = msgs.filter((m) => m.role !== "system") + const lastTwoUserMsgIndices = filteredmessages + .map((msg, index) => (msg.role === "user" ? index : -1)) + .filter((index) => index !== -1).slice(-2); + + const messages = filteredmessages.map((message, idx) => { + const addCachingHeader = lastTwoUserMsgIndices.includes(idx); + if (typeof message.content === "string") { - return message; + var chatMessage = {...message, + content: [{ + type: "text", + text: message.content, + ...(addCachingHeader? { cache_control: { type: "ephemeral" } } : {}) + }] + }; + return chatMessage; } + return { ...message, - content: message.content.map((part) => { + content: message.content.map((part, contentIdx) => { if (part.type === "text") { - return part; + const newpart = { + ...part, + // Add caching header to the last content part of the last two user messages + ...((addCachingHeader && contentIdx == message.content.length - 1) ? { cache_control: { type: "ephemeral" } } : {}) + }; + console.log(newpart); + return newpart; } return { type: "image", @@ -76,7 +95,23 @@ class Anthropic extends BaseLLM { options: CompletionOptions, ): AsyncGenerator { const shouldCacheSystemMessage = - !!this.systemMessage && !!this.cacheSystemMessage; + !!this.cacheSystemMessage; + + const body = JSON.stringify({ + ...this._convertArgs(options), + messages: this._convertMessages(messages), + system: shouldCacheSystemMessage + ? [ + { + type: "text", + text: this.systemMessage, + cache_control: { type: "ephemeral" }, + }, + ] + : this.systemMessage, + }); + + console.log("request body:", JSON.stringify(body, null, 2)); const systemMessage: string = stripImages( messages.filter((m) => m.role === "system")[0]?.content, @@ -108,6 +143,9 @@ class Anthropic extends BaseLLM { }), }); + console.log("headers:", Object.fromEntries(response.headers.entries())); + // console.log("response body:", JSON.stringify(await response.json(), null, 2)); + if (options.stream === false) { const data = await response.json(); yield { role: "assistant", content: data.content[0].text }; @@ -115,6 +153,7 @@ class Anthropic extends BaseLLM { } for await (const value of streamSse(response)) { + if (value.type == "message_start") console.log(value); if (value.delta?.text) { yield { role: "assistant", content: value.delta.text }; } From 9bd5619438ffea5b1316f760721ffc62deb29713 Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Tue, 24 Sep 2024 12:28:39 +0200 Subject: [PATCH 053/252] Cleanup + add clarifying comments --- core/llm/llms/Anthropic.ts | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 4d4bfbca1..7439f1419 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -40,17 +40,22 @@ class Anthropic extends BaseLLM { .map((msg, index) => (msg.role === "user" ? index : -1)) .filter((index) => index !== -1).slice(-2); - const messages = filteredmessages.map((message, idx) => { - const addCachingHeader = lastTwoUserMsgIndices.includes(idx); + const messages = filteredmessages.map((message, filteredMsgIdx) => { + // Add cache_control parameter to the last two user messages + // The second-to-last because it retrieves potentially already cached contents, + // The last one because we want it cached for later retrieval. + // See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching + const addCaching = lastTwoUserMsgIndices.includes(filteredMsgIdx); if (typeof message.content === "string") { - var chatMessage = {...message, - content: [{ - type: "text", - text: message.content, - ...(addCachingHeader? { cache_control: { type: "ephemeral" } } : {}) - }] - }; + var chatMessage = { + ...message, + content: [{ + type: "text", + text: message.content, + ...(addCaching? { cache_control: { type: "ephemeral" } } : {}) + }] + }; return chatMessage; } @@ -60,10 +65,9 @@ class Anthropic extends BaseLLM { if (part.type === "text") { const newpart = { ...part, - // Add caching header to the last content part of the last two user messages - ...((addCachingHeader && contentIdx == message.content.length - 1) ? { cache_control: { type: "ephemeral" } } : {}) + // If multiple text parts, only add cache_control to the last one + ...((addCaching && contentIdx == message.content.length - 1) ? { cache_control: { type: "ephemeral" } } : {}) }; - console.log(newpart); return newpart; } return { @@ -111,8 +115,6 @@ class Anthropic extends BaseLLM { : this.systemMessage, }); - console.log("request body:", JSON.stringify(body, null, 2)); - const systemMessage: string = stripImages( messages.filter((m) => m.role === "system")[0]?.content, ); @@ -143,9 +145,6 @@ class Anthropic extends BaseLLM { }), }); - console.log("headers:", Object.fromEntries(response.headers.entries())); - // console.log("response body:", JSON.stringify(await response.json(), null, 2)); - if (options.stream === false) { const data = await response.json(); yield { role: "assistant", content: data.content[0].text }; @@ -153,7 +152,7 @@ class Anthropic extends BaseLLM { } for await (const value of streamSse(response)) { - if (value.type == "message_start") console.log(value); + // if (value.type == "message_start") console.log(value); if (value.delta?.text) { yield { role: "assistant", content: value.delta.text }; } From 4838cfceb99c9496194991dc20c70c1324f00099 Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Tue, 24 Sep 2024 12:44:32 +0200 Subject: [PATCH 054/252] Make configurable and update documentation --- core/config/types.ts | 1 + core/index.d.ts | 1 + core/llm/index.ts | 2 ++ core/llm/llms/Anthropic.ts | 4 ++-- .../customize/model-providers/top-level/anthropic.md | 4 +++- docs/static/schemas/config.json | 9 +++++++++ .../intellij/src/main/resources/config_schema.json | 9 +++++++++ extensions/vscode/config_schema.json | 9 +++++++++ extensions/vscode/continue_rc_schema.json | 9 +++++++++ 9 files changed, 45 insertions(+), 3 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index c571b44df..98cc7ccb5 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -343,6 +343,7 @@ declare global { watsonxApiVersion?: string; cacheSystemMessage?: boolean; + cacheConversation?: boolean; } type RequireAtLeastOne = Pick< T, diff --git a/core/index.d.ts b/core/index.d.ts index 16c48a3ad..44fea298c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -371,6 +371,7 @@ export interface LLMOptions { watsonxFullUrl?: string; cacheSystemMessage?: boolean; + cacheConversation?: boolean; } type RequireAtLeastOne = Pick< T, diff --git a/core/llm/index.ts b/core/llm/index.ts index fd36222c9..ab1b7e652 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -121,6 +121,7 @@ export abstract class BaseLLM implements ILLM { watsonxFullUrl?: string; cacheSystemMessage?: boolean; + cacheConversation?: boolean; private _llmOptions: LLMOptions; @@ -194,6 +195,7 @@ export abstract class BaseLLM implements ILLM { this.watsonxFullUrl = options.watsonxFullUrl; this.cacheSystemMessage = options.cacheSystemMessage; + this.cacheConversation = options.cacheConversation; if (this.apiBase && !this.apiBase.endsWith("/")) { this.apiBase = `${this.apiBase}/`; diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 7439f1419..f4fc0bd3a 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -45,7 +45,7 @@ class Anthropic extends BaseLLM { // The second-to-last because it retrieves potentially already cached contents, // The last one because we want it cached for later retrieval. // See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching - const addCaching = lastTwoUserMsgIndices.includes(filteredMsgIdx); + const addCaching = !!this.cacheConversation && lastTwoUserMsgIndices.includes(filteredMsgIdx); if (typeof message.content === "string") { var chatMessage = { @@ -126,7 +126,7 @@ class Anthropic extends BaseLLM { Accept: "application/json", "anthropic-version": "2023-06-01", "x-api-key": this.apiKey as string, - ...(shouldCacheSystemMessage + ...(shouldCacheSystemMessage || !!this.cacheConversation ? { "anthropic-beta": "prompt-caching-2024-07-31" } : {}), }, diff --git a/docs/docs/customize/model-providers/top-level/anthropic.md b/docs/docs/customize/model-providers/top-level/anthropic.md index ebc156413..1aa0d9dbc 100644 --- a/docs/docs/customize/model-providers/top-level/anthropic.md +++ b/docs/docs/customize/model-providers/top-level/anthropic.md @@ -48,7 +48,8 @@ Anthropic currently does not offer any reranking models. Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). -Currently, we only allow caching of the system message. To enable this feature, update your your model configuration with `"cacheSystemMessage": true`: +To enable caching of the system message, update your your model configuration with `"cacheSystemMessage": true`: +To enable caching of the conversation, update your your model configuration with `"cacheConversation": true`: ```json { @@ -56,6 +57,7 @@ Currently, we only allow caching of the system message. To enable this feature, { // Enable prompt caching "cacheSystemMessage": true, + "cacheConversation": true, "title": "Anthropic", "provider": "anthropic", "model": "claude-3-5-sonnet-20240620", diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 911278ebb..254a5eabb 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -704,6 +704,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -801,6 +804,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -1022,6 +1028,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 5a20c6daf..c891e05a9 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -704,6 +704,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -801,6 +804,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -1022,6 +1028,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 176bbd295..6253b1d55 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -704,6 +704,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -801,6 +804,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -1022,6 +1028,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 7a7e54764..8375f099a 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -761,6 +761,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -877,6 +880,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -1120,6 +1126,9 @@ "cacheSystemMessage": { "type": "boolean" }, + "cacheConversation": { + "type": "boolean" + }, "model": { "enum": [ "deepseek-chat", From 2e9a7e216f844c9564c86de3446beba553faefed Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Tue, 24 Sep 2024 13:18:11 +0200 Subject: [PATCH 055/252] fix merging mistake --- core/llm/llms/Anthropic.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index f4fc0bd3a..fa4620e2a 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -98,23 +98,7 @@ class Anthropic extends BaseLLM { messages: ChatMessage[], options: CompletionOptions, ): AsyncGenerator { - const shouldCacheSystemMessage = - !!this.cacheSystemMessage; - - const body = JSON.stringify({ - ...this._convertArgs(options), - messages: this._convertMessages(messages), - system: shouldCacheSystemMessage - ? [ - { - type: "text", - text: this.systemMessage, - cache_control: { type: "ephemeral" }, - }, - ] - : this.systemMessage, - }); - + const shouldCacheSystemMessage = !!this.systemMessage && !!this.cacheSystemMessage; const systemMessage: string = stripImages( messages.filter((m) => m.role === "system")[0]?.content, ); From 10072575d593e46bd8a7b7bda125978c306a1a9c Mon Sep 17 00:00:00 2001 From: DongjaJ Date: Tue, 24 Sep 2024 21:37:51 +0900 Subject: [PATCH 056/252] fix: modify docs Next Page link --- docs/docs/actions/how-to-use-it.md | 1 + docs/docs/autocomplete/how-to-use-it.md | 1 + docs/docs/chat/how-to-use-it.md | 1 + docs/docs/edit/how-to-use-it.md | 1 + docs/docs/getting-started/install.md | 1 + 5 files changed, 5 insertions(+) diff --git a/docs/docs/actions/how-to-use-it.md b/docs/docs/actions/how-to-use-it.md index cffc0d65d..026f45d74 100644 --- a/docs/docs/actions/how-to-use-it.md +++ b/docs/docs/actions/how-to-use-it.md @@ -4,6 +4,7 @@ description: How to use Actions sidebar_label: How to use it keywords: [how, slash, commands, prompt, right click, quick fix, debug, action] sidebar_position: 1 +pagination_next: actions/model-setup --- ![actions](/img/actions.gif) diff --git a/docs/docs/autocomplete/how-to-use-it.md b/docs/docs/autocomplete/how-to-use-it.md index 92a3db76e..2cfd470e6 100644 --- a/docs/docs/autocomplete/how-to-use-it.md +++ b/docs/docs/autocomplete/how-to-use-it.md @@ -4,6 +4,7 @@ description: Autocomplete \- how to use it sidebar_label: How to use it keywords: [how] sidebar_position: 1 +pagination_next: autocomplete/model-setup --- ![autocomplete](/img/autocomplete.gif) diff --git a/docs/docs/chat/how-to-use-it.md b/docs/docs/chat/how-to-use-it.md index 53cd85d17..754ef12c8 100644 --- a/docs/docs/chat/how-to-use-it.md +++ b/docs/docs/chat/how-to-use-it.md @@ -4,6 +4,7 @@ description: How to use Chat sidebar_label: How to use it keywords: [how, use, chat] sidebar_position: 1 +pagination_next: chat/model-setup --- ![chat](/img/chat.gif) diff --git a/docs/docs/edit/how-to-use-it.md b/docs/docs/edit/how-to-use-it.md index ac6f2ed4b..f49e4134a 100644 --- a/docs/docs/edit/how-to-use-it.md +++ b/docs/docs/edit/how-to-use-it.md @@ -4,6 +4,7 @@ sidebar_position: 1 sidebar_label: How to use it description: How to use Edit keywords: [edit, cmd l, use] +pagination_next: edit/model-setup --- ![edit](/img/edit.gif) diff --git a/docs/docs/getting-started/install.md b/docs/docs/getting-started/install.md index da04e8468..d37e73e39 100644 --- a/docs/docs/getting-started/install.md +++ b/docs/docs/getting-started/install.md @@ -2,6 +2,7 @@ title: Install description: The open-source AI code assistant for developers keywords: [install, installation, getting started, vs code, jetbrains] +pagination_next: getting-started/overview --- ## VS Code From 6a7eea27ca5d1ade790ce08dc1cf4eb7bbdeb585 Mon Sep 17 00:00:00 2001 From: Kangmoon Seo <100016044+KangmoonSeo@users.noreply.github.com> Date: Tue, 24 Sep 2024 23:05:24 +0900 Subject: [PATCH 057/252] fix: add missing eos_token for qwen2.5-coder --- core/autocomplete/templates.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index dc729f52a..cda8b8a2d 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -47,6 +47,7 @@ const qwenCoderFimTemplate: AutocompleteTemplate = { "<|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>", completionOptions: { stop: [ + "<|endoftext|>", "<|fim_prefix|>", "<|fim_middle|>", "<|fim_suffix|>", From 1f8e9a5995349ce2f4988ab780587d7355e4fc39 Mon Sep 17 00:00:00 2001 From: Justin Milner Date: Tue, 24 Sep 2024 11:20:09 -0400 Subject: [PATCH 058/252] config schema, token init --- .../providers/GreptileContextProvider.ts | 28 ++++++++--------- extensions/vscode/config_schema.json | 30 +++++++++++++++++++ 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/core/context/providers/GreptileContextProvider.ts b/core/context/providers/GreptileContextProvider.ts index 5c8d5f3ea..c6b7620c4 100644 --- a/core/context/providers/GreptileContextProvider.ts +++ b/core/context/providers/GreptileContextProvider.ts @@ -21,16 +21,20 @@ import { extras: ContextProviderExtras, ): Promise { const greptileToken = this.getGreptileToken(); - const githubToken = process.env.GITHUB_TOKEN; - - if (!greptileToken || !githubToken) { - throw new Error("Greptile token or GitHub token not found."); + if (!greptileToken) { + throw new Error("Greptile token not found."); + } + + const githubToken = this.getGithubToken(); + if (!githubToken) { + throw new Error("GitHub token not found."); } let absPath = await this.getWorkspaceDir(extras); if (!absPath) { throw new Error("Failed to determine the workspace directory."); } + var remoteUrl = getRemoteUrl(absPath) remoteUrl = getRemoteUrl(absPath); const repoName = extractRepoName(remoteUrl); @@ -60,18 +64,10 @@ import { genius: true, }), }; - - // Log request details for debugging - console.log("Request URL: https://api.greptile.com/v2/query"); - console.log("Request Headers:", options.headers); - console.log("Request Body:", options.body); - + try { const response = await extras.fetch('https://api.greptile.com/v2/query', options); - - // Log the raw response text for debugging const rawText = await response.text(); - console.log("Raw response from Greptile:", rawText); // Check for HTTP errors if (!response.ok) { @@ -93,7 +89,11 @@ import { } private getGreptileToken(): string | undefined { - return this.options.token || process.env.GREPTILE_AUTH_TOKEN; + return this.options.GreptileToken || process.env.GREPTILE_AUTH_TOKEN; + } + + private getGithubToken(): string | undefined { + return this.options.GithubToken || process.env.GITHUB_TOKEN; } private async getWorkspaceDir(extras: ContextProviderExtras): Promise { diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index ab2186d62..819102bd0 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1933,6 +1933,36 @@ }, "required": ["host", "port", "user", "password", "database"] } + }, + { + "if": { + "properties": { + "name": { + "enum": ["greptile"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "GithubToken": { + "title": "GithubToken", + "description": "Your github access token", + "default": "", + "type": "string" + }, + "GreptileToken": { + "title": "GreptileToken", + "description": "Your greptile access token", + "default": "", + "type": "string" + } + } + } + }, + "required": ["GreptileToken", "GithubToken"] + } } ], "required": ["name"] From a98820197a5c11ed1a1085f90db214124e1666a6 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 24 Sep 2024 14:04:43 -0700 Subject: [PATCH 059/252] update config schema files --- docs/static/schemas/config.json | 8 ++++++++ extensions/intellij/src/main/resources/config_schema.json | 7 +++++++ extensions/vscode/continue_rc_schema.json | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 911278ebb..176bbd295 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1044,6 +1044,7 @@ "llama2-70b", "mistral-8x7b", "gemma", + "gemma2", "llama3-8b", "llama3-70b", "llama3.1-8b", @@ -2114,6 +2115,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 5a20c6daf..176bbd295 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -2115,6 +2115,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 7a7e54764..8a1c0bca0 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -2356,6 +2356,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", From 72e52166335cb1af56e8737173651e4cd5b81d16 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 24 Sep 2024 14:49:49 -0700 Subject: [PATCH 060/252] extract EXTENSION_NAME --- core/indexing/CodebaseIndexer.ts | 6 ++-- core/indexing/docs/DocsService.ts | 2 +- .../src/ContinueGUIWebviewViewProvider.ts | 28 +++++++++---------- extensions/vscode/src/VsCodeIde.ts | 5 ++-- .../vscode/src/activation/inlineTips.ts | 3 +- .../vscode/src/autocomplete/statusBar.ts | 5 ++-- extensions/vscode/src/commands.ts | 23 +++++++-------- .../vscode/src/extension/VsCodeExtension.ts | 7 +++-- extensions/vscode/src/stubs/activation.ts | 5 ++-- extensions/vscode/src/stubs/auth.ts | 3 +- extensions/vscode/src/stubs/remoteConfig.ts | 18 +++++++----- extensions/vscode/src/util/constants.ts | 5 ++++ extensions/vscode/src/util/ideUtils.ts | 5 ++-- 13 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 extensions/vscode/src/util/constants.ts diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index bf16b2a5d..6eca76268 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -304,9 +304,9 @@ export class CodebaseIndexer { const seconds = Math.round(timeTaken / 1000); const progressPercentage = (progress * 100).toFixed(1); const filesPerSec = (completedFileCount / seconds).toFixed(2); - console.debug( - `Indexing: ${progressPercentage}% complete, elapsed time: ${seconds}s, ${filesPerSec} file/sec`, - ); + // console.debug( + // `Indexing: ${progressPercentage}% complete, elapsed time: ${seconds}s, ${filesPerSec} file/sec`, + // ); } private async *yieldUpdateAndPause(): AsyncGenerator { diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index de773e662..75e633733 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -467,7 +467,7 @@ export default class DocsService { } for (const doc of deletedDocs) { - console.log(`Deleting doc: ${doc.startUrl}`); + // console.debug(`Deleting doc: ${doc.startUrl}`); await this.delete(doc.startUrl); } diff --git a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts index 08fedd54e..ee11a1a64 100644 --- a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts +++ b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts @@ -1,6 +1,7 @@ import type { FileEdit } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; import * as vscode from "vscode"; +import { EXTENSION_NAME } from "./util/constants"; import { getTheme } from "./util/getTheme"; import { getExtensionVersion } from "./util/util"; import { getExtensionUri, getNonce, getUniqueId } from "./util/vscode"; @@ -13,7 +14,7 @@ export class ContinueGUIWebviewViewProvider public webviewProtocol: VsCodeWebviewProtocol; private updateDebugLogsStatus() { - const settings = vscode.workspace.getConfiguration("continue"); + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); this.enableDebugLogs = settings.get("enableDebugLogs", false); if (this.enableDebugLogs) { this.outputChannel.show(true); @@ -25,8 +26,8 @@ export class ContinueGUIWebviewViewProvider // Show or hide the output channel on enableDebugLogs private setupDebugLogsListener() { vscode.workspace.onDidChangeConfiguration((event) => { - if (event.affectsConfiguration('continue.enableDebugLogs')) { - const settings = vscode.workspace.getConfiguration("continue"); + if (event.affectsConfiguration("continue.enableDebugLogs")) { + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const enableDebugLogs = settings.get("enableDebugLogs", false); if (enableDebugLogs) { this.outputChannel.show(true); @@ -38,19 +39,19 @@ export class ContinueGUIWebviewViewProvider } private async handleWebviewMessage(message: any) { - if (message.messageType === "log") { - const settings = vscode.workspace.getConfiguration("continue"); - const enableDebugLogs = settings.get("enableDebugLogs", false); + if (message.messageType === "log") { + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); + const enableDebugLogs = settings.get("enableDebugLogs", false); - if (message.level === "debug" && !enableDebugLogs) { - return; // Skip debug logs if enableDebugLogs is false + if (message.level === "debug" && !enableDebugLogs) { + return; // Skip debug logs if enableDebugLogs is false + } + + const timestamp = new Date().toISOString().split(".")[0]; + const logMessage = `[${timestamp}] [${message.level.toUpperCase()}] ${message.text}`; + this.outputChannel.appendLine(logMessage); } - - const timestamp = new Date().toISOString().split(".")[0]; - const logMessage = `[${timestamp}] [${message.level.toUpperCase()}] ${message.text}`; - this.outputChannel.appendLine(logMessage); } -} resolveWebviewView( webviewView: vscode.WebviewView, @@ -95,7 +96,6 @@ export class ContinueGUIWebviewViewProvider }); } - constructor( private readonly configHandlerPromise: Promise, private readonly windowId: string, diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index 0df445b01..ed7139636 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -26,6 +26,7 @@ import * as vscode from "vscode"; import { executeGotoProvider } from "./autocomplete/lsp"; import { DiffManager } from "./diff/horizontal"; import { Repository } from "./otherExtensions/git"; +import { EXTENSION_NAME } from "./util/constants"; import { VsCodeIdeUtils } from "./util/ideUtils"; import { getExtensionUri, @@ -294,7 +295,7 @@ class VsCodeIde implements IDE { const globalEnabled = vscode.env.isTelemetryEnabled; const continueEnabled: boolean = (await vscode.workspace - .getConfiguration("continue") + .getConfiguration(EXTENSION_NAME) .get("telemetryEnabled")) ?? true; return globalEnabled && continueEnabled; } @@ -535,7 +536,7 @@ class VsCodeIde implements IDE { } getIdeSettingsSync(): IdeSettings { - const settings = vscode.workspace.getConfiguration("continue"); + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const remoteConfigServerUrl = settings.get( "remoteConfigServerUrl", undefined, diff --git a/extensions/vscode/src/activation/inlineTips.ts b/extensions/vscode/src/activation/inlineTips.ts index 0f751c1c3..00a921db2 100644 --- a/extensions/vscode/src/activation/inlineTips.ts +++ b/extensions/vscode/src/activation/inlineTips.ts @@ -1,4 +1,5 @@ import * as vscode from "vscode"; +import { EXTENSION_NAME } from "../util/constants"; import { getMetaKeyName } from "../util/util"; const inlineTipDecoration = vscode.window.createTextEditorDecorationType({ @@ -12,7 +13,7 @@ const inlineTipDecoration = vscode.window.createTextEditorDecorationType({ function showInlineTip() { return vscode.workspace - .getConfiguration("continue") + .getConfiguration(EXTENSION_NAME) .get("showInlineTip"); } diff --git a/extensions/vscode/src/autocomplete/statusBar.ts b/extensions/vscode/src/autocomplete/statusBar.ts index 8a5a468e0..333661d55 100644 --- a/extensions/vscode/src/autocomplete/statusBar.ts +++ b/extensions/vscode/src/autocomplete/statusBar.ts @@ -1,10 +1,11 @@ +import { ILLM } from "core"; import * as vscode from "vscode"; import { Battery } from "../util/battery"; +import { EXTENSION_NAME } from "../util/constants"; import { CONTINUE_WORKSPACE_KEY, getContinueWorkspaceConfig, } from "../util/workspaceConfig"; -import { ILLM } from "core"; export enum StatusBarStatus { Disabled, @@ -121,7 +122,7 @@ export function getStatusBarStatus(): StatusBarStatus | undefined { export function monitorBatteryChanges(battery: Battery): vscode.Disposable { return battery.onChangeAC((acConnected: boolean) => { - const config = vscode.workspace.getConfiguration("continue"); + const config = vscode.workspace.getConfiguration(EXTENSION_NAME); const enabled = config.get("enableTabAutocomplete"); if (!!enabled) { const pauseOnBattery = config.get( diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 7ac639326..274065b51 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -1,18 +1,19 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import * as fs from "node:fs"; -import * as os from "node:os"; -import * as path from "node:path"; -import * as vscode from "vscode"; import { ContextMenuConfig, IDE } from "core"; import { CompletionProvider } from "core/autocomplete/completionProvider"; import { ConfigHandler } from "core/config/ConfigHandler"; +import { getModelByRole } from "core/config/util"; import { ContinueServerClient } from "core/continueServer/stubs/client"; import { Core } from "core/core"; import { walkDirAsync } from "core/indexing/walkDir"; import { GlobalContext } from "core/util/GlobalContext"; import { getConfigJsonPath, getDevDataFilePath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; +import * as fs from "node:fs"; +import * as os from "node:os"; +import * as path from "node:path"; import readLastLines from "read-last-lines"; +import * as vscode from "vscode"; import { StatusBarStatus, getAutocompleteStatusBarDescription, @@ -27,10 +28,10 @@ import { DiffManager } from "./diff/horizontal"; import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager"; import { QuickEdit, QuickEditShowParams } from "./quickEdit/QuickEditQuickPick"; import { Battery } from "./util/battery"; +import { EXTENSION_NAME } from "./util/constants"; +import { getFullyQualifiedPath } from "./util/util"; import { uriFromFilePath } from "./util/vscode"; import type { VsCodeWebviewProtocol } from "./webviewProtocol"; -import { getFullyQualifiedPath } from "./util/util"; -import { getModelByRole } from "core/config/util"; let fullScreenPanel: vscode.WebviewPanel | undefined; @@ -422,7 +423,7 @@ const commandsMap: ( }, "continue.hideInlineTip": () => { vscode.workspace - .getConfiguration("continue") + .getConfiguration(EXTENSION_NAME) .update("showInlineTip", false, vscode.ConfigurationTarget.Global); }, @@ -567,7 +568,7 @@ const commandsMap: ( "continue.toggleTabAutocompleteEnabled": () => { captureCommandTelemetry("toggleTabAutocompleteEnabled"); - const config = vscode.workspace.getConfiguration("continue"); + const config = vscode.workspace.getConfiguration(EXTENSION_NAME); const enabled = config.get("enableTabAutocomplete"); const pauseOnBattery = config.get( "pauseTabAutocompleteOnBattery", @@ -603,7 +604,7 @@ const commandsMap: ( "continue.openTabAutocompleteConfigMenu": async () => { captureCommandTelemetry("openTabAutocompleteConfigMenu"); - const config = vscode.workspace.getConfiguration("continue"); + const config = vscode.workspace.getConfiguration(EXTENSION_NAME); const quickPick = vscode.window.createQuickPick(); const autocompleteModels = (await configHandler.loadConfig())?.tabAutocompleteModels ?? []; @@ -629,8 +630,8 @@ const commandsMap: ( currentStatus === StatusBarStatus.Paused ? StatusBarStatus.Enabled : currentStatus === StatusBarStatus.Disabled - ? StatusBarStatus.Paused - : StatusBarStatus.Disabled; + ? StatusBarStatus.Paused + : StatusBarStatus.Disabled; } else { // Toggle between Disabled and Enabled targetStatus = diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 4f49e3a2b..193c4723d 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -25,6 +25,7 @@ import { WorkOsAuthProvider, } from "../stubs/WorkOsAuthProvider"; import { Battery } from "../util/battery"; +import { AUTH_TYPE, EXTENSION_NAME } from "../util/constants"; import { TabAutocompleteModel } from "../util/loadAutocompleteModel"; import { VsCodeIde } from "../VsCodeIde"; import type { VsCodeWebviewProtocol } from "../webviewProtocol"; @@ -162,7 +163,7 @@ export class VsCodeExtension { }); // Tab autocomplete - const config = vscode.workspace.getConfiguration("continue"); + const config = vscode.workspace.getConfiguration(EXTENSION_NAME); const enabled = config.get("enableTabAutocomplete"); // Register inline completion provider @@ -267,7 +268,7 @@ export class VsCodeExtension { vscode.authentication.onDidChangeSessions(async (e) => { if (e.provider.id === "github") { this.configHandler.reloadConfig(); - } else if (e.provider.id === "continue") { + } else if (e.provider.id === AUTH_TYPE) { const sessionInfo = await getControlPlaneSessionInfo(true); this.webviewProtocolPromise.then(async (webviewProtocol) => { webviewProtocol.request("didChangeControlPlaneSessionInfo", { @@ -330,7 +331,7 @@ export class VsCodeExtension { }); } - static continueVirtualDocumentScheme = "continue"; + static continueVirtualDocumentScheme = EXTENSION_NAME; // eslint-disable-next-line @typescript-eslint/naming-convention private PREVIOUS_BRANCH_FOR_WORKSPACE_DIR: { [dir: string]: string } = {}; diff --git a/extensions/vscode/src/stubs/activation.ts b/extensions/vscode/src/stubs/activation.ts index 7a4507db1..0f8866b55 100644 --- a/extensions/vscode/src/stubs/activation.ts +++ b/extensions/vscode/src/stubs/activation.ts @@ -1,9 +1,10 @@ import * as vscode from "vscode"; +import { EXTENSION_NAME } from "../util/constants"; import { getUserToken } from "./auth"; import { RemoteConfigSync } from "./remoteConfig"; export async function setupRemoteConfigSync(reloadConfig: () => void) { - const settings = vscode.workspace.getConfiguration("continue"); + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const remoteConfigServerUrl = settings.get( "remoteConfigServerUrl", null, @@ -17,7 +18,7 @@ export async function setupRemoteConfigSync(reloadConfig: () => void) { } getUserToken().then(async (token) => { await vscode.workspace - .getConfiguration("continue") + .getConfiguration(EXTENSION_NAME) .update("userToken", token, vscode.ConfigurationTarget.Global); try { const configSync = new RemoteConfigSync(reloadConfig, token); diff --git a/extensions/vscode/src/stubs/auth.ts b/extensions/vscode/src/stubs/auth.ts index 618f47efa..7a5244501 100644 --- a/extensions/vscode/src/stubs/auth.ts +++ b/extensions/vscode/src/stubs/auth.ts @@ -1,8 +1,9 @@ import * as vscode from "vscode"; +import { EXTENSION_NAME } from "../util/constants"; export async function getUserToken(): Promise { // Prefer manual user token first - const settings = vscode.workspace.getConfiguration("continue"); + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const userToken = settings.get("userToken", null); if (userToken) { return userToken; diff --git a/extensions/vscode/src/stubs/remoteConfig.ts b/extensions/vscode/src/stubs/remoteConfig.ts index fa5293a39..4a4c4f002 100644 --- a/extensions/vscode/src/stubs/remoteConfig.ts +++ b/extensions/vscode/src/stubs/remoteConfig.ts @@ -5,6 +5,7 @@ import { } from "core/util/paths"; import * as fs from "fs"; import * as vscode from "vscode"; +import { EXTENSION_NAME } from "../util/constants"; import { CONTINUE_WORKSPACE_KEY } from "../util/workspaceConfig"; export class RemoteConfigSync { @@ -48,7 +49,7 @@ export class RemoteConfigSync { } private loadVsCodeSettings() { - const settings = vscode.workspace.getConfiguration("continue"); + const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const userToken = settings.get("userToken", null); const remoteConfigServerUrl = settings.get( "remoteConfigServerUrl", @@ -93,12 +94,15 @@ export class RemoteConfigSync { if (this.syncInterval !== undefined) { clearInterval(this.syncInterval); } - this.syncInterval = setInterval(() => { - if (!this.userToken || !this.remoteConfigServerUrl) { - return; - } - this.sync(this.userToken, this.remoteConfigServerUrl); - }, this.remoteConfigSyncPeriod * 1000 * 60); + this.syncInterval = setInterval( + () => { + if (!this.userToken || !this.remoteConfigServerUrl) { + return; + } + this.sync(this.userToken, this.remoteConfigServerUrl); + }, + this.remoteConfigSyncPeriod * 1000 * 60, + ); } async sync(userToken: string, remoteConfigServerUrl: string) { diff --git a/extensions/vscode/src/util/constants.ts b/extensions/vscode/src/util/constants.ts new file mode 100644 index 000000000..2db7798f8 --- /dev/null +++ b/extensions/vscode/src/util/constants.ts @@ -0,0 +1,5 @@ +export const EXTENSION_NAME = "continue"; +export const AUTH_TYPE = + process.env.CONTROL_PLANE_ENV === "local" + ? `${EXTENSION_NAME}-staging` + : EXTENSION_NAME; diff --git a/extensions/vscode/src/util/ideUtils.ts b/extensions/vscode/src/util/ideUtils.ts index 33ab80632..a2f2e3f9f 100644 --- a/extensions/vscode/src/util/ideUtils.ts +++ b/extensions/vscode/src/util/ideUtils.ts @@ -18,6 +18,7 @@ import { } from "./vscode"; import _ from "lodash"; +import { EXTENSION_NAME } from "./constants"; const util = require("node:util"); const asyncExec = util.promisify(require("node:child_process").exec); @@ -175,7 +176,7 @@ export class VsCodeIdeUtils { async getUserSecret(key: string) { // Check if secret already exists in VS Code settings (global) - let secret = vscode.workspace.getConfiguration("continue").get(key); + let secret = vscode.workspace.getConfiguration(EXTENSION_NAME).get(key); if (typeof secret !== "undefined" && secret !== null) { return secret; } @@ -188,7 +189,7 @@ export class VsCodeIdeUtils { // Add secret to VS Code settings vscode.workspace - .getConfiguration("continue") + .getConfiguration(EXTENSION_NAME) .update(key, secret, vscode.ConfigurationTarget.Global); return secret; From 6ecbd23a012f7140626473d2b3215ee67b5e14e0 Mon Sep 17 00:00:00 2001 From: Test Date: Tue, 24 Sep 2024 15:59:03 -0700 Subject: [PATCH 061/252] gui: improve input breakpoints and context peek --- core/commands/util.ts | 4 +- .../providers/CurrentFileContextProvider.ts | 10 +- core/context/providers/FileContextProvider.ts | 4 + .../providers/OpenFilesContextProvider.ts | 9 +- core/context/providers/URLContextProvider.ts | 10 +- core/context/retrieval/retrieval.ts | 34 ++- core/index.d.ts | 16 +- core/indexing/CodeSnippetsIndex.ts | 4 + core/indexing/docs/DocsService.ts | 50 ++-- core/util/fetchFavicon.ts | 65 +++++ .../components/mainInput/ContextItemsPeek.tsx | 228 ++++++++---------- gui/src/components/mainInput/InputToolbar.tsx | 176 ++++++-------- gui/src/components/mainInput/TipTapEditor.tsx | 19 +- .../components/modelSelection/ModelSelect.tsx | 13 +- gui/src/pages/gui.tsx | 9 +- gui/tailwind.config.cjs | 12 +- 16 files changed, 354 insertions(+), 309 deletions(-) create mode 100644 core/util/fetchFavicon.ts diff --git a/core/commands/util.ts b/core/commands/util.ts index 207b6c5ec..931564839 100644 --- a/core/commands/util.ts +++ b/core/commands/util.ts @@ -1,4 +1,4 @@ -import { ContextItemWithId } from "../index.js"; +import { ContextItemWithId } from "../"; export interface RangeInFileWithContents { filepath: string; @@ -15,7 +15,7 @@ export function contextItemToRangeInFileWithContents( const lines = item.name.split("(")[1].split(")")[0].split("-"); const rif: RangeInFileWithContents = { - filepath: item.id.itemId, + filepath: item.uri?.value || "", range: { start: { line: Number.parseInt(lines[0]), diff --git a/core/context/providers/CurrentFileContextProvider.ts b/core/context/providers/CurrentFileContextProvider.ts index e149c8079..575350b49 100644 --- a/core/context/providers/CurrentFileContextProvider.ts +++ b/core/context/providers/CurrentFileContextProvider.ts @@ -2,9 +2,9 @@ import { ContextItem, ContextProviderDescription, ContextProviderExtras, -} from "../../index.js"; -import { getBasename } from "../../util/index.js"; -import { BaseContextProvider } from "../index.js"; +} from "../../"; +import { getBasename } from "../../util/"; +import { BaseContextProvider } from "../"; class CurrentFileContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { @@ -32,6 +32,10 @@ class CurrentFileContextProvider extends BaseContextProvider { currentFile, )}\n${contents}\n\`\`\``, name: getBasename(currentFile), + uri: { + type: "file", + value: currentFile, + }, }, ]; } diff --git a/core/context/providers/FileContextProvider.ts b/core/context/providers/FileContextProvider.ts index ef0bfeb54..be558c651 100644 --- a/core/context/providers/FileContextProvider.ts +++ b/core/context/providers/FileContextProvider.ts @@ -36,6 +36,10 @@ class FileContextProvider extends BaseContextProvider { name: query.split(/[\\/]/).pop() ?? query, description: query, content: `\`\`\`${query}\n${content}\n\`\`\``, + uri: { + type: "file", + value: query, + }, }, ]; } diff --git a/core/context/providers/OpenFilesContextProvider.ts b/core/context/providers/OpenFilesContextProvider.ts index b0c85bc2e..c00121a96 100644 --- a/core/context/providers/OpenFilesContextProvider.ts +++ b/core/context/providers/OpenFilesContextProvider.ts @@ -28,10 +28,15 @@ class OpenFilesContextProvider extends BaseContextProvider { openFiles.map(async (filepath: string) => { return { description: filepath, - content: `\`\`\`${await getRelativePath(filepath, workspaceDirs)}\n${await ide.readFile( + content: `\`\`\`${await getRelativePath( filepath, - )}\n\`\`\``, + workspaceDirs, + )}\n${await ide.readFile(filepath)}\n\`\`\``, name: (filepath.split("/").pop() ?? "").split("\\").pop() ?? "", + uri: { + type: "file", + value: filepath, + }, }; }), ); diff --git a/core/context/providers/URLContextProvider.ts b/core/context/providers/URLContextProvider.ts index 2e864fbb9..8a471ef45 100644 --- a/core/context/providers/URLContextProvider.ts +++ b/core/context/providers/URLContextProvider.ts @@ -1,12 +1,13 @@ import { Readability } from "@mozilla/readability"; import { JSDOM } from "jsdom"; import { NodeHtmlMarkdown } from "node-html-markdown"; -import { BaseContextProvider } from "../index.js"; +import { BaseContextProvider } from "../"; import { ContextItem, ContextProviderDescription, ContextProviderExtras, } from "../../index.js"; +import { fetchFavicon } from "../../util/fetchFavicon"; class URLContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { @@ -22,6 +23,7 @@ class URLContextProvider extends BaseContextProvider { ): Promise { try { const url = new URL(query); + const icon = await fetchFavicon(url); const resp = await extras.fetch(url); const html = await resp.text(); @@ -37,11 +39,17 @@ class URLContextProvider extends BaseContextProvider { ); const title = article?.title || url.pathname; + return [ { + icon, description: title, content: markdown, name: title, + uri: { + type: "url", + value: url.toString(), + }, }, ]; } catch (e) { diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts index 1b250e548..9d19a33f7 100644 --- a/core/context/retrieval/retrieval.ts +++ b/core/context/retrieval/retrieval.ts @@ -6,6 +6,7 @@ import { INSTRUCTIONS_BASE_ITEM } from "../providers/utils"; import { RetrievalPipelineOptions } from "./pipelines/BaseRetrievalPipeline"; import NoRerankerRetrievalPipeline from "./pipelines/NoRerankerRetrievalPipeline"; import RerankerRetrievalPipeline from "./pipelines/RerankerRetrievalPipeline"; +import path from "path"; export async function retrieveContextItemsFromEmbeddings( extras: ContextProviderExtras, @@ -94,21 +95,32 @@ export async function retrieveContextItemsFromEmbeddings( } return [ - ...results.map((r) => { - const name = `${getRelativePath(r.filepath, workspaceDirs)} (${ - r.startLine - }-${r.endLine})`; - const description = `${r.filepath} (${r.startLine}-${r.endLine})`; - return { - name, - description, - content: `\`\`\`${name}\n${r.content}\n\`\`\``, - }; - }), { ...INSTRUCTIONS_BASE_ITEM, content: "Use the above code to answer the following question. You should not reference any files outside of what is shown, unless they are commonly known files, like a .gitignore or package.json. Reference the filenames whenever possible. If there isn't enough information to answer the question, suggest where the user might look to learn more.", }, + ...results + .sort((a, b) => a.filepath.localeCompare(b.filepath)) + .map((r) => { + const name = `${path.basename(r.filepath)} (${r.startLine}-${ + r.endLine + })`; + const description = `${r.filepath}`; + + if (r.filepath.includes("package.json")) { + console.log(); + } + + return { + name, + description, + content: `\`\`\`${name}\n${r.content}\n\`\`\``, + uri: { + type: "file" as const, + value: r.filepath, + }, + }; + }), ]; } diff --git a/core/index.d.ts b/core/index.d.ts index 16c48a3ad..659f9f80c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -271,6 +271,13 @@ export interface ContextItemId { itemId: string; } +export type ContextItemUriTypes = "file" | "url"; + +export interface ContextItemUri { + type: ContextItemUriTypes; + value: string; +} + export interface ContextItem { content: string; name: string; @@ -278,16 +285,11 @@ export interface ContextItem { editing?: boolean; editable?: boolean; icon?: string; + uri?: ContextItemUri; } -export interface ContextItemWithId { - content: string; - name: string; - description: string; +export interface ContextItemWithId extends ContextItem { id: ContextItemId; - editing?: boolean; - editable?: boolean; - icon?: string; } export interface InputModifiers { diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 6a02babd4..a8b41cafe 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -341,6 +341,10 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { name: row.title, description: getLastNPathParts(row.path, 2), content: `\`\`\`${getBasename(row.path)}\n${row.content}\n\`\`\``, + uri: { + type: "file", + value: row.path, + }, }; } diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index de773e662..d54f49f10 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -32,6 +32,7 @@ import { SiteIndexingResults, } from "./preIndexed"; import preIndexedDocs from "./preIndexedDocs"; +import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon"; // Purposefully lowercase because lancedb converts export interface LanceDbDocsRow { @@ -154,7 +155,10 @@ export default class DocsService { params: {}, }); - this.ide.showToast("info", "Successfuly added docs context provider"); + await this.ide.showToast( + "info", + "Successfuly added docs context provider", + ); } return res === actionMsg; @@ -177,7 +181,7 @@ export default class DocsService { while (!(await generator.next()).done) {} } - this.ide.showToast("info", "Docs indexing completed"); + await this.ide.showToast("info", "Docs indexing completed"); } async list() { @@ -250,7 +254,7 @@ export default class DocsService { } } - Telemetry.capture("docs_pages_crawled", { + void Telemetry.capture("docs_pages_crawled", { count: processedPages, }); @@ -321,7 +325,7 @@ export default class DocsService { await this.delete(startUrl); } - const favicon = await this.fetchFavicon(siteIndexingConfig); + const favicon = await fetchFavicon(new URL(siteIndexingConfig.startUrl)); await this.add({ siteIndexingConfig, @@ -460,7 +464,7 @@ export default class DocsService { for (const doc of newDocs) { console.log(`Indexing new doc: ${doc.startUrl}`); - Telemetry.capture("add_docs_config", { url: doc.startUrl }); + void Telemetry.capture("add_docs_config", { url: doc.startUrl }); const generator = this.indexAndAdd(doc); while (!(await generator.next()).done) {} @@ -537,8 +541,9 @@ export default class DocsService { private async getLanceTableNameFromEmbeddingsProvider( isPreIndexedDoc: boolean, ) { - const embeddingsProvider = - await this.getEmbeddingsProvider(isPreIndexedDoc); + const embeddingsProvider = await this.getEmbeddingsProvider( + isPreIndexedDoc, + ); const embeddingsProviderId = this.removeInvalidLanceTableNameChars( embeddingsProvider.id, ); @@ -694,7 +699,12 @@ export default class DocsService { const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; const startUrl = new URL(siteEmbeddings.url).toString(); - const favicon = await this.fetchFavicon(preIndexedDocs[startUrl]); + + const faviconUrl = preIndexedDocs[startUrl].faviconUrl; + const favicon = + typeof faviconUrl === "string" + ? await getFaviconBase64(faviconUrl) + : undefined; await this.add({ favicon, @@ -707,30 +717,6 @@ export default class DocsService { }); } - private async fetchFavicon(siteIndexingConfig: SiteIndexingConfig) { - const faviconUrl = - siteIndexingConfig.faviconUrl ?? - new URL("/favicon.ico", siteIndexingConfig.startUrl); - - try { - const response = await fetch(faviconUrl); - const arrayBuffer = await response.arrayBuffer(); - const base64 = btoa( - new Uint8Array(arrayBuffer).reduce( - (data, byte) => data + String.fromCharCode(byte), - "", - ), - ); - const mimeType = response.headers.get("content-type") || "image/x-icon"; - - return `data:${mimeType};base64,${base64}`; - } catch { - console.error(`Failed to fetch favicon: ${faviconUrl}`); - } - - return undefined; - } - private async shouldReindexDocsOnNewEmbeddingsProvider( curEmbeddingsProviderId: EmbeddingsProvider["id"], ): Promise { diff --git a/core/util/fetchFavicon.ts b/core/util/fetchFavicon.ts new file mode 100644 index 000000000..8b1c8616a --- /dev/null +++ b/core/util/fetchFavicon.ts @@ -0,0 +1,65 @@ +import { JSDOM } from "jsdom"; + +export async function findFaviconPath(url: URL): Promise { + const baseUrl = `${url.protocol}//${url.hostname}`; + + try { + const response = await fetch(baseUrl); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const html = await response.text(); + const dom = new JSDOM(html); + const document = dom.window.document; + + // Look for favicon in tags + const linkTags = document.querySelectorAll('link[rel*="icon"]'); + + for (const link of linkTags) { + const href = link.getAttribute("href"); + if (href) { + return new URL(href, baseUrl).toString(); + } + } + } catch (error) { + console.debug(`Failed to fetch favicon for ${baseUrl}: ${error}`); + } + + console.debug(`Failed to find favicon for ${baseUrl}`); + return undefined; +} + +export async function getFaviconBase64( + faviconUrl: string, +): Promise { + try { + const response = await fetch(faviconUrl); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const arrayBuffer = await response.arrayBuffer(); + const base64 = btoa( + new Uint8Array(arrayBuffer).reduce( + (data, byte) => data + String.fromCharCode(byte), + "", + ), + ); + const mimeType = response.headers.get("content-type") || "image/x-icon"; + + return `data:${mimeType};base64,${base64}`; + } catch (error) { + console.debug(`Failed to fetch favicon from ${faviconUrl}: ${error}`); + return undefined; + } +} + +export async function fetchFavicon(url: URL): Promise { + const faviconPath = await findFaviconPath(url); + if (faviconPath) { + return getFaviconBase64(faviconPath); + } + return undefined; +} diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx index 3d3200433..f7d0b2f3e 100644 --- a/gui/src/components/mainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/ContextItemsPeek.tsx @@ -1,14 +1,9 @@ -import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline"; +import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; import { ContextItemWithId } from "core"; import { contextItemToRangeInFileWithContents } from "core/commands/util"; import React, { useContext } from "react"; import styled from "styled-components"; -import { - defaultBorderRadius, - lightGray, - vscBackground, - vscForeground, -} from ".."; +import { lightGray, vscBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { getFontSize } from "../../util"; import FileIcon from "../FileIcon"; @@ -16,70 +11,26 @@ import SafeImg from "../SafeImg"; import { INSTRUCTIONS_BASE_ITEM } from "core/context/providers/utils"; import { getIconFromDropdownItem } from "./MentionList"; -const ContextItemDiv = styled.div` - cursor: pointer; - padding: 6px 10px 6px 6px; - margin-left: 4px; - margin-right: 12px; - display: flex; - align-items: center; - border-radius: ${defaultBorderRadius}; - font-size: ${getFontSize()}; - max-width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - - &:hover { - background-color: #fff1; - } -`; - -export const ContextItems = styled.span` - margin-left: 5px; - font-size: ${getFontSize() - 1}px; - color: ${lightGray}; - - &:hover { - text-decoration: underline; - } -`; - interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; } -function filterInstructionContextItem( - contextItems: ContextItemsPeekProps["contextItems"], -) { - return contextItems?.filter( - (ctxItem) => !ctxItem.name.includes(INSTRUCTIONS_BASE_ITEM.name), - ); +interface ContextItemsPeekItemProps { + contextItem: ContextItemWithId; } -const ContextItemsPeek = (props: ContextItemsPeekProps) => { +function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { const ideMessenger = useContext(IdeMessengerContext); - const [open, setOpen] = React.useState(false); + function openContextItem() { + const { uri, name, description, content } = contextItem; - const ctxItems = filterInstructionContextItem(props.contextItems); + if (uri?.type === "url") { + window.open(description, "_blank"); + } else if (uri) { + const isRangeInFile = name.includes(" (") && name.endsWith(")"); - if (!ctxItems || ctxItems.length === 0) { - return null; - } - - const contextItemsText = `${ctxItems.length} context ${ - ctxItems.length > 1 ? "items" : "item" - }`; - - function openContextItem(contextItem: ContextItemWithId) { - if (contextItem.description.startsWith("http")) { - window.open(contextItem.description, "_blank"); - } else if ( - contextItem.description.startsWith("/") || - contextItem.description.startsWith("\\") - ) { - if (contextItem.name.includes(" (") && contextItem.name.endsWith(")")) { + if (isRangeInFile) { const rif = contextItemToRangeInFileWithContents(contextItem); ideMessenger.ide.showLines( rif.filepath, @@ -87,23 +38,23 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { rif.range.end.line, ); } else { - ideMessenger.ide.openFile(contextItem.description); + ideMessenger.ide.openFile(description); } } else { - ideMessenger.ide.showVirtualFile(contextItem.name, contextItem.content); + ideMessenger.ide.showVirtualFile(name, content); } } - const getContextItemIcon = (contextItem: ContextItemWithId) => { - const dimmensions = "1.4em"; + function getContextItemIcon() { + const dimensions = "18px"; if (contextItem.icon) { return ( ); @@ -114,13 +65,16 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { if (shouldShowFileIcon) { return ( - +
+ +
); } @@ -131,79 +85,99 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { return ( ); - }; + } return (
+
+ {getContextItemIcon()} +
+
+ {contextItem.name} +
+
+ {contextItem.description} +
+
+
+
+ ); +} + +function ContextItemsPeek({ contextItems }: ContextItemsPeekProps) { + const [open, setOpen] = React.useState(false); + + const ctxItems = contextItems?.filter( + (ctxItem) => !ctxItem.name.includes(INSTRUCTIONS_BASE_ITEM.name), + ); + + if (!ctxItems || ctxItems.length === 0) { + return null; + } + + const contextItemsText = `${ctxItems.length} context ${ + ctxItems.length > 1 ? "items" : "item" + }`; + + return ( +
setOpen((prev) => !prev)} > - {open ? ( - + - ) : ( + /> - )} - {contextItemsText} + /> +
+ + {contextItemsText} +
- {open && ( -
- {ctxItems?.map((contextItem, idx) => { - const contextItemContent = ( - openContextItem(contextItem)}> - {getContextItemIcon(contextItem)} - {contextItem.name} - - ); - - return contextItem.description.startsWith("http") ? ( - - {contextItemContent} - - ) : ( - {contextItemContent} - ); - })} -
- )} +
+ {ctxItems.map((contextItem, idx) => ( + + ))} +
); -}; +} export default ContextItemsPeek; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 367741b27..e8bbd080a 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -1,6 +1,6 @@ import { + AtSymbolIcon, PhotoIcon as OutlinePhotoIcon, - PlusIcon, } from "@heroicons/react/24/outline"; import { PhotoIcon as SolidPhotoIcon } from "@heroicons/react/24/solid"; import { InputModifiers } from "core"; @@ -36,64 +36,47 @@ const StyledDiv = styled.div<{ isHidden: boolean }>` cursor: ${(props) => (props.isHidden ? "default" : "text")}; opacity: ${(props) => (props.isHidden ? 0 : 1)}; pointer-events: ${(props) => (props.isHidden ? "none" : "auto")}; - user-select: none; & > * { flex: 0 0 auto; } +`; - /* Hide the "Use codebase" span first */ - @media (max-width: 450px) { - & > span:last-child > span:nth-last-child(2) { - display: none; - } +const HoverItem = styled.span<{ isActive?: boolean }>` + padding: 0 4px; + padding-top: 2px; + padding-bottom: 2px; + cursor: pointer; + transition: color 200ms; + + &:hover { + color: #d1d5db; } `; -const SecondToDisappearContainer = styled.span` - display: flex; - align-items: center; - - @media (max-width: 350px) { - display: none; - } -`; - -const StyledSpan = styled.span` - font-size: ${() => `${getFontSize() - 2}px`}; - color: ${lightGray}; -`; - -const EnterButton = styled.div<{ offFocus: boolean }>` +const EnterButton = styled.div` padding: 2px 4px; display: flex; align-items: center; - - background-color: ${(props) => - props.offFocus ? undefined : lightGray + "33"}; + background-color: ${lightGray}33; border-radius: ${defaultBorderRadius}; color: ${vscForeground}; + cursor: pointer; &:hover { background-color: ${vscBadgeBackground}; color: ${vscBadgeForeground}; } - - cursor: pointer; `; interface InputToolbarProps { onEnter?: (modifiers: InputModifiers) => void; - usingCodebase?: boolean; onAddContextItem?: () => void; - onClick?: () => void; - onImageFileSelected?: (file: File) => void; - hidden?: boolean; - showNoContext: boolean; + activeKey: string | null; } function InputToolbar(props: InputToolbarProps) { @@ -103,6 +86,8 @@ function InputToolbar(props: InputToolbarProps) { const defaultModel = useSelector(defaultModelSelector); const useActiveFile = useSelector(selectUseActiveFile); + console.log(props.activeKey); + return ( <> - - - - - { - props.onAddContextItem(); - }} - className="hover:underline cursor-pointer" +
+
+ +
+
+ - Add Context{" "} - + {defaultModel && modelSupportsImages( defaultModel.provider, @@ -149,18 +133,14 @@ function InputToolbar(props: InputToolbarProps) { /> {fileSelectHovered ? ( { fileInputRef.current?.click(); }} /> ) : ( { fileInputRef.current?.click(); }} @@ -168,59 +148,51 @@ function InputToolbar(props: InputToolbarProps) { )} )} - - - - - {props.showNoContext ? ( - - {getAltKeyLabel()} ⏎{" "} - {useActiveFile ? "No context" : "Use active file"} - - ) : ( - { - props.onEnter({ - useCodebase: true, - noContext: !useActiveFile, - }); - }} - className={"hover:underline cursor-pointer float-right"} - > - {getMetaKeyLabel()} ⏎ Use @codebase - - )} -
- { - props.onEnter({ - useCodebase: isMetaEquivalentKeyPressed(e), - noContext: useActiveFile ? e.altKey : !e.altKey, - }); - }} - > - ⏎ Enter -
-
+
+ +
+
+ {props.activeKey === "Alt" ? ( + + {`${getAltKeyLabel()}⏎ + ${useActiveFile ? "No active file" : "Active file"}`} + + ) : ( + + props.onEnter({ + useCodebase: true, + noContext: !useActiveFile, + }) + } + > + + {" "} + {getMetaKeyLabel()}⏎ @codebase + + @codebase + + )} +
+ + { + props.onEnter({ + useCodebase: isMetaEquivalentKeyPressed(e), + noContext: useActiveFile ? e.altKey : !e.altKey, + }); + }} + > + ⏎ Enter + ⏎ + +
); diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index a57d19bda..21f0b3923 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -57,6 +57,7 @@ import { getSlashCommandDropdownOptions, } from "./getSuggestion"; import { ComboBoxItem } from "./types"; +import { v4 } from "uuid"; const InputBoxDiv = styled.div` resize: none; @@ -729,7 +730,11 @@ function TipTapEditor(props: TipTapEditorProps) { description: `${relativePath} ${rangeStr}`, id: { providerTitle: "code", - itemId: rif.filepath, + itemId: v4(), + }, + uri: { + type: "file", + value: rif.filepath, }, }; @@ -810,19 +815,15 @@ function TipTapEditor(props: TipTapEditorProps) { }; }, []); - const [optionKeyHeld, setOptionKeyHeld] = useState(false); + const [activeKey, setActiveKey] = useState(null); return ( { - if (e.key === "Alt") { - setOptionKeyHeld(true); - } + setActiveKey(e.key); }} onKeyUp={(e) => { - if (e.key === "Alt") { - setOptionKeyHeld(false); - } + setActiveKey(null); }} className="cursor-text" onClick={() => { @@ -874,7 +875,7 @@ function TipTapEditor(props: TipTapEditorProps) { }} />
)} - { + {showTutorialCard !== false && !onboardingCard.open && (
- } + )} )}
From 9f9a9b5a24b0683ba6884b2113849733ecb015f1 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Sep 2024 10:36:19 -0700 Subject: [PATCH 077/252] Update prepackage-cross-platform.js --- extensions/vscode/scripts/prepackage-cross-platform.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/vscode/scripts/prepackage-cross-platform.js b/extensions/vscode/scripts/prepackage-cross-platform.js index 018ea70c2..65cf8836c 100644 --- a/extensions/vscode/scripts/prepackage-cross-platform.js +++ b/extensions/vscode/scripts/prepackage-cross-platform.js @@ -157,8 +157,8 @@ async function package(target, os, arch, exe) { os === "darwin" ? "libonnxruntime.1.14.0.dylib" : os === "linux" - ? "libonnxruntime.so.1.14.0" - : "onnxruntime.dll" + ? "libonnxruntime.so.1.14.0" + : "onnxruntime.dll" }`, "builtin-themes/dark_modern.json", @@ -167,7 +167,7 @@ async function package(target, os, arch, exe) { "gui/assets/index.css", // Tutorial - "media/welcome.md", + "media/move-chat-panel-right.md", "continue_tutorial.py", "config_schema.json", @@ -197,8 +197,8 @@ async function package(target, os, arch, exe) { target === "win32-arm64" ? "esbuild.exe" : target === "win32-x64" - ? "win32-x64/esbuild.exe" - : `${target}/bin/esbuild` + ? "win32-x64/esbuild.exe" + : `${target}/bin/esbuild` }`, `out/node_modules/@lancedb/vectordb-${ os === "win32" From 08e13093efcd315d8f7b6550864868da3ab9607c Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 25 Sep 2024 12:25:38 -0700 Subject: [PATCH 078/252] update free trial config schemas --- docs/static/schemas/config.json | 2 -- extensions/intellij/src/main/resources/config_schema.json | 2 -- extensions/vscode/config_schema.json | 2 -- extensions/vscode/continue_rc_schema.json | 2 -- 4 files changed, 8 deletions(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 176bbd295..6692f2de7 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -609,9 +609,7 @@ "llama3.1-70b", "llama3.1-405b", "gpt-3.5-turbo", - "phind-codellama-34b", "gemini-pro", - "mistral-8x7b", "claude-3-5-sonnet-20240620", "claude-3-haiku-20240307", "AUTODETECT" diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 176bbd295..6692f2de7 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -609,9 +609,7 @@ "llama3.1-70b", "llama3.1-405b", "gpt-3.5-turbo", - "phind-codellama-34b", "gemini-pro", - "mistral-8x7b", "claude-3-5-sonnet-20240620", "claude-3-haiku-20240307", "AUTODETECT" diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 176bbd295..6692f2de7 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -609,9 +609,7 @@ "llama3.1-70b", "llama3.1-405b", "gpt-3.5-turbo", - "phind-codellama-34b", "gemini-pro", - "mistral-8x7b", "claude-3-5-sonnet-20240620", "claude-3-haiku-20240307", "AUTODETECT" diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 8a1c0bca0..4095e0fa0 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -658,9 +658,7 @@ "llama3.1-70b", "llama3.1-405b", "gpt-3.5-turbo", - "phind-codellama-34b", "gemini-pro", - "mistral-8x7b", "claude-3-5-sonnet-20240620", "claude-3-haiku-20240307", "AUTODETECT" From b39a95450283e4bdaf386df648dd1a709810116d Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 25 Sep 2024 12:25:51 -0700 Subject: [PATCH 079/252] update max tokens for o1 --- core/llm/llms/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 2b894f418..dedae7795 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -6,7 +6,6 @@ import { ModelDescription, } from "../.."; import { renderTemplatedString } from "../../promptFiles/renderTemplatedString"; -import { DEFAULT_MAX_TOKENS } from "../constants"; import { BaseLLM } from "../index"; import Anthropic from "./Anthropic"; import Azure from "./Azure"; @@ -112,8 +111,7 @@ export async function llmFromDescription( model: (desc.model || cls.defaultOptions?.model) ?? "codellama-7b", maxTokens: finalCompletionOptions.maxTokens ?? - cls.defaultOptions?.completionOptions?.maxTokens ?? - DEFAULT_MAX_TOKENS, + cls.defaultOptions?.completionOptions?.maxTokens, }, systemMessage, writeLog, From c542e5d6153078f42e8eaf4361a4e5bdf24d9bc2 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Sep 2024 14:42:31 -0700 Subject: [PATCH 080/252] fix: autocomplete logging + input layout --- core/autocomplete/completionProvider.ts | 4 ++-- core/core.ts | 4 +++- .../autocomplete/AutocompleteService.kt | 3 +++ gui/src/components/Layout.tsx | 1 + gui/src/components/gui/StepContainer.tsx | 21 +++++-------------- gui/src/components/mainInput/InputToolbar.tsx | 14 ++++++------- .../components/modelSelection/ModelSelect.tsx | 2 +- gui/src/pages/gui.tsx | 10 +++++---- 8 files changed, 28 insertions(+), 31 deletions(-) diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index bbc2d2577..e3c887c82 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -204,7 +204,7 @@ export class CompletionProvider { const outcome = this._outcomes.get(completionId)!; outcome.accepted = true; logDevData("autocomplete", outcome); - Telemetry.capture( + void Telemetry.capture( "autocomplete", { accepted: outcome.accepted, @@ -378,7 +378,7 @@ export class CompletionProvider { outcome.accepted = false; logDevData("autocomplete", outcome); const { prompt, completion, ...restOfOutcome } = outcome; - Telemetry.capture( + void Telemetry.capture( "autocomplete", { ...restOfOutcome, diff --git a/core/core.ts b/core/core.ts index 3e5129a62..e9b29b493 100644 --- a/core/core.ts +++ b/core/core.ts @@ -571,7 +571,9 @@ export class Core { ); return outcome ? [outcome.completion] : []; }); - on("autocomplete/accept", async (msg) => {}); + on("autocomplete/accept", async (msg) => { + this.completionProvider.accept(msg.data.completionId); + }); on("autocomplete/cancel", async (msg) => { this.completionProvider.cancel(); }); diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt index c46cb7222..877308fa4 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt @@ -148,8 +148,10 @@ class AutocompleteService(private val project: Project) { val editor = completion.editor val offset = completion.offset editor.document.insertString(offset, text) + editor.caretModel.moveToOffset(offset + text.length) + project.service().coreMessenger?.request("autocomplete/accept", completion.completionId, null, ({})) invokeLater { clearCompletions(editor) @@ -177,6 +179,7 @@ class AutocompleteService(private val project: Project) { if (currentDelimiter.isNotEmpty()) { result.add(currentDelimiter) + } return result diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 9a66c9e05..d012194a3 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -35,6 +35,7 @@ const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; border-radius: ${defaultBorderRadius}; position: relative; + overflow-x: hidden; &::after { position: absolute; diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 9354a73b5..cb2013437 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -123,24 +123,13 @@ function StepContainer(props: StepContainerProps) { {(props.isLast || isHovered || typeof feedback !== "undefined") && !active && ( -
+
{props.modelTitle && (
-
{props.modelTitle}
-
+
+ {props.modelTitle} +
+
)} diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 4fc1144ad..14608ed17 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -114,7 +114,7 @@ function InputToolbar(props: InputToolbarProps) { defaultModel.capabilities, ) && ( setFileSelectHovered(false)} onMouseEnter={() => setFileSelectHovered(true)} > @@ -170,11 +170,11 @@ function InputToolbar(props: InputToolbarProps) { }) } > - - {" "} - {getMetaKeyLabel()}⏎ @codebase + + {getMetaKeyLabel()}⏎ Use @codebase - @codebase + + @codebase )}
@@ -187,8 +187,8 @@ function InputToolbar(props: InputToolbarProps) { }); }} > - ⏎ Enter - ⏎ + ⏎ Enter + ⏎
diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 1048ad562..e6d1858ff 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -318,7 +318,7 @@ function ModelSelect() { style={{ padding: 0 }} onClick={calculatePosition} > -
+
{modelSelectTitle(defaultModel) || "Select model"}{" "} diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index f4954dc1d..51c0981ae 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -469,20 +469,22 @@ function GUI() {
) : state.history.length > 0 ? ( -
+
{ saveSession(); }} className="mr-auto" > - New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"}) + + New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"}) + {" "}
) : ( <> {getLastSessionId() ? ( -
+
{ loadLastSession().catch((e) => @@ -491,7 +493,7 @@ function GUI() { }} className="mr-auto flex items-center gap-2" > - + Last Session
From 183ae03ee37ba6629201211e9a63fbcb04ebc527 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Sep 2024 15:32:06 -0700 Subject: [PATCH 081/252] fix: unnecessary scroll delay --- gui/src/components/ChatScrollAnchor.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gui/src/components/ChatScrollAnchor.tsx b/gui/src/components/ChatScrollAnchor.tsx index 59e59ab9b..40c0f9d19 100644 --- a/gui/src/components/ChatScrollAnchor.tsx +++ b/gui/src/components/ChatScrollAnchor.tsx @@ -12,10 +12,7 @@ export function ChatScrollAnchor({ isAtBottom, scrollAreaRef, }: ChatScrollAnchorProps) { - const { ref, inView, entry } = useInView({ - trackVisibility, - delay: 100, - }); + const { ref, inView, entry } = useInView(); useEffect(() => { if (isAtBottom && trackVisibility && !inView) { From 6e5c475754381a180a7acb193ccfca6c092ce0ce Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 25 Sep 2024 16:24:53 -0700 Subject: [PATCH 082/252] Use native Ollama FIM --- core/llm/index.ts | 2 +- core/llm/llms/Ollama.ts | 48 ++++++++++++++++++++++++++++++++++++++++- core/llm/llms/OpenAI.ts | 2 +- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index fd36222c9..336ded890 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -430,7 +430,7 @@ export abstract class BaseLLM implements ILLM { return formatted; } - async *_streamFim( + protected async *_streamFim( prefix: string, suffix: string, options: CompletionOptions, diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index f830b7f0f..3b16d0456 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -61,7 +61,7 @@ class Ollama extends BaseLLM { this.completionOptions.stop.push(JSON.parse(value)); } catch (e) { console.warn( - "Error parsing stop parameter value \"{value}: ${e}", + 'Error parsing stop parameter value "{value}: ${e}', ); } break; @@ -132,11 +132,13 @@ class Ollama extends BaseLLM { private _convertArgs( options: CompletionOptions, prompt: string | ChatMessage[], + suffix?: string, ) { const finalOptions: any = { model: this._getModel(), raw: true, keep_alive: options.keepAlive ?? 60 * 30, // 30 minutes + suffix, options: { temperature: options.temperature, top_p: options.topP, @@ -248,6 +250,50 @@ class Ollama extends BaseLLM { } } + supportsFim(): boolean { + return true; + } + + protected async *_streamFim( + prefix: string, + suffix: string, + options: CompletionOptions, + ): AsyncGenerator { + const response = await this.fetch(this.getEndpoint("api/generate"), { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.apiKey}`, + }, + body: JSON.stringify(this._convertArgs(options, prefix, suffix)), + }); + + let buffer = ""; + for await (const value of streamResponse(response)) { + // Append the received chunk to the buffer + buffer += value; + // Split the buffer into individual JSON chunks + const chunks = buffer.split("\n"); + buffer = chunks.pop() ?? ""; + + for (let i = 0; i < chunks.length; i++) { + const chunk = chunks[i]; + if (chunk.trim() !== "") { + try { + const j = JSON.parse(chunk); + if ("response" in j) { + yield j.response; + } else if ("error" in j) { + throw new Error(j.error); + } + } catch (e) { + throw new Error(`Error parsing Ollama response: ${e} ${chunk}`); + } + } + } + } + } + async listModels(): Promise { const response = await this.fetch( // localhost was causing fetch failed in pkg binary only for this Ollama endpoint diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index e37b43799..9366a7954 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -264,7 +264,7 @@ class OpenAI extends BaseLLM { } } - async *_streamFim( + protected async *_streamFim( prefix: string, suffix: string, options: CompletionOptions, From f63fd5d83cefbbe01721515a8f28f435353bd804 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Sep 2024 18:05:15 -0700 Subject: [PATCH 083/252] fix: add uuid to chat msgs for deletions --- gui/src/components/gui/StepContainer.tsx | 85 +++--- gui/src/components/mainInput/InputToolbar.tsx | 129 +++++---- gui/src/components/mainInput/TipTapEditor.tsx | 8 +- gui/src/components/markdown/CopyButton.tsx | 2 +- .../components/modelSelection/ModelSelect.tsx | 2 +- gui/src/hooks/useSubmenuContextProviders.tsx | 72 +---- gui/src/pages/gui.tsx | 248 ++++++++---------- gui/src/redux/slices/stateSlice.ts | 107 ++------ 8 files changed, 238 insertions(+), 415 deletions(-) diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index cb2013437..10a21fa0a 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -10,12 +10,7 @@ import { stripImages } from "core/llm/images"; import { useContext, useEffect, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; -import { - defaultBorderRadius, - lightGray, - vscBackground, - vscInputBackground, -} from ".."; +import { defaultBorderRadius, vscBackground, vscInputBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import useUIConfig from "../../hooks/useUIConfig"; import { RootState } from "../../redux/store"; @@ -49,30 +44,15 @@ const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>` function StepContainer(props: StepContainerProps) { const [isHovered, setIsHovered] = useState(false); - const isUserInput = props.item.message.role === "user"; const active = useSelector((store: RootState) => store.state.active); + const history = useSelector((state: RootState) => state.state.history); + const [truncatedEarly, setTruncatedEarly] = useState(false); const ideMessenger = useContext(IdeMessengerContext); - const [feedback, setFeedback] = useState(undefined); - const sessionId = useSelector((store: RootState) => store.state.sessionId); - const sendFeedback = (feedback: boolean) => { - setFeedback(feedback); - if (props.item.promptLogs?.length) { - for (const promptLog of props.item.promptLogs) { - ideMessenger.post("devdata/log", { - tableName: "chat", - data: { ...promptLog, feedback, sessionId }, - }); - } - } - }; - - const [truncatedEarly, setTruncatedEarly] = useState(false); - + const isUserInput = props.item.message.role === "user"; const uiConfig = useUIConfig(); - useEffect(() => { if (!active) { const content = stripImages(props.item.message.content).trim(); @@ -92,6 +72,18 @@ function StepContainer(props: StepContainerProps) { } }, [props.item.message.content, active]); + const sendFeedback = (feedback: boolean) => { + setFeedback(feedback); + if (props.item.promptLogs?.length) { + for (const promptLog of props.item.promptLogs) { + ideMessenger.post("devdata/log", { + tableName: "chat", + data: { ...promptLog, feedback, sessionId }, + }); + } + } + }; + return (
{ @@ -121,6 +113,7 @@ function StepContainer(props: StepContainerProps) { /> )} + {(props.isLast || isHovered || typeof feedback !== "undefined") && !active && (
@@ -129,7 +122,7 @@ function StepContainer(props: StepContainerProps) {
{props.modelTitle}
-
+
)} @@ -137,38 +130,28 @@ function StepContainer(props: StepContainerProps) { { - props.onContinueGeneration(); - }} + onClick={props.onContinueGeneration} > - + )} + { - props.onRetry(); - }} + onClick={props.onRetry} > - + {feedback === false || ( { sendFeedback(true); }} @@ -178,25 +161,19 @@ function StepContainer(props: StepContainerProps) { {feedback === true || ( { sendFeedback(false); }} /> )} - - { - props.onDelete(); - }} - /> - + + {props.index !== 1 && ( + + + + )}
)}
diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 14608ed17..b3f1a32d1 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -1,11 +1,11 @@ import { AtSymbolIcon, - PhotoIcon as OutlinePhotoIcon, + PhotoIcon, + SlashIcon, } from "@heroicons/react/24/outline"; -import { PhotoIcon as SolidPhotoIcon } from "@heroicons/react/24/solid"; import { InputModifiers } from "core"; import { modelSupportsImages } from "core/llm/autodetect"; -import { useRef, useState } from "react"; +import { useRef } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; import { @@ -48,11 +48,7 @@ const HoverItem = styled.span<{ isActive?: boolean }>` padding-top: 2px; padding-bottom: 2px; cursor: pointer; - transition: color 200ms; - - &:hover { - color: #d1d5db; - } + transition: color 200ms, background-color 200ms, box-shadow 200ms; `; const EnterButton = styled.div` @@ -73,6 +69,7 @@ const EnterButton = styled.div` interface InputToolbarProps { onEnter?: (modifiers: InputModifiers) => void; onAddContextItem?: () => void; + onAddSlashCommand?: () => void; onClick?: () => void; onImageFileSelected?: (file: File) => void; hidden?: boolean; @@ -81,78 +78,74 @@ interface InputToolbarProps { function InputToolbar(props: InputToolbarProps) { const fileInputRef = useRef(null); - const [fileSelectHovered, setFileSelectHovered] = useState(false); - const defaultModel = useSelector(defaultModelSelector); const useActiveFile = useSelector(selectUseActiveFile); + const supportsImages = + defaultModel && + modelSupportsImages( + defaultModel.provider, + defaultModel.model, + defaultModel.title, + defaultModel.capabilities, + ); + return ( <>
-
- -
-
- - - - {defaultModel && - modelSupportsImages( - defaultModel.provider, - defaultModel.model, - defaultModel.title, - defaultModel.capabilities, - ) && ( - setFileSelectHovered(false)} - onMouseEnter={() => setFileSelectHovered(true)} - > - { - for (const file of e.target.files) { - props.onImageFileSelected(file); - } + +
+ {supportsImages && ( + <> + { + for (const file of e.target.files) { + props.onImageFileSelected(file); + } + }} + /> + + { + fileInputRef.current?.click(); }} /> - {fileSelectHovered ? ( - { - fileInputRef.current?.click(); - }} - /> - ) : ( - { - fileInputRef.current?.click(); - }} - /> - )} - - )} + + + )} + + + + + + + +
-
-
+
+
{props.activeKey === "Alt" ? ( - + {`${getAltKeyLabel()}⏎ ${useActiveFile ? "No active file" : "Active file"}`} @@ -161,7 +154,7 @@ function InputToolbar(props: InputToolbarProps) { className={ props.activeKey === "Meta" ? "text-gray-300" - : "text-gray-400 hover:text-gray-300 transition-colors duration-200" + : "hover:text-gray-300" } onClick={(e) => props.onEnter({ @@ -170,11 +163,11 @@ function InputToolbar(props: InputToolbarProps) { }) } > - + {getMetaKeyLabel()}⏎ Use @codebase - @codebase + @codebase )}
@@ -187,8 +180,8 @@ function InputToolbar(props: InputToolbarProps) { }); }} > - ⏎ Enter - ⏎ + ⏎ Enter + ⏎
diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 21f0b3923..627865b04 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -878,11 +878,15 @@ function TipTapEditor(props: TipTapEditorProps) { activeKey={activeKey} hidden={shouldHideToolbar && !props.isMainInput} onAddContextItem={() => { - if (editor.getText().endsWith("@")) { - } else { + if (!editor.getText().endsWith("@")) { editor.commands.insertContent("@"); } }} + onAddSlashCommand={() => { + if (!editor.getText().endsWith("/")) { + editor.commands.insertContent("/"); + } + }} onEnter={onEnterRef.current} onImageFileSelected={(file) => { handleImageFile(file).then(([img, dataUrl]) => { diff --git a/gui/src/components/markdown/CopyButton.tsx b/gui/src/components/markdown/CopyButton.tsx index cd47df6db..144b427f5 100644 --- a/gui/src/components/markdown/CopyButton.tsx +++ b/gui/src/components/markdown/CopyButton.tsx @@ -36,7 +36,7 @@ export function CopyButton(props: CopyButtonProps) { {copied ? ( ) : ( - + )} diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index e6d1858ff..518d60798 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -318,7 +318,7 @@ function ModelSelect() { style={{ padding: 0 }} onClick={calculatePosition} > -
+
{modelSelectTitle(defaultModel) || "Select model"}{" "} diff --git a/gui/src/hooks/useSubmenuContextProviders.tsx b/gui/src/hooks/useSubmenuContextProviders.tsx index 79036bd81..fc0b0c71a 100644 --- a/gui/src/hooks/useSubmenuContextProviders.tsx +++ b/gui/src/hooks/useSubmenuContextProviders.tsx @@ -55,7 +55,6 @@ function useSubmenuContextProviders() { }, [ideMessenger]); useWebviewListener("refreshSubmenuItems", async (data) => { - console.debug("refreshSubmenuItems called with data:", data); if (!isLoading) { setLoaded(false); setInitialLoadComplete(false); @@ -64,7 +63,6 @@ function useSubmenuContextProviders() { }); useWebviewListener("updateSubmenuItems", async (data) => { - console.debug("updateSubmenuItems called with data:", data); const minisearch = new MiniSearch({ fields: ["title", "description"], storeFields: ["id", "title", "description"], @@ -128,13 +126,6 @@ function useSubmenuContextProviders() { const getSubmenuSearchResults = useMemo( () => (providerTitle: string | undefined, query: string): SearchResult[] => { - console.debug( - "Executing getSubmenuSearchResults. Provider:", - providerTitle, - "Query:", - query, - ); - console.debug("Current minisearches:", Object.keys(minisearches)); if (providerTitle === undefined) { // Return search combined from all providers const results = Object.keys(minisearches).map((providerTitle) => { @@ -142,10 +133,6 @@ function useSubmenuContextProviders() { query, MINISEARCH_OPTIONS, ); - console.debug( - `Search results for ${providerTitle}:`, - results.length, - ); return results.map((result) => { return { ...result, providerTitle }; }); @@ -154,7 +141,6 @@ function useSubmenuContextProviders() { return results.flat().sort((a, b) => b.score - a.score); } if (!minisearches[providerTitle]) { - console.debug(`No minisearch found for provider: ${providerTitle}`); return []; } @@ -163,7 +149,6 @@ function useSubmenuContextProviders() { .map((result) => { return { ...result, providerTitle }; }); - console.debug(`Search results for ${providerTitle}:`, results.length); return results; }, @@ -177,17 +162,6 @@ function useSubmenuContextProviders() { query: string, limit: number = MAX_LENGTH, ): (ContextSubmenuItem & { providerTitle: string })[] => { - console.debug( - "Executing getSubmenuContextItems. Provider:", - providerTitle, - "Query:", - query, - "Limit:", - limit, - ); - console.debug("Current fallbackResults:", fallbackResults); - console.debug("Current minisearches:", Object.keys(minisearches)); - try { const results = getSubmenuSearchResults(providerTitle, query); if (results.length === 0) { @@ -201,9 +175,6 @@ function useSubmenuContextProviders() { }); if (fallbackItems.length === 0 && !initialLoadComplete) { - console.debug( - "Initial load not complete, returning loading state", - ); return [ { id: "loading", @@ -214,8 +185,6 @@ function useSubmenuContextProviders() { ]; } - console.debug("Using fallback results:", fallbackItems.length); - console.debug("Fallback items:", fallbackItems); return fallbackItems; } const limitedResults = results.slice(0, limit).map((result) => { @@ -243,12 +212,6 @@ function useSubmenuContextProviders() { setIsLoading(true); const loadSubmenuItems = async () => { - console.debug("Starting loadSubmenuItems"); - console.debug( - "contextProviderDescriptions:", - contextProviderDescriptions, - ); - try { const disableIndexing = getLocalStorage("disableIndexing") ?? false; @@ -264,14 +227,12 @@ function useSubmenuContextProviders() { return; } - console.debug(`Processing provider: ${description.title}`); - try { const minisearch = new MiniSearch({ fields: ["title", "description"], storeFields: ["id", "title", "description"], }); - console.debug(`Requesting items for ${description.title}`); + const result = (await ideMessenger.request( "context/loadSubmenuItems", { @@ -279,11 +240,6 @@ function useSubmenuContextProviders() { }, )) as WebviewMessengerResult<"context/loadSubmenuItems">; - console.debug( - `Received result for ${description.title}:`, - result, - ); - if (result.status === "error") { console.error( `Error loading items for ${description.title}:`, @@ -293,21 +249,15 @@ function useSubmenuContextProviders() { } const items = result.content; - console.debug( - `Adding ${items.length} items to minisearch for ${description.title}`, - ); minisearch.addAll(items); - console.debug(`Updating minisearches for ${description.title}`); setMinisearches((prev) => ({ ...prev, [description.title]: minisearch, })); if (description.title === "file") { - console.debug("Processing file provider"); const openFiles = await memoizedGetOpenFileItems(); - console.debug(`Got ${openFiles.length} open files`); setFallbackResults((prev) => ({ ...prev, file: [ @@ -316,9 +266,6 @@ function useSubmenuContextProviders() { ], })); } else { - console.debug( - `Updating fallbackResults for ${description.title}`, - ); setFallbackResults((prev) => ({ ...prev, [description.title]: items.slice(0, MAX_LENGTH), @@ -336,23 +283,16 @@ function useSubmenuContextProviders() { } catch (error) { console.error("Error in loadSubmenuItems:", error); } finally { - console.debug("Finished loadSubmenuItems"); - console.debug("Final minisearches:", Object.keys(minisearches)); - console.debug("Final fallbackResults:", Object.keys(fallbackResults)); setInitialLoadComplete(true); setIsLoading(false); } }; - loadSubmenuItems() - .then(() => { - console.debug("loadSubmenuItems completed successfully"); - }) - .catch((error) => { - console.error("Error in loadSubmenuItems:", error); - setInitialLoadComplete(true); - setIsLoading(false); - }); + loadSubmenuItems().catch((error) => { + console.error("Error in loadSubmenuItems:", error); + setInitialLoadComplete(true); + setIsLoading(false); + }); }, [contextProviderDescriptions, loaded, autoLoadTriggered]); useWebviewListener("configUpdate", async () => { diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index 51c0981ae..d1535f1ad 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -149,37 +149,20 @@ function GUI() { const posthog = usePostHog(); const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); - + const { streamResponse } = useChatHandler(dispatch, ideMessenger); const onboardingCard = useOnboardingCard(); const { showTutorialCard, closeTutorialCard } = useTutorialCard(); - const sessionState = useSelector((state: RootState) => state.state); - const defaultModel = useSelector(defaultModelSelector); - const ttsActive = useSelector((state: RootState) => state.state.ttsActive); const active = useSelector((state: RootState) => state.state.active); - const [stepsOpen, setStepsOpen] = useState<(boolean | undefined)[]>([]); - const mainTextInputRef = useRef(null); const topGuiDivRef = useRef(null); - const [isAtBottom, setIsAtBottom] = useState(false); - const state = useSelector((state: RootState) => state.state); - - const handleScroll = () => { - // Temporary fix to account for additional height when code blocks are added - const OFFSET_HERUISTIC = 300; - if (!topGuiDivRef.current) return; - - const { scrollTop, scrollHeight, clientHeight } = topGuiDivRef.current; - const atBottom = - scrollHeight - clientHeight <= scrollTop + OFFSET_HERUISTIC; - - setIsAtBottom(atBottom); - }; + const { saveSession, getLastSessionId, loadLastSession } = + useHistory(dispatch); useEffect(() => { if (!active || !topGuiDivRef.current) return; @@ -210,9 +193,17 @@ function GUI() { }; }, [active]); - // #endregion + const handleScroll = () => { + // Temporary fix to account for additional height when code blocks are added + const OFFSET_HERUISTIC = 300; + if (!topGuiDivRef.current) return; - const { streamResponse } = useChatHandler(dispatch, ideMessenger); + const { scrollTop, scrollHeight, clientHeight } = topGuiDivRef.current; + const atBottom = + scrollHeight - clientHeight <= scrollTop + OFFSET_HERUISTIC; + + setIsAtBottom(atBottom); + }; const sendInput = useCallback( (editorState: JSONContent, modifiers: InputModifiers) => { @@ -316,9 +307,6 @@ function GUI() { ], ); - const { saveSession, getLastSessionId, loadLastSession } = - useHistory(dispatch); - useWebviewListener( "newSession", async () => { @@ -330,14 +318,9 @@ function GUI() { const isLastUserInput = useCallback( (index: number): boolean => { - let foundLaterUserInput = false; - for (let i = index + 1; i < state.history.length; i++) { - if (state.history[i].message.role === "user") { - foundLaterUserInput = true; - break; - } - } - return !foundLaterUserInput; + return !state.history + .slice(index + 1) + .some((entry) => entry.message.role === "user"); }, [state.history], ); @@ -351,117 +334,113 @@ function GUI() { >
- {state.history.map((item, index: number) => { - return ( - - { - dispatch(newSession()); - }} - > - {item.message.role === "user" ? ( - { - streamResponse( - editorState, - modifiers, - ideMessenger, - index, - ); - }} - isLastUserInput={isLastUserInput(index)} - isMainInput={false} - editorState={item.editorState} - contextItems={item.contextItems} - > - ) : ( -
- - ) : false ? ( - - ) : ( - - ) - } + {state.history.map((item, index: number) => ( + + { + dispatch(newSession()); + }} + > + {item.message.role === "user" ? ( + { + streamResponse( + editorState, + modifiers, + ideMessenger, + index, + ); + }} + isLastUserInput={isLastUserInput(index)} + isMainInput={false} + editorState={item.editorState} + contextItems={item.contextItems} + /> + ) : ( +
+ + ) : false ? ( + + ) : ( + + ) + } + open={ + typeof stepsOpen[index] === "undefined" + ? false + ? false + : true + : stepsOpen[index]! + } + onToggle={() => {}} + > + {}} - > - {}} - item={item} - onReverse={() => {}} - onRetry={() => { - streamResponse( - state.history[index - 1].editorState, - state.history[index - 1].modifiers ?? - defaultInputModifiers, - ideMessenger, - index - 1, - ); - }} - onContinueGeneration={() => { - window.postMessage( - { - messageType: "userInput", - data: { - input: - "Continue your response exactly where you left off:", - }, + key={index} + onUserInput={(input: string) => {}} + item={item} + onReverse={() => {}} + onRetry={() => { + streamResponse( + state.history[index - 1].editorState, + state.history[index - 1].modifiers ?? + defaultInputModifiers, + ideMessenger, + index - 1, + ); + }} + onContinueGeneration={() => { + window.postMessage( + { + messageType: "userInput", + data: { + input: + "Continue your response exactly where you left off:", }, - "*", - ); - }} - onDelete={() => { - dispatch(deleteMessage(index)); - }} - modelTitle={item.promptLogs?.[0]?.modelTitle ?? ""} - /> - -
- )} -
-
- ); - })} + }, + "*", + ); + }} + onDelete={() => { + dispatch(deleteMessage(index)); + }} + modelTitle={item.promptLogs?.[0]?.modelTitle ?? ""} + /> +
+
+ )} +
+
+ ))}
+ + /> {active ? ( <> @@ -520,6 +499,7 @@ function GUI() { trackVisibility={active} /> + {ttsActive && ( state.state.history], @@ -25,78 +26,14 @@ export const memoizedContextItemsSelector = createSelector( }, ); -const TEST_CONTEXT_ITEMS: ContextItemWithId[] = [ - { - content: "def add(a, b):\n return a + b", - description: "test.py", - name: "test.py", - - id: { - itemId: "test.py", - providerTitle: "file", - }, - }, - { - content: "function add(a, b) {\n return a + b\n}", - - description: "test.js", - name: "test.js", - id: { - itemId: "test.js", - providerTitle: "file", - }, - }, -]; - -const TEST_TIMELINE: ChatHistory = [ - { - message: { - role: "user", - content: "Hi, please write bubble sort in python", - }, - contextItems: [], - }, - { - message: { - role: "assistant", - content: `\`\`\`python -def bubble_sort(arr): - n = len(arr) - for i in range(n): - for j in range(0, n - i - 1): - if arr[j] > arr[j + 1]: - arr[j], arr[j + 1] = arr[j + 1], arr[j] - return arr -\`\`\``, - }, - contextItems: [], - }, - { - message: { role: "user", content: "Now write it in Rust" }, - contextItems: [], - }, - { - message: { - role: "assistant", - content: `Sure, here's bubble sort written in rust: \n\`\`\`rust -fn bubble_sort(values: &mut[T]) { - let len = values.len(); - for i in 0..len { - for j in 0..(len - i - 1) { - if values[j] > values[j + 1] { - values.swap(j, j + 1); - } - } - } -} -\`\`\`\nIs there anything else I can answer?`, - }, - contextItems: [], - }, -]; +// We need this to handle reorderings (e.g. a mid-array deletion) of the messages array. +// The proper fix is adding a UUID to all chat messages, but this is the temp workaround. +type ChatHistoryItemWithMessageId = ChatHistoryItem & { + message: ChatMessage & { id: string }; +}; type State = { - history: ChatHistory; + history: ChatHistoryItemWithMessageId[]; contextItems: ContextItemWithId[]; ttsActive: boolean; active: boolean; @@ -239,6 +176,7 @@ export const stateSlice = createSlice({ // Cut off history after the resubmitted message state.history = state.history.slice(0, payload.index + 1).concat({ message: { + id: uuidv4(), role: "assistant", content: "", }, @@ -250,22 +188,9 @@ export const stateSlice = createSlice({ state.active = true; }, deleteMessage: (state, action: PayloadAction) => { - const index = action.payload + 1; - - if (index >= 0 && index < state.history.length) { - // Delete the current message - state.history.splice(index, 1); - - // If the next message is an assistant message, delete it too - if ( - index < state.history.length && - state.history[index].message.role === "assistant" - ) { - state.history.splice(index, 1); - } - } + // Deletes the current assistant message and the previous user message + state.history.splice(action.payload - 1, 2); }, - initNewActiveMessage: ( state, { @@ -275,12 +200,13 @@ export const stateSlice = createSlice({ }>, ) => { state.history.push({ - message: { role: "user", content: "" }, + message: { role: "user", content: "", id: uuidv4() }, contextItems: state.contextItems, editorState: payload.editorState, }); state.history.push({ message: { + id: uuidv4(), role: "assistant", content: "", }, @@ -302,7 +228,7 @@ export const stateSlice = createSlice({ ) => { if (payload.index >= state.history.length) { state.history.push({ - message: payload.message, + message: { ...payload.message, id: uuidv4() }, editorState: { type: "doc", content: stripImages(payload.message.content) @@ -316,7 +242,10 @@ export const stateSlice = createSlice({ }); return; } - state.history[payload.index].message = payload.message; + state.history[payload.index].message = { + ...payload.message, + id: uuidv4(), + }; state.history[payload.index].contextItems = payload.contextItems || []; }, addContextItemsAtIndex: ( @@ -348,7 +277,7 @@ export const stateSlice = createSlice({ { payload }: PayloadAction, ) => { if (payload) { - state.history = payload.history; + state.history = payload.history as any; state.title = payload.title; state.sessionId = payload.sessionId; } else { From 3289c21f1b59a36fa87a75ece456fe85837592ae Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Sep 2024 18:31:25 -0700 Subject: [PATCH 084/252] gui: set max view width on model select --- gui/src/components/mainInput/InputToolbar.tsx | 4 ++-- gui/src/components/modelSelection/ModelSelect.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index b3f1a32d1..57fff591f 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -96,11 +96,11 @@ function InputToolbar(props: InputToolbarProps) { isHidden={props.hidden} onClick={props.onClick} id="input-toolbar" - className="hidden xs:flex text-gray-400 transition-colors duration-200" + className="hidden xs:flex " >
-
+
{supportsImages && ( <>
- +
{sortedOptions.map((option, idx) => ( Date: Wed, 25 Sep 2024 20:38:34 -0700 Subject: [PATCH 085/252] rename verticalPerLineDiff to verticalDiff --- extensions/vscode/src/commands.ts | 6 +- .../decorations.ts | 0 .../{verticalPerLine => vertical}/handler.ts | 8 +- .../{verticalPerLine => vertical}/manager.ts | 22 ++--- .../vscode/src/diff/verticalPerCharacter.ts | 90 ------------------- .../vscode/src/extension/VsCodeExtension.ts | 10 +-- .../vscode/src/extension/VsCodeMessenger.ts | 7 +- .../VerticalPerLineCodeLensProvider.ts | 2 +- .../codeLens/registerAllCodeLensProviders.ts | 2 +- .../src/quickEdit/QuickEditQuickPick.ts | 6 +- 10 files changed, 28 insertions(+), 125 deletions(-) rename extensions/vscode/src/diff/{verticalPerLine => vertical}/decorations.ts (100%) rename extensions/vscode/src/diff/{verticalPerLine => vertical}/handler.ts (98%) rename extensions/vscode/src/diff/{verticalPerLine => vertical}/manager.ts (95%) delete mode 100644 extensions/vscode/src/diff/verticalPerCharacter.ts diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 274065b51..6bec8b754 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -25,7 +25,7 @@ import { } from "./autocomplete/statusBar"; import { ContinueGUIWebviewViewProvider } from "./ContinueGUIWebviewViewProvider"; import { DiffManager } from "./diff/horizontal"; -import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager"; +import { VerticalDiffManager } from "./diff/vertical/manager"; import { QuickEdit, QuickEditShowParams } from "./quickEdit/QuickEditQuickPick"; import { Battery } from "./util/battery"; import { EXTENSION_NAME } from "./util/constants"; @@ -172,7 +172,7 @@ const commandsMap: ( sidebar: ContinueGUIWebviewViewProvider, configHandler: ConfigHandler, diffManager: DiffManager, - verticalDiffManager: VerticalPerLineDiffManager, + verticalDiffManager: VerticalDiffManager, continueServerClientPromise: Promise, battery: Battery, quickEdit: QuickEdit, @@ -713,7 +713,7 @@ export function registerAllCommands( sidebar: ContinueGUIWebviewViewProvider, configHandler: ConfigHandler, diffManager: DiffManager, - verticalDiffManager: VerticalPerLineDiffManager, + verticalDiffManager: VerticalDiffManager, continueServerClientPromise: Promise, battery: Battery, quickEdit: QuickEdit, diff --git a/extensions/vscode/src/diff/verticalPerLine/decorations.ts b/extensions/vscode/src/diff/vertical/decorations.ts similarity index 100% rename from extensions/vscode/src/diff/verticalPerLine/decorations.ts rename to extensions/vscode/src/diff/vertical/decorations.ts diff --git a/extensions/vscode/src/diff/verticalPerLine/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts similarity index 98% rename from extensions/vscode/src/diff/verticalPerLine/handler.ts rename to extensions/vscode/src/diff/vertical/handler.ts index 89554eba4..9259cb38e 100644 --- a/extensions/vscode/src/diff/verticalPerLine/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -9,12 +9,12 @@ import { } from "./decorations"; import type { VerticalDiffCodeLens } from "./manager"; -export interface VerticalPerLineDiffHandlerOptions { +export interface VerticalDiffHandlerOptions { input?: string; instant?: boolean; } -export class VerticalPerLineDiffHandler implements vscode.Disposable { +export class VerticalDiffHandler implements vscode.Disposable { private editor: vscode.TextEditor; private startLine: number; private endLine: number; @@ -29,7 +29,7 @@ export class VerticalPerLineDiffHandler implements vscode.Disposable { private newLinesAdded = 0; - public options: VerticalPerLineDiffHandlerOptions; + public options: VerticalDiffHandlerOptions; constructor( startLine: number, @@ -44,7 +44,7 @@ export class VerticalPerLineDiffHandler implements vscode.Disposable { accept: boolean, ) => void, private readonly refreshCodeLens: () => void, - options: VerticalPerLineDiffHandlerOptions, + options: VerticalDiffHandlerOptions, ) { this.currentLineIndex = startLine; this.startLine = startLine; diff --git a/extensions/vscode/src/diff/verticalPerLine/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts similarity index 95% rename from extensions/vscode/src/diff/verticalPerLine/manager.ts rename to extensions/vscode/src/diff/vertical/manager.ts index 50db74506..c84fa4397 100644 --- a/extensions/vscode/src/diff/verticalPerLine/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -5,10 +5,7 @@ import { getMarkdownLanguageTagForFile } from "core/util"; import { DiffLine } from "core"; import { streamDiffLines } from "core/edit/streamDiffLines"; import * as vscode from "vscode"; -import { - VerticalPerLineDiffHandler, - VerticalPerLineDiffHandlerOptions, -} from "./handler"; +import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler"; export interface VerticalDiffCodeLens { start: number; @@ -16,11 +13,10 @@ export interface VerticalDiffCodeLens { numGreen: number; } -export class VerticalPerLineDiffManager { +export class VerticalDiffManager { public refreshCodeLens: () => void = () => {}; - private filepathToHandler: Map = - new Map(); + private filepathToHandler: Map = new Map(); filepathToCodeLens: Map = new Map(); @@ -30,11 +26,11 @@ export class VerticalPerLineDiffManager { this.userChangeListener = undefined; } - createVerticalPerLineDiffHandler( + createVerticalDiffHandler( filepath: string, startLine: number, endLine: number, - options: VerticalPerLineDiffHandlerOptions, + options: VerticalDiffHandlerOptions, ) { if (this.filepathToHandler.has(filepath)) { this.filepathToHandler.get(filepath)?.clear(false); @@ -42,7 +38,7 @@ export class VerticalPerLineDiffManager { } const editor = vscode.window.activeTextEditor; // TODO if (editor && editor.document.uri.fsPath === filepath) { - const handler = new VerticalPerLineDiffHandler( + const handler = new VerticalDiffHandler( startLine, endLine, editor, @@ -92,7 +88,7 @@ export class VerticalPerLineDiffManager { private handleDocumentChange( event: vscode.TextDocumentChangeEvent, - handler: VerticalPerLineDiffHandler, + handler: VerticalDiffHandler, ) { // Loop through each change in the event event.contentChanges.forEach((change) => { @@ -203,7 +199,7 @@ export class VerticalPerLineDiffManager { }); // Create new handler with determined start/end - const diffHandler = this.createVerticalPerLineDiffHandler( + const diffHandler = this.createVerticalDiffHandler( filepath, startLine, endLine, @@ -339,7 +335,7 @@ export class VerticalPerLineDiffManager { }); // Create new handler with determined start/end - const diffHandler = this.createVerticalPerLineDiffHandler( + const diffHandler = this.createVerticalDiffHandler( filepath, startLine, endLine, diff --git a/extensions/vscode/src/diff/verticalPerCharacter.ts b/extensions/vscode/src/diff/verticalPerCharacter.ts deleted file mode 100644 index da63fa041..000000000 --- a/extensions/vscode/src/diff/verticalPerCharacter.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { matchLine } from "core/diff/util"; - -interface DiffBlock { - startLine: number; - endLine: number; - replacement: string[]; -} - -interface LineUpdate { - content: string; - line: number; - replace: boolean; -} - -type DiffEvent = LineUpdate | DiffBlock; - -/** - * Returns a stream of characters, but with "undefined" inserted into the stream whenever there is a new line - */ -async function* streamWithLineBreaks( - completionStream: AsyncGenerator, -): AsyncGenerator { - for await (const chunk of completionStream) { - if (chunk.includes("\n")) { - const lines = chunk.split("\n"); - for (let i = 0; i < lines.length; i++) { - yield lines[i]; - if (i < lines.length - 1) { - yield undefined; - } - } - } else { - yield chunk; - } - } -} - -async function* streamDiffEvents( - completionStream: AsyncGenerator, - oldCode: string, -): AsyncGenerator { - const remainingLines = oldCode.split("\n"); - let i = 0; - let oldLine = remainingLines.shift(); - let newLine = ""; - let alreadyReplacedCurrentLine = false; - - for await (const chunk of streamWithLineBreaks(completionStream)) { - if (chunk === undefined) { - // Decide whether there is a match - const matchIndex = matchLine(newLine, remainingLines); - // Delete all of the lines in the middle - // TODO - - // Start a new line - oldLine = remainingLines.shift(); - newLine = ""; - alreadyReplacedCurrentLine = false; - i++; - } else { - // Continue current line - newLine += chunk; - - if (oldLine?.startsWith(newLine)) { - // Match, do nothing - } else { - // Difference, send the update - // This also handles when we are past all of the oldLines - if (alreadyReplacedCurrentLine) { - yield { - content: chunk, - line: i, - replace: false, - }; - } else { - yield { - content: newLine, - line: i, - replace: true, - }; - alreadyReplacedCurrentLine = true; - } - } - } - } -} - -// But you also want to stream between the diff blocks. -// So...not only do you want to stream DiffBlocks -// Next is stream lines: {line: string, type: "match" | ""} diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 004f89d89..68714b106 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -16,7 +16,7 @@ import { import { registerAllCommands } from "../commands"; import { ContinueGUIWebviewViewProvider } from "../ContinueGUIWebviewViewProvider"; import { DiffManager } from "../diff/horizontal"; -import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager"; +import { VerticalDiffManager } from "../diff/vertical/manager"; import { registerAllCodeLensProviders } from "../lang-server/codeLens"; import { QuickEdit } from "../quickEdit/QuickEditQuickPick"; import { setupRemoteConfigSync } from "../stubs/activation"; @@ -41,7 +41,7 @@ export class VsCodeExtension { private sidebar: ContinueGUIWebviewViewProvider; private windowId: string; private diffManager: DiffManager; - private verticalDiffManager: VerticalPerLineDiffManager; + private verticalDiffManager: VerticalDiffManager; webviewProtocolPromise: Promise; private core: Core; private battery: Battery; @@ -66,7 +66,7 @@ export class VsCodeExtension { // Dependencies of core let resolveVerticalDiffManager: any = undefined; - const verticalDiffManagerPromise = new Promise( + const verticalDiffManagerPromise = new Promise( (resolve) => { resolveVerticalDiffManager = resolve; }, @@ -124,9 +124,7 @@ export class VsCodeExtension { resolveConfigHandler?.(this.configHandler); this.configHandler.reloadConfig(); - this.verticalDiffManager = new VerticalPerLineDiffManager( - this.configHandler, - ); + this.verticalDiffManager = new VerticalDiffManager(this.configHandler); resolveVerticalDiffManager?.(this.verticalDiffManager); this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler); diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 7e521224e..0e5b91b88 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -1,5 +1,5 @@ -import { ILLM } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; +import { getModelByRole } from "core/config/util"; import { applyCodeBlock } from "core/edit/lazy/applyCodeBlock"; import { FromCoreProtocol, @@ -19,7 +19,7 @@ import { getConfigJsonPath } from "core/util/paths"; import * as fs from "node:fs"; import * as path from "node:path"; import * as vscode from "vscode"; -import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager"; +import { VerticalDiffManager } from "../diff/vertical/manager"; import { getControlPlaneSessionInfo, WorkOsAuthProvider, @@ -27,7 +27,6 @@ import { import { getExtensionUri } from "../util/vscode"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; -import { getModelByRole } from "core/config/util"; /** * A shared messenger class between Core and Webview @@ -76,7 +75,7 @@ export class VsCodeMessenger { >, private readonly webviewProtocol: VsCodeWebviewProtocol, private readonly ide: VsCodeIde, - private readonly verticalDiffManagerPromise: Promise, + private readonly verticalDiffManagerPromise: Promise, private readonly configHandlerPromise: Promise, private readonly workOsAuthProvider: WorkOsAuthProvider, ) { diff --git a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts index b0effc563..fdcb30bed 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { VerticalDiffCodeLens } from "../../../diff/verticalPerLine/manager"; +import { VerticalDiffCodeLens } from "../../../diff/vertical/manager"; import { getAltOrOption, getMetaKeyLabel } from "../../../util/util"; export class VerticalPerLineCodeLensProvider diff --git a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts index cfaabde06..b70ade262 100644 --- a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts +++ b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts @@ -1,7 +1,7 @@ import { ContinueConfig } from "core"; import * as vscode from "vscode"; import { DiffManager } from "../../diff/horizontal"; -import { VerticalDiffCodeLens } from "../../diff/verticalPerLine/manager"; +import { VerticalDiffCodeLens } from "../../diff/vertical/manager"; import * as providers from "./providers"; import { getQuickActionsConfig, diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index b501c0250..59b7ad41f 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -3,7 +3,7 @@ import { IDE } from "core"; import { walkDir } from "core/indexing/walkDir"; import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; -import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager"; +import { VerticalDiffManager } from "../diff/vertical/manager"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; import { getContextProviderQuickPickVal } from "./ContextProvidersQuickPick"; import { appendToHistory, getHistoryQuickPickVal } from "./HistoryQuickPick"; @@ -12,8 +12,8 @@ import { getModelQuickPickVal } from "./ModelSelectionQuickPick"; // @ts-ignore - error finding typings import { ConfigHandler } from "core/config/ConfigHandler"; // @ts-ignore -import MiniSearch from "minisearch"; import { getModelByRole } from "core/config/util"; +import MiniSearch from "minisearch"; /** * Used to track what action to take after a user interacts @@ -86,7 +86,7 @@ export class QuickEdit { private _curModelTitle?: string; constructor( - private readonly verticalDiffManager: VerticalPerLineDiffManager, + private readonly verticalDiffManager: VerticalDiffManager, private readonly configHandler: ConfigHandler, private readonly webviewProtocol: VsCodeWebviewProtocol, private readonly ide: IDE, From a9e3c58c4b3fa53d02295281bf24a7c0f37c4404 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 25 Sep 2024 20:39:11 -0700 Subject: [PATCH 086/252] finish rename of verticaldiff --- .../codeLens/providers/VerticalPerLineCodeLensProvider.ts | 4 +--- extensions/vscode/src/lang-server/codeLens/providers/index.ts | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts index fdcb30bed..94a68bac7 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts @@ -2,9 +2,7 @@ import * as vscode from "vscode"; import { VerticalDiffCodeLens } from "../../../diff/vertical/manager"; import { getAltOrOption, getMetaKeyLabel } from "../../../util/util"; -export class VerticalPerLineCodeLensProvider - implements vscode.CodeLensProvider -{ +export class VerticalDiffCodeLensProvider implements vscode.CodeLensProvider { private _eventEmitter: vscode.EventEmitter = new vscode.EventEmitter(); diff --git a/extensions/vscode/src/lang-server/codeLens/providers/index.ts b/extensions/vscode/src/lang-server/codeLens/providers/index.ts index 599d63145..49c71ed57 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/index.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/index.ts @@ -2,5 +2,4 @@ export { ConfigPyCodeLensProvider } from "./ConfigPyCodeLensProvider"; export { DiffViewerCodeLensProvider } from "./DiffViewerCodeLensProvider"; export { QuickActionsCodeLensProvider } from "./QuickActionsCodeLensProvider"; export { SuggestionsCodeLensProvider } from "./SuggestionsCodeLensProvider"; -export { VerticalPerLineCodeLensProvider } from "./VerticalPerLineCodeLensProvider"; - +export { VerticalDiffCodeLensProvider as VerticalPerLineCodeLensProvider } from "./VerticalPerLineCodeLensProvider"; From da2c3d51898bf915cb1585d44d6073e014257d7d Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 10:02:20 -0700 Subject: [PATCH 087/252] remove redundant fields in azure provider --- core/llm/llms/Azure.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/llm/llms/Azure.ts b/core/llm/llms/Azure.ts index ce20b4ecc..be7d1c18c 100644 --- a/core/llm/llms/Azure.ts +++ b/core/llm/llms/Azure.ts @@ -1,8 +1,18 @@ -import { ModelProvider } from "../../index.js"; +import { LLMOptions, ModelProvider } from "../../index.js"; import OpenAI from "./OpenAI.js"; class Azure extends OpenAI { static providerName: ModelProvider = "azure"; + + static defaultOptions: Partial = { + apiVersion: "2024-02-15-preview", + apiType: "azure", + }; + + constructor(options: LLMOptions) { + super(options); + this.engine = options.model; + } } export default Azure; From f0c76ed0e7505b4e5971e96da0198a366453a065 Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Thu, 26 Sep 2024 21:40:49 +0200 Subject: [PATCH 088/252] Refactor: Move caching options to cacheBehavior object As suggested here: https://github.com/continuedev/continue/pull/2372 --- core/config/types.ts | 11 ++-- core/index.d.ts | 11 ++-- core/llm/index.ts | 9 ++-- core/llm/llms/Anthropic.ts | 8 +-- docs/static/schemas/config.json | 53 +++++++++++++------ .../src/main/resources/config_schema.json | 52 ++++++++++++------ extensions/vscode/config_schema.json | 45 ++++++++++------ extensions/vscode/continue_rc_schema.json | 45 ++++++++++------ 8 files changed, 158 insertions(+), 76 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index 98cc7ccb5..fb3631c4c 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -47,6 +47,7 @@ declare global { llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; apiBase?: string; + cacheBehavior?: CacheBehavior; engine?: string; apiVersion?: string; @@ -313,6 +314,7 @@ declare global { apiKey?: string; aiGatewaySlug?: string; apiBase?: string; + cacheBehavior?: CacheBehavior; useLegacyCompletionsEndpoint?: boolean; @@ -341,9 +343,6 @@ declare global { watsonxProjectId?: string; watsonxStopToken?: string; watsonxApiVersion?: string; - - cacheSystemMessage?: boolean; - cacheConversation?: boolean; } type RequireAtLeastOne = Pick< T, @@ -688,6 +687,11 @@ declare global { clientCertificate?: ClientCertificateOptions; } + export interface CacheBehavior { + cacheSystemMessage?: boolean; + cacheConversation?: boolean; + } + export interface ClientCertificateOptions { cert: string; key: string; @@ -750,6 +754,7 @@ declare global { requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; capabilities?: ModelCapability; + cacheBehavior?: CacheBehavior; } export type EmbeddingsProviderName = diff --git a/core/index.d.ts b/core/index.d.ts index 44fea298c..76181e564 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -70,6 +70,7 @@ export interface ILLM extends LLMOptions { llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; apiBase?: string; + cacheBehavior?: CacheBehavior; engine?: string; apiVersion?: string; @@ -340,6 +341,7 @@ export interface LLMOptions { apiKey?: string; aiGatewaySlug?: string; apiBase?: string; + cacheBehavior?: CacheBehavior; useLegacyCompletionsEndpoint?: boolean; @@ -369,9 +371,6 @@ export interface LLMOptions { watsonxStopToken?: string; watsonxApiVersion?: string; watsonxFullUrl?: string; - - cacheSystemMessage?: boolean; - cacheConversation?: boolean; } type RequireAtLeastOne = Pick< T, @@ -728,6 +727,11 @@ export interface RequestOptions { clientCertificate?: ClientCertificateOptions; } +export interface CacheBehavior { + cacheSystemMessage?: boolean; + cacheConversation?: boolean; +} + export interface ClientCertificateOptions { cert: string; key: string; @@ -790,6 +794,7 @@ export interface ModelDescription { requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; capabilities?: ModelCapability; + cacheBehavior?: CacheBehavior; } export type EmbeddingsProviderName = diff --git a/core/llm/index.ts b/core/llm/index.ts index ab1b7e652..6c648ceb3 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -14,6 +14,7 @@ import { PromptTemplate, RequestOptions, TemplateType, + CacheBehavior } from "../index.js"; import { logDevData } from "../util/devdata.js"; import { DevDataSqliteDb } from "../util/devdataSqlite.js"; @@ -102,6 +103,7 @@ export abstract class BaseLLM implements ILLM { llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; apiBase?: string; + cacheBehavior?: CacheBehavior; capabilities?: ModelCapability; engine?: string; @@ -120,9 +122,6 @@ export abstract class BaseLLM implements ILLM { watsonxApiVersion?: string; watsonxFullUrl?: string; - cacheSystemMessage?: boolean; - cacheConversation?: boolean; - private _llmOptions: LLMOptions; constructor(_options: LLMOptions) { @@ -185,6 +184,7 @@ export abstract class BaseLLM implements ILLM { this.apiKey = options.apiKey; this.aiGatewaySlug = options.aiGatewaySlug; this.apiBase = options.apiBase; + this.cacheBehavior = options.cacheBehavior; // for watsonx only this.watsonxUrl = options.watsonxUrl; @@ -194,9 +194,6 @@ export abstract class BaseLLM implements ILLM { this.watsonxApiVersion = options.watsonxApiVersion; this.watsonxFullUrl = options.watsonxFullUrl; - this.cacheSystemMessage = options.cacheSystemMessage; - this.cacheConversation = options.cacheConversation; - if (this.apiBase && !this.apiBase.endsWith("/")) { this.apiBase = `${this.apiBase}/`; } diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index fa4620e2a..f2182d851 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -45,7 +45,7 @@ class Anthropic extends BaseLLM { // The second-to-last because it retrieves potentially already cached contents, // The last one because we want it cached for later retrieval. // See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching - const addCaching = !!this.cacheConversation && lastTwoUserMsgIndices.includes(filteredMsgIdx); + const addCaching = this.cacheBehavior?.cacheConversation && lastTwoUserMsgIndices.includes(filteredMsgIdx); if (typeof message.content === "string") { var chatMessage = { @@ -98,7 +98,7 @@ class Anthropic extends BaseLLM { messages: ChatMessage[], options: CompletionOptions, ): AsyncGenerator { - const shouldCacheSystemMessage = !!this.systemMessage && !!this.cacheSystemMessage; + const shouldCacheSystemMessage = !!this.systemMessage && this.cacheBehavior?.cacheSystemMessage; const systemMessage: string = stripImages( messages.filter((m) => m.role === "system")[0]?.content, ); @@ -110,7 +110,7 @@ class Anthropic extends BaseLLM { Accept: "application/json", "anthropic-version": "2023-06-01", "x-api-key": this.apiKey as string, - ...(shouldCacheSystemMessage || !!this.cacheConversation + ...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation ? { "anthropic-beta": "prompt-caching-2024-07-31" } : {}), }, @@ -136,7 +136,7 @@ class Anthropic extends BaseLLM { } for await (const value of streamSse(response)) { - // if (value.type == "message_start") console.log(value); + if (value.type == "message_start") console.log(value); if (value.delta?.text) { yield { role: "assistant", content: value.delta.text }; } diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 254a5eabb..4b0161394 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -701,11 +701,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "anyOf": [ @@ -801,11 +807,14 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + } + } }, "model": { "enum": [ @@ -1025,11 +1034,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] @@ -1053,6 +1068,7 @@ "llama2-70b", "mistral-8x7b", "gemma", + "gemma2", "llama3-8b", "llama3-70b", "llama3.1-8b", @@ -2123,6 +2139,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index c891e05a9..4b0161394 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -701,11 +701,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "anyOf": [ @@ -801,11 +807,14 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + } + } }, "model": { "enum": [ @@ -1025,11 +1034,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] @@ -2124,6 +2139,13 @@ "minimum": 128, "exclusiveMaximum": 2147483647 }, + "maxBatchSize": { + "title": "Maximum Batch Size", + "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", + "type": "integer", + "minimum": 1, + "exclusiveMaximum": 2147483647 + }, "region": { "title": "Region", "description": "The region where the model is hosted", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 6253b1d55..4b0161394 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -701,11 +701,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "anyOf": [ @@ -801,11 +807,14 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + } + } }, "model": { "enum": [ @@ -1025,11 +1034,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 8375f099a..56658bf2e 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -758,11 +758,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "anyOf": [ @@ -877,11 +883,14 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + } + } }, "model": { "enum": [ @@ -1123,11 +1132,17 @@ }, "then": { "properties": { - "cacheSystemMessage": { - "type": "boolean" - }, - "cacheConversation": { - "type": "boolean" + "cacheBehavior": { + "title": "Caching Behavior", + "description": "Options for the prompt caching", + "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, + "cacheConversation": { + "type": "boolean" + } + } }, "model": { "enum": [ From 419cdd7e65e5f117ac08f3ff2fbb5fe98d062022 Mon Sep 17 00:00:00 2001 From: Tijs Zwinkels Date: Thu, 26 Sep 2024 21:50:31 +0200 Subject: [PATCH 089/252] Update documentation showing cacheBehavior object --- .../customize/model-providers/top-level/anthropic.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/docs/customize/model-providers/top-level/anthropic.md b/docs/docs/customize/model-providers/top-level/anthropic.md index 1aa0d9dbc..c4bb24a4c 100644 --- a/docs/docs/customize/model-providers/top-level/anthropic.md +++ b/docs/docs/customize/model-providers/top-level/anthropic.md @@ -48,16 +48,17 @@ Anthropic currently does not offer any reranking models. Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). -To enable caching of the system message, update your your model configuration with `"cacheSystemMessage": true`: -To enable caching of the conversation, update your your model configuration with `"cacheConversation": true`: +To enable caching of the system message and the turn-by-turn conversation, update your your model configuration as following: ```json { "models": [ { // Enable prompt caching - "cacheSystemMessage": true, - "cacheConversation": true, + "cacheBehavior": { + "cacheSystemMessage": true, + "cacheConversation": true + }, "title": "Anthropic", "provider": "anthropic", "model": "claude-3-5-sonnet-20240620", From 6002175c5e3ad591b6a4b89edc500b6715b37e73 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 14:28:41 -0700 Subject: [PATCH 090/252] add haiku as repomap model --- core/config/util.ts | 14 +++++++++++++- core/core.ts | 2 +- core/protocol/core.ts | 10 +++++++--- .../components/BestExperienceConfigForm.tsx | 17 ++++++++++++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/core/config/util.ts b/core/config/util.ts index 69e088a18..0247aa25d 100644 --- a/core/config/util.ts +++ b/core/config/util.ts @@ -29,7 +29,7 @@ export function addContextProvider(provider: ContextProviderWithParams) { }); } -export function addModel(model: ModelDescription) { +export function addModel(model: ModelDescription, role?: keyof ModelRoles) { editConfigJson((config) => { if (config.models?.some((m: any) => stringify(m) === stringify(model))) { return config; @@ -39,6 +39,18 @@ export function addModel(model: ModelDescription) { } config.models.push(model); + + // Set the role for the model + if (role) { + if (!config.experimental) { + config.experimental = {}; + } + if (!config.experimental.modelRoles) { + config.experimental.modelRoles = {}; + } + config.experimental.modelRoles[role] = model.title; + } + return config; }); } diff --git a/core/core.ts b/core/core.ts index e9b29b493..ebd08f3bf 100644 --- a/core/core.ts +++ b/core/core.ts @@ -226,7 +226,7 @@ export class Core { // Edit config on("config/addModel", (msg) => { const model = msg.data.model; - addModel(model); + addModel(model, msg.data.role); void this.configHandler.reloadConfig(); }); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 73f55946c..d5920ca81 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -1,5 +1,3 @@ -import type { AutocompleteInput } from "../autocomplete/completionProvider"; -import { ProfileDescription } from "../config/ConfigHandler"; import type { BrowserSerializedContinueConfig, ChatMessage, @@ -10,12 +8,15 @@ import type { LLMFullCompletionOptions, MessageContent, ModelDescription, + ModelRoles, PersistedSessionInfo, RangeInFile, SerializedContinueConfig, SessionInfo, SiteIndexingConfig, } from "../"; +import type { AutocompleteInput } from "../autocomplete/completionProvider"; +import { ProfileDescription } from "../config/ConfigHandler"; export type ProtocolGeneratorType = AsyncGenerator<{ done?: boolean; @@ -50,7 +51,10 @@ export type ToCoreFromIdeOrWebviewProtocol = { "devdata/log": [{ tableName: string; data: any }, void]; "config/addOpenAiKey": [string, void]; "config/addModel": [ - { model: SerializedContinueConfig["models"][number] }, + { + model: SerializedContinueConfig["models"][number]; + role?: keyof ModelRoles; + }, void, ]; "config/newPromptFile": [undefined, void]; diff --git a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx index f38fbaccd..fa5514e84 100644 --- a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +++ b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx @@ -10,7 +10,11 @@ import { setDefaultModel } from "../../../redux/slices/stateSlice"; import AddModelButtonSubtext from "../../AddModelButtonSubtext"; const { anthropic: chatProvider, mistral: autocompleteProvider } = providers; -const { claude35Sonnet: chatModel, codestral: autocompleteModel } = models; +const { + claude35Sonnet: chatModel, + claude3Haiku: repoMapModel, + codestral: autocompleteModel, +} = models; interface BestExperienceConfigFormProps { onComplete: () => void; @@ -36,6 +40,13 @@ function BestExperienceConfigForm({ title: chatModel.params.title, }; + const repoMapConfig = { + model: repoMapModel.params.model, + provider: chatProvider.provider, + apiKey: chatApiKey, + title: repoMapModel.params.title, + }; + const autocompleteModelConfig = { title: autocompleteModel.params.title, provider: autocompleteProvider.provider, @@ -47,6 +58,10 @@ function BestExperienceConfigForm({ title: DEFAULT_CHAT_MODEL_CONFIG.title, }); ideMessenger.post("config/addModel", { model: chatModelConfig }); + ideMessenger.post("config/addModel", { + model: repoMapConfig, + role: "repoMapFileSelection", + }); dispatch(setDefaultModel({ title: chatModelConfig.title, force: true })); if (!!autocompleteApiKey) { From 92f689071ab7ac2eda8032a054d1a484312bb26d Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 15:00:51 -0700 Subject: [PATCH 091/252] inline diff red --- core/diff/streamDiff.ts | 1 + .../editor/DiffStreamHandler.kt | 69 ++++++++++++++++--- .../editor/EditorComponentInlaysManager.kt | 12 ++-- .../editor/InlineEditAction.kt | 6 +- 4 files changed, 70 insertions(+), 18 deletions(-) diff --git a/core/diff/streamDiff.ts b/core/diff/streamDiff.ts index 42c8409b9..2761b5d97 100644 --- a/core/diff/streamDiff.ts +++ b/core/diff/streamDiff.ts @@ -8,6 +8,7 @@ import { LineStream, matchLine } from "./util.js"; * - old + same = oldLinesCopy.length * ^ (above two guarantee that all lines get represented) * - Lines are always output in order, at least among old and new separately + * - Old lines in a hunk are always output before the new lines */ export async function* streamDiff( oldLines: string[], diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt index f30347150..46e37dc7c 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.command.undo.UndoManager import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.colors.EditorFontType import com.intellij.openapi.editor.colors.TextAttributesKey import com.intellij.openapi.editor.markup.HighlighterLayer import com.intellij.openapi.editor.markup.RangeHighlighter @@ -17,6 +18,7 @@ import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.Project import com.intellij.ui.JBColor import java.awt.event.KeyEvent +import javax.swing.BorderFactory import javax.swing.JTextArea import kotlin.math.min @@ -34,6 +36,7 @@ class DiffStreamHandler( private val onClose: () -> Unit, private val onFinish: () -> Unit ) { + // Text attributes keys private val greenKey = run { val attributes = TextAttributes().apply { backgroundColor = JBColor(0x3000FF00.toInt(), 0x3000FF00.toInt()) @@ -61,12 +64,18 @@ class DiffStreamHandler( key } + private val editorComponentInlaysManager = EditorComponentInlaysManager.from(editor, false) + + // State variables private var currentLine = startLine private var currentLineHighlighter: RangeHighlighter? = null private val unfinishedHighlighters: MutableList = mutableListOf() - private var changeCount: Int = 0 + private var changeCount: Int = 0 // Kept track of so we can count steps to undo when cancelling private var running: Boolean = false + private var deletionBufferStartLine: Int = -1 + private val deletionsBuffer: MutableList = mutableListOf() + fun setup() { // Highlight the range with unfinished color for (i in startLine..endLine) { @@ -77,11 +86,44 @@ class DiffStreamHandler( } } + private fun deleteLineAt(index: Int) { + val startOffset = editor.document.getLineStartOffset(index) + val endOffset = editor.document.getLineEndOffset(index) + 1 + editor.document.deleteString(startOffset, min(endOffset, editor.document.textLength)) + } + + private fun insertDeletionBuffer() { + // Insert red highlighted code between the real lines in the editor + if (deletionBufferStartLine != -1 && deletionsBuffer.isNotEmpty()) { + val component = JTextArea().apply { + text = deletionsBuffer.joinToString(" \n") + isEditable = false + background = JBColor(0x30FF0000.toInt(), 0x30FF0000.toInt()) + foreground = JBColor.GRAY + border = BorderFactory.createEmptyBorder(0, 0, 0, 0) + lineWrap = false + wrapStyleWord = false + columns = Int.MAX_VALUE // This ensures the component takes up the full width + margin = java.awt.Insets(0, -100, 0, 0) + + font = editor.colorsScheme.getFont(EditorFontType.PLAIN) + preferredSize = java.awt.Dimension(editor.contentComponent.width, preferredSize.height) + } + + editorComponentInlaysManager.insertAfter(deletionBufferStartLine - 1, component) + + // Clear the buffer + deletionsBuffer.clear() + deletionBufferStartLine = -1 + } + } + private fun handleDiffLine(type: DiffLineType, line: String) { println("DiffStreamHandler: handleDiffLine: $currentLine, $type, $line") try { when (type) { DiffLineType.SAME -> { + insertDeletionBuffer() currentLine++ } DiffLineType.NEW -> { @@ -95,14 +137,21 @@ class DiffStreamHandler( // Highlight the new line green editor.markupModel.addLineHighlighter(greenKey, currentLine, HighlighterLayer.LAST) + insertDeletionBuffer() + currentLine++ changeCount++ } DiffLineType.OLD -> { // Remove old line - val startOffset = editor.document.getLineStartOffset(currentLine) - val endOffset = editor.document.getLineEndOffset(currentLine) + 1 - editor.document.deleteString(startOffset, min(endOffset, editor.document.textLength)) + deleteLineAt(currentLine) + + // Add to deletions buffer + deletionsBuffer.add(line) + if (deletionBufferStartLine == -1) { + deletionBufferStartLine = currentLine + } + changeCount++ } } @@ -175,12 +224,7 @@ class DiffStreamHandler( running = true // Highlight the range with unfinished color - for (i in startLine..endLine) { - val highlighter = editor.markupModel.addLineHighlighter(unfinishedKey, min( - i, editor.document.lineCount - 1 - ), HighlighterLayer.FIRST) - unfinishedHighlighters.add(highlighter) - } + setup() // Request diff stream from core val continuePluginService = ServiceManager.getService( @@ -206,12 +250,15 @@ class DiffStreamHandler( onFinish() ApplicationManager.getApplication().invokeLater { - // Clean up highlighters + // Clean up progress highlighters if (currentLineHighlighter != null) { editor.markupModel.removeHighlighter(currentLineHighlighter!!) } unfinishedHighlighters.forEach { editor.markupModel.removeHighlighter(it) } + // Flush deletion buffer + insertDeletionBuffer() + // Add ", " to the text area textArea.document.insertString(textArea.caretPosition, ", ", null) textArea.requestFocus() diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt index c5b089d7a..f8277d383 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt @@ -26,7 +26,7 @@ import kotlin.math.min * Copied from com.intellij.util.ui.codereview.diff.EditorComponentInlaysManager * via https://github.com/cursive-ide/component-inlay-example/blob/master/src/main/kotlin/inlays/EditorComponentInlaysManager.kt */ -class EditorComponentInlaysManager(val editor: EditorImpl) : Disposable { +class EditorComponentInlaysManager(val editor: EditorImpl, private val onlyOneInlay: Boolean) : Disposable { private val managedInlays = mutableMapOf() private val editorWidthWatcher = EditorTextWidthWatcher() @@ -44,8 +44,10 @@ class EditorComponentInlaysManager(val editor: EditorImpl) : Disposable { fun insertAfter(lineIndex: Int, component: JComponent): Disposable? { if (Disposer.isDisposed(this)) return null - // Dispose all other inlays - managedInlays.values.forEach(Disposer::dispose) + if (onlyOneInlay) { + // Dispose all other inlays + managedInlays.values.forEach(Disposer::dispose) + } val wrappedComponent = ComponentWrapper(component) val offset = editor.document.getLineEndOffset(lineIndex) @@ -144,11 +146,11 @@ class EditorComponentInlaysManager(val editor: EditorImpl) : Disposable { companion object { val INLAYS_KEY: Key = Key.create("EditorComponentInlaysManager") - fun from(editor: Editor): EditorComponentInlaysManager { + fun from(editor: Editor, onlyOneInlay: Boolean): EditorComponentInlaysManager { return synchronized(editor) { val manager = editor.getUserData(INLAYS_KEY) if (manager == null) { - val newManager = EditorComponentInlaysManager(editor as EditorImpl) + val newManager = EditorComponentInlaysManager(editor as EditorImpl, false) editor.putUserData(INLAYS_KEY, newManager) newManager } else manager diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index f94214c34..5b77f8165 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -103,7 +103,7 @@ fun openInlineEdit(project: Project?, editor: Editor) { return } - val manager = EditorComponentInlaysManager.from(editor) + val manager = EditorComponentInlaysManager.from(editor, true) // Get list of model titles val continuePluginService = project.service() @@ -192,7 +192,9 @@ fun openInlineEdit(project: Project?, editor: Editor) { diffStreamService.reject(editor) // Re-highlight the selected text - selectionModel.setSelection(start, end) + val documentLength = editor.document.textLength + val safeEnd = minOf(end, documentLength) + selectionModel.setSelection(start, safeEnd) } else if (e.keyCode == KeyEvent.VK_ENTER) { if (e.modifiersEx == KeyEvent.SHIFT_DOWN_MASK) { textArea.document.insertString(textArea.caretPosition, "\n", null) From b48a77bd68a6929a901c7497c90398a0d38647e6 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 16:46:15 -0700 Subject: [PATCH 092/252] fix model selectedIndex err --- .../continueintellijextension/editor/InlineEditAction.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index 5b77f8165..aea1b8c6b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -278,8 +278,10 @@ class CustomPanel(layout: MigLayout, project: Project, modelTitles: List horizontalAlignment = SwingConstants.RIGHT } selectedIndex = continueSettingsService.continueState.lastSelectedInlineEditModel?.let { - val index = modelTitles.indexOf(it) - if (index != -1) index else 0 + if (modelTitles.isEmpty()) -1 else { + val index = modelTitles.indexOf(it) + if (index != -1) index else 0 + } } ?: 0 addActionListener { From dd865eadea014ccc8588a49e6d9c338d89734c9d Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Sep 2024 17:02:39 -0700 Subject: [PATCH 093/252] feat: add "Gathering context..." indicator --- .../src/quickEdit/QuickEditQuickPick.ts | 1 + gui/src/components/ButtonWithTooltip.tsx | 11 +- gui/src/components/gui/StepContainer.tsx | 159 ++++++++---------- .../components/mainInput/ContextItemsPeek.tsx | 79 +++++---- .../components/mainInput/ContinueInputBox.tsx | 68 +++++--- gui/src/components/mainInput/InputToolbar.tsx | 32 +--- gui/src/components/mainInput/resolveInput.ts | 26 +++ .../components/markdown/CodeBlockToolbar.tsx | 7 +- gui/src/components/markdown/CopyButton.tsx | 23 ++- .../markdown/StyledMarkdownPreview.tsx | 11 +- .../markdown/SyntaxHighlightedPre.tsx | 1 + .../components/modelSelection/ModelSelect.tsx | 2 +- .../modelSelection/ModelSelectionListbox.tsx | 6 +- gui/src/hooks/useChatHandler.ts | 25 ++- gui/src/pages/gui.tsx | 1 - gui/src/redux/slices/stateSlice.ts | 8 + 16 files changed, 245 insertions(+), 215 deletions(-) diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 59b7ad41f..877d94ad3 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -13,6 +13,7 @@ import { getModelQuickPickVal } from "./ModelSelectionQuickPick"; import { ConfigHandler } from "core/config/ConfigHandler"; // @ts-ignore import { getModelByRole } from "core/config/util"; +// @ts-ignore import MiniSearch from "minisearch"; /** diff --git a/gui/src/components/ButtonWithTooltip.tsx b/gui/src/components/ButtonWithTooltip.tsx index 005b82001..f692133a1 100644 --- a/gui/src/components/ButtonWithTooltip.tsx +++ b/gui/src/components/ButtonWithTooltip.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React from "react"; import ReactDOM from "react-dom"; import { type PlacesType } from "react-tooltip"; import { HeaderButton } from "."; @@ -25,7 +25,6 @@ const ButtonWithTooltip = React.forwardRef< HTMLButtonElement, HeaderButtonWithTextProps >((props: HeaderButtonWithTextProps, ref) => { - const [hover, setHover] = useState(false); const id = uuidv4(); const tooltipPortalDiv = document.getElementById("tooltip-portal-div"); @@ -39,14 +38,6 @@ const ButtonWithTooltip = React.forwardRef< data-tooltip-id={tooltipId} inverted={props.inverted} disabled={props.disabled} - onMouseEnter={() => { - if (!props.disabled) { - setHover(true); - } - }} - onMouseLeave={() => { - setHover(false); - }} onClick={props.onClick} onKeyDown={props.onKeyDown} className={props.className} diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 10a21fa0a..c4d0b2597 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -10,7 +10,7 @@ import { stripImages } from "core/llm/images"; import { useContext, useEffect, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; -import { defaultBorderRadius, vscBackground, vscInputBackground } from ".."; +import { vscBackground, vscInputBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import useUIConfig from "../../hooks/useUIConfig"; import { RootState } from "../../redux/store"; @@ -34,18 +34,15 @@ interface StepContainerProps { } const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>` - padding: 4px 0px 8px 0px; + padding-top: 4px; background-color: ${(props) => props.isUserInput ? vscInputBackground : vscBackground}; font-size: ${(props) => props.fontSize || getFontSize()}px; - // border-radius: ${defaultBorderRadius}; overflow: hidden; `; function StepContainer(props: StepContainerProps) { - const [isHovered, setIsHovered] = useState(false); const active = useSelector((store: RootState) => store.state.active); - const history = useSelector((state: RootState) => state.state.history); const [truncatedEarly, setTruncatedEarly] = useState(false); const ideMessenger = useContext(IdeMessengerContext); const [feedback, setFeedback] = useState(undefined); @@ -53,6 +50,8 @@ function StepContainer(props: StepContainerProps) { const isUserInput = props.item.message.role === "user"; const uiConfig = useUIConfig(); + const shouldRenderActions = !props.isLast || (props.isLast && !active); + useEffect(() => { if (!active) { const content = stripImages(props.item.message.content).trim(); @@ -85,98 +84,72 @@ function StepContainer(props: StepContainerProps) { }; return ( -
{ - setIsHovered(true); - }} - onMouseLeave={() => { - setIsHovered(false); - }} - > -
- - {(props.isLast || isHovered || typeof feedback !== "undefined") && - !active && ( -
- {props.modelTitle && ( -
-
- {props.modelTitle} -
-
-
- )} - - {truncatedEarly && ( - - - - )} - - - - - - - {feedback === false || ( - - { - sendFeedback(true); - }} - /> - - )} - {feedback === true || ( - - { - sendFeedback(false); - }} - /> - - )} - - {props.index !== 1 && ( - - - - )} -
+ {props.index !== 1 && ( + + + )} -
+ + + + sendFeedback(true)} + > + + + + sendFeedback(false)} + > + + +
+ )}
); } diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx index 5327719d2..38ec51b08 100644 --- a/gui/src/components/mainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/ContextItemsPeek.tsx @@ -1,7 +1,7 @@ import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; import { ContextItemWithId } from "core"; import { contextItemToRangeInFileWithContents } from "core/commands/util"; -import React, { useContext } from "react"; +import { useContext, useState } from "react"; import { lightGray, vscBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { getFontSize } from "../../util"; @@ -9,15 +9,39 @@ import FileIcon from "../FileIcon"; import SafeImg from "../SafeImg"; import { INSTRUCTIONS_BASE_ITEM } from "core/context/providers/utils"; import { getIconFromDropdownItem } from "./MentionList"; +import styled from "styled-components"; interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; + isGatheringContext: boolean; } interface ContextItemsPeekItemProps { contextItem: ContextItemWithId; } +const AnimatedEllipsis = styled.span` + &::after { + content: "."; + animation: ellipsis 2.5s infinite; + display: inline-block; + width: 12px; + text-align: left; + } + + @keyframes ellipsis { + 0% { + content: "."; + } + 33% { + content: ".."; + } + 66% { + content: "..."; + } + } +`; + function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { const ideMessenger = useContext(IdeMessengerContext); @@ -116,53 +140,49 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { ); } -function ContextItemsPeek({ contextItems }: ContextItemsPeekProps) { - const [open, setOpen] = React.useState(false); +function ContextItemsPeek({ + contextItems, + isGatheringContext, +}: ContextItemsPeekProps) { + const [open, setOpen] = useState(false); const ctxItems = contextItems?.filter( (ctxItem) => !ctxItem.name.includes(INSTRUCTIONS_BASE_ITEM.name), ); - if (!ctxItems || ctxItems.length === 0) { + if ((!ctxItems || ctxItems.length === 0) && !isGatheringContext) { return null; } - const contextItemsText = `${ctxItems.length} context ${ - ctxItems.length > 1 ? "items" : "item" - }`; - return ( -
+
setOpen((prev) => !prev)} >
- - {contextItemsText} + + {isGatheringContext ? ( + <> + Gathering context + + + ) : ( + `${ctxItems.length} context ${ + ctxItems.length > 1 ? "items" : "item" + }` + )}
@@ -171,9 +191,10 @@ function ContextItemsPeek({ contextItems }: ContextItemsPeekProps) { open ? "max-h-[50vh] opacity-100" : "max-h-0 opacity-0" }`} > - {ctxItems.map((contextItem, idx) => ( - - ))} + {ctxItems && + ctxItems.map((contextItem, idx) => ( + + ))}
); diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 574a945d0..9778a6de9 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -9,6 +9,16 @@ import { newSession, setMessageAtIndex } from "../../redux/slices/stateSlice"; import { RootState } from "../../redux/store"; import ContextItemsPeek from "./ContextItemsPeek"; import TipTapEditor from "./TipTapEditor"; +import { useState, useRef, useEffect } from "react"; + +interface ContinueInputBoxProps { + isLastUserInput: boolean; + isMainInput?: boolean; + onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; + editorState?: JSONContent; + contextItems?: ContextItemWithId[]; + hidden?: boolean; +} const gradient = keyframes` 0% { @@ -22,8 +32,6 @@ const gradient = keyframes` const GradientBorder = styled.div<{ borderRadius?: string; borderColor?: string; - isFirst: boolean; - isLast: boolean; loading: 0 | 1; }>` border-radius: ${(props) => props.borderRadius || "0"}; @@ -47,18 +55,8 @@ const GradientBorder = styled.div<{ display: flex; flex-direction: row; align-items: center; - margin-top: 8px; `; -interface ContinueInputBoxProps { - isLastUserInput: boolean; - isMainInput?: boolean; - onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; - editorState?: JSONContent; - contextItems?: ContextItemWithId[]; - hidden?: boolean; -} - function ContinueInputBox(props: ContinueInputBoxProps) { const dispatch = useDispatch(); @@ -67,6 +65,12 @@ function ContinueInputBox(props: ContinueInputBoxProps) { const availableContextProviders = useSelector( (store: RootState) => store.state.config.contextProviders, ); + const isGatheringContextStore = useSelector( + (store: RootState) => store.state.isGatheringContext, + ); + + const [isGatheringContext, setIsGatheringContext] = useState(false); + const timeoutRef = useRef(null); useWebviewListener( "newSessionWithPrompt", @@ -84,24 +88,31 @@ function ContinueInputBox(props: ContinueInputBoxProps) { [props.isMainInput], ); + console.log({ isGatheringContext, isGatheringContextStore }); + + useEffect(() => { + if (isGatheringContextStore && !isGatheringContext) { + // 500ms delay when going from false -> true to prevent flashing loading indicator + timeoutRef.current = setTimeout(() => setIsGatheringContext(true), 500); + } else { + // Update immediately otherwise (i.e. true -> false) + setIsGatheringContext(isGatheringContextStore); + } + + return () => { + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + } + }; + }, [isGatheringContextStore]); + return (
-
+
+ />
- +
); } diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 57fff591f..99b08d481 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -59,11 +59,6 @@ const EnterButton = styled.div` border-radius: ${defaultBorderRadius}; color: ${vscForeground}; cursor: pointer; - - &:hover { - background-color: ${vscBadgeBackground}; - color: ${vscBadgeForeground}; - } `; interface InputToolbarProps { @@ -100,7 +95,7 @@ function InputToolbar(props: InputToolbarProps) { >
-
+
{supportsImages && ( <> - + { @@ -125,37 +120,22 @@ function InputToolbar(props: InputToolbarProps) { )} - + - - - -
-
+
{props.activeKey === "Alt" ? ( - + {`${getAltKeyLabel()}⏎ ${useActiveFile ? "No active file" : "Active file"}`} ) : ( props.onEnter({ useCodebase: true, diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index 7ede4a42d..f57c03f4a 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -207,4 +207,30 @@ function resolveParagraph(p: JSONContent): [string, MentionAttrs[], string] { return [text, contextItems, slashCommand]; } +export function hasSlashCommandOrContextProvider( + editorState: JSONContent, +): boolean { + if (!editorState.content) { + return false; + } + + for (const p of editorState.content) { + if (p.type === "paragraph" && p.content) { + for (const child of p.content) { + if (child.type === "slashcommand") { + return true; + } + if ( + child.type === "mention" && + child.attrs?.itemType === "contextProvider" + ) { + return true; + } + } + } + } + + return false; +} + export default resolveEditorContent; diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index 417d33dbb..510e70b2b 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -18,12 +18,7 @@ import { import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useWebviewListener } from "../../hooks/useWebviewListener"; import { incrementNextCodeBlockToApplyIndex } from "../../redux/slices/uiStateSlice"; -import { - getAltKeyLabel, - getFontSize, - getMetaKeyLabel, - isJetBrains, -} from "../../util"; +import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util"; import FileIcon from "../FileIcon"; import ButtonWithTooltip from "../ButtonWithTooltip"; import { CopyButton as CopyButtonHeader } from "./CopyButton"; diff --git a/gui/src/components/markdown/CopyButton.tsx b/gui/src/components/markdown/CopyButton.tsx index 144b427f5..1b0a4fbbe 100644 --- a/gui/src/components/markdown/CopyButton.tsx +++ b/gui/src/components/markdown/CopyButton.tsx @@ -6,11 +6,17 @@ import ButtonWithTooltip from "../ButtonWithTooltip"; interface CopyButtonProps { text: string | (() => string); - color?: string; tabIndex?: number; + checkIconClassName?: string; + clipboardIconClassName?: string; } -export function CopyButton(props: CopyButtonProps) { +export function CopyButton({ + text, + tabIndex, + checkIconClassName = "h-4 w-4 text-green-400", + clipboardIconClassName = "h-4 w-4 text-gray-400", +}: CopyButtonProps) { const [copied, setCopied] = useState(false); const ideMessenger = useContext(IdeMessengerContext); @@ -18,15 +24,14 @@ export function CopyButton(props: CopyButtonProps) { return ( <> { - const text = - typeof props.text === "string" ? props.text : props.text(); + const textVal = typeof text === "string" ? text : text(); if (isJetBrains()) { - ideMessenger.request("copyText", { text }); + ideMessenger.request("copyText", { text: textVal }); } else { - navigator.clipboard.writeText(text); + navigator.clipboard.writeText(textVal); } setCopied(true); @@ -34,9 +39,9 @@ export function CopyButton(props: CopyButtonProps) { }} > {copied ? ( - + ) : ( - + )} diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 53bed5d93..1e4be98db 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -29,8 +29,7 @@ const StyledMarkdown = styled.div<{ overflow-x: scroll; overflow-y: hidden; - padding: 6px; - margin: 0px; + padding: 6px 8px; } code { @@ -64,6 +63,14 @@ const StyledMarkdown = styled.div<{ ul { line-height: 1.5; } + + > *:first-child { + margin-top: 8px; + } + + > *:last-child { + margin-bottom: 0; + } `; interface StyledMarkdownPreviewProps { diff --git a/gui/src/components/markdown/SyntaxHighlightedPre.tsx b/gui/src/components/markdown/SyntaxHighlightedPre.tsx index 899a462ce..cee6f3f08 100644 --- a/gui/src/components/markdown/SyntaxHighlightedPre.tsx +++ b/gui/src/components/markdown/SyntaxHighlightedPre.tsx @@ -9,6 +9,7 @@ const StyledPre = styled.pre<{ theme: any }>` } margin-top: 0; + margin-bottom: 0; border-radius: 0 0 ${defaultBorderRadius} ${defaultBorderRadius} !important; ${(props) => diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index d5afd7382..553e440b3 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -318,7 +318,7 @@ function ModelSelect() { style={{ padding: 0 }} onClick={calculatePosition} > -
+
{modelSelectTitle(defaultModel) || "Select model"}{" "} diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index fcac2ce8b..451be0e16 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -141,11 +141,7 @@ function ModelSelectionListbox({ - `relative cursor-default select-none py-2 pl-10 pr-4 ${ - active ? "bg-amber-100 text-amber-900" : "text-gray-900" - }` - } + className="relative cursor-default select-none py-2 pl-10 pr-4 text-gray-900" value={option} > {({ selected }) => ( diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index 0de66bd44..9aff5dc79 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -17,7 +17,9 @@ import { getBasename, getRelativePath } from "core/util"; import { usePostHog } from "posthog-js/react"; import { useEffect, useRef } from "react"; import { useSelector } from "react-redux"; -import resolveEditorContent from "../components/mainInput/resolveInput"; +import resolveEditorContent, { + hasSlashCommandOrContextProvider, +} from "../components/mainInput/resolveInput"; import { IIdeMessenger } from "../context/IdeMessenger"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; import { @@ -27,6 +29,7 @@ import { initNewActiveMessage, resubmitAtIndex, setInactive, + setIsGatheringContext, setMessageAtIndex, streamUpdate, } from "../redux/slices/stateSlice"; @@ -52,6 +55,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { const history = useSelector((store: RootState) => store.state.history); const active = useSelector((store: RootState) => store.state.active); const activeRef = useRef(active); + useEffect(() => { activeRef.current = active; }, [active]); @@ -182,6 +186,13 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { // Reset current code block index dispatch(resetNextCodeBlockToApplyIndex()); + const shouldGatherContext = + modifiers.useCodebase || hasSlashCommandOrContextProvider(editorState); + + if (shouldGatherContext) { + dispatch(setIsGatheringContext(true)); + } + // Resolve context providers and construct new history const [selectedContextItems, selectedCode, content] = await resolveEditorContent( @@ -191,14 +202,17 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { defaultContextProviders, ); + dispatch(setIsGatheringContext(false)); + // Automatically use currently open file if (!modifiers.noContext) { const usingFreeTrial = defaultModel?.provider === "free-trial"; const currentFilePath = await ideMessenger.ide.getCurrentFile(); if (typeof currentFilePath === "string") { - let currentFileContents = - await ideMessenger.ide.readFile(currentFilePath); + let currentFileContents = await ideMessenger.ide.readFile( + currentFilePath, + ); if (usingFreeTrial) { currentFileContents = currentFileContents .split("\n") @@ -219,18 +233,17 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { }); } } + dispatch(addContextItems(contextItems)); const message: ChatMessage = { role: "user", content, }; + const historyItem: ChatHistoryItem = { message, contextItems: selectedContextItems, - // : typeof index === "number" - // ? history[index].contextItems - // : contextItems, editorState, }; diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index d1535f1ad..156c0b3b2 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -102,7 +102,6 @@ const StepsDiv = styled.div` .thread-message { margin: 8px 4px 0 4px; - padding-bottom: 8px; } `; diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index 82cad0542..f6c61970a 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -37,6 +37,7 @@ type State = { contextItems: ContextItemWithId[]; ttsActive: boolean; active: boolean; + isGatheringContext: boolean; config: BrowserSerializedContinueConfig; title: string; sessionId: string; @@ -50,6 +51,7 @@ const initialState: State = { contextItems: [], ttsActive: false, active: false, + isGatheringContext: false, config: { slashCommands: [ { @@ -113,6 +115,9 @@ export const stateSlice = createSlice({ setActive: (state) => { state.active = true; }, + setIsGatheringContext: (state, { payload }: PayloadAction) => { + state.isGatheringContext = payload; + }, clearLastResponse: (state) => { if (state.history.length < 2) { return; @@ -264,6 +269,7 @@ export const stateSlice = createSlice({ historyItem.contextItems.push(...payload.contextItems); }, setInactive: (state) => { + state.isGatheringContext = false; state.active = false; }, streamUpdate: (state, action: PayloadAction) => { @@ -453,5 +459,7 @@ export const { consumeMainEditorContent, setSelectedProfileId, deleteMessage, + setIsGatheringContext, } = stateSlice.actions; + export default stateSlice.reducer; From f37884dee81130bc20a8e2ab9498112b3f8efed1 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 17:14:54 -0700 Subject: [PATCH 094/252] remove deletion inlays --- .../editor/DiffStreamHandler.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt index 46e37dc7c..7de4ec6ec 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt @@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.editor import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.google.gson.Gson +import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.command.undo.UndoManager @@ -75,6 +76,14 @@ class DiffStreamHandler( private var deletionBufferStartLine: Int = -1 private val deletionsBuffer: MutableList = mutableListOf() + private val deletionInlays: MutableList = mutableListOf() + + private fun removeDeletionInlays() { + deletionInlays.forEach { + it.dispose() + } + deletionInlays.clear() + } fun setup() { // Highlight the range with unfinished color @@ -110,7 +119,10 @@ class DiffStreamHandler( preferredSize = java.awt.Dimension(editor.contentComponent.width, preferredSize.height) } - editorComponentInlaysManager.insertAfter(deletionBufferStartLine - 1, component) + val disposable = editorComponentInlaysManager.insertAfter(deletionBufferStartLine - 1, component) + if (disposable != null) { + deletionInlays.add(disposable) + } // Clear the buffer deletionsBuffer.clear() @@ -177,6 +189,9 @@ class DiffStreamHandler( // Remove all highlighters editor.markupModel.removeAllHighlighters() + // Remove all of the deletion inlays + removeDeletionInlays() + // Undo changes just by using builtin undo WriteCommandAction.runWriteCommandAction(project) { val undoManager = UndoManager.getInstance(project) @@ -197,6 +212,7 @@ class DiffStreamHandler( fun accept() { // Accept the changes editor.markupModel.removeAllHighlighters() + removeDeletionInlays() onClose() running = false } @@ -204,6 +220,7 @@ class DiffStreamHandler( fun reject() { // Reject the changes resetState() + removeDeletionInlays() onClose() running = false } From d1267877f4e9ee668c044c165d1bf6998bfca212 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 17:27:04 -0700 Subject: [PATCH 095/252] insert inlays above --- .../continueintellijextension/editor/DiffStreamHandler.kt | 4 +--- .../editor/EditorComponentInlaysManager.kt | 4 ++-- .../continueintellijextension/editor/InlineEditAction.kt | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt index 7de4ec6ec..d34603482 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt @@ -1,7 +1,6 @@ package com.github.continuedev.continueintellijextension.editor import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.google.gson.Gson import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction @@ -18,7 +17,6 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.Project import com.intellij.ui.JBColor -import java.awt.event.KeyEvent import javax.swing.BorderFactory import javax.swing.JTextArea import kotlin.math.min @@ -119,7 +117,7 @@ class DiffStreamHandler( preferredSize = java.awt.Dimension(editor.contentComponent.width, preferredSize.height) } - val disposable = editorComponentInlaysManager.insertAfter(deletionBufferStartLine - 1, component) + val disposable = editorComponentInlaysManager.insert(deletionBufferStartLine, component, true) if (disposable != null) { deletionInlays.add(disposable) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt index f8277d383..6ed4df136 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt @@ -41,7 +41,7 @@ class EditorComponentInlaysManager(val editor: EditorImpl, private val onlyOneIn } @RequiresEdt - fun insertAfter(lineIndex: Int, component: JComponent): Disposable? { + fun insert(lineIndex: Int, component: JComponent, showAbove: Boolean = false): Disposable? { if (Disposer.isDisposed(this)) return null if (onlyOneInlay) { @@ -57,7 +57,7 @@ class EditorComponentInlaysManager(val editor: EditorImpl, private val onlyOneIn EditorEmbeddedComponentManager.Properties(EditorEmbeddedComponentManager.ResizePolicy.none(), null, true, - false, + showAbove, 0, offset))?.also { managedInlays[wrappedComponent] = it diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index aea1b8c6b..318afda59 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -179,7 +179,7 @@ fun openInlineEdit(project: Project?, editor: Editor) { diffStreamService.reject(editor) inlayRef.get().dispose() }) - val inlay = manager.insertAfter(lineNumber, panel) + val inlay = manager.insert(startLineNum, panel, true) panel.revalidate() inlayRef.set(inlay) val viewport = (editor as? EditorImpl)?.scrollPane?.viewport From ec31735f557ba00edb455740947b4f4e0640f191 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 18:18:28 -0700 Subject: [PATCH 096/252] remove top codelens --- .../providers/VerticalPerLineCodeLensProvider.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts index 94a68bac7..aec789bbe 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts @@ -43,21 +43,6 @@ export class VerticalDiffCodeLensProvider implements vscode.CodeLensProvider { start.translate(block.numGreen + block.numRed), ); - if (isFirstBlockInMultiBlockDocument) { - codeLenses.push( - new vscode.CodeLens(range, { - title: `Accept All (${getMetaKeyLabel()}⇧↩)`, - command: "continue.acceptDiff", - arguments: [filepath, i], - }), - new vscode.CodeLens(range, { - title: `Reject All (${getMetaKeyLabel()}⇧⌫)`, - command: "continue.rejectDiff", - arguments: [filepath, i], - }), - ); - } - codeLenses.push( new vscode.CodeLens(range, { title: `Accept${ From 2562dcb850efe001a334ede0ec8d0b15423a5efc Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 18:26:23 -0700 Subject: [PATCH 097/252] fix debouncing to get correct value for codeblock toolbar --- .../components/markdown/PreWithToolbar.tsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gui/src/components/markdown/PreWithToolbar.tsx b/gui/src/components/markdown/PreWithToolbar.tsx index 903d7cb7d..3f650740d 100644 --- a/gui/src/components/markdown/PreWithToolbar.tsx +++ b/gui/src/components/markdown/PreWithToolbar.tsx @@ -2,7 +2,7 @@ import { debounce } from "lodash"; import { useEffect, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray } from ".."; +import { defaultBorderRadius } from ".."; import useUIConfig from "../../hooks/useUIConfig"; import { RootState } from "../../redux/store"; import CodeBlockToolBar from "./CodeBlockToolbar"; @@ -47,16 +47,20 @@ function PreWithToolbar(props: { ); useEffect(() => { - const debouncedEffect = debounce(() => { + if (copyValue === "") { setCopyValue(childrenToText(props.children.props.children)); - }, 100); + } else { + const debouncedEffect = debounce(() => { + setCopyValue(childrenToText(props.children.props.children)); + }, 100); - debouncedEffect(); + debouncedEffect(); - return () => { - debouncedEffect.cancel(); - }; - }, [props.children]); + return () => { + debouncedEffect.cancel(); + }; + } + }, [props.children, copyValue]); return ( Date: Thu, 26 Sep 2024 18:35:01 -0700 Subject: [PATCH 098/252] resolve abs path to allow relative paths to link from the gui --- extensions/vscode/src/util/ideUtils.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/util/ideUtils.ts b/extensions/vscode/src/util/ideUtils.ts index a2f2e3f9f..b71f8e095 100644 --- a/extensions/vscode/src/util/ideUtils.ts +++ b/extensions/vscode/src/util/ideUtils.ts @@ -136,10 +136,30 @@ export class VsCodeIdeUtils { ); } - openFile(filepath: string, range?: vscode.Range) { + private async resolveAbsFilepathInWorkspace( + filepath: string, + ): Promise { + // If the filepath is already absolute, return it as is + if (this.path.isAbsolute(filepath)) { + return filepath; + } + + // Try to resolve for each workspace directory + const workspaceDirectories = this.getWorkspaceDirectories(); + for (const dir of workspaceDirectories) { + const resolvedPath = this.path.resolve(dir, filepath); + if (await this.fileExists(resolvedPath)) { + return resolvedPath; + } + } + + return filepath; + } + + async openFile(filepath: string, range?: vscode.Range) { // vscode has a builtin open/get open files return openEditorAndRevealRange( - filepath, + await this.resolveAbsFilepathInWorkspace(filepath), range, vscode.ViewColumn.One, false, From fee6a1e5ceb89c44a018b6a771065dea276268a9 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 18:47:18 -0700 Subject: [PATCH 099/252] remove bottom message div --- gui/src/components/Layout.tsx | 58 ++------------------- gui/src/redux/selectors/uiStateSelectors.ts | 5 -- gui/src/redux/slices/uiStateSlice.ts | 31 +---------- 3 files changed, 6 insertions(+), 88 deletions(-) delete mode 100644 gui/src/redux/selectors/uiStateSelectors.ts diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index d012194a3..a75fe834e 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -3,31 +3,22 @@ import { useContext, useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; import styled from "styled-components"; -import { - CustomScrollbarDiv, - defaultBorderRadius, - vscForeground, - vscInputBackground, -} from "."; +import { CustomScrollbarDiv, defaultBorderRadius, vscInputBackground } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; +import { setShowDialog } from "../redux/slices/uiStateSlice"; import { RootState } from "../redux/store"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; +import ButtonWithTooltip from "./ButtonWithTooltip"; import TextDialog from "./dialogs"; import ProgressBar from "./loaders/ProgressBar"; +import { useOnboardingCard } from "./OnboardingCard"; +import { isNewUserOnboarding } from "./OnboardingCard/utils"; import PostHogPageView from "./PosthogPageView"; import ProfileSwitcher from "./ProfileSwitcher"; -import { isNewUserOnboarding } from "./OnboardingCard/utils"; -import { useOnboardingCard } from "./OnboardingCard"; -import { - setBottomMessage, - setBottomMessageCloseTimeout, - setShowDialog, -} from "../redux/slices/uiStateSlice"; -import ButtonWithTooltip from "./ButtonWithTooltip"; const FOOTER_HEIGHT = "1.8em"; @@ -48,23 +39,6 @@ const LayoutTopDiv = styled(CustomScrollbarDiv)` } `; -const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>` - position: fixed; - bottom: ${(props) => (props.displayOnBottom ? "50px" : undefined)}; - top: ${(props) => (props.displayOnBottom ? undefined : "50px")}; - left: 0; - right: 0; - margin: 8px; - margin-top: 0; - background-color: ${vscInputBackground}; - color: ${vscForeground}; - border-radius: ${defaultBorderRadius}; - padding: 12px; - z-index: 100; - box-shadow: 0px 0px 2px 0px ${vscForeground}; - max-height: 35vh; -`; - const Footer = styled.footer` display: flex; flex-direction: row; @@ -120,13 +94,6 @@ const Layout = () => { const defaultModel = useSelector(defaultModelSelector); - const bottomMessage = useSelector( - (state: RootState) => state.uiState.bottomMessage, - ); - const displayBottomMessageOnBottom = useSelector( - (state: RootState) => state.uiState.displayBottomMessageOnBottom, - ); - const timeline = useSelector((state: RootState) => state.state.history); useEffect(() => { @@ -264,21 +231,6 @@ const Layout = () => { - - { - dispatch(setBottomMessageCloseTimeout(undefined)); - }} - onMouseLeave={(e) => { - if (!e.buttons) { - dispatch(setBottomMessage(undefined)); - } - }} - hidden={!bottomMessage} - > - {bottomMessage} -
state.uiState.bottomMessage; - -export { selectBottomMessage }; diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts index d4c4f7390..94a5f2934 100644 --- a/gui/src/redux/slices/uiStateSlice.ts +++ b/gui/src/redux/slices/uiStateSlice.ts @@ -5,9 +5,6 @@ import { } from "../../components/OnboardingCard"; type UiState = { - bottomMessage: JSX.Element | undefined; - bottomMessageCloseTimeout: NodeJS.Timeout | undefined; - displayBottomMessageOnBottom: boolean; showDialog: boolean; dialogMessage: string | JSX.Element | undefined; dialogEntryOn: boolean; @@ -18,12 +15,9 @@ type UiState = { export const uiStateSlice = createSlice({ name: "uiState", initialState: { - bottomMessage: undefined, - bottomMessageCloseTimeout: undefined, showDialog: false, dialogMessage: "", dialogEntryOn: false, - displayBottomMessageOnBottom: true, nextCodeBlockToApplyIndex: 0, onboardingCard: defaultOnboardingCardState, } as UiState, @@ -34,21 +28,6 @@ export const uiStateSlice = createSlice({ ) => { state.onboardingCard = { ...state.onboardingCard, ...action.payload }; }, - setBottomMessage: ( - state, - action: PayloadAction, - ) => { - state.bottomMessage = action.payload; - }, - setBottomMessageCloseTimeout: ( - state, - action: PayloadAction, - ) => { - if (state.bottomMessageCloseTimeout) { - clearTimeout(state.bottomMessageCloseTimeout); - } - state.bottomMessageCloseTimeout = action.payload; - }, setDialogMessage: ( state, action: PayloadAction, @@ -64,12 +43,7 @@ export const uiStateSlice = createSlice({ setShowDialog: (state, action: PayloadAction) => { state.showDialog = action.payload; }, - setDisplayBottomMessageOnBottom: ( - state, - action: PayloadAction, - ) => { - state.displayBottomMessageOnBottom = action.payload; - }, + resetNextCodeBlockToApplyIndex: (state) => { state.nextCodeBlockToApplyIndex = 0; }, @@ -86,9 +60,6 @@ export const { setShowDialog, resetNextCodeBlockToApplyIndex, incrementNextCodeBlockToApplyIndex, - setBottomMessage, - setBottomMessageCloseTimeout, - setDisplayBottomMessageOnBottom, } = uiStateSlice.actions; export default uiStateSlice.reducer; From 55270279f6f7516769b2ec8c586f9a83d271ea2d Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 20:07:25 -0700 Subject: [PATCH 100/252] apply status and corresponding ui --- core/protocol/ideWebview.ts | 8 +- extensions/vscode/src/commands.ts | 1 + .../vscode/src/diff/vertical/handler.ts | 6 ++ .../vscode/src/diff/vertical/manager.ts | 23 ++++- .../vscode/src/extension/VsCodeExtension.ts | 5 +- .../vscode/src/extension/VsCodeMessenger.ts | 8 +- .../VerticalPerLineCodeLensProvider.ts | 19 +--- .../src/quickEdit/QuickEditQuickPick.ts | 1 + gui/src/components/Layout.tsx | 10 ++- .../components/markdown/CodeBlockToolbar.tsx | 86 +++++++++++++++---- gui/src/redux/slices/uiStateSlice.ts | 17 ++++ 11 files changed, 147 insertions(+), 37 deletions(-) diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 8ccc6d007..774da7ee5 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -15,7 +15,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { }, ]; openUrl: [string, void]; - applyToCurrentFile: [{ text: string }, void]; + applyToCurrentFile: [{ text: string; streamId: string }, void]; showTutorial: [undefined, void]; showFile: [{ filepath: string }, void]; openConfigJson: [undefined, void]; @@ -32,6 +32,11 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { rejectDiff: [{ filepath: string }, void]; }; +export interface ApplyState { + streamId: string; + status: "streaming" | "done" | "closed"; +} + export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { setInactive: [undefined, void]; setTTSActive: [boolean, void]; @@ -65,4 +70,5 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { incrementFtc: [undefined, void]; openOnboardingCard: [undefined, void]; applyCodeFromChat: [undefined, void]; + updateApplyState: [ApplyState, void]; }; diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 6bec8b754..17140eaf8 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -223,6 +223,7 @@ const commandsMap: ( await verticalDiffManager.streamEdit( config.experimental?.contextMenuPrompts?.[promptName] ?? fallbackPrompt, modelTitle, + undefined, onlyOneInsertion, undefined, range, diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 9259cb38e..5aa5b070b 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -1,4 +1,5 @@ import type { DiffLine } from "core"; +import { ApplyState } from "core/protocol/ideWebview"; import * as vscode from "vscode"; import { DecorationTypeRangeManager, @@ -12,6 +13,7 @@ import type { VerticalDiffCodeLens } from "./manager"; export interface VerticalDiffHandlerOptions { input?: string; instant?: boolean; + onStatusUpdate: (status: ApplyState["status"]) => void; } export class VerticalDiffHandler implements vscode.Disposable { @@ -268,6 +270,8 @@ export class VerticalDiffHandler implements vscode.Disposable { }, ); + this.options.onStatusUpdate("closed"); + this.cancelled = true; this.refreshCodeLens(); this.dispose(); @@ -352,6 +356,8 @@ export class VerticalDiffHandler implements vscode.Disposable { this.refreshCodeLens(); + this.options.onStatusUpdate("done"); + // Reject on user typing // const listener = vscode.workspace.onDidChangeTextDocument((e) => { // if (e.document.uri.fsPath === this.filepath) { diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index c84fa4397..2ecf6d596 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -5,6 +5,7 @@ import { getMarkdownLanguageTagForFile } from "core/util"; import { DiffLine } from "core"; import { streamDiffLines } from "core/edit/streamDiffLines"; import * as vscode from "vscode"; +import { VsCodeWebviewProtocol } from "../../webviewProtocol"; import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler"; export interface VerticalDiffCodeLens { @@ -22,7 +23,10 @@ export class VerticalDiffManager { private userChangeListener: vscode.Disposable | undefined; - constructor(private readonly configHandler: ConfigHandler) { + constructor( + private readonly configHandler: ConfigHandler, + private readonly webviewProtocol: VsCodeWebviewProtocol, + ) { this.userChangeListener = undefined; } @@ -176,6 +180,7 @@ export class VerticalDiffManager { async streamDiffLines( diffStream: AsyncGenerator, instant: boolean, + streamId: string, ) { vscode.commands.executeCommand("setContext", "continue.diffVisible", true); @@ -205,6 +210,11 @@ export class VerticalDiffManager { endLine, { instant, + onStatusUpdate: (status) => + this.webviewProtocol.request("updateApplyState", { + streamId, + status, + }), }, ); @@ -271,6 +281,7 @@ export class VerticalDiffManager { async streamEdit( input: string, modelTitle: string | undefined, + streamId?: string, onlyOneInsertion?: boolean, quickEdit?: string, range?: vscode.Range, @@ -339,7 +350,15 @@ export class VerticalDiffManager { filepath, startLine, endLine, - { input }, + { + input, + onStatusUpdate: (status) => + streamId && + this.webviewProtocol.request("updateApplyState", { + streamId, + status, + }), + }, ); if (!diffHandler) { diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 68714b106..ce12a0a6b 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -124,7 +124,10 @@ export class VsCodeExtension { resolveConfigHandler?.(this.configHandler); this.configHandler.reloadConfig(); - this.verticalDiffManager = new VerticalDiffManager(this.configHandler); + this.verticalDiffManager = new VerticalDiffManager( + this.configHandler, + this.sidebar.webviewProtocol, + ); resolveVerticalDiffManager?.(this.verticalDiffManager); this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler); diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 0e5b91b88..a50e389b5 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -191,10 +191,14 @@ export class VsCodeMessenger { ); const verticalDiffManager = await this.verticalDiffManagerPromise; if (instant) { - verticalDiffManager.streamDiffLines(diffLines, instant); + verticalDiffManager.streamDiffLines( + diffLines, + instant, + msg.data.streamId, + ); } else { const prompt = `The following code was suggested as an edit:\n\`\`\`\n${msg.data.text}\n\`\`\`\nPlease apply it to the previous code.`; - verticalDiffManager.streamEdit(prompt, llm.title); + verticalDiffManager.streamEdit(prompt, llm.title, msg.data.streamId); } }); diff --git a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts index aec789bbe..a96cf5660 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/VerticalPerLineCodeLensProvider.ts @@ -1,6 +1,6 @@ import * as vscode from "vscode"; import { VerticalDiffCodeLens } from "../../../diff/vertical/manager"; -import { getAltOrOption, getMetaKeyLabel } from "../../../util/util"; +import { getMetaKeyLabel } from "../../../util/util"; export class VerticalDiffCodeLensProvider implements vscode.CodeLensProvider { private _eventEmitter: vscode.EventEmitter = @@ -33,9 +33,6 @@ export class VerticalDiffCodeLensProvider implements vscode.CodeLensProvider { const codeLenses: vscode.CodeLens[] = []; for (let i = 0; i < blocks.length; i++) { - const isFirstBlockInMultiBlockDocument = - codeLenses.length === 0 && blocks.length > 1; - const block = blocks[i]; const start = new vscode.Position(block.start, 0); const range = new vscode.Range( @@ -45,26 +42,18 @@ export class VerticalDiffCodeLensProvider implements vscode.CodeLensProvider { codeLenses.push( new vscode.CodeLens(range, { - title: `Accept${ - codeLenses.length === 2 - ? ` (${getAltOrOption()}${getMetaKeyLabel()}Y)` - : "" - }`, + title: `Accept`, command: "continue.acceptVerticalDiffBlock", arguments: [filepath, i], }), new vscode.CodeLens(range, { - title: `Reject${ - codeLenses.length === 2 - ? ` (${getAltOrOption()}${getMetaKeyLabel()}N)` - : "" - }`, + title: `Reject`, command: "continue.rejectVerticalDiffBlock", arguments: [filepath, i], }), ); - if (codeLenses.length === 4) { + if (codeLenses.length === 2) { codeLenses.push( new vscode.CodeLens(range, { title: `${getMetaKeyLabel()}I to add instructions`, diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 877d94ad3..0c0b276a8 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -296,6 +296,7 @@ export class QuickEdit { prompt, modelTitle, undefined, + undefined, this.previousInput, this.range, ); diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index a75fe834e..13cc1fc93 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -7,7 +7,7 @@ import { CustomScrollbarDiv, defaultBorderRadius, vscInputBackground } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; -import { setShowDialog } from "../redux/slices/uiStateSlice"; +import { setShowDialog, updateApplyState } from "../redux/slices/uiStateSlice"; import { RootState } from "../redux/store"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; @@ -154,6 +154,14 @@ const Layout = () => { [], ); + useWebviewListener( + "updateApplyState", + async (state) => { + dispatch(updateApplyState(state)); + }, + [], + ); + useWebviewListener( "openOnboardingCard", async () => { diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index 510e70b2b..3175f5361 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -2,13 +2,15 @@ import { ArrowLeftEndOnRectangleIcon, CheckIcon, ClipboardIcon, - PlayIcon, CommandLineIcon, + PlayIcon, XMarkIcon, } from "@heroicons/react/24/outline"; -import { useContext, useState } from "react"; -import { useDispatch } from "react-redux"; +import { getBasename } from "core/util"; +import { useContext, useRef, useState } from "react"; +import { useDispatch, useSelector } from "react-redux"; import styled from "styled-components"; +import { v4 as uuidv4 } from "uuid"; import { defaultBorderRadius, lightGray, @@ -17,13 +19,16 @@ import { } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useWebviewListener } from "../../hooks/useWebviewListener"; -import { incrementNextCodeBlockToApplyIndex } from "../../redux/slices/uiStateSlice"; +import { + incrementNextCodeBlockToApplyIndex, + updateApplyState, +} from "../../redux/slices/uiStateSlice"; +import { RootState } from "../../redux/store"; import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util"; -import FileIcon from "../FileIcon"; import ButtonWithTooltip from "../ButtonWithTooltip"; +import FileIcon from "../FileIcon"; import { CopyButton as CopyButtonHeader } from "./CopyButton"; import { ToolbarButtonWithTooltip } from "./ToolbarButtonWithTooltip"; -import { getBasename } from "core/util"; const ToolbarDiv = styled.div` display: flex; @@ -123,16 +128,28 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { const ideMessenger = useContext(IdeMessengerContext); const dispatch = useDispatch(); const isTerminal = isTerminalCodeBlock(props.language, props.text); - const [showAcceptReject, setShowAcceptReject] = useState(false); const [isCopied, setIsCopied] = useState(false); const [isApplying, setIsApplying] = useState(false); + const streamIdRef = useRef(null); + if (streamIdRef.current === null) { + streamIdRef.current = uuidv4(); + } + + const applyState = useSelector( + (store: RootState) => + store.uiState.applyStates.find( + (state) => state.streamId === streamIdRef.current, + )?.status ?? "closed", + ); + // Handle apply keyboard shortcut useWebviewListener( "applyCodeFromChat", async () => { await ideMessenger.request("applyToCurrentFile", { text: props.text, + streamId: streamIdRef.current, }); dispatch(incrementNextCodeBlockToApplyIndex({})); }, @@ -157,10 +174,16 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { if (isTerminal) { ideMessenger.ide.runCommand(getTerminalCommand(props.text)); } else { - ideMessenger.post("applyToCurrentFile", { text: props.text }); - setIsApplying(true); - setTimeout(() => setIsApplying(false), 2000); - setShowAcceptReject(true); + ideMessenger.post("applyToCurrentFile", { + text: props.text, + streamId: streamIdRef.current, + }); + dispatch( + updateApplyState({ + streamId: streamIdRef.current, + status: "streaming", + }), + ); } } @@ -173,12 +196,22 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { function onClickAccept() { ideMessenger.post("acceptDiff", { filepath: props.filepath }); - setShowAcceptReject(false); + dispatch( + updateApplyState({ + streamId: streamIdRef.current, + status: "closed", + }), + ); } function onClickReject() { ideMessenger.post("rejectDiff", { filepath: props.filepath }); - setShowAcceptReject(false); + dispatch( + updateApplyState({ + streamId: streamIdRef.current, + status: "closed", + }), + ); } if (!props.filepath) { @@ -246,7 +279,7 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { {!isJetBrains() && (
- {!showAcceptReject ? ( + {applyState === "closed" ? ( Apply
- ) : ( + ) : applyState === "done" ? ( <> + ) : ( +
+ + + + +
)}
)} diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts index 94a5f2934..1625110eb 100644 --- a/gui/src/redux/slices/uiStateSlice.ts +++ b/gui/src/redux/slices/uiStateSlice.ts @@ -1,4 +1,5 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { ApplyState } from "core/protocol/ideWebview"; import { defaultOnboardingCardState, OnboardingCardState, @@ -10,6 +11,7 @@ type UiState = { dialogEntryOn: boolean; nextCodeBlockToApplyIndex: number; onboardingCard: OnboardingCardState; + applyStates: ApplyState[]; }; export const uiStateSlice = createSlice({ @@ -20,6 +22,7 @@ export const uiStateSlice = createSlice({ dialogEntryOn: false, nextCodeBlockToApplyIndex: 0, onboardingCard: defaultOnboardingCardState, + applyStates: [], } as UiState, reducers: { setOnboardingCard: ( @@ -50,6 +53,19 @@ export const uiStateSlice = createSlice({ incrementNextCodeBlockToApplyIndex: (state, action) => { state.nextCodeBlockToApplyIndex++; }, + updateApplyState: (state, action: PayloadAction) => { + const { streamId, status } = action.payload; + const index = state.applyStates.findIndex( + (applyState) => applyState.streamId === streamId, + ); + if (status === "closed" && index !== -1) { + state.applyStates.splice(index, 1); + } else if (index === -1) { + state.applyStates.push(action.payload); + } else { + state.applyStates[index].status = status; + } + }, }, }); @@ -60,6 +76,7 @@ export const { setShowDialog, resetNextCodeBlockToApplyIndex, incrementNextCodeBlockToApplyIndex, + updateApplyState, } = uiStateSlice.actions; export default uiStateSlice.reducer; From 4d299ba2cd03a05046a56cf77c9d957ea7fcd41b Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 20:18:05 -0700 Subject: [PATCH 101/252] apply to correct range --- .../vscode/src/extension/VsCodeMessenger.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index a50e389b5..c0b62fdbc 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -198,7 +198,23 @@ export class VsCodeMessenger { ); } else { const prompt = `The following code was suggested as an edit:\n\`\`\`\n${msg.data.text}\n\`\`\`\nPlease apply it to the previous code.`; - verticalDiffManager.streamEdit(prompt, llm.title, msg.data.streamId); + const fullEditorRange = new vscode.Range( + 0, + 0, + editor.document.lineCount - 1, + editor.document.lineAt(editor.document.lineCount - 1).text.length, + ); + const rangeToApplyTo = editor.selection.isEmpty + ? fullEditorRange + : editor.selection; + verticalDiffManager.streamEdit( + prompt, + llm.title, + msg.data.streamId, + undefined, + undefined, + rangeToApplyTo, + ); } }); From 7fa299326765e9ed07dd305531509181873ed644 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Sep 2024 20:40:57 -0700 Subject: [PATCH 102/252] gui: update styling for filename lins --- core/commands/slash/edit.ts | 4 +- core/commands/util.ts | 17 +- core/context/providers/FileContextProvider.ts | 8 +- gui/src/components/gui/StepContainer.tsx | 2 +- gui/src/components/index.ts | 2 - .../components/mainInput/ContextItemsPeek.tsx | 16 +- .../components/mainInput/ContinueInputBox.tsx | 10 +- gui/src/components/markdown/FilenameLink.tsx | 36 ++++ gui/src/components/markdown/LinkableCode.tsx | 170 ------------------ .../markdown/StyledMarkdownPreview.tsx | 45 +++-- gui/src/hooks/useChatHandler.ts | 4 + 11 files changed, 105 insertions(+), 209 deletions(-) create mode 100644 gui/src/components/markdown/FilenameLink.tsx delete mode 100644 gui/src/components/markdown/LinkableCode.tsx diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index a3c3ed91c..fd87ad32b 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -14,7 +14,7 @@ import { getMarkdownLanguageTagForFile, } from "../../util/"; import { - contextItemToRangeInFileWithContents, + ctxItemToRifWithContents, type RangeInFileWithContents, } from "../util"; @@ -250,7 +250,7 @@ const EditSlashCommand: SlashCommand = { } const rif: RangeInFileWithContents = - contextItemToRangeInFileWithContents(contextItemToEdit); + ctxItemToRifWithContents(contextItemToEdit); await ide.saveFile(rif.filepath); const fullFileContents = await ide.readFile(rif.filepath); diff --git a/core/commands/util.ts b/core/commands/util.ts index 931564839..a6be440e9 100644 --- a/core/commands/util.ts +++ b/core/commands/util.ts @@ -9,20 +9,29 @@ export interface RangeInFileWithContents { contents: string; } -export function contextItemToRangeInFileWithContents( +export function ctxItemToRifWithContents( item: ContextItemWithId, ): RangeInFileWithContents { - const lines = item.name.split("(")[1].split(")")[0].split("-"); + let startLine = 0; + let endLine = 0; + + const nameSplit = item.name.split("("); + + if (nameSplit.length > 1) { + const lines = nameSplit[1].split(")")[0].split("-"); + startLine = Number.parseInt(lines[0], 10); + endLine = Number.parseInt(lines[1], 10); + } const rif: RangeInFileWithContents = { filepath: item.uri?.value || "", range: { start: { - line: Number.parseInt(lines[0]), + line: startLine, character: 0, }, end: { - line: Number.parseInt(lines[1]), + line: endLine, character: 0, }, }, diff --git a/core/context/providers/FileContextProvider.ts b/core/context/providers/FileContextProvider.ts index be558c651..d1ac2d6e2 100644 --- a/core/context/providers/FileContextProvider.ts +++ b/core/context/providers/FileContextProvider.ts @@ -4,14 +4,14 @@ import { ContextProviderExtras, ContextSubmenuItem, LoadSubmenuItemsArgs, -} from "../../index.js"; -import { walkDir } from "../../indexing/walkDir.js"; +} from "../../"; +import { walkDir } from "../../indexing/walkDir"; import { getBasename, getUniqueFilePath, groupByLastNPathParts, -} from "../../util/index.js"; -import { BaseContextProvider } from "../index.js"; +} from "../../util/"; +import { BaseContextProvider } from "../"; const MAX_SUBMENU_ITEMS = 10_000; diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index c4d0b2597..94652bc7d 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -106,7 +106,7 @@ function StepContainer(props: StepContainerProps) { {shouldRenderActions && ( -
+
{truncatedEarly && (
{getContextItemIcon()} @@ -128,11 +128,11 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { {contextItem.name}
- {contextItem.description} + {contextItem.uri?.type === "file" + ? getBasename(contextItem.description) + : contextItem.description}
diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 9778a6de9..40127037f 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -88,8 +88,6 @@ function ContinueInputBox(props: ContinueInputBoxProps) { [props.isMainInput], ); - console.log({ isGatheringContext, isGatheringContextStore }); - useEffect(() => { if (isGatheringContextStore && !isGatheringContext) { // 500ms delay when going from false -> true to prevent flashing loading indicator @@ -107,10 +105,8 @@ function ContinueInputBox(props: ContinueInputBoxProps) { }, [isGatheringContextStore]); return ( -
-
+
+
+ />
); } diff --git a/gui/src/components/markdown/FilenameLink.tsx b/gui/src/components/markdown/FilenameLink.tsx new file mode 100644 index 000000000..1ef434a7e --- /dev/null +++ b/gui/src/components/markdown/FilenameLink.tsx @@ -0,0 +1,36 @@ +import { RangeInFile } from "core"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useContext } from "react"; +import { getBasename } from "core/util"; +import FileIcon from "../FileIcon"; + +interface FilenameLinkProps { + rif: RangeInFile; +} + +function FilenameLink({ rif }: FilenameLinkProps) { + const ideMessenger = useContext(IdeMessengerContext); + + function onClick() { + debugger; + ideMessenger.post("showLines", { + filepath: rif.filepath, + startLine: rif.range.start.line, + endLine: rif.range.end.line, + }); + } + + return ( +
+ + + {getBasename(rif.filepath)} + +
+ ); +} + +export default FilenameLink; diff --git a/gui/src/components/markdown/LinkableCode.tsx b/gui/src/components/markdown/LinkableCode.tsx deleted file mode 100644 index 9c4791265..000000000 --- a/gui/src/components/markdown/LinkableCode.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import { RangeInFile } from "core"; -import { useContext, useEffect, useState } from "react"; -import { useSelector } from "react-redux"; -import styled from "styled-components"; -import { defaultBorderRadius, vscInputBackground } from ".."; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { memoizedContextItemsSelector } from "../../redux/slices/stateSlice"; - -const StyledCode = styled.code<{ link: boolean }>` - color: ${(props) => (props.link ? "#ff4343" : "#f78383")}; - word-wrap: break-word; - border-radius: ${defaultBorderRadius}; - background-color: ${vscInputBackground}; - - ${(props) => props.link && "cursor: pointer;"} - &:hover { - ${(props) => props.link && "text-decoration: underline;"} - } -`; - -function LinkableCode(props: any) { - const ideMessenger = useContext(IdeMessengerContext); - - const contextItems = useSelector(memoizedContextItemsSelector); - - const [linkingDone, setLinkingDone] = useState(false); - const [isLink, setIsLink] = useState(false); - const [rif, setRif] = useState(undefined); - - useEffect(() => { - if (linkingDone) return; - setLinkingDone(true); - - // Get content of the code tag - let content: string | undefined = undefined; - if (typeof props.children === "string") { - content = props.children; - } else if ( - Array.isArray(props.children) && - props.children.length > 0 && - typeof props.children[0] === "string" - ) { - content = props.children[0]; - } - if (!content) return; - - // Match filepath with context items - const contextItemFileMatch = contextItems.find( - (item) => - ["file", "codebase", "folder"].includes(item.id.providerTitle) && - item.description.split(" (")[0].endsWith(content), - ); - if (contextItemFileMatch) { - setIsLink(true); - if (contextItemFileMatch.description.includes(" (")) { - // Get line number from filename - const [startLine, _] = contextItemFileMatch.description - .split(" (")[1] - .split(")")[0] - .split("-"); - const filepath = contextItemFileMatch.description.split(" (")[0]; - setRif({ - filepath, - range: { - start: { - line: 0, - character: 0, - }, - end: { - line: 0, - character: 0, - }, - }, - }); - return; - } else { - // If no line number, just open the file - setRif({ - filepath: contextItemFileMatch.description.split(" (")[0], - range: { - start: { - line: 0, - character: 0, - }, - end: { - line: 0, - character: 0, - }, - }, - }); - return; - } - } - - // Try to match the content with a line in a file - if (content.length > 8) { - const contextItemContentMatch = contextItems.find( - (item) => - ["file", "codebase", "folder"].includes(item.id.providerTitle) && - item.content.includes(content), - ); - if (contextItemContentMatch) { - const line = contextItemContentMatch.content - .split("\n") - .slice(1) // code block fence - .findIndex((line) => line.includes(content)); - - const [filepath, rest] = - contextItemContentMatch.description.split(" ("); - - setIsLink(true); - - if (rest) { - const [startLine, endLine] = rest.split(")")[0]?.split("-") || [ - "0", - "0", - ]; - const start = parseInt(startLine); - const end = parseInt(endLine); - setRif({ - filepath, - range: { - start: { - line: start + line, - character: 0, - }, - end: { - line: start + line + 1, - character: 0, - }, - }, - }); - } else { - setRif({ - filepath, - range: { - start: { - line: 0, - character: 0, - }, - end: { - line: 0, - character: 0, - }, - }, - }); - } - } - } - }, [linkingDone, contextItems]); - - const onClick = () => { - if (!isLink) return; - if (!rif) return; - ideMessenger.post("showLines", { - filepath: rif.filepath, - startLine: rif.range.start.line, - endLine: rif.range.end.line, - }); - }; - - return ( - <> - {isLink} - - - ); -} - -export default LinkableCode; diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 1e4be98db..1695b7d19 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -13,10 +13,13 @@ import { } from ".."; import { getFontSize } from "../../util"; import "./katex.css"; -import LinkableCode from "./LinkableCode"; +import FilenameLink from "./FilenameLink"; import "./markdown.css"; import PreWithToolbar from "./PreWithToolbar"; import { SyntaxHighlightedPre } from "./SyntaxHighlightedPre"; +import { useSelector } from "react-redux"; +import { memoizedContextItemsSelector } from "../../redux/slices/stateSlice"; +import { ctxItemToRifWithContents } from "core/commands/util"; const StyledMarkdown = styled.div<{ fontSize?: number; @@ -29,6 +32,7 @@ const StyledMarkdown = styled.div<{ overflow-x: scroll; overflow-y: hidden; + margin: 10px 0; padding: 6px 8px; } @@ -82,7 +86,7 @@ interface StyledMarkdownPreviewProps { const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-"; -const getLanuageFromClassName = (className: any): string | null => { +function getLanuageFromClassName(className: any): string | null { if (!className || typeof className !== "string") { return null; } @@ -93,11 +97,27 @@ const getLanuageFromClassName = (className: any): string | null => { ?.split("-")[1]; return language; -}; +} + +function getCodeChildrenContent(children: any) { + if (typeof children === "string") { + return children; + } else if ( + Array.isArray(children) && + children.length > 0 && + typeof children[0] === "string" + ) { + return children[0]; + } + + return undefined; +} const StyledMarkdownPreview = memo(function StyledMarkdownPreview( props: StyledMarkdownPreviewProps, ) { + const contextItems = useSelector(memoizedContextItemsSelector); + const [reactContent, setMarkdownSource] = useRemark({ remarkPlugins: [ remarkMath, @@ -167,15 +187,18 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( ); }, code: ({ node, ...codeProps }) => { - if ( - codeProps.className?.split(" ").includes("hljs") || - codeProps.children?.length > 1 - ) { - return {codeProps.children}; - } - return ( - {codeProps.children} + const content = getCodeChildrenContent(codeProps.children); + + const ctxItem = contextItems.find((ctxItem) => + ctxItem.uri?.value.includes(content), ); + + if (ctxItem) { + const rif = ctxItemToRifWithContents(ctxItem); + return ; + } + + return {codeProps.children}; }, }, }, diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index 9aff5dc79..655cfce96 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -230,6 +230,10 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { itemId: currentFilePath, providerTitle: "file", }, + uri: { + type: "file", + value: currentFilePath, + }, }); } } From 526fb7fa9388292475b1b4d3c264cac4293f8483 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 21:06:28 -0700 Subject: [PATCH 103/252] rename acc to replacements --- core/edit/lazy/deterministic.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/edit/lazy/deterministic.ts b/core/edit/lazy/deterministic.ts index aa03c086b..3fd4ffe73 100644 --- a/core/edit/lazy/deterministic.ts +++ b/core/edit/lazy/deterministic.ts @@ -135,10 +135,10 @@ export async function deterministicApplyLazyEdit( } } - const acc: AstReplacements = []; - findLazyBlockReplacements(oldTree.rootNode, newTree.rootNode, acc); + const replacements: AstReplacements = []; + findLazyBlockReplacements(oldTree.rootNode, newTree.rootNode, replacements); - const newFullFile = reconstructNewFile(oldFile, newLazyFile, acc); + const newFullFile = reconstructNewFile(oldFile, newLazyFile, replacements); const diff = myersDiff(oldFile, newFullFile); // If the diff is too messy and seems likely borked, we fall back to LLM strategy @@ -204,7 +204,7 @@ function nodesAreExact(a: Parser.SyntaxNode, b: Parser.SyntaxNode): boolean { function findLazyBlockReplacements( oldNode: Parser.SyntaxNode, newNode: Parser.SyntaxNode, - acc: AstReplacements, + replacements: AstReplacements, ): void { // Base case if (nodesAreExact(oldNode, newNode)) { @@ -254,7 +254,7 @@ function findLazyBlockReplacements( } // then recurse at the match - findLazyBlockReplacements(L, rightChildren[0], acc); + findLazyBlockReplacements(L, rightChildren[0], replacements); // then consume L and R leftChildren.shift(); @@ -263,7 +263,7 @@ function findLazyBlockReplacements( // Exit "lazy mode" if (isLazy) { // Record the replacement lines - acc.push({ + replacements.push({ nodeToReplace: currentLazyBlockNode!, replacementNodes: [...currentLazyBlockReplacementNodes], }); @@ -275,7 +275,7 @@ function findLazyBlockReplacements( } if (isLazy) { - acc.push({ + replacements.push({ nodeToReplace: currentLazyBlockNode!, replacementNodes: [...currentLazyBlockReplacementNodes, ...leftChildren], }); @@ -284,7 +284,7 @@ function findLazyBlockReplacements( // Cut out any extraneous lazy blocks for (const R of rightChildren) { if (isLazyBlock(R)) { - acc.push({ + replacements.push({ nodeToReplace: R, replacementNodes: [], }); From 14523ecbad36faa0e9e66f9ed6a9c068e32bd937 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 21:06:37 -0700 Subject: [PATCH 104/252] improve instructions for lazy comment --- core/llm/constructMessages.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index d339134e3..13d538be8 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -5,9 +5,10 @@ const SYSTEM_MESSAGE = `When generating new code: 1. Always produce a single code block. 2. Never separate the code into multiple code blocks. 3. Only include the code that is being added. -4. Replace existing code with a "lazy" block like this: "// ... existing code ..." -5. You must always provide 1-2 lines of context above and below a "lazy" block -6. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block. +4. Replace existing code with a "lazy" comment like this: "// ... existing code ..." +5. The "lazy" comment must always be a valid comment in the current context (e.g. "" for HTML, "// ... existing code ..." for JavaScript, "{/* ... existing code */}" for TSX, etc.) +6. You must always provide 1-2 lines of context above and below a "lazy" comment +7. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block. Example 1: Input: From dc7bbb027d182621aed4cafb9583d58952bff683 Mon Sep 17 00:00:00 2001 From: DongjaJ Date: Fri, 27 Sep 2024 18:57:43 +0900 Subject: [PATCH 105/252] Revert "fix: modify docs Next Page link" This reverts commit 10072575d593e46bd8a7b7bda125978c306a1a9c. --- docs/docs/actions/how-to-use-it.md | 1 - docs/docs/autocomplete/how-to-use-it.md | 1 - docs/docs/chat/how-to-use-it.md | 1 - docs/docs/edit/how-to-use-it.md | 1 - docs/docs/getting-started/install.md | 1 - 5 files changed, 5 deletions(-) diff --git a/docs/docs/actions/how-to-use-it.md b/docs/docs/actions/how-to-use-it.md index 026f45d74..cffc0d65d 100644 --- a/docs/docs/actions/how-to-use-it.md +++ b/docs/docs/actions/how-to-use-it.md @@ -4,7 +4,6 @@ description: How to use Actions sidebar_label: How to use it keywords: [how, slash, commands, prompt, right click, quick fix, debug, action] sidebar_position: 1 -pagination_next: actions/model-setup --- ![actions](/img/actions.gif) diff --git a/docs/docs/autocomplete/how-to-use-it.md b/docs/docs/autocomplete/how-to-use-it.md index 2cfd470e6..92a3db76e 100644 --- a/docs/docs/autocomplete/how-to-use-it.md +++ b/docs/docs/autocomplete/how-to-use-it.md @@ -4,7 +4,6 @@ description: Autocomplete \- how to use it sidebar_label: How to use it keywords: [how] sidebar_position: 1 -pagination_next: autocomplete/model-setup --- ![autocomplete](/img/autocomplete.gif) diff --git a/docs/docs/chat/how-to-use-it.md b/docs/docs/chat/how-to-use-it.md index 754ef12c8..53cd85d17 100644 --- a/docs/docs/chat/how-to-use-it.md +++ b/docs/docs/chat/how-to-use-it.md @@ -4,7 +4,6 @@ description: How to use Chat sidebar_label: How to use it keywords: [how, use, chat] sidebar_position: 1 -pagination_next: chat/model-setup --- ![chat](/img/chat.gif) diff --git a/docs/docs/edit/how-to-use-it.md b/docs/docs/edit/how-to-use-it.md index f49e4134a..ac6f2ed4b 100644 --- a/docs/docs/edit/how-to-use-it.md +++ b/docs/docs/edit/how-to-use-it.md @@ -4,7 +4,6 @@ sidebar_position: 1 sidebar_label: How to use it description: How to use Edit keywords: [edit, cmd l, use] -pagination_next: edit/model-setup --- ![edit](/img/edit.gif) diff --git a/docs/docs/getting-started/install.md b/docs/docs/getting-started/install.md index d37e73e39..da04e8468 100644 --- a/docs/docs/getting-started/install.md +++ b/docs/docs/getting-started/install.md @@ -2,7 +2,6 @@ title: Install description: The open-source AI code assistant for developers keywords: [install, installation, getting started, vs code, jetbrains] -pagination_next: getting-started/overview --- ## VS Code From f4170bbb76080e755070d7aed5520b309b2c9203 Mon Sep 17 00:00:00 2001 From: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:56:24 +0200 Subject: [PATCH 106/252] Falback to `file://` path --- core/config/load.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/config/load.ts b/core/config/load.ts index 95fc73053..4388d94b0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -595,7 +595,20 @@ async function loadFullConfigNode( try { // Try config.ts first const configJsPath = getConfigJsPath(); - const module = await import(configJsPath); + let module: any; + + try { + module = await import(configJsPath); + } catch (e) { + console.log(e) + console.log("Could not load config.ts as absolute path, retrying as file url ..."); + try { + module = await import(`file://${configJsPath}`); + } catch (e) { + throw new Error("Could not load config.ts as file url either", { cause: e }); + } + } + if (typeof require !== "undefined") { delete require.cache[require.resolve(configJsPath)]; } From 360cf9ee31553f0271d3b5b402cdd94a025cc651 Mon Sep 17 00:00:00 2001 From: DongjaJ Date: Sat, 28 Sep 2024 00:38:03 +0900 Subject: [PATCH 107/252] docs: remove link attribute in docsSidebar --- docs/sidebars.js | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/docs/sidebars.js b/docs/sidebars.js index 196a6c832..755d7f720 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -8,10 +8,6 @@ const sidebars = { type: "category", label: "Getting started", collapsed: false, - link: { - type: "doc", - id: "getting-started/install", - }, items: [ { type: "autogenerated", @@ -22,10 +18,6 @@ const sidebars = { { type: "category", label: "Chat", - link: { - type: "doc", - id: "chat/how-to-use-it", - }, items: [ { type: "autogenerated", @@ -36,10 +28,6 @@ const sidebars = { { type: "category", label: "Autocomplete", - link: { - type: "doc", - id: "autocomplete/how-to-use-it", - }, items: [ { type: "autogenerated", @@ -50,10 +38,6 @@ const sidebars = { { type: "category", label: "Edit", - link: { - type: "doc", - id: "edit/how-to-use-it", - }, items: [ { type: "autogenerated", @@ -64,10 +48,6 @@ const sidebars = { { type: "category", label: "Actions", - link: { - type: "doc", - id: "actions/how-to-use-it", - }, items: [ { type: "autogenerated", From 937200130820a7038119385adb8d1b0f8e9f09a2 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 27 Sep 2024 08:53:50 -0700 Subject: [PATCH 108/252] update since-build for intellij --- extensions/intellij/src/main/resources/META-INF/plugin.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index ada642dac..52111bc83 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -5,7 +5,8 @@ continue-dev com.intellij.modules.platform com.intellij.modules.json - + + From 3cc16994a835da7b8d8a193aa6635913ace25f30 Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 27 Sep 2024 09:15:51 -0700 Subject: [PATCH 109/252] gui: improve missing api key text --- .vscode/launch.json | 2 +- gui/src/components/modelSelection/ModelSelect.tsx | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f5c81180f..896793040 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "cwd": "${workspaceFolder}/extensions/vscode", "args": [ // Pass a directory to manually test in - "${workspaceFolder}/gui", + "${workspaceFolder}/manual-testing-sandbox", "${workspaceFolder}/manual-testing-sandbox/test.js", "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" ], diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 553e440b3..7e0e471c2 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -192,7 +192,14 @@ function ModelOption({
- {option.title} + + {option.title} + {showMissingApiKeyMsg && ( + + (Missing API key) + + )} +
@@ -201,12 +208,6 @@ function ModelOption({ )}
- - {showMissingApiKeyMsg && ( - - Missing API key - - )}
); From 3e8e29e8f2ce18e138df64441e436d3a07ffa45e Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 27 Sep 2024 09:20:19 -0700 Subject: [PATCH 110/252] fix: remove deugger --- gui/src/components/markdown/FilenameLink.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/src/components/markdown/FilenameLink.tsx b/gui/src/components/markdown/FilenameLink.tsx index 1ef434a7e..6eea1ae73 100644 --- a/gui/src/components/markdown/FilenameLink.tsx +++ b/gui/src/components/markdown/FilenameLink.tsx @@ -12,7 +12,6 @@ function FilenameLink({ rif }: FilenameLinkProps) { const ideMessenger = useContext(IdeMessengerContext); function onClick() { - debugger; ideMessenger.post("showLines", { filepath: rif.filepath, startLine: rif.range.start.line, From 2a4a42dd634682f8785b8521b36b4436d52f4c24 Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 27 Sep 2024 12:01:55 -0700 Subject: [PATCH 111/252] gui: update more page --- gui/src/App.tsx | 6 +- gui/src/components/Footer.tsx | 77 +++++++ gui/src/components/Layout.tsx | 55 +---- gui/src/components/ProfileSwitcher.tsx | 62 ++---- .../components/dialogs/KeyboardShortcuts.tsx | 6 +- .../loaders/IndexingProgressBar.tsx | 12 +- .../components/mainInput/ContextItemsPeek.tsx | 1 - .../components/markdown/CodeBlockToolbar.tsx | 13 +- .../markdown/CodeSnippetPreview.tsx | 10 +- .../components/modelSelection/ModelSelect.tsx | 2 +- gui/src/pages/more.tsx | 209 +++++++++--------- gui/src/pages/stats.tsx | 12 +- 12 files changed, 226 insertions(+), 239 deletions(-) create mode 100644 gui/src/components/Footer.tsx diff --git a/gui/src/App.tsx b/gui/src/App.tsx index 9cf442727..fdb481e5a 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -12,7 +12,7 @@ import GUI from "./pages/gui"; import History from "./pages/history"; import MigrationPage from "./pages/migration"; import MonacoPage from "./pages/monaco"; -import { default as More, default as MorePage } from "./pages/more"; +import { default as MorePage } from "./pages/More"; import SettingsPage from "./pages/settings"; import Stats from "./pages/stats"; @@ -38,10 +38,6 @@ const router = createMemoryRouter([ path: "/stats", element: , }, - { - path: "/help", - element: , - }, { path: "/settings", element: , diff --git a/gui/src/components/Footer.tsx b/gui/src/components/Footer.tsx new file mode 100644 index 000000000..ff0966b50 --- /dev/null +++ b/gui/src/components/Footer.tsx @@ -0,0 +1,77 @@ +import { + Cog6ToothIcon, + EllipsisHorizontalCircleIcon, +} from "@heroicons/react/24/outline"; +import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; +import ProgressBar from "./loaders/ProgressBar"; +import ProfileSwitcher from "./ProfileSwitcher"; +import ButtonWithTooltip from "./ButtonWithTooltip"; +import { useSelector } from "react-redux"; +import { defaultModelSelector } from "../redux/selectors/modelSelectors"; +import { useNavigate } from "react-router-dom"; +import { useContext } from "react"; +import { IdeMessengerContext } from "../context/IdeMessenger"; +import { RootState } from "../redux/store"; + +function Footer() { + const navigate = useNavigate(); + const defaultModel = useSelector(defaultModelSelector); + const ideMessenger = useContext(IdeMessengerContext); + const selectedProfileId = useSelector( + (store: RootState) => store.state.selectedProfileId, + ); + + function onClickMore() { + if (location.pathname === "/more") { + navigate("/"); + } else { + navigate("/more"); + } + } + + function onClickSettings() { + if (selectedProfileId === "local") { + ideMessenger.post("openConfigJson", undefined); + } else { + ideMessenger.post( + "openUrl", + `http://app.continue.dev/workspaces/${selectedProfileId}/config`, + ); + } + } + + return ( +
+
+ {defaultModel?.provider === "free-trial" ? ( + + ) : ( + + )} +
+ +
+ + + + + + + +
+
+ ); +} + +export default Footer; diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index d012194a3..7eda88c9f 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -1,4 +1,3 @@ -import { EllipsisHorizontalCircleIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; @@ -11,15 +10,11 @@ import { } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useWebviewListener } from "../hooks/useWebviewListener"; -import { defaultModelSelector } from "../redux/selectors/modelSelectors"; import { RootState } from "../redux/store"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; -import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; import TextDialog from "./dialogs"; -import ProgressBar from "./loaders/ProgressBar"; import PostHogPageView from "./PosthogPageView"; -import ProfileSwitcher from "./ProfileSwitcher"; import { isNewUserOnboarding } from "./OnboardingCard/utils"; import { useOnboardingCard } from "./OnboardingCard"; import { @@ -27,9 +22,7 @@ import { setBottomMessageCloseTimeout, setShowDialog, } from "../redux/slices/uiStateSlice"; -import ButtonWithTooltip from "./ButtonWithTooltip"; - -const FOOTER_HEIGHT = "1.8em"; +import Footer from "./Footer"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -65,22 +58,6 @@ const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>` max-height: 35vh; `; -const Footer = styled.footer` - display: flex; - flex-direction: row; - gap: 8px; - justify-content: right; - padding: 8px; - align-items: center; - width: calc(100% - 16px); - height: ${FOOTER_HEIGHT}; - background-color: transparent; - backdrop-filter: blur(12px); - border-top: 1px solid rgba(136, 136, 136, 0.3); - border-bottom: 1px solid rgba(136, 136, 136, 0.3); - overflow: hidden; -`; - const GridDiv = styled.div` display: grid; grid-template-rows: 1fr auto; @@ -99,7 +76,7 @@ const ModelDropdownPortalDiv = styled.div` const ProfileDropdownPortalDiv = styled.div` background-color: ${vscInputBackground}; position: relative; - margin-left: calc(100% - 190px); + margin-left: 8px; z-index: 200; font-size: ${getFontSize() - 2}; `; @@ -118,8 +95,6 @@ const Layout = () => { (state: RootState) => state.uiState.showDialog, ); - const defaultModel = useSelector(defaultModelSelector); - const bottomMessage = useSelector( (state: RootState) => state.uiState.bottomMessage, ); @@ -238,31 +213,7 @@ const Layout = () => { -
-
- {defaultModel?.provider === "free-trial" && ( - - )} -
- - - { - if (location.pathname === "/help") { - navigate("/"); - } else { - navigate("/help"); - } - }} - > - - -
+