Merge branch 'main' into no-results-instruction

This commit is contained in:
uinstinct 2025-06-30 11:05:20 +05:30
commit fc47e27df8
153 changed files with 12815 additions and 3141 deletions

View file

@ -0,0 +1,35 @@
---
name: New protocol message
description: Create a new protocol message from core/gui/ide to core/gui/ide
---
Create a new protocol message by taking the following steps:
## 1. Define the message type
Add your new message type definition to the appropriate file in the `protocol/` directory with correct TypeScript typing.
## 2. Check for duplicates
Verify that no existing message type already provides the same functionality.
## 3. Add to passThrough (if webview ↔ core)
If your message is between webview and core, add it to `core/protocol/passThrough.ts`.
## 4. Add to IntelliJ constants (if webview ↔ core)
If your message is between webview and core, add it to `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt`.
## 5. Implement the message handler
Implement the message in the appropriate location:
- **Messages to core**: `core/core.ts`
- **Messages to GUI**: `useWebviewListener` hook
- **Messages to VS Code IDE**: `VsCodeMessenger.ts`
- **Messages to JetBrains IDE**: `IdeProtocolClient.kt`
## 6. Test the implementation
Verify that your message works correctly in both VS Code and JetBrains IDEs if applicable.

View file

@ -0,0 +1,5 @@
---
name: Don't be overeager
---
Avoid over-eagerly adding new features. You should solve the problem at hand and then can propose further work.

View file

@ -104,6 +104,14 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
- name: Build packages (Windows)
run: ./scripts/build-packages.ps1
if: matrix.os == 'windows-latest'
- name: Build packages (Unix)
run: ./scripts/build-packages.sh
if: matrix.os != 'windows-latest'
- name: Install extension Dependencies
run: |
cd extensions/vscode

View file

@ -99,6 +99,14 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
- name: Build packages (Windows)
run: ./scripts/build-packages.ps1
if: matrix.os == 'windows-latest'
- name: Build packages (Unix)
run: ./scripts/build-packages.sh
if: matrix.os != 'windows-latest'
- name: Install extension Dependencies
run: |
cd extensions/vscode

View file

@ -9,38 +9,10 @@ on:
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
cd packages/config-yaml
npm ci
- name: Build
run: |
cd packages/config-yaml
npm run build
- name: Run tests
run: |
cd packages/config-yaml
npm test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/config-yaml
npx semantic-release
uses: ./.github/workflows/reusable-release.yml
with:
package-name: "config-yaml"
package-path: "packages/config-yaml"
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}

18
.github/workflows/release-fetch.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Release @continuedev/fetch
on:
push:
branches:
- main
paths:
- "packages/fetch/**"
jobs:
release:
uses: ./.github/workflows/reusable-release.yml
with:
package-name: "fetch"
package-path: "packages/fetch"
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}

18
.github/workflows/release-llm-info.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Release @continuedev/llm-info
on:
push:
branches:
- main
paths:
- "packages/llm-info/**"
jobs:
release:
uses: ./.github/workflows/reusable-release.yml
with:
package-name: "llm-info"
package-path: "packages/llm-info"
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}

View file

@ -0,0 +1,18 @@
name: Release @continuedev/openai-adapters
on:
push:
branches:
- main
paths:
- "packages/openai-adapters/**"
jobs:
release:
uses: ./.github/workflows/reusable-release.yml
with:
package-name: "openai-adapters"
package-path: "packages/openai-adapters"
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}

55
.github/workflows/reusable-release.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: Reusable Release Workflow
on:
workflow_call:
inputs:
package-name:
required: true
type: string
package-path:
required: true
type: string
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN:
required: true
SEMANTIC_RELEASE_NPM_TOKEN:
required: true
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
name: Release ${{ inputs.package-name }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.package-path }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
run: npx semantic-release

26
.vscode/launch.json vendored
View file

