diff --git a/.continue/rules/intellij-plugin-test-execution.yaml b/.continue/rules/intellij-plugin-test-execution.yaml new file mode 100644 index 000000000..386a72a2b --- /dev/null +++ b/.continue/rules/intellij-plugin-test-execution.yaml @@ -0,0 +1,15 @@ +name: IntelliJ Plugin Test Execution +version: 0.0.1 +schema: v1 +rules: + - name: IntelliJ Plugin Test Execution + rule: |- + Run IntelliJ plugin tests using Gradle with the fully qualified test class or method name: + ```bash + # Run test class + ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest" + + # Run specific test method + ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest.should*" + ``` + globs: extensions/intellij/**/*Test.kt diff --git a/.continue/rules/intellij-test-standards.yaml b/.continue/rules/intellij-test-standards.yaml new file mode 100644 index 000000000..f706757e2 --- /dev/null +++ b/.continue/rules/intellij-test-standards.yaml @@ -0,0 +1,10 @@ +name: IntelliJ Test Standards +version: 0.0.1 +schema: v1 +rules: + - name: IntelliJ Test Standards + rule: When writing tests for the IntelliJ plugin, use the mockk library for + mocking. Prefer mockk's idiomatic syntax for creating and verifying mocks. + Always structure tests with clear Arrange-Act-Assert patterns and use + descriptive test names that indicate the scenario being tested. + globs: "**/test/**/*.kt" diff --git a/.continue/rules/unit-testing-rules.yaml b/.continue/rules/unit-testing-rules.yaml new file mode 100644 index 000000000..ec22e9467 --- /dev/null +++ b/.continue/rules/unit-testing-rules.yaml @@ -0,0 +1,30 @@ +name: unit-testing-rules +version: 0.0.1 +schema: v1 +rules: + - name: unit-testing-rules + rule: >- + For unit testing in this project: + + + 1. The project uses Jest as the testing framework + + 2. Run tests using `npm test` from within the specific package/module + directory + + 3. Command structure: `cd [directory] && npm test -- [test file path]` + + 4. The test script uses experimental VM modules via NODE_OPTIONS flag + + 5. Test files follow the pattern `*.test.ts` + + 6. Tests must import Jest with `import { jest } from "@jest/globals";` + + 7. Run tests from within the specific package directory (e.g., `cd core` + for core module tests) + + 8. Write tests as top-level `test()` functions - DO NOT use `describe()` + blocks + + 9. Include the function name being tested in the test description for + clarity diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml new file mode 100644 index 000000000..f915854d1 --- /dev/null +++ b/.github/workflows/cla.yaml @@ -0,0 +1,29 @@ +name: "CLA Assistant" +on: + issue_comment: + types: [ created ] + pull_request_target: + types: [ opened, closed, synchronize ] + +permissions: + actions: write + contents: write + pull-requests: write + statuses: write + +jobs: + CLAAssistant: + runs-on: ubuntu-latest + # Only run this workflow on the main repository (continuedev/continue) + if: github.repository == 'continuedev/continue' + steps: + - name: "CLA Assistant" + if: (contains(github.event.comment.body, 'recheck') || contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA')) || github.event_name == 'pull_request_target' + uses: contributor-assistant/github-action@v2.6.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path-to-signatures: "signatures/version1/cla.json" + path-to-document: "https://github.com/continuedev/continue/blob/main/docs/docs/CLA.md" + branch: cla-signatures + allowlist: dependabot[bot] \ No newline at end of file diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index d1303995e..8ea3d2ebb 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -63,7 +63,7 @@ jobs: - name: Bump version in gradle.properties run: | - cd extensions/intelllij + cd extensions/intellij awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties rm -rf tmp NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 56920694f..eec79f4c6 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -235,10 +235,11 @@ jobs: cd packages/config-yaml npm run build - - name: Type check + - name: Type check and lint run: | cd gui npx tsc --noEmit + npm run lint binary-checks: needs: [install-root, install-core, install-config-yaml] diff --git a/.gitignore b/.gitignore index 2ca914069..95cd177a9 100644 --- a/.gitignore +++ b/.gitignore @@ -162,5 +162,8 @@ extensions/.continue-debug/ *.vsix +# intellij module library files +*.iml + .continuerules **/.continue/assistants/ \ No newline at end of file diff --git a/.idea/jsLinters/eslint.xml b/.idea/jsLinters/eslint.xml new file mode 100644 index 000000000..541945bb0 --- /dev/null +++ b/.idea/jsLinters/eslint.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml index b0c1c68fb..0c83ac4e8 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -2,5 +2,6 @@ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e6e1d06f..4f30e3e00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,44 +3,49 @@ ## Table of Contents - [Contributing to Continue](#contributing-to-continue) - - [Table of Contents](#table-of-contents) + - [Table of Contents](#table-of-contents) - [❤️ Ways to Contribute](#️-ways-to-contribute) - - [👋 Continue Contribution Ideas](#-continue-contribution-ideas) - - [🐛 Report Bugs](#-report-bugs) - - [✨ Suggest Enhancements](#-suggest-enhancements) - - [📖 Updating / Improving Documentation](#-updating--improving-documentation) - - [Running the Documentation Server Locally](#running-the-documentation-server-locally) - - [Method 1: NPM Script](#method-1-npm-script) - - [Method 2: VS Code Task](#method-2-vs-code-task) - - [🧑‍💻 Contributing Code](#-contributing-code) - - [Environment Setup](#environment-setup) - - [Pre-requisites](#pre-requisites) - - [Fork the Continue Repository](#fork-the-continue-repository) - - [VS Code](#vs-code) - - [Debugging](#debugging) - - [JetBrains](#jetbrains) - - [Our Git Workflow](#our-git-workflow) - - [Development workflow](#development-workflow) - - [Formatting](#formatting) - - [Testing](#testing) - - [Review Process](#review-process) - - [Getting help](#getting-help) - - [Contribtuing new LLM Providers/Models](#contribtuing-new-llm-providersmodels) - - [Adding an LLM Provider](#adding-an-llm-provider) - - [Adding Models](#adding-models) - - [📐 Continue Architecture](#-continue-architecture) - - [Continue VS Code Extension](#continue-vs-code-extension) - - [Continue JetBrains Extension](#continue-jetbrains-extension) + - [👋 Continue Contribution Ideas](#-continue-contribution-ideas) + - [🐛 Report Bugs](#-report-bugs) + - [✨ Suggest Enhancements](#-suggest-enhancements) + - [📖 Updating / Improving Documentation](#-updating--improving-documentation) + - [Running the Documentation Server Locally](#running-the-documentation-server-locally) + - [Method 1: NPM Script](#method-1-npm-script) + - [Method 2: VS Code Task](#method-2-vs-code-task) + - [🧑‍💻 Contributing Code](#-contributing-code) + - [Environment Setup](#environment-setup) + - [Pre-requisites](#pre-requisites) + - [Fork the Continue Repository](#fork-the-continue-repository) + - [VS Code](#vs-code) + - [Debugging](#debugging) + - [JetBrains](#jetbrains) + - [Our Git Workflow](#our-git-workflow) + - [Development workflow](#development-workflow) + - [Formatting](#formatting) + - [Testing](#testing) + - [Review Process](#review-process) + - [Getting help](#getting-help) + - [Contribtuing new LLM Providers/Models](#contribtuing-new-llm-providersmodels) + - [Adding an LLM Provider](#adding-an-llm-provider) + - [Adding Models](#adding-models) + - [📐 Continue Architecture](#-continue-architecture) + - [Continue VS Code Extension](#continue-vs-code-extension) + - [Continue JetBrains Extension](#continue-jetbrains-extension) + - [Contibutor License Agreement](#contributor-license-agreement-cla) # ❤️ Ways to Contribute ## 👋 Continue Contribution Ideas -[This GitHub project board](https://github.com/orgs/continuedev/projects/2) is a list of ideas for how you can contribute to Continue. These aren't the only ways, but are a great starting point if you are new to the project. You can also browse the list of [good first issues](https://github.com/continuedev/continue/issues?q=is:issue%20state:open%20label:good-first-issue). +[This GitHub project board](https://github.com/orgs/continuedev/projects/2) is a list of ideas for how you can +contribute to Continue. These aren't the only ways, but are a great starting point if you are new to the project. You +can also browse the list +of [good first issues](https://github.com/continuedev/continue/issues?q=is:issue%20state:open%20label:good-first-issue). ## 🐛 Report Bugs -If you find a bug, please [create an issue](https://github.com/continuedev/continue/issues) to report it! A great bug report includes: +If you find a bug, please [create an issue](https://github.com/continuedev/continue/issues) to report it! A great bug +report includes: - A description of the bug - Steps to reproduce @@ -50,19 +55,22 @@ If you find a bug, please [create an issue](https://github.com/continuedev/conti ## ✨ Suggest Enhancements -Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are: +Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest +an enhancement are: - Create an issue - - First, check whether a similar proposal has already been made - - If not, [create an issue](https://github.com/continuedev/continue/issues) - - Please describe the enhancement in as much detail as you can, and why it would be useful + - First, check whether a similar proposal has already been made + - If not, [create an issue](https://github.com/continuedev/continue/issues) + - Please describe the enhancement in as much detail as you can, and why it would be useful - Join the [Continue Discord](https://discord.gg/NWtdYexhMs) and tell us about your idea in the `#feedback` channel ## 📖 Updating / Improving Documentation -Continue is continuously improving, but a feature isn't complete until it is reflected in the documentation! If you see something out-of-date or missing, you can help by clicking "Edit this page" at the bottom of any page on [docs.continue.dev](https://docs.continue.dev). +Continue is continuously improving, but a feature isn't complete until it is reflected in the documentation! If you see +something out-of-date or missing, you can help by clicking "Edit this page" at the bottom of any page +on [docs.continue.dev](https://docs.continue.dev). ### Running the Documentation Server Locally @@ -70,7 +78,8 @@ You can run the documentation server locally using either of the following metho #### Method 1: NPM Script -1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see there is a sign you're in the right place. +1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see + there is a sign you're in the right place. 2. Run the following command to install the necessary dependencies for the documentation server: @@ -92,17 +101,22 @@ You can run the documentation server locally using either of the following metho 3. Look for the `docs:start` task and select it. -This will start a local server and you can see the documentation rendered in your default browser, typically accessible at `http://localhost:3000`. +This will start a local server and you can see the documentation rendered in your default browser, typically accessible +at `http://localhost:3000`. ## 🧑‍💻 Contributing Code -We welcome contributions from developers of all experience levels - from first-time contributors to seasoned open source maintainers. While we aim to maintain high standards for reliability and maintainability, our goal is to keep the process as welcoming and straightforward as possible. +We welcome contributions from developers of all experience levels - from first-time contributors to seasoned open source +maintainers. While we aim to maintain high standards for reliability and maintainability, our goal is to keep the +process as welcoming and straightforward as possible. ### Environment Setup #### Pre-requisites -You should have Node.js version 20.19.0 (LTS) or higher installed. You can get it on [nodejs.org](https://nodejs.org/en/download) or, if you are using NVM (Node Version Manager), you can set the correct version of Node.js for this project by running the following command in the root of the project: +You should have Node.js version 20.19.0 (LTS) or higher installed. You can get it +on [nodejs.org](https://nodejs.org/en/download) or, if you are using NVM (Node Version Manager), you can set the correct +version of Node.js for this project by running the following command in the root of the project: ```bash nvm use @@ -114,32 +128,39 @@ nvm use 2. Clone your forked repository to your local machine. Use: `git clone https://github.com/YOUR_USERNAME/continue.git` -3. Navigate to the cloned directory and make sure you are on the main branch. Create your feature/fix branch from there, like so: `git checkout -b 123-my-feature-branch` +3. Navigate to the cloned directory and make sure you are on the main branch. Create your feature/fix branch from there, + like so: `git checkout -b 123-my-feature-branch` 4. Send your pull request to the main branch. #### VS Code -1. Open the VS Code command pallet (`cmd/ctrl+shift+p`) and select `Tasks: Run Task` and then select `install-all-dependencies` +1. Open the VS Code command pallet (`cmd/ctrl+shift+p`) and select `Tasks: Run Task` and then select + `install-all-dependencies` 2. Start debugging: - 1. Switch to Run and Debug view - 2. Select `Launch extension` from drop down - 3. Hit play button - 4. This will start the extension in debug mode and open a new VS Code window with it installed - 1. The new VS Code window with the extension is referred to as the _Host VS Code_ - 2. The window you started debugging from is referred to as the _Main VS Code_ + 1. Switch to Run and Debug view + 2. Select `Launch extension` from drop down + 3. Hit play button + 4. This will start the extension in debug mode and open a new VS Code window with it installed + 1. The new VS Code window with the extension is referred to as the _Host VS Code_ + 2. The window you started debugging from is referred to as the _Main VS Code_ -3. To package the extension, run `npm run package` in the `extensions/vscode` directory, select `Tasks: Run Task` and then select `vscode-extension:package`. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which you can install by right-clicking and selecting "Install Extension VSIX". +3. To package the extension, run `npm run package` in the `extensions/vscode` directory, select `Tasks: Run Task` and + then select `vscode-extension:package`. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which + you can install by right-clicking and selecting "Install Extension VSIX". ##### Debugging -**Breakpoints** can be used in both the `core` and `extensions/vscode` folders while debugging, but are not currently supported inside of `gui` code. +**Breakpoints** can be used in both the `core` and `extensions/vscode` folders while debugging, but are not currently +supported inside of `gui` code. -**Hot-reloading** is enabled with Vite, so if you make any changes to the `gui`, they should be automatically reflected without rebuilding. In some cases, you may need to refresh the _Host VS Code_ window to see the changes. +**Hot-reloading** is enabled with Vite, so if you make any changes to the `gui`, they should be automatically reflected +without rebuilding. In some cases, you may need to refresh the _Host VS Code_ window to see the changes. -Similarly, any changes to `core` or `extensions/vscode` will be automatically included by just reloading the _Host VS Code_ window with cmd/ctrl+shift+p "Reload Window". +Similarly, any changes to `core` or `extensions/vscode` will be automatically included by just reloading the _Host VS +Code_ window with cmd/ctrl+shift+p "Reload Window". #### JetBrains @@ -147,13 +168,20 @@ See [`intellij/CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the ### Our Git Workflow -We keep a single permanent branch: `main`. When we are ready to create a "pre-release" version, we create a tag on the `main` branch titled `v1.1.x-vscode`, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will create a new release titled `v1.0x-vscode`, triggering a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. This workflow is well explained by . +We keep a single permanent branch: `main`. When we are ready to create a "pre-release" version, we create a tag on the +`main` branch titled `v1.1.x-vscode`, which automatically triggers the workflow +in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When +a release has been sufficiently tested, we will create a new release titled `v1.0x-vscode`, triggering a similar +workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code +extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. This workflow +is well explained by . ### What makes a good PR? To keep the Continue codebase clean and maintainable, we expect the following from our own team and all contributors: -- Open a new issue or comment on an existing one before writing code. This ensures your proposed changes are aligned with the project direction +- Open a new issue or comment on an existing one before writing code. This ensures your proposed changes are aligned + with the project direction - Keep changes focused. Multiple unrelated fixes should be opened as separate PRs - Write or update tests for new functionality - Update relevant documentation in the `docs` folder @@ -161,18 +189,22 @@ To keep the Continue codebase clean and maintainable, we expect the following fr ### Formatting -Continue uses [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to format JavaScript/TypeScript. Please install the Prettier extension in VS Code and enable "Format on Save" in your settings. +Continue uses [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to format +JavaScript/TypeScript. Please install the Prettier extension in VS Code and enable "Format on Save" in your settings. ### Testing -We have a mix of unit, functional, and e2e test suites, with a primary focus on functional testing. These tests run on each pull request. If your PR causes one of these tests to fail, we will ask that you to resolve the issue before we merge. +We have a mix of unit, functional, and e2e test suites, with a primary focus on functional testing. These tests run on +each pull request. If your PR causes one of these tests to fail, we will ask that you to resolve the issue before we +merge. When contributing, please update or create the appropriate tests to help verify the correctness of your implementaiton. ### Review Process - **Initial Review** - A maintainer will be assigned as primary reviewer -- **Feedback Loop** - The reviewer may request changes. We value your work, but also want to ensure the code is maintainable and follows our patterns. +- **Feedback Loop** - The reviewer may request changes. We value your work, but also want to ensure the code is + maintainable and follows our patterns. - **Approval & Merge** - Once the PR is approved, it will be merged into the `main` branch. ### Getting help @@ -183,19 +215,53 @@ Join [#contribute on Discord](https://discord.gg/vapESyrFmJ) to engage with main ### Adding an LLM Provider -Continue has support for more than a dozen different LLM "providers", making it easy to use models running on OpenAI, Ollama, Together, LM Studio, Msty, and more. You can find all of the existing providers [here](https://github.com/continuedev/continue/tree/main/core/llm/llms), and if you see one missing, you can add it with the following steps: +Continue has support for more than a dozen different LLM "providers", making it easy to use models running on OpenAI, +Ollama, Together, LM Studio, Msty, and more. You can find all of the existing +providers [here](https://github.com/continuedev/continue/tree/main/core/llm/llms), and if you see one missing, you can +add it with the following steps: -1. Create a new file in the `core/llm/llms` directory. The name of the file should be the name of the provider, and it should export a class that extends `BaseLLM`. This class should contain the following minimal implementation. We recommend viewing pre-existing providers for more details. The [LlamaCpp Provider](./core/llm/llms/LlamaCpp.ts) is a good simple example. +1. Create a new file in the `core/llm/llms` directory. The name of the file should be the name of the provider, and it + should export a class that extends `BaseLLM`. This class should contain the following minimal implementation. We + recommend viewing pre-existing providers for more details. The [LlamaCpp Provider](./core/llm/llms/LlamaCpp.ts) is a + good simple example. 2. Add your provider to the `LLMs` array in [core/llm/llms/index.ts](./core/llm/llms/index.ts). -3. If your provider supports images, add it to the `PROVIDER_SUPPORTS_IMAGES` array in [core/llm/autodetect.ts](./core/llm/autodetect.ts). -4. Add a documentation page for your provider in [`docs/docs/customize/model-providers/more`](./docs/docs/customize/model-providers/more). This should show an example of configuring your provider in `config.yaml` and explain what options are available. +3. If your provider supports images, add it to the `PROVIDER_SUPPORTS_IMAGES` array + in [core/llm/autodetect.ts](./core/llm/autodetect.ts). +4. Add a documentation page for your provider in [ + `docs/docs/customize/model-providers/more`](./docs/docs/customize/model-providers/more). This should show an example + of configuring your provider in `config.yaml` and explain what options are available. ### Adding Models -While any model that works with a supported provider can be used with Continue, we keep a list of recommended models that can be automatically configured from the UI or `config.json`. The following files should be updated when adding a model: +While any model that works with a supported provider can be used with Continue, we keep a list of recommended models +that can be automatically configured from the UI or `config.json`. The following files should be updated when adding a +model: -- [AddNewModel page](./gui/src/pages/AddNewModel/configs/) - This directory defines which model options are shown in the side bar model selection UI. To add a new model: - 1. Add a `ModelPackage` entry for the model into [configs/models.ts](./gui/src/pages/AddNewModel/configs/models.ts), following the lead of the many examples near the top of the file - 2. Add the model within its provider's array to [configs/providers.ts](./gui/src/pages/AddNewModel/configs/providers.ts) (add provider if needed) -- LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models). -- [Prompt Templates](./core/llm/autodetect.ts) - In this file you'll find the `autodetectTemplateType` function. Make sure that for the model name you just added, this function returns the correct template type. This is assuming that the chat template for that model is already built in Continue. If not, you will have to add the template type and corresponding edit and chat templates. +- [AddNewModel page](./gui/src/pages/AddNewModel/configs/) - This directory defines which model options are shown in the + side bar model selection UI. To add a new model: + 1. Add a `ModelPackage` entry for the model into [configs/models.ts](./gui/src/pages/AddNewModel/configs/models.ts), + following the lead of the many examples near the top of the file + 2. Add the model within its provider's array + to [configs/providers.ts](./gui/src/pages/AddNewModel/configs/providers.ts) (add provider if needed) +- LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the + translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these + providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), + and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists + here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models). +- [Prompt Templates](./core/llm/autodetect.ts) - In this file you'll find the `autodetectTemplateType` function. Make + sure that for the model name you just added, this function returns the correct template type. This is assuming that + the chat template for that model is already built in Continue. If not, you will have to add the template type and + corresponding edit and chat templates. + +## Contributor License Agreement (CLA) + +We require all contributors to accept the CLA and have made it as easy as commenting on your PR: + +1. Open your pull request. +2. Paste the following comment (or reply `recheck` if you’ve signed before): + + ```text + I have read the CLA Document and I hereby sign the CLA + ``` + +3. The CLA‑Assistant bot records your signature in the repo and marks the status check as passed. \ No newline at end of file diff --git a/binary/build.js b/binary/build.js index 574a90444..b67afb94f 100644 --- a/binary/build.js +++ b/binary/build.js @@ -64,7 +64,7 @@ async function buildWithEsbuild() { format: "cjs", platform: "node", sourcemap: true, - minify: true, + minify: !esbuildOnly, treeShaking: true, loader: { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/binary/package-lock.json b/binary/package-lock.json index b2b1c8d41..acb5b9fea 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -33,6 +33,7 @@ "@types/jest": "^29.5.12", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", + "cross-env": "^7.0.3", "esbuild": "0.19.11", "jest": "^29.7.0", "pkg": "^5.8.1", @@ -3196,6 +3197,25 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", diff --git a/binary/package.json b/binary/package.json index a9926e8f5..0e8949aa6 100644 --- a/binary/package.json +++ b/binary/package.json @@ -33,6 +33,7 @@ "@types/jest": "^29.5.12", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", + "cross-env": "^7.0.3", "esbuild": "0.19.11", "jest": "^29.7.0", "pkg": "^5.8.1", diff --git a/core/autocomplete/templating/AutocompleteTemplate.ts b/core/autocomplete/templating/AutocompleteTemplate.ts index 6385fa22b..39c653792 100644 --- a/core/autocomplete/templating/AutocompleteTemplate.ts +++ b/core/autocomplete/templating/AutocompleteTemplate.ts @@ -71,6 +71,21 @@ const qwenCoderFimTemplate: AutocompleteTemplate = { }, }; +const seedCoderFimTemplate: AutocompleteTemplate = { + template: "<[fim-prefix]>{{{prefix}}}<[fim-suffix]>{{{suffix}}}<[fim-middle]>", + completionOptions: { + stop: [ + "<[end▁of▁sentence]>", + "<[fim-prefix]>", + "<[fim-middle]>", + "<[fim-suffix]>", + "<[PAD▁TOKEN]>", + "<[SEP▁TOKEN]>", + "<[begin▁of▁sentence]>", + ], + }, +}; + const codestralFimTemplate: AutocompleteTemplate = { template: "[SUFFIX]{{{suffix}}}[PREFIX]{{{prefix}}}", completionOptions: { @@ -426,6 +441,10 @@ export function getTemplateForModel(model: string): AutocompleteTemplate { return qwenCoderFimTemplate; } + if (lowerCaseModel.includes("seed") && lowerCaseModel.includes("coder")) { + return seedCoderFimTemplate; + } + if ( lowerCaseModel.includes("starcoder") || lowerCaseModel.includes("star-coder") || diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index a1588dd43..76ccceb81 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -255,7 +255,7 @@ export class ConfigHandler { if (currentProfile) { this.globalContext.update("lastSelectedProfileForWorkspace", { ...selectedProfiles, - [profileKey]: selectedProfiles.id ?? null, + [profileKey]: currentProfile.profileDescription.id, }); } diff --git a/core/index.d.ts b/core/index.d.ts index 7cd734c16..71c5ae957 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -197,15 +197,14 @@ export interface CustomContextProvider { description?: string; renderInlineAs?: string; type?: ContextProviderType; + loadSubmenuItems?: ( + args: LoadSubmenuItemsArgs, + ) => Promise; getContextItems( query: string, extras: ContextProviderExtras, ): Promise; - - loadSubmenuItems?: ( - args: LoadSubmenuItemsArgs, - ) => Promise; } export interface ContextSubmenuItem { @@ -459,6 +458,7 @@ export interface ChatHistoryItem { toolCallState?: ToolCallState; isGatheringContext?: boolean; reasoning?: Reasoning; + appliedRules?: RuleWithSource[]; } export interface LLMFullCompletionOptions extends BaseCompletionOptions { @@ -1168,6 +1168,7 @@ export interface MCPResource { description?: string; mimeType?: string; } + export interface MCPTool { name: string; description?: string; @@ -1230,6 +1231,27 @@ export interface ApplyState { toolCallId?: string; } +export interface StreamDiffLinesPayload { + prefix: string; + highlighted: string; + suffix: string; + input: string; + language: string | undefined; + modelTitle: string | undefined; + includeRulesInSystemMessage: boolean; +} + +export interface HighlightedCodePayload { + rangeInFileWithContents: RangeInFileWithContents; + prompt?: string; + shouldRun?: boolean; +} + +export interface AcceptOrRejectDiffPayload { + filepath: string; + streamId?: string; +} + export interface RangeInFileWithContents { filepath: string; range: { @@ -1239,7 +1261,7 @@ export interface RangeInFileWithContents { contents: string; } -export type CodeToEdit = RangeInFileWithContents | FileWithContents; +export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents; /** * Represents the configuration for a quick action in the Code Lens. @@ -1498,17 +1520,19 @@ export interface TerminalOptions { waitForCompletion?: boolean; } +export type RuleSource = + | "default-chat" + | "default-agent" + | "model-chat-options" + | "model-agent-options" + | "rules-block" + | "json-systemMessage" + | ".continuerules"; + export interface RuleWithSource { name?: string; slug?: string; - source: - | "default-chat" - | "default-agent" - | "model-chat-options" - | "model-agent-options" - | "rules-block" - | "json-systemMessage" - | ".continuerules"; + source: RuleSource; globs?: string | string[]; rule: string; description?: string; diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 9a2da5008..bf79b093e 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -7,7 +7,7 @@ import { getQueryForFile, } from "../util/treeSitter"; -import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; import { IndexResultType, MarkCompleteCallback, @@ -29,6 +29,7 @@ import { getLastNUriRelativePathParts, getUriPathBasename, } from "../util/uri"; +import { tagToString } from "./utils"; type SnippetChunk = ChunkWithoutID & { title: string; signature: string }; diff --git a/core/indexing/FullTextSearchCodebaseIndex.ts b/core/indexing/FullTextSearchCodebaseIndex.ts index de183e158..1bac74e4a 100644 --- a/core/indexing/FullTextSearchCodebaseIndex.ts +++ b/core/indexing/FullTextSearchCodebaseIndex.ts @@ -3,13 +3,14 @@ import { RETRIEVAL_PARAMS } from "../util/parameters"; import { getUriPathBasename } from "../util/uri"; import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex"; -import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; import { IndexResultType, MarkCompleteCallback, RefreshIndexResults, type CodebaseIndex, } from "./types"; +import { tagToString } from "./utils"; export interface RetrieveConfig { tags: BranchAndDir[]; @@ -97,11 +98,14 @@ export class FullTextSearchCodebaseIndex implements CodebaseIndex { // Delete for (const item of results.del) { - await db.run(` + await db.run( + ` DELETE FROM fts WHERE rowid IN ( SELECT id FROM fts_metadata WHERE path = ? AND cacheKey = ? ) - `,[item.path, item.cacheKey]); + `, + [item.path, item.cacheKey], + ); await db.run("DELETE FROM fts_metadata WHERE path = ? AND cacheKey = ?", [ item.path, item.cacheKey, diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 3bf9a645d..cf41beaca 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -14,7 +14,7 @@ import { getUriPathBasename } from "../util/uri"; import { basicChunker } from "./chunk/basic.js"; import { chunkDocument, shouldChunk } from "./chunk/chunk.js"; -import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex.js"; import { CodebaseIndex, IndexResultType, @@ -24,6 +24,7 @@ import { } from "./types"; import type * as LanceType from "vectordb"; +import { tagToString } from "./utils"; interface LanceDbRow { uuid: string; diff --git a/core/indexing/chunk/ChunkCodebaseIndex.ts b/core/indexing/chunk/ChunkCodebaseIndex.ts index 9b39e506a..412ff7480 100644 --- a/core/indexing/chunk/ChunkCodebaseIndex.ts +++ b/core/indexing/chunk/ChunkCodebaseIndex.ts @@ -4,7 +4,7 @@ import { RunResult } from "sqlite3"; import { IContinueServerClient } from "../../continueServer/interface.js"; import { Chunk, IndexTag, IndexingProgressUpdate } from "../../index.js"; -import { DatabaseConnection, SqliteDb, tagToString } from "../refreshIndex.js"; +import { DatabaseConnection, SqliteDb } from "../refreshIndex.js"; import { IndexResultType, MarkCompleteCallback, @@ -13,8 +13,9 @@ import { type CodebaseIndex, } from "../types.js"; -import { chunkDocument, shouldChunk } from "./chunk.js"; import { getUriPathBasename } from "../../util/uri.js"; +import { tagToString } from "../utils.js"; +import { chunkDocument, shouldChunk } from "./chunk.js"; export class ChunkCodebaseIndex implements CodebaseIndex { relativeExpectedTime: number = 1; diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index f76c6a7f6..ec84f631b 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -18,10 +18,6 @@ import { export type DatabaseConnection = Database; -export function tagToString(tag: IndexTag): string { - return `${tag.directory}::${tag.branch}::${tag.artifactId}`; -} - export class SqliteDb { static db: DatabaseConnection | null = null; diff --git a/core/indexing/test/indexing.ts b/core/indexing/test/indexing.ts index 5f22d0aeb..b90f52564 100644 --- a/core/indexing/test/indexing.ts +++ b/core/indexing/test/indexing.ts @@ -3,11 +3,11 @@ import { jest } from "@jest/globals"; import { IndexTag } from "../.."; import { IContinueServerClient } from "../../continueServer/interface"; import { ChunkCodebaseIndex } from "../chunk/ChunkCodebaseIndex"; -import { tagToString } from "../refreshIndex"; import { CodebaseIndex, RefreshIndexResults } from "../types"; import { testIde } from "../../test/fixtures"; import { addToTestDir, TEST_DIR } from "../../test/testDir"; +import { tagToString } from "../utils"; export const mockFilename = "test.py"; export const mockPathAndCacheKey = { diff --git a/core/indexing/utils.test.ts b/core/indexing/utils.test.ts new file mode 100644 index 000000000..f432da023 --- /dev/null +++ b/core/indexing/utils.test.ts @@ -0,0 +1,58 @@ +import { IndexTag } from ".."; +import { tagToString } from "./utils"; + +test("tagToString returns full tag string when under length limit", () => { + const tag: IndexTag = { + directory: "/normal/path/to/repo", + branch: "main", + artifactId: "12345", + }; + + expect(tagToString(tag)).toBe("/normal/path/to/repo::main::12345"); +}); + +test("tagToString truncates beginning of directory when path is too long", () => { + // Create a very long directory path that exceeds MAX_DIR_LENGTH (200) + const longPrefix = "/very/long/path/that/will/be/truncated/"; + const importantSuffix = "/user/important-project/src/feature"; + const longPath = longPrefix + "x".repeat(200) + importantSuffix; + + const tag: IndexTag = { + directory: longPath, + branch: "feature-branch", + artifactId: "67890", + }; + + const result = tagToString(tag); + + // The result should keep the important suffix part + expect(result).toContain(importantSuffix); + // The result should NOT contain the beginning of the path + expect(result).not.toContain(longPrefix); + // The result should include the branch and artifactId + expect(result).toContain("::feature-branch::67890"); + // The result should be within the MAX_TABLE_NAME_LENGTH limit (240) + expect(result.length).toBeLessThanOrEqual(240); +}); + +test("tagToString preserves branch and artifactId exactly, even when truncating", () => { + const longPath = "/a".repeat(300); // Much longer than MAX_DIR_LENGTH + const tag: IndexTag = { + directory: longPath, + branch: "release-v2.0", + artifactId: "build-123", + }; + + const result = tagToString(tag); + + // Should contain the exact branch and artifactId + expect(result).toContain("::release-v2.0::build-123"); + // Should contain the end of the path + expect(result).toContain("/a/a/a"); + // Should not contain the full original path (it should be truncated) + expect(result.length).toBeLessThan( + longPath.length + "::release-v2.0::build-123".length, + ); + // The result should be within the MAX_TABLE_NAME_LENGTH limit + expect(result.length).toBeLessThanOrEqual(240); +}); diff --git a/core/indexing/utils.ts b/core/indexing/utils.ts new file mode 100644 index 000000000..0713507f0 --- /dev/null +++ b/core/indexing/utils.ts @@ -0,0 +1,45 @@ +import { IndexTag } from ".."; + +// Maximum length for table names to stay under OS filename limits +const MAX_TABLE_NAME_LENGTH = 240; + +// Leave room for branch and artifactId +const MAX_DIR_LENGTH = 200; + +/** + * Converts an IndexTag to a string representation, safely handling long paths. + * + * The string is used as a table name and identifier in various places, so it needs + * to stay under OS filename length limits (typically 255 chars). This is especially + * important for dev containers where the directory path can be very long due to + * containing container configuration. + * + * The format is: "{directory}::{branch}::{artifactId}" + * + * To handle long paths: + * 1. First tries the full string - most backwards compatible + * 2. If too long, truncates directory from the beginning to maintain uniqueness + * (since final parts of paths are more unique than prefixes) + * 3. Finally ensures entire string stays under MAX_TABLE_NAME_LENGTH for OS compatibility + * + * @param tag The tag containing directory, branch, and artifactId + * @returns A string representation safe for use as a table name + */ +export function tagToString(tag: IndexTag): string { + const result = `${tag.directory}::${tag.branch}::${tag.artifactId}`; + + if (result.length <= MAX_TABLE_NAME_LENGTH) { + return result; + } + + // Truncate from the beginning of directory path to preserve the more unique end parts + const dir = + tag.directory.length > MAX_DIR_LENGTH + ? tag.directory.slice(tag.directory.length - MAX_DIR_LENGTH) + : tag.directory; + + return `${dir}::${tag.branch}::${tag.artifactId}`.slice( + 0, + MAX_TABLE_NAME_LENGTH, + ); +} diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index d1067a8bc..7fb840d61 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -230,6 +230,7 @@ describe("LLM", () => { testFim: true, skip: false, testToolCall: true, + timeout: 60000, }, ); testLLM( diff --git a/core/llm/rules/getSystemMessageWithRules.ts b/core/llm/rules/getSystemMessageWithRules.ts index dacd941bb..3d7372fef 100644 --- a/core/llm/rules/getSystemMessageWithRules.ts +++ b/core/llm/rules/getSystemMessageWithRules.ts @@ -23,6 +23,29 @@ const matchesGlobs = ( return false; }; +/** + * Filters rules that apply to the given message + */ +export const getApplicableRules = ( + userMessage: UserChatMessage | ToolResultChatMessage | undefined, + rules: RuleWithSource[], +): RuleWithSource[] => { + const filePathsFromMessage = userMessage + ? extractPathsFromCodeBlocks(renderChatMessage(userMessage)) + : []; + + return rules.filter((rule) => { + // A rule is active if it has no globs (applies to all files) + // or if at least one file path matches its globs + const hasNoGlobs = !rule.globs; + const matchesAnyFilePath = filePathsFromMessage.some((path) => + matchesGlobs(path, rule.globs), + ); + + return hasNoGlobs || matchesAnyFilePath; + }); +}; + export const getSystemMessageWithRules = ({ baseSystemMessage, userMessage, @@ -32,23 +55,11 @@ export const getSystemMessageWithRules = ({ userMessage: UserChatMessage | ToolResultChatMessage | undefined; rules: RuleWithSource[]; }) => { - const filePathsFromMessage = userMessage - ? extractPathsFromCodeBlocks(renderChatMessage(userMessage)) - : []; - + const applicableRules = getApplicableRules(userMessage, rules); let systemMessage = baseSystemMessage ?? ""; - for (const rule of rules) { - // A rule is active if it has no globs (applies to all files) - // or if at least one file path matches its globs - const hasNoGlobs = !rule.globs; - const matchesAnyFilePath = filePathsFromMessage.some((path) => - matchesGlobs(path, rule.globs), - ); - - if (hasNoGlobs || matchesAnyFilePath) { - systemMessage += `\n\n${rule.rule}`; - } + for (const rule of applicableRules) { + systemMessage += `\n\n${rule.rule}`; } return systemMessage; diff --git a/core/llm/templates/edit/gpt.ts b/core/llm/templates/edit/gpt.ts index 4dcc39523..61d23a732 100644 --- a/core/llm/templates/edit/gpt.ts +++ b/core/llm/templates/edit/gpt.ts @@ -64,6 +64,8 @@ export const gptEditPrompt: PromptTemplateFunction = (history, otherData) => { \`\`\` The user's request is: "${otherData.userInput}" + + DO NOT output any natural language, only output the code changes. Here is the rewritten code:`); diff --git a/core/package-lock.json b/core/package-lock.json index 71133e753..ea049ae74 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -15266,9 +15266,9 @@ } }, "node_modules/undici": { - "version": "6.21.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", - "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", + "version": "6.21.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", + "integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", "license": "MIT", "engines": { "node": ">=18.17" diff --git a/core/protocol/core.ts b/core/protocol/core.ts index de061c730..ef4cde60b 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -9,7 +9,7 @@ import { AutocompleteInput } from "../autocomplete/util/types"; import { SharedConfigSchema } from "../config/sharedConfig"; import { GlobalContextModelSelections } from "../util/GlobalContext"; -import type { +import { BrowserSerializedContinueConfig, ChatMessage, ContextItem, @@ -29,6 +29,7 @@ import type { SessionMetadata, SiteIndexingConfig, SlashCommandDescription, + StreamDiffLinesPayload, ToolCall, } from "../"; import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager"; @@ -142,18 +143,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { }, AsyncGenerator, ]; - streamDiffLines: [ - { - prefix: string; - highlighted: string; - suffix: string; - input: string; - language: string | undefined; - modelTitle: string | undefined; - includeRulesInSystemMessage: boolean; - }, - AsyncGenerator, - ]; + streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator]; "chatDescriber/describe": [ { text: string; diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 17c09a348..3c836126a 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -1,11 +1,13 @@ import { ToIdeFromWebviewOrCoreProtocol } from "./ide"; import { ToWebviewFromIdeOrCoreProtocol } from "./webview"; -import type { +import { ApplyState, - CodeToEdit, + SetCodeToEditPayload, + HighlightedCodePayload, MessageContent, RangeInFileWithContents, + AcceptOrRejectDiffPayload, } from "../"; export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { @@ -42,8 +44,8 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { "jetbrains/getColors": [undefined, Record]; "vscode/openMoveRightMarkdown": [undefined, void]; setGitHubAuthToken: [{ token: string }, void]; - acceptDiff: [{ filepath: string; streamId?: string }, void]; - rejectDiff: [{ filepath: string; streamId?: string }, void]; + acceptDiff: [AcceptOrRejectDiffPayload, void]; + rejectDiff: [AcceptOrRejectDiffPayload, void]; "edit/sendPrompt": [ { prompt: MessageContent; @@ -63,15 +65,8 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { focusContinueInput: [undefined, void]; focusContinueInputWithoutClear: [undefined, void]; focusContinueInputWithNewSession: [undefined, void]; - highlightedCode: [ - { - rangeInFileWithContents: RangeInFileWithContents; - prompt?: string; - shouldRun?: boolean; - }, - void, - ]; - setCodeToEdit: [CodeToEdit, void]; + highlightedCode: [HighlightedCodePayload, void]; + setCodeToEdit: [SetCodeToEditPayload, void]; navigateTo: [{ path: string; toggle?: boolean }, void]; addModel: [undefined, void]; diff --git a/core/tools/callTool.ts b/core/tools/callTool.ts index d8eaf4ffd..34501550b 100644 --- a/core/tools/callTool.ts +++ b/core/tools/callTool.ts @@ -29,11 +29,12 @@ async function callHttpTool( }), }); + const data = await response.json(); + if (!response.ok) { - throw new Error(`Failed to call tool: ${url}`); + throw new Error(`Failed to call tool at ${url}:\n${JSON.stringify(data)}`); } - const data = await response.json(); return data.output; } @@ -84,7 +85,7 @@ async function callToolFromUri( }); if (response.isError === true) { - throw new Error(`Failed to call tool: ${toolName}`); + throw new Error(JSON.stringify(response.content)); } const contextItems: ContextItem[] = []; @@ -130,6 +131,37 @@ async function callToolFromUri( } } +async function callBuiltInTool( + functionName: string, + args: any, + extras: ToolExtras, +): Promise { + switch (functionName) { + case BuiltInToolNames.ReadFile: + return await readFileImpl(args, extras); + case BuiltInToolNames.CreateNewFile: + return await createNewFileImpl(args, extras); + case BuiltInToolNames.GrepSearch: + return await grepSearchImpl(args, extras); + case BuiltInToolNames.FileGlobSearch: + return await fileGlobSearchImpl(args, extras); + case BuiltInToolNames.RunTerminalCommand: + return await runTerminalCommandImpl(args, extras); + case BuiltInToolNames.SearchWeb: + return await searchWebImpl(args, extras); + case BuiltInToolNames.ViewDiff: + return await viewDiffImpl(args, extras); + case BuiltInToolNames.LSTool: + return await lsToolImpl(args, extras); + case BuiltInToolNames.ReadCurrentlyOpenFile: + return await readCurrentlyOpenFileImpl(args, extras); + case BuiltInToolNames.CreateRuleBlock: + return await createRuleBlockImpl(args, extras); + default: + throw new Error(`Tool "${functionName}" not found`); + } +} + // Handles calls for core/non-client tools // Returns an error context item if the tool call fails // Note: Edit tool is handled on client @@ -141,44 +173,11 @@ export async function callTool( contextItems: ContextItem[]; errorMessage: string | undefined; }> { - const args = JSON.parse(callArgs || "{}"); - const uri = tool.uri ?? tool.function.name; try { - let contextItems: ContextItem[] = []; - switch (uri) { - case BuiltInToolNames.ReadFile: - contextItems = await readFileImpl(args, extras); - break; - case BuiltInToolNames.CreateNewFile: - contextItems = await createNewFileImpl(args, extras); - break; - case BuiltInToolNames.GrepSearch: - contextItems = await grepSearchImpl(args, extras); - break; - case BuiltInToolNames.FileGlobSearch: - contextItems = await fileGlobSearchImpl(args, extras); - break; - case BuiltInToolNames.RunTerminalCommand: - contextItems = await runTerminalCommandImpl(args, extras); - break; - case BuiltInToolNames.SearchWeb: - contextItems = await searchWebImpl(args, extras); - break; - case BuiltInToolNames.ViewDiff: - contextItems = await viewDiffImpl(args, extras); - break; - case BuiltInToolNames.LSTool: - contextItems = await lsToolImpl(args, extras); - break; - case BuiltInToolNames.ReadCurrentlyOpenFile: - contextItems = await readCurrentlyOpenFileImpl(args, extras); - break; - case BuiltInToolNames.CreateRuleBlock: - contextItems = await createRuleBlockImpl(args, extras); - break; - default: - contextItems = await callToolFromUri(uri, args, extras); - } + const args = JSON.parse(callArgs || "{}"); + const contextItems = tool.uri + ? await callToolFromUri(tool.uri, args, extras) + : await callBuiltInTool(tool.function.name, args, extras); if (tool.faviconUrl) { contextItems.forEach((item) => { item.icon = tool.faviconUrl; diff --git a/docs/docs/CLA.md b/docs/docs/CLA.md new file mode 100644 index 000000000..00cd9ef07 --- /dev/null +++ b/docs/docs/CLA.md @@ -0,0 +1,48 @@ +# Individual Contributor License Agreement (v1.0, Continue) + +_Based on the Apache Software Foundation Individual CLA v 2.2._ + +By commenting **“I have read the CLA Document and I hereby sign the CLA”** +on a Pull Request, **you (“Contributor”) agree to the following terms** for any +past and future “Contributions” submitted to **Continue (the “Project”)**. + +--- + +## 1. Definitions + +- **“Contribution”** – any original work of authorship submitted to the Project + (code, documentation, designs, etc.). +- **“You” / “Your”** – the individual (or legal entity) posting the acceptance + comment. + +## 2. Copyright License + +You grant **Continue Dev, Inc.** and all recipients of software distributed by the +Project a perpetual, worldwide, non‑exclusive, royalty‑free, irrevocable +license to reproduce, prepare derivative works of, publicly display, publicly +perform, sublicense, and distribute Your Contributions and derivative works. + +## 3. Patent License + +You grant **Continue Dev, Inc.** and all recipients of the Project a perpetual, +worldwide, non‑exclusive, royalty‑free, irrevocable (except as below) patent +license to make, have made, use, sell, offer to sell, import, and otherwise +transfer Your Contributions alone or in combination with the Project. + +If any entity brings patent litigation alleging that the Project or a +Contribution infringes a patent, the patent licenses granted by You to that +entity under this CLA terminate. + +## 4. Representations + +1. You are legally entitled to grant the licenses above. +2. Each Contribution is either Your original creation or You have authority to + submit it under this CLA. +3. Your Contributions are provided **“AS IS”** without warranties of any kind. +4. You will notify the Project if any statement above becomes inaccurate. + +## 5. Miscellany + +This Agreement is governed by the laws of the **State of California**, USA, +excluding its conflict‑of‑laws rules. If any provision is held unenforceable, +the remaining provisions remain in force. diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 4d0009d5c..e8b915813 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -206,7 +206,6 @@ chat, editing, and summarizing. - `topP`: The cumulative probability for nucleus sampling. - `topK`: Maximum number of tokens considered at each step. - `stop`: An array of stop tokens that will terminate the completion. - - `n`: Number of completions to generate. - `reasoning`: Boolean to enable thinking/reasoning for Anthropic Claude 3.7+ models. - `reasoningBudgetTokens`: Budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models. - `requestOptions`: HTTP request options specific to the model. diff --git a/docs/docs/troubleshooting.mdx b/docs/docs/troubleshooting.mdx index 71eac9d9b..9692191eb 100644 --- a/docs/docs/troubleshooting.mdx +++ b/docs/docs/troubleshooting.mdx @@ -7,8 +7,6 @@ keywords: [reload, delete, manually, logs, server, console] import TabItem from "@theme/TabItem"; import Tabs from "@theme/Tabs"; -The Continue VS Code extension is currently in beta, and the JetBrains extension is in Alpha. If you are having trouble, please follow the steps below. - 1. [Check the logs](#check-the-logs) 2. [Try the latest pre-release](#download-the-latest-pre-release) 3. [Download an older version](#download-an-older-version) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index c12f063da..030e9980c 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -65,6 +65,10 @@ const config = { ], ], + scripts: [ + '!function(){var e,t,n;e="7aa28ed11570734",t=function(){Reo.init({clientID:"7aa28ed11570734"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.defer=!0,n.onload=t,document.head.appendChild(n)}();', + ], + themeConfig: /** @type {import("@docusaurus/preset-classic").ThemeConfig} */ ({ diff --git a/extensions/intellij/.run/Start Core Dev Server (CE).run.xml b/extensions/intellij/.run/Start Core Dev Server (CE).run.xml index d6c646ef9..53c668ab2 100644 --- a/extensions/intellij/.run/Start Core Dev Server (CE).run.xml +++ b/extensions/intellij/.run/Start Core Dev Server (CE).run.xml @@ -1,6 +1,6 @@ -