💫 Preview (#996)

* feat: add fixed version of the nodejs

* revert accidentally committed files

* add: unified version of the Node.js that is used locally and on Github Actions

* Set itemType for querySubmenuItem

This is necessary before calling props.command the same way we do it for non-query item types. Otherwise we receive an 'Unknow provider...' error message in the 'getContextItems' case in the 'panel.webview.onDidReceiveMessage, callback.

* include @vscode node module folder

we need the @vscode folder containing ripgrep in the distribution.

* Amended path for ripgrep executable

We have to preprend the 'out' folder in order to find the ripgrep executable in the distribution.
Prepending 'out' during development is not necessary. We need a way to distinguish in 'ideProtocol'?

* implemented locals context provider

* normal to submenu(select thread) for the locals provider

* added code context from the call stack

* use parameter for callstack retrieving

* added thread filtering and handle a edge case

* revert accidentally committed file

* temporary fix to use refreshSubmenuItems

* added updateSubmenuItems request

* refactor: changed the interface of threads

* polished format and file reading

* added a little doc

* typo

* revert accidentally committed file

* ✨ UI for JetBrains autocomplete

* 🎨 decouple autocomplete from VS Code extension

* ✨ autocomplete in core protocol

* 🚧 jetbrains autocomplete fixes

* 🐛 successfully get responses for jetbrains autocomplete

* Refactored web crawling code for document indexing. The updated code uses a breadth-first search, filters out specific paths, and ensures that websites are not downloaded twice.

* update hasDocs to use new pattern

* feat: add gitlab context class

* feat: update to work as normal context provider

* fix: add context provider

* feat: add code that comment is based on

* docs: add documentation

* feat: enable comment filtering

* 🐛 fix autocomplete with azure

* ✨ jetbrains multiline completions

* 🐛 fix file reading in autocomplete

* ✨ option to disable jetbrains autocomplete

* 📌 update package-lock files

* 🐛 fix localhost ollama bug with jetbrains binary

* 🔥 disable apply to file in jetbrains for now

* 🚸 fix constant re-rendering of code vision in jetbrains

* 🔖 update package.json versiojn

* 🐛 don't override user temperature value for tab autocomplete model

* Fix chat msg formatting in Output for image models (#971)

* 📝 tweak docs for "locals" ctx provider

* 🩹 small tweak to link filtering logic

* Add more C++ extensions for AST parser (#972)

* 🔥 remove ruby example file

* add claude3 to free trial

* 🐛 fix codelens in tutorial

* 🧱 change server url

* 🐛 don't send image_url if not image type

* 🔧 update config schemas

* 📌 update npm version to v20.11.0

* 📈 Locally track tokens generated and show stats (#987)

* ✨ log tokens generated locally

* 💄 UI for usage stats

* 🔥 delete unused test file

* 🚚 rename core package for publishing on npm

* Remove duplicate itemType property (#986)

* 🔒️ add .env to .gitignore for npm package

* Add SystemContextProvider to context providers so that users can use … (#988)

* Add SystemContextProvider to context providers so that users can use their own system cpu and os for a resource

* change to OSContextProvider

* update descriptor

* 🎨 export transformers.js

* 🐛 fix /edit for anthropic

* 🚑 fix autocomplete by binding function

---------

Co-authored-by: my8bit <mail@my8bit.name>
Co-authored-by: Ihor Pavlenko <my8bit@users.noreply.github.com>
Co-authored-by: Lars Pagh <lp@airsupport.dk>
Co-authored-by: commandblock2 <tony_hu@live.com>
Co-authored-by: Jason Jacobs <nerfnerd@gmail.com>
Co-authored-by: Ben Force <benforce@gmail.com>
Co-authored-by: Peter Zaback <pzaback@gmail.com>
Co-authored-by: SR_team <sr_team@sr.team>
This commit is contained in:
Nate Sesti 2024-03-19 10:35:28 -07:00 • committed by GitHub
parent fddeb468da
commit 3bd9c8996c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 4011 additions and 2322 deletions

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
v20.11.0

View file

@ -59,6 +59,12 @@ Continue is continuously improving, but a feature isn't complete until it is ref
VS Code is assumed for development as Continue is primarily a VS Code tool at the moment. Most of the setup and running is automated through VS Code tasks and launch configurations.
<!-- Pre-requisite: you will need `cargo` the rust package manager installed ([get it on rust-lang.org](https://www.rust-lang.org/tools/install)). -->
Pre-requisite: you have Node.js version 20.11.0 (LTS) or higher installed. [get it on https://nodejs.org](https://nodejs.org/en/download/
Alternatively, if you are using NVM (Node Version Manager), you can set the correct version of Node.js for this project by running the following command in the root of the project:
```bash
nvm use
1. Clone and open in VS Code the Continue repo `https://github.com/continuedev/continue`

1
core/.gitignore vendored
View file

@ -2,3 +2,4 @@ target
**/node_modules
**/.DS_Store
npm-debug.log*
.env

View file

@ -0,0 +1,437 @@
import Handlebars from "handlebars";
import { v4 as uuidv4 } from "uuid";
import { IDE, ILLM, Position, TabAutocompleteOptions } from "..";
import { RangeInFileWithContents } from "../commands/util";
import { ConfigHandler } from "../config/handler";
import { streamLines } from "../diff/util";
import OpenAI from "../llm/llms/OpenAI";
import { getBasename } from "../util";
import { logDevData } from "../util/devdata";
import { Telemetry } from "../util/posthog";
import { getRangeInString } from "../util/ranges";
import AutocompleteLruCache from "./cache";
import { noFirstCharNewline, onlyWhitespaceAfterEndOfLine } from "./charStream";
import {
constructAutocompletePrompt,
languageForFilepath,
} from "./constructPrompt";
import { AutocompleteLanguageInfo } from "./languages";
import {
avoidPathLine,
stopAtLines,
stopAtRepeatingLines,
stopAtSimilarLine,
streamWithNewLines,
} from "./lineStream";
import { DEFAULT_AUTOCOMPLETE_OPTS } from "./parameters";
import { AutocompleteSnippet } from "./ranking";
import { getTemplateForModel } from "./templates";
import { GeneratorReuseManager } from "./util";
export interface AutocompleteInput {
completionId: string;
filepath: string;
pos: Position;
recentlyEditedFiles: RangeInFileWithContents[];
recentlyEditedRanges: RangeInFileWithContents[];
clipboardText: string;
}
export interface AutocompleteOutcome {
accepted?: boolean;
time: number;
prompt: string;
completion: string;
modelProvider: string;
modelName: string;
completionOptions: any;
cacheHit: boolean;
}
const autocompleteCache = AutocompleteLruCache.get();
function formatExternalSnippet(
filepath: string,
snippet: string,
language: AutocompleteLanguageInfo,
) {
const comment = language.comment;
const lines = [
comment + " Path: " + getBasename(filepath),
...snippet
.trim()
.split("\n")
.map((line) => comment + " " + line),
comment,
];
return lines.join("\n");
}
export async function getTabCompletion(
token: AbortSignal,
options: TabAutocompleteOptions,
llm: ILLM,
ide: IDE,
generatorReuseManager: GeneratorReuseManager,
input: AutocompleteInput,
getDefinitionsFromLsp: (
filepath: string,
contents: string,
cursorIndex: number,
ide: IDE,
) => Promise<AutocompleteSnippet[]>,
): Promise<AutocompleteOutcome | undefined> {
const startTime = Date.now();
const {
filepath,
pos,
recentlyEditedFiles,
recentlyEditedRanges,
clipboardText,
} = input;
const fileContents = 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 instanceof OpenAI) {
llm.useLegacyCompletionsEndpoint = true;
}
if (!llm) return;
// Prompt
const fullPrefix = getRangeInString(fileContents, {
start: { line: 0, character: 0 },
end: pos,
});
const fullSuffix = getRangeInString(fileContents, {
start: pos,
end: { line: fileLines.length - 1, character: Number.MAX_SAFE_INTEGER },
});
const lineBelowCursor =
fileLines[Math.min(pos.line + 1, fileLines.length - 1)];
let extrasSnippets = (await Promise.race([
getDefinitionsFromLsp(
filepath,
fullPrefix + fullSuffix,
fullPrefix.length,
ide,
),
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,
);
// Template prompt
const { template, completionOptions } = options.template
? { template: options.template, completionOptions: {} }
: getTemplateForModel(llm.model);
let prompt: string;
const filename = getBasename(filepath);
const reponame = getBasename(workspaceDirs[0] ?? "myproject");
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;
}
prompt = compiledTemplate({
prefix,
suffix,
filename,
reponame,
});
} else {
// Let the template function format snippets
prompt = template(prefix, suffix, filename, reponame, snippets);
}
// Completion
let completion = "";
const cache = await autocompleteCache;
const cachedCompletion = options.useCache
? await cache.get(prompt)
: undefined;
let cacheHit = false;
if (cachedCompletion) {
// Cache
cacheHit = true;
completion = cachedCompletion;
} else {
// Try to reuse pending requests if what the user typed matches start of completion
let stop = [
...(completionOptions?.stop || []),
"\n\n",
"/src/",
"```",
...lang.stopWords,
];
const multiline =
options.multilineCompletions !== "never" &&
(options.multilineCompletions === "always" || completeMultiline);
let generator = generatorReuseManager.getGenerator(
prefix,
() =>
llm.streamComplete(prompt, {
...completionOptions,
raw: true,
stop,
}),
multiline,
);
// LLM
let cancelled = false;
const generatorWithCancellation = async function* () {
for await (const update of generator) {
if (token.aborted) {
cancelled = true;
return undefined;
}
yield update;
}
};
let chars = generatorWithCancellation();
const gen2 = onlyWhitespaceAfterEndOfLine(
noFirstCharNewline(chars),
lang.endOfLine,
);
const lineGenerator = streamWithNewLines(
avoidPathLine(
stopAtRepeatingLines(stopAtLines(streamLines(gen2))),
lang.comment,
),
);
const finalGenerator = stopAtSimilarLine(lineGenerator, lineBelowCursor);
for await (const update of finalGenerator) {
completion += update;
}
if (cancelled) {
return undefined;
}
// Don't return empty
if (completion.trim().length <= 0) {
return undefined;
}
// Post-processing
completion = completion.trimEnd();
}
const time = Date.now() - startTime;
return {
time,
completion,
prompt,
modelProvider: llm.providerName,
modelName: llm.model,
completionOptions,
cacheHit,
};
}
export class CompletionProvider {
private static debounceTimeout: NodeJS.Timeout | undefined = undefined;
private static debouncing: boolean = false;
private static lastUUID: string | undefined = undefined;
constructor(
private readonly configHandler: ConfigHandler,
private readonly ide: IDE,
private readonly getLlm: () => Promise<ILLM | undefined>,
private readonly _onError: (e: any) => void,
private readonly getDefinitionsFromLsp: (
filepath: string,
contents: string,
cursorIndex: number,
ide: IDE,
) => Promise<AutocompleteSnippet[]>,
) {
this.generatorReuseManager = new GeneratorReuseManager(
this.onError.bind(this),
);
}
private generatorReuseManager: GeneratorReuseManager;
private autocompleteCache = AutocompleteLruCache.get();
public errorsShown: Set<string> = new Set();
private onError(e: any) {
console.warn("Error generating autocompletion: ", e);
if (!this.errorsShown.has(e.message)) {
this.errorsShown.add(e.message);
this._onError(e);
}
}
public cancel() {
this._abortControllers.forEach((abortController, id) => {
abortController.abort();
});
this._abortControllers.clear();
}
private _abortControllers = new Map<string, AbortController>();
private _logRejectionTimeouts = new Map<string, NodeJS.Timeout>();
private _outcomes = new Map<string, AutocompleteOutcome>();
public accept(completionId: string) {
if (this._logRejectionTimeouts.has(completionId)) {
clearTimeout(this._logRejectionTimeouts.get(completionId));
this._logRejectionTimeouts.delete(completionId);
}
if (this._outcomes.has(completionId)) {
const outcome = this._outcomes.get(completionId)!;
outcome.accepted = true;
logDevData("autocomplete", outcome);
Telemetry.capture("autocomplete", {
accepted: outcome.accepted,
modelName: outcome.modelName,
modelProvider: outcome.modelProvider,
time: outcome.time,
cacheHit: outcome.cacheHit,
});
this._outcomes.delete(completionId);
}
}
public async provideInlineCompletionItems(
input: AutocompleteInput,
token: AbortSignal | undefined,
): Promise<AutocompleteOutcome | undefined> {
// Create abort signal if not given
if (!token) {
const controller = new AbortController();
token = controller.signal;
this._abortControllers.set(input.completionId, controller);
}
try {
// Debounce
const uuid = uuidv4();
CompletionProvider.lastUUID = uuid;
const config = await this.configHandler.loadConfig();
const options = {
...DEFAULT_AUTOCOMPLETE_OPTS,
...config.tabAutocompleteOptions,
};
if (CompletionProvider.debouncing) {
CompletionProvider.debounceTimeout?.refresh();
const lastUUID = await new Promise((resolve) =>
setTimeout(() => {
resolve(CompletionProvider.lastUUID);
}, options.debounceDelay),
);
if (uuid !== lastUUID) {
return undefined;
}
} else {
CompletionProvider.debouncing = true;
CompletionProvider.debounceTimeout = setTimeout(async () => {
CompletionProvider.debouncing = false;
}, options.debounceDelay);
}
// Get completion
const llm = await this.getLlm();
if (!llm) {
return undefined;
}
// Set temperature (but don't overrride)
if (llm.completionOptions.temperature === undefined) {
llm.completionOptions.temperature = 0.0;
}
const outcome = await getTabCompletion(
token,
options,
llm,
this.ide,
this.generatorReuseManager,
input,
this.getDefinitionsFromLsp,
);
const completion = outcome?.completion;
if (!completion) {
return undefined;
}
// Do some stuff later so as not to block return. Latency matters
setTimeout(async () => {
if (!outcome.cacheHit) {
(await this.autocompleteCache).put(outcome.prompt, completion);
}
}, 100);
outcome.accepted = false;
const logRejectionTimeout = setTimeout(() => {
// Wait 10 seconds, then assume it wasn't accepted
logDevData("autocomplete", outcome);
Telemetry.capture("autocomplete", {
accepted: outcome.accepted,
modelName: outcome.modelName,
modelProvider: outcome.modelProvider,
time: outcome.time,
cacheHit: outcome.cacheHit,
});
this._logRejectionTimeouts.delete(input.completionId);
}, 10_000);
this._outcomes.set(input.completionId, outcome);
this._logRejectionTimeouts.set(input.completionId, logRejectionTimeout);
return outcome;
} finally {
this._abortControllers.delete(input.completionId);
}
}
}

View file

@ -87,7 +87,7 @@ export async function constructAutocompletePrompt(
language: AutocompleteLanguageInfo,
options: TabAutocompleteOptions,
recentlyEditedRanges: RangeInFileWithContents[],
recentlyEditedDocuments: RangeInFileWithContents[],
recentlyEditedFiles: RangeInFileWithContents[],
modelName: string,
extraSnippets: AutocompleteSnippet[],
): Promise<{
@ -123,7 +123,7 @@ export async function constructAutocompletePrompt(
);
const slidingWindowMatches = await slidingWindowMatcher(
recentlyEditedDocuments,
recentlyEditedFiles,
windowAroundCursor,
3,
options.slidingWindowSize,

View file

@ -27,12 +27,12 @@ function* slidingWindow(
/**
* Match by similarity over sliding windows of recent documents.
* @param recentDocuments
* @param recentFiles
* @param prefix
* @param suffix
*/
export async function slidingWindowMatcher(
recentDocuments: RangeInFileWithContents[],
recentFiles: RangeInFileWithContents[],
windowAroundCursor: string,
topN: number,
windowSize: number,
@ -40,7 +40,7 @@ export async function slidingWindowMatcher(
// Sorted lowest similarity to highest
const topMatches: AutocompleteSnippet[] = [];
for (const { filepath, contents, range } of recentDocuments) {
for (const { filepath, contents, range } of recentFiles) {
for (const window of slidingWindow(contents, windowSize)) {
const score = jaccardSimilarity(window, windowAroundCursor);

View file

@ -27,6 +27,11 @@ export const defaultConfig: SerializedContinueConfig = {
provider: "free-trial",
model: "mistral-8x7b",
},
{
title: "Claude 3 Sonnet (Free Trial)",
provider: "free-trial",
model: "claude-3-sonnet-20240229",
},
],
slashCommands: [
{
@ -98,6 +103,11 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
provider: "free-trial",
model: "mistral-8x7b",
},
{
title: "Claude 3 Sonnet (Free Trial)",
provider: "free-trial",
model: "claude-3-sonnet-20240229",
},
],
slashCommands: [
{

View file

@ -0,0 +1,277 @@
import { AxiosInstance, AxiosError } from "axios";
import {BaseContextProvider} from "..";
import { ContextProviderExtras, ContextItem, ContextProviderDescription } from "../..";
interface RemoteBranchInfo {
branch: string | null;
project: string | null;
}
interface GitLabUser {
id: number;
username: string;
name: string;
state: "active";
locked: boolean;
avatar_url: string;
web_url: string;
}
interface GitLabMergeRequest {
iid: number;
project_id: number;
title: string;
description: string;
}
interface GitLabComment {
type: null | "DiffNote";
resolvable: boolean;
resolved?: boolean;
body: string;
created_at: string;
author: GitLabUser;
position?: {
new_path: string;
new_line: number;
head_sha: string;
line_range: {
start: {
line_code: string;
type: "new";
old_line: null;
new_line: number;
};
end: {
line_code: string;
type: "new";
old_line: null;
new_line: number;
};
};
};
}
const trimFirstElement = (args: Array<string>): string => {
return args[0].trim();
};
const getSubprocess = async (extras: ContextProviderExtras) => {
const workingDir = await extras.ide
.getWorkspaceDirs()
.then(trimFirstElement);
return (command: string) =>
extras.ide
.subprocess(`cd ${workingDir}; ${command}`)
.then(trimFirstElement);
};
class GitLabMergeRequestContextProvider extends BaseContextProvider {
static description: ContextProviderDescription = {
title: 'gitlab-mr',
displayTitle: 'GitLab Merge Request',
description: 'Reference comments in a GitLab Merge Request',
type: 'normal'
};
private async getApi(): Promise<AxiosInstance> {
const { default: Axios } = await import("axios");
const domain = this.options.domain ?? "gitlab.com";
const token = this.options.token;
if(!token) {
throw new Error(`GitLab Private Token is required!`);
}
return Axios.create({
baseURL: `https://${domain ?? "gitlab.com"}/api/v4`,
headers: {
"PRIVATE-TOKEN": token,
},
});
};
private async getRemoteBranchName(extras: ContextProviderExtras): Promise<RemoteBranchInfo> {
const subprocess = await getSubprocess(extras);
const branchName = await subprocess(`git branch --show-current`);
const branchRemote = await subprocess(
`git config branch.${branchName}.remote`
);
const branchInfo = await subprocess(`git branch -vv`);
const currentBranchInfo = branchInfo
.split("\n")
.find((line) => line.startsWith("*"));
const remoteMatches = RegExp(
`\\[${branchRemote}/(?<remote_branch>[^\\]]+)\\]`
).exec(currentBranchInfo!);
console.dir({ remoteMatches });
const remoteBranch = remoteMatches?.groups?.["remote_branch"] ?? null;
const remoteUrl = await subprocess(`git remote get-url ${branchRemote}`);
const urlMatches = RegExp(`:(?<project>.*).git`).exec(remoteUrl);
const project = urlMatches?.groups?.["project"] ?? null;
return {
branch: remoteBranch,
project,
};
};
async getContextItems(query: string, extras: ContextProviderExtras): Promise<ContextItem[]> {
const { branch, project } = await this.getRemoteBranchName(extras);
const api = await this.getApi();
const result = [] as Array<ContextItem>;
try {
const mergeRequests = await api
.get<Array<GitLabMergeRequest>>(
`/projects/${encodeURIComponent(project!)}/merge_requests`,
{
params: {
source_branch: branch,
state: "opened",
},
}
)
.then((x) => x.data);
const subprocess = await getSubprocess(extras);
for (const mergeRequest of mergeRequests) {
const parts = [
`# GitLab Merge Request\ntitle: "${mergeRequest.title}"\ndescription: "${mergeRequest.description ?? 'None'}"`,
`## Comments`,
];
const comments = await api.get<Array<GitLabComment>>(
`/projects/${mergeRequest.project_id}/merge_requests/${mergeRequest.iid}/notes`,
{
params: {
sort: "asc",
order_by: "created_at",
},
}
);
const filteredComments = comments.data.filter(
(x) => x.type === "DiffNote"
);
const locations = {} as Record<string, Array<GitLabComment>>;
for (const comment of filteredComments) {
const filename = comment.position?.new_path ?? "general";
if (!locations[filename]) {
locations[filename] = [];
}
locations[filename].push(comment);
}
if (extras.selectedCode.length && this.options.filterComments) {
const toRemove = Object.keys(locations).filter(filename => !extras.selectedCode.find(selection => selection.filepath.endsWith(filename)) && filename !== "general");
for (const filepath of toRemove) {
delete locations[filepath];
}
}
const commentFormatter = async (comment: GitLabComment) => {
const commentLabel = comment.body.includes("```suggestion") ? 'Code Suggestion' : 'Comment';
let result = `#### ${commentLabel}\nauthor: "${comment.author.name}"\ndate: "${comment.created_at}"\nresolved: ${
comment.resolved ? "Yes" : "No"
}`;
if (comment.position?.new_line) {
result += `\nline: ${comment.position.new_line}`;
if (comment.position.head_sha) {
const sourceLines = await subprocess(`git show ${comment.position.head_sha}:${comment.position.new_path}`).then(result => result.split("\n")).catch(ex => []);
const line = comment.position.new_line <= sourceLines.length ? sourceLines[comment.position.new_line - 1] : null;
if (line) {
result += `\nsource: \`${line}\``;
}
}
}
result += `\n\n${comment.body}`;
return result;
};
for (const [filename, locationComments] of Object.entries(locations)) {
if (filename !== "general") {
parts.push(`### File ${filename}`);
locationComments.sort(
(a, b) => a.position!.new_line - b.position!.new_line
);
} else {
parts.push("### General");
}
const commentSections = await Promise.all(locationComments.map(commentFormatter));
parts.push(...commentSections);
}
const content = parts.join("\n\n");
result.push(
{
name: mergeRequest.title,
content,
description: `Comments from the Merge Request for this branch.`,
},
);
}
} catch (ex) {
let content = `# GitLab Merge Request\n\nError getting merge request. `;
if (ex instanceof AxiosError) {
if (ex.response) {
const errorMessage = ex.response?.data ? ex.response.data.message ?? JSON.stringify(ex.response?.data) : `${ex.response.status}: ${ex.response.statusText}`;
content += `GitLab Error: ${errorMessage}`;
} else {
content += `GitLab Request Error ${ex.request}`;
}
} else {
// @ts-ignore
content += `Unknown error: ${ex.message ?? JSON.stringify(ex)}`;
}
result.push(
{
name: `GitLab Merge Request`,
content,
description: `Error getting the Merge Request for this branch.`,
},
);
}
return result;
}
}
export default GitLabMergeRequestContextProvider;

View file

@ -0,0 +1,62 @@
import { BaseContextProvider } from "..";
import {
ContextItem,
ContextProviderDescription,
ContextProviderExtras,
ContextSubmenuItem,
LoadSubmenuItemsArgs,
} from "../..";
class LocalsProvider extends BaseContextProvider {
static description: ContextProviderDescription = {
title: "locals",
displayTitle: "Locals",
description: "Reference the contents of the local variables",
type: "submenu",
};
async getContextItems(
query: string,
extras: ContextProviderExtras
): Promise<ContextItem[]> {
// Assuming that the query is a number
const localVariables = await extras.ide.getDebugLocals(Number(query));
const threadIndex = Number(query);
const thread = (await extras.ide.getAvailableThreads()).find(
(thread) => thread.id == threadIndex
);
const callStacksSources = await extras.ide.getTopLevelCallStackSources(
threadIndex,
this.options?.stackDepth || 3
);
const callStackContents = callStacksSources.reduce(
(acc, source, index) =>
acc + `\n\ncall stack ${index}\n` + "```\n" + source + "\n```",
""
);
return [
{
description: "The value, name and possibly type of the local variables",
content:
`This is a paused thread: ${thread?.name}\n` +
`Current local variable contents: \n${localVariables}.\n` +
`Current top level call stacks: ${callStackContents}`,
name: "Locals",
},
];
}
async loadSubmenuItems(
args: LoadSubmenuItemsArgs
): Promise<ContextSubmenuItem[]> {
const threads = await args.ide.getAvailableThreads();
return threads.map((thread) => ({
id: `${thread.id}`,
title: thread.name,
description: `${thread.id}`,
}));
}
}
export default LocalsProvider;

View file

@ -0,0 +1,36 @@
//os.platform()
//os.arch()
import { BaseContextProvider } from "..";
import {
ContextItem,
ContextProviderDescription,
ContextProviderExtras,
} from "../..";
import os from "os";
class OSContextProvider extends BaseContextProvider {
static description: ContextProviderDescription = {
title: "OS",
displayTitle: "OS",
description: "OS and CPU Information.",
type: "normal",
};
async getContextItems(
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
const cpu = os.arch();
const platform = os.platform();
return [
{
description: "Your OS and CPU",
content: `I am running ${platform} on ${cpu}.`,
name: "OS",
},
];
}
}
export default OSContextProvider;

View file

@ -15,8 +15,11 @@ import OpenFilesContextProvider from "./OpenFilesContextProvider";
import PostgresContextProvider from "./PostgresContextProvider";
import ProblemsContextProvider from "./ProblemsContextProvider";
import SearchContextProvider from "./SearchContextProvider";
import OSContextProvider from "./OSContextProvider";
import TerminalContextProvider from "./TerminalContextProvider";
import LocalsProvider from "./LocalsProvider";
import URLContextProvider from "./URLContextProvider";
import GitLabMergeRequestContextProvider from "./GitLabMergeRequestContextProvider";
const Providers: (typeof BaseContextProvider)[] = [
DiffContextProvider,
@ -24,14 +27,17 @@ const Providers: (typeof BaseContextProvider)[] = [
GitHubIssuesContextProvider,
GoogleContextProvider,
TerminalContextProvider,
LocalsProvider,
URLContextProvider,
OpenFilesContextProvider,
HttpContextProvider,
SearchContextProvider,
OSContextProvider,
CodebaseContextProvider,
ProblemsContextProvider,
FolderContextProvider,
DocsContextProvider,
GitLabMergeRequestContextProvider,
// CodeHighlightsContextProvider,
// CodeOutlineContextProvider,
JiraIssuesContextProvider,

17
core/index.d.ts vendored
View file

@ -320,6 +320,11 @@ export class Problem {
message: string;
}
export class Thread {
name: string;
id: number;
}
export type IdeType = "vscode" | "jetbrains";
export interface IdeInfo {
ideType: IdeType;
@ -340,6 +345,12 @@ export interface IDE {
isTelemetryEnabled(): Promise<boolean>;
getUniqueId(): Promise<string>;
getTerminalContents(): Promise<string>;
getDebugLocals(threadIndex: number): Promise<string>;
getTopLevelCallStackSources(
threadIndex: number,
stackDepth: number,
): Promise<string[]>;
getAvailableThreads(): Promise<Thread[]>;
listWorkspaceContents(directory?: string): Promise<string[]>;
listFolders(): Promise<string[]>;
getWorkspaceDirs(): Promise<string[]>;
@ -415,6 +426,7 @@ type ContextProviderName =
| "diff"
| "github"
| "terminal"
| "locals"
| "open"
| "google"
| "search"
@ -428,7 +440,9 @@ type ContextProviderName =
| "postgres"
| "database"
| "code"
| "docs";
| "docs"
| "gitlab-mr"
| "os";
type TemplateType =
| "llama2"
@ -500,6 +514,7 @@ export type ModelName =
| "claude-2"
| "claude-3-opus-20240229"
| "claude-3-sonnet-20240229"
| "claude-3-haiku-20240307"
| "claude-2.1"
// Google PaLM
| "chat-bison-001"

View file

@ -2,13 +2,14 @@ import { Readability } from "@mozilla/readability";
import { Chunk } from "../..";
import { MAX_CHUNK_SIZE } from "../../llm/constants";
import { cleanFragment, cleanHeader } from "../chunk/markdown";
import { PageData } from "./crawl"
type ArticleComponent = {
export type ArticleComponent = {
title: string;
body: string;
};
type Article = {
export type Article = {
url: string;
subpath: string;
title: string;
@ -132,6 +133,7 @@ export async function stringToArticle(
}
let article_components = await extractTitlesAndBodies(article.content);
return {
url,
subpath,
@ -144,20 +146,11 @@ export async function stringToArticle(
}
}
export async function urlToArticle(
subpath: string,
baseUrl: URL,
export async function pageToArticle(
page: PageData
): Promise<Article | undefined> {
const url = new URL(subpath, baseUrl);
try {
const response = await fetch(url.toString());
if (!response.ok) {
return undefined;
}
const htmlContent = await response.text();
return stringToArticle(baseUrl.toString(), htmlContent, subpath);
return stringToArticle(page.url, page.html, page.path);
} catch (err) {
console.error("Error converting URL to article components", err);
return undefined;

View file

@ -1,13 +1,12 @@
import { Octokit } from "@octokit/rest";
import cheerio from "cheerio";
import fetch from "node-fetch";
// const HCCrawler = require("headless-chrome-crawler");
import { URL } from "url";
const IGNORE_PATHS_ENDING_IN = [
"favicon.ico",
"robots.txt",
".rst.txt",
// ReadTheDocs
"genindex",
"py-modindex",
"search.html",
@ -19,70 +18,6 @@ const IGNORE_PATHS_ENDING_IN = [
const GITHUB_PATHS_TO_TRAVERSE = ["/blob/", "/tree/"];
function shouldFilterPath(pathname: string, baseUrl: URL): boolean {
if (pathname.includes("#")) {
pathname = pathname.slice(0, pathname.indexOf("#"));
}
if (pathname.endsWith("/")) {
pathname = pathname.slice(0, -1);
}
if (baseUrl.hostname === "github.com") {
if (
pathname.split("/").length > 3 &&
!GITHUB_PATHS_TO_TRAVERSE.some((path) => pathname.includes(path))
)
return true;
return false;
}
if (IGNORE_PATHS_ENDING_IN.some((path) => pathname.endsWith(path)))
return true;
return false;
}
async function* crawlLinks(
pathname: string,
baseUrl: URL,
visited: Set<string>,
): AsyncGenerator<number> {
if (visited.has(pathname) || shouldFilterPath(pathname, baseUrl)) {
return;
}
visited.add(pathname);
yield visited.size;
const response = await fetch(new URL(pathname, baseUrl));
const text = await response.text();
const $ = cheerio.load(text);
const children: string[] = [];
$("a").each((_, element) => {
const href = $(element).attr("href");
if (!href) {
return;
}
const parsedUrl = new URL(href, baseUrl);
if (
parsedUrl.hostname === baseUrl.hostname &&
!visited.has(parsedUrl.pathname)
// parsedUrl.pathname.startsWith(baseUrl.pathname)
) {
children.push(parsedUrl.pathname);
}
});
await Promise.all(
children.map(async (child) => {
for await (const _ of crawlLinks(child, baseUrl, visited)) {
}
}),
);
yield visited.size;
}
async function crawlGithubRepo(baseUrl: URL) {
const octokit = new Octokit({
auth: undefined,
@ -109,114 +44,129 @@ async function crawlGithubRepo(baseUrl: URL) {
);
const paths = tree.data.tree
.filter(
(file) => file.type === "blob" && file.path?.endsWith(".md"),
// ||
// file.path?.endsWith(".rst") ||
// file.path?.split("/").includes("documentation") ||
// file.path?.split("/").includes("docs") ||
// file.path?.split("/").includes("doc") ||
// file.path?.split("/").includes("examples") ||
// file.path?.split("/").includes("example")
)
.filter((file) => file.type === "blob" && file.path?.endsWith(".md"))
.map((file) => baseUrl.pathname + "/tree/main/" + file.path);
return paths;
}
export async function* crawlSubpages(
baseUrl: URL,
): AsyncGenerator<number, string[]> {
// Special case for GitHub repos
if (baseUrl.hostname === "github.com") {
return crawlGithubRepo(baseUrl);
async function getLinksFromUrl(url: string, path: string) {
const baseUrl = new URL(url);
const location = new URL(path, url);
let response;
try {
response = await fetch(location.toString());
} catch (error: unknown) {
if (error instanceof Error && error.message.includes("maximum redirect")) {
console.error("Maximum redirect reached for: ", location.toString());
return {
html: "",
links: [],
};
} else {
console.error(error);
return {
html: "",
links: [],
};
}
}
// First, check if the parent of the path redirects to the same page
if (baseUrl.pathname.endsWith("/")) {
baseUrl.pathname = baseUrl.pathname.slice(0, -1);
const html = await response.text();
let links: string[] = [];
if (url.includes("github.com")) {
return {
html,
links,
};
}
let realBaseUrl = new URL(baseUrl);
while (true) {
let parentUrl = new URL(realBaseUrl);
parentUrl.pathname = parentUrl.pathname.split("/").slice(0, -1).join("/");
const $ = cheerio.load(html);
$("a").each((_, element) => {
const href = $(element).attr("href");
if (!href) {
return;
}
const parsedUrl = new URL(href, url);
if (
parentUrl.pathname === realBaseUrl.pathname ||
parentUrl.pathname === ""
parsedUrl.hostname === baseUrl.hostname
// parsedUrl.pathname.startsWith(baseUrl.pathname)
) {
break;
links.push(parsedUrl.pathname);
}
const response = await fetch(parentUrl);
const redirected = response.url.toString() === baseUrl.toString() + "/";
if (!redirected) {
break;
}
realBaseUrl = parentUrl;
}
});
const visited = new Set<string>();
for await (const count of crawlLinks(
realBaseUrl.pathname || "/",
realBaseUrl,
visited,
)) {
yield count;
}
return [...visited];
links = [...new Set(links)].filter((link) => {
return (
!link.includes("#") &&
!IGNORE_PATHS_ENDING_IN.some((ending) => link.endsWith(ending))
);
});
return {
html,
links,
};
}
// class NoEscapeTurndownService extends TurndownService {
// escape(str: string): string {
// return str;
// }
// }
function splitUrl(url: URL) {
const baseUrl = `${url.protocol}//${url.hostname}`;
const basePath = url.pathname;
return {
baseUrl,
basePath,
};
}
// async function convertURLToMarkdown(url: string): Promise<string> {
// try {
// const response = await fetch(url);
// const htmlContent = await response.text();
// const turndown = new NoEscapeTurndownService({
// codeBlockStyle: "fenced",
// headingStyle: "atx",
// }).use([turndownPluginGfm.tables, turndownPluginGfm.strikethrough]);
// const markdown = turndown.turndown(htmlContent);
// return markdown;
// } catch (err) {
// console.error(err);
// throw new Error("Error converting URL to markdown");
// }
// }
export type PageData = {
url: string;
path: string;
html: string;
};
// convertURLToMarkdown("https://python-socketio.readthedocs.io/en/stable").then(
// (md) => {
// console.log(md);
// }
// );
export async function* crawlPage(url: URL): AsyncGenerator<PageData> {
const { baseUrl, basePath } = splitUrl(url);
let paths: string[] = [basePath];
let visited = new Set<string>();
const url = new URL("https://python-socketio.readthedocs.io/en/stable");
const url2 = new URL("https://platform.openai.com/docs/api-reference");
// crawlLinks(url.pathname, url, visited).then(() => {
// console.log(visited);
// });
if (url.hostname === "github.com") {
const githubLinks = await crawlGithubRepo(url);
paths = [...paths, ...githubLinks];
}
// async function hcCrawlLinks() {
// const results: any[] = [];
// const crawler = await HCCrawler.launch({
// // Function to be evaluated in browsers
// evaluatePage: () => ({
// title: $("title").text(),
// }),
// // Function to be called with evaluated results from browsers
// onSuccess: (result: any) => {
// console.log(result);
// results.push(result.url);
// },
// });
// // Queue a request
// await crawler.queue(url.toString());
// await crawler.onIdle(); // Resolved when no queue is left
// await crawler.close(); // Close the crawler
let index = 0;
// return results;
// }
while (index < paths.length) {
const promises = paths
.slice(index, index + 50)
.map((path) => getLinksFromUrl(baseUrl, path));
const results = await Promise.all(promises);
for (const { html, links } of results) {
if (html !== "") {
yield {
url: url.toString(),
path: paths[index],
html: html,
};
}
for (let link of links) {
if (!paths.includes(link)) {
paths.push(link);
}
}
index++;
}
paths = paths.filter((path) =>
results.some(
(result) => result.html !== "" && result.links.includes(path),
),
);
}
}

View file

@ -140,3 +140,9 @@ export async function listDocs(): Promise<
const docs = db.all(`SELECT title, baseUrl FROM docs`);
return docs;
}
export async function hasDoc(baseUrl: string) {
const db = await getDBDocs();
const doc = await db.get(`SELECT title FROM docs WHERE baseUrl =?`, baseUrl);
return!!doc;
}

View file

@ -4,17 +4,16 @@ import {
IndexingProgressUpdate,
} from "../..";
import { crawlSubpages } from "./crawl";
import { addDocs, listDocs } from "./db";
import { urlToArticle, chunkArticle } from "./article";
import { crawlPage } from "./crawl";
import { addDocs, hasDoc } from "./db";
import { pageToArticle, chunkArticle, Article } from "./article";
export async function* indexDocs(
title: string,
baseUrl: URL,
embeddingsProvider: EmbeddingsProvider,
): AsyncGenerator<IndexingProgressUpdate> {
const existingDocs = await listDocs();
if (existingDocs.find((doc) => doc.baseUrl === baseUrl.toString())) {
if (await hasDoc(baseUrl.toString())) {
yield {
progress: 1,
desc: "Already indexed",
@ -27,36 +26,26 @@ export async function* indexDocs(
desc: "Finding subpages",
};
const subpathGenerator = crawlSubpages(baseUrl);
let { value, done } = await subpathGenerator.next();
while (true) {
if (done) {
break;
}
const articles: Article[] = [];
for await (const page of crawlPage(baseUrl)) {
const article = await pageToArticle(page);
if (!article) continue;
articles.push(article);
yield {
progress: 0,
desc: `Finding subpages (${value})`,
desc: `Finding subpages (${page.path})`,
};
const next = await subpathGenerator.next();
value = next.value;
done = next.done;
}
let subpaths = value as string[];
const chunks: Chunk[] = [];
const embeddings: number[][] = [];
let articles = await Promise.all(
subpaths.map(subpath => urlToArticle(subpath, baseUrl)),
);
for (const article of articles) {
if (!article) continue;
yield {
progress: Math.max(1, Math.floor(100 / (subpaths.length + 1))),
progress: Math.max(1, Math.floor(100 / (articles.length + 1))),
desc: `${article.subpath}`,
};

View file

@ -28,7 +28,7 @@ class EmbeddingsPipeline {
}
}
class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider {
export class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider {
static MaxGroupSize: number = 4;
constructor() {

View file

@ -22,11 +22,11 @@ import {
codellamaEditPrompt,
deepseekEditPrompt,
gemmaEditPrompt,
gptEditPrompt,
mistralEditPrompt,
neuralChatEditPrompt,
openchatEditPrompt,
phindEditPrompt,
simplestEditPrompt,
simplifiedEditPrompt,
xWinCoderEditPrompt,
zephyrEditPrompt,
@ -151,8 +151,9 @@ function autodetectTemplateType(model: string): TemplateType | undefined {
return "zephyr";
}
// Claude requests always sent through Messages API, so formatting not necessary
if (lower.includes("claude")) {
return "anthropic";
return "none";
}
if (lower.includes("alpaca") || lower.includes("wizard")) {
@ -255,7 +256,7 @@ function autodetectPromptTemplates(
} else if (templateType === "gemma") {
editTemplate = gemmaEditPrompt;
} else if (templateType) {
editTemplate = simplestEditPrompt;
editTemplate = gptEditPrompt;
}
if (editTemplate !== null) {

View file

@ -11,6 +11,7 @@ import {
RequestOptions,
TemplateType,
} from "..";
import { DevDataSqliteDb } from "../util/devdataSqlite";
import mergeJson from "../util/merge";
import { Telemetry } from "../util/posthog";
import {
@ -29,6 +30,7 @@ import {
compileChatMessages,
countTokens,
pruneRawPromptFromTop,
stripImages,
} from "./countTokens";
import CompletionOptionsForModels from "./templates/options";
@ -202,6 +204,7 @@ ${prompt}`;
provider: this.providerName,
tokens: tokens,
});
DevDataSqliteDb.logTokensGenerated(model, this.providerName, tokens);
}
_fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> =
@ -245,8 +248,13 @@ ${prompt}`;
}
private _formatChatMessages(messages: ChatMessage[]): string {
const msgsCopy = messages ? messages.map((msg) => ({ ...msg })) : [];
let formatted = "";
for (let msg of messages) {
for (let msg of msgsCopy) {
if ("content" in msg && Array.isArray(msg.content)) {
const content = stripImages(msg.content);
msg.content = content;
}
formatted += `<${msg.role}>\n${msg.content || ""}\n\n`;
}
return formatted;

View file

@ -5,6 +5,7 @@ import {
LLMOptions,
ModelProvider,
} from "../..";
import { stripImages } from "../countTokens";
import { streamSse } from "../stream";
class Anthropic extends BaseLLM {
@ -65,6 +66,16 @@ class Anthropic extends BaseLLM {
return messages;
}
protected async *_streamComplete(
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
const messages = [{ role: "user" as const, content: prompt }];
for await (const update of this._streamChat(messages, options)) {
yield stripImages(update.content);
}
}
protected async *_streamChat(
messages: ChatMessage[],
options: CompletionOptions,

View file

@ -3,7 +3,7 @@ import { ChatMessage, CompletionOptions, ModelProvider } from "../..";
import { streamResponse } from "../stream";
// const SERVER_URL = "http://localhost:3000";
const SERVER_URL = "https://node-proxy-server-green-l6vsfbzhba-uw.a.run.app";
const SERVER_URL = "https://node-proxy-server-blue-l6vsfbzhba-uw.a.run.app";
class FreeTrial extends BaseLLM {
static providerName: ModelProvider = "free-trial";

View file

@ -21,7 +21,7 @@ class Ollama extends BaseLLM {
if (options.model === "AUTODETECT") {
return;
}
this.fetch(new URL("api/show", this.apiBase), {
this.fetch(this.getEndpoint("api/show"), {
method: "POST",
headers: {},
body: JSON.stringify({ name: this._getModel() }),
@ -137,11 +137,20 @@ class Ollama extends BaseLLM {
return finalOptions;
}
private getEndpoint(endpoint: string): URL {
let base = this.apiBase;
if (process.env.IS_BINARY) {
base = base?.replace("localhost", "127.0.0.1");
}
return new URL(endpoint, base);
}
protected async *_streamComplete(
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
const response = await this.fetch(new URL("api/generate", this.apiBase), {
const response = await this.fetch(this.getEndpoint("api/generate"), {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -180,7 +189,7 @@ class Ollama extends BaseLLM {
messages: ChatMessage[],
options: CompletionOptions,
): AsyncGenerator<ChatMessage> {
const response = await this.fetch(new URL("api/chat", this.apiBase), {
const response = await this.fetch(this.getEndpoint("api/chat"), {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -220,7 +229,7 @@ class Ollama extends BaseLLM {
async listModels(): Promise<string[]> {
const response = await this.fetch(
// localhost was causing fetch failed in pkg binary only for this Ollama endpoint
new URL("api/tags", this.apiBase?.replace("localhost", "127.0.0.1")),
this.getEndpoint("api/tags"),
{
method: "GET",
},

View file

@ -50,11 +50,14 @@ class OpenAI extends BaseLLM {
}
const parts = message.content.map((part) => {
return {
const msg: any = {
type: part.type,
text: part.text,
image_url: { ...part.imageUrl, detail: "low" },
};
if (part.type === "imageUrl") {
msg.image_url = { ...part.imageUrl, detail: "low" };
}
return msg;
});
return {
...message,
@ -71,10 +74,11 @@ class OpenAI extends BaseLLM {
top_p: options.topP,
frequency_penalty: options.frequencyPenalty,
presence_penalty: options.presencePenalty,
// Jan doesn't truncate and will throw an error
stop: this.apiBase?.includes(":1337")
? options.stop?.slice(0, 4)
: options.stop,
stop:
// Jan + Azure OpenAI don't truncate and will throw an error
this.apiBase?.includes(":1337") || this.apiType === "azure"
? options.stop?.slice(0, 4)
: options.stop,
};
return finalOptions;

2255
core/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "core",
"version": "1.0.0",
"name": "@continuedev/core",
"version": "1.0.1",
"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": "jest ./test/diff.test.ts"
@ -58,5 +58,9 @@
},
"puppeteer": {
"chromium_revision": "119.0.6045.105"
},
"engine-strict": true,
"engines": {
"node": ">=20.11.0"
}
}

View file

@ -10,6 +10,7 @@ import {
SerializedContinueConfig,
SessionInfo,
} from ".";
import { AutocompleteInput } from "./autocomplete/completionProvider";
import { IdeProtocol } from "./web/webviewProtocol";
export type ProtocolGeneratorType<T> = AsyncGenerator<{
@ -56,10 +57,9 @@ export type Protocol = {
Promise<ContextSubmenuItem[]>,
];
"context/addDocs": [{ title: string; url: string }, void];
"autocomplete/complete": [
{ filepath: string; line: number; column: number },
string[],
];
"autocomplete/complete": [AutocompleteInput, Promise<string[]>];
"autocomplete/cancel": [undefined, void];
"autocomplete/accept": [{ completionId: string }, void];
"command/run": [
{
input: string;

View file

@ -1,34 +0,0 @@
import { open } from "sqlite";
import sqlite3 from "sqlite3";
async function test() {
const db = await open({
filename:
"/Users/natesesti/Library/Application Support/Code - Insiders/User/globalStorage/state.vscdb",
driver: sqlite3.Database,
});
const rows = await db.all(
"SELECT * FROM ItemTable WHERE key = 'workbench.auxiliarybar.pinnedPanels'"
);
const pinnedPanels = rows[0].value === "" ? [] : JSON.parse(rows[0].value);
if (
!pinnedPanels.find(
(panel: any) => panel.id === "workbench.view.extension.continue"
)
) {
pinnedPanels.push({
id: "workbench.view.extension.continue",
pinned: true,
order: 15,
});
await db.run(
`UPDATE ItemTable SET value = ? WHERE key = 'workbench.auxiliarybar.pinnedPanels'`,
JSON.stringify(pinnedPanels)
);
}
}
export default test;

View file

@ -0,0 +1,73 @@
import fs from "fs";
import { DatabaseConnection } from "../indexing/refreshIndex";
import { getDevDataSqlitePath } from "./paths";
export class DevDataSqliteDb {
static db: DatabaseConnection | null = null;
private static async createTables(db: DatabaseConnection) {
await db.exec(
`CREATE TABLE IF NOT EXISTS tokens_generated (
id INTEGER PRIMARY KEY AUTOINCREMENT,
model TEXT NOT NULL,
provider TEXT NOT NULL,
tokens_generated INTEGER NOT NULL,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
)`,
);
}
public static async logTokensGenerated(
model: string,
provider: string,
tokens: number,
) {
const db = await DevDataSqliteDb.get();
await db?.run(
`INSERT INTO tokens_generated (model, provider, tokens_generated) VALUES (?, ?, ?)`,
[model, provider, tokens],
);
}
public static async getTokensPerDay() {
const db = await DevDataSqliteDb.get();
// Return a sum of tokens_generated column aggregated by day
const result = await db?.all(
`SELECT date(timestamp) as day, sum(tokens_generated) as tokens
FROM tokens_generated
GROUP BY date(timestamp)`,
// WHERE model = ? AND provider = ?
// [model, provider],
);
return result ?? [];
}
public static async getTokensPerModel() {
const db = await DevDataSqliteDb.get();
// Return a sum of tokens_generated column aggregated by model
const result = await db?.all(
`SELECT model, sum(tokens_generated) as tokens
FROM tokens_generated
GROUP BY model`,
);
return result ?? [];
}
static async get() {
const devDataSqlitePath = getDevDataSqlitePath();
if (DevDataSqliteDb.db && fs.existsSync(devDataSqlitePath)) {
return DevDataSqliteDb.db;
}
const { open } = require("sqlite");
const sqlite3 = require("sqlite3");
DevDataSqliteDb.db = await open({
filename: devDataSqlitePath,
driver: sqlite3.Database,
});
await DevDataSqliteDb.createTables(DevDataSqliteDb.db!);
return DevDataSqliteDb.db;
}
}

View file

@ -1,5 +1,5 @@
import * as fs from "fs";
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range } from "..";
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from "..";
import { getContinueGlobalPath } from "./paths";
@ -37,10 +37,22 @@ class FileSystemIde implements IDE {
getTerminalContents(): Promise<string> {
return Promise.resolve("");
}
async getDebugLocals(threadIndex: number): Promise<string> {
return Promise.resolve("");
}
async getTopLevelCallStackSources(
threadIndex: number,
stackDepth: number
): Promise<string[]> {
return Promise.resolve([]);
}
async getAvailableThreads(): Promise<Thread[]> {
return Promise.resolve([]);
}
showLines(
filepath: string,
startLine: number,
endLine: number,
endLine: number
): Promise<void> {
return Promise.resolve();
}
@ -105,7 +117,7 @@ class FileSystemIde implements IDE {
showDiff(
filepath: string,
newContents: string,
stepIndex: number,
stepIndex: number
): Promise<void> {
return Promise.resolve();
}

View file

@ -1,9 +1,24 @@
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range } from "..";
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from "..";
export class MessageIde implements IDE {
constructor(
private readonly request: (messageType: string, data: any) => Promise<any>,
private readonly request: (messageType: string, data: any) => Promise<any>
) {}
getDebugLocals(threadIndex: number): Promise<string> {
return this.request("getDebugLocals", { threadIndex });
}
getTopLevelCallStackSources(
threadIndex: number,
stackDepth: number
): Promise<string[]> {
return this.request("getTopLevelCallStackSources", {
threadIndex,
stackDepth,
});
}
getAvailableThreads(): Promise<Thread[]> {
return this.request("getAvailableThreads", undefined);
}
getTags(artifactId: string): Promise<IndexTag[]> {
return this.request("getTags", artifactId);
}
@ -48,7 +63,7 @@ export class MessageIde implements IDE {
async showLines(
filepath: string,
startLine: number,
endLine: number,
endLine: number
): Promise<void> {
return await this.request("showLines", { filepath, startLine, endLine });
}
@ -93,7 +108,7 @@ export class MessageIde implements IDE {
async showDiff(
filepath: string,
newContents: string,
stepIndex: number,
stepIndex: number
): Promise<void> {
await this.request("showDiff", { filepath, newContents, stepIndex });
}

View file

@ -138,6 +138,10 @@ export function devDataPath(): string {
return sPath;
}
export function getDevDataSqlitePath(): string {
return path.join(devDataPath(), "devdata.sqlite");
}
export function getDevDataFilePath(fileName: string): string {
return path.join(devDataPath(), fileName + ".jsonl");
}

25
core/util/ranges.ts Normal file
View file

@ -0,0 +1,25 @@
import { Range } from "..";
export function getRangeInString(content: string, range: Range): string {
const lines = content.split("\n");
if (range.start.line === range.end.line) {
return (
lines[range.start.line]?.substring(
range.start.character,
range.end.character + 1,
) ?? ""
);
}
const firstLine =
lines[range.start.line]?.substring(
range.start.character,
lines[range.start.line].length,
) ?? "";
const middleLines = lines.slice(range.start.line + 1, range.end.line);
const lastLine =
lines[range.end.line]?.substring(0, range.end.character) ?? "";
return [firstLine, ...middleLines, lastLine].join("\n");
}

View file

@ -8,6 +8,14 @@ export const supportedLanguages: { [key: string]: string } = {
cc: "cpp",
cxx: "cpp",
hxx: "cpp",
cp: "cpp",
hh: "cpp",
inc: "cpp",
// Depended on this PR: https://github.com/tree-sitter/tree-sitter-cpp/pull/173
// ccm: "cpp",
// c++m: "cpp",
// cppm: "cpp",
// cxxm: "cpp",
cs: "c_sharp",
c: "c",
h: "c",
@ -69,6 +77,9 @@ export const supportedLanguages: { [key: string]: string } = {
};
export async function getParserForFile(filepath: string) {
if (process.env.IS_BINARY) {
return undefined;
}
try {
await Parser.init();
const parser = new Parser();

View file

@ -10,5 +10,9 @@
"license": "Apache-2.0",
"dependencies": {
"@xenova/transformers": "^2.14.0"
},
"engine-strict": true,
"engines": {
"node": ">=20.11.0"
}
}

View file

@ -1,10 +1,12 @@
import {
ContextItemWithId,
ContextSubmenuItem,
ContinueRcJson,
DiffLine,
IndexTag,
Problem,
Range,
Thread,
} from "..";
import { RangeInFileWithContents } from "../commands/util";
@ -45,6 +47,12 @@ export type IdeProtocol = {
getDiff: [undefined, string];
getWorkspaceConfigs: [undefined, ContinueRcJson[]];
getTerminalContents: [undefined, string];
getDebugLocals: [{ threadIndex: Number }, string];
getTopLevelCallStackSources: [
{ threadIndex: number; stackDepth: number },
string[],
];
getAvailableThreads: [undefined, Thread[]];
isTelemetryEnabled: [undefined, boolean];
getUniqueId: [undefined, string];
getTags: [string, IndexTag[]];
@ -75,6 +83,8 @@ export type WebviewProtocol = Protocol &
reloadWindow: [undefined, void];
focusEditor: [undefined, void];
toggleFullScreen: [undefined, void];
"stats/getTokensPerDay": [undefined, { day: string; tokens: number }[]];
"stats/getTokensPerModel": [undefined, { model: string; tokens: number }[]];
};
export type ReverseWebviewProtocol = {
@ -88,6 +98,10 @@ export type ReverseWebviewProtocol = {
},
void,
];
updateSubmenuItems: [
{ provider: string; submenuItems: ContextSubmenuItem[] },
void,
];
getDefaultModelTitle: [undefined, string];
newSessionWithPrompt: [{ prompt: string }, void];
userInput: [{ input: string }, void];

File diff suppressed because it is too large Load diff

View file

@ -120,6 +120,41 @@ Type '@issue' to reference the conversation in a GitHub issue. Make sure to incl
}
```
### 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).
@ -231,6 +266,19 @@ Type `@database` to reference table schemas you can use the drop-down or start t
}
```
### 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
}
}
```
### 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.

View file

@ -40,7 +40,8 @@
"last 1 safari version"
]
},
"engine-strict": true,
"engines": {
"node": ">=16.14"
"node": ">=20.11.0"
}
}

View file

@ -427,6 +427,9 @@
"gpt-4-vision-preview",
"codellama-70b",
"mistral-8x7b",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"AUTODETECT"
]
}
@ -514,6 +517,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1"
]
},
@ -862,6 +866,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1",
"chat-bison-001",
"gemini-pro",
@ -1043,6 +1048,7 @@
"enum": [
"diff",
"terminal",
"locals",
"open",
"google",
"search",
@ -1056,7 +1062,8 @@
"highlights",
"outline",
"postgres",
"code"
"code",
"system"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1076,7 +1083,8 @@
"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 specific functions and classes from throughout your codebase",
"Reference your operating system and cpu"
],
"type": "string"
},
@ -1244,6 +1252,37 @@
"required": ["connections"]
}
},
{
"if": {
"properties": {
"name": {
"enum": ["gitlab-mr"]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"domain": {
"type": "string",
"description": "Your GitLab domain, will default to gitlab.com"
},
"token": {
"type": "string",
"description": "Your private access token."
},
"filterComments": {
"type": "boolean",
"description": "If you have code selected, filters out comments that aren't related to the selection."
}
},
"required": ["token"]
}
},
"required": ["params"]
}
},
{
"if": {
"properties": {

View file

@ -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.37
pluginVersion = 0.0.38
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223

View file

@ -29,7 +29,6 @@ import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Paths
import javax.swing.*
import com.intellij.openapi.application.PathManager;
import com.intellij.ide.plugins.PluginManager
import com.intellij.openapi.extensions.PluginId
@ -176,7 +175,9 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
ApplicationManager.getApplication().messageBus.connect().subscribe(SettingsListener.TOPIC, object : SettingsListener {
// Listen to changes to settings so the core can reload remote configuration
val connection = ApplicationManager.getApplication().messageBus.connect()
connection.subscribe(SettingsListener.TOPIC, object : SettingsListener {
override fun settingsUpdated(settings: ContinueExtensionSettings.ContinueState) {
continuePluginService.coreMessenger?.request("config/ideSettingsUpdate", settings, null) { _ -> }
}

View file

@ -0,0 +1,25 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.actionSystem.EditorAction
import com.intellij.openapi.editor.actionSystem.EditorActionHandler
class AcceptAutocompleteAction: EditorAction(object : EditorActionHandler() {
override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) {
ApplicationManager.getApplication().runWriteAction {
editor.project?.service<AutocompleteService>()?.accept()
}
}
override fun isEnabledForCaret(editor: Editor, caret: Caret, dataContext: DataContext?): Boolean {
val autocompleteService = editor.project?.service<AutocompleteService>();
val enabled = editor == autocompleteService?.pendingCompletion?.editor
&& caret.offset == autocompleteService.pendingCompletion?.offset
&& autocompleteService.pendingCompletion?.text != null
return enabled
}
}) {}

View file

@ -0,0 +1,77 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.event.*
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
import com.intellij.openapi.fileEditor.FileEditorManagerListener
import com.intellij.openapi.util.TextRange
class AutocompleteCaretListener: CaretListener {
override fun caretPositionChanged(event: CaretEvent) {
val caret = event.caret ?: return
val oldPosition = event.oldPosition
val offset = caret.offset
val editor = caret.editor
val autocompleteService = editor.project?.service<AutocompleteService>() ?: return
val pending = autocompleteService.pendingCompletion;
if (pending != null && pending.editor == editor && pending.offset == offset) {
return
}
autocompleteService.clearCompletions(editor)
}
}
class AutocompleteDocumentListener(private val editorManager: FileEditorManager, private val editor: Editor): DocumentListener {
override fun documentChanged(event: DocumentEvent) {
if (editor != editorManager.selectedTextEditor) {
return
}
// Invoke later is important, otherwise the completion will be triggered before the document is updated
// causing the old caret offset to be used
invokeLater {
editor.project?.service<AutocompleteService>()?.triggerCompletion(editor)
}
}
}
class AutocompleteEditorListener: EditorFactoryListener {
private val disposables = mutableMapOf<Editor, () -> Unit>()
override fun editorCreated(event: EditorFactoryEvent) {
val editor = event.editor
val project = editor.project ?: return
val editorManager = project.let { FileEditorManager.getInstance(it) }
val completionProvider = project.service<AutocompleteService>()
// Listen to changes to mouse position
val caretListener = AutocompleteCaretListener()
editor.caretModel.addCaretListener(caretListener)
// Listen to changes to selection
val connection = editor.project?.messageBus?.connect()
connection?.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, object : FileEditorManagerListener {
override fun selectionChanged(event: FileEditorManagerEvent) {
completionProvider.clearCompletions(editor)
}
})
// Listen to changes to content
val documentListener = AutocompleteDocumentListener(editorManager, editor)
editor.document.addDocumentListener(documentListener)
disposables[editor] = {
editor.caretModel.removeCaretListener(caretListener)
connection?.disconnect()
editor.document.removeDocumentListener(documentListener)
}
}
override fun editorReleased(event: EditorFactoryEvent) {
val editor = event.editor
val disposable = disposables[editor]
disposable?.invoke()
disposables.remove(editor)
}
}

View file

@ -0,0 +1,119 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.github.continuedev.continueintellijextension.`continue`.uuid
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.google.gson.Gson
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.InlayProperties
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
data class PendingCompletion (
val editor: Editor,
val offset: Int,
val completionId: String,
val text: String?
)
@Service(Service.Level.PROJECT)
class AutocompleteService(private val project: Project) {
var pendingCompletion: PendingCompletion? = null;
fun triggerCompletion(editor: Editor) {
val settings =
ServiceManager.getService(ContinueExtensionSettings::class.java)
if (!settings.continueState.enableTabAutocomplete) {
return
}
if (pendingCompletion != null) {
clearCompletions(pendingCompletion!!.editor)
}
// Set pending completion
val completionId = uuid()
val offset = editor.caretModel.primaryCaret.offset
pendingCompletion = PendingCompletion(editor, offset, completionId, null)
// Request a completion from the core
val virtualFile = FileDocumentManager.getInstance().getFile(editor.document)
val input = mapOf(
"completionId" to completionId,
"filepath" to virtualFile?.path,
"pos" to mapOf(
"line" to editor.caretModel.primaryCaret.logicalPosition.line,
"character" to editor.caretModel.primaryCaret.logicalPosition.column
),
"recentlyEditedFiles" to emptyList<String>(),
"recentlyEditedRanges" to emptyList<String>(),
"clipboardText" to ""
)
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/complete", input, null, ({ response ->
val completions = Gson().fromJson(response, List::class.java)
if (completions.isNotEmpty()) {
val completion = completions[0].toString()
renderCompletion(editor, offset, completion)
pendingCompletion = pendingCompletion?.copy(text = completion)
}
}))
}
private fun renderCompletion(editor: Editor, offset: Int, text: String) {
ApplicationManager.getApplication().invokeLater {
WriteAction.run<Throwable> {
val properties = InlayProperties()
properties.relatesToPrecedingText(true)
properties.disableSoftWrapping(true)
if (text.lines().size > 1) {
editor.inlayModel.addBlockElement(offset, properties, ContinueMultilineCustomElementRenderer(editor, text))
} else {
editor.inlayModel.addInlineElement(offset, properties, ContinueCustomElementRenderer(editor, text))
}
}
}
}
fun accept() {
val completion = pendingCompletion ?: return
val text = completion.text ?: return
val editor = completion.editor
val offset = completion.offset
editor.document.insertString(offset, text)
editor.caretModel.moveToOffset(offset + text.length)
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/accept", completion.completionId, null, ({}))
invokeLater {
clearCompletions(editor)
}
}
private fun cancelCompletion(completion: PendingCompletion) {
// Send cancellation message to core
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/cancel", null,null, ({}))
}
fun clearCompletions(editor: Editor) {
if (pendingCompletion != null) {
cancelCompletion(pendingCompletion!!)
pendingCompletion = null
}
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()
}
}
}
}

View file

@ -0,0 +1,21 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.actionSystem.EditorAction
import com.intellij.openapi.editor.actionSystem.EditorActionHandler
class CancelAutocompleteAction: EditorAction(object : EditorActionHandler() {
override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) {
ApplicationManager.getApplication().runWriteAction {
editor.project?.service<AutocompleteService>()?.clearCompletions(editor)
}
}
override fun isEnabledForCaret(editor: Editor, caret: Caret, dataContext: DataContext?): Boolean {
return true
}
}) {}

View file

@ -0,0 +1,46 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorCustomElementRenderer
import com.intellij.openapi.editor.Inlay
import com.intellij.openapi.editor.colors.EditorFontType
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.editor.impl.FontInfo
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.ui.Gray
import com.intellij.ui.JBColor
import java.awt.Color
import java.awt.Font
import java.awt.Graphics
import java.awt.Rectangle
import kotlin.math.ceil
class ContinueCustomElementRenderer (
val editor: Editor,
val text: String,
) : EditorCustomElementRenderer {
override fun calcWidthInPixels(inlay: Inlay<*>): Int {
return (inlay.editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(this.text)
}
protected val font: Font
get() {
val editorFont = editor.colorsScheme.getFont(EditorFontType.PLAIN)
return editorFont.deriveFont(Font.ITALIC) ?: editorFont
}
private fun offsetY(): Int {
val metrics =
FontInfo.getFontMetrics(font, FontInfo.getFontRenderContext(editor.contentComponent))
val fontHeight =
font.createGlyphVector(metrics.fontRenderContext, text).visualBounds.height
val height = (editor.lineHeight + fontHeight) / 2
return ceil(height).toInt()
}
override fun paint(inlay: Inlay<*>, g: Graphics, targetRegion: Rectangle, textAttributes: TextAttributes) {
g.color = JBColor.GRAY
g.font = font
g.drawString(this.text, targetRegion.x, targetRegion.y + offsetY())
}
}

View file

@ -0,0 +1,76 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorCustomElementRenderer
import com.intellij.openapi.editor.Inlay
import com.intellij.openapi.editor.colors.EditorFontType
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.editor.impl.FontInfo
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.ui.Gray
import com.intellij.ui.JBColor
import java.awt.Color
import java.awt.Font
import java.awt.Graphics
import java.awt.Rectangle
import kotlin.math.ceil
import kotlin.math.max
class ContinueMultilineCustomElementRenderer (
val editor: Editor,
val text: String,
) : EditorCustomElementRenderer {
override fun calcWidthInPixels(inlay: Inlay<*>): Int {
val lines = text.lines()
var maxLen = 0;
for (line in lines) {
val len = (inlay.editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(line)
if (len > maxLen) {
maxLen = len
}
}
return maxLen
}
override fun calcHeightInPixels(inlay: Inlay<*>): Int {
return (inlay.editor as EditorImpl).lineHeight * text.lines().size
}
protected val font: Font
get() {
val editorFont = editor.colorsScheme.getFont(EditorFontType.PLAIN)
return editorFont.deriveFont(Font.ITALIC) ?: editorFont
}
private fun offsetY(): Int {
val metrics =
FontInfo.getFontMetrics(font, FontInfo.getFontRenderContext(editor.contentComponent))
val fontHeight =
font.createGlyphVector(metrics.fontRenderContext, text).visualBounds.height
val height = (editor.lineHeight + fontHeight) / 2
return ceil(height).toInt()
}
private fun offsetX(): Int {
val currentLine = editor.caretModel.primaryCaret.logicalPosition.line
val currentColumn = editor.caretModel.primaryCaret.logicalPosition.column
val metrics =
FontInfo.getFontMetrics(font, FontInfo.getFontRenderContext(editor.contentComponent))
val fontWidth =
font.createGlyphVector(metrics.fontRenderContext, text).visualBounds.width
val widthBeforeCaret = (editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(text.substring(0, currentColumn))
return max(0, widthBeforeCaret - (editor as EditorImpl).scrollingModel.horizontalScrollOffset)
}
override fun paint(inlay: Inlay<*>, g: Graphics, targetRegion: Rectangle, textAttributes: TextAttributes) {
g.color = JBColor.GRAY
g.font = font
var additionalYOffset = -editor.lineHeight;
var isFirstLine = true
for (line in text.lines()) {
g.drawString(line, if (isFirstLine) targetRegion.x + offsetX() else targetRegion.x, targetRegion.y + offsetY() + additionalYOffset)
additionalYOffset += editor.lineHeight
isFirstLine = false
}
}
}

View file

@ -140,6 +140,7 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl
// Start the subprocess
val processBuilder = ProcessBuilder(continueCorePath)
.directory(File(continueCorePath).parentFile)
process = processBuilder.start()
val outputStream = process.outputStream
@ -149,7 +150,8 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl
reader = BufferedReader(InputStreamReader(inputStream))
process.onExit().thenRun {
val err = process.errorStream.bufferedReader().readText()
val err = process.errorStream.bufferedReader().readText().trim()
println("Core process exited with output: $err")
ideProtocolClient.showMessage("Core process exited with output: $err")
}
@ -158,7 +160,12 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl
while (true) {
val line = reader.readLine()
if (line != null && line.isNotEmpty()) {
handleMessage(line)
try {
handleMessage(line)
} catch (e: Exception) {
println("Error handling message: $line")
println(e)
}
} else {
Thread.sleep(100)
}

View file

@ -526,6 +526,18 @@ class IdeProtocolClient (
fun readFile(filepath: String): String {
try {
val content = ApplicationManager.getApplication().runReadAction<String?> {
val virtualFile = LocalFileSystem.getInstance().findFileByPath(filepath)
if (virtualFile != null && FileDocumentManager.getInstance().isFileModified(virtualFile)) {
return@runReadAction FileDocumentManager.getInstance().getDocument(virtualFile)?.text
}
return@runReadAction null
}
if (content != null) {
return content
}
val file = File(filepath)
if (!file.exists()) return ""

View file

@ -21,6 +21,7 @@ class ContinueSettingsComponent: DumbAware {
val remoteConfigServerUrl: JTextField = JTextField()
val remoteConfigSyncPeriod: JTextField = JTextField()
val userToken: JTextField = JTextField()
val enableTabAutocomplete: JCheckBox = JCheckBox("Enable Tab Autocomplete")
init {
val constraints = GridBagConstraints()
@ -44,6 +45,8 @@ class ContinueSettingsComponent: DumbAware {
constraints.gridy++
panel.add(userToken, constraints)
constraints.gridy++
panel.add(enableTabAutocomplete, constraints)
constraints.gridy++
// Add a "filler" component that takes up all remaining vertical space
constraints.weighty = 1.0
@ -63,6 +66,7 @@ open class ContinueExtensionSettings : PersistentStateComponent<ContinueExtensio
var remoteConfigServerUrl: String? = null
var remoteConfigSyncPeriod: Int = 60
var userToken: String? = null
var enableTabAutocomplete: Boolean = false
}
var continueState: ContinueState = ContinueState()
@ -101,7 +105,8 @@ class ContinueExtensionConfigurable : Configurable {
val settings = ContinueExtensionSettings.instance
val modified = mySettingsComponent?.remoteConfigServerUrl?.text != settings.continueState.remoteConfigServerUrl ||
mySettingsComponent?.remoteConfigSyncPeriod?.text?.toInt() != settings.continueState.remoteConfigSyncPeriod ||
mySettingsComponent?.userToken?.text != settings.continueState.userToken
mySettingsComponent?.userToken?.text != settings.continueState.userToken ||
mySettingsComponent?.enableTabAutocomplete?.isSelected != settings.continueState.enableTabAutocomplete
return modified;
}
@ -110,6 +115,7 @@ class ContinueExtensionConfigurable : Configurable {
settings.continueState.remoteConfigServerUrl = mySettingsComponent?.remoteConfigServerUrl?.text
settings.continueState.remoteConfigSyncPeriod = mySettingsComponent?.remoteConfigSyncPeriod?.text?.toInt() ?: 60
settings.continueState.userToken = mySettingsComponent?.userToken?.text
settings.continueState.enableTabAutocomplete = mySettingsComponent?.enableTabAutocomplete?.isSelected ?: false
ApplicationManager.getApplication().messageBus.syncPublisher(SettingsListener.TOPIC).settingsUpdated(settings.continueState)
}
@ -119,6 +125,7 @@ class ContinueExtensionConfigurable : Configurable {
mySettingsComponent?.remoteConfigServerUrl?.text = settings.continueState.remoteConfigServerUrl
mySettingsComponent?.remoteConfigSyncPeriod?.text = settings.continueState.remoteConfigSyncPeriod.toString()
mySettingsComponent?.userToken?.text = settings.continueState.userToken
mySettingsComponent?.enableTabAutocomplete?.isSelected = settings.continueState.enableTabAutocomplete
}
override fun disposeUIResources() {

View file

@ -77,6 +77,7 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
init {
System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE)
System.setProperty("ide.browser.jcef.osr.enabled", "false")
System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
}
val webView: JBCefBrowser by lazy {

View file

@ -11,6 +11,7 @@
</extensions>
<extensions defaultExtensionNs="com.intellij">
<editorFactoryListener implementation="com.github.continuedev.continueintellijextension.autocomplete.AutocompleteEditorListener"/>
<toolWindow id="Continue" anchor="right" icon="/tool-window-icon.png"
factoryClass="com.github.continuedev.continueintellijextension.toolWindow.ContinuePluginToolWindowFactory"/>
<projectService id="ContinuePluginService"
@ -114,6 +115,17 @@
<reference ref="continue.viewHistory"/>
</group>
<action id="com.github.continuedev.continueintellijextension.autocomplete.AcceptAutocompleteAction"
class="com.github.continuedev.continueintellijextension.autocomplete.AcceptAutocompleteAction"
text="Accept Autocomplete Suggestion" description="Accept Autocomplete Suggestion">
<keyboard-shortcut keymap="$default" first-keystroke="TAB"/>
<keyboard-shortcut keymap="Mac OS X" first-keystroke="TAB"/>
</action>
<action id="com.github.continuedev.continueintellijextension.autocomplete.CancelAutocompleteAction"
class="com.github.continuedev.continueintellijextension.autocomplete.CancelAutocompleteAction"
text="Cancel Autocomplete Suggestion" description="Cancel Autocomplete Suggestion">
<keyboard-shortcut keymap="$default" first-keystroke="ESCAPE"/>
</action>
</actions>

View file

@ -427,6 +427,9 @@
"gpt-4-vision-preview",
"codellama-70b",
"mistral-8x7b",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"AUTODETECT"
]
}
@ -514,6 +517,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1"
]
},
@ -862,6 +866,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1",
"chat-bison-001",
"gemini-pro",
@ -1043,6 +1048,7 @@
"enum": [
"diff",
"terminal",
"locals",
"open",
"google",
"search",
@ -1056,7 +1062,8 @@
"highlights",
"outline",
"postgres",
"code"
"code",
"system"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1076,7 +1083,8 @@
"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 specific functions and classes from throughout your codebase",
"Reference your operating system and cpu"
],
"type": "string"
},
@ -1244,6 +1252,37 @@
"required": ["connections"]
}
},
{
"if": {
"properties": {
"name": {
"enum": ["gitlab-mr"]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"domain": {
"type": "string",
"description": "Your GitLab domain, will default to gitlab.com"
},
"token": {
"type": "string",
"description": "Your private access token."
},
"filterComments": {
"type": "boolean",
"description": "If you have code selected, filters out comments that aren't related to the selection."
}
},
"required": ["token"]
}
},
"required": ["params"]
}
},
{
"if": {
"properties": {

View file

@ -427,6 +427,9 @@
"gpt-4-vision-preview",
"codellama-70b",
"mistral-8x7b",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"AUTODETECT"
]
}
@ -514,6 +517,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1"
]
},
@ -862,6 +866,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1",
"chat-bison-001",
"gemini-pro",
@ -1043,6 +1048,7 @@
"enum": [
"diff",
"terminal",
"locals",
"open",
"google",
"search",
@ -1056,7 +1062,8 @@
"highlights",
"outline",
"postgres",
"code"
"code",
"system"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1076,7 +1083,8 @@
"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 specific functions and classes from throughout your codebase",
"Reference your operating system and cpu"
],
"type": "string"
},
@ -1244,6 +1252,37 @@
"required": ["connections"]
}
},
{
"if": {
"properties": {
"name": {
"enum": ["gitlab-mr"]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"domain": {
"type": "string",
"description": "Your GitLab domain, will default to gitlab.com"
},
"token": {
"type": "string",
"description": "Your private access token."
},
"filterComments": {
"type": "boolean",
"description": "If you have code selected, filters out comments that aren't related to the selection."
}
},
"required": ["token"]
}
},
"required": ["params"]
}
},
{
"if": {
"properties": {

View file

@ -463,6 +463,9 @@
"gpt-4-vision-preview",
"codellama-70b",
"mistral-8x7b",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"AUTODETECT"
]
}
@ -558,6 +561,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1"
]
},
@ -961,6 +965,7 @@
"claude-instant-1",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-2.1",
"chat-bison-001",
"gemini-pro",
@ -1159,6 +1164,7 @@
"enum": [
"diff",
"terminal",
"locals",
"open",
"google",
"search",
@ -1172,7 +1178,8 @@
"highlights",
"outline",
"postgres",
"code"
"code",
"system"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1192,7 +1199,8 @@
"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 specific functions and classes from throughout your codebase",
"Reference your operating system and cpu"
],
"type": "string"
},
@ -1393,6 +1401,43 @@
]
}
},
{
"if": {
"properties": {
"name": {
"enum": [
"gitlab-mr"
]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"domain": {
"type": "string",
"description": "Your GitLab domain, will default to gitlab.com"
},
"token": {
"type": "string",
"description": "Your private access token."
},
"filterComments": {
"type": "boolean",
"description": "If you have code selected, filters out comments that aren't related to the selection."
}
},
"required": [
"token"
]
}
},
"required": [
"params"
]
}
},
{
"if": {
"properties": {

View file

@ -1,29 +0,0 @@
# Example Ruby File
# Define a class called ExpertProgrammer
class ExpertProgrammer
# Define a method called rewrite_code
def rewrite_code(code)
# Remove any empty lines from the code
code = code.gsub(/^\s*\n/, '')
# Remove any leading or trailing whitespace from each line
code = code.lines.map(&:strip).join("\n")
# Output the rewritten code
code
end
end
# Create an instance of ExpertProgrammer
programmer = ExpertProgrammer.new
# Example usage
original_code = <<~CODE
def hello_world
puts "Hello, World!"
end
CODE
rewritten_code = programmer.rewrite_code(original_code)
puts rewritten_code

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.8.18",
"version": "0.9.88",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.8.18",
"version": "0.9.88",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
@ -80,11 +80,13 @@
"vsce": "^2.15.0"
},
"engines": {
"node": ">=20.11.0",
"vscode": "^1.70.0"
}
},
"../../core": {
"version": "1.0.0",
"name": "@continuedev/core",
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
"@mozilla/readability": "^0.5.0",
@ -134,6 +136,9 @@
"esbuild": "^0.19.11",
"jest": "^29.7.0",
"ts-jest": "^29.1.1"
},
"engines": {
"node": ">=20.11.0"
}
},
"node_modules/@75lb/deep-merge": {

View file

@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.8.18",
"version": "0.9.88",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@ -22,8 +22,10 @@
"description": "Open-source autopilot for software development - bring the power of ChatGPT to your IDE",
"publisher": "Continue",
"engines": {
"vscode": "^1.70.0"
"vscode": "^1.70.0",
"node": ">=20.11.0"
},
"engine-strict": true,
"galleryBanner": {
"color": "#1E1E1E",
"theme": "dark"

View file

@ -317,7 +317,13 @@ if (args[2] === "--target") {
});
// Copy node_modules for pre-built binaries
const NODE_MODULES_TO_COPY = ["esbuild", "@esbuild", "@lancedb", "jsdom"];
const NODE_MODULES_TO_COPY = [
"esbuild",
"@esbuild",
"@lancedb",
"@vscode",
"jsdom",
];
fs.mkdirSync("out/node_modules", { recursive: true });
await Promise.all(

View file

@ -1,50 +1,47 @@
import { IDE } from "core";
import AutocompleteLruCache from "core/autocomplete/cache";
import { DEFAULT_AUTOCOMPLETE_OPTS } from "core/autocomplete/parameters";
import { GeneratorReuseManager } from "core/autocomplete/util";
import {
AutocompleteInput,
CompletionProvider,
} from "core/autocomplete/completionProvider";
import { ConfigHandler } from "core/config/handler";
import { logDevData } from "core/util/devdata";
import { Telemetry } from "core/util/posthog";
import { v4 as uuidv4 } from "uuid";
import * as vscode from "vscode";
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
import { getTabCompletion } from "./getTabCompletion";
import { stopStatusBarLoading } from "./statusBar";
import { getDefinitionsFromLsp } from "./lsp";
import { setupStatusBar, stopStatusBarLoading } from "./statusBar";
export class ContinueCompletionProvider
implements vscode.InlineCompletionItemProvider
{
private static debounceTimeout: NodeJS.Timeout | undefined = undefined;
private static debouncing: boolean = false;
private static lastUUID: string | undefined = undefined;
private onError(e: any) {
console.warn("Error generating autocompletion: ", e);
if (!this.errorsShown.has(e.message)) {
this.errorsShown.add(e.message);
vscode.window.showErrorMessage(e.message, "Documentation").then((val) => {
if (val === "Documentation") {
vscode.env.openExternal(
vscode.Uri.parse(
"https://continue.dev/docs/walkthroughs/tab-autocomplete",
),
);
}
});
}
vscode.window.showErrorMessage(e.message, "Documentation").then((val) => {
if (val === "Documentation") {
vscode.env.openExternal(
vscode.Uri.parse(
"https://continue.dev/docs/walkthroughs/tab-autocomplete",
),
);
}
});
}
private generatorReuseManager = new GeneratorReuseManager(
this.onError.bind(this),
);
private autocompleteCache = AutocompleteLruCache.get();
public errorsShown: Set<string> = new Set();
private completionProvider: CompletionProvider;
constructor(
private readonly configHandler: ConfigHandler,
private readonly ide: IDE,
private readonly tabAutocompleteModel: TabAutocompleteModel,
) {}
) {
this.completionProvider = new CompletionProvider(
this.configHandler,
this.ide,
this.tabAutocompleteModel.get.bind(this.tabAutocompleteModel),
this.onError.bind(this),
getDefinitionsFromLsp,
);
}
public async provideInlineCompletionItems(
document: vscode.TextDocument,
@ -53,33 +50,6 @@ export class ContinueCompletionProvider
token: vscode.CancellationToken,
//@ts-ignore
): ProviderResult<InlineCompletionItem[] | InlineCompletionList> {
// Debounce
const uuid = uuidv4();
ContinueCompletionProvider.lastUUID = uuid;
const config = await this.configHandler.loadConfig();
const options = {
...DEFAULT_AUTOCOMPLETE_OPTS,
...config.tabAutocompleteOptions,
};
if (ContinueCompletionProvider.debouncing) {
ContinueCompletionProvider.debounceTimeout?.refresh();
const lastUUID = await new Promise((resolve) =>
setTimeout(() => {
resolve(ContinueCompletionProvider.lastUUID);
}, options.debounceDelay),
);
if (uuid !== lastUUID) {
return [];
}
} else {
ContinueCompletionProvider.debouncing = true;
ContinueCompletionProvider.debounceTimeout = setTimeout(async () => {
ContinueCompletionProvider.debouncing = false;
}, options.debounceDelay);
}
const enableTabAutocomplete =
vscode.workspace
.getConfiguration("continue")
@ -89,28 +59,29 @@ export class ContinueCompletionProvider
}
try {
const outcome = await getTabCompletion(
document,
position,
token,
options,
this.tabAutocompleteModel,
this.ide,
this.generatorReuseManager,
);
const completion = outcome?.completion;
const abortController = new AbortController();
const signal = abortController.signal;
token.onCancellationRequested(() => abortController.abort());
const input: AutocompleteInput = {
completionId: uuidv4(),
filepath: document.uri.fsPath,
pos: { line: position.line, character: position.character },
recentlyEditedFiles: [],
recentlyEditedRanges: [],
clipboardText: await vscode.env.clipboard.readText(),
};
if (!completion) {
setupStatusBar(true, true);
const outcome =
await this.completionProvider.provideInlineCompletionItems(
input,
signal,
);
if (!outcome || !outcome.completion) {
return [];
}
// Do some stuff later so as not to block return. Latency matters
setTimeout(async () => {
if (!outcome.cacheHit) {
(await this.autocompleteCache).put(outcome.prompt, completion);
}
}, 100);
const logRejectionTimeout = setTimeout(() => {
// Wait 10 seconds, then assume it wasn't accepted
outcome.accepted = false;
@ -126,8 +97,11 @@ export class ContinueCompletionProvider
return [
new vscode.InlineCompletionItem(
completion,
new vscode.Range(position, position.translate(0, completion.length)),
outcome.completion,
new vscode.Range(
position,
position.translate(0, outcome.completion.length),
),
{
title: "Log Autocomplete Outcome",
command: "continue.logAutocompleteOutcome",

View file

@ -1,262 +0,0 @@
import { IDE, TabAutocompleteOptions } from "core";
import { AutocompleteLruCache } from "core/autocomplete/cache";
import {
noFirstCharNewline,
onlyWhitespaceAfterEndOfLine,
} from "core/autocomplete/charStream";
import {
constructAutocompletePrompt,
languageForFilepath,
} from "core/autocomplete/constructPrompt";
import { AutocompleteLanguageInfo } from "core/autocomplete/languages";
import {
avoidPathLine,
stopAtLines,
stopAtRepeatingLines,
stopAtSimilarLine,
streamWithNewLines,
} from "core/autocomplete/lineStream";
import { AutocompleteSnippet } from "core/autocomplete/ranking";
import { getTemplateForModel } from "core/autocomplete/templates";
import { GeneratorReuseManager } from "core/autocomplete/util";
import { streamLines } from "core/diff/util";
import OpenAI from "core/llm/llms/OpenAI";
import { getBasename } from "core/util";
import Handlebars from "handlebars";
import * as vscode from "vscode";
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
import { getDefinitionsFromLsp } from "./lsp";
import { RecentlyEditedTracker } from "./recentlyEdited";
import { setupStatusBar, stopStatusBarLoading } from "./statusBar";
export interface AutocompleteOutcome {
accepted?: boolean;
time: number;
prompt: string;
completion: string;
modelProvider: string;
modelName: string;
completionOptions: any;
cacheHit: boolean;
}
const autocompleteCache = AutocompleteLruCache.get();
const recentlyEditedTracker = new RecentlyEditedTracker();
function formatExternalSnippet(
filepath: string,
snippet: string,
language: AutocompleteLanguageInfo,
) {
const comment = language.comment;
const lines = [
comment + " Path: " + getBasename(filepath),
...snippet
.trim()
.split("\n")
.map((line) => comment + " " + line),
comment,
];
return lines.join("\n");
}
export async function getTabCompletion(
document: vscode.TextDocument,
pos: vscode.Position,
token: vscode.CancellationToken,
options: TabAutocompleteOptions,
tabAutocompleteModel: TabAutocompleteModel,
ide: IDE,
generatorReuseManager: GeneratorReuseManager,
): Promise<AutocompleteOutcome | undefined> {
const startTime = Date.now();
// Filter
const lang = languageForFilepath(document.fileName);
const line = document.lineAt(pos).text;
for (const endOfLine of lang.endOfLine) {
if (line.endsWith(endOfLine) && pos.character >= line.length) {
return undefined;
}
}
// Model
const llm = await tabAutocompleteModel.get();
if (llm instanceof OpenAI) {
llm.useLegacyCompletionsEndpoint = true;
}
if (!llm) return;
// Prompt
const fullPrefix = document.getText(
new vscode.Range(new vscode.Position(0, 0), pos),
);
const fullSuffix = document.getText(
new vscode.Range(
pos,
new vscode.Position(document.lineCount, Number.MAX_SAFE_INTEGER),
),
);
const lineBelowCursor = document.lineAt(
Math.min(pos.line + 1, document.lineCount - 1),
).text;
const clipboardText = await vscode.env.clipboard.readText();
let extrasSnippets = (await Promise.race([
getDefinitionsFromLsp(
document.uri.fsPath,
fullPrefix + fullSuffix,
fullPrefix.length,
ide,
),
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(
document.uri.toString(),
pos.line,
fullPrefix,
fullSuffix,
clipboardText,
lang,
options,
await recentlyEditedTracker.getRecentlyEditedRanges(),
await recentlyEditedTracker.getRecentlyEditedDocuments(),
llm.model,
extrasSnippets,
);
// Template prompt
const { template, completionOptions } = options.template
? { template: options.template, completionOptions: {} }
: getTemplateForModel(llm.model);
let prompt: string;
const filename = getBasename(document.uri.fsPath);
const reponame = getBasename(workspaceDirs[0] ?? "myproject");
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;
}
prompt = compiledTemplate({
prefix,
suffix,
filename,
reponame,
});
} else {
// Let the template function format snippets
prompt = template(prefix, suffix, filename, reponame, snippets);
}
// Completion
let completion = "";
const cache = await autocompleteCache;
const cachedCompletion = options.useCache
? await cache.get(prompt)
: undefined;
let cacheHit = false;
if (cachedCompletion) {
// Cache
cacheHit = true;
completion = cachedCompletion;
} else {
setupStatusBar(true, true);
// Try to reuse pending requests if what the user typed matches start of completion
let stop = [
...(completionOptions?.stop || []),
"\n\n",
"/src/",
"```",
...lang.stopWords,
];
const multiline =
options.multilineCompletions !== "never" &&
(options.multilineCompletions === "always" || completeMultiline);
let generator = generatorReuseManager.getGenerator(
prefix,
() =>
llm.streamComplete(prompt, {
...completionOptions,
temperature: 0,
raw: true,
stop,
}),
multiline,
);
// LLM
let cancelled = false;
const generatorWithCancellation = async function* () {
for await (const update of generator) {
if (token.isCancellationRequested) {
stopStatusBarLoading();
cancelled = true;
return undefined;
}
yield update;
}
};
let chars = generatorWithCancellation();
const gen2 = onlyWhitespaceAfterEndOfLine(
noFirstCharNewline(chars),
lang.endOfLine,
);
const lineGenerator = streamWithNewLines(
avoidPathLine(
stopAtRepeatingLines(stopAtLines(streamLines(gen2))),
lang.comment,
),
);
const finalGenerator = stopAtSimilarLine(lineGenerator, lineBelowCursor);
for await (const update of finalGenerator) {
completion += update;
}
if (cancelled) {
return undefined;
}
// Don't return empty
if (completion.trim().length <= 0) {
return undefined;
}
// Post-processing
completion = completion.trimEnd();
}
const time = Date.now() - startTime;
return {
time,
completion,
prompt,
modelProvider: llm.providerName,
modelName: llm.model,
completionOptions,
cacheHit,
};
}

View file

@ -4,10 +4,10 @@ import * as path from "path";
import * as vscode from "vscode";
import { IDE } from "core";
import { AutocompleteOutcome } from "core/autocomplete/completionProvider";
import { ConfigHandler } from "core/config/handler";
import { logDevData } from "core/util/devdata";
import { Telemetry } from "core/util/posthog";
import { AutocompleteOutcome } from "./autocomplete/getTabCompletion";
import { ContinueGUIWebviewViewProvider } from "./debugPanel";
import { DiffManager } from "./diff/horizontal";
import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager";
@ -318,7 +318,9 @@ const commandsMap: (
sidebar.webviewProtocol?.request("openSettings", undefined);
},
"continue.sendMainUserInput": (text: string) => {
sidebar.sendMainUserInput(text);
sidebar.webviewProtocol?.request("userInput", {
input: text,
});
},
"continue.shareSession": () => {
sidebar.sendMainUserInput("/share");

View file

@ -0,0 +1,71 @@
import * as vscode from "vscode";
import { VsCodeWebviewProtocol } from "../webviewProtocol";
import { VsCodeIde } from "../ideProtocol";
export const threadStopped: Map<number, boolean> = new Map();
// Arrays has better perf but you probably won't have thousands of threads in a single debug session
export function registerDebugTracker(
webviewProtocol: VsCodeWebviewProtocol,
ide: VsCodeIde
) {
vscode.debug.registerDebugAdapterTrackerFactory("*", {
createDebugAdapterTracker(_session: vscode.DebugSession) {
const updateThreads = async () => {
webviewProtocol?.request("updateSubmenuItems", {
provider: "locals",
submenuItems: (await ide.getAvailableThreads()).map((thread) => ({
id: `${thread.id}`,
title: thread.name,
description: `${thread.id}`,
})),
});
};
return {
async onWillStopSession() {
threadStopped.clear();
updateThreads();
},
async onDidSendMessage(message: any) {
if (message.type == "event") {
switch (message.event) {
case "continued":
case "stopped":
if (typeof message.body.threadId !== "undefined")
threadStopped.set(
Number(message.body.threadId),
message.event == "stopped"
);
if (message.body.allThreadsStopped)
threadStopped.forEach((_, key) =>
threadStopped.set(key, true)
);
if (message.body.allThreadsContinued)
threadStopped.forEach((_, key) =>
threadStopped.set(key, false)
);
updateThreads();
break;
case "thread":
if (message.body.reason == "exited")
threadStopped.delete(Number(message.body.threadId));
else if (message.body.reason == "started")
threadStopped.set(Number(message.body.threadId), false);
// somehow the threadId does not respect the specification in my vscodium (debugging C++)
// expecting a number but got a string instead
break;
default:
break;
}
}
},
};
},
});
}

View file

@ -14,6 +14,7 @@ import { registerAllCodeLensProviders } from "../lang-server/codeLens";
import { setupRemoteConfigSync } from "../stubs/activation";
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
import { VsCodeWebviewProtocol } from "../webviewProtocol";
import { registerDebugTracker } from "../debug/debug";
export class VsCodeExtension {
private configHandler: ConfigHandler;
@ -47,26 +48,26 @@ export class VsCodeExtension {
// Config Handler with output channel
const outputChannel = vscode.window.createOutputChannel(
"Continue - LLM Prompt/Completion",
"Continue - LLM Prompt/Completion"
);
this.configHandler = new ConfigHandler(
this.ide,
Promise.resolve(ideSettings),
async (log: string) => {
outputChannel.appendLine(
"==========================================================================",
"=========================================================================="
);
outputChannel.appendLine(
"==========================================================================",
"=========================================================================="
);
outputChannel.append(log);
},
() => this.webviewProtocol?.request("configUpdate", undefined),
() => this.webviewProtocol?.request("configUpdate", undefined)
);
this.configHandler.reloadConfig();
this.verticalDiffManager = new VerticalPerLineDiffManager(
this.configHandler,
this.configHandler
);
this.extensionContext = context;
this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler);
@ -76,7 +77,7 @@ export class VsCodeExtension {
this.ide,
this.windowId,
this.extensionContext,
this.verticalDiffManager,
this.verticalDiffManager
);
setupRemoteConfigSync(
@ -90,14 +91,14 @@ export class VsCodeExtension {
this.sidebar,
{
webviewOptions: { retainContextWhenHidden: true },
},
),
}
)
);
this.webviewProtocol = this.sidebar.webviewProtocol;
// Indexing + pause token
const indexingPauseToken = new PauseToken(
context.globalState.get<boolean>("continue.indexingPaused") === true,
context.globalState.get<boolean>("continue.indexingPaused") === true
);
this.webviewProtocol.on("index/setPaused", (msg) => {
context.globalState.update("continue.indexingPaused", msg.data);
@ -108,14 +109,14 @@ export class VsCodeExtension {
this.indexer = new CodebaseIndexer(
this.configHandler,
this.ide,
indexingPauseToken,
indexingPauseToken
);
// CodeLens
registerAllCodeLensProviders(
context,
this.diffManager,
this.verticalDiffManager.editorToVerticalDiffCodeLens,
this.verticalDiffManager.editorToVerticalDiffCodeLens
);
// Tab autocomplete
@ -130,9 +131,9 @@ export class VsCodeExtension {
new ContinueCompletionProvider(
this.configHandler,
this.ide,
this.tabAutocompleteModel,
),
),
this.tabAutocompleteModel
)
)
);
// Commands
@ -143,9 +144,11 @@ export class VsCodeExtension {
this.sidebar,
this.configHandler,
this.diffManager,
this.verticalDiffManager,
this.verticalDiffManager
);
registerDebugTracker(this.webviewProtocol, this.ide);
// Indexing
this.ide.getWorkspaceDirs().then((dirs) => this.refreshCodebaseIndex(dirs));
@ -192,7 +195,7 @@ export class VsCodeExtension {
}
});
}
}),
})
);
// Register a content provider for the readonly virtual documents
@ -210,8 +213,8 @@ export class VsCodeExtension {
context.subscriptions.push(
vscode.workspace.registerTextDocumentContentProvider(
VsCodeExtension.continueVirtualDocumentScheme,
documentContentProvider,
),
documentContentProvider
)
);
}

View file

@ -1,6 +1,6 @@
import * as child_process from "child_process";
import { exec } from "child_process";
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range } from "core";
import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from "core";
import { getContinueGlobalPath } from "core/util/paths";
import * as path from "path";
import * as vscode from "vscode";
@ -47,8 +47,8 @@ class VsCodeIde implements IDE {
filepath,
new vscode.Range(
new vscode.Position(range.start.line, range.start.character),
new vscode.Position(range.end.line, range.end.character),
),
new vscode.Position(range.end.line, range.end.character)
)
);
}
@ -60,7 +60,7 @@ class VsCodeIde implements IDE {
files.map(async (file) => {
let stat = await vscode.workspace.fs.stat(uriFromFilePath(file));
pathToLastModified[file] = stat.mtime;
}),
})
);
return pathToLastModified;
@ -89,6 +89,23 @@ class VsCodeIde implements IDE {
return await this.ideUtils.getTerminalContents(1);
}
async getDebugLocals(threadIndex: number): Promise<string> {
return await this.ideUtils.getDebugLocals(threadIndex);
}
async getTopLevelCallStackSources(
threadIndex: number,
stackDepth: number
): Promise<string[]> {
return await this.ideUtils.getTopLevelCallStackSources(
threadIndex,
stackDepth
);
}
async getAvailableThreads(): Promise<Thread[]> {
return await this.ideUtils.getAvailableThreads();
}
async listWorkspaceContents(directory?: string): Promise<string[]> {
if (directory) {
return await this.ideUtils.getDirectoryContents(directory, true);
@ -96,7 +113,7 @@ class VsCodeIde implements IDE {
const contents = await Promise.all(
this.ideUtils
.getWorkspaceDirectories()
.map((dir) => this.ideUtils.getDirectoryContents(dir, true)),
.map((dir) => this.ideUtils.getDirectoryContents(dir, true))
);
return contents.flat();
}
@ -111,7 +128,7 @@ class VsCodeIde implements IDE {
for (const [filename, type] of files) {
if (type === vscode.FileType.File && filename === ".continuerc.json") {
const contents = await this.ideUtils.readFile(
vscode.Uri.joinPath(workspaceDir, filename).fsPath,
vscode.Uri.joinPath(workspaceDir, filename).fsPath
);
configs.push(JSON.parse(contents));
}
@ -129,7 +146,7 @@ class VsCodeIde implements IDE {
directory,
[],
false,
undefined,
undefined
)) {
allDirs.push(dir);
}
@ -149,7 +166,7 @@ class VsCodeIde implements IDE {
async writeFile(path: string, contents: string): Promise<void> {
await vscode.workspace.fs.writeFile(
vscode.Uri.file(path),
Buffer.from(contents),
Buffer.from(contents)
);
}
@ -164,11 +181,11 @@ class VsCodeIde implements IDE {
async showLines(
filepath: string,
startLine: number,
endLine: number,
endLine: number
): Promise<void> {
const range = new vscode.Range(
new vscode.Position(startLine, 0),
new vscode.Position(endLine, 0),
new vscode.Position(endLine, 0)
);
openEditorAndRevealRange(filepath, range).then(() => {
// TODO: Highlight lines
@ -202,7 +219,7 @@ class VsCodeIde implements IDE {
async showDiff(
filepath: string,
newContents: string,
stepIndex: number,
stepIndex: number
): Promise<void> {
await this.diffManager.writeDiff(filepath, newContents, stepIndex);
}
@ -223,14 +240,16 @@ class VsCodeIde implements IDE {
const p = child_process.spawn(
path.join(
getExtensionUri().fsPath,
"out",
"node_modules",
"@vscode",
"ripgrep",
"bin",
"rg",
"rg"
),
["-i", "-C", "2", `"${query}"`, "."],
{ cwd: dir },
["-i", "-C", "2", "--", `${query}`, "."], //no regex
//["-i", "-C", "2", "-e", `${query}`, "."], //use regex
{ cwd: dir }
);
let output = "";

View file

@ -1,4 +1,4 @@
import { FileEdit, RangeInFile } from "core";
import { FileEdit, RangeInFile, Thread } from "core";
import path from "path";
import * as vscode from "vscode";
import { VsCodeExtension } from "../extension/vscodeExtension";
@ -15,6 +15,8 @@ import {
openEditorAndRevealRange,
uriFromFilePath,
} from "./vscode";
import { threadStopped } from "../debug/debug";
const util = require("util");
const asyncExec = util.promisify(require("child_process").exec);
@ -23,12 +25,12 @@ export class VsCodeIdeUtils {
async gotoDefinition(
filepath: string,
position: vscode.Position,
position: vscode.Position
): Promise<vscode.Location[]> {
const locations: vscode.Location[] = await vscode.commands.executeCommand(
"vscode.executeDefinitionProvider",
uriFromFilePath(filepath),
position,
position
);
return locations;
}
@ -36,25 +38,25 @@ export class VsCodeIdeUtils {
async documentSymbol(filepath: string): Promise<vscode.DocumentSymbol[]> {
return await vscode.commands.executeCommand(
"vscode.executeDocumentSymbolProvider",
uriFromFilePath(filepath),
uriFromFilePath(filepath)
);
}
async references(
filepath: string,
position: vscode.Position,
position: vscode.Position
): Promise<vscode.Location[]> {
return await vscode.commands.executeCommand(
"vscode.executeReferenceProvider",
uriFromFilePath(filepath),
position,
position
);
}
async foldingRanges(filepath: string): Promise<vscode.FoldingRange[]> {
return await vscode.commands.executeCommand(
"vscode.executeFoldingRangeProvider",
uriFromFilePath(filepath),
uriFromFilePath(filepath)
);
}
@ -78,12 +80,12 @@ export class VsCodeIdeUtils {
rangeInFile.range.start.line,
rangeInFile.range.start.character,
rangeInFile.range.end.line,
rangeInFile.range.end.character,
rangeInFile.range.end.character
);
const editor = await openEditorAndRevealRange(
rangeInFile.filepath,
range,
vscode.ViewColumn.One,
vscode.ViewColumn.One
);
if (editor) {
const decorationType = vscode.window.createTextEditorDecorationType({
@ -98,7 +100,7 @@ export class VsCodeIdeUtils {
cursorDisposable.dispose();
editor.setDecorations(decorationType, []);
}
},
}
);
setTimeout(() => {
@ -121,9 +123,9 @@ export class VsCodeIdeUtils {
edit.range.start.line,
edit.range.start.character,
edit.range.end.line,
edit.range.end.character,
edit.range.end.character
),
edit.replacement,
edit.replacement
);
}
@ -132,7 +134,7 @@ export class VsCodeIdeUtils {
const panel = vscode.window.createWebviewPanel(
"continue.continueGUIView",
"Continue",
vscode.ViewColumn.One,
vscode.ViewColumn.One
);
// panel.webview.html = this.sidebar.getSidebarContent(
// extensionContext,
@ -163,8 +165,8 @@ export class VsCodeIdeUtils {
vscode.Uri.parse(
`${
VsCodeExtension.continueVirtualDocumentScheme
}:${encodeURIComponent(name)}?${encodeURIComponent(contents)}`,
),
}:${encodeURIComponent(name)}?${encodeURIComponent(contents)}`
)
)
.then((doc) => {
vscode.window.showTextDocument(doc, { preview: false });
@ -246,7 +248,7 @@ export class VsCodeIdeUtils {
async getDirectoryContents(
directory: string,
recursive: boolean,
recursive: boolean
): Promise<string[]> {
if (!recursive) {
return (
@ -271,7 +273,7 @@ export class VsCodeIdeUtils {
gitRoot ?? directory,
[],
true,
gitRoot === directory ? undefined : onlyThisDirectory,
gitRoot === directory ? undefined : onlyThisDirectory
)) {
allFiles.push(file);
}
@ -287,46 +289,53 @@ export class VsCodeIdeUtils {
}
}
private static MAX_BYTES = 100000;
async readFile(filepath: string): Promise<string> {
filepath = this.getAbsolutePath(filepath);
try {
filepath = this.getAbsolutePath(filepath);
const uri = uriFromFilePath(filepath);
const MAX_BYTES = 100000;
let contents: string | undefined;
if (typeof contents === "undefined") {
try {
const fileStats = await vscode.workspace.fs.stat(
uriFromFilePath(filepath),
);
if (fileStats.size > 10 * MAX_BYTES) {
return "";
}
const bytes = await vscode.workspace.fs.readFile(
uriFromFilePath(filepath),
);
// Truncate the buffer to the first MAX_BYTES
const truncatedBytes = bytes.slice(0, MAX_BYTES);
contents = new TextDecoder().decode(truncatedBytes);
} catch {
contents = "";
// Check first whether it's an open document
const openTextDocument = vscode.workspace.textDocuments.find(
(doc) => doc.uri.toString() === uri.toString(),
);
if (openTextDocument !== undefined) {
return openTextDocument.getText();
}
const fileStats = await vscode.workspace.fs.stat(
uriFromFilePath(filepath),
);
if (fileStats.size > 10 * VsCodeIdeUtils.MAX_BYTES) {
return "";
}
const bytes = await vscode.workspace.fs.readFile(uri);
// Truncate the buffer to the first MAX_BYTES
const truncatedBytes = bytes.slice(0, VsCodeIdeUtils.MAX_BYTES);
const contents = new TextDecoder().decode(truncatedBytes);
return contents;
} catch {
return "";
}
return contents;
}
async readRangeInFile(
filepath: string,
range: vscode.Range,
range: vscode.Range
): Promise<string> {
const contents = new TextDecoder().decode(
await vscode.workspace.fs.readFile(vscode.Uri.file(filepath)),
await vscode.workspace.fs.readFile(vscode.Uri.file(filepath))
);
const lines = contents.split("\n");
return (
lines.slice(range.start.line, range.end.line).join("\n") +
"\n" +
lines[range.end.line].slice(0, range.end.character)
lines[
range.end.line < lines.length - 1 ? range.end.line : lines.length - 1
].slice(0, range.end.character)
);
}
@ -334,20 +343,20 @@ export class VsCodeIdeUtils {
const tempCopyBuffer = await vscode.env.clipboard.readText();
if (commands < 0) {
await vscode.commands.executeCommand(
"workbench.action.terminal.selectAll",
"workbench.action.terminal.selectAll"
);
} else {
for (let i = 0; i < commands; i++) {
await vscode.commands.executeCommand(
"workbench.action.terminal.selectToPreviousCommand",
"workbench.action.terminal.selectToPreviousCommand"
);
}
}
await vscode.commands.executeCommand(
"workbench.action.terminal.copySelection",
"workbench.action.terminal.copySelection"
);
await vscode.commands.executeCommand(
"workbench.action.terminal.clearSelection",
"workbench.action.terminal.clearSelection"
);
const terminalContents = await vscode.env.clipboard.readText();
await vscode.env.clipboard.writeText(tempCopyBuffer);
@ -359,6 +368,129 @@ export class VsCodeIdeUtils {
return terminalContents;
}
private async _getThreads(session: vscode.DebugSession) {
const threadsResponse = await session.customRequest("threads");
const threads = threadsResponse.threads.filter((thread: any) =>
threadStopped.get(thread.id)
);
threads.sort((a: any, b: any) => a.id - b.id);
threadsResponse.threads = threads;
return threadsResponse;
}
async getAvailableThreads(): Promise<Thread[]> {
const session = vscode.debug.activeDebugSession;
if (!session) return [];
const threadsResponse = await this._getThreads(session);
return threadsResponse.threads;
}
async getDebugLocals(threadIndex: number = 0): Promise<string> {
const session = vscode.debug.activeDebugSession;
if (!session) {
vscode.window.showWarningMessage(
"No active debug session found, therefore no debug context will be provided for the llm."
);
return "";
}
const variablesResponse = await session
.customRequest("stackTrace", {
threadId: threadIndex,
startFrame: 0,
})
.then((traceResponse) =>
session.customRequest("scopes", {
frameId: traceResponse.stackFrames[0].id,
})
)
.then((scopesResponse) =>
session.customRequest("variables", {
variablesReference: scopesResponse.scopes[0].variablesReference,
})
);
const variableContext = variablesResponse.variables
.filter((variable: any) => variable.type !== "global")
.reduce(
(acc: any, variable: any) =>
`${acc}\nname: ${variable.name}, type: ${variable.type}, ` +
`value: ${variable.value}`,
""
);
return variableContext;
}
async getTopLevelCallStackSources(
threadIndex: number,
stackDepth: number = 3
): Promise<string[]> {
const session = vscode.debug.activeDebugSession;
if (!session) return [];
const sourcesPromises = await session
.customRequest("stackTrace", {
threadId: threadIndex,
startFrame: 0,
})
.then((traceResponse) =>
traceResponse.stackFrames
.slice(0, stackDepth)
.map(async (stackFrame: any) => {
const scopeResponse = await session.customRequest("scopes", {
frameId: stackFrame.id,
});
const scope = scopeResponse.scopes[0];
return await this.retrieveSource(scope.source ? scope : stackFrame);
})
);
return Promise.all(sourcesPromises);
}
private async retrieveSource(sourceContainer: any): Promise<string> {
if (!sourceContainer.source) return "";
const sourceRef = sourceContainer.source.sourceReference;
if (sourceRef && sourceRef > 0) {
// according to the spec, source might be ony available in a debug session
// not yet able to test this branch
const sourceResponse =
await vscode.debug.activeDebugSession?.customRequest("source", {
source: sourceContainer.source,
sourceReference: sourceRef,
});
return sourceResponse.content;
} else if (sourceContainer.line && sourceContainer.endLine) {
return await this.readRangeInFile(
sourceContainer.source.path,
new vscode.Range(
sourceContainer.line - 1, // The line number from scope response starts from 1
sourceContainer.column,
sourceContainer.endLine - 1,
sourceContainer.endColumn
)
);
} else if (sourceContainer.line)
// fall back to 5 line of context
return await this.readRangeInFile(
sourceContainer.source.path,
new vscode.Range(
sourceContainer.line - 3,
0,
sourceContainer.line + 2,
0
)
);
else return "unavailable";
}
private async _getRepo(forDirectory: vscode.Uri): Promise<any | undefined> {
// Use the native git extension to get the branch name
const extension = vscode.extensions.getExtension("vscode.git");

View file

@ -4,6 +4,7 @@ import { addModel, addOpenAIKey, deleteModel } from "core/config/util";
import { indexDocs } from "core/indexing/docs";
import TransformersJsEmbeddingsProvider from "core/indexing/embeddings/TransformersJsEmbeddingsProvider";
import { logDevData } from "core/util/devdata";
import { DevDataSqliteDb } from "core/util/devdataSqlite";
import historyManager from "core/util/history";
import { Message } from "core/util/messenger";
import { getConfigJsonPath } from "core/util/paths";
@ -161,6 +162,18 @@ export class VsCodeWebviewProtocol {
this.on("getTerminalContents", async (msg) => {
return await ide.getTerminalContents();
});
this.on("getDebugLocals", async (msg) => {
return await ide.getDebugLocals(Number(msg.data.threadIndex));
});
this.on("getAvailableThreads", async (msg) => {
return await ide.getAvailableThreads();
});
this.on("getTopLevelCallStackSources", async (msg) => {
return await ide.getTopLevelCallStackSources(
msg.data.threadIndex,
msg.data.stackDepth,
);
});
this.on("listWorkspaceContents", async (msg) => {
return await ide.listWorkspaceContents();
});
@ -516,6 +529,14 @@ export class VsCodeWebviewProtocol {
this.on("openUrl", (msg) => {
vscode.env.openExternal(vscode.Uri.parse(msg.data));
});
this.on("stats/getTokensPerDay", async (msg) => {
const rows = await DevDataSqliteDb.getTokensPerDay();
return rows;
});
this.on("stats/getTokensPerModel", async (msg) => {
const rows = await DevDataSqliteDb.getTokensPerModel();
return rows;
});
}
public request<T extends keyof ReverseWebviewProtocol>(

View file

@ -691,7 +691,12 @@
resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz"
integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==
"@lancedb/vectordb-darwin-arm64@*", "@lancedb/vectordb-darwin-arm64@0.4.12":
"@lancedb/vectordb-darwin-arm64@*":
version "0.4.13"
resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.13.tgz"
integrity sha512-JfroNCG8yKIU931Y+x8d0Fp8C9DHUSC5j+CjI+e5err7rTWtie4j3JbsXlWAnPFaFEOg0Xk3BWkSikCvhPGJGg==
"@lancedb/vectordb-darwin-arm64@0.4.12":
version "0.4.12"
resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz"
integrity sha512-38/rkJRlWXkPWXuj9onzvbrhnIWcIUQjgEp5G9v5ixPosBowm7A4j8e2Q8CJMsVSNcVX2JLqwWVldiWegZFuYw==
@ -2348,7 +2353,7 @@ core-util-is@1.0.2:
integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
"core@file:../../core":
version "1.0.0"
version "1.0.1"
resolved "file:../../core"
dependencies:
"@mozilla/readability" "^0.5.0"

9
gui/package-lock.json generated
View file

@ -67,10 +67,14 @@
"tailwindcss": "^3.2.7",
"typescript": "^4.9.3",
"vite": "^4.1.0"
},
"engines": {
"node": ">=20.11.0"
}
},
"../core": {
"version": "1.0.0",
"name": "@continuedev/core",
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
"@mozilla/readability": "^0.5.0",
@ -120,6 +124,9 @@
"esbuild": "^0.19.11",
"jest": "^29.7.0",
"ts-jest": "^29.1.1"
},
"engines": {
"node": ">=20.11.0"
}
},
"node_modules/@alloc/quick-lru": {

View file

@ -69,5 +69,9 @@
"tailwindcss": "^3.2.7",
"typescript": "^4.9.3",
"vite": "^4.1.0"
},
"engine-strict": true,
"engines": {
"node": ">=20.11.0"
}
}

View file

@ -16,6 +16,7 @@ import SettingsPage from "./pages/settings";
import { ContextSubmenuItem } from "core";
import useSubmenuContextProviders from "./hooks/useSubmenuContextProviders";
import { useVscTheme } from "./hooks/useVscTheme";
import Stats from "./pages/stats";
const router = createMemoryRouter([
{
@ -35,6 +36,10 @@ const router = createMemoryRouter([
path: "/history",
element: <History />,
},
{
path: "/stats",
element: <Stats />,
},
{
path: "/help",
element: <Help />,
@ -70,7 +75,7 @@ const router = createMemoryRouter([
export const SubmenuContextProvidersContext = createContext<{
getSubmenuContextItems: (
providerTitle: string | undefined,
query: string
query: string,
) => (ContextSubmenuItem & { providerTitle: string })[];
addItem: (providerTitle: string, item: ContextSubmenuItem) => void;
}>({

View file

@ -67,7 +67,7 @@ if (typeof document !== "undefined") {
// Remove alpha channel from colors
const value = getComputedStyle(document.documentElement).getPropertyValue(
colorVar
colorVar,
);
if (colorVar.startsWith("#") && value.length > 7) {
document.body.style.setProperty(colorVar, value.slice(0, 7));
@ -97,7 +97,7 @@ export function parseHexColor(hexColor: string): {
export function parseColorForHex(colorVar: string): string {
const value = getComputedStyle(document.documentElement).getPropertyValue(
colorVar
colorVar,
);
if (value.startsWith("#")) {
return value.slice(0, 7);
@ -197,6 +197,10 @@ export const H3 = styled.h3`
width: fit-content;
`;
export const Hr = styled.hr`
border: 0.5px solid ${lightGray};
`;
export const Input = styled.input`
width: 100%;
padding: 8px 12px;

View file

@ -301,9 +301,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
} else {
props.command({
...querySubmenuItem,
itemType: querySubmenuItem.type,
query: queryInputRef.current.value,
label: `${querySubmenuItem.label}: ${queryInputRef.current.value}`,
itemType: querySubmenuItem.type,
});
}
} else if (e.key === "Escape") {

View file

@ -6,7 +6,7 @@ import {
import { useState } from "react";
import styled from "styled-components";
import { vscEditorBackground } from "..";
import { postToIde } from "../../util/ide";
import { isJetBrains, postToIde } from "../../util/ide";
import HeaderButtonWithText from "../HeaderButtonWithText";
const TopDiv = styled.div`
@ -39,23 +39,25 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
return (
<TopDiv>
<SecondDiv>
<HeaderButtonWithText
text={applying ? "Applying..." : "Apply to current file"}
disabled={applying}
style={{ backgroundColor: vscEditorBackground }}
onClick={(e) => {
if (applying) return;
postToIde("applyToCurrentFile", { text: props.text });
setApplying(true);
setTimeout(() => setApplying(false), 2000);
}}
>
{applying ? (
<CheckIcon className="w-4 h-4 text-green-500" />
) : (
<PlayIcon className="w-4 h-4" />
)}
</HeaderButtonWithText>
{isJetBrains() || (
<HeaderButtonWithText
text={applying ? "Applying..." : "Apply to current file"}
disabled={applying}
style={{ backgroundColor: vscEditorBackground }}
onClick={(e) => {
if (applying) return;
postToIde("applyToCurrentFile", { text: props.text });
setApplying(true);
setTimeout(() => setApplying(false), 2000);
}}
>
{applying ? (
<CheckIcon className="w-4 h-4 text-green-500" />
) : (
<PlayIcon className="w-4 h-4" />
)}
</HeaderButtonWithText>
)}
<HeaderButtonWithText
text={copied ? "Copied!" : "Copy"}
style={{ backgroundColor: vscEditorBackground }}

View file

@ -42,7 +42,28 @@ function useSubmenuContextProviders() {
}
useWebviewListener("refreshSubmenuItems", async (data) => {
setLoaded(true);
setLoaded(false);
});
useWebviewListener("updateSubmenuItems", async (data) => {
const minisearch = new MiniSearch<ContextSubmenuItem>({
fields: ["title", "description"],
storeFields: ["id", "title", "description"],
});
minisearch.addAll(data.submenuItems);
setMinisearches((prev) => ({ ...prev, [data.provider]: minisearch }));
if (data.provider === "file") {
const openFiles = await getOpenFileItems();
setFallbackResults((prev) => ({ ...prev, file: openFiles }));
} else {
setFallbackResults((prev) => ({
...prev,
[data.provider]: data.submenuItems.slice(0, 6),
}));
}
});
function addItem(providerTitle: string, item: ContextSubmenuItem) {

View file

@ -1,7 +1,13 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { Button, lightGray, vscBackground, vscForeground } from "../components";
import {
Button,
Hr,
lightGray,
vscBackground,
vscForeground,
} from "../components";
import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts";
import { useNavigationListener } from "../hooks/useNavigationListener";
import { postToIde } from "../util/ide";
@ -75,6 +81,15 @@ function HelpPage() {
</TutorialButton>
</div>
<h3
className="my-0 py-3 mx-auto text-center cursor-pointer"
onClick={() => {
navigate("/stats");
}}
>
View My Usage
</h3>
<Hr className="my-0" />
<h3 className="my-3 mx-auto text-center">Resources</h3>
<ResourcesDiv className="border">
<IconDiv backgroundColor="rgb(234, 51, 35)">

View file

@ -7,6 +7,7 @@ import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import {
Button,
Hr,
NumberInput,
TextArea,
lightGray,
@ -20,10 +21,6 @@ import { RootState } from "../redux/store";
import { getFontSize, getPlatform } from "../util";
import { postToIde } from "../util/ide";
const Hr = styled.hr`
border: 0.5px solid ${lightGray};
`;
const CancelButton = styled(Button)`
background-color: transparent;
color: ${lightGray};
@ -132,7 +129,7 @@ function Settings() {
formMethods.setValue("systemMessage", config.systemMessage);
formMethods.setValue(
"completionOptions.temperature",
config.completionOptions?.temperature
config.completionOptions?.temperature,
);
}, [config]);

107
gui/src/pages/stats.tsx Normal file
View file

@ -0,0 +1,107 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { lightGray, vscBackground, vscInputBackground } from "../components";
import { useNavigationListener } from "../hooks/useNavigationListener";
import { ideRequest } from "../util/ide";
const Th = styled.th`
padding: 0.5rem;
text-align: left;
border: 1px solid ${vscInputBackground};
`;
const Tr = styled.tr`
&:hover {
background-color: ${vscInputBackground};
}
overflow-wrap: anywhere;
border: 1px solid ${vscInputBackground};
`;
const Td = styled.td`
padding: 0.5rem;
border: 1px solid ${vscInputBackground};
`;
function Stats() {
useNavigationListener();
const navigate = useNavigate();
const [days, setDays] = useState<{ day: string; tokens: number }[]>([]);
useEffect(() => {
ideRequest("stats/getTokensPerDay", undefined).then((days) => {
setDays(days);
});
}, []);
const [models, setModels] = useState<{ model: string; tokens: number }[]>([]);
useEffect(() => {
ideRequest("stats/getTokensPerModel", undefined).then((models) => {
setModels(models);
});
}, []);
return (
<div>
<div
className="items-center flex m-0 p-0 sticky top-0"
style={{
borderBottom: `0.5px solid ${lightGray}`,
backgroundColor: vscBackground,
}}
>
<ArrowLeftIcon
width="1.2em"
height="1.2em"
onClick={() => navigate("/")}
className="inline-block ml-4 cursor-pointer"
/>
<h3 className="text-lg font-bold m-2 inline-block">My Usage</h3>
</div>
<h2 className="ml-2">Tokens per Day</h2>
<table className="w-full border-collapse">
<thead>
<Tr>
<Th>Day</Th>
<Th>Tokens</Th>
</Tr>
</thead>
<tbody>
{days.map((day) => (
<Tr key={day.day} className="">
<Td>{day.day}</Td>
<Td>{day.tokens}</Td>
</Tr>
))}
</tbody>
</table>
<h2 className="ml-2">Tokens per Model</h2>
<table className="w-full border-collapse">
<thead>
<Tr>
<Th>Model</Th>
<Th>Tokens</Th>
</Tr>
</thead>
<tbody>
{models.map((model) => (
<Tr key={model.model} className="">
<Td>{model.model}</Td>
<Td>{model.tokens}</Td>
</Tr>
))}
</tbody>
</table>
</div>
);
}
export default Stats;

View file

@ -19,7 +19,7 @@ function _postToIde(messageType: string, data: any, messageId?: string) {
console.log(
"Unable to send message: postIntellijMessage is undefined. ",
messageType,
data
data,
);
throw new Error("postIntellijMessage is undefined");
}
@ -30,7 +30,7 @@ function _postToIde(messageType: string, data: any, messageId?: string) {
console.log(
"Unable to send message: vscode is undefined. ",
messageType,
data
data,
);
return;
}
@ -47,7 +47,7 @@ export function postToIde<T extends keyof WebviewProtocol>(
messageType: T,
data: WebviewProtocol[T][0],
messageId?: string,
attempt: number = 0
attempt: number = 0,
) {
try {
_postToIde(messageType, data, messageId);
@ -56,7 +56,7 @@ export function postToIde<T extends keyof WebviewProtocol>(
console.log(`Attempt ${attempt} failed. Retrying...`);
setTimeout(
() => postToIde(messageType, data, messageId, attempt + 1),
Math.pow(2, attempt) * 1000
Math.pow(2, attempt) * 1000,
);
} else {
console.error("Max attempts reached. Message could not be sent.", error);
@ -67,7 +67,7 @@ export function postToIde<T extends keyof WebviewProtocol>(
export function respondToIde<T extends keyof ReverseWebviewProtocol>(
messageType: T,
data: ReverseWebviewProtocol[T][1],
messageId: string
messageId: string,
) {
_postToIde(messageType, data, messageId);
}
@ -82,7 +82,7 @@ function safeParseResponse(data: any) {
export async function ideRequest<T extends keyof WebviewProtocol>(
messageType: T,
data: WebviewProtocol[T][0]
data: WebviewProtocol[T][0],
): Promise<WebviewProtocol[T][1]> {
const messageId = uuidv4();
@ -102,7 +102,7 @@ export async function ideRequest<T extends keyof WebviewProtocol>(
export async function* ideStreamRequest<T extends keyof WebviewProtocol>(
messageType: T,
data: WebviewProtocol[T][0],
cancelToken?: AbortSignal
cancelToken?: AbortSignal,
): WebviewProtocol[T][1] {
const messageId = uuidv4();
@ -153,7 +153,7 @@ export async function* llmStreamChat(
modelTitle: string,
cancelToken: AbortSignal | undefined,
messages: ChatMessage[],
options: LLMFullCompletionOptions = {}
options: LLMFullCompletionOptions = {},
): AsyncGenerator<ChatMessage, LLMReturnValue> {
const gen = ideStreamRequest(
"llm/streamChat",
@ -162,7 +162,7 @@ export async function* llmStreamChat(
title: modelTitle,
completionOptions: options,
},
cancelToken
cancelToken,
);
let next = await gen.next();

View file

@ -562,7 +562,7 @@ const claude3Opus: ModelPackage = {
title: "Claude 3 Opus",
apiKey: "",
},
providerOptions: ["anthropic"],
providerOptions: ["anthropic", "freetrial"],
icon: "anthropic.png",
};
@ -576,7 +576,7 @@ const claude3Sonnet: ModelPackage = {
title: "Claude 3 Sonnet",
apiKey: "",
},
providerOptions: ["anthropic"],
providerOptions: ["anthropic", "freetrial"],
icon: "anthropic.png",
};
@ -585,12 +585,12 @@ const claude3Haiku: ModelPackage = {
description:
"The third most capable model in the Claude 3 series: fastest and most compact model for near-instant responsiveness",
params: {
model: "claude-2",
model: "claude-3-haiku-20240307",
contextLength: 200_000,
title: "Claude 3 Haiku",
apiKey: "",
},
providerOptions: ["anthropic"],
providerOptions: ["anthropic", "freetrial"],
icon: "anthropic.png",
};
@ -625,6 +625,7 @@ export const MODEL_INFO: ModelPackage[] = [
geminiPro,
claude3Opus,
claude3Sonnet,
claude3Haiku,
claude2,
deepseek,
mistral,
@ -693,7 +694,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
defaultValue: 100_000,
},
],
packages: [claude3Opus, claude3Sonnet, claude2],
packages: [claude3Opus, claude3Sonnet, claude3Haiku, claude2],
},
ollama: {
title: "Ollama",
@ -929,6 +930,9 @@ After it's up and running, you can start using Continue.`,
packages: [
codellama70bTrial,
mixtralTrial,
{ ...claude3Opus, title: "Claude 3 Opus (trial)" },
{ ...claude3Sonnet, title: "Claude 3 Sonnet (trial)" },
{ ...claude3Haiku, title: "Claude 3 Haiku (trial)" },
{ ...geminiPro, title: "Gemini Pro (trial)" },
{ ...gpt4vision, title: "GPT-4 Vision (trial)" },
{ ...gpt35turbo, title: "GPT-3.5-Turbo (trial)" },

View file

@ -32,5 +32,9 @@
"dependencies": {
"@lancedb/vectordb-darwin-arm64": "^0.4.3",
"vectordb": "^0.4.3"
},
"engine-strict": true,
"engines": {
"node": ">=20.11.0"
}
}

448
pkg/package-lock.json generated
View file

@ -34,11 +34,17 @@
"version": "1.0.0",
"license": "Apache-2.0",
"dependencies": {
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@types/jsdom": "^21.1.6",
"@types/mozilla-readability": "^0.2.1",
"@types/node-fetch": "^2.6.11",
"@xenova/transformers": "^2.14.0",
"adf-to-md": "^1.1.0",
"axios": "^1.6.7",
"cheerio": "^1.0.0-rc.12",
"commander": "^12.0.0",
"dbinfoz": "^0.1.4",
"dotenv": "^16.3.1",
"fastest-levenshtein": "^1.0.16",
"follow-redirects": "^1.15.5",
@ -46,20 +52,24 @@
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"js-tiktoken": "^1.0.8",
"llm-code-highlighter": "^0.0.5",
"jsdom": "^24.0.0",
"llama-tokenizer-js": "^1.1.3",
"llm-code-highlighter": "^0.0.14",
"node-fetch": "^3.3.2",
"node-html-markdown": "^1.3.0",
"ollama": "^0.4.6",
"openai": "^4.20.1",
"pg": "^8.11.3",
"posthog-node": "^3.6.2",
"replicate": "^0.26.0",
"request": "^2.88.2",
"socket.io-client": "^4.7.3",
"sqlite": "^5.1.1",
"sqlite3": "^5.1.7",
"tree-sitter-wasms": "^0.1.6",
"uuid": "^9.0.1",
"vectordb": "^0.4.3",
"web-tree-sitter": "^0.20.8"
"web-tree-sitter": "^0.21.0"
},
"devDependencies": {
"@types/follow-redirects": "^1.14.4",
@ -77,6 +87,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.1.tgz",
"integrity": "sha512-xvgv6pkMGBA6GwdyJbNAnDmfAIR/DfWhrj9jgWh3TY7gRm3KO46x/GPjRg6wJ0nOepwqrNxFfojebh0Df4h4Tw==",
"peer": true,
"dependencies": {
"lodash.assignwith": "^4.2.0",
"typical": "^7.1.1"
@ -89,6 +100,7 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz",
"integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==",
"peer": true,
"engines": {
"node": ">=12.17"
}
@ -97,6 +109,7 @@
"version": "14.0.2",
"resolved": "https://registry.npmjs.org/@apache-arrow/ts/-/ts-14.0.2.tgz",
"integrity": "sha512-CtwAvLkK0CZv7xsYeCo91ml6PvlfzAmAJZkRYuz2GNBwfYufj5SVi0iuSMwIMkcU/szVwvLdzORSLa5PlF/2ug==",
"peer": true,
"dependencies": {
"@types/command-line-args": "5.2.0",
"@types/command-line-usage": "5.0.2",
@ -169,9 +182,9 @@
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz",
"integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz",
"integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==",
"cpu": [
"ppc64"
],
@ -185,9 +198,9 @@
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz",
"integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz",
"integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==",
"cpu": [
"arm"
],
@ -201,9 +214,9 @@
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz",
"integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz",
"integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==",
"cpu": [
"arm64"
],
@ -217,9 +230,9 @@
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz",
"integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz",
"integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==",
"cpu": [
"x64"
],
@ -233,9 +246,9 @@
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz",
"integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz",
"integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==",
"cpu": [
"arm64"
],
@ -249,9 +262,9 @@
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz",
"integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz",
"integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==",
"cpu": [
"x64"
],
@ -265,9 +278,9 @@
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz",
"integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz",
"integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==",
"cpu": [
"arm64"
],
@ -281,9 +294,9 @@
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz",
"integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz",
"integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==",
"cpu": [
"x64"
],
@ -297,9 +310,9 @@
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz",
"integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz",
"integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==",
"cpu": [
"arm"
],
@ -313,9 +326,9 @@
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz",
"integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz",
"integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==",
"cpu": [
"arm64"
],
@ -329,9 +342,9 @@
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz",
"integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz",
"integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==",
"cpu": [
"ia32"
],
@ -345,9 +358,9 @@
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz",
"integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz",
"integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==",
"cpu": [
"loong64"
],
@ -361,9 +374,9 @@
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz",
"integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz",
"integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==",
"cpu": [
"mips64el"
],
@ -377,9 +390,9 @@
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz",
"integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz",
"integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==",
"cpu": [
"ppc64"
],
@ -393,9 +406,9 @@
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz",
"integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz",
"integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==",
"cpu": [
"riscv64"
],
@ -409,9 +422,9 @@
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz",
"integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz",
"integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==",
"cpu": [
"s390x"
],
@ -425,9 +438,9 @@
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz",
"integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz",
"integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==",
"cpu": [
"x64"
],
@ -441,9 +454,9 @@
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz",
"integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz",
"integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==",
"cpu": [
"x64"
],
@ -457,9 +470,9 @@
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz",
"integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz",
"integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==",
"cpu": [
"x64"
],
@ -473,9 +486,9 @@
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz",
"integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz",
"integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==",
"cpu": [
"x64"
],
@ -489,9 +502,9 @@
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz",
"integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz",
"integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==",
"cpu": [
"arm64"
],
@ -505,9 +518,9 @@
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz",
"integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz",
"integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==",
"cpu": [
"ia32"
],
@ -521,9 +534,9 @@
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz",
"integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz",
"integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==",
"cpu": [
"x64"
],
@ -537,32 +550,32 @@
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
"integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==",
"dev": true,
"dependencies": {
"@jridgewell/set-array": "^1.0.1",
"@jridgewell/set-array": "^1.2.1",
"@jridgewell/sourcemap-codec": "^1.4.10",
"@jridgewell/trace-mapping": "^0.3.9"
"@jridgewell/trace-mapping": "^0.3.24"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"dev": true,
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/set-array": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
"dev": true,
"engines": {
"node": ">=6.0.0"
@ -575,9 +588,9 @@
"dev": true
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.21",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz",
"integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==",
"version": "0.3.25",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"dev": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
@ -585,9 +598,9 @@
}
},
"node_modules/@lancedb/vectordb-darwin-arm64": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.10.tgz",
"integrity": "sha512-y/uHOGb0g15pvqv5tdTyZ6oN+0QVpBmZDzKFWW6pPbuSZjB2uPqcs+ti0RB+AUdmS21kavVQqaNsw/HLKEGrHA==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz",
"integrity": "sha512-38/rkJRlWXkPWXuj9onzvbrhnIWcIUQjgEp5G9v5ixPosBowm7A4j8e2Q8CJMsVSNcVX2JLqwWVldiWegZFuYw==",
"cpu": [
"arm64"
],
@ -597,9 +610,9 @@
]
},
"node_modules/@lancedb/vectordb-darwin-x64": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.10.tgz",
"integrity": "sha512-XbfR58OkQpAe0xMSTrwJh9ZjGSzG9EZ7zwO6HfYem8PxcLYAcC6eWRWoSG/T0uObyrPTcYYyvHsp0eNQWYBFAQ==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.12.tgz",
"integrity": "sha512-psE48dztyO450hXWdv9Rl9aayM2HQ1uF9wErfC0gKmDUh1N0NdVq2viDuFpZxnmCis/nvGwKlYiYT9OnYNCJ9g==",
"cpu": [
"x64"
],
@ -609,9 +622,9 @@
]
},
"node_modules/@lancedb/vectordb-linux-arm64-gnu": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.10.tgz",
"integrity": "sha512-x40WKH9b+KxorRmKr9G7fv8p5mMj8QJQvRMA0v6v+nbZHr2FLlAZV+9mvhHOnm4AGIkPP5335cUgv6Qz6hgwkQ==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.12.tgz",
"integrity": "sha512-xwkgF6MiF5aAdG9JG8v4ke652YxUJrhs9z4OrsEfrENnvsIQd2C5UyKMepVLdvij4BI/XPFRFWXdjPvP7S9rTA==",
"cpu": [
"arm64"
],
@ -621,9 +634,9 @@
]
},
"node_modules/@lancedb/vectordb-linux-x64-gnu": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.10.tgz",
"integrity": "sha512-CTGPpuzlqq2nVjUxI9gAJOT1oBANIovtIaFsOmBSnEAHgX7oeAxKy2b6L/kJzsgqSzvR5vfLwYcWFrr6ZmBxSA==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.12.tgz",
"integrity": "sha512-gJqYR0aymrS+C60xc4EQPzmQ5/69XfeFv2ofBvAj7qW+c6BcnoAcfVl+7s1IrcWeGz251sm5cD5Lx4AzJd89dA==",
"cpu": [
"x64"
],
@ -633,9 +646,9 @@
]
},
"node_modules/@lancedb/vectordb-win32-x64-msvc": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.10.tgz",
"integrity": "sha512-Fd7r74coZyrKzkfXg4WthqOL+uKyJyPTia6imcrMNqKOlTGdKmHf02Qi2QxWZrFaabkRYo4Tpn5FeRJ3yYX8CA==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.12.tgz",
"integrity": "sha512-LhCzpyEeBUyO6L2fuVqeP3mW8kYDryyU9PNqcM01m88sZB1Do6AlwiM+GjPRQ0SpzD0LK9oxQqSmJrdcNGqjbw==",
"cpu": [
"x64"
],
@ -735,47 +748,47 @@
}
},
"node_modules/@octokit/openapi-types": {
"version": "19.1.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz",
"integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw=="
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "9.1.5",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.5.tgz",
"integrity": "sha512-WKTQXxK+bu49qzwv4qKbMMRXej1DU2gq017euWyKVudA6MldaSSQuxtz+vGbhxV4CjxpUxjZu6rM2wfc1FiWVg==",
"version": "9.2.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz",
"integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==",
"dependencies": {
"@octokit/types": "^12.4.0"
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": ">=5"
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-request-log": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.0.tgz",
"integrity": "sha512-2uJI1COtYCq8Z4yNSnM231TgH50bRkheQ9+aH8TnZanB6QilOnx8RMD2qsnamSOXtDj0ilxvevf5fGsBhBBzKA==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz",
"integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==",
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": ">=5"
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "10.3.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.3.0.tgz",
"integrity": "sha512-c/fjpoHispRvBZuRoTVt/uALg7pXa9RQbXWJiDMk6NDkGNomuAZG7YuYYpZoxeoXv+kVRjIDTsO0e1z0pei+PQ==",
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz",
"integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==",
"dependencies": {
"@octokit/types": "^12.4.0"
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": ">=5"
"@octokit/core": "5"
}
},
"node_modules/@octokit/request": {
@ -820,22 +833,24 @@
}
},
"node_modules/@octokit/types": {
"version": "12.5.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.5.0.tgz",
"integrity": "sha512-YJEKcb0KkJlIUNU/zjnZwHEP8AoVh/OoIcP/1IyR4UHxExz7fzpe/a8IG4wBtQi7QDEqiomVLX88S6FpxxAJtg==",
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dependencies": {
"@octokit/openapi-types": "^19.1.0"
"@octokit/openapi-types": "^20.0.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",
"integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA=="
"integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==",
"peer": true
},
"node_modules/@types/command-line-usage": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/@types/command-line-usage/-/command-line-usage-5.0.2.tgz",
"integrity": "sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg=="
"integrity": "sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==",
"peer": true
},
"node_modules/@types/follow-redirects": {
"version": "1.14.4",
@ -854,7 +869,8 @@
"node_modules/@types/pad-left": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@types/pad-left/-/pad-left-2.1.1.tgz",
"integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA=="
"integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA==",
"peer": true
},
"node_modules/@types/uuid": {
"version": "9.0.8",
@ -910,6 +926,7 @@
"version": "14.0.2",
"resolved": "https://registry.npmjs.org/apache-arrow/-/apache-arrow-14.0.2.tgz",
"integrity": "sha512-EBO2xJN36/XoY81nhLcwCJgFwkboDZeyNQ+OPsG7bCoQjc2BT0aTyH/MR6SrL+LirSNz+cYqjGRlupMMlP1aEg==",
"peer": true,
"dependencies": {
"@types/command-line-args": "5.2.0",
"@types/command-line-usage": "5.0.2",
@ -930,6 +947,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz",
"integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==",
"peer": true,
"engines": {
"node": ">=6"
}
@ -1072,6 +1090,7 @@
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz",
"integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==",
"peer": true,
"dependencies": {
"chalk": "^4.1.2"
},
@ -1130,6 +1149,7 @@
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz",
"integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==",
"peer": true,
"dependencies": {
"array-back": "^3.1.0",
"find-replace": "^3.0.0",
@ -1144,6 +1164,7 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.1.tgz",
"integrity": "sha512-NCyznE//MuTjwi3y84QVUGEOT+P5oto1e1Pk/jFPVdPPfsG03qpTIl3yw6etR+v73d0lXsoojRpvbru2sqePxQ==",
"peer": true,
"dependencies": {
"array-back": "^6.2.2",
"chalk-template": "^0.4.0",
@ -1158,6 +1179,7 @@
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz",
"integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==",
"peer": true,
"engines": {
"node": ">=12.17"
}
@ -1166,6 +1188,7 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz",
"integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==",
"peer": true,
"engines": {
"node": ">=12.17"
}
@ -1269,17 +1292,6 @@
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"node_modules/encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"dev": true,
"optional": true,
"peer": true,
"dependencies": {
"iconv-lite": "^0.6.2"
}
},
"node_modules/end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
@ -1290,9 +1302,9 @@
}
},
"node_modules/esbuild": {
"version": "0.19.11",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz",
"integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==",
"version": "0.19.12",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz",
"integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==",
"dev": true,
"hasInstallScript": true,
"bin": {
@ -1302,35 +1314,35 @@
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.19.11",
"@esbuild/android-arm": "0.19.11",
"@esbuild/android-arm64": "0.19.11",
"@esbuild/android-x64": "0.19.11",
"@esbuild/darwin-arm64": "0.19.11",
"@esbuild/darwin-x64": "0.19.11",
"@esbuild/freebsd-arm64": "0.19.11",
"@esbuild/freebsd-x64": "0.19.11",
"@esbuild/linux-arm": "0.19.11",
"@esbuild/linux-arm64": "0.19.11",
"@esbuild/linux-ia32": "0.19.11",
"@esbuild/linux-loong64": "0.19.11",
"@esbuild/linux-mips64el": "0.19.11",
"@esbuild/linux-ppc64": "0.19.11",
"@esbuild/linux-riscv64": "0.19.11",
"@esbuild/linux-s390x": "0.19.11",
"@esbuild/linux-x64": "0.19.11",
"@esbuild/netbsd-x64": "0.19.11",
"@esbuild/openbsd-x64": "0.19.11",
"@esbuild/sunos-x64": "0.19.11",
"@esbuild/win32-arm64": "0.19.11",
"@esbuild/win32-ia32": "0.19.11",
"@esbuild/win32-x64": "0.19.11"
"@esbuild/aix-ppc64": "0.19.12",
"@esbuild/android-arm": "0.19.12",
"@esbuild/android-arm64": "0.19.12",
"@esbuild/android-x64": "0.19.12",
"@esbuild/darwin-arm64": "0.19.12",
"@esbuild/darwin-x64": "0.19.12",
"@esbuild/freebsd-arm64": "0.19.12",
"@esbuild/freebsd-x64": "0.19.12",
"@esbuild/linux-arm": "0.19.12",
"@esbuild/linux-arm64": "0.19.12",
"@esbuild/linux-ia32": "0.19.12",
"@esbuild/linux-loong64": "0.19.12",
"@esbuild/linux-mips64el": "0.19.12",
"@esbuild/linux-ppc64": "0.19.12",
"@esbuild/linux-riscv64": "0.19.12",
"@esbuild/linux-s390x": "0.19.12",
"@esbuild/linux-x64": "0.19.12",
"@esbuild/netbsd-x64": "0.19.12",
"@esbuild/openbsd-x64": "0.19.12",
"@esbuild/sunos-x64": "0.19.12",
"@esbuild/win32-arm64": "0.19.12",
"@esbuild/win32-ia32": "0.19.12",
"@esbuild/win32-x64": "0.19.12"
}
},
"node_modules/escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
"integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
"dev": true,
"engines": {
"node": ">=6"
@ -1362,9 +1374,9 @@
}
},
"node_modules/fastq": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz",
"integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==",
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz",
"integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==",
"dev": true,
"dependencies": {
"reusify": "^1.0.4"
@ -1386,6 +1398,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
"integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==",
"peer": true,
"dependencies": {
"array-back": "^3.0.1"
},
@ -1396,12 +1409,13 @@
"node_modules/flatbuffers": {
"version": "23.5.26",
"resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-23.5.26.tgz",
"integrity": "sha512-vE+SI9vrJDwi1oETtTIFldC/o9GsVKRM+s6EL0nQgxXlYV1Vc4Tk30hj4xGICftInKQKj1F3up2n8UbIVobISQ=="
"integrity": "sha512-vE+SI9vrJDwi1oETtTIFldC/o9GsVKRM+s6EL0nQgxXlYV1Vc4Tk30hj4xGICftInKQKj1F3up2n8UbIVobISQ==",
"peer": true
},
"node_modules/follow-redirects": {
"version": "1.15.5",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
"integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [
{
"type": "individual",
@ -1541,9 +1555,9 @@
}
},
"node_modules/hasown": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.2"
@ -1565,20 +1579,6 @@
"node": ">= 6"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"optional": true,
"peer": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -1600,9 +1600,9 @@
]
},
"node_modules/ignore": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz",
"integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==",
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
"integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
"dev": true,
"engines": {
"node": ">= 4"
@ -1709,6 +1709,7 @@
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/json-bignum/-/json-bignum-0.0.3.tgz",
"integrity": "sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg==",
"peer": true,
"engines": {
"node": ">=0.8"
}
@ -1728,12 +1729,14 @@
"node_modules/lodash.assignwith": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz",
"integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g=="
"integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g==",
"peer": true
},
"node_modules/lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"peer": true
},
"node_modules/lru-cache": {
"version": "6.0.0",
@ -1874,9 +1877,9 @@
}
},
"node_modules/node-abi": {
"version": "3.54.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz",
"integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==",
"version": "3.56.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.56.0.tgz",
"integrity": "sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q==",
"dev": true,
"dependencies": {
"semver": "^7.3.5"
@ -1926,6 +1929,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz",
"integrity": "sha512-HJxs9K9AztdIQIAIa/OIazRAUW/L6B9hbQDxO4X07roW3eo9XqZc2ur9bn1StH9CnbbI9EgvejHQX7CBpCF1QA==",
"peer": true,
"dependencies": {
"repeat-string": "^1.5.4"
},
@ -2134,6 +2138,7 @@
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
"integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==",
"peer": true,
"engines": {
"node": ">=0.10"
}
@ -2220,18 +2225,10 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true,
"optional": true,
"peer": true
},
"node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@ -2310,6 +2307,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/stream-read-all/-/stream-read-all-3.0.1.tgz",
"integrity": "sha512-EWZT9XOceBPlVJRrYcykW8jyRSZYbkb/0ZK36uLEmoWVO5gxBOnntNTseNzfREsqxqdfEGQrD8SXQ3QWbBmq8A==",
"peer": true,
"engines": {
"node": ">=10"
}
@ -2385,6 +2383,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/table-layout/-/table-layout-3.0.2.tgz",
"integrity": "sha512-rpyNZYRw+/C+dYkcQ3Pr+rLxW4CfHpXjPDnG7lYhdRoUcZTUt+KEsX+94RGp/aVp/MQU35JCITv2T/beY4m+hw==",
"peer": true,
"dependencies": {
"@75lb/deep-merge": "^1.1.1",
"array-back": "^6.2.2",
@ -2405,6 +2404,7 @@
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz",
"integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==",
"peer": true,
"engines": {
"node": ">=12.17"
}
@ -2413,6 +2413,7 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz",
"integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==",
"peer": true,
"engines": {
"node": ">=12.17"
}
@ -2489,7 +2490,8 @@
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"peer": true
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
@ -2504,9 +2506,9 @@
}
},
"node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -2520,6 +2522,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz",
"integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==",
"peer": true,
"engines": {
"node": ">=8"
}
@ -2557,9 +2560,9 @@
}
},
"node_modules/vectordb": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.10.tgz",
"integrity": "sha512-O6WR65CvpbIbTDs4awKV9smfymVuW1AqYOcdJf8PI0THr1b+h/LyDlAQBf3xBV5Ns8XeaIzWfSHoDspg+WJgKg==",
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.12.tgz",
"integrity": "sha512-H2mFwZ87d3BcuX4yGx5RoW06amRZQ3W5u/FRTNc86rwVINuEEa+Ivsqng1i8hURHXoTDbF/0Y9qwCshySkeznQ==",
"cpu": [
"x64",
"arm64"
@ -2570,17 +2573,19 @@
"win32"
],
"dependencies": {
"@apache-arrow/ts": "^14.0.2",
"@neon-rs/load": "^0.0.74",
"apache-arrow": "^14.0.2",
"axios": "^1.4.0"
},
"optionalDependencies": {
"@lancedb/vectordb-darwin-arm64": "0.4.10",
"@lancedb/vectordb-darwin-x64": "0.4.10",
"@lancedb/vectordb-linux-arm64-gnu": "0.4.10",
"@lancedb/vectordb-linux-x64-gnu": "0.4.10",
"@lancedb/vectordb-win32-x64-msvc": "0.4.10"
"@lancedb/vectordb-darwin-arm64": "0.4.12",
"@lancedb/vectordb-darwin-x64": "0.4.12",
"@lancedb/vectordb-linux-arm64-gnu": "0.4.12",
"@lancedb/vectordb-linux-x64-gnu": "0.4.12",
"@lancedb/vectordb-win32-x64-msvc": "0.4.12"
},
"peerDependencies": {
"@apache-arrow/ts": "^14.0.2",
"apache-arrow": "^14.0.2"
}
},
"node_modules/webidl-conversions": {
@ -2603,6 +2608,7 @@
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz",
"integrity": "sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==",
"peer": true,
"engines": {
"node": ">=12.17"
}

View file

@ -1,4 +1,5 @@
import { ContextItemId, IDE } from "core";
import { CompletionProvider } from "core/autocomplete/completionProvider";
import { ConfigHandler } from "core/config/handler";
import { addModel, addOpenAIKey, deleteModel } from "core/config/util";
import { indexDocs } from "core/indexing/docs";
@ -16,6 +17,7 @@ export class Core {
private readonly ide: IDE;
private readonly configHandler: ConfigHandler;
private readonly codebaseIndexer: CodebaseIndexer;
private readonly completionProvider: CompletionProvider;
private abortedMessageIds: Set<string> = new Set();
@ -46,6 +48,18 @@ export class Core {
new PauseToken(false),
);
const getLlm = async () => {
const config = await this.configHandler.loadConfig();
return config.tabAutocompleteModel;
};
this.completionProvider = new CompletionProvider(
this.configHandler,
ide,
getLlm,
(e) => {},
(..._) => Promise.resolve([]),
);
const on = this.messenger.on.bind(this.messenger);
// New
@ -255,6 +269,20 @@ export class Core {
on("command/run", (msg) =>
runNodeJsSlashCommand(this.configHandler, this.abortedMessageIds, msg),
);
// Autocomplete
on("autocomplete/complete", async (msg) => {
const outcome =
await this.completionProvider.provideInlineCompletionItems(
msg.data,
undefined,
);
return outcome ? [outcome.completion] : [];
});
on("autocomplete/accept", async (msg) => {});
on("autocomplete/cancel", async (msg) => {
this.completionProvider.cancel();
});
}
public invoke<T extends keyof Protocol>(