@ -73,32 +73,6 @@
"sourceMaps": true
// "preLaunchTask": "gui:dev"
},
// Has to be run after starting the server (separately or using the compound configuration)
{
"name": "Run tests",
"type": "extensionHost",
"request": "launch",
"cwd": "${workspaceFolder}/extensions/vscode",
"runtimeExecutable": "${execPath}",
"args": [
// Pass a directory to run tests in
"${workspaceFolder}/extensions/vscode/manual-testing-sandbox",
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
"--extensionTestsPath=${workspaceFolder}/extensions/vscode/out/test/runner/mochaRunner"
],
"outFiles": [
// Allows setting breakpoints in test suites across the /src folder
"${workspaceFolder}/extensions/vscode/out/test/test-suites/**/*.js",
// Allows setting breakpoints in mocha test runner file
"${workspaceFolder}/extensions/vscode/out/test/runner/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "vscode-extension:tests:build",
"env": {
// Avoid timing out when stopping on breakpoints during debugging in VSCode
"MOCHA_TIMEOUT": "0"
}
},
{
"name": "[Core] Jest Test Debugger, Current Open File",
"type": "node",

36
.vscode/tasks.json vendored
View file

@ -103,42 +103,12 @@
"clear": true
},
"options": {
"env": {
"SKIP_INSTALLS": "true"
},
"cwd": "${workspaceFolder}/extensions/vscode"
}
},
//
// Compile and bundle tests
{
"label": "vscode-extension:tests:build",
"dependsOn": [
// Build the extension
"vscode-extension:build",
// To detect compile errors - this type checks both the extension and the tests
"tsc:watch",
"vscode-extension:tests:esbuild"
]
},
{
"label": "vscode-extension:tests:esbuild",
"type": "npm",
"script": "build-test",
"path": "extensions/vscode",
"problemMatcher": [
{
"pattern": [
{
"regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
},
//
// Install or update all dependencies for all projects in the monrepo
{
"label": "install-all-dependencies",

View file

@ -3,13 +3,13 @@ const fs = require("fs");
const path = require("path");
const ncp = require("ncp").ncp;
const { rimrafSync } = require("rimraf");
const {
validateFilesPresent,
execCmdSync,
autodetectPlatformAndArch,
} = require("../scripts/util");
const { downloadRipgrep } = require("./utils/ripgrep");
const { validateFilesPresent } = require("../scripts/util");
const { ALL_TARGETS, TARGET_TO_LANCEDB } = require("./utils/targets");
const { fork } = require("child_process");
const {
installAndCopyNodeModules,
} = require("../extensions/vscode/scripts/install-copy-nodemodule");
const { bundleBinary } = require("./utils/bundle-binary");
const bin = path.join(__dirname, "bin");
const out = path.join(__dirname, "out");
@ -29,8 +29,6 @@ function cleanSlate() {
const esbuildOutputFile = "out/index.js";
let targets = [...ALL_TARGETS];
const [currentPlatform, currentArch] = autodetectPlatformAndArch();
const assetBackups = [
"node_modules/win-ca/lib/crypt32-ia32.node.bak",
"node_modules/win-ca/lib/crypt32-x64.node.bak",
@ -78,85 +76,6 @@ async function buildWithEsbuild() {
});
}
async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
console.log(`Copying ${packageName} to ${toCopy}`);
// This is a way to install only one package without npm trying to install all the dependencies
// Create a temporary directory for installing the package
const adjustedName = packageName.replace(/@/g, "").replace("/", "-");
const tempDir = path.join(
__dirname,
"tmp",
`continue-node_modules-${adjustedName}`,
);
const currentDir = process.cwd();
// // Remove the dir we will be copying to
// rimrafSync(`node_modules/${toCopy}`);
// // Ensure the temporary directory exists
fs.mkdirSync(tempDir, { recursive: true });
try {
// Move to the temporary directory
process.chdir(tempDir);
// Initialize a new package.json and install the package
execCmdSync(`npm init -y && npm i -f ${packageName} --no-save`);
console.log(
`Contents of: ${packageName}`,
fs.readdirSync(path.join(tempDir, "node_modules", toCopy)),
);
// Without this it seems the file isn't completely written to disk
await new Promise((resolve) => setTimeout(resolve, 2000));
// Copy the installed package back to the current directory
await new Promise((resolve, reject) => {
ncp(
path.join(tempDir, "node_modules", toCopy),
path.join(currentDir, "node_modules", toCopy),
{ dereference: true },
(error) => {
if (error) {
console.error(
`[error] Error copying ${packageName} package`,
error,
);
reject(error);
} else {
resolve();
}
},
);
});
} finally {
// Clean up the temporary directory
// rimrafSync(tempDir);
// Return to the original directory
process.chdir(currentDir);
}
}
/**
* Downloads and installs ripgrep binaries for the specified target
*
* @param {string} target - Target platform-arch (e.g., 'darwin-x64')
* @param {string} targetDir - Directory to install ripgrep to
* @returns {Promise<void>}
*/
async function downloadRipgrepForTarget(target, targetDir) {
console.log(`[info] Downloading ripgrep for ${target}...`);
try {
await downloadRipgrep(target, targetDir);
console.log(`[info] Successfully installed ripgrep for ${target}`);
} catch (error) {
console.error(`[error] Failed to download ripgrep for ${target}:`, error);
throw error;
}
}
(async () => {
if (esbuildOnly) {
await buildWithEsbuild();
@ -181,16 +100,21 @@ async function downloadRipgrepForTarget(target, targetDir) {
),
);
console.log("[info] Downloading prebuilt lancedb...");
const copyLanceDBPromises = [];
for (const target of targets) {
if (TARGET_TO_LANCEDB[target]) {
console.log(`[info] Downloading for ${target}...`);
await installNodeModuleInTempDirAndCopyToCurrent(
TARGET_TO_LANCEDB[target],
"@lancedb",
);
if (!TARGET_TO_LANCEDB[target]) {
continue;
}
console.log(`[info] Downloading for ${target}...`);
copyLanceDBPromises.push(
installAndCopyNodeModules(TARGET_TO_LANCEDB[target], "@lancedb"),
);
}
await Promise.all(copyLanceDBPromises).catch(() => {
console.error("[error] Failed to copy LanceDB");
process.exit(1);
});
console.log("[info] Copied all LanceDB");
// tree-sitter-wasm
const treeSitterWasmsDir = path.join(out, "tree-sitter-wasms");
@ -252,59 +176,16 @@ async function downloadRipgrepForTarget(target, targetDir) {
"out/llamaTokenizerWorkerPool.mjs",
);
const buildBinaryPromises = [];
console.log("[info] Building binaries with pkg...");
for (const target of targets) {
const targetDir = `bin/${target}`;
fs.mkdirSync(targetDir, { recursive: true });
console.log(`[info] Building ${target}...`);
execCmdSync(
`npx pkg --no-bytecode --public-packages "*" --public --compress GZip pkgJson/${target} --out-path ${targetDir}`,
);
// Download and unzip prebuilt sqlite3 binary for the target
console.log("[info] Downloading node-sqlite3");
const downloadUrl =
// node-sqlite3 doesn't have a pre-built binary for win32-arm64
target === "win32-arm64"
? "https://continue-server-binaries.s3.us-west-1.amazonaws.com/win32-arm64/node_sqlite3.tar.gz"
: `https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-${
target
}.tar.gz`;
execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`);
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
// Copy to build directory for testing
try {
const [platform, arch] = target.split("-");
if (platform === currentPlatform && arch === currentArch) {
fs.copyFileSync(
`${targetDir}/build/Release/node_sqlite3.node`,
`build/node_sqlite3.node`,
);
}
} catch (error) {
console.log("[warn] Could not copy node_sqlite to build");
console.log(error);
}
fs.unlinkSync(`${targetDir}/build.tar.gz`);
// copy @lancedb to bin folders
console.log("[info] Copying @lancedb files to bin");
fs.copyFileSync(
`node_modules/${TARGET_TO_LANCEDB[target]}/index.node`,
`${targetDir}/index.node`,
);
// Download and install ripgrep for the target
await downloadRipgrepForTarget(target, targetDir);
// Informs the `continue-binary` of where to look for node_sqlite3.node
// https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
fs.writeFileSync(`${targetDir}/package.json`, "");
buildBinaryPromises.push(bundleBinary(target));
}
await Promise.all(buildBinaryPromises).catch(() => {
console.error("[error] Failed to build binaries");
process.exit(1);
});
console.log("[info] All binaries built");
// Cleanup - this is needed when running locally
fs.rmSync("out/package.json");
@ -331,4 +212,5 @@ async function downloadRipgrepForTarget(target, targetDir) {
validateFilesPresent(pathsToVerify);
console.log("[info] Done!");
process.exit(0);
})();

View file

@ -53,9 +53,9 @@
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.13",
"@continuedev/fetch": "^1.0.14",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "^1.0.32",
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
"@modelcontextprotocol/sdk": "^1.12.0",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.1.1",
@ -106,7 +106,6 @@
"sqlite3": "^5.1.7",
"system-ca": "^1.0.3",
"tar": "^7.4.3",
"tree-sitter-structured-text": "^0.0.1",
"tree-sitter-wasms": "^0.1.11",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
@ -145,7 +144,6 @@
"myers-diff": "^2.1.0",
"onnxruntime-common": "1.14.0",
"onnxruntime-web": "1.14.0",
"tree-sitter-cli": "^0.22.5",
"ts-jest": "^29.1.1",
"typescript": "^5.6.3",
"vitest": "^3.1.4"

View file

@ -0,0 +1,103 @@
/**
* @file Builds the binary for the specified target. It is also intended to run as a child process.
*/
const {
execCmdSync,
autodetectPlatformAndArch,
} = require("../../scripts/util");
const { downloadRipgrep } = require("./ripgrep");
const { TARGET_TO_LANCEDB } = require("../utils/targets");
const fs = require("fs");
const {
downloadSqlite,
} = require("../../extensions/vscode/scripts/download-copy-sqlite-esbuild");
const { fork } = require("child_process");
async function downloadNodeSqlite(target, targetDir) {
const [currentPlatform, currentArch] = autodetectPlatformAndArch();
// Download and unzip prebuilt sqlite3 binary for the target
console.log("[info] Downloading node-sqlite3");
await downloadSqlite(target, `${targetDir}/build.tar.gz`);
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
// Copy to build directory for testing
try {
const [platform, arch] = target.split("-");
if (platform === currentPlatform && arch === currentArch) {
fs.copyFileSync(
`${targetDir}/build/Release/node_sqlite3.node`,
`build/node_sqlite3.node`,
);
}
} catch (error) {
console.log("[warn] Could not copy node_sqlite to build");
console.log(error);
}
fs.unlinkSync(`${targetDir}/build.tar.gz`);
}
/**
* @param {string} target the platform to build for
*/
async function bundleForBinary(target) {
const targetDir = `bin/${target}`;
fs.mkdirSync(targetDir, { recursive: true });
console.log(`[info] Building ${target}...`);
execCmdSync(
`npx pkg --no-bytecode --public-packages "*" --public --compress GZip pkgJson/${target} --out-path ${targetDir}`,
);
// copy @lancedb to bin folders
console.log("[info] Copying @lancedb files to bin");
fs.copyFileSync(
`node_modules/${TARGET_TO_LANCEDB[target]}/index.node`,
`${targetDir}/index.node`,
);
const downloadPromises = [];
downloadPromises.push(downloadRipgrep(target, targetDir));
downloadPromises.push(downloadNodeSqlite(target, targetDir));
await Promise.all(downloadPromises);
// Informs the `continue-binary` of where to look for node_sqlite3.node
// https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
fs.writeFileSync(`${targetDir}/package.json`, "");
}
process.on("message", (msg) => {
bundleForBinary(msg.payload.target)
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
});
/**
* @param {string} target the platform to bundle for
*/
async function bundleBinary(target) {
const child = fork(__filename, { stdio: "inherit" });
child.send({
payload: {
target,
},
});
return new Promise((resolve, reject) => {
child.on("message", (msg) => {
if (msg.error) {
reject();
} else {
resolve();
}
});
});
}
module.exports = {
bundleBinary,
};

View file

@ -1,88 +0,0 @@
import { CustomCommand, SlashCommand, SlashCommandDescription } from "../";
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
import { replaceSlashCommandWithPromptInChatHistory } from "../promptFiles/v1/updateChatHistory";
import { renderPromptFileV2 } from "../promptFiles/v2/renderPromptFile";
import { renderChatMessage } from "../util/messageContent";
import SlashCommands from "./slash";
export function slashFromCustomCommand(
customCommand: CustomCommand,
): SlashCommand {
const commandName = customCommand.name.startsWith("/")
? customCommand.name.substring(1)
: customCommand.name;
return {
name: commandName,
description: customCommand.description ?? "",
prompt: customCommand.prompt,
run: async function* ({
input,
llm,
history,
ide,
completionOptions,
config,
selectedCode,
fetch,
abortController,
}) {
// Render prompt template
let renderedPrompt: string;
if (customCommand.prompt.includes("{{{ input }}}")) {
renderedPrompt = await renderTemplatedString(
customCommand.prompt,
ide.readFile.bind(ide),
{ input },
);
} else {
const renderedPromptFile = await renderPromptFileV2(
customCommand.prompt,
{
config,
llm,
ide,
selectedCode,
fetch,
fullInput: input,
embeddingsProvider: config.modelsByRole.embed[0],
reranker: config.modelsByRole.rerank[0],
},
);
renderedPrompt = renderedPromptFile[1];
}
// Replaces slash command messages with the rendered prompt
// which INCLUDES the input
const messages = replaceSlashCommandWithPromptInChatHistory(
history,
commandName,
renderedPrompt,
undefined,
);
for await (const chunk of llm.streamChat(
messages,
abortController.signal,
completionOptions,
)) {
yield renderChatMessage(chunk);
}
},
};
}
export function slashCommandFromDescription(
desc: SlashCommandDescription,
): SlashCommand | undefined {
const cmd = SlashCommands.find((cmd) => cmd.name === desc.name);
if (!cmd) {
return undefined;
}
return {
...cmd,
params: desc.params,
description: desc.description ?? cmd.description,
};
}

View file

@ -1,6 +1,6 @@
import { streamLines } from "../../diff/util.js";
import { SlashCommand } from "../../index.js";
import { removeQuotesAndEscapes } from "../../util/index.js";
import { streamLines } from "../../../diff/util.js";
import { SlashCommand } from "../../../index.js";
import { removeQuotesAndEscapes } from "../../../util/index.js";
function commandIsPotentiallyDangerous(command: string) {
return (

View file

@ -1,5 +1,5 @@
import { SlashCommand } from "../../index.js";
import { renderChatMessage } from "../../util/messageContent.js";
import { SlashCommand } from "../../../index.js";
import { renderChatMessage } from "../../../util/messageContent.js";
const CommitMessageCommand: SlashCommand = {
name: "commit",

View file

@ -1,6 +1,6 @@
import { ChatMessage, SlashCommand } from "../../index.js";
import { removeQuotesAndEscapes } from "../../util/index.js";
import { renderChatMessage } from "../../util/messageContent.js";
import { ChatMessage, SlashCommand } from "../../../index.js";
import { removeQuotesAndEscapes } from "../../../util/index.js";
import { renderChatMessage } from "../../../util/messageContent.js";
const PROMPT = (
input: string,

View file

@ -1,6 +1,6 @@
import { streamResponse } from "@continuedev/fetch";
import { SlashCommand } from "../../index.js";
import { removeQuotesAndEscapes } from "../../util/index.js";
import { SlashCommand } from "../../../index.js";
import { removeQuotesAndEscapes } from "../../../util/index.js";
const HttpSlashCommand: SlashCommand = {
name: "http",

View file

@ -0,0 +1,37 @@
import {
SlashCommand,
SlashCommandDescription,
SlashCommandWithSource,
} from "../../..";
import GenerateTerminalCommand from "./cmd";
import CommitMessageCommand from "./commit";
import DraftIssueCommand from "./draftIssue";
import HttpSlashCommand from "./http";
import OnboardSlashCommand from "./onboard";
import ReviewMessageCommand from "./review";
import ShareSlashCommand from "./share";
const LegacyBuiltInSlashCommands: SlashCommand[] = [
DraftIssueCommand,
ShareSlashCommand,
GenerateTerminalCommand,
HttpSlashCommand,
CommitMessageCommand,
ReviewMessageCommand,
OnboardSlashCommand,
];
export function getLegacyBuiltInSlashCommandFromDescription(
desc: SlashCommandDescription,
): SlashCommandWithSource | undefined {
const cmd = LegacyBuiltInSlashCommands.find((cmd) => cmd.name === desc.name);
if (!cmd) {
return undefined;
}
return {
...cmd,
params: desc.params,
description: desc.description ?? cmd.description,
source: "built-in-legacy",
};
}

View file

@ -1,17 +1,17 @@
import ignore from "ignore";
import type { FileType, IDE, SlashCommand } from "../..";
import type { FileType, IDE, SlashCommand } from "../../..";
import {
DEFAULT_IGNORE,
getGlobalContinueIgArray,
gitIgArrayFromFile,
} from "../../indexing/ignore";
import { renderChatMessage } from "../../util/messageContent";
} from "../../../indexing/ignore";
import { renderChatMessage } from "../../../util/messageContent";
import {
findUriInDirs,
getUriPathBasename,
joinPathsToUri,
} from "../../util/uri";
} from "../../../util/uri";
const LANGUAGE_DEP_MGMT_FILENAMES = [
"package.json", // JavaScript (Node.js)

View file

@ -1,5 +1,5 @@
import { ChatMessage, SlashCommand } from "../../index.js";
import { renderChatMessage } from "../../util/messageContent.js";
import { ChatMessage, SlashCommand } from "../../../index.js";
import { renderChatMessage } from "../../../util/messageContent.js";
const prompt = `
Review the following code, focusing on Readability, Maintainability, Code Smells, Speed, and Memory Performance. Provide feedback with these guidelines:

View file

@ -3,10 +3,10 @@ import { homedir } from "node:os";
import { fileURLToPath, pathToFileURL } from "node:url";
import path from "path";
import { languageForFilepath } from "../../autocomplete/constants/AutocompleteLanguageInfo.js";
import { SlashCommand } from "../../index.js";
import { renderChatMessage } from "../../util/messageContent.js";
import { getContinueGlobalPath } from "../../util/paths.js";
import { languageForFilepath } from "../../../autocomplete/constants/AutocompleteLanguageInfo.js";
import { SlashCommand } from "../../../index.js";
import { renderChatMessage } from "../../../util/messageContent.js";
import { getContinueGlobalPath } from "../../../util/paths.js";
// If useful elsewhere, helper funcs should move to core/util/index.ts or similar
function getOffsetDatetime(date: Date): Date {

View file

@ -0,0 +1,15 @@
import { CustomCommand, SlashCommandWithSource } from "../..";
export function convertCustomCommandToSlashCommand(
customCommand: CustomCommand,
): SlashCommandWithSource {
const commandName = customCommand.name.startsWith("/")
? customCommand.name.substring(1)
: customCommand.name;
return {
name: commandName,
description: customCommand.description ?? "",
prompt: customCommand.prompt,
source: "json-custom-command",
};
}

View file

@ -1,17 +0,0 @@
import GenerateTerminalCommand from "./cmd";
import CommitMessageCommand from "./commit";
import DraftIssueCommand from "./draftIssue";
import HttpSlashCommand from "./http";
import OnboardSlashCommand from "./onboard";
import ReviewMessageCommand from "./review";
import ShareSlashCommand from "./share";
export default [
DraftIssueCommand,
ShareSlashCommand,
GenerateTerminalCommand,
HttpSlashCommand,
CommitMessageCommand,
ReviewMessageCommand,
OnboardSlashCommand,
];

View file

@ -1,70 +0,0 @@
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { PromptMessage } from "@modelcontextprotocol/sdk/types.js";
import { ChatMessage, SlashCommand } from "../../index.js";
import { renderChatMessage } from "../../util/messageContent.js";
export function constructMcpSlashCommand(
client: Client,
name: string,
description?: string,
args?: string[],
): SlashCommand {
return {
name,
description: description ?? "MCP Prompt",
params: {},
run: async function* (context) {
const argsObject: { [key: string]: string } = {};
const userInput = context.input.split(" ").slice(1).join(" ");
if (args) {
args.forEach((arg, i) => {
argsObject[arg] = ""; // userInput
});
}
const result = await client.getPrompt({ name, arguments: argsObject });
const mcpMessages: PromptMessage[] = result.messages;
const messages: ChatMessage[] = mcpMessages.map((msg) => {
if (msg.content.type !== "text") {
throw new Error(
"Continue currently only supports text prompts through MCP",
);
}
return {
content: msg.content.text,
role: msg.role,
};
});
if (messages.length === 0) {
yield "The MCP prompt returned no messages";
return;
}
if (userInput) {
const lastMessage = messages.at(-1);
if (!lastMessage || lastMessage.role !== "user") {
messages.push({
role: "user",
content: userInput,
});
} else {
let newContent = renderChatMessage(lastMessage);
if (newContent) {
newContent += "\n\n";
}
newContent += userInput;
lastMessage.content = newContent;
}
}
for await (const chunk of context.llm.streamChat(
messages,
context.abortController.signal,
context.completionOptions,
)) {
yield renderChatMessage(chunk);
}
},
};
}

View file

@ -0,0 +1,34 @@
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SlashCommandWithSource } from "../../index.js";
export function constructMcpSlashCommand(
client: Client,
name: string,
description?: string,
args?: string[],
): SlashCommandWithSource {
return {
name,
description: description ?? "MCP Prompt",
source: "mcp-prompt",
params: {},
};
}
export function stringifyMcpPrompt(
prompt: Awaited<ReturnType<typeof Client.prototype.getPrompt>>,
): string {
const { messages } = prompt;
let stringified = "";
for (const message of messages) {
if (message.content.type === "text") {
stringified += `<${message.content.role}/>\n${message.content.text}\n<${message.content.role}/>`;
} else {
console.warn(
`MCP Prompt conversion warning: ${message.content.type} content is not yet supported, message skipped`,
);
}
}
return stringified;
}

View file

@ -0,0 +1,13 @@
import { Prompt } from "@continuedev/config-yaml";
import { SlashCommandWithSource } from "../..";
export function convertPromptBlockToSlashCommand(
prompt: Prompt,
): SlashCommandWithSource {
return {
name: prompt.name,
description: prompt.description ?? "",
prompt: prompt.prompt,
source: "yaml-prompt-block",
};
}

View file

@ -0,0 +1,21 @@
import { SlashCommandWithSource } from "../..";
import { parsePromptFile } from "../../promptFiles/parsePromptFile";
export function slashCommandFromPromptFile(
path: string,
content: string,
): SlashCommandWithSource | null {
const { name, description, systemMessage, prompt, version } = parsePromptFile(
path,
content,
);
return {
name,
description,
prompt,
source: version === 1 ? "prompt-file-v1" : "prompt-file-v2",
promptFile: path,
overrideSystemMessage: systemMessage,
};
}

View file

@ -16,7 +16,7 @@ export function rifWithContentsToContextItem(
return {
content: rif.contents,
name: `${basename} ${rangeStr}`,
description: `${relativePathOrBasename} ${rangeStr}`, // This is passed to the LLM - do not pass full URI
description: `${relativePathOrBasename} ${rangeStr}`,
id: {
providerTitle: "code",
itemId: uuidv4(),

View file

@ -30,12 +30,11 @@ import {
ModelDescription,
RerankerDescription,
SerializedContinueConfig,
SlashCommand,
SlashCommandWithSource,
} from "..";
import {
slashCommandFromDescription,
slashFromCustomCommand,
} from "../commands/index";
import { getLegacyBuiltInSlashCommandFromDescription } from "../commands/slash/built-in-legacy";
import { convertCustomCommandToSlashCommand } from "../commands/slash/customSlashCommand";
import { slashCommandFromPromptFile } from "../commands/slash/promptFileSlashCommand";
import { MCPManagerSingleton } from "../context/mcp/MCPManagerSingleton";
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider";
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider";
@ -48,8 +47,7 @@ import { LLMClasses, llmFromDescription } from "../llm/llms";
import CustomLLMClass from "../llm/llms/CustomLLM";
import { LLMReranker } from "../llm/llms/llm";
import TransformersJsEmbeddingsProvider from "../llm/llms/TransformersJsEmbeddingsProvider";
import { slashCommandFromPromptFileV1 } from "../promptFiles/v1/slashCommandFromPromptFile";
import { getAllPromptFiles } from "../promptFiles/v2/getPromptFiles";
import { getAllPromptFiles } from "../promptFiles/getPromptFiles";
import { copyOf } from "../util";
import { GlobalContext } from "../util/GlobalContext";
import mergeJson from "../util/merge";
@ -66,6 +64,7 @@ import {
import { localPathToUri } from "../util/pathToUri";
import { baseToolDefinitions } from "../tools";
import { resolveRelativePathInDir } from "../util/ideUtils";
import { modifyAnyConfigWithSharedConfig } from "./sharedConfig";
import {
getModelByRole,
@ -174,15 +173,15 @@ async function serializedToIntermediateConfig(
ide: IDE,
): Promise<Config> {
// DEPRECATED - load custom slash commands
const slashCommands: SlashCommand[] = [];
const slashCommands: SlashCommandWithSource[] = [];
for (const command of initial.slashCommands || []) {
const newCommand = slashCommandFromDescription(command);
const newCommand = getLegacyBuiltInSlashCommandFromDescription(command);
if (newCommand) {
slashCommands.push(newCommand);
}
}
for (const command of initial.customCommands || []) {
slashCommands.push(slashFromCustomCommand(command));
slashCommands.push(convertCustomCommandToSlashCommand(command));
}
// DEPRECATED - load slash commands from v1 prompt files
@ -194,7 +193,7 @@ async function serializedToIntermediateConfig(
);
for (const file of promptFiles) {
const slashCommand = slashCommandFromPromptFileV1(file.path, file.content);
const slashCommand = slashCommandFromPromptFile(file.path, file.content);
if (slashCommand) {
slashCommands.push(slashCommand);
}
@ -254,7 +253,10 @@ async function intermediateToFinalConfig({
loadPromptFiles?: boolean;
}): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> {
const errors: ConfigValidationError[] = [];
const workspaceDirs = await ide.getWorkspaceDirs();
const getUriFromPath = (path: string) => {
return resolveRelativePathInDir(path, ide, workspaceDirs);
};
// Auto-detect models
let models: BaseLLM[] = [];
await Promise.all(
@ -263,6 +265,7 @@ async function intermediateToFinalConfig({
const llm = await llmFromDescription(
desc,
ide.readFile.bind(ide),
getUriFromPath,
uniqueId,
ideSettings,
llmLogger,
@ -284,6 +287,7 @@ async function intermediateToFinalConfig({
title: modelName,
},
ide.readFile.bind(ide),
getUriFromPath,
uniqueId,
ideSettings,
llmLogger,
@ -360,6 +364,7 @@ async function intermediateToFinalConfig({
const llm = await llmFromDescription(
desc,
ide.readFile.bind(ide),
getUriFromPath,
uniqueId,
ideSettings,
llmLogger,
@ -529,7 +534,7 @@ async function intermediateToFinalConfig({
contextProviders,
tools: [...baseToolDefinitions],
mcpServerStatuses: [],
slashCommands: config.slashCommands ?? [],
slashCommands: [],
modelsByRole: {
chat: models,
edit: models,
@ -551,6 +556,17 @@ async function intermediateToFinalConfig({
rules: [],
};
for (const cmd of config.slashCommands ?? []) {
if ("source" in cmd) {
continueConfig.slashCommands.push(cmd);
} else {
continueConfig.slashCommands.push({
...cmd,
source: "config-ts-slash-command",
});
}
}
if (config.systemMessage) {
continueConfig.rules.unshift({
rule: config.systemMessage,
@ -651,9 +667,10 @@ async function finalToBrowserConfig(
return {
allowAnonymousTelemetry: final.allowAnonymousTelemetry,
completionOptions: final.completionOptions,
slashCommands: final.slashCommands?.map(
({ run, ...slashCommandDescription }) => slashCommandDescription,
),
slashCommands: final.slashCommands?.map(({ run, ...rest }) => ({
...rest,
isLegacy: !!run,
})),
contextProviders: final.contextProviders?.map((c) => c.description),
disableIndexing: final.disableIndexing,
disableSessionTitles: final.disableSessionTitles,
@ -975,7 +992,6 @@ async function loadContinueConfigFromJson(
export {
finalToBrowserConfig,
intermediateToFinalConfig,
loadContinueConfigFromJson,
type BrowserSerializedContinueConfig,
};

View file

@ -16,9 +16,9 @@ import {
ILLMLogger,
RuleWithSource,
SerializedContinueConfig,
SlashCommandDescWithSource,
Tool,
} from "../../";
import { constructMcpSlashCommand } from "../../commands/slash/mcp";
import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton";
import MCPContextProvider from "../../context/providers/MCPContextProvider";
import RulesContextProvider from "../../context/providers/RulesContextProvider";
@ -190,14 +190,15 @@ export default async function doLoadConfig(options: {
}));
newConfig.tools.push(...serverTools);
const serverSlashCommands = server.prompts.map((prompt) =>
constructMcpSlashCommand(
server.client,
prompt.name,
prompt.description,
prompt.arguments?.map((a: any) => a.name),
),
);
const serverSlashCommands: SlashCommandDescWithSource[] =
server.prompts.map((prompt) => ({
name: prompt.name,
description: prompt.description ?? "MCP Prompt",
source: "mcp-prompt",
isLegacy: false,
mcpServerName: server.name, // Used in client to retrieve prompt
mcpArgs: prompt.arguments,
}));
newConfig.slashCommands.push(...serverSlashCommands);
const submenuItems = server.resources

View file

@ -25,7 +25,6 @@ import {
ILLMLogger,
RuleWithSource,
} from "../..";
import { slashFromCustomCommand } from "../../commands";
import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton";
import CodebaseContextProvider from "../../context/providers/CodebaseContextProvider";
import DocsContextProvider from "../../context/providers/DocsContextProvider";
@ -33,13 +32,14 @@ import FileContextProvider from "../../context/providers/FileContextProvider";
import { contextProviderClassFromName } from "../../context/providers/index";
import { ControlPlaneClient } from "../../control-plane/client";
import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider";
import { slashCommandFromPromptFileV1 } from "../../promptFiles/v1/slashCommandFromPromptFile";
import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles";
import { getAllPromptFiles } from "../../promptFiles/getPromptFiles";
import { GlobalContext } from "../../util/GlobalContext";
import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
import { convertPromptBlockToSlashCommand } from "../../commands/slash/promptBlockSlashCommand";
import { slashCommandFromPromptFile } from "../../commands/slash/promptFileSlashCommand";
import { getControlPlaneEnvSync } from "../../control-plane/env";
import { baseToolDefinitions } from "../../tools";
import { getToolsForIde } from "../../tools";
import { getCleanUriPath } from "../../util/uri";
import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
import { LocalPlatformClient } from "./LocalPlatformClient";
@ -187,7 +187,7 @@ async function configYamlToContinueConfig(options: {
const continueConfig: ContinueConfig = {
slashCommands: [],
tools: [...baseToolDefinitions],
tools: await getToolsForIde(ide),
mcpServerStatuses: [],
contextProviders: [],
modelsByRole: {
@ -263,7 +263,7 @@ async function configYamlToContinueConfig(options: {
promptFiles.forEach((file) => {
try {
const slashCommand = slashCommandFromPromptFileV1(
const slashCommand = slashCommandFromPromptFile(
file.path,
file.content,
);
@ -286,7 +286,7 @@ async function configYamlToContinueConfig(options: {
config.prompts?.forEach((prompt) => {
try {
const slashCommand = slashFromCustomCommand(prompt);
const slashCommand = convertPromptBlockToSlashCommand(prompt);
continueConfig.slashCommands?.push(slashCommand);
} catch (e) {
localErrors.push({

View file

@ -161,4 +161,21 @@ export class MCPManagerSingleton {
client: connection.client,
}));
}
async getPrompt(
serverName: string,
promptName: string,
args: Record<string, string> = {},
) {
const connection = this.connections.get(serverName);
if (!connection) {
throw new Error(
`Error getting prompt: MCP Connection ${serverName} not found`,
);
}
return await connection.client.getPrompt({
name: promptName,
arguments: args,
});
}
}

View file

@ -21,7 +21,9 @@ class TerminalContextProvider extends BaseContextProvider {
return [
{
description: "The contents of the terminal",
content: `Current terminal contents:\n\n${content}`,
content: `Current terminal contents:\n\n${
content || "The terminal is empty."
}`,
name: "Terminal",
},
];

View file

@ -21,7 +21,7 @@ import { CodebaseIndexer } from "./indexing/CodebaseIndexer";
import DocsService from "./indexing/docs/DocsService";
import { countTokens } from "./llm/countTokens";
import Ollama from "./llm/llms/Ollama";
import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile";
import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile";
import { callTool } from "./tools/callTool";
import { ChatDescriber } from "./util/chatDescriber";
import { clipboardCache } from "./util/clipboardCache";
@ -50,6 +50,7 @@ import {
import { BLOCK_TYPES, ConfigYaml } from "@continuedev/config-yaml";
import { getDiffFn, GitDiffCache } from "./autocomplete/snippets/gitDiffCache";
import { stringifyMcpPrompt } from "./commands/slash/mcpSlashCommand";
import { isLocalDefinitionFile } from "./config/loadLocalAssistants";
import {
setupLocalConfig,
@ -381,6 +382,19 @@ export class Core {
on("mcp/reloadServer", async (msg) => {
await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id);
});
on("mcp/getPrompt", async (msg) => {
const { serverName, promptName, args } = msg.data;
const prompt = await MCPManagerSingleton.getInstance().getPrompt(
serverName,
promptName,
args,
);
const stringifiedPrompt = stringifyMcpPrompt(prompt);
return {
prompt: stringifiedPrompt,
description: prompt.description,
};
});
// Context providers
on("context/addDocs", async (msg) => {
void this.docsService.indexAndAdd(msg.data);

55
core/index.d.ts vendored
View file

@ -731,6 +731,8 @@ export interface IDE {
isTelemetryEnabled(): Promise<boolean>;
isWorkspaceRemote(): Promise<boolean>;
getUniqueId(): Promise<string>;
getTerminalContents(): Promise<string>;
@ -836,15 +838,44 @@ export interface ContinueSDK {
abortController: AbortController;
}
export interface SlashCommand {
/* Be careful changing SlashCommand or SlashCommandDescription, config.ts can break */
export interface SlashCommandDescription {
name: string;
description: string;
prompt?: string;
params?: { [key: string]: any };
promptFile?: string;
}
export interface SlashCommand extends SlashCommandDescription {
run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
}
export interface SlashCommandWithSource extends SlashCommandDescription {
run?: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; // Optional - only needed for legacy
source: SlashCommandSource;
promptFile?: string;
overrideSystemMessage?: string;
}
export type SlashCommandSource =
| "built-in-legacy"
| "built-in"
| "json-custom-command"
| "config-ts-slash-command"
| "yaml-prompt-block"
| "mcp-prompt"
| "prompt-file-v1"
| "prompt-file-v2"
| "invokable-rule";
export interface SlashCommandDescWithSource extends SlashCommandDescription {
isLegacy: boolean; // Maps to if slashcommand.run exists
source: SlashCommandSource;
promptFile?: string;
mcpServerName?: string;
mcpArgs?: MCPPromptArgs;
}
// Config
export type StepName =
@ -945,8 +976,6 @@ export interface ContextProviderWithParams {
params: { [key: string]: any };
}
export type SlashCommandDescription = Omit<SlashCommand, "run">;
export interface CustomCommand {
name: string;
prompt: string;
@ -1170,14 +1199,16 @@ export type MCPConnectionStatus =
| "error"
| "not-connected";
export type MCPPromptArgs = {
name: string;
description?: string;
required?: boolean;
}[];
export interface MCPPrompt {
name: string;
description?: string;
arguments?: {
name: string;
description?: string;
required?: boolean;
}[];
arguments?: MCPPromptArgs;
}
// Leaving here to ideate on
@ -1442,7 +1473,7 @@ export interface Config {
/** Request options that will be applied to all models and context providers */
requestOptions?: RequestOptions;
/** The list of slash commands that will be available in the sidebar */
slashCommands?: SlashCommand[];
slashCommands?: (SlashCommand | SlashCommandWithSource)[];
/** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
* A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
*/
@ -1479,7 +1510,7 @@ export interface ContinueConfig {
// systemMessage?: string;
completionOptions?: BaseCompletionOptions;
requestOptions?: RequestOptions;
slashCommands: SlashCommand[];
slashCommands: SlashCommandWithSource[];
contextProviders: IContextProvider[];
disableSessionTitles?: boolean;
disableIndexing?: boolean;
@ -1502,7 +1533,7 @@ export interface BrowserSerializedContinueConfig {
// systemMessage?: string;
completionOptions?: BaseCompletionOptions;
requestOptions?: RequestOptions;
slashCommands: SlashCommandDescription[];
slashCommands: SlashCommandDescWithSource[];
contextProviders: ContextProviderDescription[];
disableIndexing?: boolean;
disableSessionTitles?: boolean;

View file

@ -1,3 +1,4 @@
import Handlebars from "handlebars";
import {
BaseCompletionOptions,
IdeSettings,
@ -6,10 +7,9 @@ import {
JSONModelDescription,
LLMOptions,
} from "../..";
import { renderTemplatedString } from "../../promptFiles/v1/renderTemplatedString";
import { renderTemplatedString } from "../../util/handlebars/renderTemplatedString";
import { DEFAULT_CHAT_SYSTEM_MESSAGE } from "../constructMessages";
import { BaseLLM } from "../index";
import Anthropic from "./Anthropic";
import Asksage from "./Asksage";
import Azure from "./Azure";
@ -121,6 +121,7 @@ export const LLMClasses = [
export async function llmFromDescription(
desc: JSONModelDescription,
readFile: (filepath: string) => Promise<string>,
getUriFromPath: (path: string) => Promise<string | undefined>,
uniqueId: string,
ideSettings: IdeSettings,
llmLogger: ILLMLogger,
@ -142,9 +143,12 @@ export async function llmFromDescription(
baseChatSystemMessage = DEFAULT_CHAT_SYSTEM_MESSAGE;
baseChatSystemMessage += "\n\n";
baseChatSystemMessage += await renderTemplatedString(
Handlebars,
desc.systemMessage,
readFile,
{},
[],
readFile,
getUriFromPath,
);
}

View file

@ -59,6 +59,12 @@ export async function* llmStreamChat(
},
true,
);
if (!slashCommand.run) {
console.error(
`Slash command ${command.name} (${command.source}) has no run function`,
);
throw new Error(`Slash command not found`);
}
const gen = slashCommand.run({
input,

View file

@ -139,7 +139,7 @@
},
"../packages/config-yaml": {
"name": "@continuedev/config-yaml",
"version": "1.0.94",
"version": "1.0.95",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
@ -150,10 +150,15 @@
"config-yaml": "dist/cli.js"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6",
"@semantic-release/npm": "^10.0.6",
"@types/jest": "^29.5.14",
"@types/node": "^20.0.0",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"semantic-release": "^21.1.2",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"zod-to-json-schema": "^3.24.5"
@ -161,7 +166,7 @@
},
"../packages/openai-adapters": {
"name": "@continuedev/openai-adapters",
"version": "1.0.40",
"version": "1.0.42",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.5",

View file

@ -1,6 +1,6 @@
import { IDE } from "../..";
import { GlobalContext } from "../../util/GlobalContext";
import { joinPathsToUri } from "../../util/uri";
import { IDE } from "..";
import { GlobalContext } from "../util/GlobalContext";
import { joinPathsToUri } from "../util/uri";
const FIRST_TIME_DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file
# It is used to define and reuse prompts within Continue

View file

@ -1,10 +1,9 @@
import { IDE } from "../..";
import { walkDir } from "../../indexing/walkDir";
import { readAllGlobalPromptFiles } from "../../util/paths";
import { joinPathsToUri } from "../../util/uri";
import { DEFAULT_PROMPTS_FOLDER_V1 } from "../v1";
import { DEFAULT_PROMPTS_FOLDER_V1, DEFAULT_PROMPTS_FOLDER_V2 } from ".";
import { IDE } from "..";
import { walkDir } from "../indexing/walkDir";
import { readAllGlobalPromptFiles } from "../util/paths";
import { joinPathsToUri } from "../util/uri";
export const DEFAULT_PROMPTS_FOLDER_V2 = ".continue/prompts";
export async function getPromptFilesFromDir(
ide: IDE,
dir: string,

19
core/promptFiles/index.ts Normal file
View file

@ -0,0 +1,19 @@
import { ContextProviderName } from "..";
export const DEFAULT_PROMPTS_FOLDER_V1 = ".prompts";
export const DEFAULT_PROMPTS_FOLDER_V2 = ".continue/prompts";
export const SUPPORTED_PROMPT_CONTEXT_PROVIDERS: ContextProviderName[] = [
"file",
"clipboard",
"repo-map",
"currentFile",
"os",
"problems",
"codebase",
"tree",
"open",
"debugger",
"terminal",
"diff",
];

View file

@ -1,8 +1,8 @@
import * as YAML from "yaml";
import { getLastNPathParts } from "../../util/uri";
import { getLastNPathParts } from "../util/uri";
export function parsePromptFileV1V2(path: string, content: string) {
export function parsePromptFile(path: string, content: string) {
let [preambleRaw, prompt] = content.split("\n---\n");
if (prompt === undefined) {
prompt = preambleRaw;

View file

@ -1,38 +0,0 @@
import Handlebars from "handlebars";
import { ContextItem, ContinueSDK, IContextProvider } from "../..";
function createContextItem(item: ContextItem, provider: IContextProvider) {
return {
...item,
id: {
itemId: item.description,
providerTitle: provider.description.title,
},
};
}
export function getContextProviderHelpers(
context: ContinueSDK,
): Array<[string, Handlebars.HelperDelegate]> | undefined {
return context.config.contextProviders?.map((provider: IContextProvider) => [
provider.description.title,
async (helperContext: any) => {
const items = await provider.getContextItems(helperContext, {
config: context.config,
embeddingsProvider: context.config.selectedModelByRole.embed,
fetch: context.fetch,
fullInput: context.input,
ide: context.ide,
llm: context.llm,
reranker: context.config.selectedModelByRole.rerank,
selectedCode: context.selectedCode,
});
items.forEach((item) =>
context.addContextItem(createContextItem(item, provider)),
);
return items.map((item) => item.content).join("\n\n");
},
]);
}

View file

@ -1,117 +0,0 @@
import Handlebars from "handlebars";
import { v4 as uuidv4 } from "uuid";
function convertToLetter(num: number): string {
let result = "";
while (num > 0) {
const remainder = (num - 1) % 26;
result = String.fromCharCode(97 + remainder) + result;
num = Math.floor((num - 1) / 26);
}
return result;
}
/**
* We replace filepaths with alphabetic characters to handle
* escaping issues.
*/
const replaceFilepaths = (
value: string,
ctxProviderNames: string[],
): [string, { [key: string]: string }] => {
const ast = Handlebars.parse(value);
const keysToFilepath: { [key: string]: string } = {};
let keyIndex = 1;
for (const i in ast.body) {
const node = ast.body[i] as any;
if (node.type === "MustacheStatement") {
const originalNodeVal = node.path.original;
const isFilepath = !ctxProviderNames.includes(originalNodeVal);
if (isFilepath) {
const letter = convertToLetter(keyIndex);
keysToFilepath[letter] = originalNodeVal;
value = value.replace(
new RegExp(`{{\\s*${originalNodeVal}\\s*}}`),
`{{${letter}}}`,
);
keyIndex++;
}
}
}
return [value, keysToFilepath];
};
export function registerHelpers(
helpers: Array<[string, Handlebars.HelperDelegate]>,
): {
[key: string]: Promise<string>;
} {
const promises: { [key: string]: Promise<string> } = {};
for (const [name, helper] of helpers) {
Handlebars.registerHelper(name, (...args) => {
const id = uuidv4();
promises[id] = helper(...args);
return `__${id}__`;
});
}
return promises;
}
export async function prepareTemplateAndData(
template: string,
readFile: (filepath: string) => Promise<string>,
inputData: Record<string, string>,
ctxProviderNames: string[],
): Promise<[string, any]> {
const [newTemplate, vars] = replaceFilepaths(template, ctxProviderNames);
const data: any = { ...inputData };
for (const [replacedName, originalCtxProviderName] of Object.entries(vars)) {
data[replacedName] =
inputData[originalCtxProviderName] ?? originalCtxProviderName;
// If it's not a context provider, assume it's a filepath.
if (!ctxProviderNames.includes(originalCtxProviderName)) {
const fileContents = await readFile(vars[replacedName]);
if (fileContents) {
data[replacedName] = fileContents;
}
}
}
return [newTemplate, data];
}
export function compileAndRenderTemplate(
template: string,
data: Record<string, string>,
): string {
const templateFn = Handlebars.compile(template);
return templateFn(data);
}
export async function resolveHelperPromises(
renderedString: string,
promises: { [key: string]: Promise<string> },
): Promise<string> {
await Promise.all(Object.values(promises));
for (const id in promises) {
renderedString = renderedString.replace(`__${id}__`, await promises[id]);
}
return renderedString;
}

View file

@ -1 +0,0 @@
export const DEFAULT_PROMPTS_FOLDER_V1 = ".prompts";

View file

@ -1,89 +0,0 @@
import { ContinueSDK, SlashCommand } from "../..";
import { getDiffsFromCache } from "../../autocomplete/snippets/gitDiffCache";
import { renderChatMessage } from "../../util/messageContent";
import { getLastNPathParts } from "../../util/uri";
import { parsePromptFileV1V2 } from "../v2/parsePromptFileV1V2";
import { renderPromptFileV2 } from "../v2/renderPromptFile";
import { getContextProviderHelpers } from "./getContextProviderHelpers";
import { renderTemplatedString } from "./renderTemplatedString";
import { replaceSlashCommandWithPromptInChatHistory } from "./updateChatHistory";
export function extractName(preamble: { name?: string }, path: string): string {
return preamble.name ?? getLastNPathParts(path, 1).split(".prompt")[0];
}
async function renderPromptV1(
prompt: string,
context: ContinueSDK,
userInput: string,
) {
const helpers = getContextProviderHelpers(context);
const inputData: Record<string, string> = {
input: userInput,
};
// A few context providers that don't need to be in config.json to work in .prompt files
if (helpers?.find((helper) => helper[0] === "diff")) {
const diffs = await getDiffsFromCache(context.ide);
inputData.diff = diffs.join("\n");
}
if (helpers?.find((helper) => helper[0] === "currentFile")) {
const currentFile = await context.ide.getCurrentFile();
if (currentFile) {
inputData.currentFile = currentFile.path;
}
}
return renderTemplatedString(
prompt,
context.ide.readFile.bind(context.ide),
inputData,
helpers,
);
}
export function slashCommandFromPromptFileV1(
path: string,
content: string,
): SlashCommand | null {
const { name, description, systemMessage, prompt } = parsePromptFileV1V2(
path,
content,
);
return {
name,
description,
prompt,
promptFile: path,
run: async function* (context) {
const [_, renderedPrompt] = await renderPromptFileV2(prompt, {
config: context.config,
fullInput: context.input,
embeddingsProvider: context.config.modelsByRole.embed[0],
reranker: context.config.modelsByRole.rerank[0],
llm: context.llm,
ide: context.ide,
selectedCode: context.selectedCode,
fetch: context.fetch,
});
const messages = replaceSlashCommandWithPromptInChatHistory(
context.history,
name,
renderedPrompt,
systemMessage,
);
for await (const chunk of context.llm.streamChat(
messages,
context.abortController.signal,
context.completionOptions,
)) {
yield renderChatMessage(chunk);
}
},
};
}

View file

@ -1,64 +0,0 @@
import { ChatMessage } from "../..";
export function replaceSlashCommandWithPromptInChatHistory(
history: ChatMessage[],
commandName: string,
renderedPrompt: string,
systemMessageOverride?: string,
): ChatMessage[] {
const messages = [...history];
for (let i = messages.length - 1; i >= 0; i--) {
const { role, content } = messages[i];
if (role !== "user") {
continue;
}
if (Array.isArray(content)) {
if (
content.some(
(part) =>
part.type === "text" && part.text?.startsWith(`/${commandName}`),
)
) {
messages[i] = updateArrayContent(
messages[i],
commandName,
renderedPrompt,
);
break;
}
} else if (
typeof content === "string" &&
content.startsWith(`/${commandName}`)
) {
messages[i] = { ...messages[i], content: renderedPrompt };
break;
}
}
if (systemMessageOverride) {
if (messages[0]?.role === "system") {
messages[0].content = systemMessageOverride;
} else {
messages.unshift({ role: "system", content: systemMessageOverride });
}
}
return messages;
}
function updateArrayContent(
message: any,
commandName: string,
renderedPrompt: string,
) {
return {
...message,
content: message.content.map((part: any) =>
part.text?.startsWith(`/${commandName}`)
? { ...part, text: renderedPrompt }
: part,
),
};
}

View file

@ -1,34 +0,0 @@
import * as YAML from "yaml";
import { getLastNPathParts } from "../../util/uri";
export function extractName(preamble: { name?: string }, path: string): string {
return preamble.name ?? getLastNPathParts(path, 1).split(".prompt")[0];
}
export function getPreambleAndBody(content: string): [string, string] {
let [preamble, body] = content.split("\n---\n");
if (body === undefined) {
// This means there is no preamble
body = preamble;
preamble = "";
}
return [preamble, body];
}
export function parsePreamble(
path: string,
content: string,
): { [key: string]: any; name: string; description: string } {
const [preambleRaw, _] = getPreambleAndBody(content);
const preamble = YAML.parse(preambleRaw) ?? {};
const name = extractName(preamble, path);
const description = preamble.description ?? name;
return {
...preamble,
name,
description,
};
}

View file

@ -1,84 +0,0 @@
import { ContextItem, ContextProviderExtras } from "../..";
import { contextProviderClassFromName } from "../../context/providers";
import { getUrlContextItems } from "../../context/providers/URLContextProvider";
import { resolveRelativePathInDir } from "../../util/ideUtils";
import { getUriPathBasename } from "../../util/uri";
import { getPreambleAndBody } from "./parse";
async function resolveAttachment(
name: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
// Context providers
const contextProvider = extras.config.contextProviders?.find(
(provider) => provider.description.title === name,
);
if (contextProvider) {
const items = await contextProvider.getContextItems("", extras);
return items;
} else {
// Just instantiate it here
const providerClass = contextProviderClassFromName(name) as any;
if (providerClass) {
const providerInstance = new providerClass({});
return providerInstance.getContextItems("", extras);
}
}
// Files
const resolvedFileUri = await resolveRelativePathInDir(name, extras.ide);
if (resolvedFileUri) {
let subItems: ContextItem[] = [];
if (name.endsWith(".prompt")) {
// Recurse
const [items, _] = await renderPromptFileV2(
await extras.ide.readFile(resolvedFileUri),
extras,
);
subItems.push(...items);
}
const content = `\`\`\`${name}\n${await extras.ide.readFile(resolvedFileUri)}\n\`\`\``;
return [
...subItems,
{
name: getUriPathBasename(resolvedFileUri),
content,
description: resolvedFileUri,
},
];
}
// URLs
if (name.startsWith("http")) {
const items = getUrlContextItems(name, extras.fetch);
return items;
}
return [];
}
export async function renderPromptFileV2(
rawContent: string,
extras: ContextProviderExtras,
): Promise<[ContextItem[], string]> {
const [_, body] = getPreambleAndBody(rawContent);
const contextItemsPromises: Promise<ContextItem[]>[] = [];
const renderedBody = body.replace(/@([^\s]+)/g, (match, name) => {
contextItemsPromises.push(resolveAttachment(name, extras));
return match;
});
const contextItems = (await Promise.all(contextItemsPromises)).flat();
const renderedPrompt = [
...contextItems.map((item) => item.content),
renderedBody,
extras.fullInput,
]
.join("\n\n")
.trim();
return [contextItems, renderedPrompt];
}

View file

@ -1,175 +0,0 @@
import { ContextProviderExtras, ILLM, RangeInFile } from "../..";
import { testConfigHandler, testIde } from "../../test/fixtures";
import {
addToTestDir,
setUpTestDir,
tearDownTestDir,
} from "../../test/testDir";
import { renderPromptFileV2 } from "./renderPromptFile";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
vi.mock(
import("../../context/providers/URLContextProvider"),
async (importOriginal) => {
const actual = await importOriginal();
return {
...actual,
getUrlContextItems: vi.fn().mockResolvedValue([
{
description: "https://example.com",
content: "Example Content",
name: "Example site",
uri: {
type: "url",
value: "https://example.com",
},
},
]),
};
},
);
describe("renderPromptFileV2", () => {
let extras: ContextProviderExtras;
const mockGetContextItems = vi.fn().mockResolvedValue([
{
name: "custom",
content: "Custom provider content",
description: "Custom provider",
},
]);
beforeEach(async () => {
const { config } = await testConfigHandler.loadConfig();
// Setup mock extras
extras = {
config: {
...config!,
contextProviders: [
{
description: {
type: "normal",
title: "CustomProvider",
displayTitle: "Custom Provider",
description: "A custom context provider",
},
loadSubmenuItems: vi.fn().mockResolvedValue([]),
getContextItems: mockGetContextItems,
},
],
},
fullInput: "User input",
embeddingsProvider: null,
reranker: null,
llm: {} as ILLM,
ide: testIde,
selectedCode: [] as RangeInFile[],
fetch: vi.fn(),
};
// Clear all mocks
vi.clearAllMocks();
setUpTestDir();
});
afterEach(() => {
tearDownTestDir();
});
it("should render a prompt file with no attachments", async () => {
const rawContent = "Simple prompt with no attachments";
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(0);
expect(renderedPrompt).toBe(
"Simple prompt with no attachments\n\nUser input",
);
});
it("should handle URL attachments", async () => {
const rawContent = "Content with URL @https://example.com";
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(1);
expect(renderedPrompt).toContain("Example Content");
});
it("should resolve file attachments", async () => {
const rawContent = "Content with file attachment @test.txt";
addToTestDir([["test.txt", "File content"]]);
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(1);
expect(renderedPrompt).toContain("```test.txt\nFile content\n```");
expect(renderedPrompt).toContain("Content with file attachment @test.txt");
});
it("should handle nested prompt files", async () => {
const rawContent = "Main prompt with nested @nested.prompt";
addToTestDir([
["nested.prompt", "Nested prompt content with @CustomProvider"],
]);
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(renderedPrompt).toContain("Custom provider content");
});
it("should handle custom context providers", async () => {
const rawContent = "Content with custom provider @CustomProvider";
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(1);
expect(renderedPrompt).toContain("Custom provider content");
expect(mockGetContextItems).toHaveBeenCalled();
});
it("should handle multiple attachments", async () => {
const rawContent = "Content with @file1.txt and @file2.txt";
addToTestDir([
["file1.txt", "Content 1"],
["file2.txt", "Content 2"],
]);
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(2);
expect(renderedPrompt).toContain("```file1.txt\nContent 1\n```");
expect(renderedPrompt).toContain("```file2.txt\nContent 2\n```");
});
it("should handle failed attachment resolutions gracefully", async () => {
const rawContent = "Content with @nonexistent";
const [contextItems, renderedPrompt] = await renderPromptFileV2(
rawContent,
extras,
);
expect(contextItems).toHaveLength(0);
expect(renderedPrompt).toBe("Content with @nonexistent\n\nUser input");
});
});

View file

@ -29,7 +29,7 @@ import {
Session,
SessionMetadata,
SiteIndexingConfig,
SlashCommandDescription,
SlashCommandDescWithSource,
StreamDiffLinesPayload,
ToolCall,
} from "../";
@ -118,6 +118,17 @@ export type ToCoreFromIdeOrWebviewProtocol = {
},
void,
];
"mcp/getPrompt": [
{
serverName: string;
promptName: string;
args?: Record<string, string>;
},
{
prompt: string;
description: string | undefined;
},
];
"context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
"context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
"autocomplete/complete": [AutocompleteInput, string[]];
@ -141,7 +152,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
completionOptions: LLMFullCompletionOptions;
title: string;
legacySlashCommandData?: {
command: SlashCommandDescription;
command: SlashCommandDescWithSource;
input: string;
contextItems: ContextItemWithId[];
historyIndex: number;

View file

@ -70,6 +70,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
];
getAvailableThreads: [undefined, Thread[]];
isTelemetryEnabled: [undefined, boolean];
isWorkspaceRemote: [undefined, boolean];
getUniqueId: [undefined, string];
getTags: [string, IndexTag[]];
readSecrets: [{ keys: string[] }, Record<string, string>];

View file

@ -106,6 +106,10 @@ export class MessageIde implements IDE {
return this.request("isTelemetryEnabled", undefined);
}
isWorkspaceRemote(): Promise<boolean> {
return this.request("isWorkspaceRemote", undefined);
}
getUniqueId(): Promise<string> {
return this.request("getUniqueId", undefined);
}

View file

@ -27,6 +27,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
"config/updateSharedConfig",
"config/updateSelectedModel",
"mcp/reloadServer",
"mcp/getPrompt",
"context/getContextItems",
"context/getSymbolsForFiles",
"context/loadSubmenuItems",

10
core/rules.md Normal file
View file

@ -0,0 +1,10 @@
# `core` rules
Whenever a new protocol message is added to the `protocol/` directory, check the following:
- It's type is defined correctly
- If it is a message from webview to core or vice versa:
- It has been added to `core/protocol/passThrough.ts`
- It has been added to `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt`
- It is implemented in either `core/core.ts` (for messages to the core), in a `useWebviewListener` (for messages to the gui), or in `VsCodeMessenger.ts` for VS Code or `IdeProtocolClient.kt` for JetBriains (for messages to the IDE).
- It does not duplicate functionality from another message type that already exists.

View file

@ -1,4 +1,4 @@
import { ConfigDependentToolParams, Tool } from "..";
import { ConfigDependentToolParams, IDE, Tool } from "..";
import { createNewFileTool } from "./definitions/createNewFile";
import { createRuleBlock } from "./definitions/createRuleBlock";
import { editFileTool } from "./definitions/editFile";
@ -13,12 +13,14 @@ import { runTerminalCommandTool } from "./definitions/runTerminalCommand";
import { searchWebTool } from "./definitions/searchWeb";
import { viewDiffTool } from "./definitions/viewDiff";
// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
export const localOnlyToolDefinitions = [grepSearchTool];
export const baseToolDefinitions = [
readFileTool,
editFileTool,
createNewFileTool,
runTerminalCommandTool,
grepSearchTool,
globSearchTool,
searchWebTool,
viewDiffTool,
@ -34,3 +36,8 @@ export const baseToolDefinitions = [
export const getConfigDependentToolDefinitions = (
params: ConfigDependentToolParams,
): Tool[] => [requestRuleTool(params)];
export const getToolsForIde = async (ide: IDE) =>
(await ide.isWorkspaceRemote())
? baseToolDefinitions
: [...baseToolDefinitions, ...localOnlyToolDefinitions];

View file

@ -4,7 +4,7 @@ export function safeParseToolCallArgs(
toolCall: ToolCallDelta,
): Record<string, any> {
try {
return JSON.parse(toolCall.function?.arguments ?? "{}");
return JSON.parse(toolCall.function?.arguments?.trim() || "{}");
} catch (e) {
console.error(
`Failed to parse tool call arguments:\nTool call: ${toolCall.function?.name + " " + toolCall.id}\nArgs:${toolCall.function?.arguments}\n`,

View file

@ -48,6 +48,10 @@ class FileSystemIde implements IDE {
return;
}
isWorkspaceRemote(): Promise<boolean> {
return Promise.resolve(false);
}
async getIdeSettings(): Promise<IdeSettings> {
return {
remoteConfigServerUrl: undefined,

View file

@ -0,0 +1,111 @@
import { v4 as uuidv4 } from "uuid";
export type HandlebarsType = typeof import("handlebars");
function convertToLetter(num: number): string {
let result = "";
while (num > 0) {
const remainder = (num - 1) % 26;
result = String.fromCharCode(97 + remainder) + result;
num = Math.floor((num - 1) / 26);
}
return result;
}
export function registerHelpers(
handlebars: HandlebarsType,
helpers: Array<[string, Handlebars.HelperDelegate]>,
): {
[key: string]: Promise<string>;
} {
const promises: { [key: string]: Promise<string> } = {};
for (const [name, helper] of helpers) {
handlebars.registerHelper(name, (...args) => {
const id = uuidv4();
promises[id] = helper(...args);
return `__${id}__`;
});
}
return promises;
}
export async function prepareTemplatedFilepaths(
handlebars: HandlebarsType,
template: string,
inputData: Record<string, string>,
ctxProviderNames: string[],
readFile: (filepath: string) => Promise<string>,
getUriFromPath: (path: string) => Promise<string | undefined>,
) {
// First, replace filepaths with letters to avoid escaping issues
const ast = handlebars.parse(template);
const filepathLetters: Map<string, string> = new Map();
const requiredContextProviders: Set<string> = new Set();
let withLetterKeys = template;
let letterIndex = 1;
for (const i in ast.body) {
const node = ast.body[i] as any;
if (node.type === "MustacheStatement") {
const originalNodeVal = node.path.original;
if (originalNodeVal.toLowerCase() === "input") {
continue;
}
const isFilepath = !ctxProviderNames.includes(originalNodeVal);
if (isFilepath) {
const letter = convertToLetter(letterIndex);
filepathLetters.set(letter, originalNodeVal);
withLetterKeys = withLetterKeys.replace(
new RegExp(`{{\\s*${originalNodeVal}\\s*}}`),
`{{${letter}}}`,
);
letterIndex++;
} else {
requiredContextProviders.add(originalNodeVal);
}
}
}
// Then, resolve the filepaths to their actual content and add to template data
// Fallback to simple error string if file read fails
const templateData = { ...inputData };
for (const [letter, filepath] of filepathLetters.entries()) {
try {
const uri = await getUriFromPath(filepath);
if (uri) {
const fileContents = await readFile(uri);
templateData[letter] = fileContents;
} else {
throw new Error(`File not found: ${filepath}`);
}
} catch (e) {
console.error(`Error reading file in prompt file ${filepath}:`, e);
templateData[letter] = `[Error reading file "${filepath}"]`;
}
}
return { withLetterKeys, templateData, requiredContextProviders };
}
export async function resolveHelperPromises(
renderedString: string,
promises: { [key: string]: Promise<string> },
): Promise<string> {
await Promise.all(Object.values(promises));
for (const id in promises) {
renderedString = renderedString.replace(`__${id}__`, await promises[id]);
}
return renderedString;
}

View file

@ -1,30 +1,35 @@
import {
compileAndRenderTemplate,
prepareTemplateAndData,
prepareTemplatedFilepaths,
registerHelpers,
resolveHelperPromises,
type HandlebarsType,
} from "./handlebarUtils";
export async function renderTemplatedString(
handlebars: HandlebarsType,
template: string,
readFile: (filepath: string) => Promise<string>,
inputData: Record<string, string>,
availableHelpers?: Array<[string, Handlebars.HelperDelegate]>,
availableHelpers: Array<[string, Handlebars.HelperDelegate]>,
readFile: (filepath: string) => Promise<string>,
getUriFromPath: (path: string) => Promise<string | undefined>,
): Promise<string> {
const helperPromises = availableHelpers
? registerHelpers(availableHelpers)
? registerHelpers(handlebars, availableHelpers)
: {};
const ctxProviderNames = availableHelpers?.map((h) => h[0]) ?? [];
const [newTemplate, data] = await prepareTemplateAndData(
const { withLetterKeys, templateData } = await prepareTemplatedFilepaths(
handlebars,
template,
readFile,
inputData,
ctxProviderNames,
readFile,
getUriFromPath,
);
let renderedString = compileAndRenderTemplate(newTemplate, data);
const templateFn = handlebars.compile(withLetterKeys);
const renderedString = templateFn(templateData);
return resolveHelperPromises(renderedString, helperPromises);
}

View file

@ -188,6 +188,7 @@ export function getUriDescription(uri: string, dirUriCandidates: string[]) {
dirUriCandidates,
);
const baseName = getUriPathBasename(uri);
const extension = getFileExtensionFromBasename(baseName);
const last2Parts = getLastNUriRelativePathParts(dirUriCandidates, uri, 2);
return {
uri,
@ -195,5 +196,6 @@ export function getUriDescription(uri: string, dirUriCandidates: string[]) {
foundInDir,
last2Parts,
baseName,
extension,
};
}

View file

@ -5,93 +5,54 @@ title: Prompts
Prompts are reusable instructions that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks.
:::info
Visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts)
Prompts were previously defined in a `.prompt` file format, but for consistency we now recommend using the same Markdown format as [rules](./rules.mdx) and adding `alwaysApply: false` to the frontmatter so that they are manually triggered.
:::
## Examples
Below are some examples to get you started.
### Security review
```text title="Security best practices review"
@open - Review these files for the following security best practices:
- Does the architecture follow security-by-design principles?
- Are there potential security vulnerabilities in the system design?
- Is sensitive data handled appropriately throughout the lifecycle?
```
### Reference best practice guides
```text title="Redux best practices review"
@https://redux.js.org/style-guide/
@currentFile
Review this code for adherence to Redux best practices.
```
### Pull in commonly used files for tasks
```text title="Generate a new TypeORM entity"
@src/db/dataSource.ts @src/db/entity/SampleEntity.ts
Use these files to generate a new TypeORM entity based on the following requirements:
```
## Including Context Providers in your prompts
Many [context providers](../context-providers.mdx) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is:
- `@terminal` - The contents of the terminal
- `@currentFile` - The currently active file
- `@open` - All open files
- `@os` - Information about the operating system
- `@problems` - Problems reported by the language server in the active file
- `@repo-map` - A map of files in the repository
- `@tree` - A tree view of the repository structure
Or you can directly type URLs and file paths:
- `@https://github.com/continuedev/continue` - The contents of a URL
- `@src/index.ts` - The contents of a file (VS Code only)
All references will be attached as context items, rather than injected directly inline.
## Local `.prompt` files
In addition to Prompt blocks on the Hub, you can also define prompts in local `.prompt` files, located in the `.continue/prompts` folder at the top level of your workspace. This is useful for quick iteration on prompts to test them out before pushing up to the Hub.
### Quick Start
Below is a quick example of setting up a prompt file:
1. Create a folder called `.continue/prompts` at the top level of your workspace
2. Add a file called `test.prompt` to this folder.
3. Write the following contents to `test.prompt` and save.
1. Create a folder called `.continue/rules` at the top level of your workspace
2. Add a file called `review-prompt.md` to this folder.
3. Write the following contents to `review-prompt.md` and save.
```.prompt
name: Current file prompt
description: A test prompt using the current file context provider
```md title="review-prompt.md"
---
@currentFile
name: Redux best practices review
alwaysApply: false
---
Review the currently open file for adherence to Redux best practices, as explained in their style guide at https://redux.js.org/style-guide/.
```
Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and add type out some additional text such as "Review the code for any issues".
Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and type out any additional instructions you'd like to add.
### Format
## Further Examples
The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), with additional templating to reference files, URLs, and context providers.
Below are more examples to get you started. You can also visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts).
:::info
The current state of this format is experimental and subject to change
:::
### Security review
### Preamble
```md title="security-review.md"
---
name: Security best practices review
alwaysApply: false
---
The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters:
Review the changes in the current git diff for these security best practices:
- `name` - The display title
- `description` - The description you will see in the dropdown
- `version` - Can be either "1" (for legacy prompt files) or "2" (this is the default and does not need to be set)
- Does the architecture follow security-by-design principles?
- Are there potential security vulnerabilities in the system design?
- Is sensitive data handled appropriately throughout the lifecycle?
```
If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator.
### Pull in commonly used files for tasks
```md title="typeorm-entity-generator.md"
---
name: Generate a new TypeORM entity
alwaysApply: false
---
Referencing `src/db/dataSource.ts` and `src/db/entity/SampleEntity.ts`, generate a new TypeORM entity based on the following requirements:
```

View file

@ -55,19 +55,26 @@ For example, you can say "Create a rule for this", and a rule will be created fo
Rules can also be added to an Assistant on the Continue Hub.
Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally.
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
### Syntax
:::info
Rules were originally defined in YAML format (demonstrated below), but we introduced Markdown for easier editing. While both are still supported, we recommend Markdown.
:::
Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties:
- `name` (**required** for YAML): A display name/title for the rule
- `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
- `regex` (optional): When files are provided as context and their content matches this regex pattern, the rule will be included. This can be either a single pattern (e.g., `"^import .* from '.*';$"`) or an array of patterns (e.g., `["^import .* from '.*';$", "^export .* from '.*';$"]`).
- `description` (optional): A description for the rule. Agents may read this description when `alwaysApply` is false to determine whether the rule should be pulled into context.
- `alwaysApply`: true - Always include the rule, regardless of file context
- `alwaysApply`: false - Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match
- `alwaysApply`: Determines whether the rule is always included. Behavior is described below:
- `true`: Always included, regardless of file context
- `false`: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `undefined` (default behavior): Included if no globs exist OR globs exist and match
<Tabs groupId="rules-example">
<TabItem value="md" label="Markdown">
@ -97,10 +104,13 @@ Rules blocks can be simple text, written in YAML configuration files, or as Mark
```yaml title="doc-standards.yaml"
name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
version: 1.0.0
schema: v1
rules:
- name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
rule: >
- Follow Docusaurus documentation standards
- Include YAML frontmatter with title, description, and keywords
@ -164,7 +174,7 @@ Whenever you are writing React code, make sure to
Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output.
This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4)
This can be viewed in the rules section of the toolbar (see above), or in the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4).
Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models).
@ -172,7 +182,7 @@ Advanced users can override this system message for a specific model if needed b
:::warning
`.contninuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.
`.continuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.
:::

View file

@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
pluginName=continue-intellij-extension
pluginRepositoryUrl=https://github.com/continuedev/continue
# SemVer format -> https://semver.org
pluginVersion=1.0.25
pluginVersion=1.0.26
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=223
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

View file

@ -2,9 +2,9 @@ package com.github.continuedev.continueintellijextension.auth
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.github.continuedev.continueintellijextension.utils.Desktop
import com.google.gson.Gson
import com.intellij.credentialStore.Credentials
import com.intellij.ide.BrowserUtil
import com.intellij.ide.passwordSafe.PasswordSafe
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.application.ApplicationManager
@ -165,7 +165,7 @@ class ContinueAuthService {
// Still open the URL in the browser (keeping existing behavior)
if (authUrl != null) {
Desktop.browse(java.net.URI(authUrl))
BrowserUtil.open(authUrl!!)
}
return authUrl

View file

@ -92,6 +92,7 @@ class MessageTypes {
"config/updateSharedConfig",
"config/updateSelectedModel",
"mcp/reloadServer",
"mcp/getPrompt",
"context/getContextItems",
"context/getSymbolsForFiles",
"context/loadSubmenuItems",

View file

@ -10,6 +10,7 @@ import com.github.continuedev.continueintellijextension.utils.*
import com.intellij.codeInsight.daemon.impl.HighlightInfo
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.util.ExecUtil
import com.intellij.ide.BrowserUtil
import com.intellij.ide.plugins.PluginManager
import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.lang.annotation.HighlightSeverity
@ -125,6 +126,10 @@ class IntelliJIDE(
return true
}
override suspend fun isWorkspaceRemote(): Boolean {
return this.getIdeInfo().remoteName != "local"
}
override suspend fun getUniqueId(): String {
return getMachineUniqueID()
}
@ -211,7 +216,7 @@ class IntelliJIDE(
override suspend fun openUrl(url: String) {
withContext(Dispatchers.IO) {
Desktop.browse(URI(url))
BrowserUtil.browse(url)
}
}

View file

@ -102,6 +102,8 @@ interface IDE {
suspend fun isTelemetryEnabled(): Boolean
suspend fun isWorkspaceRemote(): Boolean
suspend fun getUniqueId(): String
suspend fun getTerminalContents(): String

View file

@ -1,214 +0,0 @@
/*
* Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.continuedev.continueintellijextension.utils
import org.apache.commons.lang3.SystemUtils
import org.slf4j.LoggerFactory
import java.io.File
import java.io.IOException
import java.net.URI
object Desktop {
private val LOG = LoggerFactory.getLogger(Desktop::class.java)
fun browse(uri: URI): Boolean {
if (browseDESKTOP(uri)) {
return true
}
if (openSystemSpecific(uri.toString())) {
return true
}
LOG.warn("failed to browse {}", uri)
return false
}
fun open(file: File): Boolean {
if (openDESKTOP(file)) {
return true
}
if (openSystemSpecific(file.path)) {
return true
}
LOG.warn("failed to open {}", file.absolutePath)
return false
}
fun edit(file: File): Boolean {
if (editDESKTOP(file)) {
return true
}
if (openSystemSpecific(file.path)) {
return true
}
LOG.warn("failed to edit {}", file.absolutePath)
return false
}
private fun openSystemSpecific(what: String): Boolean {
if (SystemUtils.IS_OS_LINUX) {
if (isXDG() && runCommand("xdg-open", "%s", what)) {
return true
}
if (isKDE() && runCommand("kde-open", "%s", what)) {
return true
}
if (isGNOME() && runCommand("gnome-open", "%s", what)) {
return true
}
if (runCommand("kde-open", "%s", what)) {
return true
}
if (runCommand("gnome-open", "%s", what)) {
return true
}
}
if (SystemUtils.IS_OS_MAC && runCommand("open", "%s", what)) {
return true
}
if (SystemUtils.IS_OS_WINDOWS && runCommand("explorer", "%s", what)) {
return true
}
return false
}
private fun browseDESKTOP(uri: URI): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.BROWSE)) {
LOG.debug("BROWSE is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().browse() with {}", uri.toString())
java.awt.Desktop.getDesktop().browse(uri)
true
} catch (t: Throwable) {
LOG.error("Error using desktop browse.", t)
false
}
}
private fun openDESKTOP(file: File): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.OPEN)) {
LOG.debug("OPEN is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().open() with {}", file.toString())
java.awt.Desktop.getDesktop().open(file)
true
} catch (t: Throwable) {
LOG.error("Error using desktop open.", t)
false
}
}
private fun editDESKTOP(file: File): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.EDIT)) {
LOG.debug("EDIT is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().edit() with {}", file)
java.awt.Desktop.getDesktop().edit(file)
true
} catch (t: Throwable) {
LOG.error("Error using desktop edit.", t)
false
}
}
private fun runCommand(command: String, args: String, file: String): Boolean {
LOG.info("Trying to exec:\n cmd = {}\n args = {}\n %s = {}", command, args, file)
val parts = prepareCommand(command, args, file)
return try {
val p = Runtime.getRuntime().exec(parts)
if (p == null) {
false
} else {
try {
val retval = p.exitValue()
if (retval == 0) {
LOG.error("Process ended immediately.")
false
} else {
LOG.error("Process crashed.")
false
}
} catch (itse: IllegalThreadStateException) {
LOG.error("Process is running.")
true
}
}
} catch (e: IOException) {
LOG.error("Error running command.", e)
false
}
}
private fun prepareCommand(command: String, args: String?, file: String): Array<String> {
val parts = mutableListOf<String>()
parts.add(command)
args?.split(" ")?.forEach { s ->
parts.add(String.format(s, file).trim())
}
return parts.toTypedArray()
}
private fun isXDG(): Boolean {
val xdgSessionId = System.getenv("XDG_SESSION_ID")
return !xdgSessionId.isNullOrEmpty()
}
private fun isGNOME(): Boolean {
val gdmSession = System.getenv("GDMSESSION")
return gdmSession?.lowercase()?.contains("gnome") == true
}
private fun isKDE(): Boolean {
val gdmSession = System.getenv("GDMSESSION")
return gdmSession?.lowercase()?.contains("kde") == true
}
}

View file

@ -9,6 +9,7 @@ src/client
exe
bin
assets
tmp
gui/**

View file

@ -18,7 +18,6 @@ node_modules/**
manual-testing-sandbox
esbuild.js
esbuild.test.mjs
importMetaUrl.js
scripts
e2e

View file

@ -1,67 +0,0 @@
import * as esbuild from "esbuild";
import glob from "glob";
/**
* Bundles tests into multiple files, runTestOnVSCodeHost is then run using node runTestOnVSCodeHost.js
* It downloads vscode, starts it and passes test file to run - mochaRunner.js
* mochaRunner.js then runs tests using Mocha class
*/
console.log("Bundling tests...");
// Bundles script to run tests on VSCode host + mocha runner that will be invoked from within VSCode host
await esbuild.build({
entryPoints: [
// Runs mocha runner on VSCode host using runTests from @vscode/test-electron
"src/test/runner/runTestOnVSCodeHost.ts",
// Runs the bundled tests using Mocha class
"src/test/runner/mochaRunner.ts",
],
bundle: true,
outdir: "out",
external: [
"vscode",
// Its important to externalize mocha, otherwise mocha seems to be not initialized properly when running tests
// Example warning by esbuild when mocha is not externalized:
// [WARNING] "./reporters/parallel-buffered" should be marked as external for use with "require.resolve" [require-resolve-not-external]
"mocha",
],
format: "cjs",
platform: "node",
sourcemap: true,
loader: {
// eslint-disable-next-line @typescript-eslint/naming-convention
".node": "file",
},
});
/**
* Note: Bundling is done to work around import issues, for example with fkill that does not provide cjs module.
* Rather than figuring out a combination of tsconfig.json that would work, I decided to bundle tests instead.
*/
await esbuild.build({
// Tests can be added anywhere in src folder
entryPoints: glob.sync("src/**/*.test.ts"),
bundle: true,
outdir: "out",
external: [
"vscode",
// Its important to externalize mocha, otherwise mocha seems to be not initialized properly when running tests
"mocha",
],
format: "cjs",
platform: "node",
sourcemap: true,
loader: {
// eslint-disable-next-line @typescript-eslint/naming-convention
".node": "file",
},
// To allow import.meta.path for transformers.js
// https://github.com/evanw/esbuild/issues/1492#issuecomment-893144483
inject: ["./scripts/importMetaUrl.js"],
define: { "import.meta.url": "importMetaUrl" },
});

View file

@ -1,22 +1,19 @@
{
"name": "continue",
"version": "1.1.50",
"version": "1.1.52",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "1.1.50",
"version": "1.1.52",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"@continuedev/fetch": "^1.0.10",
"@electron/rebuild": "^3.2.10",
"@reduxjs/toolkit": "^1.9.3",
"@types/node-fetch": "^2.6.11",
"@types/uuid": "^9.0.8",
"@vscode/ripgrep": "^1.15.9",
"@vscode/test-electron": "^2.3.9",
"axios": "^1.2.5",
"core": "file:../../core",
"cors": "^2.8.5",
@ -38,6 +35,7 @@
"jsdom": "^24.0.0",
"lru-cache": "^11.0.2",
"minisearch": "^7.0.0",
"mocha": "^11.7.1",
"monaco-editor": "^0.45.0",
"monaco-vscode-textmate-theme-converter": "^0.1.7",
"ncp": "^2.0.0",
@ -70,11 +68,12 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/follow-redirects": "^1.14.4",
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.6",
"@types/mocha": "^10.0.10",
"@types/node": "16.x",
"@types/node-fetch": "^2.6.12",
"@types/react-dom": "^18.2.4",
"@types/request": "^2.48.8",
"@types/uuid": "^10.0.0",
"@types/vscode": "1.70",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.45.0",
@ -84,9 +83,7 @@
"esbuild": "0.17.19",
"esbuild-visualizer": "^0.6.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"json-schema-to-typescript": "^12.0.0",
"mocha": "^10.4.0",
"ovsx": "^0.8.3",
"rimraf": "^5.0.5",
"typescript": "^5.6.3",
@ -108,7 +105,7 @@
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.13",
"@continuedev/fetch": "^1.0.14",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
"@modelcontextprotocol/sdk": "^1.12.0",
@ -2448,16 +2445,6 @@
"@types/node": "*"
}
},
"node_modules/@types/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==",
"dev": true,
"dependencies": {
"@types/minimatch": "^5.1.2",
"@types/node": "*"
}
},
"node_modules/@types/hast": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz",
@ -2542,10 +2529,11 @@
"dev": true
},
"node_modules/@types/mocha": {
"version": "10.0.9",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.9.tgz",
"integrity": "sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q==",
"dev": true
"version": "10.0.10",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz",
"integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/ms": {
"version": "0.7.34",
@ -2558,9 +2546,11 @@
"integrity": "sha512-ia7V9a2FnhUFfetng4/sRPBMTwHZUkPFY736rb1cg9AgG7MZdR97q7/nLR9om+sq5f1la9C857E0l/nrI0RiFQ=="
},
"node_modules/@types/node-fetch": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz",
"integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==",
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz",
"integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"form-data": "^4.0.0"
@ -2717,9 +2707,11 @@
"integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA=="
},
"node_modules/@types/uuid": {
"version": "9.0.8",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/vscode": {
"version": "1.70.0",
@ -3088,136 +3080,6 @@
"yauzl": "^2.9.2"
}
},
"node_modules/@vscode/test-electron": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz",
"integrity": "sha512-Gc6EdaLANdktQ1t+zozoBVRynfIsMKMc94Svu1QreOBC8y76x4tvaK32TljrLi1LI2+PK58sDVbL7ALdqf3VRQ==",
"dependencies": {
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"jszip": "^3.10.1",
"ora": "^7.0.1",
"semver": "^7.6.2"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@vscode/test-electron/node_modules/chalk": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
"integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
"engines": {
"node": "^12.17.0 || ^14.13 || >=16.0.0"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@vscode/test-electron/node_modules/cli-cursor": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz",
"integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==",
"dependencies": {
"restore-cursor": "^4.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/is-interactive": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz",
"integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/is-unicode-supported": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz",
"integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/log-symbols": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz",
"integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==",
"dependencies": {
"chalk": "^5.0.0",
"is-unicode-supported": "^1.1.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/ora": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz",
"integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==",
"dependencies": {
"chalk": "^5.3.0",
"cli-cursor": "^4.0.0",
"cli-spinners": "^2.9.0",
"is-interactive": "^2.0.0",
"is-unicode-supported": "^1.3.0",
"log-symbols": "^5.1.0",
"stdin-discarder": "^0.1.0",
"string-width": "^6.1.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/restore-cursor": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz",
"integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==",
"dependencies": {
"onetime": "^5.1.0",
"signal-exit": "^3.0.2"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/node_modules/string-width": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz",
"integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==",
"dependencies": {
"eastasianwidth": "^0.2.0",
"emoji-regex": "^10.2.1",
"strip-ansi": "^7.0.1"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/vsce": {
"version": "2.32.0",
"resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.32.0.tgz",
@ -3594,15 +3456,6 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/ansi-colors": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/ansi-escapes": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
@ -3741,8 +3594,7 @@
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"node_modules/array-back": {
"version": "3.1.0",
@ -4038,8 +3890,7 @@
"node_modules/browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw=="
},
"node_modules/buffer": {
"version": "5.7.1",
@ -4307,7 +4158,6 @@
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"engines": {
"node": ">=10"
},
@ -5156,7 +5006,8 @@
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true
},
"node_modules/cors": {
"version": "2.8.5",
@ -5329,7 +5180,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
"integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true,
"engines": {
"node": ">=10"
},
@ -5935,7 +5785,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true,
"engines": {
"node": ">=10"
},
@ -6630,7 +6479,6 @@
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
@ -6665,7 +6513,6 @@
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
"integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
"dev": true,
"bin": {
"flat": "cli.js"
}
@ -7278,7 +7125,6 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true,
"bin": {
"he": "bin/he"
}
@ -7550,7 +7396,8 @@
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
"dev": true
},
"node_modules/immer": {
"version": "9.0.21",
@ -7955,7 +7802,8 @@
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
},
"node_modules/isexe": {
"version": "2.0.0",
@ -8061,7 +7909,6 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"dependencies": {
"argparse": "^2.0.1"
},
@ -8301,6 +8148,7 @@
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dev": true,
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
@ -8391,6 +8239,7 @@
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"dev": true,
"dependencies": {
"immediate": "~3.0.5"
}
@ -8441,7 +8290,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"dependencies": {
"p-locate": "^5.0.0"
},
@ -9436,30 +9284,30 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"node_modules/mocha": {
"version": "10.8.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"dev": true,
"version": "11.7.1",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.1.tgz",
"integrity": "sha512-5EK+Cty6KheMS/YLPPMJC64g5V61gIR25KsRItHw6x4hEKT6Njp1n9LOlH4gpevuwMVS66SXaBBpg+RWZkza4A==",
"license": "MIT",
"dependencies": {
"ansi-colors": "^4.1.3",
"browser-stdout": "^1.3.1",
"chokidar": "^3.5.3",
"chokidar": "^4.0.1",
"debug": "^4.3.5",
"diff": "^5.2.0",
"diff": "^7.0.0",
"escape-string-regexp": "^4.0.0",
"find-up": "^5.0.0",
"glob": "^8.1.0",
"glob": "^10.4.5",
"he": "^1.2.0",
"js-yaml": "^4.1.0",
"log-symbols": "^4.1.0",
"minimatch": "^5.1.6",
"minimatch": "^9.0.5",
"ms": "^2.1.3",
"picocolors": "^1.1.1",
"serialize-javascript": "^6.0.2",
"strip-json-comments": "^3.1.1",
"supports-color": "^8.1.1",
"workerpool": "^6.5.1",
"yargs": "^16.2.0",
"yargs-parser": "^20.2.9",
"workerpool": "^9.2.0",
"yargs": "^17.7.2",
"yargs-parser": "^21.1.1",
"yargs-unparser": "^2.0.0"
},
"bin": {
@ -9467,76 +9315,94 @@
"mocha": "bin/mocha.js"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/mocha/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/mocha/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/mocha/node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"node_modules/mocha/node_modules/chokidar": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
"license": "MIT",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
"readdirp": "^4.0.1"
},
"engines": {
"node": ">= 14.16.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/mocha/node_modules/diff": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
"dev": true,
"engines": {
"node": ">=0.3.1"
"node_modules/mocha/node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"license": "ISC",
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^3.1.2",
"minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/mocha/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/mocha/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"node_modules/mocha/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"license": "ISC",
"engines": {
"node": ">=8"
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/mocha/node_modules/readdirp": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
"license": "MIT",
"engines": {
"node": ">= 14.18.0"
},
"funding": {
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/mocha/node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@ -9547,39 +9413,13 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/mocha/node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"node_modules/mocha/node_modules/yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
"license": "ISC",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/mocha/node_modules/yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
"dev": true,
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
},
"engines": {
"node": ">=10"
"node": ">=12"
}
},
"node_modules/monaco-editor": {
@ -10422,7 +10262,6 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"dependencies": {
"yocto-queue": "^0.1.0"
},
@ -10437,7 +10276,6 @@
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"dependencies": {
"p-limit": "^3.0.2"
},
@ -10559,7 +10397,8 @@
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
"dev": true
},
"node_modules/parent-module": {
"version": "1.0.1",
@ -10639,7 +10478,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true,
"engines": {
"node": ">=8"
}
@ -11159,7 +10997,8 @@
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true
},
"node_modules/promise-inflight": {
"version": "1.0.1",
@ -11363,7 +11202,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true,
"dependencies": {
"safe-buffer": "^5.1.0"
}
@ -11572,6 +11410,7 @@
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
@ -11585,7 +11424,8 @@
"node_modules/readable-stream/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/readdirp": {
"version": "3.6.0",
@ -12124,7 +11964,6 @@
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true,
"dependencies": {
"randombytes": "^2.1.0"
}
@ -12168,7 +12007,8 @@
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"dev": true
},
"node_modules/setprototypeof": {
"version": "1.2.0",
@ -12499,66 +12339,6 @@
"integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==",
"license": "MIT"
},
"node_modules/stdin-discarder": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz",
"integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==",
"dependencies": {
"bl": "^5.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/stdin-discarder/node_modules/bl": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz",
"integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==",
"dependencies": {
"buffer": "^6.0.3",
"inherits": "^2.0.4",
"readable-stream": "^3.4.0"
}
},
"node_modules/stdin-discarder/node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/stdin-discarder/node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/stoppable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
@ -12711,7 +12491,6 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true,
"engines": {
"node": ">=8"
},
@ -16685,10 +16464,10 @@
}
},
"node_modules/workerpool": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
"integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
"dev": true
"version": "9.3.3",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.3.tgz",
"integrity": "sha512-slxCaKbYjEdFT/o2rH9xS1hf4uRDch1w7Uo+apxhZ+sf/1d9e0ZVkn42kPNGP2dgjIx6YFvSevj0zHvbWe2jdw==",
"license": "Apache-2.0"
},
"node_modules/wrap-ansi": {
"version": "6.2.0",
@ -16891,7 +16670,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
"integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
"dev": true,
"dependencies": {
"camelcase": "^6.0.0",
"decamelize": "^4.0.0",
@ -16906,7 +16684,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
"dev": true,
"engines": {
"node": ">=8"
}
@ -16954,7 +16731,6 @@
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true,
"engines": {
"node": ">=10"
},

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "1.1.51",
"version": "1.1.52",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@ -622,10 +622,8 @@
"rebuild": "electron-rebuild -v 19.1.8 node-pty",
"lint": "eslint src --ext ts",
"lint:fix": "eslint . --ext ts --fix",
"build-test": "npm run esbuild && node esbuild.test.mjs",
"test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"test": "vitest run",
"vitest": "vitest run",
"quick-test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"write-build-timestamp": "node scripts/write-build-timestamp.js",
"prepackage": "node scripts/prepackage.js",
"package": "node scripts/package.js",
@ -661,11 +659,12 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/follow-redirects": "^1.14.4",
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.6",
"@types/mocha": "^10.0.10",
"@types/node": "16.x",
"@types/node-fetch": "^2.6.12",
"@types/react-dom": "^18.2.4",
"@types/request": "^2.48.8",
"@types/uuid": "^10.0.0",
"@types/vscode": "1.70",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.45.0",
@ -675,9 +674,7 @@
"esbuild": "0.17.19",
"esbuild-visualizer": "^0.6.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"json-schema-to-typescript": "^12.0.0",
"mocha": "^10.4.0",
"ovsx": "^0.8.3",
"rimraf": "^5.0.5",
"typescript": "^5.6.3",
@ -689,10 +686,7 @@
"@continuedev/fetch": "^1.0.10",
"@electron/rebuild": "^3.2.10",
"@reduxjs/toolkit": "^1.9.3",
"@types/node-fetch": "^2.6.11",
"@types/uuid": "^9.0.8",
"@vscode/ripgrep": "^1.15.9",
"@vscode/test-electron": "^2.3.9",
"axios": "^1.2.5",
"core": "file:../../core",
"cors": "^2.8.5",
@ -714,6 +708,7 @@
"jsdom": "^24.0.0",
"lru-cache": "^11.0.2",
"minisearch": "^7.0.0",
"mocha": "^11.7.1",
"monaco-editor": "^0.45.0",
"monaco-vscode-textmate-theme-converter": "^0.1.7",
"ncp": "^2.0.0",

View file

@ -0,0 +1,191 @@
const { fork } = require("child_process");
const fs = require("fs");
const https = require("https");
const path = require("path");
const { rimrafSync } = require("rimraf");
const { execCmdSync } = require("../../../scripts/util");
/**
* download a file using nodejs http
* @param {string} url
* @param {string} outputPath
* @param {number} maxRedirects
*/
async function downloadFile(url, outputPath, maxRedirects = 5) {
return new Promise((resolve, reject) => {
const downloadWithRedirects = (currentUrl, redirectCount = 0) => {
if (redirectCount > maxRedirects) {
return reject(new Error(`Too many redirects (${maxRedirects})`));
}
const request = https.get(currentUrl, (response) => {
if (
response.statusCode >= 300 &&
response.statusCode < 400 &&
response.headers.location
) {
return downloadWithRedirects(
response.headers.location,
redirectCount + 1,
);
}
if (response.statusCode !== 200) {
return reject(
new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`),
);
}
const outputDir = path.dirname(outputPath);
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
const writeStream = fs.createWriteStream(outputPath);
const totalSize = parseInt(response.headers["content-length"], 10);
let downloadedSize = 0;
response.on("data", (chunk) => {
downloadedSize += chunk.length;
if (totalSize) {
const percent = ((downloadedSize / totalSize) * 100).toFixed(1);
process.stdout.write(
`\rDownloading: ${percent}% (${downloadedSize}/${totalSize} bytes)`,
);
}
});
response.pipe(writeStream);
writeStream.on("finish", () => {
console.log(`\nDownload completed: ${outputPath}`);
resolve(outputPath);
});
writeStream.on("error", reject);
response.on("error", reject);
});
request.on("error", reject);
request.setTimeout(30000, () => {
request.destroy();
reject(new Error("Request timeout"));
});
};
downloadWithRedirects(url);
});
}
/**
*
* @param {string} target platform specific target
* @param {string} targetDir the directory to download into
*/
async function downloadSqlite(target, targetDir) {
const downloadUrl =
// node-sqlite3 doesn't have a pre-built binary for win32-arm64
target === "win32-arm64"
? "https://continue-server-binaries.s3.us-west-1.amazonaws.com/win32-arm64/node_sqlite3.tar.gz"
: `https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-${
target
}.tar.gz`;
await downloadFile(downloadUrl, targetDir);
}
async function installAndCopySqlite(target) {
// Replace the installed with pre-built
console.log("[info] Downloading pre-built sqlite3 binary");
rimrafSync("../../core/node_modules/sqlite3/build");
await downloadSqlite(target, "../../core/node_modules/sqlite3/build.tar.gz");
execCmdSync("cd ../../core/node_modules/sqlite3 && tar -xvzf build.tar.gz");
fs.unlinkSync("../../core/node_modules/sqlite3/build.tar.gz");
}
async function installAndCopyEsbuild(target) {
// Download and unzip esbuild
console.log("[info] Downloading pre-built esbuild binary");
rimrafSync("node_modules/@esbuild");
fs.mkdirSync("node_modules/@esbuild", { recursive: true });
await downloadFile(
`https://continue-server-binaries.s3.us-west-1.amazonaws.com/${target}/esbuild.zip`,
"node_modules/@esbuild/esbuild.zip",
);
execCmdSync("cd node_modules/@esbuild && unzip esbuild.zip");
fs.unlinkSync("node_modules/@esbuild/esbuild.zip");
}
process.on("message", (msg) => {
const { operation, target } = msg.payload;
if (operation === "sqlite") {
installAndCopySqlite(target)
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
}
if (operation === "esbuild") {
installAndCopyEsbuild(target)
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
}
});
/**
* @param {string} target the platform to build for
*/
async function copySqlite(target) {
const child = fork(__filename, { stdio: "inherit", cwd: process.cwd() });
child.send({
payload: {
operation: "sqlite",
target,
},
});
return new Promise((resolve, reject) => {
child.on("message", (msg) => {
if (msg.error) {
reject();
} else {
resolve();
}
});
});
}
/**
* @param {string} target the platform to build for
*/
async function copyEsbuild(target) {
const child = fork(__filename, { stdio: "inherit", cwd: process.cwd() });
child.send({
payload: {
operation: "esbuild",
target,
},
});
return new Promise((resolve, reject) => {
child.on("message", (msg) => {
if (msg.error) {
reject();
} else {
resolve();
}
});
});
}
module.exports = {
downloadSqlite,
copySqlite,
copyEsbuild,
};

View file

@ -1,4 +1,5 @@
const fs = require("fs");
const { writeBuildTimestamp } = require("./utils");
const esbuild = require("esbuild");
@ -49,7 +50,7 @@ const esbuildConfig = {
],
};
(async () => {
void (async () => {
// Create .buildTimestamp.js before starting the first build
writeBuildTimestamp();
// Bundles the extension into one file

View file

@ -0,0 +1,126 @@
/**
* @file Generate config.yaml file from template. Also intended to run as a child process.
*/
const { fork } = require("child_process");
const fs = require("fs");
const path = require("path");
const { execCmdSync } = require("../../../scripts/util");
const { continueDir } = require("./utils");
async function generateConfigYamlSchema() {
process.chdir(path.join(continueDir, "packages", "config-yaml"));
execCmdSync("npm install");
execCmdSync("npm run build");
execCmdSync("npm run generate-schema");
fs.copyFileSync(
path.join("schema", "config-yaml-schema.json"),
path.join(continueDir, "extensions", "vscode", "config-yaml-schema.json"),
);
console.log("[info] Generated config.yaml schema");
}
async function copyConfigSchema() {
process.chdir(path.join(continueDir, "extensions", "vscode"));
// Modify and copy for .continuerc.json
const schema = JSON.parse(fs.readFileSync("config_schema.json", "utf8"));
schema.$defs.SerializedContinueConfig.properties.mergeBehavior = {
type: "string",
enum: ["merge", "overwrite"],
default: "merge",
title: "Merge behavior",
markdownDescription:
"If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json.",
"x-intellij-html-description":
"<p>If set to <code>merge</code>, <code>.continuerc.json</code> will be applied on top of <code>config.json</code> (arrays and objects are merged). If set to <code>overwrite</code>, then every top-level property of <code>.continuerc.json</code> will overwrite that property from <code>config.json</code>.</p>",
};
fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2));
// Copy config schemas to intellij
fs.copyFileSync(
"config_schema.json",
path.join(
"..",
"intellij",
"src",
"main",
"resources",
"config_schema.json",
),
);
fs.copyFileSync(
"continue_rc_schema.json",
path.join(
"..",
"intellij",
"src",
"main",
"resources",
"continue_rc_schema.json",
),
);
}
process.on("message", (msg) => {
const { operation } = msg.payload;
if (operation === "generate") {
generateConfigYamlSchema()
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
}
if (operation === "copy") {
copyConfigSchema()
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
}
});
async function generateAndCopyConfigYamlSchema() {
// Generate and copy over config-yaml-schema.json
const generateConfigYamlChild = fork(
path.join(__dirname, "generate-copy-config.js"),
{
stdio: "inherit",
},
);
generateConfigYamlChild.send({ payload: { operation: "generate" } });
await new Promise((resolve, reject) => {
generateConfigYamlChild.on("message", (msg) => {
if (msg.error) {
reject();
}
resolve();
});
});
// Copy config schemas to intellij
const copyConfigSchemaChild = fork(
path.join(__dirname, "generate-copy-config.js"),
{
stdio: "inherit",
},
);
copyConfigSchemaChild.send({ payload: { operation: "copy" } });
await new Promise((resolve, reject) => {
copyConfigSchemaChild.on("message", (msg) => {
if (msg.error) {
reject();
}
resolve();
});
});
}
module.exports = {
generateAndCopyConfigYamlSchema,
};

View file

@ -0,0 +1,113 @@
/**
* @file Copy lancedb to the current directory. It is also intended to run as a child process.
*/
const { fork } = require("child_process");
const fs = require("fs");
const path = require("path");
const ncp = require("ncp").ncp;
const { execCmdSync } = require("../../../scripts/util");
async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
console.log(`Copying ${packageName} to ${toCopy}`);
// This is a way to install only one package without npm trying to install all the dependencies
// Create a temporary directory for installing the package
const adjustedName = packageName.replace(/@/g, "").replace("/", "-");
const currentDir = process.cwd();
const tempDir = path.join(
currentDir,
"tmp",
`continue-node_modules-${adjustedName}`,
);
// // Remove the dir we will be copying to
// rimrafSync(`node_modules/${toCopy}`);
// // Ensure the temporary directory exists
fs.mkdirSync(tempDir, { recursive: true });
try {
// Move to the temporary directory
process.chdir(tempDir);
// Initialize a new package.json and install the package
execCmdSync(`npm init -y && npm i -f ${packageName} --no-save`);
console.log(
`Contents of: ${packageName}`,
fs.readdirSync(path.join(tempDir, "node_modules", toCopy)),
);
// Without this it seems the file isn't completely written to disk
await new Promise((resolve) => setTimeout(resolve, 2000));
// Copy the installed package back to the current directory
await new Promise((resolve, reject) => {
ncp(
path.join(tempDir, "node_modules", toCopy),
path.join(currentDir, "node_modules", toCopy),
{ dereference: true },
(error) => {
if (error) {
console.error(
`[error] Error copying ${packageName} package`,
error,
);
reject(error);
} else {
resolve();
}
},
);
});
} finally {
// Clean up the temporary directory
// rimrafSync(tempDir);
// Return to the original directory
process.chdir(currentDir);
}
}
process.on("message", (msg) => {
installNodeModuleInTempDirAndCopyToCurrent(
msg.payload.packageName,
msg.payload.toCopy,
)
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
});
/**
* invoke a child process to install a node module into temporary directory and copy it over into node modules
* @param {string} packageName the module to install and copy
* @param {string} toCopy directory to copy into inside node modules
*/
async function installAndCopyNodeModules(packageName, toCopy) {
const child = fork(__filename, { stdio: "inherit", cwd: process.cwd() });
child.send({
payload: {
packageName,
toCopy,
},
});
return new Promise((resolve, reject) => {
child.on("message", (msg) => {
if (msg.error) {
reject();
} else {
resolve();
}
});
});
}
module.exports = {
installAndCopyNodeModules,
};

View file

@ -0,0 +1,79 @@
/**
* @file Install node modules for the VS Code extension and gui. This is also intended to run as a child process.
*/
const { fork } = require("child_process");
const path = require("path");
const { execCmdSync } = require("../../../scripts/util");
const { continueDir } = require("./utils");
async function installNodeModulesInGui() {
process.chdir(path.join(continueDir, "gui"));
execCmdSync("npm install");
console.log("[info] npm install in gui completed");
}
async function installNodeModulesInVscode() {
process.chdir(path.join(continueDir, "extensions", "vscode"));
execCmdSync("npm install");
console.log("[info] npm install in extensions/vscode completed");
}
process.on("message", (msg) => {
const { targetDir } = msg.payload;
if (targetDir === "gui") {
installNodeModulesInGui()
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
} else if (targetDir === "vscode") {
installNodeModulesInVscode()
.then(() => process.send({ done: true }))
.catch((error) => {
console.error(error); // show the error in the parent process
process.send({ error: true });
});
}
});
async function npmInstall() {
const installVscodeChild = fork(__filename, {
stdio: "inherit",
});
installVscodeChild.send({ payload: { targetDir: "vscode" } });
const installGuiChild = fork(__filename, {
stdio: "inherit",
});
installGuiChild.send({ payload: { targetDir: "gui" } });
await Promise.all([
new Promise((resolve, reject) => {
installVscodeChild.on("message", (msg) => {
if (msg.error) {
reject();
}
resolve();
});
}),
new Promise((resolve, reject) => {
installGuiChild.on("message", (msg) => {
if (msg.error) {
reject();
}
resolve();
});
}),
]).catch((error) => {
console.error(error);
process.exit(1);
});
}
module.exports = {
npmInstall,
};

View file

@ -10,11 +10,11 @@ const {
autodetectPlatformAndArch,
} = require("../../../scripts/util/index");
const {
copyConfigSchema,
writeBuildTimestamp,
generateConfigYamlSchema,
} = require("./utils");
const { copySqlite, copyEsbuild } = require("./download-copy-sqlite-esbuild");
const { generateAndCopyConfigYamlSchema } = require("./generate-copy-config");
const { installAndCopyNodeModules } = require("./install-copy-nodemodule");
const { npmInstall } = require("./npm-install");
const { writeBuildTimestamp, continueDir } = require("./utils");
// Clear folders that will be packaged to ensure clean slate
rimrafSync(path.join(__dirname, "..", "bin"));
@ -27,6 +27,8 @@ if (!fs.existsSync(guiDist)) {
fs.mkdirSync(guiDist, { recursive: true });
}
const skipInstalls = process.env.SKIP_INSTALLS === "true";
// Get the target to package for
let target = undefined;
const args = process.argv;
@ -36,10 +38,10 @@ if (args[2] === "--target") {
let os;
let arch;
if (!target) {
[os, arch] = autodetectPlatformAndArch();
} else {
if (target) {
[os, arch] = target.split("-");
} else {
[os, arch] = autodetectPlatformAndArch();
}
if (os === "alpine") {
@ -67,28 +69,14 @@ const isMacTarget = target?.startsWith("darwin");
void (async () => {
console.log("[info] Packaging extension for target ", target);
// Generate and copy over config-yaml-schema.json
generateConfigYamlSchema();
// Copy config schemas to intellij
copyConfigSchema();
if (!process.cwd().endsWith("vscode")) {
// This is sometimes run from root dir instead (e.g. in VS Code tasks)
process.chdir("extensions/vscode");
}
// Make sure we have an initial timestamp file
writeBuildTimestamp();
// Install node_modules //
execCmdSync("npm install");
console.log("[info] npm install in extensions/vscode completed");
if (!skipInstalls) {
await Promise.all([generateAndCopyConfigYamlSchema(), npmInstall()]);
}
process.chdir("../../gui");
execCmdSync("npm install");
console.log("[info] npm install in gui completed");
process.chdir(path.join(continueDir, "gui"));
if (isInGitHubAction) {
execCmdSync("npm run build");
@ -280,122 +268,32 @@ void (async () => {
);
});
async function installNodeModuleInTempDirAndCopyToCurrent(
packageName,
toCopy,
) {
console.log(`Copying ${packageName} to ${toCopy}`);
// This is a way to install only one package without npm trying to install all the dependencies
// Create a temporary directory for installing the package
const adjustedName = packageName.replace(/@/g, "").replace("/", "-");
const tempDir = `/tmp/continue-node_modules-${adjustedName}`;
const currentDir = process.cwd();
// Remove the dir we will be copying to
rimrafSync(`node_modules/${toCopy}`);
// Ensure the temporary directory exists
fs.mkdirSync(tempDir, { recursive: true });
try {
// Move to the temporary directory
process.chdir(tempDir);
// Initialize a new package.json and install the package
execCmdSync(`npm init -y && npm i -f ${packageName} --no-save`);
if (!skipInstalls) {
// GitHub Actions doesn't support ARM, so we need to download pre-saved binaries
// 02/07/25 - the above comment is out of date, there is now support for ARM runners on GitHub Actions
if (isArmTarget) {
// lancedb binary
const packageToInstall = {
"darwin-arm64": "@lancedb/vectordb-darwin-arm64",
"linux-arm64": "@lancedb/vectordb-linux-arm64-gnu",
"win32-arm64": "@lancedb/vectordb-win32-arm64-msvc",
}[target];
console.log(
`Contents of: ${packageName}`,
fs.readdirSync(path.join(tempDir, "node_modules", toCopy)),
"[info] Downloading pre-built lancedb binary: " + packageToInstall,
);
// Without this it seems the file isn't completely written to disk
// Ideally we validate file integrity in the validation at the end
await new Promise((resolve) => setTimeout(resolve, 2000));
// Copy the installed package back to the current directory
await new Promise((resolve, reject) => {
ncp(
path.join(tempDir, "node_modules", toCopy),
path.join(currentDir, "node_modules", toCopy),
{ dereference: true },
(error) => {
if (error) {
console.error(
`[error] Error copying ${packageName} package`,
error,
);
reject(error);
} else {
resolve();
}
},
);
});
} finally {
// Clean up the temporary directory
// rimrafSync(tempDir);
// Return to the original directory
process.chdir(currentDir);
await Promise.all([
copyEsbuild(target),
copySqlite(target),
installAndCopyNodeModules(packageToInstall, "@lancedb"),
]);
} else {
// Download esbuild from npm in tmp and copy over
console.log("[info] npm installing esbuild binary");
await installAndCopyNodeModules("esbuild@0.17.19", "@esbuild");
}
}
// GitHub Actions doesn't support ARM, so we need to download pre-saved binaries
// 02/07/25 - the above comment is out of date, there is now support for ARM runners on GitHub Actions
if (isArmTarget) {
// lancedb binary
const packageToInstall = {
"darwin-arm64": "@lancedb/vectordb-darwin-arm64",
"linux-arm64": "@lancedb/vectordb-linux-arm64-gnu",
"win32-arm64": "@lancedb/vectordb-win32-arm64-msvc",
}[target];
console.log(
"[info] Downloading pre-built lancedb binary: " + packageToInstall,
);
await installNodeModuleInTempDirAndCopyToCurrent(
packageToInstall,
"@lancedb",
);
// Replace the installed with pre-built
console.log("[info] Downloading pre-built sqlite3 binary");
rimrafSync("../../core/node_modules/sqlite3/build");
const downloadUrl = {
"darwin-arm64":
"https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-darwin-arm64.tar.gz",
"linux-arm64":
"https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v3-linux-arm64.tar.gz",
// node-sqlite3 doesn't have a pre-built binary for win32-arm64
"win32-arm64":
"https://continue-server-binaries.s3.us-west-1.amazonaws.com/win32-arm64/node_sqlite3.tar.gz",
}[target];
execCmdSync(
`curl -L -o ../../core/node_modules/sqlite3/build.tar.gz ${downloadUrl}`,
);
execCmdSync("cd ../../core/node_modules/sqlite3 && tar -xvzf build.tar.gz");
fs.unlinkSync("../../core/node_modules/sqlite3/build.tar.gz");
// Download and unzip esbuild
console.log("[info] Downloading pre-built esbuild binary");
rimrafSync("node_modules/@esbuild");
fs.mkdirSync("node_modules/@esbuild", { recursive: true });
execCmdSync(
`curl -o node_modules/@esbuild/esbuild.zip https://continue-server-binaries.s3.us-west-1.amazonaws.com/${target}/esbuild.zip`,
);
execCmdSync(`cd node_modules/@esbuild && unzip esbuild.zip`);
fs.unlinkSync("node_modules/@esbuild/esbuild.zip");
} else {
// Download esbuild from npm in tmp and copy over
console.log("npm installing esbuild binary");
await installNodeModuleInTempDirAndCopyToCurrent(
"esbuild@0.17.19",
"@esbuild",
);
}
console.log("[info] Copying sqlite node binding from core");
await new Promise((resolve, reject) => {
ncp(
@ -465,7 +363,7 @@ void (async () => {
);
// delete esbuild/bin because platform-specific @esbuild is downloaded
fs.rmdirSync(`out/node_modules/esbuild/bin`, { recursive: true });
fs.rmSync(`out/node_modules/esbuild/bin`, { recursive: true });
console.log(`[info] Copied ${NODE_MODULES_TO_COPY.join(", ")}`);
@ -534,4 +432,6 @@ void (async () => {
`out/node_modules/@lancedb/vectordb-${target}${isWinTarget ? "-msvc" : ""}${isLinuxTarget ? "-gnu" : ""}/index.node`,
`out/node_modules/esbuild/lib/main.js`,
]);
process.exit(0);
})();

View file

@ -1,68 +1,13 @@
const fs = require("fs");
const ncp = require("ncp").ncp;
const path = require("path");
const ncp = require("ncp").ncp;
const { rimrafSync } = require("rimraf");
const {
validateFilesPresent,
execCmdSync,
autodetectPlatformAndArch,
} = require("../../../scripts/util/index");
const { execCmdSync } = require("../../../scripts/util/index");
const continueDir = path.join(__dirname, "..", "..", "..");
function generateConfigYamlSchema() {
process.chdir(path.join(continueDir, "packages", "config-yaml"));
execCmdSync("npm install");
execCmdSync("npm run build");
execCmdSync("npm run generate-schema");
fs.copyFileSync(
path.join("schema", "config-yaml-schema.json"),
path.join(continueDir, "extensions", "vscode", "config-yaml-schema.json"),
);
console.log("[info] Generated config.yaml schema");
}
function copyConfigSchema() {
process.chdir(path.join(continueDir, "extensions", "vscode"));
// Modify and copy for .continuerc.json
const schema = JSON.parse(fs.readFileSync("config_schema.json", "utf8"));
schema.$defs.SerializedContinueConfig.properties.mergeBehavior = {
type: "string",
enum: ["merge", "overwrite"],
default: "merge",
title: "Merge behavior",
markdownDescription:
"If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json.",
"x-intellij-html-description":
"<p>If set to <code>merge</code>, <code>.continuerc.json</code> will be applied on top of <code>config.json</code> (arrays and objects are merged). If set to <code>overwrite</code>, then every top-level property of <code>.continuerc.json</code> will overwrite that property from <code>config.json</code>.</p>",
};
fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2));
// Copy config schemas to intellij
fs.copyFileSync(
"config_schema.json",
path.join(
"..",
"intellij",
"src",
"main",
"resources",
"config_schema.json",
),
);
fs.copyFileSync(
"continue_rc_schema.json",
path.join(
"..",
"intellij",
"src",
"main",
"resources",
"continue_rc_schema.json",
),
);
}
function copyTokenizers() {
fs.copyFileSync(
path.join(__dirname, "../../../core/llm/llamaTokenizerWorkerPool.mjs"),
@ -77,22 +22,6 @@ function copyTokenizers() {
console.log("[info] Copied llamaTokenizer");
}
function installNodeModules() {
// Make sure we are in the right directory
if (!process.cwd().endsWith("vscode")) {
process.chdir(path.join(continueDir, "extensions", "vscode"));
}
// Install node_modules //
execCmdSync("npm install");
console.log("[info] npm install in extensions/vscode completed");
process.chdir(path.join(continueDir, "gui"));
execCmdSync("npm install");
console.log("[info] npm install in gui completed");
}
async function buildGui(isGhAction) {
// Make sure we are in the right directory
if (!process.cwd().endsWith("gui")) {
@ -536,15 +465,13 @@ async function copyScripts() {
// in the build
function writeBuildTimestamp() {
fs.writeFileSync(
"src/.buildTimestamp.ts",
path.join(continueDir, "extensions/vscode", "src/.buildTimestamp.ts"),
`export default "${new Date().toISOString()}";\n`,
);
}
module.exports = {
generateConfigYamlSchema,
copyConfigSchema,
installNodeModules,
continueDir,
buildGui,
copyOnnxRuntimeFromNodeModules,
copyTreeSitterWasms,

View file

@ -200,6 +200,10 @@ class VsCodeIde implements IDE {
return globalEnabled && continueEnabled;
}
isWorkspaceRemote(): Promise<boolean> {
return Promise.resolve(vscode.env.remoteName !== undefined);
}
getUniqueId(): Promise<string> {
return Promise.resolve(vscode.env.machineId);
}

View file

@ -1,49 +0,0 @@
import * as path from "node:path";
import * as glob from "glob";
import Mocha from "mocha";
export function run() {
// Avoid timing out when stopping on breakpoints during debugging in VSCode
const timeoutOption = process.env.MOCHA_TIMEOUT
? Number.parseInt(process.env.MOCHA_TIMEOUT)
: // : undefined;
30_000;
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
color: true,
timeout: timeoutOption,
});
// See esbuild.test.mjs for more details
// Assumes this file is in out/test/runner/mochaRunner.js
const compiledTestSuitesDirectory = path.resolve(__dirname);
glob
.sync("**/**.test.js", { cwd: compiledTestSuitesDirectory })
.forEach((file) => {
mocha.addFile(path.resolve(compiledTestSuitesDirectory, file));
});
console.log(
`Testing files in ${compiledTestSuitesDirectory}: ${mocha.files}`,
);
return new Promise<void>((resolve, reject) => {
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
}

View file

@ -1,127 +0,0 @@
import fs from "node:fs";
import * as path from "node:path";
import { runTests } from "@vscode/test-electron";
import { defaultConfig } from "core/config/default";
export const testWorkspacePath = path.resolve(
__dirname,
"..",
"src",
"test",
"fixtures",
"test-workspace",
);
const continueGlobalDir = path.resolve(
__dirname,
"..",
"src",
"test",
"fixtures",
".continue",
);
function setupTestWorkspace() {
if (fs.existsSync(testWorkspacePath)) {
fs.rmSync(testWorkspacePath, { recursive: true });
}
fs.mkdirSync(testWorkspacePath, {
recursive: true,
});
fs.writeFileSync(
path.join(testWorkspacePath, "test.py"),
"print('Hello World!')",
);
fs.writeFileSync(
path.join(testWorkspacePath, "index.js"),
"console.log('Hello World!')",
);
fs.writeFileSync(
path.join(testWorkspacePath, "test.py"),
"print('Hello World!')",
);
fs.mkdirSync(path.join(testWorkspacePath, "test-folder"));
fs.writeFileSync(
path.join(testWorkspacePath, "test-folder", "test.js"),
"console.log('Hello World!')",
);
}
function setupContinueGlobalDir() {
if (fs.existsSync(continueGlobalDir)) {
fs.rmSync(continueGlobalDir, { recursive: true });
}
fs.mkdirSync(continueGlobalDir, {
recursive: true,
});
fs.writeFileSync(
path.join(continueGlobalDir, "config.json"),
JSON.stringify({
...defaultConfig,
models: [
{
title: "Test Model",
provider: "openai",
model: "gpt-3.5-turbo",
apiKey: "API_KEY",
},
],
}),
);
}
function cleanupTestWorkspace() {
if (fs.existsSync(testWorkspacePath)) {
fs.rmSync(testWorkspacePath, { recursive: true });
}
}
function cleanupContinueGlobalDir() {
if (fs.existsSync(continueGlobalDir)) {
fs.rmSync(continueGlobalDir, { recursive: true });
}
}
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
// Assumes this file is in out/runTestOnVSCodeHost.js
const extensionDevelopmentPath = path.resolve(__dirname, "../");
console.log("extensionDevelopmentPath", extensionDevelopmentPath);
// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(
extensionDevelopmentPath,
"out/mochaRunner",
);
const extensionTestsEnv = {
NODE_ENV: "test",
CONTINUE_GLOBAL_DIR: continueGlobalDir,
};
setupTestWorkspace();
setupContinueGlobalDir();
// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
extensionTestsEnv,
launchArgs: [testWorkspacePath],
});
} catch (err) {
console.error("Failed to run tests", err);
process.exit(1);
} finally {
cleanupTestWorkspace();
cleanupContinueGlobalDir();
}
}
main();

View file

@ -1,89 +0,0 @@
import assert from "node:assert";
import path from "node:path";
import { describe, test } from "mocha";
import * as vscode from "vscode";
import { VsCodeIdeUtils } from "../../util/ideUtils";
import { testWorkspacePath } from "../runner/runTestOnVSCodeHost";
const util = require("node:util");
const asyncExec = util.promisify(require("node:child_process").exec);
/*
TODO check uri => path assumptions, will only work in some environments.
*/
describe("IDE Utils", () => {
const utils = new VsCodeIdeUtils();
const testPyPath = path.join(testWorkspacePath, "test.py");
const testJsPath = path.join(testWorkspacePath, "test-folder", "test.js");
test("getWorkspaceDirectories", async () => {
const [dir] = utils.getWorkspaceDirectories();
assert(dir.toString().endsWith("test-workspace"));
});
test("fileExists", async () => {
const exists2 = await utils.fileExists(
vscode.Uri.file(path.join(testWorkspacePath, "test.py")),
);
assert(exists2);
});
test("getOpenFiles", async () => {
let openFiles = utils.getOpenFiles();
assert(openFiles.length === 0);
// await utils.openFile(testPyPath);
let document = await vscode.workspace.openTextDocument(testPyPath);
await vscode.window.showTextDocument(document, {
preview: false,
});
openFiles = utils.getOpenFiles();
assert(openFiles.length === 1);
assert(openFiles[0].fsPath === testPyPath);
document = await vscode.workspace.openTextDocument(testJsPath);
await vscode.window.showTextDocument(document, {
preview: false,
});
openFiles = utils.getOpenFiles();
assert(openFiles.length === 2);
assert(openFiles.find((f) => f.fsPath === testPyPath));
assert(openFiles.find((f) => f.fsPath === testJsPath));
});
test("getUniqueId", async () => {
const uniqueId = utils.getUniqueId();
assert(uniqueId.length === 64);
const regex = /^[a-z0-9]+$/;
assert(regex.test(uniqueId));
});
test.skip("getTerminalContents", async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
const terminal = vscode.window.createTerminal();
await new Promise((resolve) => setTimeout(resolve, 1000));
terminal.show();
await new Promise((resolve) => setTimeout(resolve, 1000));
terminal.sendText("echo abcdefg", true);
const contents = await utils.getTerminalContents(1);
console.log("TERMINAL CONTENTS: ", contents);
assert(contents.includes("abcdefg"));
terminal.dispose();
});
test("noDiff", async () => {
const noDiff = await utils.getDiff(false);
assert(noDiff.length === 0);
});
test.skip("getBranch", async () => {
const uri = vscode.Uri.file(testWorkspacePath);
const branch = await utils.getBranch(uri);
assert(typeof branch === "string");
const { stdout } = await asyncExec("git rev-parse --abbrev-ref HEAD", {
cwd: __dirname,
});
assert(branch === stdout?.trim());
});
});

74
gui/package-lock.json generated
View file

@ -31,6 +31,7 @@
"dompurify": "^3.0.6",
"downshift": "^7.6.0",
"escape-carriage": "^1.3.1",
"handlebars": "^4.7.8",
"lodash": "^4.17.21",
"lowlight": "^3.3.0",
"minisearch": "^7.0.2",
@ -114,7 +115,7 @@
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.13",
"@continuedev/fetch": "^1.0.14",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
"@modelcontextprotocol/sdk": "^1.12.0",
@ -215,7 +216,7 @@
},
"../packages/config-yaml": {
"name": "@continuedev/config-yaml",
"version": "1.0.94",
"version": "1.0.95",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
@ -226,10 +227,15 @@
"config-yaml": "dist/cli.js"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6",
"@semantic-release/npm": "^10.0.6",
"@types/jest": "^29.5.14",
"@types/node": "^20.0.0",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"semantic-release": "^21.1.2",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"zod-to-json-schema": "^3.24.5"
@ -6299,6 +6305,36 @@
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
"dev": true
},
"node_modules/handlebars": {
"version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"license": "MIT",
"dependencies": {
"minimist": "^1.2.5",
"neo-async": "^2.6.2",
"source-map": "^0.6.1",
"wordwrap": "^1.0.0"
},
"bin": {
"handlebars": "bin/handlebars"
},
"engines": {
"node": ">=0.4.7"
},
"optionalDependencies": {
"uglify-js": "^3.1.4"
}
},
"node_modules/handlebars/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/has-bigints": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",
@ -8773,6 +8809,15 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
@ -8845,6 +8890,12 @@
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"license": "MIT"
},
"node_modules/node-releases": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
@ -12152,6 +12203,19 @@
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="
},
"node_modules/uglify-js": {
"version": "3.19.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
"integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
"license": "BSD-2-Clause",
"optional": true,
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
@ -13748,6 +13812,12 @@
"node": ">=0.10.0"
}
},
"node_modules/wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
"license": "MIT"
},
"node_modules/wrap-ansi": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",

View file

@ -40,6 +40,7 @@
"dompurify": "^3.0.6",
"downshift": "^7.6.0",
"escape-carriage": "^1.3.1",
"handlebars": "^4.7.8",
"lodash": "^4.17.21",
"lowlight": "^3.3.0",
"minisearch": "^7.0.2",

View file

@ -1,9 +1,9 @@
import { ChatBubbleLeftIcon } from "@heroicons/react/24/outline";
import { SlashCommandDescription } from "core";
import { SlashCommandDescWithSource } from "core";
interface ConversationStarterCardProps {
command: SlashCommandDescription;
onClick: (command: SlashCommandDescription) => void;
command: SlashCommandDescWithSource;
onClick: (command: SlashCommandDescWithSource) => void;
}
export function ConversationStarterCard({

View file

@ -1,4 +1,4 @@
import { SlashCommandDescription } from "core";
import { SlashCommandDescWithSource } from "core";
import { useState } from "react";
import { useBookmarkedSlashCommands } from "../../hooks/useBookmarkedSlashCommands";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
@ -23,8 +23,12 @@ export function ConversationStarterCards() {
isCommandBookmarked(command.name),
);
function onClick(command: SlashCommandDescription) {
mainEditor?.commands.insertPrompt(command);
function onClick(command: SlashCommandDescWithSource) {
mainEditor?.commands.insertPrompt({
description: command.description,
title: command.name,
content: command.prompt,
});
}
if (bookmarkedSlashCommands.length === 0) {

View file

@ -1,27 +1,35 @@
import { SlashCommandDescription } from "core";
import { SlashCommandDescWithSource } from "core";
import { sortCommandsByBookmarkStatus } from "../utils";
describe("sortCommandsByBookmarkStatus", () => {
const mockCommands: SlashCommandDescription[] = [
const mockCommands: SlashCommandDescWithSource[] = [
{
name: "command1",
description: "First command",
prompt: "This is command 1",
source: "built-in",
isLegacy: false,
},
{
name: "command2",
description: "Second command",
prompt: "This is command 2",
source: "built-in",
isLegacy: false,
},
{
name: "command3",
description: "Third command",
prompt: "This is command 3",
source: "built-in",
isLegacy: false,
},
{
name: "command4",
description: "Fourth command",
prompt: "This is command 4",
source: "built-in",
isLegacy: false,
},
];

View file

@ -1,4 +1,4 @@
import { SlashCommandDescription } from "core";
import { SlashCommandDescWithSource } from "core";
import {} from "core/config/default";
/**
@ -8,9 +8,9 @@ import {} from "core/config/default";
* @returns A new sorted array with bookmarked commands first
*/
export function sortCommandsByBookmarkStatus(
commands: SlashCommandDescription[],
commands: SlashCommandDescWithSource[],
bookmarkedCommands: string[],
): SlashCommandDescription[] {
): SlashCommandDescWithSource[] {
return [...commands].sort((a, b) => {
const aIsBookmarked = bookmarkedCommands.includes(a.name);
const bIsBookmarked = bookmarkedCommands.includes(b.name);

View file

@ -11,8 +11,10 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { useIdeMessengerRequest } from "../../../hooks/useIdeMessengerRequest";
import { useWebviewListener } from "../../../hooks/useWebviewListener";
import { useAppSelector } from "../../../redux/hooks";
import { selectCurrentToolCallApplyState } from "../../../redux/selectors/selectCurrentToolCall";
import { selectApplyStateByStreamId } from "../../../redux/slices/sessionSlice";
import {
selectApplyStateByStreamId,
selectApplyStateByToolCallId,
} from "../../../redux/slices/sessionSlice";
import { getFontSize } from "../../../util";
import Spinner from "../../gui/Spinner";
import { isTerminalCodeBlock } from "../utils";
@ -54,6 +56,7 @@ export interface StepContainerPreToolbarProps {
codeBlockIndex: number; // To track which codeblock we are applying
isLastCodeblock: boolean;
codeBlockStreamId: string;
forceToolCallId?: string; // If this is defined, we will use this streamId instead of the one from the codeBlock
range?: string;
children: any;
expanded?: boolean;
@ -68,6 +71,7 @@ export function StepContainerPreToolbar({
codeBlockIndex,
isLastCodeblock,
codeBlockStreamId,
forceToolCallId,
range,
children,
expanded,
@ -99,8 +103,8 @@ export function StepContainerPreToolbar({
const applyState = useAppSelector((state) =>
selectApplyStateByStreamId(state, codeBlockStreamId),
);
const currentToolCallApplyState = useAppSelector(
selectCurrentToolCallApplyState,
const toolCallApplyState = useAppSelector((state) =>
selectApplyStateByToolCallId(state, forceToolCallId),
);
/**
@ -147,7 +151,7 @@ export function StepContainerPreToolbar({
setRelativeFilepathUri(resolvedUri);
}
};
getRelativeFilepathUri();
void getRelativeFilepathUri();
}, [relativeFilepath, ideMessenger.ide]);
async function getFileUriToApplyTo() {
@ -173,7 +177,7 @@ export function StepContainerPreToolbar({
async function onClickApply() {
const fileUri = await getFileUriToApplyTo();
if (!fileUri) {
ideMessenger.ide.showToast(
void ideMessenger.ide.showToast(
"error",
"Could not resolve filepath to apply changes",
);
@ -188,7 +192,7 @@ export function StepContainerPreToolbar({
});
setAppliedFileUri(fileUri);
refreshFileExists();
void refreshFileExists();
}
function onClickInsertAtCursor() {
@ -198,7 +202,7 @@ export function StepContainerPreToolbar({
async function handleDiffAction(action: "accept" | "reject") {
const filepath = await getFileUriToApplyTo();
if (!filepath) {
ideMessenger.ide.showToast(
void ideMessenger.ide.showToast(
"error",
`Could not resolve filepath to ${action} changes`,
);
@ -233,10 +237,7 @@ export function StepContainerPreToolbar({
}
const renderActionButtons = () => {
const isPendingToolCall =
currentToolCallApplyState &&
currentToolCallApplyState.streamId === applyState?.streamId &&
currentToolCallApplyState.status === "not-started";
const isPendingToolCall = toolCallApplyState?.status === "not-started";
if (isGeneratingCodeBlock || isPendingToolCall) {
const numLines = codeBlockContent.split("\n").length;
@ -271,7 +272,7 @@ export function StepContainerPreToolbar({
return (
<ApplyActions
disableManualApply={disableManualApply}
applyState={applyState}
applyState={toolCallApplyState ?? applyState}
onClickApply={onClickApply}
onClickAccept={() => handleDiffAction("accept")}
onClickReject={() => handleDiffAction("reject")}
@ -293,6 +294,7 @@ export function StepContainerPreToolbar({
<ToolbarDiv isExpanded={isExpanded} className="find-widget-skip gap-3">
<div className="max-w-[50% flex flex-row items-center">
<ChevronDownIcon
data-testid="toggle-codeblock"
onClick={() => setIsExpanded(!isExpanded)}
className={`text-lightgray h-3.5 w-3.5 flex-shrink-0 cursor-pointer hover:brightness-125 ${
isExpanded ? "rotate-0" : "-rotate-90"

View file

@ -126,7 +126,7 @@ interface StyledMarkdownPreviewProps {
itemIndex?: number;
useParentBackgroundColor?: boolean;
disableManualApply?: boolean;
forceStreamId?: string;
toolCallId?: string;
expandCodeblocks?: boolean;
}
@ -196,11 +196,6 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const itemIndexRef = useUpdatingRef(props.itemIndex);
const codeblockStreamIds = useRef<string[]>([]);
useEffect(() => {
if (props.forceStreamId) {
codeblockStreamIds.current = [props.forceStreamId];
}
}, [props.forceStreamId, codeblockStreamIds]);
const [reactContent, setMarkdownSource] = useRemark({
remarkPlugins: [
@ -295,8 +290,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const isLastCodeblock = preChildProps["data-islastcodeblock"];
if (codeblockStreamIds.current[codeBlockIndex] === undefined) {
codeblockStreamIds.current[codeBlockIndex] =
props.forceStreamId ?? uuidv4();
codeblockStreamIds.current[codeBlockIndex] = uuidv4();
}
return (
@ -308,7 +302,8 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
relativeFilepath={relativeFilePath}
isLastCodeblock={isLastCodeblock}
range={range}
codeBlockStreamId={codeblockStreamIds.current[codeBlockIndex]}
codeBlockStreamId={codeblockStreamIds.current[codeBlockIndex]} // ignored if toolCallId stream state is found
forceToolCallId={props.toolCallId}
expanded={props.expandCodeblocks}
disableManualApply={props.disableManualApply}
>

View file

@ -10,7 +10,11 @@ const ResultGroup = memo(function ResultGroup({ group }: ResultGroupProps) {
return (
<>
{group.map((result, i) => (
<Result key={i} result={result} prevResult={group[i - 1]}></Result>
<Result
key={`${result.timestamp}-${i}`}
result={result}
prevResult={group[i - 1]}
></Result>
))}
</>
);

View file

@ -4,7 +4,7 @@ import {
PencilIcon,
} from "@heroicons/react/24/outline";
import { BookmarkIcon as BookmarkSolid } from "@heroicons/react/24/solid";
import { SlashCommandDescription } from "core";
import { SlashCommandDescWithSource } from "core";
import { useContext, useMemo } from "react";
import { useAuth } from "../../../../context/Auth";
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
@ -15,10 +15,12 @@ import { useMainEditor } from "../../TipTapEditor";
import { useLump } from "../LumpContext";
import { ExploreBlocksButton } from "./ExploreBlocksButton";
type PromptWithSlug = SlashCommandDescription & { slug?: string };
interface PromptCommandWithSlug extends SlashCommandDescWithSource {
slug?: string;
}
interface PromptRowProps {
prompt: PromptWithSlug;
prompt: PromptCommandWithSlug;
isBookmarked: boolean;
setIsBookmarked: (isBookmarked: boolean) => void;
onEdit?: () => void;
@ -38,7 +40,11 @@ function PromptRow({
const handlePromptClick = (e: React.MouseEvent) => {
e.stopPropagation();
mainEditor?.commands.insertPrompt(prompt);
mainEditor?.commands.insertPrompt({
title: prompt.name,
description: prompt.description,
content: prompt.prompt,
});
hideLump();
};
@ -102,7 +108,7 @@ export function PromptsSection() {
(state) => state.config.config.slashCommands ?? [],
);
const handleEdit = (prompt: PromptWithSlug) => {
const handleEdit = (prompt: PromptCommandWithSlug) => {
if (prompt.promptFile) {
ideMessenger.post("openFile", {
path: prompt.promptFile,
@ -120,23 +126,24 @@ export function PromptsSection() {
};
const sortedCommands = useMemo(() => {
const promptsWithSlug: PromptWithSlug[] = structuredClone(slashCommands);
const promptsWithSlug: PromptCommandWithSlug[] =
structuredClone(slashCommands);
// get the slugs from rawYaml
if (selectedProfile?.rawYaml) {
const parsed = parseConfigYaml(selectedProfile.rawYaml);
const parsedPrompts = parsed.prompts ?? [];
let index = 0;
for (const prompt of promptsWithSlug) {
for (const commandWithSlug of promptsWithSlug) {
// skip for local prompt files
if (prompt.promptFile) continue;
if (commandWithSlug.promptFile) continue;
const yamlPrompt = parsedPrompts[index];
if (yamlPrompt) {
if ("uses" in yamlPrompt) {
prompt.slug = yamlPrompt.uses;
commandWithSlug.slug = yamlPrompt.uses;
} else {
prompt.slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`;
commandWithSlug.slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`;
}
}
index = index + 1;

View file

@ -1,8 +1,9 @@
import { mergeAttributes, Node } from "@tiptap/core";
import { Node as ProseMirrorNode } from "@tiptap/pm/model";
import { ReactNodeViewRenderer } from "@tiptap/react";
import { ContextItemWithId, SlashCommandDescription } from "core";
import { ContextItemWithId } from "core";
import { MAIN_EDITOR_INPUT_ID } from "../../../../../pages/gui/Chat";
import { ComboBoxItem } from "../../../types";
import { PromptBlockPreview } from "./PromptBlockPreview";
export interface PromptBlockOptions {
@ -20,7 +21,9 @@ declare module "@tiptap/core" {
/**
* Insert a prompt block into the editor
*/
insertPrompt: (item: SlashCommandDescription) => ReturnType;
insertPrompt: (
item: Pick<ComboBoxItem, "title" | "content" | "description">,
) => ReturnType;
/**
* Clear all prompt blocks from the editor
@ -76,15 +79,15 @@ export const PromptBlock = Node.create<PromptBlockOptions>({
addCommands() {
return {
insertPrompt:
(prompt: SlashCommandDescription) =>
(item) =>
({ chain }) => {
const item: ContextItemWithId = {
content: prompt.prompt ?? "",
name: prompt.name,
description: prompt.description,
const contextItem: ContextItemWithId = {
content: item.content ?? "",
name: item.title,
description: item.description,
id: {
providerTitle: "prompt",
itemId: prompt.name,
itemId: item.title,
},
};
@ -93,7 +96,7 @@ export const PromptBlock = Node.create<PromptBlockOptions>({
.insertContentAt(0, {
type: this.name,
attrs: {
item,
item: contextItem,
inputId: MAIN_EDITOR_INPUT_ID,
},
})

View file

@ -22,11 +22,7 @@ export const SlashCommand = Node.create<SlashCommandOptions>({
// First delete the slash character and any text after it
editor.chain().focus().deleteRange(range).run();
editor.commands.insertPrompt({
name: props.title,
description: props.description,
prompt: props.content,
});
editor.commands.insertPrompt(props);
},
},
};

View file

@ -330,7 +330,10 @@ export function createEditorConfig(options: {
],
editorProps: {
attributes: {
class: "outline-none overflow-hidden",
"data-testid": props.isMainInput
? "editor-input-main"
: `editor-input-${props.inputId}`,
class: "ProseMirror outline-none overflow-hidden",
style: `font-size: ${getFontSize()}px;`,
},
},

Some files were not shown because too many files have changed in this diff Show more